View | Details | Raw Unified | Return to bug 19524 | Differences between
and this patch

Collapse All | Expand All

(-)EditorArea.java (-5 / +26 lines)
Lines 227-236 Link Here
227
		String partID = childMem.getString(IWorkbenchConstants.TAG_PART);
227
		String partID = childMem.getString(IWorkbenchConstants.TAG_PART);
228
		String relativeID = childMem.getString(IWorkbenchConstants.TAG_RELATIVE);
228
		String relativeID = childMem.getString(IWorkbenchConstants.TAG_RELATIVE);
229
		int relationship = 0;
229
		int relationship = 0;
230
		float ratio = 0.0f;
230
		int left = 0, right = 0;
231
		float ratio = 0.5f;
231
		if (relativeID != null) {
232
		if (relativeID != null) {
232
			relationship = childMem.getInteger(IWorkbenchConstants.TAG_RELATIONSHIP).intValue();
233
			relationship = childMem.getInteger(IWorkbenchConstants.TAG_RELATIONSHIP).intValue();
233
			ratio = childMem.getFloat(IWorkbenchConstants.TAG_RATIO).floatValue();
234
			Float Ratio = childMem.getFloat(IWorkbenchConstants.TAG_RATIO);
235
			Integer Left = childMem.getInteger(IWorkbenchConstants.TAG_RATIO_LEFT);
236
			Integer Right = childMem.getInteger(IWorkbenchConstants.TAG_RATIO_RIGHT);
237
			if (Left != null) {
238
				left = Left.intValue();
239
				right = Right.intValue();
240
			} else if (Ratio != null) {
241
				ratio = Ratio.floatValue();
242
			}
234
		}
243
		}
235
244
236
		// Create the part.
245
		// Create the part.
Lines 245-251 Link Here
245
		} else {
254
		} else {
246
			LayoutPart refPart = (LayoutPart)mapIDtoPart.get(relativeID);
255
			LayoutPart refPart = (LayoutPart)mapIDtoPart.get(relativeID);
247
			if (refPart != null) {
256
			if (refPart != null) {
248
				add(workbook, relationship, ratio, refPart);	
257
				//$TODO pass in left and right
258
				if (left == 0 || right == 0)
259
					add(workbook, relationship, ratio, refPart);
260
				else
261
					add(workbook, relationship, left, right, refPart);
249
			} else {
262
			} else {
250
				WorkbenchPlugin.log("Unable to find part for ID: " + relativeID);//$NON-NLS-1$
263
				WorkbenchPlugin.log("Unable to find part for ID: " + relativeID);//$NON-NLS-1$
251
			}
264
			}
Lines 271-277 Link Here
271
		if (info.relative != null) {
284
		if (info.relative != null) {
272
			childMem.putString(IWorkbenchConstants.TAG_RELATIVE, info.relative.getID());
285
			childMem.putString(IWorkbenchConstants.TAG_RELATIVE, info.relative.getID());
273
			childMem.putInteger(IWorkbenchConstants.TAG_RELATIONSHIP, info.relationship);
286
			childMem.putInteger(IWorkbenchConstants.TAG_RELATIONSHIP, info.relationship);
274
			childMem.putFloat(IWorkbenchConstants.TAG_RATIO, info.ratio);
287
			childMem.putInteger(IWorkbenchConstants.TAG_RATIO_LEFT, info.left);
288
			childMem.putInteger(IWorkbenchConstants.TAG_RATIO_RIGHT, info.right);
289
			//childMem.putFloat(IWorkbenchConstants.TAG_RATIO, info.ratio);
275
		}
290
		}
276
	}
291
	}
277
	return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null); //$NON-NLS-1$
292
	return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null); //$NON-NLS-1$
Lines 344-350 Link Here
344
	/* package */ DropTarget getDropTarget() {
359
	/* package */ DropTarget getDropTarget() {
345
		return dropTarget;
360
		return dropTarget;
346
	}
361
	}
347
	
362
	/**
363
	 * @see org.eclipse.ui.internal.LayoutPart#getImportance()
364
	 */
365
	public boolean isCompressible() {
366
		//Added for bug 19524
367
		return true;
368
	}	
348
	/* (non-Javadoc)
369
	/* (non-Javadoc)
349
	 * @see org.eclipse.ui.internal.ILayoutContainer#allowsAutoFocus()
370
	 * @see org.eclipse.ui.internal.ILayoutContainer#allowsAutoFocus()
350
	 */
371
	 */
(-)IWorkbenchConstants.java (+3 lines)
Lines 105-110 Link Here
105
	public static final String TAG_RELATIVE = "relative"; //$NON-NLS-1$
105
	public static final String TAG_RELATIVE = "relative"; //$NON-NLS-1$
106
	public static final String TAG_RELATIONSHIP = "relationship"; //$NON-NLS-1$
106
	public static final String TAG_RELATIONSHIP = "relationship"; //$NON-NLS-1$
107
	public static final String TAG_RATIO = "ratio"; //$NON-NLS-1$
107
	public static final String TAG_RATIO = "ratio"; //$NON-NLS-1$
108
	public static final String TAG_RATIO_LEFT = "ratioLeft"; //$NON-NLS-1$
109
	public static final String TAG_RATIO_RIGHT = "ratioRight"; //$NON-NLS-1$
110
	
108
	public static final String TAG_ACTIVE_PAGE_ID = "activePageID"; //$NON-NLS-1$
111
	public static final String TAG_ACTIVE_PAGE_ID = "activePageID"; //$NON-NLS-1$
109
	public static final String TAG_EXPANDED = "expanded"; //$NON-NLS-1$
112
	public static final String TAG_EXPANDED = "expanded"; //$NON-NLS-1$
110
	public static final String TAG_PAGE = "page"; //$NON-NLS-1$
113
	public static final String TAG_PAGE = "page"; //$NON-NLS-1$
(-)LayoutPart.java (+3 lines)
Lines 115-120 Link Here
115
	public String getID() {
115
	public String getID() {
116
		return id;
116
		return id;
117
	}
117
	}
118
	public boolean isCompressible() {
119
		return false;
120
	}
118
	/**
121
	/**
119
	 * Return the preference store for layout parts.
122
	 * Return the preference store for layout parts.
120
	 */
123
	 */
(-)LayoutPartSash.java (-5 / +29 lines)
Lines 9-14 Link Here
9
 * 
9
 * 
10
 * Contributors: 
10
 * Contributors: 
11
 *    IBM Corporation - initial API and implementation 
11
 *    IBM Corporation - initial API and implementation 
12
 *    Randy Hudson <hudsonr@us.ibm.com> 
13
 *      - Fix for bug 19524 - Resizing WorkbenchWindow resizes Views
12
 *    Cagatay Kavukcuoglu <cagatayk@acm.org>
14
 *    Cagatay Kavukcuoglu <cagatayk@acm.org>
13
 *      - Fix for bug 10025 - Resizing views should not use height ratios
15
 *      - Fix for bug 10025 - Resizing views should not use height ratios
14
**********************************************************************/
16
**********************************************************************/
Lines 28-34 Link Here
28
	private LayoutPartSash postLimit;
30
	private LayoutPartSash postLimit;
29
31
30
	SelectionListener selectionListener;
32
	SelectionListener selectionListener;
31
	private float ratio = 0.5f;
33
	private float ratio; //legacy
34
	private int left = 300, right = 300;
32
	
35
	
33
	/* Optimize limit checks by calculating minimum 
36
	/* Optimize limit checks by calculating minimum 
34
	 * and maximum ratios once per drag
37
	 * and maximum ratios once per drag
Lines 139-147 Link Here
139
LayoutPartSash getPreLimit() {
142
LayoutPartSash getPreLimit() {
140
	return preLimit;
143
	return preLimit;
141
}
144
}
145
146
int getLeft() {
147
	return left;
148
}
149
142
float getRatio() {
150
float getRatio() {
143
	return ratio;
151
	return ratio;
144
}
152
}
153
154
int getRight() {
155
	return right;	
156
}
157
145
boolean isHorizontal() {
158
boolean isHorizontal() {
146
	return ((style & SWT.HORIZONTAL) == SWT.HORIZONTAL);
159
	return ((style & SWT.HORIZONTAL) == SWT.HORIZONTAL);
147
}
160
}
Lines 154-161 Link Here
154
void setPreLimit(LayoutPartSash newPreLimit) {
167
void setPreLimit(LayoutPartSash newPreLimit) {
155
	preLimit = newPreLimit;
168
	preLimit = newPreLimit;
156
}
169
}
170
171
void setSizes(int left, int right) {
172
	this.left = left;
173
	this.right = right;
174
}
175
157
void setRatio(float newRatio) {
176
void setRatio(float newRatio) {
158
	if (newRatio < 0.0 || newRatio > 1.0) return;
177
	if (newRatio < 0.0 || newRatio > 1.0)
178
		return;
159
	ratio = newRatio;
179
	ratio = newRatio;
160
}
180
}
161
181
Lines 164-175 Link Here
164
	LayoutTreeNode node = root.findSash(this);
184
	LayoutTreeNode node = root.findSash(this);
165
	Rectangle nodeBounds = node.getBounds();
185
	Rectangle nodeBounds = node.getBounds();
166
	//Recompute ratio
186
	//Recompute ratio
187
	x -= nodeBounds.x;
188
	y -= nodeBounds.y;
167
	if(style == SWT.VERTICAL) {
189
	if(style == SWT.VERTICAL) {
168
		setRatio((float)(x - nodeBounds.x)/(float)nodeBounds.width);
190
		setSizes(x, nodeBounds.width - x);
191
		//setRatio((float)(x - nodeBounds.x)/(float)nodeBounds.width);
169
	} else {
192
	} else {
170
		setRatio((float)(y - nodeBounds.y)/(float)nodeBounds.height);
193
		setSizes(y, nodeBounds.height - y);
194
		//setRatio((float)(y - nodeBounds.y)/(float)nodeBounds.height);
171
	}
195
	}
172
		
196
	
173
	node.setBounds(nodeBounds);
197
	node.setBounds(nodeBounds);
174
	initDragRatios();
198
	initDragRatios();
175
}
199
}
(-)LayoutTree.java (+10 lines)
Lines 9-14 Link Here
9
 * 
9
 * 
10
 * Contributors: 
10
 * Contributors: 
11
 *     IBM Corporation - initial API and implementation
11
 *     IBM Corporation - initial API and implementation
12
 *    Randy Hudson <hudsonr@us.ibm.com> 
13
 *      - Fix for bug 19524 - Resizing WorkbenchWindow resizes Views
12
 *     Cagatay Kavukcuoglu <cagatayk@acm.org>
14
 *     Cagatay Kavukcuoglu <cagatayk@acm.org>
13
 *       - Fix for bug 10025 - Resizing views should not use height ratios
15
 *       - Fix for bug 10025 - Resizing views should not use height ratios
14
**********************************************************************/
16
**********************************************************************/
Lines 139-144 Link Here
139
		oldParent.replaceChild(relativeChild,node);
141
		oldParent.replaceChild(relativeChild,node);
140
		return this;
142
		return this;
141
	}
143
	}
144
}
145
/**
146
 * Returns true if this tree can be compressed and expanded.
147
 * @return true if springy
148
 */
149
public boolean isCompressible() {
150
	//Added for bug 19524
151
	return part.isCompressible();
142
}
152
}
143
/**
153
/**
144
 * Returns true if this tree has visible parts otherwise returns false.
154
 * Returns true if this tree has visible parts otherwise returns false.
(-)LayoutTreeNode.java (-13 / +69 lines)
Lines 9-21 Link Here
9
 * 
9
 * 
10
 * Contributors: 
10
 * Contributors: 
11
 *    IBM Corporation - initial API and implementation 
11
 *    IBM Corporation - initial API and implementation 
12
 *    Randy Hudson <hudsonr@us.ibm.com> 
13
 *       - Fix for bug 19524 - Resizing WorkbenchWindow resizes Views
12
 *    Cagatay Kavukcuoglu <cagatayk@acm.org>
14
 *    Cagatay Kavukcuoglu <cagatayk@acm.org>
13
 *       - Fix for bug 10025 - Resizing views should not use height ratios
15
 *       - Fix for bug 10025 - Resizing views should not use height ratios
14
**********************************************************************/
16
**********************************************************************/
15
17
16
import java.util.ArrayList;
18
import java.util.ArrayList;
17
19
18
import org.eclipse.jface.util.Geometry;
19
import org.eclipse.swt.graphics.Point;
20
import org.eclipse.swt.graphics.Point;
20
import org.eclipse.swt.graphics.Rectangle;
21
import org.eclipse.swt.graphics.Rectangle;
21
import org.eclipse.swt.widgets.Composite;
22
import org.eclipse.swt.widgets.Composite;
Lines 61-67 Link Here
61
	
62
	
62
	Rectangle bounds = sash.getBounds();
63
	Rectangle bounds = sash.getBounds();
63
	
64
	
64
	int relativePos = Geometry.getRelativePosition(bounds, toFind);
65
	//int relativePos = Geometry.getRelativePosition(bounds, toFind);
65
	
66
	
66
	if(sash.isVertical()) {
67
	if(sash.isVertical()) {
67
		if (toFind.x < bounds.x + (bounds.width / 2)) {
68
		if (toFind.x < bounds.x + (bounds.width / 2)) {
Lines 90-96 Link Here
90
	PartSashContainer.RelationshipInfo r = new PartSashContainer.RelationshipInfo();
91
	PartSashContainer.RelationshipInfo r = new PartSashContainer.RelationshipInfo();
91
	r.relative = children[0].computeRelation(relations);
92
	r.relative = children[0].computeRelation(relations);
92
	r.part = children[1].computeRelation(relations);
93
	r.part = children[1].computeRelation(relations);
93
	r.ratio = getSash().getRatio();
94
	r.left = getSash().getLeft();
95
	r.right = getSash().getRight();
94
	r.relationship = getSash().isVertical()?IPageLayout.RIGHT:IPageLayout.BOTTOM;
96
	r.relationship = getSash().isVertical()?IPageLayout.RIGHT:IPageLayout.BOTTOM;
95
	relations.add(0,r);
97
	relations.add(0,r);
96
	return r.relative;
98
	return r.relative;
Lines 227-232 Link Here
227
public boolean isVisible() {
229
public boolean isVisible() {
228
	return children[0].isVisible() || children[1].isVisible();
230
	return children[0].isVisible() || children[1].isVisible();
229
}
231
}
232
230
/**
233
/**
231
 * Recompute the ratios in this tree. The ratio for a node is the width
234
 * Recompute the ratios in this tree. The ratio for a node is the width
232
 * (or height if the sash is horizontal) of the left child's bounds 
235
 * (or height if the sash is horizontal) of the left child's bounds 
Lines 307-312 Link Here
307
 * Resize the parts on this tree to fit in <code>bounds</code>.
310
 * Resize the parts on this tree to fit in <code>bounds</code>.
308
 */
311
 */
309
public void setBounds(Rectangle bounds) {
312
public void setBounds(Rectangle bounds) {
313
//	if (bounds.isEmpty())
314
//		return;
310
	if(!children[0].isVisible()) {
315
	if(!children[0].isVisible()) {
311
		children[1].setBounds(bounds);
316
		children[1].setBounds(bounds);
312
		return;
317
		return;
Lines 321-331 Link Here
321
	Rectangle sashBounds = new Rectangle(bounds.x,bounds.y,bounds.width,bounds.height);
326
	Rectangle sashBounds = new Rectangle(bounds.x,bounds.y,bounds.width,bounds.height);
322
	
327
	
323
	float ratio = getSash().getRatio();
328
	float ratio = getSash().getRatio();
329
	if (ratio != 0.0) {
330
		int length = getSash().isVertical()
331
			? bounds.width : bounds.height;
332
		getSash().setSizes((int)(length * ratio), length - (int)(length * ratio));
333
		getSash().setRatio(0.0f);
334
	}
335
	int left = getSash().getLeft();
336
	int right = getSash().getRight();
337
	int total = left+right;
338
	
339
	//At first I was going to have a more elaborate weighting system, but all-or-non is
340
	// sufficient
341
	double wLeft = left, wRight = right;
342
	switch (getCompressionBias()) {
343
		case -1:
344
			wLeft = 0.0;
345
			break;
346
		case 1:
347
			wRight = 0.0;
348
			break;
349
		default:
350
			break;
351
	}
352
	double wTotal = wLeft + wRight;
324
	
353
	
325
	if(getSash().isVertical()) {
354
	if(getSash().isVertical()) {
326
		
355
		
327
		//Work on x and width
356
		//Work on x and width
328
		leftBounds.width = (int)(ratio * bounds.width);
357
		leftBounds.width = left;
358
		rightBounds.width = right;
359
		
360
		int redistribute = bounds.width - SASH_WIDTH - total;
361
362
		leftBounds.x = bounds.x;
363
		leftBounds.width += Math.round(redistribute * wLeft / wTotal);
364
		
329
		sashBounds.x = leftBounds.x + leftBounds.width;
365
		sashBounds.x = leftBounds.x + leftBounds.width;
330
		sashBounds.width = SASH_WIDTH;
366
		sashBounds.width = SASH_WIDTH;
331
		
367
		
Lines 334-340 Link Here
334
		}
370
		}
335
		
371
		
336
		rightBounds.x = sashBounds.x + sashBounds.width;
372
		rightBounds.x = sashBounds.x + sashBounds.width;
337
		rightBounds.width = bounds.width - leftBounds.width - sashBounds.width;
373
		rightBounds.width = bounds.x + bounds.width - rightBounds.x;
338
		
374
		
339
		if (children[1].fixedHeight()) {
375
		if (children[1].fixedHeight()) {
340
			rightBounds.height = children[1].getBounds().height;
376
			rightBounds.height = children[1].getBounds().height;
Lines 343-357 Link Here
343
		adjustWidths(bounds, leftBounds, rightBounds, sashBounds);
379
		adjustWidths(bounds, leftBounds, rightBounds, sashBounds);
344
	} else {
380
	} else {
345
		//Work on y and height
381
		//Work on y and height
382
		int redistribute = bounds.height - SASH_WIDTH - total;
383
346
		if (children[0].fixedHeight()) {
384
		if (children[0].fixedHeight()) {
347
			leftBounds.height = children[0].getBounds().height;
385
			leftBounds.height = children[0].getBounds().height;
386
		} else if (children[1].fixedHeight()) {
387
			leftBounds.height = bounds.height - children[1].getBounds().height - SASH_WIDTH;
348
		} else {
388
		} else {
349
			
389
			leftBounds.height = left + (int)Math.round(redistribute * wLeft / wTotal);
350
			if (children[1].fixedHeight()) {
351
				leftBounds.height = bounds.height - children[1].getBounds().height - SASH_WIDTH;
352
			} else {
353
				leftBounds.height = (int)(ratio * bounds.height);
354
			}
355
		}
390
		}
356
		sashBounds.y = leftBounds.y + leftBounds.height;
391
		sashBounds.y = leftBounds.y + leftBounds.height;
357
		sashBounds.height = SASH_WIDTH;
392
		sashBounds.height = SASH_WIDTH;
Lines 360-366 Link Here
360
		if (children[1].fixedHeight()) {
395
		if (children[1].fixedHeight()) {
361
			rightBounds.height = children[1].getBounds().height;
396
			rightBounds.height = children[1].getBounds().height;
362
		} else {
397
		} else {
363
			rightBounds.height = bounds.height - leftBounds.height - sashBounds.height;
398
			rightBounds.height = bounds.y + bounds.height - rightBounds.y;
364
		}
399
		}
365
		adjustHeights(bounds, leftBounds, rightBounds, sashBounds);
400
		adjustHeights(bounds, leftBounds, rightBounds, sashBounds);
366
	}
401
	}
Lines 471-477 Link Here
471
	return (part != 0 ) ? part / whole : IPageLayout.RATIO_MIN;
506
	return (part != 0 ) ? part / whole : IPageLayout.RATIO_MIN;
472
}
507
}
473
508
474
// getMaximumRatioFor added by cagatayk@acm.org 
509
510
//Added by hudsonr@us.ibm.com - bug 19524
511
512
public boolean isCompressible() {
513
	return children[0].isCompressible() || children[1].isCompressible();
514
}
515
516
/**
517
 * Returns 0 if there is no bias. Returns -1 if the first child should be of
518
 * fixed size, and the second child should be compressed. Returns 1 if the
519
 * second child should be of fixed size.
520
 * @return the bias
521
 */
522
public int getCompressionBias() {
523
	boolean left = children[0].isCompressible();
524
	boolean right = children[1].isCompressible();
525
	if (left == right)
526
		return 0;
527
	if (right)
528
		return -1;
529
	return 1;
530
}// getMaximumRatioFor added by cagatayk@acm.org 
475
/**
531
/**
476
 * Obtain the maximum ratio required to display the control on the "right"
532
 * Obtain the maximum ratio required to display the control on the "right"
477
 * using its minimum dimensions.
533
 * using its minimum dimensions.
(-)PartSashContainer.java (-3 / +28 lines)
Lines 58-64 Link Here
58
		protected LayoutPart part;
58
		protected LayoutPart part;
59
		protected LayoutPart relative;
59
		protected LayoutPart relative;
60
		protected int relationship;
60
		protected int relationship;
61
		protected float ratio;
61
		protected int left, right;
62
		protected float ratio; //legacy
62
	}
63
	}
63
	
64
	
64
public PartSashContainer(String id,final WorkbenchPage page) {
65
public PartSashContainer(String id,final WorkbenchPage page) {
Lines 141-147 Link Here
141
 * @param relationship one of PageLayout.TOP, PageLayout.BOTTOM, PageLayout.LEFT, or PageLayout.RIGHT
142
 * @param relationship one of PageLayout.TOP, PageLayout.BOTTOM, PageLayout.LEFT, or PageLayout.RIGHT
142
 * @param ratio a value between 0.0 and 1.0, indicating how much space will be allocated to the UPPER-LEFT pane
143
 * @param ratio a value between 0.0 and 1.0, indicating how much space will be allocated to the UPPER-LEFT pane
143
 * @param relative part where the new part will be attached
144
 * @param relative part where the new part will be attached
144
 * 
145
 * @deprecated need to pass in two ints instead of ratio
145
 */
146
 */
146
public void add(LayoutPart child, int relationship, float ratio, LayoutPart relative) {
147
public void add(LayoutPart child, int relationship, float ratio, LayoutPart relative) {
147
	if (isZoomed())
148
	if (isZoomed())
Lines 162-167 Link Here
162
	info.relative = relative;
163
	info.relative = relative;
163
	addChild(info);
164
	addChild(info);
164
}
165
}
166
167
public void add(LayoutPart child, int relationship, int left, int right, LayoutPart relative) {
168
	if (isZoomed())
169
		zoomOut();
170
171
	if (child == null)
172
		return;
173
	if (relative != null && !isChild(relative))
174
		return;
175
	if (relationship < IPageLayout.LEFT || relationship > IPageLayout.BOTTOM)
176
		relationship = IPageLayout.LEFT;
177
178
	// store info about relative positions
179
	RelationshipInfo info = new RelationshipInfo();
180
	info.part = child;
181
	info.relationship = relationship;
182
	info.left = left;
183
	info.right = right;
184
	info.relative = relative;
185
	addChild(info);
186
}
165
private void addChild(RelationshipInfo info) {
187
private void addChild(RelationshipInfo info) {
166
	LayoutPart child = info.part;
188
	LayoutPart child = info.part;
167
	
189
	
Lines 184-189 Link Here
184
		boolean left = info.relationship == IPageLayout.LEFT || info.relationship == IPageLayout.TOP; 
206
		boolean left = info.relationship == IPageLayout.LEFT || info.relationship == IPageLayout.TOP; 
185
		LayoutPartSash sash = new LayoutPartSash(this,vertical);
207
		LayoutPartSash sash = new LayoutPartSash(this,vertical);
186
		sash.setRatio(info.ratio);
208
		sash.setRatio(info.ratio);
209
		sash.setSizes(info.left, info.right);
187
		if((parent != null) && !(child instanceof PartPlaceholder))
210
		if((parent != null) && !(child instanceof PartPlaceholder))
188
			sash.createControl(parent);
211
			sash.createControl(parent);
189
		root = root.insert(child,left,sash,info.relative);
212
		root = root.insert(child,left,sash,info.relative);
Lines 315-326 Link Here
315
		return null;
338
		return null;
316
	return root.findBottomRight();
339
	return root.findBottomRight();
317
}
340
}
341
318
/**
342
/**
319
 * Find a initial position for a new part.
343
 * Find a initial position for a new part.
320
 */
344
 */
321
private void findPosition(RelationshipInfo info) {
345
private void findPosition(RelationshipInfo info) {
322
346
323
	info.ratio = (float)0.5;
347
	info.ratio = 0.5f;
324
	info.relationship = IPageLayout.RIGHT;
348
	info.relationship = IPageLayout.RIGHT;
325
	info.relative = root.findBottomRight();
349
	info.relative = root.findBottomRight();
326
350
Lines 416-421 Link Here
416
public boolean isZoomed() {
440
public boolean isZoomed() {
417
	return (unzoomRoot != null);
441
	return (unzoomRoot != null);
418
}
442
}
443
419
/**
444
/**
420
 * Move a part to a new position and keep the bounds when possible, ie,
445
 * Move a part to a new position and keep the bounds when possible, ie,
421
 * when the new relative part has the same higth or width as the part
446
 * when the new relative part has the same higth or width as the part
(-)RootLayoutContainer.java (-3 / +13 lines)
Lines 96-104 Link Here
96
		String relativeID = childMem.getString(IWorkbenchConstants.TAG_RELATIVE);
96
		String relativeID = childMem.getString(IWorkbenchConstants.TAG_RELATIVE);
97
		int relationship = 0;
97
		int relationship = 0;
98
		float ratio = 0.0f;
98
		float ratio = 0.0f;
99
		int left = 0, right = 0;
99
		if (relativeID != null) {
100
		if (relativeID != null) {
100
			relationship = childMem.getInteger(IWorkbenchConstants.TAG_RELATIONSHIP).intValue();
101
			relationship = childMem.getInteger(IWorkbenchConstants.TAG_RELATIONSHIP).intValue();
101
			ratio = childMem.getFloat(IWorkbenchConstants.TAG_RATIO).floatValue();
102
			Float Ratio = childMem.getFloat(IWorkbenchConstants.TAG_RATIO);
103
			if (Ratio == null) {
104
				left = childMem.getInteger(IWorkbenchConstants.TAG_RATIO_LEFT).intValue();
105
				right = childMem.getInteger(IWorkbenchConstants.TAG_RATIO_RIGHT).intValue();
106
			}
102
		}
107
		}
103
		String strFolder = childMem.getString(IWorkbenchConstants.TAG_FOLDER);
108
		String strFolder = childMem.getString(IWorkbenchConstants.TAG_FOLDER);
104
109
Lines 123-129 Link Here
123
		} else {
128
		} else {
124
			LayoutPart refPart = (LayoutPart)mapIDtoPart.get(relativeID);
129
			LayoutPart refPart = (LayoutPart)mapIDtoPart.get(relativeID);
125
			if (refPart != null) {
130
			if (refPart != null) {
126
				add(part, relationship, ratio, refPart);	
131
				if (left != 0)
132
					add(part, relationship, left, right, refPart);
133
				else
134
					add(part, relationship, ratio, refPart);
127
			} else {
135
			} else {
128
				WorkbenchPlugin.log("Unable to find part for ID: " + relativeID);//$NON-NLS-1$
136
				WorkbenchPlugin.log("Unable to find part for ID: " + relativeID);//$NON-NLS-1$
129
			}
137
			}
Lines 155-161 Link Here
155
		if (info.relative != null) {
163
		if (info.relative != null) {
156
			childMem.putString(IWorkbenchConstants.TAG_RELATIVE, info.relative.getID());
164
			childMem.putString(IWorkbenchConstants.TAG_RELATIVE, info.relative.getID());
157
			childMem.putInteger(IWorkbenchConstants.TAG_RELATIONSHIP, info.relationship);
165
			childMem.putInteger(IWorkbenchConstants.TAG_RELATIONSHIP, info.relationship);
158
			childMem.putFloat(IWorkbenchConstants.TAG_RATIO, info.ratio);
166
			childMem.putInteger(IWorkbenchConstants.TAG_RATIO_LEFT, info.left);
167
			childMem.putInteger(IWorkbenchConstants.TAG_RATIO_RIGHT, info.right);
168
			//childMem.putFloat(IWorkbenchConstants.TAG_RATIO, info.ratio);
159
		}
169
		}
160
170
161
		// Is this part a folder or a placeholder for one?
171
		// Is this part a folder or a placeholder for one?

Return to bug 19524