Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Brodt2014-07-15 15:47:12 -0400
committerBob Brodt2014-07-15 15:47:12 -0400
commit62ef16d5eb733a2edabc400e9df7114e3e89aca3 (patch)
treeb3d0af86fe7f02fa523d5ac800118eefbd0c4431
parente3e6c18ce97f03f38ee63ba35752229579edb4ac (diff)
downloadorg.eclipse.bpmn2-modeler-62ef16d5eb733a2edabc400e9df7114e3e89aca3.tar.gz
org.eclipse.bpmn2-modeler-62ef16d5eb733a2edabc400e9df7114e3e89aca3.tar.xz
org.eclipse.bpmn2-modeler-62ef16d5eb733a2edabc400e9df7114e3e89aca3.zip
Fixed dynamic loading/unloading of <style> and <modelExtension>
elements. Added a button to User Preferences to add BPMN2 Nature to a project.
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/builder/BPMN2Builder.java6
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/builder/BPMN2Nature.java34
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Bpmn2Preferences.java125
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/ShapeStyle.java25
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/messages.properties2
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/BaseRuntimeExtensionDescriptor.java9
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/ModelExtensionDescriptor.java23
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/StyleUtil.java1
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/diagram/Bpmn2FeatureMap.java9
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/Bpmn2PropertyPage.java38
10 files changed, 217 insertions, 55 deletions
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/builder/BPMN2Builder.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/builder/BPMN2Builder.java
index cabc6aab..e165d705 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/builder/BPMN2Builder.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/builder/BPMN2Builder.java
@@ -191,11 +191,11 @@ public class BPMN2Builder extends IncrementalProjectBuilder {
public void loadExtension(IFile file) {
XMLConfigElementHandler handler = new XMLConfigElementHandler(file);
try {
- SAXParser parser = getParser();
- if (file.exists()) {
+ TargetRuntime rt = Bpmn2Preferences.getInstance(file.getProject()).getRuntime();
+ if (file.exists() && file.getLocalTimeStamp() > rt.getConfigFileTimestamp()) {
+ SAXParser parser = getParser();
FileInputStream fis = new FileInputStream(file.getLocation().makeAbsolute().toOSString());
parser.parse(fis, handler);
- TargetRuntime rt = Bpmn2Preferences.getInstance(file.getProject()).getRuntime();
IConfigurationElement element = handler.root.getChildren()[0];
TargetRuntime.loadExtensions(rt, element.getChildren(), file);
}
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/builder/BPMN2Nature.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/builder/BPMN2Nature.java
index a6aeaf2c..b8bcd8c4 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/builder/BPMN2Nature.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/builder/BPMN2Nature.java
@@ -87,5 +87,39 @@ public class BPMN2Nature implements IProjectNature {
public void setProject(IProject project) {
this.project = project;
}
+
+ public static void setBPMN2Nature(IProject project, boolean enable) {
+ try {
+ IProjectDescription description = project.getDescription();
+ String[] natures = description.getNatureIds();
+ if (enable) {
+ if (project.getNature(BPMN2Nature.NATURE_ID)==null) {
+ // Add the nature
+ String[] newNatures = new String[natures.length + 1];
+ System.arraycopy(natures, 0, newNatures, 0, natures.length);
+ newNatures[natures.length] = BPMN2Nature.NATURE_ID;
+ description.setNatureIds(newNatures);
+ project.setDescription(description, null);
+ }
+ }
+ else {
+ if (project.getNature(BPMN2Nature.NATURE_ID)!=null) {
+ for (int i = 0; i < natures.length; ++i) {
+ if (BPMN2Nature.NATURE_ID.equals(natures[i])) {
+ // Remove the nature
+ String[] newNatures = new String[natures.length - 1];
+ System.arraycopy(natures, 0, newNatures, 0, i);
+ System.arraycopy(natures, i + 1, newNatures, i,
+ natures.length - i - 1);
+ description.setNatureIds(newNatures);
+ project.setDescription(description, null);
+ return;
+ }
+ }
+ }
+ }
+ } catch (CoreException e) {
+ }
+ }
}
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Bpmn2Preferences.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Bpmn2Preferences.java
index f0ea8ff9..f78df301 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Bpmn2Preferences.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Bpmn2Preferences.java
@@ -372,74 +372,107 @@ public class Bpmn2Preferences implements IResourceChangeListener, IPropertyChang
defaultPreferences.putInt(PREF_CONNECTION_TIMEOUT, 60000);
defaultPreferences.putInt(PREF_RESOLVE_EXTERNALS, 2);
- loadDefaults(PREF_TOOL_PROFILE);
- loadDefaults(PREF_MODEL_ENABLEMENT);
- loadDefaults(PREF_SHAPE_STYLE);
+ for (TargetRuntime rt : TargetRuntime.createTargetRuntimes()) {
+ loadDefaults(rt, PREF_TOOL_PROFILE);
+ loadDefaults(rt, PREF_MODEL_ENABLEMENT);
+ loadDefaults(rt, PREF_SHAPE_STYLE);
+ }
}
}
- private void loadDefaults(String key) {
+ public void loadDefaults(TargetRuntime rt, String key) {
if (key.equals(PREF_TOOL_PROFILE)) {
- for (TargetRuntime rt : TargetRuntime.createTargetRuntimes()) {
- String defaultProfile = null;
- for (ModelEnablementDescriptor med : rt.getModelEnablements()) {
- String path = getToolProfilePath(rt);
- Preferences prefs = defaultPreferences.node(path);
- if (defaultProfile == null)
- prefs.putBoolean(defaultProfile = med.getId(), true);
- else
- prefs.putBoolean(med.getId(), false);
- }
+ String defaultProfile = null;
+ for (ModelEnablementDescriptor med : rt.getModelEnablements()) {
+ String path = getToolProfilePath(rt);
+ Preferences prefs = defaultPreferences.node(path);
+ if (defaultProfile == null)
+ prefs.putBoolean(defaultProfile = med.getId(), true);
+ else
+ prefs.putBoolean(med.getId(), false);
}
}
else if (key.equals(PREF_MODEL_ENABLEMENT)) {
- for (TargetRuntime rt : TargetRuntime.createTargetRuntimes()) {
- if (rt.getModelEnablements().size()==0) {
- String path = getModelEnablementsPath(rt, null);
+ if (rt.getModelEnablements().size()==0) {
+ String path = getModelEnablementsPath(rt, null);
+ Preferences prefs = defaultPreferences.node(path);
+ for (Entry<EClass, List<EStructuralFeature>> e : rt.getModelExtensions(0).entrySet()) {
+ for (EStructuralFeature f : e.getValue()) {
+ String s = e.getKey().getName() + "." + f.getName();
+ prefs.putBoolean(s, Boolean.TRUE);
+ }
+ }
+ ModelEnablements me = new ModelEnablements(rt,"default");
+ me.setEnabledAll(true);
+ for (String s : me.getAllEnabled())
+ prefs.putBoolean(s, Boolean.TRUE);
+ }
+ else {
+ for (ModelEnablementDescriptor med : rt.getModelEnablements()) {
+ String path = getModelEnablementsPath(rt, med.getId());
Preferences prefs = defaultPreferences.node(path);
+ for (String s : med.getAllEnabled()) {
+ prefs.putBoolean(s, Boolean.TRUE);
+ }
for (Entry<EClass, List<EStructuralFeature>> e : rt.getModelExtensions(0).entrySet()) {
for (EStructuralFeature f : e.getValue()) {
String s = e.getKey().getName() + "." + f.getName();
prefs.putBoolean(s, Boolean.TRUE);
}
}
- ModelEnablements me = new ModelEnablements(rt,"default");
- me.setEnabledAll(true);
- for (String s : me.getAllEnabled())
- prefs.putBoolean(s, Boolean.TRUE);
- }
- else {
- for (ModelEnablementDescriptor med : rt.getModelEnablements()) {
- String path = getModelEnablementsPath(rt, med.getId());
- Preferences prefs = defaultPreferences.node(path);
- for (String s : med.getAllEnabled()) {
- prefs.putBoolean(s, Boolean.TRUE);
- }
- for (Entry<EClass, List<EStructuralFeature>> e : rt.getModelExtensions(0).entrySet()) {
- for (EStructuralFeature f : e.getValue()) {
- String s = e.getKey().getName() + "." + f.getName();
- prefs.putBoolean(s, Boolean.TRUE);
- }
- }
- }
}
}
}
else if (key.equals(PREF_SHAPE_STYLE)) {
// Use ShapeStyles defined in the Default Target Runtime if an extension does not provide its own.
List<ShapeStyle> defaultShapeStyles = TargetRuntime.getDefaultRuntime().getShapeStyles();
- for (TargetRuntime rt : TargetRuntime.createTargetRuntimes()) {
- String path = getShapeStylePath(rt);
- Preferences prefs = defaultPreferences.node(path);
- for (ShapeStyle ss : rt.getShapeStyles()) {
+ String path = getShapeStylePath(rt);
+ Preferences prefs = defaultPreferences.node(path);
+ for (ShapeStyle ss : rt.getShapeStyles()) {
+ String value = ShapeStyle.encode(ss);
+ prefs.put(ss.getObject(), value);
+ }
+ if (rt!=TargetRuntime.getDefaultRuntime()) {
+ for (ShapeStyle ss : defaultShapeStyles) {
String value = ShapeStyle.encode(ss);
prefs.put(ss.getObject(), value);
}
- if (rt!=TargetRuntime.getDefaultRuntime()) {
- for (ShapeStyle ss : defaultShapeStyles) {
- String value = ShapeStyle.encode(ss);
- prefs.put(ss.getObject(), value);
- }
+ }
+ }
+ }
+
+ public void unloadDefaults(TargetRuntime rt, String key) {
+ if (key.equals(PREF_TOOL_PROFILE)) {
+ for (ModelEnablementDescriptor med : rt.getModelEnablements()) {
+ String path = getToolProfilePath(rt);
+ Preferences prefs = defaultPreferences.node(path);
+ prefs.remove(med.getId());
+ }
+ }
+ else if (key.equals(PREF_MODEL_ENABLEMENT)) {
+ for (ModelEnablementDescriptor med : rt.getModelEnablements()) {
+ String path = getModelEnablementsPath(rt, med.getId());
+ Preferences prefs = defaultPreferences.node(path);
+ for (String s : med.getAllEnabled()) {
+ prefs.remove(s);
+ }
+ }
+ String path = getModelEnablementsPath(rt, null);
+ Preferences prefs = defaultPreferences.node(path);
+ for (Entry<EClass, List<EStructuralFeature>> e : rt.getModelExtensions(0).entrySet()) {
+ for (EStructuralFeature f : e.getValue()) {
+ String s = e.getKey().getName() + "." + f.getName();
+ prefs.remove(s);
+ }
+ }
+ }
+ else if (key.equals(PREF_SHAPE_STYLE)) {
+ // Use ShapeStyles defined in the Default Target Runtime if an extension does not provide its own.
+ String path = getShapeStylePath(rt);
+ Preferences prefs = defaultPreferences.node(path);
+ if (rt!=TargetRuntime.getDefaultRuntime()) {
+ for (ShapeStyle ss : rt.getShapeStyles()) {
+ prefs.remove(ss.getObject());
}
}
}
@@ -478,7 +511,7 @@ public class Bpmn2Preferences implements IResourceChangeListener, IPropertyChang
showAdvancedPropertiesTab = getBoolean(PREF_SHOW_ADVANCED_PROPERTIES, false);
showDescriptions = getBoolean(PREF_SHOW_DESCRIPTIONS, false);
showIdAttribute = getBoolean(PREF_SHOW_ID_ATTRIBUTE, false);
- checkProjectNature = getBoolean(PREF_CHECK_PROJECT_NATURE, false);
+ checkProjectNature = getBoolean(PREF_CHECK_PROJECT_NATURE, true);
simplifyLists = getBoolean(PREF_SIMPLIFY_LISTS, true);
usePopupDialogForLists = getBoolean(PREF_USE_POPUP_DIALOG_FOR_LISTS, false);
isHorizontal = getBPMNDIAttributeDefault(PREF_IS_HORIZONTAL, BPMNDIAttributeDefault.USE_DI_VALUE);
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/ShapeStyle.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/ShapeStyle.java
index eaea7b78..899245c4 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/ShapeStyle.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/ShapeStyle.java
@@ -277,7 +277,30 @@ public class ShapeStyle extends BaseRuntimeExtensionDescriptor {
else
labelPosition = LabelPosition.SOUTH;
}
-
+
+ @Override
+ public void setConfigFile(IFile configFile) {
+ super.setConfigFile(configFile);
+ if (configFile!=null) {
+ Bpmn2Preferences prefs = Bpmn2Preferences.getInstance(configFile.getProject());
+ prefs.loadDefaults(targetRuntime, Bpmn2Preferences.PREF_SHAPE_STYLE);
+ }
+ }
+
+ public void dispose() {
+ // remove the ModelEnablement classes and features that may
+ // have been defined in this Model Extension
+ if (configFile!=null) {
+ Bpmn2Preferences prefs = Bpmn2Preferences.getInstance(configFile.getProject());
+ prefs.unloadDefaults(targetRuntime, Bpmn2Preferences.PREF_SHAPE_STYLE);
+ }
+ super.dispose();
+ if (configFile!=null) {
+ Bpmn2Preferences prefs = Bpmn2Preferences.getInstance(configFile.getProject());
+ prefs.loadDefaults(targetRuntime, Bpmn2Preferences.PREF_SHAPE_STYLE);
+ }
+ }
+
@Override
public String getExtensionName() {
return EXTENSION_NAME;
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/messages.properties b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/messages.properties
index 034090ee..f1a3f65b 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/messages.properties
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/messages.properties
@@ -12,7 +12,7 @@ Bpmn2Preferences_No_Runtime_Plugin_Title=Unsupported Target Runtime
Bpmn2Preferences_Activities=Activities
Bpmn2Preferences_Always_False=Always false
Bpmn2Preferences_Always_true=Always true
-Bpmn2Preferences_Check_Project_Nature=Check if project is configured for BPMN2 Project Nature
+Bpmn2Preferences_Check_Project_Nature=Ask to enable BPMN2 Project Nature when saving files
Bpmn2Preferences_Use_Popup_Dialog_For_Lists=Use a popup dialog instead of Details Panel to edit List items
Bpmn2Preferences_Config_Dialog=Display element configuration popup dialog after DND of:
Bpmn2Preferences_Containers=Acitivity containers (Pools, SubProcess, Transaction, etc.)
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/BaseRuntimeExtensionDescriptor.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/BaseRuntimeExtensionDescriptor.java
index 1169d27f..9a121c62 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/BaseRuntimeExtensionDescriptor.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/BaseRuntimeExtensionDescriptor.java
@@ -49,6 +49,7 @@ public abstract class BaseRuntimeExtensionDescriptor implements IRuntimeExtensio
protected TargetRuntime targetRuntime;
protected IFile configFile;
+ protected long configFileTimestamp;
protected final IConfigurationElement configurationElement;
protected String id;
@@ -89,6 +90,14 @@ public abstract class BaseRuntimeExtensionDescriptor implements IRuntimeExtensio
public void setConfigFile(IFile configFile) {
this.configFile = configFile;
+ if (configFile!=null)
+ configFileTimestamp = configFile.getLocalTimeStamp();
+ else
+ configFileTimestamp = 0;
+ }
+
+ public long getConfigFileTimestamp() {
+ return configFileTimestamp;
}
public TargetRuntime getRuntime() {
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/ModelExtensionDescriptor.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/ModelExtensionDescriptor.java
index b93f53d6..c8568a99 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/ModelExtensionDescriptor.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/ModelExtensionDescriptor.java
@@ -14,6 +14,7 @@
package org.eclipse.bpmn2.modeler.core.runtime;
import java.util.ArrayList;
+import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
@@ -24,8 +25,10 @@ import org.eclipse.bpmn2.modeler.core.adapters.ExtendedPropertiesAdapter;
import org.eclipse.bpmn2.modeler.core.adapters.FeatureDescriptor;
import org.eclipse.bpmn2.modeler.core.adapters.ObjectPropertyProvider;
import org.eclipse.bpmn2.modeler.core.model.ModelDecorator;
+import org.eclipse.bpmn2.modeler.core.preferences.Bpmn2Preferences;
import org.eclipse.bpmn2.modeler.core.utils.ModelUtil.Bpmn2DiagramType;
import org.eclipse.bpmn2.modeler.core.utils.SimpleTreeIterator;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.emf.common.notify.Adapter;
@@ -298,8 +301,28 @@ public class ModelExtensionDescriptor extends BaseRuntimeExtensionDescriptor {
getModelExtensionProperties(null, this, e);
}
+ @Override
+ public void setConfigFile(IFile configFile) {
+ super.setConfigFile(configFile);
+ if (configFile!=null) {
+ Bpmn2Preferences prefs = Bpmn2Preferences.getInstance(configFile.getProject());
+ prefs.loadDefaults(targetRuntime, Bpmn2Preferences.PREF_MODEL_ENABLEMENT);
+ }
+ }
+
public void dispose() {
+ // remove the ModelEnablement classes and features that may
+ // have been defined in this Model Extension
+ if (configFile!=null) {
+ Bpmn2Preferences prefs = Bpmn2Preferences.getInstance(configFile.getProject());
+ prefs.unloadDefaults(targetRuntime, Bpmn2Preferences.PREF_MODEL_ENABLEMENT);
+ }
super.dispose();
+ if (configFile!=null) {
+ Bpmn2Preferences prefs = Bpmn2Preferences.getInstance(configFile.getProject());
+ prefs.loadDefaults(targetRuntime, Bpmn2Preferences.PREF_MODEL_ENABLEMENT);
+ }
+
getModelDecorator().dispose();
}
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/StyleUtil.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/StyleUtil.java
index b27da6c3..4239e7a0 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/StyleUtil.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/StyleUtil.java
@@ -108,6 +108,7 @@ public class StyleUtil {
IColorConstant foreground = ga instanceof AbstractText ? ss.getLabelForeground() : ss.getShapeForeground();
IColorConstant background = ss.getShapeBackground();
+ peService.setPropertyValue(ga, Bpmn2Preferences.PREF_SHAPE_STYLE, Boolean.TRUE.toString());
if (BusinessObjectUtil.isConnection(be.eClass().getInstanceClass())) {
ga.setForeground(gaService.manageColor(diagram, foreground));
if (ga instanceof AbstractText) {
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/diagram/Bpmn2FeatureMap.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/diagram/Bpmn2FeatureMap.java
index 260aa2a0..00d2ab2f 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/diagram/Bpmn2FeatureMap.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/diagram/Bpmn2FeatureMap.java
@@ -215,7 +215,14 @@ public class Bpmn2FeatureMap {
ALL_SHAPES.addAll(SUBPROCESS);
ALL_SHAPES.addAll(CHOREOGRAPHY);
ALL_SHAPES.addAll(CONVERSATION);
- ALL_SHAPES.addAll(ALL_DATA);
+ // By default we want to ignore DataInput and DataOutput from Shapes
+ // because they are created in Activity inputs and outputs as well
+ // as in Process-level diagrams. The extension plugin can override
+ // this behavior with its own {@link IObjectDecorator} implementation.
+ // {@see DefaultObjectDecorator} for details.
+ ALL_SHAPES.add(DataObject.class);
+ ALL_SHAPES.add(DataStoreReference.class);
+ ALL_SHAPES.add(Message.class);
ALL_SHAPES.addAll(ARTIFACTS);
ALL_SHAPES.addAll(SWIMLANES);
}
diff --git a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/Bpmn2PropertyPage.java b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/Bpmn2PropertyPage.java
index c0a75a2b..05d61800 100644
--- a/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/Bpmn2PropertyPage.java
+++ b/plugins/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/Bpmn2PropertyPage.java
@@ -12,12 +12,16 @@
******************************************************************************/
package org.eclipse.bpmn2.modeler.ui.preferences;
+import org.eclipse.bpmn2.modeler.core.builder.BPMN2Nature;
import org.eclipse.bpmn2.modeler.core.preferences.Bpmn2Preferences;
import org.eclipse.bpmn2.modeler.core.runtime.TargetRuntime;
import org.eclipse.bpmn2.modeler.ui.Activator;
import org.eclipse.bpmn2.modeler.ui.Messages;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -34,6 +38,8 @@ public class Bpmn2PropertyPage extends PropertyPage {
private Combo cboRuntimes;
private Button btnCheckProjectNature;
+ private Button addRemoveProjectNature;
+ private IProject project;
public Bpmn2PropertyPage() {
super();
@@ -55,10 +61,36 @@ public class Bpmn2PropertyPage extends PropertyPage {
cboRuntimes = new Combo(container, SWT.READ_ONLY);
cboRuntimes.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));
+ addRemoveProjectNature = new Button(container, SWT.CHECK);
+ addRemoveProjectNature.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 3, 1));
+ addRemoveProjectNature.setText("Enable BPMN2 Project Nature");
+ try {
+ if (project.getNature(BPMN2Nature.NATURE_ID)==null) {
+ addRemoveProjectNature.setSelection(false);
+ }
+ else {
+ addRemoveProjectNature.setSelection(true);
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ addRemoveProjectNature.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ boolean enabled = addRemoveProjectNature.getSelection();
+ btnCheckProjectNature.setEnabled(!enabled);
+ BPMN2Nature.setBPMN2Nature(project, enabled);
+ }
+ });
+ boolean enabled = addRemoveProjectNature.getSelection();
+
btnCheckProjectNature = new Button(container, SWT.CHECK);
- btnCheckProjectNature.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 3, 1));
+ GridData d = new GridData(SWT.LEFT, SWT.CENTER, true, false, 3, 1);
+ d.horizontalIndent = 20;
+ btnCheckProjectNature.setLayoutData(d);
btnCheckProjectNature.setText(Bpmn2Preferences.PREF_CHECK_PROJECT_NATURE_LABEL);
-
+ btnCheckProjectNature.setEnabled(!enabled);
+
initData();
return container;
@@ -77,7 +109,7 @@ public class Bpmn2PropertyPage extends PropertyPage {
}
public void loadPrefs() {
- IProject project = (IProject) getElement().getAdapter(IProject.class);
+ project = (IProject) getElement().getAdapter(IProject.class);
preferences = Bpmn2Preferences.getInstance(project);
preferences.useProjectPreferences();
}

Back to the top