X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/JavaEditorPreferencePage.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/JavaEditorPreferencePage.java index 261ba23..89a22b3 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/JavaEditorPreferencePage.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/ui/preferences/JavaEditorPreferencePage.java @@ -54,6 +54,7 @@ import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionListener; import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; @@ -91,70 +92,38 @@ public class JavaEditorPreferencePage extends PreferencePage implements IWorkben public final OverlayPreferenceStore.OverlayKey[] fKeys; private final String[][] fSyntaxColorListModel = new String[][] { - // { - // PreferencesMessages.getString("JavaEditorPreferencePage.multiLineComment"), - // PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR }, //$NON-NLS-1$ - // { - // PreferencesMessages.getString("JavaEditorPreferencePage.singleLineComment"), - // PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR }, //$NON-NLS-1$ - // { PreferencesMessages.getString("JavaEditorPreferencePage.keywords"), - // PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR }, //$NON-NLS-1$ - // { PreferencesMessages.getString("JavaEditorPreferencePage.strings"), - // PreferenceConstants.EDITOR_STRING_COLOR }, //$NON-NLS-1$ - // { - // PreferencesMessages.getString("JavaEditorPreferencePage.methodNames"), - // PreferenceConstants.EDITOR_JAVA_METHOD_NAME_COLOR }, //$NON-NLS-1$ - // { PreferencesMessages.getString("JavaEditorPreferencePage.operators"), - // PreferenceConstants.EDITOR_JAVA_OPERATOR_COLOR }, //$NON-NLS-1$ - // { PreferencesMessages.getString("JavaEditorPreferencePage.others"), - // PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR }, //$NON-NLS-1$ - // { - // PreferencesMessages.getString("JavaEditorPreferencePage.javaCommentTaskTags"), - // PreferenceConstants.EDITOR_TASK_TAG_COLOR }, //$NON-NLS-1$ - // { - // PreferencesMessages.getString("JavaEditorPreferencePage.javaDocKeywords"), - // PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR }, //$NON-NLS-1$ - // { - // PreferencesMessages.getString("JavaEditorPreferencePage.javaDocHtmlTags"), - // PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR }, //$NON-NLS-1$ - // { - // PreferencesMessages.getString("JavaEditorPreferencePage.javaDocLinks"), - // PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR }, //$NON-NLS-1$ - // { - // PreferencesMessages.getString("JavaEditorPreferencePage.javaDocOthers"), - // PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR } //$NON-NLS-1$ - { PreferencesMessages.getString("PHPEditorPreferencePage.multiLineComment"), + { PreferencesMessages.getString("JavaEditorPreferencePage.multiLineComment"), PreferenceConstants.EDITOR_MULTI_LINE_COMMENT_COLOR }, //$NON-NLS-1$ - { PreferencesMessages.getString("PHPEditorPreferencePage.singleLineComment"), + { PreferencesMessages.getString("JavaEditorPreferencePage.singleLineComment"), PreferenceConstants.EDITOR_SINGLE_LINE_COMMENT_COLOR }, //$NON-NLS-1$ - { PreferencesMessages.getString("PHPEditorPreferencePage.tags"), PreferenceConstants.EDITOR_PHP_TAG_COLOR }, + { PreferencesMessages.getString("JavaEditorPreferencePage.tags"), PreferenceConstants.EDITOR_PHP_TAG_COLOR }, //$NON-NLS-1$ - { PreferencesMessages.getString("PHPEditorPreferencePage.keywords"), PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR }, - { PreferencesMessages.getString("PHPEditorPreferencePage.functionNames"), PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR }, + { PreferencesMessages.getString("JavaEditorPreferencePage.keywords"), PreferenceConstants.EDITOR_JAVA_KEYWORD_COLOR }, + { PreferencesMessages.getString("JavaEditorPreferencePage.functionNames"), PreferenceConstants.EDITOR_PHP_FUNCTIONNAME_COLOR }, //$NON-NLS-1$ - { PreferencesMessages.getString("PHPEditorPreferencePage.variables"), PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR }, + { PreferencesMessages.getString("JavaEditorPreferencePage.variables"), PreferenceConstants.EDITOR_PHP_VARIABLE_COLOR }, //$NON-NLS-1$ - { PreferencesMessages.getString("PHPEditorPreferencePage.constants"), PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR }, + { PreferencesMessages.getString("JavaEditorPreferencePage.constants"), PreferenceConstants.EDITOR_PHP_CONSTANT_COLOR }, //$NON-NLS-1$ - { PreferencesMessages.getString("PHPEditorPreferencePage.types"), PreferenceConstants.EDITOR_PHP_TYPE_COLOR }, + { PreferencesMessages.getString("JavaEditorPreferencePage.types"), PreferenceConstants.EDITOR_PHP_TYPE_COLOR }, //$NON-NLS-1$ - { PreferencesMessages.getString("PHPEditorPreferencePage.strings"), PreferenceConstants.EDITOR_STRING_COLOR }, + { PreferencesMessages.getString("JavaEditorPreferencePage.strings"), PreferenceConstants.EDITOR_STRING_COLOR }, //$NON-NLS-1$ - { PreferencesMessages.getString("PHPEditorPreferencePage.others"), PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR }, //$NON-NLS-1$ + { PreferencesMessages.getString("JavaEditorPreferencePage.others"), PreferenceConstants.EDITOR_JAVA_DEFAULT_COLOR }, //$NON-NLS-1$ { PreferencesMessages.getString("JavaEditorPreferencePage.operators"), PreferenceConstants.EDITOR_PHP_OPERATOR_COLOR }, //$NON-NLS-1$ { PreferencesMessages.getString("JavaEditorPreferencePage.returnKeyword"), PreferenceConstants.EDITOR_PHP_KEYWORD_RETURN_COLOR }, //$NON-NLS-1$ - { PreferencesMessages.getString("PHPEditorPreferencePage.phpDocKeywords"), PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR }, + { PreferencesMessages.getString("JavaEditorPreferencePage.phpDocKeywords"), PreferenceConstants.EDITOR_JAVADOC_KEYWORD_COLOR }, //$NON-NLS-1$ - { PreferencesMessages.getString("PHPEditorPreferencePage.phpDocHtmlTags"), PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR }, + { PreferencesMessages.getString("JavaEditorPreferencePage.phpDocHtmlTags"), PreferenceConstants.EDITOR_JAVADOC_TAG_COLOR }, //$NON-NLS-1$ - { PreferencesMessages.getString("PHPEditorPreferencePage.phpDocLinks"), PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR }, + { PreferencesMessages.getString("JavaEditorPreferencePage.phpDocLinks"), PreferenceConstants.EDITOR_JAVADOC_LINKS_COLOR }, //$NON-NLS-1$ - { PreferencesMessages.getString("PHPEditorPreferencePage.phpDocOthers"), PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR } //$NON-NLS-1$ + { PreferencesMessages.getString("JavaEditorPreferencePage.phpDocOthers"), PreferenceConstants.EDITOR_JAVADOC_DEFAULT_COLOR } //$NON-NLS-1$ }; private final String[][] fAppearanceColorListModel = new String[][] { @@ -728,16 +697,17 @@ public class JavaEditorPreferencePage extends PreferencePage implements IWorkben new PreferencesAdapter(createTemporaryCorePreferenceStore()), generalTextStore }); fPreviewViewer = new JavaSourceViewer(parent, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER, store); - - fPreviewViewer.configure(new PHPSourceViewerConfiguration(fJavaTextTools, null, IPHPPartitions.PHP_PARTITIONING)); - // Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT); - // fPreviewViewer.getTextWidget().setFont(font); - fPreviewViewer.getTextWidget().setFont(JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT)); - // new JavaSourcePreviewerUpdater(fPreviewViewer, fJavaTextTools); - fPreviewViewer.setEditable(false); + JavaTextTools tools= PHPeclipsePlugin.getDefault().getJavaTextTools(); + PHPSourceViewerConfiguration configuration= new PHPSourceViewerConfiguration(tools.getColorManager(), store, null, IPHPPartitions.PHP_PARTITIONING); +// PHPSourceViewerConfiguration configuration =new PHPSourceViewerConfiguration(fJavaTextTools, null, IPHPPartitions.PHP_PARTITIONING); + fPreviewViewer.configure(configuration); + + Font font= JFaceResources.getFont(PreferenceConstants.EDITOR_TEXT_FONT); + fPreviewViewer.getTextWidget().setFont(font); + new JavaSourcePreviewerUpdater(fPreviewViewer, configuration, store); + fPreviewViewer.setEditable(false); String content = loadPreviewContentFromFile("ColorSettingPreviewCode.txt"); //$NON-NLS-1$ IDocument document = new Document(content); - // fJavaTextTools.setupJavaDocumentPartitioner(document, ".php", null); //IJavaPartitions.JAVA_PARTITIONING); fJavaTextTools.setupJavaDocumentPartitioner(document, IPHPPartitions.PHP_PARTITIONING); fPreviewViewer.setDocument(document); return fPreviewViewer.getControl();