[bug 323316]: XSL source editing eats GDI handles and may lead to a 'No more handles' exception
https://bugs.eclipse.org/bugs/show_bug.cgi?id=323316
diff --git a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/contentoutline/JFaceNodeAdapter.java b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/contentoutline/JFaceNodeAdapter.java
index cd89aaa..a7e9af5 100755
--- a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/contentoutline/JFaceNodeAdapter.java
+++ b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/contentoutline/JFaceNodeAdapter.java
@@ -7,7 +7,7 @@
  *
  * Contributors:
  *     David Carver (STAR) - based work on org.eclipse.wst.xml.ui.internal. JFaceNodeAdapter 
- *     
+ *     IBM Corporation - bug 319226 - Fix GDI memory leak.
  *******************************************************************************/
 package org.eclipse.wst.xsl.ui.internal.contentoutline;
 
@@ -45,29 +45,37 @@
 	}
 
 	protected ImageDescriptor getXSLImage(Element node) {
+		return XSLPluginImageHelper.getInstance().getImageDescriptor(getImagePath(node));
+	}
+
+	protected ImageDescriptor getImageDescriptor(String path) {
+		return XSLPluginImageHelper.getInstance().getImageDescriptor(path);
+	}
+
+	protected String getImagePath(Element node) {
 		String name = node.getLocalName();
 		if (name.equals("import") || name.equals("include")) {  //$NON-NLS-1$//$NON-NLS-2$
-			return XSLPluginImageHelper.getInstance().getImageDescriptor(XSLPluginImages.IMG_ELM_IMPORT_INCLUDE);
+			return XSLPluginImages.IMG_ELM_IMPORT_INCLUDE;
 		}
 		if (name.equals("template")) { //$NON-NLS-1$
 			if (node.hasAttribute("name")) { //$NON-NLS-1$
-				return XSLPluginImageHelper.getInstance().getImageDescriptor(XSLPluginImages.IMG_ELM_TEMPLATE_NAME);
+				return XSLPluginImages.IMG_ELM_TEMPLATE_NAME;
 			} else {
-				return XSLPluginImageHelper.getInstance().getImageDescriptor(XSLPluginImages.IMG_ELM_TEMPLATE);
+				return XSLPluginImages.IMG_ELM_TEMPLATE;
 			}
 		}
 		
 		if (name.equals("variable") || name.equals("param")) { //$NON-NLS-1$ //$NON-NLS-2$
-			return XSLPluginImageHelper.getInstance().getImageDescriptor(XSLPluginImages.IMG_ELM_VARIABLE);
+			return XSLPluginImages.IMG_ELM_VARIABLE;
 		}
 		
 		if (name.equals("function")) { //$NON-NLS-1$
-			return XSLPluginImageHelper.getInstance().getImageDescriptor(XSLPluginImages.IMG_ELM_FUNCTION);
+			return XSLPluginImages.IMG_ELM_FUNCTION;
 		}
 		
-		return XSLPluginImageHelper.getInstance().getImageDescriptor(XSLPluginImages.IMG_ELM_STYLESHET);
+		return XSLPluginImages.IMG_ELM_STYLESHET;
 	}
-	
+
 	protected Image createImage(Object object) {
 		Image image = null;
 		Node node = (Node) object;
@@ -75,11 +83,12 @@
 			case Node.ELEMENT_NODE : {
 				if (XSLCore.XSL_NAMESPACE_URI.equals(node.getNamespaceURI())) {
 					Element elem = (Element) node;
-					ImageDescriptor imgDesc = getXSLImage(elem); 
+					String path = getImagePath(elem);
+					ImageDescriptor imgDesc = getImageDescriptor(path); 
 					if (imgDesc == null) {
 						image = createXMLImageDescriptor(XMLEditorPluginImages.IMG_OBJ_ELEMENT);
 					} else {
-						image = imgDesc.createImage();
+						image = XSLPluginImageHelper.getInstance().getImage(path);
 					}
 				} else {
 					image = createXMLImageDescriptor(XMLEditorPluginImages.IMG_OBJ_ELEMENT);