Merge remote branch 'origin/R4_2_maintenance'
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.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/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/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.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/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/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/StackRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
index f8f5fc5..b080ca3 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
@@ -12,9 +12,12 @@
import java.util.LinkedList;
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);
+ }
}
}
}
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/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 9851458..43b6db2 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
@@ -729,6 +729,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);
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 bc1224f..39a8049 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.10.3.qualifier
+Bundle-Version: 0.10.100.qualifier
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.jface.databinding/META-INF/MANIFEST.MF b/bundles/org.eclipse.jface.databinding/META-INF/MANIFEST.MF
index 47b97f9..57795d5 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.100.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/META-INF/MANIFEST.MF b/bundles/org.eclipse.jface/META-INF/MANIFEST.MF
index b84452e..7b8f357 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.101.qualifier
+Bundle-Version: 3.8.200.qualifier
Bundle-ClassPath: .
Bundle-Vendor: %providerName
Bundle-Localization: plugin
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/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.ide/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF
index b299f6b..6ae0599 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.1.qualifier
+Bundle-Version: 3.8.100.qualifier
Bundle-ClassPath: e4-ide.jar,
.
Bundle-Activator: org.eclipse.ui.internal.ide.IDEWorkbenchPlugin
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/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.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/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..c157d8a 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,7 +362,7 @@
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;
}
@@ -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.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/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/internal/Workbench.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
index 39a1a89..1a1a640 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
@@ -1620,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 3a0ea29..2641459 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
@@ -1146,10 +1146,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 };
}
@@ -1696,13 +1688,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/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 2b01843..352b795 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
@@ -157,6 +157,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/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.workbench/META-INF/MANIFEST.MF
index d14bbb6..07e505e 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..8efddba 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.103.1-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..b540474 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.103.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
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/features/org.eclipse.e4.rcp/feature.xml b/features/org.eclipse.e4.rcp/feature.xml
index 475e6a9..f9c0ebd 100644
--- a/features/org.eclipse.e4.rcp/feature.xml
+++ b/features/org.eclipse.e4.rcp/feature.xml
@@ -659,10 +659,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/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 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 3c518da..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.0.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