diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_BooleanLiteral.gif b/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_BooleanLiteral.gif new file mode 100644 index 0000000000000000000000000000000000000000..28d7cba309af0031fd81430272f6a986c93062b8 Binary files /dev/null and b/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_BooleanLiteral.gif differ diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_BoxedPDF.gif b/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_BoxedPDF.gif new file mode 100644 index 0000000000000000000000000000000000000000..81bed353002b5878eb2af720dbd012ddc6101d2f Binary files /dev/null and b/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_BoxedPDF.gif differ diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_DoubleLiteral.gif b/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_DoubleLiteral.gif new file mode 100644 index 0000000000000000000000000000000000000000..dbd19ede270d3cac0415be640c33b63e4b122331 Binary files /dev/null and b/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_DoubleLiteral.gif differ diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_ExponentialDistribution.gif b/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_ExponentialDistribution.gif new file mode 100644 index 0000000000000000000000000000000000000000..83824fbf1ff96492d11694251fc70b689c1e120a Binary files /dev/null and b/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_ExponentialDistribution.gif differ diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_IntLiteral.gif b/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_IntLiteral.gif new file mode 100644 index 0000000000000000000000000000000000000000..758dafb7cd607cb64fb329445c0d76e298381756 Binary files /dev/null and b/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_IntLiteral.gif differ diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_NormalDistribution.gif b/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_NormalDistribution.gif new file mode 100644 index 0000000000000000000000000000000000000000..4e47629dccd1a3ceb230a3cbff1ef729b8ecbe01 Binary files /dev/null and b/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_NormalDistribution.gif differ diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_ProbabilityMassFunction.gif b/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_ProbabilityMassFunction.gif new file mode 100644 index 0000000000000000000000000000000000000000..9f85940ddf591c7f87372bfa13e6bee574e86224 Binary files /dev/null and b/edu.kit.ipd.descartes.mm.applicationlevel.edit/icons/full/ctool16/CreateRandomVariable_probFunction_ProbabilityMassFunction.gif differ diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.edit/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/provider/RandomVariableItemProvider.java b/edu.kit.ipd.descartes.mm.applicationlevel.edit/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/provider/RandomVariableItemProvider.java index d78095a4066486e1722a635c2bbd1934794d3936..df49e25e4ddc31ef28a8400a3c4c91817cb174b3 100644 --- a/edu.kit.ipd.descartes.mm.applicationlevel.edit/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/provider/RandomVariableItemProvider.java +++ b/edu.kit.ipd.descartes.mm.applicationlevel.edit/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/provider/RandomVariableItemProvider.java @@ -4,6 +4,7 @@ package edu.kit.ipd.descartes.mm.applicationlevel.functions.provider; +import edu.kit.ipd.descartes.mm.applicationlevel.functions.FunctionsFactory; import edu.kit.ipd.descartes.mm.applicationlevel.functions.FunctionsPackage; import edu.kit.ipd.descartes.mm.applicationlevel.functions.RandomVariable; @@ -17,6 +18,7 @@ import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.ResourceLocator; +import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; import org.eclipse.emf.edit.provider.IItemLabelProvider; @@ -64,7 +66,6 @@ public class RandomVariableItemProvider super.getPropertyDescriptors(object); addSpecificationPropertyDescriptor(object); - addProbFunctionPropertyDescriptor(object); } return itemPropertyDescriptors; } @@ -92,25 +93,33 @@ public class RandomVariableItemProvider } /** - * This adds a property descriptor for the Prob Function feature. + * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an + * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or + * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ - protected void addProbFunctionPropertyDescriptor(Object object) { - itemPropertyDescriptors.add - (createItemPropertyDescriptor - (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), - getResourceLocator(), - getString("_UI_RandomVariable_probFunction_feature"), - getString("_UI_PropertyDescriptor_description", "_UI_RandomVariable_probFunction_feature", "_UI_RandomVariable_type"), - FunctionsPackage.Literals.RANDOM_VARIABLE__PROB_FUNCTION, - true, - false, - true, - null, - null, - null)); + @Override + public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { + if (childrenFeatures == null) { + super.getChildrenFeatures(object); + childrenFeatures.add(FunctionsPackage.Literals.RANDOM_VARIABLE__PROB_FUNCTION); + } + return childrenFeatures; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + protected EStructuralFeature getChildFeature(Object object, Object child) { + // Check the type of the specified child object and return the proper feature to use for + // adding (see {@link AddCommand}) it as a child. + + return super.getChildFeature(object, child); } /** @@ -153,6 +162,9 @@ public class RandomVariableItemProvider case FunctionsPackage.RANDOM_VARIABLE__SPECIFICATION: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; + case FunctionsPackage.RANDOM_VARIABLE__PROB_FUNCTION: + fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); + return; } super.notifyChanged(notification); } @@ -167,6 +179,41 @@ public class RandomVariableItemProvider @Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); + + newChildDescriptors.add + (createChildParameter + (FunctionsPackage.Literals.RANDOM_VARIABLE__PROB_FUNCTION, + FunctionsFactory.eINSTANCE.createBooleanLiteral())); + + newChildDescriptors.add + (createChildParameter + (FunctionsPackage.Literals.RANDOM_VARIABLE__PROB_FUNCTION, + FunctionsFactory.eINSTANCE.createIntLiteral())); + + newChildDescriptors.add + (createChildParameter + (FunctionsPackage.Literals.RANDOM_VARIABLE__PROB_FUNCTION, + FunctionsFactory.eINSTANCE.createDoubleLiteral())); + + newChildDescriptors.add + (createChildParameter + (FunctionsPackage.Literals.RANDOM_VARIABLE__PROB_FUNCTION, + FunctionsFactory.eINSTANCE.createProbabilityMassFunction())); + + newChildDescriptors.add + (createChildParameter + (FunctionsPackage.Literals.RANDOM_VARIABLE__PROB_FUNCTION, + FunctionsFactory.eINSTANCE.createBoxedPDF())); + + newChildDescriptors.add + (createChildParameter + (FunctionsPackage.Literals.RANDOM_VARIABLE__PROB_FUNCTION, + FunctionsFactory.eINSTANCE.createNormalDistribution())); + + newChildDescriptors.add + (createChildParameter + (FunctionsPackage.Literals.RANDOM_VARIABLE__PROB_FUNCTION, + FunctionsFactory.eINSTANCE.createExponentialDistribution())); } /** diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/plugin.xml b/edu.kit.ipd.descartes.mm.applicationlevel.editor/plugin.xml index 86aab5c408dd25a0b335bd6f8db3f702cd0ebb03..09fc78705a5a014b597986810cf8ed7f2e5f9418 100644 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/plugin.xml +++ b/edu.kit.ipd.descartes.mm.applicationlevel.editor/plugin.xml @@ -33,36 +33,6 @@ </editor> </extension> - <extension point="org.eclipse.ui.newWizards"> - <!-- @generated applicationlevel --> - <category - id="org.eclipse.emf.ecore.Wizard.category.ID" - name="%_UI_Wizard_category"/> - <wizard - id="edu.kit.ipd.descartes.mm.applicationlevel.parameterdependencies.presentation.ParameterdependenciesModelWizardID" - name="%_UI_ParameterdependenciesModelWizard_label" - class="edu.kit.ipd.descartes.mm.applicationlevel.parameterdependencies.presentation.ParameterdependenciesModelWizard" - category="org.eclipse.emf.ecore.Wizard.category.ID" - icon="icons/full/obj16/ParameterdependenciesModelFile.gif"> - <description>%_UI_ParameterdependenciesModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> - -null -null -null -null -null -null -null -null -null -null -null -null -null -null <extension point="org.eclipse.ui.newWizards"> <category id="org.eclipse.emf.ecore.Wizard.category.ID" @@ -89,36 +59,6 @@ null </editor> </extension> - <extension point="org.eclipse.ui.newWizards"> - <!-- @generated applicationlevel --> - <category - id="org.eclipse.emf.ecore.Wizard.category.ID" - name="%_UI_Wizard_category"/> - <wizard - id="edu.kit.ipd.descartes.mm.applicationlevel.repository.presentation.RepositoryModelWizardID" - name="%_UI_RepositoryModelWizard_label" - class="edu.kit.ipd.descartes.mm.applicationlevel.repository.presentation.RepositoryModelWizard" - category="org.eclipse.emf.ecore.Wizard.category.ID" - icon="icons/full/obj16/RepositoryModelFile.gif"> - <description>%_UI_RepositoryModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> - -null -null -null -null -null -null -null -null -null -null -null -null -null -null <extension point="org.eclipse.ui.newWizards"> <category id="org.eclipse.emf.ecore.Wizard.category.ID" @@ -145,36 +85,6 @@ null </editor> </extension> - <extension point="org.eclipse.ui.newWizards"> - <!-- @generated applicationlevel --> - <category - id="org.eclipse.emf.ecore.Wizard.category.ID" - name="%_UI_Wizard_category"/> - <wizard - id="edu.kit.ipd.descartes.mm.applicationlevel.servicebehavior.presentation.ServicebehaviorModelWizardID" - name="%_UI_ServicebehaviorModelWizard_label" - class="edu.kit.ipd.descartes.mm.applicationlevel.servicebehavior.presentation.ServicebehaviorModelWizard" - category="org.eclipse.emf.ecore.Wizard.category.ID" - icon="icons/full/obj16/ServicebehaviorModelFile.gif"> - <description>%_UI_ServicebehaviorModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> - -null -null -null -null -null -null -null -null -null -null -null -null -null -null <extension point="org.eclipse.ui.newWizards"> <category id="org.eclipse.emf.ecore.Wizard.category.ID" @@ -201,36 +111,6 @@ null </editor> </extension> - <extension point="org.eclipse.ui.newWizards"> - <!-- @generated applicationlevel --> - <category - id="org.eclipse.emf.ecore.Wizard.category.ID" - name="%_UI_Wizard_category"/> - <wizard - id="edu.kit.ipd.descartes.mm.applicationlevel.system.presentation.SystemModelWizardID" - name="%_UI_SystemModelWizard_label" - class="edu.kit.ipd.descartes.mm.applicationlevel.system.presentation.SystemModelWizard" - category="org.eclipse.emf.ecore.Wizard.category.ID" - icon="icons/full/obj16/SystemModelFile.gif"> - <description>%_UI_SystemModelWizard_description</description> - <selection class="org.eclipse.core.resources.IResource"/> - </wizard> - </extension> - -null -null -null -null -null -null -null -null -null -null -null -null -null -null <extension point="org.eclipse.ui.newWizards"> <category id="org.eclipse.emf.ecore.Wizard.category.ID" @@ -257,6 +137,4 @@ null </editor> </extension> -null -null </plugin> diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/presentation/FunctionsEditor.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/presentation/FunctionsEditor.java index 4d92bac62dad5f558143006c5fdff7fa6bb197b9..40008816b3ff8da8983be1712e0c7081433e281c 100644 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/presentation/FunctionsEditor.java +++ b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/functions/presentation/FunctionsEditor.java @@ -231,7 +231,7 @@ public class FunctionsEditor * <!-- end-user-doc --> * @generated */ - protected List<PropertySheetPage> propertySheetPages = new ArrayList<PropertySheetPage>(); + protected PropertySheetPage propertySheetPage; /** * This is the viewer that shadows the selection in the content outline. @@ -350,7 +350,7 @@ public class FunctionsEditor } } else if (p instanceof PropertySheet) { - if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) { + if (((PropertySheet)p).getCurrentPage() == propertySheetPage) { getActionBarContributor().setActiveEditor(FunctionsEditor.this); handleActivate(); } @@ -462,15 +462,6 @@ public class FunctionsEditor @Override protected void unsetTarget(Resource target) { basicUnsetTarget(target); - resourceToDiagnosticMap.remove(target); - if (updateProblemIndication) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - updateProblemIndication(); - } - }); - } } }; @@ -504,7 +495,6 @@ public class FunctionsEditor } } } - return false; } return true; @@ -748,14 +738,8 @@ public class FunctionsEditor if (mostRecentCommand != null) { setSelectionToViewer(mostRecentCommand.getAffectedObjects()); } - for (Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext(); ) { - PropertySheetPage propertySheetPage = i.next(); - if (propertySheetPage.getControl().isDisposed()) { - i.remove(); - } - else { - propertySheetPage.refresh(); - } + if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) { + propertySheetPage.refresh(); } } }); @@ -961,7 +945,7 @@ public class FunctionsEditor getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; - Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() }; + Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() }; viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); } @@ -1419,22 +1403,23 @@ public class FunctionsEditor * @generated */ public IPropertySheetPage getPropertySheetPage() { - PropertySheetPage propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { - @Override - public void setSelectionToViewer(List<?> selection) { - FunctionsEditor.this.setSelectionToViewer(selection); - FunctionsEditor.this.setFocus(); - } + if (propertySheetPage == null) { + propertySheetPage = + new ExtendedPropertySheetPage(editingDomain) { + @Override + public void setSelectionToViewer(List<?> selection) { + FunctionsEditor.this.setSelectionToViewer(selection); + FunctionsEditor.this.setFocus(); + } - @Override - public void setActionBars(IActionBars actionBars) { - super.setActionBars(actionBars); - getActionBarContributor().shareGlobalActions(this, actionBars); - } - }; - propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); - propertySheetPages.add(propertySheetPage); + @Override + public void setActionBars(IActionBars actionBars) { + super.setActionBars(actionBars); + getActionBarContributor().shareGlobalActions(this, actionBars); + } + }; + propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); + } return propertySheetPage; } @@ -1501,7 +1486,6 @@ public class FunctionsEditor // final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); // Do the work within an operation because this is a long running activity that modifies the workbench. // @@ -1554,7 +1538,7 @@ public class FunctionsEditor /** * This returns whether something has been persisted to the URI of the specified resource. - * The implementation uses the URI converter from the editor's resource set to try to open an input stream. + * The implementation uses the URI converter from the editor's resource set to try to open an input stream. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated @@ -1626,9 +1610,20 @@ public class FunctionsEditor * @generated */ public void gotoMarker(IMarker marker) { - List<?> targetObjects = markerHelper.getTargetObjects(editingDomain, marker); - if (!targetObjects.isEmpty()) { - setSelectionToViewer(targetObjects); + try { + if (marker.getType().equals(EValidator.MARKER)) { + String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null); + if (uriAttribute != null) { + URI uri = URI.createURI(uriAttribute); + EObject eObject = editingDomain.getResourceSet().getEObject(uri, true); + if (eObject != null) { + setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject))); + } + } + } + } + catch (CoreException exception) { + ApplicationlevelEditorPlugin.INSTANCE.log(exception); } } @@ -1819,7 +1814,7 @@ public class FunctionsEditor getActionBarContributor().setActiveEditor(null); } - for (PropertySheetPage propertySheetPage : propertySheetPages) { + if (propertySheetPage != null) { propertySheetPage.dispose(); } diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/parameterdependencies/presentation/ParameterdependenciesEditor.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/parameterdependencies/presentation/ParameterdependenciesEditor.java index 871566ba82372071becaea1a06042022be894a0c..eb9aa95beaf0c62de844f2980093a04ae0a20aa2 100644 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/parameterdependencies/presentation/ParameterdependenciesEditor.java +++ b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/parameterdependencies/presentation/ParameterdependenciesEditor.java @@ -122,6 +122,8 @@ import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EValidator; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; @@ -231,7 +233,7 @@ public class ParameterdependenciesEditor * <!-- end-user-doc --> * @generated */ - protected List<PropertySheetPage> propertySheetPages = new ArrayList<PropertySheetPage>(); + protected PropertySheetPage propertySheetPage; /** * This is the viewer that shadows the selection in the content outline. @@ -350,7 +352,7 @@ public class ParameterdependenciesEditor } } else if (p instanceof PropertySheet) { - if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) { + if (((PropertySheet)p).getCurrentPage() == propertySheetPage) { getActionBarContributor().setActiveEditor(ParameterdependenciesEditor.this); handleActivate(); } @@ -462,15 +464,6 @@ public class ParameterdependenciesEditor @Override protected void unsetTarget(Resource target) { basicUnsetTarget(target); - resourceToDiagnosticMap.remove(target); - if (updateProblemIndication) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - updateProblemIndication(); - } - }); - } } }; @@ -504,7 +497,6 @@ public class ParameterdependenciesEditor } } } - return false; } return true; @@ -748,14 +740,8 @@ public class ParameterdependenciesEditor if (mostRecentCommand != null) { setSelectionToViewer(mostRecentCommand.getAffectedObjects()); } - for (Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext(); ) { - PropertySheetPage propertySheetPage = i.next(); - if (propertySheetPage.getControl().isDisposed()) { - i.remove(); - } - else { - propertySheetPage.refresh(); - } + if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) { + propertySheetPage.refresh(); } } }); @@ -961,7 +947,7 @@ public class ParameterdependenciesEditor getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; - Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() }; + Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() }; viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); } @@ -1419,22 +1405,23 @@ public class ParameterdependenciesEditor * @generated */ public IPropertySheetPage getPropertySheetPage() { - PropertySheetPage propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { - @Override - public void setSelectionToViewer(List<?> selection) { - ParameterdependenciesEditor.this.setSelectionToViewer(selection); - ParameterdependenciesEditor.this.setFocus(); - } + if (propertySheetPage == null) { + propertySheetPage = + new ExtendedPropertySheetPage(editingDomain) { + @Override + public void setSelectionToViewer(List<?> selection) { + ParameterdependenciesEditor.this.setSelectionToViewer(selection); + ParameterdependenciesEditor.this.setFocus(); + } - @Override - public void setActionBars(IActionBars actionBars) { - super.setActionBars(actionBars); - getActionBarContributor().shareGlobalActions(this, actionBars); - } - }; - propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); - propertySheetPages.add(propertySheetPage); + @Override + public void setActionBars(IActionBars actionBars) { + super.setActionBars(actionBars); + getActionBarContributor().shareGlobalActions(this, actionBars); + } + }; + propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); + } return propertySheetPage; } @@ -1501,7 +1488,6 @@ public class ParameterdependenciesEditor // final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); // Do the work within an operation because this is a long running activity that modifies the workbench. // @@ -1554,7 +1540,7 @@ public class ParameterdependenciesEditor /** * This returns whether something has been persisted to the URI of the specified resource. - * The implementation uses the URI converter from the editor's resource set to try to open an input stream. + * The implementation uses the URI converter from the editor's resource set to try to open an input stream. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated @@ -1626,9 +1612,20 @@ public class ParameterdependenciesEditor * @generated */ public void gotoMarker(IMarker marker) { - List<?> targetObjects = markerHelper.getTargetObjects(editingDomain, marker); - if (!targetObjects.isEmpty()) { - setSelectionToViewer(targetObjects); + try { + if (marker.getType().equals(EValidator.MARKER)) { + String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null); + if (uriAttribute != null) { + URI uri = URI.createURI(uriAttribute); + EObject eObject = editingDomain.getResourceSet().getEObject(uri, true); + if (eObject != null) { + setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject))); + } + } + } + } + catch (CoreException exception) { + ApplicationlevelEditorPlugin.INSTANCE.log(exception); } } @@ -1819,7 +1816,7 @@ public class ParameterdependenciesEditor getActionBarContributor().setActiveEditor(null); } - for (PropertySheetPage propertySheetPage : propertySheetPages) { + if (propertySheetPage != null) { propertySheetPage.dispose(); } diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/repository/presentation/RepositoryEditor.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/repository/presentation/RepositoryEditor.java index 9a21af090f11b92dae2a3e8ab600c0c37ffeb0f9..f109f3f46f8021847bd03c154b416357ec3d13ef 100644 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/repository/presentation/RepositoryEditor.java +++ b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/repository/presentation/RepositoryEditor.java @@ -231,7 +231,7 @@ public class RepositoryEditor * <!-- end-user-doc --> * @generated */ - protected List<PropertySheetPage> propertySheetPages = new ArrayList<PropertySheetPage>(); + protected PropertySheetPage propertySheetPage; /** * This is the viewer that shadows the selection in the content outline. @@ -350,7 +350,7 @@ public class RepositoryEditor } } else if (p instanceof PropertySheet) { - if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) { + if (((PropertySheet)p).getCurrentPage() == propertySheetPage) { getActionBarContributor().setActiveEditor(RepositoryEditor.this); handleActivate(); } @@ -462,15 +462,6 @@ public class RepositoryEditor @Override protected void unsetTarget(Resource target) { basicUnsetTarget(target); - resourceToDiagnosticMap.remove(target); - if (updateProblemIndication) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - updateProblemIndication(); - } - }); - } } }; @@ -504,7 +495,6 @@ public class RepositoryEditor } } } - return false; } return true; @@ -748,14 +738,8 @@ public class RepositoryEditor if (mostRecentCommand != null) { setSelectionToViewer(mostRecentCommand.getAffectedObjects()); } - for (Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext(); ) { - PropertySheetPage propertySheetPage = i.next(); - if (propertySheetPage.getControl().isDisposed()) { - i.remove(); - } - else { - propertySheetPage.refresh(); - } + if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) { + propertySheetPage.refresh(); } } }); @@ -961,7 +945,7 @@ public class RepositoryEditor getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; - Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() }; + Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() }; viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); } @@ -1419,22 +1403,23 @@ public class RepositoryEditor * @generated */ public IPropertySheetPage getPropertySheetPage() { - PropertySheetPage propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { - @Override - public void setSelectionToViewer(List<?> selection) { - RepositoryEditor.this.setSelectionToViewer(selection); - RepositoryEditor.this.setFocus(); - } + if (propertySheetPage == null) { + propertySheetPage = + new ExtendedPropertySheetPage(editingDomain) { + @Override + public void setSelectionToViewer(List<?> selection) { + RepositoryEditor.this.setSelectionToViewer(selection); + RepositoryEditor.this.setFocus(); + } - @Override - public void setActionBars(IActionBars actionBars) { - super.setActionBars(actionBars); - getActionBarContributor().shareGlobalActions(this, actionBars); - } - }; - propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); - propertySheetPages.add(propertySheetPage); + @Override + public void setActionBars(IActionBars actionBars) { + super.setActionBars(actionBars); + getActionBarContributor().shareGlobalActions(this, actionBars); + } + }; + propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); + } return propertySheetPage; } @@ -1501,7 +1486,6 @@ public class RepositoryEditor // final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); // Do the work within an operation because this is a long running activity that modifies the workbench. // @@ -1554,7 +1538,7 @@ public class RepositoryEditor /** * This returns whether something has been persisted to the URI of the specified resource. - * The implementation uses the URI converter from the editor's resource set to try to open an input stream. + * The implementation uses the URI converter from the editor's resource set to try to open an input stream. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated @@ -1626,9 +1610,20 @@ public class RepositoryEditor * @generated */ public void gotoMarker(IMarker marker) { - List<?> targetObjects = markerHelper.getTargetObjects(editingDomain, marker); - if (!targetObjects.isEmpty()) { - setSelectionToViewer(targetObjects); + try { + if (marker.getType().equals(EValidator.MARKER)) { + String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null); + if (uriAttribute != null) { + URI uri = URI.createURI(uriAttribute); + EObject eObject = editingDomain.getResourceSet().getEObject(uri, true); + if (eObject != null) { + setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject))); + } + } + } + } + catch (CoreException exception) { + ApplicationlevelEditorPlugin.INSTANCE.log(exception); } } @@ -1819,7 +1814,7 @@ public class RepositoryEditor getActionBarContributor().setActiveEditor(null); } - for (PropertySheetPage propertySheetPage : propertySheetPages) { + if (propertySheetPage != null) { propertySheetPage.dispose(); } diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/servicebehavior/presentation/ServicebehaviorEditor.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/servicebehavior/presentation/ServicebehaviorEditor.java index 546902fd44afd4b4494c3a7298d8e4e742f1c52c..d4ee54db09dce19dff32e0b83ac78358a21ff048 100644 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/servicebehavior/presentation/ServicebehaviorEditor.java +++ b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/servicebehavior/presentation/ServicebehaviorEditor.java @@ -122,6 +122,8 @@ import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.URI; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EValidator; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; @@ -231,7 +233,7 @@ public class ServicebehaviorEditor * <!-- end-user-doc --> * @generated */ - protected List<PropertySheetPage> propertySheetPages = new ArrayList<PropertySheetPage>(); + protected PropertySheetPage propertySheetPage; /** * This is the viewer that shadows the selection in the content outline. @@ -350,7 +352,7 @@ public class ServicebehaviorEditor } } else if (p instanceof PropertySheet) { - if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) { + if (((PropertySheet)p).getCurrentPage() == propertySheetPage) { getActionBarContributor().setActiveEditor(ServicebehaviorEditor.this); handleActivate(); } @@ -462,15 +464,6 @@ public class ServicebehaviorEditor @Override protected void unsetTarget(Resource target) { basicUnsetTarget(target); - resourceToDiagnosticMap.remove(target); - if (updateProblemIndication) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - updateProblemIndication(); - } - }); - } } }; @@ -504,7 +497,6 @@ public class ServicebehaviorEditor } } } - return false; } return true; @@ -748,14 +740,8 @@ public class ServicebehaviorEditor if (mostRecentCommand != null) { setSelectionToViewer(mostRecentCommand.getAffectedObjects()); } - for (Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext(); ) { - PropertySheetPage propertySheetPage = i.next(); - if (propertySheetPage.getControl().isDisposed()) { - i.remove(); - } - else { - propertySheetPage.refresh(); - } + if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) { + propertySheetPage.refresh(); } } }); @@ -961,7 +947,7 @@ public class ServicebehaviorEditor getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; - Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() }; + Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() }; viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); } @@ -1419,22 +1405,23 @@ public class ServicebehaviorEditor * @generated */ public IPropertySheetPage getPropertySheetPage() { - PropertySheetPage propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { - @Override - public void setSelectionToViewer(List<?> selection) { - ServicebehaviorEditor.this.setSelectionToViewer(selection); - ServicebehaviorEditor.this.setFocus(); - } + if (propertySheetPage == null) { + propertySheetPage = + new ExtendedPropertySheetPage(editingDomain) { + @Override + public void setSelectionToViewer(List<?> selection) { + ServicebehaviorEditor.this.setSelectionToViewer(selection); + ServicebehaviorEditor.this.setFocus(); + } - @Override - public void setActionBars(IActionBars actionBars) { - super.setActionBars(actionBars); - getActionBarContributor().shareGlobalActions(this, actionBars); - } - }; - propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); - propertySheetPages.add(propertySheetPage); + @Override + public void setActionBars(IActionBars actionBars) { + super.setActionBars(actionBars); + getActionBarContributor().shareGlobalActions(this, actionBars); + } + }; + propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); + } return propertySheetPage; } @@ -1501,7 +1488,6 @@ public class ServicebehaviorEditor // final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); // Do the work within an operation because this is a long running activity that modifies the workbench. // @@ -1554,7 +1540,7 @@ public class ServicebehaviorEditor /** * This returns whether something has been persisted to the URI of the specified resource. - * The implementation uses the URI converter from the editor's resource set to try to open an input stream. + * The implementation uses the URI converter from the editor's resource set to try to open an input stream. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated @@ -1626,9 +1612,20 @@ public class ServicebehaviorEditor * @generated */ public void gotoMarker(IMarker marker) { - List<?> targetObjects = markerHelper.getTargetObjects(editingDomain, marker); - if (!targetObjects.isEmpty()) { - setSelectionToViewer(targetObjects); + try { + if (marker.getType().equals(EValidator.MARKER)) { + String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null); + if (uriAttribute != null) { + URI uri = URI.createURI(uriAttribute); + EObject eObject = editingDomain.getResourceSet().getEObject(uri, true); + if (eObject != null) { + setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject))); + } + } + } + } + catch (CoreException exception) { + ApplicationlevelEditorPlugin.INSTANCE.log(exception); } } @@ -1819,7 +1816,7 @@ public class ServicebehaviorEditor getActionBarContributor().setActiveEditor(null); } - for (PropertySheetPage propertySheetPage : propertySheetPages) { + if (propertySheetPage != null) { propertySheetPage.dispose(); } diff --git a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/system/presentation/SystemEditor.java b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/system/presentation/SystemEditor.java index bc76b631ed8123de3247d9fcca143be02320e56f..40f5166b4b5927042dfb2e58e653099e4f9ca8dd 100644 --- a/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/system/presentation/SystemEditor.java +++ b/edu.kit.ipd.descartes.mm.applicationlevel.editor/src/edu/kit/ipd/descartes/mm/applicationlevel/system/presentation/SystemEditor.java @@ -231,7 +231,7 @@ public class SystemEditor * <!-- end-user-doc --> * @generated */ - protected List<PropertySheetPage> propertySheetPages = new ArrayList<PropertySheetPage>(); + protected PropertySheetPage propertySheetPage; /** * This is the viewer that shadows the selection in the content outline. @@ -350,7 +350,7 @@ public class SystemEditor } } else if (p instanceof PropertySheet) { - if (propertySheetPages.contains(((PropertySheet)p).getCurrentPage())) { + if (((PropertySheet)p).getCurrentPage() == propertySheetPage) { getActionBarContributor().setActiveEditor(SystemEditor.this); handleActivate(); } @@ -462,15 +462,6 @@ public class SystemEditor @Override protected void unsetTarget(Resource target) { basicUnsetTarget(target); - resourceToDiagnosticMap.remove(target); - if (updateProblemIndication) { - getSite().getShell().getDisplay().asyncExec - (new Runnable() { - public void run() { - updateProblemIndication(); - } - }); - } } }; @@ -504,7 +495,6 @@ public class SystemEditor } } } - return false; } return true; @@ -748,14 +738,8 @@ public class SystemEditor if (mostRecentCommand != null) { setSelectionToViewer(mostRecentCommand.getAffectedObjects()); } - for (Iterator<PropertySheetPage> i = propertySheetPages.iterator(); i.hasNext(); ) { - PropertySheetPage propertySheetPage = i.next(); - if (propertySheetPage.getControl().isDisposed()) { - i.remove(); - } - else { - propertySheetPage.refresh(); - } + if (propertySheetPage != null && !propertySheetPage.getControl().isDisposed()) { + propertySheetPage.refresh(); } } }); @@ -961,7 +945,7 @@ public class SystemEditor getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer)); int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK; - Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() }; + Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() }; viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer)); viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer)); } @@ -1419,22 +1403,23 @@ public class SystemEditor * @generated */ public IPropertySheetPage getPropertySheetPage() { - PropertySheetPage propertySheetPage = - new ExtendedPropertySheetPage(editingDomain) { - @Override - public void setSelectionToViewer(List<?> selection) { - SystemEditor.this.setSelectionToViewer(selection); - SystemEditor.this.setFocus(); - } + if (propertySheetPage == null) { + propertySheetPage = + new ExtendedPropertySheetPage(editingDomain) { + @Override + public void setSelectionToViewer(List<?> selection) { + SystemEditor.this.setSelectionToViewer(selection); + SystemEditor.this.setFocus(); + } - @Override - public void setActionBars(IActionBars actionBars) { - super.setActionBars(actionBars); - getActionBarContributor().shareGlobalActions(this, actionBars); - } - }; - propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); - propertySheetPages.add(propertySheetPage); + @Override + public void setActionBars(IActionBars actionBars) { + super.setActionBars(actionBars); + getActionBarContributor().shareGlobalActions(this, actionBars); + } + }; + propertySheetPage.setPropertySourceProvider(new AdapterFactoryContentProvider(adapterFactory)); + } return propertySheetPage; } @@ -1501,7 +1486,6 @@ public class SystemEditor // final Map<Object, Object> saveOptions = new HashMap<Object, Object>(); saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER); - saveOptions.put(Resource.OPTION_LINE_DELIMITER, Resource.OPTION_LINE_DELIMITER_UNSPECIFIED); // Do the work within an operation because this is a long running activity that modifies the workbench. // @@ -1554,7 +1538,7 @@ public class SystemEditor /** * This returns whether something has been persisted to the URI of the specified resource. - * The implementation uses the URI converter from the editor's resource set to try to open an input stream. + * The implementation uses the URI converter from the editor's resource set to try to open an input stream. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated @@ -1626,9 +1610,20 @@ public class SystemEditor * @generated */ public void gotoMarker(IMarker marker) { - List<?> targetObjects = markerHelper.getTargetObjects(editingDomain, marker); - if (!targetObjects.isEmpty()) { - setSelectionToViewer(targetObjects); + try { + if (marker.getType().equals(EValidator.MARKER)) { + String uriAttribute = marker.getAttribute(EValidator.URI_ATTRIBUTE, null); + if (uriAttribute != null) { + URI uri = URI.createURI(uriAttribute); + EObject eObject = editingDomain.getResourceSet().getEObject(uri, true); + if (eObject != null) { + setSelectionToViewer(Collections.singleton(editingDomain.getWrapper(eObject))); + } + } + } + } + catch (CoreException exception) { + ApplicationlevelEditorPlugin.INSTANCE.log(exception); } } @@ -1819,7 +1814,7 @@ public class SystemEditor getActionBarContributor().setActiveEditor(null); } - for (PropertySheetPage propertySheetPage : propertySheetPages) { + if (propertySheetPage != null) { propertySheetPage.dispose(); }