1 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 [][] COLOR_STRINGS = new String [][] { 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 buffer = new StringBuffer (); 37 String delimiter = System.getProperty("line.separator"); buffer.append("Manifest-Version: 1.0"); buffer.append(delimiter); 40 buffer.append("Bundle-Name: %name"); buffer.append(delimiter); 42 buffer.append("Bundle-SymbolicName: com.example.xyz"); buffer.append(delimiter); 44 buffer.append("Require-Bundle:"); buffer.append(delimiter); 46 buffer.append(" org.eclipse.core.runtime;bundle-version=\"3.0.0\","); buffer.append(delimiter); 48 buffer.append(" org.eclipse.ui;resolution:=optional"); 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 [][] getColorStrings() { 59 return COLOR_STRINGS; 60 } 61 62 } 63 | Popular Tags |