Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2014-03-27 22:08:37 +0000
committerChristian W. Damus2014-03-27 22:08:37 +0000
commit906d12034232809cf6980f2d505c8d5edd1ae988 (patch)
treefff1214433d70ea6ca5bc93134aa71d985d0efc8 /plugins
parent536ce430e29c6a5e4c50a01536131b50a532a366 (diff)
downloadorg.eclipse.papyrus-906d12034232809cf6980f2d505c8d5edd1ae988.tar.gz
org.eclipse.papyrus-906d12034232809cf6980f2d505c8d5edd1ae988.tar.xz
org.eclipse.papyrus-906d12034232809cf6980f2d505c8d5edd1ae988.zip
410346: Sudden performance degradation e.g. of the Outline View update.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=410346 More fixes for undisposed ComposedAdapterFactory instances. Also fix bad icon references in the TemplateParameter configuration dialog.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/ui/AbstractTemplateParameterConfigurationDialog.java7
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/ui/dialogs/ElementChooseDialog.java39
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/CollaborationRoleCreateCommand.java33
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/InformationFlowCreateCommand.java92
-rw-r--r--plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/RoleBindingCreateCommand.java30
5 files changed, 111 insertions, 90 deletions
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/ui/AbstractTemplateParameterConfigurationDialog.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/ui/AbstractTemplateParameterConfigurationDialog.java
index 617b1c188b4..6262acadf59 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/ui/AbstractTemplateParameterConfigurationDialog.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.clazz/custom-src/org/eclipse/papyrus/uml/diagram/clazz/custom/ui/AbstractTemplateParameterConfigurationDialog.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 410346
*/
package org.eclipse.papyrus.uml.diagram.clazz.custom.ui;
@@ -126,7 +127,7 @@ public class AbstractTemplateParameterConfigurationDialog extends Dialog {
public void widgetSelected(SelectionEvent e) {
}
});
- choosePararameteredElementButton.setImage(Activator.getPluginIconImage("org.eclipse.papyrus.icons.uml", "resource/gif/Package.gif"));
+ choosePararameteredElementButton.setImage(Activator.getPluginIconImage("org.eclipse.papyrus.uml.icons", "resource/gif/Package.gif"));
choosePararameteredElementButton.setBounds(322, 10, 68, 23);
choosePararameteredElementButton.setText("...");
parameteredElementLabel = new CLabel(composite_1, SWT.NONE);
@@ -150,7 +151,7 @@ public class AbstractTemplateParameterConfigurationDialog extends Dialog {
composite.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
xpndtmSetTheDefault.setControl(composite);
chooseDefaultParameterButton = new Button(composite, SWT.NONE);
- chooseDefaultParameterButton.setImage(Activator.getPluginIconImage("org.eclipse.papyrus.icons.uml", "resource/gif/Package.gif"));
+ chooseDefaultParameterButton.setImage(Activator.getPluginIconImage("org.eclipse.papyrus.uml.icons", "resource/gif/Package.gif"));
chooseDefaultParameterButton.setBounds(322, 10, 68, 23);
chooseDefaultParameterButton.setText("...");
defaultElementLabel = new CLabel(composite, SWT.NONE);
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/ui/dialogs/ElementChooseDialog.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/ui/dialogs/ElementChooseDialog.java
index cb4f17e5a61..83b2810f4af 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/ui/dialogs/ElementChooseDialog.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/ui/dialogs/ElementChooseDialog.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2010 CEA LIST.
+ * Copyright (c) 2010, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 410346
*/
package org.eclipse.papyrus.uml.diagram.common.ui.dialogs;
@@ -20,6 +21,7 @@ import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IDisposable;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -28,8 +30,10 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.ParameterableElement;
@@ -161,26 +165,31 @@ public class ElementChooseDialog extends AbstractChooseElement {
}
});
- btnSelect.addMouseListener(new MouseListener() {
-
- public void mouseUp(MouseEvent e) {
+ btnSelect.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
getParent().close();
}
-
- public void mouseDown(MouseEvent e) {}
- public void mouseDoubleClick(MouseEvent e) {}
});
- btnCancel.addMouseListener(new MouseListener() {
-
- public void mouseUp(MouseEvent e) {
+ btnCancel.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
result=null;
selectedElement=null;
getParent().close();
}
-
- public void mouseDown(MouseEvent e) {}
- public void mouseDoubleClick(MouseEvent e) {}
+ });
+
+ getParent().addDisposeListener(new DisposeListener() {
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ // Remove the adapters created by this factory
+ if(adapterFactory instanceof IDisposable) {
+ ((IDisposable)adapterFactory).dispose();
+ }
+ }
});
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/CollaborationRoleCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/CollaborationRoleCreateCommand.java
index 65abb920576..b89c3de008c 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/CollaborationRoleCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/CollaborationRoleCreateCommand.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
+ * Copyright (c) 2009, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 410346
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.composite.custom.edit.command;
@@ -16,7 +17,6 @@ package org.eclipse.papyrus.uml.diagram.composite.custom.edit.command;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
@@ -24,7 +24,6 @@ import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.uml.diagram.composite.custom.messages.Messages;
import org.eclipse.papyrus.uml.diagram.composite.custom.ui.CollaborationRoleValidator;
import org.eclipse.papyrus.uml.diagram.composite.edit.commands.CollaborationRoleCreateCommandCN;
@@ -95,22 +94,26 @@ public class CollaborationRoleCreateCommand extends CollaborationRoleCreateComma
Collaboration owner = (Collaboration)getElementToEdit();
// Create and open the selection dialog
- AdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+ ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
Shell currentShell = new Shell(Display.getCurrent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(currentShell, new AdapterFactoryLabelProvider(adapterFactory), new AdapterFactoryContentProvider(adapterFactory));
- // Set dialog parameters
- dialog.setTitle(Messages.CollaborationRoleSelectionDialog_Title);
- dialog.setMessage(Messages.CollaborationRoleSelectionDialog_Message);
- dialog.setAllowMultiple(false);
- dialog.setHelpAvailable(false);
- // ConnectableElement from the whole model can be selected as role.
- dialog.setInput(owner.getModel());
- // CollaborationRoleValidator ensures that an the selected element is a ConnectableElement.
- dialog.setValidator(new CollaborationRoleValidator());
-
- dialog.open();
+ try {
+ // Set dialog parameters
+ dialog.setTitle(Messages.CollaborationRoleSelectionDialog_Title);
+ dialog.setMessage(Messages.CollaborationRoleSelectionDialog_Message);
+ dialog.setAllowMultiple(false);
+ dialog.setHelpAvailable(false);
+ // ConnectableElement from the whole model can be selected as role.
+ dialog.setInput(owner.getModel());
+ // CollaborationRoleValidator ensures that an the selected element is a ConnectableElement.
+ dialog.setValidator(new CollaborationRoleValidator());
+ dialog.open();
+ } finally {
+ adapterFactory.dispose();
+ }
+
// If a ConnectableElement has been selected, complete command execution
// using selection as the "newly created" element and make the edited
// Collaboration reference it in the CollaborationRoles eReference.
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/InformationFlowCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/InformationFlowCreateCommand.java
index cd94d49e2d1..768cc8b4267 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/InformationFlowCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/InformationFlowCreateCommand.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
+ * Copyright (c) 2009, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 410346
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.composite.custom.edit.command;
@@ -18,7 +19,6 @@ import java.util.ArrayList;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
@@ -74,52 +74,56 @@ public class InformationFlowCreateCommand extends org.eclipse.papyrus.uml.diagra
protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
// Create and open the selection dialog
- AdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+ ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
Shell currentShell = new Shell(Display.getCurrent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
InformationItemElementTreeSelectionDialog dialog = new InformationItemElementTreeSelectionDialog(currentShell, new AdapterFactoryLabelProvider(adapterFactory), new AdapterFactoryContentProvider(adapterFactory));
- // Set dialog parameters
- dialog.setTitle(Messages.InformationFlowSelectionDialog_Title);
- dialog.setMessage(Messages.InformationFlowSelectionDialog_Message);
- dialog.setAllowMultiple(true);
- dialog.setHelpAvailable(false);
- dialog.setInput(getSource().getModel());
- dialog.setValidator(new InformationItemValidator());
-
- ArrayList<Classifier> initialSelection = new ArrayList<Classifier>();
-
- // here the dialog.getReturnCode is IDialogConstants.OK_ID
- while(dialog.open() != IDialogConstants.CANCEL_ID) {
-
- /*
- * If classifiers have been selected, complete command execution and write the selection
- * in the conveyed:Classifief Association
- */
- if(dialog.getReturnCode() == ElementTreeSelectionDialog.OK) {
- Object[] conveyedClassified = dialog.getResult();
-
- InformationFlow newInformationFlow = UMLFactory.eINSTANCE.createInformationFlow();
- getContainer().getPackagedElements().add(newInformationFlow);
- newInformationFlow.getInformationSources().add(getSource());
- newInformationFlow.getInformationTargets().add(getTarget());
-
- // add the classifier in the list of conveyed Classifier
- for(int i = 0; i < conveyedClassified.length; i++) {
- newInformationFlow.getConveyeds().add((Classifier)conveyedClassified[i]);
+ try {
+ // Set dialog parameters
+ dialog.setTitle(Messages.InformationFlowSelectionDialog_Title);
+ dialog.setMessage(Messages.InformationFlowSelectionDialog_Message);
+ dialog.setAllowMultiple(true);
+ dialog.setHelpAvailable(false);
+ dialog.setInput(getSource().getModel());
+ dialog.setValidator(new InformationItemValidator());
+
+ ArrayList<Classifier> initialSelection = new ArrayList<Classifier>();
+
+ // here the dialog.getReturnCode is IDialogConstants.OK_ID
+ while(dialog.open() != IDialogConstants.CANCEL_ID) {
+
+ /*
+ * If classifiers have been selected, complete command execution and write the selection
+ * in the conveyed:Classifief Association
+ */
+ if(dialog.getReturnCode() == ElementTreeSelectionDialog.OK) {
+ Object[] conveyedClassified = dialog.getResult();
+
+ InformationFlow newInformationFlow = UMLFactory.eINSTANCE.createInformationFlow();
+ getContainer().getPackagedElements().add(newInformationFlow);
+ newInformationFlow.getInformationSources().add(getSource());
+ newInformationFlow.getInformationTargets().add(getTarget());
+
+ // add the classifier in the list of conveyed Classifier
+ for(int i = 0; i < conveyedClassified.length; i++) {
+ newInformationFlow.getConveyeds().add((Classifier)conveyedClassified[i]);
+ }
+
+ ElementInitializers.getInstance().init_InformationFlow_4021(newInformationFlow);
+
+ ((CreateElementRequest)getRequest()).setNewElement(newInformationFlow);
+ return CommandResult.newOKCommandResult(newInformationFlow);
+
+ } else if(dialog.getReturnCode() == InformationItemElementTreeSelectionDialog.newInformationItemButton_ID) {
+ // create a new InformationItem
+ initialSelection.add((Classifier)createNewInformationItem());
+ dialog.setInitialElementSelections(initialSelection);
}
-
- ElementInitializers.getInstance().init_InformationFlow_4021(newInformationFlow);
-
- ((CreateElementRequest)getRequest()).setNewElement(newInformationFlow);
- return CommandResult.newOKCommandResult(newInformationFlow);
-
- } else if(dialog.getReturnCode() == InformationItemElementTreeSelectionDialog.newInformationItemButton_ID) {
- // create a new InformationItem
- initialSelection.add((Classifier)createNewInformationItem());
- dialog.setInitialElementSelections(initialSelection);
- }
- }// end of while()
-
+ }// end of while()
+ } finally {
+ adapterFactory.dispose();
+ }
+
// No Classifier selected: abort element creation
return CommandResult.newCancelledCommandResult();
}
diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/RoleBindingCreateCommand.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/RoleBindingCreateCommand.java
index 82ed31b27d5..5ae344cf87f 100644
--- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/RoleBindingCreateCommand.java
+++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.composite/custom-src/org/eclipse/papyrus/uml/diagram/composite/custom/edit/command/RoleBindingCreateCommand.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2009-2011 CEA LIST.
+ * Copyright (c) 2009, 2014 CEA LIST and others.
*
*
* All rights reserved. This program and the accompanying materials
@@ -9,6 +9,7 @@
*
* Contributors:
* Yann Tanguy (CEA LIST) yann.tanguy@cea.fr - Initial API and implementation
+ * Christian W. Damus (CEA) - bug 410346
*
*****************************************************************************/
package org.eclipse.papyrus.uml.diagram.composite.custom.edit.command;
@@ -16,7 +17,6 @@ package org.eclipse.papyrus.uml.diagram.composite.custom.edit.command;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
@@ -78,21 +78,25 @@ public class RoleBindingCreateCommand extends org.eclipse.papyrus.uml.diagram.co
CollaborationUse graphicalSource = (CollaborationUse)getSource();
// Create and open the selection dialog
- AdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
+ ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
Shell currentShell = new Shell(Display.getCurrent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(currentShell, new AdapterFactoryLabelProvider(adapterFactory), new CollaborationRoleTreeContentProvider());
- // Set dialog parameters
- dialog.setTitle(Messages.RoleBindingRoleSelectionDialog_Title);
- dialog.setMessage(Messages.RoleBindingRoleSelectionDialog_Message);
- dialog.setAllowMultiple(false);
- dialog.setHelpAvailable(false);
- // The source CollaborationUse is set as input for the selection dialog,
- // the CollaborationRoleTreeContentProvider provides the roles that can possibly be
- // selected.
- dialog.setInput(graphicalSource);
+ try {
+ // Set dialog parameters
+ dialog.setTitle(Messages.RoleBindingRoleSelectionDialog_Title);
+ dialog.setMessage(Messages.RoleBindingRoleSelectionDialog_Message);
+ dialog.setAllowMultiple(false);
+ dialog.setHelpAvailable(false);
+ // The source CollaborationUse is set as input for the selection dialog,
+ // the CollaborationRoleTreeContentProvider provides the roles that can possibly be
+ // selected.
+ dialog.setInput(graphicalSource);
- dialog.open();
+ dialog.open();
+ } finally {
+ adapterFactory.dispose();
+ }
// If a ConnectableElement has been selected, complete command execution
// using selection as the "newly created" element and make the edited

Back to the top