ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r987418 - in /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse: ./ src/java/org/apache/ivyde/eclipse/ src/java/org/apache/ivyde/eclipse/ui/editors/xml/ src/java/org/apache/ivyde/eclipse/ui/preferences/
Date Fri, 20 Aug 2010 09:08:30 GMT
Author: hibou
Date: Fri Aug 20 09:08:29 2010
New Revision: 987418

URL: http://svn.apache.org/viewvc?rev=987418&view=rev
Log:
IVYDE-73: add the UI to manage the color in the XML editor

Added:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/XMLEditorPreferencesPage.java
  (with props)
Modified:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/plugin.xml
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/ColorManager.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLConfiguration.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLEditor.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLScanner.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLTagScanner.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/plugin.xml
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/plugin.xml?rev=987418&r1=987417&r2=987418&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/plugin.xml (original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/plugin.xml Fri Aug 20 09:08:29 2010
@@ -203,6 +203,12 @@
             id="org.apache.ivyde.eclipse.ui.preferences.WorkspaceResolverPreferencePage"
             category="org.apache.ivyde.eclipse.ui.preferences.IvyPreferencePage">
       </page>
+      <page
+            category="org.apache.ivyde.eclipse.ui.preferences.IvyPreferencePage"
+            class="org.apache.ivyde.eclipse.ui.preferences.XMLEditorPreferencesPage"
+            id="org.apache.ivyde.eclipse.ui.preferences.XMLEditorPreferencesPage"
+            name="XML Editor">
+      </page>
    </extension>
    <extension
          point="org.eclipse.core.runtime.preferences">

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java?rev=987418&r1=987417&r2=987418&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/IvyPlugin.java
Fri Aug 20 09:08:29 2010
@@ -30,6 +30,7 @@ import org.apache.ivyde.eclipse.cpcontai
 import org.apache.ivyde.eclipse.cpcontainer.fragmentinfo.IPackageFragmentExtraInfo;
 import org.apache.ivyde.eclipse.cpcontainer.fragmentinfo.PreferenceStoreInfo;
 import org.apache.ivyde.eclipse.ui.console.IvyConsole;
+import org.apache.ivyde.eclipse.ui.editors.xml.ColorManager;
 import org.apache.ivyde.eclipse.ui.preferences.IvyDEPreferenceStoreHelper;
 import org.apache.ivyde.eclipse.ui.preferences.PreferenceConstants;
 import org.apache.ivyde.eclipse.workspaceresolver.WorkspaceResourceChangeListener;
@@ -81,6 +82,8 @@ public class IvyPlugin extends AbstractU
 
     private BundleContext bundleContext;
 
+    private ColorManager colorManager;
+
     /**
      * The constructor.
      */
@@ -97,6 +100,8 @@ public class IvyPlugin extends AbstractU
         this.bundleContext = context;
         log(IStatus.INFO, "starting IvyDE plugin", null);
         javaModel = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
+        colorManager = new ColorManager();
+        colorManager.refreshFromStore(getPreferenceStore());
         prefStoreHelper = new IvyDEPreferenceStoreHelper(getPreferenceStore());
         getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() {
             public void propertyChange(PropertyChangeEvent event) {
@@ -149,6 +154,7 @@ public class IvyPlugin extends AbstractU
         super.stop(context);
         plugin = null;
         resourceBundle = null;
+        colorManager = null;
         // if (console != null)
         // console.shutdown();
     }
@@ -329,4 +335,8 @@ public class IvyPlugin extends AbstractU
     public BundleContext getBundleContext() {
         return this.bundleContext;
     }
+
+    public ColorManager getColorManager() {
+        return colorManager;
+    }
 }

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/ColorManager.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/ColorManager.java?rev=987418&r1=987417&r2=987418&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/ColorManager.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/ColorManager.java
Fri Aug 20 09:08:29 2010
@@ -21,27 +21,89 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.ivyde.eclipse.ui.preferences.PreferenceConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.RGB;
 import org.eclipse.swt.widgets.Display;
 
 public class ColorManager {
 
-    private Map fColorTable = new HashMap();
+    protected Map fKeyTable = new HashMap();
 
-    public void dispose() {
-        Iterator e = fColorTable.values().iterator();
-        while (e.hasNext()) {
-            ((Color) e.next()).dispose();
+    protected Map fDisplayTable = new HashMap();
+
+    public void dispose(Display display) {
+        Map colorTable = (Map) fDisplayTable.get(display);
+        if (colorTable != null) {
+            Iterator e = colorTable.values().iterator();
+            while (e.hasNext()) {
+                Color color = (Color) e.next();
+                if (color != null && !color.isDisposed()) {
+                    color.dispose();
+                }
+            }
         }
     }
 
     public Color getColor(RGB rgb) {
-        Color color = (Color) fColorTable.get(rgb);
+        if (rgb == null) {
+            return null;
+        }
+
+        final Display display = Display.getCurrent();
+        Map colorTable = (Map) fDisplayTable.get(display);
+        if (colorTable == null) {
+            colorTable = new HashMap(10);
+            fDisplayTable.put(display, colorTable);
+            display.disposeExec(new Runnable() {
+                public void run() {
+                    dispose(display);
+                }
+            });
+        }
+
+        Color color = (Color) colorTable.get(rgb);
         if (color == null) {
             color = new Color(Display.getCurrent(), rgb);
-            fColorTable.put(rgb, color);
+            colorTable.put(rgb, color);
         }
+
         return color;
     }
+
+    public Color getColor(String key) {
+        if (key == null) {
+            return null;
+        }
+        RGB rgb = (RGB) fKeyTable.get(key);
+        return getColor(rgb);
+    }
+
+    public void bindColor(String key, RGB rgb) {
+        Object value = fKeyTable.get(key);
+        if (value != null) {
+            throw new UnsupportedOperationException();
+        }
+
+        fKeyTable.put(key, rgb);
+    }
+
+    public void unbindColor(String key) {
+        fKeyTable.remove(key);
+    }
+
+    public void refreshFromStore(IPreferenceStore store) {
+        rebind(store, PreferenceConstants.EDITOR_COLOR_XML_COMMENT);
+        rebind(store, PreferenceConstants.EDITOR_COLOR_PROC_INSTR);
+        rebind(store, PreferenceConstants.EDITOR_COLOR_STRING);
+        rebind(store, PreferenceConstants.EDITOR_COLOR_DEFAULT);
+        rebind(store, PreferenceConstants.EDITOR_COLOR_TAG);
+    }
+
+    private void rebind(IPreferenceStore store, String colorId) {
+        unbindColor(colorId);
+        bindColor(colorId, PreferenceConverter.getColor(store, colorId));
+    }
 }

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLConfiguration.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLConfiguration.java?rev=987418&r1=987417&r2=987418&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLConfiguration.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLConfiguration.java
Fri Aug 20 09:08:29 2010
@@ -17,6 +17,7 @@
  */
 package org.apache.ivyde.eclipse.ui.editors.xml;
 
+import org.apache.ivyde.eclipse.ui.preferences.PreferenceConstants;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.jface.text.DefaultInformationControl;
@@ -72,7 +73,7 @@ public class XMLConfiguration extends So
         if (scanner == null) {
             scanner = new XMLScanner(colorManager);
             scanner.setDefaultReturnToken(new Token(new TextAttribute(colorManager
-                    .getColor(IXMLColorConstants.DEFAULT))));
+                    .getColor(PreferenceConstants.EDITOR_COLOR_DEFAULT))));
         }
         return scanner;
     }
@@ -81,7 +82,7 @@ public class XMLConfiguration extends So
         if (tagScanner == null) {
             tagScanner = new XMLTagScanner(colorManager);
             tagScanner.setDefaultReturnToken(new Token(new TextAttribute(colorManager
-                    .getColor(IXMLColorConstants.TAG))));
+                    .getColor(PreferenceConstants.EDITOR_COLOR_TAG))));
         }
         return tagScanner;
     }
@@ -98,7 +99,7 @@ public class XMLConfiguration extends So
         reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
 
         NonRuleBasedDamagerRepairer ndr = new NonRuleBasedDamagerRepairer(new TextAttribute(
-                colorManager.getColor(IXMLColorConstants.XML_COMMENT)));
+                colorManager.getColor(PreferenceConstants.EDITOR_COLOR_XML_COMMENT)));
         reconciler.setDamager(ndr, XMLPartitionScanner.XML_COMMENT);
         reconciler.setRepairer(ndr, XMLPartitionScanner.XML_COMMENT);
 

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLEditor.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLEditor.java?rev=987418&r1=987417&r2=987418&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLEditor.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLEditor.java
Fri Aug 20 09:08:29 2010
@@ -31,16 +31,10 @@ public class XMLEditor extends TextEdito
 
     public XMLEditor(IvyContentAssistProcessor processor) {
         super();
-        colorManager = new ColorManager();
+        colorManager = IvyPlugin.getDefault().getColorManager();
         configuration = new XMLConfiguration(colorManager, processor);
         setSourceViewerConfiguration(configuration);
         setDocumentProvider(new XMLDocumentProvider());
-
-    }
-
-    public void dispose() {
-        colorManager.dispose();
-        super.dispose();
     }
 
     private static final String CONTENTASSIST_PROPOSAL_ID

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLScanner.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLScanner.java?rev=987418&r1=987417&r2=987418&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLScanner.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLScanner.java
Fri Aug 20 09:08:29 2010
@@ -17,6 +17,7 @@
  */
 package org.apache.ivyde.eclipse.ui.editors.xml;
 
+import org.apache.ivyde.eclipse.ui.preferences.PreferenceConstants;
 import org.eclipse.jface.text.TextAttribute;
 import org.eclipse.jface.text.rules.IRule;
 import org.eclipse.jface.text.rules.IToken;
@@ -29,7 +30,7 @@ public class XMLScanner extends RuleBase
 
     public XMLScanner(ColorManager manager) {
         IToken procInstr = new Token(new TextAttribute(manager
-                .getColor(IXMLColorConstants.PROC_INSTR)));
+                .getColor(PreferenceConstants.EDITOR_COLOR_PROC_INSTR)));
 
         IRule[] rules = new IRule[2];
         // Add rule for processing instructions

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLTagScanner.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLTagScanner.java?rev=987418&r1=987417&r2=987418&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLTagScanner.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/editors/xml/XMLTagScanner.java
Fri Aug 20 09:08:29 2010
@@ -17,6 +17,7 @@
  */
 package org.apache.ivyde.eclipse.ui.editors.xml;
 
+import org.apache.ivyde.eclipse.ui.preferences.PreferenceConstants;
 import org.eclipse.jface.text.TextAttribute;
 import org.eclipse.jface.text.rules.IRule;
 import org.eclipse.jface.text.rules.IToken;
@@ -28,7 +29,7 @@ import org.eclipse.jface.text.rules.Whit
 public class XMLTagScanner extends RuleBasedScanner {
 
     public XMLTagScanner(ColorManager manager) {
-        IToken string = new Token(new TextAttribute(manager.getColor(IXMLColorConstants.STRING)));
+        IToken string = new Token(new TextAttribute(manager.getColor(PreferenceConstants.EDITOR_COLOR_STRING)));
 
         // CheckStyle:MagicNumber| OFF
         IRule[] rules = new IRule[3];

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java?rev=987418&r1=987417&r2=987418&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/IvyDEPreferenceStoreHelper.java
Fri Aug 20 09:08:29 2010
@@ -22,6 +22,8 @@ import org.apache.ivyde.eclipse.cpcontai
 import org.apache.ivyde.eclipse.cpcontainer.IvySettingsSetup;
 import org.apache.ivyde.eclipse.cpcontainer.RetrieveSetup;
 import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.swt.graphics.RGB;
 
 public class IvyDEPreferenceStoreHelper {
 
@@ -199,4 +201,44 @@ public class IvyDEPreferenceStoreHelper 
         prefStore.setValue(PreferenceConstants.IGNORE_VERSION_ON_WORKSPACE_PROJECTS,
             ignoreVersionOnWorkspaceProjects);
     }
+
+    public RGB getEditorColorXmlComment() {
+        return PreferenceConverter.getColor(prefStore, PreferenceConstants.EDITOR_COLOR_XML_COMMENT);
+    }
+
+    public void setEditorColorXmlComment(RGB color) {
+        PreferenceConverter.setValue(prefStore, PreferenceConstants.EDITOR_COLOR_XML_COMMENT,
color);
+    }
+
+    public RGB getEditorColorProcInst() {
+        return PreferenceConverter.getColor(prefStore, PreferenceConstants.EDITOR_COLOR_PROC_INSTR);
+    }
+
+    public void setEditorColorProcInst(RGB color) {
+        PreferenceConverter.setValue(prefStore, PreferenceConstants.EDITOR_COLOR_PROC_INSTR,
color);
+    }
+
+    public RGB getEditorColorString() {
+        return PreferenceConverter.getColor(prefStore, PreferenceConstants.EDITOR_COLOR_STRING);
+    }
+
+    public void setEditorColorString(RGB color) {
+        PreferenceConverter.setValue(prefStore, PreferenceConstants.EDITOR_COLOR_STRING,
color);
+    }
+
+    public RGB getEditorColorDefault() {
+        return PreferenceConverter.getColor(prefStore, PreferenceConstants.EDITOR_COLOR_DEFAULT);
+    }
+
+    public void setEditorColorDefault(RGB color) {
+        PreferenceConverter.setValue(prefStore, PreferenceConstants.EDITOR_COLOR_DEFAULT,
color);
+    }
+
+    public RGB getEditorColorTag() {
+        return PreferenceConverter.getColor(prefStore, PreferenceConstants.EDITOR_COLOR_TAG);
+    }
+
+    public void setEditorColorTag(RGB color) {
+        PreferenceConverter.setValue(prefStore, PreferenceConstants.EDITOR_COLOR_TAG, color);
+    }
 }

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java?rev=987418&r1=987417&r2=987418&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceConstants.java
Fri Aug 20 09:08:29 2010
@@ -84,4 +84,15 @@ public final class PreferenceConstants {
 
     public static final String IGNORE_VERSION_ON_WORKSPACE_PROJECTS
         = "workspaceResolver.ignoreVersion";
+
+    public static final String EDITOR_COLOR_XML_COMMENT = "editor.color.xmlComment";
+
+    public static final String EDITOR_COLOR_PROC_INSTR = "editor.color.procInstr";
+
+    public static final String EDITOR_COLOR_STRING = "editor.color.string";
+
+    public static final String EDITOR_COLOR_DEFAULT = "editor.color.default";
+
+    public static final String EDITOR_COLOR_TAG = "editor.color.tag";
+
 }

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java?rev=987418&r1=987417&r2=987418&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/PreferenceInitializer.java
Fri Aug 20 09:08:29 2010
@@ -23,8 +23,10 @@ import org.apache.ivyde.eclipse.cpcontai
 import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
 import org.apache.ivyde.eclipse.cpcontainer.IvySettingsSetup;
 import org.apache.ivyde.eclipse.cpcontainer.RetrieveSetup;
+import org.apache.ivyde.eclipse.ui.editors.xml.IXMLColorConstants;
 import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
 import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferenceConverter;
 
 /**
  * Class used to initialize default preference values.
@@ -167,6 +169,17 @@ public class PreferenceInitializer exten
 
         store.setDefault(PreferenceConstants.IGNORE_VERSION_ON_WORKSPACE_PROJECTS,
             DEFAULT_IGNORE_VERSION_ON_WORKSPACE_PROJECTS);
+
+        PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_COLOR_XML_COMMENT,
+            IXMLColorConstants.XML_COMMENT);
+        PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_COLOR_PROC_INSTR,
+            IXMLColorConstants.PROC_INSTR);
+        PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_COLOR_STRING,
+            IXMLColorConstants.STRING);
+        PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_COLOR_DEFAULT,
+            IXMLColorConstants.DEFAULT);
+        PreferenceConverter.setDefault(store, PreferenceConstants.EDITOR_COLOR_TAG,
+            IXMLColorConstants.TAG);
     }
 
 }

Added: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/XMLEditorPreferencesPage.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/XMLEditorPreferencesPage.java?rev=987418&view=auto
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/XMLEditorPreferencesPage.java
(added)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/XMLEditorPreferencesPage.java
Fri Aug 20 09:08:29 2010
@@ -0,0 +1,68 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.ivyde.eclipse.ui.preferences;
+
+import org.apache.ivyde.eclipse.IvyPlugin;
+import org.apache.ivyde.eclipse.ui.editors.xml.ColorManager;
+import org.eclipse.jface.preference.ColorFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+public class XMLEditorPreferencesPage extends FieldEditorPreferencePage implements
+        IWorkbenchPreferencePage {
+
+    public XMLEditorPreferencesPage() {
+        super(GRID);
+        setPreferenceStore(IvyPlugin.getDefault().getPreferenceStore());
+        setDescription("");
+    }
+
+    public void createFieldEditors() {
+        final Composite fieldParent = getFieldEditorParent();
+
+        addField(new ColorFieldEditor(PreferenceConstants.EDITOR_COLOR_XML_COMMENT, "XML
comment",
+                fieldParent));
+
+        addField(new ColorFieldEditor(PreferenceConstants.EDITOR_COLOR_PROC_INSTR,
+                "Processing instrcution", fieldParent));
+
+        addField(new ColorFieldEditor(PreferenceConstants.EDITOR_COLOR_STRING, "String",
+                fieldParent));
+
+        addField(new ColorFieldEditor(PreferenceConstants.EDITOR_COLOR_DEFAULT, "Default",
+                fieldParent));
+
+        addField(new ColorFieldEditor(PreferenceConstants.EDITOR_COLOR_TAG, "XML tag", fieldParent));
+    }
+
+    public void init(IWorkbench workbench) {
+        // nothing to initialize
+    }
+
+    public boolean performOk() {
+        boolean success = super.performOk();
+        if (success) {
+            ColorManager colorManager = IvyPlugin.getDefault().getColorManager();
+            colorManager.refreshFromStore(getPreferenceStore());
+        }
+        return success;
+    }
+}
\ No newline at end of file

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/XMLEditorPreferencesPage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/XMLEditorPreferencesPage.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/ui/preferences/XMLEditorPreferencesPage.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message