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 9521 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]
Latest patch, with modifications by SX
19524_patch_SX.txt (text/plain), 32.83 KB, created by
Stefan Xenos
on 2004-04-15 04:21:05 EDT
(
hide
)
Description:
Latest patch, with modifications by SX
Filename:
MIME Type:
Creator:
Stefan Xenos
Created:
2004-04-15 04:21:05 EDT
Size:
32.83 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 15 Apr 2004 08:09:32 -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.38 >diff -u -r1.38 IWorkbenchConstants.java >--- IWorkbenchConstants.java 9 Apr 2004 19:48:41 -0000 1.38 >+++ IWorkbenchConstants.java 15 Apr 2004 08:09:32 -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.20 >diff -u -r1.20 LayoutPart.java >--- LayoutPart.java 8 Apr 2004 00:04:05 -0000 1.20 >+++ LayoutPart.java 15 Apr 2004 08:09:32 -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 15 Apr 2004 08:09:32 -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,8 @@ > private LayoutPartSash postLimit; > > SelectionListener selectionListener; >- private float ratio = 0.5f; >+ //private float ratio; //legacy >+ private int left = 300, right = 300; > > /* Optimize limit checks by calculating minimum > * and maximum ratios once per drag >@@ -138,9 +141,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 +162,10 @@ > void setPreLimit(LayoutPartSash newPreLimit) { > preLimit = newPreLimit; > } >-void setRatio(float newRatio) { >- if (newRatio < 0.0 || newRatio > 1.0) return; >- ratio = newRatio; >+ >+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 +173,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 15 Apr 2004 08:09:32 -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 15 Apr 2004 08:09:32 -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.17 >diff -u -r1.17 PartSashContainer.java >--- PartSashContainer.java 9 Apr 2004 19:48:41 -0000 1.17 >+++ PartSashContainer.java 15 Apr 2004 08:09:32 -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,57 @@ > * @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) { >+ bounds = new Rectangle(0,0, 800, 600); >+ } 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); >+ >+ if (parent.getChild(!isLeft).isVisible()) { >+ int left = parent.getSash().getLeft(); >+ int right = parent.getSash().getRight(); >+ int childSize = isLeft ? left : right; >+ >+ return measureTree(outerBounds, parent, horizontal) * childSize / (left + right); >+ } >+ >+ return measureTree(outerBounds, parent, horizontal); >+} >+ > protected void addChild(RelationshipInfo info) { > LayoutPart child = info.part; > >@@ -206,7 +239,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); >@@ -354,26 +387,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 > */ >@@ -449,37 +463,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. > */ >@@ -671,8 +655,7 @@ > int cursor = Geometry.getOppositeSide(side); > > if (pointlessDrop) { >- side = SWT.NONE; >- //cursor = SWT.CENTER; >+ side = SWT.NONE; > } > > return new SashContainerDropTarget(sourcePart, side, cursor, null); >@@ -828,6 +811,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 15 Apr 2004 08:09:32 -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) >Index: WorkbenchPage.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java,v >retrieving revision 1.128 >diff -u -r1.128 WorkbenchPage.java >--- WorkbenchPage.java 13 Apr 2004 22:19:34 -0000 1.128 >+++ WorkbenchPage.java 15 Apr 2004 08:09:33 -0000 >@@ -20,7 +20,6 @@ > import java.util.Iterator; > import java.util.List; > import java.util.Set; >- > import org.eclipse.core.runtime.IAdaptable; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.IStatus; >@@ -45,7 +44,6 @@ > import org.eclipse.swt.events.ControlAdapter; > import org.eclipse.swt.events.ControlEvent; > import org.eclipse.swt.events.ControlListener; >-import org.eclipse.swt.graphics.Rectangle; > import org.eclipse.swt.widgets.Composite; > import org.eclipse.swt.widgets.Control; > import org.eclipse.swt.widgets.Display; >@@ -3471,117 +3469,117 @@ > > return new IViewPart [] {part}; > } >- /** >- * Allow for programmatically resizing a part. >- * <p> >- * <em>EXPERIMENTAL</em> >- * </p> >- * <p> >- * Known limitations: >- * <ul> >- * <li>currently applies only to views</li> >- * <li>has no effect when view is zoomed</li> >- * </ul> >- */ >- public void resizeView(IViewPart part, int width, int height) { >- SashInfo sashInfo = new SashInfo(); >- PartPane pane = ((PartSite)part.getSite()).getPane(); >- ILayoutContainer container = pane.getContainer(); >- LayoutTree tree = getPerspectivePresentation().getLayout().root.find(((PartTabFolder)container)); >- >- // retrieve our layout sashes from the layout tree >- findSashParts(tree, pane.findSashes(), sashInfo); >- >- // first set the width >- float deltaWidth = width - pane.getBounds().width; >- if (sashInfo.right != null) { >- Rectangle rightBounds = sashInfo.rightNode.getBounds(); >- // set the new ratio >- sashInfo.right.setRatio( >- ((float) ((deltaWidth + sashInfo.right.getBounds().x) - rightBounds.x)) >- / ((float) rightBounds.width)); >- // complete the resize >- sashInfo.rightNode.setBounds(rightBounds); >- } >- else if (sashInfo.left != null) { >- Rectangle leftBounds = sashInfo.leftNode.getBounds(); >- // set the ratio >- sashInfo.left.setRatio( >- (float) ((sashInfo.left.getBounds().x - deltaWidth) - leftBounds.x) >- / ((float) leftBounds.width)); >- // complete the resize >- sashInfo.leftNode.setBounds(sashInfo.leftNode.getBounds()); >- } >- >- // next set the height >- float deltaHeight = height - pane.getBounds().height; >- if (sashInfo.bottom != null) { >- Rectangle bottomBounds = sashInfo.bottomNode.getBounds(); >- // set the new ratio >- sashInfo.bottom.setRatio( >- ((float) ((deltaHeight + sashInfo.bottom.getBounds().y) - bottomBounds.y)) >- / ((float) bottomBounds.height)); >- // complete the resize >- sashInfo.bottomNode.setBounds(bottomBounds); >- } >- else if (sashInfo.top != null) { >- Rectangle topBounds = sashInfo.topNode.getBounds(); >- // set the ratio >- sashInfo.top.setRatio( >- (float) ((sashInfo.top.getBounds().y - deltaHeight) - topBounds.y) >- / ((float) topBounds.height)); >- // complete the resize >- sashInfo.topNode.setBounds(topBounds); >- } >- >- } >- // provides sash information for the given pane >- private class SashInfo { >- private LayoutPartSash right; >- private LayoutPartSash left; >- private LayoutPartSash top; >- private LayoutPartSash bottom; >- private LayoutTreeNode rightNode; >- private LayoutTreeNode leftNode; >- private LayoutTreeNode topNode; >- private LayoutTreeNode bottomNode; >- } >- private void findSashParts(LayoutTree tree, PartPane.Sashes sashes, SashInfo info) { >- LayoutTree parent = tree.getParent(); >- if (parent == null) >- return; >- >- if (parent.part instanceof LayoutPartSash) { >- // get the layout part sash from this tree node >- LayoutPartSash sash = (LayoutPartSash) parent.part; >- // make sure it has a sash control >- Control control = sash.getControl(); >- if (control != null) { >- // check for a vertical sash >- if (sash.isVertical()) { >- if (sashes.left == control) { >- info.left = sash; >- info.leftNode = parent.findSash(sash); >- } >- else if (sashes.right == control) { >- info.right = sash; >- info.rightNode = parent.findSash(sash); >- } >- } >- // check for a horizontal sash >- else { >- if (sashes.top == control) { >- info.top = sash; >- info.topNode = parent.findSash(sash); >- } >- else if (sashes.bottom == control) { >- info.bottom = sash; >- info.bottomNode = parent.findSash(sash); >- } >- } >- } >- } >- // recursive call to continue up the tree >- findSashParts(parent, sashes, info); >- } >+// /** >+// * Allow for programmatically resizing a part. >+// * <p> >+// * <em>EXPERIMENTAL</em> >+// * </p> >+// * <p> >+// * Known limitations: >+// * <ul> >+// * <li>currently applies only to views</li> >+// * <li>has no effect when view is zoomed</li> >+// * </ul> >+// */ >+// public void resizeView(IViewPart part, int width, int height) { >+// SashInfo sashInfo = new SashInfo(); >+// PartPane pane = ((PartSite)part.getSite()).getPane(); >+// ILayoutContainer container = pane.getContainer(); >+// LayoutTree tree = getPerspectivePresentation().getLayout().root.find(((PartTabFolder)container)); >+// >+// // retrieve our layout sashes from the layout tree >+// findSashParts(tree, pane.findSashes(), sashInfo); >+// >+// // first set the width >+// float deltaWidth = width - pane.getBounds().width; >+// if (sashInfo.right != null) { >+// Rectangle rightBounds = sashInfo.rightNode.getBounds(); >+// // set the new ratio >+// sashInfo.right.setRatio( >+// ((float) ((deltaWidth + sashInfo.right.getBounds().x) - rightBounds.x)) >+// / ((float) rightBounds.width)); >+// // complete the resize >+// sashInfo.rightNode.setBounds(rightBounds); >+// } >+// else if (sashInfo.left != null) { >+// Rectangle leftBounds = sashInfo.leftNode.getBounds(); >+// // set the ratio >+// sashInfo.left.setRatio( >+// (float) ((sashInfo.left.getBounds().x - deltaWidth) - leftBounds.x) >+// / ((float) leftBounds.width)); >+// // complete the resize >+// sashInfo.leftNode.setBounds(sashInfo.leftNode.getBounds()); >+// } >+// >+// // next set the height >+// float deltaHeight = height - pane.getBounds().height; >+// if (sashInfo.bottom != null) { >+// Rectangle bottomBounds = sashInfo.bottomNode.getBounds(); >+// // set the new ratio >+// sashInfo.bottom.setRatio( >+// ((float) ((deltaHeight + sashInfo.bottom.getBounds().y) - bottomBounds.y)) >+// / ((float) bottomBounds.height)); >+// // complete the resize >+// sashInfo.bottomNode.setBounds(bottomBounds); >+// } >+// else if (sashInfo.top != null) { >+// Rectangle topBounds = sashInfo.topNode.getBounds(); >+// // set the ratio >+// sashInfo.top.setRatio( >+// (float) ((sashInfo.top.getBounds().y - deltaHeight) - topBounds.y) >+// / ((float) topBounds.height)); >+// // complete the resize >+// sashInfo.topNode.setBounds(topBounds); >+// } >+// >+// } >+// // provides sash information for the given pane >+// private class SashInfo { >+// private LayoutPartSash right; >+// private LayoutPartSash left; >+// private LayoutPartSash top; >+// private LayoutPartSash bottom; >+// private LayoutTreeNode rightNode; >+// private LayoutTreeNode leftNode; >+// private LayoutTreeNode topNode; >+// private LayoutTreeNode bottomNode; >+// } >+// private void findSashParts(LayoutTree tree, PartPane.Sashes sashes, SashInfo info) { >+// LayoutTree parent = tree.getParent(); >+// if (parent == null) >+// return; >+// >+// if (parent.part instanceof LayoutPartSash) { >+// // get the layout part sash from this tree node >+// LayoutPartSash sash = (LayoutPartSash) parent.part; >+// // make sure it has a sash control >+// Control control = sash.getControl(); >+// if (control != null) { >+// // check for a vertical sash >+// if (sash.isVertical()) { >+// if (sashes.left == control) { >+// info.left = sash; >+// info.leftNode = parent.findSash(sash); >+// } >+// else if (sashes.right == control) { >+// info.right = sash; >+// info.rightNode = parent.findSash(sash); >+// } >+// } >+// // check for a horizontal sash >+// else { >+// if (sashes.top == control) { >+// info.top = sash; >+// info.topNode = parent.findSash(sash); >+// } >+// else if (sashes.bottom == control) { >+// info.bottom = sash; >+// info.bottomNode = parent.findSash(sash); >+// } >+// } >+// } >+// } >+// // recursive call to continue up the tree >+// findSashParts(parent, sashes, info); >+// } > }
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