KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > preferences > ManifestSyntaxColorTab


1 /*******************************************************************************
2  * Copyright (c) 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.ui.preferences;
12
13 import org.eclipse.jface.text.Document;
14 import org.eclipse.jface.text.IDocument;
15 import org.eclipse.pde.internal.ui.PDEUIMessages;
16 import org.eclipse.pde.internal.ui.editor.context.ManifestDocumentSetupParticipant;
17 import org.eclipse.pde.internal.ui.editor.text.ChangeAwareSourceViewerConfiguration;
18 import org.eclipse.pde.internal.ui.editor.text.IColorManager;
19 import org.eclipse.pde.internal.ui.editor.text.IPDEColorConstants;
20 import org.eclipse.pde.internal.ui.editor.text.ManifestConfiguration;
21
22 public class ManifestSyntaxColorTab extends SyntaxColorTab {
23
24     private static final String JavaDoc[][] COLOR_STRINGS = new String JavaDoc[][] {
25             {PDEUIMessages.ManifestSyntaxColorTab_reservedOSGi, IPDEColorConstants.P_HEADER_OSGI},
26             {PDEUIMessages.ManifestSyntaxColorTab_keys, IPDEColorConstants.P_HEADER_KEY},
27             {PDEUIMessages.ManifestSyntaxColorTab_assignment, IPDEColorConstants.P_HEADER_ASSIGNMENT},
28             {PDEUIMessages.ManifestSyntaxColorTab_values, IPDEColorConstants.P_HEADER_VALUE},
29             {PDEUIMessages.ManifestSyntaxColorTab_attributes, IPDEColorConstants.P_HEADER_ATTRIBUTES}};
30
31     public ManifestSyntaxColorTab(IColorManager manager) {
32         super(manager);
33     }
34     
35     protected IDocument getDocument() {
36         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
37         String JavaDoc delimiter = System.getProperty("line.separator"); //$NON-NLS-1$
38
buffer.append("Manifest-Version: 1.0"); //$NON-NLS-1$
39
buffer.append(delimiter);
40         buffer.append("Bundle-Name: %name"); //$NON-NLS-1$
41
buffer.append(delimiter);
42         buffer.append("Bundle-SymbolicName: com.example.xyz"); //$NON-NLS-1$
43
buffer.append(delimiter);
44         buffer.append("Require-Bundle:"); //$NON-NLS-1$
45
buffer.append(delimiter);
46         buffer.append(" org.eclipse.core.runtime;bundle-version=\"3.0.0\","); //$NON-NLS-1$
47
buffer.append(delimiter);
48         buffer.append(" org.eclipse.ui;resolution:=optional"); //$NON-NLS-1$
49
IDocument document = new Document(buffer.toString());
50         new ManifestDocumentSetupParticipant().setup(document);
51         return document;
52     }
53
54     protected ChangeAwareSourceViewerConfiguration getSourceViewerConfiguration() {
55         return new ManifestConfiguration(fColorManager);
56     }
57
58     protected String JavaDoc[][] getColorStrings() {
59         return COLOR_STRINGS;
60     }
61
62 }
63
Popular Tags