Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor')
-rw-r--r--bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/CMImageUtil.java134
-rw-r--r--bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/DOMSelectionConvertorFactory.java86
-rw-r--r--bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/IHelpContextIds.java50
-rw-r--r--bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/XMLEditorPluginImageHelper.java159
-rw-r--r--bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/XMLEditorPluginImages.java60
5 files changed, 0 insertions, 489 deletions
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/CMImageUtil.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/CMImageUtil.java
deleted file mode 100644
index 7fa80c84d0..0000000000
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/CMImageUtil.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2010 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.wst.xml.ui.internal.editor;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.wst.sse.core.internal.util.JarUtilities;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;
-import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQuery;
-import org.eclipse.wst.xml.core.internal.modelquery.ModelQueryUtil;
-import org.eclipse.wst.xml.ui.internal.XMLUIPlugin;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * @author nsd
- */
-public class CMImageUtil {
-
- public static String SMALL_ICON_URL = "small-icon"; //$NON-NLS-1$
-
- public static CMNode getDeclaration(Node node) {
- CMNode decl = null;
- ModelQuery mq = null;
- switch (node.getNodeType()) {
- case Node.ATTRIBUTE_NODE : {
- mq = ModelQueryUtil.getModelQuery(((Attr) node).getOwnerDocument());
- decl = mq.getCMAttributeDeclaration((Attr) node);
- }
- break;
- case Node.ELEMENT_NODE : {
- mq = ModelQueryUtil.getModelQuery(node.getOwnerDocument());
- decl = mq.getCMElementDeclaration((Element) node);
- }
- break;
- }
- return decl;
- }
-
- public static Image getImage(CMNode cmnode) {
- if (cmnode == null) {
- return null;
- }
- Image image = null;
- // cache CM-specified images with the XML UI plugin
- String imageURLString = (String) cmnode.getProperty(SMALL_ICON_URL);
- if ((imageURLString != null) && (imageURLString.length() > 0)) {
- /* First ensure that the descriptor itself is cached */
- ImageDescriptor imageDescriptor = getImageDescriptor(imageURLString);
- if (imageDescriptor != null) {
- /*
- * Then obtain the image from the registry so that it is both
- * cached and properly disposed of later
- */
- image = getImageRegistry().get(imageURLString);
- }
- }
- return image;
- }
-
- public static ImageDescriptor getImageDescriptor(CMNode cmnode) {
- if (cmnode == null) {
- return null;
- }
- // cache CM-specified images with the XML UI plugin
- String imageURLString = (String) cmnode.getProperty(SMALL_ICON_URL);
- ImageDescriptor descriptor = null;
- if ((imageURLString != null) && (imageURLString.length() > 0)) {
- descriptor = getImageDescriptor(imageURLString);
- }
- return descriptor;
- }
-
- private static ImageDescriptor getImageDescriptor(String imageURLString) {
- ImageDescriptor descriptor = getImageRegistry().getDescriptor(imageURLString);
- if (descriptor == null) {
- try {
- URL imageURL = new URL(imageURLString);
- InputStream inputStream = JarUtilities.getInputStream(imageURL);
- try {
- if (inputStream != null) {
- ImageData data = new ImageData(inputStream);
- descriptor = ImageDescriptor.createFromImageData(data);
- getImageRegistry().put(imageURLString, descriptor);
- }
- }
- catch (SWTException e) {
- /*
- * There was a problem loading image from stream
- * (corrupt, missing, etc.)
- */
- if (inputStream != null)
- inputStream.close();
- }
- }
- catch (MalformedURLException e) {
- descriptor = null;
- }
- catch (IOException e) {
- descriptor = null;
- }
- }
- return descriptor;
- }
-
- private static final ImageRegistry getImageRegistry() {
- return XMLUIPlugin.getInstance().getImageRegistry();
- }
-
- /**
- *
- */
- private CMImageUtil() {
- super();
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/DOMSelectionConvertorFactory.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/DOMSelectionConvertorFactory.java
deleted file mode 100644
index 0f0988b6f7..0000000000
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/DOMSelectionConvertorFactory.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.xml.ui.internal.editor;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.ui.internal.editor.SelectionConvertor;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.w3c.dom.NamedNodeMap;
-
-/**
- * @author nitin
- *
- */
-public class DOMSelectionConvertorFactory implements IAdapterFactory {
-
- private static final Class[] ADAPTER_LIST = new Class[]{SelectionConvertor.class};
-
- private static class XMLSelectionConvertor extends SelectionConvertor {
- /* (non-Javadoc)
- * @see org.eclipse.wst.sse.ui.internal.editor.SelectionConvertor#getElements(org.eclipse.wst.sse.core.internal.provisional.IStructuredModel, int, int)
- */
- public Object[] getElements(IStructuredModel model, int start, int end) {
- Object[] objects = super.getElements(model, start, end);
- // narrow single selected Elements into Attrs if possible
- if (objects.length == 1) {
- if (objects[0] instanceof IDOMNode) {
- IDOMNode node = (IDOMNode) objects[0];
- NamedNodeMap attributes = node.getAttributes();
- if (attributes != null) {
- for (int i = 0; i < attributes.getLength(); i++) {
- IDOMAttr attribute = (IDOMAttr) attributes.item(i);
- if (attribute.contains(start) && attribute.contains(end)) {
- objects[0] = attribute;
- break;
- }
- }
- }
- }
- }
- return objects;
- }
- }
-
- private static final Object selectionConvertor = new XMLSelectionConvertor();
-
- /**
- *
- */
- public DOMSelectionConvertorFactory() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object,
- * java.lang.Class)
- */
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof IDOMModel && SelectionConvertor.class.equals(adapterType))
- return selectionConvertor;
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList() {
- return ADAPTER_LIST;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/IHelpContextIds.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/IHelpContextIds.java
deleted file mode 100644
index f7542e3cd6..0000000000
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/IHelpContextIds.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2009 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.xml.ui.internal.editor;
-
-import org.eclipse.wst.xml.ui.internal.XMLUIPlugin;
-
-/**
- * Help context ids for the XML Source Editor.
- * <p>
- * This interface contains constants only; it is not intended to be
- * implemented.
- * </p>
- *
- */
-public interface IHelpContextIds {
- // org.eclipse.wst.xml.ui.
- public static final String PREFIX = XMLUIPlugin.ID + "."; //$NON-NLS-1$
-
- // figured out on the fly
- // // XML Source page editor
- // public static final String XML_SOURCEVIEW_HELPID =
- // ContentTypeIdForXML.ContentTypeID_XML +"_source_HelpId"; //$NON-NLS-1$
-
- // XML Files Preference page
- public static final String XML_PREFWEBX_FILES_HELPID = PREFIX + "webx0060"; //$NON-NLS-1$
- // XML Source Preference page
- public static final String XML_PREFWEBX_SOURCE_HELPID = PREFIX + "webx0061"; //$NON-NLS-1$
- // XML Styles Preference page
- public static final String XML_PREFWEBX_STYLES_HELPID = PREFIX + "webx0062"; //$NON-NLS-1$
- // XML Templates Preference page
- public static final String XML_PREFWEBX_TEMPLATES_HELPID = PREFIX + "webx0063"; //$NON-NLS-1$
- // XML Validator Preference page
- public static final String XML_PREFWEBX_VALIDATOR_HELPID = PREFIX + "webx0064"; //$NON-NLS-1$
-
- // XML Cleanup dialog
- public static final String CLEANUP_XML_HELPID = PREFIX + "xmlm1200"; //$NON-NLS-1$
-
- // XML New File Wizard - Template Page
- public static final String XML_NEWWIZARD_TEMPLATE_HELPID = PREFIX + "xmlw0010"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/XMLEditorPluginImageHelper.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/XMLEditorPluginImageHelper.java
deleted file mode 100644
index 73b67360e8..0000000000
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/XMLEditorPluginImageHelper.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.xml.ui.internal.editor;
-
-import java.util.HashMap;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.wst.xml.ui.internal.XMLUIPlugin;
-
-
-/**
- * Helper class to handle images provided by this plug-in.
- *
- * NOTE: For internal use only. For images used externally, please use the
- * Shared***ImageHelper class instead.
- *
- * @author amywu
- */
-public class XMLEditorPluginImageHelper {
- private static XMLEditorPluginImageHelper instance = null;
-
- /**
- * Gets the instance.
- *
- * @return Returns a XMLEditorPluginImageHelper
- */
- public synchronized static XMLEditorPluginImageHelper getInstance() {
- if (instance == null) {
- instance = new XMLEditorPluginImageHelper();
- }
- return instance;
- }
-
- // save a descriptor for each image
- private HashMap fImageDescRegistry = null;
- private final String PLUGINID = XMLUIPlugin.ID;
-
- /**
- * Creates an image from the given resource and adds the image to the
- * image registry.
- *
- * @param resource
- * @return Image
- */
- private Image createImage(String resource) {
- ImageDescriptor desc = getImageDescriptor(resource);
- Image image = null;
-
- if (desc != null) {
- image = desc.createImage();
- // dont add the missing image descriptor image to the image
- // registry
- if (!desc.equals(ImageDescriptor.getMissingImageDescriptor())) {
- getImageRegistry().put(resource, image);
- }
- }
- return image;
- }
-
- /**
- * Creates an image descriptor from the given imageFilePath and adds the
- * image descriptor to the image descriptor registry. If an image
- * descriptor could not be created, the default "missing" image descriptor
- * is returned but not added to the image descriptor registry.
- *
- * @param imageFilePath
- * @return ImageDescriptor image descriptor for imageFilePath or default
- * "missing" image descriptor if resource could not be found
- */
- private ImageDescriptor createImageDescriptor(String imageFilePath) {
- ImageDescriptor imageDescriptor = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGINID, imageFilePath);
- if (imageDescriptor != null) {
- getImageDescriptorRegistry().put(imageFilePath, imageDescriptor);
- }
- else {
- imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
- }
-
- return imageDescriptor;
- }
-
- /**
- * Retrieves the image associated with resource from the image registry.
- * If the image cannot be retrieved, attempt to find and load the image at
- * the location specified in resource.
- *
- * @param resource
- * the image to retrieve
- * @return Image the image associated with resource or null if one could
- * not be found
- */
- public Image getImage(String resource) {
- Image image = getImageRegistry().get(resource);
- if (image == null) {
- // create an image
- image = createImage(resource);
- }
- return image;
- }
-
- /**
- * Retrieves the image descriptor associated with resource from the image
- * descriptor registry. If the image descriptor cannot be retrieved,
- * attempt to find and load the image descriptor at the location specified
- * in resource.
- *
- * @param resource
- * the image descriptor to retrieve
- * @return ImageDescriptor the image descriptor assocated with resource or
- * the default "missing" image descriptor if one could not be
- * found
- */
- public ImageDescriptor getImageDescriptor(String resource) {
- ImageDescriptor imageDescriptor = null;
- Object o = getImageDescriptorRegistry().get(resource);
- if (o == null) {
- // create a descriptor
- imageDescriptor = createImageDescriptor(resource);
- }
- else {
- imageDescriptor = (ImageDescriptor) o;
- }
- return imageDescriptor;
- }
-
- /**
- * Returns the image descriptor registry for this plugin.
- *
- * @return HashMap - image descriptor registry for this plugin
- */
- private HashMap getImageDescriptorRegistry() {
- if (fImageDescRegistry == null) {
- fImageDescRegistry = new HashMap();
- }
- return fImageDescRegistry;
- }
-
- /**
- * Returns the image registry for this plugin.
- *
- * @return ImageRegistry - image registry for this plugin
- */
- private ImageRegistry getImageRegistry() {
- return XMLUIPlugin.getDefault().getImageRegistry();
- }
-}
diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/XMLEditorPluginImages.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/XMLEditorPluginImages.java
deleted file mode 100644
index 52c379affc..0000000000
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/editor/XMLEditorPluginImages.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2007 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.xml.ui.internal.editor;
-
-/**
- * Bundle of most images used by the XML Source Editor plug-in.
- */
-public class XMLEditorPluginImages {
-
- public static final String IMG_DTOOL_CONSTRAINOFF = "icons/full/dtool16/constrainoff.gif"; //$NON-NLS-1$
- public static final String IMG_DTOOL_CONSTRAINON = "icons/full/dtool16/constrainon.gif"; //$NON-NLS-1$
- public static final String IMG_DTOOL_RLDGRMR = "icons/full/dtool16/rldgrmr.gif"; //$NON-NLS-1$
- public static final String IMG_DTOOL_VALIDATE = "icons/full/dtool16/validate.gif"; //$NON-NLS-1$
- public static final String IMG_ETOOL_CONSTRAINOFF = "icons/full/etool16/constrainoff.gif"; //$NON-NLS-1$
- public static final String IMG_ETOOL_CONSTRAINON = "icons/full/etool16/constrainon.gif"; //$NON-NLS-1$
- public static final String IMG_ETOOL_RLDGRMR = "icons/full/etool16/rldgrmr.gif"; //$NON-NLS-1$
- public static final String IMG_ETOOL_VALIDATE = "icons/full/etool16/validate.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_ADD_CORRECTION = "icons/full/obj16/add_correction.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_ATT_REQ_OBJ = "icons/full/obj16/att_req_obj.gif"; //$NON-NLS-1$
-
- public static final String IMG_OBJ_ATTRIBUTE = "icons/full/obj16/attribute_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_CDATASECTION = "icons/full/obj16/cdatasection.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_COMMENT = "icons/full/obj16/comment_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_CORRECTION_CHANGE = "icons/full/obj16/correction_change.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_DOCTYPE = "icons/full/obj16/doctype.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_DTDFILE = "icons/full/obj16/dtdfile.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_ELEMENT = "icons/full/obj16/element_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_ENTITY = "icons/full/obj16/entity.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_ENTITY_REFERENCE = "icons/full/obj16/entity_reference.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_ENUM = "icons/full/obj16/enum.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_LOCAL_VARIABLE = "icons/full/obj16/localvariable_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_NOTATION = "icons/full/obj16/notation.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_PROCESSINGINSTRUCTION = "icons/full/obj16/proinst_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_SORT = "icons/full/obj16/sort.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_TAG_GENERIC = "icons/full/obj16/tag-generic.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_TAG_GENERIC_DEEMPHASIZED = "icons/full/obj16/tag_generic_deemphasized_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_TAG_GENERIC_EMPHASIZED = "icons/full/obj16/tag_generic_emphasized_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_TAG_MACRO = "icons/full/obj16/tag-macro.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_TXTEXT = "icons/full/obj16/text.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_WARNING_OBJ = "icons/full/obj16/warning_obj.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_XSDFILE = "icons/full/obj16/XSDFile.gif"; //$NON-NLS-1$
-
- public static final String IMG_OVR_ERROR = "icons/full/ovr16/error_ovr.gif"; //$NON-NLS-1$
- public static final String IMG_OVR_STALE_ERROR = "icons/full/ovr16/stale_error_ovr.gif"; //$NON-NLS-1$
- public static final String IMG_OVR_WARN = "icons/full/ovr16/warn_ovr.gif"; //$NON-NLS-1$
-
- public static final String IMG_WIZBAN_GENERATEXML = "icons/full/wizban/generatexml_wiz.png"; //$NON-NLS-1$
-
- public static final String IMG_OBJ_DEFAULT = "icons/full/obj16/default.gif"; //$NON-NLS-1$
-}

Back to the top