| author | Rainer Pielmann | 2012-04-03 09:31:09 (EDT) |
|---|---|---|
| committer | Stephan Born | 2012-04-24 10:13:50 (EDT) |
| commit | b45ce8b7e816b50467786b3122c6c9485a705ddd (patch) (side-by-side diff) | |
| tree | bb4a3c2bb1746128405b19ae3767906e799f3069 | |
| parent | f7cd893f6fd4ea0b6936010843d64cdd1319c569 (diff) | |
| download | org.eclipse.stardust.ide-b45ce8b7e816b50467786b3122c6c9485a705ddd.zip org.eclipse.stardust.ide-b45ce8b7e816b50467786b3122c6c9485a705ddd.tar.gz org.eclipse.stardust.ide-b45ce8b7e816b50467786b3122c6c9485a705ddd.tar.bz2 | |
Jira-ID: CRNT-23740
"Visibility Public" checkbox should be added for all data types and participants which can be shared across models
git-svn-id: http://emeafrazerg/svn/ipp/product/trunk/stardust/ide@55241 8100b5e0-4d52-466c-ae9c-bdeccbdeaf6b
2 files changed, 91 insertions, 1 deletions
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 748d199..c130e1c 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,19 +13,37 @@ 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) { @@ -34,15 +52,45 @@ 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; @@ -115,4 +163,35 @@ public class DataPropertyPage extends IdentifiablePropertyPage txtDescription.getText().setEditable(!isPredefined); } } + + 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.repository.common/src/org/eclipse/stardust/modeling/repository/common/ConnectionManager.java b/modeling/org.eclipse.stardust.modeling.repository.common/src/org/eclipse/stardust/modeling/repository/common/ConnectionManager.java index d1c9065..cbc18e9 100644 --- a/modeling/org.eclipse.stardust.modeling.repository.common/src/org/eclipse/stardust/modeling/repository/common/ConnectionManager.java +++ b/modeling/org.eclipse.stardust.modeling.repository.common/src/org/eclipse/stardust/modeling/repository/common/ConnectionManager.java @@ -80,6 +80,17 @@ public class ConnectionManager implements IConnectionManager return false; } } + if (eObjectdescriptor.getEObject() instanceof DataType) + { + DataType dataType = eObjectdescriptor.getEObject(); + AttributeType visibility = AttributeUtil.getAttribute( + (IExtensibleElement) dataType, + PredefinedConstants.MODELELEMENT_VISIBILITY); + if (visibility != null && "Private".equals(visibility.getValue())) //$NON-NLS-1$ + { + return false; + } + } if (eObjectdescriptor.getEObject() instanceof ProcessDefinitionType) { ProcessDefinitionType process = (ProcessDefinitionType) eObjectdescriptor |

