[nobug] Add images for the XML Editor tabs
diff --git a/xml/bundles/org.eclipse.wst.xml.ui/icons/full/elcl16/hierarchicalLayout.png b/xml/bundles/org.eclipse.wst.xml.ui/icons/full/elcl16/hierarchicalLayout.png
new file mode 100644
index 0000000..ae6d660
--- /dev/null
+++ b/xml/bundles/org.eclipse.wst.xml.ui/icons/full/elcl16/hierarchicalLayout.png
Binary files differ
diff --git a/xml/bundles/org.eclipse.wst.xml.ui/icons/full/elcl16/hierarchicalLayout@2x.png b/xml/bundles/org.eclipse.wst.xml.ui/icons/full/elcl16/hierarchicalLayout@2x.png
new file mode 100644
index 0000000..f3a9875
--- /dev/null
+++ b/xml/bundles/org.eclipse.wst.xml.ui/icons/full/elcl16/hierarchicalLayout@2x.png
Binary files differ
diff --git a/xml/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLMultiPageEditorPart.java b/xml/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLMultiPageEditorPart.java
index 9c2db77..06aed1f 100644
--- a/xml/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLMultiPageEditorPart.java
+++ b/xml/bundles/org.eclipse.wst.xml.ui/src-multipage/org/eclipse/wst/xml/ui/internal/tabletree/XMLMultiPageEditorPart.java
@@ -18,6 +18,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IStatusLineManager;
@@ -87,6 +88,7 @@
import org.eclipse.wst.xml.core.internal.provisional.contenttype.ContentTypeIdForXML;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.eclipse.wst.xml.ui.internal.ImageDescriptorRegistry;
import org.eclipse.wst.xml.ui.internal.Logger;
import org.eclipse.wst.xml.ui.internal.XMLUIPlugin;
import org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeLabelProvider;
@@ -788,6 +790,9 @@
else {
setActivePage(fSourcePageIndex);
}
+
+ setPageImage(fDesignPageIndex, ImageDescriptorRegistry.getImage(ImageDescriptor.createFromURL(Platform.getBundle(XMLUIPlugin.ID).getResource("icons/full/elcl16/hierarchicalLayout.png"))));
+ setPageImage(fSourcePageIndex, ImageDescriptorRegistry.getImage(ImageDescriptor.createFromURL(Platform.getBundle(XMLUIPlugin.ID).getResource("icons/full/obj16/text.gif"))));
}
catch (PartInitException e) {
Logger.logException(e);
diff --git a/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/ImageDescriptorRegistry.java b/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/ImageDescriptorRegistry.java
new file mode 100644
index 0000000..c8032b5
--- /dev/null
+++ b/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/ImageDescriptorRegistry.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2013, 2020 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *
+ *******************************************************************************/
+package org.eclipse.wst.xml.ui.internal;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+
+public class ImageDescriptorRegistry {
+
+ private static final Map<ImageDescriptor, Image> registry = new HashMap<>(2);
+
+ public static synchronized Image getImage(ImageDescriptor descriptor) {
+ if (descriptor == null) {
+ descriptor = ImageDescriptor.getMissingImageDescriptor();
+ }
+
+ Image image = registry.get(descriptor);
+ if (image != null) {
+ return image;
+ }
+ image = descriptor.createImage();
+ if (image != null) {
+ registry.put(descriptor, image);
+ }
+ return image;
+ }
+
+ public static void dispose() {
+ for (Iterator<Image> it = registry.values().iterator(); it.hasNext();) {
+ it.next().dispose();
+ }
+ registry.clear();
+ }
+
+}
diff --git a/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPlugin.java b/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPlugin.java
index 314dae3..bc583c4 100644
--- a/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPlugin.java
+++ b/xml/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/XMLUIPlugin.java
@@ -19,6 +19,7 @@
import org.eclipse.jface.text.templates.ContextTypeRegistry;
import org.eclipse.jface.text.templates.persistence.TemplateStore;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry;
import org.eclipse.ui.editors.text.templates.ContributionTemplateStore;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -26,6 +27,7 @@
import org.eclipse.wst.sse.ui.internal.provisional.registry.AdapterFactoryRegistryImpl;
import org.eclipse.wst.xml.ui.internal.preferences.XMLUIPreferenceNames;
import org.eclipse.wst.xml.ui.internal.templates.TemplateContextTypeIdsXML;
+import org.osgi.framework.BundleContext;
/**
* The main plugin class to be used in the desktop.
@@ -114,6 +116,12 @@
* @return The image registered for the given name.
*/
public Image getImage(String imageName) {
- return getWorkbench().getSharedImages().getImage(imageName);
+ return PlatformUI.getWorkbench().getSharedImages().getImage(imageName);
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ ImageDescriptorRegistry.dispose();
+ super.stop(context);
}
}