Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 44444 Details for
Bug 143198
SWTExceptions occurring when handling notifications from worker thread transactions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Alternate patch for this problem that is more general...
progress meter synchronize.txt (text/plain), 11.08 KB, created by
Steven R. Shaw
on 2006-06-14 15:52:56 EDT
(
hide
)
Description:
Alternate patch for this problem that is more general...
Filename:
MIME Type:
Creator:
Steven R. Shaw
Created:
2006-06-14 15:52:56 EDT
Size:
11.08 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.gmf.runtime.diagram.ui >Index: src/org/eclipse/gmf/runtime/diagram/ui/internal/DiagramEventBrokerThreadSafe.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.diagram.ui/src/org/eclipse/gmf/runtime/diagram/ui/internal/DiagramEventBrokerThreadSafe.java,v >retrieving revision 1.1 >diff -u -r1.1 DiagramEventBrokerThreadSafe.java >--- src/org/eclipse/gmf/runtime/diagram/ui/internal/DiagramEventBrokerThreadSafe.java 31 May 2006 16:26:07 -0000 1.1 >+++ src/org/eclipse/gmf/runtime/diagram/ui/internal/DiagramEventBrokerThreadSafe.java 14 Jun 2006 19:00:48 -0000 >@@ -11,16 +11,10 @@ > package org.eclipse.gmf.runtime.diagram.ui.internal; > > import java.lang.ref.WeakReference; >-import java.util.Iterator; >-import java.util.Set; > >-import org.eclipse.emf.common.notify.Notification; > import org.eclipse.emf.transaction.ResourceSetChangeEvent; > import org.eclipse.emf.transaction.TransactionalEditingDomain; >-import org.eclipse.gef.EditPartViewer; > import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker; >-import org.eclipse.gmf.runtime.diagram.ui.internal.parts.NotificationForEditPartsListener; >-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramGraphicalViewer; > import org.eclipse.swt.widgets.Display; > import org.eclipse.ui.PlatformUI; > >@@ -34,8 +28,8 @@ > * that has been exeucted with a progress meter, where the progress meter is displaying UI on the main > * thread and there is a background thread that is being executed that the progress meter is monitoring. > * For this scenario, the UI updates on the diagram viewer have been disabled so as to avoid concurrency >- * issues and it is desirable that the notifications continue to be handled on the worker thread so that >- * the progress meter doesn't lock up. >+ * issues. When notifications are handled, they are synchronized to the main thread to avoid >+ * SWTExceptions when UI tries to access SWT resources when updating figures or other UI. > * > * The second scenario is for when a job has been executed on a worker thread, but has not been executed > * through the OperationHistory. Consequently, there is no hook for turning off display updates. This >@@ -60,44 +54,27 @@ > * @see org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker#resourceSetChanged(org.eclipse.emf.transaction.ResourceSetChangeEvent) > */ > public void resourceSetChanged(ResourceSetChangeEvent event) { >- if (Display.getCurrent() == null) { >- if (shouldSynchronizeWithMainThread(event)) { >- // force synchronization with the main thread >- final ResourceSetChangeEvent eventToHandle = event; >- TransactionalEditingDomain editingDomain = (TransactionalEditingDomain)editingDomainRef.get(); >- if (editingDomain != null) { >- PlatformUI.getWorkbench().getDisplay().syncExec(editingDomain.createPrivilegedRunnable(new Runnable() { >- public void run() { >- internal_resourceSetChanged(eventToHandle); >- } >- })); >+ if (shouldSynchronizeWithMainThread(event)) { >+ // force synchronization with the main thread >+ final ResourceSetChangeEvent eventToHandle = event; >+ TransactionalEditingDomain editingDomain = (TransactionalEditingDomain)editingDomainRef.get(); >+ if (editingDomain != null) { >+ PlatformUI.getWorkbench().getDisplay().syncExec(editingDomain.createPrivilegedRunnable(new Runnable() { >+ public void run() { >+ internal_resourceSetChanged(eventToHandle); >+ } >+ })); > >- return; >- } >- } >+ return; >+ } > } > > super.resourceSetChanged(event); > } > > private boolean shouldSynchronizeWithMainThread(ResourceSetChangeEvent event) { >- >- for (Iterator i = event.getNotifications().iterator(); i.hasNext();) { >- final Notification notification = (Notification) i.next(); >- Set nlSet = getInterestedNotificationListeners(notification, false); >- Iterator iter = nlSet.iterator(); >- while (iter.hasNext()) { >- Object listener = iter.next(); >- if (listener instanceof NotificationForEditPartsListener) { >- EditPartViewer viewer = ((NotificationForEditPartsListener)listener).getViewer(); >- if (viewer instanceof DiagramGraphicalViewer) { >- if (!((DiagramGraphicalViewer)viewer).areUpdatesDisabled()) { >- return true; >- } >- } >- } >- } >- } >+ if (Display.getCurrent() == null) >+ return true; > > return false; > } >Index: src/org/eclipse/gmf/runtime/diagram/ui/internal/parts/NotificationForEditPartsListener.java >=================================================================== >RCS file: src/org/eclipse/gmf/runtime/diagram/ui/internal/parts/NotificationForEditPartsListener.java >diff -N src/org/eclipse/gmf/runtime/diagram/ui/internal/parts/NotificationForEditPartsListener.java >--- src/org/eclipse/gmf/runtime/diagram/ui/internal/parts/NotificationForEditPartsListener.java 31 May 2006 16:26:07 -0000 1.1 >+++ /dev/null 1 Jan 1970 00:00:00 -0000 >@@ -1,30 +0,0 @@ >-/****************************************************************************** >- * Copyright (c) 2006 IBM Corporation and others. >- * All rights reserved. This program and the accompanying materials >- * are made available under the terms of the Eclipse Public License v1.0 >- * which accompanies this distribution, and is available at >- * http://www.eclipse.org/legal/epl-v10.html >- * >- * Contributors: >- * IBM Corporation - initial API and implementation >- ****************************************************************************/ >- >-package org.eclipse.gmf.runtime.diagram.ui.internal.parts; >- >-import org.eclipse.gef.EditPartViewer; >-import org.eclipse.gmf.runtime.diagram.core.listener.NotificationListener; >- >-/** >- * This class is an extension of the <code>NotificationListener</code> interface to allow clients >- * handling the listener to determine which viewer the notification is relevant for. >- * >- * @author sshaw >- * >- */ >-public interface NotificationForEditPartsListener extends NotificationListener { >- >- /** >- * @return >- */ >- public EditPartViewer getViewer(); >-} >Index: src/org/eclipse/gmf/runtime/diagram/ui/editpolicies/CanonicalEditPolicy.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.diagram.ui/src/org/eclipse/gmf/runtime/diagram/ui/editpolicies/CanonicalEditPolicy.java,v >retrieving revision 1.21 >diff -u -r1.21 CanonicalEditPolicy.java >--- src/org/eclipse/gmf/runtime/diagram/ui/editpolicies/CanonicalEditPolicy.java 2 Jun 2006 13:15:59 -0000 1.21 >+++ src/org/eclipse/gmf/runtime/diagram/ui/editpolicies/CanonicalEditPolicy.java 14 Jun 2006 19:00:48 -0000 >@@ -63,7 +63,6 @@ > import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIDebugOptions; > import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin; > import org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIStatusCodes; >-import org.eclipse.gmf.runtime.diagram.ui.internal.parts.NotificationForEditPartsListener; > import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages; > import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; > import org.eclipse.gmf.runtime.diagram.ui.util.EditPartUtil; >@@ -98,7 +97,7 @@ > * @author mhanner > */ > public abstract class CanonicalEditPolicy extends AbstractEditPolicy >-implements NotificationForEditPartsListener { >+implements NotificationListener { > > /** Runs the supplied commands asyncronously. */ > private static class AsyncCommand extends Command { >Index: src/org/eclipse/gmf/runtime/diagram/ui/editparts/GraphicalEditPart.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.diagram.ui/src/org/eclipse/gmf/runtime/diagram/ui/editparts/GraphicalEditPart.java,v >retrieving revision 1.41 >diff -u -r1.41 GraphicalEditPart.java >--- src/org/eclipse/gmf/runtime/diagram/ui/editparts/GraphicalEditPart.java 2 Jun 2006 13:15:59 -0000 1.41 >+++ src/org/eclipse/gmf/runtime/diagram/ui/editparts/GraphicalEditPart.java 14 Jun 2006 19:00:47 -0000 >@@ -69,7 +69,6 @@ > import org.eclipse.gmf.runtime.diagram.ui.internal.editparts.DummyEditPart; > import org.eclipse.gmf.runtime.diagram.ui.internal.editparts.IEditableEditPart; > import org.eclipse.gmf.runtime.diagram.ui.internal.l10n.DiagramFontRegistry; >-import org.eclipse.gmf.runtime.diagram.ui.internal.parts.NotificationForEditPartsListener; > import org.eclipse.gmf.runtime.diagram.ui.internal.services.editpolicy.EditPolicyService; > import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; > import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramEditDomain; >@@ -107,7 +106,7 @@ > */ > public abstract class GraphicalEditPart > extends AbstractGraphicalEditPart >- implements IGraphicalEditPart, IAdaptableSelection, NotificationForEditPartsListener { >+ implements IGraphicalEditPart, IAdaptableSelection, NotificationListener { > > /** A map of listener filters ids to filter data */ > private Map listenerFilters; >Index: src/org/eclipse/gmf/runtime/diagram/ui/editparts/ConnectionEditPart.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.diagram.ui/src/org/eclipse/gmf/runtime/diagram/ui/editparts/ConnectionEditPart.java,v >retrieving revision 1.34 >diff -u -r1.34 ConnectionEditPart.java >--- src/org/eclipse/gmf/runtime/diagram/ui/editparts/ConnectionEditPart.java 5 Jun 2006 20:30:20 -0000 1.34 >+++ src/org/eclipse/gmf/runtime/diagram/ui/editparts/ConnectionEditPart.java 14 Jun 2006 19:00:47 -0000 >@@ -76,7 +76,6 @@ > import org.eclipse.gmf.runtime.diagram.ui.internal.editpolicies.ConnectionLineSegEditPolicy; > import org.eclipse.gmf.runtime.diagram.ui.internal.editpolicies.TreeConnectionBendpointEditPolicy; > import org.eclipse.gmf.runtime.diagram.ui.internal.l10n.DiagramFontRegistry; >-import org.eclipse.gmf.runtime.diagram.ui.internal.parts.NotificationForEditPartsListener; > import org.eclipse.gmf.runtime.diagram.ui.internal.properties.Properties; > import org.eclipse.gmf.runtime.diagram.ui.internal.services.editpolicy.EditPolicyService; > import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry; >@@ -125,7 +124,7 @@ > abstract public class ConnectionEditPart > extends AbstractConnectionEditPart > implements IGraphicalEditPart, PropertyChangeListener, IContainedEditPart, >- IPrimaryEditPart, NotificationForEditPartsListener { >+ IPrimaryEditPart, NotificationListener { > > /** A map of listener filters ids to filter data */ > private Map listenerFilters;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 143198
:
44444
|
44643