| author | Rainer Pielmann | 2012-04-04 04:48:26 (EDT) |
|---|---|---|
| committer | Stephan Born | 2012-04-24 10:13:51 (EDT) |
| commit | 5f86fb2b8f073846653933cbaf6f195c4b3fd659 (patch) (side-by-side diff) | |
| tree | 6dac07ed69f8ab18763ff7c379151b8166d7772c | |
| parent | 1928733827f6c4a0257645ee238f42b8b86013da (diff) | |
| download | org.eclipse.stardust.ide-5f86fb2b8f073846653933cbaf6f195c4b3fd659.zip org.eclipse.stardust.ide-5f86fb2b8f073846653933cbaf6f195c4b3fd659.tar.gz org.eclipse.stardust.ide-5f86fb2b8f073846653933cbaf6f195c4b3fd659.tar.bz2 | |
Jira-ID: CRNT-23740
"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@55269 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
4 files changed, 71 insertions, 241 deletions
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..ad4a23f 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,8 @@ *******************************************************************************/ 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; 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) - { - super.loadElementFromFields(symbol, element); - } - - @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 c130e1c..4bbbabb 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 @@ -13,36 +13,19 @@ package org.eclipse.stardust.modeling.core.properties; import java.util.Iterator; import org.eclipse.stardust.common.StringUtils; -import org.eclipse.stardust.engine.api.model.PredefinedConstants; -import org.eclipse.stardust.model.xpdl.carnot.AttributeType; import org.eclipse.stardust.model.xpdl.carnot.DataType; -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.ModelType; import org.eclipse.stardust.model.xpdl.carnot.ProcessDefinitionType; import org.eclipse.stardust.model.xpdl.carnot.TransitionType; -import org.eclipse.stardust.model.xpdl.carnot.util.AttributeUtil; 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.projectnature.BpmProjectNature; import org.eclipse.stardust.modeling.common.ui.jface.databinding.EObjectAdapter; -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; public class DataPropertyPage extends IdentifiablePropertyPage { - private Button publicCheckBox; - - private boolean publicType; - - private IModelElement modelElement; public void loadFieldsFromElement(IModelElementNodeSymbol symbol, final IModelElement element) @@ -52,45 +35,16 @@ public class DataPropertyPage extends IdentifiablePropertyPage super.loadFieldsFromElement(symbol, element); ModelType model = ModelUtils.findContainingModel(element); - modelElement = element; + final String dataId = ((DataType) element).getId(); if (dataId != null) { bindTransitionConditions(model, dataId); } - setupVisibility(); refreshTree(); } - - @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$ - } - } - }); - } - private void bindTransitionConditions(ModelType model, final String dataId) { final ModelType modelType = model; @@ -164,34 +118,4 @@ public class DataPropertyPage extends IdentifiablePropertyPage } } - 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); - } }
\ 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..1f16389 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,12 @@ public class IdentifiablePropertyPage extends AbstractModelElementPropertyPage protected LabeledText txtDescription; protected Button autoIdButton; + + protected Button publicCheckBox; + + protected boolean publicType; + + protected IModelElement modelElement; private SelectionListener autoIdListener = new SelectionListener() { @@ -101,6 +114,9 @@ public class IdentifiablePropertyPage extends AbstractModelElementPropertyPage txtName.getText().selectAll(); txtName.getText().setFocus(); + + modelElement = element; + setupVisibility(); } public void loadElementFromFields(IModelElementNodeSymbol symbol, IModelElement element) @@ -149,7 +165,60 @@ public class IdentifiablePropertyPage extends AbstractModelElementPropertyPage } protected void contributeExtraControls(Composite 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$ + } + } + }); + } + + protected 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); + } protected String getId() { 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 a377e10..2bcd8db 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 @@ -14,35 +14,20 @@ import java.text.NumberFormat; import java.text.ParseException; import org.eclipse.stardust.common.StringUtils; -import org.eclipse.stardust.engine.api.model.PredefinedConstants; -import org.eclipse.stardust.model.xpdl.carnot.AttributeType; import org.eclipse.stardust.model.xpdl.carnot.CarnotWorkflowModelPackage; -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.RoleType; -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.stardust.modeling.core.VerifierFactory; -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.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; public class RoleGeneralPropertyPage extends IdentifiablePropertyPage { private Text cardinalityText; - private Button publicCheckBox; - - private boolean publicType; - - private IModelElement modelElement; - public void loadFieldsFromElement(IModelElementNodeSymbol symbol, IModelElement element) { super.loadFieldsFromElement(symbol, element); @@ -53,9 +38,6 @@ public class RoleGeneralPropertyPage extends IdentifiablePropertyPage { cardinalityText.setText(cardinality); } - - modelElement = element; - setupVisibility(); } public void loadElementFromFields(IModelElementNodeSymbol symbol, IModelElement element) @@ -91,59 +73,6 @@ public class RoleGeneralPropertyPage extends IdentifiablePropertyPage FormBuilder.createLabel(composite, Diagram_Messages.LB_Cardinality); cardinalityText = FormBuilder.createText(composite); cardinalityText.addVerifyListener(VerifierFactory.intVerifier); - - 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$ - } - } - }); - } - - 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); } } |

