Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian de Alwis2011-11-03 15:26:05 +0000
committerBrian de Alwis2011-11-03 15:26:05 +0000
commitdf1b95a345efa309021f9f8d0b8137848a0856ae (patch)
treef4f1c783409985905819e8df601354c65828aab8
parent4eb6b96058af643eca9ea63fc5a8dadd78a3eaa0 (diff)
downloadeclipse.platform.ui-20111103-1526.tar.gz
eclipse.platform.ui-20111103-1526.tar.xz
eclipse.platform.ui-20111103-1526.zip
Fixes bugs 350226 and 358627 to handle multiple monitors where X and Yv20111103-1526
are legitimately < 0. Changes the sentinel value for Window#x and #y, and uses EMF introspection to see if values are set.
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/model/UIElements.ecore5
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/MWindow.java12
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/impl/BasicPackageImpl.java8
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/impl/WindowImpl.java8
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java28
5 files changed, 35 insertions, 26 deletions
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/model/UIElements.ecore b/bundles/org.eclipse.e4.ui.model.workbench/model/UIElements.ecore
index 4e0daaba9c9..6018f77f1c8 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/model/UIElements.ecore
+++ b/bundles/org.eclipse.e4.ui.model.workbench/model/UIElements.ecore
@@ -1,4 +1,3 @@
-<<<<<<< TREE
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -379,9 +378,9 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="mainMenu" eType="#//ui/menu/Menu"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="x" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
- defaultValueLiteral="-1"/>
+ defaultValueLiteral="-2147483648"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="y" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
- defaultValueLiteral="-1"/>
+ defaultValueLiteral="-2147483648"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="width" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
defaultValueLiteral="-1"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="height" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/MWindow.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/MWindow.java
index c8130b411aa..b5124781e5c 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/MWindow.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/MWindow.java
@@ -69,6 +69,7 @@ public interface MWindow extends MElementContainer<MWindowElement>, MUILabel, MC
/**
* Returns the value of the '<em><b>X</b></em>' attribute.
+ * The default value is <code>"-2147483648"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>X</em>' attribute isn't clear,
@@ -77,7 +78,7 @@ public interface MWindow extends MElementContainer<MWindowElement>, MUILabel, MC
* <!-- end-user-doc -->
* @return the value of the '<em>X</em>' attribute.
* @see #setX(int)
- * @model
+ * @model default="-2147483648"
* @generated
*/
int getX();
@@ -94,6 +95,7 @@ public interface MWindow extends MElementContainer<MWindowElement>, MUILabel, MC
/**
* Returns the value of the '<em><b>Y</b></em>' attribute.
+ * The default value is <code>"-2147483648"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Y</em>' attribute isn't clear,
@@ -102,7 +104,7 @@ public interface MWindow extends MElementContainer<MWindowElement>, MUILabel, MC
* <!-- end-user-doc -->
* @return the value of the '<em>Y</em>' attribute.
* @see #setY(int)
- * @model
+ * @model default="-2147483648"
* @generated
*/
int getY();
@@ -119,6 +121,7 @@ public interface MWindow extends MElementContainer<MWindowElement>, MUILabel, MC
/**
* Returns the value of the '<em><b>Width</b></em>' attribute.
+ * The default value is <code>"-2147483648"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Width</em>' attribute isn't clear,
@@ -127,7 +130,7 @@ public interface MWindow extends MElementContainer<MWindowElement>, MUILabel, MC
* <!-- end-user-doc -->
* @return the value of the '<em>Width</em>' attribute.
* @see #setWidth(int)
- * @model
+ * @model default="-2147483648"
* @generated
*/
int getWidth();
@@ -144,6 +147,7 @@ public interface MWindow extends MElementContainer<MWindowElement>, MUILabel, MC
/**
* Returns the value of the '<em><b>Height</b></em>' attribute.
+ * The default value is <code>"-2147483648"</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Height</em>' attribute isn't clear,
@@ -152,7 +156,7 @@ public interface MWindow extends MElementContainer<MWindowElement>, MUILabel, MC
* <!-- end-user-doc -->
* @return the value of the '<em>Height</em>' attribute.
* @see #setHeight(int)
- * @model
+ * @model default="-2147483648"
* @generated
*/
int getHeight();
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/impl/BasicPackageImpl.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/impl/BasicPackageImpl.java
index 3144aab39a5..08d09c69880 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/impl/BasicPackageImpl.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/impl/BasicPackageImpl.java
@@ -3303,10 +3303,10 @@ public class BasicPackageImpl extends EPackageImpl {
initEClass(windowEClass, MWindow.class, "Window", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
initEReference(getWindow_MainMenu(), theMenuPackage.getMenu(), null, "mainMenu", null, 0, 1, MWindow.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
- initEAttribute(getWindow_X(), ecorePackage.getEInt(), "x", "-1", 0, 1, MWindow.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$
- initEAttribute(getWindow_Y(), ecorePackage.getEInt(), "y", "-1", 0, 1, MWindow.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$
- initEAttribute(getWindow_Width(), ecorePackage.getEInt(), "width", "-1", 0, 1, MWindow.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$
- initEAttribute(getWindow_Height(), ecorePackage.getEInt(), "height", "-1", 0, 1, MWindow.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$
+ initEAttribute(getWindow_X(), ecorePackage.getEInt(), "x", "-2147483648", 0, 1, MWindow.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$
+ initEAttribute(getWindow_Y(), ecorePackage.getEInt(), "y", "-2147483648", 0, 1, MWindow.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$
+ initEAttribute(getWindow_Width(), ecorePackage.getEInt(), "width", "-2147483648", 0, 1, MWindow.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$
+ initEAttribute(getWindow_Height(), ecorePackage.getEInt(), "height", "-2147483648", 0, 1, MWindow.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ //$NON-NLS-2$
initEReference(getWindow_Windows(), this.getWindow(), null, "windows", null, 0, -1, MWindow.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
initEReference(getWindow_SharedElements(), theUiPackage.getUIElement(), null, "sharedElements", null, 0, -1, MWindow.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/impl/WindowImpl.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/impl/WindowImpl.java
index d18df721ecf..a2d960d2a1c 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/impl/WindowImpl.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/impl/WindowImpl.java
@@ -223,7 +223,7 @@ public class WindowImpl extends ElementContainerImpl<MWindowElement> implements
* @generated
* @ordered
*/
- protected static final int X_EDEFAULT = -1;
+ protected static final int X_EDEFAULT = -2147483648;
/**
* The cached value of the '{@link #getX() <em>X</em>}' attribute.
@@ -243,7 +243,7 @@ public class WindowImpl extends ElementContainerImpl<MWindowElement> implements
* @generated
* @ordered
*/
- protected static final int Y_EDEFAULT = -1;
+ protected static final int Y_EDEFAULT = -2147483648;
/**
* The cached value of the '{@link #getY() <em>Y</em>}' attribute.
@@ -263,7 +263,7 @@ public class WindowImpl extends ElementContainerImpl<MWindowElement> implements
* @generated
* @ordered
*/
- protected static final int WIDTH_EDEFAULT = -1;
+ protected static final int WIDTH_EDEFAULT = -2147483648;
/**
* The cached value of the '{@link #getWidth() <em>Width</em>}' attribute.
@@ -283,7 +283,7 @@ public class WindowImpl extends ElementContainerImpl<MWindowElement> implements
* @generated
* @ordered
*/
- protected static final int HEIGHT_EDEFAULT = -1;
+ protected static final int HEIGHT_EDEFAULT = -2147483648;
/**
* The cached value of the '{@link #getHeight() <em>Height</em>}' attribute.
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java
index 36b7877923a..f76a5f7abce 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WBWRenderer.java
@@ -43,6 +43,7 @@ import org.eclipse.e4.ui.workbench.UIEvents;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.e4.ui.workbench.modeling.ISaveHandler;
import org.eclipse.e4.ui.workbench.modeling.IWindowCloseHandler;
+import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.ArrayContentProvider;
@@ -386,17 +387,22 @@ public class WBWRenderer extends SWTPartRenderer {
wbwShell.setBackgroundMode(SWT.INHERIT_DEFAULT);
Rectangle modelBounds = wbwShell.getBounds();
- if (wbwModel.getX() >= 0) {
- modelBounds.x = wbwModel.getX();
- }
- if (wbwModel.getY() >= 0) {
- modelBounds.y = wbwModel.getY();
- }
- if (wbwModel.getHeight() >= 0) {
- modelBounds.height = wbwModel.getHeight();
- }
- if (wbwModel.getWidth() >= 0) {
- modelBounds.width = wbwModel.getWidth();
+ if (wbwModel instanceof EObject) {
+ EObject wbw = (EObject) wbwModel;
+ EClass wbwclass = wbw.eClass();
+ // use eIsSet rather than embed sentinel values
+ if (wbw.eIsSet(wbwclass.getEStructuralFeature("x"))) { //$NON-NLS-1$
+ modelBounds.x = wbwModel.getX();
+ }
+ if (wbw.eIsSet(wbwclass.getEStructuralFeature("y"))) { //$NON-NLS-1$
+ modelBounds.y = wbwModel.getY();
+ }
+ if (wbw.eIsSet(wbwclass.getEStructuralFeature("height"))) { //$NON-NLS-1$
+ modelBounds.height = wbwModel.getHeight();
+ }
+ if (wbw.eIsSet(wbwclass.getEStructuralFeature("width"))) { //$NON-NLS-1$
+ modelBounds.width = wbwModel.getWidth();
+ }
}
// Force the shell onto the display if it would be invisible otherwise
Rectangle displayBounds = Display.getCurrent().getBounds();

Back to the top