Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/preferences/CustomTransitionPreferenceInitializer.java37
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/preferences/CustomTransitionPreferencePage.java69
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/preferences/PreferenceConstants.java6
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml18
4 files changed, 124 insertions, 6 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/preferences/CustomTransitionPreferenceInitializer.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/preferences/CustomTransitionPreferenceInitializer.java
new file mode 100644
index 00000000000..bda52f4c19d
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/preferences/CustomTransitionPreferenceInitializer.java
@@ -0,0 +1,37 @@
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.uml.diagram.statemachine.custom.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditorPlugin;
+
+/**
+ * Class used to initialize default preference values.
+ */
+public class CustomTransitionPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ @Override
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore();
+ store.setDefault(PreferenceConstants.BODY_CUT_LENGTH, 1);
+ store.setDefault(PreferenceConstants.INDICATE_PARAMETERS, true);
+ store.setDefault(PreferenceConstants.LINEBREAK_BEFORE_EFFECT, true);
+ }
+}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/preferences/CustomTransitionPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/preferences/CustomTransitionPreferencePage.java
new file mode 100644
index 00000000000..c39a7306a62
--- /dev/null
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/preferences/CustomTransitionPreferencePage.java
@@ -0,0 +1,69 @@
+package org.eclipse.papyrus.uml.diagram.statemachine.custom.preferences;
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.papyrus.infra.gmfdiag.common.helper.DiagramHelper;
+import org.eclipse.papyrus.uml.diagram.statemachine.part.UMLDiagramEditorPlugin;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+public class CustomTransitionPreferencePage extends FieldEditorPreferencePage
+ implements IWorkbenchPreferencePage
+{
+ public CustomTransitionPreferencePage() {
+ super(GRID);
+ setPreferenceStore(UMLDiagramEditorPlugin.getInstance().getPreferenceStore());
+ setDescription("This preference page allows to customize label appearance on transitions");
+ }
+
+ boolean updatePending;
+
+ /**
+ * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
+ *
+ */
+ @Override
+ protected void createFieldEditors() {
+ addField(new BooleanFieldEditor(
+ PreferenceConstants.INDICATE_PARAMETERS, "Indicate parameters", //$NON-NLS-1$
+ getFieldEditorParent()));
+
+ addField(new BooleanFieldEditor(
+ PreferenceConstants.LINEBREAK_BEFORE_EFFECT, "Line break before effect label", //$NON-NLS-1$
+ getFieldEditorParent()));
+
+ addField(new IntegerFieldEditor(
+ PreferenceConstants.BODY_CUT_LENGTH, "Shown number of lines for opaque expressions/behaviors", //$NON-NLS-1$
+ getFieldEditorParent()));
+
+ }
+
+ @Override
+ public boolean performOk() {
+ if (!updatePending) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ DiagramHelper.setNeedsRefresh();
+ DiagramHelper.refreshDiagrams();
+ updatePending = false;
+ }
+ });
+ }
+ updatePending = true;
+
+ return super.performOk();
+ }
+
+
+ /**
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ *
+ * @param workbench
+ */
+ public void init(IWorkbench workbench) {
+ }
+} \ No newline at end of file
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/preferences/PreferenceConstants.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/preferences/PreferenceConstants.java
index 5113adcf3c1..d204b0192f0 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/preferences/PreferenceConstants.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/custom-src/org/eclipse/papyrus/uml/diagram/statemachine/custom/preferences/PreferenceConstants.java
@@ -18,15 +18,15 @@ public class PreferenceConstants {
/**
* integer: Maximum length of displayed bodies.
*/
- public final static String BODY_CUT_LENGTH = "bodyCutLength";
+ public final static String BODY_CUT_LENGTH = "bodyCutLength"; //$NON-NLS-1$
/**
* Boolean: if true, indicate presence of parameters (attributes) by adding (...) to call or signal event.
*/
- public final static String INDICATE_PARAMETERS = "indicateParameters";
+ public final static String INDICATE_PARAMETERS = "indicateParameters"; //$NON-NLS-1$
/**
* Boolean: if true, add a line-break to the transition label before the effect
*/
- public final static String LINEBREAK_BEFORE_EFFECT = "lineBreakBeforeEffect";
+ public final static String LINEBREAK_BEFORE_EFFECT = "lineBreakBeforeEffect"; //$NON-NLS-1$
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml
index 8d3ca3f790f..b4aa0a8a113 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.statemachine/plugin.xml
@@ -1093,10 +1093,22 @@
</predefinedEntry>
</contribution>
<editor id="org.eclipse.papyrus.uml.diagram.statemachine"/>
- </paletteProvider>
+ </paletteProvider>
</extension>
-
-
+ <extension point="org.eclipse.ui.preferencePages">
+ <page
+ category="org.eclipse.papyrus.infra.gmfdiag.preferences.diagrams.PapyrusUMLStateMachineDiagram"
+ class="org.eclipse.papyrus.uml.diagram.statemachine.custom.preferences.CustomTransitionPreferencePage"
+ id="org.eclipse.papyrus.uml.diagram.statemachine.custom.preferences.CustomTransitionPreferencePage_ID"
+ name="Transition options">
+ </page>
+ </extension>
+
+ <extension point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.papyrus.uml.diagram.statemachine.custom.preferences.CustomTransitionPreferenceInitializer">
+ </initializer>
+ </extension>
</plugin>

Back to the top