Merge remote-tracking branch 'origin/R4_2_maintenance'
diff --git a/bundles/org.eclipse.core.commands/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.commands/META-INF/MANIFEST.MF
index b7474e1..f6a39f2 100644
--- a/bundles/org.eclipse.core.commands/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.core.commands/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.core.commands
-Bundle-Version: 3.6.2.qualifier
+Bundle-Version: 3.6.100.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.core.commands/pom.xml b/bundles/org.eclipse.core.commands/pom.xml
index d8e3e0c..0b8055e 100644
--- a/bundles/org.eclipse.core.commands/pom.xml
+++ b/bundles/org.eclipse.core.commands/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.core.commands</artifactId>
- <version>3.6.2-SNAPSHOT</version>
+ <version>3.6.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.core.databinding.property/META-INF/MANIFEST.MF b/bundles/org.eclipse.core.databinding.property/META-INF/MANIFEST.MF
index e8d6964..b2124d5 100644
--- a/bundles/org.eclipse.core.databinding.property/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.core.databinding.property/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.core.databinding.property
-Bundle-Version: 1.4.100.qualifier
+Bundle-Version: 1.4.200.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.core.databinding.property/plugin.properties b/bundles/org.eclipse.core.databinding.property/plugin.properties
index 8d13557..d20991b 100644
--- a/bundles/org.eclipse.core.databinding.property/plugin.properties
+++ b/bundles/org.eclipse.core.databinding.property/plugin.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2009 IBM Corporation and others.
+# Copyright (c) 2000, 2012 IBM Corporation and others.
# 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
@@ -8,5 +8,5 @@
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
-pluginName = JFace Data Binding
+pluginName = JFace Data Binding Properties
providerName = Eclipse.org
diff --git a/bundles/org.eclipse.core.databinding.property/pom.xml b/bundles/org.eclipse.core.databinding.property/pom.xml
index 8d01eae..703988b 100644
--- a/bundles/org.eclipse.core.databinding.property/pom.xml
+++ b/bundles/org.eclipse.core.databinding.property/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.core.databinding.property</artifactId>
- <version>1.4.100-SNAPSHOT</version>
+ <version>1.4.200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.e4.ui.bindings/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.bindings/META-INF/MANIFEST.MF
index b8d151d..84fd34c 100644
--- a/bundles/org.eclipse.e4.ui.bindings/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.bindings/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.e4.ui.bindings;singleton:=true
-Bundle-Version: 0.10.3.qualifier
+Bundle-Version: 0.10.100.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.e4.ui.bindings/pom.xml b/bundles/org.eclipse.e4.ui.bindings/pom.xml
index f29419b..a08ffab 100644
--- a/bundles/org.eclipse.e4.ui.bindings/pom.xml
+++ b/bundles/org.eclipse.e4.ui.bindings/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.e4.ui.bindings</artifactId>
- <version>0.10.3-SNAPSHOT</version>
+ <version>0.10.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.e4.ui.css.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.css.core/META-INF/MANIFEST.MF
index 958a146..c00a40d 100644
--- a/bundles/org.eclipse.e4.ui.css.core/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.css.core/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
-Bundle-Version: 0.10.2.qualifier
+Bundle-Version: 0.10.100.qualifier
Export-Package: org.eclipse.e4.ui.css.core;x-internal:=true,
org.eclipse.e4.ui.css.core.css2;x-friends:="org.eclipse.e4.ui.css.swt.theme,org.eclipse.e4.ui.css.swt,org.eclipse.e4.ui.css.jface",
org.eclipse.e4.ui.css.core.dom;x-friends:="org.eclipse.e4.ui.css.swt",
diff --git a/bundles/org.eclipse.e4.ui.css.core/pom.xml b/bundles/org.eclipse.e4.ui.css.core/pom.xml
index 9dcaca4..95d77a7 100644
--- a/bundles/org.eclipse.e4.ui.css.core/pom.xml
+++ b/bundles/org.eclipse.e4.ui.css.core/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.e4.ui.css.core</artifactId>
- <version>0.10.2-SNAPSHOT</version>
+ <version>0.10.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/util/impl/resources/ResourcesLocatorManager.java b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/util/impl/resources/ResourcesLocatorManager.java
index fb9e4b8..6cf036a 100644
--- a/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/util/impl/resources/ResourcesLocatorManager.java
+++ b/bundles/org.eclipse.e4.ui.css.core/src/org/eclipse/e4/ui/css/core/util/impl/resources/ResourcesLocatorManager.java
@@ -11,7 +11,6 @@
*******************************************************************************/
package org.eclipse.e4.ui.css.core.util.impl.resources;
-import java.io.File;
import java.io.InputStream;
import java.io.Reader;
import java.util.ArrayList;
diff --git a/bundles/org.eclipse.e4.ui.css.swt.theme/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.css.swt.theme/META-INF/MANIFEST.MF
index 4d3add0..d20f7ff 100644
--- a/bundles/org.eclipse.e4.ui.css.swt.theme/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.css.swt.theme/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.e4.ui.css.swt.theme;singleton:=true
-Bundle-Version: 0.9.4.qualifier
+Bundle-Version: 0.9.100.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.e4.ui.css.swt.theme/pom.xml b/bundles/org.eclipse.e4.ui.css.swt.theme/pom.xml
index 3dfb4a8..ffd53f9 100644
--- a/bundles/org.eclipse.e4.ui.css.swt.theme/pom.xml
+++ b/bundles/org.eclipse.e4.ui.css.swt.theme/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.e4.ui.css.swt.theme</artifactId>
- <version>0.9.4-SNAPSHOT</version>
+ <version>0.9.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/ThemeEngine.java b/bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/ThemeEngine.java
index 34cb320..d034933 100644
--- a/bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/ThemeEngine.java
+++ b/bundles/org.eclipse.e4.ui.css.swt.theme/src/org/eclipse/e4/ui/css/swt/internal/theme/ThemeEngine.java
@@ -14,7 +14,6 @@
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
diff --git a/bundles/org.eclipse.e4.ui.css.swt/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.css.swt/META-INF/MANIFEST.MF
index b1dbcce..928a617 100644
--- a/bundles/org.eclipse.e4.ui.css.swt/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.css.swt/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.e4.ui.css.swt;singleton:=true
-Bundle-Version: 0.10.3.qualifier
+Bundle-Version: 0.11.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.e4.ui.css.swt/plugin.xml b/bundles/org.eclipse.e4.ui.css.swt/plugin.xml
index 56bf824..91be28b 100644
--- a/bundles/org.eclipse.e4.ui.css.swt/plugin.xml
+++ b/bundles/org.eclipse.e4.ui.css.swt/plugin.xml
@@ -30,6 +30,9 @@
<widget
class="org.eclipse.swt.custom.CTabItem">
</widget>
+ <widget
+ class="org.eclipse.swt.widgets.ToolBar">
+ </widget>
<!-- these should be obviated by 4.2M6 -->
</provider>
diff --git a/bundles/org.eclipse.e4.ui.css.swt/pom.xml b/bundles/org.eclipse.e4.ui.css.swt/pom.xml
index 325895a..c952814 100644
--- a/bundles/org.eclipse.e4.ui.css.swt/pom.xml
+++ b/bundles/org.eclipse.e4.ui.css.swt/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.e4.ui.css.swt</artifactId>
- <version>0.10.3-SNAPSHOT</version>
+ <version>0.11.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/SWTElementProvider.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/SWTElementProvider.java
index 13f9313..b4a1a3f 100644
--- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/SWTElementProvider.java
+++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/SWTElementProvider.java
@@ -23,6 +23,8 @@
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.widgets.Widget;
import org.w3c.dom.Element;
@@ -72,6 +74,11 @@
if (element instanceof CTabFolder) {
return new CTabFolderElement((CTabFolder) element, engine);
}
+ if (element instanceof ToolBar) {
+ return new ToolBarElement((ToolBar) element, engine);
+ }
+
+
if (element instanceof Composite) {
return new CompositeElement((Composite) element, engine);
}
@@ -84,6 +91,9 @@
if (element instanceof TableItem) {
return new TableItemElement((TableItem) element, engine);
}
+ if (element instanceof ToolItem) {
+ return new ToolItemElement((ToolItem) element, engine);
+ }
if (element instanceof Item) {
return new ItemElement((Item) element, engine);
}
diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/ToolBarElement.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/ToolBarElement.java
new file mode 100644
index 0000000..c769be0
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/ToolBarElement.java
@@ -0,0 +1,31 @@
+package org.eclipse.e4.ui.css.swt.dom;
+
+import org.eclipse.e4.ui.css.core.dom.CSSStylableElement;
+import org.eclipse.e4.ui.css.core.engine.CSSEngine;
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.widgets.ToolBar;
+import org.w3c.dom.Node;
+
+/**
+ * {@link CSSStylableElement} implementation which wrap SWT {@link CTabFolder}.
+ *
+ */
+public class ToolBarElement extends CompositeElement {
+
+ public ToolBarElement(ToolBar toolbar, CSSEngine engine) {
+ super(toolbar, engine);
+ }
+
+ public ToolBar getToolBar() {
+ return (ToolBar)getNativeWidget();
+ }
+
+ public Node item(int index) {
+ return getElement(getToolBar().getItem(index));
+ }
+
+ public int getLength() {
+ return getToolBar().getItemCount();
+ }
+
+}
diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/ToolItemElement.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/ToolItemElement.java
new file mode 100644
index 0000000..c079983
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/dom/ToolItemElement.java
@@ -0,0 +1,52 @@
+package org.eclipse.e4.ui.css.swt.dom;
+
+import org.eclipse.e4.ui.css.core.dom.CSSStylableElement;
+import org.eclipse.e4.ui.css.core.engine.CSSEngine;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.swt.widgets.ToolItem;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * {@link CSSStylableElement} implementation which wrap SWT {@link TableItem}.
+ *
+ */
+public class ToolItemElement extends ItemElement {
+
+ public ToolItemElement(ToolItem toolItem, CSSEngine engine) {
+ super(toolItem, engine);
+ }
+
+ public ToolItem getToolItem() {
+ return (ToolItem) getNativeWidget();
+ }
+
+ public Node getParentNode() {
+ ToolItem item = getToolItem();
+ ToolBar parent = item.getParent();
+ if (parent != null) {
+ Element element = getElement(parent);
+ return element;
+ }
+ return null;
+ }
+
+ public Node item(int index) {
+ ToolItem item = getToolItem();
+ if ((item.getStyle() & SWT.SEPARATOR) == SWT.SEPARATOR) {
+ Object control = item.getControl();
+ if (control != null) {
+ return getElement(control);
+ }
+ }
+ return null;
+ }
+
+ public int getLength() {
+ ToolItem item = getToolItem();
+ return (item.getStyle() & SWT.SEPARATOR) == SWT.SEPARATOR
+ && item.getControl() != null ? 1 : 0;
+ }
+}
diff --git a/bundles/org.eclipse.e4.ui.di/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.di/META-INF/MANIFEST.MF
index b00330d..1f7d987 100644
--- a/bundles/org.eclipse.e4.ui.di/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.di/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.e4.ui.di
-Bundle-Version: 0.10.1.qualifier
+Bundle-Version: 0.11.0.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Import-Package: javax.inject;version="1.0.0"
diff --git a/bundles/org.eclipse.e4.ui.di/pom.xml b/bundles/org.eclipse.e4.ui.di/pom.xml
index f236a7a..804f6c5 100644
--- a/bundles/org.eclipse.e4.ui.di/pom.xml
+++ b/bundles/org.eclipse.e4.ui.di/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.e4.ui.di</artifactId>
- <version>0.10.1-SNAPSHOT</version>
+ <version>0.11.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.e4.ui.di/src/org/eclipse/e4/ui/di/AboutToHide.java b/bundles/org.eclipse.e4.ui.di/src/org/eclipse/e4/ui/di/AboutToHide.java
new file mode 100644
index 0000000..11fbfa0
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.di/src/org/eclipse/e4/ui/di/AboutToHide.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2012 MEDEVIT, FHV and others.
+ * 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:
+ * Marco Descher <marco@descher.at> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.e4.ui.di;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Use this annotation to act on to the list of dynamically shown entries within
+ * a DynamicMenuContributionItem. Usage in contribution class:
+ * <p>
+ * {@literal @}AboutToHide<br>
+ * public void aboutToHide(List<MMenuElement> items) { }
+ *
+ * @see org.eclipse.jface.action.IMenuListener2
+ */
+@Documented
+@Target({ ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AboutToHide {
+ // intentionally left empty
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.e4.ui.di/src/org/eclipse/e4/ui/di/AboutToShow.java b/bundles/org.eclipse.e4.ui.di/src/org/eclipse/e4/ui/di/AboutToShow.java
new file mode 100644
index 0000000..b3a7411
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.di/src/org/eclipse/e4/ui/di/AboutToShow.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2012 MEDEVIT, FHV and others.
+ * 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:
+ * Marco Descher <marco@descher.at> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.e4.ui.di;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Use this annotation to provide MMenuElements to the list of dynamically shown entries
+ * within a DynamicMenuContributionItem. Usage in contribution class:
+ * <p>
+ * {@literal @}AboutToShow<br>
+ * public void aboutToShow(List<MMenuElement> items) { }
+ *
+ * @see org.eclipse.jface.action.IMenuListener
+ */
+@Documented
+@Target({ ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AboutToShow {
+ // intentionally left empty
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.model.workbench.edit/META-INF/MANIFEST.MF
index a3af129..da4ca93 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench.edit/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.e4.ui.model.workbench.edit;singleton:=true
-Bundle-Version: 0.10.1.qualifier
+Bundle-Version: 0.12.0.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.e4.ui.model.application.provider.UIElementsEditPlugin$Implementation
Bundle-Vendor: %providerName
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/ctool16/CreateElementContainer_children_DynamicMenuContribution.gif b/bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/ctool16/CreateElementContainer_children_DynamicMenuContribution.gif
new file mode 100644
index 0000000..4f1420c
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/ctool16/CreateElementContainer_children_DynamicMenuContribution.gif
Binary files differ
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/ctool16/CreateWindow_sharedElements_DynamicMenuContribution.gif b/bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/ctool16/CreateWindow_sharedElements_DynamicMenuContribution.gif
new file mode 100644
index 0000000..6b9afea
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/ctool16/CreateWindow_sharedElements_DynamicMenuContribution.gif
Binary files differ
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/DynamicMenuContribution.gif b/bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/DynamicMenuContribution.gif
new file mode 100644
index 0000000..5a2614a
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/DynamicMenuContribution.gif
Binary files differ
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/plugin.properties b/bundles/org.eclipse.e4.ui.model.workbench.edit/plugin.properties
index 13f120a..bb1f583 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench.edit/plugin.properties
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/plugin.properties
@@ -282,3 +282,4 @@
_UI_SnippetContainer_type = Snippet Container
_UI_SnippetContainer_snippets_feature = Snippets
_UI_ApplicationElement_persistedState_feature = Persisted State
+_UI_DynamicMenuContribution_type = Dynamic Menu Contribution
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/pom.xml b/bundles/org.eclipse.e4.ui.model.workbench.edit/pom.xml
index e3fc86e..adce22d 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench.edit/pom.xml
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.e4.ui.model.workbench.edit</artifactId>
- <version>0.10.1-SNAPSHOT</version>
+ <version>0.12.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/provider/ApplicationItemProvider.java b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/provider/ApplicationItemProvider.java
index 290d29a..fddbc75 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/provider/ApplicationItemProvider.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/provider/ApplicationItemProvider.java
@@ -402,6 +402,11 @@
newChildDescriptors.add
(createChildParameter
(UiPackageImpl.Literals.SNIPPET_CONTAINER__SNIPPETS,
+ MMenuFactory.INSTANCE.createDynamicMenuContribution()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (UiPackageImpl.Literals.SNIPPET_CONTAINER__SNIPPETS,
org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory.INSTANCE.createPart()));
newChildDescriptors.add
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/advanced/provider/PerspectiveStackItemProvider.java b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/advanced/provider/PerspectiveStackItemProvider.java
index c3143e7..7688d48 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/advanced/provider/PerspectiveStackItemProvider.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/advanced/provider/PerspectiveStackItemProvider.java
@@ -311,6 +311,11 @@
newChildDescriptors.add
(createChildParameter
(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN,
+ MMenuFactory.INSTANCE.createDynamicMenuContribution()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN,
MBasicFactory.INSTANCE.createPart()));
newChildDescriptors.add
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/basic/provider/WindowItemProvider.java b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/basic/provider/WindowItemProvider.java
index c1f245d..712fb5f 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/basic/provider/WindowItemProvider.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/basic/provider/WindowItemProvider.java
@@ -592,6 +592,11 @@
newChildDescriptors.add
(createChildParameter
(UiPackageImpl.Literals.SNIPPET_CONTAINER__SNIPPETS,
+ MMenuFactory.INSTANCE.createDynamicMenuContribution()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (UiPackageImpl.Literals.SNIPPET_CONTAINER__SNIPPETS,
MAdvancedFactory.INSTANCE.createPlaceholder()));
newChildDescriptors.add
@@ -782,6 +787,11 @@
newChildDescriptors.add
(createChildParameter
(BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS,
+ MMenuFactory.INSTANCE.createDynamicMenuContribution()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS,
MAdvancedFactory.INSTANCE.createPlaceholder()));
newChildDescriptors.add
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/DynamicMenuContributionItemProvider.java b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/DynamicMenuContributionItemProvider.java
new file mode 100644
index 0000000..3e16e1e
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/DynamicMenuContributionItemProvider.java
@@ -0,0 +1,178 @@
+/**
+ * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * 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.e4.ui.model.application.ui.menu.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl;
+
+import org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution;
+
+import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class DynamicMenuContributionItemProvider
+ extends MenuItemItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DynamicMenuContributionItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addContributionURIPropertyDescriptor(object);
+ addObjectPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Contribution URI feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addContributionURIPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Contribution_contributionURI_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Contribution_contributionURI_feature", "_UI_Contribution_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Object feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addObjectPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Contribution_object_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Contribution_object_feature", "_UI_Contribution_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This returns DynamicMenuContribution.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/DynamicMenuContribution")); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((MDynamicMenuContribution)object).getElementId();
+ return label == null || label.length() == 0 ?
+ getString("_UI_DynamicMenuContribution_type") : //$NON-NLS-1$
+ getString("_UI_DynamicMenuContribution_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(MDynamicMenuContribution.class)) {
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTION_URI:
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__OBJECT:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/MenuItemProvider.java b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/MenuItemProvider.java
index 2aff8d7..e03b82c 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/MenuItemProvider.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/MenuItemProvider.java
@@ -310,6 +310,11 @@
newChildDescriptors.add
(createChildParameter
(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN,
+ MMenuFactory.INSTANCE.createDynamicMenuContribution()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN,
MApplicationFactory.INSTANCE.createApplication()));
newChildDescriptors.add
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/MenuItemProviderAdapterFactory.java b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/MenuItemProviderAdapterFactory.java
index c00e88c..fc44e21 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/MenuItemProviderAdapterFactory.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/MenuItemProviderAdapterFactory.java
@@ -537,6 +537,29 @@
}
/**
+ * This keeps track of the one adapter used for all {@link org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected DynamicMenuContributionItemProvider dynamicMenuContributionItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createDynamicMenuContributionAdapter() {
+ if (dynamicMenuContributionItemProvider == null) {
+ dynamicMenuContributionItemProvider = new DynamicMenuContributionItemProvider(this);
+ }
+
+ return dynamicMenuContributionItemProvider;
+ }
+
+ /**
* This returns the root adapter factory that contains this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -655,6 +678,7 @@
if (opaqueMenuItemItemProvider != null) opaqueMenuItemItemProvider.dispose();
if (opaqueMenuSeparatorItemProvider != null) opaqueMenuSeparatorItemProvider.dispose();
if (opaqueMenuItemProvider != null) opaqueMenuItemProvider.dispose();
+ if (dynamicMenuContributionItemProvider != null) dynamicMenuContributionItemProvider.dispose();
}
}
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/provider/ElementContainerItemProvider.java b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/provider/ElementContainerItemProvider.java
index 1f2baef..181fcad 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/provider/ElementContainerItemProvider.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/provider/ElementContainerItemProvider.java
@@ -276,6 +276,11 @@
newChildDescriptors.add
(createChildParameter
(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN,
+ MMenuFactory.INSTANCE.createDynamicMenuContribution()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN,
MBasicFactory.INSTANCE.createPart()));
newChildDescriptors.add
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.model.workbench/META-INF/MANIFEST.MF
index 77aff9b..1d926cb 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.model.workbench/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.e4.ui.model.workbench;singleton:=true
-Bundle-Version: 0.10.1.qualifier
+Bundle-Version: 0.12.0.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.e4.ui.model.application.impl.MWorkbenchModelActivator$Implementation
Bundle-Vendor: %providerName
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 012d1c3..b30b80d 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/model/UIElements.ecore
+++ b/bundles/org.eclipse.e4.ui.model.workbench/model/UIElements.ecore
@@ -346,6 +346,7 @@
transient="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="OpaqueMenu" eSuperTypes="#//ui/menu/Menu"/>
+ <eClassifiers xsi:type="ecore:EClass" name="DynamicMenuContribution" eSuperTypes="#//ui/menu/MenuItem #//Contribution"/>
</eSubpackages>
<eSubpackages name="basic" nsURI="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic"
nsPrefix="basic">
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/pom.xml b/bundles/org.eclipse.e4.ui.model.workbench/pom.xml
index a4fb3f7..c6d304e 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/pom.xml
+++ b/bundles/org.eclipse.e4.ui.model.workbench/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.e4.ui.model.workbench</artifactId>
- <version>0.10.1-SNAPSHOT</version>
+ <version>0.12.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/MDynamicMenuContribution.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/MDynamicMenuContribution.java
new file mode 100644
index 0000000..581016d
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/MDynamicMenuContribution.java
@@ -0,0 +1,25 @@
+/**
+ * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * 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.e4.ui.model.application.ui.menu;
+
+import org.eclipse.e4.ui.model.application.MContribution;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Dynamic Menu Contribution</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @model
+ * @generated
+ */
+public interface MDynamicMenuContribution extends MMenuItem, MContribution {
+} // MDynamicMenuContribution
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/MMenuFactory.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/MMenuFactory.java
index af88fb2..c49faad 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/MMenuFactory.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/MMenuFactory.java
@@ -207,4 +207,13 @@
*/
MOpaqueMenu createOpaqueMenu();
+ /**
+ * Returns a new object of class '<em>Dynamic Menu Contribution</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Dynamic Menu Contribution</em>'.
+ * @generated
+ */
+ MDynamicMenuContribution createDynamicMenuContribution();
+
} //MMenuFactory
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/DynamicMenuContributionImpl.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/DynamicMenuContributionImpl.java
new file mode 100644
index 0000000..3739e24
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/DynamicMenuContributionImpl.java
@@ -0,0 +1,261 @@
+/**
+ * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * 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.e4.ui.model.application.ui.menu.impl;
+
+import org.eclipse.e4.ui.model.application.MContribution;
+
+import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl;
+
+import org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Dynamic Menu Contribution</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.e4.ui.model.application.ui.menu.impl.DynamicMenuContributionImpl#getContributionURI <em>Contribution URI</em>}</li>
+ * <li>{@link org.eclipse.e4.ui.model.application.ui.menu.impl.DynamicMenuContributionImpl#getObject <em>Object</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class DynamicMenuContributionImpl extends MenuItemImpl implements MDynamicMenuContribution {
+ /**
+ * The default value of the '{@link #getContributionURI() <em>Contribution URI</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getContributionURI()
+ * @generated
+ * @ordered
+ */
+ protected static final String CONTRIBUTION_URI_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getContributionURI() <em>Contribution URI</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getContributionURI()
+ * @generated
+ * @ordered
+ */
+ protected String contributionURI = CONTRIBUTION_URI_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getObject() <em>Object</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getObject()
+ * @generated
+ * @ordered
+ */
+ protected static final Object OBJECT_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getObject() <em>Object</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getObject()
+ * @generated
+ * @ordered
+ */
+ protected Object object = OBJECT_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected DynamicMenuContributionImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getContributionURI() {
+ return contributionURI;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setContributionURI(String newContributionURI) {
+ String oldContributionURI = contributionURI;
+ contributionURI = newContributionURI;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTION_URI, oldContributionURI, contributionURI));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Object getObject() {
+ return object;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setObject(Object newObject) {
+ Object oldObject = object;
+ object = newObject;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__OBJECT, oldObject, object));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTION_URI:
+ return getContributionURI();
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__OBJECT:
+ return getObject();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTION_URI:
+ setContributionURI((String)newValue);
+ return;
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__OBJECT:
+ setObject(newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTION_URI:
+ setContributionURI(CONTRIBUTION_URI_EDEFAULT);
+ return;
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__OBJECT:
+ setObject(OBJECT_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTION_URI:
+ return CONTRIBUTION_URI_EDEFAULT == null ? contributionURI != null : !CONTRIBUTION_URI_EDEFAULT.equals(contributionURI);
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__OBJECT:
+ return OBJECT_EDEFAULT == null ? object != null : !OBJECT_EDEFAULT.equals(object);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
+ if (baseClass == MContribution.class) {
+ switch (derivedFeatureID) {
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTION_URI: return ApplicationPackageImpl.CONTRIBUTION__CONTRIBUTION_URI;
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__OBJECT: return ApplicationPackageImpl.CONTRIBUTION__OBJECT;
+ default: return -1;
+ }
+ }
+ return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
+ if (baseClass == MContribution.class) {
+ switch (baseFeatureID) {
+ case ApplicationPackageImpl.CONTRIBUTION__CONTRIBUTION_URI: return MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTION_URI;
+ case ApplicationPackageImpl.CONTRIBUTION__OBJECT: return MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__OBJECT;
+ default: return -1;
+ }
+ }
+ return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (contributionURI: "); //$NON-NLS-1$
+ result.append(contributionURI);
+ result.append(", object: "); //$NON-NLS-1$
+ result.append(object);
+ result.append(')');
+ return result.toString();
+ }
+
+} //DynamicMenuContributionImpl
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/MenuFactoryImpl.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/MenuFactoryImpl.java
index 674df3d..713e737 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/MenuFactoryImpl.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/MenuFactoryImpl.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.e4.ui.model.application.ui.menu.impl;
+import org.eclipse.e4.ui.model.application.ui.menu.*;
import org.eclipse.e4.ui.model.application.ui.menu.ItemType;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectToolItem;
@@ -111,6 +112,7 @@
case MenuPackageImpl.OPAQUE_MENU_ITEM: return (EObject)createOpaqueMenuItem();
case MenuPackageImpl.OPAQUE_MENU_SEPARATOR: return (EObject)createOpaqueMenuSeparator();
case MenuPackageImpl.OPAQUE_MENU: return (EObject)createOpaqueMenu();
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION: return (EObject)createDynamicMenuContribution();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -351,6 +353,16 @@
* <!-- end-user-doc -->
* @generated
*/
+ public MDynamicMenuContribution createDynamicMenuContribution() {
+ DynamicMenuContributionImpl dynamicMenuContribution = new DynamicMenuContributionImpl();
+ return dynamicMenuContribution;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public ItemType createItemTypeFromString(EDataType eDataType, String initialValue) {
ItemType result = ItemType.get(initialValue);
if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/MenuPackageImpl.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/MenuPackageImpl.java
index bec00b8..0d94600 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/MenuPackageImpl.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/MenuPackageImpl.java
@@ -18,6 +18,7 @@
import org.eclipse.e4.ui.model.application.ui.menu.ItemType;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectToolItem;
+import org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledToolItem;
@@ -6515,6 +6516,286 @@
public static final int OPAQUE_MENU_OPERATION_COUNT = MENU_OPERATION_COUNT + 0;
/**
+ * The meta object id for the '{@link org.eclipse.e4.ui.model.application.ui.menu.impl.DynamicMenuContributionImpl <em>Dynamic Menu Contribution</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.e4.ui.model.application.ui.menu.impl.DynamicMenuContributionImpl
+ * @see org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl#getDynamicMenuContribution()
+ * @generated
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION = 29;
+
+ /**
+ * The feature id for the '<em><b>Element Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__ELEMENT_ID = MENU_ITEM__ELEMENT_ID;
+
+ /**
+ * The feature id for the '<em><b>Persisted State</b></em>' map.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__PERSISTED_STATE = MENU_ITEM__PERSISTED_STATE;
+
+ /**
+ * The feature id for the '<em><b>Tags</b></em>' attribute list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__TAGS = MENU_ITEM__TAGS;
+
+ /**
+ * The feature id for the '<em><b>Contributor URI</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTOR_URI = MENU_ITEM__CONTRIBUTOR_URI;
+
+ /**
+ * The feature id for the '<em><b>Transient Data</b></em>' map.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__TRANSIENT_DATA = MENU_ITEM__TRANSIENT_DATA;
+
+ /**
+ * The feature id for the '<em><b>Widget</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__WIDGET = MENU_ITEM__WIDGET;
+
+ /**
+ * The feature id for the '<em><b>Renderer</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__RENDERER = MENU_ITEM__RENDERER;
+
+ /**
+ * The feature id for the '<em><b>To Be Rendered</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__TO_BE_RENDERED = MENU_ITEM__TO_BE_RENDERED;
+
+ /**
+ * The feature id for the '<em><b>On Top</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__ON_TOP = MENU_ITEM__ON_TOP;
+
+ /**
+ * The feature id for the '<em><b>Visible</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__VISIBLE = MENU_ITEM__VISIBLE;
+
+ /**
+ * The feature id for the '<em><b>Parent</b></em>' container reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__PARENT = MENU_ITEM__PARENT;
+
+ /**
+ * The feature id for the '<em><b>Container Data</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__CONTAINER_DATA = MENU_ITEM__CONTAINER_DATA;
+
+ /**
+ * The feature id for the '<em><b>Cur Shared Ref</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__CUR_SHARED_REF = MENU_ITEM__CUR_SHARED_REF;
+
+ /**
+ * The feature id for the '<em><b>Visible When</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__VISIBLE_WHEN = MENU_ITEM__VISIBLE_WHEN;
+
+ /**
+ * The feature id for the '<em><b>Accessibility Phrase</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__ACCESSIBILITY_PHRASE = MENU_ITEM__ACCESSIBILITY_PHRASE;
+
+ /**
+ * The feature id for the '<em><b>Label</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__LABEL = MENU_ITEM__LABEL;
+
+ /**
+ * The feature id for the '<em><b>Icon URI</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__ICON_URI = MENU_ITEM__ICON_URI;
+
+ /**
+ * The feature id for the '<em><b>Tooltip</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__TOOLTIP = MENU_ITEM__TOOLTIP;
+
+ /**
+ * The feature id for the '<em><b>Enabled</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__ENABLED = MENU_ITEM__ENABLED;
+
+ /**
+ * The feature id for the '<em><b>Selected</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__SELECTED = MENU_ITEM__SELECTED;
+
+ /**
+ * The feature id for the '<em><b>Type</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__TYPE = MENU_ITEM__TYPE;
+
+ /**
+ * The feature id for the '<em><b>Mnemonics</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__MNEMONICS = MENU_ITEM__MNEMONICS;
+
+ /**
+ * The feature id for the '<em><b>Contribution URI</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTION_URI = MENU_ITEM_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Object</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__OBJECT = MENU_ITEM_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Dynamic Menu Contribution</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION_FEATURE_COUNT = MENU_ITEM_FEATURE_COUNT + 2;
+
+ /**
+ * The operation id for the '<em>Get Localized Accessibility Phrase</em>' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION___GET_LOCALIZED_ACCESSIBILITY_PHRASE = MENU_ITEM___GET_LOCALIZED_ACCESSIBILITY_PHRASE;
+
+ /**
+ * The operation id for the '<em>Get Localized Label</em>' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION___GET_LOCALIZED_LABEL = MENU_ITEM___GET_LOCALIZED_LABEL;
+
+ /**
+ * The operation id for the '<em>Get Localized Tooltip</em>' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION___GET_LOCALIZED_TOOLTIP = MENU_ITEM___GET_LOCALIZED_TOOLTIP;
+
+ /**
+ * The operation id for the '<em>Get Localized Mnemonics</em>' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION___GET_LOCALIZED_MNEMONICS = MENU_ITEM___GET_LOCALIZED_MNEMONICS;
+
+ /**
+ * The number of operations of the '<em>Dynamic Menu Contribution</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION_OPERATION_COUNT = MENU_ITEM_OPERATION_COUNT + 0;
+
+ /**
* The meta object id for the '{@link org.eclipse.e4.ui.model.application.ui.menu.ItemType <em>Item Type</em>}' enum.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -6522,7 +6803,7 @@
* @see org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl#getItemType()
* @generated
*/
- public static final int ITEM_TYPE = 29;
+ public static final int ITEM_TYPE = 30;
/**
* <!-- begin-user-doc -->
@@ -6732,6 +7013,13 @@
* <!-- end-user-doc -->
* @generated
*/
+ private EClass dynamicMenuContributionEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
private EEnum itemTypeEEnum = null;
/**
@@ -7521,6 +7809,19 @@
/**
+ * Returns the meta object for class '{@link org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution <em>Dynamic Menu Contribution</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Dynamic Menu Contribution</em>'.
+ * @see org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution
+ * @generated
+ */
+ public EClass getDynamicMenuContribution() {
+ return dynamicMenuContributionEClass;
+ }
+
+
+ /**
* Returns the meta object for enum '{@link org.eclipse.e4.ui.model.application.ui.menu.ItemType <em>Item Type</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -7645,6 +7946,8 @@
opaqueMenuEClass = createEClass(OPAQUE_MENU);
+ dynamicMenuContributionEClass = createEClass(DYNAMIC_MENU_CONTRIBUTION);
+
// Create enums
itemTypeEEnum = createEEnum(ITEM_TYPE);
}
@@ -7739,6 +8042,8 @@
opaqueMenuItemEClass.getESuperTypes().add(this.getMenuItem());
opaqueMenuSeparatorEClass.getESuperTypes().add(this.getMenuSeparator());
opaqueMenuEClass.getESuperTypes().add(this.getMenu());
+ dynamicMenuContributionEClass.getESuperTypes().add(this.getMenuItem());
+ dynamicMenuContributionEClass.getESuperTypes().add(theApplicationPackage.getContribution());
// Initialize classes, features, and operations; add parameters
initEClass(itemEClass, MItem.class, "Item", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
@@ -7825,6 +8130,8 @@
initEClass(opaqueMenuEClass, MOpaqueMenu.class, "OpaqueMenu", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEClass(dynamicMenuContributionEClass, MDynamicMenuContribution.class, "DynamicMenuContribution", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+
// Initialize enums and add enum literals
initEEnum(itemTypeEEnum, ItemType.class, "ItemType"); //$NON-NLS-1$
addEEnumLiteral(itemTypeEEnum, ItemType.PUSH);
@@ -8336,6 +8643,16 @@
public static final EClass OPAQUE_MENU = eINSTANCE.getOpaqueMenu();
/**
+ * The meta object literal for the '{@link org.eclipse.e4.ui.model.application.ui.menu.impl.DynamicMenuContributionImpl <em>Dynamic Menu Contribution</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.e4.ui.model.application.ui.menu.impl.DynamicMenuContributionImpl
+ * @see org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl#getDynamicMenuContribution()
+ * @generated
+ */
+ public static final EClass DYNAMIC_MENU_CONTRIBUTION = eINSTANCE.getDynamicMenuContribution();
+
+ /**
* The meta object literal for the '{@link org.eclipse.e4.ui.model.application.ui.menu.ItemType <em>Item Type</em>}' enum.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/util/MenuAdapterFactory.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/util/MenuAdapterFactory.java
index c50d3f9..a47eb6b 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/util/MenuAdapterFactory.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/util/MenuAdapterFactory.java
@@ -17,6 +17,7 @@
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.MUILabel;
import org.eclipse.e4.ui.model.application.ui.basic.MTrimElement;
+import org.eclipse.e4.ui.model.application.ui.menu.*;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectToolItem;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem;
@@ -225,6 +226,10 @@
return createOpaqueMenuAdapter();
}
@Override
+ public Adapter caseDynamicMenuContribution(MDynamicMenuContribution object) {
+ return createDynamicMenuContributionAdapter();
+ }
+ @Override
public Adapter caseApplicationElement(MApplicationElement object) {
return createApplicationElementAdapter();
}
@@ -679,6 +684,20 @@
}
/**
+ * Creates a new adapter for an object of class '{@link org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution <em>Dynamic Menu Contribution</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution
+ * @generated
+ */
+ public Adapter createDynamicMenuContributionAdapter() {
+ return null;
+ }
+
+ /**
* Creates a new adapter for an object of class '{@link org.eclipse.e4.ui.model.application.MApplicationElement <em>Element</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/util/MenuSwitch.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/util/MenuSwitch.java
index 23acb34..8e4e473 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/util/MenuSwitch.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/util/MenuSwitch.java
@@ -17,6 +17,7 @@
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.MUILabel;
import org.eclipse.e4.ui.model.application.ui.basic.MTrimElement;
+import org.eclipse.e4.ui.model.application.ui.menu.*;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectToolItem;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem;
@@ -409,6 +410,19 @@
if (result == null) result = defaultCase(theEObject);
return result;
}
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION: {
+ MDynamicMenuContribution dynamicMenuContribution = (MDynamicMenuContribution)theEObject;
+ T1 result = caseDynamicMenuContribution(dynamicMenuContribution);
+ if (result == null) result = caseMenuItem(dynamicMenuContribution);
+ if (result == null) result = caseContribution(dynamicMenuContribution);
+ if (result == null) result = caseItem(dynamicMenuContribution);
+ if (result == null) result = caseMenuElement(dynamicMenuContribution);
+ if (result == null) result = caseUIElement(dynamicMenuContribution);
+ if (result == null) result = caseUILabel(dynamicMenuContribution);
+ if (result == null) result = caseApplicationElement(dynamicMenuContribution);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
default: return defaultCase(theEObject);
}
}
@@ -849,6 +863,21 @@
}
/**
+ * Returns the result of interpreting the object as an instance of '<em>Dynamic Menu Contribution</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Dynamic Menu Contribution</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T1 caseDynamicMenuContribution(MDynamicMenuContribution object) {
+ return null;
+ }
+
+ /**
* Returns the result of interpreting the object as an instance of '<em>Element</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/util/ApplicationAdapterFactory.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/util/ApplicationAdapterFactory.java
index 4f818b0..8a2d155 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/util/ApplicationAdapterFactory.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/util/ApplicationAdapterFactory.java
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2012 IBM Corporation and others.
* 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
diff --git a/bundles/org.eclipse.e4.ui.services/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.services/META-INF/MANIFEST.MF
index 02405a4..dc827fb 100644
--- a/bundles/org.eclipse.e4.ui.services/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.services/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.e4.ui.services;singleton:=true
-Bundle-Version: 0.10.3.qualifier
+Bundle-Version: 0.11.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.e4.ui.services/pom.xml b/bundles/org.eclipse.e4.ui.services/pom.xml
index 6975d05..97abedc 100644
--- a/bundles/org.eclipse.e4.ui.services/pom.xml
+++ b/bundles/org.eclipse.e4.ui.services/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.e4.ui.services</artifactId>
- <version>0.10.3-SNAPSHOT</version>
+ <version>0.11.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.e4.ui.widgets/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.widgets/META-INF/MANIFEST.MF
index 1ae6039..b9901f1 100644
--- a/bundles/org.eclipse.e4.ui.widgets/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.widgets/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.e4.ui.widgets
-Bundle-Version: 0.12.3.qualifier
+Bundle-Version: 0.12.100.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.e4.ui.widgets
Require-Bundle: org.eclipse.swt;bundle-version="[3.6.0,4.0.0)"
diff --git a/bundles/org.eclipse.e4.ui.widgets/pom.xml b/bundles/org.eclipse.e4.ui.widgets/pom.xml
index 454381a..da04a9c 100644
--- a/bundles/org.eclipse.e4.ui.widgets/pom.xml
+++ b/bundles/org.eclipse.e4.ui.widgets/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.e4.ui.widgets</artifactId>
- <version>0.12.3-SNAPSHOT</version>
+ <version>0.12.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.e4.ui.workbench.addons.swt/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.workbench.addons.swt/META-INF/MANIFEST.MF
index 2dd85de..a642351 100644
--- a/bundles/org.eclipse.e4.ui.workbench.addons.swt/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.workbench.addons.swt/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.e4.ui.workbench.addons.swt;singleton:=true
-Bundle-Version: 0.10.3.qualifier
+Bundle-Version: 0.11.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -18,7 +18,8 @@
org.eclipse.swt;bundle-version="[3.7.0,4.0.0)",
org.eclipse.jface;bundle-version="[3.7.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
- org.eclipse.e4.ui.di;bundle-version="0.10.0"
+ org.eclipse.e4.ui.di;bundle-version="0.10.0",
+ org.eclipse.e4.ui.services;bundle-version="0.10.2"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Import-Package: javax.annotation;version="1.0.0",
diff --git a/bundles/org.eclipse.e4.ui.workbench.addons.swt/pom.xml b/bundles/org.eclipse.e4.ui.workbench.addons.swt/pom.xml
index 55a9788..2ffe955 100644
--- a/bundles/org.eclipse.e4.ui.workbench.addons.swt/pom.xml
+++ b/bundles/org.eclipse.e4.ui.workbench.addons.swt/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.e4.ui.workbench.addons.swt</artifactId>
- <version>0.10.3-SNAPSHOT</version>
+ <version>0.11.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/DnDManager.java b/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/DnDManager.java
index 8376f4f..0894260 100644
--- a/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/DnDManager.java
+++ b/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/DnDManager.java
@@ -18,6 +18,7 @@
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
+import org.eclipse.e4.ui.services.IStylingEngine;
import org.eclipse.e4.ui.widgets.ImageBasedFrame;
import org.eclipse.e4.ui.workbench.IPresentationEngine;
import org.eclipse.e4.ui.workbench.UIEvents;
@@ -386,6 +387,10 @@
overlayFrame.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_GREEN));
overlayFrame.setAlpha(150);
+ IStylingEngine stylingEngine = dragWindow.getContext().get(IStylingEngine.class);
+ stylingEngine.setClassname(overlayFrame, "DragFeedback");
+ stylingEngine.style(overlayFrame);
+
overlayFrame.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
for (int i = 0; i < images.size(); i++) {
diff --git a/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/SplitFeedbackOverlay.java b/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/SplitFeedbackOverlay.java
index 38c889d..f23a84d 100644
--- a/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/SplitFeedbackOverlay.java
+++ b/bundles/org.eclipse.e4.ui.workbench.addons.swt/src/org/eclipse/e4/ui/workbench/addons/dndaddon/SplitFeedbackOverlay.java
@@ -10,6 +10,9 @@
*/
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer;
+import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
+import org.eclipse.e4.ui.services.IStylingEngine;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.graphics.Region;
@@ -26,6 +29,9 @@
private List<Rectangle> rects = new ArrayList<Rectangle>();
private Rectangle outerRect;
+ Boolean isModified = null;
+ private IStylingEngine stylingEngine;
+
public SplitFeedbackOverlay(Shell dragShell, Rectangle rect, int side, float pct,
boolean enclosed, boolean modified) {
outerRect = rect;
@@ -35,6 +41,9 @@
feedbackShell = new Shell(dragShell, SWT.NO_TRIM);
feedbackShell.setBounds(dragShell.getBounds());
+ MWindow winModel = (MWindow) dragShell.getData(AbstractPartRenderer.OWNING_ME);
+ stylingEngine = winModel.getContext().get(IStylingEngine.class);
+
// Show the appropriate feedback rectangles
setFeedback(enclosed, modified);
@@ -49,6 +58,7 @@
region.dispose();
feedbackShell.dispose();
}
+ feedbackShell = null;
}
private void showRects(boolean enclosed) {
@@ -110,10 +120,19 @@
}
public void setFeedback(boolean enclosed, boolean modified) {
- if (!modified)
- feedbackShell.setBackground(display.getSystemColor(SWT.COLOR_GREEN));
- else
- feedbackShell.setBackground(display.getSystemColor(SWT.COLOR_DARK_YELLOW));
+ if (isModified == null)
+ isModified = !modified;
+
+ // Update the feedback color if the drag is 'modified'
+ if (modified != isModified) {
+ if (!modified) {
+ stylingEngine.setClassname(feedbackShell, "DragFeedback");
+ } else {
+ stylingEngine.setClassname(feedbackShell, "ModifiedDragFeedback");
+ }
+ stylingEngine.style(feedbackShell);
+ isModified = modified;
+ }
showRects(enclosed);
defineRegion();
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt.cocoa/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.workbench.renderers.swt.cocoa/META-INF/MANIFEST.MF
index ce3937a..2b17577 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt.cocoa/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt.cocoa/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Eclipse-PlatformFilter: (osgi.ws=cocoa)
Bundle-SymbolicName: org.eclipse.e4.ui.workbench.renderers.swt.cocoa;singleton:=true
-Bundle-Version: 0.11.2.qualifier
+Bundle-Version: 0.11.100.qualifier
Bundle-Name: %fragmentName
Bundle-Vendor: %providerName
Fragment-Host: org.eclipse.e4.ui.workbench.renderers.swt;bundle-version="[0.10.0,1.0.0)"
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt.cocoa/pom.xml b/bundles/org.eclipse.e4.ui.workbench.renderers.swt.cocoa/pom.xml
index 7a0128f..73a5de1 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt.cocoa/pom.xml
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt.cocoa/pom.xml
@@ -22,7 +22,7 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.e4.ui.workbench.renderers.swt.cocoa</artifactId>
- <version>0.11.2-SNAPSHOT</version>
+ <version>0.11.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/.settings/org.eclipse.jdt.core.prefs
index 8d29e86..d080451 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/.settings/org.eclipse.jdt.core.prefs
@@ -38,7 +38,7 @@
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/META-INF/MANIFEST.MF
index 83310c7..255f8fc 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.e4.ui.workbench.renderers.swt;singleton:=true
-Bundle-Version: 0.10.3.qualifier
+Bundle-Version: 0.11.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/pom.xml b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/pom.xml
index e7c872b..7438185 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/pom.xml
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.e4.ui.workbench.renderers.swt</artifactId>
- <version>0.10.3-SNAPSHOT</version>
+ <version>0.11.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ElementReferenceRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ElementReferenceRenderer.java
index 2b049a0..5fce866 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ElementReferenceRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ElementReferenceRenderer.java
@@ -10,11 +10,12 @@
*******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
-import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import javax.inject.Inject;
+import javax.inject.Named;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.model.application.ui.MContext;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
@@ -30,23 +31,9 @@
* Create an element from a reference
*/
public class ElementReferenceRenderer extends SWTPartRenderer {
-
- private static Map<MUIElement, List<MPlaceholder>> renderedMap = new HashMap<MUIElement, List<MPlaceholder>>();
-
- /**
- * Get the list of all place holders that reference the given element
- *
- * @param element
- * The element to get place holders for
- * @return The list of rendered place holders (may be null)
- */
- public static List<MPlaceholder> getRenderedPlaceholders(MUIElement element) {
- List<MPlaceholder> mapVal = renderedMap.get(element);
- if (mapVal == null)
- return new ArrayList<MPlaceholder>();
-
- return mapVal;
- }
+ @Inject
+ @Named(WorkbenchRendererFactory.SHARED_ELEMENTS_STORE)
+ Map<MUIElement, Set<MPlaceholder>> renderedMap;
@Inject
IPresentationEngine renderingEngine;
@@ -56,9 +43,9 @@
final MUIElement ref = ph.getRef();
ref.setCurSharedRef(ph);
- List<MPlaceholder> renderedRefs = renderedMap.get(ref);
+ Set<MPlaceholder> renderedRefs = renderedMap.get(ref);
if (renderedRefs == null) {
- renderedRefs = new ArrayList<MPlaceholder>();
+ renderedRefs = new HashSet<MPlaceholder>();
renderedMap.put(ref, renderedRefs);
}
@@ -104,7 +91,7 @@
Control refCtrl = (Control) refElement.getWidget();
// Remove the element ref from the rendered list
- List<MPlaceholder> refs = renderedMap.get(refElement);
+ Set<MPlaceholder> refs = renderedMap.get(refElement);
refs.remove(ph);
IEclipseContext curContext = modelService.getContainingContext(ph);
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java
index 19ba782..b6d2319 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/HandledContributionItem.java
@@ -7,8 +7,8 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
- * Joseph Carroll <jdsalingerjr@gmail.com> - Bug 385414 Contributing wizards
- * to toolbar always displays icon and text
+ * Joseph Carroll <jdsalingerjr@gmail.com> - Bug 385414 Contributing wizards to toolbar always displays icon and text
+ * Snjezana Peco <snjezana.peco@redhat.com> - Memory leaks in Juno when opening and closing XML Editor - http://bugs.eclipse.org/397909
******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
@@ -656,6 +656,10 @@
private void handleWidgetDispose(Event event) {
if (event.widget == widget) {
+ if (unreferenceRunnable != null) {
+ unreferenceRunnable.run();
+ unreferenceRunnable = null;
+ }
unhookCheckListener();
toolItemUpdater.removeItem(this);
if (infoContext != null) {
@@ -886,4 +890,4 @@
public Widget getWidget() {
return widget;
}
-}
\ No newline at end of file
+}
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/LazyStackRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/LazyStackRenderer.java
index 2a0da0e..ba502d9 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/LazyStackRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/LazyStackRenderer.java
@@ -59,14 +59,13 @@
MUIElement oldSel = (MUIElement) event
.getProperty(UIEvents.EventTags.OLD_VALUE);
if (oldSel != null) {
- List<MUIElement> goingHidden = new ArrayList<MUIElement>();
- hideElementRecursive(oldSel, goingHidden);
+ hideElementRecursive(oldSel);
}
if (stack.getSelectedElement() != null)
lsr.showTab(stack.getSelectedElement());
}
- };;
+ };
public LazyStackRenderer() {
super();
@@ -152,15 +151,13 @@
protected void showTab(MUIElement element) {
// Now process any newly visible elements
- List<MUIElement> becomingVisible = new ArrayList<MUIElement>();
MUIElement curSel = element.getParent().getSelectedElement();
if (curSel != null) {
- showElementRecursive(curSel, becomingVisible);
+ showElementRecursive(curSel);
}
}
- private void hideElementRecursive(MUIElement element,
- List<MUIElement> goingHidden) {
+ private void hideElementRecursive(MUIElement element) {
if (element == null || element.getWidget() == null)
return;
@@ -181,34 +178,31 @@
element.setVisible(false);
}
- goingHidden.add(element);
-
if (element instanceof MGenericStack<?>) {
// For stacks only the currently selected elements are being hidden
MGenericStack<?> container = (MGenericStack<?>) element;
MUIElement curSel = container.getSelectedElement();
- hideElementRecursive(curSel, goingHidden);
+ hideElementRecursive(curSel);
} else if (element instanceof MElementContainer<?>) {
MElementContainer<?> container = (MElementContainer<?>) element;
for (MUIElement childElement : container.getChildren()) {
- hideElementRecursive(childElement, goingHidden);
+ hideElementRecursive(childElement);
}
// OK, now process detached windows
if (element instanceof MWindow) {
for (MWindow w : ((MWindow) element).getWindows()) {
- hideElementRecursive(w, goingHidden);
+ hideElementRecursive(w);
}
} else if (element instanceof MPerspective) {
for (MWindow w : ((MPerspective) element).getWindows()) {
- hideElementRecursive(w, goingHidden);
+ hideElementRecursive(w);
}
}
}
}
- private void showElementRecursive(MUIElement element,
- List<MUIElement> becomingVisible) {
+ private void showElementRecursive(MUIElement element) {
if (!element.isToBeRendered())
return;
@@ -267,8 +261,6 @@
element.setVisible(true);
}
- becomingVisible.add(element);
-
if (element instanceof MGenericStack<?>) {
// For stacks only the currently selected elements are being visible
MGenericStack<?> container = (MGenericStack<?>) element;
@@ -276,23 +268,23 @@
if (curSel == null && container.getChildren().size() > 0)
curSel = container.getChildren().get(0);
if (curSel != null)
- showElementRecursive(curSel, becomingVisible);
+ showElementRecursive(curSel);
} else if (element instanceof MElementContainer<?>) {
MElementContainer<?> container = (MElementContainer<?>) element;
List<MUIElement> kids = new ArrayList<MUIElement>(
container.getChildren());
for (MUIElement childElement : kids) {
- showElementRecursive(childElement, becomingVisible);
+ showElementRecursive(childElement);
}
// OK, now process detached windows
if (element instanceof MWindow) {
for (MWindow w : ((MWindow) element).getWindows()) {
- showElementRecursive(w, becomingVisible);
+ showElementRecursive(w);
}
} else if (element instanceof MPerspective) {
for (MWindow w : ((MPerspective) element).getWindows()) {
- showElementRecursive(w, becomingVisible);
+ showElementRecursive(w);
}
}
}
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerHideProcessor.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerHideProcessor.java
index f066a6d..4b68142 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerHideProcessor.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerHideProcessor.java
@@ -10,9 +10,16 @@
*******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
+import java.util.ArrayList;
+import java.util.List;
import javax.inject.Inject;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.EclipseContextFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.ui.di.AboutToHide;
+import org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution;
import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
import org.eclipse.e4.ui.model.application.ui.menu.MPopupMenu;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.swt.factories.IRendererFactory;
@@ -44,6 +51,8 @@
* @see
* org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface
* .action.IMenuManager)
+ *
+ * SWT.Hide pre-processing method for MenuManager
*/
public void menuAboutToShow(IMenuManager manager) {
if (!(manager instanceof MenuManager)) {
@@ -55,6 +64,49 @@
if (menuModel instanceof MPopupMenu) {
hidePopup(menu, (MPopupMenu) menuModel, menuManager);
}
+ if (menuModel != null && menu != null)
+ processDynamicElements(menu, menuModel);
+ }
+
+ /**
+ * Process dynamic menu contributions provided by
+ * {@link MDynamicMenuContribution} application model elements
+ *
+ * @param menu
+ * @param menuModel
+ *
+ */
+ private void processDynamicElements(Menu menu, final MMenu menuModel) {
+ if (!menu.isDisposed()) {
+ menu.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+
+ MMenuElement[] ml = menuModel.getChildren().toArray(
+ new MMenuElement[menuModel.getChildren().size()]);
+ for (int i = 0; i < ml.length; i++) {
+
+ MMenuElement currentMenuElement = ml[i];
+ if (currentMenuElement instanceof MDynamicMenuContribution) {
+ Object contribution = ((MDynamicMenuContribution) currentMenuElement)
+ .getObject();
+
+ IEclipseContext dynamicMenuContext = EclipseContextFactory
+ .create();
+ @SuppressWarnings("unchecked")
+ ArrayList<MMenuElement> mel = (ArrayList<MMenuElement>) currentMenuElement
+ .getTransientData()
+ .get(MenuManagerShowProcessor.DYNAMIC_ELEMENT_STORAGE_KEY);
+ dynamicMenuContext.set(List.class, mel);
+ ContextInjectionFactory.invoke(contribution,
+ AboutToHide.class, dynamicMenuContext);
+ }
+
+ }
+
+ }
+ });
+ }
+
}
/*
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java
index f4d21bf..c5f3bef 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Marco Descher <descher@medevit.at> - Bug 389063 Dynamic Menu Contribution
*******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
@@ -36,6 +37,7 @@
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
+import org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution;
@@ -946,4 +948,22 @@
menuManager.markDirty();
}
}
+
+ /**
+ * Clean dynamic menu contributions provided by
+ * {@link MDynamicMenuContribution} application model elements
+ *
+ * @param menuManager
+ * @param menuModel
+ * @param dump
+ */
+ public void removeDynamicMenuContributions(MenuManager menuManager,
+ MMenu menuModel, ArrayList<MMenuElement> dump) {
+ removeMenuContributions(menuModel, dump);
+ for (MMenuElement mMenuElement : dump) {
+ IContributionItem ici = getContribution(mMenuElement);
+ menuManager.remove(ici);
+ clearModelToContribution(menuModel, ici);
+ }
+ }
}
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerShowProcessor.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerShowProcessor.java
index e10afdd..b22cb04 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerShowProcessor.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerShowProcessor.java
@@ -7,17 +7,27 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Marco Descher <marco@descher.at> - Bug 389063 Dynamic Menu Contribution
*******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import javax.inject.Inject;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.EclipseContextFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.services.contributions.IContributionFactory;
+import org.eclipse.e4.ui.di.AboutToShow;
import org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer;
import org.eclipse.e4.ui.internal.workbench.swt.Policy;
import org.eclipse.e4.ui.internal.workbench.swt.WorkbenchSWTActivator;
import org.eclipse.e4.ui.model.application.ui.MContext;
+import org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution;
import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
import org.eclipse.e4.ui.model.application.ui.menu.MPopupMenu;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.swt.factories.IRendererFactory;
@@ -49,6 +59,9 @@
@Inject
private MenuManagerRenderer renderer;
+ @Inject
+ private IContributionFactory contributionFactory;
+
private HashMap<Menu, Runnable> pendingCleanup = new HashMap<Menu, Runnable>();
/*
@@ -65,6 +78,7 @@
MenuManager menuManager = (MenuManager) manager;
final MMenu menuModel = renderer.getMenuModel(menuManager);
final Menu menu = menuManager.getMenu();
+
if (menuModel != null && menuManager != null) {
cleanUp(menu, menuModel, menuManager);
}
@@ -89,6 +103,8 @@
* @see
* org.eclipse.jface.action.IMenuListener2#menuAboutToHide(org.eclipse.jface
* .action.IMenuManager)
+ *
+ * SWT.Show post processing method for MenuManager
*/
public void menuAboutToHide(IMenuManager manager) {
if (!(manager instanceof MenuManager)) {
@@ -98,10 +114,81 @@
final MMenu menuModel = renderer.getMenuModel(menuManager);
final Menu menu = menuManager.getMenu();
if (menuModel != null) {
+ processDynamicElements(menuModel, menuManager);
showMenu(menu, menuModel, menuManager);
}
}
+ /**
+ * HashMap key for storage of {@link MDynamicMenuContribution} elements used
+ * in {@link #processDynamicElements(MMenu, MenuManager)}
+ */
+ protected static final String DYNAMIC_ELEMENT_STORAGE_KEY = MenuManagerShowProcessor.class
+ .getSimpleName() + ".dynamicElements"; //$NON-NLS-1$
+
+ /**
+ * Process dynamic menu contributions provided by
+ * {@link MDynamicMenuContribution} application model elements
+ *
+ * @param menuModel
+ * @param menuManager
+ *
+ */
+ private void processDynamicElements(MMenu menuModel, MenuManager menuManager) {
+ MMenuElement[] ml = menuModel.getChildren().toArray(
+ new MMenuElement[menuModel.getChildren().size()]);
+ for (int i = 0; i < ml.length; i++) {
+
+ MMenuElement currentMenuElement = ml[i];
+ if (currentMenuElement instanceof MDynamicMenuContribution) {
+ Object contribution = ((MDynamicMenuContribution) currentMenuElement)
+ .getObject();
+ if (contribution == null) {
+ IEclipseContext context = modelService
+ .getContainingContext(menuModel);
+ contribution = contributionFactory.create(
+ ((MDynamicMenuContribution) currentMenuElement)
+ .getContributionURI(), context);
+ ((MDynamicMenuContribution) currentMenuElement)
+ .setObject(contribution);
+ }
+
+ IEclipseContext dynamicMenuContext = EclipseContextFactory
+ .create();
+ ArrayList<MMenuElement> mel = new ArrayList<MMenuElement>();
+ dynamicMenuContext.set(List.class, mel);
+ ContextInjectionFactory.invoke(contribution, AboutToShow.class,
+ dynamicMenuContext);
+
+ // remove existing entries for this dynamic contribution item if
+ // there are any
+ Map<String, Object> storageMap = currentMenuElement
+ .getTransientData();
+ @SuppressWarnings("unchecked")
+ ArrayList<MMenuElement> dump = (ArrayList<MMenuElement>) storageMap
+ .get(DYNAMIC_ELEMENT_STORAGE_KEY);
+ if (dump != null && dump.size() > 0)
+ renderer.removeDynamicMenuContributions(menuManager,
+ menuModel, dump);
+
+ storageMap.remove(DYNAMIC_ELEMENT_STORAGE_KEY);
+
+ // ensure that each element of the list has a valid element id
+ // and set the parent of the entries
+ for (int j = 0; j < mel.size(); j++) {
+ MMenuElement menuElement = mel.get(j);
+ if (menuElement.getElementId() == null
+ || menuElement.getElementId().length() < 1)
+ menuElement.setElementId(currentMenuElement
+ .getElementId() + "." + j); //$NON-NLS-1$
+ menuElement.setParent(currentMenuElement.getParent());
+ renderer.modelProcessSwitch(menuManager, menuElement);
+ }
+ storageMap.put(DYNAMIC_ELEMENT_STORAGE_KEY, mel);
+ }
+ }
+ }
+
private void cleanUp(final Menu menu, MMenu menuModel,
MenuManager menuManager) {
trace("cleanUp", menu, null); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
index f8f5fc5..10976b9 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
@@ -10,11 +10,14 @@
*******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
-import java.util.LinkedList;
+import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
+import javax.inject.Named;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.services.events.IEventBroker;
@@ -94,6 +97,9 @@
import org.w3c.dom.css.CSSValue;
public class StackRenderer extends LazyStackRenderer {
+ @Inject
+ @Named(WorkbenchRendererFactory.SHARED_ELEMENTS_STORE)
+ Map<MUIElement, Set<MPlaceholder>> renderedMap;
public static final String TAG_VIEW_MENU = "ViewMenu"; //$NON-NLS-1$
private static final String SHELL_CLOSE_EDITORS_MENU = "shell_close_editors_menu"; //$NON-NLS-1$
@@ -369,14 +375,16 @@
// Do we have any stacks with place holders for the element
// that's changed?
- List<MPlaceholder> refs = ElementReferenceRenderer
- .getRenderedPlaceholders(part);
- for (MPlaceholder ref : refs) {
- MElementContainer<MUIElement> refParent = ref.getParent();
- if (refParent.getRenderer() instanceof StackRenderer) {
- CTabItem cti = findItemForPart(ref, refParent);
- if (cti != null) {
- updateTab(cti, part, attName, newValue);
+ Set<MPlaceholder> refs = renderedMap.get(part);
+ if (refs != null) {
+ for (MPlaceholder ref : refs) {
+ MElementContainer<MUIElement> refParent = ref
+ .getParent();
+ if (refParent.getRenderer() instanceof StackRenderer) {
+ CTabItem cti = findItemForPart(ref, refParent);
+ if (cti != null) {
+ updateTab(cti, part, attName, newValue);
+ }
}
}
}
@@ -1313,6 +1321,7 @@
final Menu menu = cachedMenu;
+ int closeableElements = 0;
if (isClosable(part)) {
MenuItem menuItemClose = new MenuItem(menu, SWT.NONE);
menuItemClose.setText(SWTRenderersMessages.menuClose);
@@ -1325,40 +1334,31 @@
partService.hidePart(part);
}
});
+ closeableElements++;
}
MElementContainer<MUIElement> parent = getParent(part);
if (parent != null) {
- int count = 0;
- for (MUIElement element : parent.getChildren()) {
- if (element.isToBeRendered()) {
- count++;
- if (count == 2) {
- MenuItem menuItemOthers = new MenuItem(menu, SWT.NONE);
- menuItemOthers
- .setText(SWTRenderersMessages.menuCloseOthers);
- menuItemOthers
- .addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- MPart part = (MPart) menu
- .getData(STACK_SELECTED_PART);
- closeSiblingParts(part, true);
- }
- });
+ closeableElements += getCloseableSiblingParts(part).size();
- MenuItem menuItemAll = new MenuItem(menu, SWT.NONE);
- menuItemAll.setText(SWTRenderersMessages.menuCloseAll);
- menuItemAll
- .addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- MPart part = (MPart) menu
- .getData(STACK_SELECTED_PART);
- closeSiblingParts(part, false);
- }
- });
- break;
+ if (closeableElements >= 2) {
+ MenuItem menuItemOthers = new MenuItem(menu, SWT.NONE);
+ menuItemOthers.setText(SWTRenderersMessages.menuCloseOthers);
+ menuItemOthers.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ MPart part = (MPart) menu.getData(STACK_SELECTED_PART);
+ closeSiblingParts(part, true);
}
- }
+ });
+
+ MenuItem menuItemAll = new MenuItem(menu, SWT.NONE);
+ menuItemAll.setText(SWTRenderersMessages.menuCloseAll);
+ menuItemAll.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ MPart part = (MPart) menu.getData(STACK_SELECTED_PART);
+ closeSiblingParts(part, false);
+ }
+ });
}
}
@@ -1374,14 +1374,20 @@
return parent;
}
- private void closeSiblingParts(MPart part, boolean skipThisPart) {
+ private List<MPart> getCloseableSiblingParts(MPart part) {
+ // broken out from closeSiblingParts so it can be used to determine how
+ // many closeable siblings are available
MElementContainer<MUIElement> container = getParent(part);
+ List<MPart> closeableSiblings = new ArrayList<MPart>();
if (container == null)
- return;
+ return closeableSiblings;
List<MUIElement> children = container.getChildren();
- List<MPart> others = new LinkedList<MPart>();
for (MUIElement child : children) {
+ // If the element isn't showing skip it
+ if (!child.isToBeRendered())
+ continue;
+
MPart otherPart = null;
if (child instanceof MPart)
otherPart = (MPart) child;
@@ -1396,8 +1402,17 @@
if (part.equals(otherPart))
continue; // skip selected item
if (otherPart.isToBeRendered() && isClosable(otherPart))
- others.add(otherPart);
+ closeableSiblings.add(otherPart);
}
+ return closeableSiblings;
+ }
+
+ private void closeSiblingParts(MPart part, boolean skipThisPart) {
+ MElementContainer<MUIElement> container = getParent(part);
+ if (container == null)
+ return;
+
+ List<MPart> others = getCloseableSiblingParts(part);
// add the current part last so that we unrender obscured items first
if (!skipThisPart && part.isToBeRendered() && isClosable(part)) {
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WorkbenchRendererFactory.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WorkbenchRendererFactory.java
index a8531a6..818da89 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WorkbenchRendererFactory.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/WorkbenchRendererFactory.java
@@ -1,5 +1,7 @@
package org.eclipse.e4.ui.workbench.renderers.swt;
+import java.util.HashMap;
+import java.util.Set;
import javax.annotation.PostConstruct;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
@@ -22,7 +24,7 @@
import org.eclipse.e4.ui.workbench.swt.factories.IRendererFactory;
public class WorkbenchRendererFactory implements IRendererFactory {
-
+ public static final String SHARED_ELEMENTS_STORE = "org.eclipse.e4.ui.workbench.renderers.swt.SHARED_ELEMENTS_STORE"; //$NON-NLS-1$
private AreaRenderer areaRenderer;
private MenuManagerRenderer menuRenderer;
private ToolBarManagerRenderer toolbarRenderer;
@@ -136,6 +138,8 @@
@PostConstruct
public void init(IEclipseContext context) {
this.context = context;
+ this.context.set(SHARED_ELEMENTS_STORE,
+ new HashMap<MUIElement, Set<MPlaceholder>>());
}
}
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.workbench.swt/META-INF/MANIFEST.MF
index 010695b..52fb2a1 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.e4.ui.workbench.swt;singleton:=true
-Bundle-Version: 0.10.3.qualifier
+Bundle-Version: 0.12.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/pom.xml b/bundles/org.eclipse.e4.ui.workbench.swt/pom.xml
index d4bf89f..96b5b03 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/pom.xml
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.e4.ui.workbench.swt</artifactId>
- <version>0.10.3-SNAPSHOT</version>
+ <version>0.12.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java
index 7dc8292..2024cc5 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java
@@ -620,8 +620,6 @@
for (String key : props.keySet()) {
lclContext.set(key, props.get(key));
}
-
- E4Workbench.processHierarchy(element);
}
}
@@ -734,6 +732,7 @@
private Shell getLimboShell() {
if (limbo == null) {
limbo = new Shell(Display.getCurrent(), SWT.NONE);
+ limbo.setText("PartRenderingEngine's limbo"); //$NON-NLS-1$ // just for debugging, not shown anywhere
// Place the limbo shell 'off screen'
limbo.setLocation(0, 10000);
@@ -997,8 +996,13 @@
// torn down
IApplicationContext ac = appContext
.get(IApplicationContext.class);
- if (ac != null)
+ if (ac != null) {
ac.applicationRunning();
+ if (eventBroker != null)
+ eventBroker.post(
+ UIEvents.UILifeCycle.APP_STARTUP_COMPLETE,
+ theApp);
+ }
} else if (uiRoot instanceof MUIElement) {
if (uiRoot instanceof MWindow) {
testShell = (Shell) createGui((MUIElement) uiRoot);
diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/WorkbenchStatusReporter.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/WorkbenchStatusReporter.java
index 99983ed..7e55b8e 100644
--- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/WorkbenchStatusReporter.java
+++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/WorkbenchStatusReporter.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Sopot Cela (sopotcela@gmail.com) Bug 386022 - Title of ErrorDialog in WorkbenchStatusReporter should be externalized
******************************************************************************/
package org.eclipse.e4.ui.internal.workbench.swt;
@@ -18,6 +19,7 @@
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.services.log.Logger;
import org.eclipse.e4.core.services.statusreporter.StatusReporter;
+import org.eclipse.e4.ui.workbench.swt.internal.copy.WorkbenchSWTMessages;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.window.IShellProvider;
import org.eclipse.swt.SWT;
@@ -104,7 +106,7 @@
myShell = new Shell();
}
- dialog = new ErrorDialog(myShell, "Internal Error",
+ dialog = new ErrorDialog(myShell, WorkbenchSWTMessages.InternalError,
status.getMessage(),
status.getException() != null ? exceptionStatus : status, ERROR
| WARNING | INFO) {
diff --git a/bundles/org.eclipse.e4.ui.workbench/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.e4.ui.workbench/.settings/org.eclipse.jdt.core.prefs
index 72dedf6..a244b01 100644
--- a/bundles/org.eclipse.e4.ui.workbench/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.e4.ui.workbench/.settings/org.eclipse.jdt.core.prefs
@@ -143,7 +143,7 @@
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
diff --git a/bundles/org.eclipse.e4.ui.workbench/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.workbench/META-INF/MANIFEST.MF
index 1bf44b9..b9bb74e 100644
--- a/bundles/org.eclipse.e4.ui.workbench/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.workbench/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.eclipse.e4.ui.workbench;singleton:=true
-Bundle-Version: 0.11.0.qualifier
+Bundle-Version: 0.12.0.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.e4.ui.workbench/pom.xml b/bundles/org.eclipse.e4.ui.workbench/pom.xml
index 36e127b..2080ec0 100644
--- a/bundles/org.eclipse.e4.ui.workbench/pom.xml
+++ b/bundles/org.eclipse.e4.ui.workbench/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.e4.ui.workbench</artifactId>
- <version>0.11.0-SNAPSHOT</version>
+ <version>0.12.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java
index fc78a1c..ae30b84 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/E4Workbench.java
@@ -11,21 +11,14 @@
******************************************************************************/
package org.eclipse.e4.ui.internal.workbench;
-import java.util.Iterator;
import java.util.List;
-import org.eclipse.e4.core.commands.EHandlerService;
import org.eclipse.e4.core.contexts.EclipseContextFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.services.contributions.IContributionFactory;
import org.eclipse.e4.core.services.log.Logger;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.MApplicationElement;
-import org.eclipse.e4.ui.model.application.commands.MCommand;
-import org.eclipse.e4.ui.model.application.commands.MHandler;
-import org.eclipse.e4.ui.model.application.commands.MHandlerContainer;
import org.eclipse.e4.ui.model.application.ui.MContext;
-import org.eclipse.e4.ui.model.application.ui.MElementContainer;
-import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.workbench.IPresentationEngine;
import org.eclipse.e4.ui.workbench.IWorkbench;
import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
@@ -114,8 +107,6 @@
if (context != null) {
context.set(ExpressionContext.ALLOW_ACTIVATION, Boolean.TRUE);
}
- // Do a top level processHierarchy for the application?
- processHierarchy(appElement);
}
/**
@@ -151,38 +142,6 @@
return appModel;
}
- public static void processHierarchy(Object me) {
- if (me instanceof MHandlerContainer) {
- MContext contextModel = (MContext) me;
- MHandlerContainer container = (MHandlerContainer) contextModel;
- IEclipseContext context = contextModel.getContext();
- if (context != null) {
- IContributionFactory cf = (IContributionFactory) context
- .get(IContributionFactory.class.getName());
- EHandlerService hs = (EHandlerService) context.get(EHandlerService.class.getName());
- List<MHandler> handlers = container.getHandlers();
- for (MHandler handler : handlers) {
- MCommand command = handler.getCommand();
- if (command == null)
- continue;
- String commandId = command.getElementId();
- if (handler.getObject() == null) {
- handler.setObject(cf.create(handler.getContributionURI(), context));
- }
- hs.activateHandler(commandId, handler.getObject());
- }
- }
- }
- if (me instanceof MElementContainer<?>) {
- List<MUIElement> children = ((MElementContainer) me).getChildren();
- Iterator<MUIElement> i = children.iterator();
- while (i.hasNext()) {
- MUIElement e = i.next();
- processHierarchy(e);
- }
- }
- }
-
/**
* Create the context chain. It both creates the chain for the current model, and adds eAdapters
* so it can add new contexts when new model items are added.
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/addons/HandlerProcessingAddon.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/addons/HandlerProcessingAddon.java
new file mode 100644
index 0000000..c2859c4
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/addons/HandlerProcessingAddon.java
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ * 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
+ * Sopot Cela - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.e4.ui.internal.workbench.addons;
+
+import java.util.List;
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.inject.Inject;
+import org.eclipse.e4.core.commands.EHandlerService;
+import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.services.contributions.IContributionFactory;
+import org.eclipse.e4.core.services.events.IEventBroker;
+import org.eclipse.e4.ui.model.application.MApplication;
+import org.eclipse.e4.ui.model.application.commands.MCommand;
+import org.eclipse.e4.ui.model.application.commands.MHandler;
+import org.eclipse.e4.ui.model.application.commands.MHandlerContainer;
+import org.eclipse.e4.ui.model.application.ui.MContext;
+import org.eclipse.e4.ui.workbench.UIEvents;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.osgi.service.event.Event;
+import org.osgi.service.event.EventHandler;
+
+/**
+ * Process the additions and removals of handlers on the model
+ */
+public class HandlerProcessingAddon {
+
+ private EventHandler eventHandler;
+ private EventHandler contextHandler;
+
+ @Inject
+ private IEventBroker eventBroker;
+
+ /**
+ * Registers the listeners
+ *
+ * @param application
+ * @param modelService
+ */
+ @PostConstruct
+ public void postConstruct(MApplication application, EModelService modelService) {
+ List<MHandlerContainer> findElements = modelService.findElements(application, null,
+ MHandlerContainer.class, null);
+ for (MHandlerContainer mHandlerContainer : findElements) {
+ for (MHandler mHandler : mHandlerContainer.getHandlers()) {
+ MContext mContext = (MContext) mHandlerContainer;
+ IEclipseContext context = mContext.getContext();
+ if (context != null) {
+ processActiveHandler(mHandler, context);
+ }
+ }
+ }
+
+ registerModelListeners();
+ }
+
+ private void registerModelListeners() {
+ eventHandler = new EventHandler() {
+ public void handleEvent(Event event) {
+ if ((event.getProperty(UIEvents.EventTags.ELEMENT) instanceof MHandlerContainer)) {
+ MHandlerContainer handlerContainer = (MHandlerContainer) event
+ .getProperty(UIEvents.EventTags.ELEMENT);
+ if (UIEvents.EventTypes.ADD.equals(event.getProperty(UIEvents.EventTags.TYPE))) {
+ if (event.getProperty(UIEvents.EventTags.NEW_VALUE) instanceof MHandler) {
+ MHandler handler = (MHandler) event
+ .getProperty(UIEvents.EventTags.NEW_VALUE);
+ MContext mContext = (MContext) handlerContainer;
+ IEclipseContext context = mContext.getContext();
+ if (context != null) {
+ processActiveHandler(handler, context);
+ }
+ }
+ } else if (UIEvents.EventTypes.REMOVE.equals(event
+ .getProperty(UIEvents.EventTags.TYPE))) {
+ if (event.getProperty(UIEvents.EventTags.OLD_VALUE) instanceof MHandler) {
+ MHandler handler = (MHandler) event
+ .getProperty(UIEvents.EventTags.OLD_VALUE);
+ MContext mContext = (MContext) handlerContainer;
+ IEclipseContext context = mContext.getContext();
+ if (context != null) {
+ MCommand command = handler.getCommand();
+ if (command != null) {
+ String commandId = command.getElementId();
+ EHandlerService handlerService = (EHandlerService) context
+ .get(EHandlerService.class.getName());
+ handlerService
+ .deactivateHandler(commandId, handler.getObject());
+ }
+ }
+ }
+
+ }
+
+ }
+
+ }
+ };
+
+ contextHandler = new EventHandler() {
+
+ public void handleEvent(Event event) {
+ Object origin = event.getProperty(UIEvents.EventTags.ELEMENT);
+ Object context = event.getProperty(UIEvents.EventTags.NEW_VALUE);
+ if ((origin instanceof MHandlerContainer)
+ && (UIEvents.EventTypes.SET.equals(event
+ .getProperty(UIEvents.EventTags.TYPE)) && context instanceof IEclipseContext)) {
+ MHandlerContainer handlerContainer = (MHandlerContainer) origin;
+ IEclipseContext castedContext = (IEclipseContext) context;
+ for (MHandler mHandler : handlerContainer.getHandlers()) {
+ processActiveHandler(mHandler, castedContext);
+ }
+
+ }
+
+ }
+ };
+ eventBroker.subscribe(UIEvents.HandlerContainer.TOPIC_HANDLERS, eventHandler);
+ eventBroker.subscribe(UIEvents.Context.TOPIC_CONTEXT, contextHandler);
+ }
+
+ /**
+ * Clean up
+ */
+ @PreDestroy
+ public void preDestroy() {
+ unregisterModelListeners();
+ }
+
+ /**
+ * Unregisters the listeners
+ */
+ private void unregisterModelListeners() {
+ eventBroker.unsubscribe(eventHandler);
+ eventBroker.unsubscribe(contextHandler);
+ }
+
+ /**
+ * @param handler
+ * @param context
+ */
+ private void processActiveHandler(MHandler handler, IEclipseContext context) {
+ MCommand command = handler.getCommand();
+ if (command != null) {
+ String commandId = command.getElementId();
+ if (handler.getObject() == null) {
+ IContributionFactory contributionFactory = (IContributionFactory) context
+ .get(IContributionFactory.class.getName());
+ handler.setObject(contributionFactory.create(handler.getContributionURI(), context));
+ }
+ EHandlerService handlerService = (EHandlerService) context.get(EHandlerService.class
+ .getName());
+ handlerService.activateHandler(commandId, handler.getObject());
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/UIEvents.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/UIEvents.java
index a9135ff..2bd62a5 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/UIEvents.java
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/UIEvents.java
@@ -239,6 +239,10 @@
* Sent when a perspective is opened
*/
public static final String PERSPECTIVE_OPENED = TOPIC + TOPIC_SEP + "perspOpened"; //$NON-NLS-1$
+ /**
+ * Sent when application startup is complete
+ */
+ public static final String APP_STARTUP_COMPLETE = TOPIC + TOPIC_SEP + "appStartupComplete"; //$NON-NLS-1$
}
/**
diff --git a/bundles/org.eclipse.jface.databinding/META-INF/MANIFEST.MF b/bundles/org.eclipse.jface.databinding/META-INF/MANIFEST.MF
index 47b97f9..31cceb7 100644
--- a/bundles/org.eclipse.jface.databinding/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.jface.databinding/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jface.databinding
-Bundle-Version: 1.6.0.qualifier
+Bundle-Version: 1.6.200.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -24,6 +24,5 @@
org.eclipse.core.databinding.observable;bundle-version="[1.3.0,2.0.0)",
org.eclipse.core.databinding.property;bundle-version="[1.3.0,2.0.0)",
org.eclipse.core.databinding;bundle-version="[1.2.0,2.0.0)"
-Import-Package: com.ibm.icu.text
Bundle-RequiredExecutionEnvironment: CDC-1.0/Foundation-1.0,
J2SE-1.3
diff --git a/bundles/org.eclipse.jface.databinding/pom.xml b/bundles/org.eclipse.jface.databinding/pom.xml
index 0042880..0c09b6d 100644
--- a/bundles/org.eclipse.jface.databinding/pom.xml
+++ b/bundles/org.eclipse.jface.databinding/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.jface.databinding</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.6.200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.jface/META-INF/MANIFEST.MF b/bundles/org.eclipse.jface/META-INF/MANIFEST.MF
index 47d8dbe..0756cef 100644
--- a/bundles/org.eclipse.jface/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.jface/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jface
-Bundle-Version: 3.8.102.qualifier
+Bundle-Version: 3.8.300.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.jface/pom.xml b/bundles/org.eclipse.jface/pom.xml
index 0de1d57..b06c3d6 100644
--- a/bundles/org.eclipse.jface/pom.xml
+++ b/bundles/org.eclipse.jface/pom.xml
@@ -21,7 +21,7 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.jface</artifactId>
- <version>3.8.102-SNAPSHOT</version>
+ <version>3.8.300-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/Action.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/Action.java
index 5be541b..9a378d6 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/Action.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/Action.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* 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
@@ -164,7 +164,8 @@
/**
* Convenience method for removing any optional accelerator text from the
* given string. The accelerator text appears at the end of the text, and is
- * separated from the main part by a single tab character <code>'\t'</code>.
+ * separated from the main part by the last tab character <code>'\t'</code>
+ * (or the last <code>'@'</code> if there is no tab).
*
* @param text
* the text
@@ -636,22 +637,8 @@
}
}
- /**
- * Sets the text for this action.
- * <p>
- * Fires a property change event for the <code>TEXT</code> property if the
- * text actually changes as a consequence.
- * </p>
- * <p>
- * The accelerator is identified by the last index of a tab character. If
- * there are no tab characters, then it is identified by the last index of a
- * '@' character. If neither, then there is no accelerator text. Note that
- * if you want to insert a '@' character into the text (but no accelerator,
- * you can simply insert a '@' or a tab at the end of the text.
- * </p>
- *
- * @param text
- * the text, or <code>null</code> if none
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.action.IAction#setText(java.lang.String)
*/
public void setText(String text) {
String oldText = this.text;
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IAction.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IAction.java
index 91cbb21..d48a75c 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IAction.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* 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
@@ -472,8 +472,13 @@
/**
* Sets the text for this action.
* <p>
- * An accelerator specification may follow the actual text, separated from it by
- * an '@' or a '\t' character. An accelerator specification consists of zero or more
+ * An accelerator is identified by the last index of a '\t' character. If
+ * there are no '\t' characters, then it is identified by the last index of an
+ * '@' character. If neither, then there is no accelerator text. Note that
+ * if you want to insert an '@' character into the text (but no accelerator),
+ * then you can simply insert an '@' or a '\t' at the end of the text.
+ * <br>
+ * An accelerator specification consists of zero or more
* modifier tokens followed by a key code token. The tokens are separated by a '+' character.
* </p>
* <p>
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionManager.java
index e63cf89..58cf769 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionManager.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 IBM Corporation and others.
* 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
@@ -212,6 +212,9 @@
/**
* Removes all contribution items from this manager.
+ * <p>
+ * <strong>Note:</strong> The items will not get disposed.
+ * </p>
*/
public void removeAll();
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/LegacyActionTools.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/LegacyActionTools.java
index 0650a59..ff78c44 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/LegacyActionTools.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/LegacyActionTools.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 IBM Corporation and others.
* 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
@@ -15,10 +15,9 @@
import java.util.Map;
import java.util.StringTokenizer;
-import org.eclipse.swt.SWT;
-
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.Util;
+import org.eclipse.swt.SWT;
/**
* <p>
@@ -183,7 +182,8 @@
/**
* Extracts the accelerator text from the given text. Returns
* <code>null</code> if there is no accelerator text, and the empty string
- * if there is no text after the accelerator delimeter (tab or '@').
+ * if there is no text after the accelerator delimiter (last tab or
+ * last '@' if there's no tab).
*
* @param text
* the text for the action; may be <code>null</code>.
@@ -705,7 +705,8 @@
/**
* Convenience method for removing any optional accelerator text from the
* given string. The accelerator text appears at the end of the text, and is
- * separated from the main part by a single tab character <code>'\t'</code>.
+ * separated from the main part by the last tab character <code>'\t'</code>
+ * (or the last <code>'@'</code> if there is no tab).
*
* @param text
* the text
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/MenuManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/MenuManager.java
index 2c40cc4..df59cf8 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/MenuManager.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/MenuManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 IBM Corporation and others.
* 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
@@ -215,10 +215,10 @@
}
/**
- * Disposes of this menu manager and frees all allocated SWT resources.
- * Notifies all contribution items of the dispose. Note that this method does
- * not clean up references between this menu manager and its associated
- * contribution items. Use <code>removeAll</code> for that purpose.
+ * Disposes of this menu manager and frees all allocated SWT resources. Notifies all
+ * contribution items of the dispose. Note that this method does not clean up references between
+ * this menu manager and its associated contribution items. Use {@link #removeAll()} for that
+ * purpose, but note that will not dispose the items.
*/
public void dispose() {
if (menuExist()) {
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java
index 89702a3..9617c2c 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* 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
@@ -50,9 +50,13 @@
* confusing for the user.
* </p>
* <p>
- * If there is more than one modal dialog is open the second one should be
- * parented off of the shell of the first one otherwise it is possible that the
- * OS will give focus to the first dialog potentially blocking the UI.
+ * If more than one modal dialog is open, the second one should be
+ * parented off of the shell of the first one. Otherwise, it is possible that the
+ * OS will give focus to the first dialog, potentially blocking the UI.
+ * </p>
+ * <p>
+ * This class also moves the default button to the right if required, see
+ * {@link #initializeBounds()}.
* </p>
*/
public abstract class Dialog extends Window {
@@ -682,6 +686,10 @@
* <code>getCancelButton</code>, and <code>getOKButton</code>.
* Subclasses may override.
* </p>
+ * <p>
+ * Note: The common button order is: <b>{other buttons}</b>, <b>OK</b>, <b>Cancel</b>.
+ * On some platforms, {@link #initializeBounds()} will move the default button to the right.
+ * </p>
*
* @param parent
* the button bar composite
@@ -694,8 +702,15 @@
IDialogConstants.CANCEL_LABEL, false);
}
- /*
- * @see Window.initializeBounds()
+ /**
+ * {@inheritDoc}
+ * <p>
+ * The implementation in {@link #Dialog} also moves the
+ * {@link Shell#getDefaultButton() default button} in the
+ * {@link #createButtonBar(Composite) button bar} to the right
+ * if that's required by the
+ * {@link Display#getDismissalAlignment() platform convention}.
+ * </p>
*/
protected void initializeBounds() {
Shell shell = getShell();
@@ -706,7 +721,7 @@
if (defaultButton != null
&& isContained(buttonBar, defaultButton)) {
defaultButton.moveBelow(null);
- ((Composite) buttonBar).layout();
+ defaultButton.getParent().layout();
}
}
}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java
index d986f37..f2baf1c 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* 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
@@ -14,10 +14,6 @@
*******************************************************************************/
package org.eclipse.jface.dialogs;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.Policy;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
@@ -37,6 +33,12 @@
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.util.Policy;
+
/**
* A dialog to display one or more errors to the user, as contained in an
* <code>IStatus</code> object. If an error contains additional detailed
@@ -473,7 +475,6 @@
}
Throwable t = buildingStatus.getException();
- boolean isCoreException = t instanceof CoreException;
boolean incrementNesting = false;
if (includeStatus) {
@@ -487,7 +488,7 @@
incrementNesting = true;
}
- if (!isCoreException && t != null) {
+ if (!(t instanceof CoreException) && t != null) {
// Include low-level exception message
StringBuffer sb = new StringBuffer();
for (int i = 0; i < nesting; i++) {
@@ -508,7 +509,7 @@
}
// Look for a nested core exception
- if (isCoreException) {
+ if (t instanceof CoreException) {
CoreException ce = (CoreException) t;
IStatus eStatus = ce.getStatus();
// Only print the exception message if it is not contained in the
@@ -545,20 +546,18 @@
}
Throwable t = buildingStatus.getException();
- boolean isCoreException = t instanceof CoreException;
-
if (includeStatus) {
return true;
}
- if (!isCoreException && t != null) {
+ if (!(t instanceof CoreException) && t != null) {
return true;
}
boolean result = false;
// Look for a nested core exception
- if (isCoreException) {
+ if (t instanceof CoreException) {
CoreException ce = (CoreException) t;
IStatus eStatus = ce.getStatus();
// Gets exception message if it is not contained in the
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/StatusDialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/StatusDialog.java
index 7c7f436..32c08db 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/StatusDialog.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/StatusDialog.java
@@ -7,11 +7,13 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Rüdiger Herrmann - 395426: [JFace] StatusDialog should escape ampersand in status message
*******************************************************************************/
package org.eclipse.jface.dialogs;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.LegacyActionTools;
import org.eclipse.jface.resource.JFaceColors;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.Policy;
@@ -107,7 +109,7 @@
if (status != null && !status.isOK()) {
String message = status.getMessage();
if (message != null && message.length() > 0) {
- setText(message);
+ setText(LegacyActionTools.escapeMnemonics(message));
// unqualified call of setImage is too ambiguous for
// Foundation 1.0 compiler
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=140576
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTableViewer.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTableViewer.java
index ca71505..258d9f0 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTableViewer.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTableViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* 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
@@ -19,7 +19,6 @@
import java.util.Iterator;
import java.util.List;
-import org.eclipse.core.runtime.Assert;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.widgets.Control;
@@ -28,6 +27,8 @@
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Widget;
+import org.eclipse.core.runtime.Assert;
+
/**
* This is a widget independent class implementors of
* {@link org.eclipse.swt.widgets.Table} like widgets can use to provide a
@@ -1005,12 +1006,14 @@
if (count < size) {
System.arraycopy(indices, 0, indices = new int[count], 0, count);
}
- doDeselectAll();
- doSelect(indices);
- if (reveal && firstItem != null) {
- doShowItem(firstItem);
+ if (reveal) {
+ doSetSelection(indices);
+ } else {
+ doDeselectAll();
+ doSelect(indices);
}
+
}
/**
@@ -1280,20 +1283,18 @@
protected abstract void doDeselectAll();
/**
- * Sets the receiver's selection to be the given array of items. The current
- * selection is cleared before the new items are selected.
+ * Sets the receiver's selection to be the given array of items. The current selection is
+ * cleared before the new items are selected, and if necessary the receiver is scrolled to make
+ * the new selection visible.
* <p>
- * Items that are not in the receiver are ignored. If the receiver is
- * single-select and multiple items are specified, then all items are
- * ignored.
+ * Items that are not in the receiver are ignored. If the receiver is single-select and multiple
+ * items are specified, then all items are ignored.
* </p>
- *
- * @param items
- * the array of items
- *
- * @exception IllegalArgumentException -
- * if the array of items is null
- *
+ *
+ * @param items the array of items
+ *
+ * @exception IllegalArgumentException - if the array of items is null
+ *
* @since 3.3
*/
protected abstract void doSetSelection(Item[] items);
@@ -1308,20 +1309,18 @@
protected abstract void doShowSelection();
/**
- * Selects the items at the given zero-relative indices in the receiver. The
- * current selection is cleared before the new items are selected.
+ * Selects the items at the given zero-relative indices in the receiver. The current selection
+ * is cleared before the new items are selected, and if necessary the receiver is scrolled to
+ * make the new selection visible.
* <p>
- * Indices that are out of range and duplicate indices are ignored. If the
- * receiver is single-select and multiple indices are specified, then all
- * indices are ignored.
+ * Indices that are out of range and duplicate indices are ignored. If the receiver is
+ * single-select and multiple indices are specified, then all indices are ignored.
* </p>
- *
- * @param indices
- * the indices of the items to select
- *
- * @exception IllegalArgumentException -
- * if the array of indices is null
- *
+ *
+ * @param indices the indices of the items to select
+ *
+ * @exception IllegalArgumentException - if the array of indices is null
+ *
* @since 3.3
*/
protected abstract void doSetSelection(int[] indices);
diff --git a/bundles/org.eclipse.ui.browser/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.browser/META-INF/MANIFEST.MF
index bc9626c..2d053f9 100644
--- a/bundles/org.eclipse.ui.browser/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui.browser/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.ui.browser; singleton:=true
-Bundle-Version: 3.4.2.qualifier
+Bundle-Version: 3.4.100.qualifier
Bundle-Activator: org.eclipse.ui.internal.browser.WebBrowserUIPlugin
Bundle-Vendor: %Plugin.providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.ui.browser/pom.xml b/bundles/org.eclipse.ui.browser/pom.xml
index f2a5984..441679a 100644
--- a/bundles/org.eclipse.ui.browser/pom.xml
+++ b/bundles/org.eclipse.ui.browser/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.ui.browser</artifactId>
- <version>3.4.2-SNAPSHOT</version>
+ <version>3.4.100-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF
index 791f390..67da30f 100644
--- a/bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.ui.ide; singleton:=true
-Bundle-Version: 3.8.2.qualifier
+Bundle-Version: 3.9.0.qualifier
Bundle-ClassPath: e4-ide.jar,
.
Bundle-Activator: org.eclipse.ui.internal.ide.IDEWorkbenchPlugin
diff --git a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/NewWizardMenu.java b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/NewWizardMenu.java
index d437396..5d5efcc 100644
--- a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/NewWizardMenu.java
+++ b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/actions/NewWizardMenu.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 IBM Corporation and others.
* 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
@@ -32,6 +32,9 @@
/**
* A <code>NewWizardMenu</code> augments <code>BaseNewWizardMenu</code> with IDE-specific
* actions: New Project... (always shown) and New Example... (shown only if there are example wizards installed).
+ * <p>
+ * <strong>Note:</strong> Clients must dispose this menu when it is no longer required.
+ * </p>
*/
public class NewWizardMenu extends BaseNewWizardMenu {
@@ -42,6 +45,9 @@
/**
* Creates a new wizard shortcut menu for the IDE.
+ * <p>
+ * <strong>Note:</strong> Clients must dispose this menu when it is no longer required.
+ * </p>
*
* @param window
* the window containing the menu
@@ -53,6 +59,9 @@
/**
* Creates a new wizard shortcut menu for the IDE.
+ * <p>
+ * <strong>Note:</strong> Clients must dispose this menu when it is no longer required.
+ * </p>
*
* @param window
* the window containing the menu
@@ -75,6 +84,9 @@
* when the menu is no longer needed. This will unhook any perspective
* listeners.
* </p>
+ * <p>
+ * <strong>Note:</strong> Clients must dispose this menu when it is no longer required.
+ * </p>
*
* @param innerMgr the location for the shortcut menu contents
* @param window the window containing the menu
diff --git a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/dialogs/FilteredResourcesSelectionDialog.java b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/dialogs/FilteredResourcesSelectionDialog.java
index ea78f7a..d40dee2 100644
--- a/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/dialogs/FilteredResourcesSelectionDialog.java
+++ b/bundles/org.eclipse.ui.ide/extensions/org/eclipse/ui/dialogs/FilteredResourcesSelectionDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2012 IBM Corporation and others.
* 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
@@ -15,7 +15,6 @@
import java.io.StringReader;
import java.io.StringWriter;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
@@ -562,13 +561,30 @@
protected void fillContentProvider(AbstractContentProvider contentProvider,
ItemsFilter itemsFilter, IProgressMonitor progressMonitor)
throws CoreException {
- if (itemsFilter instanceof ResourceFilter)
- container.accept(new ResourceProxyVisitor(contentProvider,
- (ResourceFilter) itemsFilter, progressMonitor),
- IResource.NONE);
- if (progressMonitor != null)
- progressMonitor.done();
-
+ if (itemsFilter instanceof ResourceFilter) {
+ IResource[] members = container.members();
+ progressMonitor
+ .beginTask(
+ WorkbenchMessages.FilteredItemsSelectionDialog_searchJob_taskName,
+ members.length);
+
+ ResourceProxyVisitor visitor = new ResourceProxyVisitor(
+ contentProvider, (ResourceFilter) itemsFilter,
+ progressMonitor);
+
+ if (visitor.visit(container.createProxy())) {
+ for (int i= 0; i < members.length; i++) {
+ IResource member = members[i];
+ if (member.isAccessible())
+ member.accept(visitor, IResource.NONE);
+ progressMonitor.worked(1);
+ if (progressMonitor.isCanceled())
+ break;
+ }
+ }
+
+ }
+ progressMonitor.done();
}
/**
@@ -818,8 +834,6 @@
private IProgressMonitor progressMonitor;
- private List projects;
-
/**
* Creates new ResourceProxyVisitor instance.
*
@@ -835,14 +849,6 @@
this.proxyContentProvider = contentProvider;
this.resourceFilter = resourceFilter;
this.progressMonitor = progressMonitor;
- IResource[] resources = container.members();
- this.projects = new ArrayList(Arrays.asList(resources));
-
- if (progressMonitor != null)
- progressMonitor
- .beginTask(
- WorkbenchMessages.FilteredItemsSelectionDialog_searchJob_taskName,
- projects.size());
}
/*
@@ -857,11 +863,6 @@
IResource resource = proxy.requestResource();
- if (this.projects.remove((resource.getProject()))
- || this.projects.remove((resource))) {
- progressMonitor.worked(1);
- }
-
proxyContentProvider.add(resource, resourceFilter);
if (resource.getType() == IResource.FOLDER && resource.isDerived()
@@ -1020,10 +1021,12 @@
return false;
}
IResource resource = (IResource) item;
- if ((!this.showDerived && resource.isDerived())
- || ((this.filterTypeMask & resource.getType()) == 0))
- return false;
+ return (this.filterTypeMask & resource.getType()) != 0
+ && matchName(resource)
+ && (this.showDerived || !resource.isDerived());
+ }
+ private boolean matchName(IResource resource) {
String name = resource.getName();
if (nameMatches(name)) {
if (containerPattern != null) {
diff --git a/bundles/org.eclipse.ui.ide/pom.xml b/bundles/org.eclipse.ui.ide/pom.xml
index 786a586..76cbb10 100644
--- a/bundles/org.eclipse.ui.ide/pom.xml
+++ b/bundles/org.eclipse.ui.ide/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.ui.ide</artifactId>
- <version>3.8.2-SNAPSHOT</version>
+ <version>3.9.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/LineDelimiterEditor.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/LineDelimiterEditor.java
index ae2e996..d7a463a 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/LineDelimiterEditor.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/LineDelimiterEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 IBM Corporation and others.
* 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
@@ -17,6 +17,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
@@ -158,6 +159,9 @@
if (project != null) {
value = getStoredValue(getPreferences(null));
}
+ if (value == null) {
+ value = getStoredValue(Platform.getPreferencesService().getRootNode().node(DefaultScope.SCOPE));
+ }
return value != null ? value : System.getProperty(Platform.PREF_LINE_SEPARATOR);
}
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java
index 6b6cb92..5884168 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 IBM Corporation and others.
* 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
@@ -877,7 +877,10 @@
showInQuickMenu = null;
newQuickMenu = null;
buildProjectAction = null;
- newWizardMenu = null;
+ if (newWizardMenu != null) {
+ newWizardMenu.dispose();
+ newWizardMenu = null;
+ }
statusLineItem = null;
prefListener = null;
propPrefListener = null;
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/actions/BuildUtilities.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/actions/BuildUtilities.java
index 122d7d3..57d3da4 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/actions/BuildUtilities.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/actions/BuildUtilities.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2012 IBM Corporation and others.
* 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
@@ -15,6 +15,7 @@
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IResource;
@@ -49,15 +50,21 @@
public static IProject[] extractProjects(Object[] selection) {
HashSet projects = new HashSet();
for (int i = 0; i < selection.length; i++) {
- IResource resource = ResourceUtil.getResource(selection[i]);
+ Object element = selection[i];
+ IResource resource = ResourceUtil.getResource(element);
if (resource != null) {
projects.add(resource.getProject());
} else {
- ResourceMapping mapping = ResourceUtil.getResourceMapping(selection[i]);
+ ResourceMapping mapping = ResourceUtil.getResourceMapping(element);
if (mapping != null) {
IProject[] theProjects = mapping.getProjects();
- for(int j=0; j < theProjects.length; j++) {
- projects.add(theProjects[j]);
+ for (int j = 0; j < theProjects.length; j++) {
+ projects.add(theProjects[j]);
+ }
+ } else {
+ Object marker = ResourceUtil.getAdapter(element, IMarker.class, false);
+ if (marker instanceof IMarker) {
+ projects.add(((IMarker) marker).getResource().getProject());
}
}
}
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ResourceInfoPage.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ResourceInfoPage.java
index e9c700d..9e37831 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ResourceInfoPage.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/dialogs/ResourceInfoPage.java
@@ -852,30 +852,6 @@
return cachedContentDescription;
}
- /**
- * Returns whether the given resource is a linked resource bound to a path
- * variable.
- *
- * @param resource
- * resource to test
- * @return boolean <code>true</code> the given resource is a linked
- * resource bound to a path variable. <code>false</code> the given
- * resource is either not a linked resource or it is not using a
- * path variable.
- */
- /*
- * Now shows the same widgets for all linked files. private boolean
- * isPathVariable(IResource resource) { if (!resource.isLinked()) { return
- * false; }
- *
- * IPath resolvedLocation = resource.getLocation(); if (resolvedLocation ==
- * null) { // missing path variable return true; } IPath rawLocation =
- * resource.getRawLocation(); if (resolvedLocation.equals(rawLocation)) {
- * return false; }
- *
- * return true; }
- */
-
/*
* @see PreferencePage#performDefaults()
*/
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/DataTransferMessages.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/DataTransferMessages.java
index aa05a19..c2aa5e4 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/DataTransferMessages.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/DataTransferMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2010 IBM Corporation and others.
+ * Copyright (c) 2005, 2010, 2012 IBM Corporation and others.
* 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
@@ -97,6 +97,7 @@
public static String WizardProjectsImportPage_ArchiveSelectTitle;
public static String WizardProjectsImportPage_SelectArchiveDialogTitle;
public static String WizardProjectsImportPage_CreateProjectsTask;
+ public static String WizardProjectsImportPage_SearchForNestedProjects;
public static String WizardProjectsImportPage_CopyProjectsIntoWorkspace;
public static String WizardProjectsImportPage_projectsInWorkspace;
public static String WizardProjectsImportPage_noProjectsToImport;
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java
index 77f861e..709c26d 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2009 IBM Corporation and others.
+ * Copyright (c) 2004, 2009, 2012 IBM Corporation and others.
* 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
@@ -14,6 +14,8 @@
* - Bug 187318[Wizards] "Import Existing Project" loops forever with cyclic symbolic links
* Remy Chi Jian Suen (remy.suen@gmail.com)
* - Bug 210568 [Import/Export] [Import/Export] - Refresh button does not update list of projects
+ * Matt Hurne (matt@thehurnes.com)
+ * - Bug 144610 [Import/Export] Import existing projects does not search subdirectories of found projects
*******************************************************************************/
package org.eclipse.ui.internal.wizards.datatransfer;
@@ -285,6 +287,8 @@
}
// dialog store id constants
+ private final static String STORE_NESTED_PROJECTS = "WizardProjectsImportPage.STORE_NESTED_PROJECTS"; //$NON-NLS-1$
+
private final static String STORE_COPY_PROJECT_ID = "WizardProjectsImportPage.STORE_COPY_PROJECT_ID"; //$NON-NLS-1$
private final static String STORE_ARCHIVE_SELECTED = "WizardProjectsImportPage.STORE_ARCHIVE_SELECTED"; //$NON-NLS-1$
@@ -293,6 +297,12 @@
private CheckboxTreeViewer projectsList;
+ private Button nestedProjectsCheckbox;
+
+ private boolean nestedProjects = false;
+
+ private boolean lastNestedProjects = false;
+
private Button copyCheckbox;
private boolean copyFiles = false;
@@ -419,6 +429,21 @@
optionsGroup.setLayout(new GridLayout());
optionsGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ nestedProjectsCheckbox = new Button(optionsGroup, SWT.CHECK);
+ nestedProjectsCheckbox
+ .setText(DataTransferMessages.WizardProjectsImportPage_SearchForNestedProjects);
+ nestedProjectsCheckbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ nestedProjectsCheckbox.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ nestedProjects = nestedProjectsCheckbox.getSelection();
+ if (projectFromDirectoryRadio.getSelection()) {
+ updateProjectsList(directoryPathField.getText().trim());
+ } else {
+ updateProjectsList(archivePathField.getText().trim());
+ }
+ }
+ });
+
copyCheckbox = new Button(optionsGroup, SWT.CHECK);
copyCheckbox
.setText(DataTransferMessages.WizardProjectsImportPage_CopyProjectsIntoWorkspace);
@@ -800,6 +825,8 @@
browseArchivesButton.setEnabled(true);
updateProjectsList(archivePathField.getText());
archivePathField.setFocus();
+ nestedProjectsCheckbox.setSelection(true);
+ nestedProjectsCheckbox.setEnabled(false);
copyCheckbox.setSelection(true);
copyCheckbox.setEnabled(false);
}
@@ -813,6 +840,8 @@
browseArchivesButton.setEnabled(false);
updateProjectsList(directoryPathField.getText());
directoryPathField.setFocus();
+ nestedProjectsCheckbox.setEnabled(true);
+ nestedProjectsCheckbox.setSelection(nestedProjects);
copyCheckbox.setEnabled(true);
copyCheckbox.setSelection(copyFiles);
}
@@ -852,7 +881,11 @@
final File directory = new File(path);
long modified = directory.lastModified();
- if (path.equals(lastPath) && lastModified == modified && lastCopyFiles == copyFiles) {
+ if (path.equals(lastPath)
+ && lastModified == modified
+ && lastNestedProjects == nestedProjects
+ && lastCopyFiles == copyFiles)
+ {
// since the file/folder was not modified and the path did not
// change, no refreshing is required
return;
@@ -860,6 +893,7 @@
lastPath = path;
lastModified = modified;
+ lastNestedProjects = nestedProjects;
lastCopyFiles = copyFiles;
// We can't access the radio button from the inner class so get the
@@ -1095,12 +1129,15 @@
File file = contents[i];
if (file.isFile() && file.getName().equals(dotProject)) {
files.add(file);
- // don't search sub-directories since we can't have nested
- // projects
- return true;
+ if (!nestedProjects) {
+ // don't search sub-directories since we can't have nested
+ // projects
+ return true;
+ }
}
}
- // no project description found, so recurse into sub-directories
+ // no project description found or search for nested projects enabled,
+ // so recurse into sub-directories
for (int i = 0; i < contents.length; i++) {
if (contents[i].isDirectory()) {
if (!contents[i].getName().equals(METADATA_FOLDER)) {
@@ -1564,6 +1601,11 @@
IDialogSettings settings = getDialogSettings();
if (settings != null) {
// checkbox
+ nestedProjects = settings.getBoolean(STORE_NESTED_PROJECTS);
+ nestedProjectsCheckbox.setSelection(nestedProjects);
+ lastNestedProjects = nestedProjects;
+
+ // checkbox
copyFiles = settings.getBoolean(STORE_COPY_PROJECT_ID);
copyCheckbox.setSelection(copyFiles);
lastCopyFiles = copyFiles;
@@ -1617,6 +1659,8 @@
public void saveWidgetValues() {
IDialogSettings settings = getDialogSettings();
if (settings != null) {
+ settings.put(STORE_NESTED_PROJECTS, nestedProjectsCheckbox.getSelection());
+
settings.put(STORE_COPY_PROJECT_ID, copyCheckbox.getSelection());
settings.put(STORE_ARCHIVE_SELECTED, projectFromArchiveRadio
@@ -1632,4 +1676,14 @@
public Button getCopyCheckbox() {
return copyCheckbox;
}
+
+ /**
+ * Method used for test suite.
+ *
+ * @return Button nested projects checkbox
+ */
+ public Button getNestedProjectsCheckbox() {
+ return nestedProjectsCheckbox;
+ }
+
}
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/messages.properties b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/messages.properties
index db0ad31..63239bf 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/messages.properties
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2010 IBM Corporation and others.
+# Copyright (c) 2000, 2012 IBM Corporation and others.
# 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
@@ -99,6 +99,7 @@
WizardProjectsImportPage_CreateProjectsTask=Creating Projects
WizardProjectsImportPage_ImportProjectsDescription=Select a directory to search for existing Eclipse projects.
WizardProjectsImportPage_CheckingMessage= Checking: {0}
+WizardProjectsImportPage_SearchForNestedProjects=Search for &nested projects
WizardProjectsImportPage_CopyProjectsIntoWorkspace=&Copy projects into workspace
# The first parameter is the project folder name and the second is the name from the project description
WizardProjectsImportPage_projectLabel={0} ({1})
diff --git a/bundles/org.eclipse.ui.navigator/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.navigator/META-INF/MANIFEST.MF
index 9563d17..46d9ae0 100644
--- a/bundles/org.eclipse.ui.navigator/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui.navigator/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.ui.navigator; singleton:=true
-Bundle-Version: 3.5.200.qualifier
+Bundle-Version: 3.5.300.qualifier
Bundle-Activator: org.eclipse.ui.internal.navigator.NavigatorPlugin
Bundle-Vendor: %Plugin.providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.ui.navigator/pom.xml b/bundles/org.eclipse.ui.navigator/pom.xml
index de1d986..b7ab82c 100644
--- a/bundles/org.eclipse.ui.navigator/pom.xml
+++ b/bundles/org.eclipse.ui.navigator/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.ui.navigator</artifactId>
- <version>3.5.200-SNAPSHOT</version>
+ <version>3.5.300-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/CommonNavigatorMessages.java b/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/CommonNavigatorMessages.java
index ad06273..0952966 100644
--- a/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/CommonNavigatorMessages.java
+++ b/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/CommonNavigatorMessages.java
@@ -59,6 +59,9 @@
public static String Navigator_statusLineMultiSelect;
/** */
+ public static String Navigator_statusLineSingleSelect;
+
+ /** */
public static String SelectFiltersActionDelegate_1;
/** */
diff --git a/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/NavigatorContentServiceDescriptionProvider.java b/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/NavigatorContentServiceDescriptionProvider.java
index 47555bf..0ecfeee 100644
--- a/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/NavigatorContentServiceDescriptionProvider.java
+++ b/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/NavigatorContentServiceDescriptionProvider.java
@@ -73,11 +73,11 @@
/**
* @param aSize
* The number of items selected.
- * @return A string of the form "# items selected"
+ * @return A string of the form "# item(s) selected"
*/
protected final String getDefaultStatusBarMessage(int aSize) {
- return NLS.bind(
- CommonNavigatorMessages.Navigator_statusLineMultiSelect,
+ return NLS.bind(aSize != 1 ? CommonNavigatorMessages.Navigator_statusLineMultiSelect
+ : CommonNavigatorMessages.Navigator_statusLineSingleSelect,
new Object[] { new Integer(aSize) });
}
diff --git a/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/messages.properties b/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/messages.properties
index fcf5eed..349eeb3 100644
--- a/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/messages.properties
+++ b/bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/messages.properties
@@ -18,6 +18,7 @@
NewProjectWizard_errorTitle=New Project Problems
Link_With_Editor_Job_=Linking viewer selection with current editor
Navigator_statusLineMultiSelect={0} items selected
+Navigator_statusLineSingleSelect=1 item selected
SelectFiltersActionDelegate_1=Select and deselect filters to apply to the content in the tree
CommonFilterSelectionDialog_Select_the_available_extensions=Select the available extensions to show (unchecked extensions will not display content)\:
SelectFiltersActionDelegate_0=&Customize View...
diff --git a/bundles/org.eclipse.ui.presentations.r21/.classpath b/bundles/org.eclipse.ui.presentations.r21/.classpath
deleted file mode 100644
index ce73933..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.ui.presentations.r21/.cvsignore b/bundles/org.eclipse.ui.presentations.r21/.cvsignore
deleted file mode 100644
index c5e82d7..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.presentations.r21/.project b/bundles/org.eclipse.ui.presentations.r21/.project
deleted file mode 100644
index 5da924d..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/.project
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ui.presentations.r21</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.ui</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.ui.presentations.r21/.settings/org.eclipse.core.runtime.prefs b/bundles/org.eclipse.ui.presentations.r21/.settings/org.eclipse.core.runtime.prefs
deleted file mode 100644
index c522e1f..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/.settings/org.eclipse.core.runtime.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-line.separator=\n
diff --git a/bundles/org.eclipse.ui.presentations.r21/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.ui.presentations.r21/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 0db0d73..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,90 +0,0 @@
-#Mon Oct 29 10:37:38 EDT 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.core.builder.cleanOutputFolder=clean
-org.eclipse.jdt.core.builder.duplicateResourceTask=warning
-org.eclipse.jdt.core.builder.invalidClasspath=abort
-org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
-org.eclipse.jdt.core.circularClasspath=error
-org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
-org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=error
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=error
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=error
-org.eclipse.jdt.core.compiler.problem.unusedParameter=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
-org.eclipse.jdt.core.incompatibleJDKLevel=ignore
-org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/bundles/org.eclipse.ui.presentations.r21/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.ui.presentations.r21/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 29e9857..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-#Mon Oct 29 10:37:42 EDT 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.ui.javadoc=true
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return Returns the ${bare_field_name}.\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} The ${bare_field_name} to set.\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\n * Copyright (c) ${year} IBM Corporation and others.\n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * IBM Corporation - initial API and implementation\n ******************************************************************************/\n</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @since 3.3\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template></templates>
diff --git a/bundles/org.eclipse.ui.presentations.r21/.settings/org.eclipse.pde.prefs b/bundles/org.eclipse.ui.presentations.r21/.settings/org.eclipse.pde.prefs
deleted file mode 100644
index 77b65f8..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/.settings/org.eclipse.pde.prefs
+++ /dev/null
@@ -1,14 +0,0 @@
-#Tue Nov 16 14:11:51 EST 2004
-compilers.p.unused-element-or-attribute=1
-compilers.p.unresolved-ex-points=0
-compilers.p.deprecated=0
-compilers.p.unknown-element=1
-compilers.p.unknown-resource=1
-compilers.p.unknown-class=1
-compilers.p.unknown-attribute=0
-compilers.p.no-required-att=0
-eclipse.preferences.version=1
-compilers.p.unresolved-import=0
-compilers.p.not-externalized-att=0
-compilers.p.illegal-att-value=0
-compilers.use-project=true
diff --git a/bundles/org.eclipse.ui.presentations.r21/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.presentations.r21/META-INF/MANIFEST.MF
deleted file mode 100644
index fffc6f7..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,17 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.ui.presentations.r21; singleton:=true
-Bundle-Version: 3.2.200.qualifier
-Bundle-ClassPath: .
-Bundle-Activator: org.eclipse.ui.internal.presentations.r21.R21PresentationPlugin
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Export-Package: org.eclipse.ui.internal.presentations;x-internal:=true,
- org.eclipse.ui.internal.presentations.r21;x-internal:=true,
- org.eclipse.ui.internal.presentations.r21.widgets;x-internal:=true
-Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.ui;bundle-version="[3.2.0,4.0.0)"
-Import-Package: com.ibm.icu.text
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
-Bundle-ActivationPolicy: lazy
diff --git a/bundles/org.eclipse.ui.presentations.r21/README.TXT b/bundles/org.eclipse.ui.presentations.r21/README.TXT
deleted file mode 100644
index 33b17e3..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/README.TXT
+++ /dev/null
@@ -1,15 +0,0 @@
-The r21presentation plugin provides an R2.1 style look and feel for
-Eclipse. This look and feel is accomplished entirely through the
-Presentations API, no changes are needed to the base eclipse release.
-
-Use:
-
-1. Ensure the plugin is installed (look in your eclipse/plugins
- directory for org.eclipse.ui.presentations.r21_3.0.0).
-2. Add the contents of the r21presentation.ini file to your primary
- plugin's "plugin_customization.ini" file. In the basic Eclipse
- IDE, this file is located in plugins/org.eclipse.platform_3.0.0.
-3. Resolve any conflicts in the plugin_customization.ini file to favour
- the settings for this project. E.g., DOCK_PERSPECTIVE_BAR is set
- to "topRight" in the basic platform but should be "left" for the
- R21 presentation.
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.presentations.r21/about.html b/bundles/org.eclipse.ui.presentations.r21/about.html
deleted file mode 100644
index 4602330..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 2, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.presentations.r21/build.properties b/bundles/org.eclipse.ui.presentations.r21/build.properties
deleted file mode 100644
index eccd880..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/build.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-###############################################################################
-# Copyright (c) 2004, 2005 IBM Corporation and others.
-# 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
-###############################################################################
-
-bin.includes = plugin.properties,\
- plugin.xml,\
- .,\
- r21presentation.ini,\
- README.TXT,\
- about.html,\
- META-INF/
-src.includes = about.html
-source.. = src/
diff --git a/bundles/org.eclipse.ui.presentations.r21/plugin.properties b/bundles/org.eclipse.ui.presentations.r21/plugin.properties
deleted file mode 100644
index 516f332..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/plugin.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2005 IBM Corporation and others.
-# 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
-###############################################################################
-pluginName= R21 Presentation Plug-in
-providerName= Eclipse.org
-
-Presentation.r21.name=Eclipse 2.1 Style Presentation
diff --git a/bundles/org.eclipse.ui.presentations.r21/plugin.xml b/bundles/org.eclipse.ui.presentations.r21/plugin.xml
deleted file mode 100644
index dd5bcd3..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/plugin.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
-
- <extension
- point="org.eclipse.ui.presentationFactories">
- <factory
- name="%Presentation.r21.name"
- class="org.eclipse.ui.internal.presentations.R21PresentationFactory"
- id="org.eclipse.ui.internal.r21presentationFactory">
- </factory>
- </extension>
-
-</plugin>
diff --git a/bundles/org.eclipse.ui.presentations.r21/pom.xml b/bundles/org.eclipse.ui.presentations.r21/pom.xml
deleted file mode 100644
index 581cdd9..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/pom.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2012 Eclipse Foundation.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Distribution License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/org/documents/edl-v10.php
-
- Contributors:
- Igor Fedorenko - initial implementation
--->
-
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>eclipse.platform.ui</artifactId>
- <groupId>eclipse.platform.ui</groupId>
- <version>3.8.0-SNAPSHOT</version>
- <relativePath>../../</relativePath>
- </parent>
- <groupId>eclipse.platform.ui</groupId>
- <artifactId>org.eclipse.ui.presentations.r21</artifactId>
- <version>3.2.200-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
-</project>
diff --git a/bundles/org.eclipse.ui.presentations.r21/r21presentation.ini b/bundles/org.eclipse.ui.presentations.r21/r21presentation.ini
deleted file mode 100644
index be8c8e3..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/r21presentation.ini
+++ /dev/null
@@ -1,18 +0,0 @@
-# R21 presentation settings: copy these values to your product's
-# plugin_customization.ini file before starting eclipse
-#
-# Its possible that platform has its own setting for some of these
-# values. Be sure to resolve conflicts to favour the values in this
-# file.
-
-# use the R2.1 style
-org.eclipse.ui/presentationFactoryId=org.eclipse.ui.internal.r21presentationFactory
-
-# put the view tabs on the bottom (1024 == SWT.BOTTOM)
-org.eclipse.ui.workbench/VIEW_TAB_POSITION=1024
-
-# put the perspective switcher on the left
-org.eclipse.ui/DOCK_PERSPECTIVE_BAR=left
-
-# put the fast view bar on the left
-org.eclipse.ui/initialFastViewBarLocation=left
diff --git a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/R21BasicStackPresentation.java b/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/R21BasicStackPresentation.java
deleted file mode 100644
index 13f9041..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/R21BasicStackPresentation.java
+++ /dev/null
@@ -1,1217 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * 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
- * Gunnar Wagenknecht - some contributions (bug fixes and enhancements)
- *******************************************************************************/
-package org.eclipse.ui.internal.presentations;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.util.Geometry;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPropertyListener;
-import org.eclipse.ui.internal.IWorkbenchConstants;
-import org.eclipse.ui.internal.IWorkbenchGraphicConstants;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.internal.dnd.DragUtil;
-import org.eclipse.ui.internal.presentations.r21.R21Colors;
-import org.eclipse.ui.internal.presentations.r21.R21PresentationMessages;
-import org.eclipse.ui.internal.presentations.r21.widgets.CTabItem;
-import org.eclipse.ui.internal.presentations.r21.widgets.R21PaneFolder;
-import org.eclipse.ui.internal.util.Util;
-import org.eclipse.ui.presentations.IPartMenu;
-import org.eclipse.ui.presentations.IPresentablePart;
-import org.eclipse.ui.presentations.IPresentationSerializer;
-import org.eclipse.ui.presentations.IStackPresentationSite;
-import org.eclipse.ui.presentations.PresentationUtil;
-import org.eclipse.ui.presentations.StackDropResult;
-import org.eclipse.ui.presentations.StackPresentation;
-
-/**
- * Base class for StackPresentations that display IPresentableParts in a
- * CTabFolder.
- *
- * @since 3.0
- */
-public class R21BasicStackPresentation extends StackPresentation {
-
- private R21PaneFolder paneFolder;
-
- private IPresentablePart current;
-
- private boolean activeState = false;
-
- private MenuManager systemMenuManager = new MenuManager();
-
- private CLabel titleLabel;
-
- private boolean shellActive = true;
-
- private final static String TAB_DATA = R21BasicStackPresentation.class
- .getName()
- + ".partId"; //$NON-NLS-1$
-
- // private PaneFolderButtonListener buttonListener = new
- // PaneFolderButtonListener() {
- // public void stateButtonPressed(int buttonId) {
- // getSite().setState(buttonId);
- // }
- //
- // public void closeButtonPressed(CTabItem item) {
- // IPresentablePart part = getPartForTab(item);
- //
- // getSite().close(part);
- // }
- // };
- //
- private MouseListener mouseListener = new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- if (e.widget instanceof Control) {
- Control ctrl = (Control) e.widget;
- Point globalPos = ctrl.toDisplay(new Point(e.x, e.y));
-
- // PR#1GDEZ25 - If selection will change in mouse up ignore
- // mouse down.
- // Else, set focus.
- CTabItem newItem = paneFolder.getItem(paneFolder.getControl()
- .toControl(globalPos));
- if (newItem != null) {
- CTabItem oldItem = paneFolder.getSelection();
- if (newItem != oldItem) {
- return;
- }
- }
- if (current != null) {
- current.setFocus();
- }
- }
- }
-
- public void mouseDoubleClick(MouseEvent e) {
- if (getSite().getState() == IStackPresentationSite.STATE_MAXIMIZED) {
- getSite().setState(IStackPresentationSite.STATE_RESTORED);
- } else {
- getSite().setState(IStackPresentationSite.STATE_MAXIMIZED);
- }
- }
- };
-
- private MouseListener titleMouseListener = new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- if (e.widget instanceof Control) {
- Control ctrl = (Control) e.widget;
- Point globalPos = ctrl.toDisplay(new Point(0, titleLabel
- .getBounds().height));
-
- if ((e.button == 1) && overImage(e.x)) {
- showSystemMenu(globalPos);
- }
- }
- }
- };
-
- private Listener menuListener = new Listener() {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
- */
- public void handleEvent(Event event) {
- Point pos = new Point(event.x, event.y);
-
- showSystemMenu(pos);
- }
- };
-
- private Listener dragListener = new Listener() {
- public void handleEvent(Event event) {
-
- Point localPos = new Point(event.x, event.y);
- CTabItem tabUnderPointer = paneFolder.getItem(localPos);
-
- // Drags on the title area drag the selected part only
- if (tabUnderPointer == null) {
- if (paneFolder.getTabPosition() == SWT.BOTTOM
- && localPos.y < paneFolder.getControl().getBounds().height
- - paneFolder.getTabHeight()) {
- tabUnderPointer = paneFolder.getSelection();
- } else if (paneFolder.getTabPosition() == SWT.TOP
- && localPos.y > paneFolder.getTabHeight()) {
- tabUnderPointer = paneFolder.getSelection();
- }
- }
-
- // Not in a tab, not in a title area, must be dragging the whole
- // stack
- if (tabUnderPointer == null) {
- getSite().dragStart(
- paneFolder.getControl().toDisplay(localPos), false);
- return;
- }
-
- IPresentablePart part = getPartForTab(tabUnderPointer);
-
- if (getSite().isPartMoveable(part)) {
- getSite().dragStart(part,
- paneFolder.getControl().toDisplay(localPos), false);
- }
- }
- };
-
- private Listener selectionListener = new Listener() {
- public void handleEvent(Event e) {
- IPresentablePart item = getPartForTab((CTabItem) e.item);
-
- if (item != null) {
- getSite().selectPart(item);
- }
- }
- };
-
- private Listener resizeListener = new Listener() {
- public void handleEvent(Event e) {
- setControlSize();
- }
- };
-
- private IPropertyListener childPropertyChangeListener = new IPropertyListener() {
- public void propertyChanged(Object source, int property) {
- if (source instanceof IPresentablePart) {
- IPresentablePart part = (IPresentablePart) source;
- childPropertyChanged(part, property);
- }
- }
- };
-
- private DisposeListener tabDisposeListener = new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (e.widget instanceof CTabItem) {
- CTabItem item = (CTabItem) e.widget;
-
- IPresentablePart part = getPartForTab(item);
-
- part.removePropertyListener(childPropertyChangeListener);
- }
- }
- };
-
- /** the shell listener for upgrading the gradient */
- private ShellAdapter shellListener = new ShellAdapter() {
-
- public void shellActivated(ShellEvent event) {
- shellActive = true;
- updateGradient();
- }
-
- public void shellDeactivated(ShellEvent event) {
- shellActive = false;
- updateGradient();
- }
- };
-
- private ToolBar viewToolBar;
-
- private ToolItem pullDownButton;
-
- private ToolItem closeButton;
-
- /**
- * @param control
- * @param stackSite
- */
- public R21BasicStackPresentation(R21PaneFolder control,
- IStackPresentationSite stackSite) {
- super(stackSite);
- paneFolder = control;
-
- shellActive = paneFolder.getControl().getShell().equals(
- control.getControl().getDisplay().getActiveShell());
-
- // tabFolder.setMinimizeVisible(stackSite.supportsState(IStackPresentationSite.STATE_MINIMIZED));
- // tabFolder.setMaximizeVisible(stackSite.supportsState(IStackPresentationSite.STATE_MAXIMIZED));
- //
- titleLabel = new CLabel(paneFolder.getControl(), SWT.SHADOW_NONE);
- titleLabel.setVisible(false);
- titleLabel.moveAbove(null);
- titleLabel.addMouseListener(titleMouseListener);
- titleLabel.addMouseListener(mouseListener);
- titleLabel.addListener(SWT.MenuDetect, menuListener);
- PresentationUtil.addDragListener(titleLabel, dragListener);
-
- // ColorSchemeService.setViewTitleFont(this, titleLabel);
-
- viewToolBar = new ToolBar(control.getControl(), SWT.HORIZONTAL
- | SWT.FLAT);
- viewToolBar.moveAbove(null);
-
- pullDownButton = new ToolItem(viewToolBar, SWT.PUSH);
- // Image img =
- // WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_LCL_VIEW_MENU);
- Image hoverImage = WorkbenchImages
- .getImage(IWorkbenchGraphicConstants.IMG_LCL_VIEW_MENU);
- pullDownButton.setDisabledImage(null); // TODO: comment this out?
- // PR#1GE56QT - Avoid creation of unnecessary image.
- pullDownButton.setImage(hoverImage);
- pullDownButton.setToolTipText(R21PresentationMessages
- .getString("BasicStackPresentation.menu.tooltip")); //$NON-NLS-1$
- pullDownButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- showPaneMenu();
- }
- });
-
- // listener to switch between visible tabItems
- paneFolder.getControl().addListener(SWT.Selection, selectionListener);
-
- // listener to resize visible components
- paneFolder.getControl().addListener(SWT.Resize, resizeListener);
-
- // listen for mouse down on tab to set focus.
- paneFolder.getControl().addMouseListener(mouseListener);
-
- paneFolder.getControl().addListener(SWT.MenuDetect, menuListener);
-
- // tabFolder.addButtonListener(buttonListener);
-
- PresentationUtil.addDragListener(paneFolder.getControl(), dragListener);
-
- // add the shell listener to track shell activations
- // TODO: check if workaround can be removed (see bug 55458)
- paneFolder.getControl().getShell().addShellListener(shellListener);
-
- // Uncomment to allow dragging from the title label
- // PresentationUtil.addDragListener(titleLabel, new Listener() {
- // public void handleEvent(Event event) {
- // if (layout.isTrimOnTop()) {
- // Point localPos = new Point(event.x, event.y);
- // getSite().dragStart(titleLabel.toDisplay(localPos), false);
- // }
- // }
- // });
-
- // // Compute the tab height
- // int tabHeight = viewToolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
- //
- // // Enforce a minimum tab height
- // if (tabHeight < 20) {
- // tabHeight = 20;
- // }
- // paneFolder.setTabHeight(tabHeight);
- //
- populateSystemMenu(systemMenuManager);
- }
-
- /*
- * Return true if <code>x</code> is over the label image.
- */
- private boolean overImage(int x) {
- return x < titleLabel.getImage().getBounds().width;
- }
-
- /**
- * @param systemMenuManager
- */
- private void populateSystemMenu(IMenuManager systemMenuManager) {
-
- systemMenuManager.add(new GroupMarker("misc")); //$NON-NLS-1$
- systemMenuManager.add(new GroupMarker("restore")); //$NON-NLS-1$
- systemMenuManager.add(new UpdatingActionContributionItem(
- new SystemMenuRestore(getSite())));
-
- systemMenuManager.add(new SystemMenuMove(getSite(), getPaneName()));
- systemMenuManager.add(new GroupMarker("size")); //$NON-NLS-1$
- systemMenuManager.add(new GroupMarker("state")); //$NON-NLS-1$
- systemMenuManager.add(new UpdatingActionContributionItem(
- new SystemMenuMinimize(getSite())));
-
- systemMenuManager.add(new UpdatingActionContributionItem(
- new SystemMenuMaximize(getSite())));
- systemMenuManager.add(new Separator("close")); //$NON-NLS-1$
- systemMenuManager.add(new UpdatingActionContributionItem(
- new SystemMenuClose(getSite())));
-
- getSite().addSystemActions(systemMenuManager);
- }
-
- protected String getPaneName() {
- return R21PresentationMessages.getString("BasicStackPresentation.pane"); //$NON-NLS-1$
- }
-
- /**
- * Displays the view menu as a popup
- */
- public void showPaneMenu() {
- IPartMenu menu = getPartMenu();
-
- if (menu != null) {
- Rectangle bounds = DragUtil.getDisplayBounds(viewToolBar);
- menu.showMenu(new Point(bounds.x, bounds.y + bounds.height));
- }
- }
-
- /**
- * Returns the currently selected part, or <code>null</code>.
- *
- * @return the currently selected part, or <code>null</code>
- */
- protected IPresentablePart getCurrent() {
- return current;
- }
-
- /**
- * Returns the index of the tab for the given part, or returns
- * tabFolder.getItemCount() if there is no such tab.
- *
- * @param part
- * part being searched for
- * @return the index of the tab for the given part, or the number of tabs if
- * there is no such tab
- */
- private final int indexOf(IPresentablePart part) {
- if (part == null) {
- return paneFolder.getItemCount();
- }
-
- CTabItem[] items = paneFolder.getItems();
-
- for (int idx = 0; idx < items.length; idx++) {
- IPresentablePart tabPart = getPartForTab(items[idx]);
-
- if (part == tabPart) {
- return idx;
- }
- }
-
- return items.length;
- }
-
- /**
- * Returns the tab for the given part, or null if there is no such tab
- *
- * @param part
- * the part being searched for
- * @return the tab for the given part, or null if there is no such tab
- */
- protected final CTabItem getTab(IPresentablePart part) {
- CTabItem[] items = paneFolder.getItems();
-
- int idx = indexOf(part);
-
- if (idx < items.length) {
- return items[idx];
- }
-
- return null;
- }
-
- /**
- * @param part
- * @param property
- */
- protected void childPropertyChanged(IPresentablePart part, int property) {
-
- CTabItem tab = getTab(part);
- initTab(tab, part);
-
- switch (property) {
- case IPresentablePart.PROP_BUSY:
- break;
- case IPresentablePart.PROP_HIGHLIGHT_IF_BACK:
- // FontRegistry registry =
- // PlatformUI.getWorkbench().
- // getThemeManager().getCurrentTheme().
- // getFontRegistry();
- //
- // if(!getCurrent().equals(part))//Set bold if it does currently
- // have focus
- // tab.setFont(registry.getBold(IWorkbenchThemeConstants.TAB_TEXT_FONT));
- // break;
- case IPresentablePart.PROP_TOOLBAR:
- case IPresentablePart.PROP_PANE_MENU:
- case IPresentablePart.PROP_TITLE:
- setControlSize();
- break;
- }
- }
-
- protected final IPresentablePart getPartForTab(CTabItem item) {
- IPresentablePart part = (IPresentablePart) item.getData(TAB_DATA);
-
- return part;
- }
-
- /**
- * Returns the underlying tab folder for this presentation.
- *
- * @return the tab folder
- */
- protected R21PaneFolder getPaneFolder() {
- return paneFolder;
- }
-
- /**
- * Returns true iff the underlying tab folder has been disposed.
- *
- * @return true if disposed
- */
- public boolean isDisposed() {
- return paneFolder == null || paneFolder.isDisposed();
- }
-
- /**
- * Update the tab folder's colours to match the current theme settings and
- * active state
- */
- protected void updateGradient() {
-
- if (isDisposed()) {
- return;
- }
-
- Color fgColor;
- Color[] bgColors;
- int[] bgPercents;
- boolean vertical = false;
- if (isActive()) {
- if (getShellActivated()) {
- fgColor = R21Colors.getSystemColor(SWT.COLOR_TITLE_FOREGROUND);
- bgColors = R21Colors.getActiveViewGradient();
- bgPercents = R21Colors.getActiveViewGradientPercents();
- } else {
- fgColor = R21Colors
- .getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND);
- bgColors = R21Colors.getDeactivatedViewGradient();
- bgPercents = R21Colors.getDeactivatedViewGradientPercents();
- }
-
- } else {
- fgColor = R21Colors.getSystemColor(SWT.COLOR_LIST_FOREGROUND);
- bgColors = null;
- bgPercents = null;
- }
-
- drawGradient(fgColor, bgColors, bgPercents, vertical);
-
- // Color fgColor;
- // ITheme currentTheme =
- // PlatformUI.getWorkbench().getThemeManager().getCurrentTheme();
- // FontRegistry fontRegistry = currentTheme.getFontRegistry();
- // ColorRegistry colorRegistry = currentTheme.getColorRegistry();
- // Color [] bgColors = new Color[2];
- // int [] percent = new int[1];
- // boolean vertical;
-
- // if (isActive()){
- //
- // CTabItem item = getPaneFolder().getSelection();
- // if(item != null && !getPartForTab(item).isBusy()){
- // Font tabFont =
- // fontRegistry.get(IWorkbenchThemeConstants.TAB_TEXT_FONT);
- // // item.setFont(tabFont);
- // }
- //
- // fgColor =
- // colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_TAB_TEXT_COLOR);
- // bgColors[0] =
- // colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_START);
- // bgColors[1] =
- // colorRegistry.get(IWorkbenchThemeConstants.ACTIVE_TAB_BG_END);
- // percent[0] =
- // currentTheme.getInt(IWorkbenchThemeConstants.ACTIVE_TAB_PERCENT);
- // vertical =
- // currentTheme.getBoolean(IWorkbenchThemeConstants.ACTIVE_TAB_VERTICAL);
- // } else {
- // fgColor =
- // colorRegistry.get(IWorkbenchThemeConstants.INACTIVE_TAB_TEXT_COLOR);
- // bgColors[0] =
- // colorRegistry.get(IWorkbenchThemeConstants.INACTIVE_TAB_BG_START);
- // bgColors[1] =
- // colorRegistry.get(IWorkbenchThemeConstants.INACTIVE_TAB_BG_END);
- // percent[0] =
- // currentTheme.getInt(IWorkbenchThemeConstants.INACTIVE_TAB_PERCENT);
- // vertical =
- // currentTheme.getBoolean(IWorkbenchThemeConstants.INACTIVE_TAB_VERTICAL);
- // }
- //
- //
- // drawGradient(fgColor, bgColors, bgPercents, false);
- }
-
- /**
- * Draws the applicable gradient on the title area
- *
- * @param fgColor
- * @param bgColors
- * @param percentages
- * @param vertical
- */
- public void drawGradient(Color fgColor, Color[] bgColors,
- int[] percentages, boolean vertical) {
- // paneFolder.setSelectionForeground(fgColor);
- // paneFolder.setSelectionBackground(bgColors, percentages, vertical);
-
- if (titleLabel == null || viewToolBar == null) {
- return;
- }
-
- titleLabel.setBackground(bgColors, percentages, vertical);
- titleLabel.setForeground(fgColor);
-
- titleLabel.update();
- }
-
- /**
- * @return true if active
- */
- public boolean isActive() {
- return activeState;
- }
-
- /**
- * Set the size of a page in the folder.
- *
- * TODO: Kim here...I had to make this public so that the when the font was
- * updated via the color scheme service it could relayout the
- * presentation... calling control.getLayout() doesn't do the trick.
- */
- public void setControlSize() {
- // Set up the top-right controls
- // List topRight = new ArrayList(3);
-
- if (current != null) {
- paneFolder.setTopLeft(titleLabel);
- titleLabel.setText(current.getTitle());
- titleLabel.setImage(current.getTitleImage());
- titleLabel.setVisible(true);
-
- // set tooltip (https://bugs.eclipse.org/bugs/show_bug.cgi?id=67513)
- String toolTipText = current.getTitleToolTip();
- titleLabel.setToolTipText(toolTipText
- .equals(Util.ZERO_LENGTH_STRING) ? null : toolTipText);
-
- }
-
- Control currentToolbar = getCurrentToolbar();
- paneFolder.setTopCenter(currentToolbar);
-
- IPartMenu partMenu = getPartMenu();
-
- if (partMenu != null) {
- pullDownButton.setEnabled(true);
- } else {
- pullDownButton.setEnabled(false);
- }
- paneFolder.setTopRight(viewToolBar);
- viewToolBar.setVisible(true);
-
- paneFolder.layout(true);
-
- if (current != null) {
- Rectangle clientArea = paneFolder.getClientArea();
- Rectangle bounds = paneFolder.getControl().getBounds();
- clientArea.x += bounds.x;
- clientArea.y += bounds.y;
-
- current.setBounds(clientArea);
- }
-
- }
-
- /**
- * Returns the IPartMenu for the currently selected part, or null if the
- * current part does not have a menu.
- *
- * @return the IPartMenu for the currently selected part or null if none
- */
- protected IPartMenu getPartMenu() {
- IPresentablePart part = getCurrentPart();
- if (part == null) {
- return null;
- }
-
- return part.getMenu();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.Presentation#dispose()
- */
- public void dispose() {
- if (isDisposed()) {
- return;
- }
-
- // remove shell listener
- paneFolder.getControl().getShell().removeShellListener(shellListener);
-
- PresentationUtil.removeDragListener(paneFolder.getControl(),
- dragListener);
- PresentationUtil.removeDragListener(titleLabel, dragListener);
-
- systemMenuManager.dispose();
- systemMenuManager.removeAll();
- paneFolder.getControl().dispose();
- paneFolder = null;
-
- titleLabel.dispose();
- titleLabel = null;
-
- viewToolBar.dispose();
- }
-
- /**
- * @param isActive
- */
- public void setActive(boolean isActive) {
- activeState = isActive;
- updateGradient();
- }
-
- /**
- * Return whether the window's shell is activated
- */
- /* package */boolean getShellActivated() {
- return shellActive;
- }
-
- /**
- * Returns the top level window.
- * @return the window
- */
- public Window getWindow() {
- Control ctrl = getControl();
- if (ctrl != null) {
- Object data = ctrl.getShell().getData();
- if (data instanceof Window) {
- return (Window) data;
- }
- }
- return null;
- }
-
- private CTabItem createPartTab(IPresentablePart part, int tabIndex) {
- CTabItem tabItem;
-
- int style = SWT.NONE;
-
- if (getSite().isCloseable(part)) {
- style |= SWT.CLOSE;
- }
-
- tabItem = paneFolder.createItem(style, tabIndex);
-
- tabItem.setData(TAB_DATA, part);
-
- part.addPropertyListener(childPropertyChangeListener);
- tabItem.addDisposeListener(tabDisposeListener);
-
- initTab(tabItem, part);
-
- return tabItem;
- }
-
- // Create a close button in the title bar for the argument part (if needed).
- private void updateCloseButton() {
- // remove the close button if needed
- if (current == null || !getSite().isCloseable(current)) {
- if (closeButton != null) {
- closeButton.dispose();
- closeButton = null;
-
- paneFolder.flush();
- }
- return;
- }
-
- // a close button is needed, so if its already there, we're done
- if (closeButton != null) {
- return;
- }
-
- // otherwise create it
- closeButton = new ToolItem(viewToolBar, SWT.PUSH);
- closeButton.setDisabledImage(null);
- closeButton.setImage(WorkbenchImages
- .getImage(IWorkbenchGraphicConstants.IMG_LCL_CLOSE_VIEW));
- closeButton.setToolTipText(R21PresentationMessages
- .getString("BasicStackPresentation.close.tooltip")); //$NON-NLS-1$
- closeButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- close(getCurrent());
- }
- });
-
- paneFolder.flush();
- }
-
- /**
- * Initializes a tab for the given part. Sets the text, icon, tool tip, etc.
- * This will also be called whenever a relevant property changes in the part
- * to reflect those changes in the tab. Subclasses may override to change
- * the appearance of tabs for a particular part.
- *
- * @param tabItem
- * tab for the part
- * @param part
- * the part being displayed
- */
- protected void initTab(CTabItem tabItem, IPresentablePart part) {
- tabItem.setText(part.getName());
-
- // tabItem.setImage(part.getTitleImage());
-
- // String toolTipText = part.getTitleToolTip();
- // if (!toolTipText.equals(Util.ZERO_LENGTH_STRING)) {
- // tabItem.setToolTipText(toolTipText);
- // }
-
- // FontRegistry registry =
- // PlatformUI.getWorkbench().
- // getThemeManager().getCurrentTheme().
- // getFontRegistry();
- //
- // if(part.isBusy())
- // tabItem.setFont(registry.getItalic(IWorkbenchThemeConstants.TAB_TEXT_FONT));
- // else{
- // tabItem.setFont(registry.get(IWorkbenchThemeConstants.TAB_TEXT_FONT));
- // }
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.StackPresentation#addPart(org.eclipse.ui.internal.skins.IPresentablePart,
- * org.eclipse.ui.internal.skins.IPresentablePart)
- */
- public void addPart(IPresentablePart newPart, Object cookie) {
-
- int idx;
-
- if (cookie instanceof Integer) {
- idx = ((Integer) cookie).intValue();
- } else {
- // Select a location for newly inserted parts
- idx = paneFolder.getItemCount();
- }
-
- addPart(newPart, idx);
- }
-
- /**
- * Adds the given presentable part to this presentation at the given index.
- * Does nothing if a tab already exists for the given part.
- *
- * @param newPart
- * @param index
- */
- public void addPart(IPresentablePart newPart, int index) {
- // If we already have a tab for this part, do nothing
- if (getTab(newPart) != null) {
- return;
- }
- createPartTab(newPart, index);
-
- setControlSize();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.StackPresentation#removePart(org.eclipse.ui.internal.skins.IPresentablePart)
- */
- public void removePart(IPresentablePart oldPart) {
- if (current == oldPart) {
- titleLabel.setImage(null);
- current = null;
- }
-
- CTabItem item = getTab(oldPart);
- if (item == null) {
- return;
- }
- oldPart.setVisible(false);
-
- item.dispose();
-
- // Layout the folder again in case there is only one item
- setControlSize();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.StackPresentation#selectPart(org.eclipse.ui.internal.skins.IPresentablePart)
- */
- public void selectPart(IPresentablePart toSelect) {
- if (toSelect == current) {
- return;
- }
-
- IPresentablePart oldPart = current;
-
- current = toSelect;
-
- if (current != null) {
- paneFolder.setSelection(indexOf(current));
- current.setVisible(true);
- updateCloseButton();
- setControlSize();
- }
-
- if (oldPart != null) {
- oldPart.setVisible(false);
- }
- }
-
- /**
- * @return the current part
- */
- public IPresentablePart getCurrentPart() {
- return current;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.Presentation#setBounds(org.eclipse.swt.graphics.Rectangle)
- */
- public void setBounds(Rectangle bounds) {
- if (getSite().getState() == IStackPresentationSite.STATE_MINIMIZED) {
- bounds = Geometry.copy(bounds);
- bounds.height = computePreferredSize(false, Integer.MAX_VALUE,
- bounds.width, Integer.MAX_VALUE);
- }
-
- paneFolder.getControl().setBounds(bounds);
- setControlSize();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.Presentation#computeMinimumSize()
- */
- public Point computeMinimumSize() {
- Point result = Geometry.getSize(paneFolder.computeTrim(0, 0, 0, 0));
-
- result.x += 100;
-
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.Presentation#setVisible(boolean)
- */
- public void setVisible(boolean isVisible) {
- if (current != null) {
- current.setVisible(isVisible);
- }
- paneFolder.getControl().setVisible(isVisible);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.Presentation#setState(int)
- */
- public void setState(int state) {
- // tabFolder.setState(state);
- }
-
- /**
- * @return the menu manager
- */
- public IMenuManager getSystemMenuManager() {
- return systemMenuManager;
- }
-
- /**
- * @param point
- */
- protected void showSystemMenu(Point point) {
- Menu aMenu = systemMenuManager.createContextMenu(paneFolder
- .getControl().getParent());
- systemMenuManager.update(true);
- aMenu.setLocation(point.x, point.y);
- aMenu.setVisible(true);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.Presentation#getControl()
- */
- public Control getControl() {
- return paneFolder.getControl();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.StackPresentation#dragOver(org.eclipse.swt.widgets.Control,
- * org.eclipse.swt.graphics.Point)
- */
- public StackDropResult dragOver(Control currentControl, Point location) {
-
- // Determine which tab we're currently dragging over
- Point localPos = paneFolder.getControl().toControl(location);
- final CTabItem tabUnderPointer = paneFolder.getItem(localPos);
-
- // This drop target only deals with tabs... if we're not dragging over
- // a tab, exit.
- if (tabUnderPointer == null) {
- return null;
- }
-
- // workaround when left tab is dragged over next
- int dragOverIndex = paneFolder.indexOf(tabUnderPointer);
-
- return new StackDropResult(Geometry.toDisplay(paneFolder.getControl(),
- tabUnderPointer.getBounds()), new Integer(dragOverIndex));
- }
-
- /**
- * Returns the toolbar control for the currently selected part, or null if
- * none (not all parts have a toolbar).
- *
- * @return the current toolbar or null if none
- */
- protected Control getCurrentToolbar() {
- IPresentablePart part = getCurrentPart();
- if (part == null) {
- return null;
- }
-
- return part.getToolBar();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.presentations.StackPresentation#showSystemMenu()
- */
- public void showSystemMenu() {
- IPresentablePart part = getCurrentPart();
- if (part != null) {
- Rectangle bounds = DragUtil.getDisplayBounds(paneFolder
- .getControl());
-
- int idx = paneFolder.getSelectionIndex();
- if (idx > -1) {
- CTabItem item = paneFolder.getItem(idx);
- Rectangle itemBounds = item.getBounds();
-
- bounds.x += itemBounds.x;
- bounds.y += itemBounds.y;
- }
-
- Point location = new Point(bounds.x, bounds.y
- + paneFolder.getTabHeight());
- showSystemMenu(location);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.presentations.StackPresentation#getTabList(IPresentablePart)
- */
- public Control[] getTabList(IPresentablePart part) {
- ArrayList list = new ArrayList();
- if (paneFolder.getTabPosition() == SWT.BOTTOM) {
- if (part.getToolBar() != null) {
- list.add(part.getToolBar());
- }
- if (part.getControl() != null) {
- list.add(part.getControl());
- }
- if (getPaneFolder() != null) {
- list.add(getPaneFolder().getControl());
- }
- } else {
- if (getPaneFolder() != null) {
- list.add(getPaneFolder().getControl());
- }
- if (part.getToolBar() != null) {
- list.add(part.getToolBar());
- }
- if (part.getControl() != null) {
- list.add(part.getControl());
- }
- }
- return (Control[]) list.toArray(new Control[list.size()]);
- }
-
- /**
- * @param parentShell
- * @param x
- * @param y
- */
- protected void showList(Shell parentShell, int x, int y) {
- // final R21PaneFolder tabFolder = getTabFolder();
- //
- // int shellStyle = SWT.RESIZE | SWT.ON_TOP | SWT.NO_TRIM;
- // int tableStyle = SWT.V_SCROLL | SWT.H_SCROLL;
- // final BasicStackList editorList = new
- // BasicStackList(tabFolder.getControl().getShell(),
- // shellStyle, tableStyle);
- // editorList.setInput(this);
- // Point size = editorList.computeSizeHint();
- //
- // Rectangle bounds = Display.getCurrent().getBounds();
- // if (x + size.x > bounds.width) x = bounds.width - size.x;
- // if (y + size.y > bounds.height) y = bounds.height - size.y;
- // editorList.setLocation(new Point(x, y));
- // editorList.setVisible(true);
- // editorList.setFocus();
- // editorList.getTableViewer().getTable().getShell().addListener(
- // SWT.Deactivate, new Listener() {
- //
- // public void handleEvent(Event event) {
- // editorList.setVisible(false);
- // }
- // });
- }
-
- /*
- * Shows the list of tabs at the top left corner of the editor
- */
- protected void showListDefaultLocation() {
- R21PaneFolder tabFolder = getPaneFolder();
- Shell shell = tabFolder.getControl().getShell();
- Rectangle clientArea = tabFolder.getClientArea();
- Point location = tabFolder.getControl().getDisplay().map(
- tabFolder.getControl(), null, clientArea.x, clientArea.y);
- showList(shell, location.x, location.y);
- }
-
- void setSelection(CTabItem tabItem) {
- getSite().selectPart(getPartForTab(tabItem));
- }
-
- void close(IPresentablePart presentablePart) {
- getSite().close(new IPresentablePart[] { presentablePart });
- }
-
- Image getLabelImage(IPresentablePart presentablePart) {
- return presentablePart.getTitleImage();
- }
-
- /**
- * @param presentablePart
- * @param includePath
- */
- String getLabelText(IPresentablePart presentablePart, boolean includePath) {
- String title = presentablePart.getTitle().trim();
- return title;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.presentations.StackPresentation#setActive(int)
- */
- public void setActive(int newState) {
- setActive(newState == AS_ACTIVE_FOCUS);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.presentations.StackPresentation#restoreState(org.eclipse.ui.presentations.IPresentationSerializer,
- * org.eclipse.ui.IMemento)
- */
- public void restoreState(IPresentationSerializer serializer,
- IMemento savedState) {
- IMemento[] parts = savedState.getChildren(IWorkbenchConstants.TAG_PART);
-
- for (int idx = 0; idx < parts.length; idx++) {
- String id = parts[idx].getString(IWorkbenchConstants.TAG_ID);
-
- if (id != null) {
- IPresentablePart part = serializer.getPart(id);
-
- if (part != null) {
- addPart(part, getPaneFolder().getItemCount());
- }
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.presentations.StackPresentation#saveState(org.eclipse.ui.presentations.IPresentationSerializer,
- * org.eclipse.ui.IMemento)
- */
- public void saveState(IPresentationSerializer context, IMemento memento) {
- super.saveState(context, memento);
-
- List parts = getPresentableParts();
-
- Iterator iter = parts.iterator();
- while (iter.hasNext()) {
- IPresentablePart next = (IPresentablePart) iter.next();
-
- IMemento childMem = memento
- .createChild(IWorkbenchConstants.TAG_PART);
- childMem.putString(IWorkbenchConstants.TAG_ID, context.getId(next));
- }
- }
-
- /**
- * Returns the List of IPresentablePart currently in this presentation
- */
- private List getPresentableParts() {
- Assert.isTrue(!isDisposed());
-
- CTabItem[] items = getPaneFolder().getItems();
- List result = new ArrayList(items.length);
-
- for (int idx = 0; idx < getPaneFolder().getItemCount(); idx++) {
- result.add(getPartForTab(items[idx]));
- }
-
- return result;
- }
-}
diff --git a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/R21EditorStackPresentation.java b/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/R21EditorStackPresentation.java
deleted file mode 100644
index c50a355..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/R21EditorStackPresentation.java
+++ /dev/null
@@ -1,1007 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * 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.presentations;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.action.GroupMarker;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.Geometry;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPropertyListener;
-import org.eclipse.ui.IWorkbenchPreferenceConstants;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.IPreferenceConstants;
-import org.eclipse.ui.internal.IWorkbenchConstants;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.WorkbenchWindow;
-import org.eclipse.ui.internal.dnd.DragUtil;
-import org.eclipse.ui.internal.presentations.r21.R21Colors;
-import org.eclipse.ui.internal.presentations.r21.R21PresentationMessages;
-import org.eclipse.ui.internal.presentations.r21.widgets.CTabFolder;
-import org.eclipse.ui.internal.presentations.r21.widgets.CTabFolderEvent;
-import org.eclipse.ui.internal.presentations.r21.widgets.CTabFolderListener;
-import org.eclipse.ui.internal.presentations.r21.widgets.CTabItem;
-import org.eclipse.ui.presentations.IPartMenu;
-import org.eclipse.ui.presentations.IPresentablePart;
-import org.eclipse.ui.presentations.IPresentationSerializer;
-import org.eclipse.ui.presentations.IStackPresentationSite;
-import org.eclipse.ui.presentations.PresentationUtil;
-import org.eclipse.ui.presentations.StackDropResult;
-import org.eclipse.ui.presentations.StackPresentation;
-
-/**
- * A stack presentation for editors using a widget set that is close to what was
- * provided in 2.1.
- * <p>
- * EXPERIMENTAL
- * </p>
- *
- * @since 3.0
- */
-public class R21EditorStackPresentation extends StackPresentation {
-
- /** the tab folder */
- private CTabFolder tabFolder;
-
- /** the drag listener */
- private Listener dragListener = new Listener() {
-
- public void handleEvent(Event event) {
- Point localPos = new Point(event.x, event.y);
- CTabItem tabUnderPointer = tabFolder.getItem(localPos);
-
- if (tabUnderPointer == null) {
- // drag the entire stack
- if (getSite().isStackMoveable()) {
- getSite().dragStart(tabFolder.toDisplay(localPos), false);
- }
- return;
- }
-
- IPresentablePart part = getPartForTab(tabUnderPointer);
-
- if (getSite().isPartMoveable(part)) {
- // drag the part
- getSite().dragStart(part, tabFolder.toDisplay(localPos), false);
- }
- }
- };
-
- /** the listener that will close the tab */
- private CTabFolderListener closeListener = new CTabFolderListener() {
-
- public void itemClosed(CTabFolderEvent e) {
- CTabItem item = (CTabItem) e.item;
- if (null != item) {
- e.doit = false; // otherwise tab is auto disposed on return
- getSite().close(new IPresentablePart[] { getPartForTab(item) });
- }
- }
- };
-
- /** the current part */
- private IPresentablePart current;
-
- /** the system menu */
- private MenuManager systemMenuManager = new MenuManager();
-
- /** the shared preference store */
- private static IPreferenceStore preferenceStore = WorkbenchPlugin
- .getDefault().getPreferenceStore();
-
- // don't reset this dynamically, so just keep the information static.
- // see bug:
- // 75422 [Presentations] Switching presentation to R21 switches immediately,
- // but only partially
- private static int tabPos = PlatformUI.getPreferenceStore()
- .getInt(IWorkbenchPreferenceConstants.EDITOR_TAB_POSITION);
-
- /** the tab item property holding the part */
- private final static String TAB_DATA = R21EditorStackPresentation.class
- .getName()
- + ".partId"; //$NON-NLS-1$
-
- /** the mouse listener for setting focus */
- private MouseListener mouseListener = new MouseAdapter() {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseDown(MouseEvent e) {
- if (e.widget instanceof Control) {
- Control ctrl = (Control) e.widget;
-
- Point globalPos = ctrl.toDisplay(new Point(e.x, e.y));
-
- CTabItem newItem = tabFolder.getItem(tabFolder
- .toControl(globalPos));
- if (newItem != null) {
-
- // show menu over icon
- if ((e.button == 1) && overImage(newItem, e.x)) {
- getSite().selectPart(getPartForTab(newItem));
- showSystemMenu();
- }
-
- // PR#1GDEZ25 - If selection will change in mouse up ignore
- // mouse down.
- CTabItem oldItem = tabFolder.getSelection();
- if (newItem != oldItem) {
- return;
- }
- }
-
- // set focus
- if (current != null) {
- current.setFocus();
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.MouseAdapter#mouseDoubleClick(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseDoubleClick(MouseEvent e) {
- if (getSite().getState() == IStackPresentationSite.STATE_MAXIMIZED) {
- getSite().setState(IStackPresentationSite.STATE_RESTORED);
- } else {
- getSite().setState(IStackPresentationSite.STATE_MAXIMIZED);
- }
- }
- };
-
- /**
- * Return true if <code>x</code> is over the tab item image.
- *
- * @return true if <code>x</code> is over the tab item image
- */
- static boolean overImage(CTabItem item, int x) {
- Rectangle imageBounds = item.getImage().getBounds();
- return x < (item.getBounds().x + imageBounds.x + imageBounds.width);
- }
-
- /** the menu listener for showing the menu */
- private Listener menuListener = new Listener() {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
- */
- public void handleEvent(Event event) {
- Point pos = new Point(event.x, event.y);
- showSystemMenu(pos);
- }
- };
-
- /** the selection listener */
- private Listener selectionListener = new Listener() {
-
- public void handleEvent(Event e) {
- IPresentablePart item = getPartForTab((CTabItem) e.item);
- if (item != null) {
- getSite().selectPart(item);
- }
- }
- };
-
- private Listener resizeListener = new Listener() {
-
- public void handleEvent(Event e) {
- setControlSize();
- }
- };
-
- /** a property change listener for the parts */
- private IPropertyListener childPropertyChangeListener = new IPropertyListener() {
-
- public void propertyChanged(Object source, int property) {
- if (source instanceof IPresentablePart) {
- IPresentablePart part = (IPresentablePart) source;
- childPropertyChanged(part, property);
- }
- }
- };
-
- /** a dispose listener to do some cleanups when a tab is disposed */
- private DisposeListener tabDisposeListener = new DisposeListener() {
-
- public void widgetDisposed(DisposeEvent e) {
- if (e.widget instanceof CTabItem) {
- CTabItem item = (CTabItem) e.widget;
- IPresentablePart part = getPartForTab(item);
- part.removePropertyListener(childPropertyChangeListener);
- }
- }
- };
-
- /** the shell listener for upgrading the gradient */
- private ShellAdapter shellListener = new ShellAdapter() {
-
- public void shellActivated(ShellEvent event) {
- updateGradient();
- }
-
- public void shellDeactivated(ShellEvent event) {
- updateGradient();
- }
- };
-
- /**
- * Create a new presentation stack.
- *
- * @param parent
- * the parent widget
- * @param stackSite
- * the site
- */
- public R21EditorStackPresentation(Composite parent,
- IStackPresentationSite stackSite) {
- super(stackSite);
-
- // create the tab folder
- tabFolder = new CTabFolder(parent, tabPos | SWT.BORDER);
-
- // minimum tab width
- tabFolder.MIN_TAB_WIDTH = preferenceStore
- .getInt(IPreferenceConstants.EDITOR_TAB_WIDTH);
-
- // prevent close button and scroll buttons from taking focus
- tabFolder.setTabList(new Control[0]);
-
- // enable close button in tab folder
- tabFolder.addCTabFolderListener(closeListener);
-
- // listener to switch between visible tabItems
- tabFolder.addListener(SWT.Selection, selectionListener);
-
- // listener to resize visible components
- tabFolder.addListener(SWT.Resize, resizeListener);
-
- // listen for mouse down on tab to set focus, show system menu and
- // maximize/restore.
- tabFolder.addMouseListener(mouseListener);
-
- // the menu
- tabFolder.addListener(SWT.MenuDetect, menuListener);
-
- // register drag listener
- PresentationUtil.addDragListener(tabFolder, dragListener);
-
- // add the shell listener to track shell activations
- // TODO: check if workaround can be removed (see bug 55458)
- tabFolder.getShell().addShellListener(shellListener);
-
- // initialize system menu
- populateSystemMenu(systemMenuManager);
- }
-
- /**
- * Initializes the specified menu manager.
- *
- * @param menuManager
- */
- private void populateSystemMenu(IMenuManager menuManager) {
-
- menuManager.add(new GroupMarker("misc")); //$NON-NLS-1$
- menuManager.add(new GroupMarker("restore")); //$NON-NLS-1$
- menuManager.add(new UpdatingActionContributionItem(
- new SystemMenuRestore(getSite())));
- menuManager.add(new SystemMenuMove(getSite(), getPaneName()));
- menuManager.add(new GroupMarker("size")); //$NON-NLS-1$
- menuManager.add(new GroupMarker("state")); //$NON-NLS-1$
- // systemMenuManager.add(new UpdatingActionContributionItem(new
- // SystemMenuMinimize(getSite())));
- menuManager.add(new UpdatingActionContributionItem(
- new SystemMenuMaximize(getSite())));
- menuManager.add(new Separator("close")); //$NON-NLS-1$
- menuManager.add(new UpdatingActionContributionItem(new SystemMenuClose(
- getSite())));
-
- getSite().addSystemActions(menuManager);
- }
-
- /**
- * Returns the index of the tab for the given part, or returns
- * tabFolder.getItemCount() if there is no such tab.
- *
- * @param part
- * part being searched for
- * @return the index of the tab for the given part, or the number of tabs if
- * there is no such tab
- */
- private final int indexOf(IPresentablePart part) {
- if (part == null) {
- return tabFolder.getItemCount();
- }
-
- CTabItem[] items = tabFolder.getItems();
- for (int idx = 0; idx < items.length; idx++) {
- if (part == getPartForTab(items[idx])) {
- return idx;
- }
- }
-
- return items.length;
- }
-
- /**
- * Returns the tab for the given part, or null if there is no such tab
- *
- * @param part
- * the part being searched for
- * @return the tab for the given part, or null if there is no such tab
- */
- protected final CTabItem getTab(IPresentablePart part) {
- CTabItem[] items = tabFolder.getItems();
- int idx = indexOf(part);
- return idx < items.length ? items[idx] : null;
- }
-
- /**
- * @param part
- * @param property
- */
- protected void childPropertyChanged(IPresentablePart part, int property) {
- initTab(getTab(part), part);
- }
-
- protected final IPresentablePart getPartForTab(CTabItem item) {
- return (IPresentablePart) item.getData(TAB_DATA);
- }
-
- protected CTabFolder getTabFolder() {
- return tabFolder;
- }
-
- /**
- * Answer whether the receiver is disposed.
- *
- * @return boolean <code>true</code> if disposed
- */
- public boolean isDisposed() {
- return tabFolder == null || tabFolder.isDisposed();
- }
-
- /**
- * Set the size of a page in the folder.
- */
- private void setControlSize() {
- if (current != null && tabFolder != null) {
- current.setBounds(calculatePageBounds(tabFolder));
- }
- }
-
- /**
- * Calculate the bounds of the client area inside the folder
- *
- * @param folder
- * @return Rectangle the bounds of the client
- */
- public static Rectangle calculatePageBounds(CTabFolder folder) {
- if (folder == null) {
- return new Rectangle(0, 0, 0, 0);
- }
-
- Rectangle bounds = folder.getBounds();
- Rectangle offset = folder.getClientArea();
- bounds.x += offset.x;
- bounds.y += offset.y;
- bounds.width = offset.width;
- bounds.height = offset.height;
- return bounds;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.Presentation#dispose()
- */
- public void dispose() {
- if (isDisposed()) {
- return;
- }
-
- // remove shell listener
- tabFolder.getShell().removeShellListener(shellListener);
-
- // remove close listener
- tabFolder.removeCTabFolderListener(closeListener);
-
- // remove drag listener
- PresentationUtil.removeDragListener(tabFolder, dragListener);
-
- // dispose system menu manager
- systemMenuManager.dispose();
- systemMenuManager.removeAll();
-
- // dispose tab folder
- tabFolder.dispose();
- tabFolder = null;
- }
-
- /** the active state */
- private int activeState = AS_INACTIVE;
-
- /**
- * Update the tab folder's colours to match the current theme settings and
- * active state
- */
- private void updateGradient() {
-
- if (isDisposed()) {
- return;
- }
-
- Color fgColor;
- Color[] bgColors;
- int[] bgPercents;
- boolean vertical = false;
- if (activeState == AS_ACTIVE_FOCUS) {
- if (getShellActivated()) {
- fgColor = R21Colors.getSystemColor(SWT.COLOR_TITLE_FOREGROUND);
- bgColors = R21Colors.getActiveEditorGradient();
- bgPercents = R21Colors.getActiveEditorGradientPercents();
- } else {
- fgColor = R21Colors
- .getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND);
- bgColors = R21Colors.getDeactivatedEditorGradient();
- bgPercents = R21Colors.getDeactivatedEditorGradientPercents();
- }
-
- } else if (activeState == AS_ACTIVE_NOFOCUS) {
- fgColor = R21Colors.getSystemColor(SWT.COLOR_LIST_FOREGROUND);
- bgColors = R21Colors.getActiveNoFocusEditorGradient();
- bgPercents = R21Colors.getActiveNoFocusEditorGradientPercents();
- } else {
- fgColor = null;
- bgColors = null;
- bgPercents = null;
- }
-
- drawGradient(fgColor, bgColors, bgPercents, vertical);
- }
-
- /**
- * Sets the gradient for the selected tab
- *
- * @param fgColor
- * @param bgColors
- * @param percentages
- * @param vertical
- */
- protected void drawGradient(Color fgColor, Color[] bgColors,
- int[] percentages, boolean vertical) {
- tabFolder.setSelectionForeground(fgColor);
- tabFolder.setSelectionBackground(bgColors, percentages);
- tabFolder.update();
- }
-
- /**
- * Return whether the window's shell is activated
- */
- /* package */boolean getShellActivated() {
- Window window = getWindow();
- if (window instanceof WorkbenchWindow) {
- return ((WorkbenchWindow) window).getShellActivated();
- }
- return false;
- }
-
- /**
- * Returns the top level window.
- *
- * @return Window the window for the receiver
- */
- public Window getWindow() {
- Control ctrl = getControl();
- if (ctrl != null) {
- Object data = ctrl.getShell().getData();
- if (data instanceof Window) {
- return (Window) data;
- }
- }
- return null;
- }
-
- /**
- * Creates the tab item for the specified part.
- *
- * @param part
- * @param tabIndex
- * @return the tab item for the part
- */
- private CTabItem createPartTab(IPresentablePart part, int tabIndex) {
- CTabItem tabItem = new CTabItem(tabFolder, SWT.NONE, tabIndex);
- tabItem.setData(TAB_DATA, part);
- part.addPropertyListener(childPropertyChangeListener);
- tabItem.addDisposeListener(tabDisposeListener);
- initTab(tabItem, part);
- return tabItem;
- }
-
- /**
- * Initializes a tab for the given part. Sets the text, icon, tool tip, etc.
- * This will also be called whenever a relevant property changes in the part
- * to reflect those changes in the tab. Subclasses may override to change
- * the appearance of tabs for a particular part.
- *
- * @param tabItem
- * tab for the part
- * @param part
- * the part being displayed
- */
- protected void initTab(CTabItem tabItem, IPresentablePart part) {
-
- // set tab text and tooltip
- tabItem.setText(getLabelText(part, true, false));
- tabItem.setToolTipText(getLabelToolTipText(part));
-
- // set tab image
- tabItem.setImage(getLabelImage(part));
-
- // following code allows a disabled image
- // but the result was distracting: didn't see any disabled image
-
- // Image image = getLabelImage(part);
- // boolean useColorIcons = false; // should we use a preference setting?
- //
- // if (image == null || image.isDisposed()) {
- // // normal image
- // tabItem.setImage(null);
- // // disabled image
- // if (!useColorIcons) {
- // Image disableImage = tabItem.getDisabledImage();
- // if (disableImage != null) {
- // disableImage.dispose();
- // tabItem.setDisabledImage(null);
- // }
- // }
- // } else if (!image.equals(tabItem.getImage())) {
- // // normal image
- // tabItem.setImage(image);
- // // disabled image
- // if (!useColorIcons) {
- // Image disableImage = tabItem.getDisabledImage();
- // if (disableImage != null)
- // disableImage.dispose();
- // Display display = tabItem.getDisplay();
- // disableImage = new Image(display, image, SWT.IMAGE_DISABLE);
- // tabItem.setDisabledImage(disableImage);
- // }
- // }
-
- }
-
- /**
- * Returns the label text that should be used for the tab item for the
- * specified part
- *
- * @param presentablePart
- * @param dirtyLeft
- * @param includePath
- * @return a formated label text
- */
- String getLabelText(IPresentablePart presentablePart, boolean dirtyLeft,
- boolean includePath) {
- String title = presentablePart.getName().trim();
- String text = title;
-
- if (includePath) {
- String titleTooltip = presentablePart.getTitleToolTip().trim();
-
- if (titleTooltip.endsWith(title)) {
- titleTooltip = titleTooltip.substring(0,
- titleTooltip.lastIndexOf(title)).trim();
- }
-
- if (titleTooltip.endsWith("\\")) { //$NON-NLS-1$
- titleTooltip = titleTooltip.substring(0,
- titleTooltip.lastIndexOf("\\")).trim(); //$NON-NLS-1$
- }
-
- if (titleTooltip.endsWith("/")) { //$NON-NLS-1$
- titleTooltip = titleTooltip.substring(0,
- titleTooltip.lastIndexOf("/")).trim(); //$NON-NLS-1$
- }
-
- if (titleTooltip.length() >= 1) {
- text += " - " + titleTooltip; //$NON-NLS-1$
- }
- }
-
- if (presentablePart.isDirty()) {
- if (dirtyLeft) {
- text = "* " + text; //$NON-NLS-1$
- } else {
- text = text + " *"; //$NON-NLS-1$
- }
- }
-
- return text;
- }
-
- /**
- * Returns the image used for the tab item
- *
- * @param presentablePart
- * @return an image
- */
- Image getLabelImage(IPresentablePart presentablePart) {
- return presentablePart.getTitleImage();
- }
-
- /**
- * Returns the tool tip text used for the tab item
- *
- * @param presentablePart
- * @return a tool tip text
- */
- String getLabelToolTipText(IPresentablePart presentablePart) {
- return presentablePart.getTitleToolTip();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.StackPresentation#addPart(org.eclipse.ui.internal.skins.IPresentablePart,
- * org.eclipse.ui.internal.skins.IPresentablePart)
- */
- public void addPart(IPresentablePart newPart, Object cookie) {
-
- int idx;
-
- if (cookie instanceof Integer) {
- idx = ((Integer) cookie).intValue();
- } else {
- // Select a location for newly inserted parts
- idx = tabFolder.getItemCount();
- }
-
- addPart(newPart, idx);
- }
-
- /**
- * Adds the given presentable part to this presentation at the given index.
- * Does nothing if a tab already exists for the given part.
- *
- * @param newPart
- * @param index
- */
- public void addPart(IPresentablePart newPart, int index) {
- // If we already have a tab for this part, do nothing
- if (getTab(newPart) != null) {
- return;
- }
- createPartTab(newPart, index);
-
- // setControlSize();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.StackPresentation#removePart(org.eclipse.ui.internal.skins.IPresentablePart)
- */
- public void removePart(IPresentablePart oldPart) {
- if (current == oldPart) {
- current = null;
- }
-
- CTabItem item = getTab(oldPart);
- if (item == null) {
- return;
- }
- oldPart.setVisible(false);
-
- item.dispose();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.StackPresentation#selectPart(org.eclipse.ui.internal.skins.IPresentablePart)
- */
- public void selectPart(IPresentablePart toSelect) {
- if (toSelect == current) {
- return;
- }
-
- IPresentablePart oldPart = current;
-
- current = toSelect;
-
- if (current != null) {
- tabFolder.setSelection(indexOf(current));
- current.setVisible(true);
- setControlSize();
-
- }
-
- if (oldPart != null) {
- oldPart.setVisible(false);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.Presentation#setBounds(org.eclipse.swt.graphics.Rectangle)
- */
- public void setBounds(Rectangle bounds) {
- tabFolder.setBounds(bounds);
- setControlSize();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.Presentation#computeMinimumSize()
- */
- public Point computeMinimumSize() {
- return Geometry.getSize(tabFolder.computeTrim(0, 0, 0, 0));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.Presentation#setVisible(boolean)
- */
- public void setVisible(boolean isVisible) {
- if (current != null) {
- current.setVisible(isVisible);
- }
-
- getTabFolder().setVisible(isVisible);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.Presentation#setState(int)
- */
- public void setState(int state) {
- // tabFolder.setMinimized(state == IPresentationSite.STATE_MINIMIZED);
- // tabFolder.setMaximized(state == IPresentationSite.STATE_MAXIMIZED);
- }
-
- /**
- * Returns the system menu manager.
- *
- * @return the system menu manager
- */
- public IMenuManager getSystemMenuManager() {
- return systemMenuManager;
- }
-
- /**
- * Shows the system context menu at the specified location
- *
- * @param point
- */
- protected void showSystemMenu(Point point) {
- Menu aMenu = systemMenuManager.createContextMenu(tabFolder.getParent());
- systemMenuManager.update(true);
- aMenu.setLocation(point.x, point.y);
- aMenu.setVisible(true);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.Presentation#getControl()
- */
- public Control getControl() {
- return tabFolder;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.internal.skins.StackPresentation#dragOver(org.eclipse.swt.widgets.Control,
- * org.eclipse.swt.graphics.Point)
- */
- public StackDropResult dragOver(Control currentControl, Point location) {
-
- // Determine which tab we're currently dragging over
- Point localPos = tabFolder.toControl(location);
- final CTabItem tabUnderPointer = tabFolder.getItem(localPos);
-
- // This drop target only deals with tabs... if we're not dragging over
- // a tab, exit.
- if (tabUnderPointer == null) {
- return null;
- }
-
- // workaround when left tab is dragged over next
- int dragOverIndex = tabFolder.indexOf(tabUnderPointer);
-
- return new StackDropResult(Geometry.toDisplay(tabFolder,
- tabUnderPointer.getBounds()), new Integer(dragOverIndex));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.presentations.StackPresentation#showSystemMenu()
- */
- public void showSystemMenu() {
- if (null != current) {
- // switch to the editor
- CTabItem item = getTab(current);
- getSite().selectPart(getCurrentPart());
- Rectangle bounds = item.getBounds();
- int y = bounds.height;
- if (getTabFolder().getTabPosition() == SWT.BOTTOM) {
- y += bounds.y;
- }
- showSystemMenu(getTabFolder().toDisplay(bounds.x, y));
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.presentations.StackPresentation#showPaneMenu()
- */
- public void showPaneMenu() {
- IPartMenu menu = getPartMenu();
-
- if (null != menu) {
- CTabItem tab = getTab(getCurrentPart());
-
- if (null != tab && null != tab.getControl()) {
- Rectangle bounds = DragUtil.getDisplayBounds(tab.getControl());
- menu.showMenu(new Point(bounds.x, bounds.y + bounds.height));
- }
- }
- }
-
- /**
- * Returns the IPartMenu for the currently selected part, or null if the
- * current part does not have a menu.
- *
- * @return the IPartMenu for the currently selected part or null if none
- */
- protected IPartMenu getPartMenu() {
- IPresentablePart part = getCurrentPart();
- if (part == null) {
- return null;
- }
-
- return part.getMenu();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.presentations.StackPresentation#getTabList(IPresentablePart)
- */
- public Control[] getTabList(IPresentablePart part) {
- ArrayList list = new ArrayList();
- if (getControl() != null) {
- list.add(getControl());
- }
- if (part.getToolBar() != null) {
- list.add(part.getToolBar());
- }
- if (part.getControl() != null) {
- list.add(part.getControl());
- }
- return (Control[]) list.toArray(new Control[list.size()]);
- }
-
- /**
- * @return the current part
- */
- public IPresentablePart getCurrentPart() {
- return current;
- }
-
- protected String getPaneName() {
- return R21PresentationMessages.getString("EditorPane.moveEditor"); //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.presentations.StackPresentation#setActive(int)
- */
- public void setActive(int newState) {
- activeState = newState;
- updateGradient();
- }
-
- /**
- * Restores a presentation from a previously stored state
- *
- * @param serializer (not null)
- * @param savedState (not null)
- */
- public void restoreState(IPresentationSerializer serializer, IMemento savedState) {
- IMemento[] parts = savedState.getChildren(IWorkbenchConstants.TAG_PART);
-
- for (int idx = 0; idx < parts.length; idx++) {
- String id = parts[idx].getString(IWorkbenchConstants.TAG_ID);
-
- if (id != null) {
- IPresentablePart part = serializer.getPart(id);
-
- if (part != null) {
- addPart(part, tabFolder.getItemCount());
- }
- }
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.presentations.StackPresentation#saveState(org.eclipse.ui.presentations.IPresentationSerializer, org.eclipse.ui.IMemento)
- */
- public void saveState(IPresentationSerializer context, IMemento memento) {
- super.saveState(context, memento);
-
- List parts = getPresentableParts();
-
- Iterator iter = parts.iterator();
- while (iter.hasNext()) {
- IPresentablePart next = (IPresentablePart)iter.next();
-
- IMemento childMem = memento.createChild(IWorkbenchConstants.TAG_PART);
- childMem.putString(IWorkbenchConstants.TAG_ID, context.getId(next));
- }
- }
-
- /**
- * Returns the List of IPresentablePart currently in this presentation
- */
- private List getPresentableParts() {
- Assert.isTrue(!isDisposed());
-
- CTabItem[] items = tabFolder.getItems();
- List result = new ArrayList(items.length);
-
- for (int idx = 0; idx < tabFolder.getItemCount(); idx++) {
- result.add(getPartForTab(items[idx]));
- }
-
- return result;
- }
- }
diff --git a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/R21PresentationFactory.java b/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/R21PresentationFactory.java
deleted file mode 100644
index 04f2b83..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/R21PresentationFactory.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * 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.presentations;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.presentations.IStackPresentationSite;
-import org.eclipse.ui.presentations.StackPresentation;
-import org.eclipse.ui.presentations.WorkbenchPresentationFactory;
-
-/**
- * A presentation factory that creates a look similar to previous verisons of eclipse.
- */
-public class R21PresentationFactory extends WorkbenchPresentationFactory {
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.presentations.AbstractPresentationFactory
- */
- public StackPresentation createEditorPresentation(Composite parent,
- IStackPresentationSite site) {
- return new R21EditorStackPresentation(parent, site);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.presentations.AbstractPresentationFactory
- */
- public StackPresentation createViewPresentation(Composite parent,
- IStackPresentationSite site) {
- return new R21ViewStackPresentation(parent, site);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.presentations.AbstractPresentationFactory
- */
- public StackPresentation createStandaloneViewPresentation(Composite parent,
- IStackPresentationSite site, boolean showTitle) {
- // TODO: honour showTitle
- return new R21ViewStackPresentation(parent, site);
- }
-
-}
diff --git a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/R21ViewStackPresentation.java b/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/R21ViewStackPresentation.java
deleted file mode 100644
index 348bc92..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/R21ViewStackPresentation.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * 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.presentations;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbenchPreferenceConstants;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.presentations.r21.R21PresentationMessages;
-import org.eclipse.ui.internal.presentations.r21.widgets.CTabFolderEvent;
-import org.eclipse.ui.internal.presentations.r21.widgets.R21PaneFolder;
-import org.eclipse.ui.internal.presentations.r21.widgets.R21PaneFolderButtonListener;
-import org.eclipse.ui.presentations.IStackPresentationSite;
-
-/**
- * Controls the appearance of views stacked into the workbench.
- *
- * @since 3.0
- */
-public class R21ViewStackPresentation extends R21BasicStackPresentation {
-
- // don't reset this dynamically, so just keep the information static.
- // see bug:
- // 75422 [Presentations] Switching presentation to R21 switches immediately, but only partially
- private static int tabPos = PlatformUI.getPreferenceStore().getInt(IWorkbenchPreferenceConstants.VIEW_TAB_POSITION);
-
- private R21PaneFolderButtonListener showListListener = new R21PaneFolderButtonListener() {
-
- public void showList(CTabFolderEvent event) {
- event.doit = false;
- showListDefaultLocation();
- }
- };
-
- /**
- * Create a new view stack presentation.
- *
- * @param parent
- * @param newSite
- */
- public R21ViewStackPresentation(Composite parent,
- IStackPresentationSite newSite) {
-
- super(new R21PaneFolder(parent, SWT.BORDER), newSite);
- R21PaneFolder tabFolder = getPaneFolder();
-
- tabFolder.addButtonListener(showListListener);
-
- tabFolder.setTabPosition(tabPos);
- updateGradient();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.skins.Presentation#setActive(boolean)
- */
- public void setActive(boolean isActive) {
- super.setActive(isActive);
-
- updateGradient();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.internal.presentations.DefaultPartPresentation#getPartMenu()
- */
- protected String getPaneName() {
- return R21PresentationMessages.getString("ViewPane.moveView"); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/R21Colors.java b/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/R21Colors.java
deleted file mode 100644
index 157c602..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/R21Colors.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * 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.presentations.r21;
-
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * This class manages the R21 workbench colors (they are fixed).
- */
-public class R21Colors {
-
- static private boolean init = false;
-
- static private HashMap colorMap;
-
- static private HashMap systemColorMap;
-
- static private Color workbenchColors[];
-
- static private Color[] activeViewGradient;
-
- static private Color[] deactivatedViewGradient;
-
- static private Color[] activeEditorGradient;
-
- static private Color[] activeNoFocusEditorGradient;
-
- static private Color[] deactivatedEditorGradient;
-
- static private int[] activeViewPercentages;
-
- static private int[] deactivatedViewPercentages;
-
- static private int[] activeEditorPercentages;
-
- static private int[] activeNoFocusEditorPercentages;
-
- static private int[] deactivatedEditorPercentages;
-
- static private final String CLR_VIEW_GRAD_START = "clrViewGradStart";//$NON-NLS-1$
-
- static private final String CLR_VIEW_GRAD_END = "clrViewGradEnd";//$NON-NLS-1$
-
- static private final String CLR_EDITOR_GRAD_START = "clrEditorGradStart";//$NON-NLS-1$
-
- static private final String CLR_EDITOR_GRAD_END = "clrEditorGradEnd";//$NON-NLS-1$
-
- /**
- * Dispose all color pre-allocated by the workbench.
- */
- private static void disposeWorkbenchColors() {
- for (int i = 0; i < workbenchColors.length; i++) {
- workbenchColors[i].dispose();
- }
- }
-
- /**
- * Returns the active editor gradient.
- * @return an array of colors
- */
- static public Color[] getActiveEditorGradient() {
- return activeEditorGradient;
- }
-
- /**
- * Returns the active editor gradient end color.
- * @return the color
- */
- static public Color getActiveEditorGradientEnd() {
- Color clr = (Color) systemColorMap.get(CLR_EDITOR_GRAD_END);
- Assert.isNotNull(clr);
- return clr;
- }
-
- /**
- * Returns the active editor gradient percents.
- * @return an array of ints
- */
- static public int[] getActiveEditorGradientPercents() {
- return activeEditorPercentages;
- }
-
- /**
- * Returns the active editor gradient start color.
- * @return the color
- */
- static public Color getActiveEditorGradientStart() {
- Color clr = (Color) systemColorMap.get(CLR_EDITOR_GRAD_START);
- Assert.isNotNull(clr);
- return clr;
- }
-
- /**
- * Returns the active no focus editor gradient.
- * @return an array of colors
- */
- static public Color[] getActiveNoFocusEditorGradient() {
- return activeNoFocusEditorGradient;
- }
-
- /**
- * Returns the active no focus editor gradient percents.
- * @return an array of ints
- */
- static public int[] getActiveNoFocusEditorGradientPercents() {
- return activeNoFocusEditorPercentages;
- }
-
- /**
- * Returns the active gradient for views.
- * @return an arry of colors
- */
- static public Color[] getActiveViewGradient() {
- return activeViewGradient;
- }
-
- /**
- * Returns the active view gradient end color.
- * @return the color
- */
- static public Color getActiveViewGradientEnd() {
- Color clr = (Color) systemColorMap.get(CLR_VIEW_GRAD_END);
- Assert.isNotNull(clr);
- return clr;
- }
-
- /**
- * Returns the active view gradient percents.
- * @return an arry of ints
- */
- static public int[] getActiveViewGradientPercents() {
- return activeViewPercentages;
- }
-
- /**
- * Returns the active view gradient start color.
- * @return the color
- */
- static public Color getActiveViewGradientStart() {
- Color clr = (Color) systemColorMap.get(CLR_VIEW_GRAD_START);
- Assert.isNotNull(clr);
- return clr;
- }
-
- /**
- * Returns the gradient for editors when the window is deactivated.
- * @return an array of colors
- */
- static public Color[] getDeactivatedEditorGradient() {
- return deactivatedEditorGradient;
- }
-
- /**
- * Returns the editor gradient percents when the window is deactivated.
- * @return an array of ints
- */
- static public int[] getDeactivatedEditorGradientPercents() {
- return deactivatedEditorPercentages;
- }
-
- /**
- * Returns the gradient for views when the window is deactivated.
- * @return an array of colors
- */
- static public Color[] getDeactivatedViewGradient() {
- return deactivatedViewGradient;
- }
-
- /**
- * Returns the view gradient percents when the window is deactivated.
- * @return an array of ints
- */
- static public int[] getDeactivatedViewGradientPercents() {
- return deactivatedViewPercentages;
- }
-
- /**
- * Returns a color identified by an RGB value.
- * @param rgbValue
- * @return the color
- */
- static public Color getColor(RGB rgbValue) {
- Color clr = (Color) colorMap.get(rgbValue);
- if (clr == null) {
- Display disp = Display.getDefault();
- clr = new Color(disp, rgbValue);
- colorMap.put(rgbValue, clr);
- }
- return clr;
- }
-
- /**
- * Returns a system color identified by a SWT constant.
- * @param swtId
- * @return the color
- */
- static public Color getSystemColor(int swtId) {
- Integer bigInt = new Integer(swtId);
- Color clr = (Color) systemColorMap.get(bigInt);
- if (clr == null) {
- Display disp = Display.getDefault();
- clr = disp.getSystemColor(swtId);
- systemColorMap.put(bigInt, clr);
- }
- return clr;
- }
-
- /**
- * Initialize all colors used in the workbench in case the OS is using a 256
- * color palette making sure the workbench colors are allocated.
- *
- * This list comes from the designers.
- */
- private static void initWorkbenchColors(Display d) {
- if (workbenchColors != null) {
- return;
- }
-
- workbenchColors = new Color[] {
- //Product pallet
- new Color(d, 255, 255, 255), new Color(d, 255, 251, 240),
- new Color(d, 223, 223, 191), new Color(d, 223, 191, 191),
- new Color(d, 192, 220, 192), new Color(d, 192, 192, 192),
- new Color(d, 191, 191, 191), new Color(d, 191, 191, 159),
- new Color(d, 191, 159, 191), new Color(d, 160, 160, 164),
- new Color(d, 159, 159, 191), new Color(d, 159, 159, 159),
- new Color(d, 159, 159, 127), new Color(d, 159, 127, 159),
- new Color(d, 159, 127, 127), new Color(d, 128, 128, 128),
- new Color(d, 127, 159, 159), new Color(d, 127, 159, 127),
- new Color(d, 127, 127, 159), new Color(d, 127, 127, 127),
- new Color(d, 127, 127, 95), new Color(d, 127, 95, 127),
- new Color(d, 127, 95, 95), new Color(d, 95, 127, 127),
- new Color(d, 95, 127, 95), new Color(d, 95, 95, 127),
- new Color(d, 95, 95, 95), new Color(d, 95, 95, 63),
- new Color(d, 95, 63, 95), new Color(d, 95, 63, 63),
- new Color(d, 63, 95, 95), new Color(d, 63, 95, 63),
- new Color(d, 63, 63, 95), new Color(d, 0, 0, 0),
- //wizban pallet
- new Color(d, 195, 204, 224), new Color(d, 214, 221, 235),
- new Color(d, 149, 168, 199), new Color(d, 128, 148, 178),
- new Color(d, 106, 128, 158), new Color(d, 255, 255, 255),
- new Color(d, 0, 0, 0), new Color(d, 0, 0, 0),
- //Perspective
- new Color(d, 132, 130, 132), new Color(d, 143, 141, 138),
- new Color(d, 171, 168, 165),
- //PreferenceDialog and TitleAreaDialog
- new Color(d, 230, 226, 221) };
- }
-
- /**
- * Disposes of the colors. Ignore all system colors as they do not need to
- * be disposed.
- */
- static public void shutdown() {
- if (!init) {
- return;
- }
-
- disposeWorkbenchColors();
-
- Iterator iter = colorMap.values().iterator();
- while (iter.hasNext()) {
- Color clr = (Color) iter.next();
- if (clr != null) {
- clr.dispose();
- }
- }
-
- colorMap.clear();
- systemColorMap.clear();
- init = false;
- }
-
- /**
- * Initializes the colors.
- */
- static public void startup() {
- if (init) {
- return;
- }
-
- // Initialize the caches first.
- init = true;
- colorMap = new HashMap(10);
- systemColorMap = new HashMap(10);
-
- initWorkbenchColors(Display.getDefault());
- // Define active view gradient using same OS title gradient colors.
- Color clr1 = getSystemColor(SWT.COLOR_TITLE_BACKGROUND);
- Color clr2 = getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT);
- Color clr3 = getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
- systemColorMap.put(CLR_VIEW_GRAD_START, clr1);
- systemColorMap.put(CLR_VIEW_GRAD_END, clr3);
- activeViewGradient = new Color[] { clr1, clr2, clr3 };
- activeViewPercentages = new int[] { 50, 100 };
-
- // Define active editor gradient using same OS title gradient colors.
- systemColorMap.put(CLR_EDITOR_GRAD_START, clr1);
- systemColorMap.put(CLR_EDITOR_GRAD_END, null); // use widget default
- // background
- activeEditorGradient = new Color[] { clr1, clr2, null, null };
- activeEditorPercentages = new int[] { 50, 90, 100 };
-
- // Define active no focus editor gradient
- activeNoFocusEditorGradient = new Color[] { getSystemColor(SWT.COLOR_LIST_BACKGROUND) };
- activeNoFocusEditorPercentages = new int[0];
-
- // Define view gradient for deactivated window using same OS title
- // gradient colors.
- clr1 = getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND);
- clr2 = getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT);
- clr3 = getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
- deactivatedViewGradient = new Color[] { clr1, clr2, clr3 };
- deactivatedViewPercentages = new int[] { 70, 100 };
-
- // Define editor gradient for deactivated window using same OS title
- // gradient colors.
- deactivatedEditorGradient = new Color[] { clr1, clr2, null, null };
- deactivatedEditorPercentages = new int[] { 70, 95, 100 };
-
- // Preload.
- getSystemColor(SWT.COLOR_WIDGET_FOREGROUND);
- getSystemColor(SWT.COLOR_BLACK);
- }
-}
diff --git a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/R21PresentationMessages.java b/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/R21PresentationMessages.java
deleted file mode 100644
index 9ef639c..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/R21PresentationMessages.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * 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.presentations.r21;
-
-import com.ibm.icu.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Utility class which helps managing messages
- */
-public abstract class R21PresentationMessages {
-
- private static final String RESOURCE_BUNDLE = "org.eclipse.ui.internal.presentations.r21.messages"; //$NON-NLS-1$
-
- private static ResourceBundle bundle = ResourceBundle
- .getBundle(RESOURCE_BUNDLE);
-
- /**
- * Returns the formatted message for the given key in the resource bundle.
- *
- * @param key
- * the resource name
- * @param args
- * the message arguments
- * @return the string
- */
- public static String format(String key, Object[] args) {
- return MessageFormat.format(getString(key), args);
- }
-
- /**
- * Returns the resource object with the given key in the resource bundle. If
- * there isn't any value under the given key, the key is returned.
- *
- * @param key
- * the resource name
- * @return the string
- */
- public static String getString(String key) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- /**
- * Returns the resource object with the given key in the resource bundle. If
- * there isn't any value under the given key, the default value is returned.
- *
- * @param key
- * the resource name
- * @param def
- * the default value
- * @return the string
- */
- public static String getString(String key, String def) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return def;
- }
- }
-}
diff --git a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/R21PresentationPlugin.java b/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/R21PresentationPlugin.java
deleted file mode 100644
index 4217209..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/R21PresentationPlugin.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2008 IBM Corporation and others.
- * 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.presentations.r21;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class R21PresentationPlugin extends AbstractUIPlugin {
- //The shared instance.
- private static R21PresentationPlugin plugin;
-
- //Resource bundle.
- private ResourceBundle resourceBundle;
-
- /**
- * The constructor.
- */
- public R21PresentationPlugin() {
- super();
- plugin = this;
- try {
- resourceBundle = ResourceBundle
- .getBundle("org.eclipse.ui.internal.r21presentation.R21lookPluginResources"); //$NON-NLS-1$
- } catch (MissingResourceException x) {
- resourceBundle = null;
- }
- }
-
- /**
- * Returns the shared instance.
- * @return the plug-in
- */
- public static R21PresentationPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns the string from the plugin's resource bundle,
- * or 'key' if not found.
- * @param key
- * @return the string
- */
- public static String getResourceString(String key) {
- ResourceBundle bundle = R21PresentationPlugin.getDefault()
- .getResourceBundle();
- try {
- return (bundle != null) ? bundle.getString(key) : key;
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- /**
- * Returns the plugin's resource bundle,
- * @return the resource bundle
- */
- public ResourceBundle getResourceBundle() {
- return resourceBundle;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- R21Colors.startup();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- R21Colors.shutdown();
- }
-}
diff --git a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/messages.properties b/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/messages.properties
deleted file mode 100644
index db4b916..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/messages.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2004, 2006 IBM Corporation and others.
-# 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.r21presentation
-
-BasicStackPresentation.menu.tooltip=Menu
-BasicStackPresentation.close.tooltip=Close
-BasicStackPresentation.pane=&Pane
-
-ViewPane.moveView=&View
-EditorPane.moveEditor=&Editor
diff --git a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/CTabFolder.java b/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/CTabFolder.java
deleted file mode 100644
index 2311c56..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/CTabFolder.java
+++ /dev/null
@@ -1,2574 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * 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.presentations.r21.widgets;
-
-import org.eclipse.jface.util.Util;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.accessibility.ACC;
-import org.eclipse.swt.accessibility.Accessible;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleControlAdapter;
-import org.eclipse.swt.accessibility.AccessibleControlEvent;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.PaletteData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.TypedListener;
-
-/**
- * Instances of this class implement the notebook user interface
- * metaphor. It allows the user to select a notebook page from
- * set of pages.
- * <p>
- * The item children that may be added to instances of this class
- * must be of type <code>CTabItem</code>.
- * <code>Control</code> children are created and then set into a
- * tab item using <code>CTabItem#setControl</code>.
- * </p><p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>TOP, BOTTOM, FLAT</dd>
- * <dt><b>Events:</b></dt>
- * <dd>Selection</dd>
- * <dd>"CTabFolder"</dd>
- * </dl>
- * <p>
- * Note: Only one of the styles TOP and BOTTOM
- * may be specified.
- * </p><p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class CTabFolder extends Composite {
-
- /**
- * marginWidth specifies the number of pixels of horizontal margin
- * that will be placed along the left and right edges of the form.
- *
- * The default value is 0.
- */
- public int marginWidth = 0;
-
- /**
- * marginHeight specifies the number of pixels of vertical margin
- * that will be placed along the top and bottom edges of the form.
- *
- * The default value is 0.
- */
- public int marginHeight = 0;
-
- /**
- * Color of innermost line of drop shadow border.
- */
- public static RGB borderInsideRGB = new RGB(132, 130, 132);
-
- /**
- * Color of middle line of drop shadow border.
- */
- public static RGB borderMiddleRGB = new RGB(143, 141, 138);
-
- /**
- * Color of outermost line of drop shadow border.
- */
- public static RGB borderOutsideRGB = new RGB(171, 168, 165);
-
- /**
- * A multiple of the tab height that specifies the minimum width to which a tab
- * will be compressed before scrolling arrows are used to navigate the tabs.
- */
- public int MIN_TAB_WIDTH = 3;
-
- /* sizing, positioning */
- int xClient, yClient;
-
- boolean onBottom = false;
-
- boolean fixedTabHeight;
-
- int tabHeight;
-
- /* item management */
- private CTabItem items[] = new CTabItem[0];
-
- private int selectedIndex = -1;
-
- int topTabIndex = -1; // index of the left most visible tab.
-
- /* External Listener management */
- private CTabFolderListener[] tabListeners = new CTabFolderListener[0];
-
- /* Color appearance */
- Image backgroundImage;
-
- Color[] gradientColors;
-
- int[] gradientPercents;
-
- Color selectionForeground;
-
- Color background;
-
- // internal constants
- private static final int DEFAULT_WIDTH = 64;
-
- private static final int DEFAULT_HEIGHT = 64;
-
- // scrolling arrows
- private ToolBar arrowBar;
-
- private Image arrowLeftImage;
-
- private Image arrowRightImage;
-
- private Control topRight;
-
- // close button
- boolean showClose = false;
-
- private Image closeImage;
-
- ToolBar closeBar;
-
- private ToolBar inactiveCloseBar;
-
- private CTabItem inactiveItem;
-
- // borders
- boolean showBorders = false;
-
- private int borderBottom = 0;
-
- private int borderLeft = 0;
-
- private int borderRight = 0;
-
- private int borderTop = 0;
-
- private Color borderColor1;
-
- private Color borderColor2;
-
- private Color borderColor3;
-
- // when disposing CTabFolder, don't try to layout the items or
- // change the selection as each child is destroyed.
- private boolean inDispose = false;
-
- // keep track of size changes in order to redraw only affected area
- // on Resize
- private Point oldSize;
-
- private Font oldFont;
-
- // insertion marker
- int insertionIndex = -2; // Index of insert marker. Marker always shown after index.
-
- // -2 means no insert marker
-
- // tool tip
- private Shell tip;
-
- private Label label;
-
- private boolean showToolTip = false;
-
- private CTabItem toolTipItem;
-
- /**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * lists the style constants that are applicable to the class.
- * Style bits are also inherited from superclasses.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- *
- * @see SWT#TOP
- * @see SWT#BOTTOM
- * @see SWT#FLAT
- * @see #getStyle()
- */
- public CTabFolder(Composite parent, int style) {
- super(parent, checkStyle(style));
-
- onBottom = (getStyle() & SWT.BOTTOM) != 0;
-
- borderColor1 = new Color(getDisplay(), borderInsideRGB);
- borderColor2 = new Color(getDisplay(), borderMiddleRGB);
- borderColor3 = new Color(getDisplay(), borderOutsideRGB);
-
- // tool tip support
- tip = new Shell(getShell(), SWT.ON_TOP);
- label = new Label(tip, SWT.CENTER);
-
- // Add all listeners
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Dispose:
- onDispose();
- break;
- case SWT.Paint:
- onPaint(event);
- break;
- case SWT.Resize:
- onResize();
- break;
- case SWT.MouseDoubleClick:
- onMouseDoubleClick(event);
- break;
- case SWT.MouseDown:
- onMouseDown(event);
- break;
- case SWT.MouseExit:
- onMouseExit(event);
- break;
- case SWT.MouseHover:
- onMouseHover(event);
- break;
- case SWT.MouseMove:
- onMouseMove(event);
- break;
- case SWT.FocusIn:
- onFocus(event);
- break;
- case SWT.FocusOut:
- onFocus(event);
- break;
- case SWT.KeyDown:
- onKeyDown(event);
- break;
- case SWT.Traverse:
- onTraverse(event);
- break;
- }
- }
- };
-
- int[] folderEvents = new int[] { SWT.Dispose, SWT.Paint, SWT.Resize,
- SWT.MouseDoubleClick, SWT.MouseDown, SWT.MouseExit,
- SWT.MouseHover, SWT.MouseMove, SWT.FocusIn, SWT.FocusOut,
- SWT.KeyDown, SWT.Traverse, };
- for (int i = 0; i < folderEvents.length; i++) {
- addListener(folderEvents[i], listener);
- }
-
- createArrowBar();
- createCloseBar();
-
- setBorderVisible((style & SWT.BORDER) != 0);
-
- initAccessible();
-
- }
-
- private static int checkStyle(int style) {
- int mask = SWT.TOP | SWT.BOTTOM | SWT.FLAT | SWT.LEFT_TO_RIGHT
- | SWT.RIGHT_TO_LEFT;
- style = style & mask;
- // TOP and BOTTOM are mutually exlusive.
- // TOP is the default
- if ((style & SWT.TOP) != 0) {
- style = style & ~(SWT.TOP | SWT.BOTTOM) | SWT.TOP;
- }
- // reduce the flash by not redrawing the entire area on a Resize event
- style |= SWT.NO_REDRAW_RESIZE;
- return style;
- }
-
- /**
- * Adds the listener to receive events.
- * <p>
- *
- * @param listener the listener
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li>
- * </ul>
- */
- public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection, typedListener);
- addListener(SWT.DefaultSelection, typedListener);
- }
-
- /**
- * Adds the listener to the collection of listeners who will
- * be notified when a tab item is closed.
- *
- * @param listener the listener which should be notified
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- *
- * @see CTabFolderListener
- * @see #removeCTabFolderListener
- */
- public void addCTabFolderListener(CTabFolderListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- // add to array
- CTabFolderListener[] newTabListeners = new CTabFolderListener[tabListeners.length + 1];
- System.arraycopy(tabListeners, 0, newTabListeners, 0,
- tabListeners.length);
- tabListeners = newTabListeners;
- tabListeners[tabListeners.length - 1] = listener;
- showClose = true;
- setButtonBounds();
- }
-
- private void closeNotify(CTabItem item, int time) {
- if (item == null) {
- return;
- }
-
- CTabFolderEvent event = new CTabFolderEvent(this);
- event.widget = this;
- event.time = time;
- event.item = item;
- event.doit = true;
- if (tabListeners != null) {
- for (int i = 0; i < tabListeners.length; i++) {
- tabListeners[i].itemClosed(event);
- }
- }
- if (event.doit) {
- item.dispose();
- }
- }
-
- public Point computeSize(int wHint, int hHint, boolean changed) {
- checkWidget();
- int minWidth = 0;
- int minHeight = 0;
-
- // preferred width of tab area to show all tabs
- GC gc = new GC(this);
- for (int i = 0; i < items.length; i++) {
- minWidth += items[i].preferredWidth(gc);
- }
- gc.dispose();
-
- // preferred size of controls in tab items
- for (int i = 0; i < items.length; i++) {
- Control control = items[i].getControl();
- if (control != null && !control.isDisposed()) {
- Point size = control.computeSize(wHint, hHint);
- minWidth = Math.max(minWidth, size.x);
- minHeight = Math.max(minHeight, size.y);
- }
- }
- if (minWidth == 0) {
- minWidth = DEFAULT_WIDTH;
- }
- if (minHeight == 0) {
- minHeight = DEFAULT_HEIGHT;
- }
-
- if (wHint != SWT.DEFAULT) {
- minWidth = wHint;
- }
- if (hHint != SWT.DEFAULT) {
- minHeight = hHint;
- }
-
- Rectangle trim = computeTrim(0, 0, minWidth, minHeight);
- return new Point(trim.width, trim.height);
- }
-
- public Rectangle computeTrim(int x, int y, int width, int height) {
- checkWidget();
- if (items.length == 0) {
- if (!showBorders) {
- return new Rectangle(x, y, width, height);
- }
- int trimX = x - borderRight - 1;
- int trimY = y - borderBottom - 1;
- int trimWidth = width + borderRight + 2;
- int trimHeight = height + borderBottom + 2;
- return new Rectangle(trimX, trimY, trimWidth, trimHeight);
- }
- int trimX = x - marginWidth - borderLeft;
- int trimY = y - marginHeight - tabHeight - borderTop - 1;
- // -1 is for the line at the bottom of the tabs
- if (onBottom) {
- trimY = y - marginHeight - borderTop;
- }
- int trimWidth = width + borderLeft + borderRight + 2 * marginWidth;
- int trimHeight = height + borderTop + borderBottom + 2
- * marginHeight + tabHeight + 1;
- return new Rectangle(trimX, trimY, trimWidth, trimHeight);
- }
-
- /**
- * Create the specified item at 'index'.
- */
- void createItem(CTabItem item, int index) {
- if (0 > index || index > getItemCount()) {
- SWT.error(SWT.ERROR_INVALID_RANGE);
- }
- // grow by one and rearrange the array.
- CTabItem[] newItems = new CTabItem[items.length + 1];
- System.arraycopy(items, 0, newItems, 0, index);
- newItems[index] = item;
- System.arraycopy(items, index, newItems, index + 1, items.length
- - index);
- items = newItems;
-
- item.parent = this;
-
- if (selectedIndex >= index) {
- selectedIndex++;
- }
- if (items.length == 1) {
- topTabIndex = 0;
- resetTabSize(true);
- } else {
- setItemBounds();
- showItem(item);
- }
-
- if (items.length == 1) {
- redraw();
- } else {
- redrawTabArea(-1);
- }
- }
-
- private void createArrowBar() {
- // create arrow buttons for scrolling
- arrowBar = new ToolBar(this, SWT.FLAT);
- arrowBar.setVisible(false);
- arrowBar.setBackground(background);
- ToolItem scrollLeft = new ToolItem(arrowBar, SWT.PUSH);
- scrollLeft.setEnabled(false);
- ToolItem scrollRight = new ToolItem(arrowBar, SWT.PUSH);
- scrollRight.setEnabled(false);
-
- scrollLeft.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- scroll_scrollLeft();
- }
- });
- scrollRight.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- scroll_scrollRight();
- }
- });
-
- }
-
- private void createCloseBar() {
- closeBar = new ToolBar(this, SWT.FLAT);
- closeBar.setVisible(false);
- if (gradientColors != null && gradientColors.length > 0) {
- closeBar.setBackground(gradientColors[gradientColors.length - 1]);
- } else {
- closeBar.setBackground(background);
- }
- ToolItem closeItem = new ToolItem(closeBar, SWT.PUSH);
-
- inactiveCloseBar = new ToolBar(this, SWT.FLAT);
- inactiveCloseBar.setVisible(false);
- inactiveCloseBar.setBackground(background);
- ToolItem inactiveCloseItem = new ToolItem(inactiveCloseBar, SWT.PUSH);
-
- closeItem.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- closeNotify(getSelection(), event.time);
- }
- });
- inactiveCloseItem.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- closeNotify(inactiveItem, event.time);
- inactiveCloseBar.setVisible(false);
- inactiveItem = null;
- }
- });
- inactiveCloseBar.addListener(SWT.MouseExit, new Listener() {
- public void handleEvent(Event event) {
- if (inactiveItem != null) {
- Rectangle itemBounds = inactiveItem.getBounds();
- if (itemBounds.contains(event.x, event.y)) {
- return;
- }
- }
- inactiveCloseBar.setVisible(false);
- inactiveItem = null;
- }
- });
-
- }
-
- /**
- * Destroy the specified item.
- */
- void destroyItem(CTabItem item) {
- if (inDispose) {
- return;
- }
-
- int index = indexOf(item);
- if (index == -1) {
- return; // should this trigger an error?
- }
-
- insertionIndex = -2;
-
- if (items.length == 1) {
- items = new CTabItem[0];
- selectedIndex = -1;
- topTabIndex = 0;
-
- Control control = item.getControl();
- if (control != null && !control.isDisposed()) {
- control.setVisible(false);
- }
- closeBar.setVisible(false);
- if (!fixedTabHeight) {
- tabHeight = 0;
- }
- redraw();
- return;
- }
-
- // shrink by one and rearrange the array.
- CTabItem[] newItems = new CTabItem[items.length - 1];
- System.arraycopy(items, 0, newItems, 0, index);
- System.arraycopy(items, index + 1, newItems, index, items.length
- - index - 1);
- items = newItems;
-
- if (topTabIndex == items.length) {
- --topTabIndex;
- }
-
- // move the selection if this item is selected
- if (selectedIndex == index) {
- Control control = item.getControl();
- if (control != null && !control.isDisposed()) {
- control.setVisible(false);
- }
- selectedIndex = -1;
- setSelection(Math.max(0, index - 1), true);
- } else if (selectedIndex > index) {
- selectedIndex--;
- }
-
- setItemBounds();
- redrawTabArea(-1);
- }
-
- private void onKeyDown(Event e) {
- if (e.keyCode != SWT.ARROW_LEFT && e.keyCode != SWT.ARROW_RIGHT) {
- return;
- }
- int leadKey = (getStyle() & SWT.MIRRORED) != 0 ? SWT.ARROW_RIGHT
- : SWT.ARROW_LEFT;
- if (e.keyCode == leadKey) {
- if (selectedIndex > 0) {
- setSelection(selectedIndex - 1, true);
- }
- } else {
- if (selectedIndex < items.length - 1) {
- setSelection(selectedIndex + 1, true);
- }
- }
- }
-
- /**
- * Dispose the items of the receiver
- */
- private void onDispose() {
- /*
- * Usually when an item is disposed, destroyItem will change the size of the items array,
- * reset the bounds of all the tabs and manage the widget associated with the tab.
- * Since the whole folder is being disposed, this is not necessary. For speed
- * the inDispose flag is used to skip over this part of the item dispose.
- */
- inDispose = true;
-
- int length = items.length;
- for (int i = 0; i < length; i++) {
- if (items[i] != null) {
- items[i].dispose();
- }
- }
-
- // clean up resources
- if (tip != null && !tip.isDisposed()) {
- tip.dispose();
- tip = null;
- label = null;
- }
-
- if (arrowLeftImage != null) {
- arrowLeftImage.dispose();
- }
- arrowLeftImage = null;
- if (arrowRightImage != null) {
- arrowRightImage.dispose();
- }
- arrowRightImage = null;
- if (closeImage != null) {
- closeImage.dispose();
- }
- closeImage = null;
-
- gradientColors = null;
- gradientPercents = null;
- backgroundImage = null;
-
- if (borderColor1 != null) {
- borderColor1.dispose();
- }
- borderColor1 = null;
-
- if (borderColor2 != null) {
- borderColor2.dispose();
- }
- borderColor2 = null;
-
- if (borderColor3 != null) {
- borderColor3.dispose();
- }
- borderColor3 = null;
- }
-
- /**
- * @param e
- */
- private void onFocus(Event e) {
- checkWidget();
- if (selectedIndex >= 0) {
- redrawTabArea(selectedIndex);
- } else {
- setSelection(0, true);
- }
- }
-
- /**
- * Draw a border around the receiver.
- */
- private void drawBorder(GC gc) {
-
- Rectangle d = super.getClientArea();
-
- if (showBorders) {
- if ((getStyle() & SWT.FLAT) != 0) {
- gc.setForeground(borderColor1);
- gc.drawRectangle(d.x, d.y, d.x + d.width - 1, d.y + d.height
- - 1);
- } else {
- gc.setForeground(borderColor1);
- gc.drawRectangle(d.x, d.y, d.x + d.width - 3, d.y + d.height
- - 3);
-
- gc.setForeground(borderColor2);
- gc.drawLine(d.x + 1, d.y + d.height - 2, d.x + d.width - 1, d.y
- + d.height - 2);
- gc.drawLine(d.x + d.width - 2, d.y + 1, d.x + d.width - 2, d.y
- + d.height - 1);
-
- gc.setForeground(borderColor3);
- gc.drawLine(d.x + 2, d.y + d.height - 1, d.x + d.width - 2, d.y
- + d.height - 1);
- gc.drawLine(d.x + d.width - 1, d.y + 2, d.x + d.width - 1, d.y
- + d.height - 2);
-
- // fill in corners with parent's background
- gc.setForeground(getParent().getBackground());
- gc.drawLine(d.x + d.width - 2, d.y, d.x + d.width - 1, d.y);
- gc.drawLine(d.x + d.width - 1, d.y + 1, d.x + d.width - 1,
- d.y + 1);
-
- gc.drawLine(d.x, d.y + d.height - 2, d.x, d.y + d.height - 2);
- gc.drawLine(d.x, d.y + d.height - 1, d.x + 1, d.y + d.height
- - 1);
-
- gc.drawLine(d.x + d.width - 1, d.y + d.height - 1, d.x
- + d.width - 1, d.y + d.height - 1);
- }
-
- }
-
- // draw a separator line
- if (items.length > 0) {
- int lineY = d.y + borderTop + tabHeight;
- if (onBottom) {
- lineY = d.y + d.height - borderBottom - tabHeight - 1;
- }
- gc.setForeground(borderColor1);
- gc.drawLine(d.x + borderLeft, lineY, d.x + d.width - borderRight,
- lineY);
- }
-
- gc.setForeground(getForeground());
- }
-
- public Rectangle getClientArea() {
- checkWidget();
- Point size = getSize();
- if (items.length == 0) {
- if (!showBorders) {
- return super.getClientArea();
- }
- int width = size.x - borderRight - 2;
- int height = size.y - borderBottom - 2;
- return new Rectangle(borderRight + 1, borderBottom + 1, width,
- height);
- }
- int width = size.x - 2 * marginWidth - borderLeft - borderRight;
- int height = size.y - 2 * marginHeight - borderTop - borderBottom
- - tabHeight - 1;
- return new Rectangle(xClient, yClient, width, height);
- }
-
- /**
- * Returns the height of the tab
- *
- * @return the height of the tab
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
- public int getTabHeight() {
- checkWidget();
- return tabHeight;
- }
-
- /**
- * Return the tab that is located at the specified index.
- * @param index
- *
- * @return the item at the specified index
- */
- public CTabItem getItem(int index) {
- //checkWidget();
- if (index < 0 || index >= items.length) {
- SWT.error(SWT.ERROR_INVALID_RANGE);
- }
- return items[index];
- }
-
- /**
- * Gets the item at a point in the widget.
- * <p>
- * @param pt
- *
- * @return the item at a point
- */
- public CTabItem getItem(Point pt) {
- //checkWidget();
- if (items.length == 0) {
- return null;
- }
- int lastItem = getLastItem();
- lastItem = Math.min(items.length - 1, lastItem + 1);
- for (int i = topTabIndex; i <= lastItem; i++) {
- Rectangle bounds = items[i].getBounds();
- if (bounds.contains(pt)) {
- return items[i];
- }
- }
- return null;
- }
-
- /**
- * Return the number of tabs in the folder.
- *
- * @return the number of tabs in the folder
- */
- public int getItemCount() {
- //checkWidget();
- return items.length;
- }
-
- /**
- * Return the tab items.
- *
- * @return the tab items
- */
- public CTabItem[] getItems() {
- //checkWidget();
- CTabItem[] tabItems = new CTabItem[items.length];
- System.arraycopy(items, 0, tabItems, 0, items.length);
- return tabItems;
- }
-
- private int getLastItem() {
- if (items.length == 0) {
- return -1;
- }
- Rectangle area = getClientArea();
- if (area.width <= 0) {
- return 0;
- }
- Rectangle toolspace = getToolSpace();
- if (toolspace.width == 0) {
- return items.length - 1;
- }
- int width = area.width - toolspace.width;
- int index = topTabIndex;
- int tabWidth = items[index].width;
- while (index < items.length - 1) {
- tabWidth += items[index + 1].width;
- if (tabWidth > width) {
- break;
- }
- index++;
- }
- return index;
- }
-
- /**
- * Return the selected tab item, or an empty array if there
- * is no selection.
- *
- * @return the selected tab item
- */
- public CTabItem getSelection() {
- //checkWidget();
- if (selectedIndex == -1) {
- return null;
- }
- return items[selectedIndex];
- }
-
- /**
- * Return the index of the selected tab item, or -1 if there
- * is no selection.
- *
- * @return the index of the selected tab item or -1
- */
- public int getSelectionIndex() {
- //checkWidget();
- return selectedIndex;
- }
-
- private Rectangle getToolSpace() {
- boolean showArrows = scroll_leftVisible() || scroll_rightVisible();
- if (!showArrows && topRight == null) {
- return new Rectangle(0, 0, 0, 0);
- }
- Rectangle toolspace;
- if (showArrows) {
- toolspace = arrowBar.getBounds();
- toolspace.width += borderRight;
- if (topRight != null) {
- toolspace.width += topRight.getSize().x;
- }
- } else {
- toolspace = topRight.getBounds();
- toolspace.width += borderRight;
- }
- return toolspace;
- }
-
- /**
- * Returns the control in the top right corner of the tab folder.
- * Typically this is a close button or a composite with a menu and close button.
- *
- * @since 2.1
- *
- * @return the control in the top right corner of the tab folder or null
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
- public Control getTopRight() {
- checkWidget();
- return topRight;
- }
-
- /**
- * Return the index of the specified tab or -1 if the tab is not
- * in the receiver.
- * @param item
- *
- * @return the index of the specified tab item or -1
- *
- * @exception SWTError <ul>
- * <li>ERROR_NULL_ARGUMENT when the item is null</li>
- * </ul>
- */
- public int indexOf(CTabItem item) {
- //checkWidget();
- if (item == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- for (int i = 0; i < items.length; i++) {
- if (items[i] == item) {
- return i;
- }
- }
- return -1;
- }
-
- private void initAccessible() {
- final Accessible accessible = getAccessible();
- accessible.addAccessibleListener(new AccessibleAdapter() {
- public void getName(AccessibleEvent e) {
- String name = null;
- int childID = e.childID;
- if (childID >= 0 && childID < items.length) {
- name = items[childID].getText();
- int index = name.indexOf('&');
- if (index > 0) {
- name = name.substring(0, index)
- + name.substring(index + 1);
- }
- }
- e.result = name;
- }
-
- public void getHelp(AccessibleEvent e) {
- String help = null;
- int childID = e.childID;
- if (childID == ACC.CHILDID_SELF) {
- help = getToolTipText();
- } else if (childID >= 0 && childID < items.length) {
- help = items[childID].getToolTipText();
- }
- e.result = help;
- }
-
- public void getKeyboardShortcut(AccessibleEvent e) {
- String shortcut = null;
- int childID = e.childID;
- if (childID >= 0 && childID < items.length) {
- String text = items[childID].getText();
- if (text != null) {
- char mnemonic = getMnemonic(text);
- if (mnemonic != '\0') {
- shortcut = "Alt+" + mnemonic; //$NON-NLS-1$
- }
- }
- }
- e.result = shortcut;
- }
- });
-
- accessible.addAccessibleControlListener(new AccessibleControlAdapter() {
- public void getChildAtPoint(AccessibleControlEvent e) {
- Point testPoint = toControl(new Point(e.x, e.y));
- int childID = ACC.CHILDID_NONE;
- for (int i = 0; i < items.length; i++) {
- if (items[i].getBounds().contains(testPoint)) {
- childID = i;
- break;
- }
- }
- if (childID == ACC.CHILDID_NONE) {
- Rectangle location = getBounds();
- location.height = location.height - getClientArea().height;
- if (location.contains(testPoint)) {
- childID = ACC.CHILDID_SELF;
- }
- }
- e.childID = childID;
- }
-
- public void getLocation(AccessibleControlEvent e) {
- Rectangle location = null;
- int childID = e.childID;
- if (childID == ACC.CHILDID_SELF) {
- location = getBounds();
- }
- if (childID >= 0 && childID < items.length) {
- location = items[childID].getBounds();
- }
- if (location != null) {
- Point pt = toDisplay(new Point(location.x, location.y));
- e.x = pt.x;
- e.y = pt.y;
- e.width = location.width;
- e.height = location.height;
- }
- }
-
- public void getChildCount(AccessibleControlEvent e) {
- e.detail = items.length;
- }
-
- public void getDefaultAction(AccessibleControlEvent e) {
- String action = null;
- int childID = e.childID;
- if (childID >= 0 && childID < items.length) {
- action = "Switch"; //$NON-NLS-1$
- }
- e.result = action;
- }
-
- public void getFocus(AccessibleControlEvent e) {
- int childID = ACC.CHILDID_NONE;
- if (isFocusControl()) {
- if (selectedIndex == -1) {
- childID = ACC.CHILDID_SELF;
- } else {
- childID = selectedIndex;
- }
- }
- e.childID = childID;
- }
-
- public void getRole(AccessibleControlEvent e) {
- int role = 0;
- int childID = e.childID;
- if (childID == ACC.CHILDID_SELF) {
- role = ACC.ROLE_TABFOLDER;
- } else if (childID >= 0 && childID < items.length) {
- role = ACC.ROLE_TABITEM;
- }
- e.detail = role;
- }
-
- public void getSelection(AccessibleControlEvent e) {
- e.childID = (selectedIndex == -1) ? ACC.CHILDID_NONE
- : selectedIndex;
- }
-
- public void getState(AccessibleControlEvent e) {
- int state = 0;
- int childID = e.childID;
- if (childID == ACC.CHILDID_SELF) {
- state = ACC.STATE_NORMAL;
- } else if (childID >= 0 && childID < items.length) {
- state = ACC.STATE_SELECTABLE;
- if (isFocusControl()) {
- state |= ACC.STATE_FOCUSABLE;
- }
- if (selectedIndex == childID) {
- state |= ACC.STATE_SELECTED;
- if (isFocusControl()) {
- state |= ACC.STATE_FOCUSED;
- }
- }
- }
- e.detail = state;
- }
-
- public void getChildren(AccessibleControlEvent e) {
- Object[] children = new Object[items.length];
- for (int i = 0; i < items.length; i++) {
- children[i] = new Integer(i);
- }
- e.children = children;
- }
- });
-
- addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- if (isFocusControl()) {
- if (selectedIndex == -1) {
- accessible.setFocus(ACC.CHILDID_SELF);
- } else {
- accessible.setFocus(selectedIndex);
- }
- }
- }
- });
-
- addListener(SWT.FocusIn, new Listener() {
- public void handleEvent(Event event) {
- if (selectedIndex == -1) {
- accessible.setFocus(ACC.CHILDID_SELF);
- } else {
- accessible.setFocus(selectedIndex);
- }
- }
- });
- }
-
- private void setButtonBounds() {
-
- updateArrowBar();
- updateCloseBar();
-
- Rectangle area = super.getClientArea();
-
- int offset = 0;
- if (topRight != null) {
- Point size = topRight.computeSize(SWT.DEFAULT, tabHeight);
- int x = area.x + area.width - borderRight - size.x;
- int y = onBottom ? area.y + area.height - borderBottom - size.y
- : area.y + borderTop;
- topRight.setBounds(x, y, size.x, size.y);
- offset = size.x;
- }
- boolean leftVisible = scroll_leftVisible();
- boolean rightVisible = scroll_rightVisible();
- if (leftVisible || rightVisible) {
- Point size = arrowBar.computeSize(SWT.DEFAULT, tabHeight);
- int x = area.x + area.width - borderRight - size.x - offset;
- int y = (onBottom) ? area.y + area.height - borderBottom - size.y
- : area.y + borderTop;
-
- arrowBar.setBounds(x, y, size.x, size.y);
- ToolItem[] items = arrowBar.getItems();
- items[0].setEnabled(leftVisible);
- items[1].setEnabled(rightVisible);
- arrowBar.setVisible(true);
- } else {
- arrowBar.setVisible(false);
- }
-
- // When the close button is right at the edge of the Tab folder, hide it because
- // otherwise it may block off a part of the border on the right
- if (showClose) {
- inactiveCloseBar.setVisible(false);
- CTabItem item = getSelection();
- if (item == null) {
- closeBar.setVisible(false);
- } else {
- int toolbarHeight = tabHeight - CTabItem.TOP_MARGIN
- - CTabItem.BOTTOM_MARGIN + 2; // +2 to ignore gap between focus rectangle
- Point size = closeBar.computeSize(SWT.DEFAULT, toolbarHeight);
- int x = item.x + item.width - size.x - 2; // -2 to not overlap focus rectangle and trim
- int y = item.y + Math.max(0, (item.height - toolbarHeight) / 2);
- closeBar.setBounds(x, y, size.x, toolbarHeight);
- Rectangle toolspace = getToolSpace();
- Point folderSize = getSize();
- boolean visible = (toolspace.width == 0 || x < toolspace.x)
- && x + size.x < folderSize.x - borderRight;
- closeBar.setVisible(visible);
- }
- }
- }
-
- private boolean setItemLocation() {
- if (items.length == 0) {
- return false;
- }
- Rectangle area = super.getClientArea();
- int x = area.x;
- int y = area.y + borderTop;
- if (onBottom) {
- y = Math.max(0, area.y + area.height - borderBottom - tabHeight);
- }
-
- boolean changed = false;
- for (int i = topTabIndex - 1; i >= 0; i--) {
- // if the first visible tab is not the first tab
- CTabItem tab = items[i];
- x -= tab.width;
- if (!changed && (tab.x != x || tab.y != y)) {
- changed = true;
- }
- // layout tab items from right to left thus making them invisible
- tab.x = x;
- tab.y = y;
- }
-
- x = area.x + borderLeft;
- for (int i = topTabIndex; i < items.length; i++) {
- // continue laying out remaining, visible items left to right
- CTabItem tab = items[i];
- tab.x = x;
- tab.y = y;
- x = x + tab.width;
- }
- setButtonBounds();
- return changed;
- }
-
- private void setLastItem(int index) {
- if (index < 0 || index > items.length - 1) {
- return;
- }
- Rectangle area = getClientArea();
- if (area.width <= 0) {
- return;
- }
- int maxWidth = area.width;
- Rectangle toolspace = getToolSpace();
- if (toolspace.width > 0) {
- maxWidth -= toolspace.width;
- }
- int tabWidth = items[index].width;
- while (index > 0) {
- tabWidth += items[index - 1].width;
- if (tabWidth > maxWidth) {
- break;
- }
- index--;
- }
- topTabIndex = index;
- setItemLocation();
- redrawTabArea(-1);
- }
-
- /**
- * Layout the items and store the client area size.
- */
- boolean setItemBounds() {
- boolean changed = false;
- if (isDisposed()) {
- return changed;
- }
- Rectangle area = super.getClientArea();
-
- xClient = area.x + borderLeft + marginWidth;
- if (onBottom) {
- yClient = area.y + borderTop + marginHeight;
- } else {
- yClient = area.y + borderTop + tabHeight + 1 + marginHeight;
- // +1 is for the line at the bottom of the tabs
- }
-
- if (area.width <= 0 || area.height <= 0 || items.length == 0) {
- return changed;
- }
-
- int[] widths = new int[items.length];
- GC gc = new GC(this);
- for (int i = 0; i < items.length; i++) {
- widths[i] = items[i].preferredWidth(gc);
- }
- gc.dispose();
-
- int oldAverageWidth = 0;
- int averageWidth = (area.width - borderLeft - borderRight)
- / items.length;
- while (averageWidth > oldAverageWidth) {
- int width = area.width - borderLeft - borderRight;
- int count = items.length;
- for (int i = 0; i < items.length; i++) {
- if (widths[i] < averageWidth) {
- width -= widths[i];
- count--;
- }
- }
- oldAverageWidth = averageWidth;
- if (count > 0) {
- averageWidth = width / count;
- }
- }
- averageWidth = Math.max(averageWidth, MIN_TAB_WIDTH * tabHeight);
- for (int i = 0; i < items.length; i++) {
- if (widths[i] > averageWidth) {
- widths[i] = averageWidth;
- }
- }
-
- int totalWidth = 0;
- for (int i = 0; i < items.length; i++) {
- CTabItem tab = items[i];
- if (tab.height != tabHeight || tab.width != widths[i]) {
- changed = true;
- }
- tab.height = tabHeight;
- tab.width = widths[i];
- totalWidth += widths[i];
- }
-
- int areaWidth = area.x + area.width - borderRight;
- if (totalWidth <= areaWidth) {
- topTabIndex = 0;
- }
- if (setItemLocation()) {
- changed = true;
- }
-
- // Is there a gap after last item showing
- if (correctLastItem()) {
- changed = true;
- }
- return changed;
- }
-
- private boolean onMnemonic(Event event) {
- char key = event.character;
- for (int i = 0; i < items.length; i++) {
- if (items[i] != null) {
- char mnemonic = getMnemonic(items[i].getText());
- if (mnemonic != '\0') {
- if (Character.toUpperCase(key) == Character
- .toUpperCase(mnemonic)) {
- setSelection(i, true);
- return true;
- }
- }
- }
- }
- return false;
- }
-
- /**
- * Paint the receiver.
- */
- private void onPaint(Event event) {
- Font font = getFont();
- if (oldFont == null || !oldFont.equals(font)) {
- oldFont = font;
- resetTabSize(true);
- }
- GC gc = event.gc;
- Rectangle rect = super.getClientArea();
- if (items.length == 0) {
- if (showBorders) {
- if ((getStyle() & SWT.FLAT) != 0) {
- gc.setForeground(borderColor1);
- gc.drawRectangle(rect.x, rect.y, rect.x + rect.width - 1,
- rect.y + rect.height - 1);
- } else {
- gc.setForeground(borderColor1);
- gc.drawRectangle(rect.x, rect.y, rect.x + rect.width - 3,
- rect.y + rect.height - 3);
-
- // fill in right and bottom edges with parent's background
- gc.setBackground(getParent().getBackground());
- gc.fillRectangle(rect.x + rect.width - 2, rect.y, 2,
- rect.height);
- gc.fillRectangle(rect.x, rect.y + rect.height - 2,
- rect.width, 2);
- }
- gc.setForeground(getForeground());
- }
- return;
- }
-
- // redraw the Border
- drawBorder(gc);
-
- rect.x += borderLeft;
- rect.y += borderTop;
- rect.width -= borderLeft + borderRight;
- rect.height -= borderTop + borderBottom;
- Rectangle clip = gc.getClipping();
- gc.setClipping(clip.intersection(rect));
-
- // Draw the unselected tabs first.
- for (int i = 0; i < items.length; i++) {
- if (i != selectedIndex
- && event.getBounds().intersects(items[i].getBounds())) {
- items[i].onPaint(gc, false);
- }
- }
- // Selected tab comes last
- if (selectedIndex != -1) {
- items[selectedIndex].onPaint(gc, true);
- }
-
- // draw insertion mark
- if (insertionIndex > -2) {
- gc.setForeground(getDisplay().getSystemColor(
- SWT.COLOR_LIST_SELECTION));
- if (insertionIndex == -1) {
- Rectangle bounds = items[0].getBounds();
- gc.drawLine(bounds.x, bounds.y, bounds.x, bounds.y
- + bounds.height - 1);
- gc.drawLine(bounds.x - 2, bounds.y, bounds.x + 2, bounds.y);
- gc.drawLine(bounds.x - 1, bounds.y + 1, bounds.x + 1,
- bounds.y + 1);
- gc.drawLine(bounds.x - 1, bounds.y + bounds.height - 2,
- bounds.x + 1, bounds.y + bounds.height - 2);
- gc.drawLine(bounds.x - 2, bounds.y + bounds.height - 1,
- bounds.x + 2, bounds.y + bounds.height - 1);
-
- } else {
- Rectangle bounds = items[insertionIndex].getBounds();
- gc.drawLine(bounds.x + bounds.width, bounds.y, bounds.x
- + bounds.width, bounds.y + bounds.height - 1);
- gc.drawLine(bounds.x + bounds.width - 2, bounds.y, bounds.x
- + bounds.width + 2, bounds.y);
- gc.drawLine(bounds.x + bounds.width - 1, bounds.y + 1, bounds.x
- + bounds.width + 1, bounds.y + 1);
- gc.drawLine(bounds.x + bounds.width - 1, bounds.y
- + bounds.height - 2, bounds.x + bounds.width + 1,
- bounds.y + bounds.height - 2);
- gc.drawLine(bounds.x + bounds.width - 2, bounds.y
- + bounds.height - 1, bounds.x + bounds.width + 2,
- bounds.y + bounds.height - 1);
- }
- }
-
- gc.setForeground(getForeground());
- gc.setBackground(getBackground());
- }
-
- private void redrawTabArea(int index) {
- int x = 0, y = 0, width = 0, height = 0;
- if (index == -1) {
- Rectangle area = super.getClientArea();
- if (area.width == 0 || area.height == 0) {
- return;
- }
- width = area.x + area.width - borderLeft - borderRight;
- height = tabHeight + 1; // +1 causes top line between content and tabs to be redrawn
- x = area.x + borderLeft;
- y = area.y + borderTop;
- if (onBottom) {
- y = Math.max(0, area.y + area.height - borderBottom - height);
- }
- } else {
- CTabItem item = items[index];
- x = item.x;
- y = item.y;
- Rectangle area = super.getClientArea();
- width = area.x + area.width - x;
- height = item.height;
- }
- redraw(x, y, width, height, false);
- }
-
- /**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
- public void removeSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- removeListener(SWT.Selection, listener);
- removeListener(SWT.DefaultSelection, listener);
- }
-
- /**
- * Removes the listener.
- *
- * @param listener the listener
- *
- * @exception SWTError
- * <ul><li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * <li>ERROR_NULL_ARGUMENT when listener is null</li></ul>
- */
- public void removeCTabFolderListener(CTabFolderListener listener) {
- checkWidget();
- if (listener == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- if (tabListeners.length == 0) {
- return;
- }
- int index = -1;
- for (int i = 0; i < tabListeners.length; i++) {
- if (listener == tabListeners[i]) {
- index = i;
- break;
- }
- }
- if (index == -1) {
- return;
- }
- if (tabListeners.length == 1) {
- tabListeners = new CTabFolderListener[0];
- showClose = false;
- setButtonBounds();
- return;
- }
- CTabFolderListener[] newTabListeners = new CTabFolderListener[tabListeners.length - 1];
- System.arraycopy(tabListeners, 0, newTabListeners, 0, index);
- System.arraycopy(tabListeners, index + 1, newTabListeners, index,
- tabListeners.length - index - 1);
- tabListeners = newTabListeners;
- }
-
- /**
- * The widget was resized. Adjust the size of the currently selected page.
- */
- private void onResize() {
-
- if (items.length == 0) {
- redraw();
- return;
- }
-
- if (setItemBounds()) {
- redrawTabArea(-1);
- }
-
- Point size = getSize();
- if (oldSize == null) {
- redraw();
- } else {
- if (onBottom && size.y != oldSize.y) {
- redraw();
- } else {
- int x1 = Math.min(size.x, oldSize.x);
- if (size.x != oldSize.x) {
- x1 -= 10;
- }
- int y1 = Math.min(size.y, oldSize.y);
- if (size.y != oldSize.y) {
- y1 -= 10;
- }
- int x2 = Math.max(size.x, oldSize.x);
- int y2 = Math.max(size.y, oldSize.y);
- redraw(0, y1, x2 + 10, y2 - y1, false);
- redraw(x1, 0, x2 - x1, y2, false);
- }
- }
- oldSize = size;
-
- // resize content
- if (selectedIndex != -1) {
- Control control = items[selectedIndex].getControl();
- if (control != null && !control.isDisposed()) {
- control.setBounds(getClientArea());
- }
- }
- }
-
- public void setBackground(Color color) {
- super.setBackground(color);
- background = color;
- // init inactive close button
- inactiveCloseBar.setBackground(color);
-
- // init scroll buttons
- arrowBar.setBackground(color);
-
- //init topRight control
- if (topRight != null) {
- topRight.setBackground(color);
- }
-
- // init close button
- if (gradientColors == null) {
- closeBar.setBackground(color);
- }
- }
-
- /**
- * Specify a gradient of colours to be draw in the background of the selected tab.
- * For example to draw a gradient that varies from dark blue to blue and then to
- * white, use the following call to setBackground:
- * <pre>
- * cfolder.setBackground(new Color[]{display.getSystemColor(SWT.COLOR_DARK_BLUE),
- * display.getSystemColor(SWT.COLOR_BLUE),
- * display.getSystemColor(SWT.COLOR_WHITE),
- * display.getSystemColor(SWT.COLOR_WHITE)},
- * new int[] {25, 50, 100});
- * </pre>
- *
- * @param colors an array of Color that specifies the colors to appear in the gradient
- * in order of appearance left to right. The value <code>null</code> clears the
- * background gradient. The value <code>null</code> can be used inside the array of
- * Color to specify the background color.
- * @param percents an array of integers between 0 and 100 specifying the percent of the width
- * of the widget at which the color should change. The size of the percents array must be one
- * less than the size of the colors array.
- *
- * @exception SWTError <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS when called from the wrong thread</li>
- * <li>ERROR_WIDGET_DISPOSED when the widget has been disposed</li>
- * </ul>
- */
-
- public void setSelectionBackground(Color[] colors, int[] percents) {
- checkWidget();
- if (colors != null) {
- if (percents == null || percents.length != colors.length - 1) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (getDisplay().getDepth() < 15) {
- // Don't use gradients on low color displays
- colors = new Color[] { colors[0] };
- percents = new int[] {};
- }
- for (int i = 0; i < percents.length; i++) {
- if (percents[i] < 0 || percents[i] > 100) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (i > 0 && percents[i] < percents[i - 1]) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- }
- }
-
- // Are these settings the same as before?
- if (backgroundImage == null) {
- if ((gradientColors != null) && (colors != null)
- && (gradientColors.length == colors.length)) {
- boolean same = false;
- for (int i = 0; i < gradientColors.length; i++) {
- if (gradientColors[i] == null) {
- same = colors[i] == null;
- } else {
- same = gradientColors[i].equals(colors[i]);
- }
- if (!same) {
- break;
- }
- }
- if (same) {
- for (int i = 0; i < gradientPercents.length; i++) {
- same = gradientPercents[i] == percents[i];
- if (!same) {
- break;
- }
- }
- }
- if (same) {
- return;
- }
- }
- } else {
- backgroundImage = null;
- }
- // Store the new settings
- if (colors == null) {
- gradientColors = null;
- gradientPercents = null;
- closeBar.setBackground(background);
- } else {
- gradientColors = new Color[colors.length];
- for (int i = 0; i < colors.length; ++i) {
- gradientColors[i] = colors[i];
- }
- gradientPercents = new int[percents.length];
- for (int i = 0; i < percents.length; ++i) {
- gradientPercents[i] = percents[i];
- }
- if (getDisplay().getDepth() < 15) {
- closeBar.setBackground(background);
- } else {
- closeBar
- .setBackground(gradientColors[gradientColors.length - 1]);
- }
- }
-
- // Refresh with the new settings
- if (selectedIndex > -1) {
- redrawTabArea(selectedIndex);
- }
- }
-
- /**
- * Set the image to be drawn in the background of the selected tab.
- *
- * @param image the image to be drawn in the background
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setSelectionBackground(Image image) {
- checkWidget();
- if (image == backgroundImage) {
- return;
- }
- if (image != null) {
- gradientColors = null;
- gradientPercents = null;
- }
- backgroundImage = image;
- redrawTabArea(selectedIndex);
- }
-
- /**
- * Toggle the visibility of the border
- *
- * @param show true if the border should be displayed
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setBorderVisible(boolean show) {
- checkWidget();
- // if (showBorders == show) return;
-
- showBorders = show;
- if (showBorders) {
- if ((getStyle() & SWT.FLAT) != 0) {
- borderBottom = borderTop = borderLeft = borderRight = 1;
- } else {
- borderLeft = borderTop = 1;
- borderRight = borderBottom = 3;
- }
- } else {
- borderBottom = borderTop = borderLeft = borderRight = 0;
- }
- oldSize = null;
- notifyListeners(SWT.Resize, new Event());
- }
-
- public void setFont(Font font) {
- checkWidget();
- if (font != null && font.equals(getFont())) {
- return;
- }
- super.setFont(font);
- oldFont = getFont();
- resetTabSize(true);
- }
-
- /**
- * Set the foreground color of the selected tab.
- *
- * @param color the color of the text displayed in the selected tab
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setSelectionForeground(Color color) {
- checkWidget();
- if (selectionForeground == color) {
- return;
- }
- if (color == null) {
- color = getForeground();
- }
- selectionForeground = color;
- if (selectedIndex > -1) {
- redrawTabArea(selectedIndex);
- }
- }
-
- /**
- * Display an insert marker before or after the specified tab item.
- *
- * A value of null will clear the mark.
- *
- * @param item the item with which the mark is associated or null
- *
- * @param after true if the mark should be displayed after the specified item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setInsertMark(CTabItem item, boolean after) {
- checkWidget();
- int index = -1;
- if (item != null) {
- index = indexOf(item);
- }
- setInsertMark(index, after);
- }
-
- /**
- * Display an insert marker before or after the specified tab item.
- *
- * A value of -1 will clear the mark.
- *
- * @param index the index of the item with which the mark is associated or null
- *
- * @param after true if the mark should be displayed after the specified item
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setInsertMark(int index, boolean after) {
- checkWidget();
- if (index < -1 || index >= getItemCount()) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- if (index == -1) {
- index = -2;
- } else {
- index = after ? index : --index;
- }
-
- if (insertionIndex == index) {
- return;
- }
- int oldIndex = insertionIndex;
- insertionIndex = index;
- if (index > -1) {
- redrawTabArea(index);
- }
- if (oldIndex > 1) {
- redrawTabArea(oldIndex);
- }
- }
-
- /**
- * Set the selection to the tab at the specified index.
- *
- * @param index the index of the tab item to be selected
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setSelection(int index) {
- checkWidget();
- if (index < 0 || index >= items.length) {
- return;
- }
- if (selectedIndex == index) {
- return;
- }
-
- int oldIndex = selectedIndex;
- selectedIndex = index;
-
- Control control = items[index].control;
- if (control != null && !control.isDisposed()) {
- control.setBounds(getClientArea());
- control.setVisible(true);
- }
-
- if (oldIndex != -1) {
- control = items[oldIndex].control;
- if (control != null && !control.isDisposed()) {
- control.setVisible(false);
- }
- }
- showItem(items[selectedIndex]);
- setButtonBounds();
- redrawTabArea(-1);
- }
-
- /**
- * Set the control that appears in the top right corner of the tab folder.
- * Typically this is a close button or a composite with a Menu and close button.
- * The topRight control is optional. Setting the top right control to null will remove it from the tab folder.
- *
- * @since 2.1
- *
- * @param control the control to be displayed in the top right corner or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * <li>ERROR_INVALID_ARGUMENT - if the control is not a child of this CTabFolder</li>
- * </ul>
- */
- public void setTopRight(Control control) {
- checkWidget();
- if (control != null && control.getParent() != this) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- topRight = control;
- resetTabSize(true);
- }
-
- /**
- * Shows the item. If the item is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the item is visible.
- *
- * @param item the item to be shown
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the item is null</li>
- * <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see CTabFolder#showSelection()
- *
- * @since 2.0
- */
- public void showItem(CTabItem item) {
- checkWidget();
- if (item == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- if (item.isDisposed()) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
-
- int index = indexOf(item);
- if (index < topTabIndex) {
- topTabIndex = index;
- setItemLocation();
- redrawTabArea(-1);
- return;
- }
- Rectangle area = getClientArea();
- if (area.width <= 0) {
- topTabIndex = index;
- return;
- }
- int rightEdge = area.x + area.width;
- Rectangle rect = getToolSpace();
- if (rect.width > 0) {
- rightEdge -= rect.width;
- }
- if (item.x + item.width < rightEdge) {
- return;
- }
- setLastItem(index);
- }
-
- /**
- * Shows the selection. If the selection is already showing in the receiver,
- * this method simply returns. Otherwise, the items are scrolled until
- * the selection is visible.
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- *
- * @see CTabFolder#showItem(CTabItem)
- *
- * @since 2.0
- *
- */
- public void showSelection() {
- checkWidget();
- if (selectedIndex != -1) {
- showItem(getSelection());
- }
- }
-
- char getMnemonic(String string) {
- int index = 0;
- int length = string.length();
- do {
- while ((index < length) && (string.charAt(index) != '&')) {
- index++;
- }
- if (++index >= length) {
- return '\0';
- }
- if (string.charAt(index) != '&') {
- return string.charAt(index);
- }
- index++;
- } while (index < length);
- return '\0';
- }
-
- /**
- * Set the selection to the tab at the specified item.
- *
- * @param item the tab item to be selected
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * <li>ERROR_NULL_ARGUMENT - if argument is null</li>
- * </ul>
- */
- public void setSelection(CTabItem item) {
- checkWidget();
- if (item == null) {
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- }
- int index = indexOf(item);
- setSelection(index);
- }
-
- /**
- * Set the selection to the tab at the specified index.
- */
- private void setSelection(int index, boolean notify) {
- int oldSelectedIndex = selectedIndex;
- setSelection(index);
- if (notify && selectedIndex != oldSelectedIndex && selectedIndex != -1) {
- Event event = new Event();
- event.item = getItem(selectedIndex);
- notifyListeners(SWT.Selection, event);
- }
- }
-
- private Image scaleImage(Image image, int oldSize, int newSize) {
- Display display = getDisplay();
- Color foreground = getForeground();
- Color black = display.getSystemColor(SWT.COLOR_BLACK);
- Color background = getBackground();
- PaletteData palette = new PaletteData(new RGB[] { foreground.getRGB(),
- background.getRGB(), black.getRGB() });
- ImageData imageData = new ImageData(newSize, newSize, 4, palette);
- imageData.transparentPixel = 1;
- Image temp = new Image(display, imageData);
- GC gc = new GC(temp);
- gc.setBackground(background);
- gc.fillRectangle(0, 0, newSize, newSize);
- gc.drawImage(image, 0, 0, oldSize, oldSize, 0, 0, newSize, newSize);
- gc.dispose();
- return temp;
- }
-
- private void updateCloseBar() {
- //Temporary code - need a better way to determine toolBar trim
- int toolbarTrim = 4;
- if (Util.isPhoton()) {
- toolbarTrim = 6;
- }
- if (Util.isGtk()) {
- toolbarTrim = 8;
- }
-
- int maxHeight = tabHeight - CTabItem.TOP_MARGIN
- - CTabItem.BOTTOM_MARGIN - toolbarTrim;
- if (maxHeight < 3) {
- return;
- }
- int imageHeight = (maxHeight < 9) ? 9 : maxHeight;
-
- if (closeImage != null && closeImage.getBounds().height == imageHeight) {
- return;
- }
-
- if (closeBar != null) {
- closeBar.dispose();
- }
- closeBar = null;
- if (inactiveCloseBar != null) {
- inactiveCloseBar.dispose();
- }
- inactiveCloseBar = null;
- createCloseBar();
-
- ToolItem closeItem = closeBar.getItems()[0];
- ToolItem inactiveCloseItem = inactiveCloseBar.getItems()[0];
-
- if (closeImage != null) {
- closeImage.dispose();
- }
-
- Display display = getDisplay();
- Color foreground = getForeground();
- Color black = display.getSystemColor(SWT.COLOR_BLACK);
- Color background = getBackground();
-
- PaletteData palette = new PaletteData(new RGB[] { foreground.getRGB(),
- background.getRGB(), black.getRGB() });
- ImageData imageData = new ImageData(imageHeight, imageHeight, 4,
- palette);
- imageData.transparentPixel = 1;
- closeImage = new Image(display, imageData);
- GC gc = new GC(closeImage);
- gc.setBackground(background);
- gc.fillRectangle(0, 0, imageHeight, imageHeight);
- gc.setForeground(black);
-
- //draw an 9x8 'x' centered in image
- int h = (imageHeight / 2) * 2;
- int inset = (h - 8) / 2;
- gc.drawLine(inset, inset, h - inset - 1, h - inset - 1);
- gc.drawLine(inset + 1, inset, h - inset, h - inset - 1);
- gc.drawLine(inset, h - inset - 1, h - inset - 1, inset);
- gc.drawLine(inset + 1, h - inset - 1, h - inset, inset);
-
- gc.dispose();
-
- if (maxHeight < imageHeight) {
- //rescale image
- Image temp = scaleImage(closeImage, imageHeight, maxHeight);
- closeImage.dispose();
- closeImage = temp;
- }
- closeItem.setImage(closeImage);
- inactiveCloseItem.setImage(closeImage);
- }
-
- private void updateArrowBar() {
- //Temporary code - need a better way to determine toolBar trim
- int toolbarTrim = 6; // Windows needs 6, photon needs 6, gtk needs 8
- if (Util.isGtk()) {
- toolbarTrim = 8;
- }
-
- int maxHeight = tabHeight - toolbarTrim;
- if (maxHeight < 3) {
- return;
- }
- int imageHeight = (maxHeight < 9) ? 9 : maxHeight;
-
- if (arrowLeftImage != null
- && arrowLeftImage.getBounds().height == imageHeight) {
- return;
- }
-
- if (arrowBar != null) {
- arrowBar.dispose();
- }
- arrowBar = null;
- if (arrowLeftImage != null) {
- arrowLeftImage.dispose();
- }
- if (arrowRightImage != null) {
- arrowRightImage.dispose();
- }
-
- createArrowBar();
- ToolItem[] items = arrowBar.getItems();
- ToolItem left = items[0];
- ToolItem right = items[1];
-
- Display display = getDisplay();
- Color foreground = getForeground();
- Color black = display.getSystemColor(SWT.COLOR_BLACK);
- Color background = getBackground();
-
- PaletteData palette = new PaletteData(new RGB[] { foreground.getRGB(),
- background.getRGB(), black.getRGB() });
- ImageData imageData = new ImageData(7, imageHeight, 4, palette);
- imageData.transparentPixel = 1;
- arrowLeftImage = new Image(display, imageData);
- GC gc = new GC(arrowLeftImage);
- gc.setBackground(background);
- gc.fillRectangle(0, 0, 7, imageHeight);
- gc.setBackground(black);
- //draw a 9x5 '<' centered vertically in image
- int h = (imageHeight / 2) * 2;
- int midpoint = h / 2 - 1;
- int[] pointArr = new int[] { 6, midpoint - 5, 1, midpoint, 6,
- midpoint + 5, };
- gc.fillPolygon(pointArr);
- gc.dispose();
-
- palette = new PaletteData(new RGB[] { foreground.getRGB(),
- background.getRGB(), black.getRGB() });
- imageData = new ImageData(7, imageHeight, 4, palette);
- imageData.transparentPixel = 1;
- arrowRightImage = new Image(display, imageData);
- gc = new GC(arrowRightImage);
- gc.setBackground(background);
- gc.fillRectangle(0, 0, 7, imageHeight);
- gc.setBackground(black);
- //draw a 9x5 '>' centered vertically in image
- pointArr = new int[] { 1, midpoint - 5, 6, midpoint, 1, midpoint + 5, };
- gc.fillPolygon(pointArr);
- gc.dispose();
-
- if (maxHeight < imageHeight) {
- //rescale image
- Image leftTemp = scaleImage(arrowLeftImage, imageHeight, maxHeight);
- arrowLeftImage.dispose();
- arrowLeftImage = leftTemp;
-
- Image rightTemp = scaleImage(arrowRightImage, imageHeight,
- maxHeight);
- arrowRightImage.dispose();
- arrowRightImage = rightTemp;
- }
- left.setImage(arrowLeftImage);
- right.setImage(arrowRightImage);
- }
-
- private void onMouseDoubleClick(Event event) {
- Event e = new Event();
- e.item = getItem(new Point(event.x, event.y));
- notifyListeners(SWT.DefaultSelection, e);
- }
-
- /**
- * A mouse button was pressed down.
- * If a tab was hit select the tab.
- */
- private void onMouseDown(Event event) {
- for (int i = 0; i < items.length; i++) {
- if (items[i].getBounds().contains(new Point(event.x, event.y))) {
- if (i == selectedIndex) {
- showSelection();
- return;
- }
- forceFocus();
- setSelection(i, true);
- if (isFocusControl()) {
- setFocus();
- }
- return;
- }
- }
- }
-
- private void onMouseExit(Event event) {
- Rectangle inactiveBounds = inactiveCloseBar.getBounds();
- if (inactiveBounds.contains(event.x, event.y)) {
- return;
- }
- inactiveCloseBar.setVisible(false);
- inactiveItem = null;
-
- showToolTip = false;
- toolTipItem = null;
- if (tip != null && !tip.isDisposed() && tip.isVisible()) {
- tip.setVisible(false);
- }
- }
-
- private void onMouseHover(Event event) {
- if (tip == null || tip.isDisposed()) {
- return;
- }
- showToolTip = true;
- showToolTip(event.x, event.y);
- }
-
- private void showToolTip(int x, int y) {
- CTabItem item = getItem(new Point(x, y));
- if (item != null) {
- if (item == toolTipItem) {
- return;
- }
- toolTipItem = item;
- String tooltip = item.getToolTipText();
- if (tooltip != null && tooltip.length() > 0) {
- Display display = tip.getDisplay();
- label.setForeground(display
- .getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- label.setBackground(display
- .getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- label.setText(tooltip);
- Point labelSize = label.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- labelSize.x += 2;
- labelSize.y += 2;
- label.setSize(labelSize);
- tip.pack();
- /*
- * On some platforms, there is a minimum size for a shell
- * which may be greater than the label size.
- * To avoid having the background of the tip shell showing
- * around the label, force the label to fill the entire client area.
- */
- Rectangle area = tip.getClientArea();
- label.setSize(area.width, area.height);
- /*
- * Position the tooltip and ensure that it is not located off
- * the screen.
- */
- Point pt = new Point(item.x + item.width / 4, item.y
- + item.height + 2);
- pt = toDisplay(pt);
- Rectangle rect = display.getBounds();
- Point tipSize = tip.getSize();
- pt.x = Math.max(0, Math.min(pt.x, rect.width - tipSize.x));
- pt.y = Math.max(0, Math.min(pt.y, rect.height - tipSize.y));
- tip.setLocation(pt);
- tip.setVisible(true);
- return;
- }
- }
-
- toolTipItem = null;
- if (tip != null && !tip.isDisposed() && tip.isVisible()) {
- tip.setVisible(false);
- }
- }
-
- private void onMouseMove(Event event) {
- if (showToolTip) {
- showToolTip(event.x, event.y);
- }
-
- if (!showClose) {
- return;
- }
-
- CTabItem item = null;
- for (int i = 0; i < items.length; i++) {
- Rectangle rect = items[i].getBounds();
- if (rect.contains(new Point(event.x, event.y))) {
- item = items[i];
- break;
- }
- }
- if (item == inactiveItem) {
- return;
- }
-
- inactiveCloseBar.setVisible(false);
- inactiveItem = null;
-
- if (item == null || item == getSelection()) {
- return;
- }
-
- int toolbarHeight = tabHeight - CTabItem.TOP_MARGIN
- - CTabItem.BOTTOM_MARGIN + 2; // +2 to ignore gap between focus rectangle
- Point size = inactiveCloseBar.computeSize(SWT.DEFAULT, toolbarHeight);
- int x = item.x + item.width - size.x - 2; // -2 to not overlap focus rectangle and trim
- int y = item.y + Math.max(0, (item.height - toolbarHeight) / 2);
- Rectangle toolspace = getToolSpace();
- Point folderSize = getSize();
- if ((toolspace.width == 0 || x < toolspace.x)
- && x + size.x < folderSize.x - borderRight) {
- inactiveCloseBar.setBounds(x, y, size.x, toolbarHeight);
- inactiveCloseBar.setVisible(true);
- inactiveItem = item;
- }
- }
-
- private void onTraverse(Event event) {
- switch (event.detail) {
- case SWT.TRAVERSE_ESCAPE:
- // TEMPORARY CODE See bug report 17372
- // case SWT.TRAVERSE_RETURN:
- case SWT.TRAVERSE_TAB_NEXT:
- case SWT.TRAVERSE_TAB_PREVIOUS:
- event.doit = true;
- break;
- case SWT.TRAVERSE_MNEMONIC:
- event.doit = onMnemonic(event);
- if (event.doit) {
- event.detail = SWT.TRAVERSE_NONE;
- }
- break;
- case SWT.TRAVERSE_PAGE_NEXT:
- case SWT.TRAVERSE_PAGE_PREVIOUS:
- event.doit = onPageTraversal(event);
- if (event.doit) {
- event.detail = SWT.TRAVERSE_NONE;
- }
- break;
- }
- }
-
- private boolean onPageTraversal(Event event) {
- int count = getItemCount();
- if (count == 0) {
- return false;
- }
- int index = getSelectionIndex();
- if (index == -1) {
- index = 0;
- } else {
- int offset = (event.detail == SWT.TRAVERSE_PAGE_NEXT) ? 1 : -1;
- index = (index + offset + count) % count;
- }
- setSelection(index, true);
- return true;
- }
-
- /**
- * Answer true if not all tabs can be visible in the receive
- * thus requiring the scroll buttons to be visible.
- */
- private boolean scroll_leftVisible() {
- return topTabIndex > 0;
- }
-
- /**
- * Answer true if not all tabs can be visible in the receive
- * thus requiring the scroll buttons to be visible.
- */
- private boolean scroll_rightVisible() {
- // only show Scroll buttons if there is more than one item
- // and if we are not already at the last item
- if (items.length < 2) {
- return false;
- }
- Rectangle area = getClientArea();
- int rightEdge = area.x + area.width;
- if (rightEdge <= 0) {
- return false;
- }
- if (topTabIndex > 0) {
- rightEdge -= arrowBar.getSize().x;
- }
- if (topRight != null) {
- rightEdge -= topRight.getSize().x;
- }
- CTabItem item = items[items.length - 1];
- return (item.x + item.width > rightEdge);
- }
-
- /**
- * Scroll the tab items to the left.
- */
- private void scroll_scrollLeft() {
- if (items.length == 0) {
- return;
- }
- setLastItem(topTabIndex - 1);
- }
-
- /**
- * Scroll the tab items to the right.
- */
- private void scroll_scrollRight() {
- int lastIndex = getLastItem();
- topTabIndex = lastIndex + 1;
- setItemLocation();
- correctLastItem();
- redrawTabArea(-1);
- }
-
- private boolean correctLastItem() {
- Rectangle area = getClientArea();
- int rightEdge = area.x + area.width;
- if (rightEdge <= 0) {
- return false;
- }
- Rectangle toolspace = getToolSpace();
- if (toolspace.width > 0) {
- rightEdge -= toolspace.width;
- }
- CTabItem item = items[items.length - 1];
- if (item.x + item.width < rightEdge) {
- setLastItem(items.length - 1);
- return true;
- }
- return false;
- }
-
- /**
- * Specify a fixed height for the tab items. If no height is specified,
- * the default height is the height of the text or the image, whichever
- * is greater. Specifying a height of 0 will revert to the default height.
- *
- * @param height the pixel value of the height or 0
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * <li>ERROR_INVALID_ARGUMENT - if called with a height of less than 0</li>
- * </ul>
- */
- public void setTabHeight(int height) {
- checkWidget();
- if (height < 0) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- fixedTabHeight = true;
- if (tabHeight == height) {
- return;
- }
- tabHeight = height;
- oldSize = null;
- notifyListeners(SWT.Resize, new Event());
- }
-
- void resetTabSize(boolean checkHeight) {
- int oldHeight = tabHeight;
- if (!fixedTabHeight && checkHeight) {
- int tempHeight = 0;
- GC gc = new GC(this);
- for (int i = 0; i < items.length; i++) {
- tempHeight = Math.max(tempHeight, items[i].preferredHeight(gc));
- }
- gc.dispose();
- if (topRight != null) {
- tempHeight = Math.max(tempHeight, topRight.computeSize(
- SWT.DEFAULT, SWT.DEFAULT).y);
- }
- tabHeight = tempHeight;
- }
-
- if (tabHeight != oldHeight) {
- oldSize = null;
- notifyListeners(SWT.Resize, new Event());
- } else {
- setItemBounds();
- redraw();
- }
- }
-
- /**
- *
- * @param position
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * <li>ERROR_INVALID_ARGUMENT - if the position value is not either SWT.TOP or SWT.BOTTOM</li>
- * </ul>
- *
- * UNDER CONSTRUCTION
- * @since 3.0
- */
- public void setTabPosition(int position) {
- checkWidget();
- if (position != SWT.TOP && position != SWT.BOTTOM) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (onBottom != (position == SWT.BOTTOM)) {
- onBottom = position == SWT.BOTTOM;
- setBorderVisible(showBorders);
- resetTabSize(true);
- // updateTabHeight(true);
- // Rectangle rectBefore = getClientArea();
- // updateItems();
- // Rectangle rectAfter = getClientArea();
- // if (!rectBefore.equals(rectAfter)) {
- // notifyListeners(SWT.Resize, new Event());
- // }
- // setItemBounds();
- // redrawTabArea(-1);
- // redraw();
- }
- }
-
- /**
- * @return one of {@link SWT#TOP} or {@link SWT#BOTTOM}
- */
- public int getTabPosition() {
- if (onBottom) {
- return SWT.BOTTOM;
- }
- return SWT.TOP;
- }
-
-}
diff --git a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/CTabFolderEvent.java b/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/CTabFolderEvent.java
deleted file mode 100644
index 7b4a880..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/CTabFolderEvent.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * 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.presentations.r21.widgets;
-
-import org.eclipse.swt.events.TypedEvent;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- *
- */
-public class CTabFolderEvent extends TypedEvent {
-
- /**
- * Generated serial version UID for this class.
- * @since 3.1
- */
- private static final long serialVersionUID = 3258688793199719730L;
-
- /**
- *
- */
- public Widget item;
-
- /**
- *
- */
- public boolean doit;
-
- CTabFolderEvent(Widget w) {
- super(w);
- }
-}
diff --git a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/CTabFolderListener.java b/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/CTabFolderListener.java
deleted file mode 100644
index 4d07e63..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/CTabFolderListener.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * 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.presentations.r21.widgets;
-
-/**
- */
-public interface CTabFolderListener {
- /**
- * @param event
- */
- public void itemClosed(CTabFolderEvent event);
-}
diff --git a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/CTabItem.java b/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/CTabItem.java
deleted file mode 100644
index 594e014..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/CTabItem.java
+++ /dev/null
@@ -1,623 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * 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.presentations.r21.widgets;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- */
-public class CTabItem extends Item {
- CTabFolder parent;
-
- int x, y, width, height = 0;
-
- String toolTipText;
-
- Control control; // the tab page
-
- private Image disabledImage;
-
- // internal constants
- static final int LEFT_MARGIN = 4;
-
- static final int RIGHT_MARGIN = 4;
-
- static final int TOP_MARGIN = 3;
-
- static final int BOTTOM_MARGIN = 3;
-
- private static final int INTERNAL_SPACING = 2;
-
- private static final String ellipsis = "..."; //$NON-NLS-1$
-
- String shortenedText;
-
- int shortenedTextWidth;
-
- /**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>CTabFolder</code>) and a style value
- * describing its behavior and appearance. The item is added
- * to the end of the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * lists the style constants that are applicable to the class.
- * Style bits are also inherited from superclasses.
- * </p>
- *
- * @param parent a CTabFolder which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#getStyle
- */
- public CTabItem(CTabFolder parent, int style) {
- this(parent, style, parent.getItemCount());
- }
-
- /**
- * Constructs a new instance of this class given its parent
- * (which must be a <code>CTabFolder</code>), a style value
- * describing its behavior and appearance, and the index
- * at which to place it in the items maintained by its parent.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * lists the style constants that are applicable to the class.
- * Style bits are also inherited from superclasses.
- * </p>
- *
- * @param parent a CTabFolder which will be the parent of the new instance (cannot be null)
- * @param style the style of control to construct
- * @param index the index to store the receiver in its parent
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- *
- * @see SWT
- * @see Widget#getStyle
- */
- public CTabItem(CTabFolder parent, int style, int index) {
- super(parent, checkStyle(style));
- parent.createItem(this, index);
- }
-
- /**
- * @param style
- */
- private static int checkStyle(int style) {
- return SWT.NONE;
- }
-
- public void dispose() {
- if (isDisposed()) {
- return;
- }
- parent.destroyItem(this);
- super.dispose();
- parent = null;
- control = null;
- toolTipText = null;
- }
-
- /**
- * Returns a rectangle describing the receiver's size and location
- * relative to its parent.
- *
- * @return the receiver's bounding column rectangle
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public Rectangle getBounds() {
- //checkWidget();
- return new Rectangle(x, y, width, height);
- }
-
- /**
- * Gets the control that is displayed in the content are of the tab item.
- *
- * @return the control
- *
- * @exception SWTError(ERROR_THREAD_INVALID_ACCESS)
- * when called from the wrong thread
- * @exception SWTError(ERROR_WIDGET_DISPOSED)
- * when the widget has been disposed
- */
- public Control getControl() {
- checkWidget();
- return control;
- }
-
- public Display getDisplay() {
- if (parent == null) {
- SWT.error(SWT.ERROR_WIDGET_DISPOSED);
- }
- return parent.getDisplay();
- }
-
- /**
- * Get the image displayed in the tab if the tab is disabled.
- *
- * @return the disabled image or null
- */
- public Image getDisabledImage() {
- //checkWidget();
- return disabledImage;
- }
-
- /**
- * Returns the receiver's parent, which must be a <code>CTabFolder</code>.
- *
- * @return the receiver's parent
- */
- public CTabFolder getParent() {
- //checkWidget();
- return parent;
- }
-
- /**
- * Returns the receiver's tool tip text, or null if it has
- * not been set.
- *
- * @return the receiver's tool tip text
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public String getToolTipText() {
- checkWidget();
- return toolTipText;
- }
-
- /**
- * Paint the receiver.
- */
- void onPaint(GC gc, boolean isSelected) {
-
- if (width == 0 || height == 0) {
- return;
- }
-
- Display display = getDisplay();
- Color highlightShadow = display
- .getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
- Color normalShadow = display
- .getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
-
- int index = parent.indexOf(this);
-
- if (isSelected) {
-
- Rectangle bounds = null;
- if (!parent.onBottom) {
- if (index == parent.topTabIndex) {
- bounds = new Rectangle(x + 1, y + 1, width - 2, height - 1);
- } else {
- bounds = new Rectangle(x + 2, y + 1, width - 3, height - 1);
- }
- } else {
- if (index == parent.topTabIndex) {
- bounds = new Rectangle(x + 1, y + 1, width - 2, height - 2);
- } else {
- bounds = new Rectangle(x + 2, y + 1, width - 3, height - 2);
- }
- }
- if (parent.backgroundImage != null) {
- // draw a background image behind the text
- Rectangle imageRect = parent.backgroundImage.getBounds();
- gc.drawImage(parent.backgroundImage, 0, 0, imageRect.width,
- imageRect.height, bounds.x, bounds.y, bounds.width,
- bounds.height);
- } else if (parent.gradientColors != null) {
- // draw a gradient behind the text
- Color oldBackground = gc.getBackground();
- if (parent.gradientColors.length == 1) {
- if (parent.gradientColors[0] != null) {
- gc.setBackground(parent.gradientColors[0]);
- }
- gc.fillRectangle(bounds.x, bounds.y, bounds.width,
- bounds.height);
- } else {
- Color oldForeground = gc.getForeground();
- Color lastColor = parent.gradientColors[0];
- if (lastColor == null) {
- lastColor = oldBackground;
- }
- for (int i = 0, pos = 0; i < parent.gradientPercents.length; ++i) {
- gc.setForeground(lastColor);
- lastColor = parent.gradientColors[i + 1];
- if (lastColor == null) {
- lastColor = oldBackground;
- }
- gc.setBackground(lastColor);
- int gradientWidth = (parent.gradientPercents[i]
- * bounds.width / 100)
- - pos;
- gc.fillGradientRectangle(bounds.x + pos, bounds.y,
- gradientWidth, bounds.height, false);
- pos += gradientWidth;
- }
- gc.setForeground(oldForeground);
- }
- gc.setBackground(oldBackground);
- }
-
- // draw tab lines
- if (!parent.onBottom) {
- gc.setForeground(normalShadow);
- if (index != parent.topTabIndex) {
- gc.drawLine(x + 1, y, x + 1, y);
- gc.drawLine(x, y + 1, x, y + height - 2);
- gc.drawLine(x, y + height - 1, x, y + height - 1);
- }
- gc.drawLine(x + width - 1, y, x + width - 1, y);
- gc.drawLine(x + width, y + 1, x + width, y + height - 2);
- gc.drawLine(x + width, y + height - 1, x + width, y + height
- - 1);
-
- gc.setForeground(highlightShadow);
- if (index != parent.topTabIndex) {
- gc.drawLine(x + 2, y, x + 2, y);
- gc.drawLine(x + 1, y + 1, x + 1, y + height - 2);
- gc.drawLine(x + 1, y + height - 1, x + 1, y + height - 1);
- } else {
- gc.drawLine(x, y, x, y + height - 1);
- }
-
- gc.drawLine(x + width - 2, y, x + width - 2, y);
- gc
- .drawLine(x + width - 1, y + 1, x + width - 1, y
- + height - 2);
- gc.drawLine(x + width - 1, y + height - 1, x + width - 1, y
- + height - 1);
-
- // light line across top
- if (index != parent.topTabIndex) {
- gc.drawLine(x + 3, y, x + width - 3, y);
- } else {
- gc.drawLine(x + 1, y, x + width - 3, y);
- }
- } else {
- gc.setForeground(normalShadow);
- if (index != parent.topTabIndex) {
- gc.drawLine(x, y, x, y);
- gc.drawLine(x, y + 1, x, y + height - 2);
- gc.drawLine(x + 1, y + height - 1, x + 1, y + height - 1);
- }
- gc.drawLine(x + width, y, x + width, y);
- gc.drawLine(x + width, y + 1, x + width, y + height - 2);
- gc.drawLine(x + width - 1, y + height - 1, x + width - 1, y
- + height - 1);
-
- gc.setForeground(highlightShadow);
- if (index != parent.topTabIndex) {
- gc.drawLine(x + 1, y, x + 1, y);
- gc.drawLine(x + 1, y + 1, x + 1, y + height - 2);
- gc.drawLine(x + 2, y + height - 1, x + 2, y + height - 1);
- } else {
- gc.drawLine(x, y, x, y + height - 1);
- }
-
- gc.drawLine(x + width - 1, y, x + width - 1, y);
- gc
- .drawLine(x + width - 1, y + 1, x + width - 1, y
- + height - 2);
- gc.drawLine(x + width - 2, y + height - 1, x + width - 2, y
- + height - 1);
-
- // light line across top and bottom
- if (index != parent.topTabIndex) {
- gc.drawLine(x + 1, y, x + width - 2, y);
- gc.drawLine(x + 2, y + height - 1, x + width - 3, y
- + height - 1);
- } else {
- gc.drawLine(x + 1, y, x + width - 2, y);
- gc.drawLine(x + 1, y + height - 1, x + width - 3, y
- + height - 1);
- }
- }
- if (parent.isFocusControl()) {
- // draw a focus rectangle
- int x1, y1, width1, height1;
- if (!parent.onBottom) {
- if (index == parent.topTabIndex) {
- x1 = x + 1;
- y1 = y + 1;
- width1 = width - 2;
- height1 = height - 1;
- } else {
- x1 = x + 2;
- y1 = y + 1;
- width1 = width - 3;
- height1 = height - 1;
- }
- } else {
- if (index == parent.topTabIndex) {
- x1 = x + 1;
- y1 = y + 1;
- width1 = width - 2;
- height1 = height - 2;
- } else {
- x1 = x + 2;
- y1 = y + 1;
- width1 = width - 3;
- height1 = height - 2;
- }
- }
- gc.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
- gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
- gc.drawFocus(x1, y1, width1, height1);
- }
- } else {
- // draw tab lines for unselected items
- gc.setForeground(normalShadow);
- if (!parent.onBottom) {
- if (index != parent.topTabIndex
- && index != parent.getSelectionIndex() + 1) {
- gc.drawLine(x, y, x, y + (height / 2));
- }
- } else {
- if (index != parent.topTabIndex
- && index != parent.getSelectionIndex() + 1) {
- gc.drawLine(x, y + (height / 2), x, y + height - 1);
- }
- }
-
- }
-
- // draw Image
- int xDraw = x + LEFT_MARGIN;
-
- Image image = getImage();
- if (!isSelected && image != null) {
- Image temp = getDisabledImage();
- if (temp != null) {
- image = temp;
- }
- }
- if (image != null) {
- Rectangle imageBounds = image.getBounds();
- int imageX = xDraw;
- int imageHeight = Math.min(height - BOTTOM_MARGIN - TOP_MARGIN,
- imageBounds.height);
- int imageY = y + (height - imageHeight) / 2;
- int imageWidth = imageBounds.width * imageHeight
- / imageBounds.height;
- gc.drawImage(image, imageBounds.x, imageBounds.y,
- imageBounds.width, imageBounds.height, imageX, imageY,
- imageWidth, imageHeight);
- xDraw += imageWidth + INTERNAL_SPACING;
- }
-
- // draw Text
- int textWidth = x + width - xDraw - RIGHT_MARGIN;
- if (isSelected && parent.showClose) {
- textWidth = x + width - xDraw - parent.closeBar.getSize().x
- - RIGHT_MARGIN;
- }
- if (shortenedText == null || shortenedTextWidth != textWidth) {
- shortenedText = shortenText(gc, getText(), textWidth);
- shortenedTextWidth = textWidth;
- }
- String text = shortenedText;
-
- if (isSelected && parent.selectionForeground != null) {
- gc.setForeground(parent.selectionForeground);
- } else {
- gc.setForeground(parent.getForeground());
- }
- int textY = y + (height - gc.textExtent(text, SWT.DRAW_MNEMONIC).y) / 2;
- gc.drawText(text, xDraw, textY, SWT.DRAW_TRANSPARENT
- | SWT.DRAW_MNEMONIC);
-
- gc.setForeground(parent.getForeground());
- }
-
- private static String shortenText(GC gc, String text, int width) {
- if (gc.textExtent(text, SWT.DRAW_MNEMONIC).x <= width) {
- return text;
- }
-
- int ellipseWidth = gc.textExtent(ellipsis, SWT.DRAW_MNEMONIC).x;
- int length = text.length();
- int end = length - 1;
- while (end > 0) {
- text = text.substring(0, end);
- int l1 = gc.textExtent(text, SWT.DRAW_MNEMONIC).x;
- if (l1 + ellipseWidth <= width) {
- return text + ellipsis;
- }
- end--;
- }
- return text + ellipsis;
- }
-
- /**
- * Answer the preferred height of the receiver for the GC.
- */
- int preferredHeight(GC gc) {
- Image image = getImage();
- int height = 0;
- if (image != null) {
- height = image.getBounds().height;
- }
- String text = getText();
- height = Math.max(height, gc.textExtent(text, SWT.DRAW_MNEMONIC).y);
- return height + TOP_MARGIN + BOTTOM_MARGIN;
- }
-
- /**
- * Answer the preferred width of the receiver for the GC.
- */
- int preferredWidth(GC gc) {
- int width = 0;
- Image image = getImage();
- if (image != null) {
- width += image.getBounds().width;
- }
- String text = getText();
- if (text != null) {
- if (image != null) {
- width += INTERNAL_SPACING;
- }
- width += gc.textExtent(text, SWT.DRAW_MNEMONIC).x;
- }
- if (parent.showClose) {
- width += INTERNAL_SPACING + preferredHeight(gc); // closebar will be square and will fill preferred height
- }
- return width + LEFT_MARGIN + RIGHT_MARGIN;
- }
-
- /**
- * Sets the control that is used to fill the client area of
- * the tab folder when the user selects the tab item.
- * <p>
- * @param control the new control (or null)
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_INVALID_ARGUMENT - if the control has been disposed</li>
- * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setControl(Control control) {
- checkWidget();
- if (control != null) {
- if (control.isDisposed()) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (control.getParent() != parent) {
- SWT.error(SWT.ERROR_INVALID_PARENT);
- }
- }
- if (this.control != null && !this.control.isDisposed()) {
- this.control.setVisible(false);
- }
- this.control = control;
- if (this.control != null) {
- int index = parent.indexOf(this);
- if (index == parent.getSelectionIndex()) {
- this.control.setBounds(parent.getClientArea());
- this.control.setVisible(true);
- } else {
- this.control.setVisible(false);
- }
- }
- }
-
- public void setImage(Image image) {
- checkWidget();
- if (image != null && image.equals(getImage())) {
- return;
- }
- super.setImage(image);
- parent.resetTabSize(true);
- }
-
- /**
- * Sets the image that is displayed if the tab item is disabled.
- * Null will clear the image.
- *
- * @param image the image to be displayed when the item is disabled or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setDisabledImage(Image image) {
- checkWidget();
- if (image != null && image.equals(getDisabledImage())) {
- return;
- }
- disabledImage = image;
- parent.redraw();
- }
-
- /**
- * Set the widget text.
- * <p>
- * This method sets the widget label. The label may include
- * mnemonic characters but must not contain line delimiters.
- *
- * @param string the new label for the widget
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the text is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setText(String string) {
- checkWidget();
- if (string.equals(getText())) {
- return;
- }
- super.setText(string);
- shortenedText = null;
- shortenedTextWidth = 0;
- parent.resetTabSize(false);
- }
-
- /**
- * Sets the receiver's tool tip text to the argument, which
- * may be null indicating that no tool tip text should be shown.
- *
- * @param string the new tool tip text (or null)
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setToolTipText(String string) {
- checkWidget();
- toolTipText = string;
- }
-}
diff --git a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/R21PaneFolder.java b/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/R21PaneFolder.java
deleted file mode 100644
index 0a67928..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/R21PaneFolder.java
+++ /dev/null
@@ -1,487 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * 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.presentations.r21.widgets;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.internal.layout.SizeCache;
-import org.eclipse.ui.internal.presentations.util.ProxyControl;
-import org.eclipse.ui.presentations.IStackPresentationSite;
-
-/**
- * This class implements the tab folders that contains can contain two toolbars and
- * status text. Wherever possible, the toolbars are aligned with the tabs.
- * If there is not enough room beside the tabs, the toolbars are aligned with the status text. This
- * is the same tab folder that is used to arrange views and editors in Eclipse.
- * <p>
- * This is closely related to DefaultPartPresentation, but they have different responsibilities. This
- * is essentially a CTabFolder that can manage a toolbar. It should not depend on
- * data structures from the workbench, and its public interface should only use SWT objects or
- * listeners. DefaultPartPresentation uses a PaneFolder to arrange views or editors. Knowledge
- * of higher-level data structures should go there.
- * </p>
- * <p>
- * Although it is not actually a control, the public interface is much like
- * an SWT control. Implementation-wise, this is actually a combination of a CTabFolder and
- * a ViewForm. It encapsulates the details of moving the toolbar between the CTabFolder and
- * the ViewForm, and provides a simpler interface to the ViewForm/CTabFolder.
- * </p>
- *
- * @since 3.0
- */
-public final class R21PaneFolder {
- // Tab folder and associated proxy controls
- private CTabFolder tabFolder;
-
- // private Control titleAreaProxy;
-
- // View form and associated proxy controls
- private ViewForm viewForm;
-
- private ProxyControl contentProxy;
-
- private ProxyControl viewFormTopLeftProxy;
-
- private ProxyControl viewFormTopRightProxy;
-
- private ProxyControl viewFormTopCenterProxy;
-
- // Cached sizes of the top-right and top-center controls
- private SizeCache topRightCache = new SizeCache();
-
- private SizeCache topCenterCache = new SizeCache();
-
- private SizeCache topLeftCache = new SizeCache();
-
- private int tabPos;
-
- private boolean putTrimOnTop = false;
-
- /**
- * List of PaneFolderButtonListener
- */
- private List buttonListeners = new ArrayList(1);
-
- private int state = IStackPresentationSite.STATE_RESTORED;
-
- /**
- * State of the folder at the last mousedown event. This is used to prevent
- * a mouseup over the minimize or maximize buttons from undoing a state change
- * that was caused by the mousedown.
- */
- private int mousedownState = -1;
-
- // // CTabFolder listener
- // private CTabFolder2Adapter expandListener = new CTabFolder2Adapter() {
- // public void minimize(CTabFolderEvent event) {
- // event.doit = false;
- // notifyButtonListeners(IStackPresentationSite.STATE_MINIMIZED);
- // }
- //
- // public void restore(CTabFolderEvent event) {
- // event.doit = false;
- // notifyButtonListeners(IStackPresentationSite.STATE_RESTORED);
- // }
- //
- // public void maximize(CTabFolderEvent event) {
- // event.doit = false;
- // notifyButtonListeners(IStackPresentationSite.STATE_MAXIMIZED);
- // }
- //
- // /* (non-Javadoc)
- // * @see org.eclipse.swt.custom.CTabFolder2Adapter#close(org.eclipse.swt.custom.CTabFolderEvent)
- // */
- // public void close(CTabFolderEvent event) {
- // event.doit = false;
- // notifyCloseListeners((CTabItem)event.item);
- // }
- //
- // public void showList(CTabFolderEvent event) {
- // notifyShowListeners(event);
- // }
- //
- // };
- //
- private MouseListener mouseListener = new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- mousedownState = getState();
- }
-
- public void mouseDoubleClick(MouseEvent e) {
- }
- };
-
- /**
- * Creates a pane folder. This will create exactly one child control in the
- * given parent.
- *
- * @param parent
- * @param flags
- */
- public R21PaneFolder(Composite parent, int flags) {
- // Initialize tab folder
- {
- tabFolder = new CTabFolder(parent, flags);
-
- // // Create a proxy control to measure the title area of the tab folder
- // titleAreaProxy = new Composite(tabFolder, SWT.NONE);
- // titleAreaProxy.setVisible(false);
- // tabFolder.setTopRight(titleAreaProxy, SWT.FILL);
-
- // tabFolder.addCTabFolder2Listener(expandListener);
- //
- tabFolder.addMouseListener(mouseListener);
- }
-
- // Initialize view form
- {
- viewForm = new ViewForm(tabFolder, SWT.NONE);
-
- // Only attach these to the viewForm when there's actuall a control to display
- viewFormTopLeftProxy = new ProxyControl(viewForm);
- viewFormTopCenterProxy = new ProxyControl(viewForm);
- viewFormTopRightProxy = new ProxyControl(viewForm);
-
- contentProxy = new ProxyControl(viewForm);
- viewForm.setContent(contentProxy.getControl());
- }
- }
-
- /**
- * Return the main control for this pane folder
- *
- * @return Composite the control
- */
- public Composite getControl() {
- return tabFolder;
- }
-
- /**
- * Sets the top-center control (usually a toolbar), or null if none.
- * Note that the control can have any parent.
- *
- * @param topCenter the top-center control or null if none
- */
- public void setTopCenter(Control topCenter) {
- topCenterCache.setControl(topCenter);
- if (topCenter != null) {
- if (!putTrimOnTop) {
- viewFormTopCenterProxy.setTarget(topCenterCache);
- viewForm.setTopCenter(viewFormTopCenterProxy.getControl());
- }
- } else {
- if (!putTrimOnTop) {
- viewForm.setTopCenter(null);
- }
- }
- }
-
- /**
- * Sets the top-right control (usually a dropdown), or null if none
- *
- * @param topRight
- */
- public void setTopRight(Control topRight) {
- topRightCache.setControl(topRight);
- if (topRight != null) {
- if (!putTrimOnTop) {
- viewFormTopRightProxy.setTarget(topRightCache);
- viewForm.setTopRight(viewFormTopRightProxy.getControl());
- }
- } else {
- if (!putTrimOnTop) {
- viewForm.setTopRight(null);
- }
- }
- }
-
- /**
- * Sets the top-left control (usually a title label), or null if none
- *
- * @param topLeft
- */
- public void setTopLeft(Control topLeft) {
- if (topLeftCache.getControl() != topLeft) {
- topLeftCache.setControl(topLeft);
- // The top-left control always goes directly in the ViewForm
- if (topLeft != null) {
- viewFormTopLeftProxy.setTarget(topLeftCache);
- viewForm.setTopLeft(viewFormTopLeftProxy.getControl());
- } else {
- viewFormTopLeftProxy.setTargetControl(null);
- viewForm.setTopLeft(null);
- }
- }
- }
-
- /**
- * Flush all of this folder's size caches to ensure they will be re-computed
- * on the next layout.
- */
- public void flush() {
- topLeftCache.flush();
- topRightCache.flush();
- topCenterCache.flush();
- }
-
- /**
- * Layout the receiver, flusing the cache if needed.
- *
- * @param flushCache
- */
- public void layout(boolean flushCache) {
- // Flush the cached sizes if necessary
- if (flushCache) {
- flush();
- }
-
- Rectangle tabFolderClientArea = tabFolder.getClientArea();
-
- // Hide tabs if there is only one
- if (tabFolder.getItemCount() < 2) {
- //Rectangle tabFolderBounds = tabFolder.getBounds();
-
- int delta = getTabHeight() + 1;
- tabFolderClientArea.height += delta;
-
- if (getTabPosition() == SWT.TOP) {
- tabFolderClientArea.y -= delta;
- }
- }
-
- viewForm.setBounds(tabFolderClientArea);
- viewFormTopRightProxy.layout();
- viewFormTopLeftProxy.layout();
- viewFormTopCenterProxy.layout();
- }
-
- /**
- * Returns the client area for this PaneFolder, relative to the pane folder's control.
- *
- * @return Rectangle the client area
- */
- public Rectangle getClientArea() {
- Rectangle bounds = contentProxy.getControl().getBounds();
-
- Rectangle formArea = viewForm.getBounds();
-
- bounds.x += formArea.x;
- bounds.y += formArea.y;
-
- return bounds;
- }
-
- /**
- * Returns the current state of the folder (as shown on the button icons)
- *
- * @return one of the IStackPresentationSite.STATE_* constants
- */
- public int getState() {
- return state;
- }
-
- /**
- * @param buttonId one of the IStackPresentationSite.STATE_* constants
- */
- protected void notifyButtonListeners(int buttonId) {
- if (mousedownState == getState()) {
- Iterator iter = buttonListeners.iterator();
-
- while (iter.hasNext()) {
- R21PaneFolderButtonListener listener = (R21PaneFolderButtonListener) iter
- .next();
-
- listener.stateButtonPressed(buttonId);
- }
- }
- }
-
- /**
- * Notifies all listeners that the user clicked on the chevron
- *
- * @param event
- */
- protected void notifyShowListeners(CTabFolderEvent event) {
- Iterator iter = buttonListeners.iterator();
-
- while (iter.hasNext()) {
- R21PaneFolderButtonListener listener = (R21PaneFolderButtonListener) iter
- .next();
-
- listener.showList(event);
- }
- }
-
- /**
- * Notifies all listeners that the close button was pressed
- *
- * @param tabItem
- */
- protected void notifyCloseListeners(CTabItem tabItem) {
- Iterator iter = buttonListeners.iterator();
-
- while (iter.hasNext()) {
- R21PaneFolderButtonListener listener = (R21PaneFolderButtonListener) iter
- .next();
-
- listener.closeButtonPressed(tabItem);
- }
- }
-
- /**
- * @param listener
- */
- public void addButtonListener(R21PaneFolderButtonListener listener) {
- buttonListeners.add(listener);
- }
-
- /**
- * @param listener
- */
- public void removeButtonListener(R21PaneFolderButtonListener listener) {
- buttonListeners.remove(listener);
- }
-
- /**
- * @param newTabPosition
- */
- public void setTabPosition(int newTabPosition) {
- tabPos = newTabPosition;
- tabFolder.setTabPosition(tabPos);
- }
-
- /**
- * @return int the postion of the tab
- */
- public int getTabPosition() {
- return tabPos;
- }
-
- /**
- * @return boolean <code>true</code> if the receiver has been disposed
- */
- public boolean isDisposed() {
- return tabFolder == null || tabFolder.isDisposed();
- }
-
- /**
- * @param style
- * @param index
- * @return CTabItem the created item
- */
- public CTabItem createItem(int style, int index) {
- return new CTabItem(tabFolder, style, index);
- }
-
- // The remainder of the methods in this class redirect directly to CTabFolder methods
-
- /**
- * @param selection
- */
- public void setSelection(int selection) {
- tabFolder.setSelection(selection);
- }
-
- /**
- * @param i
- * @param j
- * @param k
- * @param l
- * @return Rectangle the trim rectangle
- */
- public Rectangle computeTrim(int i, int j, int k, int l) {
- return tabFolder.computeTrim(i, j, k, l);
- }
-
- /**
- * @param fgColor
- */
- public void setSelectionForeground(Color fgColor) {
- tabFolder.setSelectionForeground(fgColor);
- }
-
- /**
- * @param idx
- * @return CTabItem the indexed item
- */
- public CTabItem getItem(int idx) {
- return tabFolder.getItem(idx);
- }
-
- /**
- * @return int the selected items index
- */
- public int getSelectionIndex() {
- return tabFolder.getSelectionIndex();
- }
-
- /**
- * @return int the height of the tabs
- */
- public int getTabHeight() {
- return tabFolder.getTabHeight();
- }
-
- /**
- * @param toFind
- * @return int the index of the item to find
- */
- public int indexOf(CTabItem toFind) {
- return tabFolder.indexOf(toFind);
- }
-
- /**
- * @param height
- */
- public void setTabHeight(int height) {
- tabFolder.setTabHeight(height);
- }
-
- /**
- * @return int the item count
- */
- public int getItemCount() {
- return tabFolder.getItemCount();
- }
-
- /**
- * @return CTabItem the items
- */
- public CTabItem[] getItems() {
- return tabFolder.getItems();
- }
-
- /**
- * @param toGet
- * @return CTabItem the indexed item
- */
- public CTabItem getItem(Point toGet) {
- return tabFolder.getItem(toGet);
- }
-
- /**
- * @return CTabItem the selected item
- */
- public CTabItem getSelection() {
- return tabFolder.getSelection();
- }
-}
diff --git a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/R21PaneFolderButtonListener.java b/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/R21PaneFolderButtonListener.java
deleted file mode 100644
index 5316e12..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/R21PaneFolderButtonListener.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
- * 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.presentations.r21.widgets;
-
-/**
- * This listener receives notifications when the user clicks on one of
- * the buttons (minimize, maximize, or restore) on a pane folder.
- *
- * @since 3.0
- */
-public abstract class R21PaneFolderButtonListener {
-
- /**
- * Called when the minimize, maximize, or restore buttons are pressed.
- *
- * @param buttonId one of the IStackPresentationSite.STATE_* constants
- */
- public void stateButtonPressed(int buttonId) {
- }
-
- /**
- * Called when a close button is pressed.
- *
- * @param item the tab whose close button was pressed
- */
- public void closeButtonPressed(CTabItem item) {
- }
-
- /**
- *
- * @param event
- * @since 3.0
- */
- public void showList(CTabFolderEvent event) {
- }
-}
diff --git a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/ViewForm.java b/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/ViewForm.java
deleted file mode 100644
index 21920da..0000000
--- a/bundles/org.eclipse.ui.presentations.r21/src/org/eclipse/ui/internal/presentations/r21/widgets/ViewForm.java
+++ /dev/null
@@ -1,696 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * 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.presentations.r21.widgets;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Listener;
-
-/**
- * Instances of this class implement a Composite that lays out three
- * children horizontally and allows programmatic control of layout and
- * border parameters. ViewForm is used in the workbench to implement a
- * view's label/menu/toolbar local bar.
- * <p>
- * Note that although this class is a subclass of <code>Composite</code>,
- * it does not make sense to set a layout on it.
- * </p><p>
- * <dl>
- * <dt><b>Styles:</b></dt>
- * <dd>BORDER, FLAT</dd>
- * <dt><b>Events:</b></dt>
- * <dd>(None)</dd>
- * </dl>
- * <p>
- * IMPORTANT: This class is <em>not</em> intended to be subclassed.
- * </p>
- */
-
-public class ViewForm extends Composite {
-
- /**
- * marginWidth specifies the number of pixels of horizontal margin
- * that will be placed along the left and right edges of the form.
- *
- * The default value is 0.
- */
- public int marginWidth = 0;
-
- /**
- * marginHeight specifies the number of pixels of vertical margin
- * that will be placed along the top and bottom edges of the form.
- *
- * The default value is 0.
- */
- public int marginHeight = 0;
-
- /**
- * Color of innermost line of drop shadow border.
- */
- public static RGB borderInsideRGB = new RGB(132, 130, 132);
-
- /**
- * Color of middle line of drop shadow border.
- */
- public static RGB borderMiddleRGB = new RGB(143, 141, 138);
-
- /**
- * Color of outermost line of drop shadow border.
- */
- public static RGB borderOutsideRGB = new RGB(171, 168, 165);
-
- // SWT widgets
- private Control topLeft;
-
- private Control topCenter;
-
- private Control topRight;
-
- private Control content;
-
- // Configuration and state info
- private boolean separateTopCenter = false;
-
- private int drawLine1 = -1;
-
- private int drawLine2 = -1;
-
- private boolean showBorder = false;
-
- private int BORDER_TOP = 0;
-
- private int BORDER_BOTTOM = 0;
-
- private int BORDER_LEFT = 0;
-
- private int BORDER_RIGHT = 0;
-
- private Color borderColor1;
-
- private Color borderColor2;
-
- private Color borderColor3;
-
- private Rectangle oldArea;
-
- private static final int OFFSCREEN = -200;
-
- /**
- * Constructs a new instance of this class given its parent
- * and a style value describing its behavior and appearance.
- * <p>
- * The style value is either one of the style constants defined in
- * class <code>SWT</code> which is applicable to instances of this
- * class, or must be built by <em>bitwise OR</em>'ing together
- * (that is, using the <code>int</code> "|" operator) two or more
- * of those <code>SWT</code> style constants. The class description
- * lists the style constants that are applicable to the class.
- * Style bits are also inherited from superclasses.
- * </p>
- *
- * @param parent a widget which will be the parent of the new instance (cannot be null)
- * @param style the style of widget to construct
- *
- * @exception IllegalArgumentException <ul>
- * <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
- * </ul>
- * @exception SWTException <ul>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
- * </ul>
- *
- * @see SWT#BORDER
- * @see SWT#FLAT
- * @see #getStyle()
- */
- public ViewForm(Composite parent, int style) {
- super(parent, checkStyle(style));
-
- borderColor1 = new Color(getDisplay(), borderInsideRGB);
- borderColor2 = new Color(getDisplay(), borderMiddleRGB);
- borderColor3 = new Color(getDisplay(), borderOutsideRGB);
- setBorderVisible((style & SWT.BORDER) != 0);
-
- addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent event) {
- onPaint(event.gc);
- }
- });
- addControlListener(new ControlAdapter() {
- public void controlResized(ControlEvent e) {
- onResize();
- }
- });
-
- addListener(SWT.Dispose, new Listener() {
- public void handleEvent(Event e) {
- onDispose();
- }
- });
- }
-
- /**
- * Check the style bits to ensure that no invalid styles are applied.
- * @private
- */
- private static int checkStyle(int style) {
- int mask = SWT.FLAT | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
- return style & mask | SWT.NO_REDRAW_RESIZE;
- }
-
- public Point computeSize(int wHint, int hHint, boolean changed) {
- checkWidget();
- // size of title bar area
- Point leftSize = new Point(0, 0);
- if (topLeft != null) {
- leftSize = topLeft.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- leftSize.x += 1; // +1 for highlight line
- }
- Point centerSize = new Point(0, 0);
- if (topCenter != null) {
- centerSize = topCenter.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- }
- Point rightSize = new Point(0, 0);
- if (topRight != null) {
- rightSize = topRight.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- }
- Point size = new Point(0, 0);
- // calculate width of title bar
- if (separateTopCenter
- || (wHint != SWT.DEFAULT && leftSize.x + centerSize.x
- + rightSize.x > wHint)) {
- size.x = leftSize.x + rightSize.x;
- size.x = Math.max(centerSize.x, size.x);
- size.y = Math.max(leftSize.y, rightSize.y) + 1; // +1 for highlight line
- if (topCenter != null) {
- size.y += centerSize.y;
- }
- } else {
- size.x = leftSize.x + centerSize.x + rightSize.x;
- size.y = Math.max(leftSize.y, Math.max(centerSize.y, rightSize.y)) + 1; // +1 for highlight line
- }
-
- if (content != null) {
- Point contentSize = new Point(0, 0);
- contentSize = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- size.x = Math.max(size.x, contentSize.x);
- size.y += contentSize.y + 1; // +1 for line bewteen content and header
- }
-
- size.x += 2 * marginWidth;
- size.y += 2 * marginHeight;
-
- if (wHint != SWT.DEFAULT) {
- size.x = wHint;
- }
- if (hHint != SWT.DEFAULT) {
- size.y = hHint;
- }
-
- Rectangle trim = computeTrim(0, 0, size.x, size.y);
- return new Point(trim.width, trim.height);
- }
-
- public Rectangle computeTrim(int x, int y, int width, int height) {
- checkWidget();
- int trimX = x - BORDER_LEFT;
- int trimY = y - BORDER_TOP;
- int trimWidth = width + BORDER_LEFT + BORDER_RIGHT;
- int trimHeight = height + BORDER_TOP + BORDER_BOTTOM;
- return new Rectangle(trimX, trimY, trimWidth, trimHeight);
- }
-
- public Rectangle getClientArea() {
- checkWidget();
- Rectangle clientArea = super.getClientArea();
- clientArea.x += BORDER_LEFT;
- clientArea.y += BORDER_TOP;
- clientArea.width -= BORDER_LEFT + BORDER_RIGHT;
- clientArea.height -= BORDER_TOP + BORDER_BOTTOM;
- return clientArea;
- }
-
- /**
- * Returns the content area.
- *
- * @return the control in the content area of the pane or null
- */
- public Control getContent() {
- //checkWidget();
- return content;
- }
-
- /**
- * Returns Control that appears in the top center of the pane.
- * Typically this is a toolbar.
- *
- * @return the control in the top center of the pane or null
- */
- public Control getTopCenter() {
- //checkWidget();
- return topCenter;
- }
-
- /**
- * Returns the Control that appears in the top left corner of the pane.
- * Typically this is a label such as CLabel.
- *
- * @return the control in the top left corner of the pane or null
- */
- public Control getTopLeft() {
- //checkWidget();
- return topLeft;
- }
-
- /**
- * Returns the control in the top right corner of the pane.
- * Typically this is a Close button or a composite with a Menu and Close button.
- *
- * @return the control in the top right corner of the pane or null
- */
- public Control getTopRight() {
- //checkWidget();
- return topRight;
- }
-
- public void layout(boolean changed) {
- checkWidget();
- Rectangle rect = getClientArea();
-
- drawLine1 = -1;
- drawLine2 = -1;
-
- Point leftSize = new Point(0, 0);
- if (topLeft != null && !topLeft.isDisposed()) {
- leftSize = topLeft.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- }
- Point centerSize = new Point(0, 0);
- if (topCenter != null && !topCenter.isDisposed()) {
- centerSize = topCenter.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- }
- Point rightSize = new Point(0, 0);
- if (topRight != null && !topRight.isDisposed()) {
- rightSize = topRight.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- }
-
- int minTopWidth = leftSize.x + centerSize.x + rightSize.x + 2
- * marginWidth + 1; // +1 for highlight line
- int height = rect.y + marginHeight;
-
- boolean top = false;
- if (separateTopCenter || minTopWidth > rect.width) {
- int topHeight = Math.max(rightSize.y, leftSize.y);
- if (topRight != null && !topRight.isDisposed()) {
- top = true;
- topRight.setBounds(rect.x + rect.width - marginWidth
- - rightSize.x, rect.y + 1 + marginHeight, rightSize.x,
- topHeight);
- height += 1 + topHeight; // +1 for highlight line
- }
- if (topLeft != null && !topLeft.isDisposed()) {
- top = true;
- leftSize = topLeft.computeSize(rect.width - 2 * marginWidth
- - rightSize.x - 1, SWT.DEFAULT);
- topLeft.setBounds(rect.x + 1 + marginWidth, rect.y + 1
- + marginHeight, leftSize.x, topHeight);
- height = Math
- .max(height, rect.y + marginHeight + 1 + topHeight); // +1 for highlight line
- }
- if (topCenter != null && !topCenter.isDisposed()) {
- top = true;
- if (height > rect.y + marginHeight) {
- drawLine1 = height;
- height += 1; // +1 for divider line
- }
- centerSize = topCenter.computeSize(
- rect.width - 2 * marginWidth, SWT.DEFAULT);
- topCenter.setBounds(rect.x + rect.width - marginWidth
- - centerSize.x, height, centerSize.x, centerSize.y);
- height += centerSize.y;
-
- }
- } else {
- int topHeight = Math.max(rightSize.y, Math.max(centerSize.y,
- leftSize.y));
- if (topRight != null && !topRight.isDisposed()) {
- top = true;
- topRight.setBounds(rect.x + rect.width - marginWidth
- - rightSize.x, rect.y + marginHeight + 1, // +1 for highlight line
- rightSize.x, topHeight);
- height += 1 + topHeight; // +1 for highlight line
- }
- if (topCenter != null && !topCenter.isDisposed()) {
- top = true;
- topCenter.setBounds(rect.x + rect.width - marginWidth
- - rightSize.x - centerSize.x,
- rect.y + marginHeight + 1, // +1 for highlight line
- centerSize.x, topHeight);
- height = Math
- .max(height, rect.y + marginHeight + 1 + topHeight); // +1 for highlight line
- }
- if (topLeft != null && !topLeft.isDisposed()) {
- top = true;
- leftSize = topLeft.computeSize(rect.width - 2 * marginWidth
- - rightSize.x - centerSize.x - 1, topHeight);
- topLeft.setBounds(rect.x + marginWidth + 1, // +1 for highlight line
- rect.y + marginHeight + 1, // +1 for highlight line
- leftSize.x, topHeight);
- height = Math
- .max(height, rect.y + marginHeight + 1 + topHeight); // +1 for highlight line
- }
- }
-
- if (content != null && !content.isDisposed()) {
- if (top) {
- drawLine2 = height;
- height += 1; // +1 for divider line
- }
- content
- .setBounds(rect.x + marginWidth, height, rect.width - 2
- * marginWidth, rect.y + rect.height - height
- - marginHeight);
- }
- }
-
- private void onDispose() {
- if (borderColor1 != null) {
- borderColor1.dispose();
- }
- borderColor1 = null;
-
- if (borderColor2 != null) {
- borderColor2.dispose();
- }
- borderColor2 = null;
-
- if (borderColor3 != null) {
- borderColor3.dispose();
- }
- borderColor3 = null;
-
- topLeft = null;
- topCenter = null;
- topRight = null;
- content = null;
- oldArea = null;
- }
-
- /**
- * Draws the focus border.
- */
- private void onPaint(GC gc) {
- Rectangle d = super.getClientArea();
-
- if (showBorder) {
- if ((getStyle() & SWT.FLAT) != 0) {
- gc.setForeground(borderColor1);
- gc.drawRectangle(d.x, d.y, d.x + d.width - 1, d.y + d.height
- - 1);
- } else {
- gc.setForeground(borderColor1);
- gc.drawRectangle(d.x, d.y, d.x + d.width - 3, d.y + d.height
- - 3);
-
- gc.setForeground(borderColor2);
- gc.drawLine(d.x + 1, d.y + d.height - 2, d.x + d.width - 1, d.y
- + d.height - 2);
- gc.drawLine(d.x + d.width - 2, d.y + 1, d.x + d.width - 2, d.y
- + d.height - 1);
-
- gc.setForeground(borderColor3);
- gc.drawLine(d.x + 2, d.y + d.height - 1, d.x + d.width - 2, d.y
- + d.height - 1);
- gc.drawLine(d.x + d.width - 1, d.y + 2, d.x + d.width - 1, d.y
- + d.height - 2);
- }
- }
-
- if (drawLine1 != -1) {
- // top seperator line
- gc.setForeground(borderColor1);
- gc.drawLine(d.x + BORDER_LEFT, drawLine1, d.x + d.width
- - BORDER_RIGHT, drawLine1);
- }
- if (drawLine2 != -1) {
- // content separator line
- gc.setForeground(borderColor1);
- gc.drawLine(d.x + BORDER_LEFT, drawLine2, d.x + d.width
- - BORDER_RIGHT, drawLine2);
- }
- // highlight on top
- int y = drawLine1;
- if (y == -1) {
- y = drawLine2;
- }
- if (y != -1) {
- gc.setForeground(getDisplay().getSystemColor(
- SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
- gc.drawLine(d.x + BORDER_LEFT + marginWidth, d.y + BORDER_TOP
- + marginHeight, d.x + BORDER_LEFT + marginWidth, y - 1);
- gc.drawLine(d.x + BORDER_LEFT + marginWidth, d.y + BORDER_TOP
- + marginHeight, d.x + d.width - BORDER_RIGHT - marginWidth
- - 1, d.y + BORDER_TOP + marginHeight);
- }
-
- gc.setForeground(getForeground());
- }
-
- private void onResize() {
- layout();
-
- Rectangle area = super.getClientArea();
- if (oldArea == null || oldArea.width == 0 || oldArea.height == 0) {
- redraw();
- } else {
- int width = 0;
- if (oldArea.width < area.width) {
- width = area.width - oldArea.width + BORDER_RIGHT;
- } else if (oldArea.width > area.width) {
- width = BORDER_RIGHT;
- }
- redraw(area.x + area.width - width, area.y, width, area.height,
- false);
-
- int height = 0;
- if (oldArea.height < area.height) {
- height = area.height - oldArea.height + BORDER_BOTTOM;
- }
- if (oldArea.height > area.height) {
- height = BORDER_BOTTOM;
- }
- redraw(area.x, area.y + area.height - height, area.width, height,
- false);
- }
- oldArea = area;
- }
-
- /**
- * Sets the content.
- * Setting the content to null will remove it from
- * the pane - however, the creator of the content must dispose of the content.
- *
- * @param content the control to be displayed in the content area or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setContent(Control content) {
- checkWidget();
- if (content != null && content.getParent() != this) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (this.content != null && !this.content.isDisposed()) {
- this.content.setBounds(OFFSCREEN, OFFSCREEN, 0, 0);
- }
- this.content = content;
- layout();
- }
-
- /**
- * Set the widget font.
- * This will apply the font to the topLeft, topRight and topCenter widgets.
- */
- public void setFont(Font f) {
- super.setFont(f);
- if (topLeft != null && !topLeft.isDisposed()) {
- topLeft.setFont(f);
- }
- if (topCenter != null && !topCenter.isDisposed()) {
- topCenter.setFont(f);
- }
- if (topRight != null && !topRight.isDisposed()) {
- topRight.setFont(f);
- }
-
- layout();
- }
-
- /**
- * Sets the layout which is associated with the receiver to be
- * the argument which may be null.
- * <p>
- * Note : ViewForm does not use a layout class to size and position its children.
- * </p>
- *
- * @param layout the receiver's new layout or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setLayout(Layout layout) {
- checkWidget();
- return;
- }
-
- /**
- * Set the control that appears in the top center of the pane.
- * Typically this is a toolbar.
- * The topCenter is optional. Setting the topCenter to null will remove it from
- * the pane - however, the creator of the topCenter must dispose of the topCenter.
- *
- * @param topCenter the control to be displayed in the top center or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setTopCenter(Control topCenter) {
- checkWidget();
- if (topCenter != null && topCenter.getParent() != this) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (this.topCenter != null && !this.topCenter.isDisposed()) {
- this.topCenter.setBounds(OFFSCREEN, OFFSCREEN, 0, 0);
- }
- this.topCenter = topCenter;
- layout();
- }
-
- /**
- * Set the control that appears in the top left corner of the pane.
- * Typically this is a label such as CLabel.
- * The topLeft is optional. Setting the top left control to null will remove it from
- * the pane - however, the creator of the control must dispose of the control.
- *
- * @param c the control to be displayed in the top left corner or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setTopLeft(Control c) {
- checkWidget();
- if (c != null && c.getParent() != this) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (this.topLeft != null && !this.topLeft.isDisposed()) {
- this.topLeft.setBounds(OFFSCREEN, OFFSCREEN, 0, 0);
- }
- this.topLeft = c;
- layout();
- }
-
- /**
- * Set the control that appears in the top right corner of the pane.
- * Typically this is a Close button or a composite with a Menu and Close button.
- * The topRight is optional. Setting the top right control to null will remove it from
- * the pane - however, the creator of the control must dispose of the control.
- *
- * @param c the control to be displayed in the top right corner or null
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * <li>ERROR_INVALID_ARGUMENT - if the control is not a child of this ViewForm</li>
- * </ul>
- */
- public void setTopRight(Control c) {
- checkWidget();
- if (c != null && c.getParent() != this) {
- SWT.error(SWT.ERROR_INVALID_ARGUMENT);
- }
- if (this.topRight != null && !this.topRight.isDisposed()) {
- this.topRight.setBounds(OFFSCREEN, OFFSCREEN, 0, 0);
- }
- this.topRight = c;
- layout();
- }
-
- /**
- * Specify whether the border should be displayed or not.
- *
- * @param show true if the border should be displayed
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setBorderVisible(boolean show) {
- checkWidget();
- if (showBorder == show) {
- return;
- }
-
- showBorder = show;
- if (showBorder) {
- if ((getStyle() & SWT.FLAT) != 0) {
- BORDER_LEFT = BORDER_TOP = BORDER_RIGHT = BORDER_BOTTOM = 1;
- } else {
- BORDER_LEFT = BORDER_TOP = 1;
- BORDER_RIGHT = BORDER_BOTTOM = 3;
- }
- } else {
- BORDER_BOTTOM = BORDER_TOP = BORDER_LEFT = BORDER_RIGHT = 0;
- }
-
- layout();
- redraw();
- }
-
- /**
- * If true, the topCenter will always appear on a separate line by itself, otherwise the
- * topCenter will appear in the top row if there is room and will be moved to the second row if
- * required.
- *
- * @param show true if the topCenter will always appear on a separate line by itself
- *
- * @exception SWTException <ul>
- * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
- * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
- * </ul>
- */
- public void setTopCenterSeparate(boolean show) {
- checkWidget();
- separateTopCenter = show;
- layout();
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views.properties.tabbed/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.views.properties.tabbed/META-INF/MANIFEST.MF
index f00c5f0..282da85 100644
--- a/bundles/org.eclipse.ui.views.properties.tabbed/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui.views.properties.tabbed/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.ui.views.properties.tabbed;singleton:=true
-Bundle-Version: 3.5.300.qualifier
+Bundle-Version: 3.6.0.qualifier
Bundle-Activator: org.eclipse.ui.internal.views.properties.tabbed.TabbedPropertyViewPlugin
Bundle-Vendor: %Plugin.providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.ui.views.properties.tabbed/pom.xml b/bundles/org.eclipse.ui.views.properties.tabbed/pom.xml
index f05c90b..43b84d6 100644
--- a/bundles/org.eclipse.ui.views.properties.tabbed/pom.xml
+++ b/bundles/org.eclipse.ui.views.properties.tabbed/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.ui.views.properties.tabbed</artifactId>
- <version>3.5.300-SNAPSHOT</version>
+ <version>3.6.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyList.java b/bundles/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyList.java
index 468f1d5..212be14 100755
--- a/bundles/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyList.java
+++ b/bundles/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyList.java
@@ -8,9 +8,12 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Mariot Chauvin <mariot.chauvin@obeo.fr> - bug 259553
+ * Amit Joglekar <joglekar@us.ibm.com> - Support for dynamic images (bug 385795)
*******************************************************************************/
package org.eclipse.ui.internal.views.properties.tabbed.view;
+import java.util.Map;
+
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.ACC;
@@ -34,6 +37,7 @@
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
@@ -69,6 +73,17 @@
private ListElement[] elements;
+ /**
+ * This map specifies the number of dynamic images for a tab. It has a
+ * ITabItem as key and number of dynamic images for the tab as value. It is
+ * set using the setDynamicImageCount() method. It is used to calculate the
+ * width of the widest tab by setting aside enough space for displaying the
+ * dynamic images. Individual dynamic images are displayed/removed from a
+ * tab by using the showDynamicImage() and hideDynamicImage() methods on the
+ * tab's ListElement object.
+ */
+ private Map tabToDynamicImageCountMap;
+
private int selectedElementIndex = NONE;
private int topVisibleIndex = NONE;
@@ -126,6 +141,10 @@
private boolean hover;
+ private Image[] dynamicImages;
+
+ private Color textColor = widgetForeground;
+
/**
* Constructor for ListElement.
*
@@ -187,6 +206,32 @@
}
/**
+ * Constructor for ListElement.
+ *
+ * @param parent
+ * the parent Composite.
+ * @param tab
+ * the tab item for the element.
+ * @param dynamicImageCount
+ * number of dynamic images for this element
+ * @param index
+ * the index in the list.
+ */
+ public ListElement(Composite parent, final ITabItem tab,
+ int dynamicImageCount, int index) {
+ this(parent, tab, index);
+ /*
+ * Dynamic images are not displayed initially, set all of them to
+ * null. Clients should call showDynamicImage() method to display a
+ * dynamic image.
+ */
+ this.dynamicImages = new Image[dynamicImageCount];
+ for (int i = 0; i < dynamicImageCount; i++) {
+ this.dynamicImages[i] = null;
+ }
+ }
+
+ /**
* Set selected value for this element.
*
* @param selected
@@ -198,6 +243,64 @@
}
/**
+ * Show the dynamic image at specified index in dynamicImages array. The
+ * image width should not be more than 16 pixels. The caller is
+ * responsible for loading the image appropriately and managing it's
+ * resources.
+ *
+ * @param index
+ * @param image
+ */
+ public void showDynamicImage(int index, Image image) {
+ if (index >= 0 && index < dynamicImages.length) {
+ if (dynamicImages[index] != image) {
+ dynamicImages[index] = image;
+ redraw();
+ }
+ }
+ }
+
+ /**
+ * Hide the dynamic image at specified index in dynamicImages array. The
+ * caller is responsible for managing image resources and disposing it
+ * appropriately.
+ *
+ * @param index
+ */
+ public void hideDynamicImage(int index) {
+ if (index >= 0 && index < dynamicImages.length) {
+ if (dynamicImages[index] != null) {
+ dynamicImages[index] = null;
+ redraw();
+ }
+ }
+ }
+
+ /**
+ * Sets color to be used for drawing tab label text. The caller is
+ * responsible for managing the color's resources and disposing it
+ * appropriately after setDefaultTextColor() is later invoked.
+ *
+ * @param textColor
+ */
+ public void setTextColor(Color textColor) {
+ if (textColor != null && !this.textColor.equals(textColor)) {
+ this.textColor = textColor;
+ redraw();
+ }
+ }
+
+ /**
+ * Sets default color for tab label text
+ */
+ public void setDefaultTextColor() {
+ if (!this.textColor.equals(widgetForeground)) {
+ this.textColor = widgetForeground;
+ redraw();
+ }
+ }
+
+ /**
* Paint the element.
*
* @param e
@@ -242,6 +345,9 @@
bounds.height + 1);
}
+ /*
+ * Add INDENT pixels to the left as a margin.
+ */
int textIndent = INDENT;
FontMetrics fm = e.gc.getFontMetrics();
int height = fm.getHeight();
@@ -256,13 +362,13 @@
textIndent = textIndent - 3;
}
e.gc.drawImage(tab.getImage(), textIndent, textMiddle - 1);
- textIndent = textIndent + 16 + 5;
+ textIndent = textIndent + 16 + 4;
} else if (tab.isIndented()) {
textIndent = textIndent + INDENT;
}
/* draw the text */
- e.gc.setForeground(widgetForeground);
+ e.gc.setForeground(textColor);
if (selected) {
/* selected tab is bold font */
e.gc.setFont(JFaceResources.getFontRegistry().getBold(
@@ -276,6 +382,33 @@
+ point.x, bounds.height - 4);
}
+ /* Draw dynamic images, if any */
+ boolean hasDynamicImage = false;
+ for (int i = 0; i < dynamicImages.length; i++) {
+ Image dynamicImage = dynamicImages[i];
+ if (dynamicImage != null && !dynamicImage.isDisposed()) {
+ hasDynamicImage = true;
+ break;
+ }
+ }
+ if (hasDynamicImage) {
+ int drawPosition = textIndent
+ + e.gc.textExtent(tab.getText()).x + 4;
+ boolean addSpace = false;
+ for (int i = 0; i < dynamicImages.length; i++) {
+ Image dynamicImage = dynamicImages[i];
+ if (dynamicImage != null && !dynamicImage.isDisposed()) {
+ if (addSpace) {
+ drawPosition = drawPosition + 3;
+ }
+ e.gc.drawImage(dynamicImage, drawPosition,
+ textMiddle - 1);
+ drawPosition = drawPosition + 16;
+ addSpace = true;
+ }
+ }
+ }
+
/* draw the bottom line on the tab for selected and default */
if (!hover) {
e.gc.setForeground(listBackground);
@@ -549,6 +682,15 @@
}
/**
+ * Returns the number of elements in this list viewer.
+ *
+ * @return number of elements
+ */
+ public int getNumberOfElements() {
+ return elements.length;
+ }
+
+ /**
* Returns the element with the given index from this list viewer. Returns
* <code>null</code> if the index is out of range.
*
@@ -575,6 +717,14 @@
}
/**
+ * @return zero-relative index of the widest item, or -1 if this list is
+ * empty.
+ */
+ public int getWidestLabelIndex() {
+ return widestLabelIndex;
+ }
+
+ /**
* Removes all elements from this list.
*/
public void removeAll() {
@@ -591,6 +741,20 @@
}
/**
+ * Sets a map containing an ITabItem as key and number of dynamic images as
+ * value. It is used to calculate the width of the widest tab by setting
+ * aside enough space (16 pixels per image) for displaying the dynamic
+ * images. Individual dynamic images are displayed/removed from a tab by
+ * using the showDynamicImage() and hideDynamicImage() methods on the tab's
+ * ListElement object.
+ *
+ * @param tabToDynamicImageCountMap
+ */
+ public void setDynamicImageCount(Map tabToDynamicImageCountMap) {
+ this.tabToDynamicImageCountMap = tabToDynamicImageCountMap;
+ }
+
+ /**
* Sets the new list elements.
*
* @param children
@@ -605,18 +769,20 @@
} else {
widestLabelIndex = 0;
for (int i = 0; i < children.length; i++) {
- elements[i] = new ListElement(this, (ITabItem) children[i], i);
+ int dynamicImageCount = 0;
+ if (tabToDynamicImageCountMap != null
+ && tabToDynamicImageCountMap.containsKey(children[i])) {
+ dynamicImageCount = ((Integer) tabToDynamicImageCountMap
+ .get(children[i])).intValue();
+ }
+ elements[i] = new ListElement(this, (ITabItem) children[i],
+ dynamicImageCount, i);
elements[i].setVisible(false);
elements[i].setLayoutData(null);
if (i != widestLabelIndex) {
- String label = ((ITabItem) children[i]).getText();
- int width = getTextDimension(label).x;
- if (((ITabItem) children[i]).isIndented()) {
- width = width + INDENT;
- }
- if (width > getTextDimension(((ITabItem) children[widestLabelIndex])
- .getText()).x) {
+ int width = getTabWidth((ITabItem) children[i]);
+ if (width > getTabWidth((ITabItem) children[widestLabelIndex])) {
widestLabelIndex = i;
}
}
@@ -626,6 +792,40 @@
computeTopAndBottomTab();
}
+ private int getTabWidth(ITabItem tabItem) {
+ int width = getTextDimension(tabItem.getText()).x;
+ /*
+ * To anticipate for the icon placement we should always keep the
+ * space available after the label. So when the active tab includes
+ * an icon the width of the tab doesn't change.
+ */
+ if (tabItem.getImage() != null) {
+ width = width + 16 + 4;
+ }
+ if (tabItem.isIndented()) {
+ width = width + INDENT;
+ }
+ if (tabToDynamicImageCountMap != null) {
+ int dynamicImageCount = 0;
+ if (tabToDynamicImageCountMap.containsKey(tabItem)) {
+ dynamicImageCount = ((Integer) tabToDynamicImageCountMap
+ .get(tabItem)).intValue();
+ }
+ if (dynamicImageCount > 0) {
+ /*
+ * Keep some space between tab's text and first dynamic image
+ */
+ width = width + 4;
+ width = width + (dynamicImageCount * 16);
+ /*
+ * Keep some space between consecutive dynamic images
+ */
+ width = width + ((dynamicImageCount - 1) * 3);
+ }
+ }
+ return width;
+ }
+
/**
* Selects one of the elements in the list.
*
@@ -684,21 +884,12 @@
String properties_not_available = TabbedPropertyMessages.TabbedPropertyList_properties_not_available;
result.x = getTextDimension(properties_not_available).x + INDENT;
} else {
- ITabItem widestTab = elements[widestLabelIndex].getTabItem();
- int width = getTextDimension(widestTab.getText()).x + INDENT;
/*
- * To anticipate for the icon placement we should always keep the
- * space available after the label. So when the active tab includes
- * an icon the width of the tab doesn't change.
+ * Add INDENT pixels to the left of the longest tab as a margin.
*/
- if (widestTab.getImage() != null) {
- width = width + 16 + 4;
- }
- if (widestTab.isIndented()) {
- width = width + 10;
- }
+ int width = getTabWidth(elements[widestLabelIndex].getTabItem()) + INDENT;
/*
- * Add 10 pixels to the right of the longest string as a margin.
+ * Add 10 pixels to the right of the longest tab as a margin.
*/
result.x = width + 10;
}
diff --git a/bundles/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage.java b/bundles/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage.java
index c3b14caac2..6881820 100644
--- a/bundles/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage.java
+++ b/bundles/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage.java
@@ -443,8 +443,9 @@
* Dispose the contributor with the provided contributor id. This happens on
* part close as well as when contributors switch between the workbench
* part and contributor from a selection.
+ * @since 3.6
*/
- private void disposeContributor() {
+ protected void disposeContributor() {
/**
* If the current tab is about to be disposed we have to call
* aboutToBeHidden
@@ -606,7 +607,18 @@
}
}
- private void disposeTabs(Collection tabs) {
+ /**
+ * Disposes the TabContents objects passed to this method. If the
+ * 'currentTab' is going to be disposed, then the caller should call
+ * aboutToBeHidden() on the currentTab and set it to null before calling
+ * this method. Also, the caller needs to ensure that descriptorToTab map
+ * entries corresponding to the disposed TabContents objects are also
+ * removed.
+ *
+ * @param tabs
+ * @since 3.6
+ */
+ protected void disposeTabs(Collection tabs) {
for (Iterator iter = tabs.iterator(); iter.hasNext();) {
TabContents tab = (TabContents) iter.next();
Composite composite = (Composite) tabToComposite.remove(tab);
@@ -1052,4 +1064,57 @@
}
return registry.getLabelProvider().getImage(selection);
}
+
+ /**
+ * Returns the TabContents object corresponding to the given tab-descriptor.
+ *
+ * @param tabDescriptor
+ * tab-descriptor whose TabContents object is to be returned
+ * @return TabContents object corresponding to the given tab-descriptor key
+ * in descriptorToTab map, or null if the key does not exist in the
+ * map
+ * @since 3.6
+ */
+ protected TabContents getTabContents(ITabDescriptor tabDescriptor) {
+ TabContents tabContents = null;
+ if (this.descriptorToTab.containsKey(tabDescriptor)) {
+ tabContents = (TabContents) this.descriptorToTab.get(tabDescriptor);
+ }
+ return tabContents;
+ }
+
+ /**
+ * Get the current selection-contributor if any
+ *
+ * @return The selection-contributor, or null.
+ * @since 3.6
+ */
+ protected ITabbedPropertySheetPageContributor getSelectionContributor() {
+ return this.selectionContributor;
+ }
+
+ /**
+ * Get the currently active contributor id. It may not match the contributor
+ * id from the workbench part that created this instance because if all the
+ * elements in a structured selection implement
+ * ITabbedPropertySheetPageContributor and they all return the same unique
+ * contributor ID, then tabs and sections associated with that contributor
+ * ID are used by the tabbed property view for that selection.
+ *
+ * @return contributor id
+ * @since 3.6
+ */
+ protected String getCurrentContributorId() {
+ return this.currentContributorId;
+ }
+
+ /**
+ * Get the current selection
+ *
+ * @return selection
+ * @since 3.6
+ */
+ protected ISelection getCurrentSelection() {
+ return this.currentSelection;
+ }
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.win32/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.win32/META-INF/MANIFEST.MF
index 69334e9..0f492f2 100644
--- a/bundles/org.eclipse.ui.win32/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui.win32/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %fragmentName
Bundle-SymbolicName: org.eclipse.ui.win32
-Bundle-Version: 3.2.302.qualifier
+Bundle-Version: 3.2.400.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Fragment-Host: org.eclipse.ui.ide;bundle-version="[3.2.0,4.0.0)"
diff --git a/bundles/org.eclipse.ui.win32/pom.xml b/bundles/org.eclipse.ui.win32/pom.xml
index 4905515..e5541d0 100644
--- a/bundles/org.eclipse.ui.win32/pom.xml
+++ b/bundles/org.eclipse.ui.win32/pom.xml
@@ -22,7 +22,7 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.ui.win32</artifactId>
- <version>3.2.302-SNAPSHOT</version>
+ <version>3.2.400-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>
diff --git a/bundles/org.eclipse.ui.workbench.compatibility/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.workbench.compatibility/META-INF/MANIFEST.MF
index ef002f7..9445c5b 100644
--- a/bundles/org.eclipse.ui.workbench.compatibility/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui.workbench.compatibility/META-INF/MANIFEST.MF
@@ -2,10 +2,11 @@
Bundle-ManifestVersion: 2
Bundle-Name: %fragmentName
Bundle-SymbolicName: org.eclipse.ui.workbench.compatibility
-Bundle-Version: 3.2.102.qualifier
+Bundle-Version: 3.2.300.qualifier
Bundle-Vendor: %providerName
Fragment-Host: org.eclipse.ui.workbench;bundle-version="[3.0.0,4.0.0)"
Bundle-Localization: fragment-compatibility
+Export-Package: org.eclipse.ui.internal;x-internal:=true
Require-Bundle: org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)"
Bundle-RequiredExecutionEnvironment: J2SE-1.4
Bundle-ClassPath: compatibility.jar
diff --git a/bundles/org.eclipse.ui.workbench.compatibility/pom.xml b/bundles/org.eclipse.ui.workbench.compatibility/pom.xml
index ebb61c4..4e67dfb 100644
--- a/bundles/org.eclipse.ui.workbench.compatibility/pom.xml
+++ b/bundles/org.eclipse.ui.workbench.compatibility/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.ui.workbench.compatibility</artifactId>
- <version>3.2.102-SNAPSHOT</version>
+ <version>3.2.300-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.ui.workbench/.settings/.api_filters b/bundles/org.eclipse.ui.workbench/.settings/.api_filters
index db03471..f6d94c0 100644
--- a/bundles/org.eclipse.ui.workbench/.settings/.api_filters
+++ b/bundles/org.eclipse.ui.workbench/.settings/.api_filters
@@ -15,7 +15,7 @@
<message_argument value="getEditorState(IEditorReference[])"/>
</message_arguments>
</filter>
- <filter comment="Packported API to 3.8.2 from 4.2.2" id="1210056707">
+ <filter comment="backported to 3.8.2" id="1210056707">
<message_arguments>
<message_argument value="3.8.2"/>
<message_argument value="getEditorState(IEditorReference[], boolean)"/>
@@ -27,7 +27,7 @@
<message_argument value="openEditors(IEditorInput[], String[], IMemento[], int)"/>
</message_arguments>
</filter>
- <filter comment="Packported API to 3.8.2 from 4.2.2" id="1210056707">
+ <filter comment="backported to 3.8.2" id="1210056707">
<message_arguments>
<message_argument value="3.8.2"/>
<message_argument value="openEditors(IEditorInput[], String[], IMemento[], int, int)"/>
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindow.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindow.java
index 5b51843..c352e73 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindow.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindow.java
@@ -11,7 +11,6 @@
package org.eclipse.ui;
import java.lang.reflect.InvocationTargetException;
-
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.dynamichelpers.IExtensionTracker;
import org.eclipse.jface.operation.IRunnableContext;
@@ -199,11 +198,11 @@
public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException;
/**
- * Sets or clears the currently active page for this workbench window.
- *
- * @param page
- * the new active page
- */
+ * Sets or clears the currently active page for this workbench window.
+ *
+ * @param page
+ * the new active page, or <code>null</code> for no active page
+ */
public void setActivePage(IWorkbenchPage page);
/**
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/OpenAndLinkWithEditorHelper.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/OpenAndLinkWithEditorHelper.java
index e6e23a1..9db40b1 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/OpenAndLinkWithEditorHelper.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/OpenAndLinkWithEditorHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2012 IBM Corporation and others.
* 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
@@ -11,7 +11,6 @@
package org.eclipse.ui;
import org.eclipse.core.runtime.Assert;
-
import org.eclipse.jface.util.OpenStrategy;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
@@ -127,19 +126,24 @@
protected abstract void open(ISelection selection, boolean activate);
/**
- * Tells to link the given selection to the editor that is open on the given selection but does
- * nothing if no matching editor can be found.
+ * Tells to link the given selection to the editor that is open on the given
+ * selection but does nothing if no matching editor can be found.
* <p>
- * The common implementation brings that editor to front but more advanced implementations may
- * also select the given selection inside the editor.
+ * The common implementation brings that editor to front but more advanced
+ * implementations may also select the given selection inside the editor.
* </p>
* <p>
* <strong>Note:</strong> The implementation must not open a new editor.
* </p>
+ * <p>
+ * The default implementation does nothing i.e. does not implement linking.
+ * </p>
*
- * @param selection the viewer's selection
- * @since 3.5
+ * @param selection
+ * the viewer's selection
+ * @since 3.5, non-abstract since 4.3
*/
- protected abstract void linkToEditor(ISelection selection);
+ protected void linkToEditor(ISelection selection) {
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/XMLMemento.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/XMLMemento.java
index 7a13851..c3e6892 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/XMLMemento.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/XMLMemento.java
@@ -13,6 +13,7 @@
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Reader;
+import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
import javax.xml.parsers.DocumentBuilder;
@@ -607,6 +608,22 @@
}
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ try {
+ StringWriter writer = new StringWriter();
+ save(writer);
+ return writer.toString();
+ } catch (IOException e) {
+ return super.toString();
+ }
+ }
+
/**
* A simple XML writer. Using this instead of the javax.xml.transform classes allows
* compilation against JCL Foundation (bug 80053).
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/BaseNewWizardMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/BaseNewWizardMenu.java
index f184d73..e19f9fe 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/BaseNewWizardMenu.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/BaseNewWizardMenu.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 IBM Corporation and others.
* 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
@@ -43,6 +43,9 @@
* A <code>BaseNewWizardMenu</code> is used to populate a menu manager with
* New Wizard actions for the current perspective's new wizard shortcuts,
* including an Other... action to open the new wizard dialog.
+ * <p>
+ * <strong>Note:</strong> Clients must dispose this menu when it is no longer required.
+ * </p>
*
* @since 3.1
*/
@@ -98,6 +101,9 @@
/**
* Creates a new wizard shortcut menu for the IDE.
+ * <p>
+ * <strong>Note:</strong> Clients must dispose this menu when it is no longer required.
+ * </p>
*
* @param window
* the window containing the menu
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ContributionItemFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ContributionItemFactory.java
index 93d15a2..90b8d70 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ContributionItemFactory.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ContributionItemFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2012 IBM Corporation and others.
* 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
@@ -28,6 +28,7 @@
import org.eclipse.ui.internal.ShowViewMenu;
import org.eclipse.ui.internal.SwitchToWindowMenu;
import org.eclipse.ui.internal.WorkbenchImages;
+import org.eclipse.ui.internal.WorkbenchMessages;
import org.eclipse.ui.internal.WorkbenchPlugin;
import org.eclipse.ui.internal.actions.HelpSearchContributionItem;
import org.eclipse.ui.menus.CommandContributionItem;
@@ -118,7 +119,7 @@
.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_PIN_EDITOR),
WorkbenchImages
.getImageDescriptor(IWorkbenchGraphicConstants.IMG_ETOOL_PIN_EDITOR_DISABLED),
- null, null, null, null,
+ null, null, null, WorkbenchMessages.PinEditorAction_toolTip, // Local workaround for http://bugs.eclipse.org/387583
CommandContributionItem.STYLE_CHECK, null, false);
final IPropertyChangeListener[] perfs = new IPropertyChangeListener[1];
final IPartListener partListener = new IPartListener() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/LabelRetargetAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/LabelRetargetAction.java
index f2827c4..7a9830a 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/LabelRetargetAction.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/LabelRetargetAction.java
@@ -161,7 +161,9 @@
String str = removeAcceleratorText(newText);
// Append our accelerator
if (acceleratorText != null) {
- str = str + acceleratorText;
+ str = str + '\t' + acceleratorText;
+ } else if (str != newText) {
+ str = str + '\t';
}
return str;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
index b224db2..a96c2c2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
@@ -1233,7 +1233,6 @@
if (windowContext == null) {
windowContext = E4Workbench.initializeContext(
e4Context, window);
- E4Workbench.processHierarchy(window);
}
WorkbenchWindow result = (WorkbenchWindow) windowContext.get(IWorkbenchWindow.class
.getName());
@@ -1621,7 +1620,16 @@
preferenceStore.addPropertyChangeListener(new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
if (IWorkbenchPreferenceConstants.ENABLE_ANIMATIONS.equals(event.getProperty())) {
- e4Context.set(IPresentationEngine.ANIMATIONS_ENABLED, event.getNewValue());
+ Object o = event.getNewValue();
+ if (o instanceof Boolean) {
+ // Boolean if notified after the preference page has
+ // been closed
+ e4Context.set(IPresentationEngine.ANIMATIONS_ENABLED, o);
+ } else if (o instanceof String) {
+ // String if notified via an import of the preference
+ e4Context.set(IPresentationEngine.ANIMATIONS_ENABLED,
+ Boolean.parseBoolean((String) event.getNewValue()));
+ }
}
}
});
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
index e780a8c..e42b1f0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
@@ -1145,10 +1145,13 @@
try {
// Tag the currently active part so we can restore focus on startup
- WorkbenchPartReference ref = (WorkbenchPartReference) getActivePage()
- .getActivePartReference();
- if (ref != null) {
- ref.getModel().getTags().add(EPartService.ACTIVE_ON_CLOSE_TAG);
+ IWorkbenchPage activePage = getActivePage();
+ if (activePage != null) {
+ WorkbenchPartReference ref = (WorkbenchPartReference) activePage
+ .getActivePartReference();
+ if (ref != null) {
+ ref.getModel().getTags().add(EPartService.ACTIVE_ON_CLOSE_TAG);
+ }
}
// Only do the check if it is OK to close if we are not closing
@@ -1171,8 +1174,7 @@
// Reset the internal flags if window was not closed.
closing = false;
updateDisabled = false;
- }
- else {
+ } else {
firePageClosed();
fireWindowClosed();
}
@@ -1363,20 +1365,10 @@
return actionBars;
}
- /**
- * Returns the active page.
- *
- * @return the active page
- */
public IWorkbenchPage getActivePage() {
return page;
}
- /**
- * Returns an array of the pages in the workbench window.
- *
- * @return an array of pages
- */
public IWorkbenchPage[] getPages() {
return page == null ? new IWorkbenchPage[0] : new IWorkbenchPage[] { page };
}
@@ -1699,13 +1691,6 @@
}
}
- /**
- * Sets the active page within the window.
- *
- * @param in
- * identifies the new active page, or <code>null</code> for no
- * active page
- */
public void setActivePage(final IWorkbenchPage in) {
if (getActivePage() != in) {
if (in == null) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CustomizePerspectiveDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CustomizePerspectiveDialog.java
index 90634c8..88efe21 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CustomizePerspectiveDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CustomizePerspectiveDialog.java
@@ -764,11 +764,13 @@
* @return the created label
*/
protected Label createEntry(Composite parent, Image icon, String text) {
+ Color fg = parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND);
+ Color bg = parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);
if (icon != null) {
Label iconLabel = new Label(parent, SWT.NONE);
iconLabel.setImage(icon);
- iconLabel.setBackground(parent.getDisplay().getSystemColor(
- SWT.COLOR_INFO_BACKGROUND));
+ iconLabel.setForeground(fg);
+ iconLabel.setBackground(bg);
iconLabel.setData(new GridData());
}
@@ -781,8 +783,8 @@
}
textLabel.setText(text);
- textLabel.setBackground(parent.getDisplay().getSystemColor(
- SWT.COLOR_INFO_BACKGROUND));
+ textLabel.setForeground(fg);
+ textLabel.setBackground(bg);
return textLabel;
}
@@ -803,11 +805,13 @@
*/
protected Link createEntryWithLink(Composite parent, Image icon,
String text) {
+ Color fg = parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND);
+ Color bg = parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);
if (icon != null) {
Label iconLabel = new Label(parent, SWT.NONE);
iconLabel.setImage(icon);
- iconLabel.setBackground(parent.getDisplay().getSystemColor(
- SWT.COLOR_INFO_BACKGROUND));
+ iconLabel.setForeground(fg);
+ iconLabel.setBackground(bg);
iconLabel.setData(new GridData());
}
@@ -818,8 +822,8 @@
}
textLink.setText(text);
- textLink.setBackground(parent.getDisplay().getSystemColor(
- SWT.COLOR_INFO_BACKGROUND));
+ textLink.setForeground(fg);
+ textLink.setBackground(bg);
return textLink;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferencesPageContainer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferencesPageContainer.java
deleted file mode 100644
index 72593c6..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferencesPageContainer.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * 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.dialogs;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.preference.IPreferenceNode;
-import org.eclipse.jface.preference.IPreferencePageContainer;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ScrolledComposite;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-/**
- * The PreferencesPageContainer is the container object for the preference pages
- * in a node.
- */
-public class PreferencesPageContainer implements IPreferencePageContainer {
-
- private Composite control;
-
- private ScrolledComposite scrolled;
-
- private class PreferenceEntry {
-
- Composite composite;
-
- IPreferenceNode node;
-
- String title;
-
- int offset;
-
- Label expandImage;
-
- Label titleLabel;
-
- Composite pageContainer;
-
- /**
- * Create a new instance of the receiver.
- *
- * @param displayedNode
- * @param pageTitle
- */
- PreferenceEntry(IPreferenceNode displayedNode, String pageTitle) {
- node = displayedNode;
- title = pageTitle;
- }
-
- /**
- * Add the subnodes of the receiver.
- */
- private void addSubNodes() {
- IPreferenceNode[] subnodes = node.getSubNodes();
- PreferenceEntry previous = null;
- for (int i = 0; i < subnodes.length; i++) {
- PreferenceEntry entry = createEntry(subnodes[i], subnodes[i]
- .getLabelText(), offset + 1);
- if (previous == null) {
- entry.composite.moveBelow(this.composite);
- } else {
- entry.composite.moveBelow(previous.composite);
- }
- previous = entry;
- }
- }
-
- /**
- * Create the contents of the entry in parent. When laying this out
- * indent the composite ident units.
- *
- * @param indent
- */
- void createContents(int indent) {
-
- composite = new Composite(control, SWT.NULL);
-
- // Create the title area which will contain
- // a title, message, and image.
-
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.horizontalIndent = IDialogConstants.SMALL_INDENT * indent;
- composite.setLayoutData(gridData);
-
- FormLayout layout = new FormLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- Font titleFont = JFaceResources.getBannerFont();
-
- expandImage = new Label(composite, SWT.RIGHT);
- expandImage.setText("+");//$NON-NLS-1$
- expandImage.setFont(titleFont);
-
- FormData imageData = new FormData();
- imageData.top = new FormAttachment(0);
- imageData.left = new FormAttachment(0,
- IDialogConstants.HORIZONTAL_SPACING);
- expandImage.setLayoutData(imageData);
-
- // Title image
- titleLabel = new Label(composite, SWT.LEFT);
- titleLabel.setText(title);
- titleLabel.setFont(titleFont);
-
- FormData titleData = new FormData();
- titleData.right = new FormAttachment(100);
- titleData.top = new FormAttachment(0);
- titleData.left = new FormAttachment(expandImage,
- IDialogConstants.HORIZONTAL_SPACING);
- titleLabel.setLayoutData(titleData);
-
- titleLabel.addMouseListener(new MouseAdapter() {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.swt.events.MouseAdapter#mouseDown(org.eclipse.swt.events.MouseEvent)
- */
- public void mouseDown(MouseEvent e) {
-
- if (pageContainer == null) {
- boolean adjustScrollbars = false;
-
- pageContainer = new Composite(composite, SWT.BORDER);
-
- FormData containerData = new FormData();
- containerData.top = new FormAttachment(titleLabel, 0);
- containerData.left = new FormAttachment(0);
- containerData.right = new FormAttachment(100);
- pageContainer.setLayoutData(containerData);
-
- pageContainer.setLayout(new GridLayout());
-
- node.createPage();
- node.getPage().createControl(pageContainer);
- node.getPage().setContainer(
- PreferencesPageContainer.this);
- node.getPage().getControl().setLayoutData(
- new GridData(GridData.FILL_BOTH));
- adjustScrollbars = true;
-
- Point contentSize = node.getPage().computeSize();
- Rectangle totalArea = composite.getClientArea();
-
- if (contentSize.x < totalArea.width) {
- contentSize.x = totalArea.width;
- }
-
- node.getPage().setSize(contentSize);
- if (adjustScrollbars) {
- adjustScrollbars(contentSize);
- }
-
- expandImage.setText("-");//$NON-NLS-1$
-
- addSubNodes();
-
- setSelectionColors(composite.getDisplay()
- .getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- } else {
- setSelectionColors(null);
- pageContainer.dispose();
- pageContainer = null;
- expandImage.setText("+");//$NON-NLS-1$
- }
-
- control.layout(true);
- }
- });
- offset = indent;
- }
-
- /**
- * Set the background colors and the labels due to selection.
- *
- * @param highlight
- * The highlight to set
- */
- private void setSelectionColors(Color highlight) {
- composite.setBackground(highlight);
- titleLabel.setBackground(highlight);
- expandImage.setBackground(highlight);
- }
-
- }
-
- /**
- * Create a new instance of the receiver.
- */
- public PreferencesPageContainer() {
- super();
- }
-
- /**
- * Create the contents area of the composite.
- *
- * @param parent
- * @param style
- */
- void createContents(Composite parent, int style) {
- scrolled = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
-
- GridData newPageData = new GridData(GridData.FILL_BOTH);
- scrolled.setLayoutData(newPageData);
-
- control = new Composite(scrolled, style);
-
- scrolled.setContent(control);
- scrolled.setExpandVertical(true);
- scrolled.setExpandHorizontal(true);
- GridData controlData = new GridData(GridData.FILL_BOTH);
- control.setLayoutData(controlData);
-
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 1;
- control.setLayout(layout);
-
- }
-
- /**
- * Return the top level control
- *
- * @return Control
- */
- Control getControl() {
- return control;
- }
-
- /**
- * Show the selected node. Return whether or not this succeeded.
- *
- * @param node
- * @return <code>true</code> if the page selection was sucessful
- * <code>false</code> is unsuccessful
- */
- boolean show(IPreferenceNode node) {
- createGeneralEntry(node);
- control.layout(true);
- return true;
- }
-
- /**
- * Create an entry for the receiver with the general tag. Do not recurse
- * through the children as this is the implied top node.
- *
- * @param node
- */
- private void createGeneralEntry(IPreferenceNode node) {
- PreferenceEntry entry = createEntry(node, "General", 0); //$NON-NLS-1$
- entry.addSubNodes();
-
- }
-
- /**
- * Create an entry with the given title for the IPreferenceNode with an
- * indent i.
- *
- * @param node
- * @param name
- * @param indent
- * @return the entry
- */
- private PreferenceEntry createEntry(IPreferenceNode node, String name,
- int indent) {
- PreferenceEntry entry = new PreferenceEntry(node, name);
- entry.createContents(indent);
- return entry;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.IPreferencePageContainer#getPreferenceStore()
- */
- public IPreferenceStore getPreferenceStore() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.IPreferencePageContainer#updateButtons()
- */
- public void updateButtons() {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.IPreferencePageContainer#updateMessage()
- */
- public void updateMessage() {
- // TODO Auto-generated method stub
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.IPreferencePageContainer#updateTitle()
- */
- public void updateTitle() {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * Adjust the scrollbars for the content that just got added.
- *
- * @param contentSize
- */
- private void adjustScrollbars(Point contentSize) {
-
- Point size = control.getSize();
- scrolled.setMinHeight(size.y + contentSize.y);
- scrolled.setMinWidth(Math.max(size.x, contentSize.x));
- }
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SimpleWorkingSetSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SimpleWorkingSetSelectionDialog.java
index 01f2e2f..bc3381f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SimpleWorkingSetSelectionDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SimpleWorkingSetSelectionDialog.java
@@ -14,7 +14,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.Set;
-
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.ArrayContentProvider;
@@ -83,10 +82,6 @@
}
}
- private final static int SIZING_SELECTION_WIDGET_HEIGHT = 200;
-
- private final static int SIZING_SELECTION_WIDGET_WIDTH = 50;
-
private CheckboxTableViewer viewer;
private IWorkingSet[] initialSelection;
@@ -123,20 +118,16 @@
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
viewerComposite.setLayout(layout);
-
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
- data.widthHint = SIZING_SELECTION_WIDGET_WIDTH + 300; // fudge? I like
- // fudge.
- viewerComposite.setLayoutData(data);
+ viewerComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
viewer = CheckboxTableViewer.newCheckList(viewerComposite, SWT.BORDER);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
viewer.setLabelProvider(new WorkingSetLabelProvider());
viewer.setContentProvider(new ArrayContentProvider());
viewer.addFilter(new WorkingSetFilter(null));
- viewer.setInput(PlatformUI.getWorkbench().getWorkingSetManager()
- .getWorkingSets());
+ IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager()
+ .getWorkingSets();
+ viewer.setInput(workingSets);
viewer.setFilters(new ViewerFilter[] { new Filter() });
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@@ -146,11 +137,10 @@
});
viewer.setCheckedElements(initialSelection);
- data = new GridData(GridData.FILL_BOTH);
- data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
- data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
+ GridData viewerData = new GridData(GridData.FILL_BOTH);
+ viewerData.widthHint = convertWidthInCharsToPixels(50);
+ viewer.getControl().setLayoutData(viewerData);
- viewer.getControl().setLayoutData(data);
addModifyButtons(viewerComposite);
addSelectionButtons(composite);
@@ -159,6 +149,9 @@
Dialog.applyDialogFont(composite);
+ viewerData.heightHint = viewer.getTable().getItemHeight()
+ * Math.min(30, Math.max(10, workingSets.length));
+
return composite;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SpyHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SpyHandler.java
index 1d929b9..0b36ab2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SpyHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/handlers/SpyHandler.java
@@ -10,14 +10,13 @@
*******************************************************************************/
package org.eclipse.ui.internal.handlers;
-import org.eclipse.ui.internal.testing.ContributionInfoMessages;
-
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.window.ToolTip;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
@@ -30,6 +29,7 @@
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.internal.testing.ContributionInfoMessages;
import org.eclipse.ui.internal.util.Util;
import org.eclipse.ui.testing.ContributionInfo;
import org.osgi.framework.Bundle;
@@ -114,10 +114,13 @@
protected Composite createToolTipContentArea(Event event, Composite parent) {
// Create the content area
Composite composite = new Composite(parent, SWT.NONE);
- composite.setBackground(parent.getDisplay().getSystemColor(
- SWT.COLOR_INFO_BACKGROUND));
+ Color fg = parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND);
+ Color bg = parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);
+ composite.setForeground(fg);
+ composite.setBackground(bg);
Text text = new Text(composite, SWT.READ_ONLY);
- text.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+ text.setForeground(fg);
+ text.setBackground(bg);
String info = NLS.bind(ContributionInfoMessages.ContributionInfo_ContributedBy,
contributionInfo.getElementType(), contributionInfo.getBundleId());
text.setText(info);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandProvider.java
index 2ab99ae..289bde5 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandProvider.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/CommandProvider.java
@@ -18,6 +18,7 @@
import org.eclipse.core.commands.ParameterizedCommand;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.e4.ui.workbench.modeling.ExpressionContext;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandService;
@@ -109,6 +110,9 @@
protected void doReset() {
idToElement = null;
+ if (currentSnapshot instanceof ExpressionContext) {
+ ((ExpressionContext) currentSnapshot).eclipseContext.dispose();
+ }
currentSnapshot = null;
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/SearchField.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/SearchField.java
index 8289490..0422176 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/SearchField.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/SearchField.java
@@ -181,6 +181,7 @@
quickAccessContents.hookFilterText(text);
shell = new Shell(parent.getShell(), SWT.RESIZE | SWT.ON_TOP);
shell.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_WHITE));
+ shell.setText(QuickAccessMessages.QuickAccess_EnterSearch); // just for debugging, not shown anywhere
shell.addShellListener(new ShellAdapter() {
@Override
public void shellClosed(ShellEvent e) {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/OperationHistoryActionHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/OperationHistoryActionHandler.java
index 131a5c1..f5614a0 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/OperationHistoryActionHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/operations/OperationHistoryActionHandler.java
@@ -11,12 +11,6 @@
package org.eclipse.ui.operations;
import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.operations.IAdvancedUndoableOperation2;
import org.eclipse.core.commands.operations.IOperationHistory;
@@ -24,13 +18,16 @@
import org.eclipse.core.commands.operations.IUndoContext;
import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.core.commands.operations.OperationHistoryEvent;
-
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.LegacyActionTools;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-
import org.eclipse.ui.IPartListener;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartSite;
@@ -45,8 +42,6 @@
import org.eclipse.ui.part.MultiPageEditorSite;
import org.eclipse.ui.statushandlers.StatusManager;
-import org.eclipse.osgi.util.NLS;
-
/**
* <p>
* OperationHistoryActionHandler implements common behavior for the undo and
@@ -79,7 +74,7 @@
public abstract class OperationHistoryActionHandler extends Action implements
ActionFactory.IWorkbenchAction, IAdaptable {
- private static final int MAX_LABEL_LENGTH = 32;
+ private static final int MAX_LABEL_LENGTH = 33;
private class PartListener implements IPartListener {
/**
@@ -440,8 +435,8 @@
if (enabled) {
tooltipText = NLS.bind(getTooltipString(), getOperation()
.getLabel());
- text = NLS.bind(getCommandString(), shortenText(getOperation()
- .getLabel()));
+ text = NLS.bind(getCommandString(),
+ LegacyActionTools.escapeMnemonics(shortenText(getOperation().getLabel()))) + '@';
} else {
tooltipText = NLS.bind(
WorkbenchMessages.Operations_undoRedoCommandDisabled,
@@ -467,10 +462,10 @@
int length = message.length();
if (length > MAX_LABEL_LENGTH) {
StringBuffer result = new StringBuffer();
- int mid = MAX_LABEL_LENGTH / 2;
- result.append(message.substring(0, mid));
+ int end = MAX_LABEL_LENGTH / 2 - 1;
+ result.append(message.substring(0, end));
result.append("..."); //$NON-NLS-1$
- result.append(message.substring(length - mid));
+ result.append(message.substring(length - end));
return result.toString();
}
return message;
diff --git a/bundles/org.eclipse.ui.workbench/LegacyIDE.e4xmi b/bundles/org.eclipse.ui.workbench/LegacyIDE.e4xmi
index 18621e3..5846851 100644
--- a/bundles/org.eclipse.ui.workbench/LegacyIDE.e4xmi
+++ b/bundles/org.eclipse.ui.workbench/LegacyIDE.e4xmi
@@ -31,4 +31,5 @@
<addons xmi:id="_XwQYkE2EEd-DfN2vYY4Lew" elementId="Cleanup Addon" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.addons.swt/org.eclipse.e4.ui.workbench.addons.cleanupaddon.CleanupAddon"/>
<addons xmi:id="_bqcWME2EEd-DfN2vYY4Lew" elementId="DnD Addon" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.addons.swt/org.eclipse.e4.ui.workbench.addons.dndaddon.DnDAddon"/>
<addons xmi:id="_7GC6sGp-Ed-QyNZjH9g15Q" elementId="MinMax Addon" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.addons.swt/org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddon"/>
+ <addons xmi:id="_00yosOXqEeGugqEu_OWUGQ" elementId="org.eclipse.ui.workbench.addon.0" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.HandlerProcessingAddon"/>
</application:Application>
diff --git a/bundles/org.eclipse.ui.workbench/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.workbench/META-INF/MANIFEST.MF
index 619a774..ab01398 100644
--- a/bundles/org.eclipse.ui.workbench/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui.workbench/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ui.workbench; singleton:=true
-Bundle-Version: 3.104.0.qualifier
+Bundle-Version: 3.105.0.qualifier
Bundle-ClassPath: e4-workbench.jar,
compatibility.jar,
.
diff --git a/bundles/org.eclipse.ui.workbench/plugin.properties b/bundles/org.eclipse.ui.workbench/plugin.properties
index c17bc30..bd8890c 100644
--- a/bundles/org.eclipse.ui.workbench/plugin.properties
+++ b/bundles/org.eclipse.ui.workbench/plugin.properties
@@ -18,4 +18,4 @@
bindingcontext.name.dialogAndWindows = In Dialog and Windows
bindingcontext.name.windows = In Windows
bindingcontext.name.bindingView = In Binding View
-bindingcontext.name.dialogAndWindows = In Dialogs
+bindingcontext.name.dialogs = In Dialogs
diff --git a/bundles/org.eclipse.ui.workbench/pom.xml b/bundles/org.eclipse.ui.workbench/pom.xml
index 5de4e5e..bf18ca4 100644
--- a/bundles/org.eclipse.ui.workbench/pom.xml
+++ b/bundles/org.eclipse.ui.workbench/pom.xml
@@ -22,6 +22,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.ui.workbench</artifactId>
- <version>3.104.0-SNAPSHOT</version>
+ <version>3.105.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui/META-INF/MANIFEST.MF
index c202548..72745dd 100644
--- a/bundles/org.eclipse.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.ui; singleton:=true
-Bundle-Version: 3.104.0.qualifier
+Bundle-Version: 3.105.0.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.ui.internal.UIPlugin
Bundle-ActivationPolicy: lazy
diff --git a/bundles/org.eclipse.ui/pom.xml b/bundles/org.eclipse.ui/pom.xml
index 0db8370..c837ff1 100644
--- a/bundles/org.eclipse.ui/pom.xml
+++ b/bundles/org.eclipse.ui/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.ui</artifactId>
- <version>3.104.0-SNAPSHOT</version>
+ <version>3.105.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/examples/org.eclipse.e4.demo.contacts/Application.e4xmi b/examples/org.eclipse.e4.demo.contacts/Application.e4xmi
index 0f9bf9d..7f703f5 100644
--- a/examples/org.eclipse.e4.demo.contacts/Application.e4xmi
+++ b/examples/org.eclipse.e4.demo.contacts/Application.e4xmi
@@ -65,4 +65,5 @@
<addons xmi:id="_LK0NgPZmEd-XstlTZ6nTXj" elementId="org.eclipse.e4.ui.workbench.commands.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon"/>
<addons xmi:id="_LK0NgPZmEd-XstlTZ6nTXk" elementId="org.eclipse.e4.ui.workbench.contexts.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon"/>
<addons xmi:id="_LK0NgPZmEd-XstlTZ6nTXl" elementId="org.eclipse.e4.ui.workbench.bindings.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon"/>
+ <addons xmi:id="_Cl0IkOXrEeGugqEu_OWUGQ" elementId="org.eclipse.e4.demo.contacts.addon.0" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.HandlerProcessingAddon"/>
</application:Application>
diff --git a/examples/org.eclipse.e4.demo.contacts/vcards/Kai Toedter.vcf b/examples/org.eclipse.e4.demo.contacts/vcards/Kai Toedter.vcf
index 0a64e4c..a3f9a3a 100644
--- a/examples/org.eclipse.e4.demo.contacts/vcards/Kai Toedter.vcf
+++ b/examples/org.eclipse.e4.demo.contacts/vcards/Kai Toedter.vcf
@@ -2,10 +2,10 @@
VERSION:2.1
N;CHARSET=UTF-8:Tödter;Kai;
FN;CHARSET=UTF-8:Kai Tödter
-ORG;CHARSET=UTF-8:Siemens AG, CT T DE IT 1
+ORG;CHARSET=UTF-8:Siemens AG, CT RCT ITP SDP-DE
TITLE:Dipl.-Inform.
NOTE:Eclipse RCP Expert
-TEL;WORK;VOICE:+49 (89) 636-45450
+TEL;WORK;VOICE:+49 (89) 636-41064
TEL;CELL;VOICE:+49 (173) 7068910
ADR;WORK;CHARSET=UTF-8:;;Otto-Hahn-Ring 6;Munich;;81739;Germany
URL;WORK:http://www.toedter.com
diff --git a/examples/org.eclipse.e4.demo.e4photo/Application.e4xmi b/examples/org.eclipse.e4.demo.e4photo/Application.e4xmi
index 64c0070..5a21410 100644
--- a/examples/org.eclipse.e4.demo.e4photo/Application.e4xmi
+++ b/examples/org.eclipse.e4.demo.e4photo/Application.e4xmi
@@ -18,7 +18,7 @@
</children>
</children>
<children xsi:type="basic:PartSashContainer" xmi:id="_hKibQEleEd-TVO58rzJVgA" elementId="_hKibQEleEd-TVO58rzJVgA" containerData="70">
- <children xsi:type="basic:Part" xmi:id="_krbvIEleEd-TVO58rzJVgA" elementId="_krbvIEleEd-TVO58rzJVgA" contributionURI="bundleclass://org.eclipse.e4.demo.e4photo/org.eclipse.e4.demo.e4photo.Preview" containerData="70" label="Preview"/>
+ <children xsi:type="basic:Part" xmi:id="_krbvIEleEd-TVO58rzJVgA" elementId="_krbvIEleEd-TVO58rzJVgA" containerData="70" contributionURI="bundleclass://org.eclipse.e4.demo.e4photo/org.eclipse.e4.demo.e4photo.Preview" label="Preview"/>
<children xsi:type="basic:PartStack" xmi:id="_sRLYgEleEd-TVO58rzJVgA" elementId="_sRLYgEleEd-TVO58rzJVgA" containerData="30">
<children xsi:type="basic:Part" xmi:id="_tuj8gEleEd-TVO58rzJVgA" elementId="ThumbnailsView" contributionURI="bundleclass://org.eclipse.e4.demo.e4photo/org.eclipse.e4.demo.e4photo.Thumbnails" label="Thumbnails"/>
<children xsi:type="basic:Part" xmi:id="_xPeegEleEd-TVO58rzJVgA" elementId="ExifView" contributionURI="bundleclass://org.eclipse.e4.demo.e4photo/org.eclipse.e4.demo.e4photo.ExifTable" label="Exif"/>
@@ -51,8 +51,8 @@
<handlers xmi:id="_RrwmEEjPEd-XR9_8rlW1bQ" elementId="_RrwmEEjPEd-XR9_8rlW1bQ" contributionURI="bundleclass://org.eclipse.e4.demo.e4photo/org.eclipse.e4.demo.e4photo.ImageDialogHandler" command="_6B0q4EjPEd-XR9_8rlW1bQ"/>
<handlers xmi:id="_bH-CkUljEd-YPslvXqnLdg" elementId="_bH-CkUljEd-YPslvXqnLdg" contributionURI="bundleclass://org.eclipse.e4.demo.e4photo/org.eclipse.e4.demo.e4photo.AddNoteHandler" command="_9w2hYEjPEd-XR9_8rlW1bQ"/>
<bindingTables xmi:id="_ofif4EjPEd-XR9_8rlW1bQ" elementId="_ofif4EjPEd-XR9_8rlW1bQ" bindingContext="_Y_0CgEjPEd-XR9_8rlW1bQ">
- <bindings xmi:id="_rCRiYEjPEd-XR9_8rlW1bQ" keySequence="CTRL+Q" elementId="_rCRiYEjPEd-XR9_8rlW1bQ" command="_vBr-QEjPEd-XR9_8rlW1bQ"/>
- <bindings xmi:id="_tDFjkEjPEd-XR9_8rlW1bQ" keySequence="CTRL+N" elementId="_tDFjkEjPEd-XR9_8rlW1bQ" command="_zQSFoEjPEd-XR9_8rlW1bQ"/>
+ <bindings xmi:id="_rCRiYEjPEd-XR9_8rlW1bQ" elementId="_rCRiYEjPEd-XR9_8rlW1bQ" keySequence="CTRL+Q" command="_vBr-QEjPEd-XR9_8rlW1bQ"/>
+ <bindings xmi:id="_tDFjkEjPEd-XR9_8rlW1bQ" elementId="_tDFjkEjPEd-XR9_8rlW1bQ" keySequence="CTRL+N" command="_zQSFoEjPEd-XR9_8rlW1bQ"/>
</bindingTables>
<rootContext xmi:id="_Y_0CgEjPEd-XR9_8rlW1bQ" elementId="org.eclipse.ui.contexts.dialogAndWindow" name="In Dialog and Windows" description="">
<children xmi:id="_gCmv0EjPEd-XR9_8rlW1bQ" elementId="org.eclipse.ui.contexts.window" name="In Windows" description=""/>
@@ -71,4 +71,5 @@
<addons xmi:id="_LK0NgPZmEd-XstlTZ6nTXj" elementId="org.eclipse.e4.ui.workbench.commands.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon"/>
<addons xmi:id="_LK0NgPZmEd-XstlTZ6nTXk" elementId="org.eclipse.e4.ui.workbench.contexts.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon"/>
<addons xmi:id="_LK0NgPZmEd-XstlTZ6nTXl" elementId="org.eclipse.e4.ui.workbench.bindings.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon"/>
+ <addons xmi:id="__YcNoOXqEeGugqEu_OWUGQ" elementId="org.eclipse.e4.demo.e4photo.addon.0" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.HandlerProcessingAddon"/>
</application:Application>
diff --git a/examples/org.eclipse.jface.snippets/Eclipse JFace Snippets/org/eclipse/jface/snippets/viewers/Snippet010OwnerDraw.java b/examples/org.eclipse.jface.snippets/Eclipse JFace Snippets/org/eclipse/jface/snippets/viewers/Snippet010OwnerDraw.java
index 05db09f..0281215 100644
--- a/examples/org.eclipse.jface.snippets/Eclipse JFace Snippets/org/eclipse/jface/snippets/viewers/Snippet010OwnerDraw.java
+++ b/examples/org.eclipse.jface.snippets/Eclipse JFace Snippets/org/eclipse/jface/snippets/viewers/Snippet010OwnerDraw.java
@@ -8,12 +8,13 @@
* Contributors:
* IBM Corporation - initial API and implementation
* oliver.schaefer@mbtech-services.com - Fix for Bug 225051 [Snippets] Snippet010OwnerDraw - Wrong german flag
+ * Lars Vogel <lars.vogel@gmail.com >- Fix for Bug 387367 - JFace Snippet Snippet010OwnerDraw rework
*******************************************************************************/
package org.eclipse.jface.snippets.viewers;
import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.OwnerDrawLabelProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableLayout;
@@ -319,47 +320,15 @@
*/
public void createPartControl(Composite parent) {
viewer = new TableViewer(parent, SWT.FULL_SELECTION);
-
- viewer.setContentProvider(new IStructuredContentProvider() {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- };
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
- return entries;
- };
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
- * java.lang.Object, java.lang.Object)
- */
- public void inputChanged(org.eclipse.jface.viewers.Viewer viewer,
- Object oldInput, Object newInput) {
- }
-
- });
+ viewer.setContentProvider(ArrayContentProvider.getInstance());
+
createColumns();
viewer.setLabelProvider(new OwnerDrawLabelProvider() {
-
-
protected void measure(Event event, Object element) {
CountryEntry country = (CountryEntry) element;
-
event.setBounds(new Rectangle(event.x, event.y, country.getWidth(event),
country.getHeight(event)));
-
}
/*
@@ -375,12 +344,11 @@
}
});
- OwnerDrawLabelProvider.setUpOwnerDraw(viewer);
- viewer.setInput(this);
GridData data = new GridData(GridData.GRAB_HORIZONTAL
| GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
viewer.getControl().setLayoutData(data);
+ viewer.setInput(entries);
viewer.setSelection(new StructuredSelection(entries[1]));
}
@@ -399,7 +367,6 @@
layout.addColumnData(new ColumnPixelData(100));
tc.setText(getTitleFor(i));
}
- ;
}
/**
@@ -417,9 +384,4 @@
}
return "Unknown";
}
-
- public void setFocus() {
-
- }
-
}
diff --git a/examples/org.eclipse.ui.forms.examples/plugin.xml b/examples/org.eclipse.ui.forms.examples/plugin.xml
index df18dd9..4770827 100644
--- a/examples/org.eclipse.ui.forms.examples/plugin.xml
+++ b/examples/org.eclipse.ui.forms.examples/plugin.xml
Binary files differ
diff --git a/examples/org.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/index.xml b/examples/org.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/index.xml
index 3be639b..6dc71af 100644
--- a/examples/org.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/index.xml
+++ b/examples/org.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/index.xml
Binary files differ
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part1/.classpath b/examples/org.eclipse.ui.tutorials.rcp.part1/.classpath
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part1/.classpath
rename to examples/org.eclipse.ui.tutorials.rcp.part1/.classpath
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part1/.cvsignore b/examples/org.eclipse.ui.tutorials.rcp.part1/.cvsignore
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part1/.cvsignore
rename to examples/org.eclipse.ui.tutorials.rcp.part1/.cvsignore
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part1/.project b/examples/org.eclipse.ui.tutorials.rcp.part1/.project
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part1/.project
rename to examples/org.eclipse.ui.tutorials.rcp.part1/.project
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part1/.settings/org.eclipse.core.runtime.prefs b/examples/org.eclipse.ui.tutorials.rcp.part1/.settings/org.eclipse.core.runtime.prefs
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part1/.settings/org.eclipse.core.runtime.prefs
rename to examples/org.eclipse.ui.tutorials.rcp.part1/.settings/org.eclipse.core.runtime.prefs
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part1/META-INF/MANIFEST.MF b/examples/org.eclipse.ui.tutorials.rcp.part1/META-INF/MANIFEST.MF
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part1/META-INF/MANIFEST.MF
rename to examples/org.eclipse.ui.tutorials.rcp.part1/META-INF/MANIFEST.MF
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part1/build.properties b/examples/org.eclipse.ui.tutorials.rcp.part1/build.properties
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part1/build.properties
rename to examples/org.eclipse.ui.tutorials.rcp.part1/build.properties
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part1/part1.product b/examples/org.eclipse.ui.tutorials.rcp.part1/part1.product
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part1/part1.product
rename to examples/org.eclipse.ui.tutorials.rcp.part1/part1.product
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part1/plugin.xml b/examples/org.eclipse.ui.tutorials.rcp.part1/plugin.xml
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part1/plugin.xml
rename to examples/org.eclipse.ui.tutorials.rcp.part1/plugin.xml
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part1/pom.xml b/examples/org.eclipse.ui.tutorials.rcp.part1/pom.xml
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part1/pom.xml
rename to examples/org.eclipse.ui.tutorials.rcp.part1/pom.xml
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/Application.java b/examples/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/Application.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/Application.java
rename to examples/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/Application.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/ApplicationActionBarAdvisor.java b/examples/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/ApplicationActionBarAdvisor.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/ApplicationActionBarAdvisor.java
rename to examples/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/ApplicationActionBarAdvisor.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/ApplicationWorkbenchAdvisor.java b/examples/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/ApplicationWorkbenchAdvisor.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/ApplicationWorkbenchAdvisor.java
rename to examples/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/ApplicationWorkbenchAdvisor.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/ApplicationWorkbenchWindowAdvisor.java b/examples/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/ApplicationWorkbenchWindowAdvisor.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/ApplicationWorkbenchWindowAdvisor.java
rename to examples/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/ApplicationWorkbenchWindowAdvisor.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/Part1Plugin.java b/examples/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/Part1Plugin.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/Part1Plugin.java
rename to examples/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/Part1Plugin.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/Perspective.java b/examples/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/Perspective.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/Perspective.java
rename to examples/org.eclipse.ui.tutorials.rcp.part1/src/org/eclipse/ui/tutorials/rcp/part1/Perspective.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part2/.classpath b/examples/org.eclipse.ui.tutorials.rcp.part2/.classpath
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part2/.classpath
rename to examples/org.eclipse.ui.tutorials.rcp.part2/.classpath
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part2/.cvsignore b/examples/org.eclipse.ui.tutorials.rcp.part2/.cvsignore
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part2/.cvsignore
rename to examples/org.eclipse.ui.tutorials.rcp.part2/.cvsignore
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part2/.project b/examples/org.eclipse.ui.tutorials.rcp.part2/.project
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part2/.project
rename to examples/org.eclipse.ui.tutorials.rcp.part2/.project
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part2/.settings/org.eclipse.core.runtime.prefs b/examples/org.eclipse.ui.tutorials.rcp.part2/.settings/org.eclipse.core.runtime.prefs
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part2/.settings/org.eclipse.core.runtime.prefs
rename to examples/org.eclipse.ui.tutorials.rcp.part2/.settings/org.eclipse.core.runtime.prefs
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part2/META-INF/MANIFEST.MF b/examples/org.eclipse.ui.tutorials.rcp.part2/META-INF/MANIFEST.MF
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part2/META-INF/MANIFEST.MF
rename to examples/org.eclipse.ui.tutorials.rcp.part2/META-INF/MANIFEST.MF
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part2/build.properties b/examples/org.eclipse.ui.tutorials.rcp.part2/build.properties
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part2/build.properties
rename to examples/org.eclipse.ui.tutorials.rcp.part2/build.properties
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part2/part2.product b/examples/org.eclipse.ui.tutorials.rcp.part2/part2.product
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part2/part2.product
rename to examples/org.eclipse.ui.tutorials.rcp.part2/part2.product
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part2/plugin.xml b/examples/org.eclipse.ui.tutorials.rcp.part2/plugin.xml
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part2/plugin.xml
rename to examples/org.eclipse.ui.tutorials.rcp.part2/plugin.xml
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part2/pom.xml b/examples/org.eclipse.ui.tutorials.rcp.part2/pom.xml
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part2/pom.xml
rename to examples/org.eclipse.ui.tutorials.rcp.part2/pom.xml
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/Application.java b/examples/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/Application.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/Application.java
rename to examples/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/Application.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/ApplicationActionBarAdvisor.java b/examples/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/ApplicationActionBarAdvisor.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/ApplicationActionBarAdvisor.java
rename to examples/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/ApplicationActionBarAdvisor.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/ApplicationWorkbenchAdvisor.java b/examples/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/ApplicationWorkbenchAdvisor.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/ApplicationWorkbenchAdvisor.java
rename to examples/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/ApplicationWorkbenchAdvisor.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/ApplicationWorkbenchWindowAdvisor.java b/examples/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/ApplicationWorkbenchWindowAdvisor.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/ApplicationWorkbenchWindowAdvisor.java
rename to examples/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/ApplicationWorkbenchWindowAdvisor.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/Part2Plugin.java b/examples/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/Part2Plugin.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/Part2Plugin.java
rename to examples/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/Part2Plugin.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/Perspective.java b/examples/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/Perspective.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/Perspective.java
rename to examples/org.eclipse.ui.tutorials.rcp.part2/src/org/eclipse/ui/tutorials/rcp/part2/Perspective.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/.classpath b/examples/org.eclipse.ui.tutorials.rcp.part3/.classpath
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/.classpath
rename to examples/org.eclipse.ui.tutorials.rcp.part3/.classpath
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/.cvsignore b/examples/org.eclipse.ui.tutorials.rcp.part3/.cvsignore
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/.cvsignore
rename to examples/org.eclipse.ui.tutorials.rcp.part3/.cvsignore
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/.project b/examples/org.eclipse.ui.tutorials.rcp.part3/.project
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/.project
rename to examples/org.eclipse.ui.tutorials.rcp.part3/.project
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/.settings/org.eclipse.core.runtime.prefs b/examples/org.eclipse.ui.tutorials.rcp.part3/.settings/org.eclipse.core.runtime.prefs
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/.settings/org.eclipse.core.runtime.prefs
rename to examples/org.eclipse.ui.tutorials.rcp.part3/.settings/org.eclipse.core.runtime.prefs
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/META-INF/MANIFEST.MF b/examples/org.eclipse.ui.tutorials.rcp.part3/META-INF/MANIFEST.MF
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/META-INF/MANIFEST.MF
rename to examples/org.eclipse.ui.tutorials.rcp.part3/META-INF/MANIFEST.MF
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/build.properties b/examples/org.eclipse.ui.tutorials.rcp.part3/build.properties
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/build.properties
rename to examples/org.eclipse.ui.tutorials.rcp.part3/build.properties
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/icons/sample.gif b/examples/org.eclipse.ui.tutorials.rcp.part3/icons/sample.gif
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/icons/sample.gif
rename to examples/org.eclipse.ui.tutorials.rcp.part3/icons/sample.gif
Binary files differ
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/icons/sample.icns b/examples/org.eclipse.ui.tutorials.rcp.part3/icons/sample.icns
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/icons/sample.icns
rename to examples/org.eclipse.ui.tutorials.rcp.part3/icons/sample.icns
Binary files differ
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/icons/sample2.gif b/examples/org.eclipse.ui.tutorials.rcp.part3/icons/sample2.gif
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/icons/sample2.gif
rename to examples/org.eclipse.ui.tutorials.rcp.part3/icons/sample2.gif
Binary files differ
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/icons/sample3.gif b/examples/org.eclipse.ui.tutorials.rcp.part3/icons/sample3.gif
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/icons/sample3.gif
rename to examples/org.eclipse.ui.tutorials.rcp.part3/icons/sample3.gif
Binary files differ
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/part3.product b/examples/org.eclipse.ui.tutorials.rcp.part3/part3.product
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/part3.product
rename to examples/org.eclipse.ui.tutorials.rcp.part3/part3.product
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/plugin.properties b/examples/org.eclipse.ui.tutorials.rcp.part3/plugin.properties
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/plugin.properties
rename to examples/org.eclipse.ui.tutorials.rcp.part3/plugin.properties
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/plugin.xml b/examples/org.eclipse.ui.tutorials.rcp.part3/plugin.xml
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/plugin.xml
rename to examples/org.eclipse.ui.tutorials.rcp.part3/plugin.xml
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/pom.xml b/examples/org.eclipse.ui.tutorials.rcp.part3/pom.xml
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/pom.xml
rename to examples/org.eclipse.ui.tutorials.rcp.part3/pom.xml
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/product_lg.gif b/examples/org.eclipse.ui.tutorials.rcp.part3/product_lg.gif
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/product_lg.gif
rename to examples/org.eclipse.ui.tutorials.rcp.part3/product_lg.gif
Binary files differ
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/splash.bmp b/examples/org.eclipse.ui.tutorials.rcp.part3/splash.bmp
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/splash.bmp
rename to examples/org.eclipse.ui.tutorials.rcp.part3/splash.bmp
Binary files differ
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/Application.java b/examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/Application.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/Application.java
rename to examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/Application.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/ApplicationActionBarAdvisor.java b/examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/ApplicationActionBarAdvisor.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/ApplicationActionBarAdvisor.java
rename to examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/ApplicationActionBarAdvisor.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/ApplicationWorkbenchAdvisor.java b/examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/ApplicationWorkbenchAdvisor.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/ApplicationWorkbenchAdvisor.java
rename to examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/ApplicationWorkbenchAdvisor.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/ApplicationWorkbenchWindowAdvisor.java b/examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/ApplicationWorkbenchWindowAdvisor.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/ApplicationWorkbenchWindowAdvisor.java
rename to examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/ApplicationWorkbenchWindowAdvisor.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/ICommandIds.java b/examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/ICommandIds.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/ICommandIds.java
rename to examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/ICommandIds.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/MessagePopupAction.java b/examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/MessagePopupAction.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/MessagePopupAction.java
rename to examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/MessagePopupAction.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/NavigationView.java b/examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/NavigationView.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/NavigationView.java
rename to examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/NavigationView.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/OpenViewAction.java b/examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/OpenViewAction.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/OpenViewAction.java
rename to examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/OpenViewAction.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/Part3Plugin.java b/examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/Part3Plugin.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/Part3Plugin.java
rename to examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/Part3Plugin.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/Perspective.java b/examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/Perspective.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/Perspective.java
rename to examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/Perspective.java
diff --git a/bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/View.java b/examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/View.java
similarity index 100%
rename from bundles/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/View.java
rename to examples/org.eclipse.ui.tutorials.rcp.part3/src/org/eclipse/ui/tutorials/rcp/part3/View.java
diff --git a/features/org.eclipse.e4.rcp/feature.xml b/features/org.eclipse.e4.rcp/feature.xml
index ccac72a..0bbf327 100644
--- a/features/org.eclipse.e4.rcp/feature.xml
+++ b/features/org.eclipse.e4.rcp/feature.xml
@@ -141,7 +141,7 @@
id="javax.annotation"
download-size="0"
install-size="0"
- version="1.0.0.qualifier"
+ version="0.0.0"
unpack="false"/>
<plugin
@@ -681,10 +681,10 @@
unpack="false"/>
<plugin
- id="org.eclipse.swt.gtk.hpux.ia64_32"
+ id="org.eclipse.swt.gtk.hpux.ia64"
os="hpux"
ws="gtk"
- arch="ia64_32"
+ arch="ia64"
download-size="0"
install-size="0"
version="0.0.0"
diff --git a/features/org.eclipse.e4.rcp/pom.xml b/features/org.eclipse.e4.rcp/pom.xml
index dfa9961..f7aee1e 100644
--- a/features/org.eclipse.e4.rcp/pom.xml
+++ b/features/org.eclipse.e4.rcp/pom.xml
@@ -73,7 +73,7 @@
<plugin id="org.eclipse.swt.cocoa.macosx" />
<plugin id="org.eclipse.swt.gtk.aix.ppc" />
<plugin id="org.eclipse.swt.gtk.aix.ppc64" />
- <plugin id="org.eclipse.swt.gtk.hpux.ia64_32" />
+ <plugin id="org.eclipse.swt.gtk.hpux.ia64" />
<plugin id="org.w3c.css.sac" />
<plugin id="org.w3c.dom.smil" />
<plugin id="org.w3c.dom.svg" />
diff --git a/pom.xml b/pom.xml
index 7b9cb89..442644d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -118,9 +118,9 @@
<module>bundles/org.eclipse.ui.views.properties.tabbed</module>
<module>bundles/org.eclipse.ui.workbench</module>
<module>bundles/org.eclipse.ui.navigator</module>
- <module>bundles/org.eclipse.ui.tutorials.rcp.part1</module>
- <module>bundles/org.eclipse.ui.tutorials.rcp.part2</module>
- <module>bundles/org.eclipse.ui.tutorials.rcp.part3</module>
+ <module>examples/org.eclipse.ui.tutorials.rcp.part1</module>
+ <module>examples/org.eclipse.ui.tutorials.rcp.part2</module>
+ <module>examples/org.eclipse.ui.tutorials.rcp.part3</module>
<module>features/org.eclipse.e4.rcp</module>
<module>bundles/org.eclipse.ui.ide</module>
<module>bundles/org.eclipse.ui.ide.application</module>
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/Bug320857Test.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/Bug320857Test.java
index 4ee42fb..2de83c8 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/Bug320857Test.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/Bug320857Test.java
@@ -18,7 +18,6 @@
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.services.contributions.IContributionFactory;
-import org.eclipse.e4.ui.internal.workbench.E4Workbench;
import org.eclipse.e4.ui.internal.workbench.UIEventPublisher;
import org.eclipse.e4.ui.internal.workbench.swt.E4Application;
import org.eclipse.e4.ui.model.application.MApplication;
@@ -56,7 +55,6 @@
MApplication application) {
applicationContext.set(MApplication.class.getName(), application);
application.setContext(applicationContext);
- E4Workbench.processHierarchy(application);
((Notifier) application).eAdapters().add(
new UIEventPublisher(applicationContext));
}
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java
index 1089b7a..3ea6f3d 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java
@@ -19,7 +19,6 @@
import org.eclipse.core.runtime.AssertionFailedException;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.di.Focus;
-import org.eclipse.e4.ui.internal.workbench.E4Workbench;
import org.eclipse.e4.ui.internal.workbench.UIEventPublisher;
import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor;
import org.eclipse.e4.ui.model.application.ui.MElementContainer;
@@ -10155,7 +10154,6 @@
}
private void initialize() {
- E4Workbench.processHierarchy(application);
((Notifier) application).eAdapters().add(
new UIEventPublisher(applicationContext));
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ESelectionServiceTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ESelectionServiceTest.java
index 7f9896a..9bb2e2e 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ESelectionServiceTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/ESelectionServiceTest.java
@@ -22,7 +22,6 @@
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.di.UISynchronize;
-import org.eclipse.e4.ui.internal.workbench.E4Workbench;
import org.eclipse.e4.ui.internal.workbench.UIEventPublisher;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
@@ -1108,7 +1107,6 @@
}
});
application.setContext(applicationContext);
- E4Workbench.processHierarchy(application);
((Notifier) application).eAdapters().add(
new UIEventPublisher(applicationContext));
}
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/HeadlessApplicationTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/HeadlessApplicationTest.java
index 848d326..0a91222 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/HeadlessApplicationTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/HeadlessApplicationTest.java
@@ -298,8 +298,6 @@
E4Workbench.initializeContext(appContext, window);
}
- E4Workbench.processHierarchy(application);
-
processPartContributions(application.getContext(), resource);
renderer = createPresentationEngine(getEngineURI());
diff --git a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/MMenuItemTest.java b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/MMenuItemTest.java
index b71e9d3..a2cb4ab 100644
--- a/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/MMenuItemTest.java
+++ b/tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/MMenuItemTest.java
@@ -19,6 +19,7 @@
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.bindings.BindingServiceAddon;
import org.eclipse.e4.ui.internal.workbench.E4Workbench;
+import org.eclipse.e4.ui.internal.workbench.addons.HandlerProcessingAddon;
import org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer;
import org.eclipse.e4.ui.internal.workbench.swt.E4Application;
import org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine;
@@ -736,6 +737,9 @@
application.getChildren().add(window);
application.setContext(appContext);
appContext.set(MApplication.class.getName(), application);
+ // The handler processing addon cannot run until the context
+ // contains the MApplication
+ ContextInjectionFactory.make(HandlerProcessingAddon.class, appContext);
wb = new E4Workbench(window, appContext);
wb.createAndRunUI(window);
diff --git a/tests/org.eclipse.ui.tests.forms/test.xml b/tests/org.eclipse.ui.tests.forms/test.xml
index 0e5ea9e..0e00b35 100644
--- a/tests/org.eclipse.ui.tests.forms/test.xml
+++ b/tests/org.eclipse.ui.tests.forms/test.xml
Binary files differ
diff --git a/tests/org.eclipse.ui.tests.views.properties.tabbed/icons/error_tsk.gif b/tests/org.eclipse.ui.tests.views.properties.tabbed/icons/error_tsk.gif
new file mode 100644
index 0000000..9b048d6
--- /dev/null
+++ b/tests/org.eclipse.ui.tests.views.properties.tabbed/icons/error_tsk.gif
Binary files differ
diff --git a/tests/org.eclipse.ui.tests.views.properties.tabbed/icons/info_tsk.gif b/tests/org.eclipse.ui.tests.views.properties.tabbed/icons/info_tsk.gif
new file mode 100644
index 0000000..2da001e
--- /dev/null
+++ b/tests/org.eclipse.ui.tests.views.properties.tabbed/icons/info_tsk.gif
Binary files differ
diff --git a/tests/org.eclipse.ui.tests.views.properties.tabbed/icons/warn_tsk.gif b/tests/org.eclipse.ui.tests.views.properties.tabbed/icons/warn_tsk.gif
new file mode 100644
index 0000000..14009e9
--- /dev/null
+++ b/tests/org.eclipse.ui.tests.views.properties.tabbed/icons/warn_tsk.gif
Binary files differ
diff --git a/tests/org.eclipse.ui.tests.views.properties.tabbed/plugin.properties b/tests/org.eclipse.ui.tests.views.properties.tabbed/plugin.properties
index fe51e2a..585d6e8 100644
--- a/tests/org.eclipse.ui.tests.views.properties.tabbed/plugin.properties
+++ b/tests/org.eclipse.ui.tests.views.properties.tabbed/plugin.properties
@@ -13,6 +13,7 @@
Views.category.name = Tabbed Properties View
Views.example.name = Tabbed Properties Tests View
+Views.decoration.name = Tabbed Properties Decoration Tests View
Views.dynamic.name = Tabbed Properties Dynamic Tests View
Views.text.name = Tabbed Properties Text Tests View
Views.override.name = Tabbed Properties Override Tests View
diff --git a/tests/org.eclipse.ui.tests.views.properties.tabbed/plugin.xml b/tests/org.eclipse.ui.tests.views.properties.tabbed/plugin.xml
index 5e6a97e..bda4408 100644
--- a/tests/org.eclipse.ui.tests.views.properties.tabbed/plugin.xml
+++ b/tests/org.eclipse.ui.tests.views.properties.tabbed/plugin.xml
@@ -35,6 +35,13 @@
class="org.eclipse.ui.tests.views.properties.tabbed.override.OverrideTestsView"
id="org.eclipse.ui.tests.views.properties.tabbed.override.OverrideTestsView">
</view>
+ <view
+ category="org.eclipse.ui.views.properties.tabbed"
+ class="org.eclipse.ui.tests.views.properties.tabbed.decorations.views.DecorationTestsView"
+ icon="icons/sample.gif"
+ id="org.eclipse.ui.tests.views.properties.tabbed.decorations.views.DecorationTestsView"
+ name="%Views.decoration.name">
+ </view>
</extension>
<extension
point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
@@ -74,16 +81,19 @@
afterTab="propertyTab4"
category="first"
id="propertyTab5"
+ image="icons/info_tsk.gif"
label="Information"/>
<propertyTab
afterTab="propertyTab5"
category="first"
id="propertyTab6"
+ image="icons/warn_tsk.gif"
label="Warning"/>
<propertyTab
afterTab="propertyTab6"
category="first"
id="propertyTab7"
+ image="icons/error_tsk.gif"
label="Error"/>
<propertyTab
category="second"
diff --git a/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/AllTests.java b/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/AllTests.java
index f796d69..c9ae90d 100644
--- a/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/AllTests.java
+++ b/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/AllTests.java
@@ -28,6 +28,7 @@
suite.addTestSuite(TabbedPropertySheetPageDynamicTest.class);
suite.addTestSuite(TabbedPropertySheetPageTextTest.class);
suite.addTestSuite(TabbedPropertySheetPageOverrideTest.class);
+ suite.addTestSuite(TabbedPropertySheetPageDecorationsTest.class);
return suite;
}
diff --git a/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageDecorationsTest.java b/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageDecorationsTest.java
new file mode 100644
index 0000000..7bbf2b8
--- /dev/null
+++ b/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageDecorationsTest.java
@@ -0,0 +1,231 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ * 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.tests.views.properties.tabbed;
+
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyComposite;
+import org.eclipse.ui.tests.views.properties.tabbed.decorations.TabbedPropertySheetPageWithDecorations;
+import org.eclipse.ui.tests.views.properties.tabbed.decorations.views.DecorationTestsView;
+import org.eclipse.ui.tests.views.properties.tabbed.views.TestsPerspective;
+import org.eclipse.ui.tests.views.properties.tabbed.views.TestsViewContentProvider;
+import org.eclipse.ui.views.properties.tabbed.ITabDescriptor;
+
+import junit.framework.TestCase;
+
+public class TabbedPropertySheetPageDecorationsTest extends TestCase {
+
+ private DecorationTestsView decorationTestsView;
+
+ private TreeNode[] treeNodes;
+
+ protected void setUp()
+ throws Exception {
+ super.setUp();
+
+ /**
+ * Close the existing perspectives.
+ */
+ IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow();
+ assertNotNull(workbenchWindow);
+ IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
+ assertNotNull(workbenchPage);
+ workbenchPage.closeAllPerspectives(false, false);
+
+ /**
+ * Open the tests perspective.
+ */
+ PlatformUI.getWorkbench().showPerspective(
+ TestsPerspective.TESTS_PERSPECTIVE_ID, workbenchWindow);
+
+ /**
+ * Select the Decoration Tests view.
+ */
+ IViewPart view = workbenchPage.showView(DecorationTestsView.DECORATION_TESTS_VIEW_ID);
+ assertNotNull(view);
+ assertTrue(view instanceof DecorationTestsView);
+ decorationTestsView = (DecorationTestsView) view;
+
+ /**
+ * get the list of tree nodes from the view.
+ */
+ IContentProvider contentProvider = decorationTestsView.getViewer()
+ .getContentProvider();
+ assertTrue(contentProvider instanceof TestsViewContentProvider);
+ TestsViewContentProvider viewContentProvider = (TestsViewContentProvider) contentProvider;
+ treeNodes = viewContentProvider.getInvisibleRoot().getChildren();
+ assertEquals(treeNodes.length, 8);
+ }
+
+ protected void tearDown()
+ throws Exception {
+ super.tearDown();
+
+ /**
+ * Bug 175070: Make sure the views have finished painting.
+ */
+ while (Display.getCurrent().readAndDispatch()) {
+ //
+ }
+
+ /**
+ * Deselect everything in the Tests view.
+ */
+ setSelection(new TreeNode[] {} );
+ }
+
+ /**
+ * Set the selection in the view to cause the properties view to change.
+ *
+ * @param selectedNodes
+ * nodes to select in the view.
+ */
+ private void setSelection(TreeNode[] selectedNodes) {
+ StructuredSelection selection = new StructuredSelection(selectedNodes);
+ decorationTestsView.getViewer().setSelection(selection, true);
+ }
+
+ /**
+ * When Information node is selected, the Information tab is widest if decorations are not used.
+ */
+ public void test_widestLabelIndex1_WithoutDecorations() {
+ ((TabbedPropertySheetPageWithDecorations)decorationTestsView.getTabbedPropertySheetPage()).useDecorations(false);
+ /**
+ * select Information node
+ */
+ setSelection(new TreeNode[] {treeNodes[0]});
+ ITabDescriptor[] tabDescriptors = decorationTestsView.getTabbedPropertySheetPage().getActiveTabs();
+
+ /**
+ * First tab is Name
+ */
+ assertEquals("Name", tabDescriptors[0].getLabel());//$NON-NLS-1$
+ /**
+ * Second tab is Information
+ */
+ assertEquals("Information", tabDescriptors[1].getLabel());//$NON-NLS-1$
+ /**
+ * Third tab is Message
+ */
+ assertEquals("Message", tabDescriptors[2].getLabel());//$NON-NLS-1$
+ /**
+ * No fourth tab
+ */
+ assertEquals(3, tabDescriptors.length);
+
+ /**
+ * Information tab is widest
+ */
+ assertEquals(1, ((TabbedPropertyComposite) decorationTestsView.getTabbedPropertySheetPage().getControl()).getList().getWidestLabelIndex());
+ }
+
+ /**
+ * When Information node is selected, the Name tab is widest if decorations are used.
+ */
+ public void test_widestLabelIndex1_WithDecorations() {
+ ((TabbedPropertySheetPageWithDecorations)decorationTestsView.getTabbedPropertySheetPage()).useDecorations(true);
+ /**
+ * select Information node
+ */
+ setSelection(new TreeNode[] {treeNodes[0]});
+ ITabDescriptor[] tabDescriptors = decorationTestsView.getTabbedPropertySheetPage().getActiveTabs();
+
+ /**
+ * First tab is Name
+ */
+ assertEquals("Name", tabDescriptors[0].getLabel());//$NON-NLS-1$
+ /**
+ * Second tab is Information
+ */
+ assertEquals("Information", tabDescriptors[1].getLabel());//$NON-NLS-1$
+ /**
+ * Third tab is Message
+ */
+ assertEquals("Message", tabDescriptors[2].getLabel());//$NON-NLS-1$
+ /**
+ * No fourth tab
+ */
+ assertEquals(3, tabDescriptors.length);
+
+ /**
+ * Name tab is widest
+ */
+ assertEquals(0, ((TabbedPropertyComposite) decorationTestsView.getTabbedPropertySheetPage().getControl()).getList().getWidestLabelIndex());
+ }
+
+ /**
+ * When Two Information nodes are selected, the Information tab is widest if decorations are not used.
+ */
+ public void test_widestLabelIndex2_WithoutDecorations() {
+ ((TabbedPropertySheetPageWithDecorations)decorationTestsView.getTabbedPropertySheetPage()).useDecorations(false);
+ /**
+ * select nodes
+ */
+ setSelection(new TreeNode[] {treeNodes[0], treeNodes[1]});
+ ITabDescriptor[] tabDescriptors = decorationTestsView.getTabbedPropertySheetPage().getActiveTabs();
+
+ /**
+ * First tab is Information
+ */
+ assertEquals("Information", tabDescriptors[0].getLabel());//$NON-NLS-1$
+ /**
+ * Second tab is Message
+ */
+ assertEquals("Message", tabDescriptors[1].getLabel());//$NON-NLS-1$
+ /**
+ * No other tab
+ */
+ assertEquals(2, tabDescriptors.length);
+
+ /**
+ * Information tab is widest
+ */
+ assertEquals(0, ((TabbedPropertyComposite) decorationTestsView.getTabbedPropertySheetPage().getControl()).getList().getWidestLabelIndex());
+ }
+
+ /**
+ * When Two Information nodes are selected, the Message tab is widest if decorations are used.
+ */
+ public void test_widestLabelIndex2_WithDecorations() {
+ ((TabbedPropertySheetPageWithDecorations)decorationTestsView.getTabbedPropertySheetPage()).useDecorations(true);
+ /**
+ * select nodes
+ */
+ setSelection(new TreeNode[] {treeNodes[0], treeNodes[1]});
+ ITabDescriptor[] tabDescriptors = decorationTestsView.getTabbedPropertySheetPage().getActiveTabs();
+
+ /**
+ * First tab is Information
+ */
+ assertEquals("Information", tabDescriptors[0].getLabel());//$NON-NLS-1$
+ /**
+ * Second tab is Message
+ */
+ assertEquals("Message", tabDescriptors[1].getLabel());//$NON-NLS-1$
+ /**
+ * No other tab
+ */
+ assertEquals(2, tabDescriptors.length);
+
+ /**
+ * Message tab is widest
+ */
+ assertEquals(1, ((TabbedPropertyComposite) decorationTestsView.getTabbedPropertySheetPage().getControl()).getList().getWidestLabelIndex());
+ }
+}
diff --git a/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageTest.java b/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageTest.java
index 56b8b8e..3f5f2d2 100644
--- a/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageTest.java
+++ b/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/TabbedPropertySheetPageTest.java
@@ -20,6 +20,7 @@
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyComposite;
import org.eclipse.ui.tests.views.properties.tabbed.sections.InformationTwoSection;
import org.eclipse.ui.tests.views.properties.tabbed.sections.NameSection;
import org.eclipse.ui.tests.views.properties.tabbed.views.TestsPerspective;
@@ -201,6 +202,105 @@
}
/**
+ * When Information node is selected, the Information tab is widest.
+ */
+ public void test_widestLabelIndex1() {
+ /**
+ * select Information node
+ */
+ setSelection(new TreeNode[] {treeNodes[0]});
+ ITabDescriptor[] tabDescriptors = testsView.getTabbedPropertySheetPage().getActiveTabs();
+
+ /**
+ * First tab is Name
+ */
+ assertEquals("Name", tabDescriptors[0].getLabel());//$NON-NLS-1$
+ /**
+ * Second tab is Information
+ */
+ assertEquals("Information", tabDescriptors[1].getLabel());//$NON-NLS-1$
+ /**
+ * Third tab is Message
+ */
+ assertEquals("Message", tabDescriptors[2].getLabel());//$NON-NLS-1$
+ /**
+ * No fourth tab
+ */
+ assertEquals(3, tabDescriptors.length);
+
+ /**
+ * Information tab is widest
+ */
+ assertEquals(1, ((TabbedPropertyComposite) testsView.getTabbedPropertySheetPage().getControl()).getList().getWidestLabelIndex());
+ }
+
+ /**
+ * When Error node is selected, the Message tab is widest.
+ */
+ public void test_widestLabelIndex2() {
+ /**
+ * select Error node
+ */
+ setSelection(new TreeNode[] {treeNodes[2]});
+ ITabDescriptor[] tabDescriptors = testsView.getTabbedPropertySheetPage().getActiveTabs();
+
+ /**
+ * First tab is Name
+ */
+ assertEquals("Name", tabDescriptors[0].getLabel());//$NON-NLS-1$
+ /**
+ * Second tab is Error
+ */
+ assertEquals("Error", tabDescriptors[1].getLabel());//$NON-NLS-1$
+ /**
+ * Third tab is Message
+ */
+ assertEquals("Message", tabDescriptors[2].getLabel());//$NON-NLS-1$
+ /**
+ * No fourth tab
+ */
+ assertEquals(3, tabDescriptors.length);
+
+ /**
+ * Message tab is widest
+ */
+ assertEquals(2, ((TabbedPropertyComposite) testsView.getTabbedPropertySheetPage().getControl()).getList().getWidestLabelIndex());
+ }
+
+ /**
+ * When Warning node is selected, the Warning tab is widest.
+ */
+ public void test_widestLabelIndex3() {
+ /**
+ * select Warning node
+ */
+ setSelection(new TreeNode[] {treeNodes[3]});
+ ITabDescriptor[] tabDescriptors = testsView.getTabbedPropertySheetPage().getActiveTabs();
+
+ /**
+ * First tab is Name
+ */
+ assertEquals("Name", tabDescriptors[0].getLabel());//$NON-NLS-1$
+ /**
+ * Second tab is Warning
+ */
+ assertEquals("Warning", tabDescriptors[1].getLabel());//$NON-NLS-1$
+ /**
+ * Third tab is Message
+ */
+ assertEquals("Message", tabDescriptors[2].getLabel());//$NON-NLS-1$
+ /**
+ * No fourth tab
+ */
+ assertEquals(3, tabDescriptors.length);
+
+ /**
+ * Warning tab is widest
+ */
+ assertEquals(1, ((TabbedPropertyComposite) testsView.getTabbedPropertySheetPage().getControl()).getList().getWidestLabelIndex());
+ }
+
+ /**
* When File, Folder and Project Nodes are selected, only the Resource tab
* displays. Tests input attribute.
*/
@@ -230,6 +330,10 @@
assertNull(tabContents);
ITabDescriptor[] TabDescriptors = testsView.getTabbedPropertySheetPage().getActiveTabs();
assertEquals(0, TabDescriptors.length);
+ /**
+ * widestLabelIndex should be -1
+ */
+ assertEquals(-1, ((TabbedPropertyComposite) testsView.getTabbedPropertySheetPage().getControl()).getList().getWidestLabelIndex());
}
}
diff --git a/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/decorations/TabbedPropertySheetPageWithDecorations.java b/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/decorations/TabbedPropertySheetPageWithDecorations.java
new file mode 100644
index 0000000..a848db0
--- /dev/null
+++ b/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/decorations/TabbedPropertySheetPageWithDecorations.java
@@ -0,0 +1,150 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ * 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.tests.views.properties.tabbed.decorations;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyComposite;
+import org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyList;
+import org.eclipse.ui.views.properties.tabbed.ITabDescriptor;
+import org.eclipse.ui.views.properties.tabbed.ITabItem;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
+import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
+
+public class TabbedPropertySheetPageWithDecorations extends
+ TabbedPropertySheetPage {
+
+ private boolean useDecorations;
+
+ private Image image;
+
+ private Color color = Display.getCurrent().getSystemColor(SWT.COLOR_RED);
+
+ public TabbedPropertySheetPageWithDecorations(
+ ITabbedPropertySheetPageContributor tabbedPropertySheetPageContributor) {
+ super(tabbedPropertySheetPageContributor);
+ }
+
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ if (selection.equals(getCurrentSelection())) {
+ return;
+ }
+ super.selectionChanged(part, selection);
+ if (useDecorations) {
+ /*
+ * Call ListElement's showDynamicImage(), hideDynamicImage(),
+ * setTextColor() and setDefaultTextColor() methods to make sure
+ * that they don't throw any exceptions.
+ */
+ TabbedPropertyList tabbedPropertyList = ((TabbedPropertyComposite) this
+ .getControl()).getList();
+ for (int i = 0; i < tabbedPropertyList.getNumberOfElements(); i++) {
+ TabbedPropertyList.ListElement tabListElement = (TabbedPropertyList.ListElement) tabbedPropertyList
+ .getElementAt(i);
+ if (tabListElement != null) {
+ ITabItem tab = tabListElement.getTabItem();
+ if (tab.getText().equals("Name")) {
+ /*
+ * The Name tab can have 5 images. Check boundary
+ * conditions to make sure that the code does not throw
+ * IndexOutOfBoundsException.
+ */
+ tabListElement.showDynamicImage(-1, image);
+ tabListElement.hideDynamicImage(-1);
+
+ tabListElement.showDynamicImage(0, image);
+ tabListElement.hideDynamicImage(0);
+
+ tabListElement.showDynamicImage(2, image);
+ tabListElement.hideDynamicImage(2);
+
+ tabListElement.showDynamicImage(4, image);
+ tabListElement.hideDynamicImage(4);
+
+ tabListElement.showDynamicImage(5, image);
+ tabListElement.hideDynamicImage(5);
+
+ tabListElement.showDynamicImage(7, image);
+ tabListElement.hideDynamicImage(7);
+
+ /*
+ * Set and reset the tab-label's color. Make sure that
+ * the code does not throw NullPointerException.
+ */
+ tabListElement.setTextColor(null);
+ tabListElement.setTextColor(color);
+ tabListElement.setDefaultTextColor();
+ } else if (tab.getText().equals("Message")) {
+ /*
+ * The Name tab can have 3 images. Check boundary
+ * conditions to make sure that the code does not throw
+ * IndexOutOfBoundsException.
+ */
+ tabListElement.showDynamicImage(-1, image);
+ tabListElement.hideDynamicImage(-1);
+
+ tabListElement.showDynamicImage(0, image);
+ tabListElement.hideDynamicImage(0);
+
+ tabListElement.showDynamicImage(1, image);
+ tabListElement.hideDynamicImage(1);
+
+ tabListElement.showDynamicImage(2, image);
+ tabListElement.hideDynamicImage(2);
+
+ tabListElement.showDynamicImage(3, image);
+ tabListElement.hideDynamicImage(3);
+
+ tabListElement.showDynamicImage(7, image);
+ tabListElement.hideDynamicImage(7);
+ }
+ }
+ }
+ }
+ }
+
+ protected void updateTabs(ITabDescriptor[] descriptors) {
+ super.updateTabs(descriptors);
+ if (useDecorations) {
+ // Set the number of decoration-images in the TabbedPropertyList
+ TabbedPropertyList tabbedPropertyList = ((TabbedPropertyComposite) this
+ .getControl()).getList();
+ Map tabToImageDecorationsMap = getImageDecorationsForTabs(descriptors);
+ tabbedPropertyList.setDynamicImageCount(tabToImageDecorationsMap);
+ }
+ }
+
+ private Map getImageDecorationsForTabs(ITabItem[] tabItems) {
+ Map tabToImageDecorationsMap = new HashMap();
+ for (int i = 0; i < tabItems.length; i++) {
+ if (tabItems[i].getText().equals("Name")) {
+ tabToImageDecorationsMap.put(tabItems[i], new Integer(5));
+ } else if (tabItems[i].getText().equals("Message")) {
+ tabToImageDecorationsMap.put(tabItems[i], new Integer(3));
+ } else {
+ tabToImageDecorationsMap.put(tabItems[i], new Integer(0));
+ }
+ }
+ return tabToImageDecorationsMap;
+ }
+
+ public void useDecorations(boolean value) {
+ this.useDecorations = value;
+ }
+}
diff --git a/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/decorations/views/DecorationTestsView.java b/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/decorations/views/DecorationTestsView.java
new file mode 100644
index 0000000..c254034
--- /dev/null
+++ b/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/decorations/views/DecorationTestsView.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation and others.
+ * 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.tests.views.properties.tabbed.decorations.views;
+
+import org.eclipse.ui.tests.views.properties.tabbed.decorations.TabbedPropertySheetPageWithDecorations;
+import org.eclipse.ui.tests.views.properties.tabbed.views.TestsView;
+import org.eclipse.ui.views.properties.IPropertySheetPage;
+
+public class DecorationTestsView extends TestsView {
+
+ public static final String DECORATION_TESTS_VIEW_ID = "org.eclipse.ui.tests.views.properties.tabbed.decorations.views.DecorationTestsView"; //$NON-NLS-1$
+
+ public Object getAdapter(Class adapter) {
+ if (adapter == IPropertySheetPage.class) {
+ if (tabbedPropertySheetPage == null) {
+ tabbedPropertySheetPage = new TabbedPropertySheetPageWithDecorations(this);
+ }
+ return tabbedPropertySheetPage;
+ }
+ return super.getAdapter(adapter);
+ }
+
+}
diff --git a/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/views/TestsView.java b/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/views/TestsView.java
index 8099080..57f7fe1 100644
--- a/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/views/TestsView.java
+++ b/tests/org.eclipse.ui.tests.views.properties.tabbed/src/org/eclipse/ui/tests/views/properties/tabbed/views/TestsView.java
@@ -28,7 +28,7 @@
private TreeViewer viewer;
- private TabbedPropertySheetPage tabbedPropertySheetPage;
+ protected TabbedPropertySheetPage tabbedPropertySheetPage;
public static final String TESTS_VIEW_ID = "org.eclipse.ui.tests.views.properties.tabbed.views.TestsView"; //$NON-NLS-1$
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/AllTests.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/AllTests.java
index 2e74b55..11a6e47 100644
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/AllTests.java
+++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/AllTests.java
@@ -25,6 +25,7 @@
public AllTests() {
addTestSuite(DialogTest.class);
+ addTestSuite(StatusDialogTest.class);
addTestSuite(DialogSettingsTest.class);
addTestSuite(InputDialogTest.class);
addTestSuite(TitleAreaDialogTest.class);
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/StatusDialogTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/StatusDialogTest.java
new file mode 100755
index 0000000..f7d5261
--- /dev/null
+++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/StatusDialogTest.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Rüdiger Herrmann and others.
+ * 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:
+ * Rüdiger Herrmann - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.jface.tests.dialogs;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.StatusDialog;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+public class StatusDialogTest extends TestCase {
+
+ private static final String PLUGIN_ID = "org.eclipse.ui.tests";
+
+ private Shell shell;
+
+ public void testEscapeAmpesandInStatusLabelBug395426() {
+ TestableStatusDialog dialog = new TestableStatusDialog(shell);
+ dialog.open();
+ dialog.updateStatus(new Status(IStatus.ERROR, PLUGIN_ID, "&"));
+ CLabel statusLabel = findStatusLabel(dialog.getShell());
+ assertEquals( "&&", statusLabel.getText());
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ shell = new Shell();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ shell.dispose();
+ }
+
+ private CLabel findStatusLabel(Composite parent) {
+ CLabel result = null;
+ Control[] children = parent.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ if (children[i] instanceof CLabel) {
+ result = (CLabel) children[i];
+ }
+ }
+ if (result == null) {
+ for (int i = 0; i < children.length; i++) {
+ if (children[i] instanceof Composite) {
+ result = findStatusLabel((Composite) children[i]);
+ }
+ }
+ }
+ return result;
+ }
+
+ public class TestableStatusDialog extends StatusDialog {
+
+ public TestableStatusDialog(Shell parent) {
+ super(parent);
+ setBlockOnOpen(false);
+ }
+
+ @Override
+ protected void updateStatus(IStatus status) {
+ super.updateStatus(status);
+ }
+ }
+}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/datatransfer/ImportExistingProjectsWizardTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/datatransfer/ImportExistingProjectsWizardTest.java
index de67767..c5a4216 100644
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/datatransfer/ImportExistingProjectsWizardTest.java
+++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/datatransfer/ImportExistingProjectsWizardTest.java
@@ -60,6 +60,7 @@
private static final String DATA_PATH_PREFIX = "data/org.eclipse.datatransferArchives/";
private static final String WS_DATA_PREFIX = "data/workspaces";
private static final String WS_DATA_LOCATION = "importExistingFromDirTest";
+ private static final String WS_NESTED_DATA_LOCATION = "importExistingNestedTest";
private static final String ARCHIVE_HELLOWORLD = "helloworld";
private static final String ARCHIVE_FILE_WITH_EMPTY_FOLDER = "EmptyFolderInArchive";
private static final String PROJECTS_ARCHIVE = "ProjectsArchive";
@@ -117,7 +118,7 @@
super.doTearDown();
IWorkspaceRoot wsRoot = ResourcesPlugin.getWorkspace().getRoot();
IProject[] projects = wsRoot.getProjects();
- for (int i = 0; i < projects.length; i++) {
+ for (int i = projects.length - 1; i >= 0; i--) {
FileUtil.deleteProject(projects[i]);
}
// clean up any data directories created
@@ -226,7 +227,7 @@
public void testFindSingleDirectory() {
try {
- dataLocation = copyDataLocation();
+ dataLocation = copyDataLocation(WS_DATA_LOCATION);
IPath wsPath = new Path(dataLocation).append("HelloWorld");
WizardProjectsImportPage wpip = getNewWizard();
HashSet projects = new HashSet();
@@ -251,7 +252,7 @@
public void testDoNotShowProjectWithSameName() {
try {
- dataLocation = copyDataLocation();
+ dataLocation = copyDataLocation(WS_DATA_LOCATION);
IPath wsPath = new Path(dataLocation);
FileUtil.createProject("HelloWorld");
@@ -502,7 +503,7 @@
for (int i = 0; i < workspaceProjects.length; i++)
FileUtil.deleteProject(workspaceProjects[i]);
- dataLocation = copyDataLocation();
+ dataLocation = copyDataLocation(WS_DATA_LOCATION);
wsPath = new Path(dataLocation).append("HelloWorld");
WizardProjectsImportPage wpip = getNewWizard();
HashSet projects = new HashSet();
@@ -551,7 +552,7 @@
for (int i = 0; i < workspaceProjects.length; i++)
FileUtil.deleteProject(workspaceProjects[i]);
- dataLocation = copyDataLocation();
+ dataLocation = copyDataLocation(WS_DATA_LOCATION);
wsPath = new Path(dataLocation).append("HelloWorld");
WizardProjectsImportPage wpip = getNewWizard();
HashSet projects = new HashSet();
@@ -604,7 +605,7 @@
for (int i = 0; i < workspaceProjects.length; i++)
FileUtil.deleteProject(workspaceProjects[i]);
- dataLocation = copyDataLocation();
+ dataLocation = copyDataLocation(WS_DATA_LOCATION);
wsPath = new Path(dataLocation).append("HelloWorld");
WizardProjectsImportPage wpip = getNewWizard();
HashSet projects = new HashSet();
@@ -802,12 +803,83 @@
}
+ public void testImportDirectoryNested() {
+ IPath wsPath = null;
+ try {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+
+ IProject[] workspaceProjects = root.getProjects();
+ for (int i = 0; i < workspaceProjects.length; i++) {
+ FileUtil.deleteProject(workspaceProjects[i]);
+ }
+
+ dataLocation = copyDataLocation(WS_NESTED_DATA_LOCATION);
+ wsPath = new Path(dataLocation).append("A");
+ WizardProjectsImportPage wpip = getNewWizard();
+ HashSet projects = new HashSet();
+ projects.add("A");
+ projects.add("B");
+ projects.add("C");
+
+ wpip.getProjectFromDirectoryRadio().setSelection(true);
+ wpip.getNestedProjectsCheckbox().setSelection(true);
+ wpip.getCopyCheckbox().setSelection(false);
+ wpip.saveWidgetValues();
+ wpip.restoreWidgetValues();
+
+ wpip.updateProjectsList(wsPath.toOSString());
+ ProjectRecord[] selectedProjects = wpip.getProjectRecords();
+ ArrayList projectNames = new ArrayList();
+ for (int i = 0; i < selectedProjects.length; i++) {
+ projectNames.add(selectedProjects[i].getProjectName());
+ }
+
+ assertTrue("Not all projects were found correctly in directory",
+ projectNames.containsAll(projects));
+
+ CheckboxTreeViewer projectsList = wpip.getProjectsList();
+ projectsList.setCheckedElements(selectedProjects);
+ wpip.createProjects(); // Try importing all the projects we found
+ waitForRefresh();
+
+ // "A", "B", and "C" should be the only projects in the workspace
+ workspaceProjects = root.getProjects();
+ if (workspaceProjects.length != 3) {
+ fail("Incorrect number of projects imported");
+ }
+
+ IFolder aFolder = workspaceProjects[0].getFolder("A");
+ if (aFolder.exists()) {
+ fail("Project A was imported as a folder into itself");
+ }
+
+ IFolder bFolder = workspaceProjects[1].getFolder("B");
+ if (bFolder.exists()) {
+ fail("Project B was imported as a folder into itself");
+ }
+
+ IFolder cFolder = workspaceProjects[2].getFolder("C");
+ if (cFolder.exists()) {
+ fail("Project C was imported as a folder into itself");
+ }
+
+ workspaceProjects[0].refreshLocal(IResource.DEPTH_INFINITE, null);
+
+ verifyProjectInWorkspace(false, workspaceProjects[0], FILE_LIST, true);
+ verifyProjectInWorkspace(false, workspaceProjects[1], FILE_LIST, true);
+ verifyProjectInWorkspace(false, workspaceProjects[2], FILE_LIST, true);
+ } catch (IOException e) {
+ fail(e.toString());
+ } catch (CoreException e) {
+ fail(e.toString());
+ }
+ }
public void testInitialValue() {
try {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- zipLocation = copyZipLocation();
+ zipLocation = copyZipLocation(WS_DATA_LOCATION);
IProject[] workspaceProjects = root.getProjects();
for (int i = 0; i < workspaceProjects.length; i++)
FileUtil.deleteProject(workspaceProjects[i]);
@@ -841,7 +913,7 @@
public void testImportArchiveMultiProject() {
try {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- zipLocation = copyZipLocation();
+ zipLocation = copyZipLocation(WS_DATA_LOCATION);
IProject[] workspaceProjects = root.getProjects();
for (int i = 0; i < workspaceProjects.length; i++)
@@ -931,7 +1003,7 @@
if (!res.exists())
filesNotImported.append(res.getName() + ", ");
}
- assertTrue("Files expected but not in workspace: "
+ assertTrue("Files expected but not in workspace for project \"" + project.getName() + "\": "
+ filesNotImported.toString(), filesNotImported.length() == 0);
}
@@ -940,14 +1012,14 @@
*
* @return the location
*/
- private String copyDataLocation() throws IOException {
+ private String copyDataLocation(String dataLocation) throws IOException {
TestPlugin plugin = TestPlugin.getDefault();
if (plugin == null)
throw new IllegalStateException(
"TestPlugin default reference is null");
URL fullPathString = plugin.getDescriptor().find(
- new Path(WS_DATA_PREFIX).append(WS_DATA_LOCATION + ".zip"));
+ new Path(WS_DATA_PREFIX).append(dataLocation + ".zip"));
if (fullPathString == null)
throw new IllegalArgumentException();
@@ -966,14 +1038,14 @@
return destination.getAbsolutePath();
}
- private String copyZipLocation() throws IOException {
+ private String copyZipLocation(String zipLocation) throws IOException {
TestPlugin plugin = TestPlugin.getDefault();
if (plugin == null)
throw new IllegalStateException(
"TestPlugin default reference is null");
URL fullPathString = plugin.getDescriptor().find(
- new Path(WS_DATA_PREFIX).append(WS_DATA_LOCATION + ".zip"));
+ new Path(WS_DATA_PREFIX).append(zipLocation + ".zip"));
if (fullPathString == null)
throw new IllegalArgumentException();
diff --git a/tests/org.eclipse.ui.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.ui.tests/META-INF/MANIFEST.MF
index d75fe4f..c46080e 100644
--- a/tests/org.eclipse.ui.tests/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.ui.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Eclipse UI Tests
Bundle-SymbolicName: org.eclipse.ui.tests; singleton:=true
-Bundle-Version: 3.7.1.qualifier
+Bundle-Version: 3.8.0.qualifier
Eclipse-BundleShape: dir
Bundle-ClassPath: uitests.jar
Bundle-Activator: org.eclipse.ui.tests.TestPlugin
diff --git a/tests/org.eclipse.ui.tests/data/workspaces/importExistingNestedTest.zip b/tests/org.eclipse.ui.tests/data/workspaces/importExistingNestedTest.zip
new file mode 100644
index 0000000..ef6fb9b
--- /dev/null
+++ b/tests/org.eclipse.ui.tests/data/workspaces/importExistingNestedTest.zip
Binary files differ
diff --git a/tests/org.eclipse.ui.tests/pom.xml b/tests/org.eclipse.ui.tests/pom.xml
index 05e3bfc..4d6f1ac 100644
--- a/tests/org.eclipse.ui.tests/pom.xml
+++ b/tests/org.eclipse.ui.tests/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.ui.tests</artifactId>
- <version>3.7.1-SNAPSHOT</version>
+ <version>3.8.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
</project>