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.XMLDocumentSetupParticpant; 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.XMLConfiguration; 21 22 public class XMLSyntaxColorTab extends SyntaxColorTab { 23 24 private static final String [][] COLOR_STRINGS = new String [][] { 25 26 {PDEUIMessages.EditorPreferencePage_text, IPDEColorConstants.P_DEFAULT}, 27 {PDEUIMessages.EditorPreferencePage_proc, IPDEColorConstants.P_PROC_INSTR}, 28 {PDEUIMessages.EditorPreferencePage_tag, IPDEColorConstants.P_TAG}, 29 {PDEUIMessages.EditorPreferencePage_string, IPDEColorConstants.P_STRING}, 30 {PDEUIMessages.EditorPreferencePage_comment, IPDEColorConstants.P_XML_COMMENT}}; 31 32 public XMLSyntaxColorTab(IColorManager manager) { 33 super(manager); 34 } 35 36 protected IDocument getDocument() { 37 StringBuffer buffer = new StringBuffer (); 38 String delimiter = System.getProperty("line.separator"); buffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); buffer.append(delimiter); 41 buffer.append("<plugin>"); buffer.append(delimiter); 43 buffer.append("<!-- Comment -->"); buffer.append(delimiter); 45 buffer.append(" <extension point=\"some.id\">"); buffer.append(delimiter); 47 buffer.append(" <tag> body text </tag>"); buffer.append(delimiter); 49 buffer.append(" </extension>"); buffer.append(delimiter); 51 buffer.append("</plugin>"); 53 IDocument document = new Document(buffer.toString()); 54 new XMLDocumentSetupParticpant().setup(document); 55 return document; 56 } 57 58 protected ChangeAwareSourceViewerConfiguration getSourceViewerConfiguration() { 59 return new XMLConfiguration(fColorManager); 60 } 61 62 protected String [][] getColorStrings() { 63 return COLOR_STRINGS; 64 } 65 } 66 | Popular Tags |