[jboss-cvs] jbosside/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/preferences ...
Max Rydahl Andersen
mandersen at jboss.com
Fri Aug 25 06:12:45 EDT 2006
User: mandersen
Date: 06/08/25 06:12:45
Added: hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/preferences
PreferenceInitializer.java
HQLEditorPreferencePage.java
HQLPreferenceConstants.java
Log:
JBIDE-320 & HBX-735 customize HQL editor coloring
Revision Changes Path
1.1 date: 2006/08/25 10:12:45; author: mandersen; state: Exp;jbosside/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/preferences/PreferenceInitializer.java
Index: PreferenceInitializer.java
===================================================================
package org.hibernate.eclipse.hqleditor.preferences;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.swt.graphics.RGB;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
/**
* Class used to initialize default preference values.
*/
public class PreferenceInitializer extends AbstractPreferenceInitializer {
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
*/
public void initializeDefaultPreferences() {
IPreferenceStore store = HibernateConsolePlugin.getDefault()
.getPreferenceStore();
PreferenceConverter.setDefault( store, HQLPreferenceConstants.HQL_DEFAULT_COLOR, new RGB( 0, 0, 0 ) );
PreferenceConverter.setDefault( store, HQLPreferenceConstants.HQL_IDENTIFIER_COLOR, new RGB( 0, 128, 128 ) );
PreferenceConverter.setDefault( store, HQLPreferenceConstants.HQL_KEYWORD_COLOR, new RGB( 128, 0, 0 ) );
PreferenceConverter.setDefault( store, HQLPreferenceConstants.HQL_QUOTED_LITERAL_COLOR, new RGB( 0, 0, 255 ) );
PreferenceConverter.setDefault( store, HQLPreferenceConstants.HQL_COMMENT_COLOR, new RGB( 0, 0, 128 ) );
}
}
1.1 date: 2006/08/25 10:12:45; author: mandersen; state: Exp;jbosside/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/preferences/HQLEditorPreferencePage.java
Index: HQLEditorPreferencePage.java
===================================================================
package org.hibernate.eclipse.hqleditor.preferences;
import org.eclipse.jface.preference.*;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.IWorkbench;
import org.hibernate.eclipse.console.HibernateConsolePlugin;
/**
* This class represents a preference page that
* is contributed to the Preferences dialog. By
* subclassing <samp>FieldEditorPreferencePage</samp>, we
* can use the field support built into JFace that allows
* us to create a page that is small and knows how to
* save, restore and apply itself.
* <p>
* This page is used to modify preferences only. They
* are stored in the preference store that belongs to
* the main plug-in class. That way, preferences can
* be accessed directly via the preference store.
*/
public class HQLEditorPreferencePage
extends FieldEditorPreferencePage
implements IWorkbenchPreferencePage {
public HQLEditorPreferencePage() {
super(GRID);
setPreferenceStore(HibernateConsolePlugin.getDefault().getPreferenceStore());
setDescription("Colors for HQL editor syntax highlighting");
}
/**
* Creates the field editors. Field editors are abstractions of
* the common GUI blocks needed to manipulate various types
* of preferences. Each field editor knows how to save and
* restore itself.
*/
public void createFieldEditors() {
addField(new ColorFieldEditor(HQLPreferenceConstants.HQL_DEFAULT_COLOR,
"Default:", getFieldEditorParent()));
addField(new ColorFieldEditor(HQLPreferenceConstants.HQL_IDENTIFIER_COLOR,
"Identifier:", getFieldEditorParent()));
addField(new ColorFieldEditor(HQLPreferenceConstants.HQL_KEYWORD_COLOR,
"Keyword:", getFieldEditorParent()));
addField(new ColorFieldEditor(HQLPreferenceConstants.HQL_QUOTED_LITERAL_COLOR,
"String literal:", getFieldEditorParent()));
}
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
public void init(IWorkbench workbench) {
}
}
1.1 date: 2006/08/25 10:12:45; author: mandersen; state: Exp;jbosside/hibernatetools/plugins/org.hibernate.eclipse.console/src/org/hibernate/eclipse/hqleditor/preferences/HQLPreferenceConstants.java
Index: HQLPreferenceConstants.java
===================================================================
package org.hibernate.eclipse.hqleditor.preferences;
/**
* Constant definitions for plug-in preferences
*/
public class HQLPreferenceConstants {
public static final String HQL_KEYWORD_COLOR = "hql.keyword.color";
public static final String HQL_IDENTIFIER_COLOR = "hql.identifier.color";
public static final String HQL_DEFAULT_COLOR = "hql.default.color";
public static final String HQL_QUOTED_LITERAL_COLOR = "hql.quoted_literal.color";
public static final String HQL_COMMENT_COLOR = "hql.comment.color";
}
More information about the jboss-cvs-commits
mailing list