Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipse-dev] Eclipse beginner threading question...

Hi,

I am new to eclipse and I am having a problem with threads. I have created a MultiPageEditorPart editor. I have a background thread listening to model changes in my application. I am notified of these changes in a non -gui thread. I want to set MultiPageEditorPart as dirty whenever I receive a model change event.
So I wrote a function like this

public void setEditorModified() {
      m_bModified = true;
      if (!super.isDirty()) {
          firePropertyChange(IEditorPart.PROP_DIRTY);
      }
  }


This method crashes whenever I call it from the background thread. Below is the error stack. But it is a bit misleading. From the debugger, I can see the issue is with the thread I am calling firePropertyChange() from. Can anyone tell me what is the proper way to update the dirty state from a background thread. Also, the background thread is not aware of the GUI components it only has a refer.


java.lang.NullPointerException
at org.eclipse.jface.dialogs.IconAndMessageDialog.getSWTImage(IconAndMessageDialog.java:225) at org.eclipse.jface.dialogs.IconAndMessageDialog.getErrorImage(IconAndMessageDialog.java:172) at org.eclipse.jface.dialogs.MessageDialog.<init>(MessageDialog.java:141) at org.eclipse.jface.dialogs.MessageDialog.openError(MessageDialog.java:310) at org.eclipse.jface.util.SafeRunnable.handleException(SafeRunnable.java:59) at org.eclipse.core.internal.runtime.InternalPlatform.handleException(InternalPlatform.java:703) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:1023)
  at org.eclipse.core.runtime.Platform.run(Platform.java:757)
at org.eclipse.ui.part.WorkbenchPart.firePropertyChange(WorkbenchPart.java:121) at horst.modeler.editors.BPELModelerEditor.setEditorModified(BPELModelerEditor.java:103) at horst.modeler.editors.BPELModelerEditor.threadSafeSetEditorModified(BPELModelerEditor.java:96) at horst.modeler.editors.BPELModelerEditor$1.graphNodesInserted(BPELModelerEditor.java:142) at oracle.tip.tools.ide.common.graph.AbstractGraphModel.fireGraphNodesInserted(AbstractGraphModel.java:391) at oracle.tip.tools.ide.common.graph.AbstractGraphModel.insertChildNode(AbstractGraphModel.java:132) at oracle.tip.tools.ide.pm.bpelgraph.collaxalaf.BPELDNDDropHandler.handleDrop(BPELDNDDropHandler.java:202) at oracle.tip.tools.ide.common.graph.DefaultGraphPaneDropTargetListener.routeToDropHandler(DefaultGraphPaneDropTargetListener.java:212) at oracle.tip.tools.ide.common.graph.DefaultGraphPaneDropTargetListener.handleDrop(DefaultGraphPaneDropTargetListener.java:200) at oracle.tip.tools.ide.pm.bpelgraph.collaxalaf.BPELGraphPaneDropTargetListener.handleDrop(BPELGraphPaneDropTargetListener.java:75) at oracle.tip.tools.ide.common.graph.DefaultGraphPaneDropTargetListener.drop(DefaultGraphPaneDropTargetListener.java:260)
  at java.awt.dnd.DropTarget.drop(Unknown Source)
at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(Unknown Source)
  at sun.awt.dnd.SunDropTargetContextPeer.access$800(Unknown Source)
at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchDropEvent(Unknown Source) at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(Unknown Source)
  at sun.awt.dnd.SunDropTargetEvent.dispatch(Unknown Source)
  at java.awt.Component.dispatchEventImpl(Unknown Source)
  at java.awt.Container.dispatchEventImpl(Unknown Source)
  at java.awt.Component.dispatchEvent(Unknown Source)
  at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
  at java.awt.LightweightDispatcher.processDropTargetEvent(Unknown Source)
  at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
  at java.awt.Container.dispatchEventImpl(Unknown Source)
  at java.awt.Component.dispatchEvent(Unknown Source)
  at java.awt.EventQueue.dispatchEvent(Unknown Source)
  at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
  at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
  at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
  at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
  at java.awt.EventDispatchThread.run(Unknown Source)


Back to the top