summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Pielmann2012-04-10 03:32:58 (EDT)
committer Stephan Born2012-04-24 10:13:56 (EDT)
commit68f383ef37fa0e608f76fcbae12a7fe619a55447 (patch)
tree64d18d90281d5686578188aa0306e4d0c0f4640e
parentf692cabdf05bc2e60dc493c47e2cb9de4fb40471 (diff)
downloadorg.eclipse.stardust.ide-68f383ef37fa0e608f76fcbae12a7fe619a55447.zip
org.eclipse.stardust.ide-68f383ef37fa0e608f76fcbae12a7fe619a55447.tar.gz
org.eclipse.stardust.ide-68f383ef37fa0e608f76fcbae12a7fe619a55447.tar.bz2
"Visibility Public" checkbox should be added for all data types and participants which can be shared across models (Refactored code to avoid code duplication)
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ide@55382 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
-rw-r--r--modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/ActivityGeneralPropertyPage.java15
-rw-r--r--modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/ApplicationGeneralPropertyPage.java93
-rw-r--r--modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/DataPropertyPage.java14
-rw-r--r--modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/IdentifiablePropertyPage.java90
-rw-r--r--modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/RoleGeneralPropertyPage.java11
5 files changed, 128 insertions, 95 deletions
diff --git a/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/ActivityGeneralPropertyPage.java b/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/ActivityGeneralPropertyPage.java
index 7c41954..ebc1d2a 100644
--- a/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/ActivityGeneralPropertyPage.java
+++ b/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/ActivityGeneralPropertyPage.java
@@ -11,7 +11,12 @@
package org.eclipse.stardust.modeling.core.properties;
import org.eclipse.stardust.engine.api.model.PredefinedConstants;
-import org.eclipse.stardust.model.xpdl.carnot.*;
+import org.eclipse.stardust.model.xpdl.carnot.ActivityType;
+import org.eclipse.stardust.model.xpdl.carnot.CarnotWorkflowModelFactory;
+import org.eclipse.stardust.model.xpdl.carnot.IModelElement;
+import org.eclipse.stardust.model.xpdl.carnot.IModelElementNodeSymbol;
+import org.eclipse.stardust.model.xpdl.carnot.ProcessDefinitionType;
+import org.eclipse.stardust.model.xpdl.carnot.TransitionType;
import org.eclipse.stardust.model.xpdl.carnot.util.ActivityUtil;
import org.eclipse.stardust.model.xpdl.carnot.util.AttributeUtil;
import org.eclipse.stardust.model.xpdl.carnot.util.ModelUtils;
@@ -97,7 +102,7 @@ public class ActivityGeneralPropertyPage extends IdentifiablePropertyPage
.getName(), "core"); //$NON-NLS-1$
addNodeTo(null, new CarnotPreferenceNode(qualityControlCodes, getElement(), 2), null);
refreshTree();
- }
+ }
}
}
@@ -109,7 +114,7 @@ public class ActivityGeneralPropertyPage extends IdentifiablePropertyPage
public void loadElementFromFields(IModelElementNodeSymbol symbol, IModelElement element)
{
- super.loadElementFromFields(symbol, element);
+ super.loadElementFromFields(symbol, element);
ActivityType activity = (ActivityType) element;
if (activity != null)
{
@@ -134,6 +139,7 @@ public class ActivityGeneralPropertyPage extends IdentifiablePropertyPage
updateRelocateTransition((ProcessDefinitionType) activity.eContainer());
}
}
+
private void updateRelocateTransition(ProcessDefinitionType process)
{
@@ -173,6 +179,7 @@ public class ActivityGeneralPropertyPage extends IdentifiablePropertyPage
public void contributeExtraControls(Composite composite)
{
+ super.contributeExtraControls(composite);
Composite panel = FormBuilder.createComposite(composite, 2, 2);
GridLayout grid = (GridLayout) panel.getLayout();
grid.makeColumnsEqualWidth = true;
@@ -187,4 +194,6 @@ public class ActivityGeneralPropertyPage extends IdentifiablePropertyPage
relocateTargetCheck = FormBuilder.createCheckBox(panel, "Is relocation target",
new GridData(SWT.LEAD, SWT.CENTER, true, false));
}
+
+
}
diff --git a/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/ApplicationGeneralPropertyPage.java b/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/ApplicationGeneralPropertyPage.java
index a04d89d..9c19411 100644
--- a/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/ApplicationGeneralPropertyPage.java
+++ b/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/ApplicationGeneralPropertyPage.java
@@ -10,100 +10,17 @@
*******************************************************************************/
package org.eclipse.stardust.modeling.core.properties;
-import org.eclipse.stardust.engine.api.model.PredefinedConstants;
-import org.eclipse.stardust.model.xpdl.carnot.AttributeType;
-import org.eclipse.stardust.model.xpdl.carnot.IExtensibleElement;
-import org.eclipse.stardust.model.xpdl.carnot.IModelElement;
-import org.eclipse.stardust.model.xpdl.carnot.IModelElementNodeSymbol;
-import org.eclipse.stardust.model.xpdl.carnot.util.AttributeUtil;
-import org.eclipse.stardust.modeling.common.projectnature.BpmProjectNature;
-import org.eclipse.stardust.modeling.common.ui.jface.utils.FormBuilder;
-import org.eclipse.stardust.modeling.core.Diagram_Messages;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.PlatformUI;
+import org.eclipse.swt.widgets.Control;
public class ApplicationGeneralPropertyPage extends IdentifiablePropertyPage
{
- private Button publicCheckBox;
-
- private boolean publicType;
-
- private IModelElement modelElement;
-
- @Override
- protected void contributeExtraControls(Composite composite)
- {
- super.contributeExtraControls(composite);
- publicCheckBox = FormBuilder.createCheckBox(composite,
- Diagram_Messages.CHECKBOX_Visibility);
- publicCheckBox.addSelectionListener(new SelectionAdapter()
- {
-
- public void widgetSelected(SelectionEvent e)
- {
-
- publicType = !publicType;
- if (publicType)
- {
- AttributeUtil.setAttribute((IExtensibleElement) modelElement,
- PredefinedConstants.MODELELEMENT_VISIBILITY, "Public"); //$NON-NLS-1$
- }
- else
- {
- AttributeUtil.setAttribute((IExtensibleElement) modelElement,
- PredefinedConstants.MODELELEMENT_VISIBILITY, "Private"); //$NON-NLS-1$
- }
- }
- });
- }
-
@Override
- public void loadElementFromFields(IModelElementNodeSymbol symbol, IModelElement element)
+ public Control createBody(Composite parent)
{
- super.loadElementFromFields(symbol, element);
+ setProvidesVisibility(true);
+ return super.createBody(parent);
}
-
- @Override
- public void loadFieldsFromElement(IModelElementNodeSymbol symbol, IModelElement element)
- {
- super.loadFieldsFromElement(symbol, element);
- modelElement = element;
- setupVisibility();
- }
-
- private void setupVisibility()
- {
- AttributeType visibility = AttributeUtil.getAttribute(
- (IExtensibleElement) modelElement,
- PredefinedConstants.MODELELEMENT_VISIBILITY);
- if (visibility == null)
- {
- String visibilityDefault = PlatformUI.getPreferenceStore().getString(
- BpmProjectNature.PREFERENCE_MULTIPACKAGEMODELING_VISIBILITY);
- if (visibilityDefault == null || visibilityDefault == "" //$NON-NLS-1$
- || visibilityDefault.equalsIgnoreCase("Public")) //$NON-NLS-1$
- {
- AttributeUtil.setAttribute((IExtensibleElement) modelElement,
- PredefinedConstants.MODELELEMENT_VISIBILITY, "Public"); //$NON-NLS-1$
- publicType = true;
- }
- }
- else
- {
- if (visibility.getValue().equalsIgnoreCase("Public")) //$NON-NLS-1$
- {
- publicType = true;
- }
- else
- {
- publicType = false;
- }
- }
- publicCheckBox.setSelection(publicType);
- }
-
+
}
diff --git a/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/DataPropertyPage.java b/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/DataPropertyPage.java
index 4bbbabb..998dbbf 100644
--- a/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/DataPropertyPage.java
+++ b/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/DataPropertyPage.java
@@ -23,13 +23,15 @@ import org.eclipse.stardust.model.xpdl.carnot.util.ElUtils;
import org.eclipse.stardust.model.xpdl.carnot.util.ModelUtils;
import org.eclipse.stardust.model.xpdl.xpdl2.ScriptType;
import org.eclipse.stardust.modeling.common.ui.jface.databinding.EObjectAdapter;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
public class DataPropertyPage extends IdentifiablePropertyPage
{
public void loadFieldsFromElement(IModelElementNodeSymbol symbol,
final IModelElement element)
- {
+ {
setEditableText(((DataType) element).isPredefined());
super.loadFieldsFromElement(symbol, element);
@@ -42,9 +44,17 @@ public class DataPropertyPage extends IdentifiablePropertyPage
{
bindTransitionConditions(model, dataId);
}
+
refreshTree();
}
+ @Override
+ public Control createBody(Composite parent)
+ {
+ setProvidesVisibility(true);
+ return super.createBody(parent);
+ }
+
private void bindTransitionConditions(ModelType model, final String dataId)
{
final ModelType modelType = model;
@@ -116,6 +126,6 @@ public class DataPropertyPage extends IdentifiablePropertyPage
autoIdButton.setEnabled(false);
txtDescription.getText().setEditable(!isPredefined);
}
- }
+ }
} \ No newline at end of file
diff --git a/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/IdentifiablePropertyPage.java b/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/IdentifiablePropertyPage.java
index fe72fd5..8d3334b 100644
--- a/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/IdentifiablePropertyPage.java
+++ b/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/IdentifiablePropertyPage.java
@@ -10,11 +10,16 @@
*******************************************************************************/
package org.eclipse.stardust.modeling.core.properties;
+import org.eclipse.stardust.engine.api.model.PredefinedConstants;
+import org.eclipse.stardust.model.xpdl.carnot.AttributeType;
+import org.eclipse.stardust.model.xpdl.carnot.IExtensibleElement;
import org.eclipse.stardust.model.xpdl.carnot.IIdentifiableModelElement;
import org.eclipse.stardust.model.xpdl.carnot.IModelElement;
import org.eclipse.stardust.model.xpdl.carnot.IModelElementNodeSymbol;
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;
+import org.eclipse.stardust.modeling.common.projectnature.BpmProjectNature;
import org.eclipse.stardust.modeling.common.ui.jface.utils.FormBuilder;
import org.eclipse.stardust.modeling.common.ui.jface.utils.LabeledText;
import org.eclipse.stardust.modeling.core.Diagram_Messages;
@@ -23,6 +28,7 @@ import org.eclipse.stardust.modeling.core.utils.GenericUtils;
import org.eclipse.stardust.modeling.core.utils.WidgetBindingManager;
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.widgets.Button;
@@ -30,6 +36,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
public class IdentifiablePropertyPage extends AbstractModelElementPropertyPage
@@ -44,6 +51,14 @@ public class IdentifiablePropertyPage extends AbstractModelElementPropertyPage
protected LabeledText txtDescription;
protected Button autoIdButton;
+
+ private Button publicCheckBox;
+
+ private boolean publicType;
+
+ protected IIdentifiableModelElement modelElement;
+
+ private Boolean providesVisibility = false;
private SelectionListener autoIdListener = new SelectionListener()
{
@@ -101,6 +116,8 @@ public class IdentifiablePropertyPage extends AbstractModelElementPropertyPage
txtName.getText().selectAll();
txtName.getText().setFocus();
+
+
}
public void loadElementFromFields(IModelElementNodeSymbol symbol, IModelElement element)
@@ -138,6 +155,15 @@ public class IdentifiablePropertyPage extends AbstractModelElementPropertyPage
FormBuilder.createHorizontalSeparator(composite, 2);
this.txtDescription = FormBuilder.createLabeledTextArea(composite,
Diagram_Messages.TA_Description);
+
+ modelElement = (IIdentifiableModelElement) getModelElement();
+ }
+
+
+
+ if (providesVisibility)
+ {
+ setupVisibility();
}
return composite;
@@ -149,7 +175,32 @@ public class IdentifiablePropertyPage extends AbstractModelElementPropertyPage
}
protected void contributeExtraControls(Composite composite)
- {}
+ {
+ if (providesVisibility)
+ {
+ publicCheckBox = FormBuilder.createCheckBox(composite,
+ Diagram_Messages.CHECKBOX_Visibility, 2);
+ publicCheckBox.addSelectionListener(new SelectionAdapter()
+ {
+
+ public void widgetSelected(SelectionEvent e)
+ {
+
+ publicType = !publicType;
+ if (publicType)
+ {
+ AttributeUtil.setAttribute((IExtensibleElement) modelElement,
+ PredefinedConstants.MODELELEMENT_VISIBILITY, "Public"); //$NON-NLS-1$
+ }
+ else
+ {
+ AttributeUtil.setAttribute((IExtensibleElement) modelElement,
+ PredefinedConstants.MODELELEMENT_VISIBILITY, "Private"); //$NON-NLS-1$
+ }
+ }
+ });
+ }
+ }
protected String getId()
{
@@ -160,4 +211,41 @@ public class IdentifiablePropertyPage extends AbstractModelElementPropertyPage
{
return txtName.getText().getText();
}
+
+ protected void setupVisibility()
+ {
+ AttributeType visibility = AttributeUtil.getAttribute(
+ (IExtensibleElement) getModelElement(),
+ PredefinedConstants.MODELELEMENT_VISIBILITY);
+ if (visibility == null)
+ {
+ String visibilityDefault = PlatformUI.getPreferenceStore().getString(
+ BpmProjectNature.PREFERENCE_MULTIPACKAGEMODELING_VISIBILITY);
+ if (visibilityDefault == null || visibilityDefault == "" //$NON-NLS-1$
+ || visibilityDefault.equalsIgnoreCase("Public")) //$NON-NLS-1$
+ {
+ AttributeUtil.setAttribute((IExtensibleElement) modelElement,
+ PredefinedConstants.MODELELEMENT_VISIBILITY, "Public"); //$NON-NLS-1$
+ publicType = true;
+ }
+ }
+ else
+ {
+ if (visibility.getValue().equalsIgnoreCase("Public")) //$NON-NLS-1$
+ {
+ publicType = true;
+ }
+ else
+ {
+ publicType = false;
+ }
+ }
+ publicCheckBox.setSelection(publicType);
+ }
+
+ protected void setProvidesVisibility(boolean flag)
+ {
+ providesVisibility = flag;
+ }
+
} \ No newline at end of file
diff --git a/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/RoleGeneralPropertyPage.java b/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/RoleGeneralPropertyPage.java
index fcafc01..6dfce9d 100644
--- a/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/RoleGeneralPropertyPage.java
+++ b/modeling/org.eclipse.stardust.modeling.core/src/org/eclipse/stardust/modeling/core/properties/RoleGeneralPropertyPage.java
@@ -22,6 +22,7 @@ import org.eclipse.stardust.modeling.common.ui.jface.utils.FormBuilder;
import org.eclipse.stardust.modeling.core.Diagram_Messages;
import org.eclipse.stardust.modeling.core.VerifierFactory;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;
public class RoleGeneralPropertyPage extends IdentifiablePropertyPage
@@ -29,7 +30,7 @@ public class RoleGeneralPropertyPage extends IdentifiablePropertyPage
private Text cardinalityText;
public void loadFieldsFromElement(IModelElementNodeSymbol symbol, IModelElement element)
- {
+ {
super.loadFieldsFromElement(symbol, element);
RoleType role = (RoleType) element;
String cardinality = NumberFormat.getIntegerInstance()
@@ -68,6 +69,13 @@ public class RoleGeneralPropertyPage extends IdentifiablePropertyPage
}
}
+ @Override
+ public Control createBody(Composite parent)
+ {
+ setProvidesVisibility(true);
+ return super.createBody(parent);
+ }
+
public void contributeExtraControls(Composite composite)
{
super.contributeExtraControls(composite);
@@ -75,6 +83,7 @@ public class RoleGeneralPropertyPage extends IdentifiablePropertyPage
cardinalityText = FormBuilder.createText(composite);
cardinalityText.addVerifyListener(VerifierFactory.intVerifier);
}
+
}