Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/CustomElementFeatureContainer.java19
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/ICustomElementFeatureContainer.java5
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/TargetRuntime.java1
-rw-r--r--plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/ImportUtil.java18
4 files changed, 35 insertions, 8 deletions
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/CustomElementFeatureContainer.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/CustomElementFeatureContainer.java
index f67b35b3..250e425f 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/CustomElementFeatureContainer.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/CustomElementFeatureContainer.java
@@ -17,6 +17,7 @@ import org.eclipse.bpmn2.modeler.core.runtime.CustomTaskDescriptor;
import org.eclipse.bpmn2.modeler.core.runtime.CustomTaskImageProvider;
import org.eclipse.bpmn2.modeler.core.runtime.TargetRuntime;
import org.eclipse.bpmn2.modeler.core.utils.BusinessObjectUtil;
+import org.eclipse.bpmn2.modeler.core.utils.ImportUtil;
import org.eclipse.core.runtime.Assert;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
@@ -182,15 +183,17 @@ public class CustomElementFeatureContainer implements ICustomElementFeatureConta
// IAddContext can also mean that a file is dragged, therefore we have
// to check if we are really dragging a customTask
- if (context instanceof IAddContext &&
- ((IAddContext)context).getNewObject() instanceof EObject ) {
- EObject object = (EObject) ((IAddContext)context).getNewObject();
+ if (context instanceof IAddContext) {
TargetRuntime rt = TargetRuntime.getCurrentRuntime();
- for (CustomTaskDescriptor ctd : rt.getCustomTaskDescriptors()) {
- id = ctd.getFeatureContainer().getId(object);
- if (ctd.getId().equals(id)) {
- context.putProperty(GraphitiConstants.CUSTOM_ELEMENT_ID, id);
- return (String)id;
+ Object newObject = ((IAddContext)context).getNewObject();
+ if (newObject instanceof EObject ) {
+ for (CustomTaskDescriptor ctd : rt.getCustomTaskDescriptors()) {
+ // FIXME: {@see ICustomElementFeatureContainer#getId(EObject)}
+ id = ctd.getFeatureContainer().getId((EObject) newObject);
+ if (ctd.getId().equals(id)) {
+ context.putProperty(GraphitiConstants.CUSTOM_ELEMENT_ID, id);
+ return (String)id;
+ }
}
}
}
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/ICustomElementFeatureContainer.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/ICustomElementFeatureContainer.java
index 97bdcaee..315b6bbd 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/ICustomElementFeatureContainer.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/ICustomElementFeatureContainer.java
@@ -58,6 +58,11 @@ public interface ICustomElementFeatureContainer extends IFeatureContainer {
* @param object - the model object to inspect
* @return a Custom Task ID string or null
*/
+ // FIXME: change parameter type to Object. This will allow the Target Runtime extension
+ // to handle DND objects from Project Explorer because AddContext.getNewObject() will
+ // be an IFile or IType or something other than EObject. By inspecting the NewObject,
+ // the extension plugin can decide whether it wants to handle DND of different types
+ // of files onto the canvas.
public abstract String getId(EObject object);
/* (non-Javadoc)
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/TargetRuntime.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/TargetRuntime.java
index e9de4516..702df098 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/TargetRuntime.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/TargetRuntime.java
@@ -458,6 +458,7 @@ public class TargetRuntime extends BaseRuntimeExtensionDescriptor implements IRu
ct.targetRuntime = this;
}
+ // FIXME: {@see ICustomElementFeatureContainer#getId(EObject)}
public String getCustomTaskId(EObject object) {
for (CustomTaskDescriptor ctd : getCustomTaskDescriptors()) {
String id = ctd.getFeatureContainer().getId(object);
diff --git a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/ImportUtil.java b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/ImportUtil.java
index dca11f55..9f1fa369 100644
--- a/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/ImportUtil.java
+++ b/plugins/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/ImportUtil.java
@@ -282,6 +282,24 @@ public class ImportUtil {
return null;
}
+ // FIXME: {@see ICustomElementFeatureContainer#getId(EObject)}
+ public static String getImportKind(Object object) {
+ String kind = null;
+ if (object instanceof IFile) {
+ String ext = ((IFile)object).getFileExtension();
+ if ("xml".equals(ext) || "xsd".equals(ext))
+ kind = IMPORT_KIND_XML_SCHEMA;
+ else if ("bpmn".equals(ext) || "bpmn2".equals(ext))
+ kind = IMPORT_KIND_BPMN2;
+ else if ("wsdl".equals(ext))
+ kind = IMPORT_KIND_WSDL;
+ }
+ else if (object instanceof IType) {
+ kind = IMPORT_KIND_JAVA;
+ }
+ return kind;
+ }
+
public Object loadImport(URI uri, String kind) {
return loadImport(this.fHackedResourceSet, uri, kind);
}

Back to the top