### Eclipse Workspace Patch 1.0
#P org.eclipse.ui.workbench
Index: Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java,v
retrieving revision 1.401
diff -u -r1.401 WorkbenchWindow.java
--- Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java 30 Apr 2008 19:56:47 -0000 1.401
+++ Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java 1 May 2008 18:54:04 -0000
@@ -1019,7 +1019,8 @@
* the shell
*/
protected void createDefaultContents(final Shell shell) {
- defaultLayout = new TrimLayout();
+ defaultLayout = new TrimLayout(
+ getWindowConfigurer().getPresentationFactory().getTrimAreaData());
shell.setLayout(defaultLayout);
Menu menuBar = getMenuBarManager().createMenuBar(shell);
Index: Eclipse UI/org/eclipse/ui/internal/layout/TrimLayout.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/TrimLayout.java,v
retrieving revision 1.39
diff -u -r1.39 TrimLayout.java
--- Eclipse UI/org/eclipse/ui/internal/layout/TrimLayout.java 14 Nov 2007 15:28:13 -0000 1.39
+++ Eclipse UI/org/eclipse/ui/internal/layout/TrimLayout.java 1 May 2008 18:54:05 -0000
@@ -109,19 +109,19 @@
/**
* Creates a new (initially empty) trim layout.
*/
- public TrimLayout() {
+ public TrimLayout(TrimAreaData trimData) {
// Determine whether or not the trim is 'locked'
final IPreferenceStore store = PlatformUI.getPreferenceStore();
trimLocked = store.getBoolean(IWorkbenchPreferenceConstants.LOCK_TRIM);
- createTrimArea(TOP_ID, TOP_ID.toString());
- createTrimArea(BOTTOM_ID, BOTTOM_ID.toString());
- createTrimArea(LEFT_ID, LEFT_ID.toString());
- createTrimArea(RIGHT_ID, RIGHT_ID.toString());
+ createTrimArea(TOP_ID, TOP_ID.toString(), trimData);
+ createTrimArea(BOTTOM_ID, BOTTOM_ID.toString(), trimData);
+ createTrimArea(LEFT_ID, LEFT_ID.toString(), trimData);
+ createTrimArea(RIGHT_ID, RIGHT_ID.toString(), trimData);
}
- private void createTrimArea(Integer id, String displayName) {
- TrimArea top = new TrimArea(id.intValue(), displayName);
+ private void createTrimArea(Integer id, String displayName, TrimAreaData trimData) {
+ TrimArea top = new TrimArea(id.intValue(), displayName, trimData);
fTrimArea.put(id, top);
}
Index: Eclipse UI/org/eclipse/ui/internal/layout/TrimArea.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/layout/TrimArea.java,v
retrieving revision 1.6
diff -u -r1.6 TrimArea.java
--- Eclipse UI/org/eclipse/ui/internal/layout/TrimArea.java 24 Mar 2008 19:21:58 -0000 1.6
+++ Eclipse UI/org/eclipse/ui/internal/layout/TrimArea.java 1 May 2008 18:54:04 -0000
@@ -138,11 +138,11 @@
/** Each trimArea is an ordered list of TrimDescriptors. */
private ArrayList fTrim;
+ /** The layout information */
+ private TrimAreaData fTrimData = new TrimAreaData();
+
// layout constants
private static final String PREFSIZE_DATA_ID = "prefSize"; //$NON-NLS-1$
- private static final int MIN_BANNER_LEFT = 150;
- private static int TILE_SPACING = 2;
- private static int LINE_SPACING = 2;
private Rectangle curRect = new Rectangle(0,0,0,0);
@@ -153,10 +153,11 @@
* @param displayName
* the NLS display name
*/
- public TrimArea(int id, String displayName) {
+ public TrimArea(int id, String displayName, TrimAreaData trimData) {
fTrim = new ArrayList();
fId = id;
fDisplayName = displayName;
+ fTrimData = trimData;
}
/**
@@ -234,7 +235,7 @@
// the banner will occupy is calculated
if (ctrl instanceof CBanner) {
CBanner banner = (CBanner) ctrl;
- prefSize.x = banner.getRightWidth() + banner.getBorderWidth() + MIN_BANNER_LEFT;
+ prefSize.x = banner.getRightWidth() + banner.getBorderWidth() + fTrimData.minBannerLeft;
prefSize.y = 0; // No height for now, computed later
}
else if (getData(ctrl).getId().equals("org.eclipse.jface.action.StatusLineManager")) { //$NON-NLS-1$
@@ -319,7 +320,7 @@
}
// Space out the controls
- tileLength += TILE_SPACING;
+ tileLength += fTrimData.horizontalSpacing;
// Place the control into the 'current' line if it'll fit or if
// it's the -first- control (this handles the case where a control is too
@@ -345,7 +346,7 @@
totalMinor += curLine.terminate();
// Finally, add enough room to provide spacing between the lines
- totalMinor += (lines.size() + 1) * LINE_SPACING;
+ totalMinor += (lines.size() + 1) * fTrimData.verticalSpacing;
return totalMinor;
}
@@ -371,12 +372,12 @@
int tileY = anchorY;
if (isHorizontal) {
- tileX += TILE_SPACING;
- tileY += LINE_SPACING;
+ tileX += fTrimData.horizontalSpacing;
+ tileY += fTrimData.verticalSpacing;
}
else {
- tileY += TILE_SPACING;
- tileX += LINE_SPACING;
+ tileY += fTrimData.horizontalSpacing;
+ tileX += fTrimData.verticalSpacing;
}
for (Iterator lineIter = lines.iterator(); lineIter.hasNext();) {
@@ -419,19 +420,19 @@
// Adjust the TILE_SPACING (unless it's a handle)
if (!(ctrl instanceof TrimCommonUIHandle)) {
if (isHorizontal)
- tileX += TILE_SPACING;
+ tileX += fTrimData.horizontalSpacing;
else
- tileY += TILE_SPACING;
+ tileY += fTrimData.horizontalSpacing;
}
}
if (isHorizontal) {
- tileY += (line.minorMax + LINE_SPACING);
- tileX = anchorX + TILE_SPACING;
+ tileY += (line.minorMax + fTrimData.verticalSpacing);
+ tileX = anchorX + fTrimData.horizontalSpacing;
}
else {
- tileX += (line.minorMax + LINE_SPACING);
- tileY = anchorY + TILE_SPACING;
+ tileX += (line.minorMax + fTrimData.verticalSpacing);
+ tileY = anchorY + fTrimData.horizontalSpacing;
}
}
Index: Eclipse UI/org/eclipse/ui/presentations/AbstractPresentationFactory.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/presentations/AbstractPresentationFactory.java,v
retrieving revision 1.19
diff -u -r1.19 AbstractPresentationFactory.java
--- Eclipse UI/org/eclipse/ui/presentations/AbstractPresentationFactory.java 9 Apr 2008 20:03:21 -0000 1.19
+++ Eclipse UI/org/eclipse/ui/presentations/AbstractPresentationFactory.java 1 May 2008 18:54:05 -0000
@@ -17,6 +17,7 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Sash;
+import org.eclipse.ui.internal.layout.TrimAreaData;
/**
* This is a factory for presentation objects that control the appearance of
@@ -162,4 +163,15 @@
public int getSashSize(int style) {
return SASH_SIZE;
}
+
+ /**
+ * Returns the a descriptor with all the layout constants for the proper positioning
+ * of the presentation stacks within a window.
+ *
+ * @return
+ * @since 3.4
+ */
+ public TrimAreaData getTrimAreaData() {
+ return new TrimAreaData();
+ }
}
Index: Eclipse UI/org/eclipse/ui/internal/layout/TrimAreaData.java
===================================================================
RCS file: Eclipse UI/org/eclipse/ui/internal/layout/TrimAreaData.java
diff -N Eclipse UI/org/eclipse/ui/internal/layout/TrimAreaData.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ Eclipse UI/org/eclipse/ui/internal/layout/TrimAreaData.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2008 L. Mihalkovic
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.ui.internal.layout;
+
+/**
+ * TrimAreaData
is the layout data object associated with
+ * TrimArea
.
+ * @since 3.4
+ *
+ */
+public class TrimAreaData {
+
+ /**
+ * Minimum size of the left most area (default = 150)
+ */
+ public int minBannerLeft = 150;
+
+ /**
+ * Number of pixels between two horizontally adjacent tiles (default = 2)
+ */
+ public int horizontalSpacing = 2;
+
+ /**
+ * Number of pixels between two vertically adjacent tiles (default = 2)
+ */
+ public int verticalSpacing = 2;
+
+ /**
+ * Constructs a new instance of TrimAreaData using
+ * default values.
+ */
+ public TrimAreaData() {
+ // Use the default values for all fields.
+ }
+
+ /**
+ * Constructs a new instance of GridData according to the parameters.
+ *
+ * @param horizontalSpacing number of pixels between two horizontally adjacent tiles
+ * @param verticalSpacing number of pixels between two vertically adjacent tiles
+ */
+ public TrimAreaData(int horizontalSpacing, int verticalSpacing) {
+ this.horizontalSpacing = horizontalSpacing;
+ this.verticalSpacing = verticalSpacing;
+ }
+}