aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Gilmer <kgilmer@gmail.com>2011-07-01 18:53:20 +0900
committerKen Gilmer <kgilmer@gmail.com>2011-07-01 18:53:20 +0900
commitc89ab8ca446654ece705ec48e4720f011551545a (patch)
tree0fb233b1c9981e82f31eda47c0b7fe951bb75930
parent26c8f3d57ff23246545b65b87d679534a9423210 (diff)
downloadeclipsetools-c89ab8ca446654ece705ec48e4720f011551545a.zip
eclipsetools-c89ab8ca446654ece705ec48e4720f011551545a.tar.gz
eclipsetools-c89ab8ca446654ece705ec48e4720f011551545a.tar.bz2
OTE: add preference page to enable/disable background bitbake session
for variable expansion.
-rw-r--r--org.openembedded.bc.ui/plugin.xml14
-rw-r--r--org.openembedded.bc.ui/src/org/openembedded/bc/ui/editors/bitbake/BitBakeSourceViewerConfiguration.java6
-rw-r--r--org.openembedded.bc.ui/src/org/openembedded/bc/ui/preferences/MainPreferencePage.java39
-rw-r--r--org.openembedded.bc.ui/src/org/openembedded/bc/ui/preferences/PreferenceConstants.java9
-rw-r--r--org.openembedded.bc.ui/src/org/openembedded/bc/ui/preferences/PreferenceInitializer.java22
5 files changed, 90 insertions, 0 deletions
diff --git a/org.openembedded.bc.ui/plugin.xml b/org.openembedded.bc.ui/plugin.xml
index 7a4e1fc..b472ef4 100644
--- a/org.openembedded.bc.ui/plugin.xml
+++ b/org.openembedded.bc.ui/plugin.xml
@@ -290,5 +290,19 @@
</enablement>
</decorator>
</extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ class="org.openembedded.bc.ui.preferences.MainPreferencePage"
+ id="org.openembedded.bc.ui.preferences.MainPreferencePage"
+ name="Bitbake Commander">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.openembedded.bc.ui.preferences.PreferenceInitializer">
+ </initializer>
+ </extension>
</plugin>
diff --git a/org.openembedded.bc.ui/src/org/openembedded/bc/ui/editors/bitbake/BitBakeSourceViewerConfiguration.java b/org.openembedded.bc.ui/src/org/openembedded/bc/ui/editors/bitbake/BitBakeSourceViewerConfiguration.java
index e3cbeb4..92ee692 100644
--- a/org.openembedded.bc.ui/src/org/openembedded/bc/ui/editors/bitbake/BitBakeSourceViewerConfiguration.java
+++ b/org.openembedded.bc.ui/src/org/openembedded/bc/ui/editors/bitbake/BitBakeSourceViewerConfiguration.java
@@ -34,6 +34,7 @@ import org.eclipse.swt.graphics.RGB;
import org.eclipse.ui.editors.text.TextSourceViewerConfiguration;
import org.openembedded.bc.bitbake.BBLanguageHelper;
import org.openembedded.bc.bitbake.BBSession;
+import org.openembedded.bc.ui.preferences.PreferenceConstants;
public class BitBakeSourceViewerConfiguration extends TextSourceViewerConfiguration {
@@ -52,10 +53,12 @@ public class BitBakeSourceViewerConfiguration extends TextSourceViewerConfigurat
private BBSession session;
private String targetFilePath;
private BBVariableTextHover textHover;
+ private boolean enableTextHover;
public BitBakeSourceViewerConfiguration(ISharedTextColors sharedColors, IPreferenceStore store) {
super(store);
fSharedColors = sharedColors;
+ enableTextHover = store.getBoolean(PreferenceConstants.ENABLE_BITBAKE_BACKGROUND_SESSION);
}
protected void setTargetFilePath(String targetFilePath) {
@@ -63,6 +66,9 @@ public class BitBakeSourceViewerConfiguration extends TextSourceViewerConfigurat
}
public ITextHover getTextHover(ISourceViewer sv, String contentType) {
+ if (!enableTextHover)
+ return null;
+
if (textHover == null && session != null && targetFilePath != null) {
textHover = new BBVariableTextHover(session, targetFilePath);
}
diff --git a/org.openembedded.bc.ui/src/org/openembedded/bc/ui/preferences/MainPreferencePage.java b/org.openembedded.bc.ui/src/org/openembedded/bc/ui/preferences/MainPreferencePage.java
new file mode 100644
index 0000000..2871eac
--- /dev/null
+++ b/org.openembedded.bc.ui/src/org/openembedded/bc/ui/preferences/MainPreferencePage.java
@@ -0,0 +1,39 @@
+package org.openembedded.bc.ui.preferences;
+
+import org.eclipse.jface.preference.*;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.IWorkbench;
+import org.openembedded.bc.ui.Activator;
+
+public class MainPreferencePage
+ extends FieldEditorPreferencePage
+ implements IWorkbenchPreferencePage {
+
+ public MainPreferencePage() {
+ super(GRID);
+ setPreferenceStore(Activator.getDefault().getPreferenceStore());
+ setDescription("Bitbake Commander Preferences");
+ }
+
+ /**
+ * 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 BooleanFieldEditor(
+ PreferenceConstants.ENABLE_BITBAKE_BACKGROUND_SESSION,
+ "&Enable background Bitbake session for variable expansion",
+ getFieldEditorParent()));
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ }
+
+} \ No newline at end of file
diff --git a/org.openembedded.bc.ui/src/org/openembedded/bc/ui/preferences/PreferenceConstants.java b/org.openembedded.bc.ui/src/org/openembedded/bc/ui/preferences/PreferenceConstants.java
new file mode 100644
index 0000000..b962d66
--- /dev/null
+++ b/org.openembedded.bc.ui/src/org/openembedded/bc/ui/preferences/PreferenceConstants.java
@@ -0,0 +1,9 @@
+package org.openembedded.bc.ui.preferences;
+
+/**
+ * Constant definitions for plug-in preferences
+ */
+public class PreferenceConstants {
+ public static final String ENABLE_BITBAKE_BACKGROUND_SESSION = "booleanPreference";
+
+}
diff --git a/org.openembedded.bc.ui/src/org/openembedded/bc/ui/preferences/PreferenceInitializer.java b/org.openembedded.bc.ui/src/org/openembedded/bc/ui/preferences/PreferenceInitializer.java
new file mode 100644
index 0000000..cb323a9
--- /dev/null
+++ b/org.openembedded.bc.ui/src/org/openembedded/bc/ui/preferences/PreferenceInitializer.java
@@ -0,0 +1,22 @@
+package org.openembedded.bc.ui.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+import org.openembedded.bc.ui.Activator;
+
+/**
+ * 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 = Activator.getDefault().getPreferenceStore();
+ store.setDefault(PreferenceConstants.ENABLE_BITBAKE_BACKGROUND_SESSION, false);
+ }
+}