summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-01-16 07:32:43 (EST)
committerStephan Born2012-04-24 04:29:37 (EDT)
commitac6f1870eae9c5e55cfe477adc354a82e3cad690 (patch)
tree6df987c5625b5d386c4504c2e71fb8c88f36c1d6
parent92d06db1c47c50f240f6354e3fb5715d9d2b3366 (diff)
downloadorg.eclipse.stardust.ide-ac6f1870eae9c5e55cfe477adc354a82e3cad690.zip
org.eclipse.stardust.ide-ac6f1870eae9c5e55cfe477adc354a82e3cad690.tar.gz
org.eclipse.stardust.ide-ac6f1870eae9c5e55cfe477adc354a82e3cad690.tar.bz2
Formatting.
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ide@52892 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/widgets/ExternalClassAdditionDialog.java422
1 files changed, 234 insertions, 188 deletions
diff --git a/modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/widgets/ExternalClassAdditionDialog.java b/modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/widgets/ExternalClassAdditionDialog.java
index c9c95ea..a20d17e 100644
--- a/modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/widgets/ExternalClassAdditionDialog.java
+++ b/modeling/org.eclipse.stardust.modeling.transformation/src/org/eclipse/stardust/modeling/transformation/messaging/modeling/application/transformation/widgets/ExternalClassAdditionDialog.java
@@ -44,192 +44,235 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
+public class ExternalClassAdditionDialog extends Dialog implements ModifyListener
+{
+ private static final int RESET_ID = IDialogConstants.NO_TO_ALL_ID + 1;
-public class ExternalClassAdditionDialog extends Dialog implements ModifyListener {
- private static final int RESET_ID = IDialogConstants.NO_TO_ALL_ID + 1;
- private Text messageNameText;
- private String tagName;
+ private Text messageNameText;
- private MessageTransformationController controller;
- private AccessPointType messageType;
- private String messageName;
- private List messageTypes;
- private String preset;
- private List allMessageTypes = new ArrayList();
- private List typeFilters = new ArrayList();
-
-
+ private String tagName;
-private Label errorLabel;
-private WorkflowModelEditor wfme;
-private Composite mainComposite;
-private boolean isError = false;
-//private Combo dataTypeCombo;
+ private MessageTransformationController controller;
+ private AccessPointType messageType;
-private TypeSelectionComposite classBrowser;
-private StackLayout stack;
-private Composite structPrimComposite;
+ private String messageName;
-private Composite messageComposite;
-protected ViewerFilter selectedFilter;
-private DirectionType directionType;
+ private List messageTypes;
-
- public ExternalClassAdditionDialog(Shell parentShell, MessageTransformationController controller, List messageTypes, String preset, DirectionType directionType) {
- super(parentShell);
- this.controller = controller;
- this.messageTypes = messageTypes;
- this.directionType = directionType;
- this.preset = preset;
- allMessageTypes.addAll(controller.getSourceMessageTypes());
- allMessageTypes.addAll(controller.getTargetMessageTypes());
- allMessageTypes.addAll(controller.getExternalClassTypes());
- typeFilters.add(new StructuredTypesFilter());
- typeFilters.add(new PrimitivesFilter());
- if (!controller.isSimpleMode()) {
- typeFilters.add(new SerializableFilter());
- }
- }
-
- protected Control createDialogArea(Composite parent) {
- mainComposite = parent;
- if ((null != PlatformUI.getWorkbench())
- && (null != PlatformUI.getWorkbench().getActiveWorkbenchWindow())
- && (null != PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow()
- .getActivePage()))
- {
- IEditorPart currentEditor = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow()
- .getActivePage()
- .getActiveEditor();
- if (currentEditor instanceof WorkflowModelEditor)
- {
- wfme = (WorkflowModelEditor) currentEditor;
- }
- }
-
-
- Composite comp = (Composite) super.createDialogArea(parent);
- comp.setLayout(new GridLayout());
-
- Composite groupComposite = new Group(comp, SWT.NONE);
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- groupComposite.setLayout(layout);
-
- Label tagNameLabel = new Label(groupComposite, SWT.LEFT);
- tagNameLabel.setText(MessageFormat.format(Modeling_Messages.TXT_NAME, new Object[]{controller.getNameString()}));
- if (controller.isSimpleMode()) {
-
- } else {
- tagNameLabel.setText(Modeling_Messages.TXT_INSTANCE_NAME);
- }
- messageNameText = new Text(groupComposite, SWT.SINGLE | SWT.BORDER);
- messageNameText.addModifyListener(this);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- messageNameText.setLayoutData(data);
- errorLabel = new Label(groupComposite, SWT.NONE);
- errorLabel.setImage(MessageTransformationModelingPlugin.getDefault().getImageDescriptor("icons/error.gif").createImage()); //$NON-NLS-1$
- errorLabel.setVisible(false);
-
-
- Label typeLabel = new Label(groupComposite, SWT.LEFT);
- typeLabel.setText(Modeling_Messages.TXT_CLASS);
-
-
- classBrowser = new TypeSelectionComposite(groupComposite, Modeling_Messages.PlainJavaPropertyPage_LB_Plain_Java);
- classBrowser.getText().addModifyListener(new ModifyListener(){
- public void modifyText(ModifyEvent e) {
- serializableTypeModified(e);
- }
-
- });
-
-
-
- parent.getShell().setMinimumSize(300, 150);
- parent.getShell().setText(Modeling_Messages.TXT_ADD_EXTERNAL_CL);
-
- return comp;
- }
-
-
- protected void buttonEnablement() {
- String text = messageNameText.getText();
- this.errorLabel.setVisible(isError);
- if (getButton(IDialogConstants.OK_ID) != null) {
- getButton(IDialogConstants.OK_ID).setEnabled(!isError && !text.equalsIgnoreCase("") && text.indexOf(" ") == -1); //$NON-NLS-1$ //$NON-NLS-2$
- }
-}
-
-
-protected void createButtonsForButtonBar(Composite parent) {
- super.createButtonsForButtonBar(parent);
- getButton(IDialogConstants.OK_ID).setEnabled(false);
- this.buttonEnablement();
-}
-
- protected void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID) {
- messageName = messageNameText.getText();
- }
- super.buttonPressed(buttonId);
-
- }
-
-public void modifyText(ModifyEvent arg0) {
- String text = messageNameText.getText();
- if (!controller.isSimpleMode()) {
- if (getMessageTypeByName(text) != null) {
- isError = true;
- errorLabel.setToolTipText(MessageFormat.format(Modeling_Messages.TXT_ALREADY_EXIST_WITHIN_CONTEXT, new Object[]{text}));
- } else {
- if (!StringUtils.isValidIdentifier(text)) {
- isError = true;
- errorLabel.setToolTipText(MessageFormat.format(Modeling_Messages.TXT_NOT_VALID_NAME, new Object[]{text}));
- } else {
- isError = false;
- errorLabel.setToolTipText(null);
- }
- }
- } else {
- if (!StringUtils.isValidIdentifier(text)) {
- isError = true;
- errorLabel.setToolTipText(MessageFormat.format(Modeling_Messages.TXT_NOT_VALID_NAME, new Object[]{text}));
- } else {
- isError = false;
- errorLabel.setToolTipText(null);
- }
- }
- buttonEnablement();
-}
-
-private void serializableTypeModified(ModifyEvent e) {
- if (classBrowser.getType() != null) {
- String messageName = classBrowser.getType().getType().getElementName();
- String text = messageName;
- int n = 1;
- while ( isAccessPointIdDefined(text + n) )
- {
- n++;
- }
- text = text + n;
- messageNameText.setText(text);
- AccessPointType apt = controller.getMtaUtils().createSerializableAccessPoint(classBrowser.getType(), text, directionType);
- this.messageType = apt;
- }
-}
-
-public AccessPointType getMessageType() {
- return messageType;
-}
-
-public String getMessageName() {
- return messageName;
-}
+ private String preset;
+
+ private List allMessageTypes = new ArrayList();
+
+ private List typeFilters = new ArrayList();
+
+ private Label errorLabel;
+
+ private WorkflowModelEditor wfme;
+
+ private Composite mainComposite;
+
+ private boolean isError = false;
+
+ // private Combo dataTypeCombo;
+
+ private TypeSelectionComposite classBrowser;
+
+ private StackLayout stack;
+
+ private Composite structPrimComposite;
+
+ private Composite messageComposite;
+
+ protected ViewerFilter selectedFilter;
+
+ private DirectionType directionType;
+
+ public ExternalClassAdditionDialog(Shell parentShell,
+ MessageTransformationController controller, List messageTypes, String preset,
+ DirectionType directionType)
+ {
+ super(parentShell);
+ this.controller = controller;
+ this.messageTypes = messageTypes;
+ this.directionType = directionType;
+ this.preset = preset;
+ allMessageTypes.addAll(controller.getSourceMessageTypes());
+ allMessageTypes.addAll(controller.getTargetMessageTypes());
+ allMessageTypes.addAll(controller.getExternalClassTypes());
+ typeFilters.add(new StructuredTypesFilter());
+ typeFilters.add(new PrimitivesFilter());
+ if (!controller.isSimpleMode())
+ {
+ typeFilters.add(new SerializableFilter());
+ }
+ }
+
+ protected Control createDialogArea(Composite parent)
+ {
+ mainComposite = parent;
+ if ((null != PlatformUI.getWorkbench())
+ && (null != PlatformUI.getWorkbench().getActiveWorkbenchWindow())
+ && (null != PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getActivePage()))
+ {
+ IEditorPart currentEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getActivePage().getActiveEditor();
+ if (currentEditor instanceof WorkflowModelEditor)
+ {
+ wfme = (WorkflowModelEditor) currentEditor;
+ }
+ }
+
+ Composite comp = (Composite) super.createDialogArea(parent);
+ comp.setLayout(new GridLayout());
+
+ Composite groupComposite = new Group(comp, SWT.NONE);
+
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 3;
+ groupComposite.setLayout(layout);
+
+ Label tagNameLabel = new Label(groupComposite, SWT.LEFT);
+ tagNameLabel.setText(MessageFormat.format(Modeling_Messages.TXT_NAME,
+ new Object[] {controller.getNameString()}));
+ if (controller.isSimpleMode())
+ {
+
+ }
+ else
+ {
+ tagNameLabel.setText(Modeling_Messages.TXT_INSTANCE_NAME);
+ }
+ messageNameText = new Text(groupComposite, SWT.SINGLE | SWT.BORDER);
+ messageNameText.addModifyListener(this);
+ GridData data = new GridData(GridData.FILL_HORIZONTAL);
+ messageNameText.setLayoutData(data);
+ errorLabel = new Label(groupComposite, SWT.NONE);
+ errorLabel.setImage(MessageTransformationModelingPlugin.getDefault()
+ .getImageDescriptor("icons/error.gif").createImage()); //$NON-NLS-1$
+ errorLabel.setVisible(false);
+
+ Label typeLabel = new Label(groupComposite, SWT.LEFT);
+ typeLabel.setText(Modeling_Messages.TXT_CLASS);
+
+ classBrowser = new TypeSelectionComposite(groupComposite,
+ Modeling_Messages.PlainJavaPropertyPage_LB_Plain_Java);
+ classBrowser.getText().addModifyListener(new ModifyListener()
+ {
+ public void modifyText(ModifyEvent e)
+ {
+ serializableTypeModified(e);
+ }
+
+ });
+
+ parent.getShell().setMinimumSize(300, 150);
+ parent.getShell().setText(Modeling_Messages.TXT_ADD_EXTERNAL_CL);
+
+ return comp;
+ }
+
+ protected void buttonEnablement()
+ {
+ String text = messageNameText.getText();
+ this.errorLabel.setVisible(isError);
+ if (getButton(IDialogConstants.OK_ID) != null)
+ {
+ getButton(IDialogConstants.OK_ID).setEnabled(
+ !isError && !text.equalsIgnoreCase("") && text.indexOf(" ") == -1); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ protected void createButtonsForButtonBar(Composite parent)
+ {
+ super.createButtonsForButtonBar(parent);
+ getButton(IDialogConstants.OK_ID).setEnabled(false);
+ this.buttonEnablement();
+ }
+
+ protected void buttonPressed(int buttonId)
+ {
+ if (buttonId == IDialogConstants.OK_ID)
+ {
+ messageName = messageNameText.getText();
+ }
+ super.buttonPressed(buttonId);
+
+ }
+
+ public void modifyText(ModifyEvent arg0)
+ {
+ String text = messageNameText.getText();
+ if (!controller.isSimpleMode())
+ {
+ if (getMessageTypeByName(text) != null)
+ {
+ isError = true;
+ errorLabel.setToolTipText(MessageFormat
+ .format(Modeling_Messages.TXT_ALREADY_EXIST_WITHIN_CONTEXT,
+ new Object[] {text}));
+ }
+ else
+ {
+ if (!StringUtils.isValidIdentifier(text))
+ {
+ isError = true;
+ errorLabel.setToolTipText(MessageFormat.format(
+ Modeling_Messages.TXT_NOT_VALID_NAME, new Object[] {text}));
+ }
+ else
+ {
+ isError = false;
+ errorLabel.setToolTipText(null);
+ }
+ }
+ }
+ else
+ {
+ if (!StringUtils.isValidIdentifier(text))
+ {
+ isError = true;
+ errorLabel.setToolTipText(MessageFormat.format(
+ Modeling_Messages.TXT_NOT_VALID_NAME, new Object[] {text}));
+ }
+ else
+ {
+ isError = false;
+ errorLabel.setToolTipText(null);
+ }
+ }
+ buttonEnablement();
+ }
+
+ private void serializableTypeModified(ModifyEvent e)
+ {
+ if (classBrowser.getType() != null)
+ {
+ String messageName = classBrowser.getType().getType().getElementName();
+ String text = messageName;
+ int n = 1;
+ while (isAccessPointIdDefined(text + n))
+ {
+ n++;
+ }
+ text = text + n;
+ messageNameText.setText(text);
+ AccessPointType apt = controller.getMtaUtils().createSerializableAccessPoint(
+ classBrowser.getType(), text, directionType);
+ this.messageType = apt;
+ }
+ }
+
+ public AccessPointType getMessageType()
+ {
+ return messageType;
+ }
+
+ public String getMessageName()
+ {
+ return messageName;
+ }
private boolean isAccessPointIdDefined(String id)
{
@@ -244,14 +287,17 @@ public String getMessageName() {
return false;
}
-private AccessPointType getMessageTypeByName(String name) {
- for (Iterator i = allMessageTypes.iterator(); i.hasNext();) {
- AccessPointType messageType = (AccessPointType)i.next();
- if (messageType.getId().equalsIgnoreCase(name)) {
- return messageType;
- }
- }
- return null;
-}
+ private AccessPointType getMessageTypeByName(String name)
+ {
+ for (Iterator i = allMessageTypes.iterator(); i.hasNext();)
+ {
+ AccessPointType messageType = (AccessPointType) i.next();
+ if (messageType.getId().equalsIgnoreCase(name))
+ {
+ return messageType;
+ }
+ }
+ return null;
+ }
}