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 11518 Details for
Bug 61628
[Workbench] Animating close rectangle is barely visible on the MAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Reimplements RectangleAnimation using a Shell
61628_workbench_patch.txt (text/plain), 10.46 KB, created by
Stefan Xenos
on 2004-06-02 20:24:35 EDT
(
hide
)
Description:
Reimplements RectangleAnimation using a Shell
Filename:
MIME Type:
Creator:
Stefan Xenos
Created:
2004-06-02 20:24:35 EDT
Size:
10.46 KB
patch
obsolete
>Index: Eclipse UI/org/eclipse/ui/internal/FastViewBar.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FastViewBar.java,v >retrieving revision 1.22 >diff -u -r1.22 FastViewBar.java >--- Eclipse UI/org/eclipse/ui/internal/FastViewBar.java 20 May 2004 14:03:25 -0000 1.22 >+++ Eclipse UI/org/eclipse/ui/internal/FastViewBar.java 3 Jun 2004 00:18:53 -0000 >@@ -15,6 +15,7 @@ > import java.util.Iterator; > import java.util.List; > import java.util.Map; >+ > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Platform; > import org.eclipse.core.runtime.Status; >@@ -542,7 +543,20 @@ > if (selectedView != null) { > WorkbenchPage page = window.getActiveWorkbenchPage(); > if (page != null) { >+ int idx = getIndex(selectedView); >+ ToolItem item = getItem(idx); >+ Rectangle bounds = item.getBounds(); >+ Rectangle startBounds = Geometry.toDisplay(item.getParent(), bounds); >+ > page.removeFastView(selectedView); >+ >+ LayoutPart pane = ((WorkbenchPartReference)selectedView).getPane(); >+ >+ RectangleAnimation animation = new RectangleAnimation(window.getShell(), >+ startBounds, >+ DragUtil.getDisplayBounds(pane.getControl())); >+ >+ animation.schedule(); > } > } > } >Index: Eclipse UI/org/eclipse/ui/internal/RectangleAnimation.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RectangleAnimation.java,v >retrieving revision 1.6 >diff -u -r1.6 RectangleAnimation.java >--- Eclipse UI/org/eclipse/ui/internal/RectangleAnimation.java 8 May 2004 09:38:51 -0000 1.6 >+++ Eclipse UI/org/eclipse/ui/internal/RectangleAnimation.java 3 Jun 2004 00:18:53 -0000 >@@ -14,15 +14,14 @@ > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Status; > import org.eclipse.core.runtime.jobs.Job; >-import org.eclipse.jface.util.Geometry; > import org.eclipse.swt.SWT; >-import org.eclipse.swt.events.PaintEvent; >-import org.eclipse.swt.events.PaintListener; > import org.eclipse.swt.graphics.Color; >-import org.eclipse.swt.graphics.GC; > import org.eclipse.swt.graphics.Rectangle; >+import org.eclipse.swt.graphics.Region; > import org.eclipse.swt.widgets.Canvas; >-import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Control; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Shell; > > /** > * This job creates an animated rectangle that moves from a source rectangle to >@@ -32,6 +31,7 @@ > * @since 3.0 > */ > public class RectangleAnimation extends Job { >+ private static final int LINE_WIDTH = 2; > private Rectangle start; > private int elapsed; > private int duration; >@@ -39,6 +39,10 @@ > private Rectangle end; > private Rectangle last; > private boolean done = false; >+ private Shell theShell; >+ private Display display; >+ private Region shellRegion; >+ private boolean first = true; > > /** > * Canvas used to draw the animation, or null if the animation should be skipped. >@@ -60,52 +64,62 @@ > private Runnable paintJob = new Runnable() { //$NON-NLS-1$ > > public void run() { >- if (canvas == null || canvas.isDisposed()) { >+ >+ // Measure the start as the time of the first syncExec >+ if (startTime == 0) { >+ startTime = System.currentTimeMillis(); >+ } >+ >+ if (theShell == null || theShell.isDisposed()) { > done = true; > return; > } > >- canvas.redraw(); >+ long currentTime = System.currentTimeMillis(); >+ >+ double amount = (double)(currentTime - startTime) / (double)duration; >+ >+ if (amount > 1.0) { >+ amount = 1.0; >+ done = true; >+ } >+ >+ Rectangle toPaint = interpolate(start, end, amount); >+ >+ theShell.setBounds(toPaint); >+ if (shellRegion != null) { >+ shellRegion.dispose(); >+ shellRegion = new Region(display); >+ } >+ >+ Rectangle rect = theShell.getClientArea(); >+ shellRegion.add(rect); >+ rect.x += LINE_WIDTH; >+ rect.y += LINE_WIDTH; >+ rect.width -= 2 * LINE_WIDTH; >+ rect.height -= 2 * LINE_WIDTH; >+ >+ shellRegion.subtract(rect); >+ >+ theShell.setRegion(shellRegion); >+ >+ if (first) { >+ // Make sure that opening the shell doesn't steal focus >+ Control focusControl = display.getFocusControl(); >+ theShell.open(); >+ if (focusControl != null) { >+ focusControl.setFocus(); >+ } >+ } >+ >+ first = false; > } > > }; > >- private void draw(GC gc) { >- if (startTime == 0) { >- return; >- } >- >- if (canvas == null || canvas.isDisposed()) { >- done = true; >- return; >- } >- >- long currentTime = System.currentTimeMillis(); >- >- double amount = (double)(currentTime - startTime) / (double)duration; >- >- if (amount > 1.0) { >- amount = 1.0; >- done = true; >- } >- >- Rectangle toPaint = interpolate(start, end, amount); >- >- gc.setLineWidth(2); >- Color color = canvas.getDisplay().getSystemColor(SWT.COLOR_WHITE); >- gc.setForeground(color); >- >- gc.setXORMode(true); >- if (last != null) { >- if (last.equals(toPaint)) { >- return; >- } >- gc.drawRectangle(Geometry.toControl(canvas, last)); >- } >- gc.drawRectangle(Geometry.toControl(canvas, toPaint)); >- last = toPaint; >+ public RectangleAnimation(Shell parentShell, Rectangle start, Rectangle end) { >+ this(parentShell, start, end, 400); > } >- > > /** > * Creates an animation that will morph the start rectangle to the end rectangle in the >@@ -122,31 +136,30 @@ > * @param end final rectangle (display coordinates) > * @param duration number of milliseconds over which the animation will run > */ >- public RectangleAnimation(Composite whereToDraw, Rectangle start, Rectangle end, int duration) { >+ public RectangleAnimation(Shell parentShell, Rectangle start, Rectangle end, int duration) { > super(WorkbenchMessages.getString("RectangleAnimation.Animating_Rectangle")); //$NON-NLS-1$ > this.duration = duration; > this.start = start; > this.end = end; > >+ display = parentShell.getDisplay(); >+ > setSystem(true); > > // Determine if we're on a platform where animations look ugly. > // If so, we indicate this by setting canvas=null, in which case this job does nothing. >- String platform = SWT.getPlatform(); >- if (!"win32".equals(platform)) { //$NON-NLS-1$ >- return; >- } >- >- this.canvas = new Canvas(whereToDraw, SWT.NO_BACKGROUND); >- canvas.setBounds(whereToDraw.getClientArea()); >+// String platform = SWT.getPlatform(); >+// if (!"win32".equals(platform)) { //$NON-NLS-1$ >+// return; >+// } >+ >+ theShell = new Shell(parentShell, SWT.NO_TRIM | SWT.NO_FOCUS); >+ Color color = display.getSystemColor(SWT.COLOR_BLACK); >+ theShell.setBackground(color); > >- canvas.addPaintListener(new PaintListener() { >- public void paintControl(PaintEvent event) { >- draw(event.gc); >- } >- }); >+ theShell.setBounds(start); > >- canvas.moveAbove(null); >+ shellRegion = new Region(display); > } > > /* (non-Javadoc) >@@ -155,24 +168,30 @@ > protected IStatus run(IProgressMonitor monitor) { > > // We use canvas = null to indicate that the animation should be skipped on this platform. >- if (canvas == null) { >+ if (theShell == null) { > return Status.OK_STATUS; > } > >- startTime = System.currentTimeMillis(); >+ startTime = 0;//System.currentTimeMillis(); > > while (!done) { >- if (!canvas.isDisposed()) { >- canvas.getDisplay().syncExec(paintJob); >+ if (!theShell.isDisposed()) { >+ display.syncExec(paintJob); >+ // Don't pin the CPU >+ Thread.yield(); > } > } > >- if (!canvas.isDisposed()) { >- canvas.getDisplay().syncExec(new Runnable() { >+ if (!theShell.isDisposed()) { >+ theShell.getDisplay().syncExec(new Runnable() { > public void run() { >- canvas.dispose(); >+ theShell.dispose(); > } > }); >+ } >+ >+ if (!shellRegion.isDisposed()) { >+ shellRegion.dispose(); > } > > return Status.OK_STATUS; >Index: Eclipse UI/org/eclipse/ui/internal/ViewPane.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewPane.java,v >retrieving revision 1.75 >diff -u -r1.75 ViewPane.java >--- Eclipse UI/org/eclipse/ui/internal/ViewPane.java 27 May 2004 15:59:26 -0000 1.75 >+++ Eclipse UI/org/eclipse/ui/internal/ViewPane.java 3 Jun 2004 00:18:53 -0000 >@@ -289,16 +289,17 @@ > * Make this view pane a fast view > */ > public void doMakeFast() { >- FastViewBar fastViewBar = ((WorkbenchWindow)getPage().getWorkbenchWindow()).getFastViewBar(); >+ WorkbenchWindow window = (WorkbenchWindow)getPage().getWorkbenchWindow(); >+ >+ FastViewBar fastViewBar = window.getFastViewBar(); > if (fastViewBar == null) { > return; > } >- Shell shell = getControl().getShell(); >+ Shell shell = window.getShell(); > > RectangleAnimation animation = new RectangleAnimation(shell, > getParentBounds(), >- fastViewBar.getLocationOfNextIcon(), >- 250); >+ fastViewBar.getLocationOfNextIcon()); > > animation.schedule(); > >@@ -317,8 +318,7 @@ > > RectangleAnimation animation = new RectangleAnimation(shell, > initialBounds, >- finalBounds, >- 250); >+ finalBounds); > > animation.schedule(); > } >Index: Eclipse UI/org/eclipse/ui/internal/progress/ProgressManagerUtil.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ProgressManagerUtil.java,v >retrieving revision 1.18 >diff -u -r1.18 ProgressManagerUtil.java >--- Eclipse UI/org/eclipse/ui/internal/progress/ProgressManagerUtil.java 27 May 2004 17:15:01 -0000 1.18 >+++ Eclipse UI/org/eclipse/ui/internal/progress/ProgressManagerUtil.java 3 Jun 2004 00:18:53 -0000 >@@ -288,7 +288,7 @@ > end.x += windowLocation.x; > end.y += windowLocation.y; > RectangleAnimation animation = new RectangleAnimation(internalWindow >- .getShell(), startPosition, end, 250); >+ .getShell(), startPosition, end); > animation.schedule(); > } > >@@ -311,7 +311,7 @@ > region.x += windowLocation.x; > region.y += windowLocation.y; > RectangleAnimation animation = new RectangleAnimation(internalWindow >- .getShell(), region, endPosition, 250); >+ .getShell(), region, endPosition); > animation.schedule(); > } > }
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 61628
:
11518
|
11519