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 98271 Details for
Bug 229726
Improvements to auto-scrolling behavior in GEF
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Support auto-scrolling in the ResizeTracker
ResizeTrackerPatch.txt (text/plain), 6.12 KB, created by
Cherie Revells
on 2008-04-30 17:22:12 EDT
(
hide
)
Description:
Support auto-scrolling in the ResizeTracker
Filename:
MIME Type:
Creator:
Cherie Revells
Created:
2008-04-30 17:22:12 EDT
Size:
6.12 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.gef >Index: src/org/eclipse/gef/tools/ResizeTracker.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.gef/plugins/org.eclipse.gef/src/org/eclipse/gef/tools/ResizeTracker.java,v >retrieving revision 1.38 >diff -u -r1.38 ResizeTracker.java >--- src/org/eclipse/gef/tools/ResizeTracker.java 7 Jun 2005 19:57:36 -0000 1.38 >+++ src/org/eclipse/gef/tools/ResizeTracker.java 30 Apr 2008 21:20:42 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 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 >@@ -10,10 +10,12 @@ > *******************************************************************************/ > package org.eclipse.gef.tools; > >+import java.util.Collections; > import java.util.List; > > import org.eclipse.swt.SWT; > import org.eclipse.swt.graphics.Cursor; >+import org.eclipse.swt.widgets.Display; > > import org.eclipse.draw2d.IFigure; > import org.eclipse.draw2d.PositionConstants; >@@ -23,6 +25,7 @@ > import org.eclipse.draw2d.geometry.PrecisionPoint; > import org.eclipse.draw2d.geometry.PrecisionRectangle; > >+import org.eclipse.gef.AutoexposeHelper; > import org.eclipse.gef.EditPart; > import org.eclipse.gef.GraphicalEditPart; > import org.eclipse.gef.Request; >@@ -55,7 +58,96 @@ > private GraphicalEditPart owner; > private PrecisionRectangle sourceRect; > private SnapToHelper snapToHelper; >+private PrecisionPoint sourceRelativeStartPoint; > >+private AutoexposeHelper exposeHelper; >+ >+class QueuedAutoexpose implements Runnable { >+ public void run() { >+ if (exposeHelper != null) >+ doAutoexpose(); >+ } >+} >+/** >+ * Called to perform an iteration of the autoexpose process. If the expose helper is set, >+ * it will be asked to step at the current mouse location. If it returns true, another >+ * expose iteration will be queued. There is no delay between autoexpose events, other >+ * than the time required to perform the step(). >+ */ >+protected void doAutoexpose() { >+ if (exposeHelper == null) >+ return; >+ if (exposeHelper.step(getLocation())) { >+ handleAutoexpose(); >+ Display.getCurrent().asyncExec(new QueuedAutoexpose()); >+ } else >+ setAutoexposeHelper(null); >+} >+protected void handleAutoexpose() { >+ updateSourceRequest(); >+ showSourceFeedback(); >+ showTargetFeedback(); >+ setCurrentCommand(getCommand()); >+} >+/** >+ * Returns <code>null</code> or the current autoexpose helper. >+ * @return null or a helper >+ */ >+protected AutoexposeHelper getAutoexposeHelper() { >+ return exposeHelper; >+} >+/** >+ * Sets the active autoexpose helper to the given helper, or <code>null</code>. If the >+ * helper is not <code>null</code>, a runnable is queued on the event thread that will >+ * trigger a subsequent {@link #doAutoexpose()}. The helper is typically updated only on >+ * a hover event. >+ * @param helper the new autoexpose helper or <code>null</code> >+ */ >+protected void setAutoexposeHelper(AutoexposeHelper helper) { >+ exposeHelper = helper; >+ if (exposeHelper == null) >+ return; >+ Display.getCurrent().asyncExec(new QueuedAutoexpose()); >+ >+ if (sourceRelativeStartPoint == null && isInDragInProgress()) { >+ IFigure figure = getTargetEditPart().getFigure(); >+ sourceRelativeStartPoint = new PrecisionPoint(getStartLocation()); >+ figure.translateToRelative(sourceRelativeStartPoint); >+ } >+} >+/** >+ * Updates the active {@link AutoexposeHelper}. Does nothing if there is still an active >+ * helper. Otherwise, obtains a new helper (possible <code>null</code>) at the current >+ * mouse location and calls {@link #setAutoexposeHelper(AutoexposeHelper)}. >+ */ >+protected void updateAutoexposeHelper() { >+ if (exposeHelper != null) >+ return; >+ AutoexposeHelper.Search search; >+ search = new AutoexposeHelper.Search(getLocation()); >+ getCurrentViewer() >+ .findObjectAtExcluding(getLocation(), Collections.EMPTY_LIST, search); >+ setAutoexposeHelper(search.result); >+} >+ >+/** >+ * If auto scroll (also called auto expose) is being performed, the start location moves >+ * during the scroll. This method updates that location. >+ */ >+protected void repairStartLocation() { >+ if (sourceRelativeStartPoint == null) >+ return; >+ IFigure figure = getTargetEditPart().getFigure(); >+ PrecisionPoint newStart = (PrecisionPoint)sourceRelativeStartPoint.getCopy(); >+ figure.translateToAbsolute(newStart); >+ Point delta = new Point(newStart.x - getStartLocation().x, >+ newStart.y - getStartLocation().y); >+ setStartLocation(newStart); >+ // sourceRect needs to be updated as well when auto-scrolling >+ if (sourceRect != null) >+ sourceRect.translate(delta); >+; >+} > /** > * Constructs a resize tracker that resizes in the specified direction. The direction is > * specified using {@link PositionConstants#NORTH}, {@link PositionConstants#NORTH_EAST}, >@@ -133,6 +225,8 @@ > // For the case where ESC key was hit while resizing > eraseTargetFeedback(); > >+ sourceRelativeStartPoint = null; >+ setAutoexposeHelper(null); > sourceRect = null; > snapToHelper = null; > super.deactivate(); >@@ -234,8 +328,14 @@ > showTargetFeedback(); > setCurrentCommand(getCommand()); > } >+ > return true; > } >+protected boolean handleHover() { >+ if (isInDragInProgress()) >+ updateAutoexposeHelper(); >+ return true; >+} > > /** > * This method is invoked as the drag is happening. It notifies the >@@ -251,6 +351,8 @@ > * @see org.eclipse.gef.tools.SimpleDragTracker#updateSourceRequest() > */ > protected void updateSourceRequest() { >+ repairStartLocation(); >+ > ChangeBoundsRequest request = (ChangeBoundsRequest) getSourceRequest(); > Dimension d = getDragMoveDelta(); >
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 229726
: 98271 |
98272