mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Added a preferences page for the editor
This commit is contained in:
@@ -45,4 +45,18 @@
|
||||
</action>
|
||||
</editorContribution>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.ui.preferencePages">
|
||||
<page
|
||||
class="org.processing.preferences.ProcessingPreferencesPage"
|
||||
id="org.processing.preferences.ProcessingPreferencesPage"
|
||||
name="Processing">
|
||||
</page>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.core.runtime.preferences">
|
||||
<initializer
|
||||
class="org.processing.preferences.PreferenceInitializer">
|
||||
</initializer>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.processing.preferences;
|
||||
|
||||
/**
|
||||
* Constant definitions for plug-in preferences
|
||||
*/
|
||||
public class PreferenceConstants {
|
||||
|
||||
// Editor Preferences
|
||||
public static final String PROCESSING_SKETCH = "sketch_path"; // path preference
|
||||
public static final String PROCESSING_AUTO_INDENT = "eclipse.editor.auto.indent";
|
||||
|
||||
// // PROCESSING_PREFERENCES prefix indicates membership in the processing.app preferences class
|
||||
// public static final String PROCESSING_APP_PREFERENCES_EDITOR_TABS_SIZE = "editor.tabs.size";
|
||||
// public static final String PROCESSING_APP_PREFERENCES_PREPROC_SUBSTITUTE_FLOATS= "preproc.substitute_floats";
|
||||
// public static final String PROCESSING_APP_PREFERENCES_PREPROC_WEB_COLORS = "preproc.web_colors";
|
||||
// public static final String PROCESSING_APP_PREFERENCES_PREPROC_COLOR_DATATYPE = "preproc.color_datatype";
|
||||
// public static final String PROCESSING_APP_PREFERENCES_PREPROC_ENHANCED_CASTING = "preproc.enhanced_casted";
|
||||
// public static final String PROCESSING_APP_PREFERENCES_PREPROC_SUBSTITUTE_UNICODE = "preproc.substitute.unicode";
|
||||
// public static final String PROCESSING_APP_PREFERENCES_PREPROC_OUTPUT_PARSE_TREE = "preproc.output_parse.tree";
|
||||
// public static final String PROCESSING_APP_PREFERENCES_PREPROC_EXPORT_APPLICATION_FULLSCREEN = "export.application.fullscreen";
|
||||
// public static final String PROCESSING_APP_PREFERENCES_PREPROC_RUN_PRESENT_BGCOLOR = "run.present.bgcolor";
|
||||
// public static final String PROCESSING_APP_PREFERENCES_PREPROC_EXPORT_APPLICATION_STOP = "export.application.stop";
|
||||
// public static final String PROCESSING_APP_PREFERENCES_PREPROC_RUN_PRESENT_STOP_COLOR = "run.present.stop.color";
|
||||
// public static final String PROCESSING_APP_PREFERENCES_PREPROC_RUN_WINDOW_BGCOLOR = "run.window.bgcolor";
|
||||
// public static final String PROCESSING_APP_PREFERENCES_PREPROC_PREPROC_IMPORTS_LIST = "preproc.imports.list";
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package org.processing.preferences;
|
||||
|
||||
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
|
||||
import org.processing.editor.ProcessingEditorPlugin;
|
||||
|
||||
/**
|
||||
* Class used to initialize default preference values.
|
||||
*/
|
||||
public class PreferenceInitializer extends AbstractPreferenceInitializer {
|
||||
|
||||
/**
|
||||
* Sets the default preference values
|
||||
*/
|
||||
public void initializeDefaultPreferences() {
|
||||
IPreferenceStore store = ProcessingEditorPlugin.getDefault().getPreferenceStore();
|
||||
|
||||
//store.setDefault(PreferenceContants.PROCESSING_SKETCH, value);
|
||||
store.setDefault(PreferenceConstants.PROCESSING_AUTO_INDENT, true);
|
||||
|
||||
// PROCESSING_PREFERENCES are processing.app preferences
|
||||
// store.setDefault(PreferenceConstants.PROCESSING_APP_PREFERENCES_EDITOR_TABS_SIZE, "4");
|
||||
// store.setDefault(PreferenceConstants.PROCESSING_APP_PREFERENCES_PREPROC_SUBSTITUTE_FLOATS, "true");
|
||||
// store.setDefault(PreferenceConstants.PROCESSING_APP_PREFERENCES_PREPROC_WEB_COLORS, "true");
|
||||
// store.setDefault(PreferenceConstants.PROCESSING_APP_PREFERENCES_PREPROC_COLOR_DATATYPE, "true");
|
||||
// store.setDefault(PreferenceConstants.PROCESSING_APP_PREFERENCES_PREPROC_ENHANCED_CASTING, "true");
|
||||
// store.setDefault(PreferenceConstants.PROCESSING_APP_PREFERENCES_PREPROC_SUBSTITUTE_UNICODE, "true");
|
||||
// store.setDefault(PreferenceConstants.PROCESSING_APP_PREFERENCES_PREPROC_OUTPUT_PARSE_TREE, "false");
|
||||
// store.setDefault(PreferenceConstants.PROCESSING_APP_PREFERENCES_PREPROC_EXPORT_APPLICATION_FULLSCREEN, "false");
|
||||
// store.setDefault(PreferenceConstants.PROCESSING_APP_PREFERENCES_PREPROC_RUN_PRESENT_BGCOLOR, "#666666");
|
||||
// store.setDefault(PreferenceConstants.PROCESSING_APP_PREFERENCES_PREPROC_EXPORT_APPLICATION_STOP, "true");
|
||||
// store.setDefault(PreferenceConstants.PROCESSING_APP_PREFERENCES_PREPROC_RUN_PRESENT_STOP_COLOR, "#cccccc");
|
||||
// store.setDefault(PreferenceConstants.PROCESSING_APP_PREFERENCES_PREPROC_RUN_WINDOW_BGCOLOR, "#ECE9D8");
|
||||
// store.setDefault(PreferenceConstants.PROCESSING_APP_PREFERENCES_PREPROC_PREPROC_IMPORTS_LIST, "java.applet.*,java.awt.Dimension,java.awt.Frame,java.awt.event.MouseEvent,java.awt.event.KeyEvent,java.awt.event.FocusEvent,java.awt.Image,java.io.*,java.net.*,java.text.*,java.util.*,java.util.zip.*,java.util.regex.*");
|
||||
}
|
||||
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package org.processing.preferences;
|
||||
|
||||
import org.eclipse.jface.preference.*;
|
||||
import org.eclipse.ui.IWorkbenchPreferencePage;
|
||||
import org.eclipse.ui.IWorkbench;
|
||||
import org.processing.editor.ProcessingEditorPlugin;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* <p>
|
||||
* Two editor preferences are included as examples, but
|
||||
* currently do not do anything.
|
||||
* <p>
|
||||
* //TODO transfer Processing.app preferences here
|
||||
* this may involve subclassing PreferencePage,
|
||||
* but things could be setup such that these are read
|
||||
* from a file, and we could use a customized version of
|
||||
* a standard Processing preferences file to store this.
|
||||
*/
|
||||
|
||||
public class ProcessingPreferencesPage
|
||||
extends FieldEditorPreferencePage
|
||||
implements IWorkbenchPreferencePage {
|
||||
|
||||
public ProcessingPreferencesPage() {
|
||||
super(GRID);
|
||||
setPreferenceStore(ProcessingEditorPlugin.getDefault().getPreferenceStore());
|
||||
setDescription("Processing Plugin Preferences (nothing here is used, see JavaDoc)");
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 DirectoryFieldEditor(PreferenceConstants.PROCESSING_SKETCH,
|
||||
"Sketchbook Directory:", getFieldEditorParent()));
|
||||
addField(
|
||||
new BooleanFieldEditor(
|
||||
PreferenceConstants.PROCESSING_AUTO_INDENT,
|
||||
"Auto indent",
|
||||
getFieldEditorParent()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes the preference page. Nothing to do here, but it has to be subclassed.
|
||||
*/
|
||||
public void init(IWorkbench workbench) {}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user