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 106-111 Link Here
106
	public static final String TAG_RELATIVE = "relative"; //$NON-NLS-1$
106
	public static final String TAG_RELATIVE = "relative"; //$NON-NLS-1$
107
	public static final String TAG_RELATIONSHIP = "relationship"; //$NON-NLS-1$
107
	public static final String TAG_RELATIONSHIP = "relationship"; //$NON-NLS-1$
108
	public static final String TAG_RATIO = "ratio"; //$NON-NLS-1$
108
	public static final String TAG_RATIO = "ratio"; //$NON-NLS-1$
109
	public static final String TAG_RATIO_LEFT = "ratioLeft"; //$NON-NLS-1$
110
	public static final String TAG_RATIO_RIGHT = "ratioRight"; //$NON-NLS-1$
111
	
109
	public static final String TAG_ACTIVE_PAGE_ID = "activePageID"; //$NON-NLS-1$
112
	public static final String TAG_ACTIVE_PAGE_ID = "activePageID"; //$NON-NLS-1$
110
	public static final String TAG_EXPANDED = "expanded"; //$NON-NLS-1$
113
	public static final String TAG_EXPANDED = "expanded"; //$NON-NLS-1$
111
	public static final String TAG_PAGE = "page"; //$NON-NLS-1$
114
	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 138-146 Link Here
138
LayoutPartSash getPreLimit() {
141
LayoutPartSash getPreLimit() {
139
	return preLimit;
142
	return preLimit;
140
}
143
}
144
145
int getLeft() {
146
	return left;
147
}
148
141
float getRatio() {
149
float getRatio() {
142
	return ratio;
150
	return ratio;
143
}
151
}
152
153
int getRight() {
154
	return right;	
155
}
156
144
boolean isHorizontal() {
157
boolean isHorizontal() {
145
	return ((style & SWT.HORIZONTAL) == SWT.HORIZONTAL);
158
	return ((style & SWT.HORIZONTAL) == SWT.HORIZONTAL);
146
}
159
}
Lines 153-160 Link Here
153
void setPreLimit(LayoutPartSash newPreLimit) {
166
void setPreLimit(LayoutPartSash newPreLimit) {
154
	preLimit = newPreLimit;
167
	preLimit = newPreLimit;
155
}
168
}
169
170
void setSizes(int left, int right) {
171
	this.left = left;
172
	this.right = right;
173
}
174
156
void setRatio(float newRatio) {
175
void setRatio(float newRatio) {
157
	if (newRatio < 0.0 || newRatio > 1.0) return;
176
	if (newRatio < 0.0 || newRatio > 1.0)
177
		return;
158
	ratio = newRatio;
178
	ratio = newRatio;
159
}
179
}
160
180
Lines 163-174 Link Here
163
	LayoutTreeNode node = root.findSash(this);
183
	LayoutTreeNode node = root.findSash(this);
164
	Rectangle nodeBounds = node.getBounds();
184
	Rectangle nodeBounds = node.getBounds();
165
	//Recompute ratio
185
	//Recompute ratio
186
	x -= nodeBounds.x;
187
	y -= nodeBounds.y;
166
	if(style == SWT.VERTICAL) {
188
	if(style == SWT.VERTICAL) {
167
		setRatio((float)(x - nodeBounds.x)/(float)nodeBounds.width);
189
		setSizes(x, nodeBounds.width - x);
190
		//setRatio((float)(x - nodeBounds.x)/(float)nodeBounds.width);
168
	} else {
191
	} else {
169
		setRatio((float)(y - nodeBounds.y)/(float)nodeBounds.height);
192
		setSizes(y, nodeBounds.height - y);
193
		//setRatio((float)(y - nodeBounds.y)/(float)nodeBounds.height);
170
	}
194
	}
171
		
195
	
172
	node.setBounds(nodeBounds);
196
	node.setBounds(nodeBounds);
173
	initDragRatios();
197
	initDragRatios();
174
}
198
}
(-)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 141-146 Link Here
141
		oldParent.replaceChild(relativeChild,node);
143
		oldParent.replaceChild(relativeChild,node);
142
		return this;
144
		return this;
143
	}
145
	}
146
}
147
/**
148
 * Returns true if this tree can be compressed and expanded.
149
 * @return true if springy
150
 */
151
public boolean isCompressible() {
152
	//Added for bug 19524
153
	return part.isCompressible();
144
}
154
}
145
/**
155
/**
146
 * Returns true if this tree has visible parts otherwise returns false.
156
 * 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 (-2 / +28 lines)
Lines 56-61 Link Here
56
		protected LayoutPart relative;
56
		protected LayoutPart relative;
57
		protected int relationship;
57
		protected int relationship;
58
		protected float ratio;
58
		protected float ratio;
59
		protected int left;
60
		protected int right;
59
	}
61
	}
60
62
61
	private class SashContainerDropTarget extends AbstractDropTarget {
63
	private class SashContainerDropTarget extends AbstractDropTarget {
Lines 173-179 Link Here
173
 * @param relationship one of PageLayout.TOP, PageLayout.BOTTOM, PageLayout.LEFT, or PageLayout.RIGHT
175
 * @param relationship one of PageLayout.TOP, PageLayout.BOTTOM, PageLayout.LEFT, or PageLayout.RIGHT
174
 * @param ratio a value between 0.0 and 1.0, indicating how much space will be allocated to the UPPER-LEFT pane
176
 * @param ratio a value between 0.0 and 1.0, indicating how much space will be allocated to the UPPER-LEFT pane
175
 * @param relative part where the new part will be attached
177
 * @param relative part where the new part will be attached
176
 * 
178
 * @deprecated need to pass in two ints instead of ratio
177
 */
179
 */
178
public void add(LayoutPart child, int relationship, float ratio, LayoutPart relative) {
180
public void add(LayoutPart child, int relationship, float ratio, LayoutPart relative) {
179
	if (isZoomed())
181
	if (isZoomed())
Lines 207-212 Link Here
207
		boolean left = info.relationship == IPageLayout.LEFT || info.relationship == IPageLayout.TOP; 
209
		boolean left = info.relationship == IPageLayout.LEFT || info.relationship == IPageLayout.TOP; 
208
		LayoutPartSash sash = new LayoutPartSash(this,vertical);
210
		LayoutPartSash sash = new LayoutPartSash(this,vertical);
209
		sash.setRatio(info.ratio);
211
		sash.setRatio(info.ratio);
212
		sash.setSizes(info.left, info.right);
210
		if((parent != null) && !(child instanceof PartPlaceholder))
213
		if((parent != null) && !(child instanceof PartPlaceholder))
211
			sash.createControl(parent);
214
			sash.createControl(parent);
212
		root = root.insert(child,left,sash,info.relative);
215
		root = root.insert(child,left,sash,info.relative);
Lines 354-365 Link Here
354
		return null;
357
		return null;
355
	return root.findBottomRight();
358
	return root.findBottomRight();
356
}
359
}
360
357
/**
361
/**
358
 * Find a initial position for a new part.
362
 * Find a initial position for a new part.
359
 */
363
 */
360
private void findPosition(RelationshipInfo info) {
364
private void findPosition(RelationshipInfo info) {
361
365
362
	info.ratio = (float)0.5;
366
	info.ratio = 0.5f;
363
	info.relationship = IPageLayout.RIGHT;
367
	info.relationship = IPageLayout.RIGHT;
364
	info.relative = root.findBottomRight();
368
	info.relative = root.findBottomRight();
365
369
Lines 449-454 Link Here
449
public boolean isZoomed() {
453
public boolean isZoomed() {
450
	return (unzoomRoot != null);
454
	return (unzoomRoot != null);
451
}
455
}
456
452
/**
457
/**
453
 * Move a part to a new position and keep the bounds when possible, ie,
458
 * Move a part to a new position and keep the bounds when possible, ie,
454
 * when the new relative part has the same higth or width as the part
459
 * when the new relative part has the same higth or width as the part
Lines 828-833 Link Here
828
		root.describeLayout(buf);
833
		root.describeLayout(buf);
829
		buf.append(")");
834
		buf.append(")");
830
	}
835
	}
836
}
837
838
public void add(LayoutPart child, int relationship, int left, int right, LayoutPart relative) {
839
	if (isZoomed())
840
		zoomOut();
841
842
	if (child == null)
843
		return;
844
	if (relative != null && !isChild(relative))
845
		return;
846
	if (relationship < IPageLayout.LEFT || relationship > IPageLayout.BOTTOM)
847
		relationship = IPageLayout.LEFT;
848
849
	// store info about relative positions
850
	RelationshipInfo info = new RelationshipInfo();
851
	info.part = child;
852
	info.relationship = relationship;
853
	info.left = left;
854
	info.right = right;
855
	info.relative = relative;
856
	addChild(info);
831
}
857
}
832
858
833
}
859
}
(-)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