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 9834 Details for
Bug 19524
[Workbench] Resizing WorkbenchWindow resizes Views
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Updated patch
19524_patch_040422.txt (text/plain), 25.90 KB, created by
Stefan Xenos
on 2004-04-22 06:07:17 EDT
(
hide
)
Description:
Updated patch
Filename:
MIME Type:
Creator:
Stefan Xenos
Created:
2004-04-22 06:07:17 EDT
Size:
25.90 KB
patch
obsolete
>Index: EditorArea.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorArea.java,v >retrieving revision 1.17 >diff -u -r1.17 EditorArea.java >--- EditorArea.java 21 Mar 2004 17:57:21 -0000 1.17 >+++ EditorArea.java 22 Apr 2004 09:49:25 -0000 >@@ -227,10 +227,19 @@ > String partID = childMem.getString(IWorkbenchConstants.TAG_PART); > String relativeID = childMem.getString(IWorkbenchConstants.TAG_RELATIVE); > int relationship = 0; >- float ratio = 0.0f; >+ int left = 0, right = 0; >+ float ratio = 0.5f; > if (relativeID != null) { > relationship = childMem.getInteger(IWorkbenchConstants.TAG_RELATIONSHIP).intValue(); >- ratio = childMem.getFloat(IWorkbenchConstants.TAG_RATIO).floatValue(); >+ Float Ratio = childMem.getFloat(IWorkbenchConstants.TAG_RATIO); >+ Integer Left = childMem.getInteger(IWorkbenchConstants.TAG_RATIO_LEFT); >+ Integer Right = childMem.getInteger(IWorkbenchConstants.TAG_RATIO_RIGHT); >+ if (Left != null) { >+ left = Left.intValue(); >+ right = Right.intValue(); >+ } else if (Ratio != null) { >+ ratio = Ratio.floatValue(); >+ } > } > > // Create the part. >@@ -245,7 +254,11 @@ > } else { > LayoutPart refPart = (LayoutPart)mapIDtoPart.get(relativeID); > if (refPart != null) { >- add(workbook, relationship, ratio, refPart); >+ //$TODO pass in left and right >+ if (left == 0 || right == 0) >+ add(workbook, relationship, ratio, refPart); >+ else >+ add(workbook, relationship, left, right, refPart); > } else { > WorkbenchPlugin.log("Unable to find part for ID: " + relativeID);//$NON-NLS-1$ > } >@@ -271,7 +284,9 @@ > if (info.relative != null) { > childMem.putString(IWorkbenchConstants.TAG_RELATIVE, info.relative.getID()); > childMem.putInteger(IWorkbenchConstants.TAG_RELATIONSHIP, info.relationship); >- childMem.putFloat(IWorkbenchConstants.TAG_RATIO, info.ratio); >+ childMem.putInteger(IWorkbenchConstants.TAG_RATIO_LEFT, info.left); >+ childMem.putInteger(IWorkbenchConstants.TAG_RATIO_RIGHT, info.right); >+ //childMem.putFloat(IWorkbenchConstants.TAG_RATIO, info.ratio); > } > } > return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null); //$NON-NLS-1$ >@@ -344,7 +359,13 @@ > /* package */ DropTarget getDropTarget() { > return dropTarget; > } >- >+ /** >+ * @see org.eclipse.ui.internal.LayoutPart#getImportance() >+ */ >+ public boolean isCompressible() { >+ //Added for bug 19524 >+ return true; >+ } > /* (non-Javadoc) > * @see org.eclipse.ui.internal.ILayoutContainer#allowsAutoFocus() > */ >Index: IWorkbenchConstants.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java,v >retrieving revision 1.39 >diff -u -r1.39 IWorkbenchConstants.java >--- IWorkbenchConstants.java 17 Apr 2004 08:04:03 -0000 1.39 >+++ IWorkbenchConstants.java 22 Apr 2004 09:49:26 -0000 >@@ -106,6 +106,9 @@ > public static final String TAG_RELATIVE = "relative"; //$NON-NLS-1$ > public static final String TAG_RELATIONSHIP = "relationship"; //$NON-NLS-1$ > public static final String TAG_RATIO = "ratio"; //$NON-NLS-1$ >+ public static final String TAG_RATIO_LEFT = "ratioLeft"; //$NON-NLS-1$ >+ public static final String TAG_RATIO_RIGHT = "ratioRight"; //$NON-NLS-1$ >+ > public static final String TAG_ACTIVE_PAGE_ID = "activePageID"; //$NON-NLS-1$ > public static final String TAG_EXPANDED = "expanded"; //$NON-NLS-1$ > public static final String TAG_PAGE = "page"; //$NON-NLS-1$ >Index: LayoutPart.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutPart.java,v >retrieving revision 1.21 >diff -u -r1.21 LayoutPart.java >--- LayoutPart.java 15 Apr 2004 19:04:56 -0000 1.21 >+++ LayoutPart.java 22 Apr 2004 09:49:27 -0000 >@@ -115,6 +115,9 @@ > public String getID() { > return id; > } >+ public boolean isCompressible() { >+ return false; >+ } > /** > * Return the preference store for layout parts. > */ >Index: LayoutPartSash.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutPartSash.java,v >retrieving revision 1.7 >diff -u -r1.7 LayoutPartSash.java >--- LayoutPartSash.java 30 Mar 2004 02:52:05 -0000 1.7 >+++ LayoutPartSash.java 22 Apr 2004 09:49:27 -0000 >@@ -9,6 +9,8 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Randy Hudson <hudsonr@us.ibm.com> >+ * - Fix for bug 19524 - Resizing WorkbenchWindow resizes Views > * Cagatay Kavukcuoglu <cagatayk@acm.org> > * - Fix for bug 10025 - Resizing views should not use height ratios > **********************************************************************/ >@@ -28,7 +30,7 @@ > private LayoutPartSash postLimit; > > SelectionListener selectionListener; >- private float ratio = 0.5f; >+ private int left = 300, right = 300; > > /* Optimize limit checks by calculating minimum > * and maximum ratios once per drag >@@ -138,9 +140,15 @@ > LayoutPartSash getPreLimit() { > return preLimit; > } >-float getRatio() { >- return ratio; >+ >+int getLeft() { >+ return left; >+} >+ >+int getRight() { >+ return right; > } >+ > boolean isHorizontal() { > return ((style & SWT.HORIZONTAL) == SWT.HORIZONTAL); > } >@@ -153,9 +161,16 @@ > void setPreLimit(LayoutPartSash newPreLimit) { > preLimit = newPreLimit; > } >+ > void setRatio(float newRatio) { >- if (newRatio < 0.0 || newRatio > 1.0) return; >- ratio = newRatio; >+ int total = left + right; >+ left = (int) (total * newRatio); >+ right = total - left; >+} >+ >+void setSizes(int left, int right) { >+ this.left = left; >+ this.right = right; > } > > private void widgetSelected(int x, int y, int width, int height) { >@@ -163,12 +178,16 @@ > LayoutTreeNode node = root.findSash(this); > Rectangle nodeBounds = node.getBounds(); > //Recompute ratio >+ x -= nodeBounds.x; >+ y -= nodeBounds.y; > if(style == SWT.VERTICAL) { >- setRatio((float)(x - nodeBounds.x)/(float)nodeBounds.width); >+ setSizes(x, nodeBounds.width - x); >+ //setRatio((float)(x - nodeBounds.x)/(float)nodeBounds.width); > } else { >- setRatio((float)(y - nodeBounds.y)/(float)nodeBounds.height); >+ setSizes(y, nodeBounds.height - y); >+ //setRatio((float)(y - nodeBounds.y)/(float)nodeBounds.height); > } >- >+ > node.setBounds(nodeBounds); > initDragRatios(); > } >Index: LayoutTree.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutTree.java,v >retrieving revision 1.7 >diff -u -r1.7 LayoutTree.java >--- LayoutTree.java 8 Apr 2004 00:04:05 -0000 1.7 >+++ LayoutTree.java 22 Apr 2004 09:49:27 -0000 >@@ -9,6 +9,8 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Randy Hudson <hudsonr@us.ibm.com> >+ * - Fix for bug 19524 - Resizing WorkbenchWindow resizes Views > * Cagatay Kavukcuoglu <cagatayk@acm.org> > * - Fix for bug 10025 - Resizing views should not use height ratios > **********************************************************************/ >@@ -141,6 +143,14 @@ > oldParent.replaceChild(relativeChild,node); > return this; > } >+} >+/** >+ * Returns true if this tree can be compressed and expanded. >+ * @return true if springy >+ */ >+public boolean isCompressible() { >+ //Added for bug 19524 >+ return part.isCompressible(); > } > /** > * Returns true if this tree has visible parts otherwise returns false. >Index: LayoutTreeNode.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutTreeNode.java,v >retrieving revision 1.9 >diff -u -r1.9 LayoutTreeNode.java >--- LayoutTreeNode.java 8 Apr 2004 00:04:05 -0000 1.9 >+++ LayoutTreeNode.java 22 Apr 2004 09:49:28 -0000 >@@ -9,13 +9,14 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Randy Hudson <hudsonr@us.ibm.com> >+ * - Fix for bug 19524 - Resizing WorkbenchWindow resizes Views > * Cagatay Kavukcuoglu <cagatayk@acm.org> > * - Fix for bug 10025 - Resizing views should not use height ratios > **********************************************************************/ > > import java.util.ArrayList; > >-import org.eclipse.jface.util.Geometry; > import org.eclipse.swt.graphics.Point; > import org.eclipse.swt.graphics.Rectangle; > import org.eclipse.swt.widgets.Composite; >@@ -61,7 +62,7 @@ > > Rectangle bounds = sash.getBounds(); > >- int relativePos = Geometry.getRelativePosition(bounds, toFind); >+ //int relativePos = Geometry.getRelativePosition(bounds, toFind); > > if(sash.isVertical()) { > if (toFind.x < bounds.x + (bounds.width / 2)) { >@@ -90,7 +91,8 @@ > PartSashContainer.RelationshipInfo r = new PartSashContainer.RelationshipInfo(); > r.relative = children[0].computeRelation(relations); > r.part = children[1].computeRelation(relations); >- r.ratio = getSash().getRatio(); >+ r.left = getSash().getLeft(); >+ r.right = getSash().getRight(); > r.relationship = getSash().isVertical()?IPageLayout.RIGHT:IPageLayout.BOTTOM; > relations.add(0,r); > return r.relative; >@@ -227,29 +229,7 @@ > public boolean isVisible() { > return children[0].isVisible() || children[1].isVisible(); > } >-/** >- * Recompute the ratios in this tree. The ratio for a node is the width >- * (or height if the sash is horizontal) of the left child's bounds >- * divided by the width or height of node's bounds. Sash width <em>is</em> >- * considered in ratio computation. >- */ >-public void recomputeRatio() { >- children[0].recomputeRatio(); >- children[1].recomputeRatio(); >- >- if(children[0].isVisible() && children[1].isVisible()) { >- if(getSash().isVertical()) { >- float left = children[0].getBounds().width; >- float right = children[1].getBounds().width; >- getSash().setRatio(left/(right+left+SASH_WIDTH)); >- } else { >- float left = children[0].getBounds().height; >- float right = children[1].getBounds().height; >- getSash().setRatio(left/(right+left+SASH_WIDTH)); >- } >- } >- >-} >+ > /** > * Remove the child and this node from the tree > */ >@@ -307,6 +287,8 @@ > * Resize the parts on this tree to fit in <code>bounds</code>. > */ > public void setBounds(Rectangle bounds) { >+// if (bounds.isEmpty()) >+// return; > if(!children[0].isVisible()) { > children[1].setBounds(bounds); > return; >@@ -320,12 +302,36 @@ > Rectangle rightBounds = new Rectangle(bounds.x,bounds.y,bounds.width,bounds.height); > Rectangle sashBounds = new Rectangle(bounds.x,bounds.y,bounds.width,bounds.height); > >- float ratio = getSash().getRatio(); >+ int left = getSash().getLeft(); >+ int right = getSash().getRight(); >+ int total = left+right; >+ >+ //At first I was going to have a more elaborate weighting system, but all-or-non is >+ // sufficient >+ double wLeft = left, wRight = right; >+ switch (getCompressionBias()) { >+ case -1: >+ wLeft = 0.0; >+ break; >+ case 1: >+ wRight = 0.0; >+ break; >+ default: >+ break; >+ } >+ double wTotal = wLeft + wRight; > > if(getSash().isVertical()) { > > //Work on x and width >- leftBounds.width = (int)(ratio * bounds.width); >+ leftBounds.width = left; >+ rightBounds.width = right; >+ >+ int redistribute = bounds.width - SASH_WIDTH - total; >+ >+ leftBounds.x = bounds.x; >+ leftBounds.width += Math.round(redistribute * wLeft / wTotal); >+ > sashBounds.x = leftBounds.x + leftBounds.width; > sashBounds.width = SASH_WIDTH; > >@@ -334,7 +340,7 @@ > } > > rightBounds.x = sashBounds.x + sashBounds.width; >- rightBounds.width = bounds.width - leftBounds.width - sashBounds.width; >+ rightBounds.width = bounds.x + bounds.width - rightBounds.x; > > if (children[1].fixedHeight()) { > rightBounds.height = children[1].getBounds().height; >@@ -343,15 +349,14 @@ > adjustWidths(bounds, leftBounds, rightBounds, sashBounds); > } else { > //Work on y and height >+ int redistribute = bounds.height - SASH_WIDTH - total; >+ > if (children[0].fixedHeight()) { > leftBounds.height = children[0].getBounds().height; >+ } else if (children[1].fixedHeight()) { >+ leftBounds.height = bounds.height - children[1].getBounds().height - SASH_WIDTH; > } else { >- >- if (children[1].fixedHeight()) { >- leftBounds.height = bounds.height - children[1].getBounds().height - SASH_WIDTH; >- } else { >- leftBounds.height = (int)(ratio * bounds.height); >- } >+ leftBounds.height = left + (int)Math.round(redistribute * wLeft / wTotal); > } > sashBounds.y = leftBounds.y + leftBounds.height; > sashBounds.height = SASH_WIDTH; >@@ -360,7 +365,7 @@ > if (children[1].fixedHeight()) { > rightBounds.height = children[1].getBounds().height; > } else { >- rightBounds.height = bounds.height - leftBounds.height - sashBounds.height; >+ rightBounds.height = bounds.y + bounds.height - rightBounds.y; > } > adjustHeights(bounds, leftBounds, rightBounds, sashBounds); > } >@@ -471,7 +476,28 @@ > return (part != 0 ) ? part / whole : IPageLayout.RATIO_MIN; > } > >-// getMaximumRatioFor added by cagatayk@acm.org >+ >+//Added by hudsonr@us.ibm.com - bug 19524 >+ >+public boolean isCompressible() { >+ return children[0].isCompressible() || children[1].isCompressible(); >+} >+ >+/** >+ * Returns 0 if there is no bias. Returns -1 if the first child should be of >+ * fixed size, and the second child should be compressed. Returns 1 if the >+ * second child should be of fixed size. >+ * @return the bias >+ */ >+public int getCompressionBias() { >+ boolean left = children[0].isCompressible(); >+ boolean right = children[1].isCompressible(); >+ if (left == right) >+ return 0; >+ if (right) >+ return -1; >+ return 1; >+}// getMaximumRatioFor added by cagatayk@acm.org > /** > * Obtain the maximum ratio required to display the control on the "right" > * using its minimum dimensions. >@@ -538,6 +564,14 @@ > return minimum; > } > >+boolean isLeftChild(LayoutTree toTest) { >+ return children[0] == toTest; >+} >+ >+LayoutTree getChild(boolean left) { >+ int index = left?0:1; >+ return (children[index]); >+} > > /** > * Sets a child in this node >Index: PartSashContainer.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSashContainer.java,v >retrieving revision 1.18 >diff -u -r1.18 PartSashContainer.java >--- PartSashContainer.java 15 Apr 2004 19:04:56 -0000 1.18 >+++ PartSashContainer.java 22 Apr 2004 09:49:35 -0000 >@@ -55,7 +55,18 @@ > protected LayoutPart part; > protected LayoutPart relative; > protected int relationship; >- protected float ratio; >+ >+ /** >+ * Preferred size for the left child (this would be the size, in pixels of the child >+ * at the time the sash was last moved) >+ */ >+ protected int left; >+ >+ /** >+ * Preferred size for the right child (this would be the size, in pixels of the child >+ * at the time the sash was last moved) >+ */ >+ protected int right; > } > > private class SashContainerDropTarget extends AbstractDropTarget { >@@ -122,19 +133,11 @@ > /** > * Add a part. > */ >-public void add(LayoutPart child) { >- if (isZoomed()) >- zoomOut(); >- >+public void add(LayoutPart child) { > if (child == null) > return; > >- RelationshipInfo info = new RelationshipInfo(); >- info.part = child; >- if(root != null) { >- findPosition(info); >- } >- addChild(info); >+ addEnhanced(child, SWT.RIGHT, 0.5f, findBottomRight()); > } > > /** >@@ -173,27 +176,83 @@ > * @param relationship one of PageLayout.TOP, PageLayout.BOTTOM, PageLayout.LEFT, or PageLayout.RIGHT > * @param ratio a value between 0.0 and 1.0, indicating how much space will be allocated to the UPPER-LEFT pane > * @param relative part where the new part will be attached >- * > */ > public void add(LayoutPart child, int relationship, float ratio, LayoutPart relative) { >- if (isZoomed()) >- zoomOut(); >+ boolean isHorizontal = (relationship == IPageLayout.LEFT || relationship == IPageLayout.RIGHT); > >- if (child == null) >- return; >- if (relative != null && !isChild(relative)) >- return; >- if (relationship < IPageLayout.LEFT || relationship > IPageLayout.BOTTOM) >- relationship = IPageLayout.LEFT; >+ LayoutTree node = null; >+ if (root != null && relative != null) { >+ node = root.find(relative); >+ } >+ >+ Rectangle bounds; >+ if (getParent() == null) { >+ Control control = getPage().getClientComposite(); >+ if (control != null && !control.isDisposed()) { >+ bounds = control.getBounds(); >+ } else { >+ bounds = new Rectangle(0,0,800,600); >+ } >+ bounds.x = 0; >+ bounds.y = 0; >+ } else { >+ bounds = getBounds(); >+ } >+ >+ int totalSize = measureTree(bounds, node, isHorizontal); >+ >+ int left = (int) (totalSize * ratio); >+ int right = totalSize - left; > >- // store info about relative positions >- RelationshipInfo info = new RelationshipInfo(); >- info.part = child; >- info.relationship = relationship; >- info.ratio = ratio; >- info.relative = relative; >- addChild(info); >+ add(child, relationship, left, right, relative); > } >+ >+static int measureTree(Rectangle outerBounds, LayoutTree toMeasure, boolean horizontal) { >+ if (toMeasure == null) { >+ return Geometry.getDimension(outerBounds, horizontal); >+ } >+ >+ LayoutTreeNode parent = toMeasure.getParent(); >+ if (parent == null) { >+ return Geometry.getDimension(outerBounds, horizontal); >+ } >+ >+ if (parent.getSash().isHorizontal() == horizontal) { >+ return measureTree(outerBounds, parent, horizontal); >+ } >+ >+ boolean isLeft = parent.isLeftChild(toMeasure); >+ >+ LayoutTree otherChild = parent.getChild(!isLeft); >+ if (otherChild.isVisible()) { >+ int left = parent.getSash().getLeft(); >+ int right = parent.getSash().getRight(); >+ int childSize = isLeft ? left : right; >+ >+ int bias = parent.getCompressionBias(); >+ >+ // Normalize bias: 1 = we're fixed, -1 = other child is fixed >+ if (isLeft) { >+ bias = -bias; >+ } >+ >+ if (bias == 1) { >+ // If we're fixed, return the fixed size >+ return childSize; >+ } else if (bias == -1) { >+ >+ // If the other child is fixed, return the size of the parent minus the fixed size of the >+ // other child >+ return measureTree(outerBounds, parent, horizontal) - (left + right - childSize); >+ } >+ >+ // Else return the size of the parent, scaled appropriately >+ return measureTree(outerBounds, parent, horizontal) * childSize / (left + right); >+ } >+ >+ return measureTree(outerBounds, parent, horizontal); >+} >+ > protected void addChild(RelationshipInfo info) { > LayoutPart child = info.part; > >@@ -206,7 +265,7 @@ > int vertical = (info.relationship == IPageLayout.LEFT || info.relationship == IPageLayout.RIGHT)?SWT.VERTICAL:SWT.HORIZONTAL; > boolean left = info.relationship == IPageLayout.LEFT || info.relationship == IPageLayout.TOP; > LayoutPartSash sash = new LayoutPartSash(this,vertical); >- sash.setRatio(info.ratio); >+ sash.setSizes(info.left, info.right); > if((parent != null) && !(child instanceof PartPlaceholder)) > sash.createControl(parent); > root = root.insert(child,left,sash,info.relative); >@@ -222,6 +281,7 @@ > } > > } >+ > /** > * Adds the child using ratio and position attributes > * from the specified placeholder without replacing >@@ -235,7 +295,10 @@ > RelationshipInfo newRelationshipInfo = new RelationshipInfo(); > newRelationshipInfo.part = child; > if(root != null) { >- findPosition(newRelationshipInfo); >+ newRelationshipInfo.relationship = IPageLayout.RIGHT; >+ newRelationshipInfo.relative = root.findBottomRight(); >+ newRelationshipInfo.left = 200; >+ newRelationshipInfo.right = 200; > } > > // find the relationship info for the placeholder >@@ -243,7 +306,8 @@ > for (int i = 0; i < relationships.length; i ++) { > RelationshipInfo info = relationships[i]; > if (info.part == placeholder) { >- newRelationshipInfo.ratio = info.ratio; >+ newRelationshipInfo.left = info.left; >+ newRelationshipInfo.right = info.right; > newRelationshipInfo.relationship = info.relationship; > newRelationshipInfo.relative = info.relative; > } >@@ -373,26 +437,7 @@ > return null; > return root.findBottomRight(); > } >-/** >- * Find a initial position for a new part. >- */ >-private void findPosition(RelationshipInfo info) { >- >- info.ratio = (float)0.5; >- info.relationship = IPageLayout.RIGHT; >- info.relative = root.findBottomRight(); > >- // If no parent go with default. >- if (parent == null) >- return; >- >- // If the relative part is too small, place the part on the left of everything. >- if (((float)this.getBounds().width / (float)info.relative.getBounds().width > 2) || >- ((float)this.getBounds().height / (float)info.relative.getBounds().height > 4)) { >- info.relative = null; >- info.ratio = 0.75f; >- } >-} > /** > * @see LayoutPart#getBounds > */ >@@ -468,37 +513,7 @@ > public boolean isZoomed() { > return (unzoomRoot != null); > } >-/** >- * Move a part to a new position and keep the bounds when possible, ie, >- * when the new relative part has the same higth or width as the part >- * being move. >- */ >-public void move(LayoutPart child, int relationship, LayoutPart relative) { >- LayoutTree childTree = root.find(child); >- LayoutTree relativeTree = root.find(relative); >- >- LayoutTreeNode commonParent = relativeTree.getParent().findCommonParent(child,relative); >- boolean isVertical = commonParent.getSash().isVertical(); >- boolean recomputeRatio = false; >- recomputeRatio = >- isRelationshipCompatible(relationship,isVertical) && >- commonParent.sameDirection(isVertical,relativeTree.getParent()) && >- commonParent.sameDirection(isVertical,childTree.getParent()); > >- root = root.remove(child); >- int vertical = (relationship == IPageLayout.LEFT || relationship == IPageLayout.RIGHT)?SWT.VERTICAL:SWT.HORIZONTAL; >- boolean left = relationship == IPageLayout.LEFT || relationship == IPageLayout.TOP; >- LayoutPartSash sash = new LayoutPartSash(this,vertical); >- sash.setRatio(0.5f); >- if((parent != null) && !(child instanceof PartPlaceholder)) >- sash.createControl(parent); >- root = root.insert(child,left,sash,relative); >- root.updateSashes(parent); >- if(recomputeRatio) >- root.recomputeRatio(); >- >- resizeSashes(parent.getClientArea()); >-} > /** > * Remove a part. > */ >@@ -690,8 +705,7 @@ > int cursor = Geometry.getOppositeSide(side); > > if (pointlessDrop) { >- side = SWT.NONE; >- //cursor = SWT.CENTER; >+ side = SWT.NONE; > } > > return new SashContainerDropTarget(sourcePart, side, cursor, null); >@@ -847,6 +861,27 @@ > root.describeLayout(buf); > buf.append(")"); > } >+} >+ >+void add(LayoutPart child, int relationship, int left, int right, LayoutPart relative) { >+ if (isZoomed()) >+ zoomOut(); >+ >+ if (child == null) >+ return; >+ if (relative != null && !isChild(relative)) >+ return; >+ if (relationship < IPageLayout.LEFT || relationship > IPageLayout.BOTTOM) >+ relationship = IPageLayout.LEFT; >+ >+ // store info about relative positions >+ RelationshipInfo info = new RelationshipInfo(); >+ info.part = child; >+ info.relationship = relationship; >+ info.left = left; >+ info.right = right; >+ info.relative = relative; >+ addChild(info); > } > > } >Index: RootLayoutContainer.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RootLayoutContainer.java,v >retrieving revision 1.12 >diff -u -r1.12 RootLayoutContainer.java >--- RootLayoutContainer.java 31 Mar 2004 23:46:18 -0000 1.12 >+++ RootLayoutContainer.java 22 Apr 2004 09:49:39 -0000 >@@ -96,9 +96,16 @@ > String relativeID = childMem.getString(IWorkbenchConstants.TAG_RELATIVE); > int relationship = 0; > float ratio = 0.0f; >+ int left = 0, right = 0; > if (relativeID != null) { > relationship = childMem.getInteger(IWorkbenchConstants.TAG_RELATIONSHIP).intValue(); >- ratio = childMem.getFloat(IWorkbenchConstants.TAG_RATIO).floatValue(); >+ Float Ratio = childMem.getFloat(IWorkbenchConstants.TAG_RATIO); >+ if (Ratio == null) { >+ left = childMem.getInteger(IWorkbenchConstants.TAG_RATIO_LEFT).intValue(); >+ right = childMem.getInteger(IWorkbenchConstants.TAG_RATIO_RIGHT).intValue(); >+ } else { >+ ratio = Ratio.floatValue(); >+ } > } > String strFolder = childMem.getString(IWorkbenchConstants.TAG_FOLDER); > >@@ -123,7 +130,10 @@ > } else { > LayoutPart refPart = (LayoutPart)mapIDtoPart.get(relativeID); > if (refPart != null) { >- add(part, relationship, ratio, refPart); >+ if (left != 0) >+ add(part, relationship, left, right, refPart); >+ else >+ add(part, relationship, ratio, refPart); > } else { > WorkbenchPlugin.log("Unable to find part for ID: " + relativeID);//$NON-NLS-1$ > } >@@ -155,7 +165,9 @@ > if (info.relative != null) { > childMem.putString(IWorkbenchConstants.TAG_RELATIVE, info.relative.getID()); > childMem.putInteger(IWorkbenchConstants.TAG_RELATIONSHIP, info.relationship); >- childMem.putFloat(IWorkbenchConstants.TAG_RATIO, info.ratio); >+ childMem.putInteger(IWorkbenchConstants.TAG_RATIO_LEFT, info.left); >+ childMem.putInteger(IWorkbenchConstants.TAG_RATIO_RIGHT, info.right); >+ //childMem.putFloat(IWorkbenchConstants.TAG_RATIO, info.ratio); > } > > // Is this part a folder or a placeholder for one? >@@ -183,14 +195,6 @@ > public boolean allowsAutoFocus() { > return true; > } >- >-/* (non-Javadoc) >- * @see org.eclipse.ui.internal.PartSashContainer#dropObject(org.eclipse.ui.internal.LayoutPart, org.eclipse.ui.internal.LayoutPart, int) >- */ >-protected void dropObject(LayoutPart sourcePart, LayoutPart targetPart, int side) { >- super.dropObject(sourcePart, targetPart, side); >-} >- > > /* (non-Javadoc) > * @see org.eclipse.ui.internal.PartSashContainer#getDockingRatio(org.eclipse.ui.internal.LayoutPart, org.eclipse.ui.internal.LayoutPart)
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 19524
:
2612
|
9345
|
9508
|
9509
|
9521
| 9834