Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.dtd.ui/src/org')
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/StructuredTextViewerConfigurationDTD.java70
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIMessages.java81
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIPlugin.java99
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIPluginResources.properties90
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/Logger.java143
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DTDDragAndDropManager.java46
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragAttributeCommand.java61
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragContentModelCommand.java113
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragTopLevelNodesCommand.java64
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/ActionContributorDTD.java77
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImageHelper.java157
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImages.java44
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/IHelpContextIds.java43
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDColorPage.java171
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDFilesPreferencePage.java160
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDSyntaxColoringPage.java855
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDTemplatePreferencePage.java167
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceInitializer.java77
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceNames.java37
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/projection/DTDFoldingStrategy.java70
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/registry/AdapterFactoryProviderForDTD.java53
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/IStyleConstantsDTD.java41
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/LineStyleProviderForDTD.java133
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/LineStyleProviderForDTDSubSet.java159
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/templates/TemplateContextTypeDTD.java36
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/templates/TemplateContextTypeIdsDTD.java17
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/text/DTDDocumentRegionEdgeMatcher.java28
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddAttributeAction.java56
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddAttributeListAction.java44
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddCommentAction.java32
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddElementAction.java33
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddElementToContentModelAction.java52
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddEntityAction.java35
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddGroupToContentModelAction.java39
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddNotationAction.java34
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddParameterEntityReferenceAction.java49
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/BaseAction.java67
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/DeleteAction.java70
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/ReplaceEmptyContentModelWithGroupAction.java44
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/properties/DTDPropertySourceAdapter.java130
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/properties/DTDPropertySourceAdapterFactory.java42
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/wizard/NewDTDTemplatesWizardPage.java513
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/wizard/NewDTDWizard.java277
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContentOutlineComparator.java37
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContentOutlineConfiguration.java282
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContextMenuHelper.java268
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDLabelProvider.java94
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDTreeContentProvider.java398
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/OrderAction.java57
-rw-r--r--bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/SortAction.java57
50 files changed, 0 insertions, 5802 deletions
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/StructuredTextViewerConfigurationDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/StructuredTextViewerConfigurationDTD.java
deleted file mode 100644
index 80a5dd1f2d..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/StructuredTextViewerConfigurationDTD.java
+++ /dev/null
@@ -1,70 +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.dtd.ui;
-
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.wst.dtd.core.text.IDTDPartitions;
-import org.eclipse.wst.dtd.ui.internal.style.LineStyleProviderForDTD;
-import org.eclipse.wst.sse.core.text.IStructuredPartitions;
-import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
-import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider;
-
-
-/**
- * Configuration for a source viewer which shows DTD content.
- * <p>
- * Clients can subclass and override just those methods which must be specific
- * to their needs.
- * </p>
- *
- * @see org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration
- * @since 1.0
- */
-public class StructuredTextViewerConfigurationDTD extends StructuredTextViewerConfiguration {
- /*
- * One instance per configuration because not sourceviewer-specific and
- * it's a String array
- */
- private String[] fConfiguredContentTypes;
- /*
- * One instance per configuration
- */
- private LineStyleProvider[] fLineStyleProviders;
-
- /**
- * Create new instance of StructuredTextViewerConfigurationDTD
- */
- public StructuredTextViewerConfigurationDTD() {
- // Must have empty constructor to createExecutableExtension
- super();
- }
-
- public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
- if (fConfiguredContentTypes == null) {
- fConfiguredContentTypes = new String[]{IDTDPartitions.DTD_DEFAULT, IStructuredPartitions.DEFAULT_PARTITION, IStructuredPartitions.UNKNOWN_PARTITION};
- }
- return fConfiguredContentTypes;
- }
-
- public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) {
- if (fLineStyleProviders == null) {
- fLineStyleProviders = new LineStyleProvider[]{createLineStyleProviderForDTD()};
- }
- return fLineStyleProviders;
- }
-
- private LineStyleProvider createLineStyleProviderForDTD() {
- return new LineStyleProviderForDTD();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIMessages.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIMessages.java
deleted file mode 100644
index 710f2c761c..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIMessages.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 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 - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- * Strings used by DTD UI
- *
- * @plannedfor 1.0
- */
-public class DTDUIMessages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.wst.dtd.ui.internal.DTDUIPluginResources";//$NON-NLS-1$
-
- public static String _UI_ACTION_ADD_ATTRIBUTELIST;
- public static String _UI_ACTION_ADD_DTD_NOTATION;
- public static String _UI_ACTION_ADD_DTD_ENTITY;
- public static String _UI_ACTION_ADD_DTD_ELEMENT;
- public static String _UI_ACTION_ADD_DTD_COMMENT;
- public static String _UI_ACTION_DTD_DELETE;
- public static String _UI_ACTION_ADD_ATTRIBUTE;
- public static String _UI_ACTION_GROUP_ADD_GROUP;
- public static String _UI_ACTION_ADD_ELEMENT;
- public static String _UI_BUTTON_GROUP_ITEMS_LOGICALLY;
- public static String _UI_BUTTON_SORT_ITEMS;
- public static String _UI_ACTION_ADD_PARAM_ENTITY_REF;
- public static String _UI_MOVE_ATTRIBUTE;
- public static String _UI_MOVE_CONTENT;
- public static String _UI_MOVE_NODE;
- public static String _UI_MOVE_NODES;
- public static String _ERROR_FILENAME_MUST_END_DTD;
- public static String Creating_files;
- public static String DTDFilesPreferencePage_ExtensionLabel;
- public static String DTDFilesPreferencePage_ExtensionError;
- public static String DTDColorPage_0;
- public static String DTDColorPage_1;
- public static String DTDColorPage_2;
- public static String DTDColorPage_3;
- public static String DTDColorPage_4;
- public static String DTDColorPage_5;
- public static String DTDColorPage_6;
- public static String DTDColorPage_7;
- public static String DTDColorPage_8;
- public static String DTDPropertySourceAdapter_0;
- public static String DTDPropertySourceAdapter_1;
- public static String DTDPropertySourceAdapter_2;
- public static String SourceMenu_label;
- public static String _UI_CREATE_NEW_DTD_FILE;
- public static String _UI_WIZARD_NEW_DTD_TITLE;
- public static String _UI_WIZARD_NEW_DTD_EXPL;
- public static String _UI_LABEL_DTD_FILE_DELETE;
- public static String ResourceGroup_nameExists;
- public static String NewDTDTemplatesWizardPage_0;
- public static String NewDTDTemplatesWizardPage_1;
- public static String NewDTDTemplatesWizardPage_2;
- public static String NewDTDTemplatesWizardPage_3;
- public static String NewDTDTemplatesWizardPage_4;
- public static String NewDTDTemplatesWizardPage_5;
- public static String NewDTDTemplatesWizardPage_6;
- public static String NewDTDTemplatesWizardPage_7;
- public static String SyntaxColoringPage_0;
- public static String SyntaxColoringPage_2;
- public static String SyntaxColoringPage_3;
- public static String SyntaxColoringPage_4;
- public static String SyntaxColoringPage_5;
- public static String SyntaxColoringPage_6;
- public static String _UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, DTDUIMessages.class);
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIPlugin.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIPlugin.java
deleted file mode 100644
index e76e6db423..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIPlugin.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal;
-
-import java.io.IOException;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jface.text.templates.ContextTypeRegistry;
-import org.eclipse.jface.text.templates.persistence.TemplateStore;
-import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry;
-import org.eclipse.ui.editors.text.templates.ContributionTemplateStore;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.wst.dtd.ui.internal.preferences.DTDUIPreferenceNames;
-import org.eclipse.wst.dtd.ui.internal.templates.TemplateContextTypeIdsDTD;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class DTDUIPlugin extends AbstractUIPlugin {
- // The shared instance.
- private static DTDUIPlugin plugin;
-
- /**
- * The template store for the dtd ui.
- */
- private TemplateStore fTemplateStore;
-
- /**
- * The template context type registry for dtd ui.
- */
- private ContextTypeRegistry fContextTypeRegistry;
-
- /**
- * Returns the shared instance.
- */
- public static DTDUIPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns the workspace instance.
- */
- public static IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- /**
- * The constructor.
- */
- public DTDUIPlugin() {
- super();
- plugin = this;
- }
-
- /**
- * Returns the template store for the dtd editor templates.
- *
- * @return the template store for the dtd editor templates
- */
- public TemplateStore getTemplateStore() {
- if (fTemplateStore == null) {
- fTemplateStore = new ContributionTemplateStore(getTemplateContextRegistry(), getPreferenceStore(), DTDUIPreferenceNames.TEMPLATES_KEY);
-
- try {
- fTemplateStore.load();
- } catch (IOException e) {
- Logger.logException(e);
- }
- }
- return fTemplateStore;
- }
-
- /**
- * Returns the template context type registry for the dtd plugin.
- *
- * @return the template context type registry for the dtd plugin
- */
- public ContextTypeRegistry getTemplateContextRegistry() {
- if (fContextTypeRegistry == null) {
- ContributionContextTypeRegistry registry = new ContributionContextTypeRegistry();
- registry.addContextType(TemplateContextTypeIdsDTD.NEW);
-
- fContextTypeRegistry = registry;
- }
-
- return fContextTypeRegistry;
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIPluginResources.properties b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIPluginResources.properties
deleted file mode 100644
index 26a34c66e1..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/DTDUIPluginResources.properties
+++ /dev/null
@@ -1,90 +0,0 @@
-###############################################################################
-# Copyright (c) 2005, 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
-###############################################################################
-
-_UI_ACTION_ADD_ATTRIBUTELIST=Add Attribute &List
-
-!DTDOutliner
-_UI_ACTION_ADD_DTD_NOTATION=Add &Notation
-_UI_ACTION_ADD_DTD_ENTITY=Add &Entity
-_UI_ACTION_ADD_DTD_ELEMENT=Add Ele&ment
-_UI_ACTION_ADD_DTD_COMMENT=Add &Comment
-_UI_ACTION_DTD_DELETE=&Delete
-_UI_ACTION_ADD_ATTRIBUTE=Add &Attribute
-_UI_ACTION_GROUP_ADD_GROUP=Add Group to Con&tent Model
-_UI_ACTION_ADD_ELEMENT=Add Element to C&ontent Model
-
-!DTDContentOutlinePage
-_UI_BUTTON_GROUP_ITEMS_LOGICALLY=Group items logically.
-_UI_BUTTON_SORT_ITEMS=Sort items alphabetically.
-
-!DTDContextContributer
-_UI_ACTION_ADD_PARAM_ENTITY_REF=Add &Parameter Entity Reference
-
-!DragAttributeCommand
-_UI_MOVE_ATTRIBUTE=Move Attribute
-
-!DragContentModelCommand
-_UI_MOVE_CONTENT=Move Content
-
-!DragTopLevelNodesCommand
-_UI_MOVE_NODE=Move Node
-_UI_MOVE_NODES=Move Nodes
-
-_ERROR_FILENAME_MUST_END_DTD=The file name must end in one of the following extensions {0}.
-
-#DTD File page
-Creating_files=Creating files
-DTDFilesPreferencePage_ExtensionLabel=Add this suffix (if not specified):
-DTDFilesPreferencePage_ExtensionError=Suffix must be one of the following {0}.
-
-#DTD Style page
-DTDColorPage_0=<!ELEMENT Main (One,Two+)>\r\n<!ELEMENT One (Three,Four)>\r\n<!ATTLIST One\r\n oneone CDATA #REQUIRED\r\n>\r\n<!-- You need this -->\r\n<!ELEMENT Two (moremore*)>\r\n<!ATTLIST Two\r\n twotwo CDATA #REQUIRED\r\n twothree (aaa | bbb) "aaa"\r\n>\r\n
-DTDColorPage_1=Comments
-DTDColorPage_2=Data
-DTDColorPage_3=Default
-DTDColorPage_4=Keywords
-DTDColorPage_5=Strings
-DTDColorPage_6=Symbols
-DTDColorPage_7=Tag Delimiters
-DTDColorPage_8=Tag Names
-DTDPropertySourceAdapter_0=Name
-DTDPropertySourceAdapter_1=Contents
-DTDPropertySourceAdapter_2=Attributes
-
-! NewDTDWizard.java
-_UI_CREATE_NEW_DTD_FILE = Create a new DTD file.
-_UI_WIZARD_NEW_DTD_TITLE = Create DTD
-_UI_WIZARD_NEW_DTD_EXPL = Create a new DTD file. Specify the folder and name for the file.
-
-# copied from dtd core
-_UI_LABEL_DTD_FILE_DELETE=Delete
-##
-ResourceGroup_nameExists = The same name already exists.
-NewDTDTemplatesWizardPage_0=Select DTD Template
-NewDTDTemplatesWizardPage_1=Select a template as initial content in the DTD page.
-NewDTDTemplatesWizardPage_2=Name
-NewDTDTemplatesWizardPage_3=Description
-NewDTDTemplatesWizardPage_4=&Use DTD Template
-NewDTDTemplatesWizardPage_5=&Preview:
-NewDTDTemplatesWizardPage_6=Templates are 'New DTD' templates found in the <a>DTD Templates</a> preference page.
-NewDTDTemplatesWizardPage_7=&Templates:
-
-SourceMenu_label=Source
-
-SyntaxColoringPage_0=Syntax Element:
-SyntaxColoringPage_2=Enable
-SyntaxColoringPage_3=&Bold
-SyntaxColoringPage_4=&Italic
-SyntaxColoringPage_5=&Strikethrough
-SyntaxColoringPage_6=&Underline
-
-_UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK=DTD preferences. Note that some preferences may be set on the <a>{0}</a> preference page.
-
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/Logger.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/Logger.java
deleted file mode 100644
index d224ef26f2..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/Logger.java
+++ /dev/null
@@ -1,143 +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.dtd.ui.internal;
-
-import com.ibm.icu.util.StringTokenizer;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.osgi.framework.Bundle;
-
-/**
- * Small convenience class to log messages to plugin's log file and also, if
- * desired, the console. This class should only be used by classes in this
- * plugin. Other plugins should make their own copy, with appropriate ID.
- */
-public class Logger {
- private static final String PLUGIN_ID = "org.eclipse.wst.dtd.ui"; //$NON-NLS-1$
-
- public static final int ERROR = IStatus.ERROR; // 4
- public static final int ERROR_DEBUG = 200 + ERROR;
- public static final int INFO = IStatus.INFO; // 1
- public static final int INFO_DEBUG = 200 + INFO;
-
- public static final int OK = IStatus.OK; // 0
-
- public static final int OK_DEBUG = 200 + OK;
-
- private static final String TRACEFILTER_LOCATION = "/debug/tracefilter"; //$NON-NLS-1$
- public static final int WARNING = IStatus.WARNING; // 2
- public static final int WARNING_DEBUG = 200 + WARNING;
-
- /**
- * Adds message to log.
- *
- * @param level
- * severity level of the message (OK, INFO, WARNING, ERROR,
- * OK_DEBUG, INFO_DEBUG, WARNING_DEBUG, ERROR_DEBUG)
- * @param message
- * text to add to the log
- * @param exception
- * exception thrown
- */
- protected static void _log(int level, String message, Throwable exception) {
- if (level == OK_DEBUG || level == INFO_DEBUG || level == WARNING_DEBUG || level == ERROR_DEBUG) {
- if (!isDebugging())
- return;
- }
-
- int severity = IStatus.OK;
- switch (level) {
- case INFO_DEBUG :
- case INFO :
- severity = IStatus.INFO;
- break;
- case WARNING_DEBUG :
- case WARNING :
- severity = IStatus.WARNING;
- break;
- case ERROR_DEBUG :
- case ERROR :
- severity = IStatus.ERROR;
- }
- Status statusObj = new Status(severity, PLUGIN_ID, severity, message, exception);
- Bundle bundle = Platform.getBundle(PLUGIN_ID);
- if (bundle != null)
- Platform.getLog(bundle).log(statusObj);
- }
-
- /**
- * Prints message to log if category matches /debug/tracefilter option.
- *
- * @param message
- * text to print
- * @param category
- * category of the message, to be compared with
- * /debug/tracefilter
- */
- protected static void _trace(String category, String message, Throwable exception) {
- if (!isDebugging())
- return;
-
- String traceFilter = Platform.getDebugOption(PLUGIN_ID + TRACEFILTER_LOCATION);
- if (traceFilter != null) {
- StringTokenizer tokenizer = new StringTokenizer(traceFilter, ","); //$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- String cat = tokenizer.nextToken().trim();
- if (category.equals(cat)) {
- Status statusObj = new Status(IStatus.OK, PLUGIN_ID, IStatus.OK, message, exception);
- Bundle bundle = Platform.getBundle(PLUGIN_ID);
- if (bundle != null)
- Platform.getLog(bundle).log(statusObj);
- return;
- }
- }
- }
- }
-
- /**
- * @return true if the platform is debugging
- */
- public static boolean isDebugging() {
- return Platform.inDebugMode();
- }
-
- public static void log(int level, String message) {
- _log(level, message, null);
- }
-
- public static void log(int level, String message, Throwable exception) {
- _log(level, message, exception);
- }
-
- public static void logException(String message, Throwable exception) {
- _log(ERROR, message, exception);
- }
-
- public static void logException(Throwable exception) {
- _log(ERROR, exception.getMessage(), exception);
- }
-
- public static void trace(String category, String message) {
- _trace(category, message, null);
- }
-
- public static void traceException(String category, String message, Throwable exception) {
- _trace(category, message, exception);
- }
-
- public static void traceException(String category, Throwable exception) {
- _trace(category, exception.getMessage(), exception);
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DTDDragAndDropManager.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DTDDragAndDropManager.java
deleted file mode 100644
index a95050d6a7..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DTDDragAndDropManager.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-
-
-package org.eclipse.wst.dtd.ui.internal.dnd;
-
-import java.util.Collection;
-
-import org.eclipse.wst.common.ui.internal.dnd.DragAndDropCommand;
-import org.eclipse.wst.common.ui.internal.dnd.DragAndDropManager;
-import org.eclipse.wst.dtd.core.internal.Attribute;
-import org.eclipse.wst.dtd.core.internal.CMNode;
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.TopLevelNode;
-
-public class DTDDragAndDropManager implements DragAndDropManager {
-
- public DragAndDropCommand createCommand(Object target, float location, int operations, int operation, Collection source) {
- if (target instanceof DTDNode) {
- DTDNode node = (DTDNode) target;
-
- if (node instanceof TopLevelNode) {
- return new DragTopLevelNodesCommand(target, location, operations, operation, source);
- }
- if (node instanceof Attribute) {
- return new DragAttributeCommand(target, location, operations, operation, source);
- }
- if (node instanceof CMNode) {
- return new DragContentModelCommand(target, location, operations, operation, source);
- }
-
- }
- return null;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragAttributeCommand.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragAttributeCommand.java
deleted file mode 100644
index 45511c1cf3..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragAttributeCommand.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.dnd;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.eclipse.wst.common.ui.internal.dnd.DefaultDragAndDropCommand;
-import org.eclipse.wst.dtd.core.internal.Attribute;
-import org.eclipse.wst.dtd.core.internal.AttributeList;
-import org.eclipse.wst.dtd.core.internal.DTDFile;
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.ui.internal.DTDUIMessages;
-
-
-
-public class DragAttributeCommand extends DefaultDragAndDropCommand {
-
- public DragAttributeCommand(Object target, float location, int operations, int operation, Collection sources) {
- super(target, location, operations, operation, sources);
- }
-
- public boolean canExecute() {
- Iterator iter = sources.iterator();
- while (iter.hasNext()) {
- Object source = iter.next();
- if (!(source instanceof Attribute)) {
- return false;
- }
- }
- return true;
- }
-
- public void execute() {
- DTDNode referenceNode = (DTDNode) target;
- DTDFile dtdFile = referenceNode.getDTDFile();
- if (referenceNode instanceof Attribute) {
- dtdFile.getDTDModel().beginRecording(this, DTDUIMessages._UI_MOVE_ATTRIBUTE); //$NON-NLS-1$
- AttributeList attList = (AttributeList) referenceNode.getParentNode();
- Iterator iter = sources.iterator();
- while (iter.hasNext()) {
- DTDNode node = (DTDNode) iter.next();
- if (node instanceof Attribute) {
- attList.insertIntoModel(this, (Attribute) referenceNode, (Attribute) node, isAfter());
- dtdFile.deleteNode(this, node);
- }
- }
- dtdFile.getDTDModel().endRecording(this);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragContentModelCommand.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragContentModelCommand.java
deleted file mode 100644
index 51cdb8735f..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragContentModelCommand.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-
-
-package org.eclipse.wst.dtd.ui.internal.dnd;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.wst.common.ui.internal.dnd.DefaultDragAndDropCommand;
-import org.eclipse.wst.dtd.core.internal.CMBasicNode;
-import org.eclipse.wst.dtd.core.internal.CMGroupNode;
-import org.eclipse.wst.dtd.core.internal.CMNode;
-import org.eclipse.wst.dtd.core.internal.DTDFile;
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.Element;
-import org.eclipse.wst.dtd.ui.internal.DTDUIMessages;
-
-
-public class DragContentModelCommand extends DefaultDragAndDropCommand {
-
- public DragContentModelCommand(Object target, float location, int operations, int operation, Collection sources) {
- super(target, location, operations, operation, sources);
- }
-
- public boolean canExecute() {
- if (!(target instanceof CMNode)) {
- return false;
- }
-
- Iterator iter = sources.iterator();
- while (iter.hasNext()) {
- Object source = iter.next();
- if (!(source instanceof CMNode)) {
- return false;
- }
- }
- return true;
- }
-
- public void execute() {
- DTDNode referenceNode = (DTDNode) target;
-
- if (referenceNode instanceof CMNode) {
- DTDFile dtdFile = referenceNode.getDTDFile();
-
- DTDNode parent = (DTDNode) referenceNode.getParentNode();
- dtdFile.getDTDModel().beginRecording(this, DTDUIMessages._UI_MOVE_CONTENT); //$NON-NLS-1$
- boolean parentIsElement = false;
- Element element = null;
- CMGroupNode group = null;
- if (parent instanceof Element) {
- parentIsElement = true;
- element = (Element) parent;
- }
- else {
- group = (CMGroupNode) parent;
- }
-
- if (element == null && group == null) {
- // no parent to add to
- return;
- }
-
- Iterator iter = sources.iterator();
- while (iter.hasNext()) {
- DTDNode node = (DTDNode) iter.next();
- if (node instanceof CMNode) {
- if (parentIsElement) {
- if (element.getContentModel() == node) {
- continue;
- }
- element.replaceContentModel(this, (CMNode) node);
- }
- else {
- if (referenceNode == node || (isAfter() && referenceNode.getNextSibling() == node) || (!isAfter() && node.getNextSibling() == referenceNode)) {
- continue;
- }
-
- group.insertIntoModel(this, (CMNode) referenceNode, (CMNode) node, isAfter());
-
- }
- DTDNode nodeParent = (DTDNode) node.getParentNode();
- nodeParent.delete(this, node);
- }
- }
- dtdFile.getDTDModel().endRecording(this);
- }
- }
-
- public int getFeedback() {
- DTDNode referenceNode = (DTDNode) target;
- if (referenceNode instanceof CMNode) {
- CMNode cmNode = (CMNode) referenceNode;
- if (cmNode.isRootElementContent() && cmNode instanceof CMBasicNode) {
- return DND.FEEDBACK_SELECT;
- }
- }
-
- return super.getFeedback();
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragTopLevelNodesCommand.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragTopLevelNodesCommand.java
deleted file mode 100644
index 59b872eff9..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/dnd/DragTopLevelNodesCommand.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-
-
-package org.eclipse.wst.dtd.ui.internal.dnd;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.eclipse.wst.common.ui.internal.dnd.DefaultDragAndDropCommand;
-import org.eclipse.wst.dtd.core.internal.DTDFile;
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.TopLevelNode;
-import org.eclipse.wst.dtd.ui.internal.DTDUIMessages;
-
-public class DragTopLevelNodesCommand extends DefaultDragAndDropCommand {
-
- static private final String moveNode = DTDUIMessages._UI_MOVE_NODE; //$NON-NLS-1$
- static private final String moveNodes = DTDUIMessages._UI_MOVE_NODES; //$NON-NLS-1$
-
- public DragTopLevelNodesCommand(Object target, float location, int operations, int operation, Collection sources) {
- super(target, location, operations, operation, sources);
- }
-
- public boolean canExecute() {
- if (!(target instanceof TopLevelNode)) {
- return false;
- }
-
- Iterator iter = sources.iterator();
- while (iter.hasNext()) {
- Object source = iter.next();
- if (!(source instanceof TopLevelNode)) {
- return false;
- }
- }
- return true;
- }
-
- public void execute() {
- DTDNode referenceNode = (DTDNode) target;
-
- DTDFile dtdFile = referenceNode.getDTDFile();
- dtdFile.getDTDModel().beginRecording(this, sources.size() > 1 ? moveNodes : moveNode);
- Iterator iter = sources.iterator();
- while (iter.hasNext()) {
- DTDNode node = (DTDNode) iter.next();
- if (node instanceof TopLevelNode) {
- dtdFile.moveNode(this, referenceNode, node, isAfter());
- }
- }
- dtdFile.getDTDModel().endRecording(this);
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/ActionContributorDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/ActionContributorDTD.java
deleted file mode 100644
index a624936ea5..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/ActionContributorDTD.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.editor;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.wst.dtd.ui.internal.DTDUIMessages;
-import org.eclipse.wst.sse.ui.internal.actions.ActionContributor;
-
-/**
- * XMLEditorActionContributor
- *
- * This class should not be used inside multi page editor's
- * ActionBarContributor, since cascaded init() call from the
- * ActionBarContributor will causes exception and it leads to lose whole
- * toolbars.
- *
- * Instead, use SourcePageActionContributor for source page contributor of
- * multi page editor.
- *
- * Note that this class is still valid for single page editor.
- */
-public class ActionContributorDTD extends ActionContributor {
- protected static final String[] EDITOR_IDS = {"org.eclipse.wst.dtd.core.dtdsource.source", "org.eclipse.wst.sse.ui.StructuredTextEditor"}; //$NON-NLS-1$ //$NON-NLS-2$
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.edit.util.ActionContributor#getExtensionIDs()
- */
- protected String[] getExtensionIDs() {
- return EDITOR_IDS;
- }
-
- protected void addToMenu(IMenuManager menu) {
- // edit commands
- IMenuManager editMenu = menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
- if (editMenu != null) {
- editMenu.add(fCommandsSeparator);
- editMenu.add(fToggleInsertModeAction);
- editMenu.add(fCommandsSeparator);
- editMenu.add(fExpandSelectionToMenu);
- editMenu.add(fCommandsSeparator);
- editMenu.add(fMenuAdditionsGroupMarker);
- }
-
- // source commands
- String sourceMenuLabel = DTDUIMessages.SourceMenu_label;
- String sourceMenuId = "sourceMenuId"; //$NON-NLS-1$
- IMenuManager sourceMenu = new MenuManager(sourceMenuLabel, sourceMenuId);
- menu.insertAfter(IWorkbenchActionConstants.M_EDIT, sourceMenu);
- if (sourceMenu != null) {
- sourceMenu.add(fCommandsSeparator);
- sourceMenu.add(fShiftRight);
- sourceMenu.add(fShiftLeft);
- sourceMenu.add(fCommandsSeparator);
- }
- IMenuManager navigateMenu = menu.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE);
- if (navigateMenu != null) {
- IMenuManager gotoGroup = navigateMenu.findMenuUsingPath(IWorkbenchActionConstants.GO_TO);
- if (gotoGroup != null) {
- gotoGroup.add(fGotoMatchingBracketAction);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImageHelper.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImageHelper.java
deleted file mode 100644
index 70d949d4cb..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImageHelper.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.editor;
-
-import java.util.HashMap;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin;
-
-
-/**
- * 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 DTDEditorPluginImageHelper {
- private static DTDEditorPluginImageHelper instance = null;
-
- /**
- * Gets the instance.
- *
- * @return Returns a DTDEditorPluginImageHelper
- */
- public synchronized static DTDEditorPluginImageHelper getInstance() {
- if (instance == null)
- instance = new DTDEditorPluginImageHelper();
- return instance;
- }
-
- // save a descriptor for each image
- private HashMap fImageDescRegistry = null;
- private final String PLUGINID = DTDUIPlugin.getDefault().getBundle().getSymbolicName();
-
- /**
- * 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 JFaceResources.getImageRegistry();
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImages.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImages.java
deleted file mode 100644
index bb2befbabb..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/DTDEditorPluginImages.java
+++ /dev/null
@@ -1,44 +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.dtd.ui.internal.editor;
-
-/**
- * Bundle of most images used by the DTD Source Editor plug-in.
- */
-public class DTDEditorPluginImages {
- public static final String IMG_CTOOL_ADD_ATTRIBUTE = "icons/full/ctool16/ADD_Attribute.gif"; //$NON-NLS-1$
-
- public static final String IMG_CTOOL_ADD_ELEMENT = "icons/full/ctool16/ADD_Element.gif"; //$NON-NLS-1$
-
- public static final String IMG_CTOOL_ADD_ELEMENTTOCONMODEL = "icons/full/ctool16/ADD_ElementToConModel.gif"; //$NON-NLS-1$
-
- public static final String IMG_CTOOL_ADD_GROUPTOCONMODEL = "icons/full/ctool16/ADD_GroupToConModel.gif"; //$NON-NLS-1$
- public static final String IMG_DTOOL_ADD_ATTRIBUTE = "icons/full/dtool16/ADD_Attribute.gif"; //$NON-NLS-1$
- public static final String IMG_DTOOL_ADD_ELEMENT = "icons/full/dtool16/ADD_Element.gif"; //$NON-NLS-1$
- public static final String IMG_DTOOL_ADD_ELEMENTTOCONMODEL = "icons/full/dtool16/ADD_ElementToConModel.gif"; //$NON-NLS-1$
- public static final String IMG_DTOOL_ADD_GROUPTOCONMODEL = "icons/full/dtool16/ADD_GroupToConModel.gif"; //$NON-NLS-1$
- public static final String IMG_ETOOL_ADD_ATTRIBUTE = "icons/full/etool16/ADD_Attribute.gif"; //$NON-NLS-1$
- public static final String IMG_ETOOL_ADD_ELEMENT = "icons/full/etool16/ADD_Element.gif"; //$NON-NLS-1$
- public static final String IMG_ETOOL_ADD_ELEMENTTOCONMODEL = "icons/full/etool16/ADD_ElementToConModel.gif"; //$NON-NLS-1$
- public static final String IMG_ETOOL_ADD_GROUPTOCONMODEL = "icons/full/etool16/ADD_GroupToConModel.gif"; //$NON-NLS-1$
-
- public static final String IMG_OBJ_ADD_COMMENT = "icons/full/obj16/ADD_Comment.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_ADD_ENTITY = "icons/full/obj16/ADD_Entity.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_ADD_ENTITY_REFERENCE = "icons/full/obj16/ADD_Entity_Reference.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_ADD_NOTATION = "icons/full/obj16/ADD_Notation.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_ORGANIZE_DTD_LOGICALLY = "icons/full/obj16/organize_dtd_logically.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_VALIDATE = "icons/full/obj16/validate.gif"; //$NON-NLS-1$
-
- public static final String IMG_WIZBAN_NEWDTDFILE = "icons/full/wizban/newdtdfile_wiz.png"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/IHelpContextIds.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/IHelpContextIds.java
deleted file mode 100644
index e0ce21090d..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/editor/IHelpContextIds.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.editor;
-
-import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin;
-
-/**
- * Help context ids for the DTD Source Editor.
- * <p>
- * This interface contains constants only; it is not intended to be
- * implemented.
- * </p>
- *
- */
-public interface IHelpContextIds {
-
- // org.eclipse.wst.dtd.ui.
- public static final String PREFIX = DTDUIPlugin.getDefault().getBundle().getSymbolicName() + "."; //$NON-NLS-1$
- // DTD Files Preference page
- public static final String DTD_PREFWEBX_FILES_HELPID = PREFIX + "webx0020"; //$NON-NLS-1$
- // DTD Styles Preference page
- public static final String DTD_PREFWEBX_STYLES_HELPID = PREFIX + "webx0021"; //$NON-NLS-1$
- // DTD Template Preference page (no id for this yet)
- public static final String DTD_PREFWEBX_TEMPLATES_HELPID = PREFIX + "webx0022"; //$NON-NLS-1$
-
- // // figured out on the fly
- // // DTD Source page editor
- // public static final String DTD_SOURCEVIEW_HELPID =
- // ContentTypeIdForDTD.ContentTypeID_DTD + "_source_HelpId"; //$NON-NLS-1$
-
- // DTD New File Wizard - Template Page
- public static final String DTD_NEWWIZARD_TEMPLATE_HELPID = PREFIX + "dtdw0010"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDColorPage.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDColorPage.java
deleted file mode 100644
index ed1855d55d..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDColorPage.java
+++ /dev/null
@@ -1,171 +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.dtd.ui.internal.preferences;
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.Iterator;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.dtd.core.internal.parser.DTDRegionTypes;
-import org.eclipse.wst.dtd.core.internal.provisional.contenttype.ContentTypeIdForDTD;
-import org.eclipse.wst.dtd.ui.internal.DTDUIMessages;
-import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin;
-import org.eclipse.wst.dtd.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.dtd.ui.internal.style.IStyleConstantsDTD;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
-import org.eclipse.wst.sse.ui.internal.preferences.OverlayPreferenceStore;
-import org.eclipse.wst.sse.ui.internal.preferences.OverlayPreferenceStore.OverlayKey;
-import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractColorPage;
-import org.eclipse.wst.sse.ui.internal.preferences.ui.StyledTextColorPicker;
-
-/**
- * @deprecated
- */
-public class DTDColorPage extends AbstractColorPage {
-
- protected Control createContents(Composite parent) {
- Composite pageComponent = createComposite(parent, 1);
- ((GridData) pageComponent.getLayoutData()).horizontalAlignment = GridData.HORIZONTAL_ALIGN_FILL;
-
- super.createContents(pageComponent);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(pageComponent, IHelpContextIds.DTD_PREFWEBX_STYLES_HELPID);
-
- return pageComponent;
- }
-
- /**
- * Set up all the style preference keys in the overlay store
- */
- protected OverlayKey[] createOverlayStoreKeys() {
- ArrayList overlayKeys = new ArrayList();
-
- ArrayList styleList = new ArrayList();
- initStyleList(styleList);
- Iterator i = styleList.iterator();
- while (i.hasNext()) {
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, (String) i.next()));
- }
-
- OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
- overlayKeys.toArray(keys);
- return keys;
- }
-
- protected IPreferenceStore doGetPreferenceStore() {
- return DTDUIPlugin.getDefault().getPreferenceStore();
- }
-
- public String getSampleText() {
- return DTDUIMessages.DTDColorPage_0; //$NON-NLS-1$
- }
-
- protected void initContextStyleMap(Dictionary contextStyleMap) {
- contextStyleMap.put(DTDRegionTypes.CONTENT_EMPTY, IStyleConstantsDTD.DTD_DATA);
- contextStyleMap.put(DTDRegionTypes.CONTENT_ANY, IStyleConstantsDTD.DTD_DATA);
- contextStyleMap.put(DTDRegionTypes.CONTENT_PCDATA, IStyleConstantsDTD.DTD_DATA);
- contextStyleMap.put(DTDRegionTypes.NDATA_VALUE, IStyleConstantsDTD.DTD_DATA);
- contextStyleMap.put(DTDRegionTypes.NAME, IStyleConstantsDTD.DTD_DATA);
- contextStyleMap.put(DTDRegionTypes.ENTITY_PARM, IStyleConstantsDTD.DTD_DATA);
-
- contextStyleMap.put(DTDRegionTypes.ELEMENT_TAG, IStyleConstantsDTD.DTD_TAGNAME);
- contextStyleMap.put(DTDRegionTypes.ENTITY_TAG, IStyleConstantsDTD.DTD_TAGNAME);
- contextStyleMap.put(DTDRegionTypes.ATTLIST_TAG, IStyleConstantsDTD.DTD_TAGNAME);
- contextStyleMap.put(DTDRegionTypes.NOTATION_TAG, IStyleConstantsDTD.DTD_TAGNAME);
-
- contextStyleMap.put(DTDRegionTypes.CONNECTOR, IStyleConstantsDTD.DTD_SYMBOL);
- contextStyleMap.put(DTDRegionTypes.OCCUR_TYPE, IStyleConstantsDTD.DTD_SYMBOL);
-
- contextStyleMap.put(DTDRegionTypes.START_TAG, IStyleConstantsDTD.DTD_TAG);
- contextStyleMap.put(DTDRegionTypes.END_TAG, IStyleConstantsDTD.DTD_TAG);
- contextStyleMap.put(DTDRegionTypes.EXCLAMATION, IStyleConstantsDTD.DTD_TAG);
-
- contextStyleMap.put(DTDRegionTypes.COMMENT_START, IStyleConstantsDTD.DTD_COMMENT);
- contextStyleMap.put(DTDRegionTypes.COMMENT_CONTENT, IStyleConstantsDTD.DTD_COMMENT);
- contextStyleMap.put(DTDRegionTypes.COMMENT_END, IStyleConstantsDTD.DTD_COMMENT);
-
- contextStyleMap.put(DTDRegionTypes.SINGLEQUOTED_LITERAL, IStyleConstantsDTD.DTD_STRING);
- contextStyleMap.put(DTDRegionTypes.DOUBLEQUOTED_LITERAL, IStyleConstantsDTD.DTD_STRING);
-
- contextStyleMap.put(DTDRegionTypes.SYSTEM_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- contextStyleMap.put(DTDRegionTypes.PUBLIC_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- contextStyleMap.put(DTDRegionTypes.NDATA_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- contextStyleMap.put(DTDRegionTypes.CDATA_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- contextStyleMap.put(DTDRegionTypes.ID_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- contextStyleMap.put(DTDRegionTypes.IDREF_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- contextStyleMap.put(DTDRegionTypes.IDREFS_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- contextStyleMap.put(DTDRegionTypes.ENTITY_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- contextStyleMap.put(DTDRegionTypes.ENTITIES_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- contextStyleMap.put(DTDRegionTypes.NMTOKEN_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- contextStyleMap.put(DTDRegionTypes.NMTOKENS_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- contextStyleMap.put(DTDRegionTypes.NOTATION_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- contextStyleMap.put(DTDRegionTypes.REQUIRED_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- contextStyleMap.put(DTDRegionTypes.IMPLIED_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- contextStyleMap.put(DTDRegionTypes.FIXED_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- }
-
- protected void initDescriptions(Dictionary descriptions) {
- descriptions.put(IStyleConstantsDTD.DTD_COMMENT, DTDUIMessages.DTDColorPage_1); //$NON-NLS-1$
- descriptions.put(IStyleConstantsDTD.DTD_DATA, DTDUIMessages.DTDColorPage_2); //$NON-NLS-1$
- descriptions.put(IStyleConstantsDTD.DTD_DEFAULT, DTDUIMessages.DTDColorPage_3); //$NON-NLS-1$
- descriptions.put(IStyleConstantsDTD.DTD_KEYWORD, DTDUIMessages.DTDColorPage_4); //$NON-NLS-1$
- descriptions.put(IStyleConstantsDTD.DTD_STRING, DTDUIMessages.DTDColorPage_5); //$NON-NLS-1$
- descriptions.put(IStyleConstantsDTD.DTD_SYMBOL, DTDUIMessages.DTDColorPage_6); //$NON-NLS-1$
- descriptions.put(IStyleConstantsDTD.DTD_TAG, DTDUIMessages.DTDColorPage_7); //$NON-NLS-1$
- descriptions.put(IStyleConstantsDTD.DTD_TAGNAME, DTDUIMessages.DTDColorPage_8); //$NON-NLS-1$
- }
-
- protected void initStyleList(ArrayList list) {
- list.add(IStyleConstantsDTD.DTD_COMMENT);
- list.add(IStyleConstantsDTD.DTD_DATA);
- list.add(IStyleConstantsDTD.DTD_DEFAULT);
- list.add(IStyleConstantsDTD.DTD_KEYWORD);
- list.add(IStyleConstantsDTD.DTD_STRING);
- list.add(IStyleConstantsDTD.DTD_SYMBOL);
- list.add(IStyleConstantsDTD.DTD_TAG);
- list.add(IStyleConstantsDTD.DTD_TAGNAME);
- }
-
- protected void setupPicker(StyledTextColorPicker picker) {
- IModelManager mmanager = StructuredModelManager.getModelManager();
- picker.setParser(mmanager.createStructuredDocumentFor(ContentTypeIdForDTD.ContentTypeID_DTD).getParser());
-
- Dictionary descriptions = new Hashtable();
- initDescriptions(descriptions);
-
- Dictionary contextStyleMap = new Hashtable();
- initContextStyleMap(contextStyleMap);
-
- ArrayList styleList = new ArrayList();
- initStyleList(styleList);
-
- picker.setContextStyleMap(contextStyleMap);
- picker.setDescriptions(descriptions);
- picker.setStyleList(styleList);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.preferences.ui.AbstractColorPage#savePreferences()
- */
- protected void savePreferences() {
- DTDUIPlugin.getDefault().savePluginPreferences();
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDFilesPreferencePage.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDFilesPreferencePage.java
deleted file mode 100644
index 7bff14c6cc..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDFilesPreferencePage.java
+++ /dev/null
@@ -1,160 +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.dtd.ui.internal.preferences;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferenceLinkArea;
-import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
-import org.eclipse.wst.dtd.core.internal.DTDCorePlugin;
-import org.eclipse.wst.dtd.core.internal.preferences.DTDCorePreferenceNames;
-import org.eclipse.wst.dtd.core.internal.provisional.contenttype.ContentTypeIdForDTD;
-import org.eclipse.wst.dtd.ui.internal.DTDUIMessages;
-import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin;
-import org.eclipse.wst.dtd.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage;
-
-
-public class DTDFilesPreferencePage extends AbstractPreferencePage {
- private Combo fDefaultSuffix = null;
- private List fValidExtensions = null;
-
- protected Control createContents(final Composite parent) {
- Composite composite = super.createComposite(parent, 1);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.DTD_PREFWEBX_FILES_HELPID);
-
- new PreferenceLinkArea(composite, SWT.WRAP | SWT.MULTI, "org.eclipse.wst.sse.ui.preferences.editor", DTDUIMessages._UI_STRUCTURED_TEXT_EDITOR_PREFS_LINK,//$NON-NLS-1$
- (IWorkbenchPreferenceContainer) getContainer(), null).getControl().setLayoutData(GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).create());
- new Label(composite, SWT.NONE).setLayoutData(GridDataFactory.swtDefaults().create());
-
-
- Group creatingGroup = createGroup(composite, 2);
- creatingGroup.setText(DTDUIMessages.Creating_files);
-
- // Default extension for New file Wizard
- createLabel(creatingGroup, DTDUIMessages.DTDFilesPreferencePage_ExtensionLabel);
- fDefaultSuffix = createDropDownBox(creatingGroup);
- String[] validExtensions = (String[]) getValidExtensions().toArray(new String[0]);
- Arrays.sort(validExtensions);
- fDefaultSuffix.setItems(validExtensions);
- fDefaultSuffix.addSelectionListener(this);
-
- setSize(composite);
- loadPreferences();
-
- return composite;
- }
-
- public void dispose() {
- fDefaultSuffix.removeModifyListener(this);
- super.dispose();
- }
-
- protected IPreferenceStore doGetPreferenceStore() {
- return DTDUIPlugin.getDefault().getPreferenceStore();
- }
-
- protected void doSavePreferenceStore() {
- DTDCorePlugin.getInstance().savePluginPreferences(); // model
- }
-
- /**
- * Get content type associated with this new file wizard
- *
- * @return IContentType
- */
- private IContentType getContentType() {
- return Platform.getContentTypeManager().getContentType(ContentTypeIdForDTD.ContentTypeID_DTD);
- }
-
- /**
- * Get list of valid extensions
- *
- * @return List
- */
- private List getValidExtensions() {
- if (fValidExtensions == null) {
- IContentType type = getContentType();
- fValidExtensions = new ArrayList(Arrays.asList(type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC)));
- }
- return fValidExtensions;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.preferences.ui.AbstractPreferencePage#getModelPreferences()
- */
- protected Preferences getModelPreferences() {
- return DTDCorePlugin.getInstance().getPluginPreferences();
- }
-
- protected void initializeValues() {
- String suffix = getModelPreferences().getString(DTDCorePreferenceNames.DEFAULT_EXTENSION);
- fDefaultSuffix.setText(suffix);
- }
-
- protected void performDefaults() {
- String suffix = getModelPreferences().getDefaultString(DTDCorePreferenceNames.DEFAULT_EXTENSION);
- fDefaultSuffix.setText(suffix);
-
- super.performDefaults();
- }
-
- public boolean performOk() {
- boolean result = super.performOk();
-
- doSavePreferenceStore();
-
- return result;
- }
-
- protected void storeValues() {
- String suffix = fDefaultSuffix.getText();
- getModelPreferences().setValue(DTDCorePreferenceNames.DEFAULT_EXTENSION, suffix);
- }
-
- protected void validateValues() {
- boolean isValid = false;
- Iterator i = getValidExtensions().iterator();
- while (i.hasNext() && !isValid) {
- String extension = (String) i.next();
- isValid = extension.equalsIgnoreCase(fDefaultSuffix.getText());
- }
-
- if (!isValid) {
- setErrorMessage(NLS.bind(DTDUIMessages.DTDFilesPreferencePage_ExtensionError, getValidExtensions().toString()));
- setValid(false);
- }
- else {
- setErrorMessage(null);
- setValid(true);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDSyntaxColoringPage.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDSyntaxColoringPage.java
deleted file mode 100644
index a675cbd575..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDSyntaxColoringPage.java
+++ /dev/null
@@ -1,855 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.preferences;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jface.preference.ColorSelector;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.ACC;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.wst.dtd.core.internal.parser.DTDRegionTypes;
-import org.eclipse.wst.dtd.core.internal.provisional.contenttype.ContentTypeIdForDTD;
-import org.eclipse.wst.dtd.ui.internal.DTDUIMessages;
-import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin;
-import org.eclipse.wst.dtd.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.dtd.ui.internal.style.IStyleConstantsDTD;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-import org.eclipse.wst.sse.ui.internal.SSEUIPlugin;
-import org.eclipse.wst.sse.ui.internal.preferences.OverlayPreferenceStore;
-import org.eclipse.wst.sse.ui.internal.preferences.OverlayPreferenceStore.OverlayKey;
-import org.eclipse.wst.sse.ui.internal.preferences.ui.ColorHelper;
-import org.eclipse.wst.sse.ui.internal.util.EditorUtility;
-
-import com.ibm.icu.text.Collator;
-
-/**
- * A preference page to configure our XML syntax color. It resembles the JDT
- * and CDT pages far more than our original color page while retaining the
- * extra "click-to-find" functionality.
- */
-public final class DTDSyntaxColoringPage extends PreferencePage implements IWorkbenchPreferencePage {
-
- private Button fBold;
- private Label fForegroundLabel;
- private Label fBackgroundLabel;
- private Button fClearStyle;
- private Map fContextToStyleMap;
- private Color fDefaultForeground = null;
- private Color fDefaultBackground = null;
- private IStructuredDocument fDocument;
- private ColorSelector fForegroundColorEditor;
- private ColorSelector fBackgroundColorEditor;
- private Button fItalic;
- private OverlayPreferenceStore fOverlayStore;
- private Button fStrike;
- private Collection fStylePreferenceKeys;
- private StructuredViewer fStylesViewer = null;
- private Map fStyleToDescriptionMap;
- private StyledText fText;
- private Button fUnderline;
-
- // activate controls based on the given local color type
- private void activate(String namedStyle) {
- Color foreground = fDefaultForeground;
- Color background = fDefaultBackground;
- if (namedStyle == null) {
- fClearStyle.setEnabled(false);
- fBold.setEnabled(false);
- fItalic.setEnabled(false);
- fStrike.setEnabled(false);
- fUnderline.setEnabled(false);
- fForegroundLabel.setEnabled(false);
- fBackgroundLabel.setEnabled(false);
- fForegroundColorEditor.setEnabled(false);
- fBackgroundColorEditor.setEnabled(false);
- fBold.setSelection(false);
- fItalic.setSelection(false);
- fStrike.setSelection(false);
- fUnderline.setSelection(false);
- }
- else {
- TextAttribute attribute = getAttributeFor(namedStyle);
- fClearStyle.setEnabled(true);
- fBold.setEnabled(true);
- fItalic.setEnabled(true);
- fStrike.setEnabled(true);
- fUnderline.setEnabled(true);
- fForegroundLabel.setEnabled(true);
- fBackgroundLabel.setEnabled(true);
- fForegroundColorEditor.setEnabled(true);
- fBackgroundColorEditor.setEnabled(true);
- fBold.setSelection((attribute.getStyle() & SWT.BOLD) != 0);
- fItalic.setSelection((attribute.getStyle() & SWT.ITALIC) != 0);
- fStrike.setSelection((attribute.getStyle() & TextAttribute.STRIKETHROUGH) != 0);
- fUnderline.setSelection((attribute.getStyle() & TextAttribute.UNDERLINE) != 0);
- if (attribute.getForeground() != null) {
- foreground = attribute.getForeground();
- }
- if (attribute.getBackground() != null) {
- background = attribute.getBackground();
- }
- }
-
- fForegroundColorEditor.setColorValue(foreground.getRGB());
- fBackgroundColorEditor.setColorValue(background.getRGB());
- }
-
- /**
- * Color the text in the sample area according to the current preferences
- */
- void applyStyles() {
- if (fText == null || fText.isDisposed())
- return;
- IStructuredDocumentRegion documentRegion = fDocument.getFirstStructuredDocumentRegion();
- while (documentRegion != null) {
- ITextRegionList regions = documentRegion.getRegions();
- for (int i = 0; i < regions.size(); i++) {
- ITextRegion currentRegion = regions.get(i);
- // lookup the local coloring type and apply it
- String namedStyle = (String) fContextToStyleMap.get(currentRegion.getType());
- if (namedStyle == null)
- continue;
- TextAttribute attribute = getAttributeFor(namedStyle);
- if (attribute == null)
- continue;
- StyleRange style = new StyleRange(documentRegion.getStartOffset(currentRegion), currentRegion.getTextLength(), attribute.getForeground(), attribute.getBackground(), attribute.getStyle());
- style.strikeout = (attribute.getStyle() & TextAttribute.STRIKETHROUGH) != 0;
- style.underline = (attribute.getStyle() & TextAttribute.UNDERLINE) != 0;
- fText.setStyleRange(style);
- }
- documentRegion = documentRegion.getNext();
- }
- }
-
- Button createCheckbox(Composite parent, String label) {
- Button button = new Button(parent, SWT.CHECK);
- button.setText(label);
- button.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- return button;
- }
-
- /**
- * Creates composite control and sets the default layout data.
- */
- private Composite createComposite(Composite parent, int numColumns) {
- Composite composite = new Composite(parent, SWT.NULL);
-
- // GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- layout.makeColumnsEqualWidth = false;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
-
- // GridData
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
- composite.setLayoutData(data);
- return composite;
- }
-
- protected Control createContents(final Composite parent) {
- initializeDialogUnits(parent);
-
- fDefaultForeground = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND);
- fDefaultBackground = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
- Composite pageComponent = createComposite(parent, 2);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(pageComponent, IHelpContextIds.DTD_PREFWEBX_STYLES_HELPID);
-
- Link link = new Link(pageComponent, SWT.WRAP);
- link.setText(SSEUIMessages.SyntaxColoring_Link);
- link.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- PreferencesUtil.createPreferenceDialogOn(parent.getShell(), e.text, null, null);
- }
- });
-
- GridData linkData= new GridData(SWT.FILL, SWT.BEGINNING, true, false, 2, 1);
- linkData.widthHint= 150; // only expand further if anyone else requires it
- link.setLayoutData(linkData);
-
- new Label(pageComponent, SWT.NONE).setLayoutData(new GridData());
- new Label(pageComponent, SWT.NONE).setLayoutData(new GridData());
-
- SashForm editor = new SashForm(pageComponent, SWT.VERTICAL);
- GridData gridData2 = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData2.horizontalSpan = 2;
- editor.setLayoutData(gridData2);
- SashForm top = new SashForm(editor, SWT.HORIZONTAL);
- Composite styleEditor = createComposite(top, 1);
- ((GridLayout) styleEditor.getLayout()).marginRight = 5;
- ((GridLayout) styleEditor.getLayout()).marginLeft = 0;
- createLabel(styleEditor, DTDUIMessages.SyntaxColoringPage_0);
- fStylesViewer = createStylesViewer(styleEditor);
- GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData.horizontalIndent = 0;
- Iterator iterator = fStyleToDescriptionMap.values().iterator();
- while (iterator.hasNext()) {
- gridData.widthHint = Math.max(gridData.widthHint, convertWidthInCharsToPixels(iterator.next().toString().length()));
- }
- gridData.heightHint = convertHeightInCharsToPixels(5);
- fStylesViewer.getControl().setLayoutData(gridData);
-
- Composite editingComposite = createComposite(top, 1);
- ((GridLayout) styleEditor.getLayout()).marginLeft = 5;
- createLabel(editingComposite, ""); //$NON-NLS-1$
- Button enabler = createCheckbox(editingComposite, DTDUIMessages.SyntaxColoringPage_2);
- enabler.setEnabled(false);
- enabler.setSelection(true);
- Composite editControls = createComposite(editingComposite, 2);
- ((GridLayout) editControls.getLayout()).marginLeft = 20;
-
- fForegroundLabel = createLabel(editControls, SSEUIMessages.Foreground_UI_);
- ((GridData) fForegroundLabel.getLayoutData()).verticalAlignment = SWT.CENTER;
- fForegroundLabel.setEnabled(false);
-
- fForegroundColorEditor = new ColorSelector(editControls);
- Button fForegroundColor = fForegroundColorEditor.getButton();
- GridData gd = new GridData(SWT.BEGINNING, SWT.FILL, false, false);
- fForegroundColor.setLayoutData(gd);
- fForegroundColorEditor.setEnabled(false);
-
- fBackgroundLabel = createLabel(editControls, SSEUIMessages.Background_UI_);
- ((GridData) fBackgroundLabel.getLayoutData()).verticalAlignment = SWT.CENTER;
- fBackgroundLabel.setEnabled(false);
-
- fBackgroundColorEditor = new ColorSelector(editControls);
- Button fBackgroundColor = fBackgroundColorEditor.getButton();
- gd = new GridData(SWT.BEGINNING, SWT.FILL, false, false);
- fBackgroundColor.setLayoutData(gd);
- fBackgroundColorEditor.setEnabled(false);
-
- fBold = createCheckbox(editControls, DTDUIMessages.SyntaxColoringPage_3);
- fBold.setEnabled(false);
- ((GridData) fBold.getLayoutData()).horizontalSpan = 2;
- fItalic = createCheckbox(editControls, DTDUIMessages.SyntaxColoringPage_4);
- fItalic.setEnabled(false);
- ((GridData) fItalic.getLayoutData()).horizontalSpan = 2;
- fStrike = createCheckbox(editControls, DTDUIMessages.SyntaxColoringPage_5);
- fStrike.setEnabled(false);
- ((GridData) fStrike.getLayoutData()).horizontalSpan = 2;
- fUnderline = createCheckbox(editControls, DTDUIMessages.SyntaxColoringPage_6);
- fUnderline.setEnabled(false);
- ((GridData) fUnderline.getLayoutData()).horizontalSpan = 2;
- fClearStyle = new Button(editingComposite, SWT.PUSH);
- fClearStyle.setText(SSEUIMessages.Restore_Default_UI_); //$NON-NLS-1$ = "Restore Default"
- fClearStyle.setLayoutData(new GridData(SWT.BEGINNING));
- ((GridData)fClearStyle.getLayoutData()).horizontalIndent = 20;
- fClearStyle.setEnabled(false);
-
- Composite sampleArea = createComposite(editor, 1);
-
- ((GridLayout) sampleArea.getLayout()).marginLeft = 5;
- ((GridLayout) sampleArea.getLayout()).marginTop = 5;
- createLabel(sampleArea, SSEUIMessages.Sample_text__UI_); //$NON-NLS-1$ = "&Sample text:"
- SourceViewer viewer = new SourceViewer(sampleArea, null, SWT.BORDER | SWT.LEFT_TO_RIGHT | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY);
- fText = viewer.getTextWidget();
- GridData gridData3 = new GridData(SWT.FILL, SWT.FILL, true, true);
- gridData3.widthHint = convertWidthInCharsToPixels(20);
- gridData3.heightHint = convertHeightInCharsToPixels(5);
- gridData3.horizontalSpan = 2;
- fText.setLayoutData(gridData3);
- fText.setEditable(false);
- fText.setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont"));//$NON-NLS-1$
- fText.addKeyListener(getTextKeyListener());
- fText.addSelectionListener(getTextSelectionListener());
- fText.addMouseListener(getTextMouseListener());
- fText.addTraverseListener(getTraverseListener());
- setAccessible(fText, SSEUIMessages.Sample_text__UI_);
- fDocument = StructuredModelManager.getModelManager().createStructuredDocumentFor(ContentTypeIdForDTD.ContentTypeID_DTD);
- fDocument.set(getExampleText());
- viewer.setDocument(fDocument);
-
- top.setWeights(new int[]{1, 1});
- editor.setWeights(new int[]{1, 1});
- PlatformUI.getWorkbench().getHelpSystem().setHelp(pageComponent, IHelpContextIds.DTD_PREFWEBX_STYLES_HELPID);
-
- fStylesViewer.setInput(getStylePreferenceKeys());
-
- applyStyles();
-
- fStylesViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- if (!event.getSelection().isEmpty()) {
- Object o = ((IStructuredSelection) event.getSelection()).getFirstElement();
- String namedStyle = o.toString();
- activate(namedStyle);
- if (namedStyle == null)
- return;
- }
- }
- });
-
- fForegroundColorEditor.addListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(ColorSelector.PROP_COLORCHANGE)) {
- Object o = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement();
- String namedStyle = o.toString();
- String prefString = getOverlayStore().getString(namedStyle);
- String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
- if (stylePrefs != null) {
- String oldValue = stylePrefs[0];
- // open color dialog to get new color
- String newValue = ColorHelper.toRGBString(fForegroundColorEditor.getColorValue());
-
- if (!newValue.equals(oldValue)) {
- stylePrefs[0] = newValue;
- String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
- getOverlayStore().setValue(namedStyle, newPrefString);
- applyStyles();
- fText.redraw();
- }
- }
- }
- }
- });
-
- fBackgroundColorEditor.addListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(ColorSelector.PROP_COLORCHANGE)) {
- Object o = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement();
- String namedStyle = o.toString();
- String prefString = getOverlayStore().getString(namedStyle);
- String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
- if (stylePrefs != null) {
- String oldValue = stylePrefs[1];
- // open color dialog to get new color
- String newValue = ColorHelper.toRGBString(fBackgroundColorEditor.getColorValue());
-
- if (!newValue.equals(oldValue)) {
- stylePrefs[1] = newValue;
- String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
- getOverlayStore().setValue(namedStyle, newPrefString);
- applyStyles();
- fText.redraw();
- activate(namedStyle);
- }
- }
- }
- }
- });
-
- fBold.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- super.widgetSelected(e);
- // get current (newly old) style
- Object o = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement();
- String namedStyle = o.toString();
- String prefString = getOverlayStore().getString(namedStyle);
- String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
- if (stylePrefs != null) {
- String oldValue = stylePrefs[2];
- String newValue = String.valueOf(fBold.getSelection());
- if (!newValue.equals(oldValue)) {
- stylePrefs[2] = newValue;
- String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
- getOverlayStore().setValue(namedStyle, newPrefString);
- applyStyles();
- fText.redraw();
- }
- }
- }
- });
-
- fItalic.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- super.widgetSelected(e);
- // get current (newly old) style
- Object o = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement();
- String namedStyle = o.toString();
- String prefString = getOverlayStore().getString(namedStyle);
- String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
- if (stylePrefs != null) {
- String oldValue = stylePrefs[3];
- String newValue = String.valueOf(fItalic.getSelection());
- if (!newValue.equals(oldValue)) {
- stylePrefs[3] = newValue;
- String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
- getOverlayStore().setValue(namedStyle, newPrefString);
- applyStyles();
- fText.redraw();
- }
- }
- }
- });
-
- fStrike.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- super.widgetSelected(e);
- // get current (newly old) style
- Object o = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement();
- String namedStyle = o.toString();
- String prefString = getOverlayStore().getString(namedStyle);
- String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
- if (stylePrefs != null) {
- String oldValue = stylePrefs[4];
- String newValue = String.valueOf(fStrike.getSelection());
- if (!newValue.equals(oldValue)) {
- stylePrefs[4] = newValue;
- String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
- getOverlayStore().setValue(namedStyle, newPrefString);
- applyStyles();
- fText.redraw();
- }
- }
- }
- });
-
- fUnderline.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- super.widgetSelected(e);
- // get current (newly old) style
- Object o = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement();
- String namedStyle = o.toString();
- String prefString = getOverlayStore().getString(namedStyle);
- String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
- if (stylePrefs != null) {
- String oldValue = stylePrefs[5];
- String newValue = String.valueOf(fUnderline.getSelection());
- if (!newValue.equals(oldValue)) {
- stylePrefs[5] = newValue;
- String newPrefString = ColorHelper.packStylePreferences(stylePrefs);
- getOverlayStore().setValue(namedStyle, newPrefString);
- applyStyles();
- fText.redraw();
- }
- }
- }
- });
-
- fClearStyle.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (fStylesViewer.getSelection().isEmpty())
- return;
- String namedStyle = ((IStructuredSelection) fStylesViewer.getSelection()).getFirstElement().toString();
- getOverlayStore().setToDefault(namedStyle);
- applyStyles();
- fText.redraw();
- activate(namedStyle);
- }
- });
-
- return pageComponent;
- }
-
- private Label createLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.WRAP);
- label.setText(text);
- GridData data = new GridData(SWT.FILL, SWT.FILL, false, false);
- label.setLayoutData(data);
- label.setBackground(parent.getBackground());
- return label;
- }
-
- // protected Label createDescriptionLabel(Composite parent) {
- // return null;
- // }
-
- /**
- * Set up all the style preference keys in the overlay store
- */
- private OverlayKey[] createOverlayStoreKeys() {
- List overlayKeys = new ArrayList();
-
- Iterator i = getStylePreferenceKeys().iterator();
- while (i.hasNext()) {
- overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, (String) i.next()));
- }
-
- OverlayPreferenceStore.OverlayKey[] keys = new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
- overlayKeys.toArray(keys);
- return keys;
- }
-
- /**
- * Creates the List viewer where we see the various syntax element display
- * names--would it ever be a Tree like JDT's?
- *
- * @param parent
- * @return
- */
- private StructuredViewer createStylesViewer(Composite parent) {
- StructuredViewer stylesViewer = new ListViewer(parent, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
- stylesViewer.setComparator(new ViewerComparator(Collator.getInstance()));
- stylesViewer.setLabelProvider(new LabelProvider() {
- public String getText(Object element) {
- Object description = fStyleToDescriptionMap.get(element);
- if (description != null)
- return description.toString();
- return super.getText(element);
- }
- });
- stylesViewer.setContentProvider(new ITreeContentProvider() {
- public void dispose() {
- }
-
- public Object[] getChildren(Object parentElement) {
- return getStylePreferenceKeys().toArray();
- }
-
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- public Object getParent(Object element) {
- return getStylePreferenceKeys();
- }
-
- public boolean hasChildren(Object element) {
- return false;
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- });
- return stylesViewer;
- }
-
- public void dispose() {
- if (fOverlayStore != null) {
- fOverlayStore.stop();
- }
- super.dispose();
- }
-
- protected IPreferenceStore doGetPreferenceStore() {
- return DTDUIPlugin.getDefault().getPreferenceStore();
- }
-
- private TextAttribute getAttributeFor(String namedStyle) {
- TextAttribute ta = new TextAttribute(fDefaultForeground, fDefaultBackground, SWT.NORMAL);
-
- if (namedStyle != null && fOverlayStore != null) {
- // note: "namedStyle" *is* the preference key
- String prefString = getOverlayStore().getString(namedStyle);
- String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
- if (stylePrefs != null) {
- RGB foreground = ColorHelper.toRGB(stylePrefs[0]);
- RGB background = ColorHelper.toRGB(stylePrefs[1]);
-
- int fontModifier = SWT.NORMAL;
-
- if (stylePrefs.length > 2) {
- boolean on = Boolean.valueOf(stylePrefs[2]).booleanValue();
- if (on)
- fontModifier = fontModifier | SWT.BOLD;
- }
- if (stylePrefs.length > 3) {
- boolean on = Boolean.valueOf(stylePrefs[3]).booleanValue();
- if (on)
- fontModifier = fontModifier | SWT.ITALIC;
- }
- if (stylePrefs.length > 4) {
- boolean on = Boolean.valueOf(stylePrefs[4]).booleanValue();
- if (on)
- fontModifier = fontModifier | TextAttribute.STRIKETHROUGH;
- }
- if (stylePrefs.length > 5) {
- boolean on = Boolean.valueOf(stylePrefs[5]).booleanValue();
- if (on)
- fontModifier = fontModifier | TextAttribute.UNDERLINE;
- }
-
- ta = new TextAttribute((foreground != null) ? EditorUtility.getColor(foreground) : null, (background != null) ? EditorUtility.getColor(background) : null, fontModifier);
- }
- }
- return ta;
- }
-
- private String getExampleText() {
- return DTDUIMessages.DTDColorPage_0;
- }
-
- private String getNamedStyleAtOffset(int offset) {
- // ensure the offset is clean
- if (offset >= fDocument.getLength())
- return getNamedStyleAtOffset(fDocument.getLength() - 1);
- else if (offset < 0)
- return getNamedStyleAtOffset(0);
- IStructuredDocumentRegion documentRegion = fDocument.getFirstStructuredDocumentRegion();
- while (documentRegion != null && !documentRegion.containsOffset(offset)) {
- documentRegion = documentRegion.getNext();
- }
- if (documentRegion != null) {
- // find the ITextRegion's Context at this offset
- ITextRegion interest = documentRegion.getRegionAtCharacterOffset(offset);
- if (interest == null)
- return null;
- if (offset > documentRegion.getTextEndOffset(interest))
- return null;
- String regionContext = interest.getType();
- if (regionContext == null)
- return null;
- // find the named style (internal/selectable name) for that
- // context
- String namedStyle = (String) fContextToStyleMap.get(regionContext);
- if (namedStyle != null) {
- return namedStyle;
- }
- }
- return null;
- }
-
- private OverlayPreferenceStore getOverlayStore() {
- return fOverlayStore;
- }
-
- private Collection getStylePreferenceKeys() {
- if (fStylePreferenceKeys == null) {
- List styles = new ArrayList();
- styles.add(IStyleConstantsDTD.DTD_COMMENT); //$NON-NLS-1$
- styles.add(IStyleConstantsDTD.DTD_DATA); //$NON-NLS-1$
- styles.add(IStyleConstantsDTD.DTD_DEFAULT); //$NON-NLS-1$
- styles.add(IStyleConstantsDTD.DTD_KEYWORD); //$NON-NLS-1$
- styles.add(IStyleConstantsDTD.DTD_STRING); //$NON-NLS-1$
- styles.add(IStyleConstantsDTD.DTD_SYMBOL); //$NON-NLS-1$
- styles.add(IStyleConstantsDTD.DTD_TAG); //$NON-NLS-1$
- styles.add(IStyleConstantsDTD.DTD_TAGNAME); //$NON-NLS-1$
- fStylePreferenceKeys = styles;
- }
- return fStylePreferenceKeys;
- }
-
- private KeyListener getTextKeyListener() {
- return new KeyListener() {
- public void keyPressed(KeyEvent e) {
- if (e.widget instanceof StyledText) {
- int x = ((StyledText) e.widget).getCaretOffset();
- selectColorAtOffset(x);
- }
- }
-
- public void keyReleased(KeyEvent e) {
- if (e.widget instanceof StyledText) {
- int x = ((StyledText) e.widget).getCaretOffset();
- selectColorAtOffset(x);
- }
- }
- };
- }
-
- private MouseListener getTextMouseListener() {
- return new MouseListener() {
- public void mouseDoubleClick(MouseEvent e) {
- }
-
- public void mouseDown(MouseEvent e) {
- }
-
- public void mouseUp(MouseEvent e) {
- if (e.widget instanceof StyledText) {
- int x = ((StyledText) e.widget).getCaretOffset();
- selectColorAtOffset(x);
- }
- }
- };
- }
-
- private SelectionListener getTextSelectionListener() {
- return new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- selectColorAtOffset(e.x);
- if (e.widget instanceof StyledText) {
- ((StyledText) e.widget).setSelection(e.x);
- }
- }
-
- public void widgetSelected(SelectionEvent e) {
- selectColorAtOffset(e.x);
- if (e.widget instanceof StyledText) {
- ((StyledText) e.widget).setSelection(e.x);
- }
- }
- };
- }
-
- private TraverseListener getTraverseListener() {
- return new TraverseListener() {
- /**
- * @see org.eclipse.swt.events.TraverseListener#keyTraversed(TraverseEvent)
- */
- public void keyTraversed(TraverseEvent e) {
- if (e.widget instanceof StyledText) {
- if ((e.detail == SWT.TRAVERSE_TAB_NEXT) || (e.detail == SWT.TRAVERSE_TAB_PREVIOUS))
- e.doit = true;
- }
- }
- };
- }
-
- public void init(IWorkbench workbench) {
- setDescription(SSEUIMessages.SyntaxColoring_Description);
-
- fStyleToDescriptionMap = new HashMap();
- fContextToStyleMap = new HashMap();
-
- initStyleToDescriptionMap();
- initRegionContextToStyleMap();
-
- fOverlayStore = new OverlayPreferenceStore(getPreferenceStore(), createOverlayStoreKeys());
- fOverlayStore.load();
- fOverlayStore.start();
- }
-
- private void initRegionContextToStyleMap() {
- fContextToStyleMap.put(DTDRegionTypes.CONTENT_EMPTY, IStyleConstantsDTD.DTD_DATA);
- fContextToStyleMap.put(DTDRegionTypes.CONTENT_ANY, IStyleConstantsDTD.DTD_DATA);
- fContextToStyleMap.put(DTDRegionTypes.CONTENT_PCDATA, IStyleConstantsDTD.DTD_DATA);
- fContextToStyleMap.put(DTDRegionTypes.NDATA_VALUE, IStyleConstantsDTD.DTD_DATA);
- fContextToStyleMap.put(DTDRegionTypes.NAME, IStyleConstantsDTD.DTD_DATA);
- fContextToStyleMap.put(DTDRegionTypes.ENTITY_PARM, IStyleConstantsDTD.DTD_DATA);
-
- fContextToStyleMap.put(DTDRegionTypes.ELEMENT_TAG, IStyleConstantsDTD.DTD_TAGNAME);
- fContextToStyleMap.put(DTDRegionTypes.ENTITY_TAG, IStyleConstantsDTD.DTD_TAGNAME);
- fContextToStyleMap.put(DTDRegionTypes.ATTLIST_TAG, IStyleConstantsDTD.DTD_TAGNAME);
- fContextToStyleMap.put(DTDRegionTypes.NOTATION_TAG, IStyleConstantsDTD.DTD_TAGNAME);
-
- fContextToStyleMap.put(DTDRegionTypes.CONNECTOR, IStyleConstantsDTD.DTD_SYMBOL);
- fContextToStyleMap.put(DTDRegionTypes.OCCUR_TYPE, IStyleConstantsDTD.DTD_SYMBOL);
-
- fContextToStyleMap.put(DTDRegionTypes.START_TAG, IStyleConstantsDTD.DTD_TAG);
- fContextToStyleMap.put(DTDRegionTypes.END_TAG, IStyleConstantsDTD.DTD_TAG);
- fContextToStyleMap.put(DTDRegionTypes.EXCLAMATION, IStyleConstantsDTD.DTD_TAG);
-
- fContextToStyleMap.put(DTDRegionTypes.COMMENT_START, IStyleConstantsDTD.DTD_COMMENT);
- fContextToStyleMap.put(DTDRegionTypes.COMMENT_CONTENT, IStyleConstantsDTD.DTD_COMMENT);
- fContextToStyleMap.put(DTDRegionTypes.COMMENT_END, IStyleConstantsDTD.DTD_COMMENT);
-
- fContextToStyleMap.put(DTDRegionTypes.SINGLEQUOTED_LITERAL, IStyleConstantsDTD.DTD_STRING);
- fContextToStyleMap.put(DTDRegionTypes.DOUBLEQUOTED_LITERAL, IStyleConstantsDTD.DTD_STRING);
-
- fContextToStyleMap.put(DTDRegionTypes.SYSTEM_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- fContextToStyleMap.put(DTDRegionTypes.PUBLIC_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- fContextToStyleMap.put(DTDRegionTypes.NDATA_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- fContextToStyleMap.put(DTDRegionTypes.CDATA_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- fContextToStyleMap.put(DTDRegionTypes.ID_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- fContextToStyleMap.put(DTDRegionTypes.IDREF_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- fContextToStyleMap.put(DTDRegionTypes.IDREFS_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- fContextToStyleMap.put(DTDRegionTypes.ENTITY_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- fContextToStyleMap.put(DTDRegionTypes.ENTITIES_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- fContextToStyleMap.put(DTDRegionTypes.NMTOKEN_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- fContextToStyleMap.put(DTDRegionTypes.NMTOKENS_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- fContextToStyleMap.put(DTDRegionTypes.NOTATION_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- fContextToStyleMap.put(DTDRegionTypes.REQUIRED_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- fContextToStyleMap.put(DTDRegionTypes.IMPLIED_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- fContextToStyleMap.put(DTDRegionTypes.FIXED_KEYWORD, IStyleConstantsDTD.DTD_KEYWORD);
- }
-
- private void initStyleToDescriptionMap() {
- fStyleToDescriptionMap.put(IStyleConstantsDTD.DTD_COMMENT, DTDUIMessages.DTDColorPage_1); //$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsDTD.DTD_DATA, DTDUIMessages.DTDColorPage_2); //$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsDTD.DTD_DEFAULT, DTDUIMessages.DTDColorPage_3); //$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsDTD.DTD_KEYWORD, DTDUIMessages.DTDColorPage_4); //$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsDTD.DTD_STRING, DTDUIMessages.DTDColorPage_5); //$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsDTD.DTD_SYMBOL, DTDUIMessages.DTDColorPage_6); //$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsDTD.DTD_TAG, DTDUIMessages.DTDColorPage_7); //$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsDTD.DTD_TAGNAME, DTDUIMessages.DTDColorPage_8); //$NON-NLS-1$
- }
-
- protected void performDefaults() {
- super.performDefaults();
- getOverlayStore().loadDefaults();
- applyStyles();
- fStylesViewer.setSelection(StructuredSelection.EMPTY);
- activate(null);
- fText.redraw();
- }
-
- public boolean performOk() {
- getOverlayStore().propagate();
-
- DTDUIPlugin.getDefault().savePluginPreferences();
- SSEUIPlugin.getDefault().savePluginPreferences();
- return true;
- }
-
- private void selectColorAtOffset(int offset) {
- String namedStyle = getNamedStyleAtOffset(offset);
- if (namedStyle != null) {
- fStylesViewer.setSelection(new StructuredSelection(namedStyle));
- fStylesViewer.reveal(namedStyle);
- }
- else {
- fStylesViewer.setSelection(StructuredSelection.EMPTY);
- }
- activate(namedStyle);
- }
-
- /**
- * Specifically set the reporting name of a control for accessibility
- */
- private void setAccessible(Control control, String name) {
- if (control == null)
- return;
- final String n = name;
- control.getAccessible().addAccessibleListener(new AccessibleAdapter() {
- public void getName(AccessibleEvent e) {
- if (e.childID == ACC.CHILDID_SELF)
- e.result = n;
- }
- });
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDTemplatePreferencePage.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDTemplatePreferencePage.java
deleted file mode 100644
index 8cca3874aa..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDTemplatePreferencePage.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 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
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.preferences;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.contentassist.ContentAssistant;
-import org.eclipse.jface.text.contentassist.IContentAssistant;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
-import org.eclipse.jface.text.templates.ContextTypeRegistry;
-import org.eclipse.jface.text.templates.Template;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.templates.TemplatePreferencePage;
-import org.eclipse.wst.dtd.core.internal.provisional.contenttype.ContentTypeIdForDTD;
-import org.eclipse.wst.dtd.ui.StructuredTextViewerConfigurationDTD;
-import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin;
-import org.eclipse.wst.dtd.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
-import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider;
-
-/**
- * Preference page for DTD templates
- */
-public class DTDTemplatePreferencePage extends TemplatePreferencePage {
-
- class DTDEditTemplateDialog extends EditTemplateDialog {
- public DTDEditTemplateDialog(Shell parent, Template template, boolean edit, boolean isNameModifiable, ContextTypeRegistry registry) {
- super(parent, template, edit, isNameModifiable, registry);
- }
-
- protected SourceViewer createViewer(Composite parent) {
- SourceViewerConfiguration sourceViewerConfiguration = new StructuredTextViewerConfiguration() {
- StructuredTextViewerConfiguration baseConfiguration = new StructuredTextViewerConfigurationDTD();
-
- public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
- return baseConfiguration.getConfiguredContentTypes(sourceViewer);
- }
-
- public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) {
- return baseConfiguration.getLineStyleProviders(sourceViewer, partitionType);
- }
-
- public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
- ContentAssistant assistant = new ContentAssistant();
- assistant.enableAutoActivation(true);
- assistant.enableAutoInsert(true);
- assistant.setContentAssistProcessor(getTemplateProcessor(), IDocument.DEFAULT_CONTENT_TYPE);
- return assistant;
- }
- };
- return doCreateViewer(parent, sourceViewerConfiguration);
- }
- }
-
- public DTDTemplatePreferencePage() {
- DTDUIPlugin dtdUIPlugin = DTDUIPlugin.getDefault();
-
- setPreferenceStore(dtdUIPlugin.getPreferenceStore());
- setTemplateStore(dtdUIPlugin.getTemplateStore());
- setContextTypeRegistry(dtdUIPlugin.getTemplateContextRegistry());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
- boolean ok = super.performOk();
- DTDUIPlugin.getDefault().savePluginPreferences();
- return ok;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.templates.TemplatePreferencePage#isShowFormatterSetting()
- */
- protected boolean isShowFormatterSetting() {
- // template formatting has not been implemented
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
- */
- protected Control createContents(Composite ancestor) {
- Control c = super.createContents(ancestor);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(c, IHelpContextIds.DTD_PREFWEBX_TEMPLATES_HELPID);
- return c;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.templates.TemplatePreferencePage#createViewer(org.eclipse.swt.widgets.Composite)
- */
- protected SourceViewer createViewer(Composite parent) {
- SourceViewerConfiguration sourceViewerConfiguration = new StructuredTextViewerConfiguration() {
- StructuredTextViewerConfiguration baseConfiguration = new StructuredTextViewerConfigurationDTD();
-
- public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
- return baseConfiguration.getConfiguredContentTypes(sourceViewer);
- }
-
- public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) {
- return baseConfiguration.getLineStyleProviders(sourceViewer, partitionType);
- }
- };
- return doCreateViewer(parent, sourceViewerConfiguration);
- }
-
- SourceViewer doCreateViewer(Composite parent, SourceViewerConfiguration viewerConfiguration) {
- SourceViewer viewer = null;
- String contentTypeID = ContentTypeIdForDTD.ContentTypeID_DTD;
- viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- ((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
- IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(contentTypeID);
- IDocument document = scratchModel.getStructuredDocument();
- viewer.configure(viewerConfiguration);
- viewer.setDocument(document);
- return viewer;
- }
-
- /**
- * Creates the edit dialog. Subclasses may override this method to provide
- * a custom dialog.
- *
- * @param template
- * the template being edited
- * @param edit
- * whether the dialog should be editable
- * @param isNameModifiable
- * whether the template name may be modified
- * @return the created or modified template, or <code>null</code> if the
- * edition failed
- * @since 3.1
- */
- protected Template editTemplate(Template template, boolean edit, boolean isNameModifiable) {
- EditTemplateDialog dialog = new DTDEditTemplateDialog(getShell(), template, edit, isNameModifiable, getContextTypeRegistry());
- if (dialog.open() == Window.OK) {
- return dialog.getTemplate();
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceInitializer.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceInitializer.java
deleted file mode 100644
index 3f6f2c645c..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceInitializer.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 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
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.preferences;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ColorRegistry;
-import org.eclipse.jface.text.templates.Template;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin;
-import org.eclipse.wst.dtd.ui.internal.style.IStyleConstantsDTD;
-import org.eclipse.wst.sse.ui.internal.preferences.ui.ColorHelper;
-
-/**
- * Sets default values for DTD UI preferences
- */
-public class DTDUIPreferenceInitializer extends AbstractPreferenceInitializer {
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
- */
- public void initializeDefaultPreferences() {
- IPreferenceStore store = DTDUIPlugin.getDefault().getPreferenceStore();
- ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
-
- // DTD Style Preferences
- String NOBACKGROUNDBOLD = " | null | false"; //$NON-NLS-1$
- String JUSTITALIC = " | null | false | true"; //$NON-NLS-1$
- String styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_DEFAULT, 0, 0, 0) + NOBACKGROUNDBOLD;
- store.setDefault(IStyleConstantsDTD.DTD_DEFAULT, styleValue); // black
-
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_TAG, 63, 63, 191) + NOBACKGROUNDBOLD;
- store.setDefault(IStyleConstantsDTD.DTD_TAG, styleValue); // blue
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_TAGNAME, 63, 63, 191) + NOBACKGROUNDBOLD;
- store.setDefault(IStyleConstantsDTD.DTD_TAGNAME, styleValue); // blue
-
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_COMMENT, 127, 127, 127) + NOBACKGROUNDBOLD;
- store.setDefault(IStyleConstantsDTD.DTD_COMMENT, styleValue); // grey
-
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_KEYWORD, 128, 0, 0) + NOBACKGROUNDBOLD;
- store.setDefault(IStyleConstantsDTD.DTD_KEYWORD, styleValue); // dark
- // red
-
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_STRING, 63, 159, 95) + JUSTITALIC;
- store.setDefault(IStyleConstantsDTD.DTD_STRING, styleValue); // green
-
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_DATA, 191, 95, 95) + NOBACKGROUNDBOLD;
- store.setDefault(IStyleConstantsDTD.DTD_DATA, styleValue); // light
- // red
-
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsDTD.DTD_SYMBOL, 128, 0, 0) + NOBACKGROUNDBOLD;
- store.setDefault(IStyleConstantsDTD.DTD_SYMBOL, styleValue); // dark
- // red
-
- // set default new xml file template to use in new file wizard
- /*
- * Need to find template name that goes with default template id (name
- * may change for differnt language)
- */
- String templateName = ""; //$NON-NLS-1$
- Template template = DTDUIPlugin.getDefault().getTemplateStore().findTemplateById("org.eclipse.wst.dtd.ui.internal.templates.xmldeclaration"); //$NON-NLS-1$
- if (template != null)
- templateName = template.getName();
- store.setDefault(DTDUIPreferenceNames.NEW_FILE_TEMPLATE_NAME, templateName);
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceNames.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceNames.java
deleted file mode 100644
index 73f2f71d8f..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/preferences/DTDUIPreferenceNames.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.preferences;
-
-/**
- * Preference keys for DTD UI
- */
-public class DTDUIPreferenceNames {
- private DTDUIPreferenceNames() {
- // cannot create instance
- }
- /**
- * The key to store customized templates.
- * <p>
- * Value is of type <code>String</code>.
- * </p>
- */
- public static final String TEMPLATES_KEY = "org.eclipse.wst.sse.ui.custom_templates"; //$NON-NLS-1$
-
- /**
- * The key to store the last template name used in new DTD file wizard.
- * Template name is stored instead of template id because user-created
- * templates do not have template ids.
- * <p>
- * Value is of type <code>String</code>.
- * </p>
- */
- public static final String NEW_FILE_TEMPLATE_NAME = "newFileTemplateName"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/projection/DTDFoldingStrategy.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/projection/DTDFoldingStrategy.java
deleted file mode 100644
index adc0739a00..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/projection/DTDFoldingStrategy.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 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.dtd.ui.internal.projection;
-
-import org.eclipse.jface.text.Position;
-import org.eclipse.wst.dtd.core.internal.Comment;
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.Unrecognized;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.ui.internal.projection.AbstractStructuredFoldingStrategy;
-import org.eclipse.wst.xml.ui.internal.projection.XMLCommentFoldingPosition;
-import org.eclipse.wst.xml.ui.internal.projection.XMLElementFoldingPosition;
-
-
-/**
- * A folding strategy for DTD structured documents.
- * See AbstractStructuredFoldingStrategy for more details.
- *
- * This strategy is rather lame because the DTD parser does not
- * create regions for syntax such as <[ ]> so folding on it
- * can not currently occur.
- */
-public class DTDFoldingStrategy extends AbstractStructuredFoldingStrategy {
-
- /**
- * Create an instance of the folding strategy.
- * Be sure to set the viewer and document after creation.
- */
- public DTDFoldingStrategy() {
- super();
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.internal.projection.AbstractFoldingStrategy#calcNewFoldPosition(org.eclipse.wst.sse.core.internal.provisional.IndexedRegion)
- */
- protected Position calcNewFoldPosition(IndexedRegion indexedRegion) {
- Position newPos = null;
-
- //only want to fold regions with a valid range
- if(indexedRegion.getStartOffset() >= 0 && indexedRegion.getLength() >= 0) {
- IStructuredDocumentRegion structRegion = ((DTDNode) indexedRegion).getStructuredDTDDocumentRegion();
- //if Comment then use comment folding position
- //else use element folding position
- if(indexedRegion instanceof Comment) {
- newPos = new XMLCommentFoldingPosition(structRegion);
- } else {
- newPos = new XMLElementFoldingPosition(structRegion);
- }
- }
- return newPos;
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.internal.projection.AbstractFoldingStrategy#indexedRegionValidType(org.eclipse.wst.sse.core.internal.provisional.IndexedRegion)
- */
- protected boolean indexedRegionValidType(IndexedRegion indexedRegion) {
- //can only fold DTDNodes
- return (indexedRegion instanceof DTDNode && !(indexedRegion instanceof Unrecognized));
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/registry/AdapterFactoryProviderForDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/registry/AdapterFactoryProviderForDTD.java
deleted file mode 100644
index 61a22f19c7..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/registry/AdapterFactoryProviderForDTD.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.registry;
-
-import org.eclipse.wst.dtd.core.internal.modelhandler.ModelHandlerForDTD;
-import org.eclipse.wst.sse.core.internal.ltk.modelhandler.IDocumentTypeHandler;
-import org.eclipse.wst.sse.core.internal.model.FactoryRegistry;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.ui.internal.provisional.registry.AdapterFactoryProvider;
-import org.eclipse.wst.sse.ui.internal.util.Assert;
-
-
-/**
- * @author nitin
- *
- * To change the template for this generated type comment go to
- * Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
- */
-public class AdapterFactoryProviderForDTD implements AdapterFactoryProvider {
-
- /**
- *
- */
- public AdapterFactoryProviderForDTD() {
- super();
- }
-
- /*
- * @see AdapterFactoryProvider#addAdapterFactories(IStructuredModel)
- */
- public void addAdapterFactories(IStructuredModel structuredModel) {
- FactoryRegistry factoryRegistry = structuredModel.getFactoryRegistry();
- Assert.isNotNull(factoryRegistry, "Program Error: client caller must ensure model has factory registry"); //$NON-NLS-1$
- }
-
- public boolean isFor(IDocumentTypeHandler contentTypeDescription) {
- return (contentTypeDescription instanceof ModelHandlerForDTD);
- }
-
- public void reinitializeFactories(IStructuredModel structuredModel) {
- // nothing to do, since no embedded type
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/IStyleConstantsDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/IStyleConstantsDTD.java
deleted file mode 100644
index 68bdb5e870..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/IStyleConstantsDTD.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.style;
-
-/**
- * Contains the symbolic name of styles used by LineStyleProvider,
- * ColorManager, and any others who may be interested
- */
-public interface IStyleConstantsDTD {
-
- public static final String DTD_COMMENT = "dtdComment"; //$NON-NLS-1$
-
- // Data are variables
- public static final String DTD_DATA = "dtdData"; //$NON-NLS-1$
- public static final String DTD_DEFAULT = "dtdDefault"; //$NON-NLS-1$
-
- // keywords are constants like IMPLIED or PCDATA
- public static final String DTD_KEYWORD = "dtdKeyword"; //$NON-NLS-1$
-
- // strings are anything in quotes
- public static final String DTD_STRING = "dtdString"; //$NON-NLS-1$
-
- // All the remaining symbols
- public static final String DTD_SYMBOL = "dtdSymbol"; //$NON-NLS-1$
-
- // tags are '<', '!', or '>'
- public static final String DTD_TAG = "dtdTag"; //$NON-NLS-1$
-
- // tagnames are like ELEMENT, ATTLIST, etc.
- public static final String DTD_TAGNAME = "dtdTagName"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/LineStyleProviderForDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/LineStyleProviderForDTD.java
deleted file mode 100644
index 443a940ae1..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/LineStyleProviderForDTD.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.style;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.wst.dtd.core.internal.parser.DTDRegionTypes;
-import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.sse.ui.internal.provisional.style.AbstractLineStyleProvider;
-import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider;
-
-public class LineStyleProviderForDTD extends AbstractLineStyleProvider implements LineStyleProvider {
- public LineStyleProviderForDTD() {
- super();
- }
-
- protected TextAttribute getAttributeFor(ITextRegion region) {
- /**
- * a method to centralize all the "format rules" for regions
- * specifically associated for how to "open" the region.
- */
- // not sure why this is coming through null, but just to catch it
- if (region == null) {
- return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_DEFAULT);
- }
- String type = region.getType();
- if (type == DTDRegionTypes.CONTENT_EMPTY || type == DTDRegionTypes.CONTENT_ANY || type == DTDRegionTypes.CONTENT_PCDATA) {
- return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_DATA);
- }
- else if (type == DTDRegionTypes.ELEMENT_TAG || type == DTDRegionTypes.ENTITY_TAG || type == DTDRegionTypes.ATTLIST_TAG || type == DTDRegionTypes.NOTATION_TAG) {
- return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_TAGNAME);
- }
- else if (type == DTDRegionTypes.CONNECTOR || type == DTDRegionTypes.OCCUR_TYPE) {
- return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_SYMBOL);
- }
- else if (type == DTDRegionTypes.NDATA_VALUE) {
- return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_DATA);
- }
- else if (type == DTDRegionTypes.START_TAG || type == DTDRegionTypes.END_TAG || type == DTDRegionTypes.EXCLAMATION) {
- return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_TAG);
- }
- else if (type == DTDRegionTypes.COMMENT_START || type == DTDRegionTypes.COMMENT_CONTENT || type == DTDRegionTypes.COMMENT_END) {
- return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_COMMENT);
- }
- else if (type == DTDRegionTypes.SINGLEQUOTED_LITERAL || type == DTDRegionTypes.DOUBLEQUOTED_LITERAL) {
- return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_STRING);
- }
- else if (type == DTDRegionTypes.SYSTEM_KEYWORD || type == DTDRegionTypes.PUBLIC_KEYWORD || type == DTDRegionTypes.NDATA_KEYWORD || type == DTDRegionTypes.CDATA_KEYWORD || type == DTDRegionTypes.ID_KEYWORD || type == DTDRegionTypes.IDREF_KEYWORD || type == DTDRegionTypes.IDREFS_KEYWORD || type == DTDRegionTypes.ENTITY_KEYWORD || type == DTDRegionTypes.ENTITIES_KEYWORD || type == DTDRegionTypes.NMTOKEN_KEYWORD || type == DTDRegionTypes.NMTOKENS_KEYWORD || type == DTDRegionTypes.NOTATION_KEYWORD || type == DTDRegionTypes.REQUIRED_KEYWORD || type == DTDRegionTypes.IMPLIED_KEYWORD || type == DTDRegionTypes.FIXED_KEYWORD) {
- return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_KEYWORD);
- }
- else if (type == DTDRegionTypes.NAME || type == DTDRegionTypes.ENTITY_PARM) {
- // if (region instanceof DTDRegion) {
- // DTDRegion dtdRegion = (DTDRegion) region;
- // IStructuredDocumentRegion flatNode = dtdRegion.getParent();
- // String regionText = flatNode.getText(dtdRegion);
- // if (regionText.equals("ANY") || regionText.equals("EMPTY")) {
- // return new TextAttribute(DTDColors.DTD_KEYWORD);
- // }
- // }
- return (TextAttribute) getTextAttributes().get(IStyleConstantsDTD.DTD_DATA);
- }
-
- // default, return null to signal "not handled"
- // in which case, other factories should be tried
- return null;
- }
-
- protected IPreferenceStore getColorPreferences() {
- return DTDUIPlugin.getDefault().getPreferenceStore();
- }
-
- protected void handlePropertyChange(PropertyChangeEvent event) {
- String styleKey = null;
-
- if (event != null) {
- String prefKey = event.getProperty();
- // check if preference changed is a style preference
- if (IStyleConstantsDTD.DTD_DEFAULT.equals(prefKey)) {
- styleKey = IStyleConstantsDTD.DTD_DEFAULT;
- }
- else if (IStyleConstantsDTD.DTD_TAG.equals(prefKey)) {
- styleKey = IStyleConstantsDTD.DTD_TAG;
- }
- else if (IStyleConstantsDTD.DTD_TAGNAME.equals(prefKey)) {
- styleKey = IStyleConstantsDTD.DTD_TAGNAME;
- }
- else if (IStyleConstantsDTD.DTD_COMMENT.equals(prefKey)) {
- styleKey = IStyleConstantsDTD.DTD_COMMENT;
- }
- else if (IStyleConstantsDTD.DTD_KEYWORD.equals(prefKey)) {
- styleKey = IStyleConstantsDTD.DTD_KEYWORD;
- }
- else if (IStyleConstantsDTD.DTD_STRING.equals(prefKey)) {
- styleKey = IStyleConstantsDTD.DTD_STRING;
- }
- else if (IStyleConstantsDTD.DTD_DATA.equals(prefKey)) {
- styleKey = IStyleConstantsDTD.DTD_DATA;
- }
- else if (IStyleConstantsDTD.DTD_SYMBOL.equals(prefKey)) {
- styleKey = IStyleConstantsDTD.DTD_SYMBOL;
- }
- }
-
- if (styleKey != null) {
- // overwrite style preference with new value
- addTextAttribute(styleKey);
- super.handlePropertyChange(event);
- }
- }
-
- protected void loadColors() {
- addTextAttribute(IStyleConstantsDTD.DTD_DEFAULT);
- addTextAttribute(IStyleConstantsDTD.DTD_TAG);
- addTextAttribute(IStyleConstantsDTD.DTD_TAGNAME);
- addTextAttribute(IStyleConstantsDTD.DTD_COMMENT);
- addTextAttribute(IStyleConstantsDTD.DTD_KEYWORD);
- addTextAttribute(IStyleConstantsDTD.DTD_STRING);
- addTextAttribute(IStyleConstantsDTD.DTD_DATA);
- addTextAttribute(IStyleConstantsDTD.DTD_SYMBOL);
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/LineStyleProviderForDTDSubSet.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/LineStyleProviderForDTDSubSet.java
deleted file mode 100644
index 0f25b7e633..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/style/LineStyleProviderForDTDSubSet.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 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
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.style;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.text.TextUtilities;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.wst.dtd.core.internal.provisional.contenttype.ContentTypeIdForDTD;
-import org.eclipse.wst.dtd.core.text.IDTDPartitions;
-import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredPartitioning;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.sse.ui.internal.preferences.ui.ColorHelper;
-import org.eclipse.wst.sse.ui.internal.provisional.style.AbstractLineStyleProvider;
-import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider;
-
-public class LineStyleProviderForDTDSubSet extends AbstractLineStyleProvider implements LineStyleProvider {
- private IStructuredModel fInternalModel = null;
- private LineStyleProviderForDTD fInternalProvider = null;
- private StyleRange[] fInternalRanges;
- private String fPartitioning = null;
-
- public LineStyleProviderForDTDSubSet() {
- super();
- fInternalProvider = new LineStyleProviderForDTD();
- fInternalRanges = new StyleRange[0];
- fPartitioning = IStructuredPartitioning.DEFAULT_STRUCTURED_PARTITIONING;
- }
-
-
- /**
- * @param lineRequestStart
- * @param lineRequestLength
- * @param holdResults
- */
- private void addStyleRanges(int lineRequestStart, int lineRequestLength, Collection holdResults, int adjustment) {
- int lineRequestEnd = lineRequestStart + lineRequestLength;
- for (int i = 0; i < fInternalRanges.length; i++) {
- int adjustedStyleRangeStart = adjustment + fInternalRanges[i].start;
- int adjustedStyleRangeEnd = adjustedStyleRangeStart + fInternalRanges[i].length;
- if (adjustedStyleRangeEnd < lineRequestStart || lineRequestEnd < adjustedStyleRangeStart)
- continue;
- int end = Math.min(adjustedStyleRangeEnd, lineRequestEnd);
- StyleRange range = new StyleRange();
- range.start = Math.max(adjustedStyleRangeStart, lineRequestStart);
- range.length = end - range.start;
- range.fontStyle = fInternalRanges[i].fontStyle;
- range.foreground = fInternalRanges[i].foreground;
- range.background = fInternalRanges[i].background;
- holdResults.add(range);
- }
- }
-
- protected TextAttribute getAttributeFor(ITextRegion region) {
- TextAttribute ta = null;
-
- String prefString = getColorPreferences().getString(IStyleConstantsDTD.DTD_DEFAULT);
- String[] stylePrefs = ColorHelper.unpackStylePreferences(prefString);
- if (stylePrefs != null) {
- RGB foreground = ColorHelper.toRGB(stylePrefs[0]);
- RGB background = ColorHelper.toRGB(stylePrefs[1]);
- boolean bold = Boolean.valueOf(stylePrefs[2]).booleanValue();
- ta = createTextAttribute(foreground, background, bold);
- }
- return ta;
- }
-
- protected IPreferenceStore getColorPreferences() {
- return DTDUIPlugin.getDefault().getPreferenceStore();
- }
-
- /**
- * @return
- */
- private IStructuredDocument getInternalDocument() {
- if (fInternalModel == null) {
- fInternalModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForDTD.ContentTypeID_DTD);
- }
- return fInternalModel.getStructuredDocument();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.structured.style.AbstractLineStyleProvider#prepareRegions(org.eclipse.jface.text.ITypedRegion,
- * int, int, java.util.Collection)
- */
- public boolean prepareRegions(ITypedRegion typedRegion, int lineRequestStart, int lineRequestLength, Collection holdResults) {
- if (!IDTDPartitions.DTD_DEFAULT.equals(typedRegion.getType())) {
- // compute an internal DTD model and return linestyles for it
- ITextRegion dtdContentRegion = null;
- IStructuredDocumentRegion doctype = fDocument.getRegionAtCharacterOffset(typedRegion.getOffset());
- if (doctype != null)
- dtdContentRegion = doctype.getRegionAtCharacterOffset(typedRegion.getOffset());
- String contents = dtdContentRegion != null ? doctype.getFullText(dtdContentRegion) : null;
- IStructuredDocument document = getInternalDocument();
- if (document == null)
- return false;
-
- updateStyleRanges(document, contents);
-
- addStyleRanges(lineRequestStart, lineRequestLength, holdResults, doctype.getStartOffset(dtdContentRegion));
- return true;
- }
- return false;
- }
-
- public void release() {
- super.release();
- if (fInternalProvider != null) {
- fInternalProvider.release();
- }
- }
-
- private void updateStyleRanges(IStructuredDocument document, String contents) {
- if (!document.get().equals(contents)) {
- document.set(contents);
- try {
- ITypedRegion regions[] = TextUtilities.computePartitioning(getInternalDocument(), fPartitioning, 0, document.getLength(), false);
- List ranges = new ArrayList();
- fInternalProvider.init(getInternalDocument(), fRecHighlighter);
- for (int i = 0; i < regions.length; i++) {
- fInternalProvider.prepareRegions(regions[i], regions[i].getOffset(), regions[i].getLength(), ranges);
- }
- fInternalRanges = (StyleRange[]) ranges.toArray(new StyleRange[0]);
- }
- catch (BadLocationException e) {
- fInternalRanges = new StyleRange[0];
- }
- }
- }
-
-
- protected void loadColors() {
- fInternalProvider.loadColors();
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/templates/TemplateContextTypeDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/templates/TemplateContextTypeDTD.java
deleted file mode 100644
index c63d5933ce..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/templates/TemplateContextTypeDTD.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 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
- * David Carver, STAR - added Encoding Content Resolver, bug 162321
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.templates;
-
-import org.eclipse.jface.text.templates.GlobalTemplateVariables;
-import org.eclipse.jface.text.templates.TemplateContextType;
-import org.eclipse.wst.xml.ui.internal.templates.EncodingTemplateVariableResolverXML;
-
-/**
- * Base class for DTD template context types. Templates of this context type
- * apply to any place within DTD content type.
- */
-public class TemplateContextTypeDTD extends TemplateContextType {
-
- public TemplateContextTypeDTD() {
- super();
- addResolver(new GlobalTemplateVariables.Cursor());
- addResolver(new GlobalTemplateVariables.Date());
- addResolver(new GlobalTemplateVariables.Dollar());
- addResolver(new GlobalTemplateVariables.LineSelection());
- addResolver(new GlobalTemplateVariables.Time());
- addResolver(new GlobalTemplateVariables.User());
- addResolver(new GlobalTemplateVariables.WordSelection());
- addResolver(new GlobalTemplateVariables.Year());
- addResolver(new EncodingTemplateVariableResolverXML());
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/templates/TemplateContextTypeIdsDTD.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/templates/TemplateContextTypeIdsDTD.java
deleted file mode 100644
index 0aa4ee0ee5..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/templates/TemplateContextTypeIdsDTD.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.templates;
-
-
-public class TemplateContextTypeIdsDTD {
- public static final String NEW = "dtd_new"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/text/DTDDocumentRegionEdgeMatcher.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/text/DTDDocumentRegionEdgeMatcher.java
deleted file mode 100644
index 5cf9a66050..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/text/DTDDocumentRegionEdgeMatcher.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.text;
-
-import org.eclipse.wst.dtd.core.internal.parser.DTDRegionTypes;
-import org.eclipse.wst.sse.ui.internal.text.DocumentRegionEdgeMatcher;
-
-
-public class DTDDocumentRegionEdgeMatcher extends DocumentRegionEdgeMatcher {
-
- /**
- * @param validContexts
- * @param nextMatcher
- */
- public DTDDocumentRegionEdgeMatcher() {
- super(new String[]{DTDRegionTypes.START_TAG, DTDRegionTypes.COMMENT_START}, null);
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddAttributeAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddAttributeAction.java
deleted file mode 100644
index ed94bc9f58..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddAttributeAction.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-
-
-package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.wst.dtd.core.internal.AttributeList;
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.Element;
-import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl;
-
-
-public class AddAttributeAction extends BaseAction {
-
- public AddAttributeAction(DTDModelImpl model, String label) {
- super(model, label);
- }
-
- public void run() {
- DTDNode selectedNode = getFirstNodeSelected();
- String newName = "NewAttribute"; //$NON-NLS-1$
- if (selectedNode instanceof AttributeList) {
- ((AttributeList) selectedNode).addAttribute(newName);
- }
- else if (selectedNode instanceof Element) {
- ((Element) selectedNode).addAttribute(newName);
- }
- }
-
- protected boolean updateSelection(IStructuredSelection selection) {
- boolean rc = super.updateSelection(selection);
- DTDNode node = getFirstNodeSelected(selection);
- if (node instanceof Element) {
- // System.out.println("attribute set to true");
- setEnabled(true);
- }
- else {
- // System.out.println("attribute set to false");
- setEnabled(false);
- }
-
- return rc;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddAttributeListAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddAttributeListAction.java
deleted file mode 100644
index 1bcc5a1c75..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddAttributeListAction.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-
-
-package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions;
-
-import org.eclipse.wst.dtd.core.internal.DTDFile;
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.Element;
-import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl;
-
-
-public class AddAttributeListAction extends BaseAction {
-
- public AddAttributeListAction(DTDModelImpl model, String label) {
- super(model, label);
- }
-
- public void run() {
- DTDNode selectedNode = getFirstNodeSelected();
- DTDFile dtdFile = getModel().getDTDFile();
- String attListName = "NewAttList"; //$NON-NLS-1$
- if (selectedNode != null) {
- DTDNode topLevelNode = dtdFile.getTopLevelNodeAt(selectedNode.getStartOffset());
- if (topLevelNode instanceof Element) {
- attListName = ((Element) topLevelNode).getName();
- }
- }
-
- getModel().getDTDFile().createAttributeList(selectedNode, attListName, true);
- // newElement.setName(DTDUniqueNameHelper.getUniqueElementName(dtdFile));
-
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddCommentAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddCommentAction.java
deleted file mode 100644
index bdd9630ce5..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddCommentAction.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-
-
-package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions;
-
-
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl;
-
-
-public class AddCommentAction extends BaseAction {
-
- public AddCommentAction(DTDModelImpl model, String label) {
- super(model, label);
- }
-
- public void run() {
- DTDNode selectedNode = getFirstNodeSelected();
- getModel().getDTDFile().createComment(selectedNode, "NewComment", true); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddElementAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddElementAction.java
deleted file mode 100644
index 6b00a259ac..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddElementAction.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions;
-
-import org.eclipse.wst.dtd.core.internal.DTDFile;
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl;
-import org.eclipse.wst.dtd.core.internal.util.DTDUniqueNameHelper;
-
-
-public class AddElementAction extends BaseAction {
-
- public AddElementAction(DTDModelImpl model, String label) {
- super(model, label);
- }
-
- public void run() {
- DTDNode selectedNode = getFirstNodeSelected();
- DTDFile dtdFile = getModel().getDTDFile();
- String elementName = DTDUniqueNameHelper.getUniqueElementName(dtdFile);
- dtdFile.createElement(selectedNode, elementName, true); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddElementToContentModelAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddElementToContentModelAction.java
deleted file mode 100644
index c398cf9fb2..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddElementToContentModelAction.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-
-
-package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.wst.dtd.core.internal.CMGroupNode;
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.Element;
-import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl;
-
-
-public class AddElementToContentModelAction extends BaseAction {
-
- public AddElementToContentModelAction(DTDModelImpl model, String label) {
- super(model, label);
- }
-
- public void run() {
- DTDNode node = getFirstNodeSelected();
-
- if (node instanceof CMGroupNode) {
- ((CMGroupNode) node).addChild();
- }
- else if (node instanceof Element) {
- ((Element) node).addChild();
- }
- }
-
- protected boolean updateSelection(IStructuredSelection selection) {
- boolean rc = super.updateSelection(selection);
- DTDNode node = getFirstNodeSelected(selection);
- if (node instanceof CMGroupNode) {
- setEnabled(true);
- }
- else {
- setEnabled(false);
- }
- return rc;
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddEntityAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddEntityAction.java
deleted file mode 100644
index c51669ec2e..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddEntityAction.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-
-
-package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions;
-
-
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl;
-
-
-public class AddEntityAction extends BaseAction {
-
- public AddEntityAction(DTDModelImpl model, String label) {
- super(model, label);
- }
-
- public void run() {
- DTDNode selectedNode = getFirstNodeSelected();
-
- getModel().getDTDFile().createEntity(selectedNode, "NewEntity", true); //$NON-NLS-1$
- // newElement.setName(DTDUniqueNameHelper.getUniqueElementName(dtdFile));
-
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddGroupToContentModelAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddGroupToContentModelAction.java
deleted file mode 100644
index 866e1c9168..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddGroupToContentModelAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-
-
-package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions;
-
-import org.eclipse.wst.dtd.core.internal.CMGroupNode;
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.Element;
-import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl;
-
-
-public class AddGroupToContentModelAction extends BaseAction {
-
- public AddGroupToContentModelAction(DTDModelImpl model, String label) {
- super(model, label);
- }
-
- public void run() {
- DTDNode node = getFirstNodeSelected();
-
- if (node instanceof CMGroupNode) {
- ((CMGroupNode) node).addGroup();
- }
- else if (node instanceof Element) {
- ((Element) node).addGroup();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddNotationAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddNotationAction.java
deleted file mode 100644
index b11f82df70..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddNotationAction.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-
-
-package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions;
-
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl;
-
-
-public class AddNotationAction extends BaseAction {
-
- public AddNotationAction(DTDModelImpl model, String label) {
- super(model, label);
- }
-
- public void run() {
- DTDNode selectedNode = getFirstNodeSelected();
-
- getModel().getDTDFile().createNotation(selectedNode, "NewNotation", true); //$NON-NLS-1$
-
- // newNotation.setName(DTDUniqueNameHelper.getUniqueNotationName(dtdFile));
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddParameterEntityReferenceAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddParameterEntityReferenceAction.java
deleted file mode 100644
index 05ebced519..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/AddParameterEntityReferenceAction.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-
-
-package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions;
-
-import org.eclipse.wst.dtd.core.internal.DTDFile;
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl;
-import org.eclipse.wst.dtd.core.internal.util.LabelValuePair;
-
-
-public class AddParameterEntityReferenceAction extends BaseAction {
- public AddParameterEntityReferenceAction(DTDModelImpl model, String label) {
- super(model, label);
- }
-
- public String getFirstExternalParameterEntity(DTDFile dtdFile) {
- LabelValuePair[] freeExternalEntities = dtdFile.getDTDModel().createParmEntityContentItems(null);
-
- if (freeExternalEntities.length > 0) {
- return (String) freeExternalEntities[0].fValue;
- // return (Entity) freeExternalEntities[0].fValue;
- }
- return null;
- }
-
- public void run() {
- DTDFile dtdFile = getModel().getDTDFile();
- String extEntity = getFirstExternalParameterEntity(dtdFile);
- DTDNode selectedNode = getFirstNodeSelected();
- if (extEntity != null) {
- dtdFile.createParameterEntityReference(selectedNode, extEntity, true);
- }
- else {
- dtdFile.createParameterEntityReference(selectedNode, "%NewEntityReference;", true); //$NON-NLS-1$
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/BaseAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/BaseAction.java
deleted file mode 100644
index 411e9c3e91..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/BaseAction.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-
-
-package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IEditorActionBarContributor;
-import org.eclipse.ui.actions.SelectionListenerAction;
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-
-
-abstract public class BaseAction extends SelectionListenerAction {
-
- protected IEditorActionBarContributor contextContributor;
- private IStructuredModel fModel;
-
- public BaseAction(IStructuredModel model, String text) {
- this(model, text, null);
- }
-
- public BaseAction(IStructuredModel model, String text, ImageDescriptor imageDesc) {
- super(text);
- fModel = model;
- setImageDescriptor(imageDesc);
- }
-
- protected DTDNode getFirstNodeSelected() {
- return getFirstNodeSelected(getStructuredSelection());
- }
-
- protected DTDNode getFirstNodeSelected(IStructuredSelection selection) {
- Iterator iter = selection.iterator();
- // DTDNode referencePoint = null;
- while (iter.hasNext()) {
- Object element = iter.next();
- if (element instanceof DTDNode) {
- return (DTDNode) element;
- }
- }
- return null;
- }
-
- protected DTDModelImpl getModel() {
- return (DTDModelImpl) fModel;
- }
-
- public void setContextContributor(IEditorActionBarContributor contributor) {
- contextContributor = contributor;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/DeleteAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/DeleteAction.java
deleted file mode 100644
index 679c1dce9b..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/DeleteAction.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-
-
-package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.actions.SelectionListenerAction;
-import org.eclipse.wst.dtd.core.internal.CMNode;
-import org.eclipse.wst.dtd.core.internal.DTDFile;
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.util.DTDBatchNodeDelete;
-import org.eclipse.wst.dtd.ui.internal.DTDUIMessages;
-
-
-public class DeleteAction extends SelectionListenerAction {
-
- public DeleteAction(String label) {
- super(label);
- }
-
- public void run() {
- IStructuredSelection selection = getStructuredSelection();
-
- Iterator iter = selection.iterator();
- DTDBatchNodeDelete batchDelete = null;
- DTDFile dtdFile = null;
- while (iter.hasNext()) {
- Object element = iter.next();
- if (element instanceof DTDNode) {
- DTDNode node = (DTDNode) element;
- dtdFile = node.getDTDFile();
- if (batchDelete == null) {
- batchDelete = new DTDBatchNodeDelete(dtdFile);
- }
- batchDelete.addNode((DTDNode) element);
- }
- }
- dtdFile.getDTDModel().beginRecording(this, DTDUIMessages._UI_LABEL_DTD_FILE_DELETE); //$NON-NLS-1$
- batchDelete.deleteNodes(this);
- dtdFile.getDTDModel().endRecording(this);
- }
-
- public boolean updateSelection(IStructuredSelection sel) {
- if (!super.updateSelection(sel))
- return false;
-
- Object selectedObject = sel.getFirstElement();
- if (selectedObject instanceof DTDNode && !(selectedObject instanceof CMNode && ((CMNode) selectedObject).isRootElementContent())) {
- setEnabled(true);
- return true; // enable delete menu item
- }
- else {
- setEnabled(false);
- return false; // disable it - grey out
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/ReplaceEmptyContentModelWithGroupAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/ReplaceEmptyContentModelWithGroupAction.java
deleted file mode 100644
index 5523965513..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/contentoutline/actions/ReplaceEmptyContentModelWithGroupAction.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.wst.dtd.core.internal.CMNode;
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.Element;
-import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl;
-
-public class ReplaceEmptyContentModelWithGroupAction extends BaseAction {
-
- public ReplaceEmptyContentModelWithGroupAction(DTDModelImpl model, String label) {
- super(model, label);
- }
-
- public void run() {
- DTDNode node = getFirstNodeSelected();
- if (node instanceof Element) {
- CMNode contentModel = ((Element) node).getContentModel();
- if (CMNode.EMPTY.equals(contentModel.getType())) {
- getModel().beginRecording(this, getText());
- ((Element) node).replaceContentModel(this, "()"); //$NON-NLS-1$
- getModel().endRecording(this);
- }
- }
- }
-
- protected boolean updateSelection(IStructuredSelection selection) {
- boolean rc = super.updateSelection(selection);
- DTDNode node = getFirstNodeSelected(selection);
- setEnabled(node instanceof Element);
- return rc;
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/properties/DTDPropertySourceAdapter.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/properties/DTDPropertySourceAdapter.java
deleted file mode 100644
index cc90289ae0..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/properties/DTDPropertySourceAdapter.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.views.properties;
-
-import java.util.Stack;
-
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.ui.internal.DTDUIMessages;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
-import org.eclipse.wst.sse.ui.internal.properties.CustomPropertyDescriptor;
-
-
-/**
- * An IPropertySource implementation for a JFace viewer used to display
- * properties of DOM nodes. Requires an adapter factory to create JFace
- * adapters for the nodes in the tree.
- */
-public class DTDPropertySourceAdapter implements INodeAdapter, IPropertySource {
- protected final static String CATEGORY_ATTRIBUTES = "Attributes"; //$NON-NLS-1$
-
- private static final String ID_NAME = DTDUIMessages.DTDPropertySourceAdapter_0; //$NON-NLS-1$
- private static final String ID_TEXT = DTDUIMessages.DTDPropertySourceAdapter_1; //$NON-NLS-1$
-
- protected IPropertyDescriptor[] fDescriptors = null;
- protected INodeNotifier fNode = null;
-
- protected Stack fValuesBeingSet = new Stack();
-
- public DTDPropertySourceAdapter(INodeNotifier target) {
- super();
- fNode = target;
- }
-
- /**
- * @return
- */
- private IPropertyDescriptor[] createPropertyDescriptors() {
- CustomPropertyDescriptor nameDescriptor = new CustomPropertyDescriptor(ID_NAME, ID_NAME, null);
- nameDescriptor.setCategory(DTDUIMessages.DTDPropertySourceAdapter_2); //$NON-NLS-1$
- // CustomPropertyDescriptor contentDescriptor = new
- // CustomPropertyDescriptor(ID_TEXT, ID_TEXT, null);
- // contentDescriptor.setCategory("Attributes");
- return new IPropertyDescriptor[]{nameDescriptor};
- }
-
- /**
- * Returns a value for this Node that can be editted in a property sheet.
- *
- * @return a value that can be editted
- */
- public Object getEditableValue() {
- return null;
- }
-
- /**
- * Returns the current collection of property descriptors.
- *
- * @return all valid descriptors.
- */
- public IPropertyDescriptor[] getPropertyDescriptors() {
- if (fDescriptors == null || fDescriptors.length == 0) {
- fDescriptors = createPropertyDescriptors();
- }
- else {
- updatePropertyDescriptors();
- }
- return fDescriptors;
- }
-
- /**
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
- public Object getPropertyValue(Object id) {
- Object value = null;
- if (id.equals(ID_NAME) && fNode instanceof DTDNode) {
- value = ((DTDNode) fNode).getName();
- }
- if (id.equals(ID_TEXT) && fNode instanceof DTDNode) {
- value = ((DTDNode) fNode).getFullNodeText();
- }
- return value;
- }
-
- /**
- * Allowing the INodeAdapter to compare itself against the type allows it
- * to return true in more than one case.
- */
- public boolean isAdapterForType(Object type) {
- return type == IPropertySource.class;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
- */
- public boolean isPropertySet(Object id) {
- return false;
- }
-
- public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
- public void resetPropertyValue(Object id) {
- }
-
- public void setPropertyValue(Object nameObject, Object value) {
- }
-
- protected void updatePropertyDescriptors() {
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/properties/DTDPropertySourceAdapterFactory.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/properties/DTDPropertySourceAdapterFactory.java
deleted file mode 100644
index 59606bbb6f..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/views/properties/DTDPropertySourceAdapterFactory.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.views.properties;
-
-
-
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.wst.sse.core.internal.provisional.AbstractAdapterFactory;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapterFactory;
-import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
-
-
-public class DTDPropertySourceAdapterFactory extends AbstractAdapterFactory {
-
- public DTDPropertySourceAdapterFactory() {
- super(IPropertySource.class, true);
- }
-
- public DTDPropertySourceAdapterFactory(Object adapterKey, boolean registerAdapters) {
- super(adapterKey, registerAdapters);
- }
-
- public INodeAdapterFactory copy() {
- return new DTDPropertySourceAdapterFactory(getAdapterKey(), isShouldRegisterAdapter());
- }
-
- protected INodeAdapter createAdapter(INodeNotifier target) {
- // at the moment, only one implementation exists
- return new DTDPropertySourceAdapter(target);
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/wizard/NewDTDTemplatesWizardPage.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/wizard/NewDTDTemplatesWizardPage.java
deleted file mode 100644
index 4af5a52c40..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/wizard/NewDTDTemplatesWizardPage.java
+++ /dev/null
@@ -1,513 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 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
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.internal.wizard;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
-import org.eclipse.jface.text.templates.DocumentTemplateContext;
-import org.eclipse.jface.text.templates.Template;
-import org.eclipse.jface.text.templates.TemplateBuffer;
-import org.eclipse.jface.text.templates.TemplateContext;
-import org.eclipse.jface.text.templates.TemplateContextType;
-import org.eclipse.jface.text.templates.persistence.TemplateStore;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ControlAdapter;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferencesUtil;
-import org.eclipse.wst.dtd.core.internal.provisional.contenttype.ContentTypeIdForDTD;
-import org.eclipse.wst.dtd.ui.StructuredTextViewerConfigurationDTD;
-import org.eclipse.wst.dtd.ui.internal.DTDUIMessages;
-import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin;
-import org.eclipse.wst.dtd.ui.internal.Logger;
-import org.eclipse.wst.dtd.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.dtd.ui.internal.preferences.DTDUIPreferenceNames;
-import org.eclipse.wst.dtd.ui.internal.templates.TemplateContextTypeIdsDTD;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
-import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider;
-
-/**
- * Templates page in new file wizard. Allows users to select a new file
- * template to be applied in new file.
- *
- */
-public class NewDTDTemplatesWizardPage extends WizardPage {
-
- /**
- * Content provider for templates
- */
- private class TemplateContentProvider implements IStructuredContentProvider {
- /** The template store. */
- private TemplateStore fStore;
-
- /*
- * @see IContentProvider#dispose()
- */
- public void dispose() {
- fStore = null;
- }
-
- /*
- * @see IStructuredContentProvider#getElements(Object)
- */
- public Object[] getElements(Object input) {
- return fStore.getTemplates(TemplateContextTypeIdsDTD.NEW);
- }
-
- /*
- * @see IContentProvider#inputChanged(Viewer, Object, Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- fStore = (TemplateStore) newInput;
- }
- }
-
- /**
- * Label provider for templates.
- */
- private class TemplateLabelProvider extends LabelProvider implements ITableLabelProvider {
-
- /*
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object,
- * int)
- */
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- /*
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object,
- * int)
- */
- public String getColumnText(Object element, int columnIndex) {
- Template template = (Template) element;
-
- switch (columnIndex) {
- case 0 :
- return template.getName();
- case 1 :
- return template.getDescription();
- default :
- return ""; //$NON-NLS-1$
- }
- }
- }
-
- /** Last selected template name */
- private String fLastSelectedTemplateName;
- /** The viewer displays the pattern of selected template. */
- private SourceViewer fPatternViewer;
- /** The table presenting the templates. */
- private TableViewer fTableViewer;
- /** Template store used by this wizard page */
- private TemplateStore fTemplateStore;
- /** Checkbox for using templates. */
- private Button fUseTemplateButton;
-
- public NewDTDTemplatesWizardPage() {
- super("NewDTDTemplatesWizardPage", DTDUIMessages.NewDTDTemplatesWizardPage_0, null); //$NON-NLS-1$
- setDescription(DTDUIMessages.NewDTDTemplatesWizardPage_1);
- }
-
- /**
- * Correctly resizes the table so no phantom columns appear
- *
- * @param parent
- * the parent control
- * @param buttons
- * the buttons
- * @param table
- * the table
- * @param column1
- * the first column
- * @param column2
- * the second column
- * @param column3
- * the third column
- */
- private void configureTableResizing(final Composite parent, final Table table, final TableColumn column1, final TableColumn column2) {
- parent.addControlListener(new ControlAdapter() {
- public void controlResized(ControlEvent e) {
- Rectangle area = parent.getClientArea();
- Point preferredSize = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- int width = area.width - 2 * table.getBorderWidth();
- if (preferredSize.y > area.height) {
- // Subtract the scrollbar width from the total column
- // width
- // if a vertical scrollbar will be required
- Point vBarSize = table.getVerticalBar().getSize();
- width -= vBarSize.x;
- }
-
- Point oldSize = table.getSize();
- if (oldSize.x > width) {
- // table is getting smaller so make the columns
- // smaller first and then resize the table to
- // match the client area width
- column1.setWidth(width / 2);
- column2.setWidth(width / 2);
- table.setSize(width, area.height);
- }
- else {
- // table is getting bigger so make the table
- // bigger first and then make the columns wider
- // to match the client area width
- table.setSize(width, area.height);
- column1.setWidth(width / 2);
- column2.setWidth(width / 2);
- }
- }
- });
- }
-
- public void createControl(Composite ancestor) {
- Composite parent = new Composite(ancestor, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- parent.setLayout(layout);
-
- // create checkbox for user to use DTD Template
- fUseTemplateButton = new Button(parent, SWT.CHECK);
- fUseTemplateButton.setText(DTDUIMessages.NewDTDTemplatesWizardPage_4);
- GridData data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
- fUseTemplateButton.setLayoutData(data);
- fUseTemplateButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- enableTemplates();
- }
- });
-
- // create composite for Templates table
- Composite innerParent = new Composite(parent, SWT.NONE);
- GridLayout innerLayout = new GridLayout();
- innerLayout.numColumns = 2;
- innerLayout.marginHeight = 0;
- innerLayout.marginWidth = 0;
- innerParent.setLayout(innerLayout);
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
- innerParent.setLayoutData(gd);
-
- Label label = new Label(innerParent, SWT.NONE);
- label.setText(DTDUIMessages.NewDTDTemplatesWizardPage_7);
- data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
- label.setLayoutData(data);
-
- // create table that displays templates
- Table table = new Table(innerParent, SWT.BORDER | SWT.FULL_SELECTION);
-
- data = new GridData(GridData.FILL_BOTH);
- data.widthHint = convertWidthInCharsToPixels(2);
- data.heightHint = convertHeightInCharsToPixels(10);
- data.horizontalSpan = 2;
- table.setLayoutData(data);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- TableLayout tableLayout = new TableLayout();
- table.setLayout(tableLayout);
-
- TableColumn column1 = new TableColumn(table, SWT.NONE);
- column1.setText(DTDUIMessages.NewDTDTemplatesWizardPage_2);
-
- TableColumn column2 = new TableColumn(table, SWT.NONE);
- column2.setText(DTDUIMessages.NewDTDTemplatesWizardPage_3);
-
- fTableViewer = new TableViewer(table);
- fTableViewer.setLabelProvider(new TemplateLabelProvider());
- fTableViewer.setContentProvider(new TemplateContentProvider());
-
- fTableViewer.setSorter(new ViewerSorter() {
- public int compare(Viewer viewer, Object object1, Object object2) {
- if ((object1 instanceof Template) && (object2 instanceof Template)) {
- Template left = (Template) object1;
- Template right = (Template) object2;
- int result = left.getName().compareToIgnoreCase(right.getName());
- if (result != 0)
- return result;
- return left.getDescription().compareToIgnoreCase(right.getDescription());
- }
- return super.compare(viewer, object1, object2);
- }
-
- public boolean isSorterProperty(Object element, String property) {
- return true;
- }
- });
-
- fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent e) {
- updateViewerInput();
- }
- });
-
- // create viewer that displays currently selected template's contents
- fPatternViewer = doCreateViewer(parent);
-
- fTemplateStore = DTDUIPlugin.getDefault().getTemplateStore();
- fTableViewer.setInput(fTemplateStore);
-
- // Create linked text to just to templates preference page
- Link link = new Link(parent, SWT.NONE);
- link.setText(DTDUIMessages.NewDTDTemplatesWizardPage_6);
- data = new GridData(SWT.END, SWT.FILL, true, false, 2, 1);
- link.setLayoutData(data);
- link.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- linkClicked();
- }
- });
-
- configureTableResizing(innerParent, table, column1, column2);
- loadLastSavedPreferences();
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpContextIds.DTD_NEWWIZARD_TEMPLATE_HELPID);
- Dialog.applyDialogFont(parent);
- setControl(parent);
- }
-
- /**
- * Creates, configures and returns a source viewer to present the template
- * pattern on the preference page. Clients may override to provide a
- * custom source viewer featuring e.g. syntax coloring.
- *
- * @param parent
- * the parent control
- * @return a configured source viewer
- */
- private SourceViewer createViewer(Composite parent) {
- SourceViewerConfiguration sourceViewerConfiguration = new StructuredTextViewerConfiguration() {
- StructuredTextViewerConfiguration baseConfiguration = new StructuredTextViewerConfigurationDTD();
-
- public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
- return baseConfiguration.getConfiguredContentTypes(sourceViewer);
- }
-
- public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) {
- return baseConfiguration.getLineStyleProviders(sourceViewer, partitionType);
- }
- };
- SourceViewer viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- ((StructuredTextViewer) viewer).getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
- IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForDTD.ContentTypeID_DTD);
- IDocument document = scratchModel.getStructuredDocument();
- viewer.configure(sourceViewerConfiguration);
- viewer.setDocument(document);
- return viewer;
- }
-
- private SourceViewer doCreateViewer(Composite parent) {
- Label label = new Label(parent, SWT.NONE);
- label.setText(DTDUIMessages.NewDTDTemplatesWizardPage_5);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- label.setLayoutData(data);
-
- SourceViewer viewer = createViewer(parent);
- viewer.setEditable(false);
-
- Control control = viewer.getControl();
- data = new GridData(GridData.FILL_BOTH);
- data.horizontalSpan = 2;
- data.heightHint = convertHeightInCharsToPixels(5);
- // [261274] - source viewer was growing to fit the max line width of the template
- data.widthHint = convertWidthInCharsToPixels(2);
- control.setLayoutData(data);
-
- return viewer;
- }
-
- /**
- * Enable/disable controls in page based on fUseTemplateButton's current
- * state.
- */
- void enableTemplates() {
- boolean enabled = fUseTemplateButton.getSelection();
-
- if (!enabled) {
- // save last selected template
- Template template = getSelectedTemplate();
- if (template != null)
- fLastSelectedTemplateName = template.getName();
- else
- fLastSelectedTemplateName = ""; //$NON-NLS-1$
-
- fTableViewer.setSelection(null);
- }
- else {
- setSelectedTemplate(fLastSelectedTemplateName);
- }
-
- fTableViewer.getControl().setEnabled(enabled);
- fPatternViewer.getControl().setEnabled(enabled);
- }
-
- /**
- * Return the template preference page id
- *
- * @return
- */
- private String getPreferencePageId() {
- return "org.eclipse.wst.sse.ui.preferences.dtd.templates"; //$NON-NLS-1$
- }
-
- /**
- * Get the currently selected template.
- *
- * @return
- */
- private Template getSelectedTemplate() {
- Template template = null;
- IStructuredSelection selection = (IStructuredSelection) fTableViewer.getSelection();
-
- if (selection.size() == 1) {
- template = (Template) selection.getFirstElement();
- }
- return template;
- }
-
- /**
- * Returns template string to insert.
- *
- * @return String to insert or null if none is to be inserted
- */
- String getTemplateString() {
- String templateString = null;
-
- Template template = getSelectedTemplate();
- if (template != null) {
- TemplateContextType contextType = DTDUIPlugin.getDefault().getTemplateContextRegistry().getContextType(TemplateContextTypeIdsDTD.NEW);
- IDocument document = new Document();
- TemplateContext context = new DocumentTemplateContext(contextType, document, 0, 0);
- try {
- TemplateBuffer buffer = context.evaluate(template);
- templateString = buffer.getString();
- }
- catch (Exception e) {
- Logger.log(Logger.WARNING_DEBUG, "Could not create template for new dtd", e); //$NON-NLS-1$
- }
- }
-
- return templateString;
- }
-
- void linkClicked() {
- String pageId = getPreferencePageId();
- PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), pageId, new String[]{pageId}, null);
- dialog.open();
- fTableViewer.refresh();
- }
-
- /**
- * Load the last template name used in New DTD File wizard.
- */
- private void loadLastSavedPreferences() {
- String templateName = DTDUIPlugin.getDefault().getPreferenceStore().getString(DTDUIPreferenceNames.NEW_FILE_TEMPLATE_NAME);
- if (templateName == null || templateName.length() == 0) {
- fLastSelectedTemplateName = ""; //$NON-NLS-1$
- fUseTemplateButton.setSelection(false);
- }
- else {
- fLastSelectedTemplateName = templateName;
- fUseTemplateButton.setSelection(true);
- }
- enableTemplates();
- }
-
- /**
- * Save template name used for next call to New DTD File wizard.
- */
- void saveLastSavedPreferences() {
- String templateName = ""; //$NON-NLS-1$
-
- Template template = getSelectedTemplate();
- if (template != null) {
- templateName = template.getName();
- }
-
- DTDUIPlugin.getDefault().getPreferenceStore().setValue(DTDUIPreferenceNames.NEW_FILE_TEMPLATE_NAME, templateName);
- DTDUIPlugin.getDefault().savePluginPreferences();
- }
-
- /**
- * Select a template in the table viewer given the template name. If
- * template name cannot be found or templateName is null, just select
- * first item in table. If no items in table select nothing.
- *
- * @param templateName
- */
- private void setSelectedTemplate(String templateName) {
- Object template = null;
-
- if (templateName != null && templateName.length() > 0) {
- // pick the last used template
- template = fTemplateStore.findTemplate(templateName, TemplateContextTypeIdsDTD.NEW);
- }
-
- // no record of last used template so just pick first element
- if (template == null) {
- // just pick first element
- template = fTableViewer.getElementAt(0);
- }
-
- if (template != null) {
- IStructuredSelection selection = new StructuredSelection(template);
- fTableViewer.setSelection(selection, true);
- }
- }
-
- /**
- * Updates the pattern viewer.
- */
- void updateViewerInput() {
- Template template = getSelectedTemplate();
- if (template != null) {
- fPatternViewer.getDocument().set(template.getPattern());
- }
- else {
- fPatternViewer.getDocument().set(""); //$NON-NLS-1$
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/wizard/NewDTDWizard.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/wizard/NewDTDWizard.java
deleted file mode 100644
index ad7a35c259..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/internal/wizard/NewDTDWizard.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 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.dtd.ui.internal.wizard;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStreamWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ProjectScope;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-import org.eclipse.ui.ide.IDE;
-import org.eclipse.wst.dtd.core.internal.DTDCorePlugin;
-import org.eclipse.wst.dtd.core.internal.preferences.DTDCorePreferenceNames;
-import org.eclipse.wst.dtd.core.internal.provisional.contenttype.ContentTypeIdForDTD;
-import org.eclipse.wst.dtd.ui.internal.DTDUIMessages;
-import org.eclipse.wst.dtd.ui.internal.Logger;
-import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImageHelper;
-import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImages;
-import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames;
-import org.eclipse.wst.sse.core.utils.StringUtils;
-import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
-
-public class NewDTDWizard extends Wizard implements INewWizard {
- private WizardNewFileCreationPage fNewFilePage;
- private NewDTDTemplatesWizardPage fNewFileTemplatesPage;
- private IStructuredSelection fSelection;
- private IContentType fContentType;
- private List fValidExtensions = null;
-
- /**
- * Adds default extension to the filename
- *
- * @param filename
- * @return
- */
- String addDefaultExtension(String filename) {
- StringBuffer newFileName = new StringBuffer(filename);
-
- Preferences preference = DTDCorePlugin.getInstance().getPluginPreferences();
- String ext = preference.getString(DTDCorePreferenceNames.DEFAULT_EXTENSION);
-
- newFileName.append("."); //$NON-NLS-1$
- newFileName.append(ext);
-
- return newFileName.toString();
- }
-
- /**
- * Get content type associated with this new file wizard
- *
- * @return IContentType
- */
- IContentType getContentType() {
- if (fContentType == null)
- fContentType = Platform.getContentTypeManager().getContentType(ContentTypeIdForDTD.ContentTypeID_DTD);
- return fContentType;
- }
-
- /**
- * Get list of valid extensions for DTD Content type
- *
- * @return
- */
- List getValidExtensions() {
- if (fValidExtensions == null) {
- IContentType type = getContentType();
- fValidExtensions = new ArrayList(Arrays.asList(type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC)));
- }
- return fValidExtensions;
- }
-
- private String applyLineDelimiter(IFile file, String text) {
- String lineDelimiter = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, System.getProperty("line.separator"), new IScopeContext[] {new ProjectScope(file.getProject()), new InstanceScope() });//$NON-NLS-1$
- String convertedText = StringUtils.replace(text, "\r\n", "\n");
- convertedText = StringUtils.replace(convertedText, "\r", "\n");
- convertedText = StringUtils.replace(convertedText, "\n", lineDelimiter);
- return convertedText;
- }
-
- /**
- * Verifies if fileName is valid name for content type. Takes base content
- * type into consideration.
- *
- * @param fileName
- * @return true if extension is valid for this content type
- */
- boolean extensionValidForContentType(String fileName) {
- boolean valid = false;
-
- IContentType type = getContentType();
- // there is currently an extension
- if (fileName.lastIndexOf('.') != -1) {
- // check what content types are associated with current extension
- IContentType[] types = Platform.getContentTypeManager().findContentTypesFor(fileName);
- int i = 0;
- while (i < types.length && !valid) {
- valid = types[i].isKindOf(type);
- ++i;
- }
- }
- else
- valid = true; // no extension so valid
- return valid;
- }
-
- public void addPages() {
- fNewFilePage = new WizardNewFileCreationPage("DTDWizardNewFileCreationPage", new StructuredSelection(IDE.computeSelectedResources(fSelection))) { //$NON-NLS-1$
- protected boolean validatePage() {
- String fileName = getFileName();
- IPath fullPath = getContainerFullPath();
- if ((fullPath != null) && (fullPath.isEmpty() == false) && (fileName != null)) {
- // check that filename does not contain invalid extension
- if (!extensionValidForContentType(fileName)) {
- setErrorMessage(NLS.bind(DTDUIMessages._ERROR_FILENAME_MUST_END_DTD, getValidExtensions().toString()));
- return false;
- }
- // no file extension specified so check adding default
- // extension doesn't equal a file that already exists
- if (fileName.lastIndexOf('.') == -1) {
- String newFileName = addDefaultExtension(fileName);
- IPath resourcePath = fullPath.append(newFileName);
-
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IStatus result = workspace.validatePath(resourcePath.toString(), IResource.FOLDER);
- if (!result.isOK()) {
- // path invalid
- setErrorMessage(result.getMessage());
- return false;
- }
-
- if ((workspace.getRoot().getFolder(resourcePath).exists() || workspace.getRoot().getFile(resourcePath).exists())) {
- setErrorMessage(DTDUIMessages.ResourceGroup_nameExists);
- return false;
- }
- }
- }
- setErrorMessage(null);
- return super.validatePage();
- }
- };
- fNewFilePage.setTitle(DTDUIMessages._UI_CREATE_NEW_DTD_FILE);
- fNewFilePage.setDescription(DTDUIMessages._UI_WIZARD_NEW_DTD_EXPL);
-
- addPage(fNewFilePage);
-
- fNewFileTemplatesPage = new NewDTDTemplatesWizardPage();
- addPage(fNewFileTemplatesPage);
- }
-
- public void init(IWorkbench aWorkbench, IStructuredSelection aSelection) {
- fSelection = aSelection;
- setWindowTitle(DTDUIMessages._UI_WIZARD_NEW_DTD_TITLE); //$NON-NLS-1$
-
- ImageDescriptor descriptor = DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_WIZBAN_NEWDTDFILE);
- setDefaultPageImageDescriptor(descriptor);
- }
-
- private void openEditor(final IFile file) {
- if (file != null) {
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- try {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IDE.openEditor(page, file, true);
- }
- catch (PartInitException e) {
- Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
- }
- }
- });
- }
- }
-
- public boolean performFinish() {
- boolean performedOK = false;
-
- // save user options for next use
- fNewFileTemplatesPage.saveLastSavedPreferences();
-
- // no file extension specified so add default extension
- String fileName = fNewFilePage.getFileName();
- if (fileName.lastIndexOf('.') == -1) {
- String newFileName = addDefaultExtension(fileName);
- fNewFilePage.setFileName(newFileName);
- }
-
- // create a new empty file
- IFile file = fNewFilePage.createNewFile();
-
- // if there was problem with creating file, it will be null, so make
- // sure to check
- if (file != null) {
- // put template contents into file
- String templateString = fNewFileTemplatesPage.getTemplateString();
- if (templateString != null) {
- templateString = applyLineDelimiter(file, templateString);
- // determine the encoding for the new file
- String charSet = getAppropriateCharset();
-
- try {
- ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
- OutputStreamWriter outputStreamWriter = null;
- if (charSet == null || charSet.trim().equals("")) { //$NON-NLS-1$
- // just use default encoding
- outputStreamWriter = new OutputStreamWriter(outputStream);
- }
- else {
- outputStreamWriter = new OutputStreamWriter(outputStream, charSet);
- }
- outputStreamWriter.write(templateString);
- outputStreamWriter.flush();
- outputStreamWriter.close();
- ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
- file.setContents(inputStream, true, false, null);
- inputStream.close();
- }
- catch (Exception e) {
- Logger.log(Logger.WARNING_DEBUG, "Could not create contents for new DTD file", e); //$NON-NLS-1$
- }
- }
-
- // open the file in editor
- openEditor(file);
-
- // everything's fine
- performedOK = true;
- }
- return performedOK;
- }
-
- /**
- * If the DTD preference identifies a charset, use that. If not, revert to the XML
- * charset preference
- *
- * @return charset based on DTD preferences if defined, if not, from the XML preferences
- */
- private String getAppropriateCharset() {
- String charset = DTDCorePlugin.getInstance().getPluginPreferences().getString(CommonEncodingPreferenceNames.OUTPUT_CODESET);
- if(charset == null || charset.trim().equals(""))
- charset = XMLCorePlugin.getDefault().getPluginPreferences().getString(CommonEncodingPreferenceNames.OUTPUT_CODESET);
- return charset;
- }
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContentOutlineComparator.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContentOutlineComparator.java
deleted file mode 100644
index e6aca53126..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContentOutlineComparator.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.views.contentoutline;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.wst.dtd.core.internal.CMNode;
-
-/**
- * Comparator for the outline. Allows sorting of regular DTD elements, but not
- * their content models since the ordering there is important.
- */
-class DTDContentOutlineComparator extends ViewerComparator {
-
- public DTDContentOutlineComparator() {
- super();
- }
-
- public int compare(Viewer viewer, Object e1, Object e2) {
- if (e1 instanceof CMNode && e2 instanceof CMNode)
- return 0;
- return super.compare(viewer, e1, e2);
- }
-
- public boolean isSorterProperty(Object element, String property) {
- return super.isSorterProperty(element, property);
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContentOutlineConfiguration.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContentOutlineConfiguration.java
deleted file mode 100644
index e42869c7cf..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContentOutlineConfiguration.java
+++ /dev/null
@@ -1,282 +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.dtd.ui.views.contentoutline;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.jface.util.TransferDragSourceListener;
-import org.eclipse.jface.util.TransferDropTargetListener;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.wst.common.ui.internal.dnd.DragAndDropCommand;
-import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl;
-import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin;
-import org.eclipse.wst.dtd.ui.internal.dnd.DTDDragAndDropManager;
-import org.eclipse.wst.sse.ui.internal.contentoutline.PropertyChangeUpdateActionContributionItem;
-import org.eclipse.wst.sse.ui.internal.util.Assert;
-import org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration;
-
-/**
- * Configuration for outline view page which shows DTD content.
- *
- * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration
- * @since 1.0
- */
-public class DTDContentOutlineConfiguration extends ContentOutlineConfiguration {
- private IContentProvider fContentProvider = null;
- private ILabelProvider fLabelProvider = null;
-
- private DTDContextMenuHelper fMenuHelper;
- private TransferDragSourceListener[] fTransferDragSourceListeners;
- private TransferDropTargetListener[] fTransferDropTargetListeners;
- private Map fViewerContributions;
- private final String OUTLINE_ORDER_PREF = "outline-order"; //$NON-NLS-1$
- private final String OUTLINE_SORT_PREF = "outline-sort"; //$NON-NLS-1$
-
- /**
- * Default constructor for DTDContentOutlineConfiguration.
- */
- public DTDContentOutlineConfiguration() {
- // Must have empty constructor to createExecutableExtension
- super();
- fViewerContributions = new HashMap(2);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#createToolbarContributions(org.eclipse.jface.viewers.TreeViewer)
- */
- public IContributionItem[] createToolbarContributions(TreeViewer viewer) {
- Assert.isTrue(getContentProvider(viewer) instanceof DTDTreeContentProvider, "invalid content provider on viewer"); //$NON-NLS-1$
- IContributionItem[] items = super.createToolbarContributions(viewer);
-
- SortAction sortAction = new SortAction(viewer, DTDUIPlugin.getDefault().getPreferenceStore(), OUTLINE_SORT_PREF);
- OrderAction orderAction = new OrderAction(viewer, (DTDTreeContentProvider) getContentProvider(viewer), DTDUIPlugin.getDefault().getPreferenceStore(), OUTLINE_ORDER_PREF);
- IContributionItem sortItem = new PropertyChangeUpdateActionContributionItem(sortAction);
- IContributionItem orderItem = new PropertyChangeUpdateActionContributionItem(orderAction);
-
- if (items == null) {
- items = new IContributionItem[2];
- items[0] = sortItem;
- items[1] = orderItem;
- }
- else {
- IContributionItem[] combinedItems = new IContributionItem[items.length + 2];
- combinedItems[0] = sortItem;
- combinedItems[1] = orderItem;
- System.arraycopy(items, 0, combinedItems, 2, items.length);
- items = combinedItems;
- }
- return items;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#getContentProvider(org.eclipse.jface.viewers.TreeViewer)
- */
- public IContentProvider getContentProvider(TreeViewer viewer) {
- if (fContentProvider == null) {
- fContentProvider = new DTDTreeContentProvider();
- }
- // return super.getContentProvider(viewer);
- return fContentProvider;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#getLabelProvider(org.eclipse.jface.viewers.TreeViewer)
- */
- public ILabelProvider getLabelProvider(TreeViewer viewer) {
- if (fLabelProvider == null) {
- fLabelProvider = new DTDLabelProvider();
- }
- // return super.getLabelProvider(viewer);
- return fLabelProvider;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#getMenuListener(org.eclipse.jface.viewers.TreeViewer)
- */
- public IMenuListener getMenuListener(TreeViewer viewer) {
- IMenuListener listener = null;
- if (fMenuHelper == null && viewer.getInput() instanceof DTDModelImpl) {
- fMenuHelper = new DTDContextMenuHelper((DTDModelImpl) viewer.getInput());
- fMenuHelper.createMenuListenersFor(viewer);
- }
- if (fMenuHelper != null) {
- listener = fMenuHelper.getMenuListener();
- }
- return listener;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#getPreferenceStore()
- */
- protected IPreferenceStore getPreferenceStore() {
- return DTDUIPlugin.getDefault().getPreferenceStore();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#getTransferDragSourceListeners(org.eclipse.jface.viewers.TreeViewer)
- */
- public TransferDragSourceListener[] getTransferDragSourceListeners(final TreeViewer treeViewer) {
- if (fTransferDragSourceListeners == null) {
- fTransferDragSourceListeners = new TransferDragSourceListener[]{new TransferDragSourceListener() {
- public void dragFinished(DragSourceEvent event) {
- LocalSelectionTransfer.getTransfer().setSelection(null);
- }
-
- public void dragSetData(DragSourceEvent event) {
- }
-
- public void dragStart(DragSourceEvent event) {
- LocalSelectionTransfer.getTransfer().setSelection(treeViewer.getSelection());
- }
-
- public Transfer getTransfer() {
- return LocalSelectionTransfer.getTransfer();
- }
- }};
- }
-
- return fTransferDragSourceListeners;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#getTransferDropTargetListeners(org.eclipse.jface.viewers.TreeViewer)
- */
- public TransferDropTargetListener[] getTransferDropTargetListeners(final TreeViewer treeViewer) {
- if (fTransferDropTargetListeners == null) {
- fTransferDropTargetListeners = new TransferDropTargetListener[]{new TransferDropTargetListener() {
- public void dragEnter(DropTargetEvent event) {
- }
-
- public void dragLeave(DropTargetEvent event) {
- }
-
- public void dragOperationChanged(DropTargetEvent event) {
- }
-
- public void dragOver(DropTargetEvent event) {
- event.feedback = DND.FEEDBACK_SELECT;
- float feedbackFloat = getHeightInItem(event);
- if (feedbackFloat > 0.75) {
- event.feedback = DND.FEEDBACK_INSERT_AFTER;
- }
- else if (feedbackFloat < 0.25) {
- event.feedback = DND.FEEDBACK_INSERT_BEFORE;
- }
- event.feedback |= DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL;
- }
-
- public void drop(DropTargetEvent event) {
- if (event.operations != DND.DROP_NONE && LocalSelectionTransfer.getTransfer().getSelection() instanceof IStructuredSelection) {
- IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer().getSelection();
- if (selection != null && !selection.isEmpty() && event.item != null && event.item.getData() != null) {
- /*
- * the command uses these numbers instead of the
- * feedback constants (even though it converts in
- * the other direction as well)
- */
- float feedbackFloat = getHeightInItem(event);
-
- final DragAndDropCommand command = new DTDDragAndDropManager().createCommand(event.item.getData(), feedbackFloat, event.operations, event.detail, selection.toList());
- if (command != null && command.canExecute()) {
- SafeRunnable.run(new SafeRunnable() {
- public void run() throws Exception {
- command.execute();
- }
- });
- }
- }
- }
- }
-
- public void dropAccept(DropTargetEvent event) {
- }
-
- private float getHeightInItem(DropTargetEvent event) {
- if(event.item == null) return .5f;
- if (event.item instanceof TreeItem) {
- TreeItem treeItem = (TreeItem) event.item;
- Control control = treeItem.getParent();
- Point point = control.toControl(new Point(event.x, event.y));
- Rectangle bounds = treeItem.getBounds();
- return (float) (point.y - bounds.y) / (float) bounds.height;
- }
- else if (event.item instanceof TableItem) {
- TableItem tableItem = (TableItem) event.item;
- Control control = tableItem.getParent();
- Point point = control.toControl(new Point(event.x, event.y));
- Rectangle bounds = tableItem.getBounds(0);
- return (float) (point.y - bounds.y) / (float) bounds.height;
- }
- else {
- return 0.0F;
- }
- }
-
- public Transfer getTransfer() {
- return LocalSelectionTransfer.getTransfer();
- }
-
- public boolean isEnabled(DropTargetEvent event) {
- return getTransfer().isSupportedType(event.currentDataType);
- }
- }};
- }
- return fTransferDropTargetListeners;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration#unconfigure(org.eclipse.jface.viewers.TreeViewer)
- */
- public void unconfigure(TreeViewer viewer) {
- super.unconfigure(viewer);
- fViewerContributions.remove(viewer);
- if (fMenuHelper != null) {
- fMenuHelper.removeMenuListenersFor(viewer);
- fMenuHelper = null;
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContextMenuHelper.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContextMenuHelper.java
deleted file mode 100644
index f99a07f91c..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDContextMenuHelper.java
+++ /dev/null
@@ -1,268 +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
- * Naoki Akiyama (Fujitsu) - bug 187172 - fix attribute grouping
- *
- *******************************************************************************/
-
-package org.eclipse.wst.dtd.ui.views.contentoutline;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.wst.dtd.core.internal.AttributeList;
-import org.eclipse.wst.dtd.core.internal.CMGroupNode;
-import org.eclipse.wst.dtd.core.internal.CMNode;
-import org.eclipse.wst.dtd.core.internal.DTDFile;
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.Element;
-import org.eclipse.wst.dtd.core.internal.NodeList;
-import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl;
-import org.eclipse.wst.dtd.core.internal.parser.DTDRegionTypes;
-import org.eclipse.wst.dtd.core.internal.util.LabelValuePair;
-import org.eclipse.wst.dtd.ui.internal.DTDUIMessages;
-import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImageHelper;
-import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImages;
-import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.AddAttributeAction;
-import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.AddAttributeListAction;
-import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.AddCommentAction;
-import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.AddElementAction;
-import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.AddElementToContentModelAction;
-import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.AddEntityAction;
-import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.AddGroupToContentModelAction;
-import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.AddNotationAction;
-import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.AddParameterEntityReferenceAction;
-import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.DeleteAction;
-import org.eclipse.wst.dtd.ui.internal.views.contentoutline.actions.ReplaceEmptyContentModelWithGroupAction;
-
-/**
- * Menu helper for Content Outline page. This should not be used elsewhere.
- */
-class DTDContextMenuHelper {
- class DTDMenuListener implements IMenuListener {
- public void menuAboutToShow(IMenuManager manager) {
- // update the action selection now
- addNotationAction.selectionChanged(fViewerSelection);
- addEntityAction.selectionChanged(fViewerSelection);
- addElementAction.selectionChanged(fViewerSelection);
- addCommentAction.selectionChanged(fViewerSelection);
- addParameterEntityReferenceAction.selectionChanged(fViewerSelection);
- deleteAction.selectionChanged(fViewerSelection);
- addAttributeAction.selectionChanged(fViewerSelection);
- addAttributeListAction.selectionChanged(fViewerSelection);
- addGroupToContentModelAction.selectionChanged(fViewerSelection);
- addElementToContentModelAction.selectionChanged(fViewerSelection);
- replaceEmptyContentModelWithGroupAction.selectionChanged(fViewerSelection);
-
-
- if (!fViewerSelection.isEmpty()) {
- addActionItemsForSelection(fViewerSelection.getFirstElement(), manager);
- }
- }
- }
-
- class ViewerSelectionChangeListener implements ISelectionChangedListener {
- public void selectionChanged(SelectionChangedEvent event) {
- _selectionChanged(event);
- }
- }
-
- AddAttributeAction addAttributeAction;
-
- AddAttributeListAction addAttributeListAction;
- AddCommentAction addCommentAction;
- AddElementAction addElementAction;
- AddElementToContentModelAction addElementToContentModelAction;
- AddEntityAction addEntityAction;
- AddGroupToContentModelAction addGroupToContentModelAction;
- AddNotationAction addNotationAction;
- AddParameterEntityReferenceAction addParameterEntityReferenceAction;
- DeleteAction deleteAction;
- private ISelectionChangedListener fInternalSelectionChangedListener = new ViewerSelectionChangeListener();
-
- private IMenuListener fMenuListener;
- private DTDModelImpl fModel;
- private List fViewerList;
-
- IStructuredSelection fViewerSelection = StructuredSelection.EMPTY;
-
- ReplaceEmptyContentModelWithGroupAction replaceEmptyContentModelWithGroupAction;
-
- public DTDContextMenuHelper(DTDModelImpl model) {
- fModel = model;
- fViewerList = new ArrayList(1);
- fMenuListener = new DTDMenuListener();
-
- addNotationAction = new AddNotationAction(model, DTDUIMessages._UI_ACTION_ADD_DTD_NOTATION); //$NON-NLS-1$
- addEntityAction = new AddEntityAction(model, DTDUIMessages._UI_ACTION_ADD_DTD_ENTITY); //$NON-NLS-1$
- addElementAction = new AddElementAction(model, DTDUIMessages._UI_ACTION_ADD_DTD_ELEMENT); //$NON-NLS-1$
- addCommentAction = new AddCommentAction(model, DTDUIMessages._UI_ACTION_ADD_DTD_COMMENT); //$NON-NLS-1$
-
- addParameterEntityReferenceAction = new AddParameterEntityReferenceAction(model, DTDUIMessages._UI_ACTION_ADD_PARAM_ENTITY_REF); //$NON-NLS-1$
- deleteAction = new DeleteAction(DTDUIMessages._UI_ACTION_DTD_DELETE); //$NON-NLS-1$
- addAttributeAction = new AddAttributeAction(model, DTDUIMessages._UI_ACTION_ADD_ATTRIBUTE); //$NON-NLS-1$
- addAttributeListAction = new AddAttributeListAction(model, DTDUIMessages._UI_ACTION_ADD_ATTRIBUTELIST); //$NON-NLS-1$
-
- addGroupToContentModelAction = new AddGroupToContentModelAction(model, DTDUIMessages._UI_ACTION_GROUP_ADD_GROUP); //$NON-NLS-1$
- addElementToContentModelAction = new AddElementToContentModelAction(model, DTDUIMessages._UI_ACTION_ADD_ELEMENT); //$NON-NLS-1$
-
- replaceEmptyContentModelWithGroupAction = new ReplaceEmptyContentModelWithGroupAction(model, DTDUIMessages._UI_ACTION_GROUP_ADD_GROUP); //$NON-NLS-1$
-
- addNotationAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_OBJ_ADD_NOTATION));
- addEntityAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_OBJ_ADD_ENTITY));
- addCommentAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_OBJ_ADD_COMMENT));
- addParameterEntityReferenceAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_OBJ_ADD_ENTITY_REFERENCE));
-
- // Tri-state images
- addElementAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_ETOOL_ADD_ELEMENT));
- addElementAction.setHoverImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_CTOOL_ADD_ELEMENT));
- addElementAction.setDisabledImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_DTOOL_ADD_ELEMENT));
-
- addAttributeAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_ETOOL_ADD_ATTRIBUTE));
- addAttributeAction.setHoverImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_CTOOL_ADD_ATTRIBUTE));
- addAttributeAction.setDisabledImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_DTOOL_ADD_ATTRIBUTE));
-
- addAttributeListAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_ETOOL_ADD_ATTRIBUTE));
- addAttributeListAction.setHoverImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_CTOOL_ADD_ATTRIBUTE));
- addAttributeListAction.setDisabledImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_DTOOL_ADD_ATTRIBUTE));
-
- addGroupToContentModelAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_ETOOL_ADD_GROUPTOCONMODEL));
- addGroupToContentModelAction.setHoverImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_CTOOL_ADD_GROUPTOCONMODEL));
- addGroupToContentModelAction.setDisabledImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_DTOOL_ADD_GROUPTOCONMODEL));
-
- addElementToContentModelAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_ETOOL_ADD_ELEMENTTOCONMODEL));
- addElementToContentModelAction.setHoverImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_CTOOL_ADD_ELEMENTTOCONMODEL));
- addElementToContentModelAction.setDisabledImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_DTOOL_ADD_ELEMENTTOCONMODEL));
-
- // use the same images as addGroupToContentModelAction
- replaceEmptyContentModelWithGroupAction.setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_ETOOL_ADD_GROUPTOCONMODEL));
- replaceEmptyContentModelWithGroupAction.setHoverImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_CTOOL_ADD_GROUPTOCONMODEL));
- replaceEmptyContentModelWithGroupAction.setDisabledImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_DTOOL_ADD_GROUPTOCONMODEL));
- }
-
- void _selectionChanged(SelectionChangedEvent event) {
- /*
- * Save the selection so we only notify the actions when the menu is
- * shown
- */
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection) {
- fViewerSelection = (IStructuredSelection) selection;
- }
- else {
- fViewerSelection = StructuredSelection.EMPTY;
- }
- }
-
- void addActionItemsForSelection(Object selectedObject, IMenuManager menu) {
- if (selectedObject instanceof NodeList) {
- // add appropriate menu to logical view
- NodeList folder = (NodeList) selectedObject;
- if (folder.getListType().equals(DTDRegionTypes.NOTATION_TAG)) {
- menu.add(addNotationAction);
- }
- else if (folder.getListType().equals(DTDRegionTypes.ENTITY_TAG)) {
- menu.add(addEntityAction);
- }
- else if (folder.getListType().equals(DTDRegionTypes.ELEMENT_TAG)) {
- LabelValuePair[] availableEntities = fModel.createParmEntityContentItems(null);
- addParameterEntityReferenceAction.setEnabled(availableEntities.length > 0);
-
- menu.add(addElementAction);
- menu.add(addParameterEntityReferenceAction);
- }
- else if (folder.getListType().equals(DTDRegionTypes.ATTLIST_TAG)) {
- menu.add(addAttributeListAction);
- }
- }
- if (selectedObject instanceof DTDFile || selectedObject == null) {
- LabelValuePair[] availableEntities = fModel.createParmEntityContentItems(null);
- addParameterEntityReferenceAction.setEnabled(availableEntities.length > 0);
-
- menu.add(addElementAction);
- menu.add(addEntityAction);
- menu.add(addNotationAction);
- menu.add(addParameterEntityReferenceAction);
- menu.add(addCommentAction);
- menu.add(addAttributeListAction);
- menu.add(new Separator());
- }
-
- if (selectedObject instanceof Element) {
- Element dtdElement = (Element) selectedObject;
-
- CMNode contentModel = dtdElement.getContentModel();
- if (contentModel == null) {
- menu.add(addGroupToContentModelAction);
- menu.add(addElementToContentModelAction);
- }
- else if (contentModel != null && CMNode.EMPTY.equals(contentModel.getType())) {
- menu.add(replaceEmptyContentModelWithGroupAction);
- }
- menu.add(addAttributeAction);
- }
- else if (selectedObject instanceof CMGroupNode) {
- menu.add(addElementToContentModelAction);
- menu.add(addGroupToContentModelAction);
- }
- else if (selectedObject instanceof AttributeList) {
- menu.add(addAttributeAction);
- }
-
- menu.add(new Separator());
- addEditActions(menu);
- menu.add(new Separator());
-
- if (selectedObject instanceof DTDNode && !(selectedObject instanceof CMNode && ((CMNode) selectedObject).isRootElementContent())) {
- menu.add(deleteAction);
- deleteAction.setEnabled(true);
- }
- }
-
- void addEditActions(IMenuManager menu) {
- // menu.add(undoAction);
- // menu.add(redoAction);
- // menu.add(new Separator());
- // menu.add(cutAction);
- // menu.add(copyAction);
- // menu.add(pasteAction);
- }
-
- public void createMenuListenersFor(Viewer viewer) {
- viewer.addSelectionChangedListener(fInternalSelectionChangedListener);
- ISelection selection = viewer.getSelection();
- if (selection instanceof IStructuredSelection) {
- fViewerSelection = (IStructuredSelection) selection;
- }
- else {
- fViewerSelection = StructuredSelection.EMPTY;
- }
-
- fViewerList.add(viewer);
- }
-
- public IMenuListener getMenuListener() {
- return fMenuListener;
- }
-
- public void removeMenuListenersFor(Viewer viewer) {
- viewer.removeSelectionChangedListener(fInternalSelectionChangedListener);
- fViewerList.remove(viewer);
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDLabelProvider.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDLabelProvider.java
deleted file mode 100644
index 6c7fb1f3ef..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDLabelProvider.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Jens Lukowski/Innoopract - initial renaming/restructuring
- *
- *******************************************************************************/
-package org.eclipse.wst.dtd.ui.views.contentoutline;
-
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.dtd.core.internal.DTDFile;
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.NodeList;
-
-class DTDLabelProvider extends LabelProvider {
-
- public DTDLabelProvider() {
- super();
- }
-
- /**
- * Returns the image for the label of the given element.
- *
- * @param element
- * the element for which to provide the label image
- * @return the image used to label the element, or <code>null</code> if
- * these is no image for the given object
- */
- public Image getImage(Object element) {
- Image image = null;
- if (element instanceof DTDNode) {
- image = ((DTDNode) element).getImage();
- }
- else if (element instanceof NodeList) {
- image = ((NodeList) element).getImage();
- }
- else if (element instanceof DTDFile) {
- image = ((DTDFile) element).getImage();
- }
- else {
- image = super.getImage(element);
- }
- return image;
- }
-
- /**
- * Returns the text for the label of the given element.
- *
- * @param element
- * the element for which to provide the label text
- * @return the text string used to label the element, or <code>null</code>
- * if these is no text label for the given object
- */
- public String getText(Object element) {
- if (element instanceof DTDNode) {
- String name = ((DTDNode) element).getName();
-
- // strip leading whitespace (useful for multi-line comments)
- int firstSignificantCharacter = 0;
- int lastVisibleCharacter = name.length() - 1;
- for (firstSignificantCharacter = 0; firstSignificantCharacter < name.length(); firstSignificantCharacter++) {
- if (!Character.isWhitespace(name.charAt(firstSignificantCharacter)))
- break;
- }
- // keep only the first line of text in a multi-line name
- if (firstSignificantCharacter < lastVisibleCharacter) {
- for (lastVisibleCharacter = firstSignificantCharacter + 1; lastVisibleCharacter < name.length(); lastVisibleCharacter++) {
- char character = name.charAt(lastVisibleCharacter);
- if (character == '\r' || character == '\n')
- break;
- }
- }
- if (firstSignificantCharacter > 0 && firstSignificantCharacter < name.length() - 1) {
- name = name.substring(firstSignificantCharacter, lastVisibleCharacter);
- }
-
- return name;
- }
- else if (element instanceof NodeList) {
- // return ((NodeList) element).getListType();
- return ((NodeList) element).getName();
- }
- else if (element instanceof DTDFile) {
- return ((DTDFile) element).getName();
- }
- return super.getText(element);
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDTreeContentProvider.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDTreeContentProvider.java
deleted file mode 100644
index a6aa906b4e..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/DTDTreeContentProvider.java
+++ /dev/null
@@ -1,398 +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.dtd.ui.views.contentoutline;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.wst.dtd.core.internal.Attribute;
-import org.eclipse.wst.dtd.core.internal.AttributeList;
-import org.eclipse.wst.dtd.core.internal.Comment;
-import org.eclipse.wst.dtd.core.internal.DTDFile;
-import org.eclipse.wst.dtd.core.internal.DTDNode;
-import org.eclipse.wst.dtd.core.internal.Element;
-import org.eclipse.wst.dtd.core.internal.Entity;
-import org.eclipse.wst.dtd.core.internal.NodeList;
-import org.eclipse.wst.dtd.core.internal.Notation;
-import org.eclipse.wst.dtd.core.internal.ParameterEntityReference;
-import org.eclipse.wst.dtd.core.internal.document.DTDModelImpl;
-import org.eclipse.wst.dtd.core.internal.event.IDTDFileListener;
-import org.eclipse.wst.dtd.core.internal.event.NodesEvent;
-
-class DTDTreeContentProvider implements ITreeContentProvider, IDTDFileListener {
-
- private Object fInputObject;
- protected Viewer fViewer;
-
- // A cached set of IndexedNodeLists, required for getParent to return the
- // correct instances mapping to TreeItems
- protected Object[] logicalNodeLists = null;
-
- private boolean showLogicalOrder = false;
-
- public DTDTreeContentProvider() {
- super();
- }
-
- public void dispose() {
- fViewer = null;
- }
-
- private void expandToNode(DTDNode node) {
- DTDFile dtdFile = node.getDTDFile();
- // first expand the root
- AbstractTreeViewer viewer = (AbstractTreeViewer) fViewer;
- viewer.expandToLevel(dtdFile, 1);
- NodeList listToExpand = null;
- if (node instanceof Element || node instanceof ParameterEntityReference) {
- listToExpand = dtdFile.getElementsAndParameterEntityReferences();
- }
- else if (node instanceof Notation) {
- listToExpand = dtdFile.getNotations();
- }
- else if (node instanceof Entity) {
- listToExpand = dtdFile.getEntities();
- }
- else if (node instanceof Comment) {
- listToExpand = dtdFile.getComments();
- }
- if (listToExpand != null) {
- viewer.expandToLevel(listToExpand, 1);
- }
- viewer.expandToLevel(node, 0);
- }
-
- public Object[] getChildren(Object parentElement) {
- // return the lists of nodes when in logical order mode, all the Nodes
- // otherwise
- if (parentElement instanceof DTDFile) {
- if (isShowLogicalOrder()) {
- // return the visible node lists
- if (logicalNodeLists == null) {
- Iterator nodeLists = ((DTDFile) parentElement).getNodeLists().iterator();
- List visibleLists = new ArrayList(7);
- while (nodeLists.hasNext()) {
- NodeList list = (NodeList) nodeLists.next();
- if (isVisibleNodeList(list)) {
- visibleLists.add(list);
- }
- }
- logicalNodeLists = visibleLists.toArray();
- }
- return logicalNodeLists;
- }
- else {
- // return the visible nodes
- List allNodes = ((DTDFile) parentElement).getNodes();
- List visibleNodes = new ArrayList(allNodes.size());
- for (int i = 0; i < allNodes.size(); i++) {
- Object o = allNodes.get(i);
- if (isVisibleNode(o)) {
- visibleNodes.add(o);
- }
- }
- return visibleNodes.toArray();
- }
- }
- else if (parentElement instanceof NodeList) {
- return ((NodeList) parentElement).getNodes().toArray();
- }
- else if (parentElement instanceof Element) {
- // always group the attributes directly under the element
- Object[] children = ((DTDNode) parentElement).getChildren();
- List attributes = ((Element) parentElement).getElementAttributes();
- Object[] logicalChildren = new Object[children.length + attributes.size()];
- int index = 0;
- for (index = 0; index < children.length; index++) {
- logicalChildren[index] = children[index];
- }
- for (Iterator iter = attributes.iterator(); iter.hasNext();) {
- logicalChildren[index++] = iter.next();
- }
- return logicalChildren;
- }
- else if (parentElement instanceof DTDNode) {
- return ((DTDNode) parentElement).getChildren();
- }
- return Collections.EMPTY_LIST.toArray();
- }
-
- public Object[] getElements(java.lang.Object inputElement) {
- Object[] elements = null;
- // Always show the DTDFile "node"
- if (inputElement instanceof DTDModelImpl) {
- elements = new Object[]{((DTDModelImpl) inputElement).getDTDFile()};
- }
- if (elements == null) {
- elements = new Object[0];
- }
- return elements;
- }
-
- public Object getParent(Object element) {
- Object parent = null;
- if (element instanceof DTDNode) {
- DTDNode node = (DTDNode) element;
- if (element instanceof Attribute) {
- // then we must say that the element with the same name
- // as our attribute's parent attributelist is our parent
- parent = node.getParentNode();
- if (parent != null && parent instanceof AttributeList) {
- return getParent(parent);
- }
- }
- if (element instanceof AttributeList) {
- // then we must say that the element with the same name
- // as our attributelist is our parent
- String attListName = ((AttributeList) element).getName();
- Iterator iter = node.getDTDFile().getElementsAndParameterEntityReferences().getNodes().iterator();
- while (iter.hasNext() && parent == null) {
- DTDNode currentNode = (DTDNode) iter.next();
- if (currentNode instanceof Element && currentNode.getName().equals(attListName)) {
- parent = currentNode;
- }
- }
- }
-
- if (parent == null) {
- parent = ((DTDNode) element).getParentNode();
- }
-
- // if showing in the logical order, return the IndexedNodeList
- // acting as the parent in the tree
- if (parent == null) {
- if (isShowLogicalOrder()) {
- Object[] indexedNodeLists = getChildren(((DTDModelImpl) fInputObject).getDTDFile());
- for (int i = 0; i < indexedNodeLists.length && parent == null; i++) {
- if (indexedNodeLists[i] instanceof NodeList) {
- if (((NodeList) indexedNodeLists[i]).getNodes().contains(element))
- parent = indexedNodeLists[i];
- }
- }
- }
- else {
- parent = ((DTDModelImpl) fInputObject).getDTDFile();
- }
- }
- }
- else if (element instanceof NodeList && fInputObject instanceof DTDModelImpl) {
- parent = ((DTDModelImpl) fInputObject).getDTDFile();
- }
- return parent;
- }
-
- public boolean hasChildren(Object element) {
- Object[] children = getChildren(element);
- return children.length > 0;
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- fViewer = viewer;
-
- if (fInputObject instanceof DTDModelImpl) {
- ((DTDModelImpl) fInputObject).getDTDFile().removeDTDFileListener(this);
- }
- fInputObject = newInput;
- if (fInputObject instanceof DTDModelImpl) {
- ((DTDModelImpl) fInputObject).getDTDFile().addDTDFileListener(this);
- }
- }
-
- /**
- * Get the value of showLogicalOrder.
- *
- * @return value of showLogicalOrder.
- */
- public boolean isShowLogicalOrder() {
- return showLogicalOrder;
- }
-
- private boolean isVisibleNode(Object o) {
- if (o instanceof AttributeList) {
- return false;
- }
- return true;
- }
-
- private boolean isVisibleNodeList(NodeList nodeList) {
- /*
- * All NodesLists should be visible because you can momentarily have
- * an ATTLIST (for example) without a corresponding ELEMENT
- * declaration
- */
- return true;// !nodeList.getListType().equals(DTDRegionTypes.ATTLIST_TAG);
- }
-
- public void nodeChanged(final DTDNode node) {
- if (fViewer instanceof StructuredViewer) {
- // System.out.println("node changed notified");
- // System.out.println("selection before = " +
- // ((StructuredViewer)view).getSelection());
- if (node instanceof AttributeList && isShowLogicalOrder()) {
- // in this case, we are showing attributes under the element.
- // refresh the element object instead
- Iterator iter = node.getDTDFile().getNodes().iterator();
- while (iter.hasNext()) {
- DTDNode currentNode = (DTDNode) iter.next();
- if (currentNode.getName().equals(node.getName()) && currentNode instanceof Element) {
- ((StructuredViewer) fViewer).refresh(currentNode, true);
- }
- } // end of while ()
- }
- else {
- // do standard stuff
- fViewer.getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (fViewer.getControl().isDisposed())
- return;
- if (node.getParentNode() != null) {
- ((StructuredViewer) fViewer).refresh(node.getParentNode(), true);
- }
- ((StructuredViewer) fViewer).refresh(node, true);
- }
- });
- }
-
- if (node instanceof Attribute) {
- fViewer.getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (fViewer.getControl().isDisposed())
- return;
- /*
- * go from the attribute to its list and then owning element
- * so we refresh the tree item there as well
- */
- Object attrList = node.getParentNode();
- if (attrList != null && attrList instanceof AttributeList) {
- String attListName = ((AttributeList) attrList).getName();
- Iterator iter = node.getDTDFile().getElementsAndParameterEntityReferences().getNodes().iterator();
- Object parent = null;
- while (iter.hasNext() && parent == null) {
- DTDNode currentNode = (DTDNode) iter.next();
- if (currentNode instanceof Element && currentNode.getName().equals(attListName)) {
- parent = currentNode;
- }
- }
- if (parent != null) {
- ((StructuredViewer) fViewer).refresh(parent, true);
- }
- }
- }
- });
- }
- // System.out.println("selection after = " +
- // ((StructuredViewer)view).getSelection());
- }
- }
-
- public void nodesAdded(NodesEvent event) {
- if (fViewer instanceof AbstractTreeViewer) {
- StructuredViewer viewer = (StructuredViewer) fViewer;
- ISelection selection = viewer.getSelection();
-
- Object firstObj = (!selection.isEmpty() && selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null;
- DTDNode oldSelectedNode = null;
- if (firstObj instanceof DTDNode) {
- oldSelectedNode = (DTDNode) firstObj;
- }
-
- final AbstractTreeViewer abstractTreeViewer = (AbstractTreeViewer) fViewer;
- for (Iterator it = event.getNodes().iterator(); it.hasNext();) {
- Object node = it.next();
- final Object parent = getParent(node);
- // Bug 111100 - If it is a top level node (ie. parent is a
- // DTDFile),
- // insert the node directly to improve performance
- if (parent instanceof DTDFile) {
- Object[] objs = getChildren(parent);
- for (int i = 0; i < objs.length; i++) {
- if (objs[i] == node) {
- abstractTreeViewer.insert(parent, node, i);
- break;
- }
- }
- }
- // If the parent node is not a DTDFile, just refresh the
- // parent for now
- else if (parent != null) {
- fViewer.getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (fViewer.getControl().isDisposed())
- return;
- abstractTreeViewer.refresh(parent, true);
- }
- });
- }
- // You should never reach this block, if you do, just refresh
- // the whole tree
- else {
- fViewer.getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (fViewer.getControl().isDisposed())
- return;
- abstractTreeViewer.refresh(true);
- }
- });
- }
- }
-
- Iterator iter = event.getNodes().iterator();
- List newSelection = new ArrayList();
- while (iter.hasNext()) {
- DTDNode node = (DTDNode) iter.next();
- if (oldSelectedNode == null || node.getStructuredDTDDocumentRegion() != oldSelectedNode.getStructuredDTDDocumentRegion() || node.getStartOffset() != oldSelectedNode.getStartOffset() || node.getEndOffset() != oldSelectedNode.getEndOffset()) {
- // add to selection
- newSelection.add(node);
- expandToNode(node);
- }
- }
- if (newSelection.size() > 0) {
- viewer.setSelection(new StructuredSelection(newSelection));
- }
-
- }
- }
-
- public void nodesRemoved(NodesEvent event) {
- if (fViewer instanceof AbstractTreeViewer) {
- AbstractTreeViewer abstractTreeViewer = (AbstractTreeViewer) fViewer;
- for (Iterator iter = event.getNodes().iterator(); iter.hasNext();) {
- abstractTreeViewer.remove(iter.next());
- }
- }
-
- }
-
- /**
- * Set the value of showLogicalOrder.
- *
- * @param value
- * Value to assign to showLogicalOrder.
- */
- public void setShowLogicalOrder(boolean value) {
- this.showLogicalOrder = value;
- if (!value) {
- // if not using logical order, lose the cached lists
- logicalNodeLists = null;
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/OrderAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/OrderAction.java
deleted file mode 100644
index 227bc77269..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/OrderAction.java
+++ /dev/null
@@ -1,57 +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
- *
- *******************************************************************************/
-/*
- * Created on Jan 22, 2004
- *
- * To change the template for this generated file go to
- * Window - Preferences - Java - Code Generation - Code and Comments
- */
-package org.eclipse.wst.dtd.ui.views.contentoutline;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.wst.dtd.ui.internal.DTDUIMessages;
-import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImageHelper;
-import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImages;
-import org.eclipse.wst.sse.ui.internal.contentoutline.PropertyChangeUpdateAction;
-
-class OrderAction extends PropertyChangeUpdateAction {
- private DTDTreeContentProvider contentProvider;
- private TreeViewer treeViewer;
-
- public OrderAction(TreeViewer viewer, DTDTreeContentProvider provider, IPreferenceStore store, String preferenceKey) {
- super(DTDUIMessages._UI_BUTTON_GROUP_ITEMS_LOGICALLY, store, preferenceKey, false); //$NON-NLS-1$
- setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_OBJ_ORGANIZE_DTD_LOGICALLY));
- treeViewer = viewer;
- contentProvider = provider;
- setToolTipText(getText());
- contentProvider.setShowLogicalOrder(isChecked());
- }
-
- public void update() {
- super.update();
- treeViewer.getControl().setRedraw(false);
- setChecked(getPreferenceStore().getBoolean(getPreferenceKey()));
- Object[] expandedElements = treeViewer.getExpandedElements();
- ISelection selection = treeViewer.getSelection();
- contentProvider.setShowLogicalOrder(isChecked());
-
- // treeViewer.setInput(treeViewer.getInput());
- treeViewer.refresh(treeViewer.getInput());
-
- treeViewer.setExpandedElements(expandedElements);
- treeViewer.getControl().setRedraw(true);
- treeViewer.setSelection(selection);
- }
-}
diff --git a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/SortAction.java b/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/SortAction.java
deleted file mode 100644
index dc73f47389..0000000000
--- a/bundles/org.eclipse.wst.dtd.ui/src/org/eclipse/wst/dtd/ui/views/contentoutline/SortAction.java
+++ /dev/null
@@ -1,57 +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.dtd.ui.views.contentoutline;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.wst.dtd.ui.internal.DTDUIMessages;
-import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImageHelper;
-import org.eclipse.wst.dtd.ui.internal.editor.DTDEditorPluginImages;
-import org.eclipse.wst.sse.ui.internal.contentoutline.PropertyChangeUpdateAction;
-
-class SortAction extends PropertyChangeUpdateAction {
- private TreeViewer treeViewer;
- private ViewerComparator fComparator;
-
- public SortAction(TreeViewer viewer, IPreferenceStore store, String preferenceKey) {
- super(DTDUIMessages._UI_BUTTON_SORT_ITEMS, store, preferenceKey, false); //$NON-NLS-1$
- setImageDescriptor(DTDEditorPluginImageHelper.getInstance().getImageDescriptor(DTDEditorPluginImages.IMG_OBJ_SORT));
- setToolTipText(getText());
- fComparator = new DTDContentOutlineComparator();
- treeViewer = viewer;
- if (isChecked()) {
- treeViewer.setComparator(fComparator);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.texteditor.IUpdate#update()
- */
- public void update() {
- super.update();
- treeViewer.getControl().setRedraw(false);
- Object[] expandedElements = treeViewer.getExpandedElements();
- if (isChecked()) {
- treeViewer.setComparator(fComparator);
- }
- else {
- treeViewer.setComparator(null);
- }
- treeViewer.setInput(treeViewer.getInput());
- treeViewer.setExpandedElements(expandedElements);
- treeViewer.getControl().setRedraw(true);
- }
-}

Back to the top