Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2014-11-24 17:50:33 +0000
committerHenrik Rentz-Reichert2014-11-24 17:50:33 +0000
commitca7b98e4ac8537e05d24a1e4d3b76f6454a48703 (patch)
tree5822a83478446648771c487e2df24c42ad219dc3 /plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui
parente8a363711841da0e75ee195ee08256de6f3ebb76 (diff)
downloadorg.eclipse.etrice-ca7b98e4ac8537e05d24a1e4d3b76f6454a48703.tar.gz
org.eclipse.etrice-ca7b98e4ac8537e05d24a1e4d3b76f6454a48703.tar.xz
org.eclipse.etrice-ca7b98e4ac8537e05d24a1e4d3b76f6454a48703.zip
[behavior.actioneditor, behavior.fsm] added default language to
Diffstat (limited to 'plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui')
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/preferences/ActionEditorPreferencePage.java3
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/preferences/PreferenceConstants.java2
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/preferences/PreferenceInitializer.java4
-rw-r--r--plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/dialogs/AbstractMemberAwarePropertyDialog.java12
4 files changed, 15 insertions, 6 deletions
diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/preferences/ActionEditorPreferencePage.java b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/preferences/ActionEditorPreferencePage.java
index 5cef80a41..d3854f7ab 100644
--- a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/preferences/ActionEditorPreferencePage.java
+++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/preferences/ActionEditorPreferencePage.java
@@ -35,8 +35,9 @@ public class ActionEditorPreferencePage extends FieldEditorPreferencePage
*/
public void createFieldEditors() {
+ // choice for language
addField(new RadioGroupFieldEditor(
- PreferenceConstants.JAVA_EDITOR_LANGUAGE,
+ PreferenceConstants.EDITOR_LANGUAGE,
CHOOSE_EDITOR_LANGUAGE,
1,
new String[][] {
diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/preferences/PreferenceConstants.java b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/preferences/PreferenceConstants.java
index c653a51f0..7af8ac00c 100644
--- a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/preferences/PreferenceConstants.java
+++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/preferences/PreferenceConstants.java
@@ -12,7 +12,7 @@ public class PreferenceConstants {
/** indicating C/C++ */
public static final String CPP_LANGUAGE = "org.eclipse.etrice.ui.behavior.actioneditor.preferences.cpplanguage";
/** the language to be chosen */
- public static final String JAVA_EDITOR_LANGUAGE = "org.eclipse.etrice.ui.behavior.actioneditor.preferences.language";
+ public static final String EDITOR_LANGUAGE = "org.eclipse.etrice.ui.behavior.actioneditor.preferences.language";
/** Preference name for Java Editor */
public static final String JAVA_EDITOR_PREFERENCE = "org.eclipse.etrice.ui.behavior.actioneditor.preferences.javaeditor";
/** Preference name for C/C++ Editor */
diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/preferences/PreferenceInitializer.java b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/preferences/PreferenceInitializer.java
index 7fa791964..2a069915f 100644
--- a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/preferences/PreferenceInitializer.java
+++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/actioneditor/preferences/PreferenceInitializer.java
@@ -23,6 +23,10 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer {
public void initializeDefaultPreferences() {
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+ // Set the default preference value for editor language
+ store.setDefault(PreferenceConstants.EDITOR_LANGUAGE,
+ PreferenceConstants.JAVA_LANGUAGE);
+
// Set the default preference value for Java Editor
store.setDefault(PreferenceConstants.JAVA_EDITOR_PREFERENCE,
MODEL_AWARE_ACTION_CODE_EDITOR_ID);
diff --git a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/dialogs/AbstractMemberAwarePropertyDialog.java b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/dialogs/AbstractMemberAwarePropertyDialog.java
index 3d45ef94d..ed1d1552e 100644
--- a/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/dialogs/AbstractMemberAwarePropertyDialog.java
+++ b/plugins/org.eclipse.etrice.ui.behavior.fsm/src/org/eclipse/etrice/ui/behavior/fsm/dialogs/AbstractMemberAwarePropertyDialog.java
@@ -29,6 +29,7 @@ import org.eclipse.etrice.ui.behavior.fsm.actioneditor.IActionCodeEditor;
import org.eclipse.etrice.ui.behavior.fsm.actioneditor.preferences.PreferenceConstants;
import org.eclipse.etrice.ui.common.base.dialogs.AbstractPropertyDialog;
import org.eclipse.etrice.ui.common.base.dialogs.MultiValidator2;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusEvent;
@@ -221,12 +222,15 @@ public abstract class AbstractMemberAwarePropertyDialog extends AbstractProperty
Label l = getToolkit().createLabel(parent, label, SWT.NONE);
l.setLayoutData(new GridData(SWT.NONE));
- // TODO Auto-detect target language.
- String targetLanguage = PreferenceConstants.JAVA_EDITOR_PREFERENCE;
+ // get target language and selected editor
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+ String targetLanguage = store.getString(PreferenceConstants.EDITOR_LANGUAGE);
+ String editor = (targetLanguage.equals(PreferenceConstants.JAVA_LANGUAGE))?
+ PreferenceConstants.JAVA_EDITOR_PREFERENCE : PreferenceConstants.CPP_EDITOR_PREFERENCE;
- // Get editor id from preferences for the given target language.
+ // Get editor id from preferences
String id = Activator.getDefault().getPreferenceStore()
- .getString(targetLanguage);
+ .getString(editor);
// Create new editor instance
IActionCodeEditor actionCodeEditor = ActionCodeEditorRegistry.INSTANCE

Back to the top