summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-04-03 03:44:17 (EDT)
committerStephan Born2012-04-24 10:13:48 (EDT)
commitcdcf3a4255f3f4ea1823597f75696b6b194f4769 (patch)
tree78ee18bcdd2a40240c06c58c32a033bf5f3c9cff
parent79b517bb095a9141368d99ef0dd92d961e282ecd (diff)
downloadorg.eclipse.stardust.ide-cdcf3a4255f3f4ea1823597f75696b6b194f4769.zip
org.eclipse.stardust.ide-cdcf3a4255f3f4ea1823597f75696b6b194f4769.tar.gz
org.eclipse.stardust.ide-cdcf3a4255f3f4ea1823597f75696b6b194f4769.tar.bz2
Jira-ID: CRNT-23768
Referenced structured types should be differentiated by check box in external web application and Message transformation applications git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ide@55216 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/ReferencedModelSorter.java37
-rw-r--r--modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/MessageTransformationApplicationControlsManager.java48
-rw-r--r--modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/widgets/DelegatingMessageTypeLabelProvider.java5
-rw-r--r--modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/widgets/MessageTypeLabelProvider.java156
4 files changed, 185 insertions, 61 deletions
diff --git a/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/ReferencedModelSorter.java b/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/ReferencedModelSorter.java
index ec887e6..36f8172 100644
--- a/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/ReferencedModelSorter.java
+++ b/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/ReferencedModelSorter.java
@@ -10,10 +10,15 @@
*******************************************************************************/
package org.eclipse.stardust.modeling.core.properties;
+import java.awt.List;
+import java.util.Iterator;
+
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.stardust.model.xpdl.carnot.AccessPointType;
import org.eclipse.stardust.model.xpdl.carnot.ModelType;
+import org.eclipse.stardust.model.xpdl.carnot.util.AttributeUtil;
import org.eclipse.stardust.model.xpdl.carnot.util.ModelUtils;
@@ -40,6 +45,16 @@ public class ReferencedModelSorter extends ViewerSorter
}
ModelType model1 = ModelUtils.findContainingModel((EObject) e1);
ModelType model2 = ModelUtils.findContainingModel((EObject) e2);
+ if (model1 == null && model2 == null)
+ {
+ if (e1 instanceof AccessPointType && e2 instanceof AccessPointType)
+ {
+ AccessPointType ap1 = (AccessPointType) e1;
+ AccessPointType ap2 = (AccessPointType) e2;
+ model1 = parseReferencedModel(ap1);
+ model2 = parseReferencedModel(ap2);
+ }
+ }
if (model1 != model2)
{
if (model1 == model)
@@ -58,4 +73,26 @@ public class ReferencedModelSorter extends ViewerSorter
{
this.model = model;
}
+
+ private ModelType parseReferencedModel(AccessPointType apt)
+ {
+ String path = AttributeUtil.getAttribute(apt, "carnot:engine:dataType").getValue(); //$NON-NLS-1$
+ if (path.startsWith("typeDeclaration:")) //$NON-NLS-1$
+ {
+ int idx1 = path.indexOf("{");
+ int idx2 = path.indexOf("}");
+ String modelID = path.substring(idx1 + 1, idx2);
+ java.util.List<String> refModelsURI = ModelUtils
+ .getURIsForExternalPackages(model);
+ for (Iterator<String> i = refModelsURI.iterator(); i.hasNext();)
+ {
+ ModelType refModel = ModelUtils.getReferencedModelByURI(model, i.next());
+ if (refModel.getId().equalsIgnoreCase(modelID))
+ {
+ return refModel;
+ }
+ }
+ }
+ return model;
+ }
}
diff --git a/modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/MessageTransformationApplicationControlsManager.java b/modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/MessageTransformationApplicationControlsManager.java
index a4626f1..a8e0e1c 100644
--- a/modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/MessageTransformationApplicationControlsManager.java
+++ b/modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/MessageTransformationApplicationControlsManager.java
@@ -42,7 +42,9 @@ import org.eclipse.stardust.model.xpdl.carnot.IModelElement;
import org.eclipse.stardust.model.xpdl.carnot.ModelType;
import org.eclipse.stardust.model.xpdl.carnot.util.ModelUtils;
import org.eclipse.stardust.modeling.common.ui.jface.utils.FormBuilder;
+import org.eclipse.stardust.modeling.core.Diagram_Messages;
import org.eclipse.stardust.modeling.core.editors.WorkflowModelEditor;
+import org.eclipse.stardust.modeling.core.properties.ReferencedModelSorter;
import org.eclipse.stardust.modeling.javascript.editor.EditorUtils;
import org.eclipse.stardust.modeling.javascript.editor.JSCompilationUnitEditor;
import org.eclipse.stardust.modeling.javascript.editor.JSCompilationUnitEditor.RegionWithLineOffset;
@@ -86,6 +88,7 @@ import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
@@ -185,6 +188,12 @@ public class MessageTransformationApplicationControlsManager
private Button sourceHighlightedFilter;
private MessageTransformationController controller = new MessageTransformationController();
+
+ private DelegatingMessageTypeLabelProvider sourceLabelProvider = new DelegatingMessageTypeLabelProvider(controller);
+
+ private DelegatingMessageTypeLabelProvider targetLabelProvider = new DelegatingMessageTypeLabelProvider(controller);
+
+ private ReferencedModelSorter refModelSorter = new ReferencedModelSorter();
private SourceHighlightFilter sourceHighlightViewerFilter;
@@ -212,6 +221,8 @@ public class MessageTransformationApplicationControlsManager
private Button btnAddExternalClass;
+ private Button groupingCheckbox;
+
public Control create(final Composite parent, final IModelElement modelElement)
{
return create(parent, modelElement, true);
@@ -781,6 +792,36 @@ public class MessageTransformationApplicationControlsManager
});
menuMgr.setRemoveAllWhenShown(true);
tree.setMenu(menu);
+
+ groupingCheckbox = FormBuilder.createCheckBox(ioComposite, Diagram_Messages.LB_GroupModelElements);
+ groupingCheckbox.addSelectionListener(new SelectionListener(){
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+
+ public void widgetSelected(SelectionEvent e)
+ {
+ sourceLabelProvider.setShowGroupInfo(groupingCheckbox.getSelection());
+ targetLabelProvider.setShowGroupInfo(groupingCheckbox.getSelection());
+ refModelSorter.setGrouped(groupingCheckbox.getSelection());
+ if (groupingCheckbox.getSelection())
+ {
+ targetMessageTreeViewer.setSorter(refModelSorter);
+ sourceMessageTreeViewer.setSorter(refModelSorter);
+ }
+ else
+ {
+ targetMessageTreeViewer.setSorter(null);
+ sourceMessageTreeViewer.setSorter(null);
+ }
+ sourceMessageTreeViewer.refresh();
+ targetMessageTreeViewer.refresh();
+ refreshDocument();
+ }
+
+ });
+
}
private void createEditorComposite(final IModelElement modelElement,
@@ -1160,17 +1201,16 @@ public class MessageTransformationApplicationControlsManager
MultipleAccessPathBrowserContentProvider provider = new MultipleAccessPathBrowserContentProvider(
DirectionType.INOUT_LITERAL, controller);
sourceMessageTreeViewer.setContentProvider(provider);
- sourceMessageTreeViewer.setLabelProvider(new DelegatingMessageTypeLabelProvider(
- controller));
+ sourceMessageTreeViewer.setLabelProvider(sourceLabelProvider);
sourceMessageTreeViewer.setComparer(new MessageTypeComparer());
+ refModelSorter.setModel(this.model);
sourceMessageTreeViewer.setInput(controller.getSourceMessageTypes());
controller.setSourceAPB(provider);
provider = new MultipleAccessPathBrowserContentProvider(
DirectionType.INOUT_LITERAL, controller);
targetMessageTreeViewer.setContentProvider(provider);
- targetMessageTreeViewer.setLabelProvider(new DelegatingMessageTypeLabelProvider(
- controller));
+ targetMessageTreeViewer.setLabelProvider(targetLabelProvider);
targetMessageTreeViewer.setComparer(new MessageTypeComparer());
targetMessageTreeViewer.setInput(controller.getTargetMessageTypes());
controller.setTargetAPB(provider);
diff --git a/modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/widgets/DelegatingMessageTypeLabelProvider.java b/modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/widgets/DelegatingMessageTypeLabelProvider.java
index 4403909..0e07308 100644
--- a/modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/widgets/DelegatingMessageTypeLabelProvider.java
+++ b/modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/widgets/DelegatingMessageTypeLabelProvider.java
@@ -39,4 +39,9 @@ public class DelegatingMessageTypeLabelProvider extends CellLabelProvider
.getColumnImage(cell.getElement(), cell.getColumnIndex()));
cell.setText(labelProvider.getColumnText(cell.getElement(), cell.getColumnIndex()));
}
+
+ public void setShowGroupInfo(boolean showGroupInfo)
+ {
+ labelProvider.setShowGroupInfo(showGroupInfo);
+ }
} \ No newline at end of file
diff --git a/modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/widgets/MessageTypeLabelProvider.java b/modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/widgets/MessageTypeLabelProvider.java
index 4c2c5d7..49298be 100644
--- a/modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/widgets/MessageTypeLabelProvider.java
+++ b/modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/widgets/MessageTypeLabelProvider.java
@@ -15,6 +15,8 @@ import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.stardust.engine.extensions.transformation.model.mapping.FieldMapping;
import org.eclipse.stardust.model.xpdl.carnot.AccessPointType;
+import org.eclipse.stardust.model.xpdl.carnot.AttributeType;
+import org.eclipse.stardust.model.xpdl.carnot.util.AttributeUtil;
import org.eclipse.stardust.modeling.transformation.messaging.modeling.MessageTransformationModelingPlugin;
import org.eclipse.stardust.modeling.transformation.messaging.modeling.application.transformation.MessageTransformationController;
import org.eclipse.stardust.modeling.transformation.messaging.modeling.application.transformation.breakpoints.MessageBreakpointManager;
@@ -24,35 +26,47 @@ import org.eclipse.swt.widgets.Display;
/**
* LabelProvider for the main element table.
- *
+ *
* @author Rainer Pielmann
* @version $Revision$
*/
-public class MessageTypeLabelProvider extends LabelProvider implements
- ITableLabelProvider
+public class MessageTypeLabelProvider extends LabelProvider
+ implements ITableLabelProvider
{
- private static final Image primitiveImage = MessageTransformationModelingPlugin.getDefault()
- .getImageDescriptor("icons/primitive_data.gif").createImage(); //$NON-NLS-1$
- private static final Image legoImage = MessageTransformationModelingPlugin.getDefault()
- .getImageDescriptor("icons/lego_icon.gif").createImage(); //$NON-NLS-1$
- private static final Image primitiveBpImage = MessageTransformationModelingPlugin.getDefault()
- .getImageDescriptor("icons/primitive_data_bp.png").createImage(); //$NON-NLS-1$
- private static final Image legoBpImage = MessageTransformationModelingPlugin.getDefault()
- .getImageDescriptor("icons/lego_icon_bp.png").createImage(); //$NON-NLS-1$
- private static final Image errorImage = MessageTransformationModelingPlugin.getDefault()
- .getImageDescriptor("icons/error_tsk.gif").createImage(); //$NON-NLS-1$
- private static final Image serializableImage = MessageTransformationModelingPlugin.getDefault()
- .getImageDescriptor("icons/serializable_data.gif").createImage(); //$NON-NLS-1$
-
+ private static final Image primitiveImage = MessageTransformationModelingPlugin
+ .getDefault().getImageDescriptor("icons/primitive_data.gif").createImage(); //$NON-NLS-1$
+
+ private static final Image legoImage = MessageTransformationModelingPlugin
+ .getDefault().getImageDescriptor("icons/lego_icon.gif").createImage(); //$NON-NLS-1$
+
+ private static final Image primitiveBpImage = MessageTransformationModelingPlugin
+ .getDefault().getImageDescriptor("icons/primitive_data_bp.png").createImage(); //$NON-NLS-1$
+
+ private static final Image legoBpImage = MessageTransformationModelingPlugin
+ .getDefault().getImageDescriptor("icons/lego_icon_bp.png").createImage(); //$NON-NLS-1$
+
+ private static final Image errorImage = MessageTransformationModelingPlugin
+ .getDefault().getImageDescriptor("icons/error_tsk.gif").createImage(); //$NON-NLS-1$
+
+ private static final Image serializableImage = MessageTransformationModelingPlugin
+ .getDefault().getImageDescriptor("icons/serializable_data.gif").createImage(); //$NON-NLS-1$
+
private static final int COLUMN_ID = 0;
+
private static final int COLUMN_TYPE = 1;
+
private static final int COLUMN_MAPPING = 2;
+
private static final int COLUMN_ERROR_IMAGE = 3;
-
+
private FontRegistry fontRegistry = new FontRegistry();
+
private MessageTransformationController controller;
+
private final MessageBreakpointManager breakpointManager;
+ private boolean showGroupInfo;
+
public MessageTypeLabelProvider(MessageTransformationController controller)
{
super();
@@ -64,7 +78,7 @@ public class MessageTypeLabelProvider extends LabelProvider implements
{
return getColumnText(element, 0);
}
-
+
public Image getColumnImage(Object element, int columnIndex)
{
if (element instanceof AccessPointType)
@@ -73,17 +87,19 @@ public class MessageTypeLabelProvider extends LabelProvider implements
{
AccessPointType messageType = (AccessPointType) element;
FieldMapping fm = (FieldMapping) controller.getFieldMappings().get(
- controller.getXPathFor(messageType));
+ controller.getXPathFor(messageType));
boolean breakpointAvailable = null == fm ? false : breakpointManager
.isBreakpointAvailable(fm.getFieldPath());
- if (controller.isSerializable(messageType)) {
- return breakpointAvailable ? legoBpImage : serializableImage;
+ if (controller.isSerializable(messageType))
+ {
+ return breakpointAvailable ? legoBpImage : serializableImage;
}
if (controller.isRoot(messageType) && controller.isSerializable(messageType))
{
return breakpointAvailable ? legoBpImage : serializableImage;
}
- if ((controller.isRoot(messageType) || controller.isComplexType(messageType)) & !controller.isPrimitive(messageType))
+ if ((controller.isRoot(messageType) || controller.isComplexType(messageType))
+ & !controller.isPrimitive(messageType))
{
return breakpointAvailable ? legoBpImage : legoImage;
}
@@ -102,54 +118,76 @@ public class MessageTypeLabelProvider extends LabelProvider implements
if (fm != null)
{
boolean valid = controller.validateMapping(fm, false);
- if (!valid) {
- return errorImage;
- }
+ if (!valid)
+ {
+ return errorImage;
+ }
}
}
}
- }
+ }
return null;
}
+ private String parseName(String path)
+ {
+ if (path.startsWith("typeDeclaration:")) //$NON-NLS-1$
+ {
+ path = path.replaceAll("typeDeclaration:", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ path = path.replace("{", "");//$NON-NLS-1$ //$NON-NLS-2$
+ path = path.replace("}", " / "); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return path;
+ }
public String getColumnText(Object element, int columnIndex)
{
switch (columnIndex)
{
- case COLUMN_ID:
- if (element instanceof AccessPointType)
- {
- AccessPointType messageType = (AccessPointType) element;
- String displayString = messageType.getId();
- if (displayString.startsWith("@")){ //$NON-NLS-1$
- displayString = displayString.replace("@", ""); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return displayString;
+ case COLUMN_ID:
+ if (element instanceof AccessPointType)
+ {
+ AccessPointType messageType = (AccessPointType) element;
+ String displayString = messageType.getId();
+ if (displayString.startsWith("@")) { //$NON-NLS-1$
+ displayString = displayString.replace("@", ""); //$NON-NLS-1$ //$NON-NLS-2$
}
- case COLUMN_TYPE:
- AccessPointType messageElement = (AccessPointType) element;
- String typeString = controller.getTypeString(messageElement);
- if (controller.isList(messageElement))
+ return displayString;
+ }
+ case COLUMN_TYPE:
+ AccessPointType messageElement = (AccessPointType) element;
+ String typeString = controller.getTypeString(messageElement);
+ if (controller.isList(messageElement))
+ {
+ typeString = typeString + "*"; //$NON-NLS-1$
+ typeString = typeString.replace("null", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ if (showGroupInfo)
+ {
+ AttributeType attType = AttributeUtil.getAttribute(messageElement,
+ "carnot:engine:dataType"); //$NON-NLS-1$
+ if (attType != null)
{
- typeString = typeString + "*"; //$NON-NLS-1$
- typeString = typeString.replace("null", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ String path = AttributeUtil.getAttribute(messageElement,
+ "carnot:engine:dataType").getValue(); //$NON-NLS-1$
+ typeString = this.parseName(path);
}
- return typeString;
- case COLUMN_MAPPING:
- if (element instanceof AccessPointType)
+ }
+ return typeString;
+ case COLUMN_MAPPING:
+ if (element instanceof AccessPointType)
+ {
+ AccessPointType messageType = (AccessPointType) element;
+ String xPath = controller.getXPathFor(messageType);
+ FieldMapping fieldMapping = (FieldMapping) controller.getFieldMappings().get(
+ xPath);
+ if (fieldMapping != null && fieldMapping.getMappingExpression() != null)
{
- AccessPointType messageType = (AccessPointType) element;
- String xPath = controller.getXPathFor(messageType);
- FieldMapping fieldMapping = (FieldMapping) controller.getFieldMappings()
- .get(xPath);
- if (fieldMapping != null && fieldMapping.getMappingExpression() != null)
- {
- String text = fieldMapping.getMappingExpression();
- text = text.replace('\n', ' ');
- return text;
- }
+ String text = fieldMapping.getMappingExpression();
+ text = text.replace('\n', ' ');
+ return text;
}
+ }
}
return ""; //$NON-NLS-1$
}
@@ -160,11 +198,10 @@ public class MessageTypeLabelProvider extends LabelProvider implements
if (element instanceof AccessPointType)
{
AccessPointType messageType = (AccessPointType) element;
- if ( !controller.isSourceField(messageType))
+ if (!controller.isSourceField(messageType))
{
if ((controller.hasMappingExpression(element) || controller
- .hasMappingStatement(element))
- && columnIndex == COLUMN_ID)
+ .hasMappingStatement(element)) && columnIndex == COLUMN_ID)
{
font = fontRegistry.getItalic(Display.getCurrent().getSystemFont()
.getFontData()[0].getName());
@@ -188,4 +225,9 @@ public class MessageTypeLabelProvider extends LabelProvider implements
return font;
}
+ public void setShowGroupInfo(boolean showGroupInfo)
+ {
+ this.showGroupInfo = showGroupInfo;
+ }
+
} \ No newline at end of file