### Eclipse Workspace Patch 1.0
#P org.eclipse.gmf.runtime.diagram.ui
Index: src/org/eclipse/gmf/runtime/diagram/ui/editpolicies/DiagramAssistantEditPolicy.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.runtime.diagram.ui/src/org/eclipse/gmf/runtime/diagram/ui/editpolicies/DiagramAssistantEditPolicy.java,v
retrieving revision 1.6.2.1
diff -u -r1.6.2.1 DiagramAssistantEditPolicy.java
--- src/org/eclipse/gmf/runtime/diagram/ui/editpolicies/DiagramAssistantEditPolicy.java 21 Aug 2006 18:22:53 -0000 1.6.2.1
+++ src/org/eclipse/gmf/runtime/diagram/ui/editpolicies/DiagramAssistantEditPolicy.java 7 Sep 2006 19:44:30 -0000
@@ -42,19 +42,19 @@
* The Runnable
used when a timer is started to show the
* diagram assistant after a certain amount of time has passed.
*/
- private class ShowDiagramAssistantRunnable
+ protected class ShowDiagramAssistantRunnable
implements Runnable {
/** the mouse location when the timer was started */
private Point originalMouseLocation;
/**
- * Creates a new instance.
+ * Sets mouse location
*
* @param originalMouseLocation
* the current mouse location
*/
- protected ShowDiagramAssistantRunnable(Point originalMouseLocation) {
+ public void setOriginalMouseLocation(Point originalMouseLocation) {
this.originalMouseLocation = originalMouseLocation;
}
@@ -80,19 +80,20 @@
* The Runnable
used when a timer is started to hide the
* diagram assistant after a certain amount of time has passed.
*/
- private Runnable hideDiagramAssistantRunnable = new Runnable() {
+ protected class HideDiagramAssistantRunnable implements Runnable
+ {
/**
* The diagram assistant is removed when this task is run if the mouse
* is still outside the shape.
*/
public void run() {
- if (getMouseLocation() == null
- || !shouldAvoidHidingDiagramAssistant()) {
+ if ((getMouseLocation() == null
+ || !shouldAvoidHidingDiagramAssistant()) && isDiagramAssistantShowing()) {
hideDiagramAssistant();
}
}
- };
+ }
/**
* Listens to the focus events on the owner editpart so that the diagram
@@ -146,6 +147,9 @@
/** Flag to indicate that the diagram assistant should not be hidden. */
private boolean avoidHidingDiagramAssistant = true;
+
+ protected ShowDiagramAssistantRunnable showDiagramAssistantRunnable = new ShowDiagramAssistantRunnable();
+ protected HideDiagramAssistantRunnable hideDiagramAssistantRunnable = new HideDiagramAssistantRunnable();
/**
* Creates a new instance.
@@ -286,10 +290,8 @@
* the delay in milliseconds
*/
protected void showDiagramAssistantAfterDelay(int delay) {
- if (shouldShowDiagramAssistant()) {
- Display.getCurrent().timerExec(delay,
- new ShowDiagramAssistantRunnable(getMouseLocation()));
- }
+ showDiagramAssistantRunnable.setOriginalMouseLocation(getMouseLocation());
+ Display.getCurrent().timerExec(delay,showDiagramAssistantRunnable);
}
/**
@@ -299,9 +301,7 @@
* the delay in milliseconds
*/
protected void hideDiagramAssistantAfterDelay(int delay) {
- if (isDiagramAssistantShowing()) {
- Display.getCurrent().timerExec(delay, hideDiagramAssistantRunnable);
- }
+ Display.getCurrent().timerExec(delay, hideDiagramAssistantRunnable);
}
/*