Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css')
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/StructuredTextViewerConfigurationCSS.java163
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/ActionContributorCSS.java121
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/CSSUIMessages.java139
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/CSSUIPlugin.java99
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/CSSUIPluginResources.properties128
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/Logger.java156
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/autoedit/StructuredAutoEditStrategyCSS.java596
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSCACandidate.java113
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSCompletionProposalComputer.java258
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSContentAssistContext.java463
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSContentAssistProcessor.java339
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalArranger.java180
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGenerator.java232
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForAtmarkRule.java294
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForDeclarationName.java169
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForDeclarationValue.java372
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForHTMLTag.java159
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForPseudoSelector.java164
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSStructuredContentAssistProcessor.java41
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSTemplateCompletionProcessor.java72
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSTemplatesCompletionProposalComputer.java107
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CompletionProposal.java188
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/HTML40Namespace.java890
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/IProposalInfo.java25
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/ProposalInfoFactory.java66
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentoutline/CSSNodeAdapter.java641
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentoutline/JFaceNodeAdapterFactoryCSS.java37
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentoutline/RefreshStructureJob.java355
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentproperties/ContentSettingsRegistry.java40
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentproperties/ui/CSSContentSettingsPropertyPage.java106
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentproperties/ui/CSSWebContentSettingsPropertyPage.java156
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/edit/ui/CleanupActionCSSDelegate.java134
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/edit/ui/CleanupDialogCSS.java325
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/CSSEditorPluginImages.java54
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/CSSSelectionConverterFactory.java153
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/IHelpContextIds.java49
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/AbstractCommentHandler.java102
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/AddBlockCommentHandler.java74
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/CleanupDocumentHandler.java120
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/RemoveBlockCommentHandler.java77
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/StructuredSelectEnclosingHandler.java54
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/StructuredSelectNextHandler.java65
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/StructuredSelectPreviousHandler.java60
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/ToggleCommentHandler.java159
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/image/CSSImageHelper.java183
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/image/CSSImageType.java235
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSCompletionProposalCategoriesConfiguration.java82
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSUIPreferenceInitializer.java98
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSUIPreferenceNames.java79
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSColorPage.java221
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSContentAssistPreferencePage.java126
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSFilesPreferencePage.java67
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSSourcePreferencePage.java296
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSSyntaxColoringPage.java902
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSTemplatePreferencePage.java165
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/projection/CSSFoldingStrategy.java88
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/projection/CSSRuleFoldingPosition.java61
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/properties/CSSPropertySource.java355
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/properties/CSSTextPropertyDescriptor.java112
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/registry/AdapterFactoryProviderCSS.java49
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectEnclosingCSSActionDelegate.java64
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectNextCSSActionDelegate.java81
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectPreviousCSSActionDelegate.java76
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/style/IStyleConstantsCSS.java40
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/style/LineStyleProviderForCSS.java228
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/style/LineStyleProviderForEmbeddedCSS.java135
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/templates/EncodingTemplateVariableResolverCSS.java38
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/templates/TemplateContextTypeCSS.java34
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/templates/TemplateContextTypeIdsCSS.java20
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/text/CSSCharacterPairInserter.java43
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/text/CSSDocumentRegionEdgeMatcher.java83
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/FacetModuleCoreSupport.java67
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/FacetModuleCoreSupportDelegate.java84
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/NewCSSFileWizardPage.java225
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/NewCSSTemplatesWizardPage.java521
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/NewCSSWizard.java145
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSContentOutlineConfiguration.java121
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSContentSelectionProvider.java47
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSQuickOutlineConfiguration.java41
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeContentProviderCSS.java176
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeLabelProviderCSS.java115
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/SortAction.java55
-rw-r--r--bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSPropertySheetConfiguration.java193
83 files changed, 0 insertions, 14046 deletions
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/StructuredTextViewerConfigurationCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/StructuredTextViewerConfigurationCSS.java
deleted file mode 100644
index 2afea5f847..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/StructuredTextViewerConfigurationCSS.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.text.IAutoEditStrategy;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.text.formatter.IContentFormatter;
-import org.eclipse.jface.text.formatter.MultiPassContentFormatter;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.wst.css.core.internal.CSSCorePlugin;
-import org.eclipse.wst.css.core.internal.format.FormatProcessorCSS;
-import org.eclipse.wst.css.core.internal.preferences.CSSCorePreferenceNames;
-import org.eclipse.wst.css.core.text.ICSSPartitions;
-import org.eclipse.wst.css.ui.internal.contentassist.CSSStructuredContentAssistProcessor;
-import org.eclipse.wst.css.ui.internal.style.LineStyleProviderForCSS;
-import org.eclipse.wst.sse.core.text.IStructuredPartitions;
-import org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration;
-import org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy;
-import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider;
-
-/**
- * Configuration for a source viewer which shows CSS.
- * <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 StructuredTextViewerConfigurationCSS 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 fLineStyleProviderForCSS;
-
- /**
- * Create new instance of StructuredTextViewerConfigurationCSS
- */
- public StructuredTextViewerConfigurationCSS() {
- // Must have empty constructor to createExecutableExtension
- super();
- }
-
- public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) {
- List allStrategies = new ArrayList(0);
-
- IAutoEditStrategy[] superStrategies = super.getAutoEditStrategies(sourceViewer, contentType);
- for (int i = 0; i < superStrategies.length; i++) {
- allStrategies.add(superStrategies[i]);
- }
-
- return (IAutoEditStrategy[]) allStrategies.toArray(new IAutoEditStrategy[0]);
- }
-
- public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
- if (fConfiguredContentTypes == null) {
- fConfiguredContentTypes = new String[]{ICSSPartitions.STYLE, ICSSPartitions.COMMENT, IStructuredPartitions.DEFAULT_PARTITION, IStructuredPartitions.UNKNOWN_PARTITION};
- }
- return fConfiguredContentTypes;
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration#getContentAssistProcessors(
- * org.eclipse.jface.text.source.ISourceViewer, java.lang.String)
- */
- protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
- IContentAssistProcessor processor = new CSSStructuredContentAssistProcessor(
- this.getContentAssistant(), partitionType, sourceViewer);
- return new IContentAssistProcessor[]{processor};
- }
-
- public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
- IContentFormatter formatter = super.getContentFormatter(sourceViewer);
- // super was unable to create a formatter, probably because
- // sourceViewer does not have document set yet, so just create a
- // generic one
- if (!(formatter instanceof MultiPassContentFormatter))
- formatter = new MultiPassContentFormatter(getConfiguredDocumentPartitioning(sourceViewer), ICSSPartitions.STYLE);
-
- ((MultiPassContentFormatter) formatter).setMasterStrategy(new StructuredFormattingStrategy(new FormatProcessorCSS()));
-
- return formatter;
- }
-
- public String[] getIndentPrefixes(ISourceViewer sourceViewer, String contentType) {
- Vector vector = new Vector();
-
- // prefix[0] is either '\t' or ' ' x tabWidth, depending on preference
- Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences();
- int indentationWidth = preferences.getInt(CSSCorePreferenceNames.INDENTATION_SIZE);
- String indentCharPref = preferences.getString(CSSCorePreferenceNames.INDENTATION_CHAR);
- boolean useSpaces = CSSCorePreferenceNames.SPACE.equals(indentCharPref);
-
- for (int i = 0; i <= indentationWidth; i++) {
- StringBuffer prefix = new StringBuffer();
- boolean appendTab = false;
-
- if (useSpaces) {
- for (int j = 0; j + i < indentationWidth; j++)
- prefix.append(' ');
-
- if (i != 0)
- appendTab = true;
- }
- else {
- for (int j = 0; j < i; j++)
- prefix.append(' ');
-
- if (i != indentationWidth)
- appendTab = true;
- }
-
- if (appendTab) {
- prefix.append('\t');
- vector.add(prefix.toString());
- // remove the tab so that indentation - tab is also an indent
- // prefix
- prefix.deleteCharAt(prefix.length() - 1);
- }
- vector.add(prefix.toString());
- }
-
- vector.add(""); //$NON-NLS-1$
-
- return (String[]) vector.toArray(new String[vector.size()]);
- }
-
- public LineStyleProvider[] getLineStyleProviders(ISourceViewer sourceViewer, String partitionType) {
- LineStyleProvider[] providers = null;
-
- if (partitionType == ICSSPartitions.STYLE || partitionType == ICSSPartitions.COMMENT) {
- providers = new LineStyleProvider[]{getLineStyleProviderForCSS()};
- }
-
- return providers;
- }
-
- private LineStyleProvider getLineStyleProviderForCSS() {
- if (fLineStyleProviderForCSS == null) {
- fLineStyleProviderForCSS = new LineStyleProviderForCSS();
- }
- return fLineStyleProviderForCSS;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/ActionContributorCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/ActionContributorCSS.java
deleted file mode 100644
index d7b45af582..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/ActionContributorCSS.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal;
-
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
-import org.eclipse.ui.texteditor.RetargetTextEditorAction;
-import org.eclipse.wst.sse.ui.internal.actions.ActionContributor;
-import org.eclipse.wst.sse.ui.internal.actions.ActionDefinitionIds;
-import org.eclipse.wst.sse.ui.internal.actions.StructuredTextEditorActionConstants;
-
-/**
- * ActionContributorCSS
- *
- * 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 ActionContributorCSS extends ActionContributor {
- private static final String[] EDITOR_IDS = {"org.eclipse.wst.css.core.csssource.source", "org.eclipse.wst.sse.ui.StructuredTextEditor"}; //$NON-NLS-1$ //$NON-NLS-2$
-
- protected RetargetTextEditorAction fContentAssist = null;
- protected RetargetTextEditorAction fCleanupDocument = null;
- protected RetargetTextEditorAction fFormatDocument = null;
- protected RetargetTextEditorAction fFormatActiveElements = null;
-
- public ActionContributorCSS() {
- super();
-
- ResourceBundle resourceBundle = CSSUIMessages.getResourceBundle();
-
- // edit commands
- fContentAssist = new RetargetTextEditorAction(resourceBundle, ""); //$NON-NLS-1$
- fContentAssist.setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
-
- // source commands
- fCleanupDocument = new RetargetTextEditorAction(resourceBundle, ""); //$NON-NLS-1$
- fCleanupDocument.setActionDefinitionId(ActionDefinitionIds.CLEANUP_DOCUMENT);
-
- fFormatDocument = new RetargetTextEditorAction(resourceBundle, ""); //$NON-NLS-1$
- fFormatDocument.setActionDefinitionId(ActionDefinitionIds.FORMAT_DOCUMENT);
-
- fFormatActiveElements = new RetargetTextEditorAction(resourceBundle, ""); //$NON-NLS-1$
- fFormatActiveElements.setActionDefinitionId(ActionDefinitionIds.FORMAT_ACTIVE_ELEMENTS);
- }
-
- 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(fContentAssist);
- editMenu.add(fMenuAdditionsGroupMarker);
- }
-
- // source commands
- String sourceMenuLabel = CSSUIMessages.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(fCleanupDocument);
- sourceMenu.add(fFormatDocument);
- sourceMenu.add(fFormatActiveElements);
- 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);
- }
- }
- }
-
- public void setActiveEditor(IEditorPart activeEditor) {
- super.setActiveEditor(activeEditor);
-
- ITextEditor textEditor = getTextEditor(activeEditor);
-
- fContentAssist.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_CONTENTASSIST_PROPOSALS));
-
- fCleanupDocument.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_CLEANUP_DOCUMENT));
- fFormatDocument.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_DOCUMENT));
- fFormatActiveElements.setAction(getAction(textEditor, StructuredTextEditorActionConstants.ACTION_NAME_FORMAT_ACTIVE_ELEMENTS));
- fCleanupDocument.setEnabled(textEditor != null && textEditor.isEditable());
- fFormatDocument.setEnabled(textEditor != null && textEditor.isEditable());
- fFormatActiveElements.setEnabled(textEditor != null && textEditor.isEditable());
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/CSSUIMessages.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/CSSUIMessages.java
deleted file mode 100644
index 56040a5984..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/CSSUIMessages.java
+++ /dev/null
@@ -1,139 +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.css.ui.internal;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.osgi.util.NLS;
-
-public class CSSUIMessages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.wst.css.ui.internal.CSSUIPluginResources";//$NON-NLS-1$
- private static ResourceBundle fResourceBundle;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, CSSUIMessages.class);
- }
-
- public static ResourceBundle getResourceBundle() {
- try {
- if (fResourceBundle == null)
- fResourceBundle = ResourceBundle.getBundle(BUNDLE_NAME);
- }
- catch (MissingResourceException x) {
- fResourceBundle = null;
- }
- return fResourceBundle;
- }
-
- public static String INFO_Not_Categorized_1;
- public static String PrefsLabel_WrappingWithoutAttr;
- public static String PrefsLabel_WrappingInsertLineBreak;
- public static String PrefsLabel_CaseGroup;
- public static String PrefsLabel_CaseIdent;
- public static String PrefsLabel_CasePropName;
- public static String PrefsLabel_CasePropValue;
- public static String PrefsLabel_CaseIdentUpper;
- public static String PrefsLabel_CaseIdentLower;
- public static String PrefsLabel_SelectorTagName;
- public static String PrefsLabel_CasePropNameUpper;
- public static String PrefsLabel_CasePropNameLower;
- public static String PrefsLabel_CasePropValueUpper;
- public static String PrefsLabel_CasePropValueLower;
- public static String PrefsLabel_SelectorTagNameUpper;
- public static String PrefsLabel_SelectorTagNameLower;
- public static String PrefsLabel_ColorSample;
- public static String PrefsLabel_ColorNormal;
- public static String PrefsLabel_ColorAtmarkRule;
- public static String PrefsLabel_ColorSelector;
- public static String PrefsLabel_ColorCombinator;
- public static String PrefsLabel_ColorUniversal;
- public static String PrefsLabel_ColorId;
- public static String PrefsLabel_ColorPseudoClass;
- public static String PrefsLabel_ColorClass;
- public static String PrefsLabel_ColorMedia;
- public static String PrefsLabel_ColorComment;
- public static String PrefsLabel_ColorPropertyName;
- public static String PrefsLabel_ColorPropertyValue;
- public static String PrefsLabel_ColorUri;
- public static String PrefsLabel_ColorString;
- public static String PrefsLabel_ColorColon;
- public static String PrefsLabel_ColorSemiColon;
- public static String PrefsLabel_ColorCurlyBrace;
- public static String PrefsLabel_ColorError;
- public static String PrefsLabel_ColorAttrDelimiter;
- public static String PrefsLabel_ColorAttrName;
- public static String PrefsLabel_ColorAttrValue;
- public static String PrefsLabel_ColorAttrOperator;
- public static String SortAction_0;
- public static String _UI_WIZARD_NEW_TITLE;
- public static String _UI_WIZARD_NEW_HEADING;
- public static String _UI_WIZARD_NEW_DESCRIPTION;
- public static String _ERROR_FILENAME_MUST_END_CSS;
- public static String _WARNING_FOLDER_MUST_BE_INSIDE_WEB_CONTENT;
- public static String Title_InvalidValue;
- public static String Message_InvalidValue;
- public static String FormatMenu_label;
- public static String CleanupDocument_label; // resource bundle
- public static String CleanupDocument_tooltip; // resource bundle
- public static String CleanupDocument_description; // resource bundle
- public static String UI_none;
- public static String Cleanup_UI_;
- public static String CSS_Cleanup_UI_;
- public static String ToggleComment_tooltip;
- public static String AddBlockComment_tooltip;
- public static String RemoveBlockComment_tooltip;
- public static String Identifier_case__UI_;
- public static String Property_name_case__UI_;
- public static String Property_value_case__UI_;
- public static String Selector_tag_name_case__UI_;
- public static String Quote_values_UI_;
- public static String Format_source_UI_;
- public static String As_is_UI_;
- public static String Lower_UI_;
- public static String Upper_UI_;
- public static String SourceMenu_label;
- public static String Formatting_UI_;
- public static String Line_width__UI_;
- public static String Indent_using_tabs_;
- public static String Indent_using_spaces;
- public static String Indentation_size;
- public static String Indentation_size_tip;
- public static String StructureSelectEnclosing_label;
- public static String StructureSelectEnclosing_tooltip;
- public static String StructureSelectEnclosing_description;
- public static String StructureSelectNext_label;
- public static String StructureSelectNext_tooltip;
- public static String StructureSelectNext_description;
- public static String StructureSelectPrevious_label;
- public static String StructureSelectPrevious_tooltip;
- public static String StructureSelectPrevious_description;
- public static String Creating_files_encoding;
- public static String ResourceGroup_nameExists;
- public static String NewCSSTemplatesWizardPage_0;
- public static String NewCSSTemplatesWizardPage_1;
- public static String NewCSSTemplatesWizardPage_2;
- public static String NewCSSTemplatesWizardPage_3;
- public static String NewCSSTemplatesWizardPage_4;
- public static String NewCSSTemplatesWizardPage_5;
- public static String NewCSSTemplatesWizardPage_6;
- public static String NewCSSTemplatesWizardPage_7;
- public static String CSSContentSettingsPropertyPage_0;
- public static String CSSContentSettingsPropertyPage_1;
- 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;
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/CSSUIPlugin.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/CSSUIPlugin.java
deleted file mode 100644
index 1fcef9170a..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/CSSUIPlugin.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.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.css.ui.internal.preferences.CSSUIPreferenceNames;
-import org.eclipse.wst.css.ui.internal.templates.TemplateContextTypeIdsCSS;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class CSSUIPlugin extends AbstractUIPlugin {
- public final static String ID = "org.eclipse.wst.css.ui"; //$NON-NLS-1$
- //The shared instance.
- private static CSSUIPlugin plugin;
-
- /**
- * The template store for the css ui.
- */
- private TemplateStore fTemplateStore;
-
- /**
- * The template context type registry for css ui.
- */
- private ContextTypeRegistry fContextTypeRegistry;
-
- /**
- * The constructor.
- */
- public CSSUIPlugin() {
- super();
- plugin = this;
- }
-
- /**
- * Returns the shared instance.
- */
- public static CSSUIPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns the workspace instance.
- */
- public static IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- /**
- * Returns the template store for the css editor templates.
- *
- * @return the template store for the css editor templates
- */
- public TemplateStore getTemplateStore() {
- if (fTemplateStore == null) {
- fTemplateStore = new ContributionTemplateStore(getTemplateContextRegistry(), getPreferenceStore(), CSSUIPreferenceNames.TEMPLATES_KEY);
-
- try {
- fTemplateStore.load();
- } catch (IOException e) {
- Logger.logException(e);
- }
- }
- return fTemplateStore;
- }
-
- /**
- * Returns the template context type registry for the css plugin.
- *
- * @return the template context type registry for the css plugin
- */
- public ContextTypeRegistry getTemplateContextRegistry() {
- if (fContextTypeRegistry == null) {
- ContributionContextTypeRegistry registry = new ContributionContextTypeRegistry();
- registry.addContextType(TemplateContextTypeIdsCSS.ALL);
- registry.addContextType(TemplateContextTypeIdsCSS.NEW);
-
- fContextTypeRegistry = registry;
- }
-
- return fContextTypeRegistry;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/CSSUIPluginResources.properties b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/CSSUIPluginResources.properties
deleted file mode 100644
index a29d6c2daf..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/CSSUIPluginResources.properties
+++ /dev/null
@@ -1,128 +0,0 @@
-###############################################################################
-# Copyright (c) 2004, 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
-###############################################################################
-
-INFO_Not_Categorized_1=Not Categorized
-
-## CSS Preferences -- source ##
-PrefsLabel_WrappingWithoutAttr=Disable wrapping in style &attribute of HTML
-PrefsLabel_WrappingInsertLineBreak=Insert &line break between properties
-
-PrefsLabel_CaseGroup=Capitalization style
-PrefsLabel_CaseIdent=Identifier:
-PrefsLabel_CasePropName=Property name:
-PrefsLabel_CasePropValue=Property value:
-PrefsLabel_SelectorTagName=Selector tag name:
-
-PrefsLabel_CaseIdentUpper=&Uppercase
-PrefsLabel_CaseIdentLower=L&owercase
-PrefsLabel_CasePropNameUpper=U&ppercase
-PrefsLabel_CasePropNameLower=Lo&wercase
-PrefsLabel_CasePropValueUpper=Upp&ercase
-PrefsLabel_CasePropValueLower=Lowe&rcase
-PrefsLabel_SelectorTagNameUpper=Upper&case
-PrefsLabel_SelectorTagNameLower=Lowerca&se
-
-## CSS Preferences -- color ##
-
-## The following line is a sample CSS document. Please translate only the following parts:
-## Sample Styles
-PrefsLabel_ColorSample=@import url("../sample2.css");\n\n/* Sample Styles */\n\nBODY {\n\tcolor : black;\n\tbackground-color : rgb(181, 253, 211);\n\ttext-align : center;\n\tfont-family : "Heisei Mincho W3", serif\n}\n\n#content > div *.links a[href~="http://"]:hover {\n\ttext-decoration : underline;\n}\n\n@page :left { margin-left : 4cm }\n\n@media aural {\n\tP.heidi {\n\t\tazimuth : center-left;\n\t\televation : 12.3deg;\n\t\tpause : 30ms 1.6s\n\t}\n}\n
-
-PrefsLabel_ColorNormal=Default
-PrefsLabel_ColorAtmarkRule=At-Rule
-PrefsLabel_ColorSelector=Type Selector
-PrefsLabel_ColorCombinator=Combinator
-PrefsLabel_ColorUniversal=Universal Selector
-PrefsLabel_ColorId=Id Selector
-PrefsLabel_ColorPseudoClass=Pseudo-class
-PrefsLabel_ColorClass=Class Selector
-PrefsLabel_ColorMedia=Media Name
-PrefsLabel_ColorComment=Comment
-PrefsLabel_ColorPropertyName=Property Name
-PrefsLabel_ColorPropertyValue=Property Value
-PrefsLabel_ColorUri=URI
-PrefsLabel_ColorString=Quoted String
-PrefsLabel_ColorColon=Property Delimiter
-PrefsLabel_ColorSemiColon=Semicolon
-PrefsLabel_ColorCurlyBrace=Curly Brace
-PrefsLabel_ColorError=Error
-PrefsLabel_ColorAttrDelimiter=Attribute Selector Delimiter
-PrefsLabel_ColorAttrName=Attribute Name
-PrefsLabel_ColorAttrValue=Attribute Value
-PrefsLabel_ColorAttrOperator=Attribute Selector Operator
-#
-SortAction_0=Sort
-#
-_UI_WIZARD_NEW_TITLE = New CSS File
-_UI_WIZARD_NEW_HEADING = CSS
-_UI_WIZARD_NEW_DESCRIPTION = Create a new CSS file.
-_ERROR_FILENAME_MUST_END_CSS = The file name must end in one of the following extensions {0}.
-_WARNING_FOLDER_MUST_BE_INSIDE_WEB_CONTENT = Files created outside of the Web Content folder will not be included in your deployed Web application.
-#
-Title_InvalidValue=Invalid Value
-Message_InvalidValue=Invalid property value.
-# Copied from sse.ui
-FormatMenu_label=F&ormat
-CleanupDocument_label=C&leanup Document...
-CleanupDocument_tooltip=Cleanup Document
-CleanupDocument_description=Cleanup Document
-UI_none=none
-Cleanup_UI_=Cleanup
-CSS_Cleanup_UI_=CSS Cleanup
-AddBlockComment_tooltip=Add Block Comment
-RemoveBlockComment_tooltip=Remove Block Comment
-ToggleComment_tooltip=Toggle Comment
-Identifier_case__UI_=Identifier case:
-Property_name_case__UI_=Property name case:
-Property_value_case__UI_=Property value case:
-Selector_tag_name_case__UI_=Selector tag name case:
-Quote_values_UI_=Quote values
-Format_source_UI_=&Format source
-As_is_UI_=As-is
-Lower_UI_=Lower
-Upper_UI_=Upper
-SourceMenu_label=&Source
-Formatting_UI_=Formatting
-Line_width__UI_=Line &width:
-Indent_using_tabs_=&Indent using tabs
-Indent_using_spaces=I&ndent using spaces
-Indentation_size=In&dentation size:
-Indentation_size_tip=Indentation size
-StructureSelectEnclosing_label=&Enclosing Element
-StructureSelectEnclosing_tooltip=Expand selection to include enclosing element
-StructureSelectEnclosing_description=Expand selection to include enclosing element
-StructureSelectNext_label=&Next Element
-StructureSelectNext_tooltip=Expand selection to include next sibling
-StructureSelectNext_description=Expand selection to include next sibling
-StructureSelectPrevious_label=&Previous Element
-StructureSelectPrevious_tooltip=Expand selection to include previous sibling
-StructureSelectPrevious_description=Expand selection to include previous sibling
-##
-Creating_files_encoding=Creating files encoding preference
-ResourceGroup_nameExists = The same name already exists.
-NewCSSTemplatesWizardPage_0=Select CSS Template
-NewCSSTemplatesWizardPage_1=Select a template as initial content in the CSS page.
-NewCSSTemplatesWizardPage_2=Name
-NewCSSTemplatesWizardPage_3=Description
-NewCSSTemplatesWizardPage_4=&Use CSS Template
-NewCSSTemplatesWizardPage_5=&Preview:
-NewCSSTemplatesWizardPage_6=Templates are 'New CSS' templates found in the <a>CSS Templates</a> preference page.
-NewCSSTemplatesWizardPage_7=&Templates:
-# CSS Content Settings
-CSSContentSettingsPropertyPage_0=The type of CSS to use. The project setting is used if you specify "none."
-CSSContentSettingsPropertyPage_1=CSS Profile:
-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=CSS editing preferences. Note that some preferences may be set on the <a>{0}</a> preference page.
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/Logger.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/Logger.java
deleted file mode 100644
index 73eba5e3f3..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/Logger.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.css.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.css.ui"; //$NON-NLS-1$
-
- private static final String TRACEFILTER_LOCATION = "/debug/tracefilter"; //$NON-NLS-1$
-
- public static final int OK = IStatus.OK; // 0
- public static final int INFO = IStatus.INFO; // 1
- public static final int WARNING = IStatus.WARNING; // 2
- public static final int ERROR = IStatus.ERROR; // 4
-
- public static final int OK_DEBUG = 200 + OK;
- public static final int INFO_DEBUG = 200 + INFO;
- public static final int WARNING_DEBUG = 200 + WARNING;
- public static final int ERROR_DEBUG = 200 + ERROR;
-
- /**
- * 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;
- }
- message = (message != null) ? message : "null"; //$NON-NLS-1$
- 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 (isTracing(category)) {
- message = (message != null) ? message : "null"; //$NON-NLS-1$
- 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 true if the platform is debugging
- */
- public static boolean isDebugging() {
- return Platform.inDebugMode();
- }
-
- /**
- * Determines if currently tracing a category
- *
- * @param category
- * @return true if tracing category, false otherwise
- */
- public static boolean isTracing(String category) {
- if (!isDebugging())
- return false;
-
- 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)) {
- return true;
- }
- }
- }
- return false;
- }
-
- 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 traceException(String category, String message, Throwable exception) {
- _trace(category, message, exception);
- }
-
- public static void traceException(String category, Throwable exception) {
- _trace(category, exception.getMessage(), exception);
- }
-
- public static void trace(String category, String message) {
- _trace(category, message, null);
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/autoedit/StructuredAutoEditStrategyCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/autoedit/StructuredAutoEditStrategyCSS.java
deleted file mode 100644
index 43e9c53d08..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/autoedit/StructuredAutoEditStrategyCSS.java
+++ /dev/null
@@ -1,596 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.autoedit;
-
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DocumentCommand;
-import org.eclipse.jface.text.IAutoEditStrategy;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ITextEditorExtension3;
-import org.eclipse.wst.css.core.internal.CSSCorePlugin;
-import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts;
-import org.eclipse.wst.css.core.internal.preferences.CSSCorePreferenceNames;
-import org.eclipse.wst.css.core.internal.util.RegionIterator;
-import org.eclipse.wst.css.ui.internal.Logger;
-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;
-
-public class StructuredAutoEditStrategyCSS implements IAutoEditStrategy {
- protected IStructuredDocument structuredDocument = null;
-
- class CompoundRegion {
-
- /* textRegion can be null if the offset is at the end of the document */
- CompoundRegion(IStructuredDocumentRegion documentRegion, ITextRegion textRegion) {
- super();
- this.documentRegion = documentRegion;
- this.textRegion = textRegion;
- }
-
- IStructuredDocumentRegion getDocumentRegion() {
- return documentRegion;
- }
-
- ITextRegion getTextRegion() {
- return textRegion;
- }
-
- int getStart() {
- return (textRegion != null) ? textRegion.getStart() : documentRegion.getStart();
- }
-
- int getEnd() {
- return (textRegion != null) ? textRegion.getEnd() : documentRegion.getEnd();
- }
-
- String getType() {
- return (textRegion != null) ? textRegion.getType() : CSSRegionContexts.CSS_UNKNOWN;
- }
-
- String getText() {
- return (textRegion != null) ? documentRegion.getText(textRegion) : ""; //$NON-NLS-1$
- }
-
- int getStartOffset() {
- return (textRegion != null) ? documentRegion.getStartOffset(textRegion) : documentRegion.getStartOffset();
- }
-
- int getEndOffset() {
- return (textRegion != null) ? documentRegion.getEndOffset(textRegion) : documentRegion.getEndOffset();
- }
-
- private IStructuredDocumentRegion documentRegion;
- private ITextRegion textRegion;
-
- }
-
- /**
- */
- protected void autoIndentAfterClose(DocumentCommand command, String regionType) {
- if (!setRangeForClose(command))
- return;
-
- int position = command.offset + command.length;
-
- if (position == -1 || structuredDocument.getLength() == 0) {
- return;
- }
-
- // get open brace region
- CompoundRegion region = prevCorrespondence(position, regionType);
-
- // get indentation
- String str = getIndentFor(region, false);
-
- // append to input
- if (str != null)
- command.text = str + command.text;
- }
-
- /**
- * Copies the indentation of the previous line.
- */
- protected void autoIndentAfterNewLine(DocumentCommand command) {
- // select nearest white spaces to replace with new-line
- setRangeForNewLine(command);
-
- // get position
- int position = command.offset;
-
- if (position == -1 || structuredDocument.getLength() == 0) {
- return;
- }
-
- // get current region
- CompoundRegion currentRegion = getRegion(command.offset + command.length);
-
- // get key region
- CompoundRegion keyRegion = getPrevKeyRegion(position, currentRegion);
-
- // get indent string
- String str = getIndentFor(keyRegion, true);
-
- // check another indentation
- int shift = needShift(keyRegion, command.offset + command.length);
-
- // create text to replace
- StringBuffer buf = new StringBuffer(command.text);
- if (str != null)
- buf.append(str);
- while (shift-- != 0)
- buf.append(getIndentString());
- command.text = buf.toString();
-
- }
-
- /**
- */
- public void customizeDocumentCommand(IDocument document, DocumentCommand command) {
- Object textEditor = getActiveTextEditor();
- if (!(textEditor instanceof ITextEditorExtension3 && ((ITextEditorExtension3) textEditor).getInsertMode() == ITextEditorExtension3.SMART_INSERT))
- return;
-
- // return;
- // /*
- structuredDocument = (IStructuredDocument) document;
-
- if (command.length == 0 && command.text != null) {
- if (endsWith(document.getLegalLineDelimiters(), command.text) != -1) {
- autoIndentAfterNewLine(command);
- } else if (command.text.equals("}")) {//$NON-NLS-1$
- autoIndentAfterClose(command, CSSRegionContexts.CSS_RBRACE);
- } else if (command.text.equals("]")) {//$NON-NLS-1$
- autoIndentAfterClose(command, CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_END);
- } else if (command.text.equals(")")) {//$NON-NLS-1$
- autoIndentAfterClose(command, CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE);
- }
- }
- // */
-
- // spaces for tab character
- if (command.text != null && command.text.length() > 0 && command.text.charAt(0) == '\t')
- smartInsertForTab(command, document);
- }
-
- /**
- */
- protected String getIndentFor(CompoundRegion region, boolean indentForNextRegion) {
- if (region == null)
- return null;
- IStructuredDocumentRegion flatNode = region.getDocumentRegion();
- if (flatNode == null)
- return null;
-
- try {
- if (region.getType() == CSSRegionContexts.CSS_LBRACE || region.getType() == CSSRegionContexts.CSS_DELIMITER || region.getType() == CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
- // get meanful flat node
- RegionIterator it = new RegionIterator(flatNode, region.getTextRegion());
- it.prev();
- while (it.hasPrev()) {
- ITextRegion r = it.prev();
- region = new CompoundRegion(it.getStructuredDocumentRegion(), r);
- if (region.getType() != CSSRegionContexts.CSS_S)
- break;
- }
- flatNode = region.getDocumentRegion();
- // get indent string
- int position = flatNode.getStart();
- int line = structuredDocument.getLineOfOffset(position);
- int start = structuredDocument.getLineOffset(line);
- int end = findEndOfWhiteSpace(structuredDocument, start, position);
- return structuredDocument.get(start, end - start);
- } else if (region.getType() == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_START ||
- // region.getType() == CSSRegionContexts.CSS_PARENTHESIS_OPEN ||
- region.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION || region.getType() == CSSRegionContexts.CSS_DECLARATION_SEPARATOR) {
- int position = flatNode.getStart() + region.getStart();
- int line = structuredDocument.getLineOfOffset(position);
- int start = structuredDocument.getLineOffset(line);
- int end = findEndOfWhiteSpace(structuredDocument, start, position);
- StringBuffer buf = new StringBuffer(structuredDocument.get(start, end - start));
- position += region.getText().length();
- if (indentForNextRegion) {
- int tokenStart = findEndOfWhiteSpace(structuredDocument, position, structuredDocument.getLineOffset(line) + structuredDocument.getLineLength(line) - 1);
- if (tokenStart < structuredDocument.getLineOffset(line) + structuredDocument.getLineLength(line) - 1) {
- position = tokenStart;
- }
- }
- while (position - end > 0) {
- buf.append(" ");//$NON-NLS-1$
- end++;
- }
- return buf.toString();
- } else
- return "";//$NON-NLS-1$
- } catch (BadLocationException excp) {
- Logger.logException(excp);
- }
- return null;
- }
-
- /**
- */
- protected CompoundRegion getPrevKeyRegion(int position, CompoundRegion currentRegion) {
- if (currentRegion == null) {
- if (structuredDocument.getLastStructuredDocumentRegion() == null)
- return null;
- }
-
- if (currentRegion != null && (currentRegion.getType() == CSSRegionContexts.CSS_RBRACE || currentRegion.getType() == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_END || currentRegion.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)) {
- return prevCorrespondence(currentRegion);
- }
-
- RegionIterator it = new RegionIterator(structuredDocument, position - 1);
- while (it.hasPrev()) {
- ITextRegion r = it.prev();
- CompoundRegion region = new CompoundRegion(it.getStructuredDocumentRegion(), r);
- if (region.getType() == CSSRegionContexts.CSS_LBRACE ||
- // region.getType() == CSSRegionContexts.CSS_RBRACE ||
- region.getType() == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_START ||
- // region.getType() ==
- // CSSRegionContexts.CSS_BRACKET_CLOSE ||
- // // region.getType() ==
- // CSSRegionContexts.CSS_PARENTHESIS_OPEN ||
- // region.getType() ==
- // CSSRegionContexts.CSS_PARENTHESIS_CLOSE ||
- region.getType() == CSSRegionContexts.CSS_DELIMITER || region.getType() == CSSRegionContexts.CSS_DECLARATION_DELIMITER ||
- // region.getType() == CSSRegionContexts.CSS_COLON ||
- // region.getType() == CSSRegionContexts.CSS_COMMENT
- // ||
- region.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION) {
- return region;
- } else if (region.getType() == CSSRegionContexts.CSS_RBRACE || region.getType() == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_END || region.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) {
- // skip to LBRACE
- CompoundRegion pc = prevCorrespondence(region);
- // guard for NPE
- //https://bugs.eclipse.org/bugs/show_bug.cgi?id=111318
- if (pc == null) break;
- it.reset(pc.getDocumentRegion(), pc.getTextRegion());
- it.prev();
- } else if (region.getType() == CSSRegionContexts.CSS_STRING) {
- RegionIterator itTmp = new RegionIterator(structuredDocument, position);
- if (region == itTmp.prev())
- return region; // position is inside of string
- } else if (region.getType() == CSSRegionContexts.CSS_COMMENT) {
- RegionIterator itTmp = new RegionIterator(structuredDocument, position);
- if (region == itTmp.prev())
- return region; // position is inside of comment
- } else if (region.getType() == CSSRegionContexts.CSS_UNKNOWN) {
- String str = region.getText();
- if (str.charAt(str.length() - 1) == '\\')
- return region;
- } else if (region.getType() == CSSRegionContexts.CSS_DECLARATION_SEPARATOR) {
- RegionIterator itPrev = new RegionIterator(region.getDocumentRegion(), region.getTextRegion());
- while (itPrev.hasPrev()) {
- ITextRegion regionPrev = itPrev.prev();
- if (regionPrev.getType() == CSSRegionContexts.CSS_RBRACE) {
- break;
- } else if (regionPrev.getType() == CSSRegionContexts.CSS_DELIMITER || regionPrev.getType() == CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
- return region;
- } else if (regionPrev.getType() == CSSRegionContexts.CSS_LBRACE) {
- while (itPrev.hasPrev()) {
- regionPrev = itPrev.prev();
- if (regionPrev.getType() == CSSRegionContexts.CSS_MEDIA)
- break;
- if (regionPrev.getType() == CSSRegionContexts.CSS_LBRACE || regionPrev.getType() == CSSRegionContexts.CSS_RBRACE || regionPrev.getType() == CSSRegionContexts.CSS_DELIMITER || regionPrev.getType() == CSSRegionContexts.CSS_DECLARATION_DELIMITER)
- return region;
- }
- if (regionPrev.getType() == CSSRegionContexts.CSS_MEDIA)
- break;
- else
- return region;
- }
- }
- }
- }
- return null;
- }
-
- /**
- */
- protected CompoundRegion getRegion(int position) {
- IStructuredDocumentRegion flatNode = structuredDocument.getRegionAtCharacterOffset(position);
- if (flatNode != null)
- return new CompoundRegion(flatNode, flatNode.getRegionAtCharacterOffset(position));
- return null;
- }
-
- /**
- */
- protected int needShift(CompoundRegion region, int position) {
- int shift = 0;
- if (region == null || region.getType() == CSSRegionContexts.CSS_DELIMITER || region.getType() == CSSRegionContexts.CSS_DECLARATION_DELIMITER || region.getType() == CSSRegionContexts.CSS_LBRACE) {
- // get non space region
- CompoundRegion cr = getRegion(position - 1);
- RegionIterator it = new RegionIterator(cr.getDocumentRegion(), cr.getTextRegion());
- ITextRegion nearestRegion = null;
- while (it.hasPrev()) {
- nearestRegion = it.prev();
- if (nearestRegion.getType() != CSSRegionContexts.CSS_S && nearestRegion.getType() != CSSRegionContexts.CSS_COMMENT)
- break;
- }
- if (nearestRegion != null && (nearestRegion.getType() == CSSRegionContexts.CSS_LBRACE || nearestRegion.getType() == CSSRegionContexts.CSS_RBRACE || nearestRegion.getType() == CSSRegionContexts.CSS_DELIMITER || nearestRegion.getType() == CSSRegionContexts.CSS_DECLARATION_DELIMITER))
- shift--;
- else if (region == null)
- shift--;
- shift++;
- }
- if (region != null && region.getType() == CSSRegionContexts.CSS_LBRACE) {
- RegionIterator it = new RegionIterator(structuredDocument, position);
- if (!it.hasPrev() || it.prev().getType() != CSSRegionContexts.CSS_RBRACE)
- shift++;
- else
- shift = 0;
- }
- return shift;
- }
-
- /**
- */
- protected CompoundRegion prevCorrespondence(int position, String regionType) {
- RegionIterator it = new RegionIterator(structuredDocument, position - 1);
- ITextRegion region = null;
- int nest = 1;
- if (regionType == CSSRegionContexts.CSS_RBRACE) {
- // skip to LBRACE
- while (it.hasPrev()) {
- region = it.prev();
- if (region.getType() == CSSRegionContexts.CSS_LBRACE)
- nest--;
- else if (region.getType() == CSSRegionContexts.CSS_RBRACE)
- nest++;
- if (nest <= 0)
- break;
- }
- if (nest == 0)
- return new CompoundRegion(it.getStructuredDocumentRegion(), region);
- }
- if (regionType == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_END) {
- // skip to BRACKET_OPEN
- while (it.hasPrev()) {
- region = it.prev();
- if (region.getType() == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_START)
- nest--;
- else if (region.getType() == CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_END)
- nest++;
- if (nest <= 0)
- break;
- }
- if (nest == 0)
- return new CompoundRegion(it.getStructuredDocumentRegion(), region);
- }
- if (regionType == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE) {
- // skip to PARENTHESIS_OPEN
- while (it.hasPrev()) {
- region = it.prev();
- if (// region.getType() ==
- // CSSRegionContexts.CSS_PARENTHESIS_OPEN ||
- region.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION)
- nest--;
- else if (region.getType() == CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE)
- nest++;
- if (nest <= 0)
- break;
- }
- if (nest == 0)
- return new CompoundRegion(it.getStructuredDocumentRegion(), region);
- }
- return null;
- }
-
- /**
- */
- protected CompoundRegion prevCorrespondence(CompoundRegion region) {
- if (region == null)
- return null;
-
- IStructuredDocumentRegion flatNode = region.getDocumentRegion();
- int position = flatNode.getStart() + region.getStart();
- return prevCorrespondence(position, region.getType());
- }
-
- /**
- * Insert the method's description here.
- *
- * @return boolean
- * @param command
- * org.eclipse.jface.text.DocumentCommand
- */
- protected boolean setRangeForClose(DocumentCommand command) {
- int position = command.offset;
-
- if (position == -1 || structuredDocument.getLength() == 0) {
- return false;
- }
-
- try {
- // find start of line
- int p = (position == structuredDocument.getLength() ? position - 1 : position);
-
- int line = structuredDocument.getLineOfOffset(p);
- int start = structuredDocument.getLineOffset(line);
- RegionIterator it = new RegionIterator(structuredDocument, start);
- boolean allWhiteSpace = false;
- // check whether the text from lStart to position is white space
- // or not
- while (it.hasNext()) {
- ITextRegion region = it.next();
- if (region.getType() != CSSRegionContexts.CSS_S)
- break;
- if (it.getStructuredDocumentRegion().getEndOffset(region) > p) {
- allWhiteSpace = true;
- break;
- }
- }
- if (allWhiteSpace) {
- command.length = command.length - (start - command.offset);
- command.offset = start;
- return true;
- }
- } catch (BadLocationException excp) {
- Logger.logException(excp);
- }
- return false;
- }
-
- /**
- */
- protected void setRangeForNewLine(DocumentCommand command) {
- int position = command.offset;
-
- if (position == -1 || structuredDocument.getLength() == 0) {
- return;
- }
-
- try {
- // add pre-nearest white spaces to replace target
- if (position > 0) {
- IStructuredDocumentRegion flatNode = structuredDocument.getRegionAtCharacterOffset(position - 1);
- if (flatNode != null) {
- ITextRegion region = flatNode.getRegionAtCharacterOffset(position - 1);
- if (region.getType() == CSSRegionContexts.CSS_S) {
- int end = command.offset + command.length;
- int nLine = structuredDocument.getLineOfOffset(position);
- int nStartPos = structuredDocument.getLineOffset(nLine);
- if (nStartPos < flatNode.getStartOffset(region))
- nStartPos = flatNode.getStartOffset(region);
- command.offset = nStartPos;
- command.length = end - command.offset;
- }
- }
- }
-
- // add post-nearest white spaces to replace target
- if (position < structuredDocument.getLength()) {
- IStructuredDocumentRegion flatNode = structuredDocument.getRegionAtCharacterOffset(position);
- if (flatNode != null) {
- ITextRegion region = flatNode.getRegionAtCharacterOffset(position);
- if (region.getType() == CSSRegionContexts.CSS_S) {
- int nLine = structuredDocument.getLineOfOffset(position);
- String currentLineDelim = structuredDocument.getLineDelimiter(nLine);
- int nEndPos = structuredDocument.getLineOffset(nLine) + structuredDocument.getLineLength(nLine) - ((currentLineDelim != null) ? currentLineDelim.length() : 0);
- if (nEndPos > flatNode.getEndOffset(region))
- nEndPos = flatNode.getEndOffset(region);
- command.length = nEndPos - command.offset;
- }
- }
- }
- } catch (BadLocationException e) {
- // do not customize command
- }
-
- }
-
- private static int endsWith(String[] searchStrings, String text) {
- for (int i = 0; i < searchStrings.length; i++) {
- if (text.endsWith(searchStrings[i]))
- return i;
- }
- return -1;
- }
-
- private static int findEndOfWhiteSpace(IDocument document, int offset, int end) throws BadLocationException {
- while (offset < end) {
- char c = document.getChar(offset);
- if (c != ' ' && c != '\t') {
- return offset;
- }
- offset++;
- }
- return end;
- }
-
-
- private String getIndentString() {
- StringBuffer indent = new StringBuffer();
-
- Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences();
- if (preferences != null) {
- char indentChar = ' ';
- String indentCharPref = preferences.getString(CSSCorePreferenceNames.INDENTATION_CHAR);
- if (CSSCorePreferenceNames.TAB.equals(indentCharPref)) {
- indentChar = '\t';
- }
- int indentationWidth = preferences.getInt(CSSCorePreferenceNames.INDENTATION_SIZE);
-
- for (int i = 0; i < indentationWidth; i++) {
- indent.append(indentChar);
- }
- }
- return indent.toString();
- }
-
- /**
- * Return the active text editor if possible, otherwise the active editor
- * part.
- *
- * @return
- */
- private Object getActiveTextEditor() {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- IEditorPart editor = page.getActiveEditor();
- if (editor != null) {
- if (editor instanceof ITextEditor)
- return editor;
- ITextEditor textEditor = (ITextEditor) editor.getAdapter(ITextEditor.class);
- if (textEditor != null)
- return textEditor;
- return editor;
- }
- }
- }
- return null;
- }
-
- /**
- * Insert spaces for tabs
- *
- * @param command
- */
- private void smartInsertForTab(DocumentCommand command, IDocument document) {
- // tab key was pressed. now check preferences to see if need to insert
- // spaces instead of tab
- Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences();
- if (CSSCorePreferenceNames.SPACE.equals(preferences.getString(CSSCorePreferenceNames.INDENTATION_CHAR))) {
- int indentationWidth = preferences.getInt(CSSCorePreferenceNames.INDENTATION_SIZE);
-
- StringBuffer indent = new StringBuffer();
- if (indentationWidth != 0) {
- int indentSize = indentationWidth;
- try {
- IRegion firstLine = document.getLineInformationOfOffset(command.offset);
- int offsetInLine = command.offset - firstLine.getOffset();
- int remainder = offsetInLine % indentationWidth;
-
- indentSize = indentationWidth - remainder;
- } catch (BadLocationException e) {
- Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
- }
-
- for (int i = 0; i < indentSize; i++)
- indent.append(' ');
- }
-
- // replace \t characters with spaces
- command.text = indent.toString();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSCACandidate.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSCACandidate.java
deleted file mode 100644
index 89d80181c0..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSCACandidate.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.contentassist;
-
-
-
-import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode;
-import org.eclipse.wst.css.ui.internal.image.CSSImageType;
-
-class CSSCACandidate {
-
- private String fReplacementString = null;
- private int fCursorPosition = 0;
- private String fDisplayString = null;
- private CSSImageType fImageType = null;
- private CSSMMNode fNode = null;
- /**
- * CSSCACandidate constructor comment.
- */
- CSSCACandidate() {
- super();
- }
-
- /**
- *
- */
- int getCursorPosition() {
- return fCursorPosition;
- }
-
- /**
- *
- */
- String getDisplayString() {
- return fDisplayString;
- }
-
- /**
- *
- */
- CSSImageType getImageType() {
- return fImageType;
- }
-
- /**
- *
- */
- String getReplacementString() {
- return fReplacementString;
- }
-
- CSSMMNode getMMNode() {
- return fNode;
- }
-
- /**
- *
- */
- void setCursorPosition(int cursorPosition) {
- fCursorPosition = cursorPosition;
- }
-
- /**
- *
- */
- void setDisplayString(String displayString) {
- fDisplayString = displayString;
- }
-
- /**
- *
- */
- void setImageType(CSSImageType imageType) {
- fImageType = imageType;
- }
-
- /**
- *
- */
- void setReplacementString(String replacementString) {
- fReplacementString = replacementString;
- }
-
- void setMMNode(CSSMMNode node) {
- fNode = node;
- }
-
- /**
- * Returns a String that represents the value of this object.
- *
- * @return a string representation of the receiver
- */
- public String toString() {
- StringBuffer buf = new StringBuffer();
- buf.append(getReplacementString());
- buf.append("\"");//$NON-NLS-1$
- buf.append(getDisplayString());
- buf.append("\"");//$NON-NLS-1$
- buf.append("(");//$NON-NLS-1$
- buf.append(getCursorPosition());
- buf.append(")");//$NON-NLS-1$
-
- return buf.toString();
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSCompletionProposalComputer.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSCompletionProposalComputer.java
deleted file mode 100644
index 81f6817354..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSCompletionProposalComputer.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.css.ui.internal.contentassist;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.wst.css.core.internal.Logger;
-import org.eclipse.wst.css.core.internal.provisional.adapters.ICSSModelAdapter;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSDocument;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.html.core.internal.htmlcss.StyleAdapterFactory;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-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.ui.contentassist.CompletionProposalInvocationContext;
-import org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer;
-import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.eclipse.wst.xml.ui.internal.contentassist.XMLContentAssistUtilities;
-import org.eclipse.wst.xml.ui.internal.util.SharedXMLEditorPluginImageHelper;
-
-/**
- * <p>Completion computer for CSS</p>
- */
-public class CSSCompletionProposalComputer implements ICompletionProposalComputer {
- /**
- * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#computeCompletionProposals(org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext, org.eclipse.core.runtime.IProgressMonitor)
- */
- public List computeCompletionProposals(CompletionProposalInvocationContext context, IProgressMonitor monitor) {
- ITextViewer viewer = context.getViewer();
- int documentPosition = context.getInvocationOffset();
-
- IndexedRegion indexedNode = ContentAssistUtils.getNodeAt(viewer, documentPosition);
- IDOMNode xNode = null;
- IDOMNode parent = null;
- CSSProposalArranger arranger = null;
-
- // If there is a selected region, we'll need to replace the text
- ITextSelection selection = (ITextSelection) viewer.getSelectionProvider().getSelection();
-
- // bail if we couldn't get an indexed node
- // if(indexedNode == null) return new ICompletionProposal[0];
- if (indexedNode instanceof IDOMNode) {
- xNode = (IDOMNode) indexedNode;
- parent = (IDOMNode) xNode.getParentNode();
- }
- // need to get in here if there in the no 0 region <style>|</style>
- // case
- if ((xNode != null) && xNode.getNodeName().equalsIgnoreCase(HTML40Namespace.ElementName.STYLE)) {
- // now we know the cursor is in a <style> tag w/out region
- IStructuredModel cssModel = getCSSModel(xNode);
- if (cssModel != null) {
- // adjust offsets for embedded style
- int offset = documentPosition;
- int pos = 0;
- IndexedRegion keyIndexedNode = cssModel.getIndexedRegion(pos);
- if (keyIndexedNode == null) {
- keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument();
- }
- arranger = new CSSProposalArranger(pos, (ICSSNode) keyIndexedNode, offset, selection.getLength(), (char) 0);
- }
- } else if ((parent != null) && parent.getNodeName().equalsIgnoreCase(HTML40Namespace.ElementName.STYLE)) {
- // now we know the cursor is in a <style> tag with a region
- // use the parent because that will be the <style> tag
- IStructuredModel cssModel = getCSSModel(parent);
- if (cssModel != null) {
- // adjust offsets for embedded style
- int offset = indexedNode.getStartOffset();
- int pos = documentPosition - offset;
- IndexedRegion keyIndexedNode = cssModel.getIndexedRegion(pos);
- if (keyIndexedNode == null) {
- keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument();
- }
- arranger = new CSSProposalArranger(pos, (ICSSNode) keyIndexedNode, offset, selection.getLength(), (char) 0);
- }
- } else if (indexedNode instanceof IDOMNode) {
- IDOMNode domNode = ((IDOMNode)indexedNode);
- // get model for node w/ style attribute
- IStructuredModel cssModel = getCSSModel(domNode);
- if (cssModel != null) {
- // adjust offsets for embedded style
- int textRegionStartOffset = getTextRegionStartOffset(domNode, documentPosition);
- int pos = documentPosition - textRegionStartOffset;
-
- char quote = (char) 0;
- try {
- quote = context.getDocument().get(textRegionStartOffset, 1).charAt(0);
- } catch (BadLocationException e) {
- Logger.logException("error getting quote character", e);
- }
-
- //get css indexed region
- IndexedRegion cssIndexedNode = cssModel.getIndexedRegion(pos);
- if (cssIndexedNode == null) {
- cssIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument();
- }
- if (cssIndexedNode instanceof ICSSNode) {
- // inline style for a tag, not embedded
- arranger = new CSSProposalArranger(pos, (ICSSNode) cssIndexedNode, textRegionStartOffset, selection.getLength(), quote);
- }
- }
- } else if (indexedNode instanceof ICSSNode) {
- // when editing external CSS using CSS Designer, ICSSNode is passed.
- ICSSDocument cssdoc = ((ICSSNode) indexedNode).getOwnerDocument();
- if (cssdoc != null) {
- IStructuredModel cssModel = cssdoc.getModel();
- if (cssModel != null) {
- IndexedRegion keyIndexedNode = cssModel.getIndexedRegion(documentPosition);
- if (keyIndexedNode == null) {
- keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument();
- }
- if (keyIndexedNode instanceof ICSSNode) {
- // inline style for a tag, not embedded
- arranger = new CSSProposalArranger(documentPosition, (ICSSNode) keyIndexedNode, 0, selection.getLength(), (char)0);
- }
- }
- }
- } else if ((indexedNode == null) && ContentAssistUtils.isViewerEmpty(viewer)) {
- // the top of empty CSS Document
- IStructuredModel cssModel = null;
- try {
- cssModel = StructuredModelManager.getModelManager().getExistingModelForRead(viewer.getDocument());
- if (cssModel instanceof ICSSModel) {
- IndexedRegion keyIndexedNode = cssModel.getIndexedRegion(documentPosition);
- if (keyIndexedNode == null) {
- keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument();
- }
- if (keyIndexedNode instanceof ICSSNode) {
- // inline style for a tag, not embedded
- arranger = new CSSProposalArranger(documentPosition, (ICSSNode) keyIndexedNode, 0, (char)0);
- }
- }
- } finally {
- if (cssModel != null)
- cssModel.releaseFromRead();
- }
- }
-
- ICompletionProposal[] proposals = new ICompletionProposal[0];
- if (arranger != null) {
- proposals = arranger.getProposals();
-
- ICompletionProposal[] newfileproposals = new ICompletionProposal[0];
- ICompletionProposal[] anyproposals = new ICompletionProposal[0];
-
- // add end tag if parent is not closed
- ICompletionProposal endTag = XMLContentAssistUtilities.computeXMLEndTagProposal(viewer, documentPosition, indexedNode, HTML40Namespace.ElementName.STYLE, SharedXMLEditorPluginImageHelper.IMG_OBJ_TAG_GENERIC);
-
- // add the additional proposals
- int additionalLength = newfileproposals.length + anyproposals.length;
- additionalLength = (endTag != null) ? ++additionalLength : additionalLength;
- if (additionalLength > 0) {
- ICompletionProposal[] plusOnes = new ICompletionProposal[proposals.length + additionalLength];
- int appendPos = proposals.length;
- // add end tag proposal
- if (endTag != null) {
- System.arraycopy(proposals, 0, plusOnes, 1, proposals.length);
- plusOnes[0] = endTag;
- ++appendPos;
- } else {
- System.arraycopy(proposals, 0, plusOnes, 0, proposals.length);
- }
- // add items in newfileproposals
- for (int i = 0; i < newfileproposals.length; ++i) {
- plusOnes[appendPos + i] = newfileproposals[i];
- }
- // add items in anyproposals
- appendPos = appendPos + newfileproposals.length;
- for (int i = 0; i < anyproposals.length; ++i) {
- plusOnes[appendPos + i] = anyproposals[i];
- }
- proposals = plusOnes;
- }
- }
- return Arrays.asList(proposals);
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#computeContextInformation(org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext, org.eclipse.core.runtime.IProgressMonitor)
- */
- public List computeContextInformation(
- CompletionProposalInvocationContext context,
- IProgressMonitor monitor) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#getErrorMessage()
- */
- public String getErrorMessage() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#sessionStarted()
- */
- public void sessionStarted() {
- //default is to do nothing
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#sessionEnded()
- */
- public void sessionEnded() {
- //default is to do nothing
- }
-
- /**
- * Returns the CSSmodel for a given XML node.
- *
- * @param element
- * @return IStructuredModel
- */
- private static IStructuredModel getCSSModel(IDOMNode element) {
- if (element == null) {
- return null;
- }
- INodeAdapter adapter = StyleAdapterFactory.getInstance().adapt(element);
- if ((adapter == null) || !(adapter instanceof ICSSModelAdapter)) {
- return null;
- }
- ICSSModelAdapter modelAdapter = (ICSSModelAdapter) adapter;
- return modelAdapter.getModel();
- }
-
- /**
- * <p>Get the start offset of the text region containing the given document position</p>
- *
- * @param domNode {@link IDOMNode} containing the document position
- * @param documentPosition the document relative position to get the start
- * offset of the containing {@link ITextRegion} for
- * @return start offset of the {@link ITextRegion} containing the given document position
- */
- private static int getTextRegionStartOffset(IDOMNode domNode, int documentPosition) {
- IStructuredDocumentRegion structRegion = domNode.getFirstStructuredDocumentRegion();
- return structRegion.getStartOffset(structRegion.getRegionAtCharacterOffset(documentPosition));
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSContentAssistContext.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSContentAssistContext.java
deleted file mode 100644
index b5edab9115..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSContentAssistContext.java
+++ /dev/null
@@ -1,463 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.contentassist;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.wst.css.core.internal.metamodel.CSSMetaModel;
-import org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelFinder;
-import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSDocument;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.core.internal.util.CSSUtil;
-import org.eclipse.wst.css.core.internal.util.RegionIterator;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-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;
-
-class CSSContentAssistContext {
-
- private int fReplaceBegin = -1;
- private String fTextToReplace = null;
- private String fTextToCompare = null;
- private int fTargetPos = -1;
- private ICSSNode fTargetNode = null;
- private int fCursorPos = -1;
- private int fLength = -1;
- private IStructuredDocument fStructuredDocument = null;
- private int fDocumentOffset = 0;
- private char fQuote = 0;
- private ICSSModel fModel = null;
- private boolean fSelected = false;
-
- /**
- *
- */
- private CSSContentAssistContext() {
- super();
- }
-
- /**
- *
- */
- CSSContentAssistContext(int documentPosition, ICSSNode node, int documentOffset, char quote) {
- this();
- fCursorPos = documentPosition;
- fDocumentOffset = documentOffset;
- fQuote = quote;
- initialize(node.getOwnerDocument());
- }
-
- CSSContentAssistContext(int documentPosition, ICSSNode node, int documentOffset, int length, char quote) {
- this();
- fCursorPos = documentPosition;
- fDocumentOffset = documentOffset;
- fQuote = quote;
- fLength = length;
- initialize(node.getOwnerDocument());
- }
-
- CSSContentAssistContext(int documentPosition, ICSSNode node, int documentOffset, char quote, boolean selected) {
- this();
- fCursorPos = documentPosition;
- fDocumentOffset = documentOffset;
- fQuote = quote;
- fSelected = selected;
- initialize(node.getOwnerDocument());
- }
-
- /**
- * @return int
- */
- int getCursorPos() {
- return fCursorPos;
- }
-
- /**
- * @return int
- */
- int getDocumentOffset() {
- return fDocumentOffset;
- }
-
- IStructuredDocument getStructuredDocument() {
- return fStructuredDocument;
- }
-
- ICSSModel getModel() {
- return fModel;
- }
-
- private ICSSNode getNodeAt(int offset) {
- return (ICSSNode) ((fModel != null) ? fModel.getIndexedRegion(offset) : null);
- }
-
- /**
- *
- * @return char
- */
- char getQuoteOfStyleAttribute() {
- return fQuote;
- }
-
- ITextRegion getRegionByOffset(int offset) {
- ITextRegion region = null;
- if (fStructuredDocument != null) {
- IStructuredDocumentRegion flatNode = fStructuredDocument.getRegionAtCharacterOffset(offset);
- if (flatNode != null) {
- //if its a quoted region and at the beginning of a node then get the node before it
- if(offset == flatNode.getStartOffset() && fQuote != 0) {
- flatNode = fStructuredDocument.getRegionAtCharacterOffset(offset-1);
- }
-
- //if its the end offset of the node then to get the region need to step back one
- if(offset == flatNode.getEndOffset()) {
- region = flatNode.getRegionAtCharacterOffset(offset-1);
- } else {
- region = flatNode.getRegionAtCharacterOffset(offset);
- }
- }
- }
- return region;
- }
-
- /**
- *
- */
- // String getRegionText() {
- // ITextRegion targetRegion = getTargetRegion();
- // if (targetRegion != null) {
- // return targetRegion.getText();
- // } else {
- // return ""; //$NON-NLS-1$
- // }
- // }
- /**
- *
- */
- int getReplaceBegin() {
- return fReplaceBegin;
- }
-
- ICSSNode getTargetNode() {
- return fTargetNode;
- }
-
- private int getTargetPos() {
- return fTargetPos;
- }
-
- ITextRegion getTargetRegion() {
- return getRegionByOffset(getTargetPos());
- }
-
- private IStructuredDocumentRegion getTargetDocumentRegion() {
- return getDocumentRegionByOffset(getTargetPos());
- }
-
- private IStructuredDocumentRegion getDocumentRegionByOffset(int offset) {
- return (fStructuredDocument != null) ? fStructuredDocument.getRegionAtCharacterOffset(offset) : null;
- }
-
- ITextRegion getTargetRegionPrevious() {
- ITextRegion previousRegion = null;
- ITextRegion targetRegion = getTargetRegion();
- RegionIterator iterator = null;
- if (targetRegion == null) {
- if (0 < fCursorPos) {
- iterator = new RegionIterator(fStructuredDocument, fCursorPos - 1);
- }
- } else {
- iterator = getRegionIterator();
- if (iterator.hasPrev()) {
- iterator.prev();
- } else {
- iterator = null;
- }
- }
- if (iterator != null) {
- while (iterator.hasPrev()) {
- ITextRegion region = iterator.prev();
- String type = region.getType();
- if (type != CSSRegionContexts.CSS_S && type != CSSRegionContexts.CSS_COMMENT && type != CSSRegionContexts.CSS_CDO && type != CSSRegionContexts.CSS_CDC) {
- previousRegion = region;
- break;
- }
- }
- }
-
- return previousRegion;
- }
-
- /**
- * @return java.lang.String
- */
- String getTextToCompare() {
- return fTextToCompare;
- }
-
- /**
- *
- */
- String getTextToReplace() {
- return fTextToReplace;
- }
-
- /**
- *
- */
- private void initialize(ICSSDocument doc) {
- if (doc == null) {
- return;
- }
- ICSSModel model = doc.getModel();
- fModel = model;
- fStructuredDocument = model.getStructuredDocument();
-
- initializeTargetPos();
- initializeTargetText();
- initializeTargetNode();
- }
-
- /**
- *
- */
- private void initializeTargetNode() {
- if (fCursorPos == 0) {
- fTargetNode = fModel.getDocument();
- return;
- }
-
- // find edge of tree node
- ICSSNode cursorNode = getNodeAt(fCursorPos);
- if (cursorNode == null) { // end of document
- cursorNode = fModel.getDocument();
- }
- ICSSNode node = null;
- IStructuredDocumentRegion flatNode = fStructuredDocument.getRegionAtCharacterOffset(fCursorPos - 1);
- while (flatNode != null && (node = getNodeAt(flatNode.getStartOffset())) == cursorNode && ((IndexedRegion) node).getStartOffset() != flatNode.getStartOffset()) {
- flatNode = flatNode.getPrevious();
- }
- if (flatNode == null) { // top of document
- fTargetNode = (node == null) ? fModel.getDocument() : node;
- return;
- }
- // v<--|
- // AAAAAA
- // BBBBBBBBBB cursorNode:A , node:B -> target is A
- if (cursorNode != null) {
- for (ICSSNode parent = cursorNode.getParentNode(); parent != null; parent = parent.getParentNode()) {
- if (parent == cursorNode) {
- fTargetNode = cursorNode;
- return;
- }
- }
- }
- // v<--|
- // AAA
- // BBBBBBBBBB cursorNode:B , node:A -> depend on A's node type
- short nodeType = node.getNodeType();
- if (nodeType == ICSSNode.STYLEDECLITEM_NODE || nodeType == ICSSNode.CHARSETRULE_NODE || nodeType == ICSSNode.IMPORTRULE_NODE) {
- String type = CSSUtil.getStructuredDocumentRegionType(flatNode);
- if (type == CSSRegionContexts.CSS_DELIMITER || type == CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
- fTargetNode = node.getParentNode();
- } else {
- fTargetNode = node;
- }
- // fTargetNode = (bOverSemiColon) ? node.getParentNode() : node;
- } else if (CSSUtil.getStructuredDocumentRegionType(flatNode) == CSSRegionContexts.CSS_RBRACE) {
- fTargetNode = node.getParentNode();
- } else {
- fTargetNode = node;
- }
-
- return;
- }
-
- /**
- *
- */
- private void initializeTargetPos() {
- if (fCursorPos == 0 || isSpecialDelimiterRegion(fCursorPos - 1)) {
- fTargetPos = fCursorPos;
- } else {
- fTargetPos = fCursorPos - 1;
- }
-
- //deal with the leading quote
- if(fQuote != 0) {
- fTargetPos--;
- }
- }
-
- /**
- *
- */
- private void initializeTargetText() {
- ITextRegion targetRegion = getTargetRegion();
- IStructuredDocumentRegion documentRegion = getTargetDocumentRegion();
- if (targetRegion == null) {
- fReplaceBegin = fCursorPos;
- fTextToReplace = ""; //$NON-NLS-1$
- fTextToCompare = ""; //$NON-NLS-1$
- } else {
- String regionText = documentRegion.getText(targetRegion);
- int regionStart = documentRegion.getStartOffset(targetRegion);
- if (!fSelected && (regionStart == fCursorPos || regionText.trim().length() == 0 || regionStart + regionText.length() - 1 < this.fTargetPos)) {
- // to insertion
- fReplaceBegin = fCursorPos;
- fTextToReplace = ""; //$NON-NLS-1$
- fTextToCompare = ""; //$NON-NLS-1$
- try {
- if (fLength > 0)
- fTextToReplace = fStructuredDocument.get(fReplaceBegin, fLength);
- }
- catch (BadLocationException e) {
- }
- } else {
- // to replace
- fReplaceBegin = regionStart;
- fTextToReplace = regionText;
-
- //math to deal with leading quote
- int matchLength = fCursorPos - fReplaceBegin;
- if(fQuote != 0) {
- matchLength--;
- fReplaceBegin++;
- }
-
- if(fCursorPos >= fReplaceBegin && regionText.trim().length() >= (matchLength))
- fTextToCompare = regionText.substring(0, matchLength);
- else
- fTextToCompare = ""; //$NON-NLS-1$
- }
- }
- }
-
- /**
- *
- */
- private boolean isSpecialDelimiterRegion(int pos) {
- ITextRegion region = getRegionByOffset(pos);
- String type = null;
- if(region != null) {
- type = region.getType();
- }
- return (type != null) &&((type == CSSRegionContexts.CSS_LBRACE ||
- type == CSSRegionContexts.CSS_RBRACE ||
- type == CSSRegionContexts.CSS_DELIMITER ||
- type == CSSRegionContexts.CSS_DECLARATION_SEPARATOR ||
- type == CSSRegionContexts.CSS_DECLARATION_DELIMITER ||
- type == CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR ||
- type == CSSRegionContexts.CSS_S));
- }
- /**
- *
- */
- boolean isTargetPosAfterOf(String regionType) {
- int start = ((IndexedRegion) fTargetNode).getStartOffset();
- if (start < 0 || ((IndexedRegion) fTargetNode).getEndOffset() <= 0) {
- return false;
- }
-
- RegionIterator iRegion = new RegionIterator(fStructuredDocument, start);
- while (iRegion.hasNext()) {
- ITextRegion region = iRegion.next();
- if (fTargetPos < iRegion.getStructuredDocumentRegion().getTextEndOffset(region)) {
- break;
- }
- if (region.getType() == regionType) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- *
- */
- boolean isTargetPosBeforeOf(String regionType) {
- return !isTargetPosAfterOf(regionType);
- }
-
- /**
- * @return boolean
- * @param regionType
- * java.lang.String
- */
- boolean targetFollows(String regionType) {
- RegionIterator iRegion;
- ITextRegion region = null;
- if (fStructuredDocument.getLength() <= fTargetPos) {
- iRegion = new RegionIterator(fStructuredDocument, fStructuredDocument.getLength() - 1);
- } else {
- iRegion = new RegionIterator(fStructuredDocument, fTargetPos);
- try {
- if (!Character.isWhitespace(fStructuredDocument.getChar(fTargetPos)) && iRegion.hasPrev()) {
- region = iRegion.prev();
- }
- } catch (BadLocationException e) {
- iRegion = new RegionIterator(fStructuredDocument, fStructuredDocument.getLength() - 1);
- }
- }
- while (iRegion.hasPrev()) {
- region = iRegion.prev();
- String type = region.getType();
- if (type == CSSRegionContexts.CSS_S || type == CSSRegionContexts.CSS_COMMENT) {
- continue;
- } else {
- break;
- }
- }
- if (region != null && region.getType() == regionType) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
- *
- */
- boolean targetHas(String regionType) {
- int end = ((IndexedRegion) fTargetNode).getEndOffset();
- if (getTargetPos() < 0 || end <= 0) {
- return false;
- }
- RegionIterator iRegion = new RegionIterator(fStructuredDocument, getTargetPos());
- while (iRegion.hasNext()) {
- ITextRegion region = iRegion.next();
- if (end <= iRegion.getStructuredDocumentRegion().getStartOffset(region)) {
- break;
- }
- if (region.getType() == regionType) {
- return true;
- }
- }
- return false;
- }
-
- RegionIterator getRegionIterator() {
- return new RegionIterator(getStructuredDocument(), getTargetPos());
- }
-
- /**
- *
- */
- CSSMetaModel getMetaModel() {
- CSSMetaModelFinder finder = CSSMetaModelFinder.getInstance();
- return finder.findMetaModelFor(getModel());
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSContentAssistProcessor.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSContentAssistProcessor.java
deleted file mode 100644
index b4af3d0a49..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSContentAssistProcessor.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.contentassist;
-
-
-
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.wst.css.core.internal.provisional.adapters.ICSSModelAdapter;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSDocument;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.ui.internal.templates.TemplateContextTypeIdsCSS;
-import org.eclipse.wst.html.core.internal.htmlcss.StyleAdapterFactory;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.eclipse.wst.xml.ui.internal.contentassist.XMLContentAssistUtilities;
-import org.eclipse.wst.xml.ui.internal.util.SharedXMLEditorPluginImageHelper;
-
-/**
- * @deprecated This class is no longer used locally and will be removed in the future
- * @see CSSStructuredContentAssistProcessor
- */
-public class CSSContentAssistProcessor implements IContentAssistProcessor {
-
- private int fDocumentOffset = 0;
- private char fQuote = 0;
- private CSSTemplateCompletionProcessor fTemplateProcessor = null;
-
- /**
- * Return a list of proposed code completions based on the specified
- * location within the document that corresponds to the current cursor
- * position within the text-editor control.
- *
- * @param documentPosition
- * a location within the document
- * @return an array of code-assist items
- */
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentPosition) {
-
- IndexedRegion indexedNode = ContentAssistUtils.getNodeAt(viewer, documentPosition + fDocumentOffset);
- IDOMNode xNode = null;
- IDOMNode parent = null;
- CSSProposalArranger arranger = null;
- boolean isEmptyDocument = false;
- // If there is a selected region, we'll need to replace the text
- ITextSelection selection = (ITextSelection) viewer.getSelectionProvider().getSelection();
- boolean selected = (selection != null && selection.getText() != null && selection.getText().trim().length() > 0);
-
- // bail if we couldn't get an indexed node
- // if(indexedNode == null) return new ICompletionProposal[0];
- if (indexedNode instanceof IDOMNode) {
- xNode = (IDOMNode) indexedNode;
- parent = (IDOMNode) xNode.getParentNode();
- }
- // need to get in here if there in the no 0 region <style>|</style>
- // case
- if ((xNode != null) && xNode.getNodeName().equalsIgnoreCase(HTML40Namespace.ElementName.STYLE)) {
- // now we know the cursor is in a <style> tag w/out region
- IStructuredModel cssModel = getCSSModel(xNode);
- if (cssModel != null) {
- // adjust offsets for embedded style
- int offset = documentPosition + fDocumentOffset;
- int pos = 0;
- IndexedRegion keyIndexedNode = cssModel.getIndexedRegion(pos);
- if (keyIndexedNode == null) {
- keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument();
- }
- arranger = new CSSProposalArranger(pos, (ICSSNode) keyIndexedNode, offset, (char) 0, selected);
- }
- } else if ((parent != null) && parent.getNodeName().equalsIgnoreCase(HTML40Namespace.ElementName.STYLE)) {
- // now we know the cursor is in a <style> tag with a region
- // use the parent because that will be the <style> tag
- IStructuredModel cssModel = getCSSModel(parent);
- if (cssModel != null) {
- // adjust offsets for embedded style
- int offset = indexedNode.getStartOffset();
- int pos = documentPosition - offset;
- IndexedRegion keyIndexedNode = cssModel.getIndexedRegion(pos);
- if (keyIndexedNode == null) {
- keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument();
- }
- arranger = new CSSProposalArranger(pos, (ICSSNode) keyIndexedNode, offset, (char) 0, selected);
- }
- } else if (indexedNode instanceof IDOMNode) {
- // get model for node w/ style attribute
- IStructuredModel cssModel = getCSSModel((IDOMNode) indexedNode);
- if (cssModel != null) {
- IndexedRegion keyIndexedNode = cssModel.getIndexedRegion(documentPosition - fDocumentOffset);
- if (keyIndexedNode == null) {
- keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument();
- }
- if (keyIndexedNode instanceof ICSSNode) {
- // inline style for a tag, not embedded
- arranger = new CSSProposalArranger(documentPosition, (ICSSNode) keyIndexedNode, fDocumentOffset, fQuote, selected);
- }
- }
- } else if (indexedNode instanceof ICSSNode) {
- // when editing external CSS using CSS Designer, ICSSNode is
- // passed.
- ICSSDocument cssdoc = ((ICSSNode) indexedNode).getOwnerDocument();
- if (cssdoc != null) {
- IStructuredModel cssModel = cssdoc.getModel();
- if (cssModel != null) {
- IndexedRegion keyIndexedNode = cssModel.getIndexedRegion(documentPosition - fDocumentOffset);
- if (keyIndexedNode == null) {
- keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument();
- }
- if (keyIndexedNode instanceof ICSSNode) {
- // inline style for a tag, not embedded
- arranger = new CSSProposalArranger(documentPosition, (ICSSNode) keyIndexedNode, fDocumentOffset, fQuote, selected);
- }
- }
- }
- } else if ((indexedNode == null) && isViewerEmpty(viewer)) {
- isEmptyDocument = true;
- // the top of empty CSS Document
- IStructuredModel cssModel = null;
- try {
- cssModel = StructuredModelManager.getModelManager().getExistingModelForRead(viewer.getDocument());
- if (cssModel instanceof ICSSModel) {
- IndexedRegion keyIndexedNode = cssModel.getIndexedRegion(documentPosition - fDocumentOffset);
- if (keyIndexedNode == null) {
- keyIndexedNode = (IndexedRegion) ((ICSSModel) cssModel).getDocument();
- }
- if (keyIndexedNode instanceof ICSSNode) {
- // inline style for a tag, not embedded
- arranger = new CSSProposalArranger(documentPosition, (ICSSNode) keyIndexedNode, fDocumentOffset, fQuote);
- }
- }
- } finally {
- if (cssModel != null)
- cssModel.releaseFromRead();
- }
- }
-
- ICompletionProposal[] proposals = new ICompletionProposal[0];
- if (arranger != null) {
- fDocumentOffset = 0;
- proposals = arranger.getProposals();
-
- ICompletionProposal[] newfileproposals = new ICompletionProposal[0];
- ICompletionProposal[] anyproposals = new ICompletionProposal[0];
- // add template proposals
- if (getTemplateCompletionProcessor() != null) {
- if (isEmptyDocument) {
- getTemplateCompletionProcessor().setContextType(TemplateContextTypeIdsCSS.NEW);
- newfileproposals = getTemplateCompletionProcessor().computeCompletionProposals(viewer, documentPosition);
- }
- getTemplateCompletionProcessor().setContextType(TemplateContextTypeIdsCSS.ALL);
- anyproposals = getTemplateCompletionProcessor().computeCompletionProposals(viewer, documentPosition);
- }
-
- // add end tag if parent is not closed
- ICompletionProposal endTag = XMLContentAssistUtilities.computeXMLEndTagProposal(viewer, documentPosition, indexedNode, HTML40Namespace.ElementName.STYLE, SharedXMLEditorPluginImageHelper.IMG_OBJ_TAG_GENERIC);
-
- // add the additional proposals
- int additionalLength = newfileproposals.length + anyproposals.length;
- additionalLength = (endTag != null) ? ++additionalLength : additionalLength;
- if (additionalLength > 0) {
- ICompletionProposal[] plusOnes = new ICompletionProposal[proposals.length + additionalLength];
- int appendPos = proposals.length;
- // add end tag proposal
- if (endTag != null) {
- System.arraycopy(proposals, 0, plusOnes, 1, proposals.length);
- plusOnes[0] = endTag;
- ++appendPos;
- } else {
- System.arraycopy(proposals, 0, plusOnes, 0, proposals.length);
- }
- // add items in newfileproposals
- for (int i = 0; i < newfileproposals.length; ++i) {
- plusOnes[appendPos + i] = newfileproposals[i];
- }
- // add items in anyproposals
- appendPos = appendPos + newfileproposals.length;
- for (int i = 0; i < anyproposals.length; ++i) {
- plusOnes[appendPos + i] = anyproposals[i];
- }
- proposals = plusOnes;
- }
- }
- return proposals;
- }
-
- /**
- * Returns true if there is no text or it's all white space, otherwise
- * returns false
- *
- * @param treeNode
- * @param textViewer
- * @return boolean
- */
- private boolean isViewerEmpty(ITextViewer textViewer) {
- boolean isEmpty = false;
- String text = textViewer.getTextWidget().getText();
- if ((text == null) || ((text != null) && text.trim().equals(""))) //$NON-NLS-1$
- isEmpty = true;
- return isEmpty;
- }
-
- /**
- * Get CSSModel for an indexed node
- *
- * @param indexedNode
- * @return IStructuredModel
- */
- // private IStructuredModel getCSSModel(IndexedRegion indexedNode) {
- // if (indexedNode == null) return null;
- // Node node = (Node)indexedNode;
- // INodeNotifier notifier = (INodeNotifier)node.getParentNode();
- // if (notifier == null) return null;
- // INodeAdapter adapter =
- // StyleAdapterFactory.getInstance().adapt(notifier);
- // if (adapter == null || !(adapter instanceof CSSModelAdapter)) return
- // null;
- // CSSModelAdapter modelAdapter = (CSSModelAdapter)adapter;
- // return modelAdapter.getModel();
- // }
- /**
- * Returns the CSSmodel for a given XML node.
- *
- * @param element
- * @return IStructuredModel
- */
- private IStructuredModel getCSSModel(IDOMNode element) {
- if (element == null)
- return null;
- INodeAdapter adapter = StyleAdapterFactory.getInstance().adapt(element);
- if ((adapter == null) || !(adapter instanceof ICSSModelAdapter))
- return null;
- ICSSModelAdapter modelAdapter = (ICSSModelAdapter) adapter;
- return modelAdapter.getModel();
- }
-
- /**
- * Returns information about possible contexts based on the specified
- * location within the document that corresponds to the current cursor
- * position within the text viewer.
- *
- * @param viewer
- * the viewer whose document is used to compute the possible
- * contexts
- * @param documentPosition
- * an offset within the document for which context information
- * should be computed
- * @return an array of context information objects or <code>null</code>
- * if no context could be found
- */
- public org.eclipse.jface.text.contentassist.IContextInformation[] computeContextInformation(org.eclipse.jface.text.ITextViewer viewer, int documentOffset) {
- return null;
- }
-
- /**
- * Returns the characters which when entered by the user should
- * automatically trigger the presentation of possible completions.
- *
- * @return the auto activation characters for completion proposal or
- * <code>null</code> if no auto activation is desired
- */
- public char[] getCompletionProposalAutoActivationCharacters() {
- return null;
- }
-
- /**
- * Returns the characters which when entered by the user should
- * automatically trigger the presentation of context information.
- *
- * @return the auto activation characters for presenting context
- * information or <code>null</code> if no auto activation is
- * desired
- */
- public char[] getContextInformationAutoActivationCharacters() {
- return null;
- }
-
- /**
- * Returns a validator used to determine when displayed context
- * information should be dismissed. May only return <code>null</code> if
- * the processor is incapable of computing context information.
- *
- * @return a context information validator, or <code>null</code> if the
- * processor is incapable of computing context information
- */
- public org.eclipse.jface.text.contentassist.IContextInformationValidator getContextInformationValidator() {
- return null;
- }
-
- /**
- * Return the reason why computeProposals was not able to find any
- * completions.
- *
- * @return an error message or null if no error occurred
- */
- public String getErrorMessage() {
- return null;
- }
-
- /**
- * Insert the method's description here. Creation date: (2001/05/22
- * 10:37:05)
- *
- * @param offset
- * int
- */
- public void setDocumentOffset(int offset) {
- fDocumentOffset = offset;
- }
-
- /**
- *
- * @param quote
- * char
- */
- public void setQuoteCharOfStyleAttribute(char quote) {
- fQuote = quote;
- }
-
- private CSSTemplateCompletionProcessor getTemplateCompletionProcessor() {
- if (fTemplateProcessor == null) {
- fTemplateProcessor = new CSSTemplateCompletionProcessor();
- }
- return fTemplateProcessor;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalArranger.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalArranger.java
deleted file mode 100644
index 7df053a684..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalArranger.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.contentassist;
-
-
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSMediaRule;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSPageRule;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSPrimitiveValue;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclItem;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclaration;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet;
-import org.w3c.dom.css.CSSFontFaceRule;
-
-class CSSProposalArranger {
-
- private List fProposals = new ArrayList();
- private CSSContentAssistContext fContext = null;
-
- /**
- * CSSProposalArranger constructor comment.
- */
- private CSSProposalArranger() {
- super();
- }
-
- /**
- * CSSProposalArranger constructor comment.
- */
- CSSProposalArranger(int documentPosition, ICSSNode node, int documentOffset, char quote) {
- this();
- fContext = new CSSContentAssistContext(documentPosition, node, documentOffset, quote);
- }
-
- CSSProposalArranger(int documentPosition, ICSSNode node, int documentOffset, int length, char quote) {
- this();
- fContext = new CSSContentAssistContext(documentPosition, node, documentOffset, length, quote);
- }
-
- CSSProposalArranger(int documentPosition, ICSSNode node, int documentOffset, char quote, boolean selected) {
- this();
- fContext = new CSSContentAssistContext(documentPosition, node, documentOffset, quote, selected);
- }
-
- /**
- *
- */
- void buildProposals() {
- fProposals.clear();
-
- /*
- * String text; ICompletionProposal item; text = "---- Test
- * Information ----"; item = new CompletionProposal("",
- * fContext.getReplaceBegin(), 0, 0, null, text, null, null);
- * fProposals.add(item);
- *
- * text = "Target: \"" + fContext.getRegionText() + "\"";
- *
- * item = new CompletionProposal("", fContext.getReplaceBegin(), 0, 0,
- * null, text, null, null); fProposals.add(item);
- *
- * text = fContext.getTargetNode().getClass().toString(); int
- * lastPeriodPos = text.lastIndexOf('.'); text = "Node: " +
- * text.substring(lastPeriodPos + 1); item = new
- * CompletionProposal("", fContext.getReplaceBegin(), 0, 0, null,
- * text, null, null); fProposals.add(item);
- */
-
- ICSSNode targetNode = fContext.getTargetNode();
- //int targetPos = fContext.getTargetPos();
- if (targetNode instanceof ICSSStyleSheet) {
- buildProposalsForAnyRule();
- } else if ((targetNode instanceof ICSSMediaRule && fContext.isTargetPosAfterOf(CSSRegionContexts.CSS_LBRACE)) || (targetNode instanceof ICSSStyleRule && fContext.isTargetPosBeforeOf(CSSRegionContexts.CSS_LBRACE))) {
- buildProposalsForAnyRule();
- // buildProposalsForStyleRule();
- } else if ((targetNode instanceof ICSSPageRule && fContext.isTargetPosBeforeOf(CSSRegionContexts.CSS_LBRACE))) {
- buildProposalsForPageRulePseudoClass();
- } else if ((targetNode instanceof ICSSStyleRule || targetNode instanceof CSSFontFaceRule || targetNode instanceof ICSSPageRule || targetNode instanceof ICSSStyleDeclaration) && (targetNode.getOwnerDocument() instanceof ICSSStyleDeclaration || fContext.targetFollows(CSSRegionContexts.CSS_DECLARATION_DELIMITER) || fContext.targetFollows(CSSRegionContexts.CSS_LBRACE))) {
- buildProposalsForDeclarationName();
- } else if (targetNode instanceof ICSSStyleDeclItem) {
- if (fContext.isTargetPosAfterOf(CSSRegionContexts.CSS_DECLARATION_SEPARATOR)) {
- buildProposalsForDeclarationValue();
- } else {
- buildProposalsForDeclarationName();
- }
- } else if (targetNode instanceof ICSSPrimitiveValue) {
- buildProposalsForDeclarationValue();
- }
- /*
- * else if (targetNode instanceof ICSSPrimitiveValue || ((targetNode
- * instanceof ICSSStyleRule || targetNode instanceof CSSFontFaceRule ||
- * targetNode instanceof ICSSStyleDeclaration || targetNode instanceof
- * ICSSStyleDeclItem) &&
- * fContext.isTargetPosAfterOf(CSSRegionContexts.COLON))) {
- * buildProposalsForDeclarationValue(); }
- */
-
- // for Test
- }
-
- /**
- *
- */
- void buildProposalsForAnyRule() {
- CSSProposalGenerator generator;
- generator = new CSSProposalGeneratorForAtmarkRule(fContext);
- fProposals.addAll(generator.getProposals());
- generator = new CSSProposalGeneratorForHTMLTag(fContext);
- fProposals.addAll(generator.getProposals());
- generator = new CSSProposalGeneratorForPseudoSelector(fContext);
- fProposals.addAll(generator.getProposals());
- }
-
- /**
- *
- */
- void buildProposalsForDeclarationName() {
- CSSProposalGenerator generator;
- generator = new CSSProposalGeneratorForDeclarationName(fContext);
- fProposals.addAll(generator.getProposals());
- }
-
- /**
- *
- */
- void buildProposalsForDeclarationValue() {
- CSSProposalGenerator generator;
- generator = new CSSProposalGeneratorForDeclarationValue(fContext);
- fProposals.addAll(generator.getProposals());
- }
-
- /**
- *
- */
- void buildProposalsForPageRulePseudoClass() {
- CSSProposalGenerator generator;
- generator = new CSSProposalGeneratorForPseudoSelector(fContext);
- fProposals.addAll(generator.getProposals());
- }
-
- /**
- *
- */
- void buildProposalsForStyleRule() {
- CSSProposalGenerator generator;
- generator = new CSSProposalGeneratorForHTMLTag(fContext);
- fProposals.addAll(generator.getProposals());
- generator = new CSSProposalGeneratorForPseudoSelector(fContext);
- fProposals.addAll(generator.getProposals());
- }
-
- /**
- *
- */
- ICompletionProposal[] getProposals() {
- buildProposals();
- ICompletionProposal[] proposalArray = new ICompletionProposal[fProposals.size()];
- Iterator iItem = fProposals.iterator();
- for (int i = 0; iItem.hasNext(); i++) {
- proposalArray[i] = (ICompletionProposal) iItem.next();
- }
- return proposalArray;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGenerator.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGenerator.java
deleted file mode 100644
index d199902aec..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGenerator.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.contentassist;
-
-
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.css.core.internal.CSSCorePlugin;
-import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts;
-import org.eclipse.wst.css.core.internal.preferences.CSSCorePreferenceNames;
-import org.eclipse.wst.css.ui.internal.image.CSSImageHelper;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-
-abstract class CSSProposalGenerator {
-
-
- protected class StringAndOffset {
- StringAndOffset(String string, int offset) {
- this.fString = string;
- this.fOffset = offset;
- }
-
- String fString;
- int fOffset;
- }
-
- protected CSSContentAssistContext fContext = null;
-
- /**
- * CSSProposalGenerator constructor comment.
- */
- private CSSProposalGenerator() {
- super();
- }
-
- CSSProposalGenerator(CSSContentAssistContext context) {
- this();
- fContext = context;
- }
-
- /**
- *
- */
- protected boolean checkLeadingColon() {
- boolean hasLeadingColon = false;
- ITextRegion targetRegion = fContext.getTargetRegion();
- if (targetRegion == null && 0 < fContext.getCursorPos()) {
- targetRegion = fContext.getRegionByOffset(fContext.getCursorPos() - 1);
- if (targetRegion != null && targetRegion.getType() == CSSRegionContexts.CSS_SELECTOR_PSEUDO) {
- hasLeadingColon = true;
- }
- }
- else if (targetRegion != null) {
- // BUG 92848 - Changed how pseudo-selectors are defined in the
- // tokenizer
- // The target region should be the CSS_SELECTOR_PSEUDO now
- if (targetRegion.getType() == CSSRegionContexts.CSS_SELECTOR_PSEUDO) {
- hasLeadingColon = true;
- }
- }
- return hasLeadingColon;
- }
-
- /**
- *
- */
- protected StringAndOffset generateBraces() {
- StringBuffer buf = new StringBuffer();
- String lineDelimiter = fContext.getStructuredDocument().getLineDelimiter();
- Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences();
- String indentStr = getIndentString();
- if (preferences.getBoolean(CSSCorePreferenceNames.WRAPPING_NEWLINE_ON_OPEN_BRACE)) {
- buf.append(lineDelimiter);
- }
- buf.append("{");//$NON-NLS-1$
- if (preferences.getBoolean(CSSCorePreferenceNames.WRAPPING_ONE_PER_LINE)) {
- buf.append(lineDelimiter);
- buf.append(indentStr);
- } else {
- buf.append(" ");//$NON-NLS-1$
- }
- int offset = buf.length();
- if (preferences.getBoolean(CSSCorePreferenceNames.WRAPPING_ONE_PER_LINE)) {
- buf.append(lineDelimiter);
- } else {
- buf.append(" ");//$NON-NLS-1$
- }
- buf.append("}");//$NON-NLS-1$
- return new StringAndOffset(buf.toString(), offset);
- }
-
- /**
- *
- */
- protected StringAndOffset generateParenthesis() {
- StringBuffer buf = new StringBuffer();
- int offset;
- buf.append("(");//$NON-NLS-1$
- offset = 1;
- buf.append(")");//$NON-NLS-1$
- return new StringAndOffset(buf.toString(), offset);
- }
-
- /**
- *
- */
- protected StringAndOffset generateQuotes() {
- StringBuffer buf = new StringBuffer();
- char quoteChar = getQuoteChar();
- buf.append(quoteChar);
- buf.append(quoteChar);
- return new StringAndOffset(buf.toString(), 1);
- }
-
- /**
- *
- */
- protected StringAndOffset generateSemicolon() {
- StringBuffer buf = new StringBuffer();
- int offset;
- buf.append(";");//$NON-NLS-1$
- offset = 0;
- return new StringAndOffset(buf.toString(), offset);
- }
-
- /**
- *
- */
- protected StringAndOffset generateURI() {
- StringBuffer buf = new StringBuffer();
-
- boolean isQuoteInURI = CSSCorePlugin.getDefault().getPluginPreferences().getBoolean(CSSCorePreferenceNames.FORMAT_QUOTE_IN_URI);
- char quoteChar = getQuoteChar();
- buf.append("url(");//$NON-NLS-1$
- if (isQuoteInURI) {
- buf.append(quoteChar);
- }
- int offset = buf.length();
- if (isQuoteInURI) {
- buf.append(quoteChar);
- }
- buf.append(")");//$NON-NLS-1$
- return new StringAndOffset(buf.toString(), offset);
- }
-
- abstract protected Iterator getCandidates();
-
- List getProposals() {
- List proposals = new ArrayList();
-
- CSSImageHelper imageHelper = CSSImageHelper.getInstance();
- Iterator i = getCandidates();
- while (i.hasNext()) {
- CSSCACandidate candidate = (CSSCACandidate) i.next();
- Image image = imageHelper.getImage(candidate.getImageType());
- ICompletionProposal item = new CompletionProposal(candidate.getReplacementString(), fContext.getReplaceBegin() + fContext.getDocumentOffset(), fContext.getTextToReplace().length(), candidate.getCursorPosition(), image, candidate.getDisplayString(), null, candidate.getDisplayString(), candidate.getMMNode());
- proposals.add(item);
- }
-
- return proposals;
- }
-
- /**
- *
- * @return char
- */
- private char getQuoteChar() {
-
- String quoteStr = CSSCorePlugin.getDefault().getPluginPreferences().getString(CSSCorePreferenceNames.FORMAT_QUOTE);
- char quoteChar = (quoteStr != null && 0 < quoteStr.length()) ? quoteStr.charAt(0) : '"';
- char attrQuote = fContext.getQuoteOfStyleAttribute();
- if (attrQuote != 0) {
- if (attrQuote == '"' && quoteChar == '"') {
- quoteChar = '\'';
- } else if (attrQuote == '\'' && quoteChar == '\'') {
- quoteChar = '"';
- }
- }
- return quoteChar;
- }
-
- /**
- *
- */
- protected boolean isMatch(String text) {
- String textToCompare = fContext.getTextToCompare();
- if (textToCompare.length() == 0) {
- return true;
- } else {
- return (text.toUpperCase().indexOf(textToCompare.toUpperCase()) == 0);
- }
- /*
- * String textToReplace = fContext.getTextToReplace(); if
- * (textToReplace.length() == 0) { return true; } else { return
- * (text.toUpperCase().indexOf(textToReplace.toUpperCase()) == 0); }
- */
- }
-
-
- private String getIndentString() {
- StringBuffer indent = new StringBuffer();
-
- Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences();
- if (preferences != null) {
- char indentChar = ' ';
- String indentCharPref = preferences.getString(CSSCorePreferenceNames.INDENTATION_CHAR);
- if (CSSCorePreferenceNames.TAB.equals(indentCharPref)) {
- indentChar = '\t';
- }
- int indentationWidth = preferences.getInt(CSSCorePreferenceNames.INDENTATION_SIZE);
-
- for (int i = 0; i < indentationWidth; i++) {
- indent.append(indentChar);
- }
- }
- return indent.toString();
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForAtmarkRule.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForAtmarkRule.java
deleted file mode 100644
index 87ba013219..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForAtmarkRule.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.contentassist;
-
-
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.wst.css.core.internal.CSSCorePlugin;
-import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode;
-import org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelUtil;
-import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts;
-import org.eclipse.wst.css.core.internal.preferences.CSSCorePreferenceNames;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSCharsetRule;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSDocument;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSImportRule;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.core.internal.util.SelectionCollector;
-import org.eclipse.wst.css.ui.internal.image.CSSImageType;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-
-class CSSProposalGeneratorForAtmarkRule extends CSSProposalGenerator {
-
- private boolean fUseUpperCase = false;
- private static final String CHARSET = "@charset";//$NON-NLS-1$
- private static final String FONT_FACE = "@font-face";//$NON-NLS-1$
- private static final String IMPORT = "@import";//$NON-NLS-1$
- private static final String MEDIA = "@media";//$NON-NLS-1$
- private static final String PAGE = "@page";//$NON-NLS-1$
-
- /**
- * CSSAtmarkRuleProposalGenerator constructor comment.
- *
- */
- CSSProposalGeneratorForAtmarkRule(CSSContentAssistContext context) {
- super(context);
- fUseUpperCase = CSSCorePlugin.getDefault().getPluginPreferences().getInt(CSSCorePreferenceNames.CASE_IDENTIFIER) == CSSCorePreferenceNames.UPPER;
- }
-
- /**
- *
- */
- private CSSCACandidate getCandidateCharsetRule() {
- // check content model
- CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel());
- if (!util.collectNodesByType(CSSMMNode.TYPE_CHARSET_RULE).hasNext()) {
- return null;
- }
-
- // check if embedded or not
- if (fContext.getModel().getStyleSheetType() == ICSSModel.EMBEDDED) {
- return null;
- }
-
- // check if caret precede all other rules.
- int offset = fContext.getCursorPos();
- if (0 < offset) {
- SelectionCollector trav = new SelectionCollector();
- trav.setRegion(0, offset - 1);
- trav.apply(fContext.getModel().getDocument());
- Iterator i = trav.getSelectedNodes().iterator();
- while (i.hasNext()) {
- Object obj = i.next();
- if (obj instanceof ICSSNode && !(obj instanceof ICSSDocument)) {
- return null;
- }
- }
- }
-
- int cursorPos = 0;
- String ident = (fUseUpperCase) ? CHARSET.toUpperCase() : CHARSET.toLowerCase();
- StringBuffer buf = new StringBuffer();
- buf.append(ident);
- buf.append(" ");//$NON-NLS-1$
- cursorPos = buf.length();
- StringAndOffset sao;
- sao = generateQuotes();
- buf.append(sao.fString);
- cursorPos += sao.fOffset;
- sao = generateSemicolon();
- buf.append(sao.fString);
-
- String text = buf.toString();
-
- if (isMatch(text)) {
- CSSCACandidate item = new CSSCACandidate();
- item.setReplacementString(text);
- item.setCursorPosition(cursorPos);
- item.setDisplayString(ident);
- item.setImageType(CSSImageType.RULE_CHARSET);
- return item;
- } else {
- return null;
- }
- }
-
- /**
- *
- */
- private CSSCACandidate getCandidateFontFaceRule() {
- CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel());
- if (!util.collectNodesByType(CSSMMNode.TYPE_FONT_FACE_RULE).hasNext()) {
- return null;
- }
-
- int cursorPos = 0;
- String ident = (fUseUpperCase) ? FONT_FACE.toUpperCase() : FONT_FACE.toLowerCase();
- StringBuffer buf = new StringBuffer();
- buf.append(ident);
- buf.append(" ");//$NON-NLS-1$
- cursorPos = buf.length();
- StringAndOffset sao;
- sao = generateBraces();
- buf.append(sao.fString);
- cursorPos += sao.fOffset;
-
- String text = buf.toString();
-
- if (isMatch(text)) {
- CSSCACandidate item = new CSSCACandidate();
- item.setReplacementString(buf.toString());
- item.setCursorPosition(cursorPos);
- item.setDisplayString(ident);
- item.setImageType(CSSImageType.RULE_FONTFACE);
- return item;
- } else {
- return null;
- }
- }
-
- /**
- *
- */
- private CSSCACandidate getCandidateImportRule() {
- // check content model
- CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel());
- if (!util.collectNodesByType(CSSMMNode.TYPE_IMPORT_RULE).hasNext()) {
- return null;
- }
-
- // charset and import can precede import rule.
- int offset = fContext.getCursorPos();
- if (0 < offset) {
- SelectionCollector trav = new SelectionCollector();
- trav.setRegion(0, offset - 1);
- trav.apply(fContext.getModel().getDocument());
- Iterator i = trav.getSelectedNodes().iterator();
- while (i.hasNext()) {
- Object obj = i.next();
- if (obj instanceof ICSSNode && !(obj instanceof ICSSDocument || obj instanceof ICSSCharsetRule || obj instanceof ICSSImportRule)) {
- return null;
- }
- }
- }
-
- int cursorPos = 0;
- String ident = (fUseUpperCase) ? IMPORT.toUpperCase() : IMPORT.toLowerCase();
- StringBuffer buf = new StringBuffer();
- buf.append(ident);
- buf.append(" ");//$NON-NLS-1$
- cursorPos = buf.length();
- StringAndOffset sao;
- sao = generateURI();
- buf.append(sao.fString);
- cursorPos += sao.fOffset;
- sao = generateSemicolon();
- buf.append(sao.fString);
-
- String text = buf.toString();
-
- if (isMatch(text)) {
- CSSCACandidate item = new CSSCACandidate();
- item.setReplacementString(buf.toString());
- item.setCursorPosition(cursorPos);
- item.setDisplayString(ident);
- item.setImageType(CSSImageType.RULE_IMPORT);
- return item;
- } else {
- return null;
- }
- }
-
- /**
- *
- */
- private CSSCACandidate getCandidateMediaRule() {
- CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel());
- if (!util.collectNodesByType(CSSMMNode.TYPE_MEDIA_RULE).hasNext()) {
- return null;
- }
-
- int cursorPos = 0;
- String ident = (fUseUpperCase) ? MEDIA.toUpperCase() : MEDIA.toLowerCase();
- StringBuffer buf = new StringBuffer();
- buf.append(ident);
- buf.append(" ");//$NON-NLS-1$
- cursorPos = buf.length() - 1;
- StringAndOffset sao;
- sao = generateBraces();
- buf.append(sao.fString);
-
- String text = buf.toString();
-
- if (isMatch(text)) {
- CSSCACandidate item = new CSSCACandidate();
- item.setReplacementString(buf.toString());
- item.setCursorPosition(cursorPos);
- item.setDisplayString(ident);
- item.setImageType(CSSImageType.RULE_MEDIA);
- return item;
- } else {
- return null;
- }
- }
-
- /**
- *
- */
- private CSSCACandidate getCandidatePageRule() {
- CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel());
- if (!util.collectNodesByType(CSSMMNode.TYPE_PAGE_RULE).hasNext()) {
- return null;
- }
-
- int cursorPos = 0;
- String ident = (fUseUpperCase) ? PAGE.toUpperCase() : PAGE.toLowerCase();
- StringBuffer buf = new StringBuffer();
- buf.append(ident);
- buf.append(" ");//$NON-NLS-1$
- cursorPos = buf.length();
- StringAndOffset sao;
- sao = generateBraces();
- buf.append(sao.fString);
- cursorPos += sao.fOffset;
-
- String text = buf.toString();
-
- if (isMatch(text)) {
- CSSCACandidate item = new CSSCACandidate();
- item.setReplacementString(buf.toString());
- item.setCursorPosition(cursorPos);
- item.setDisplayString(ident);
- item.setImageType(CSSImageType.RULE_PAGE);
- return item;
- } else {
- return null;
- }
- }
-
- /**
- * getCandidates method comment.
- */
- protected Iterator getCandidates() {
- List candidates = new ArrayList();
-
- ITextRegion region = fContext.getTargetRegionPrevious();
- // ITextRegion region = fContext.getSignificantTargetRegion();
- if (region != null) {
- String type = region.getType();
- if (type != CSSRegionContexts.CSS_RBRACE && type != CSSRegionContexts.CSS_DELIMITER) {
- return candidates.iterator();
- }
- }
-
- CSSCACandidate item;
- if ((item = getCandidateImportRule()) != null) {
- candidates.add(item);
- }
- if ((item = getCandidateCharsetRule()) != null) {
- candidates.add(item);
- }
- if ((item = getCandidateMediaRule()) != null) {
- candidates.add(item);
- }
- if ((item = getCandidatePageRule()) != null) {
- candidates.add(item);
- }
- if ((item = getCandidateFontFaceRule()) != null) {
- candidates.add(item);
- }
- return candidates.iterator();
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForDeclarationName.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForDeclarationName.java
deleted file mode 100644
index 3deb7779ce..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForDeclarationName.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.contentassist;
-
-
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.wst.css.core.internal.CSSCorePlugin;
-import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode;
-import org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelUtil;
-import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts;
-import org.eclipse.wst.css.core.internal.preferences.CSSCorePreferenceNames;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclItem;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclaration;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
-import org.eclipse.wst.css.ui.internal.image.CSSImageType;
-
-class CSSProposalGeneratorForDeclarationName extends CSSProposalGenerator {
-
- /**
- * CSSProposalGeneratorForDeclaration constructor comment.
- *
- */
- CSSProposalGeneratorForDeclarationName(CSSContentAssistContext context) {
- super(context);
- }
-
- /**
- * getCandidates method comment.
- */
- protected Iterator getCandidates() {
- List candidates = new ArrayList();
- Preferences preferences = CSSCorePlugin.getDefault().getPluginPreferences();
- String preDelim = "";//$NON-NLS-1$
- for (int i = 0; i < preferences.getInt(CSSCorePreferenceNames.FORMAT_PROP_PRE_DELIM); i++) {
- preDelim += ' ';//$NON-NLS-1$
- }
- String postDelim = "";//$NON-NLS-1$
- for (int i = 0; i < preferences.getInt(CSSCorePreferenceNames.FORMAT_PROP_POST_DELIM); i++) {
- postDelim += ' ';//$NON-NLS-1$
- }
-
- ICSSNode targetNode = fContext.getTargetNode();
- boolean bFontRule = false;
- for (ICSSNode node = targetNode; node != null; node = node.getParentNode()) {
- if (node instanceof org.w3c.dom.css.CSSFontFaceRule) {
- bFontRule = true;
- break;
- }
- }
-
- List names = new ArrayList();
- CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel());
- Iterator iNames = util.collectNodesByType((bFontRule) ? CSSMMNode.TYPE_DESCRIPTOR : CSSMMNode.TYPE_PROPERTY);
- while (iNames.hasNext()) {
- CSSMMNode node = (CSSMMNode) iNames.next();
- names.add(node);
- }
- sortNames(names);
- // Collections.sort(names);
-
- boolean bAddColon = true;
- if ((targetNode instanceof ICSSStyleRule || targetNode instanceof ICSSStyleDeclItem || targetNode instanceof ICSSStyleDeclaration) && fContext.targetHas(CSSRegionContexts.CSS_DECLARATION_SEPARATOR)) {
- bAddColon = false;
- }
-
- Iterator i = names.iterator();
- while (i.hasNext()) {
- CSSMMNode node = (CSSMMNode) i.next();
- String text = node.getName();
- text = (preferences.getInt(CSSCorePreferenceNames.CASE_PROPERTY_NAME) == CSSCorePreferenceNames.UPPER) ? text.toUpperCase() : text.toLowerCase();
- if (!isMatch(text)) {
- continue;
- }
-
- int cursorPos = 0;
- StringBuffer buf = new StringBuffer();
- buf.append(text);
- buf.append(preDelim);
- cursorPos = buf.length();
- if (bAddColon) {
- buf.append(':');//$NON-NLS-1$
- buf.append(postDelim);
- cursorPos += 1 + postDelim.length();
- }
- // if (! (targetNode instanceof ICSSStyleDeclItem)) {
- // buf.append(';');//$NON-NLS-1$
- // }
-
- CSSCACandidate item = new CSSCACandidate();
- item.setReplacementString(buf.toString());
- item.setCursorPosition(cursorPos);
- item.setDisplayString(text);
- item.setMMNode(node);
- item.setImageType(getCategoryImageType(node));
- candidates.add(item);
- }
-
- return candidates.iterator();
- }
-
- void sortNames(List names) {
- Collections.sort(names, new Comparator() {
- public int compare(Object o1, Object o2) {
- CSSMMNode node1 = (CSSMMNode) o1;
- CSSMMNode node2 = (CSSMMNode) o2;
- if (node1 == null) {
- return 1;
- } else if (node2 == null) {
- return -1;
- }
- int diff = 0;
- String category1 = node1.getAttribute("category"); //$NON-NLS-1$
- String category2 = node2.getAttribute("category"); //$NON-NLS-1$
- if (category1 == null) {
- if (category2 == null) {
- diff = 0;
- } else {
- return 1;
- }
- } else if (category2 == null) {
- return -1;
- } else {
- diff = category1.compareTo(category2);
- }
- if (diff == 0) {
- String name = node1.getName();
- if (name == null) {
- return 1;
- } else {
- return name.compareTo(node2.getName());
- }
- } else {
- return diff;
- }
- }
- });
- }
-
- /*
- * retrieve default category icon name TODO: if node has "icon"(?), use
- * it.
- */
- CSSImageType getCategoryImageType(CSSMMNode node) {
- CSSImageType imageType = null;
- if (node != null) {
- String category = node.getAttribute("category"); //$NON-NLS-1$
- if (category != null) {
- imageType = CSSImageType.getImageType(category);
- }
- }
- return (imageType == null) ? CSSImageType.CATEGORY_DEFAULT : imageType;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForDeclarationValue.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForDeclarationValue.java
deleted file mode 100644
index b32e881cdc..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForDeclarationValue.java
+++ /dev/null
@@ -1,372 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.contentassist;
-
-
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.wst.css.core.internal.CSSCorePlugin;
-import org.eclipse.wst.css.core.internal.metamodel.CSSMMDescriptor;
-import org.eclipse.wst.css.core.internal.metamodel.CSSMMFunction;
-import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode;
-import org.eclipse.wst.css.core.internal.metamodel.CSSMMNumber;
-import org.eclipse.wst.css.core.internal.metamodel.CSSMMProperty;
-import org.eclipse.wst.css.core.internal.metamodel.CSSMMUnit;
-import org.eclipse.wst.css.core.internal.metamodel.util.CSSFunctionID;
-import org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelUtil;
-import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts;
-import org.eclipse.wst.css.core.internal.preferences.CSSCorePreferenceNames;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSPrimitiveValue;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclItem;
-import org.eclipse.wst.css.core.internal.util.CSSUtil;
-import org.eclipse.wst.css.core.internal.util.RegionIterator;
-import org.eclipse.wst.css.ui.internal.image.CSSImageType;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.w3c.dom.css.CSSFontFaceRule;
-
-class CSSProposalGeneratorForDeclarationValue extends CSSProposalGenerator {
-
- private static final String IMPORTANT = "!important"; //$NON-NLS-1$
- private boolean fUseUpperCase;
- private boolean fAppendSemiColon;
-
- /**
- * CSSProposalGeneratorForDeclarationValue constructor comment.
- *
- */
- CSSProposalGeneratorForDeclarationValue(CSSContentAssistContext context) {
- super(context);
- fUseUpperCase = CSSCorePlugin.getDefault().getPluginPreferences().getInt(CSSCorePreferenceNames.CASE_PROPERTY_VALUE) == CSSCorePreferenceNames.UPPER;
- }
-
- /**
- *
- */
- private void addFunction(List candidates, CSSMMFunction prop) {
- String text = prop.toString();
- if (!isMatch(text)) {
- return;
- }
-
- int cursorPos = 0;
- StringBuffer buf = new StringBuffer();
- if (prop.getName().equals(CSSFunctionID.F_URI)) {
- StringAndOffset sao = generateURI();
- buf.append(sao.fString);
- cursorPos = sao.fOffset;
- } else {
- buf.append(prop.toString());
- cursorPos = buf.length();
- StringAndOffset sao = generateParenthesis();
- buf.append(sao.fString);
- cursorPos += sao.fOffset;
- }
-
- text = buf.toString();
- text = (fUseUpperCase) ? text.toUpperCase() : text.toLowerCase();
-
- CSSCACandidate item = new CSSCACandidate();
- item.setReplacementString(text);
- item.setCursorPosition(cursorPos);
- item.setDisplayString(text);
- item.setMMNode(prop);
- item.setImageType(CSSImageType.VALUE_FUNCTION);
- appendSemiColon(item);
- candidates.add(item);
- }
-
- /**
- *
- */
- private void addNumber(List candidates, CSSMMNumber prop) {
- String fullText = fContext.getTextToReplace();
- // skip number
- int unitIndex = -1;
- for (int i = 0; i < fullText.length(); i++) {
- if (Character.isDigit(fullText.charAt(i))) {
- unitIndex = i + 1;
- } else {
- break;
- }
- }
-
- String unitSubText = ""; //$NON-NLS-1$
- String numSubText = ""; //$NON-NLS-1$
- if (0 <= unitIndex) {
- numSubText = fullText.substring(0, unitIndex);
- if (unitIndex < fullText.length()) {
- unitSubText = fullText.substring(unitIndex);
- }
- } else {
- unitSubText = fullText;
- }
-
- Iterator i = prop.getDescendants();
- while (i.hasNext()) {
- CSSMMUnit unit = (CSSMMUnit) i.next();
- String unitString = unit.getUnitString();
- if ((0 < unitSubText.length() && unitString.indexOf(unitSubText) != 0) || (0 < numSubText.length() && unitString.equals("#"))) { //$NON-NLS-1$
- continue;
- }
-
- String text = numSubText + unitString;
- text = (fUseUpperCase) ? text.toUpperCase() : text.toLowerCase();
- CSSCACandidate item = new CSSCACandidate();
- item.setReplacementString(text);
- if (0 < numSubText.length() || text.equals("#")) { //$NON-NLS-1$
- item.setCursorPosition(text.length());
- } else {
- item.setCursorPosition(0);
- }
- item.setDisplayString(text);
- item.setImageType(CSSImageType.VALUE_NUMBER);
- appendSemiColon(item);
- candidates.add(item);
- }
- }
-
- /**
- *
- */
- private void checkSemiColon() {
- fAppendSemiColon = false;
-
- ITextRegion targetRegion = fContext.getTargetRegion();
- if (targetRegion != null && targetRegion.getType() != CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
- // find trailing ":" or ";"
- // if ":" before ";" is found, add ";"
- RegionIterator iterator = fContext.getRegionIterator();
- IStructuredDocumentRegion container = iterator.getStructuredDocumentRegion();
- while (iterator.hasNext()) {
- ITextRegion region = iterator.next();
- if (iterator.getStructuredDocumentRegion() != container) {
- break;
- }
- if (region.getType() == CSSRegionContexts.CSS_DECLARATION_SEPARATOR) {
- fAppendSemiColon = true;
- break;
- }
- }
- if (!fAppendSemiColon) {
- // second chance:
- // leading IStructuredDocumentRegion is not ";"
- IStructuredDocumentRegion nextStructuredDocumentRegion = CSSUtil.findNextSignificantNode(container);
- if (CSSUtil.getStructuredDocumentRegionType(nextStructuredDocumentRegion) != CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
- fAppendSemiColon = true;
- }
- }
- }
- }
-
- /**
- *
- */
- private void appendSemiColon(CSSCACandidate item) {
- if (fAppendSemiColon) {
- String replacementString = item.getReplacementString();
- item.setReplacementString(replacementString + ";"); //$NON-NLS-1$
- int cursorPosition = item.getCursorPosition();
- if (replacementString.length() <= cursorPosition) {
- // cursorpos is tail of string
- cursorPosition++;
- item.setCursorPosition(cursorPosition);
- }
- }
- }
-
- /**
- *
- */
- private void addSemiColon(List candidates) {
- ICSSNode targetNode = fContext.getTargetNode();
- if (targetNode instanceof ICSSStyleDeclItem) {
- ICSSNode firstChild = targetNode.getFirstChild();
- if (firstChild == null) {
- return;
- }
- if (firstChild instanceof IndexedRegion) {
- int startOffset = ((IndexedRegion) firstChild).getStartOffset();
- if (fContext.getCursorPos() <= startOffset) {
- return;
- }
- }
- }
-
- boolean bAddCloser = false;
-
- ITextRegion targetRegion = fContext.getTargetRegion();
- if (targetRegion != null && targetRegion.getType() != CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
- // find trailing ":" or ";"
- // if ":" before ";" is found, add ";"
- RegionIterator iterator = fContext.getRegionIterator();
- IStructuredDocumentRegion container = iterator.getStructuredDocumentRegion();
- while (iterator.hasNext()) {
- ITextRegion region = iterator.next();
- if (iterator.getStructuredDocumentRegion() != container) {
- break;
- }
- if (region.getType() == CSSRegionContexts.CSS_DECLARATION_SEPARATOR) {
- bAddCloser = true;
- break;
- }
- }
- if (!bAddCloser) {
- // second chance:
- // leading IStructuredDocumentRegion is not ";"
- IStructuredDocumentRegion nextStructuredDocumentRegion = CSSUtil.findNextSignificantNode(container);
- if (CSSUtil.getStructuredDocumentRegionType(nextStructuredDocumentRegion) != CSSRegionContexts.CSS_DECLARATION_DELIMITER) {
- bAddCloser = true;
- }
- }
- }
-
- if (bAddCloser) {
- CSSCACandidate item = new CSSCACandidate();
- String text = fContext.getTextToReplace() + ";";//$NON-NLS-1$
- item.setReplacementString(text);
- item.setCursorPosition(text.length());
- item.setDisplayString(";");//$NON-NLS-1$
- item.setImageType(null);
- candidates.add(item);
- }
- }
-
- /**
- *
- */
- private void addString(List candidates, String text) {
- if (!isMatch(text)) {
- return;
- }
-
- text = (fUseUpperCase) ? text.toUpperCase() : text.toLowerCase();
-
- CSSCACandidate item = new CSSCACandidate();
- item.setReplacementString(text);
- item.setCursorPosition(text.length());
- item.setDisplayString(text);
- item.setImageType(CSSImageType.VALUE_STRING);
- appendSemiColon(item);
- candidates.add(item);
- }
-
- private void addImportant(List candidates) {
- ICSSNode targetNode = fContext.getTargetNode();
- while (targetNode instanceof ICSSPrimitiveValue) {
- targetNode = targetNode.getParentNode();
- }
- if (!(targetNode instanceof ICSSStyleDeclItem)) {
- return;
- }
- // 1. has no priority region
- // 2. cursor position is after of last child
- // 3. normal isMatch method
- String priority = ((ICSSStyleDeclItem) targetNode).getPriority();
- if (priority == null || priority.length() == 0) {
- ICSSNode lastChild = targetNode.getLastChild();
- if (lastChild instanceof IndexedRegion) {
- int startOffset = ((IndexedRegion) lastChild).getStartOffset();
- // int endOffset = ((IndexedRegion)lastChild).getEndOffset();
- if (startOffset < fContext.getCursorPos() && isMatch(IMPORTANT)) {
- CSSCACandidate item = new CSSCACandidate();
- item.setReplacementString(IMPORTANT);
- item.setCursorPosition(IMPORTANT.length());
- item.setDisplayString(IMPORTANT);
- item.setImageType(CSSImageType.VALUE_STRING);
- appendSemiColon(item);
- candidates.add(item);
- }
- }
- }
- }
-
- /**
- * getCandidates method comment.
- */
- protected Iterator getCandidates() {
- List candidates = new ArrayList();
-
- checkSemiColon(); // check should add semi-colon or not
-
- String name = getPropertyName();
- if (name != null) {
- CSSMetaModelUtil util = new CSSMetaModelUtil(fContext.getMetaModel());
- Iterator i = Collections.EMPTY_LIST.iterator();
- if (isFontFaceRule()) {
- CSSMMDescriptor desc = util.getDescriptor(name);
- if (desc != null) {
- i = desc.getValues();
- }
- } else {
- CSSMMProperty prop = util.getProperty(name);
- if (prop != null) {
- i = prop.getValues();
- }
- }
- while (i.hasNext()) {
- CSSMMNode val = (CSSMMNode) i.next();
- String valueType = val.getType();
- if (valueType == CSSMMNode.TYPE_KEYWORD) {
- addString(candidates, val.toString());
- } else if (valueType == CSSMMNode.TYPE_NUMBER) {
- addNumber(candidates, (CSSMMNumber) val);
- } else if (valueType == CSSMMNode.TYPE_FUNCTION) {
- addFunction(candidates, (CSSMMFunction) val);
- }
- }
- }
-
- addImportant(candidates);
- addSemiColon(candidates);
-
- return candidates.iterator();
- }
-
- /**
- * @return java.lang.String
- */
- private String getPropertyName() {
- ICSSNode targetNode = fContext.getTargetNode();
- while (targetNode instanceof ICSSPrimitiveValue) {
- targetNode = targetNode.getParentNode();
- }
- if (targetNode instanceof ICSSStyleDeclItem) {
- return ((ICSSStyleDeclItem) targetNode).getPropertyName();
- } else {
- return null;
- }
- }
-
- /**
- *
- */
- private boolean isFontFaceRule() {
- ICSSNode targetNode = fContext.getTargetNode();
- while (targetNode instanceof ICSSPrimitiveValue) {
- targetNode = targetNode.getParentNode();
- }
- if (targetNode instanceof ICSSStyleDeclItem) {
- targetNode = targetNode.getParentNode(); // get Declaration
- if (targetNode != null) {
- // inline style has no rule node
- targetNode = targetNode.getParentNode(); // get rule
- }
- }
- return (targetNode instanceof CSSFontFaceRule);
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForHTMLTag.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForHTMLTag.java
deleted file mode 100644
index 6302cb15bb..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForHTMLTag.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.contentassist;
-
-
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.wst.css.core.internal.CSSCorePlugin;
-import org.eclipse.wst.css.core.internal.preferences.CSSCorePreferenceNames;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
-import org.eclipse.wst.css.ui.internal.image.CSSImageType;
-import org.eclipse.wst.html.core.internal.contentmodel.HTMLCMDocumentFactory;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;
-import org.eclipse.wst.xml.core.internal.document.DocumentTypeAdapter;
-import org.eclipse.wst.xml.core.internal.provisional.contentmodel.CMDocType;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-class CSSProposalGeneratorForHTMLTag extends CSSProposalGenerator {
-
- /**
- * CSSStyleRuleProposalGenerator constructor comment.
- *
- */
- CSSProposalGeneratorForHTMLTag(CSSContentAssistContext context) {
- super(context);
-
- if (fHTMLTags == null) {
- fHTMLTags = setupHTMLTags();
- }
- }
-
- /**
- * getCandidates method comment.
- */
- protected Iterator getCandidates() {
- List candidates = new ArrayList();
-
- if (checkLeadingColon()) {
- return candidates.iterator();
- }
-
- boolean bLowerCase = CSSCorePlugin.getDefault().getPluginPreferences().getInt(CSSCorePreferenceNames.CASE_SELECTOR) == CSSCorePreferenceNames.LOWER;
- // XHTML requires lower case
- if (fContext.getModel().getStyleSheetType() == ICSSModel.EMBEDDED) {
- Node domNode = fContext.getModel().getOwnerDOMNode();
- if (domNode != null && !(domNode instanceof Document)) {
- domNode = domNode.getOwnerDocument();
- if (domNode instanceof IDOMDocument) {
- DocumentTypeAdapter adapter = (DocumentTypeAdapter) ((IDOMDocument) domNode).getAdapterFor(DocumentTypeAdapter.class);
- if (adapter != null)
- bLowerCase = (adapter.getTagNameCase() == DocumentTypeAdapter.LOWER_CASE);
- }
- }
- }
-
-
- int length = fHTMLTags.length;
- for (int i = 0; i < length; i++) {
- String tagText = fHTMLTags[i];
- if (bLowerCase) {
- tagText = tagText.toLowerCase();
- }
- if (!isMatch(tagText)) {
- continue;
- }
-
- int cursorPos = 0;
- StringBuffer buf = new StringBuffer();
- buf.append(tagText);
- cursorPos += tagText.length();
- boolean inRule = (fContext.getTargetNode() instanceof ICSSStyleRule);
- if (!inRule || fContext.getTextToReplace().length() == 0) {
- buf.append(" ");//$NON-NLS-1$
- cursorPos += 1;
- }
- if (!inRule) {
- StringAndOffset sao = generateBraces();
- buf.append(sao.fString);
- cursorPos += sao.fOffset;
- }
-
- CSSCACandidate item = new CSSCACandidate();
- item.setReplacementString(buf.toString());
- item.setCursorPosition(cursorPos);
- item.setDisplayString(tagText);
- item.setImageType(CSSImageType.SELECTOR_TAG);
- candidates.add(item);
- }
-
- return candidates.iterator();
- }
-
- /**
- *
- */
- private static String[] setupHTMLTags() {
- CMDocument cmdoc = HTMLCMDocumentFactory.getCMDocument(CMDocType.HTML_DOC_TYPE);
- CMNamedNodeMap elements = cmdoc.getElements();
- Vector names = new Vector();
- int nElements = elements.getLength();
- for (int i = 0; i < nElements; i++) {
- CMElementDeclaration edec = (CMElementDeclaration) elements.item(i);
- if (isAttrDefined(edec, HTML40Namespace.ATTR_NAME_STYLE)) {
- names.add(edec.getElementName());
- }
- }
- Collections.sort(names);
- String[] tags = new String[names.size()];
- Iterator iNames = names.iterator();
- for (int i = 0; iNames.hasNext(); i++) {
- tags[i] = (String) iNames.next();
- }
- return tags;
- }
-
- /**
- *
- */
- private static boolean isAttrDefined(CMElementDeclaration edec, String attrName) {
- if (edec == null) {
- return false;
- }
- CMNamedNodeMap attrs = edec.getAttributes();
- if (attrs == null) {
- return false;
- }
- for (int i = 0; i < attrs.getLength(); i++) {
- CMAttributeDeclaration attr = (CMAttributeDeclaration) attrs.item(i);
- if (attr == null) {
- continue;
- }
- if (attr.getAttrName().equalsIgnoreCase(attrName)) {
- return true;
- }
- }
- return false;
- }
-
- private static String[] fHTMLTags = null;
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForPseudoSelector.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForPseudoSelector.java
deleted file mode 100644
index ad49fa8efc..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSProposalGeneratorForPseudoSelector.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.contentassist;
-
-
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.wst.css.core.internal.CSSCorePlugin;
-import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode;
-import org.eclipse.wst.css.core.internal.metamodel.CSSMMSelector;
-import org.eclipse.wst.css.core.internal.metamodel.util.CSSMMTypeCollector;
-import org.eclipse.wst.css.core.internal.parser.CSSRegionUtil;
-import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts;
-import org.eclipse.wst.css.core.internal.preferences.CSSCorePreferenceNames;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSPageRule;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
-import org.eclipse.wst.css.ui.internal.image.CSSImageType;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-
-/**
- *
- */
-class CSSProposalGeneratorForPseudoSelector extends CSSProposalGenerator {
-
- /**
- * CSSProposalGeneratorForPseudoSelector constructor comment.
- *
- */
- CSSProposalGeneratorForPseudoSelector(CSSContentAssistContext context) {
- super(context);
- }
-
- /**
- * getCandidates method comment.
- */
- protected Iterator getCandidates() {
- List candidates = new ArrayList();
-
- boolean hasLeadingColon = checkLeadingColon();
- String textToReplace = fContext.getTextToReplace();
- if (!hasLeadingColon && 0 < textToReplace.length() && !textToReplace.equals(fContext.getTextToCompare())) {
- // cursor placed midpoint of the region
- return candidates.iterator();
- }
- ITextRegion region = fContext.getTargetRegion();
- if (region != null) {
- String type = region.getType();
- if (type != CSSRegionContexts.CSS_S && !CSSRegionUtil.isSelectorBegginingType(type)) {
- return candidates.iterator();
- }
- }
-
- boolean useUpperCase = CSSCorePlugin.getDefault().getPluginPreferences().getInt(CSSCorePreferenceNames.CASE_IDENTIFIER) == CSSCorePreferenceNames.UPPER;
-
- List tags = getSelectorTags();
- Collections.sort(tags, new Comparator() {
- /* (non-Javadoc)
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object o1, Object o2) {
- return clean(((CSSMMSelector) o1).getName()).compareTo(clean(((CSSMMSelector) o2).getName()));
- }
-
- private String clean(String str) {
- int length = str.length();
- for (int i = 0; i < length; i++) {
- if (str.charAt(i) != ':') {
- return str.substring(i);
- }
- }
- return str;
- }
- });
-
- Iterator i = tags.iterator();
- while (i.hasNext()) {
- CSSMMSelector selector = (CSSMMSelector) i.next();
- String text = selector.getSelectorString();
- if (hasLeadingColon && !isMatch(text)) {
- continue;
- }
- text = (useUpperCase) ? text.toUpperCase() : text.toLowerCase();
-
- int cursorPos = 0;
- StringBuffer buf = new StringBuffer();
-
- if (!hasLeadingColon)
- buf.append(textToReplace);
-
- buf.append(text);
- cursorPos += buf.length();
-
- if (0 < buf.length()) {
- // Pseudoclass/element takes arguments
- if (buf.charAt(buf.length() - 1) == ')') {
- --cursorPos;
- }
- boolean inRule = (fContext.getTargetNode() instanceof ICSSStyleRule || fContext.getTargetNode() instanceof ICSSPageRule);
- if (!inRule || (textToReplace.length() == 0 && !hasLeadingColon)) {
- buf.append(" ");//$NON-NLS-1$
- cursorPos += 1;
- }
- if (!inRule) {
- StringAndOffset sao = generateBraces();
- buf.append(sao.fString);
- cursorPos += sao.fOffset;
- }
- CSSCACandidate item = new CSSCACandidate();
- item.setReplacementString(buf.toString());
- item.setCursorPosition(cursorPos);
- item.setDisplayString(text);
- item.setImageType(CSSImageType.SELECTOR_PSEUDO);
- item.setMMNode(selector);
- candidates.add(item);
- }
- }
-
- return candidates.iterator();
- }
-
- /**
- *
- */
- List getSelectorTags() {
- List tagList = new ArrayList();
- ICSSNode targetNode = fContext.getTargetNode();
- String rootType = (targetNode instanceof ICSSPageRule) ? CSSMMNode.TYPE_PAGE_RULE : CSSMMNode.TYPE_STYLE_RULE;
-
- CSSMMTypeCollector collector = new CSSMMTypeCollector();
- collector.collectNestedType(false);
- collector.apply(fContext.getMetaModel(), rootType);
- Iterator i;
- i = collector.getNodes();
- if (!i.hasNext()) {
- return tagList;
- }
- CSSMMNode node = (CSSMMNode) i.next();
- i = node.getChildNodes();
- while (i.hasNext()) {
- CSSMMNode child = (CSSMMNode) i.next();
- if (child.getType() == CSSMMNode.TYPE_SELECTOR) {
- String selType = ((CSSMMSelector) child).getSelectorType();
- if (selType == CSSMMSelector.TYPE_PSEUDO_CLASS || selType == CSSMMSelector.TYPE_PSEUDO_ELEMENT) {
- tagList.add(child);
- }
- }
- }
- return tagList;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSStructuredContentAssistProcessor.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSStructuredContentAssistProcessor.java
deleted file mode 100644
index 0d37ed74f1..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSStructuredContentAssistProcessor.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.css.ui.internal.contentassist;
-
-
-
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.contentassist.ContentAssistant;
-import org.eclipse.wst.sse.ui.contentassist.StructuredContentAssistProcessor;
-
-/**
- * <p>Implementation of {@link StructuredContentAssistProcessor} for CSS documents</p>
- *
- * <p>Currently the CSS content assist processor does not do anything different then
- * the {@link StructuredContentAssistProcessor} but at some point it may have to
- * react to user preference changes</p>
- *
- * @see StructuredContentAssistProcessor
- */
-public class CSSStructuredContentAssistProcessor extends StructuredContentAssistProcessor {
- /**
- * <p>Constructor</p>
- *
- * @param assistant {@link ContentAssistant} to use
- * @param partitionTypeID the partition type this processor is for
- * @param viewer {@link ITextViewer} this processor is acting in
- */
- public CSSStructuredContentAssistProcessor(ContentAssistant assistant,
- String partitionTypeID, ITextViewer viewer) {
-
- super(assistant, partitionTypeID, viewer, null);
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSTemplateCompletionProcessor.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSTemplateCompletionProcessor.java
deleted file mode 100644
index 6605bdbb09..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSTemplateCompletionProcessor.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.contentassist;
-
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.templates.ContextTypeRegistry;
-import org.eclipse.jface.text.templates.Template;
-import org.eclipse.jface.text.templates.TemplateCompletionProcessor;
-import org.eclipse.jface.text.templates.TemplateContextType;
-import org.eclipse.jface.text.templates.persistence.TemplateStore;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.css.ui.internal.CSSUIPlugin;
-import org.eclipse.wst.css.ui.internal.editor.CSSEditorPluginImages;
-import org.eclipse.wst.css.ui.internal.image.CSSImageHelper;
-
-
-/**
- * Completion processor for CSS Templates. Most of the work is already done
- * by the CSS Content Assist processor, so by the time the
- * CSSTemplateCompletionProcessor is asked for content assist proposals, the
- * CSS content assist processor has already set the context type for
- * templates.
- */
-class CSSTemplateCompletionProcessor extends TemplateCompletionProcessor {
- private String fContextTypeId = null;
-
- protected TemplateContextType getContextType(ITextViewer viewer, IRegion region) {
- TemplateContextType type = null;
-
- ContextTypeRegistry registry = getTemplateContextRegistry();
- if (registry != null)
- type = registry.getContextType(fContextTypeId);
-
- return type;
- }
-
- protected Image getImage(Template template) {
- // just return the same image for now
- return CSSImageHelper.getInstance().getImage(CSSEditorPluginImages.IMG_OBJ_TEMPLATE);
- }
-
- private ContextTypeRegistry getTemplateContextRegistry() {
- return CSSUIPlugin.getDefault().getTemplateContextRegistry();
- }
-
- protected Template[] getTemplates(String contextTypeId) {
- Template templates[] = null;
-
- TemplateStore store = getTemplateStore();
- if (store != null)
- templates = store.getTemplates(contextTypeId);
-
- return templates;
- }
-
- private TemplateStore getTemplateStore() {
- return CSSUIPlugin.getDefault().getTemplateStore();
- }
-
- void setContextType(String contextTypeId) {
- fContextTypeId = contextTypeId;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSTemplatesCompletionProposalComputer.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSTemplatesCompletionProposalComputer.java
deleted file mode 100644
index 2b58dc6be9..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CSSTemplatesCompletionProposalComputer.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.css.ui.internal.contentassist;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.wst.css.ui.internal.templates.TemplateContextTypeIdsCSS;
-import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
-import org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer;
-import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
-
-/**
- * <p>Completion computer for CSS templates</p>
- */
-public class CSSTemplatesCompletionProposalComputer implements ICompletionProposalComputer {
- /** <p>The template processor used to create the proposals</p> */
- private CSSTemplateCompletionProcessor fTemplateProcessor = null;
-
- /**
- * <p>Create the computer</p>
- */
- public CSSTemplatesCompletionProposalComputer() {
- fTemplateProcessor = new CSSTemplateCompletionProcessor();
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#computeCompletionProposals(org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext, org.eclipse.core.runtime.IProgressMonitor)
- */
- public List computeCompletionProposals(
- CompletionProposalInvocationContext context,
- IProgressMonitor monitor) {
-
- List proposals = new ArrayList();
-
- boolean isEmptyDocument =
- ContentAssistUtils.isViewerEmpty(context.getViewer());
- if (isEmptyDocument) {
- proposals.addAll(getTemplates(TemplateContextTypeIdsCSS.NEW, context));
- }
- proposals.addAll(getTemplates(TemplateContextTypeIdsCSS.ALL, context));
-
-
- return proposals;
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#computeContextInformation(org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext, org.eclipse.core.runtime.IProgressMonitor)
- */
- public List computeContextInformation(
- CompletionProposalInvocationContext context,
- IProgressMonitor monitor) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#getErrorMessage()
- */
- public String getErrorMessage() {
- return null;
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#sessionStarted()
- */
- public void sessionStarted() {
- //default is to do nothing
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.contentassist.ICompletionProposalComputer#sessionEnded()
- */
- public void sessionEnded() {
- //default is to do nothing
- }
-
-
- /**
- * <p>Gets template proposals for the given template and proposal contexts</p>
- *
- * @param templateContext the template context
- * @param context the proposal context
- * @return {@link List} of template proposals for the given contexts
- */
- private List getTemplates(String templateContext,
- CompletionProposalInvocationContext context) {
-
- fTemplateProcessor.setContextType(templateContext);
- ICompletionProposal[] proposals = fTemplateProcessor.computeCompletionProposals(
- context.getViewer(), context.getInvocationOffset());
-
- return Arrays.asList(proposals);
- }
-
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CompletionProposal.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CompletionProposal.java
deleted file mode 100644
index ccccf08cda..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/CompletionProposal.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/******************************************************************************
- * Copyright (c) 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.css.ui.internal.contentassist;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.internal.text.html.BrowserInformationControl;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.text.AbstractReusableInformationControlCreator;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.DefaultInformationControl;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.ICompletionProposalExtension3;
-import org.eclipse.jface.text.contentassist.ICompletionProposalExtension5;
-import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode;
-
-public class CompletionProposal implements ICompletionProposal, ICompletionProposalExtension3, ICompletionProposalExtension5 {
-
- /** The string to be displayed in the completion proposal popup. */
- private String fDisplayString;
- /** The replacement string. */
- private String fReplacementString;
- /** The replacement offset. */
- private int fReplacementOffset;
- /** The replacement length. */
- private int fReplacementLength;
- /** The cursor position after this proposal has been applied. */
- private int fCursorPosition;
- /** The image to be displayed in the completion proposal popup. */
- private Image fImage;
- /** The context information of this proposal. */
- private IContextInformation fContextInformation;
- /** The additional info of this proposal. */
- private String fAdditionalProposalInfo;
- private CSSMMNode fNode;
- /** The information control creator */
- private IInformationControlCreator fCreator;
-
- /**
- * Creates a new completion proposal based on the provided information. The replacement string is
- * considered being the display string too. All remaining fields are set to <code>null</code>.
- *
- * @param replacementString the actual string to be inserted into the document
- * @param replacementOffset the offset of the text to be replaced
- * @param replacementLength the length of the text to be replaced
- * @param cursorPosition the position of the cursor following the insert relative to replacementOffset
- */
- public CompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition) {
- this(replacementString, replacementOffset, replacementLength, cursorPosition, null, null, null, null);
- }
-
- /**
- * Creates a new completion proposal. All fields are initialized based on the provided information.
- *
- * @param replacementString the actual string to be inserted into the document
- * @param replacementOffset the offset of the text to be replaced
- * @param replacementLength the length of the text to be replaced
- * @param cursorPosition the position of the cursor following the insert relative to replacementOffset
- * @param image the image to display for this proposal
- * @param displayString the string to be displayed for the proposal
- * @param contextInformation the context information associated with this proposal
- * @param additionalProposalInfo the additional information associated with this proposal
- */
- public CompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo) {
- this(replacementString, replacementOffset, replacementLength, cursorPosition, null, null, null, null, null);
- }
-
- public CompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo, CSSMMNode node) {
- Assert.isNotNull(replacementString);
- Assert.isTrue(replacementOffset >= 0);
- Assert.isTrue(replacementLength >= 0);
- Assert.isTrue(cursorPosition >= 0);
-
- fReplacementString= replacementString;
- fReplacementOffset= replacementOffset;
- fReplacementLength= replacementLength;
- fCursorPosition= cursorPosition;
- fImage= image;
- fDisplayString= displayString;
- fContextInformation= contextInformation;
- fAdditionalProposalInfo= additionalProposalInfo;
- fNode = node;
- }
- /*
- * @see ICompletionProposal#apply(IDocument)
- */
- public void apply(IDocument document) {
- try {
- document.replace(fReplacementOffset, fReplacementLength, fReplacementString);
- } catch (BadLocationException x) {
- // ignore
- }
- }
-
- /*
- * @see ICompletionProposal#getSelection(IDocument)
- */
- public Point getSelection(IDocument document) {
- return new Point(fReplacementOffset + fCursorPosition, 0);
- }
-
- /*
- * @see ICompletionProposal#getContextInformation()
- */
- public IContextInformation getContextInformation() {
- return fContextInformation;
- }
-
- /*
- * @see ICompletionProposal#getImage()
- */
- public Image getImage() {
- return fImage;
- }
-
- /*
- * @see ICompletionProposal#getDisplayString()
- */
- public String getDisplayString() {
- if (fDisplayString != null)
- return fDisplayString;
- return fReplacementString;
- }
-
- /*
- * @see ICompletionProposal#getAdditionalProposalInfo()
- */
- public String getAdditionalProposalInfo() {
- return fAdditionalProposalInfo;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension5#getAdditionalProposalInfo(org.eclipse.core.runtime.IProgressMonitor)
- */
- public Object getAdditionalProposalInfo(IProgressMonitor monitor) {
- return ProposalInfoFactory.getProposalInfo(fNode);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension3#getInformationControlCreator()
- */
- public IInformationControlCreator getInformationControlCreator() {
- if (fCreator == null) {
- fCreator = new AbstractReusableInformationControlCreator() {
-
- protected IInformationControl doCreateInformationControl(Shell parent) {
- if (BrowserInformationControl.isAvailable(parent)) {
- BrowserInformationControl control = new BrowserInformationControl(parent, JFaceResources.DIALOG_FONT, false);
- return control;
- } else {
- return new DefaultInformationControl(parent, true);
- }
- }
- };
- }
- return fCreator;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension3#getPrefixCompletionText(org.eclipse.jface.text.IDocument, int)
- */
- public CharSequence getPrefixCompletionText(IDocument document, int completionOffset) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension3#getPrefixCompletionStart(org.eclipse.jface.text.IDocument, int)
- */
- public int getPrefixCompletionStart(IDocument document, int completionOffset) {
- return 0;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/HTML40Namespace.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/HTML40Namespace.java
deleted file mode 100644
index c8c0e30948..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/HTML40Namespace.java
+++ /dev/null
@@ -1,890 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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
- *******************************************************************************/
-/*nlsXXX*/
-package org.eclipse.wst.css.ui.internal.contentassist;
-
-
-
-/**
- * Provide all names defined in the HTML 4.0? specification.
- */
-public interface HTML40Namespace {
-
- // Element names
- public static interface ElementName {
- public static final String A = "A"; //$NON-NLS-1$
- public static final String ABBR = "ABBR"; //$NON-NLS-1$
- public static final String ACRONYM = "ACRONYM"; //$NON-NLS-1$
- public static final String ADDRESS = "ADDRESS"; //$NON-NLS-1$
- public static final String APPLET = "APPLET"; //$NON-NLS-1$
- public static final String AREA = "AREA"; //$NON-NLS-1$
- public static final String B = "B"; //$NON-NLS-1$
- public static final String BASE = "BASE"; //$NON-NLS-1$
- public static final String BASEFONT = "BASEFONT"; //$NON-NLS-1$
- public static final String BDO = "BDO"; //$NON-NLS-1$
- public static final String BGSOUND = "BGSOUND"; // D205513
- // //$NON-NLS-1$
- public static final String BIG = "BIG"; //$NON-NLS-1$
- public static final String BLINK = "BLINK"; //$NON-NLS-1$
- public static final String BLOCKQUOTE = "BLOCKQUOTE"; //$NON-NLS-1$
- public static final String BODY = "BODY"; //$NON-NLS-1$
- public static final String BR = "BR"; //$NON-NLS-1$
- public static final String BUTTON = "BUTTON"; //$NON-NLS-1$
- public static final String CAPTION = "CAPTION"; //$NON-NLS-1$
- public static final String CENTER = "CENTER"; //$NON-NLS-1$
- public static final String CITE = "CITE"; //$NON-NLS-1$
- public static final String CODE = "CODE"; //$NON-NLS-1$
- public static final String COL = "COL"; //$NON-NLS-1$
- public static final String COLGROUP = "COLGROUP"; //$NON-NLS-1$
- public static final String DD = "DD"; //$NON-NLS-1$
- public static final String DEL = "DEL"; //$NON-NLS-1$
- public static final String DFN = "DFN"; //$NON-NLS-1$
- public static final String DIR = "DIR"; //$NON-NLS-1$
- public static final String DIV = "DIV"; //$NON-NLS-1$
- public static final String DL = "DL"; //$NON-NLS-1$
- public static final String DT = "DT"; //$NON-NLS-1$
- public static final String EM = "EM"; //$NON-NLS-1$
- public static final String EMBED = "EMBED"; //$NON-NLS-1$
- public static final String FIELDSET = "FIELDSET"; //$NON-NLS-1$
- public static final String FONT = "FONT"; //$NON-NLS-1$
- public static final String FORM = "FORM"; //$NON-NLS-1$
- public static final String FRAME = "FRAME"; //$NON-NLS-1$
- public static final String FRAMESET = "FRAMESET"; //$NON-NLS-1$
- public static final String H1 = "H1"; //$NON-NLS-1$
- public static final String H2 = "H2"; //$NON-NLS-1$
- public static final String H3 = "H3"; //$NON-NLS-1$
- public static final String H4 = "H4"; //$NON-NLS-1$
- public static final String H5 = "H5"; //$NON-NLS-1$
- public static final String H6 = "H6"; //$NON-NLS-1$
- public static final String HEAD = "HEAD"; //$NON-NLS-1$
- public static final String HR = "HR"; //$NON-NLS-1$
- public static final String HTML = "HTML"; //$NON-NLS-1$
- public static final String I = "I"; //$NON-NLS-1$
- public static final String IFRAME = "IFRAME"; //$NON-NLS-1$
- public static final String IMG = "IMG"; //$NON-NLS-1$
- public static final String INPUT = "INPUT"; //$NON-NLS-1$
- public static final String INS = "INS"; //$NON-NLS-1$
- public static final String ISINDEX = "ISINDEX"; //$NON-NLS-1$
- public static final String KBD = "KBD"; //$NON-NLS-1$
- public static final String LABEL = "LABEL"; //$NON-NLS-1$
- public static final String LEGEND = "LEGEND"; //$NON-NLS-1$
- public static final String LI = "LI"; //$NON-NLS-1$
- public static final String LINK = "LINK"; //$NON-NLS-1$
- public static final String MAP = "MAP"; //$NON-NLS-1$
- public static final String MENU = "MENU"; //$NON-NLS-1$
- public static final String META = "META"; //$NON-NLS-1$
- public static final String NOBR = "NOBR"; // D205513 //$NON-NLS-1$
- public static final String NOEMBED = "NOEMBED"; //$NON-NLS-1$
- public static final String NOFRAMES = "NOFRAMES"; //$NON-NLS-1$
- public static final String NOSCRIPT = "NOSCRIPT"; //$NON-NLS-1$
- public static final String OBJECT = "OBJECT"; //$NON-NLS-1$
- public static final String OL = "OL"; //$NON-NLS-1$
- public static final String OPTGROUP = "OPTGROUP"; //$NON-NLS-1$
- public static final String OPTION = "OPTION"; //$NON-NLS-1$
- public static final String P = "P"; //$NON-NLS-1$
- public static final String PARAM = "PARAM"; //$NON-NLS-1$
- public static final String PRE = "PRE"; //$NON-NLS-1$
- public static final String Q = "Q"; //$NON-NLS-1$
- public static final String S = "S"; //$NON-NLS-1$
- public static final String SAMP = "SAMP"; //$NON-NLS-1$
- public static final String SCRIPT = "SCRIPT"; //$NON-NLS-1$
- public static final String SELECT = "SELECT"; //$NON-NLS-1$
- public static final String SMALL = "SMALL"; //$NON-NLS-1$
- public static final String SPAN = "SPAN"; //$NON-NLS-1$
- public static final String STRIKE = "STRIKE"; //$NON-NLS-1$
- public static final String STRONG = "STRONG"; //$NON-NLS-1$
- public static final String STYLE = "STYLE"; //$NON-NLS-1$
- public static final String SUB = "SUB"; //$NON-NLS-1$
- public static final String SUP = "SUP"; //$NON-NLS-1$
- public static final String TABLE = "TABLE"; //$NON-NLS-1$
- public static final String TBODY = "TBODY"; //$NON-NLS-1$
- public static final String TD = "TD"; //$NON-NLS-1$
- public static final String TEXTAREA = "TEXTAREA"; //$NON-NLS-1$
- public static final String TFOOT = "TFOOT"; //$NON-NLS-1$
- public static final String TH = "TH"; //$NON-NLS-1$
- public static final String THEAD = "THEAD"; //$NON-NLS-1$
- public static final String TITLE = "TITLE"; //$NON-NLS-1$
- public static final String TR = "TR"; //$NON-NLS-1$
- public static final String TT = "TT"; //$NON-NLS-1$
- public static final String U = "U"; //$NON-NLS-1$
- public static final String UL = "UL"; //$NON-NLS-1$
- public static final String VAR = "VAR"; //$NON-NLS-1$
- public static final String WBR = "WBR"; // D205513 //$NON-NLS-1$
- public static final String MARQUEE = "MARQUEE"; //$NON-NLS-1$
- public static final String SSI_CONFIG = "SSI:CONFIG"; // D210393
- // //$NON-NLS-1$
- public static final String SSI_ECHO = "SSI:ECHO"; //$NON-NLS-1$
- public static final String SSI_EXEC = "SSI:EXEC"; //$NON-NLS-1$
- public static final String SSI_FSIZE = "SSI:FSIZE"; //$NON-NLS-1$
- public static final String SSI_FLASTMOD = "SSI:FLASTMOD"; //$NON-NLS-1$
- public static final String SSI_INCLUDE = "SSI:INCLUDE"; //$NON-NLS-1$
- public static final String SSI_PRINTENV = "SSI:PRINTENV"; //$NON-NLS-1$
- public static final String SSI_SET = "SSI:SET"; //$NON-NLS-1$
- public static final String WML_WML = "wml"; //$NON-NLS-1$
- public static final String WML_CARD = "card"; //$NON-NLS-1$
- public static final String WML_TEMPLATE = "template"; //$NON-NLS-1$
- public static final String WML_ACCESS = "access"; //$NON-NLS-1$
- public static final String WML_DO = "do"; //$NON-NLS-1$
- public static final String WML_ONEVENT = "onevent"; //$NON-NLS-1$
- public static final String WML_TIMER = "timer"; //$NON-NLS-1$
- public static final String WML_ANCHOR = "anchor"; //$NON-NLS-1$
- public static final String WML_PREV = "prev"; //$NON-NLS-1$
- public static final String WML_REFRESH = "refresh"; //$NON-NLS-1$
- public static final String WML_GO = "go"; //$NON-NLS-1$
- public static final String WML_NOOP = "noop"; //$NON-NLS-1$
- public static final String WML_SETVAR = "setvar"; //$NON-NLS-1$
- public static final String WML_POSTFIELD = "postfield"; //$NON-NLS-1$
- }
-
- // Character Entities
- public static interface EntityName {
- public static final String AACUTE_U = "Aacute"; //$NON-NLS-1$
- public static final String AACUTE_L = "aacute"; //$NON-NLS-1$
- public static final String ACIRC_U = "Acirc"; //$NON-NLS-1$
- public static final String ACIRC_L = "acirc"; //$NON-NLS-1$
- public static final String ACUTE = "acute"; //$NON-NLS-1$
- public static final String AELIG_U = "AElig"; //$NON-NLS-1$
- public static final String AELIG_L = "aelig"; //$NON-NLS-1$
- public static final String AGRAVE_U = "Agrave"; //$NON-NLS-1$
- public static final String AGRAVE_L = "agrave"; //$NON-NLS-1$
- public static final String ALEFSYM = "alefsym"; //$NON-NLS-1$
- public static final String ALPHA_U = "Alpha"; //$NON-NLS-1$
- public static final String ALPHA_L = "alpha"; //$NON-NLS-1$
- public static final String AMP = "amp"; //$NON-NLS-1$
- public static final String AND = "and"; //$NON-NLS-1$
- public static final String ANG = "ang"; //$NON-NLS-1$
- public static final String ARING_U = "Aring"; //$NON-NLS-1$
- public static final String ARING_L = "aring"; //$NON-NLS-1$
- public static final String ASYMP = "asymp"; //$NON-NLS-1$
- public static final String ATILDE_U = "Atilde"; //$NON-NLS-1$
- public static final String ATILDE_L = "atilde"; //$NON-NLS-1$
- public static final String AUML_U = "Auml"; //$NON-NLS-1$
- public static final String AUML_L = "auml"; //$NON-NLS-1$
- public static final String BDQUO = "bdquo"; //$NON-NLS-1$
- public static final String BETA_U = "Beta"; //$NON-NLS-1$
- public static final String BETA_L = "beta"; //$NON-NLS-1$
- public static final String BRVBAR = "brvbar"; //$NON-NLS-1$
- public static final String BULL = "bull"; //$NON-NLS-1$
- public static final String CAP = "cap"; //$NON-NLS-1$
- public static final String CCEDIL_U = "Ccedil"; //$NON-NLS-1$
- public static final String CCEDIL_L = "ccedil"; //$NON-NLS-1$
- public static final String CEDIL = "cedil"; //$NON-NLS-1$
- public static final String CENT = "cent"; //$NON-NLS-1$
- public static final String CHI_U = "Chi"; //$NON-NLS-1$
- public static final String CHI_L = "chi"; //$NON-NLS-1$
- public static final String CIRC = "circ"; //$NON-NLS-1$
- public static final String CLUBS = "clubs"; //$NON-NLS-1$
- public static final String CONG = "cong"; //$NON-NLS-1$
- public static final String COPY = "copy"; //$NON-NLS-1$
- public static final String CRARR = "crarr"; //$NON-NLS-1$
- public static final String CUP = "cup"; //$NON-NLS-1$
- public static final String CURREN = "curren"; //$NON-NLS-1$
- public static final String DAGGER_U = "Dagger"; //$NON-NLS-1$
- public static final String DAGGER_L = "dagger"; //$NON-NLS-1$
- public static final String DARR_U = "dArr"; //$NON-NLS-1$
- public static final String DARR_L = "darr"; //$NON-NLS-1$
- public static final String DEG = "deg"; //$NON-NLS-1$
- public static final String DELTA_U = "Delta"; //$NON-NLS-1$
- public static final String DELTA_L = "delta"; //$NON-NLS-1$
- public static final String DIAMS = "diams"; //$NON-NLS-1$
- public static final String DIVIDE = "divide"; //$NON-NLS-1$
- public static final String EACUTE_U = "Eacute"; //$NON-NLS-1$
- public static final String EACUTE_L = "eacute"; //$NON-NLS-1$
- public static final String ECIRC_U = "Ecirc"; //$NON-NLS-1$
- public static final String ECIRC_L = "ecirc"; //$NON-NLS-1$
- public static final String EGRAVE_U = "Egrave"; //$NON-NLS-1$
- public static final String EGRAVE_L = "egrave"; //$NON-NLS-1$
- public static final String EMPTY = "empty"; //$NON-NLS-1$
- public static final String EMSP = "emsp"; //$NON-NLS-1$
- public static final String ENSP = "ensp"; //$NON-NLS-1$
- public static final String EPSILON_U = "Epsilon"; //$NON-NLS-1$
- public static final String EPSILON_L = "epsilon"; //$NON-NLS-1$
- public static final String EQUIV = "equiv"; //$NON-NLS-1$
- public static final String ETA_U = "Eta"; //$NON-NLS-1$
- public static final String ETA_L = "eta"; //$NON-NLS-1$
- public static final String ETH_U = "ETH"; //$NON-NLS-1$
- public static final String ETH_L = "eth"; //$NON-NLS-1$
- public static final String EUML_U = "Euml"; //$NON-NLS-1$
- public static final String EUML_L = "euml"; //$NON-NLS-1$
- public static final String EURO = "euro"; //$NON-NLS-1$
- public static final String EXIST = "exist"; //$NON-NLS-1$
- public static final String FNOF = "fnof"; //$NON-NLS-1$
- public static final String FORALL = "forall"; //$NON-NLS-1$
- public static final String FRAC12 = "frac12"; //$NON-NLS-1$
- public static final String FRAC14 = "frac14"; //$NON-NLS-1$
- public static final String FRAC34 = "frac34"; //$NON-NLS-1$
- public static final String FRASL = "frasl"; //$NON-NLS-1$
- public static final String GAMMA_U = "Gamma"; //$NON-NLS-1$
- public static final String GAMMA_L = "gamma"; //$NON-NLS-1$
- public static final String GE = "ge"; //$NON-NLS-1$
- public static final String GT = "gt"; //$NON-NLS-1$
- public static final String HARR_U = "hArr"; //$NON-NLS-1$
- public static final String HARR_L = "harr"; //$NON-NLS-1$
- public static final String HEARTS = "hearts"; //$NON-NLS-1$
- public static final String HELLIP = "hellip"; //$NON-NLS-1$
- public static final String IACUTE_U = "Iacute"; //$NON-NLS-1$
- public static final String IACUTE_L = "iacute"; //$NON-NLS-1$
- public static final String ICIRC_U = "Icirc"; //$NON-NLS-1$
- public static final String ICIRC_L = "icirc"; //$NON-NLS-1$
- public static final String IEXCL = "iexcl"; //$NON-NLS-1$
- public static final String IGRAVE_U = "Igrave"; //$NON-NLS-1$
- public static final String IGRAVE_L = "igrave"; //$NON-NLS-1$
- public static final String IMAGE = "image"; //$NON-NLS-1$
- public static final String INFIN = "infin"; //$NON-NLS-1$
- public static final String INT = "int"; //$NON-NLS-1$
- public static final String IOTA_U = "Iota"; //$NON-NLS-1$
- public static final String IOTA_L = "iota"; //$NON-NLS-1$
- public static final String IQUEST = "iquest"; //$NON-NLS-1$
- public static final String ISIN = "isin"; //$NON-NLS-1$
- public static final String IUML_U = "Iuml"; //$NON-NLS-1$
- public static final String IUML_L = "iuml"; //$NON-NLS-1$
- public static final String KAPPA_U = "Kappa"; //$NON-NLS-1$
- public static final String KAPPA_L = "kappa"; //$NON-NLS-1$
- public static final String LAMBDA_U = "Lambda"; //$NON-NLS-1$
- public static final String LAMBDA_L = "lambda"; //$NON-NLS-1$
- public static final String LANG = "lang"; //$NON-NLS-1$
- public static final String LAQUO = "laquo"; //$NON-NLS-1$
- public static final String LARR_U = "lArr"; //$NON-NLS-1$
- public static final String LARR_L = "larr"; //$NON-NLS-1$
- public static final String LCEIL = "lceil"; //$NON-NLS-1$
- public static final String LDQUO = "ldquo"; //$NON-NLS-1$
- public static final String LE = "le"; //$NON-NLS-1$
- public static final String LFLOOR = "lfloor"; //$NON-NLS-1$
- public static final String LOWAST = "lowast"; //$NON-NLS-1$
- public static final String LOZ = "loz"; //$NON-NLS-1$
- public static final String LRM = "lrm"; //$NON-NLS-1$
- public static final String LSAQUO = "lsaquo"; //$NON-NLS-1$
- public static final String LSQUO = "lsquo"; //$NON-NLS-1$
- public static final String LT = "lt"; //$NON-NLS-1$
- public static final String MACR = "macr"; //$NON-NLS-1$
- public static final String MDASH = "mdash"; //$NON-NLS-1$
- public static final String MICRO = "micro"; //$NON-NLS-1$
- public static final String MIDDOT = "middot"; //$NON-NLS-1$
- public static final String MINUS = "minus"; //$NON-NLS-1$
- public static final String MU_U = "Mu"; //$NON-NLS-1$
- public static final String MU_L = "mu"; //$NON-NLS-1$
- public static final String NABLA = "nabla"; //$NON-NLS-1$
- public static final String NBSP = "nbsp"; //$NON-NLS-1$
- public static final String NDASH = "ndash"; //$NON-NLS-1$
- public static final String NE = "ne"; //$NON-NLS-1$
- public static final String NI = "ni"; //$NON-NLS-1$
- public static final String NOT = "not"; //$NON-NLS-1$
- public static final String NOTIN = "notin"; //$NON-NLS-1$
- public static final String NSUB = "nsub"; //$NON-NLS-1$
- public static final String NTILDE_U = "Ntilde"; //$NON-NLS-1$
- public static final String NTILDE_L = "ntilde"; //$NON-NLS-1$
- public static final String NU_U = "Nu"; //$NON-NLS-1$
- public static final String NU_L = "nu"; //$NON-NLS-1$
- public static final String OACUTE_U = "Oacute"; //$NON-NLS-1$
- public static final String OACUTE_L = "oacute"; //$NON-NLS-1$
- public static final String OCIRC_U = "Ocirc"; //$NON-NLS-1$
- public static final String OCIRC_L = "ocirc"; //$NON-NLS-1$
- public static final String OELIG_U = "OElig"; //$NON-NLS-1$
- public static final String OELIG_L = "oelig"; //$NON-NLS-1$
- public static final String OGRAVE_U = "Ograve"; //$NON-NLS-1$
- public static final String OGRAVE_L = "ograve"; //$NON-NLS-1$
- public static final String OLINE = "oline"; //$NON-NLS-1$
- public static final String OMEGA_U = "Omega"; //$NON-NLS-1$
- public static final String OMEGA_L = "omega"; //$NON-NLS-1$
- public static final String OMICRON_U = "Omicron"; //$NON-NLS-1$
- public static final String OMICRON_L = "omicron"; //$NON-NLS-1$
- public static final String OPLUS = "oplus"; //$NON-NLS-1$
- public static final String OR = "or"; //$NON-NLS-1$
- public static final String ORDF = "ordf"; //$NON-NLS-1$
- public static final String ORDM = "ordm"; //$NON-NLS-1$
- public static final String OSLASH_U = "Oslash"; //$NON-NLS-1$
- public static final String OSLASH_L = "oslash"; //$NON-NLS-1$
- public static final String OTILDE_U = "Otilde"; //$NON-NLS-1$
- public static final String OTILDE_L = "otilde"; //$NON-NLS-1$
- public static final String OTIMES = "otimes"; //$NON-NLS-1$
- public static final String OUML_U = "Ouml"; //$NON-NLS-1$
- public static final String OUML_L = "ouml"; //$NON-NLS-1$
- public static final String PARA = "para"; //$NON-NLS-1$
- public static final String PART = "part"; //$NON-NLS-1$
- public static final String PERMIL = "permil"; //$NON-NLS-1$
- public static final String PERP = "perp"; //$NON-NLS-1$
- public static final String PHI_U = "Phi"; //$NON-NLS-1$
- public static final String PHI_L = "phi"; //$NON-NLS-1$
- public static final String PI_U = "Pi"; //$NON-NLS-1$
- public static final String PI_L = "pi"; //$NON-NLS-1$
- public static final String PIV = "piv"; //$NON-NLS-1$
- public static final String PLUSMN = "plusmn"; //$NON-NLS-1$
- public static final String POUND = "pound"; //$NON-NLS-1$
- public static final String PRIME_U = "Prime"; //$NON-NLS-1$
- public static final String PRIME_L = "prime"; //$NON-NLS-1$
- public static final String PROD = "prod"; //$NON-NLS-1$
- public static final String PROP = "prop"; //$NON-NLS-1$
- public static final String PSI_U = "Psi"; //$NON-NLS-1$
- public static final String PSI_L = "psi"; //$NON-NLS-1$
- public static final String QUOT = "quot"; //$NON-NLS-1$
- public static final String RADIC = "radic"; //$NON-NLS-1$
- public static final String RANG = "rang"; //$NON-NLS-1$
- public static final String RAQUO = "raquo"; //$NON-NLS-1$
- public static final String RARR_U = "rArr"; //$NON-NLS-1$
- public static final String RARR_L = "rarr"; //$NON-NLS-1$
- public static final String RCEIL = "rceil"; //$NON-NLS-1$
- public static final String RDQUO = "rdquo"; //$NON-NLS-1$
- public static final String REAL = "real"; //$NON-NLS-1$
- public static final String REG = "reg"; //$NON-NLS-1$
- public static final String RFLOOR = "rfloor"; //$NON-NLS-1$
- public static final String RHO_U = "Rho"; //$NON-NLS-1$
- public static final String RHO_L = "rho"; //$NON-NLS-1$
- public static final String RLM = "rlm"; //$NON-NLS-1$
- public static final String RSAQUO = "rsaquo"; //$NON-NLS-1$
- public static final String RSQUO = "rsquo"; //$NON-NLS-1$
- public static final String SBQUO = "sbquo"; //$NON-NLS-1$
- public static final String SCARON_U = "Scaron"; //$NON-NLS-1$
- public static final String SCARON_L = "scaron"; //$NON-NLS-1$
- public static final String SDOT = "sdot"; //$NON-NLS-1$
- public static final String SECT = "sect"; //$NON-NLS-1$
- public static final String SHY = "shy"; //$NON-NLS-1$
- public static final String SIGMA_U = "Sigma"; //$NON-NLS-1$
- public static final String SIGMA_L = "sigma"; //$NON-NLS-1$
- public static final String SIGMAF = "sigmaf"; //$NON-NLS-1$
- public static final String SIM = "sim"; //$NON-NLS-1$
- public static final String SPADES = "spades"; //$NON-NLS-1$
- public static final String SUB = "sub"; //$NON-NLS-1$
- public static final String SUBE = "sube"; //$NON-NLS-1$
- public static final String SUM = "sum"; //$NON-NLS-1$
- public static final String SUP = "sup"; //$NON-NLS-1$
- public static final String SUP1 = "sup1"; //$NON-NLS-1$
- public static final String SUP2 = "sup2"; //$NON-NLS-1$
- public static final String SUP3 = "sup3"; //$NON-NLS-1$
- public static final String SUPE = "supe"; //$NON-NLS-1$
- public static final String SZLIG = "szlig"; //$NON-NLS-1$
- public static final String TAU_U = "Tau"; //$NON-NLS-1$
- public static final String TAU_L = "tau"; //$NON-NLS-1$
- public static final String THERE4 = "there4"; //$NON-NLS-1$
- public static final String THETA_U = "Theta"; //$NON-NLS-1$
- public static final String THETA_L = "theta"; //$NON-NLS-1$
- public static final String THETASYM = "thetasym"; //$NON-NLS-1$
- public static final String THINSP = "thinsp"; //$NON-NLS-1$
- public static final String THORN_U = "THORN"; //$NON-NLS-1$
- public static final String THORN_L = "thorn"; //$NON-NLS-1$
- public static final String TILDE = "tilde"; //$NON-NLS-1$
- public static final String TIMES = "times"; //$NON-NLS-1$
- public static final String TRADE = "trade"; //$NON-NLS-1$
- public static final String UACUTE_U = "Uacute"; //$NON-NLS-1$
- public static final String UACUTE_L = "uacute"; //$NON-NLS-1$
- public static final String UARR_U = "uArr"; //$NON-NLS-1$
- public static final String UARR_L = "uarr"; //$NON-NLS-1$
- public static final String UCIRC_U = "Ucirc"; //$NON-NLS-1$
- public static final String UCIRC_L = "ucirc"; //$NON-NLS-1$
- public static final String UGRAVE_U = "Ugrave"; //$NON-NLS-1$
- public static final String UGRAVE_L = "ugrave"; //$NON-NLS-1$
- public static final String UML = "uml"; //$NON-NLS-1$
- public static final String UPSIH = "upsih"; //$NON-NLS-1$
- public static final String UPSILON_U = "Upsilon"; //$NON-NLS-1$
- public static final String UPSILON_L = "upsilon"; //$NON-NLS-1$
- public static final String UUML_U = "Uuml"; //$NON-NLS-1$
- public static final String UUML_L = "uuml"; //$NON-NLS-1$
- public static final String WEIERP = "weierp"; //$NON-NLS-1$
- public static final String XI_U = "Xi"; //$NON-NLS-1$
- public static final String XI_L = "xi"; //$NON-NLS-1$
- public static final String YACUTE_U = "Yacute"; //$NON-NLS-1$
- public static final String YACUTE_L = "yacute"; //$NON-NLS-1$
- public static final String YEN = "yen"; //$NON-NLS-1$
- public static final String YUML_U = "Yuml"; //$NON-NLS-1$
- public static final String YUML_L = "yuml"; //$NON-NLS-1$
- public static final String ZETA_U = "Zeta"; //$NON-NLS-1$
- public static final String ZETA_L = "zeta"; //$NON-NLS-1$
- public static final String ZWJ = "zwj"; //$NON-NLS-1$
- public static final String ZWNJ = "zwnj"; //$NON-NLS-1$
- }
-
- public static final String HTML40_URI = "http://www.w3.org/TR/REC-html40/frameset.dtd"; //$NON-NLS-1$
- public static final String HTML40_TAG_PREFIX = ""; //$NON-NLS-1$
- // global attribute names
- public static final String ATTR_NAME_ID = "id"; // %coreattrs;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_CLASS = "class"; // %coreattrs;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_STYLE = "style"; // %coreattrs;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_TITLE = "title"; // %coreattrs;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_LANG = "lang"; // %i18n;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_DIR = "dir"; // %i18n; //$NON-NLS-1$
- public static final String ATTR_NAME_ONCLICK = "onclick"; // %events;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ONDBLCLICK = "ondblclick"; // %events;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ONMOUSEDOWN = "onmousedown"; // %events;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ONMOUSEUP = "onmouseup"; // %events;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ONMOUSEOVER = "onmouseover"; // %events;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ONMOUSEMOVE = "onmousemove"; // %events;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ONMOUSEOUT = "onmouseout"; // %events;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ONKEYPRESS = "onkeypress"; // %events;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ONKEYDOWN = "onkeydown"; // %events;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ONKEYUP = "onkeyup"; // %events;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ONHELP = "onhelp"; // %events;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_BGCOLOR = "bgcolor"; // %bodycolor;,
- // TABLE
- // //$NON-NLS-1$
- public static final String ATTR_NAME_TEXT = "text"; // %bodycolor;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_LINK = "link"; // %bodycolor;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_VLINK = "vlink"; // %bodycolor;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ALINK = "alink"; // %bodycolor;
- // //$NON-NLS-1$
- public static final String ATTR_NAME_VERSION = "version"; // HTML
- // //$NON-NLS-1$
- public static final String ATTR_NAME_PROFILE = "profile"; // HEAD
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ONLOAD = "onload"; // BODY
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ONUNLOAD = "onunload"; // BODY
- // //$NON-NLS-1$
- public static final String ATTR_NAME_BACKGROUND = "background"; // BODY,
- // TABLE
- // //$NON-NLS-1$
- public static final String ATTR_NAME_SRC = "src"; // IMG //$NON-NLS-1$
- public static final String ATTR_NAME_ALT = "alt"; // IMG,AREA
- // //$NON-NLS-1$
- public static final String ATTR_NAME_LONGDESC = "longdesc"; // IMG
- // //$NON-NLS-1$
- public static final String ATTR_NAME_NAME = "name"; // IMG //$NON-NLS-1$
- public static final String ATTR_NAME_HEIGHT = "height"; // IMG, TABLE
- // //$NON-NLS-1$
- public static final String ATTR_NAME_WIDTH = "width"; // IMG, TABLE,HR
- // //$NON-NLS-1$
- public static final String ATTR_NAME_USEMAP = "usemap"; // IMG
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ISMAP = "ismap"; // IMG //$NON-NLS-1$
- public static final String ATTR_NAME_ALIGN = "align"; // IMG, TABLE,HR
- // //$NON-NLS-1$
- public static final String ATTR_NAME_BORDER = "border"; // IMG, TABLE
- // //$NON-NLS-1$
- public static final String ATTR_NAME_HSPACE = "hspace"; // IMG
- // //$NON-NLS-1$
- public static final String ATTR_NAME_VSPACE = "vspace"; // IMG
- // //$NON-NLS-1$
- public static final String ATTR_NAME_MAPFILE = "mapfile"; // IMG
- // //$NON-NLS-1$
- public static final String ATTR_NAME_SUMMARY = "summary"; // TABLE
- // //$NON-NLS-1$
- public static final String ATTR_NAME_FRAME = "frame"; // TABLE
- // //$NON-NLS-1$
- public static final String ATTR_NAME_RULES = "rules"; // TABLE
- // //$NON-NLS-1$
- public static final String ATTR_NAME_CELLSPACING = "cellspacing"; // TABLE
- // //$NON-NLS-1$
- public static final String ATTR_NAME_CELLPADDING = "cellpadding"; // TABLE
- // //$NON-NLS-1$
- public static final String ATTR_NAME_DATAPAGESIZE = "datapagesize"; // TABLE,HR
- // //$NON-NLS-1$
- public static final String ATTR_NAME_COLOR = "color"; // BASEFONT,FONT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_FACE = "face"; // BASEFONT,FONT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_SIZE = "size"; // BASEFONT,FONT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_CLEAR = "clear"; // BR //$NON-NLS-1$
- public static final String ATTR_NAME_SHAPE = "shape"; // AREA
- // //$NON-NLS-1$
- public static final String ATTR_NAME_COORDS = "coords"; // AREA
- // //$NON-NLS-1$
- public static final String ATTR_NAME_HREF = "href"; // AREA //$NON-NLS-1$
- public static final String ATTR_NAME_TARGET = "target"; // AREA
- // //$NON-NLS-1$
- public static final String ATTR_NAME_NOHREF = "nohref"; // AREA
- // //$NON-NLS-1$
- public static final String ATTR_NAME_TABINDEX = "tabindex"; // AREA
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ACCESSKEY = "accesskey"; // AREA
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ONFOCUS = "onfocus"; // AREA
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ONBLUR = "onblur"; // AREA
- // //$NON-NLS-1$
- public static final String ATTR_NAME_CHARSET = "charset"; // LINK
- // //$NON-NLS-1$
- public static final String ATTR_NAME_HREFLANG = "hreflang"; // LINK
- // //$NON-NLS-1$
- public static final String ATTR_NAME_TYPE = "type"; // LINK //$NON-NLS-1$
- public static final String ATTR_NAME_REL = "rel"; // LINK //$NON-NLS-1$
- public static final String ATTR_NAME_REV = "rev"; // LINK //$NON-NLS-1$
- public static final String ATTR_NAME_MEDIA = "media"; // LINK
- // //$NON-NLS-1$
- public static final String ATTR_NAME_VALUE = "value"; // PARAM
- // //$NON-NLS-1$
- public static final String ATTR_NAME_VALUETYPE = "valuetype"; // PARAM
- // //$NON-NLS-1$
- public static final String ATTR_NAME_NOSHADE = "noshade"; // HR
- // //$NON-NLS-1$
- public static final String ATTR_NAME_CHECKED = "checked"; // INPUT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_DISABLED = "disabled"; // INPUT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_READONLY = "readonly"; // INPUT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_MAXLENGTH = "maxlength"; // INPUT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ONSELECT = "onselect"; // INPUT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ONCHANGE = "onchange"; // INPUT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ACCEPT = "accept"; // INPUT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ISTYLE = "istyle"; // INPUT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_CHAR = "char"; // COL //$NON-NLS-1$
- public static final String ATTR_NAME_CHAROFF = "charoff"; // COL
- // //$NON-NLS-1$
- public static final String ATTR_NAME_VALIGN = "valign"; // COL
- // //$NON-NLS-1$
- public static final String ATTR_NAME_SPAN = "span"; // COL //$NON-NLS-1$
- public static final String ATTR_NAME_FRAMEBORDER = "frameborder"; // FRAME
- // //$NON-NLS-1$
- public static final String ATTR_NAME_MARGINWIDTH = "marginwidth"; // FRAME
- // //$NON-NLS-1$
- public static final String ATTR_NAME_MARGINHEIGHT = "marginheight"; // FRAME
- // //$NON-NLS-1$
- public static final String ATTR_NAME_NORESIZE = "noresize"; // FRAME
- // //$NON-NLS-1$
- public static final String ATTR_NAME_SCROLLING = "scrolling"; // FRAME
- // //$NON-NLS-1$
- public static final String ATTR_NAME_PROMPT = "prompt"; // ISINDEX
- // //$NON-NLS-1$
- public static final String ATTR_NAME_HTTP_EQUIV = "http-equiv"; // META
- // //$NON-NLS-1$
- public static final String ATTR_NAME_CONTENT = "content"; // META
- // //$NON-NLS-1$
- public static final String ATTR_NAME_SCHEME = "scheme"; // META
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ERRMSG = "errmsg"; // ssi:config
- // //$NON-NLS-1$
- public static final String ATTR_NAME_SIZEFMT = "sizefmt"; // ssi:config
- // //$NON-NLS-1$
- public static final String ATTR_NAME_TIMEFMT = "timefmt"; // ssi:config
- // //$NON-NLS-1$
- public static final String ATTR_NAME_VAR = "var"; // ssi:echo
- // //$NON-NLS-1$
- public static final String ATTR_NAME_CGI = "cgi"; // ssi:exec
- // //$NON-NLS-1$
- public static final String ATTR_NAME_CMD = "cmd"; // ssi:exec
- // //$NON-NLS-1$
- public static final String ATTR_NAME_FILE = "file"; // ssi:fsize
- // //$NON-NLS-1$
- public static final String ATTR_NAME_VIRTUAL = "virtual"; // ssi:fsize
- // //$NON-NLS-1$
- public static final String ATTR_NAME_SELECTED = "selected"; // OPTION
- // //$NON-NLS-1$
- public static final String ATTR_NAME_LABEL = "label"; // OPTION
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ROWS = "rows"; // TEXTAREA
- // //$NON-NLS-1$
- public static final String ATTR_NAME_COLS = "cols"; // TEXTAREA
- // //$NON-NLS-1$
- public static final String ATTR_NAME_LANGUAGE = "language"; // SCRIPT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_DEFER = "defer"; // SCRIPT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_EVENT = "event"; // SCRIPT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_FOR = "for"; // SCRIPT //$NON-NLS-1$
- public static final String ATTR_NAME_COMPACT = "compact"; // OL/UL
- // //$NON-NLS-1$
- public static final String ATTR_NAME_START = "start"; // OL/UL
- // //$NON-NLS-1$
- public static final String ATTR_NAME_DIRECTKEY = "directkey"; // A
- // //$NON-NLS-1$
- public static final String ATTR_NAME_CODEBASE = "codebase"; // APPLET
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ARCHIVE = "archive"; // APPLET
- // //$NON-NLS-1$
- public static final String ATTR_NAME_CODE = "code"; // APPLET
- // //$NON-NLS-1$
- public static final String ATTR_NAME_OBJECT = "object"; // APPLET
- // //$NON-NLS-1$
- public static final String ATTR_NAME_MAYSCRIPT = "mayscript"; // APPLET
- // //$NON-NLS-1$
- public static final String ATTR_NAME_CITE = "cite"; // BLOCKQUOTE
- // //$NON-NLS-1$
- public static final String ATTR_NAME_MACRO = "macro"; // D2W //$NON-NLS-1$
- public static final String ATTR_NAME_DATETIME = "datetime"; // INS/DEL
- // //$NON-NLS-1$
- public static final String ATTR_NAME_LOOP = "loop"; // EMBED //$NON-NLS-1$
- public static final String ATTR_NAME_HIDDEN = "hidden"; // EMBED
- // //$NON-NLS-1$
- public static final String ATTR_NAME_VOLUME = "volume"; // EMBED
- // //$NON-NLS-1$
- public static final String ATTR_NAME_AUTOSTART = "autostart"; // EMBED
- // //$NON-NLS-1$
- public static final String ATTR_NAME_AUTOPLAY = "autoplay"; // EMBED
- // //$NON-NLS-1$
- public static final String ATTR_NAME_AUTOSIZE = "autosize"; // EMBED
- // //$NON-NLS-1$
- public static final String ATTR_NAME_CONTROLLER = "controller";// EMBED
- // //$NON-NLS-1$
- public static final String ATTR_NAME_SCALE = "scale"; // EMBED
- // //$NON-NLS-1$
- public static final String ATTR_NAME_SHOWCONTROLS = "showcontrols";// EMBED
- // //$NON-NLS-1$
- public static final String ATTR_NAME_PLAYCOUNT = "playcount"; // EMBED
- // //$NON-NLS-1$
- public static final String ATTR_NAME_REPEAT = "repeat"; // EMBED
- // //$NON-NLS-1$
- public static final String ATTR_NAME_PANEL = "panel"; // EMBED
- // //$NON-NLS-1$
- public static final String ATTR_NAME_PALETTE = "palette"; // EMBED
- // //$NON-NLS-1$
- public static final String ATTR_NAME_TEXTFOCUS = "textfocus"; // EMBED
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ACTION = "action"; // FORM
- // //$NON-NLS-1$
- public static final String ATTR_NAME_METHOD = "method"; // FORM
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ENCTYPE = "enctype"; // FORM
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ONSUBMIT = "onsubmit"; // FORM
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ONRESET = "onreset"; // FORM
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ACCEPT_CHARSET = "accept-charset";// FORM
- // //$NON-NLS-1$
- public static final String ATTR_NAME_BEHAVIOR = "behavior"; // MARQUEE
- // //$NON-NLS-1$
- public static final String ATTR_NAME_DIRECTION = "direction"; // MARQUEE
- // //$NON-NLS-1$
- public static final String ATTR_NAME_SCROLLAMOUNT = "scrollamount";// MARQUEE
- // //$NON-NLS-1$
- public static final String ATTR_NAME_SCROLLDELAY = "scrolldelay";// MARQUEE
- // //$NON-NLS-1$
- public static final String ATTR_NAME_TRUESPEED = "truespeed"; // MARQUEE
- // //$NON-NLS-1$
- public static final String ATTR_NAME_DECLARE = "declare"; // OBJECT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_CLASSID = "classid"; // OBJECT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_DATA = "data"; // OBJECT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_CODETYPE = "codetype"; // OBJECT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_STANDBY = "standby"; // OBJECT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_MULTIPLE = "multiple"; // SELECT
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ABBR = "abbr"; // TH/TD //$NON-NLS-1$
- public static final String ATTR_NAME_AXIS = "axis"; // TH/TD //$NON-NLS-1$
- public static final String ATTR_NAME_HEADERS = "headers"; // TH/TD
- // //$NON-NLS-1$
- public static final String ATTR_NAME_SCOPE = "scope"; // TH/TD
- // //$NON-NLS-1$
- public static final String ATTR_NAME_ROWSPAN = "rowspan"; // TH/TD
- // //$NON-NLS-1$
- public static final String ATTR_NAME_COLSPAN = "colspan"; // TH/TD
- // //$NON-NLS-1$
- public static final String ATTR_NAME_NOWRAP = "nowrap"; // TH/TD
- // //$NON-NLS-1$
- // <<D205514
- public static final String ATTR_NAME_TOPMARGIN = "topmargin"; // BODY
- // //$NON-NLS-1$
- public static final String ATTR_NAME_BOTTOMMARGIN = "bottommargin"; // BODY
- // //$NON-NLS-1$
- public static final String ATTR_NAME_LEFTMARGIN = "leftmargin"; // BODY
- // //$NON-NLS-1$
- public static final String ATTR_NAME_RIGHTMARGIN = "rightmargin"; // BODY
- // //$NON-NLS-1$
- public static final String ATTR_NAME_BORDERCOLOR = "bordercolor"; // TABLE/TR/TH/TD/FRAMESET/FRAME
- // //$NON-NLS-1$
- // for WML
- public static final String WML_ATTR_NAME_TITLE = "title"; // card
- // //$NON-NLS-1$
- public static final String WML_ATTR_NAME_DOMAIN = "domain"; // access
- // //$NON-NLS-1$
- public static final String WML_ATTR_NAME_PATH = "path"; // access
- // //$NON-NLS-1$
- public static final String WML_ATTR_NAME_ONENTERFORWARD = "onenterforward"; // template,card
- // //$NON-NLS-1$
- public static final String WML_ATTR_NAME_ONENTERBACKWARD = "onenterbackward"; // template,card
- // //$NON-NLS-1$
- public static final String WML_ATTR_NAME_ONPICK = "onpick"; // option
- // //$NON-NLS-1$
- public static final String WML_ATTR_NAME_ONTIMER = "ontimer"; // template,card
- // //$NON-NLS-1$
- public static final String WML_ATTR_NAME_NEWCONTEXT = "newcontext"; // card
- // //$NON-NLS-1$
- public static final String WML_ATTR_NAME_ORDERED = "ordered"; // card
- // //$NON-NLS-1$
- public static final String WML_ATTR_NAME_OPTIONAL = "optional"; // do
- // //$NON-NLS-1$
- public static final String WML_ATTR_NAME_CACHE_CONTROL = "cache-control"; // go
- // //$NON-NLS-1$
- public static final String WML_ATTR_NAME_SENDREFERER = "sendreferer"; // go
- // //$NON-NLS-1$
- public static final String WML_ATTR_NAME_METHOD = "method"; // go
- // //$NON-NLS-1$
- public static final String WML_ATTR_NAME_ENCTYPE = "enctype"; // go
- // //$NON-NLS-1$
- public static final String WML_ATTR_NAME_ACCEPT_CHARSET = "accept-charset"; // go
- // //$NON-NLS-1$
- public static final String WML_ATTR_NAME_COLUMNS = "columns"; // table
- // //$NON-NLS-1$
- // D205514
- //<<D215684
- public static final String ATTR_NAME_FRAMESPACING = "framespacing"; // FRAMESET
- // //$NON-NLS-1$
- //D215684
- // global attribute values; mainly used in enumeration.
- public static final String ATTR_VALUE_VERSION_TRANSITIONAL = "-//W3C//DTD HTML 4.01 Transitional//EN"; //$NON-NLS-1$
- public static final String ATTR_VALUE_VERSION_FRAMESET = "-//W3C//DTD HTML 4.01 Frameset//EN"; //$NON-NLS-1$
- public static final String ATTR_VALUE_LTR = "ltr"; // dir //$NON-NLS-1$
- public static final String ATTR_VALUE_RTL = "rtl"; // dir //$NON-NLS-1$
- // for align (top|middle|bottom|left|right)
- public static final String ATTR_VALUE_TOP = "top"; // align //$NON-NLS-1$
- public static final String ATTR_VALUE_MIDDLE = "middle"; // align
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_BOTTOM = "bottom"; // align
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_LEFT = "left"; // align
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_CENTER = "center"; // align
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_RIGHT = "right"; // align
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_JUSTIFY = "justify"; // align
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_CHAR = "char"; // align
- // //$NON-NLS-1$
- // for valign (baseline)
- public static final String ATTR_VALUE_BASELINE = "baseline"; // valign
- // //$NON-NLS-1$
- // for clear (left|all|right|none): left and right are already defined
- // above.
- public static final String ATTR_VALUE_ALL = "all"; // clear //$NON-NLS-1$
- public static final String ATTR_VALUE_NONE = "none"; // clear
- // //$NON-NLS-1$
- // for shape (rect|circle|poly|default)
- public static final String ATTR_VALUE_RECT = "rect"; // shape
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_CIRCLE = "circle"; // shape
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_POLY = "poly"; // shape
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_DEFAULT = "default"; // shape
- // //$NON-NLS-1$
- // for valuetype (data|ref|object)
- public static final String ATTR_VALUE_DATA = "data"; // valuetype
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_REF = "ref"; // valuetype
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_OBJECT = "object"; // valuetype
- // //$NON-NLS-1$
- // for type of INPUT
- // (text | password | checkbox | radio | submit | reset |
- // file | hidden | image | button)
- public static final String ATTR_VALUE_TEXT = "text"; // INPUT:type
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_PASSWORD = "password"; // INPUT:type
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_CHECKBOX = "checkbox"; // INPUT:type
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_RADIO = "radio"; // INPUT:type
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_SUBMIT = "submit"; // INPUT:type
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_RESET = "reset"; // INPUT:type
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_FILE = "file"; // INPUT:type
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_HIDDEN = "hidden"; // INPUT:type
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_IMAGE = "image"; // INPUT:type
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_BUTTON = "button"; // INPUT:type
- // //$NON-NLS-1$
- // for span, colspan, rowspan
- public static final String ATTR_VALUE_1 = "1"; // span //$NON-NLS-1$
- // for frameborder
- public static final String ATTR_VALUE_0 = "0"; // FRAME //$NON-NLS-1$
- // for scrolling
- public static final String ATTR_VALUE_YES = "yes"; // FRAME //$NON-NLS-1$
- public static final String ATTR_VALUE_NO = "no"; // FRAME //$NON-NLS-1$
- public static final String ATTR_VALUE_AUTO = "auto"; // FRAME
- // //$NON-NLS-1$
- // for UL
- public static final String ATTR_VALUE_DISC = "disc"; // UL:type
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_SQUARE = "square"; // UL:type
- // //$NON-NLS-1$
- // for frame of TABLE
- public static final String ATTR_VALUE_VOID = "void"; // TABLE:frame
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_ABOVE = "above"; // TABLE:frame
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_BELOW = "below"; // TABLE:frame
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_HSIDES = "hsides"; // TABLE:frame
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_LHS = "lhs"; // TABLE:frame
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_RHS = "rhs"; // TABLE:frame
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_VSIDES = "vsides"; // TABLE:frame
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_BOX = "box"; // TABLE:frame
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_BORDER = "border"; // TABLE:frame
- // //$NON-NLS-1$
- // for rules of TABLE
- public static final String ATTR_VALUE_GROUPS = "groups"; // TABLE:rules
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_ROWS = "rows"; // TEXTAREA
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_COLS = "cols"; // TEXTAREA
- // //$NON-NLS-1$
- // for method of FORM
- public static final String ATTR_VALUE_GET = "get"; // FORM //$NON-NLS-1$
- public static final String ATTR_VALUE_POST = "post"; // FORM //$NON-NLS-1$
- public static final String ATTR_VALUE_WWW_FORM_URLENCODED = "application/x-www-form-urlencoded"; //$NON-NLS-1$
- // for scope of (TH | TD)
- public static final String ATTR_VALUE_ROW = "row"; // (TH|TD):scope
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_COL = "col"; // (TH|TD):scope
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_ROWGROUP = "rowgroup";// (TH|TD):scope
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_COLGROUP = "colgroup";// (TH|TD):scope
- // //$NON-NLS-1$
- // for auto?? of EMBED
- public static final String ATTR_VALUE_TRUE = "true"; // EMBED
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_FALSE = "false"; // EMBED
- // //$NON-NLS-1$
- // for behaviro of MARQUEE
- public static final String ATTR_VALUE_SCROLL = "scroll"; // MARQUEE
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_SLIDE = "slide"; // MARQUEE
- // //$NON-NLS-1$
- public static final String ATTR_VALUE_ALTERNATE = "alternate"; // MARQUEE
- // //$NON-NLS-1$
- // for direction of MARQUEE
- public static final String ATTR_VALUE_UP = "up"; // MARQUEE //$NON-NLS-1$
- public static final String ATTR_VALUE_DOWN = "down"; // MARQUEE
- // //$NON-NLS-1$
- // for type of LI (D19924)
- public static final String ATTR_VALUE_NUMBER = "1"; // LI //$NON-NLS-1$
- public static final String ATTR_VALUE_LOWER_ALPHA = "a"; // LI
- // //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/IProposalInfo.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/IProposalInfo.java
deleted file mode 100644
index 1b4b8a9af9..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/IProposalInfo.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/******************************************************************************
- * Copyright (c) 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.css.ui.internal.contentassist;
-
-import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode;
-
-/**
- * Interface for additional proposal information for CSS Content Assist
- *
- */
-public interface IProposalInfo {
- /**
- * Sets the element for additional proposal information
- * @param node the element for additional proposal information
- */
- void setInputElement(CSSMMNode node);
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/ProposalInfoFactory.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/ProposalInfoFactory.java
deleted file mode 100644
index 373f3ddddb..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentassist/ProposalInfoFactory.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/******************************************************************************
- * Copyright (c) 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.css.ui.internal.contentassist;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode;
-import org.eclipse.wst.css.ui.internal.CSSUIPlugin;
-import org.eclipse.wst.css.ui.internal.Logger;
-
-/**
- * Generates proposal information for {@link CSSMMNode}s. If the Proposal Information instance
- * implements {@link IProposalInfo} the node will be set as the input element.
- *
- */
-class ProposalInfoFactory {
-
- private static IConfigurationElement fElement = null;
- private static boolean fIsInitialized = false;
-
- private static final String ATTR_CLASS = "class"; //$NON-NLS-1$
-
- private ProposalInfoFactory() {
- }
-
- /**
- * Returns additional proposal information for <code>node</code>
- * @param node the CSS metamodel node
- * @return additional proposal information about <code>node></code>
- */
- public static synchronized Object getProposalInfo(CSSMMNode node) {
- Object info = null;
- if (!fIsInitialized) {
- // Only attempt to initialize this once. If there are no proposal information providers, we'll always return null
- IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor(CSSUIPlugin.ID, "proposalInfo"); //$NON-NLS-1$
- if (elements.length > 0) {
- // Get the first proposal info that's declared
- fElement = elements[0];
- }
-
- fIsInitialized = true;
- }
-
- if (fElement != null) {
- try {
- info = fElement.createExecutableExtension(ATTR_CLASS); //$NON-NLS-1$
- if (info instanceof IProposalInfo) {
- ((IProposalInfo) info).setInputElement(node);
- }
- } catch (CoreException e) {
- Logger.log(Logger.ERROR, "Could not create instance for proposalInfo [" + fElement.getAttribute("class") + "]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
- return info;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentoutline/CSSNodeAdapter.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentoutline/CSSNodeAdapter.java
deleted file mode 100644
index 1898c59509..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentoutline/CSSNodeAdapter.java
+++ /dev/null
@@ -1,641 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.contentoutline;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.PropertySheetPage;
-import org.eclipse.wst.css.core.internal.document.CSSStructuredDocumentRegionContainer;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSDocument;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSMediaRule;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSPrimitiveValue;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclItem;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclaration;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet;
-import org.eclipse.wst.css.ui.internal.image.CSSImageHelper;
-import org.eclipse.wst.css.ui.internal.image.CSSImageType;
-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;
-import org.eclipse.wst.sse.ui.internal.contentoutline.IJFaceNodeAdapter;
-import org.eclipse.wst.sse.ui.internal.contentoutline.IJFaceNodeAdapterFactory;
-import org.w3c.dom.css.CSSImportRule;
-import org.w3c.dom.css.CSSRule;
-import org.w3c.dom.stylesheets.MediaList;
-
-/**
- * Adapts the CSS DOM node to a JFace viewer.
- */
-class CSSNodeAdapter implements IJFaceNodeAdapter, INodeAdapter, Runnable {
- /**
- * debug .option
- */
- private static final boolean DEBUG = getDebugValue();
-
- private static boolean getDebugValue() {
- String value = Platform.getDebugOption("org.eclipse.wst.sse.ui/debug/outline"); //$NON-NLS-1$
- boolean result = (value != null) && value.equalsIgnoreCase("true"); //$NON-NLS-1$
- return result;
- }
-
- class NotifyContext {
- NotifyContext(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
- this.notifier = notifier;
- this.eventType = eventType;
- this.changedFeature = changedFeature;
- this.oldValue = oldValue;
- this.newValue = newValue;
- this.pos = pos;
- }
-
- void fire() {
- internalNotifyChanged(notifier, eventType, changedFeature, oldValue, newValue, pos);
- }
-
- INodeNotifier notifier;
- int eventType;
- Object changedFeature;
- Object oldValue;
- Object newValue;
- int pos;
- }
-
- class StyleViewUpdater implements Runnable {
- public void run() {
- if (lastUpdater == this) {
- internalActionPerformed();
- lastUpdater = null;
- }
- }
- }
-
- protected INodeAdapterFactory adapterFactory;
- private Vector notifyQueue;
- StyleViewUpdater lastUpdater;
- protected int delayMSecs = 500;
- RefreshStructureJob fRefreshJob = null;
- final static Class ADAPTER_KEY = IJFaceNodeAdapter.class;
-
- public CSSNodeAdapter(INodeAdapterFactory adapterFactory) {
- super();
- this.adapterFactory = adapterFactory;
- }
-
- private synchronized RefreshStructureJob getRefreshJob() {
- if (fRefreshJob == null) {
- fRefreshJob = new RefreshStructureJob();
- }
- return fRefreshJob;
- }
-
- /**
- * Insert the method's description here.
- */
- protected void internalActionPerformed() {
- if (notifyQueue == null) {
- return;
- }
- boolean refresh_all = false;
- boolean refresh_rule = false;
- int pos_all = 0;
- List targets = new ArrayList();
- for (int i = 0; i < notifyQueue.size(); i++) {
- NotifyContext context = (NotifyContext) notifyQueue.get(i);
- if (context.notifier instanceof ICSSStyleSheet) {
- refresh_all = true;
- pos_all = i;
- }
- if (context.notifier instanceof ICSSStyleDeclaration) {
- refresh_rule = true;
- targets.add(context);
- // pos_rule = i;
- }
- // ((NotifyContext) notifyQueue.get(i)).fire();
- }
- if (refresh_all) {
- ((NotifyContext) notifyQueue.get(pos_all)).fire();
- }
- else if (refresh_rule) {
- Iterator i = targets.iterator();
- while (i.hasNext()) {
- ((NotifyContext) i.next()).fire();
- }
- // else if (refresh_rule) internalRefreshAll();
- }
- else {
- for (int i = 0; i < notifyQueue.size(); i++) {
- ((NotifyContext) notifyQueue.get(i)).fire();
- }
- }
- notifyQueue.clear();
- }
-
- /**
- * Called by the object being adapter (the notifier) when something has
- * changed.
- */
- public void internalNotifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
- Iterator iterator = ((IJFaceNodeAdapterFactory) adapterFactory).getListeners().iterator();
- while (iterator.hasNext()) {
- Object listener = iterator.next();
- if (listener instanceof StructuredViewer) {
- notifyChangedForStructuredViewer((StructuredViewer) listener, notifier, eventType, changedFeature, oldValue, newValue, pos);
- }
- else if (listener instanceof PropertySheetPage) {
- notifyChangedForPropertySheetPage((PropertySheetPage) listener, notifier, eventType, changedFeature, oldValue, newValue, pos);
- }
- }
- }
-
- private void notifyChangedForPropertySheetPage(PropertySheetPage page, INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
- if (page.getControl() == null || page.getControl().isDisposed()) {
- return;
- }
- if (eventType == INodeNotifier.CHANGE || eventType == INodeNotifier.ADD || eventType == INodeNotifier.REMOVE) {
- page.refresh();
- }
- }
-
- private void notifyChangedForStructuredViewer(StructuredViewer viewer, INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
- if (viewer.getControl() == null || viewer.getControl().isDisposed()) {
- return;
- }
- if (eventType == INodeNotifier.CHANGE) {
- if (notifier instanceof ICSSStyleSheet) {
- ICSSNode temp = (changedFeature != null) ? (ICSSNode) changedFeature : (ICSSNode) newValue;
- if (temp instanceof ICSSStyleRule) {
- viewer.refresh();
- }
- else {
- for (;;) {
- if (temp instanceof ICSSStyleRule) {
- break;
- }
- temp = temp.getParentNode();
- if (temp == null) {
- break;
- }
- }
- if (temp == null || temp instanceof ICSSStyleSheet) {
- viewer.refresh();
- }
- else {
- viewer.refresh(temp);
- }
- }
- }
- else {
- ICSSNode temp = (ICSSNode) notifier;
- if (temp != null) {
- temp = temp.getParentNode();
- }
- if (temp == null || temp instanceof ICSSStyleSheet) {
- viewer.refresh();
- }
- else {
- viewer.refresh(temp);
- }
- }
- }
- if (eventType == INodeNotifier.ADD) {
- if (notifier instanceof ICSSStyleSheet) {
- ICSSNode temp = (changedFeature != null) ? (ICSSNode) changedFeature : (ICSSNode) newValue;
- if (temp instanceof ICSSStyleRule) {
- viewer.refresh();
- }
- else {
- for (;;) {
- if (temp instanceof ICSSStyleRule) {
- break;
- }
- temp = temp.getParentNode();
- if (temp == null) {
- break;
- }
- }
- }
- if (temp == null || (temp instanceof ICSSStyleSheet)) {
- viewer.refresh();
- }
- else {
- viewer.refresh(temp);
- }
- }
- else {
- if (newValue != null && (newValue instanceof ICSSStyleDeclItem)) {
- viewer.refresh(((ICSSNode) newValue).getParentNode());
- }
- else {
- ICSSNode temp = (ICSSNode) notifier;
- if (temp != null) {
- temp = temp.getParentNode();
- }
- if (temp == null || (temp instanceof ICSSStyleSheet)) {
- viewer.refresh();
- }
- else {
- viewer.refresh(temp);
- }
- }
- }
- }
- else if (eventType == INodeNotifier.REMOVE) {
- if (notifier instanceof ICSSStyleSheet) {
- ICSSNode temp = (changedFeature != null) ? (ICSSNode) changedFeature : (ICSSNode) newValue;
- if (temp instanceof ICSSStyleRule) {
- viewer.refresh();
- }
- else {
- for (;;) {
- if (temp instanceof ICSSStyleRule) {
- break;
- }
- temp = temp.getParentNode();
- if (temp == null) {
- break;
- }
- }
- if (temp == null || (temp instanceof ICSSStyleSheet)) {
- viewer.refresh();
- }
- else {
- viewer.refresh(temp);
- }
- }
- }
- else {
- // viewer.refresh(notifier);
- ICSSNode temp = (ICSSNode) notifier;
- if (temp != null) {
- temp = temp.getParentNode();
- }
- if (temp == null || (temp instanceof ICSSStyleSheet)) {
- viewer.refresh();
- }
- else {
- viewer.refresh(temp);
- }
- }
- }
- // }
- }
-
- /**
- *
- */
- public void internalRefreshAll() {
- Collection listeners = ((JFaceNodeAdapterFactoryCSS) adapterFactory).getListeners();
- Iterator iterator = listeners.iterator();
- while (iterator.hasNext()) {
- Object listener = iterator.next();
- if (listener instanceof StructuredViewer) {
- StructuredViewer viewer = (StructuredViewer) listener;
- if (viewer.getControl() != null && !viewer.getControl().isDisposed()) {
- viewer.refresh();
- }
- }
- else if (listener instanceof PropertySheetPage) {
- PropertySheetPage page = (PropertySheetPage) listener;
- if (page.getControl() != null && !page.getControl().isDisposed()) {
- page.refresh();
- }
- }
- }
- }
-
- /**
- * 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.equals(ADAPTER_KEY);
- }
-
- /**
- * Called by the object being adapter (the notifier) when something has
- * changed.
- */
- public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
- if (notifyQueue == null)
- notifyQueue = new Vector();
-// notifyQueue.add(new NotifyContext(notifier, eventType, changedFeature, oldValue, newValue, pos));
- // TODO-future: there's probably a better way than relying on async
- // exec
- if (notifier instanceof ICSSNode) {
- Collection listeners = ((JFaceNodeAdapterFactoryCSS) adapterFactory).getListeners();
- Iterator iterator = listeners.iterator();
-
- while (iterator.hasNext()) {
- Object listener = iterator.next();
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=90637
- // if (notifier instanceof Node && (listener instanceof
- // StructuredViewer) && (eventType ==
- // INodeNotifier.STRUCTURE_CHANGED || (eventType ==
- // INodeNotifier.CHANGE && changedFeature == null))) {
- if ((listener instanceof StructuredViewer) && ((eventType == INodeNotifier.STRUCTURE_CHANGED) || (eventType == INodeNotifier.CONTENT_CHANGED) || (eventType == INodeNotifier.CHANGE || (eventType == INodeNotifier.ADD) || (eventType == INodeNotifier.REMOVE)))) {
- if (DEBUG) {
- System.out.println("JFaceNodeAdapter notified on event type > " + eventType); //$NON-NLS-1$
- }
-
- // refresh on structural and "unknown" changes
- StructuredViewer structuredViewer = (StructuredViewer) listener;
- // https://w3.opensource.ibm.com/bugzilla/show_bug.cgi?id=5230
- if (structuredViewer.getControl() != null) {
- getRefreshJob().refresh(structuredViewer, (ICSSNode) notifier);
- }
- }
- }
- }
- }
-
- Display getDisplay() {
- return PlatformUI.getWorkbench().getDisplay();
- }
-
- /**
- * this method is intended only for timerExec()
- */
- public void run() {
- lastUpdater = new StyleViewUpdater();
- getDisplay().asyncExec(lastUpdater);
- }
-
- /**
- * Returns an enumeration containing all child nodes of the given element,
- * which represents a node in a tree. The difference to
- * <code>IStructuredContentProvider.getElements(Object)</code> is as
- * follows: <code>getElements</code> is called to obtain the tree
- * viewer's root elements. Method <code>getChildren</code> is used to
- * obtain the children of a given node in the tree, which can can be a
- * root node, too.
- */
- public Object[] getChildren(Object object) {
- if (object instanceof ICSSNode) {
- ICSSNode node = (ICSSNode) object;
-
- short nodeType = node.getNodeType();
- if (nodeType == ICSSNode.STYLERULE_NODE || nodeType == ICSSNode.PAGERULE_NODE || nodeType == ICSSNode.FONTFACERULE_NODE) {
- for (node = node.getFirstChild(); node != null && !(node instanceof ICSSStyleDeclaration); node.getNextSibling()) {
- // nop
- }
- }
- List children = new ArrayList();
- ICSSNode child = (node != null) ? node.getFirstChild() : null;
- while (child != null) {
- if (!(child instanceof ICSSPrimitiveValue) && !(child instanceof MediaList)) {
- children.add(child);
- }
- /*
- * Required to correctly connect the refreshing behavior to
- * the tree
- */
- if (child instanceof INodeNotifier) {
- ((INodeNotifier) child).getAdapterFor(IJFaceNodeAdapter.class);
- }
- child = child.getNextSibling();
- }
- return children.toArray();
- }
- return new Object[0];
- }
-
- /**
- * Returns an enumeration with the elements belonging to the passed
- * element. These elements can be presented as rows in a table, items in a
- * list etc.
- */
- public Object[] getElements(Object object) {
- // The root is usually an instance of an XMLStructuredModel in
- // which case we want to extract the document.
-
- if (object instanceof ICSSModel) {
- ArrayList v = new ArrayList();
- // internalGetElements(object, v);
- addElements(object, v);
- Object[] elements = v.toArray();
-
- for (int i = 0; i < elements.length; i++) {
- /*
- * Required to correctly connect the refreshing behavior to
- * the tree
- */
- if (elements[i] instanceof INodeNotifier) {
- ((INodeNotifier) elements[i]).getAdapterFor(IJFaceNodeAdapter.class);
- }
- }
-
- return elements;
- }
- return new Object[0];
-
- }
-
- /**
- * Returns the image for the label of the given element, for use in the
- * given viewer.
- *
- * @param viewer
- * The viewer that displays the element.
- * @param element
- * The element for which to provide the label image. Element
- * can be <code>null</code> indicating no input object is set
- * to the viewer.
- */
- public Image getLabelImage(Object element) {
- if (element instanceof ICSSNode) {
- CSSImageHelper helper = CSSImageHelper.getInstance();
- return helper.getImage(CSSImageType.getImageType((ICSSNode) element));
- // Image image = getCSSNodeImage(element);
- // return image;
- // return getAdapter(element).getLabelImage((ICSSNode) element);
- }
- return null;
- }
-
- /**
- * Returns the text for the label of the given element, for use in the
- * given viewer.
- *
- * @param viewer
- * The viewer that displays the element.
- * @param element
- * The element for which to provide the label text. Element can
- * be <code>null</code> indicating no input object is set to
- * the viewer.
- */
- public String getLabelText(Object element) {
- // This was returning null, on occasion ... probably should not be,
- // but
- // took the quick and easy way out for now. (dmw 3/8/01)
-
- String result = "";//$NON-NLS-1$
- String mediaText;
- if (element instanceof ICSSNode) {
- switch (((ICSSNode) element).getNodeType()) {
- case ICSSNode.STYLERULE_NODE :
- result = ((ICSSStyleRule) element).getSelectors().getString();
- break;
- case ICSSNode.FONTFACERULE_NODE :
- result = "@font-face";//$NON-NLS-1$
- break;
- case ICSSNode.IMPORTRULE_NODE :
- result = ((CSSImportRule) element).getHref();
- mediaText = getMediaText((CSSImportRule) element);
- if (mediaText != null && 0 < mediaText.length()) {
- result += " (" + mediaText + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- break;
- case ICSSNode.PAGERULE_NODE :
- result = "@page";//$NON-NLS-1$
- break;
- case ICSSNode.STYLEDECLARATION_NODE :
- result = "properties";//$NON-NLS-1$
- break;
- case ICSSNode.STYLEDECLITEM_NODE :
- result = ((ICSSStyleDeclItem) element).getPropertyName();
- break;
- case ICSSNode.PRIMITIVEVALUE_NODE :
- result = ((ICSSPrimitiveValue) element).getStringValue();
- break;
- case ICSSNode.MEDIARULE_NODE :
- result = "@media";//$NON-NLS-1$
- mediaText = getMediaText((ICSSMediaRule) element);
- if (mediaText != null && 0 < mediaText.length()) {
- result += " (" + mediaText + ")"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- break;
- case ICSSNode.CHARSETRULE_NODE :
- result = "@charset";//$NON-NLS-1$
- break;
- case ICSSNode.MEDIALIST_NODE :
- result = ((MediaList) element).getMediaText();
- break;
- default :
- break;
- }
- }
-
- // if (element instanceof ICSSNode) {
- // ICSSNode node = ((ICSSNode)element);
- // result = getAdapter(element).getLabelText((ICSSNode) element);
- // }
- return result;
- }
-
- /**
- * Returns the parent for the given element. This method can return
- * <code>null</code> indicating that the parent can't be computed. In
- * this case the tree viewer can't expand a given node correctly if
- * requested.
- */
- public Object getParent(Object object) {
- if (object instanceof ICSSNode) {
- ICSSNode node = ((ICSSNode) object).getParentNode();
- if (node != null && node.getNodeType() == ICSSNode.STYLEDECLARATION_NODE) {
- /*
- * Required to also correctly connect style declaration to the
- * refreshing behavior in the tree
- */
- if (node instanceof INodeNotifier) {
- ((INodeNotifier) node).getAdapterFor(IJFaceNodeAdapter.class);
- }
- node = node.getParentNode();
- }
- return node;
- }
- return null;
- }
-
- /**
- * Returns <code>true</code> if the given element has children.
- * Otherwise <code>false</code> is returned.
- */
- public boolean hasChildren(Object object) {
- // return getAdapter(object).hasChildren((ICSSNode) object);
- if (object instanceof ICSSNode) {
- /*
- * Required to correctly connect the refreshing behavior to the
- * tree
- */
- if (object instanceof INodeNotifier) {
- ((INodeNotifier) object).getAdapterFor(IJFaceNodeAdapter.class);
- }
-
- if (object instanceof ICSSStyleDeclItem)
- return false;
- else {
- if(((ICSSNode) object).hasChildNodes()) {
- ICSSNode child = ((ICSSNode) object).getFirstChild();
-
- while(child != null) {
- if(child instanceof CSSStructuredDocumentRegionContainer) {
- String childText = ((CSSStructuredDocumentRegionContainer) child).getCssText();
- if(childText != null && childText.length() > 0)
- return true;
- }
- child = child.getNextSibling();
- }
- }
- }
- }
- return false;
- }
-
- private void addElements(Object element, ArrayList v) {
-
- ICSSNode node;
-
- if (element instanceof ICSSModel) {
- ICSSModel model = (ICSSModel) element;
- ICSSDocument doc = model.getDocument();
- node = doc.getFirstChild();
- }
- else if (element instanceof ICSSNode) {
- node = ((ICSSNode) element).getFirstChild();
- }
- else
- return;
-
- while (node != null) {
- if (node instanceof CSSRule) {
- v.add(node);
- }
-
- node = node.getNextSibling();
- }
-
- }
-
- private String getMediaText(CSSRule rule) {
- String result = ""; //$NON-NLS-1$
- ICSSNode child = (rule != null) ? ((ICSSNode) rule).getFirstChild() : null;
- while (child != null) {
- if (child.getNodeType() == ICSSNode.MEDIALIST_NODE) {
- result = ((MediaList) child).getMediaText();
- break;
- }
- child = child.getNextSibling();
- }
- return result;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentoutline/JFaceNodeAdapterFactoryCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentoutline/JFaceNodeAdapterFactoryCSS.java
deleted file mode 100644
index d87e8ee4ea..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentoutline/JFaceNodeAdapterFactoryCSS.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.contentoutline;
-
-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.contentoutline.IJFaceNodeAdapter;
-import org.eclipse.wst.xml.ui.internal.contentoutline.JFaceNodeAdapterFactory;
-
-public class JFaceNodeAdapterFactoryCSS extends JFaceNodeAdapterFactory {
- public JFaceNodeAdapterFactoryCSS() {
- this(IJFaceNodeAdapter.class, true);
- }
-
- public JFaceNodeAdapterFactoryCSS(Object adapterKey, boolean registerAdapters) {
- super(adapterKey, registerAdapters);
- }
-
-
- protected INodeAdapter createAdapter(INodeNotifier node) {
- if (singletonAdapter == null) {
- // create the JFaceNodeAdapter
- singletonAdapter = new CSSNodeAdapter(this);
- }
- return singletonAdapter;
- }
-
-
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentoutline/RefreshStructureJob.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentoutline/RefreshStructureJob.java
deleted file mode 100644
index 11114cec93..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentoutline/RefreshStructureJob.java
+++ /dev/null
@@ -1,355 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.css.ui.internal.contentoutline;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSDocument;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
-
-public class RefreshStructureJob extends Job {
- /** debug flag */
- static final boolean DEBUG;
- private static final long UPDATE_DELAY = 300;
- static {
- String value = Platform.getDebugOption("org.eclipse.wst.sse.ui/debug/refreshStructure"); //$NON-NLS-1$
- DEBUG = (value != null) && value.equalsIgnoreCase("true"); //$NON-NLS-1$
- }
- /** List of refresh requests (Nodes) */
- private final List fRefreshes;
- /** List of update requests (Nodes) */
- private final List fUpdates;
- /** List of update requests (Nodes) */
- private final List fUpdateProperties;
- /** the structured viewers */
- Set fRefreshViewers = new HashSet(3);
- Set fUpdateViewers = new HashSet(3);
-
- public RefreshStructureJob() {
- super(XMLUIMessages.refreshoutline_0);
- setPriority(Job.LONG);
- setSystem(true);
- fRefreshes = new ArrayList(5);
- fUpdates = new ArrayList(5);
- fUpdateProperties = new ArrayList(5);
- }
-
- private synchronized void addUpdateRequest(ICSSNode newNodeRequest, String[] updateProperties) {
- /*
- * If we get to here, either from existing request list being zero
- * length, or no exisitng requests "matched" new request, then add the
- * new request.
- */
- fUpdates.add(newNodeRequest);
- fUpdateProperties.add(updateProperties);
- }
-
- private synchronized void addUpdateViewer(StructuredViewer viewer) {
- fUpdateViewers.add(viewer);
- }
-
- private synchronized void addRefreshRequest(ICSSNode newNodeRequest) {
- /*
- * note: the caller must NOT pass in null node request (which, since
- * private method, we do not need to gaurd against here, as long as we
- * gaurd against it in calling method.
- */
- int size = fRefreshes.size();
- for (int i = 0; i < size; i++) {
- ICSSNode existingNodeRequest = (ICSSNode) fRefreshes.get(i);
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=157427 If we
- * already have a request which equals the new request, discard
- * the new request
- */
- if (existingNodeRequest.equals(newNodeRequest)) {
- return;
- }
- /*
- * If we already have a request which contains the new request,
- * discard the new request
- */
- if (contains(existingNodeRequest, newNodeRequest)) {
- return;
- }
- /*
- * If new request contains any existing requests, replace it with
- * new request. ISSUE: technically, we should replace ALL
- * contained, existing requests (such as if many siblings already
- * que'd up when their common parent is then requested, but, I'm
- * not sure if that occurs much, in practice, or if there's an
- * algorithm to quickly find them all. Actually, I guess we could
- * just go through the _rest_ of the list (i+1 to size) and remove
- * any that are contained by new request ... in future :) .
- */
- if (contains(newNodeRequest, existingNodeRequest)) {
- fRefreshes.set(i, newNodeRequest);
- return;
- }
- }
- /*
- * If we get to here, either from existing request list being zero
- * length, or no exisitng requests "matched" new request, then add the
- * new request.
- */
- fRefreshes.add(newNodeRequest);
- }
-
- private synchronized void addRefreshViewer(StructuredViewer viewer) {
- fRefreshViewers.add(viewer);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.Job#canceling()
- */
- protected void canceling() {
- fUpdates.clear();
- fUpdateViewers.clear();
- super.canceling();
- }
-
- /**
- * Simple hierarchical containment relationship. Note, this method returns
- * "false" if the two nodes are equal!
- *
- * @param root
- * @param possible
- * @return if the root is parent of possible, return true, otherwise
- * return false
- */
- private boolean contains(ICSSNode root, ICSSNode possible) {
- if (DEBUG) {
- System.out.println("=============================================================================================================="); //$NON-NLS-1$
- System.out.println("recursive call w/ root: " + root + " and possible: " + possible); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println("--------------------------------------------------------------------------------------------------------------"); //$NON-NLS-1$
- }
-
- // the following checks are important
- // #document node will break the algorithm otherwise
-
- // can't contain the child if it's null
- if (root == null) {
- if (DEBUG) {
- System.out.println("returning false: root is null"); //$NON-NLS-1$
- }
- return false;
- }
- // nothing can be parent of Document node
- if (possible instanceof ICSSDocument) {
- if (DEBUG) {
- System.out.println("returning false: possible is Document node"); //$NON-NLS-1$
- }
- return false;
- }
- // document contains everything
- if (root instanceof ICSSDocument) {
- if (DEBUG) {
- System.out.println("returning true: root is Document node"); //$NON-NLS-1$
- }
- return true;
- }
-
- // check parentage
- ICSSNode current = possible;
- // loop parents
- while ((current != null) && (current.getNodeType() != ICSSNode.STYLESHEET_NODE || current.getNodeType() != ICSSNode.STYLEDECLARATION_NODE)) {
- // found it
- if (root.equals(current)) {
- if (DEBUG) {
- System.out.println(" !!! found: " + possible + " in subelement of: " + root); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return true;
- }
- current = current.getParentNode();
- }
- // never found it
- return false;
- }
-
- /**
- * Refresh must be on UI thread because it's on a SWT widget.
- *
- * @param node
- */
- private void doRefresh(final ICSSNode node, final StructuredViewer[] viewers) {
- final Display display = PlatformUI.getWorkbench().getDisplay();
- display.asyncExec(new Runnable() {
- public void run() {
- if (DEBUG) {
- System.out.println("refresh on: [" + node + "]"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- for (int i = 0; i < viewers.length; i++) {
- if (!viewers[i].getControl().isDisposed()) {
- if (node.getNodeType() == ICSSNode.STYLESHEET_NODE || node.getNodeType() == ICSSNode.STYLEDECLARATION_NODE) {
- viewers[i].refresh(false);
- }
- else {
- viewers[i].refresh(node, false);
- }
- }
- else {
- if (DEBUG) {
- System.out.println(" !!! skipped refreshing disposed viewer: " + viewers[i]); //$NON-NLS-1$
- }
- }
- }
- }
- });
- }
-
- /**
- * Update must be on UI thread because it's on a SWT widget.
- *
- * @param node
- */
- private void doUpdate(final StructuredViewer[] viewers, final ICSSNode node, final String[] properties) {
- final Display display = PlatformUI.getWorkbench().getDisplay();
- display.asyncExec(new Runnable() {
- public void run() {
- if (DEBUG) {
- System.out.println("refresh on: [" + node + "]"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- for (int i = 0; i < viewers.length; i++) {
- if (!viewers[i].getControl().isDisposed()) {
- viewers[i].update(node, properties);
- }
- else {
- if (DEBUG) {
- System.out.println(" !!! skipped refreshing disposed viewer: " + viewers[i]); //$NON-NLS-1$
- }
- }
- }
- }
- });
- }
-
- /**
- * This method also synchronized because it accesses the fRefreshes queue
- * and fRefreshViewers list
- *
- * @return an array containing and array of the currently requested Nodes
- * to refresh and the viewers in which to refresh them
- */
- private synchronized Object[] getRefreshRequests() {
- ICSSNode[] toRefresh = (ICSSNode[]) fRefreshes.toArray(new ICSSNode[fRefreshes.size()]);
- fRefreshes.clear();
-
- StructuredViewer[] viewers = (StructuredViewer[]) fRefreshViewers.toArray(new StructuredViewer[fRefreshViewers.size()]);
- fRefreshViewers.clear();
-
- return new Object[]{toRefresh, viewers};
- }
-
- /**
- * This method also synchronized because it accesses the fUpdates queue
- * and fUpdateViewers list
- *
- * @return an array containing and array of the currently requested Nodes
- * to refresh and the viewers in which to refresh them
- */
- private synchronized Object[] getUpdateRequests() {
- ICSSNode[] toUpdate = (ICSSNode[]) fUpdates.toArray(new ICSSNode[fUpdates.size()]);
- fUpdates.clear();
-
- StructuredViewer[] viewers = (StructuredViewer[]) fUpdateViewers.toArray(new StructuredViewer[fUpdateViewers.size()]);
- fUpdateViewers.clear();
-
- String[][] properties = (String[][]) fUpdateProperties.toArray(new String[fUpdateProperties.size()][]);
- fUpdateProperties.clear();
-
- return new Object[]{toUpdate, viewers, properties};
- }
-
- /**
- * Invoke a refresh on the viewer on the given node.
- *
- * @param node
- */
- public void refresh(StructuredViewer viewer, ICSSNode node) {
- if (node == null) {
- return;
- }
-
- addRefreshViewer(viewer);
- addRefreshRequest(node);
- schedule(UPDATE_DELAY);
- }
-
- /**
- * Invoke a refresh on the viewer on the given node.
- *
- * @param node
- */
- public void update(StructuredViewer viewer, ICSSNode node, String[] properties) {
- if (node == null) {
- return;
- }
-
- addUpdateViewer(viewer);
- addUpdateRequest(node, properties);
- schedule(UPDATE_DELAY);
- }
-
- protected IStatus run(IProgressMonitor monitor) {
- IStatus status = Status.OK_STATUS;
- try {
- performUpdates();
-
- performRefreshes(monitor);
- }
- finally {
- monitor.done();
- }
- return status;
- }
-
- private void performRefreshes(IProgressMonitor monitor) {
- // Retrieve BOTH viewers and Nodes on one block
- Object[] requests = getRefreshRequests();
- ICSSNode[] nodes = (ICSSNode[]) requests[0];
- StructuredViewer[] viewers = (StructuredViewer[]) requests[1];
-
- for (int i = 0; i < nodes.length; i++) {
- if (monitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- doRefresh(nodes[i], viewers);
- }
- }
-
- private void performUpdates() {
- // Retrieve BOTH viewers and Nodes on one block
- Object[] requests = getUpdateRequests();
- ICSSNode[] nodes = (ICSSNode[]) requests[0];
- StructuredViewer[] viewers = (StructuredViewer[]) requests[1];
- String[][] properties = (String[][]) requests[2];
-
- for (int i = 0; i < nodes.length; i++) {
- doUpdate(viewers, nodes[i], properties[i]);
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentproperties/ContentSettingsRegistry.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentproperties/ContentSettingsRegistry.java
deleted file mode 100644
index 87155f00aa..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentproperties/ContentSettingsRegistry.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.css.ui.internal.contentproperties;
-
-import java.util.Iterator;
-
-import org.eclipse.wst.css.core.internal.metamodel.CSSProfile;
-import org.eclipse.wst.css.core.internal.metamodel.CSSProfileRegistry;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-import org.eclipse.wst.sse.ui.internal.contentproperties.ui.ComboList;
-
-/**
- * @deprecated This class only contains helper methods that you should
- * actually implement yourself.
- */
-public final class ContentSettingsRegistry {
- private static final String NONE = CSSUIMessages.UI_none;
-
- public static void setCSSMetaModelRegistryInto(ComboList combo) {
- combo.add(NONE, ""); //$NON-NLS-1$
- CSSProfileRegistry reg = CSSProfileRegistry.getInstance();
- Iterator i = reg.getProfiles();
- while (i.hasNext()) {
- CSSProfile profile = (CSSProfile) i.next();
- String id = profile.getProfileID();
- String name = profile.getProfileName();
- combo.add(name, id);
- }
- combo.sortByKey(1);
- }
-
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentproperties/ui/CSSContentSettingsPropertyPage.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentproperties/ui/CSSContentSettingsPropertyPage.java
deleted file mode 100644
index 47f0f07cb5..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentproperties/ui/CSSContentSettingsPropertyPage.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.css.ui.internal.contentproperties.ui;
-
-
-
-import java.util.Map;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.css.ui.internal.Logger;
-import org.eclipse.wst.css.ui.internal.contentproperties.ContentSettingsRegistry;
-import org.eclipse.wst.css.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.sse.internal.contentproperties.IContentSettings;
-import org.eclipse.wst.sse.ui.internal.contentproperties.ui.ComboListOnPropertyPage;
-import org.eclipse.wst.sse.ui.internal.contentproperties.ui.ContentSettingsPropertyPage;
-
-/**
- * @deprecated Use CSSWebContentSettingsPropertyPage instead
- */
-public final class CSSContentSettingsPropertyPage extends ContentSettingsPropertyPage {
-
- private final int N_CSS_PROFILE = 0;
-
-
-
- public CSSContentSettingsPropertyPage() {
- super();
- numberOfCombo = 1;
- numCols = 2;
- numRows = 1;
- combo = new ComboListOnPropertyPage[super.numberOfCombo];
-
- }
-
- protected void createCSSComboBox() {
- super.combo[N_CSS_PROFILE] = super.createComboBoxOf(CSS_LABEL);
- ContentSettingsRegistry.setCSSMetaModelRegistryInto(combo[N_CSS_PROFILE]);
- if (combo[N_CSS_PROFILE].getItemCount() <= 0)
- return;
- String initValue = contentSettings.getProperty((IResource) super.getElement(), IContentSettings.CSS_PROFILE);
- // when either .contentsettings or element doesn't exist
- // when attribute doesn't exists,getProperty returns empty string.
- if (initValue == null)
- initValue = ""; //$NON-NLS-1$
- // set init selectionItem in Combo
- super.setSelectionItem(combo[N_CSS_PROFILE], initValue);
- }
-
-
-
- protected void createSettingsPageGUI() {
-
- int type = ((IResource) getElement()).getType();
- switch (type) {
- case IResource.FILE :
- //composite = createComposite(propertyPage,numCols,numRows);
- createCSSComboBox();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(propertyPage, IHelpContextIds.CSS_CONTENT_SETTINGS_HELPID);
- break;
-
- default :
- Logger.log(Logger.WARNING, "CSSContentSettingsPropertyPage is instantiated by resource except FILE");//$NON-NLS-1$
- break;
- }
-
- }
-
-
- protected void putSelectedPropertyInto(Map properties, String valueInCombo, int index) {
-
- switch (index) {
- case N_CSS_PROFILE :
- // css
- properties.put(IContentSettings.CSS_PROFILE, valueInCombo);
- break;
- default :
- Logger.log(Logger.ERROR, "Index is out of range in putSelectedPropertyInto() in class CSSContentSettingsPropertyPage");//$NON-NLS-1$
- break;
- }
-
- }
-
- protected void deleteNoneProperty(int index) {
- switch (index) {
- case N_CSS_PROFILE :
- // css
- contentSettings.deleteProperty((IResource) super.getElement(), IContentSettings.CSS_PROFILE);
- break;
-
- default :
- Logger.log(Logger.ERROR, "Index is out of range in deleteNoneProperty() in class CSSContentSettingsPropertyPage");//$NON-NLS-1$
- break;
- }
- }
-
-}
-
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentproperties/ui/CSSWebContentSettingsPropertyPage.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentproperties/ui/CSSWebContentSettingsPropertyPage.java
deleted file mode 100644
index 7e1dff427e..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/contentproperties/ui/CSSWebContentSettingsPropertyPage.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others. All rights reserved. This
- * program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and
- * is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * David Schneider, david.schneider@unisys.com - [142500] WTP properties pages fonts don't follow Eclipse preferences
- ****************************************************************************/
-package org.eclipse.wst.css.ui.internal.contentproperties.ui;
-
-
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.wst.css.core.internal.contentproperties.CSSContentProperties;
-import org.eclipse.wst.css.core.internal.metamodel.CSSProfile;
-import org.eclipse.wst.css.core.internal.metamodel.CSSProfileRegistry;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-import org.eclipse.wst.css.ui.internal.Logger;
-import org.eclipse.wst.css.ui.internal.editor.IHelpContextIds;
-
-public final class CSSWebContentSettingsPropertyPage extends PropertyPage {
- private static final String SELECT_NONE = CSSUIMessages.UI_none;
-
- private Combo fProfileCombo;
- private List fProfileIds;
-
- public CSSWebContentSettingsPropertyPage() {
- super();
- setDescription(CSSUIMessages.CSSContentSettingsPropertyPage_0);
- }
-
- private Composite createComposite(Composite parent, int numColumns) {
- Composite composite = new Composite(parent, SWT.NULL);
-
- // GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- composite.setLayout(layout);
-
- // GridData
- GridData data = new GridData(GridData.FILL, GridData.FILL, true, false);
- data.horizontalIndent = 0;
- composite.setLayoutData(data);
-
- return composite;
- }
-
- protected Control createContents(Composite parent) {
- Composite propertyPage = createComposite(parent, 2);
-
- // CSS Profile control
- Text languageLabel = new Text(propertyPage, SWT.READ_ONLY);
- languageLabel.setText(CSSUIMessages.CSSContentSettingsPropertyPage_1);
- fProfileCombo = new Combo(propertyPage, SWT.READ_ONLY);
- GridData data = new GridData(GridData.FILL, GridData.FILL, true, false);
- data.horizontalIndent = 0;
- fProfileCombo.setLayoutData(data);
-
- populateValues();
- initializeValues();
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(propertyPage, IHelpContextIds.CSS_CONTENT_SETTINGS_HELPID);
- Dialog.applyDialogFont(parent);
- return propertyPage;
- }
-
- /**
- * Get the resource this properties page is for
- *
- * @return IResource for this properties page or null if there is no
- * IResource
- */
- private IResource getResource() {
- IResource resource = null;
- if (getElement() instanceof IResource) {
- resource = (IResource) getElement();
- }
- return resource;
- }
-
- private void initializeValues() {
- int index = 0;
- String profile = CSSContentProperties.getProperty(CSSContentProperties.CSS_PROFILE, getResource(), false);
- if (profile != null && profile.length() > 0) {
- /*
- * If item is already part of combo, select it. Otherwise, select
- * none.
- */
- index = fProfileIds.indexOf(profile);
- }
- index = index >= 0 ? index : 0;
- fProfileCombo.select(index);
- }
-
- private void populateValues() {
- fProfileIds = new ArrayList();
- // add none first
- fProfileCombo.add(SELECT_NONE);
- fProfileIds.add(null);
-
- CSSProfileRegistry reg = CSSProfileRegistry.getInstance();
- Iterator i = reg.getProfiles();
- while (i.hasNext()) {
- CSSProfile profile = (CSSProfile) i.next();
- String id = profile.getProfileID();
- String name = profile.getProfileName();
- fProfileCombo.add(name);
- fProfileIds.add(id);
- }
- }
-
- protected void performDefaults() {
- int index = fProfileCombo.indexOf(SELECT_NONE);
- if (index > -1)
- fProfileCombo.select(index);
-
- super.performDefaults();
- }
-
- public boolean performOk() {
- int index = fProfileCombo.getSelectionIndex();
- if (index > -1) {
- String id = (String) fProfileIds.get(index);
- if (id == null || id.length() == 0 || id.equalsIgnoreCase(SELECT_NONE)) {
- // if none, use null
- id = null;
- }
- try {
- CSSContentProperties.setProperty(CSSContentProperties.CSS_PROFILE, getResource(), id);
- }
- catch (CoreException e) {
- // maybe in future, let user know there was a problem saving
- // file
- Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
- }
- }
- return super.performOk();
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/edit/ui/CleanupActionCSSDelegate.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/edit/ui/CleanupActionCSSDelegate.java
deleted file mode 100644
index 1f2d6d07da..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/edit/ui/CleanupActionCSSDelegate.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.css.ui.internal.edit.ui;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.IActionDelegate2;
-import org.eclipse.ui.IEditorActionDelegate;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.css.core.internal.cleanup.CleanupProcessorCSS;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupProcessor;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-
-/**
- * Cleanup action delegate for CSS editor
- */
-public class CleanupActionCSSDelegate implements IEditorActionDelegate, IActionDelegate2, IViewActionDelegate {
- private IEditorPart fEditor;
- private IStructuredCleanupProcessor fCleanupProcessor;
-
- public void setActiveEditor(IAction action, IEditorPart targetEditor) {
- fEditor = targetEditor;
- }
-
- public void dispose() {
- // nulling out just in case
- fEditor = null;
- fCleanupProcessor = null;
- }
-
- public void init(IAction action) {
- if (action != null) {
- action.setText(CSSUIMessages.CleanupDocument_label);
- action.setToolTipText(CSSUIMessages.CleanupDocument_tooltip);
- action.setDescription(CSSUIMessages.CleanupDocument_description);
- }
- }
-
- public void runWithEvent(IAction action, Event event) {
- run(action);
- }
-
- public void init(IViewPart view) {
- // do nothing
- }
-
- public void run(IAction action) {
- if (fEditor instanceof ITextEditor) {
- final ITextEditor editor = (ITextEditor) fEditor;
- Dialog cleanupDialog = new CleanupDialogCSS(editor.getSite().getShell());
- if (cleanupDialog.open() == Window.OK) {
- // setup runnable
- Runnable runnable = new Runnable() {
- public void run() {
- IStructuredCleanupProcessor cleanupProcessor = getCleanupProcessor();
- if (cleanupProcessor != null) {
- IStructuredModel model = null;
- try {
- model = StructuredModelManager.getModelManager().getExistingModelForEdit(editor.getDocumentProvider().getDocument(editor.getEditorInput()));
- if (model != null)
- cleanupProcessor.cleanupModel(model);
- }
- finally {
- if (model != null)
- model.releaseFromEdit();
- }
- }
- }
- };
-
- // TODO: make independent of 'model'.
- IStructuredModel model = null;
- try {
- model = StructuredModelManager.getModelManager().getExistingModelForEdit(editor.getDocumentProvider().getDocument(editor.getEditorInput()));
- if (model != null) {
- // begin recording
- ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
- model.beginRecording(this, SSEUIMessages.Cleanup_Document_UI_, SSEUIMessages.Cleanup_Document_UI_, selection.getOffset(), selection.getLength()); //$NON-NLS-1$ //$NON-NLS-2$
-
- // tell the model that we are about to make a big
- // model change
- model.aboutToChangeModel();
-
- // run
- BusyIndicator.showWhile(fEditor.getEditorSite().getWorkbenchWindow().getShell().getDisplay(), runnable);
- }
- }
- finally {
- if (model != null) {
- // tell the model that we are done with the big
- // model
- // change
- model.changedModel();
-
- // end recording
- ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
- model.endRecording(this, selection.getOffset(), selection.getLength());
- model.releaseFromEdit();
- }
- }
- }
- }
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // do nothing
- }
-
- IStructuredCleanupProcessor getCleanupProcessor() {
- if (fCleanupProcessor == null)
- fCleanupProcessor = new CleanupProcessorCSS();
-
- return fCleanupProcessor;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/edit/ui/CleanupDialogCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/edit/ui/CleanupDialogCSS.java
deleted file mode 100644
index 7c60678b20..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/edit/ui/CleanupDialogCSS.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.edit.ui;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.Group;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.css.core.internal.cleanup.CSSCleanupStrategy;
-import org.eclipse.wst.css.core.internal.cleanup.CSSCleanupStrategyImpl;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-import org.eclipse.wst.css.ui.internal.editor.IHelpContextIds;
-
-public class CleanupDialogCSS extends Dialog implements SelectionListener{
-
- private boolean embeddedCSS;
- protected Button fRadioButtonIdentCaseAsis;
- protected Button fRadioButtonIdentCaseLower;
- protected Button fRadioButtonIdentCaseUpper;
- protected Button fRadioButtonPropNameCaseAsis;
- protected Button fRadioButtonPropNameCaseLower;
- protected Button fRadioButtonPropNameCaseUpper;
- protected Button fRadioButtonPropValueCaseAsis;
- protected Button fRadioButtonPropValueCaseLower;
- protected Button fRadioButtonPropValueCaseUpper;
- protected Button fRadioButtonSelectorTagCaseAsis;
- protected Button fRadioButtonSelectorTagCaseLower;
- protected Button fRadioButtonSelectorTagCaseUpper;
- protected Button fCheckBoxQuoteValues;
- protected Button fCheckBoxFormatSource;
-
- /**
- * CSSCleanupDialog constructor comment.
- *
- * @param parentShell
- * org.eclipse.swt.widgets.Shell
- */
- public CleanupDialogCSS(Shell parentShell) {
- super(parentShell);
- }
-
- /**
- *
- * @return org.eclipse.swt.widgets.Control
- * @param parent
- * org.eclipse.swt.widgets.Composite
- */
- public Control createDialogArea(Composite parent) {
- if (isEmbeddedCSS())
- getShell().setText(CSSUIMessages.CSS_Cleanup_UI_);
- else
- getShell().setText(CSSUIMessages.Cleanup_UI_);
-
- Composite panel = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.makeColumnsEqualWidth = true;
- panel.setLayout(layout);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(panel, IHelpContextIds.CSS_CLEANUP_HELPID);
-
- // Convert ident case
- // ACC: Group radio buttons together so associated label is read
- // Label identCaseLabel = new Label(panel, SWT.NULL);
- // identCaseLabel.setText(ResourceHandler.getString("Identifier_case__UI_"));
- // //$NON-NLS-1$ = "Identifier case:"
- // Canvas identCase = new Canvas(panel, SWT.NULL);
- Group identCase = new Group(panel, SWT.NULL);
- identCase.setText(CSSUIMessages.Identifier_case__UI_);
- GridLayout hLayout = new GridLayout();
- hLayout.numColumns = 3;
- identCase.setLayout(hLayout);
- fRadioButtonIdentCaseAsis = new Button(identCase, SWT.RADIO);
- fRadioButtonIdentCaseAsis.setText(CSSUIMessages.As_is_UI_);
- fRadioButtonIdentCaseAsis.addSelectionListener(this);
- fRadioButtonIdentCaseLower = new Button(identCase, SWT.RADIO);
- fRadioButtonIdentCaseLower.setText(CSSUIMessages.Lower_UI_);
- fRadioButtonIdentCaseLower.addSelectionListener(this);
- fRadioButtonIdentCaseUpper = new Button(identCase, SWT.RADIO);
- fRadioButtonIdentCaseUpper.setText(CSSUIMessages.Upper_UI_);
- fRadioButtonIdentCaseUpper.addSelectionListener(this);
-
- // Convert property name case
- // ACC: Group radio buttons together so associated label is read
- // Label propNameCaseLabel = new Label(panel, SWT.NULL);
- // propNameCaseLabel.setText(ResourceHandler.getString("Property_name_case__UI_"));
- // //$NON-NLS-1$ = "Property name case:"
- // Canvas propNameCase = new Canvas(panel, SWT.NULL);
- Group propNameCase = new Group(panel, SWT.NULL);
- propNameCase.setText(CSSUIMessages.Property_name_case__UI_);
- hLayout = new GridLayout();
- hLayout.numColumns = 3;
- propNameCase.setLayout(hLayout);
- fRadioButtonPropNameCaseAsis = new Button(propNameCase, SWT.RADIO);
- fRadioButtonPropNameCaseAsis.setText(CSSUIMessages.As_is_UI_);
- fRadioButtonPropNameCaseAsis.addSelectionListener(this);
- fRadioButtonPropNameCaseLower = new Button(propNameCase, SWT.RADIO);
- fRadioButtonPropNameCaseLower.setText(CSSUIMessages.Lower_UI_);
- fRadioButtonPropNameCaseLower.addSelectionListener(this);
- fRadioButtonPropNameCaseUpper = new Button(propNameCase, SWT.RADIO);
- fRadioButtonPropNameCaseUpper.setText(CSSUIMessages.Upper_UI_);
- fRadioButtonPropNameCaseUpper.addSelectionListener(this);
-
- // Convert property Value case
- // ACC: Group radio buttons together so associated label is read
- // Label propValueCaseLabel = new Label(panel, SWT.NULL);
- // propValueCaseLabel.setText(ResourceHandler.getString("Property_value_case__UI_"));
- // //$NON-NLS-1$ = "Property value case:"
- // Canvas propValueCase = new Canvas(panel, SWT.NULL);
- Group propValueCase = new Group(panel, SWT.NULL);
- propValueCase.setText(CSSUIMessages.Property_value_case__UI_);
- hLayout = new GridLayout();
- hLayout.numColumns = 3;
- propValueCase.setLayout(hLayout);
- fRadioButtonPropValueCaseAsis = new Button(propValueCase, SWT.RADIO);
- fRadioButtonPropValueCaseAsis.setText(CSSUIMessages.As_is_UI_);
- fRadioButtonPropValueCaseAsis.addSelectionListener(this);
- fRadioButtonPropValueCaseLower = new Button(propValueCase, SWT.RADIO);
- fRadioButtonPropValueCaseLower.setText(CSSUIMessages.Lower_UI_);
- fRadioButtonPropValueCaseLower.addSelectionListener(this);
- fRadioButtonPropValueCaseUpper = new Button(propValueCase, SWT.RADIO);
- fRadioButtonPropValueCaseUpper.setText(CSSUIMessages.Upper_UI_);
- fRadioButtonPropValueCaseUpper.addSelectionListener(this);
-
- if (!isEmbeddedCSS()) {
- // Convert selector tag case
- // ACC: Group radio buttons together so associated label is read
- // Label selectorTagCaseLabel = new Label(panel, SWT.NULL);
- // selectorTagCaseLabel.setText(ResourceHandler.getString("Selector_tag_name_case__UI_"));
- // //$NON-NLS-1$ = "Selector tag name case:"
- // Canvas selectorTagCase = new Canvas(panel, SWT.NULL);
- Group selectorTagCase = new Group(panel, SWT.NULL);
- selectorTagCase.setText(CSSUIMessages.Selector_tag_name_case__UI_);
- hLayout = new GridLayout();
- hLayout.numColumns = 3;
- selectorTagCase.setLayout(hLayout);
- fRadioButtonSelectorTagCaseAsis = new Button(selectorTagCase, SWT.RADIO);
- fRadioButtonSelectorTagCaseAsis.setText(CSSUIMessages.As_is_UI_);
- fRadioButtonSelectorTagCaseAsis.addSelectionListener(this);
- fRadioButtonSelectorTagCaseLower = new Button(selectorTagCase, SWT.RADIO);
- fRadioButtonSelectorTagCaseLower.setText(CSSUIMessages.Lower_UI_);
- fRadioButtonSelectorTagCaseLower.addSelectionListener(this);
- fRadioButtonSelectorTagCaseUpper = new Button(selectorTagCase, SWT.RADIO);
- fRadioButtonSelectorTagCaseUpper.setText(CSSUIMessages.Upper_UI_);
- fRadioButtonSelectorTagCaseUpper.addSelectionListener(this);
- }
-
- // Quote attribute values
- fCheckBoxQuoteValues = new Button(panel, SWT.CHECK);
- fCheckBoxQuoteValues.setText(CSSUIMessages.Quote_values_UI_);
- fCheckBoxQuoteValues.addSelectionListener(this);
-
- if (!isEmbeddedCSS()) {
- // Format source
- fCheckBoxFormatSource = new Button(panel, SWT.CHECK);
- fCheckBoxFormatSource.setText(CSSUIMessages.Format_source_UI_);
- fCheckBoxFormatSource.addSelectionListener(this);
- }
-
- setCleanupOptions();
-
- return panel;
- }
-
- /**
- * Insert the method's description here.
- *
- * @return boolean
- */
- public boolean isEmbeddedCSS() {
- return embeddedCSS;
- }
-
- /**
- *
- */
- protected void okPressed() {
- updateCleanupOptions();
- super.okPressed();
- }
-
- /**
- *
- */
- protected void setCleanupOptions() {
- CSSCleanupStrategy stgy = CSSCleanupStrategyImpl.getInstance();
-
- if (fRadioButtonIdentCaseAsis != null) {
- if (stgy.getIdentCase() == CSSCleanupStrategy.UPPER)
- fRadioButtonIdentCaseUpper.setSelection(true);
- else if (stgy.getIdentCase() == CSSCleanupStrategy.LOWER)
- fRadioButtonIdentCaseLower.setSelection(true);
- else
- fRadioButtonIdentCaseAsis.setSelection(true);
- }
-
- if (fRadioButtonPropNameCaseAsis != null) {
- if (stgy.getPropNameCase() == CSSCleanupStrategy.UPPER)
- fRadioButtonPropNameCaseUpper.setSelection(true);
- else if (stgy.getPropNameCase() == CSSCleanupStrategy.LOWER)
- fRadioButtonPropNameCaseLower.setSelection(true);
- else
- fRadioButtonPropNameCaseAsis.setSelection(true);
- }
-
- if (fRadioButtonPropValueCaseAsis != null) {
- if (stgy.getPropValueCase() == CSSCleanupStrategy.UPPER)
- fRadioButtonPropValueCaseUpper.setSelection(true);
- else if (stgy.getPropValueCase() == CSSCleanupStrategy.LOWER)
- fRadioButtonPropValueCaseLower.setSelection(true);
- else
- fRadioButtonPropValueCaseAsis.setSelection(true);
- }
-
- if (fRadioButtonSelectorTagCaseAsis != null) {
- if (stgy.getSelectorTagCase() == CSSCleanupStrategy.UPPER)
- fRadioButtonSelectorTagCaseUpper.setSelection(true);
- else if (stgy.getSelectorTagCase() == CSSCleanupStrategy.LOWER)
- fRadioButtonSelectorTagCaseLower.setSelection(true);
- else
- fRadioButtonSelectorTagCaseAsis.setSelection(true);
- }
-
- if (fCheckBoxQuoteValues != null)
- fCheckBoxQuoteValues.setSelection(stgy.isQuoteValues());
-
- if (fCheckBoxFormatSource != null)
- fCheckBoxFormatSource.setSelection(stgy.isFormatSource());
-
- }
-
- /**
- * Insert the method's description here.
- *
- * @param newEmbeddedCSS
- * boolean
- */
- public void setEmbeddedCSS(boolean newEmbeddedCSS) {
- embeddedCSS = newEmbeddedCSS;
- }
-
- /**
- *
- */
- protected void updateCleanupOptions() {
- CSSCleanupStrategy stgy = CSSCleanupStrategyImpl.getInstance();
-
- if (fRadioButtonIdentCaseAsis != null) {
- if (fRadioButtonIdentCaseUpper.getSelection())
- stgy.setIdentCase(CSSCleanupStrategy.UPPER);
- else if (fRadioButtonIdentCaseLower.getSelection())
- stgy.setIdentCase(CSSCleanupStrategy.LOWER);
- else
- stgy.setIdentCase(CSSCleanupStrategy.ASIS);
- }
-
- if (fRadioButtonPropNameCaseAsis != null) {
- if (fRadioButtonPropNameCaseUpper.getSelection())
- stgy.setPropNameCase(CSSCleanupStrategy.UPPER);
- else if (fRadioButtonPropNameCaseLower.getSelection())
- stgy.setPropNameCase(CSSCleanupStrategy.LOWER);
- else
- stgy.setPropNameCase(CSSCleanupStrategy.ASIS);
- }
-
- if (fRadioButtonPropValueCaseAsis != null) {
- if (fRadioButtonPropValueCaseUpper.getSelection())
- stgy.setPropValueCase(CSSCleanupStrategy.UPPER);
- else if (fRadioButtonPropValueCaseLower.getSelection())
- stgy.setPropValueCase(CSSCleanupStrategy.LOWER);
- else
- stgy.setPropValueCase(CSSCleanupStrategy.ASIS);
- }
-
- if (fRadioButtonSelectorTagCaseAsis != null) {
- if (fRadioButtonSelectorTagCaseUpper.getSelection())
- stgy.setSelectorTagCase(CSSCleanupStrategy.UPPER);
- else if (fRadioButtonSelectorTagCaseLower.getSelection())
- stgy.setSelectorTagCase(CSSCleanupStrategy.LOWER);
- else
- stgy.setSelectorTagCase(CSSCleanupStrategy.ASIS);
- }
-
- if (fCheckBoxQuoteValues != null)
- stgy.setQuoteValues(fCheckBoxQuoteValues.getSelection());
-
- if (fCheckBoxFormatSource != null)
- stgy.setFormatSource(fCheckBoxFormatSource.getSelection());
-
- // save these values to preferences
- ((CSSCleanupStrategyImpl) stgy).saveOptions();
- }
-
- public void widgetSelected(SelectionEvent e) {
- boolean okEnabled = fCheckBoxFormatSource.getSelection()
- || fCheckBoxQuoteValues.getSelection()
- || ((fRadioButtonIdentCaseLower != null && fRadioButtonIdentCaseLower.getSelection()) || (fRadioButtonIdentCaseUpper != null && fRadioButtonIdentCaseUpper.getSelection()))
- || ((fRadioButtonPropNameCaseLower != null && fRadioButtonPropNameCaseLower.getSelection()) || (fRadioButtonPropNameCaseUpper != null && fRadioButtonPropNameCaseUpper.getSelection()))
- || ((fRadioButtonPropValueCaseLower != null && fRadioButtonPropValueCaseLower.getSelection()) || (fRadioButtonPropValueCaseUpper != null && fRadioButtonPropValueCaseUpper.getSelection()))
- || ((fRadioButtonSelectorTagCaseLower != null && fRadioButtonSelectorTagCaseLower.getSelection()) || (fRadioButtonSelectorTagCaseUpper != null && fRadioButtonSelectorTagCaseUpper.getSelection()))
- ;
- getButton(OK).setEnabled(okEnabled);
-
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
-
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/CSSEditorPluginImages.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/CSSEditorPluginImages.java
deleted file mode 100644
index 7559e982b8..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/CSSEditorPluginImages.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.css.ui.internal.editor;
-
-
-/**
- * Bundle of most images used by the CSS Source Editor plug-in.
- */
-public class CSSEditorPluginImages {
- public static final String IMG_OBJ_SORT = "icons/full/obj16/sort.gif"; //$NON-NLS-1$
-
- public static final String IMG_OBJ_STYLESHEET = "icons/full/obj16/stylesheet.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_RULE_CHARSET = "icons/full/obj16/charset_rule.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_RULE_FONTFACE = "icons/full/obj16/fontface_rule.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_RULE_IMPORT = "icons/full/obj16/link_rule.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_RULE_MEDIA = "icons/full/obj16/media_rule.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_RULE_PAGE = "icons/full/obj16/page_rule.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_RULE_STYLE = "icons/full/obj16/style_rule.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_RULE_UNKNOWN = "icons/full/obj16/unknown_rule.gif"; //$NON-NLS-1$
-
- public static final String IMG_OBJ_SELECTOR_CLASS = "icons/full/obj16/class_selector.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_SELECTOR_ID = "icons/full/obj16/id_selector.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_SELECTOR_PSEUDO = "icons/full/obj16/pseudo.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_SELECTOR_TAG = "icons/full/obj16/tag_selector.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_SELECTOR_LINK = "icons/full/obj16/link_selector.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_SELECTOR_DEFAULT = "icons/full/obj16/tag_selector.gif"; //$NON-NLS-1$
-
- public static final String IMG_OBJ_VALUE_FUNCTION = "icons/full/obj16/css_propertyvalue_function.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_VALUE_NUMBER = "icons/full/obj16/css_propertyvalue_unit.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_VALUE_STRING = "icons/full/obj16/css_propertyvalue_identifier.gif"; //$NON-NLS-1$
-
- public static final String IMG_OBJ_CATEGORY_AURAL = "icons/full/obj16/aural_props.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_CATEGORY_BOX = "icons/full/obj16/boxmodel_props.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_CATEGORY_COLORANDBACKGROUND = "icons/full/obj16/colback_props.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_CATEGORY_CONTENT = "icons/full/obj16/content_props.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_CATEGORY_FONT = "icons/full/obj16/font_props.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_CATEGORY_PAGE = "icons/full/obj16/pagedmedia_props.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_CATEGORY_TABLES = "icons/full/obj16/table_props.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_CATEGORY_TEXT = "icons/full/obj16/text_props.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_CATEGORY_UI = "icons/full/obj16/ui_props.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_CATEGORY_VISUAL = "icons/full/obj16/visual_props.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_CATEGORY_DEFAULT = "icons/full/obj16/other_props.gif"; //$NON-NLS-1$
- public static final String IMG_OBJ_TEMPLATE = "icons/full/obj16/tag-template.gif"; //$NON-NLS-1$
-
- public static final String IMG_WIZBAN_NEWCSSFILE = "icons/full/wizban/newcssfile_wiz.png"; //$NON-NLS-1$
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/CSSSelectionConverterFactory.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/CSSSelectionConverterFactory.java
deleted file mode 100644
index 02de0913cc..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/CSSSelectionConverterFactory.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.css.ui.internal.editor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.wst.css.core.internal.document.CSSNodeImpl;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet;
-import org.eclipse.wst.css.ui.internal.Logger;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.internal.editor.SelectionConvertor;
-
-/**
- * <p>Factory to adapt from {@link ICSSModel} to {@link SelectionConvertor}</p>
- */
-public class CSSSelectionConverterFactory implements IAdapterFactory {
-
- /** the list of classes this factory can adapt to */
- private static final Class[] ADAPTER_LIST = new Class[]{SelectionConvertor.class};
-
- /** the adapted class */
- private static final Object selectionConvertor = new CSSSelectionConverter();
-
- /**
- * <p>Default constructor</p>
- */
- public CSSSelectionConverterFactory() {
- }
-
- /**
- * <p>Adapts {@link ICSSModel} to {@link SelectionConvertor}</p>
- *
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
- */
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- Object adapter = null;
- if (adaptableObject instanceof ICSSModel && SelectionConvertor.class.equals(adapterType)) {
- adapter = selectionConvertor;
- }
- return adapter;
- }
-
- /**
- * <p>Adapts to {@link SelectionConvertor}</p>
- *
- * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
- */
- public Class[] getAdapterList() {
- return ADAPTER_LIST;
- }
-
- /**
- * <p>{@link SelectionConvertor} specific to CSS</p>
- */
- private static class CSSSelectionConverter extends SelectionConvertor {
- /**
- * <p>Default constructor</p>
- */
- public CSSSelectionConverter() {
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.internal.editor.SelectionConvertor#getElements(org.eclipse.wst.sse.core.internal.provisional.IStructuredModel, int, int)
- */
- public Object[] getElements(IStructuredModel model, int start, int end) {
- Object[] localSelectedStructures = null;
- if (model != null) {
- IndexedRegion region = model.getIndexedRegion(start);
-
- /* in CSS docs whitespace is owned by the style sheet
- * this is to find the first none whitespace region
- */
- if(region instanceof ICSSStyleSheet) {
- try {
- String selection = model.getStructuredDocument().get(start, end);
- int whitespaceLength = beginingWhitespaceLength(selection);
- region = model.getIndexedRegion(start+whitespaceLength+1);
- } catch(BadLocationException e) {
- //should never be able to happen
- Logger.logException("Bad location on selection, this should never happen", e);
- }
- }
-
- if (region != null) {
- // if single selection spans selected region
- // else multiple selection
- if (end <= region.getEndOffset()) {
- // single selection
- localSelectedStructures = new Object[1];
- localSelectedStructures[0] = region;
- }
- else {
- int maxLength = model.getStructuredDocument().getLength();
- List structures = new ArrayList(2);
- while (region != null && region.getEndOffset() <= end && region.getEndOffset() <= maxLength) {
- structures.add(region);
-
- //use the CSS model to find the next sibling
- boolean foundNextSibling = false;
- if(region instanceof CSSNodeImpl ) {
- ICSSNode node = ((ICSSNode)region).getNextSibling();
- if(node instanceof IndexedRegion) {
- region = (IndexedRegion)node;
- foundNextSibling = true;
- }
- }
-
- if(!foundNextSibling) {
- region = model.getIndexedRegion(region.getEndOffset() + 1);
- }
- }
- localSelectedStructures = structures.toArray();
- }
- }
- }
- if (localSelectedStructures == null) {
- localSelectedStructures = new Object[0];
- }
- return localSelectedStructures;
- }
-
- }
-
- /**
- * @param s find the length of the whitespace preceding this {@link String}
- * @return the length of the whitespace preceding the given {@link String}
- */
- private static int beginingWhitespaceLength(String s) {
- int length = 0;
-
- for (int i = 0; i < s.length() && length == 0; ++i) {
- if (!Character.isWhitespace(s.charAt(i))) {
- length = i;
- }
- }
-
- return length;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/IHelpContextIds.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/IHelpContextIds.java
deleted file mode 100644
index ddc622b3b2..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/editor/IHelpContextIds.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.editor;
-
-import org.eclipse.wst.css.ui.internal.CSSUIPlugin;
-
-/**
- * Help context ids for the CSS Source Editor.
- * <p>
- * This interface contains constants only; it is not intended to be
- * implemented.
- * </p>
- *
- */
-public interface IHelpContextIds {
- // org.eclipse.wst.css.ui.
- public static final String PREFIX = CSSUIPlugin.ID + "."; //$NON-NLS-1$
-
- // // figured out on the fly
- // // CSS Source page editor
- // public static final String CSS_SOURCEVIEW_HELPID =
- // ContentTypeIdForCSS.ContentTypeID_CSS +"_source_HelpId"; //$NON-NLS-1$
-
- // CSS Files Preference page
- public static final String CSS_PREFWEBX_FILES_HELPID = PREFIX + "webx0010"; //$NON-NLS-1$
- // CSS Source Preference page
- public static final String CSS_PREFWEBX_SOURCE_HELPID = PREFIX + "webx0011"; //$NON-NLS-1$
- // CSS Styles Preference page
- public static final String CSS_PREFWEBX_STYLES_HELPID = PREFIX + "webx0012"; //$NON-NLS-1$
- // CSS Template Preference page
- public static final String CSS_PREFWEBX_TEMPLATES_HELPID = PREFIX + "webx0013"; //$NON-NLS-1$
-
- // CSS Cleanup dialog
- public static final String CSS_CLEANUP_HELPID = PREFIX + "xmlm1300"; //$NON-NLS-1$
-
- // CSS Content Settings
- public static final String CSS_CONTENT_SETTINGS_HELPID = PREFIX + "misc0180"; //$NON-NLS-1$
-
- // CSS New File Wizard - Template Page
- public static final String CSS_NEWWIZARD_TEMPLATE_HELPID = PREFIX + "cssw0010"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/AbstractCommentHandler.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/AbstractCommentHandler.java
deleted file mode 100644
index f0122fbc21..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/AbstractCommentHandler.java
+++ /dev/null
@@ -1,102 +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.css.ui.internal.handlers;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.css.ui.internal.Logger;
-
-public class AbstractCommentHandler extends AbstractHandler {
-
- static final String OPEN_COMMENT = "/*"; //$NON-NLS-1$
- static final String CLOSE_COMMENT = "*/"; //$NON-NLS-1$
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ITextEditor textEditor = getTextEditor(event);
- if (textEditor != null) {
- IDocument document = textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput());
- if (document != null) {
- // get current text selection
- ITextSelection textSelection = getCurrentSelection(textEditor);
- if (textSelection.isEmpty()) {
- return null;
- }
-
- processAction(textEditor, document, textSelection);
- }
- }
-
- return null;
- }
-
- protected void processAction(ITextEditor editor, IDocument document, ITextSelection textSelection) {
- }
-
- protected ITextEditor getTextEditor(ExecutionEvent event) {
- IEditorPart editor = HandlerUtil.getActiveEditor(event);
- ITextEditor textEditor = null;
- if (editor instanceof ITextEditor)
- textEditor = (ITextEditor) editor;
- else {
- Object o = editor.getAdapter(ITextEditor.class);
- if (o != null)
- textEditor = (ITextEditor) o;
- }
- return textEditor;
- }
-
- protected ITextSelection getCurrentSelection(ITextEditor textEditor) {
- ISelectionProvider provider = textEditor.getSelectionProvider();
- if (provider != null) {
- ISelection selection = provider.getSelection();
- if (selection instanceof ITextSelection) {
- return (ITextSelection) selection;
- }
- }
- return TextSelection.emptySelection();
- }
-
- protected void removeOpenCloseComments(IDocument document, int offset, int length) {
- try {
- int adjusted_length = length;
-
- // remove open comments
- String string = document.get(offset, length);
- int index = string.lastIndexOf(OPEN_COMMENT);
- while (index != -1) {
- document.replace(offset + index, OPEN_COMMENT.length(), ""); //$NON-NLS-1$
- index = string.lastIndexOf(OPEN_COMMENT, index - 1);
- adjusted_length -= OPEN_COMMENT.length();
- }
-
- // remove close comments
- string = document.get(offset, adjusted_length);
- index = string.lastIndexOf(CLOSE_COMMENT);
- while (index != -1) {
- document.replace(offset + index, CLOSE_COMMENT.length(), ""); //$NON-NLS-1$
- index = string.lastIndexOf(CLOSE_COMMENT, index - 1);
- }
- }
- catch (BadLocationException e) {
- Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/AddBlockCommentHandler.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/AddBlockCommentHandler.java
deleted file mode 100644
index 232b0dcc6d..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/AddBlockCommentHandler.java
+++ /dev/null
@@ -1,74 +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.css.ui.internal.handlers;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts;
-import org.eclipse.wst.css.ui.internal.Logger;
-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.css.ui.internal.CSSUIMessages;
-
-public class AddBlockCommentHandler extends AbstractCommentHandler {
-
- protected void processAction(ITextEditor textEditor, IDocument document, ITextSelection textSelection) {
- IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForEdit(document);
- if (model != null && document instanceof IStructuredDocument) {
- try {
- IStructuredDocument doc = (IStructuredDocument) document;
- IStructuredDocumentRegion startRegion = doc.getRegionAtCharacterOffset(textSelection.getOffset());
- IStructuredDocumentRegion endRegion = doc.getRegionAtCharacterOffset(textSelection.getOffset() + textSelection.getLength());
-
- if (startRegion == null) {
- return;
- }
- if ((endRegion == null) && (textSelection.getLength() > 0)) {
- endRegion = doc.getRegionAtCharacterOffset(textSelection.getOffset() + textSelection.getLength() - 1);
- }
- if (endRegion == null) {
- return;
- }
-
- int openCommentOffset = startRegion.getStartOffset();
- int closeCommentOffset = endRegion.getEndOffset() + CLOSE_COMMENT.length();
-
- if ((textSelection.getLength() == 0) && (startRegion.getType() == CSSRegionContexts.CSS_COMMENT)) {
- return;
- }
-
- model.beginRecording(this, CSSUIMessages.AddBlockComment_tooltip);
- model.aboutToChangeModel();
-
- try {
- document.replace(openCommentOffset, 0, OPEN_COMMENT);
- document.replace(closeCommentOffset, 0, CLOSE_COMMENT);
- super.removeOpenCloseComments(document, openCommentOffset + OPEN_COMMENT.length(), closeCommentOffset - openCommentOffset - CLOSE_COMMENT.length());
- }
- catch (BadLocationException e) {
- Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
- }
- finally {
- model.changedModel();
- model.endRecording(this);
- }
- }
- finally {
- model.releaseFromEdit();
- }
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/CleanupDocumentHandler.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/CleanupDocumentHandler.java
deleted file mode 100644
index a623b3ee18..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/CleanupDocumentHandler.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.css.ui.internal.handlers;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.css.core.internal.cleanup.CleanupProcessorCSS;
-import org.eclipse.wst.css.ui.internal.edit.ui.CleanupDialogCSS;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.cleanup.IStructuredCleanupProcessor;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.ui.internal.SSEUIMessages;
-
-public class CleanupDocumentHandler extends AbstractHandler implements IHandler {
- private IStructuredCleanupProcessor fCleanupProcessor;
-
- public void dispose() {
- // nulling out just in case
- fCleanupProcessor = null;
- }
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
- ITextEditor textEditor = null;
- if (editorPart instanceof ITextEditor)
- textEditor = (ITextEditor) editorPart;
- else {
- Object o = editorPart.getAdapter(ITextEditor.class);
- if (o != null)
- textEditor = (ITextEditor) o;
- }
-
- if (textEditor != null) {
- final ITextEditor editor = textEditor;
- Dialog cleanupDialog = new CleanupDialogCSS(editor.getSite().getShell());
- if (cleanupDialog.open() == Window.OK) {
- // setup runnable
- Runnable runnable = new Runnable() {
- public void run() {
- IStructuredCleanupProcessor cleanupProcessor = getCleanupProcessor();
- if (cleanupProcessor != null) {
- IStructuredModel model = null;
- try {
- model = StructuredModelManager.getModelManager().getExistingModelForEdit(editor.getDocumentProvider().getDocument(editor.getEditorInput()));
- if (model != null)
- cleanupProcessor.cleanupModel(model);
- }
- finally {
- if (model != null)
- model.releaseFromEdit();
- }
- }
- }
- };
-
- // TODO: make independent of 'model'.
- IStructuredModel model = null;
- try {
- model = StructuredModelManager.getModelManager().getExistingModelForEdit(editor.getDocumentProvider().getDocument(editor.getEditorInput()));
- if (model != null) {
- // begin recording
- ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
- model.beginRecording(this, SSEUIMessages.Cleanup_Document_UI_, SSEUIMessages.Cleanup_Document_UI_, selection.getOffset(), selection.getLength()); //$NON-NLS-1$ //$NON-NLS-2$
-
- // tell the model that we are about to make a big
- // model change
- model.aboutToChangeModel();
-
- // run
- BusyIndicator.showWhile(editor.getEditorSite().getWorkbenchWindow().getShell().getDisplay(), runnable);
- }
- }
- finally {
- if (model != null) {
- // tell the model that we are done with the big
- // model
- // change
- model.changedModel();
-
- // end recording
- ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
- model.endRecording(this, selection.getOffset(), selection.getLength());
- model.releaseFromEdit();
- }
- }
- }
- }
- return null;
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- // do nothing
- }
-
- IStructuredCleanupProcessor getCleanupProcessor() {
- if (fCleanupProcessor == null)
- fCleanupProcessor = new CleanupProcessorCSS();
-
- return fCleanupProcessor;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/RemoveBlockCommentHandler.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/RemoveBlockCommentHandler.java
deleted file mode 100644
index 6d0790972b..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/RemoveBlockCommentHandler.java
+++ /dev/null
@@ -1,77 +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.css.ui.internal.handlers;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts;
-import org.eclipse.wst.css.ui.internal.Logger;
-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.css.ui.internal.CSSUIMessages;
-
-public class RemoveBlockCommentHandler extends AbstractCommentHandler {
-
- protected void processAction(ITextEditor textEditor, IDocument document, ITextSelection textSelection) {
- IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForEdit(document);
- if (model != null && document instanceof IStructuredDocument) {
- try {
- IStructuredDocument doc = (IStructuredDocument) document;
- IStructuredDocumentRegion startRegion = doc.getRegionAtCharacterOffset(textSelection.getOffset());
- IStructuredDocumentRegion endRegion = doc.getRegionAtCharacterOffset(textSelection.getOffset() + textSelection.getLength());
-
- if ((startRegion == null) || (endRegion == null)) {
- return;
- }
-
- int openCommentOffset = startRegion.getStartOffset();
- int closeCommentOffset = endRegion.getEndOffset() - OPEN_COMMENT.length() - CLOSE_COMMENT.length();
-
- model.beginRecording(this, CSSUIMessages.RemoveBlockComment_tooltip);
- model.aboutToChangeModel();
-
- try {
- if (textSelection.getLength() == 0) {
- if (startRegion.getType() == CSSRegionContexts.CSS_COMMENT) {
- document.replace(openCommentOffset, OPEN_COMMENT.length(), ""); //$NON-NLS-1$
- document.replace(closeCommentOffset, CLOSE_COMMENT.length(), ""); //$NON-NLS-1$
- }
- }
- else {
- if (startRegion.getType() == CSSRegionContexts.CSS_COMMENT) {
- document.replace(openCommentOffset, OPEN_COMMENT.length(), ""); //$NON-NLS-1$
- }
-
- if (endRegion.getType() == CSSRegionContexts.CSS_COMMENT) {
- document.replace(closeCommentOffset, CLOSE_COMMENT.length(), ""); //$NON-NLS-1$
- }
- }
- removeOpenCloseComments(document, openCommentOffset + OPEN_COMMENT.length(), closeCommentOffset - openCommentOffset - CLOSE_COMMENT.length());
- }
- catch (BadLocationException e) {
- Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
- }
- finally {
- model.changedModel();
- model.endRecording(this);
- }
- }
- finally {
- model.releaseFromEdit();
- }
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/StructuredSelectEnclosingHandler.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/StructuredSelectEnclosingHandler.java
deleted file mode 100644
index efd4711595..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/StructuredSelectEnclosingHandler.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 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.css.ui.internal.handlers;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.Region;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.internal.handlers.AbstractStructuredSelectHandler;
-import org.w3c.dom.css.CSSStyleDeclaration;
-
-public class StructuredSelectEnclosingHandler extends AbstractStructuredSelectHandler {
-
- protected IndexedRegion getCursorIndexedRegion(IDocument document, ITextSelection textSelection) {
- IndexedRegion indexedRegion = null;
-
- indexedRegion = getIndexedRegion(document, textSelection.getOffset());
-
- return indexedRegion;
- }
-
- protected Region getNewSelectionRegion(IndexedRegion indexedRegion, ITextSelection textSelection) {
- Region newRegion = null;
- if (indexedRegion instanceof ICSSNode) {
- ICSSNode cursorNode = (ICSSNode) indexedRegion;
- Region cursorNodeRegion = new Region(indexedRegion.getStartOffset(), indexedRegion.getEndOffset() - indexedRegion.getStartOffset());
- int currentOffset = textSelection.getOffset();
- int currentEndOffset = currentOffset + textSelection.getLength();
- if (cursorNodeRegion.getOffset() >= currentOffset && cursorNodeRegion.getOffset() <= currentEndOffset && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() >= currentOffset && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() <= currentEndOffset) {
- ICSSNode newNode = cursorNode.getParentNode();
- if(newNode instanceof CSSStyleDeclaration) {
- newNode = newNode.getParentNode();
- }
-
- if (newNode instanceof IndexedRegion) {
- IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
- newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
- }
- }
- else
- newRegion = cursorNodeRegion;
- }
- return newRegion;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/StructuredSelectNextHandler.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/StructuredSelectNextHandler.java
deleted file mode 100644
index bfccb26a81..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/StructuredSelectNextHandler.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.css.ui.internal.handlers;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.Region;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.internal.handlers.AbstractStructuredSelectHandler;
-
-public class StructuredSelectNextHandler extends AbstractStructuredSelectHandler {
-
- protected IndexedRegion getCursorIndexedRegion(IDocument document, ITextSelection textSelection) {
- int offset = textSelection.getOffset() + textSelection.getLength() - 1;
- if (offset < 0)
- offset = 0;
-
- IndexedRegion indexedRegion = null;
-
- indexedRegion = getIndexedRegion(document, offset);
-
- return indexedRegion;
- }
-
- protected Region getNewSelectionRegion(IndexedRegion indexedRegion, ITextSelection textSelection) {
- Region newRegion = null;
-
- if (indexedRegion instanceof ICSSNode) {
- ICSSNode cursorNode = (ICSSNode) indexedRegion;
-
- Region cursorNodeRegion = new Region(indexedRegion.getStartOffset(), indexedRegion.getEndOffset() - indexedRegion.getStartOffset());
- int currentOffset = textSelection.getOffset();
- int currentEndOffset = currentOffset + textSelection.getLength();
- if (cursorNodeRegion.getOffset() >= currentOffset && cursorNodeRegion.getOffset() <= currentEndOffset && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() >= currentOffset && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() <= currentEndOffset) {
- ICSSNode newNode = cursorNode.getNextSibling();
- if (newNode == null) {
- newNode = cursorNode.getParentNode();
-
- if (newNode instanceof IndexedRegion) {
- IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
- newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
- }
- }
- else {
- if (newNode instanceof IndexedRegion) {
- IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
- newRegion = new Region(currentOffset, newIndexedRegion.getEndOffset() - currentOffset);
- }
- }
- }
- else
- newRegion = cursorNodeRegion;
- }
- return newRegion;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/StructuredSelectPreviousHandler.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/StructuredSelectPreviousHandler.java
deleted file mode 100644
index 5827a4f664..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/StructuredSelectPreviousHandler.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.css.ui.internal.handlers;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.Region;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.internal.handlers.AbstractStructuredSelectHandler;
-
-public class StructuredSelectPreviousHandler extends AbstractStructuredSelectHandler {
-
- protected IndexedRegion getCursorIndexedRegion(IDocument document, ITextSelection textSelection) {
- IndexedRegion indexedRegion = null;
-
- indexedRegion = getIndexedRegion(document, textSelection.getOffset());
-
- return indexedRegion;
- }
-
- protected Region getNewSelectionRegion(IndexedRegion indexedRegion, ITextSelection textSelection) {
- Region newRegion = null;
- if (indexedRegion instanceof ICSSNode) {
- ICSSNode cursorNode = (ICSSNode) indexedRegion;
-
- Region cursorNodeRegion = new Region(indexedRegion.getStartOffset(), indexedRegion.getEndOffset() - indexedRegion.getStartOffset());
- int currentOffset = textSelection.getOffset();
- int currentEndOffset = currentOffset + textSelection.getLength();
- if (cursorNodeRegion.getOffset() >= currentOffset && cursorNodeRegion.getOffset() <= currentEndOffset && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() >= currentOffset && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() <= currentEndOffset) {
- ICSSNode newNode = cursorNode.getPreviousSibling();
- if (newNode == null) {
- newNode = cursorNode.getParentNode();
-
- if (newNode instanceof IndexedRegion) {
- IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
- newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
- }
- }
- else {
- if (newNode instanceof IndexedRegion) {
- IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
- newRegion = new Region(newIndexedRegion.getStartOffset(), currentEndOffset - newIndexedRegion.getStartOffset());
- }
- }
- }
- else
- newRegion = cursorNodeRegion;
- }
- return newRegion;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/ToggleCommentHandler.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/ToggleCommentHandler.java
deleted file mode 100644
index ca7dd92661..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/handlers/ToggleCommentHandler.java
+++ /dev/null
@@ -1,159 +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.css.ui.internal.handlers;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.Position;
-import org.eclipse.jface.text.TextSelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.wst.css.ui.internal.Logger;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-
-public class ToggleCommentHandler extends AbstractCommentHandler {
-
- protected void processAction(ITextEditor textEditor, IDocument document, ITextSelection textSelection) {
- // get text selection lines info
- int selectionStartLine = textSelection.getStartLine();
- int selectionEndLine = textSelection.getEndLine();
- try {
- int selectionEndLineOffset = document.getLineOffset(selectionEndLine);
- int selectionEndOffset = textSelection.getOffset() + textSelection.getLength();
-
- // adjust selection end line
- if ((selectionEndLine > selectionStartLine) && (selectionEndLineOffset == selectionEndOffset)) {
- selectionEndLine--;
- }
-
- }
- catch (BadLocationException e) {
- Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
- }
-
- // save the selection position since it will be changing
- Position selectionPosition = null;
- boolean updateStartOffset = false;
- try {
- selectionPosition = new Position(textSelection.getOffset(), textSelection.getLength());
- document.addPosition(selectionPosition);
-
- // extra check if commenting from beginning of line
- int selectionStartLineOffset = document.getLineOffset(selectionStartLine);
- if ((textSelection.getLength() > 0) && (selectionStartLineOffset == textSelection.getOffset()) && !isCommentLine(document, selectionStartLine)) {
- updateStartOffset = true;
- }
- }
- catch (BadLocationException e) {
- Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
- }
-
- processAction(document, selectionStartLine, selectionEndLine);
-
- updateCurrentSelection(textEditor, selectionPosition, document, updateStartOffset);
- }
-
- private void processAction(IDocument document, int selectionStartLine, int selectionEndLine) {
- IStructuredModel model = StructuredModelManager.getModelManager().getExistingModelForEdit(document);
- if (model != null) {
- try {
- model.beginRecording(this, CSSUIMessages.ToggleComment_tooltip);
- model.aboutToChangeModel();
-
- for (int i = selectionStartLine; i <= selectionEndLine; i++) {
- try {
- if (document.getLineLength(i) > 0) {
- if (isCommentLine(document, i)) {
- int lineOffset = document.getLineOffset(i);
- IRegion region = document.getLineInformation(i);
- String string = document.get(region.getOffset(), region.getLength());
- int openCommentOffset = lineOffset + string.indexOf(OPEN_COMMENT);
- int closeCommentOffset = lineOffset + string.indexOf(CLOSE_COMMENT) - OPEN_COMMENT.length();
- uncomment(document, openCommentOffset, closeCommentOffset);
- }
- else {
- int openCommentOffset = document.getLineOffset(i);
- int lineDelimiterLength = document.getLineDelimiter(i) == null ? 0 : document.getLineDelimiter(i).length();
- int closeCommentOffset = openCommentOffset + document.getLineLength(i) - lineDelimiterLength + OPEN_COMMENT.length();
- comment(document, openCommentOffset, closeCommentOffset);
- }
- }
- }
- catch (BadLocationException e) {
- Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
- }
- }
- }
- finally {
- model.changedModel();
- model.endRecording(this);
- model.releaseFromEdit();
- }
- }
- }
-
- private void updateCurrentSelection(ITextEditor textEditor, Position selectionPosition, IDocument document, boolean updateStartOffset) {
- // update the selection if text selection changed
- if (selectionPosition != null) {
- ITextSelection selection = null;
- if (updateStartOffset) {
- selection = new TextSelection(document, selectionPosition.getOffset() - OPEN_COMMENT.length(), selectionPosition.getLength() + OPEN_COMMENT.length());
- }
- else {
- selection = new TextSelection(document, selectionPosition.getOffset(), selectionPosition.getLength());
- }
- ISelectionProvider provider = textEditor.getSelectionProvider();
- if (provider != null) {
- provider.setSelection(selection);
- }
- document.removePosition(selectionPosition);
- }
- }
-
- private boolean isCommentLine(IDocument document, int line) {
- boolean isComment = false;
-
- try {
- IRegion region = document.getLineInformation(line);
- String string = document.get(region.getOffset(), region.getLength()).trim();
- isComment = (string.length() >= OPEN_COMMENT.length() + CLOSE_COMMENT.length()) && string.startsWith(OPEN_COMMENT) && string.endsWith(CLOSE_COMMENT);
- }
- catch (BadLocationException e) {
- Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
- }
- return isComment;
- }
-
- private void comment(IDocument document, int openCommentOffset, int closeCommentOffset) {
- try {
- document.replace(openCommentOffset, 0, OPEN_COMMENT);
- document.replace(closeCommentOffset, 0, CLOSE_COMMENT);
- removeOpenCloseComments(document, openCommentOffset + OPEN_COMMENT.length(), closeCommentOffset - openCommentOffset - CLOSE_COMMENT.length());
- }
- catch (BadLocationException e) {
- Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
- }
- }
-
- private void uncomment(IDocument document, int openCommentOffset, int closeCommentOffset) {
- try {
- document.replace(openCommentOffset, OPEN_COMMENT.length(), ""); //$NON-NLS-1$
- document.replace(closeCommentOffset, CLOSE_COMMENT.length(), ""); //$NON-NLS-1$
- }
- catch (BadLocationException e) {
- Logger.log(Logger.WARNING_DEBUG, e.getMessage(), e);
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/image/CSSImageHelper.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/image/CSSImageHelper.java
deleted file mode 100644
index 702be85760..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/image/CSSImageHelper.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.image;
-
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-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.css.ui.internal.CSSUIPlugin;
-import org.eclipse.wst.css.ui.internal.editor.CSSEditorPluginImages;
-
-
-public class CSSImageHelper {
- private static CSSImageHelper fInstance = null;
-
- /**
- * singleton
- */
- public synchronized static CSSImageHelper getInstance() {
- if (fInstance == null) {
- fInstance = new CSSImageHelper();
- }
- return fInstance;
- }
-
- private HashMap fImageDescRegistry = null; // save a descriptor for each image
- private Map fTypeMap = null;
-
- /**
- *
- */
- private CSSImageHelper() {
- super();
- }
-
- /**
- *
- */
- private Image createImage(String resource) {
- ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(CSSUIPlugin.ID, resource);
- Image image = null;
-
- if (desc == null) {
- desc = ImageDescriptor.getMissingImageDescriptor();
- image = desc.createImage();
- } else {
- image = desc.createImage();
- 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(CSSUIPlugin.ID, imageFilePath);
- if (imageDescriptor != null) {
- getImageDescriptorRegistry().put(imageFilePath, imageDescriptor);
- } else {
- imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
- }
-
- return imageDescriptor;
- }
-
- /**
- * by type
- */
- public Image getImage(CSSImageType type) {
- if (fTypeMap == null) {
- fTypeMap = new HashMap();
- fTypeMap.put(CSSImageType.STYLESHEET, CSSEditorPluginImages.IMG_OBJ_STYLESHEET);
-
- fTypeMap.put(CSSImageType.RULE_CHARSET, CSSEditorPluginImages.IMG_OBJ_RULE_CHARSET);
- fTypeMap.put(CSSImageType.RULE_FONTFACE, CSSEditorPluginImages.IMG_OBJ_RULE_FONTFACE);
- fTypeMap.put(CSSImageType.RULE_IMPORT, CSSEditorPluginImages.IMG_OBJ_RULE_IMPORT);
- fTypeMap.put(CSSImageType.RULE_MEDIA, CSSEditorPluginImages.IMG_OBJ_RULE_MEDIA);
- fTypeMap.put(CSSImageType.RULE_PAGE, CSSEditorPluginImages.IMG_OBJ_RULE_PAGE);
- fTypeMap.put(CSSImageType.RULE_STYLE, CSSEditorPluginImages.IMG_OBJ_RULE_STYLE);
- fTypeMap.put(CSSImageType.RULE_UNKNOWN, CSSEditorPluginImages.IMG_OBJ_RULE_UNKNOWN);
-
- fTypeMap.put(CSSImageType.SELECTOR_CLASS, CSSEditorPluginImages.IMG_OBJ_SELECTOR_CLASS);
- fTypeMap.put(CSSImageType.SELECTOR_ID, CSSEditorPluginImages.IMG_OBJ_SELECTOR_ID);
- fTypeMap.put(CSSImageType.SELECTOR_PSEUDO, CSSEditorPluginImages.IMG_OBJ_SELECTOR_PSEUDO);
- fTypeMap.put(CSSImageType.SELECTOR_TAG, CSSEditorPluginImages.IMG_OBJ_SELECTOR_TAG);
- fTypeMap.put(CSSImageType.SELECTOR_LINK, CSSEditorPluginImages.IMG_OBJ_SELECTOR_LINK);
- fTypeMap.put(CSSImageType.SELECTOR_DEFAULT, CSSEditorPluginImages.IMG_OBJ_SELECTOR_DEFAULT);
-
- fTypeMap.put(CSSImageType.VALUE_FUNCTION, CSSEditorPluginImages.IMG_OBJ_VALUE_FUNCTION);
- fTypeMap.put(CSSImageType.VALUE_NUMBER, CSSEditorPluginImages.IMG_OBJ_VALUE_NUMBER);
- fTypeMap.put(CSSImageType.VALUE_STRING, CSSEditorPluginImages.IMG_OBJ_VALUE_STRING);
-
- fTypeMap.put(CSSImageType.CATEGORY_AURAL, CSSEditorPluginImages.IMG_OBJ_CATEGORY_AURAL);
- fTypeMap.put(CSSImageType.CATEGORY_BOX, CSSEditorPluginImages.IMG_OBJ_CATEGORY_BOX);
- fTypeMap.put(CSSImageType.CATEGORY_COLORANDBACKGROUND, CSSEditorPluginImages.IMG_OBJ_CATEGORY_COLORANDBACKGROUND);
- fTypeMap.put(CSSImageType.CATEGORY_CONTENT, CSSEditorPluginImages.IMG_OBJ_CATEGORY_CONTENT);
- fTypeMap.put(CSSImageType.CATEGORY_FONT, CSSEditorPluginImages.IMG_OBJ_CATEGORY_FONT);
- fTypeMap.put(CSSImageType.CATEGORY_PAGE, CSSEditorPluginImages.IMG_OBJ_CATEGORY_PAGE);
- fTypeMap.put(CSSImageType.CATEGORY_TABLES, CSSEditorPluginImages.IMG_OBJ_CATEGORY_TABLES);
- fTypeMap.put(CSSImageType.CATEGORY_TEXT, CSSEditorPluginImages.IMG_OBJ_CATEGORY_TEXT);
- fTypeMap.put(CSSImageType.CATEGORY_UI, CSSEditorPluginImages.IMG_OBJ_CATEGORY_UI);
- fTypeMap.put(CSSImageType.CATEGORY_VISUAL, CSSEditorPluginImages.IMG_OBJ_CATEGORY_VISUAL);
- fTypeMap.put(CSSImageType.CATEGORY_DEFAULT, CSSEditorPluginImages.IMG_OBJ_CATEGORY_DEFAULT);
- }
- return getImage((String) fTypeMap.get(type));
- }
-
- /**
- * by relative path(from here)
- */
- public Image getImage(String resource) {
- if (resource == null) {
- return null;
- }
- Image image = getImageRegistry().get(resource);
- if (image == null) {
- 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;
- }
-
- private ImageRegistry getImageRegistry() {
- return JFaceResources.getImageRegistry();
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/image/CSSImageType.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/image/CSSImageType.java
deleted file mode 100644
index 6f2bf91fac..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/image/CSSImageType.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.image;
-
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.wst.css.core.internal.metamodel.CSSMMProperty;
-import org.eclipse.wst.css.core.internal.metamodel.CSSMetaModel;
-import org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelFinder;
-import org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelUtil;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSDocument;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSPrimitiveValue;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSSelector;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorItem;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSSelectorList;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSSimpleSelector;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclItem;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
-import org.w3c.dom.css.CSSCharsetRule;
-import org.w3c.dom.css.CSSFontFaceRule;
-import org.w3c.dom.css.CSSImportRule;
-import org.w3c.dom.css.CSSMediaRule;
-import org.w3c.dom.css.CSSPageRule;
-import org.w3c.dom.css.CSSPrimitiveValue;
-import org.w3c.dom.css.CSSStyleDeclaration;
-import org.w3c.dom.css.CSSStyleRule;
-import org.w3c.dom.css.CSSValue;
-
-/**
- */
-public class CSSImageType {
-
- private final String fName;
-
- private CSSImageType(String name) {
- this.fName = name;
- }
-
- public String toString() {
- return fName;
- }
-
- public static final CSSImageType STYLESHEET = new CSSImageType("STYLESHEET"); //$NON-NLS-1$
-
- public static final CSSImageType RULE_CHARSET = new CSSImageType("RULE_CHARSET"); //$NON-NLS-1$
- public static final CSSImageType RULE_FONTFACE = new CSSImageType("RULE_FONTFACE"); //$NON-NLS-1$
- public static final CSSImageType RULE_IMPORT = new CSSImageType("RULE_IMPORT"); //$NON-NLS-1$
- public static final CSSImageType RULE_MEDIA = new CSSImageType("RULE_MEDIA"); //$NON-NLS-1$
- public static final CSSImageType RULE_PAGE = new CSSImageType("RULE_PAGE"); //$NON-NLS-1$
- public static final CSSImageType RULE_STYLE = new CSSImageType("RULE_STYLE"); //$NON-NLS-1$
- public static final CSSImageType RULE_UNKNOWN = new CSSImageType("RULE_UNKNOWN"); //$NON-NLS-1$
-
- public static final CSSImageType SELECTOR_CLASS = new CSSImageType("SELECTOR_CLASS"); //$NON-NLS-1$
- public static final CSSImageType SELECTOR_ID = new CSSImageType("SELECTOR_ID"); //$NON-NLS-1$
- public static final CSSImageType SELECTOR_DEFAULT = new CSSImageType("SELECTOR_DEFAULT"); //$NON-NLS-1$
- public static final CSSImageType SELECTOR_PSEUDO = new CSSImageType("SELECTOR_PSEUDO"); //$NON-NLS-1$
- public static final CSSImageType SELECTOR_TAG = new CSSImageType("SELECTOR_TAG"); //$NON-NLS-1$
- public static final CSSImageType SELECTOR_LINK = new CSSImageType("SELECTOR_LINK"); //$NON-NLS-1$
-
- public static final CSSImageType VALUE_FUNCTION = new CSSImageType("VALUE_FUNCTION"); //$NON-NLS-1$
- public static final CSSImageType VALUE_NUMBER = new CSSImageType("VALUE_NUMBER"); //$NON-NLS-1$
- public static final CSSImageType VALUE_STRING = new CSSImageType("VALUE_STRING"); //$NON-NLS-1$
-
- public static final CSSImageType CATEGORY_AURAL = new CSSImageType("CATEGORY_AURAL"); //$NON-NLS-1$
- public static final CSSImageType CATEGORY_BOX = new CSSImageType("CATEGORY_BOX"); //$NON-NLS-1$
- public static final CSSImageType CATEGORY_COLORANDBACKGROUND = new CSSImageType("CATEGORY_COLORANDBACKGROUND"); //$NON-NLS-1$
- public static final CSSImageType CATEGORY_CONTENT = new CSSImageType("CATEGORY_CONTENT"); //$NON-NLS-1$
- public static final CSSImageType CATEGORY_FONT = new CSSImageType("CATEGORY_FONT"); //$NON-NLS-1$
- public static final CSSImageType CATEGORY_PAGE = new CSSImageType("CATEGORY_PAGE"); //$NON-NLS-1$
- public static final CSSImageType CATEGORY_TABLES = new CSSImageType("CATEGORY_TABLES"); //$NON-NLS-1$
- public static final CSSImageType CATEGORY_TEXT = new CSSImageType("CATEGORY_TEXT"); //$NON-NLS-1$
- public static final CSSImageType CATEGORY_UI = new CSSImageType("CATEGORY_UI"); //$NON-NLS-1$
- public static final CSSImageType CATEGORY_VISUAL = new CSSImageType("CATEGORY_VISUAL"); //$NON-NLS-1$
- public static final CSSImageType CATEGORY_DEFAULT = new CSSImageType("CATEGORY_DEFAULT"); //$NON-NLS-1$
-
- /**
- * by node
- */
- public static CSSImageType getImageType(ICSSNode node) {
- CSSImageType imageType = null;
- if (node instanceof CSSCharsetRule) {
- imageType = RULE_CHARSET;
- } else if (node instanceof CSSFontFaceRule) {
- imageType = RULE_FONTFACE;
- } else if (node instanceof CSSImportRule) {
- imageType = RULE_IMPORT;
- } else if (node instanceof CSSMediaRule) {
- imageType = RULE_MEDIA;
- } else if (node instanceof CSSPageRule) {
- imageType = RULE_PAGE;
- } else if (node instanceof CSSStyleRule) {
- imageType = getImageType(((ICSSStyleRule) node).getSelectors());
- } else if (node instanceof CSSStyleDeclaration) {
- ICSSNode parent = node.getParentNode();
- if (parent != null) {
- return getImageType(parent);
- }
- } else if (node instanceof ICSSStyleDeclItem) {
- String name = ((ICSSStyleDeclItem) node).getPropertyName();
- ICSSDocument doc = node.getOwnerDocument();
- ICSSModel model = (doc != null) ? doc.getModel() : null;
- CSSMetaModelFinder finder = CSSMetaModelFinder.getInstance();
- CSSMetaModel metaModel = finder.findMetaModelFor(model);
- // is font-face rule ?
- ICSSNode parent = node.getParentNode();
- if (parent != null) {
- parent = parent.getParentNode();
- if (parent instanceof CSSFontFaceRule) {
- imageType = CSSImageType.CATEGORY_FONT;
- }
- }
- if (imageType == null) {
- CSSMMProperty prop = new CSSMetaModelUtil(metaModel).getProperty(name);
- if (prop != null) {
- String category = prop.getAttribute("category"); //$NON-NLS-1$
- imageType = getImageType(category);
- }
- if (imageType == null) {
- imageType = CSSImageType.CATEGORY_DEFAULT;
- }
- }
- } else if (node instanceof CSSValue) {
- switch (((CSSValue) node).getCssValueType()) {
- case CSSPrimitiveValue.CSS_NUMBER :
- case CSSPrimitiveValue.CSS_PERCENTAGE :
- case CSSPrimitiveValue.CSS_EMS :
- case CSSPrimitiveValue.CSS_EXS :
- case CSSPrimitiveValue.CSS_PX :
- case CSSPrimitiveValue.CSS_CM :
- case CSSPrimitiveValue.CSS_MM :
- case CSSPrimitiveValue.CSS_IN :
- case CSSPrimitiveValue.CSS_PT :
- case CSSPrimitiveValue.CSS_PC :
- case CSSPrimitiveValue.CSS_DEG :
- case CSSPrimitiveValue.CSS_RAD :
- case CSSPrimitiveValue.CSS_GRAD :
- case CSSPrimitiveValue.CSS_MS :
- case CSSPrimitiveValue.CSS_S :
- case CSSPrimitiveValue.CSS_HZ :
- case CSSPrimitiveValue.CSS_KHZ :
- case CSSPrimitiveValue.CSS_DIMENSION :
- case ICSSPrimitiveValue.CSS_INTEGER :
- case ICSSPrimitiveValue.CSS_HASH :
- imageType = VALUE_NUMBER;
- break;
- case CSSPrimitiveValue.CSS_ATTR :
- case CSSPrimitiveValue.CSS_COUNTER :
- case CSSPrimitiveValue.CSS_RECT :
- case CSSPrimitiveValue.CSS_RGBCOLOR :
- case CSSPrimitiveValue.CSS_URI :
- case ICSSPrimitiveValue.CSS_FORMAT :
- case ICSSPrimitiveValue.CSS_LOCAL :
- imageType = VALUE_FUNCTION;
- break;
- default :
- imageType = VALUE_STRING;
- break;
- }
- }
- return imageType;
- }
-
- public static CSSImageType getImageType(ICSSSelectorList selectorList) {
- if (selectorList == null || selectorList.getLength() == 0) {
- return SELECTOR_DEFAULT;
- }
- CSSImageType imageType = null;
- int nSelectors = selectorList.getLength();
- for (int i = 0; i < nSelectors; i++) {
- CSSImageType candidate = getImageType(selectorList.getSelector(i));
- if (imageType == null) {
- imageType = candidate;
- } else if (imageType != candidate) {
- imageType = null;
- break;
- }
- }
-
- return (imageType == null) ? SELECTOR_DEFAULT : imageType;
- }
-
- public static CSSImageType getImageType(ICSSSelector selector) {
- CSSImageType imageType = SELECTOR_DEFAULT;
- if (selector == null || selector.getLength() == 0) {
- return imageType;
- }
- ICSSSelectorItem item = selector.getItem(selector.getLength() - 1);
- if (item.getItemType() == ICSSSelectorItem.SIMPLE) {
- ICSSSimpleSelector ss = (ICSSSimpleSelector) item;
- if (0 < ss.getNumOfIDs()) {
- imageType = SELECTOR_ID;
- } else if (0 < ss.getNumOfClasses()) {
- imageType = SELECTOR_CLASS;
- } else if (0 < ss.getNumOfPseudoNames()) {
- imageType = SELECTOR_PSEUDO;
- } else {
- imageType = SELECTOR_TAG;
- }
- }
- return imageType;
- }
-
- public static CSSImageType getImageType(String category) {
- if (fCategoryMap == null) {
- fCategoryMap = new HashMap();
- fCategoryMap.put("aural", CATEGORY_AURAL); //$NON-NLS-1$
- fCategoryMap.put("box", CATEGORY_BOX); //$NON-NLS-1$
- fCategoryMap.put("colorandbackground", CATEGORY_COLORANDBACKGROUND); //$NON-NLS-1$
- fCategoryMap.put("content", CATEGORY_CONTENT); //$NON-NLS-1$
- fCategoryMap.put("font", CATEGORY_FONT); //$NON-NLS-1$
- fCategoryMap.put("page", CATEGORY_PAGE); //$NON-NLS-1$
- fCategoryMap.put("tables", CATEGORY_TABLES); //$NON-NLS-1$
- fCategoryMap.put("text", CATEGORY_TEXT); //$NON-NLS-1$
- fCategoryMap.put("ui", CATEGORY_UI); //$NON-NLS-1$
- fCategoryMap.put("visual", CATEGORY_VISUAL); //$NON-NLS-1$
- }
- CSSImageType imageType = (CSSImageType) fCategoryMap.get(category);
- return (imageType == null) ? CATEGORY_DEFAULT : imageType;
- }
-
- private static Map fCategoryMap = null;
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSCompletionProposalCategoriesConfiguration.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSCompletionProposalCategoriesConfiguration.java
deleted file mode 100644
index 3691c7aa18..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSCompletionProposalCategoriesConfiguration.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.css.ui.internal.preferences;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.wst.css.ui.internal.CSSUIPlugin;
-import org.eclipse.wst.sse.ui.preferences.AbstractCompletionProposalCategoriesConfiguration;
-
-/**
- * <p>The readable and writable completion proposal categories configuration
- * for the CSS content type</p>
- */
-public class CSSCompletionProposalCategoriesConfiguration extends
- AbstractCompletionProposalCategoriesConfiguration {
-
- /** the ID of the preference page where users can change the preferences */
- private static final String PREFERENCES_PAGE_ID = "org.eclipse.wst.css.ui.preferences.contentassist"; //$NON-NLS-1$
-
- /**
- * <p>Creates the configuration</p>
- */
- public CSSCompletionProposalCategoriesConfiguration() {
- //nothing to do.
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.preferences.AbstractCompletionProposalCategoriesConfiguration#getPreferenceStore()
- */
- protected IPreferenceStore getPreferenceStore() {
- return CSSUIPlugin.getDefault().getPreferenceStore();
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.preferences.ICompletionProposalCategoriesConfigurationWriter#hasAssociatedPropertiesPage()
- */
- public boolean hasAssociatedPropertiesPage() {
- return true;
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.preferences.ICompletionProposalCategoriesConfigurationWriter#getPropertiesPageID()
- */
- public String getPropertiesPageID() {
- return PREFERENCES_PAGE_ID;
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.preferences.AbstractCompletionProposalCategoriesConfiguration#getShouldNotDisplayOnDefaultPagePrefKey()
- */
- protected String getShouldNotDisplayOnDefaultPagePrefKey() {
- return CSSUIPreferenceNames.CONTENT_ASSIST_DO_NOT_DISPLAY_ON_DEFAULT_PAGE;
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.preferences.AbstractCompletionProposalCategoriesConfiguration#getShouldNotDisplayOnOwnPagePrefKey()
- */
- protected String getShouldNotDisplayOnOwnPagePrefKey() {
- return CSSUIPreferenceNames.CONTENT_ASSIST_DO_NOT_DISPLAY_ON_OWN_PAGE;
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.preferences.AbstractCompletionProposalCategoriesConfiguration#getPageSortOrderPrefKey()
- */
- protected String getPageSortOrderPrefKey() {
- return CSSUIPreferenceNames.CONTENT_ASSIST_OWN_PAGE_SORT_ORDER;
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.preferences.AbstractCompletionProposalCategoriesConfiguration#getDefaultPageSortOrderPrefKey()
- */
- protected String getDefaultPageSortOrderPrefKey() {
- return CSSUIPreferenceNames.CONTENT_ASSIST_DEFAULT_PAGE_SORT_ORDER;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSUIPreferenceInitializer.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSUIPreferenceInitializer.java
deleted file mode 100644
index b5ab212567..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSUIPreferenceInitializer.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.wst.css.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.ui.PlatformUI;
-import org.eclipse.wst.css.ui.internal.CSSUIPlugin;
-import org.eclipse.wst.css.ui.internal.style.IStyleConstantsCSS;
-import org.eclipse.wst.sse.ui.internal.preferences.ui.ColorHelper;
-
-/**
- * Sets default values for CSS UI preferences
- */
-public class CSSUIPreferenceInitializer extends AbstractPreferenceInitializer {
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
- */
- public void initializeDefaultPreferences() {
- IPreferenceStore store = CSSUIPlugin.getDefault().getPreferenceStore();
- ColorRegistry registry = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry();
-
- // CSS Style Preferences
- String NOBACKGROUNDBOLD = " | null | false"; //$NON-NLS-1$
- String JUSTITALIC = " | null | false | true"; //$NON-NLS-1$
- String JUSTBOLD = " | null | true";
- String styleValue = "null" + NOBACKGROUNDBOLD; //$NON-NLS-1$
- store.setDefault(IStyleConstantsCSS.NORMAL, styleValue);
-
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.ATMARK_RULE, 63, 127, 127) + NOBACKGROUNDBOLD;
- store.setDefault(IStyleConstantsCSS.ATMARK_RULE, styleValue);
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.SELECTOR, 63, 127, 127) + JUSTBOLD;
- store.setDefault(IStyleConstantsCSS.SELECTOR, styleValue);
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.UNIVERSAL, 63, 127, 127) + NOBACKGROUNDBOLD;
- store.setDefault(IStyleConstantsCSS.UNIVERSAL, styleValue);
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.COMBINATOR, 63, 127, 127) + NOBACKGROUNDBOLD;
- store.setDefault(IStyleConstantsCSS.COMBINATOR, styleValue);
-
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.SELECTOR_CLASS, 63, 127, 127) + JUSTITALIC;
- store.setDefault(IStyleConstantsCSS.SELECTOR_CLASS, styleValue);
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.ID, 63, 127, 127) + JUSTITALIC;
- store.setDefault(IStyleConstantsCSS.ID, styleValue);
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.PSEUDO, 63, 127, 127) + JUSTITALIC;
- store.setDefault(IStyleConstantsCSS.PSEUDO, styleValue);
-
- /* Attribute selector */
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.ATTRIBUTE_DELIM, 63, 127, 127) + NOBACKGROUNDBOLD;
- store.setDefault(IStyleConstantsCSS.ATTRIBUTE_DELIM, styleValue);
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.ATTRIBUTE_NAME, 63, 127, 127) + NOBACKGROUNDBOLD;
- store.setDefault(IStyleConstantsCSS.ATTRIBUTE_NAME, styleValue);
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.ATTRIBUTE_OPERATOR, 63, 127, 127) + NOBACKGROUNDBOLD;
- store.setDefault(IStyleConstantsCSS.ATTRIBUTE_OPERATOR, styleValue);
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.ATTRIBUTE_VALUE, 63, 127, 127) + NOBACKGROUNDBOLD;
- store.setDefault(IStyleConstantsCSS.ATTRIBUTE_VALUE, styleValue);
-
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.MEDIA, 42, 0, 225) + NOBACKGROUNDBOLD;
- store.setDefault(IStyleConstantsCSS.MEDIA, styleValue);
-
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.COMMENT, 63, 95, 191) + NOBACKGROUNDBOLD;
- store.setDefault(IStyleConstantsCSS.COMMENT, styleValue);
-
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.PROPERTY_NAME, 127, 0, 127) + NOBACKGROUNDBOLD;
- store.setDefault(IStyleConstantsCSS.PROPERTY_NAME, styleValue);
-
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.PROPERTY_VALUE, 42, 0, 225) + JUSTITALIC;
- store.setDefault(IStyleConstantsCSS.PROPERTY_VALUE, styleValue);
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.URI, 42, 0, 225) + JUSTITALIC;
- store.setDefault(IStyleConstantsCSS.URI, styleValue);
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.STRING, 42, 0, 225) + JUSTITALIC;
- store.setDefault(IStyleConstantsCSS.STRING, styleValue);
-
- styleValue = "null" + NOBACKGROUNDBOLD; //$NON-NLS-1$
- store.setDefault(IStyleConstantsCSS.COLON, styleValue);
- store.setDefault(IStyleConstantsCSS.SEMI_COLON, styleValue);
- store.setDefault(IStyleConstantsCSS.CURLY_BRACE, styleValue);
-
- styleValue = ColorHelper.findRGBString(registry, IStyleConstantsCSS.ERROR, 191, 63, 63) + NOBACKGROUNDBOLD;
- store.setDefault(IStyleConstantsCSS.ERROR, styleValue);
-
- // set default new css file template to use in new file wizard
- /*
- * Need to find template name that goes with default template id (name
- * may change for different language)
- */
- store.setDefault(CSSUIPreferenceNames.NEW_FILE_TEMPLATE_ID, "org.eclipse.wst.css.ui.internal.templates.newcss"); //$NON-NLS-1$
-
- // Defaults for Content Assist preference page
- store.setDefault(CSSUIPreferenceNames.CONTENT_ASSIST_DO_NOT_DISPLAY_ON_DEFAULT_PAGE, "");
- store.setDefault(CSSUIPreferenceNames.CONTENT_ASSIST_DO_NOT_DISPLAY_ON_OWN_PAGE, "");
- store.setDefault(CSSUIPreferenceNames.CONTENT_ASSIST_DEFAULT_PAGE_SORT_ORDER,
- "org.eclipse.wst.css.ui.proposalCategory.css\0" +
- "org.eclipse.wst.css.ui.proposalCategory.cssTemplates");
- store.setDefault(CSSUIPreferenceNames.CONTENT_ASSIST_OWN_PAGE_SORT_ORDER,
- "org.eclipse.wst.css.ui.proposalCategory.cssTemplates\0"+
- "org.eclipse.wst.css.ui.proposalCategory.css");
- }
-
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSUIPreferenceNames.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSUIPreferenceNames.java
deleted file mode 100644
index 1dc5129c57..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/CSSUIPreferenceNames.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 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.css.ui.internal.preferences;
-
-/**
- * Preference keys for CSS UI
- */
-public class CSSUIPreferenceNames {
- private CSSUIPreferenceNames() {
- // 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 CSS 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$
-
- /**
- * The initial template ID to be used in the new CSS file wizard. In the absence
- * of {@link NEW_FILE_TEMPLATE_NAME}, this ID is used to find a template name
- */
- public static final String NEW_FILE_TEMPLATE_ID = "newFileTemplateId"; //$NON-NLS-1$
-
- /**
- * <p>preference key used for saving which categories should not display on the default page</p>
- *
- * <p>Value is of type {@link String} consisting of
- * <tt>org.eclipse.wst.sse.ui.completionProposal/proposalCategory/@id</tt>s separated by the null
- * character (<tt>\0</tt>), ordered is ignored</p>
- */
- public static final String CONTENT_ASSIST_DO_NOT_DISPLAY_ON_DEFAULT_PAGE = "css_content_assist_display_on_default_page"; //$NON-NLS-1$
-
- /**
- * <p>preference key used for saving which categories should not display on their own page</p>
- *
- * <p>Value is of type {@link String} consisting of
- * <tt>org.eclipse.wst.sse.ui.completionProposal/proposalCategory/@id</tt>s separated by the null
- * character (<tt>\0</tt>), order is ignored</p>
- */
- public static final String CONTENT_ASSIST_DO_NOT_DISPLAY_ON_OWN_PAGE = "css_content_assist_display_on_own_page"; //$NON-NLS-1$
-
- /**
- * <p>preference key for saving the sort order of the categories when displaying them on their own page</p>
- *
- * <p>Value is of type {@link String} consisting of
- * <tt>org.eclipse.wst.sse.ui.completionProposal/proposalCategory/@id</tt>s separated by the null
- * character (<tt>\0</tt>) in the desired sort order.</p>
- */
- public static final String CONTENT_ASSIST_OWN_PAGE_SORT_ORDER= "css_content_assist_own_page_sort_order"; //$NON-NLS-1$
-
- /**
- * <p>preference key for saving the sort order of the categories when displaying them on the default page</p>
- *
- * <p>Value is of type {@link String} consisting of
- * <tt>org.eclipse.wst.sse.ui.completionProposal/proposalCategory/@id</tt>s separated by the null
- * character (<tt>\0</tt>) in the desired sort order.</p>
- */
- public static final String CONTENT_ASSIST_DEFAULT_PAGE_SORT_ORDER= "css_content_assist_default_page_sort_order"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSColorPage.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSColorPage.java
deleted file mode 100644
index ab63bf1ab3..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSColorPage.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2004,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.css.ui.internal.preferences.ui;
-
-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.css.core.internal.parserz.CSSRegionContexts;
-import org.eclipse.wst.css.core.internal.provisional.contenttype.ContentTypeIdForCSS;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-import org.eclipse.wst.css.ui.internal.CSSUIPlugin;
-import org.eclipse.wst.css.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.css.ui.internal.style.IStyleConstantsCSS;
-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 CSSColorPage extends AbstractColorPage {
-
- /**
- * 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 Control createContents(Composite parent) {
- Composite pageComponent = createComposite(parent, 1);
- ((GridData) pageComponent.getLayoutData()).horizontalAlignment = GridData.HORIZONTAL_ALIGN_FILL;
-
- super.createContents(pageComponent);
-
- // assigning one help for whole group
- PlatformUI.getWorkbench().getHelpSystem().setHelp(pageComponent, IHelpContextIds.CSS_PREFWEBX_STYLES_HELPID);
-
- return pageComponent;
- }
-
- protected Composite createColoringComposite(Composite parent) {
- Composite coloringComposite = super.createColoringComposite(parent);
-
- // assigning one help for whole group
- return coloringComposite;
- }
-
- /**
- * getSampleText method comment.
- */
- public String getSampleText() {
- return CSSUIMessages.PrefsLabel_ColorSample; //$NON-NLS-1$
- }
-
- /**
- *
- * @param contextStyleMap
- * java.util.Dictionary
- */
- protected void initContextStyleMap(Dictionary contextStyleMap) {
- contextStyleMap.put(CSSRegionContexts.CSS_COMMENT, IStyleConstantsCSS.COMMENT);
- contextStyleMap.put(CSSRegionContexts.CSS_CDO, IStyleConstantsCSS.COMMENT);
- contextStyleMap.put(CSSRegionContexts.CSS_CDC, IStyleConstantsCSS.COMMENT);
- contextStyleMap.put(CSSRegionContexts.CSS_S, IStyleConstantsCSS.NORMAL);
-
- contextStyleMap.put(CSSRegionContexts.CSS_DELIMITER, IStyleConstantsCSS.SEMI_COLON);
- contextStyleMap.put(CSSRegionContexts.CSS_LBRACE, IStyleConstantsCSS.CURLY_BRACE);
- contextStyleMap.put(CSSRegionContexts.CSS_RBRACE, IStyleConstantsCSS.CURLY_BRACE);
-
- contextStyleMap.put(CSSRegionContexts.CSS_IMPORT, IStyleConstantsCSS.ATMARK_RULE);
- contextStyleMap.put(CSSRegionContexts.CSS_PAGE, IStyleConstantsCSS.ATMARK_RULE);
- contextStyleMap.put(CSSRegionContexts.CSS_MEDIA, IStyleConstantsCSS.ATMARK_RULE);
- contextStyleMap.put(CSSRegionContexts.CSS_FONT_FACE, IStyleConstantsCSS.ATMARK_RULE);
- contextStyleMap.put(CSSRegionContexts.CSS_CHARSET, IStyleConstantsCSS.ATMARK_RULE);
- contextStyleMap.put(CSSRegionContexts.CSS_ATKEYWORD, IStyleConstantsCSS.ATMARK_RULE);
-
- contextStyleMap.put(CSSRegionContexts.CSS_STRING, IStyleConstantsCSS.STRING);
- contextStyleMap.put(CSSRegionContexts.CSS_URI, IStyleConstantsCSS.URI);
- contextStyleMap.put(CSSRegionContexts.CSS_MEDIUM, IStyleConstantsCSS.MEDIA);
- contextStyleMap.put(CSSRegionContexts.CSS_MEDIA_SEPARATOR, IStyleConstantsCSS.MEDIA);
-
- contextStyleMap.put(CSSRegionContexts.CSS_CHARSET_NAME, IStyleConstantsCSS.STRING);
-
- contextStyleMap.put(CSSRegionContexts.CSS_PAGE_SELECTOR, IStyleConstantsCSS.MEDIA);
-
- contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ELEMENT_NAME, IStyleConstantsCSS.SELECTOR);
- contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_UNIVERSAL, IStyleConstantsCSS.SELECTOR);
- contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_PSEUDO, IStyleConstantsCSS.SELECTOR);
- contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_CLASS, IStyleConstantsCSS.SELECTOR);
- contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ID, IStyleConstantsCSS.SELECTOR);
-
- contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_COMBINATOR, IStyleConstantsCSS.SELECTOR);
- contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_SEPARATOR, IStyleConstantsCSS.SELECTOR);
- contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_START, IStyleConstantsCSS.SELECTOR);
- contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_END, IStyleConstantsCSS.SELECTOR);
- contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_NAME, IStyleConstantsCSS.SELECTOR);
- contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_VALUE, IStyleConstantsCSS.SELECTOR);
- contextStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_OPERATOR, IStyleConstantsCSS.SELECTOR);
-
- contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_PROPERTY, IStyleConstantsCSS.PROPERTY_NAME);
- contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT, IStyleConstantsCSS.PROPERTY_VALUE);
- contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_DIMENSION, IStyleConstantsCSS.PROPERTY_VALUE);
- contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE, IStyleConstantsCSS.PROPERTY_VALUE);
- contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER, IStyleConstantsCSS.PROPERTY_VALUE);
- contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION, IStyleConstantsCSS.PROPERTY_VALUE);
- contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE, IStyleConstantsCSS.PROPERTY_VALUE);
- contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_STRING, IStyleConstantsCSS.PROPERTY_VALUE);
- contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_URI, IStyleConstantsCSS.PROPERTY_VALUE);
- contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_HASH, IStyleConstantsCSS.PROPERTY_VALUE);
- contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_UNICODE_RANGE, IStyleConstantsCSS.PROPERTY_VALUE);
- contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_IMPORTANT, IStyleConstantsCSS.PROPERTY_VALUE);
- contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR, IStyleConstantsCSS.PROPERTY_VALUE);
- contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_S, IStyleConstantsCSS.PROPERTY_VALUE);
- contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_SEPARATOR, IStyleConstantsCSS.COLON);
- contextStyleMap.put(CSSRegionContexts.CSS_DECLARATION_DELIMITER, IStyleConstantsCSS.SEMI_COLON);
-
- contextStyleMap.put(CSSRegionContexts.CSS_UNKNOWN, IStyleConstantsCSS.ERROR);
- }
-
- /**
- *
- * @param descriptions
- * java.util.Dictionary
- */
- protected void initDescriptions(Dictionary descriptions) {
- // create descriptions for hilighting types
- descriptions.put(IStyleConstantsCSS.NORMAL, CSSUIMessages.PrefsLabel_ColorNormal);//$NON-NLS-1$
- descriptions.put(IStyleConstantsCSS.ATMARK_RULE, CSSUIMessages.PrefsLabel_ColorAtmarkRule);//$NON-NLS-1$
- descriptions.put(IStyleConstantsCSS.SELECTOR, CSSUIMessages.PrefsLabel_ColorSelector);//$NON-NLS-1$
- descriptions.put(IStyleConstantsCSS.MEDIA, CSSUIMessages.PrefsLabel_ColorMedia);//$NON-NLS-1$
- descriptions.put(IStyleConstantsCSS.COMMENT, CSSUIMessages.PrefsLabel_ColorComment);//$NON-NLS-1$
- descriptions.put(IStyleConstantsCSS.PROPERTY_NAME, CSSUIMessages.PrefsLabel_ColorPropertyName);//$NON-NLS-1$
- descriptions.put(IStyleConstantsCSS.PROPERTY_VALUE, CSSUIMessages.PrefsLabel_ColorPropertyValue);//$NON-NLS-1$
- descriptions.put(IStyleConstantsCSS.URI, CSSUIMessages.PrefsLabel_ColorUri);//$NON-NLS-1$
- descriptions.put(IStyleConstantsCSS.STRING, CSSUIMessages.PrefsLabel_ColorString);//$NON-NLS-1$
- descriptions.put(IStyleConstantsCSS.COLON, CSSUIMessages.PrefsLabel_ColorColon);//$NON-NLS-1$
- descriptions.put(IStyleConstantsCSS.SEMI_COLON, CSSUIMessages.PrefsLabel_ColorSemiColon);//$NON-NLS-1$
- descriptions.put(IStyleConstantsCSS.CURLY_BRACE, CSSUIMessages.PrefsLabel_ColorCurlyBrace);//$NON-NLS-1$
- descriptions.put(IStyleConstantsCSS.ERROR, CSSUIMessages.PrefsLabel_ColorError);//$NON-NLS-1$
- }
-
- /**
- *
- * @param list
- * java.util.ArrayList
- */
- protected void initStyleList(ArrayList list) {
- list.add(IStyleConstantsCSS.NORMAL);
- list.add(IStyleConstantsCSS.ATMARK_RULE);
- list.add(IStyleConstantsCSS.SELECTOR);
- list.add(IStyleConstantsCSS.MEDIA);
- list.add(IStyleConstantsCSS.COMMENT);
- list.add(IStyleConstantsCSS.PROPERTY_NAME);
- list.add(IStyleConstantsCSS.PROPERTY_VALUE);
- list.add(IStyleConstantsCSS.URI);
- list.add(IStyleConstantsCSS.STRING);
- list.add(IStyleConstantsCSS.COLON);
- list.add(IStyleConstantsCSS.SEMI_COLON);
- list.add(IStyleConstantsCSS.CURLY_BRACE);
- list.add(IStyleConstantsCSS.ERROR);
- }
-
- /**
- * setupPicker method comment.
- */
- protected void setupPicker(StyledTextColorPicker picker) {
- IModelManager mmanager = StructuredModelManager.getModelManager();
- picker.setParser(mmanager.createStructuredDocumentFor(ContentTypeIdForCSS.ContentTypeID_CSS).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);
- }
-
- protected IPreferenceStore doGetPreferenceStore() {
- return CSSUIPlugin.getDefault().getPreferenceStore();
- }
- /* (non-Javadoc)
- * @see org.eclipse.wst.sse.ui.preferences.ui.AbstractColorPage#savePreferences()
- */
- protected void savePreferences() {
- CSSUIPlugin.getDefault().savePluginPreferences();
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSContentAssistPreferencePage.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSContentAssistPreferencePage.java
deleted file mode 100644
index 0bf18afbc4..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSContentAssistPreferencePage.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.css.ui.internal.preferences.ui;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.wst.css.ui.internal.CSSUIPlugin;
-import org.eclipse.wst.sse.ui.internal.Logger;
-import org.eclipse.wst.sse.ui.internal.contentassist.CompletionProposoalCatigoriesConfigurationRegistry;
-import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage;
-import org.eclipse.wst.sse.ui.preferences.CodeAssistCyclingConfigurationBlock;
-import org.eclipse.wst.sse.ui.preferences.ICompletionProposalCategoriesConfigurationWriter;
-
-/**
- * <p>Defines the preference page for allowing the user to change the content
- * assist preferences</p>
- */
-public class CSSContentAssistPreferencePage extends AbstractPreferencePage implements
- IWorkbenchPreferencePage {
-
- private static final String CSS_CONTENT_TYPE_ID = "org.eclipse.wst.css.core.csssource"; //$NON-NLS-1$
-
- /** configuration block for changing preference having to do with the content assist categories */
- private CodeAssistCyclingConfigurationBlock fConfigurationBlock;
-
- /**
- * @see org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage#createContents(org.eclipse.swt.widgets.Composite)
- */
- protected Control createContents(Composite parent) {
- final Composite composite = super.createComposite(parent, 1);
-
- createContentsForCyclingGroup(composite);
-
- setSize(composite);
- loadPreferences();
-
- return composite;
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage#performDefaults()
- */
- protected void performDefaults() {
- performDefaultsForCyclingGroup();
-
- validateValues();
- enableValues();
-
- super.performDefaults();
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage#initializeValues()
- */
- protected void initializeValues() {
- initializeValuesForCyclingGroup();
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage#storeValues()
- */
- protected void storeValues() {
- storeValuesForCyclingGroup();
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore()
- */
- protected IPreferenceStore doGetPreferenceStore() {
- return CSSUIPlugin.getDefault().getPreferenceStore();
- }
-
- /**
- * <p>Create the contents for the content assist cycling preference group</p>
- * @param parent {@link Composite} parent of the group
- */
- private void createContentsForCyclingGroup(Composite parent) {
- ICompletionProposalCategoriesConfigurationWriter configurationWriter = CompletionProposoalCatigoriesConfigurationRegistry.getDefault().getWritableConfiguration(CSS_CONTENT_TYPE_ID);
-
- if(configurationWriter != null) {
- fConfigurationBlock = new CodeAssistCyclingConfigurationBlock(CSS_CONTENT_TYPE_ID, configurationWriter);
- fConfigurationBlock.createContents(parent, null); //$NON-NLS-1$
- } else {
- Logger.log(Logger.ERROR, "There should be an ICompletionProposalCategoriesConfigurationWriter" + //$NON-NLS-1$
- " specified for the CSS content type, but can't fine it, thus can't create user" + //$NON-NLS-1$
- " preference block for editing proposal categories preferences."); //$NON-NLS-1$
- }
- }
-
- /**
- * <p>Store the values for the cycling group</p>
- */
- private void storeValuesForCyclingGroup() {
- if (fConfigurationBlock != null) {
- fConfigurationBlock.storeValues();
- }
- }
-
- /**
- * <p>Initialize the values for the cycling group</p>
- */
- private void initializeValuesForCyclingGroup() {
- if(fConfigurationBlock != null) {
- fConfigurationBlock.initializeValues();
- }
- }
-
- /**
- * <p>Load the defaults of the cycling group</p>
- */
- private void performDefaultsForCyclingGroup() {
- if(fConfigurationBlock != null) {
- fConfigurationBlock.performDefaults();
- }
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSFilesPreferencePage.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSFilesPreferencePage.java
deleted file mode 100644
index 77cbe7f532..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSFilesPreferencePage.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.css.ui.internal.preferences.ui;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.wst.css.core.internal.CSSCorePlugin;
-import org.eclipse.wst.css.core.internal.provisional.contenttype.ContentTypeIdForCSS;
-import org.eclipse.wst.css.ui.internal.CSSUIPlugin;
-import org.eclipse.wst.css.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.xml.ui.internal.preferences.XMLFilesPreferencePage;
-
-public class CSSFilesPreferencePage extends XMLFilesPreferencePage {
- protected IPreferenceStore doGetPreferenceStore() {
- return CSSUIPlugin.getDefault().getPreferenceStore();
- }
-
- protected void doSavePreferenceStore() {
- CSSCorePlugin.getDefault().savePluginPreferences(); // model
- }
-
- protected Preferences getModelPreferences() {
- return CSSCorePlugin.getDefault().getPluginPreferences();
- }
-
- protected Control createContents(Composite parent) {
- Composite scrolledComposite = createScrolledComposite(parent);
- createContentsForCreatingGroup(scrolledComposite);
-
- PlatformUI.getWorkbench().getHelpSystem().setHelp(scrolledComposite, IHelpContextIds.CSS_PREFWEBX_FILES_HELPID);
-
- setSize(scrolledComposite);
- loadPreferences();
- return scrolledComposite;
- }
-
- protected IContentType getContentType() {
- return Platform.getContentTypeManager().getContentType(ContentTypeIdForCSS.ContentTypeID_CSS);
- }
-
- protected void initializeValues() {
- initializeValuesForCreatingGroup();
- }
-
- protected void performDefaults() {
- performDefaultsForCreatingGroup();
-
- updateApplyButton();
- }
-
- protected void storeValues() {
- storeValuesForCreatingGroup();
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSSourcePreferencePage.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSSourcePreferencePage.java
deleted file mode 100644
index c2ffddb01c..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSSourcePreferencePage.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.preferences.ui;
-
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.swt.SWT;
-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.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Spinner;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.PreferenceLinkArea;
-import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
-import org.eclipse.wst.css.core.internal.CSSCorePlugin;
-import org.eclipse.wst.css.core.internal.preferences.CSSCorePreferenceNames;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-import org.eclipse.wst.css.ui.internal.CSSUIPlugin;
-import org.eclipse.wst.css.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.sse.ui.internal.preferences.ui.AbstractPreferencePage;
-
-/**
- */
-public class CSSSourcePreferencePage extends AbstractPreferencePage {
- // Content Assist
- protected Button fAutoPropose;
- protected Label fAutoProposeLabel;
-
- protected Text fAutoProposeText;
- protected Button fClearAllBlankLines;
- protected Button fIdentLower;
- // case of output character
- // case of identifier
- protected Button fIdentUpper;
- private Spinner fIndentationSize;
- private Button fIndentUsingSpaces;
-
- private Button fIndentUsingTabs;
- // Formatting
- protected Label fLineWidthLabel;
-
- protected Text fLineWidthText;
- // prohibit wrapping if style attribute
- protected Button fNowrapAttr;
- // one property per one line
- protected Button fPropertyPerLine;
- protected Button fPropNameLower;
-
- // case of property name
- protected Button fPropNameUpper;
- protected Button fPropValueLower;
- // case of property value
- protected Button fPropValueUpper;
-
- // Selector case
- protected Button fSelectorUpper;
- protected Button fSelectorLower;
-
- protected Button fSplitMultiAttrs;
- private final int MAX_INDENTATION_SIZE = 16;
- private final int MIN_INDENTATION_SIZE = 0;
-
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
- */
- protected Control createContents(Composite parent) {
- final Composite composite = super.createComposite(parent, 1);
- PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.CSS_PREFWEBX_SOURCE_HELPID);
-
- new PreferenceLinkArea(composite, SWT.WRAP | SWT.MULTI, "org.eclipse.wst.sse.ui.preferences.editor", CSSUIMessages._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());
-
- createContentsForFormattingGroup(composite);
- createContentsForContentAssistGroup(composite);
- setSize(composite);
- loadPreferences();
-
- return composite;
- }
-
- private void createContentsForContentAssistGroup(Composite parent) {
- // not content assist, but preferred case
- Group caseGroup = createGroup(parent, 4);
- caseGroup.setText(CSSUIMessages.PrefsLabel_CaseGroup);
-
- // use group for radio buttons so that associated label is read
- Group identGroup = createGroup(caseGroup, 1);
- identGroup.setText(CSSUIMessages.PrefsLabel_CaseIdent);
- fIdentUpper = createRadioButton(identGroup, CSSUIMessages.PrefsLabel_CaseIdentUpper);
- fIdentLower = createRadioButton(identGroup, CSSUIMessages.PrefsLabel_CaseIdentLower);
-
- // use group for radio buttons so that associated label is read
- Group selectorGroup = createGroup(caseGroup, 1);
- selectorGroup.setText(CSSUIMessages.PrefsLabel_SelectorTagName);
- fSelectorUpper = createRadioButton(selectorGroup, CSSUIMessages.PrefsLabel_CaseIdentUpper);
- fSelectorLower = createRadioButton(selectorGroup, CSSUIMessages.PrefsLabel_CaseIdentLower);
-
- // use group for radio buttons so that associated label is read
- Group propNameGroup = createGroup(caseGroup, 1);
- propNameGroup.setText(CSSUIMessages.PrefsLabel_CasePropName);
- fPropNameUpper = createRadioButton(propNameGroup, CSSUIMessages.PrefsLabel_CasePropNameUpper);
- fPropNameLower = createRadioButton(propNameGroup, CSSUIMessages.PrefsLabel_CasePropNameLower);
-
- // use group for radio buttons so that associated label is read
- Group propValueGroup = createGroup(caseGroup, 1);
- propValueGroup.setText(CSSUIMessages.PrefsLabel_CasePropValue);
- fPropValueUpper = createRadioButton(propValueGroup, CSSUIMessages.PrefsLabel_CasePropValueUpper);
- fPropValueLower = createRadioButton(propValueGroup, CSSUIMessages.PrefsLabel_CasePropValueLower);
- }
-
- private void createContentsForFormattingGroup(Composite parent) {
- Group formattingGroup = createGroup(parent, 2);
- formattingGroup.setText(CSSUIMessages.Formatting_UI_);
-
- fLineWidthLabel = createLabel(formattingGroup, CSSUIMessages.Line_width__UI_);
- fLineWidthText = new Text(formattingGroup, SWT.SINGLE | SWT.BORDER);
- GridData gData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.BEGINNING);
- gData.widthHint = 25;
- fLineWidthText.setLayoutData(gData);
- fLineWidthText.addModifyListener(this);
-
- fPropertyPerLine = createCheckBox(formattingGroup, CSSUIMessages.PrefsLabel_WrappingInsertLineBreak);
- ((GridData) fPropertyPerLine.getLayoutData()).horizontalSpan = 2;
-
- fNowrapAttr = createCheckBox(formattingGroup, CSSUIMessages.PrefsLabel_WrappingWithoutAttr);
- ((GridData) fNowrapAttr.getLayoutData()).horizontalSpan = 2;
-
- // [269224] - Place the indent controls in their own composite for proper tab ordering
- Composite indentComposite = createComposite(formattingGroup, 1);
- ((GridData) indentComposite.getLayoutData()).horizontalSpan = 2;
- ((GridLayout) indentComposite.getLayout()).marginWidth = 0;
- ((GridLayout) indentComposite.getLayout()).marginHeight = 0;
-
- fIndentUsingTabs = createRadioButton(indentComposite, CSSUIMessages.Indent_using_tabs_);
- ((GridData) fIndentUsingTabs.getLayoutData()).horizontalSpan = 1;
- fIndentUsingSpaces = createRadioButton(indentComposite, CSSUIMessages.Indent_using_spaces);
- ((GridData) fIndentUsingSpaces.getLayoutData()).horizontalSpan = 1;
-
- createLabel(formattingGroup, CSSUIMessages.Indentation_size);
- fIndentationSize = new Spinner(formattingGroup, SWT.READ_ONLY | SWT.BORDER);
- GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
- fIndentationSize.setLayoutData(gd);
- fIndentationSize.setToolTipText(CSSUIMessages.Indentation_size_tip);
- fIndentationSize.setMinimum(MIN_INDENTATION_SIZE);
- fIndentationSize.setMaximum(MAX_INDENTATION_SIZE);
- fIndentationSize.setIncrement(1);
- fIndentationSize.setPageIncrement(4);
- fIndentationSize.addModifyListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore()
- */
- protected IPreferenceStore doGetPreferenceStore() {
- return CSSUIPlugin.getDefault().getPreferenceStore();
- }
-
- private void doSavePreferenceStore() {
- CSSUIPlugin.getDefault().savePluginPreferences();
- CSSCorePlugin.getDefault().savePluginPreferences(); // model
- }
-
- protected Preferences getModelPreferences() {
- return CSSCorePlugin.getDefault().getPluginPreferences();
- }
-
- protected void initializeValues() {
- initializeValuesForFormattingGroup();
- initializeValuesForContentAssistGroup();
- }
-
- private void initializeValuesForContentAssistGroup() {
- // not content assist, but preferred case
- Preferences prefs = getModelPreferences();
- fIdentUpper.setSelection(prefs.getInt(CSSCorePreferenceNames.CASE_IDENTIFIER) == CSSCorePreferenceNames.UPPER);
- fIdentLower.setSelection(prefs.getInt(CSSCorePreferenceNames.CASE_IDENTIFIER) == CSSCorePreferenceNames.LOWER);
- fSelectorUpper.setSelection(prefs.getInt(CSSCorePreferenceNames.CASE_SELECTOR) == CSSCorePreferenceNames.UPPER);
- fSelectorLower.setSelection(prefs.getInt(CSSCorePreferenceNames.CASE_SELECTOR) == CSSCorePreferenceNames.LOWER);
- fPropNameUpper.setSelection(prefs.getInt(CSSCorePreferenceNames.CASE_PROPERTY_NAME) == CSSCorePreferenceNames.UPPER);
- fPropNameLower.setSelection(prefs.getInt(CSSCorePreferenceNames.CASE_PROPERTY_NAME) == CSSCorePreferenceNames.LOWER);
- fPropValueUpper.setSelection(prefs.getInt(CSSCorePreferenceNames.CASE_PROPERTY_VALUE) == CSSCorePreferenceNames.UPPER);
- fPropValueLower.setSelection(prefs.getInt(CSSCorePreferenceNames.CASE_PROPERTY_VALUE) == CSSCorePreferenceNames.LOWER);
- }
-
- private void initializeValuesForFormattingGroup() {
- // Formatting
- Preferences prefs = getModelPreferences();
- fLineWidthText.setText(prefs.getString(CSSCorePreferenceNames.LINE_WIDTH));
- fPropertyPerLine.setSelection(prefs.getBoolean(CSSCorePreferenceNames.WRAPPING_ONE_PER_LINE));
- fNowrapAttr.setSelection(prefs.getBoolean(CSSCorePreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR));
-
- if (CSSCorePreferenceNames.TAB.equals(getModelPreferences().getString(CSSCorePreferenceNames.INDENTATION_CHAR))) {
- fIndentUsingTabs.setSelection(true);
- fIndentUsingSpaces.setSelection(false);
- } else {
- fIndentUsingSpaces.setSelection(true);
- fIndentUsingTabs.setSelection(false);
- }
-
- fIndentationSize.setSelection(getModelPreferences().getInt(CSSCorePreferenceNames.INDENTATION_SIZE));
- }
-
- protected void performDefaults() {
- performDefaultsForFormattingGroup();
- performDefaultsForContentAssistGroup();
-
- validateValues();
- enableValues();
-
- super.performDefaults();
- }
-
- private void performDefaultsForContentAssistGroup() {
- // not content assist, but preferred case
- Preferences prefs = getModelPreferences();
- fIdentUpper.setSelection(prefs.getDefaultInt(CSSCorePreferenceNames.CASE_IDENTIFIER) == CSSCorePreferenceNames.UPPER);
- fIdentLower.setSelection(prefs.getDefaultInt(CSSCorePreferenceNames.CASE_IDENTIFIER) == CSSCorePreferenceNames.LOWER);
- fSelectorUpper.setSelection(prefs.getDefaultInt(CSSCorePreferenceNames.CASE_SELECTOR) == CSSCorePreferenceNames.UPPER);
- fSelectorLower.setSelection(prefs.getDefaultInt(CSSCorePreferenceNames.CASE_SELECTOR) == CSSCorePreferenceNames.LOWER);
- fPropNameUpper.setSelection(prefs.getDefaultInt(CSSCorePreferenceNames.CASE_PROPERTY_NAME) == CSSCorePreferenceNames.UPPER);
- fPropNameLower.setSelection(prefs.getDefaultInt(CSSCorePreferenceNames.CASE_PROPERTY_NAME) == CSSCorePreferenceNames.LOWER);
- fPropValueUpper.setSelection(prefs.getDefaultInt(CSSCorePreferenceNames.CASE_PROPERTY_VALUE) == CSSCorePreferenceNames.UPPER);
- fPropValueLower.setSelection(prefs.getDefaultInt(CSSCorePreferenceNames.CASE_PROPERTY_VALUE) == CSSCorePreferenceNames.LOWER);
- }
-
- private void performDefaultsForFormattingGroup() {
- // Formatting
- Preferences prefs = getModelPreferences();
- fLineWidthText.setText(prefs.getDefaultString(CSSCorePreferenceNames.LINE_WIDTH));
- fPropertyPerLine.setSelection(prefs.getDefaultBoolean(CSSCorePreferenceNames.WRAPPING_ONE_PER_LINE));
- fNowrapAttr.setSelection(prefs.getDefaultBoolean(CSSCorePreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR));
-
- if (CSSCorePreferenceNames.TAB.equals(getModelPreferences().getDefaultString(CSSCorePreferenceNames.INDENTATION_CHAR))) {
- fIndentUsingTabs.setSelection(true);
- fIndentUsingSpaces.setSelection(false);
- } else {
- fIndentUsingSpaces.setSelection(true);
- fIndentUsingTabs.setSelection(false);
- }
- fIndentationSize.setSelection(getModelPreferences().getDefaultInt(CSSCorePreferenceNames.INDENTATION_SIZE));
- }
-
- public boolean performOk() {
- boolean result = super.performOk();
-
- doSavePreferenceStore();
-
- return result;
- }
-
- protected void storeValues() {
- storeValuesForFormattingGroup();
- storeValuesForContentAssistGroup();
- }
-
- private void storeValuesForContentAssistGroup() {
- // not content assist, but preferred case
- Preferences prefs = getModelPreferences();
- prefs.setValue(CSSCorePreferenceNames.CASE_IDENTIFIER, (fIdentUpper.getSelection()) ? CSSCorePreferenceNames.UPPER : CSSCorePreferenceNames.LOWER);
- prefs.setValue(CSSCorePreferenceNames.CASE_SELECTOR, (fSelectorUpper.getSelection()) ? CSSCorePreferenceNames.UPPER : CSSCorePreferenceNames.LOWER);
- prefs.setValue(CSSCorePreferenceNames.CASE_PROPERTY_NAME, (fPropNameUpper.getSelection()) ? CSSCorePreferenceNames.UPPER : CSSCorePreferenceNames.LOWER);
- prefs.setValue(CSSCorePreferenceNames.CASE_PROPERTY_VALUE, (fPropValueUpper.getSelection()) ? CSSCorePreferenceNames.UPPER : CSSCorePreferenceNames.LOWER);
- }
- private void storeValuesForFormattingGroup() {
- // Formatting
- Preferences prefs = getModelPreferences();
- prefs.setValue(CSSCorePreferenceNames.LINE_WIDTH, fLineWidthText.getText());
- prefs.setValue(CSSCorePreferenceNames.WRAPPING_ONE_PER_LINE, fPropertyPerLine.getSelection());
- prefs.setValue(CSSCorePreferenceNames.WRAPPING_PROHIBIT_WRAP_ON_ATTR, fNowrapAttr.getSelection());
-
- if (fIndentUsingTabs.getSelection()) {
- getModelPreferences().setValue(CSSCorePreferenceNames.INDENTATION_CHAR, CSSCorePreferenceNames.TAB);
- } else {
- getModelPreferences().setValue(CSSCorePreferenceNames.INDENTATION_CHAR, CSSCorePreferenceNames.SPACE);
- }
- getModelPreferences().setValue(CSSCorePreferenceNames.INDENTATION_SIZE, fIndentationSize.getSelection());
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSSyntaxColoringPage.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSSyntaxColoringPage.java
deleted file mode 100644
index c84099536b..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSSyntaxColoringPage.java
+++ /dev/null
@@ -1,902 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 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.css.ui.internal.preferences.ui;
-
-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.css.core.internal.parserz.CSSRegionContexts;
-import org.eclipse.wst.css.core.internal.provisional.contenttype.ContentTypeIdForCSS;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-import org.eclipse.wst.css.ui.internal.CSSUIPlugin;
-import org.eclipse.wst.css.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.css.ui.internal.style.IStyleConstantsCSS;
-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 CSSSyntaxColoringPage 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.CSS_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, CSSUIMessages.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, "");
- Button enabler = createCheckbox(editingComposite, CSSUIMessages.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, CSSUIMessages.SyntaxColoringPage_3);
- fBold.setEnabled(false);
- ((GridData) fBold.getLayoutData()).horizontalSpan = 2;
- fItalic = createCheckbox(editControls, CSSUIMessages.SyntaxColoringPage_4);
- fItalic.setEnabled(false);
- ((GridData) fItalic.getLayoutData()).horizontalSpan = 2;
- fStrike = createCheckbox(editControls, CSSUIMessages.SyntaxColoringPage_5);
- fStrike.setEnabled(false);
- ((GridData) fStrike.getLayoutData()).horizontalSpan = 2;
- fUnderline = createCheckbox(editControls, CSSUIMessages.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"));
- fText.addKeyListener(getTextKeyListener());
- fText.addSelectionListener(getTextSelectionListener());
- fText.addMouseListener(getTextMouseListener());
- fText.addTraverseListener(getTraverseListener());
- setAccessible(fText, SSEUIMessages.Sample_text__UI_);
- fDocument = StructuredModelManager.getModelManager().createStructuredDocumentFor(ContentTypeIdForCSS.ContentTypeID_CSS);
- fDocument.set(getExampleText());
- viewer.setDocument(fDocument);
-
- top.setWeights(new int[]{1, 1});
- editor.setWeights(new int[]{1, 1});
- PlatformUI.getWorkbench().getHelpSystem().setHelp(pageComponent, IHelpContextIds.CSS_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 CSSUIPlugin.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 CSSUIMessages.PrefsLabel_ColorSample;
- }
-
- 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(IStyleConstantsCSS.NORMAL);
- styles.add(IStyleConstantsCSS.ATMARK_RULE);
- styles.add(IStyleConstantsCSS.SELECTOR);
- styles.add(IStyleConstantsCSS.UNIVERSAL);
- styles.add(IStyleConstantsCSS.COMBINATOR);
- styles.add(IStyleConstantsCSS.SELECTOR_CLASS);
- styles.add(IStyleConstantsCSS.ID);
- styles.add(IStyleConstantsCSS.PSEUDO);
- styles.add(IStyleConstantsCSS.ATTRIBUTE_DELIM);
- styles.add(IStyleConstantsCSS.ATTRIBUTE_NAME);
- styles.add(IStyleConstantsCSS.ATTRIBUTE_OPERATOR);
- styles.add(IStyleConstantsCSS.ATTRIBUTE_VALUE);
- styles.add(IStyleConstantsCSS.MEDIA);
- styles.add(IStyleConstantsCSS.COMMENT);
- styles.add(IStyleConstantsCSS.PROPERTY_NAME);
- styles.add(IStyleConstantsCSS.PROPERTY_VALUE);
- styles.add(IStyleConstantsCSS.URI);
- styles.add(IStyleConstantsCSS.STRING);
- styles.add(IStyleConstantsCSS.COLON);
- styles.add(IStyleConstantsCSS.SEMI_COLON);
- styles.add(IStyleConstantsCSS.CURLY_BRACE);
- styles.add(IStyleConstantsCSS.ERROR);
- 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(CSSRegionContexts.CSS_COMMENT, IStyleConstantsCSS.COMMENT);
- fContextToStyleMap.put(CSSRegionContexts.CSS_CDO, IStyleConstantsCSS.COMMENT);
- fContextToStyleMap.put(CSSRegionContexts.CSS_CDC, IStyleConstantsCSS.COMMENT);
- fContextToStyleMap.put(CSSRegionContexts.CSS_S, IStyleConstantsCSS.NORMAL);
-
- fContextToStyleMap.put(CSSRegionContexts.CSS_DELIMITER, IStyleConstantsCSS.SEMI_COLON);
- fContextToStyleMap.put(CSSRegionContexts.CSS_LBRACE, IStyleConstantsCSS.CURLY_BRACE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_RBRACE, IStyleConstantsCSS.CURLY_BRACE);
-
- fContextToStyleMap.put(CSSRegionContexts.CSS_IMPORT, IStyleConstantsCSS.ATMARK_RULE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_PAGE, IStyleConstantsCSS.ATMARK_RULE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_MEDIA, IStyleConstantsCSS.ATMARK_RULE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_FONT_FACE, IStyleConstantsCSS.ATMARK_RULE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_CHARSET, IStyleConstantsCSS.ATMARK_RULE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_ATKEYWORD, IStyleConstantsCSS.ATMARK_RULE);
-
- fContextToStyleMap.put(CSSRegionContexts.CSS_STRING, IStyleConstantsCSS.STRING);
- fContextToStyleMap.put(CSSRegionContexts.CSS_URI, IStyleConstantsCSS.URI);
- fContextToStyleMap.put(CSSRegionContexts.CSS_MEDIUM, IStyleConstantsCSS.MEDIA);
- fContextToStyleMap.put(CSSRegionContexts.CSS_MEDIA_SEPARATOR, IStyleConstantsCSS.MEDIA);
-
- fContextToStyleMap.put(CSSRegionContexts.CSS_CHARSET_NAME, IStyleConstantsCSS.STRING);
-
- fContextToStyleMap.put(CSSRegionContexts.CSS_PAGE_SELECTOR, IStyleConstantsCSS.MEDIA);
-
- fContextToStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ELEMENT_NAME, IStyleConstantsCSS.SELECTOR);
- fContextToStyleMap.put(CSSRegionContexts.CSS_SELECTOR_UNIVERSAL, IStyleConstantsCSS.UNIVERSAL);
-
- fContextToStyleMap.put(CSSRegionContexts.CSS_SELECTOR_PSEUDO, IStyleConstantsCSS.PSEUDO);
- fContextToStyleMap.put(CSSRegionContexts.CSS_SELECTOR_CLASS, IStyleConstantsCSS.SELECTOR_CLASS);
- fContextToStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ID, IStyleConstantsCSS.ID);
-
- fContextToStyleMap.put(CSSRegionContexts.CSS_SELECTOR_COMBINATOR, IStyleConstantsCSS.COMBINATOR);
- fContextToStyleMap.put(CSSRegionContexts.CSS_SELECTOR_SEPARATOR, IStyleConstantsCSS.SELECTOR);
-
- /* Attribute selector */
- fContextToStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_START, IStyleConstantsCSS.ATTRIBUTE_DELIM);
- fContextToStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_END, IStyleConstantsCSS.ATTRIBUTE_DELIM);
- fContextToStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_NAME, IStyleConstantsCSS.ATTRIBUTE_NAME);
- fContextToStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_VALUE, IStyleConstantsCSS.ATTRIBUTE_VALUE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_OPERATOR, IStyleConstantsCSS.ATTRIBUTE_OPERATOR);
-
- fContextToStyleMap.put(CSSRegionContexts.CSS_DECLARATION_PROPERTY, IStyleConstantsCSS.PROPERTY_NAME);
- fContextToStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT, IStyleConstantsCSS.PROPERTY_VALUE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_DIMENSION, IStyleConstantsCSS.PROPERTY_VALUE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE, IStyleConstantsCSS.PROPERTY_VALUE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER, IStyleConstantsCSS.PROPERTY_VALUE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION, IStyleConstantsCSS.PROPERTY_VALUE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE, IStyleConstantsCSS.PROPERTY_VALUE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_STRING, IStyleConstantsCSS.PROPERTY_VALUE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_URI, IStyleConstantsCSS.PROPERTY_VALUE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_HASH, IStyleConstantsCSS.PROPERTY_VALUE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_UNICODE_RANGE, IStyleConstantsCSS.PROPERTY_VALUE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_IMPORTANT, IStyleConstantsCSS.PROPERTY_VALUE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR, IStyleConstantsCSS.PROPERTY_VALUE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_DECLARATION_VALUE_S, IStyleConstantsCSS.PROPERTY_VALUE);
- fContextToStyleMap.put(CSSRegionContexts.CSS_DECLARATION_SEPARATOR, IStyleConstantsCSS.COLON);
- fContextToStyleMap.put(CSSRegionContexts.CSS_DECLARATION_DELIMITER, IStyleConstantsCSS.SEMI_COLON);
-
- fContextToStyleMap.put(CSSRegionContexts.CSS_UNKNOWN, IStyleConstantsCSS.ERROR);
- }
-
- private void initStyleToDescriptionMap() {
- fStyleToDescriptionMap.put(IStyleConstantsCSS.NORMAL, CSSUIMessages.PrefsLabel_ColorNormal);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.ATMARK_RULE, CSSUIMessages.PrefsLabel_ColorAtmarkRule);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.SELECTOR, CSSUIMessages.PrefsLabel_ColorSelector);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.COMBINATOR, CSSUIMessages.PrefsLabel_ColorCombinator);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.UNIVERSAL, CSSUIMessages.PrefsLabel_ColorUniversal);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.ID, CSSUIMessages.PrefsLabel_ColorId);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.PSEUDO, CSSUIMessages.PrefsLabel_ColorPseudoClass);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.SELECTOR_CLASS, CSSUIMessages.PrefsLabel_ColorClass);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.ATTRIBUTE_DELIM, CSSUIMessages.PrefsLabel_ColorAttrDelimiter);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.ATTRIBUTE_NAME, CSSUIMessages.PrefsLabel_ColorAttrName);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.ATTRIBUTE_OPERATOR, CSSUIMessages.PrefsLabel_ColorAttrOperator);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.ATTRIBUTE_VALUE, CSSUIMessages.PrefsLabel_ColorAttrValue);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.MEDIA, CSSUIMessages.PrefsLabel_ColorMedia);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.COMMENT, CSSUIMessages.PrefsLabel_ColorComment);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.PROPERTY_NAME, CSSUIMessages.PrefsLabel_ColorPropertyName);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.PROPERTY_VALUE, CSSUIMessages.PrefsLabel_ColorPropertyValue);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.URI, CSSUIMessages.PrefsLabel_ColorUri);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.STRING, CSSUIMessages.PrefsLabel_ColorString);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.COLON, CSSUIMessages.PrefsLabel_ColorColon);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.SEMI_COLON, CSSUIMessages.PrefsLabel_ColorSemiColon);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.CURLY_BRACE, CSSUIMessages.PrefsLabel_ColorCurlyBrace);//$NON-NLS-1$
- fStyleToDescriptionMap.put(IStyleConstantsCSS.ERROR, CSSUIMessages.PrefsLabel_ColorError);//$NON-NLS-1$
- }
-
- protected void performDefaults() {
- super.performDefaults();
- getOverlayStore().loadDefaults();
- applyStyles();
- fStylesViewer.setSelection(StructuredSelection.EMPTY);
- activate(null);
- fText.redraw();
- }
-
- public boolean performOk() {
- getOverlayStore().propagate();
-
- CSSUIPlugin.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.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSTemplatePreferencePage.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSTemplatePreferencePage.java
deleted file mode 100644
index baf7fd66c3..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/preferences/ui/CSSTemplatePreferencePage.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.preferences.ui;
-
-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.css.core.internal.provisional.contenttype.ContentTypeIdForCSS;
-import org.eclipse.wst.css.ui.StructuredTextViewerConfigurationCSS;
-import org.eclipse.wst.css.ui.internal.CSSUIPlugin;
-import org.eclipse.wst.css.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 CSS templates
- */
-public class CSSTemplatePreferencePage extends TemplatePreferencePage {
-
- class CSSEditTemplateDialog extends EditTemplateDialog {
- public CSSEditTemplateDialog(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 StructuredTextViewerConfigurationCSS();
-
- 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 CSSTemplatePreferencePage() {
- CSSUIPlugin cssUIPlugin = CSSUIPlugin.getDefault();
-
- setPreferenceStore(cssUIPlugin.getPreferenceStore());
- setTemplateStore(cssUIPlugin.getTemplateStore());
- setContextTypeRegistry(cssUIPlugin.getTemplateContextRegistry());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.preference.IPreferencePage#performOk()
- */
- public boolean performOk() {
- boolean ok = super.performOk();
- CSSUIPlugin.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.CSS_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 StructuredTextViewerConfigurationCSS();
-
- 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 = ContentTypeIdForCSS.ContentTypeID_CSS;
- viewer = new StructuredTextViewer(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
- 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 CSSEditTemplateDialog(getShell(), template, edit, isNameModifiable, getContextTypeRegistry());
- if (dialog.open() == Window.OK) {
- return dialog.getTemplate();
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/projection/CSSFoldingStrategy.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/projection/CSSFoldingStrategy.java
deleted file mode 100644
index 03037e0771..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/projection/CSSFoldingStrategy.java
+++ /dev/null
@@ -1,88 +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.css.ui.internal.projection;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.text.Position;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.internal.projection.AbstractStructuredFoldingStrategy;
-
-/**
- * A folding strategy for CSS structured documents.
- * See AbstractStructuredFoldingStrategy for more details.
- */
-public class CSSFoldingStrategy extends AbstractStructuredFoldingStrategy {
-
- /**
- * Create an instance of the folding strategy.
- * Be sure to set the viewer and document after creation.
- */
- public CSSFoldingStrategy() {
- 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) {
- newPos = new CSSRuleFoldingPosition(indexedRegion);
- }
- return newPos;
- }
-
- /**
- * The same as the AbstractFoldingStrategy implementation except for the new position is
- * calculated on the given IndexRegion and not the annotations stored IndexedRegion because
- * of the way CSS regions are replaced when they are updated.
- *
- * (non-Javadoc)
- * @see org.eclipse.wst.sse.ui.internal.projection.AbstractStructuredFoldingStrategy#updateAnnotations(java.util.Iterator, org.eclipse.wst.sse.core.internal.provisional.IndexedRegion, java.util.List, java.util.List)
- */
- protected void updateAnnotations(Iterator existingAnnotationsIter, IndexedRegion dirtyRegion,
- List modifications, List deletions) {
-
- while(existingAnnotationsIter.hasNext()) {
- Object obj = existingAnnotationsIter.next();
- if(obj instanceof FoldingAnnotation) {
- FoldingAnnotation annotation = (FoldingAnnotation)obj;
-
- //NOTE can not use the annotations stored region because the CSSStructuredDocument
- // replaces the old region with a new one when it is modified
- Position newPos = calcNewFoldPosition(annotation.getRegion());
- if(newPos != null) {
- Position oldPos = fProjectionAnnotationModel.getPosition(annotation);
- if(!newPos.equals(oldPos)) {
- oldPos.setOffset(newPos.offset);
- oldPos.setLength(newPos.length);
- modifications.add(annotation);
- }
- } else {
- deletions.add(annotation);
- }
- }
- }
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.internal.projection.AbstractFoldingStrategy#indexedRegionValidType(org.eclipse.wst.sse.core.internal.provisional.IndexedRegion)
- */
- protected boolean indexedRegionValidType(IndexedRegion indexedRegion) {
- return (indexedRegion instanceof ICSSStyleRule);
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/projection/CSSRuleFoldingPosition.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/projection/CSSRuleFoldingPosition.java
deleted file mode 100644
index dfc0984437..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/projection/CSSRuleFoldingPosition.java
+++ /dev/null
@@ -1,61 +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.css.ui.internal.projection;
-
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.internal.projection.AbstractStructuredFoldingPosition;
-import org.w3c.dom.css.CSSStyleRule;
-
-/**
- * An {@link AbstractStructuredFoldingPosition} used to cover CSS regions
- */
-public class CSSRuleFoldingPosition extends AbstractStructuredFoldingPosition {
-
- /**
- * the region that will be folded
- */
- private IndexedRegion fRegion;
-
- /**
- * Creates a folding position that covers {@link IndexedRegion}s
- * in a CSS document
- *
- * @param region the {@link IndexedRegion} that this folding position covers
- */
- public CSSRuleFoldingPosition(IndexedRegion region) {
- super(region.getStartOffset(), region.getLength());
- this.fRegion = region;
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.internal.projection.AbstractStructuredFoldingPosition#getStartOffset()
- */
- protected int getStartOffset() {
- int startOffset = fRegion.getStartOffset();
-
- //so that multi-line CSS selector text does not get folded
- if(this.fRegion instanceof CSSStyleRule) {
- CSSStyleRule rule = (CSSStyleRule)this.fRegion;
- startOffset += rule.getSelectorText().length();
- }
-
- return startOffset;
- }
-
- /**
- * @see org.eclipse.wst.sse.ui.internal.projection.AbstractStructuredFoldingPosition#getEndOffset()
- */
- protected int getEndOffset() {
- return fRegion.getEndOffset();
- }
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/properties/CSSPropertySource.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/properties/CSSPropertySource.java
deleted file mode 100644
index 5060e8bd41..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/properties/CSSPropertySource.java
+++ /dev/null
@@ -1,355 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.properties;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.wst.css.core.internal.metamodel.CSSMMCategory;
-import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode;
-import org.eclipse.wst.css.core.internal.metamodel.CSSMetaModel;
-import org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelFinder;
-import org.eclipse.wst.css.core.internal.metamodel.util.CSSMetaModelUtil;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNodeList;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclItem;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-import org.eclipse.wst.sse.ui.views.properties.IPropertySourceExtension;
-import org.w3c.dom.css.CSSStyleDeclaration;
-
-/**
- * A IPropertySource implementation for a JFace viewer used to display
- * properties of CSS nodes.
- */
-public class CSSPropertySource implements IPropertySource, IPropertySourceExtension {
- protected ICSSNode fNode = null;
- // for performance...
- final static Class ADAPTER_KEY = IPropertySource.class;
- final boolean PERF_GETDESCRIPTORS = false;
- private long time0;
-
- public CSSPropertySource(ICSSNode target) {
- super();
- fNode = target;
- }
-
- protected IPropertyDescriptor createDefaultPropertyDescriptor(String attributeName) {
- // the displayName MUST be set
- IPropertyDescriptor descriptor = new CSSTextPropertyDescriptor(attributeName, attributeName, fNode);
- // IPropertyDescriptor descriptor = new
- // TextPropertyDescriptor(attributeName, attributeName);
- return descriptor;
- }
-
- protected IPropertyDescriptor createPropertyDescriptor(CSSMMNode node, String category) {
- return createPropertyDescriptor(node.getName(), category);
- }
-
- protected IPropertyDescriptor createPropertyDescriptor(String name, String category) {
- IPropertyDescriptor descriptor = null;
- if (name != null && 0 < name.length()) {
- name = name.toLowerCase();
- if (category == null) {
- category = CSSUIMessages.INFO_Not_Categorized_1; //$NON-NLS-1$
- }
- descriptor = new CSSTextPropertyDescriptor(name, name, fNode, category);
- // if (category == null) {
- // descriptor = new CSSTextPropertyDescriptor(name, name, fNode);
- // } else {
- // descriptor = new CSSTextPropertyDescriptor(name, name, fNode,
- // category);
- // }
- }
- return descriptor;
- }
-
- /**
- * Returns a value for this object 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 a vector containing all descriptors.
- */
- public IPropertyDescriptor[] getPropertyDescriptors() {
- time0 = System.currentTimeMillis();
-
- CSSMetaModel metamodel = CSSMetaModelFinder.getInstance().findMetaModelFor(fNode);
- Iterator iProperties = Collections.EMPTY_LIST.iterator();
- switch (fNode.getNodeType()) {
- case ICSSNode.STYLERULE_NODE :
- case ICSSNode.FONTFACERULE_NODE :
- case ICSSNode.PAGERULE_NODE :
- case ICSSNode.STYLEDECLARATION_NODE :
- CSSMMNode mmParent = new CSSMetaModelUtil(metamodel).getMetaModelNodeFor(fNode);
- if (mmParent != null) {
- iProperties = mmParent.getChildNodes();
- }
- break;
- case ICSSNode.STYLEDECLITEM_NODE :
- CSSMMNode mmNode = new CSSMetaModelUtil(metamodel).getMetaModelNodeFor(fNode);
- if (mmNode != null) {
- iProperties = Collections.singletonList(mmNode).iterator();
- }
- break;
- default :
- break;
- }
-
- // setup categories
- Map categories = new HashMap();
- Iterator iCategories = metamodel.getCategories();
- while (iCategories.hasNext()) {
- CSSMMCategory category = (CSSMMCategory) iCategories.next();
- categories.put(category.getName(), category.getCaption());
- }
-
- // collect property names
- Set declaredProperties = new HashSet();
- if (iProperties.hasNext()) {
- CSSStyleDeclaration declaration = getDeclarationNode();
- if (declaration != null) {
- ICSSNodeList nodeList = ((ICSSNode) declaration).getChildNodes();
- int nProps = (nodeList != null) ? nodeList.getLength() : 0;
- for (int i = 0; i < nProps; i++) {
- ICSSNode node = nodeList.item(i);
- if (node instanceof ICSSStyleDeclItem) {
- String name = ((ICSSStyleDeclItem) node).getPropertyName();
- if (name != null && 0 < name.length()) {
- declaredProperties.add(name.toLowerCase());
- }
- }
- }
- }
- }
-
- List descriptors = new ArrayList();
-
- // first: properties from content model
- while (iProperties.hasNext()) {
- CSSMMNode node = (CSSMMNode) iProperties.next();
- if (node.getType() == CSSMMNode.TYPE_PROPERTY || node.getType() == CSSMMNode.TYPE_DESCRIPTOR) {
- String category = (String) categories.get(node.getAttribute("category")); //$NON-NLS-1$
- String name = node.getName().toLowerCase();
- if (declaredProperties.contains(name)) {
- declaredProperties.remove(name);
- }
- IPropertyDescriptor descriptor = createPropertyDescriptor(name, category);
- if (descriptor != null) {
- descriptors.add(descriptor);
- }
- }
- }
-
- // second: existing properties but not in content model
- Iterator iRemains = declaredProperties.iterator();
- while (iRemains.hasNext()) {
- IPropertyDescriptor descriptor = createPropertyDescriptor((String) iRemains.next(), null);
- if (descriptor != null) {
- descriptors.add(descriptor);
- }
- }
-
- IPropertyDescriptor[] resultArray = new IPropertyDescriptor[descriptors.size()];
- if (PERF_GETDESCRIPTORS) {
- System.out.println(getClass().getName() + ".getPropertyDescriptors: " + (System.currentTimeMillis() - time0) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return (IPropertyDescriptor[]) descriptors.toArray(resultArray);
- }
-
- /**
- * Returns the current value for the named property.
- *
- * @param name
- * the name of the property as named by its property descriptor
- * @return the current value of the property
- */
- public Object getPropertyValue(Object name) {
- if (name == null) {
- return ""; //$NON-NLS-1$
- }
-
- String valueString = null;
- String nameString = name.toString();
-
- CSSStyleDeclaration declaration = null;
-
- switch (fNode.getNodeType()) {
- case ICSSNode.STYLEDECLITEM_NODE :
- valueString = ((ICSSStyleDeclItem) fNode).getCSSValueText();
- break;
- case ICSSNode.STYLERULE_NODE :
- case ICSSNode.FONTFACERULE_NODE :
- case ICSSNode.PAGERULE_NODE :
- declaration = (CSSStyleDeclaration) fNode.getFirstChild();
- if (declaration != null) {
- valueString = declaration.getPropertyValue(nameString);
- }
- break;
- case ICSSNode.STYLEDECLARATION_NODE :
- valueString = ((CSSStyleDeclaration) fNode).getPropertyValue(nameString);
- break;
- case ICSSNode.PRIMITIVEVALUE_NODE :
- ICSSNode parent = fNode;
- while (parent != null && !(parent instanceof ICSSStyleDeclItem)) {
- parent = parent.getParentNode();
- }
- if (parent != null) {
- valueString = ((ICSSStyleDeclItem) parent).getCSSValueText();
- }
- break;
- default :
- break;
- }
-
- if (valueString == null) {
- valueString = ""; //$NON-NLS-1$
- }
-
- return valueString;
- }
-
- /**
- * Returns whether the property value has changed from the default.
- *
- * @return <code>true</code> if the value of the specified property has
- * changed from its original default value; <code>false</code>
- * otherwise.
- */
- public boolean isPropertySet(Object property) {
- if (property == null) {
- return false;
- }
- CSSStyleDeclaration declaration = getDeclarationNode();
- if (declaration != null) {
- String value = declaration.getPropertyValue(property.toString());
- if (value != null && 0 < value.length()) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Resets the specified property's value to its default value.
- *
- * @param property
- * the property to reset
- */
- public void resetPropertyValue(Object str) {
- if (str == null) {
- return;
- }
- CSSStyleDeclaration declaration = getDeclarationNode();
- if (declaration != null) {
- declaration.removeProperty(str.toString());
- }
- }
-
- /**
- * Sets the named property to the given value.
- *
- * @param name
- * the name of the property being set
- * @param value
- * the new value for the property
- */
- public void setPropertyValue(Object name, Object value) {
- if (name == null) {
- return;
- }
- String valueString = (value != null) ? value.toString() : null;
- String nameString = name.toString();
- CSSStyleDeclaration declaration = getDeclarationNode();
- if (declaration != null) {
- try {
- if (valueString == null || valueString.length() <= 0) {
- declaration.removeProperty(nameString);
- }
- else {
- declaration.setProperty(nameString, valueString, ""); //$NON-NLS-1$
- }
- }
- catch (Exception e) {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- String title = CSSUIMessages.Title_InvalidValue; //$NON-NLS-1$
- String message = CSSUIMessages.Message_InvalidValue; //$NON-NLS-1$
- MessageDialog.openWarning(window.getShell(), title, message);
- }
- }
- }
-
- private CSSStyleDeclaration getDeclarationNode() {
- CSSStyleDeclaration declaration = null;
-
- switch (fNode.getNodeType()) {
- case ICSSNode.STYLEDECLITEM_NODE :
- declaration = (CSSStyleDeclaration) fNode.getParentNode();
- break;
- case ICSSNode.STYLERULE_NODE :
- case ICSSNode.FONTFACERULE_NODE :
- case ICSSNode.PAGERULE_NODE :
- declaration = (CSSStyleDeclaration) fNode.getFirstChild();
- break;
- case ICSSNode.STYLEDECLARATION_NODE :
- declaration = (CSSStyleDeclaration) fNode;
- break;
- case ICSSNode.PRIMITIVEVALUE_NODE :
- ICSSNode parent = fNode;
- while (parent != null && !(parent instanceof CSSStyleDeclaration)) {
- parent = parent.getParentNode();
- }
- if (parent != null) {
- declaration = (CSSStyleDeclaration) parent;
- }
- break;
- default :
- break;
- }
-
- return declaration;
- }
-
- // Bug 130039 - Implement IPropertySourceExtension
-
- public boolean isPropertyRemovable(Object name) {
- return true;
- }
-
- public void removeProperty(Object name) {
- if(name == null)
- return;
-
- CSSStyleDeclaration declaration = getDeclarationNode();
-
- if(declaration != null)
- declaration.removeProperty(name.toString());
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/properties/CSSTextPropertyDescriptor.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/properties/CSSTextPropertyDescriptor.java
deleted file mode 100644
index 77c27a98f8..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/properties/CSSTextPropertyDescriptor.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.css.ui.internal.properties;
-
-
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.core.internal.util.CSSPathService;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-
-/**
- */
-public class CSSTextPropertyDescriptor extends TextPropertyDescriptor {
- private final ICSSNode fNode;
-
- /**
- * CSSTextPropertyDescriptor constructor comment.
- *
- * @param id
- * java.lang.String
- * @param displayName
- * java.lang.String
- */
- public CSSTextPropertyDescriptor(String id, String displayName, ICSSNode node) {
- super(id, displayName);
- this.fNode = node;
- }
-
- public CSSTextPropertyDescriptor(String id, String displayName, ICSSNode node, String category) {
- super(id, displayName);
- this.fNode = node;
- setCategory(category);
- }
-
- /**
- * @return org.eclipse.jface.viewers.CellEditor
- * @param parent
- * org.eclipse.swt.widgets.Composite
- */
- public CellEditor createPropertyEditor(Composite parent) {
- ICSSModel model = fNode.getOwnerDocument().getModel();
- if (model == null)
- return null;
- if (model.getStyleSheetType() == ICSSModel.EXTERNAL && findEditor(model) == null)
- return null;
- // check whether IFile is readonly to prohibit editing before
- // validateEdit()
- IStructuredModel structuredModel = model;
- if (model.getStyleSheetType() != ICSSModel.EXTERNAL) {
- structuredModel = ((IDOMNode) model.getOwnerDOMNode()).getModel();
- if (structuredModel == null)
- return null;
- }
- IFile file = CSSPathService.location2File(structuredModel.getBaseLocation());
- if (file == null || file.isReadOnly())
- return null;
-
- return super.createPropertyEditor(parent);
- }
-
- private static IEditorPart findEditor(ICSSModel model) {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
- for (int i = 0; i < windows.length; i++) {
- IWorkbenchPage[] pages = windows[i].getPages();
- for (int j = 0; j < pages.length; j++) {
- IEditorReference[] editors = pages[j].getEditorReferences();
- for (int k = 0; k < editors.length; k++) {
- IEditorPart editPart = editors[k].getEditor(false);
- if (editPart != null) {
- IEditorInput editorInput = editPart.getEditorInput();
- if (editorInput instanceof IFileEditorInput) {
- IFile file = ((IFileEditorInput) editorInput).getFile();
- if (file != null) {
- //TODO Urgent needs to be fixed
- // I think we need 'equals' (or 'equivalent'
- // on model) for cases like this
- if (StructuredModelManager.getModelManager().calculateId(file).equals(model.getId())) {
- return editPart;
- }
- }
- }
- }
- }
- }
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/registry/AdapterFactoryProviderCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/registry/AdapterFactoryProviderCSS.java
deleted file mode 100644
index 717dcb529a..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/registry/AdapterFactoryProviderCSS.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.registry;
-
-import org.eclipse.wst.css.core.internal.modelhandler.ModelHandlerForCSS;
-import org.eclipse.wst.css.ui.internal.contentoutline.JFaceNodeAdapterFactoryCSS;
-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.INodeAdapterFactory;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.ui.internal.contentoutline.IJFaceNodeAdapter;
-import org.eclipse.wst.sse.ui.internal.provisional.registry.AdapterFactoryProvider;
-import org.eclipse.wst.sse.ui.internal.util.Assert;
-
-public class AdapterFactoryProviderCSS implements AdapterFactoryProvider {
- public boolean isFor(IDocumentTypeHandler contentTypeDescription) {
- return (contentTypeDescription instanceof ModelHandlerForCSS);
- }
-
- public void addAdapterFactories(IStructuredModel structuredModel) {
- // add the normal content based factories to model's registry
- addContentBasedFactories(structuredModel);
- }
-
- protected void addContentBasedFactories(IStructuredModel structuredModel) {
- FactoryRegistry factoryRegistry = structuredModel.getFactoryRegistry();
- Assert.isNotNull(factoryRegistry, "Program Error: client caller must ensure model has factory registry"); //$NON-NLS-1$
- INodeAdapterFactory factory = null;
-
- factory = factoryRegistry.getFactoryFor(IJFaceNodeAdapter.class);
- if (factory == null) {
- factory = new JFaceNodeAdapterFactoryCSS(IJFaceNodeAdapter.class, true);
- factoryRegistry.addFactory(factory);
- }
- }
-
- public void reinitializeFactories(IStructuredModel structuredModel) {
-
- }
-
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectEnclosingCSSActionDelegate.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectEnclosingCSSActionDelegate.java
deleted file mode 100644
index fa1a72016d..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectEnclosingCSSActionDelegate.java
+++ /dev/null
@@ -1,64 +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.css.ui.internal.selection;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.Region;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.internal.selection.StructuredSelectActionDelegate;
-
-/**
- * Selects enclosing CSS element
- */
-public class StructuredSelectEnclosingCSSActionDelegate extends StructuredSelectActionDelegate {
- public void init(IAction action) {
- if (action != null) {
- action.setText(CSSUIMessages.StructureSelectEnclosing_label);
- action.setToolTipText(CSSUIMessages.StructureSelectEnclosing_tooltip);
- action.setDescription(CSSUIMessages.StructureSelectEnclosing_description);
- }
- }
-
- protected IndexedRegion getCursorIndexedRegion(IDocument document, ITextSelection textSelection) {
- IndexedRegion indexedRegion = null;
-
- indexedRegion = getIndexedRegion(document, textSelection.getOffset());
-
- return indexedRegion;
- }
-
- protected Region getNewSelectionRegion(IndexedRegion indexedRegion, ITextSelection textSelection) {
- Region newRegion = null;
- if (indexedRegion instanceof ICSSNode) {
- ICSSNode cursorNode = (ICSSNode) indexedRegion;
- Region cursorNodeRegion = new Region(indexedRegion.getStartOffset(), indexedRegion.getEndOffset() - indexedRegion.getStartOffset());
- int currentOffset = textSelection.getOffset();
- int currentEndOffset = currentOffset + textSelection.getLength();
- if (cursorNodeRegion.getOffset() >= currentOffset && cursorNodeRegion.getOffset() <= currentEndOffset && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() >= currentOffset && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() <= currentEndOffset) {
- ICSSNode newNode = cursorNode.getParentNode();
-
- if (newNode instanceof IndexedRegion) {
- IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
- newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
- }
- }
- else
- newRegion = cursorNodeRegion;
- }
- return newRegion;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectNextCSSActionDelegate.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectNextCSSActionDelegate.java
deleted file mode 100644
index de122ab198..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectNextCSSActionDelegate.java
+++ /dev/null
@@ -1,81 +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.css.ui.internal.selection;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.Region;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.internal.selection.StructuredSelectActionDelegate;
-
-/**
- * Selects next CSS element
- */
-public class StructuredSelectNextCSSActionDelegate extends StructuredSelectActionDelegate {
-
- protected IndexedRegion getCursorIndexedRegion(IDocument document, ITextSelection textSelection) {
- int offset = textSelection.getOffset() + textSelection.getLength() - 1;
- if (offset < 0)
- offset = 0;
-
- IndexedRegion indexedRegion = null;
-
- indexedRegion = getIndexedRegion(document, offset);
-
- return indexedRegion;
- }
-
- protected Region getNewSelectionRegion(IndexedRegion indexedRegion, ITextSelection textSelection) {
- Region newRegion = null;
-
- if (indexedRegion instanceof ICSSNode) {
- ICSSNode cursorNode = (ICSSNode) indexedRegion;
-
- Region cursorNodeRegion = new Region(indexedRegion.getStartOffset(), indexedRegion.getEndOffset() - indexedRegion.getStartOffset());
- int currentOffset = textSelection.getOffset();
- int currentEndOffset = currentOffset + textSelection.getLength();
- if (cursorNodeRegion.getOffset() >= currentOffset && cursorNodeRegion.getOffset() <= currentEndOffset && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() >= currentOffset && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() <= currentEndOffset) {
- ICSSNode newNode = cursorNode.getNextSibling();
- if (newNode == null) {
- newNode = cursorNode.getParentNode();
-
- if (newNode instanceof IndexedRegion) {
- IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
- newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
- }
- }
- else {
- if (newNode instanceof IndexedRegion) {
- IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
- newRegion = new Region(currentOffset, newIndexedRegion.getEndOffset() - currentOffset);
- }
- }
- }
- else
- newRegion = cursorNodeRegion;
- }
- return newRegion;
- }
-
- public void init(IAction action) {
- if (action != null) {
- action.setText(CSSUIMessages.StructureSelectNext_label);
- action.setToolTipText(CSSUIMessages.StructureSelectNext_tooltip);
- action.setDescription(CSSUIMessages.StructureSelectNext_description);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectPreviousCSSActionDelegate.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectPreviousCSSActionDelegate.java
deleted file mode 100644
index 78289a25f7..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/selection/StructuredSelectPreviousCSSActionDelegate.java
+++ /dev/null
@@ -1,76 +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.css.ui.internal.selection;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.text.Region;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.ui.internal.selection.StructuredSelectActionDelegate;
-
-/**
- * Selects previous CSS element
- */
-public class StructuredSelectPreviousCSSActionDelegate extends StructuredSelectActionDelegate {
-
- protected IndexedRegion getCursorIndexedRegion(IDocument document, ITextSelection textSelection) {
- IndexedRegion indexedRegion = null;
-
- indexedRegion = getIndexedRegion(document, textSelection.getOffset());
-
- return indexedRegion;
- }
-
- protected Region getNewSelectionRegion(IndexedRegion indexedRegion, ITextSelection textSelection) {
- Region newRegion = null;
- if (indexedRegion instanceof ICSSNode) {
- ICSSNode cursorNode = (ICSSNode) indexedRegion;
-
- Region cursorNodeRegion = new Region(indexedRegion.getStartOffset(), indexedRegion.getEndOffset() - indexedRegion.getStartOffset());
- int currentOffset = textSelection.getOffset();
- int currentEndOffset = currentOffset + textSelection.getLength();
- if (cursorNodeRegion.getOffset() >= currentOffset && cursorNodeRegion.getOffset() <= currentEndOffset && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() >= currentOffset && cursorNodeRegion.getOffset() + cursorNodeRegion.getLength() <= currentEndOffset) {
- ICSSNode newNode = cursorNode.getPreviousSibling();
- if (newNode == null) {
- newNode = cursorNode.getParentNode();
-
- if (newNode instanceof IndexedRegion) {
- IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
- newRegion = new Region(newIndexedRegion.getStartOffset(), newIndexedRegion.getEndOffset() - newIndexedRegion.getStartOffset());
- }
- }
- else {
- if (newNode instanceof IndexedRegion) {
- IndexedRegion newIndexedRegion = (IndexedRegion) newNode;
- newRegion = new Region(newIndexedRegion.getStartOffset(), currentEndOffset - newIndexedRegion.getStartOffset());
- }
- }
- }
- else
- newRegion = cursorNodeRegion;
- }
- return newRegion;
- }
-
- public void init(IAction action) {
- if (action != null) {
- action.setText(CSSUIMessages.StructureSelectPrevious_label);
- action.setToolTipText(CSSUIMessages.StructureSelectPrevious_tooltip);
- action.setDescription(CSSUIMessages.StructureSelectPrevious_description);
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/style/IStyleConstantsCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/style/IStyleConstantsCSS.java
deleted file mode 100644
index 2287a63275..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/style/IStyleConstantsCSS.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.style;
-
-/**
- * Contains the symbolic name of styles used by LineStyleProvider,
- * ColorManager, and any others who may be interested
- */
-public interface IStyleConstantsCSS {
- public static final String NORMAL = "NORMAL"; //$NON-NLS-1$
- public static final String ATMARK_RULE = "ATMARK_RULE"; //$NON-NLS-1$
- public static final String SELECTOR = "SELECTOR"; //$NON-NLS-1$
- public static final String UNIVERSAL = "UNIVERSAL"; //$NON-NLS-1$
- public static final String PSEUDO = "PSEUDO"; //$NON-NLS-1$
- public static final String SELECTOR_CLASS = "CLASS"; //$NON-NLS-1$
- public static final String ID = "ID"; //$NON-NLS-1$
- public static final String MEDIA = "MEDIA"; //$NON-NLS-1$
- public static final String COMMENT = "COMMENT"; //$NON-NLS-1$
- public static final String PROPERTY_NAME = "PROPERTY_NAME"; //$NON-NLS-1$
- public static final String PROPERTY_VALUE = "PROPERTY_VALUE"; //$NON-NLS-1$
- public static final String URI = "URI"; //$NON-NLS-1$
- public static final String STRING = "STRING"; //$NON-NLS-1$
- public static final String COLON = "COLON"; //$NON-NLS-1$
- public static final String SEMI_COLON = "SEMI_COLON"; //$NON-NLS-1$
- public static final String CURLY_BRACE = "CURLY_BRACE"; //$NON-NLS-1$
- public static final String ATTRIBUTE_DELIM = "ATTRIBUTE_DELIM"; //$NON-NLS-1$
- public static final String ATTRIBUTE_NAME = "ATTRIBUTE_NAME"; //$NON-NLS-1$
- public static final String ATTRIBUTE_OPERATOR = "ATTRIBUTE_OPERATOR"; //$NON-NLS-1$
- public static final String ATTRIBUTE_VALUE = "ATTRIBUTE_VALUE"; //$NON-NLS-1$
- public static final String COMBINATOR = "COMBINATOR"; //$NON-NLS-1$
- public static final String ERROR = "ERROR"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/style/LineStyleProviderForCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/style/LineStyleProviderForCSS.java
deleted file mode 100644
index 8cffa99058..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/style/LineStyleProviderForCSS.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.style;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts;
-import org.eclipse.wst.css.ui.internal.CSSUIPlugin;
-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 LineStyleProviderForCSS extends AbstractLineStyleProvider implements LineStyleProvider {
- /** Contains region to style mapping */
- private Map fColorTypes;
-
- /**
- * LineStyleProviderForEmbeddedCSS constructor comment.
- */
- public LineStyleProviderForCSS() {
- super();
- }
-
- protected TextAttribute getAttributeFor(ITextRegion region) {
- if (region != null) {
- String type = region.getType();
- if (type != null) {
- return getAttributeFor(type);
- }
- }
- return (TextAttribute) getTextAttributes().get(IStyleConstantsCSS.NORMAL);
- }
-
- /**
- * Look up the TextAttribute for the given region context. Might return
- * null for unusual text.
- *
- * @param type
- * @return
- */
- protected TextAttribute getAttributeFor(String type) {
- return (TextAttribute) getTextAttributes().get(fColorTypes.get(type));
- }
-
- private void initAttributes() {
- if (fColorTypes == null) {
- fColorTypes = new HashMap();
- }
- fColorTypes.put(CSSRegionContexts.CSS_COMMENT, IStyleConstantsCSS.COMMENT);
- fColorTypes.put(CSSRegionContexts.CSS_CDO, IStyleConstantsCSS.COMMENT);
- fColorTypes.put(CSSRegionContexts.CSS_CDC, IStyleConstantsCSS.COMMENT);
- fColorTypes.put(CSSRegionContexts.CSS_S, IStyleConstantsCSS.NORMAL);
-
- fColorTypes.put(CSSRegionContexts.CSS_DELIMITER, IStyleConstantsCSS.SEMI_COLON);
- fColorTypes.put(CSSRegionContexts.CSS_LBRACE, IStyleConstantsCSS.CURLY_BRACE);
- fColorTypes.put(CSSRegionContexts.CSS_RBRACE, IStyleConstantsCSS.CURLY_BRACE);
-
- fColorTypes.put(CSSRegionContexts.CSS_IMPORT, IStyleConstantsCSS.ATMARK_RULE);
- fColorTypes.put(CSSRegionContexts.CSS_PAGE, IStyleConstantsCSS.ATMARK_RULE);
- fColorTypes.put(CSSRegionContexts.CSS_MEDIA, IStyleConstantsCSS.ATMARK_RULE);
- fColorTypes.put(CSSRegionContexts.CSS_FONT_FACE, IStyleConstantsCSS.ATMARK_RULE);
- fColorTypes.put(CSSRegionContexts.CSS_CHARSET, IStyleConstantsCSS.ATMARK_RULE);
- fColorTypes.put(CSSRegionContexts.CSS_ATKEYWORD, IStyleConstantsCSS.ATMARK_RULE);
-
- fColorTypes.put(CSSRegionContexts.CSS_STRING, IStyleConstantsCSS.STRING);
- fColorTypes.put(CSSRegionContexts.CSS_URI, IStyleConstantsCSS.URI);
- fColorTypes.put(CSSRegionContexts.CSS_MEDIUM, IStyleConstantsCSS.MEDIA);
- fColorTypes.put(CSSRegionContexts.CSS_MEDIA_SEPARATOR, IStyleConstantsCSS.MEDIA);
-
- fColorTypes.put(CSSRegionContexts.CSS_CHARSET_NAME, IStyleConstantsCSS.STRING);
-
- fColorTypes.put(CSSRegionContexts.CSS_PAGE_SELECTOR, IStyleConstantsCSS.MEDIA);
-
- fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_ELEMENT_NAME, IStyleConstantsCSS.SELECTOR);
- fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_UNIVERSAL, IStyleConstantsCSS.UNIVERSAL);
-
- fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_PSEUDO, IStyleConstantsCSS.PSEUDO);
- fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_CLASS, IStyleConstantsCSS.SELECTOR_CLASS);
- fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_ID, IStyleConstantsCSS.ID);
-
- fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_COMBINATOR, IStyleConstantsCSS.COMBINATOR);
- fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_SEPARATOR, IStyleConstantsCSS.SELECTOR);
-
- /* Attribute selector */
- fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_START, IStyleConstantsCSS.ATTRIBUTE_DELIM);
- fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_END, IStyleConstantsCSS.ATTRIBUTE_DELIM);
- fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_NAME, IStyleConstantsCSS.ATTRIBUTE_NAME);
- fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_VALUE, IStyleConstantsCSS.ATTRIBUTE_VALUE);
- fColorTypes.put(CSSRegionContexts.CSS_SELECTOR_ATTRIBUTE_OPERATOR, IStyleConstantsCSS.ATTRIBUTE_OPERATOR);
-
- fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_PROPERTY, IStyleConstantsCSS.PROPERTY_NAME);
- fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_IDENT, IStyleConstantsCSS.PROPERTY_VALUE);
- fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_DIMENSION, IStyleConstantsCSS.PROPERTY_VALUE);
- fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_PERCENTAGE, IStyleConstantsCSS.PROPERTY_VALUE);
- fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_NUMBER, IStyleConstantsCSS.PROPERTY_VALUE);
- fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_FUNCTION, IStyleConstantsCSS.PROPERTY_VALUE);
- fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_PARENTHESIS_CLOSE, IStyleConstantsCSS.PROPERTY_VALUE);
- fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_STRING, IStyleConstantsCSS.PROPERTY_VALUE);
- fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_URI, IStyleConstantsCSS.PROPERTY_VALUE);
- fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_HASH, IStyleConstantsCSS.PROPERTY_VALUE);
- fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_UNICODE_RANGE, IStyleConstantsCSS.PROPERTY_VALUE);
- fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_IMPORTANT, IStyleConstantsCSS.PROPERTY_VALUE);
- fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_OPERATOR, IStyleConstantsCSS.PROPERTY_VALUE);
- fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_VALUE_S, IStyleConstantsCSS.PROPERTY_VALUE);
- fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_SEPARATOR, IStyleConstantsCSS.COLON);
- fColorTypes.put(CSSRegionContexts.CSS_DECLARATION_DELIMITER, IStyleConstantsCSS.SEMI_COLON);
-
- fColorTypes.put(CSSRegionContexts.CSS_UNKNOWN, IStyleConstantsCSS.NORMAL);
- }
-
- protected void handlePropertyChange(PropertyChangeEvent event) {
- String styleKey = null;
-
- if (event != null) {
- String prefKey = event.getProperty();
- // check if preference changed is a style preference
- if (IStyleConstantsCSS.ATMARK_RULE.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.ATMARK_RULE;
- } else if (IStyleConstantsCSS.COLON.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.COLON;
- } else if (IStyleConstantsCSS.COMMENT.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.COMMENT;
- } else if (IStyleConstantsCSS.CURLY_BRACE.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.CURLY_BRACE;
- } else if (IStyleConstantsCSS.ERROR.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.ERROR;
- } else if (IStyleConstantsCSS.MEDIA.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.MEDIA;
- } else if (IStyleConstantsCSS.NORMAL.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.NORMAL;
- } else if (IStyleConstantsCSS.ATTRIBUTE_DELIM.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.ATTRIBUTE_DELIM;
- } else if (IStyleConstantsCSS.ATTRIBUTE_NAME.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.ATTRIBUTE_NAME;
- } else if (IStyleConstantsCSS.ATTRIBUTE_OPERATOR.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.ATTRIBUTE_OPERATOR;
- } else if (IStyleConstantsCSS.ATTRIBUTE_VALUE.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.ATTRIBUTE_VALUE;
- } else if (IStyleConstantsCSS.COMBINATOR.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.COMBINATOR;
- } else if (IStyleConstantsCSS.PROPERTY_NAME.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.PROPERTY_NAME;
- } else if (IStyleConstantsCSS.PROPERTY_VALUE.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.PROPERTY_VALUE;
- } else if (IStyleConstantsCSS.SELECTOR.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.SELECTOR;
- } else if (IStyleConstantsCSS.UNIVERSAL.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.UNIVERSAL;
- } else if (IStyleConstantsCSS.ID.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.ID;
- } else if (IStyleConstantsCSS.PSEUDO.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.PSEUDO;
- } else if (IStyleConstantsCSS.SELECTOR_CLASS.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.SELECTOR_CLASS;
- } else if (IStyleConstantsCSS.SEMI_COLON.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.SEMI_COLON;
- } else if (IStyleConstantsCSS.STRING.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.STRING;
- } else if (IStyleConstantsCSS.URI.equals(prefKey)) {
- styleKey = IStyleConstantsCSS.URI;
- }
- } else {
- // this is around for old deprecated preferencesChanged() method
- // TODO remove when preferencesChanged() is removed
- loadColors();
- super.handlePropertyChange(event);
- }
-
- if (styleKey != null) {
- // overwrite style preference with new value
- addTextAttribute(styleKey);
- super.handlePropertyChange(event);
- }
- }
-
- public void release() {
- if (fColorTypes != null) {
- fColorTypes.clear();
- fColorTypes = null;
- }
- super.release();
- }
-
- public void loadColors() {
- initAttributes();
-
- addTextAttribute(IStyleConstantsCSS.ATMARK_RULE);
- addTextAttribute(IStyleConstantsCSS.COLON);
- addTextAttribute(IStyleConstantsCSS.COMMENT);
- addTextAttribute(IStyleConstantsCSS.CURLY_BRACE);
- addTextAttribute(IStyleConstantsCSS.ERROR);
- addTextAttribute(IStyleConstantsCSS.MEDIA);
- addTextAttribute(IStyleConstantsCSS.NORMAL);
- addTextAttribute(IStyleConstantsCSS.PROPERTY_NAME);
- addTextAttribute(IStyleConstantsCSS.PROPERTY_VALUE);
- addTextAttribute(IStyleConstantsCSS.SELECTOR);
- addTextAttribute(IStyleConstantsCSS.UNIVERSAL);
- addTextAttribute(IStyleConstantsCSS.ATTRIBUTE_DELIM);
- addTextAttribute(IStyleConstantsCSS.ATTRIBUTE_NAME);
- addTextAttribute(IStyleConstantsCSS.ATTRIBUTE_OPERATOR);
- addTextAttribute(IStyleConstantsCSS.ATTRIBUTE_VALUE);
- addTextAttribute(IStyleConstantsCSS.COMBINATOR);
- addTextAttribute(IStyleConstantsCSS.ID);
- addTextAttribute(IStyleConstantsCSS.SELECTOR_CLASS);
- addTextAttribute(IStyleConstantsCSS.PSEUDO);
- addTextAttribute(IStyleConstantsCSS.SEMI_COLON);
- addTextAttribute(IStyleConstantsCSS.STRING);
- addTextAttribute(IStyleConstantsCSS.URI);
- }
-
- protected IPreferenceStore getColorPreferences() {
- return CSSUIPlugin.getDefault().getPreferenceStore();
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/style/LineStyleProviderForEmbeddedCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/style/LineStyleProviderForEmbeddedCSS.java
deleted file mode 100644
index 1428f6da35..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/style/LineStyleProviderForEmbeddedCSS.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.style;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.ITypedRegion;
-import org.eclipse.jface.text.TextAttribute;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.wst.css.core.internal.parserz.CSSTextParser;
-import org.eclipse.wst.css.core.internal.parserz.CSSTextToken;
-import org.eclipse.wst.css.ui.internal.Logger;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
-import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
-
-public class LineStyleProviderForEmbeddedCSS extends LineStyleProviderForCSS {
-
- public boolean prepareRegions(ITypedRegion typedRegion, int lineRequestStart, int lineRequestLength, Collection holdResults) {
- int regionStart = typedRegion.getOffset();
- int regionEnd = regionStart + typedRegion.getLength();
- IStructuredDocumentRegion wholeRegion = getDocument().getRegionAtCharacterOffset(regionStart);
-
- if (wholeRegion == null)
- return false;
-
- List tokens = null;
- int offset = typedRegion.getOffset();
-
- List cache = getCachedParsingResult(wholeRegion);
- if (cache == null) {
- try {
- String content = getDocument().get(typedRegion.getOffset(), typedRegion.getLength());
-
- //if region is an XML tag then in CSS style attribute, else in style tag
- int mode;
- if(wholeRegion.getType() == DOMRegionContext.XML_TAG_NAME) {
- mode = CSSTextParser.MODE_DECLARATION;
- } else {
- mode = CSSTextParser.MODE_STYLESHEET;
- }
-
- CSSTextParser parser = new CSSTextParser(mode, content);
- tokens = parser.getTokenList();
- cacheParsingResult(wholeRegion, tokens);
- } catch (BadLocationException e) {
- Logger.logException("Given a bad ITypedRegion: " + typedRegion, e);
- }
- }
- else {
- tokens = cache;
- }
-
- boolean result = false;
-
- if (tokens != null && 0 < tokens.size()) {
- int start = offset;
- int end = start;
- Iterator i = tokens.iterator();
- while (i.hasNext()) {
- CSSTextToken token = (CSSTextToken) i.next();
- end = start + token.length;
- int styleLength = token.length;
- /* The token starts in the region */
- if (regionStart <= start && start < regionEnd) {
- /* [239415] The region may not span the total length of the token -
- * Adjust the length so that it doesn't overlap with other style ranges */
- if (regionEnd < end)
- styleLength = regionEnd - start;
- addStyleRange(holdResults, getAttributeFor(token.kind), start, styleLength);
- }
- /* The region starts in the token */
- else if (start <= regionStart && regionStart < end ) {
- /* The token may not span the total length of the region */
- if (end < regionEnd)
- styleLength = end - regionStart;
- else /* Bugzilla 282218 */
- styleLength = regionEnd - regionStart;
- addStyleRange(holdResults, getAttributeFor(token.kind), regionStart, styleLength);
- }
- start += token.length;
- }
- result = true;
- }
-
- return result;
- }
-
- private void addStyleRange(Collection holdResults, TextAttribute attribute, int start, int end) {
- if (attribute != null)
- holdResults.add(new StyleRange(start, end, attribute.getForeground(), attribute.getBackground(), attribute.getStyle()));
- else
- holdResults.add(new StyleRange(start, end, null, null));
- }
-
- protected TextAttribute getAttributeFor(ITextRegion region) {
- return null;
- }
-
- private void cleanupCache() {
- fCacheKey = -1;
- fCacheResult = null;
- }
-
- private List getCachedParsingResult(IStructuredDocumentRegion region) {
- if (fCacheKey == region.getText().hashCode()) {
- return fCacheResult;
- }
- return null;
- }
-
- private void cacheParsingResult(IStructuredDocumentRegion region, List result) {
- fCacheKey = region.getText().hashCode();
- fCacheResult = result;
- }
-
- public void release() {
- super.release();
- cleanupCache();
- }
-
- int fCacheKey = -1;
- List fCacheResult = null;
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/templates/EncodingTemplateVariableResolverCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/templates/EncodingTemplateVariableResolverCSS.java
deleted file mode 100644
index 757da6ca70..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/templates/EncodingTemplateVariableResolverCSS.java
+++ /dev/null
@@ -1,38 +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.css.ui.internal.templates;
-
-import org.eclipse.jface.text.templates.SimpleTemplateVariableResolver;
-import org.eclipse.jface.text.templates.TemplateContext;
-import org.eclipse.wst.css.core.internal.CSSCorePlugin;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames;
-
-
-public class EncodingTemplateVariableResolverCSS extends SimpleTemplateVariableResolver {
- private static final String ENCODING_TYPE = getEncodingType();
-
- private static String getEncodingType() {
- return "encoding"; //$NON-NLS-1$
- }
-
- /**
- * Creates a new encoding variable
- */
- public EncodingTemplateVariableResolverCSS() {
- super(ENCODING_TYPE, CSSUIMessages.Creating_files_encoding);
- }
-
- protected String resolve(TemplateContext context) {
- return CSSCorePlugin.getDefault().getPluginPreferences().getString(CommonEncodingPreferenceNames.OUTPUT_CODESET);
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/templates/TemplateContextTypeCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/templates/TemplateContextTypeCSS.java
deleted file mode 100644
index 7e981c86ea..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/templates/TemplateContextTypeCSS.java
+++ /dev/null
@@ -1,34 +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.css.ui.internal.templates;
-
-import org.eclipse.jface.text.templates.GlobalTemplateVariables;
-import org.eclipse.jface.text.templates.TemplateContextType;
-
-/**
- * Base class for CSS template context types. Templates of this context type
- * apply to any place within CSS content type.
- */
-public class TemplateContextTypeCSS extends TemplateContextType {
-
- public TemplateContextTypeCSS() {
- 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 EncodingTemplateVariableResolverCSS());
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/templates/TemplateContextTypeIdsCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/templates/TemplateContextTypeIdsCSS.java
deleted file mode 100644
index d0a134f1d2..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/templates/TemplateContextTypeIdsCSS.java
+++ /dev/null
@@ -1,20 +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.css.ui.internal.templates;
-
-
-public class TemplateContextTypeIdsCSS {
-
- public static final String ALL = "css_all"; //$NON-NLS-1$
-
- public static final String NEW = "css_new"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/text/CSSCharacterPairInserter.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/text/CSSCharacterPairInserter.java
deleted file mode 100644
index 9034f42911..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/text/CSSCharacterPairInserter.java
+++ /dev/null
@@ -1,43 +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.css.ui.internal.text;
-
-import org.eclipse.wst.sse.ui.typing.AbstractCharacterPairInserter;
-
-public class CSSCharacterPairInserter extends AbstractCharacterPairInserter {
-
- public boolean hasPair(char c) {
- switch (c) {
- case '"':
- case '\'':
- case '[':
- case '(':
- return true;
- default:
- return false;
- }
- }
-
- protected char getPair(char c) {
- switch (c) {
- case '\'':
- case '"':
- return c;
- case '(':
- return ')';
- case '[':
- return ']';
- default:
- throw new IllegalArgumentException();
- }
- }
-
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/text/CSSDocumentRegionEdgeMatcher.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/text/CSSDocumentRegionEdgeMatcher.java
deleted file mode 100644
index 702dbc679f..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/text/CSSDocumentRegionEdgeMatcher.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 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.css.ui.internal.text;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.source.ICharacterPairMatcher;
-import org.eclipse.wst.css.core.internal.parserz.CSSRegionContexts;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-
-public class CSSDocumentRegionEdgeMatcher implements ICharacterPairMatcher {
-
- private int fAnchor = ICharacterPairMatcher.LEFT;
-
- /**
- * @param validContexts
- * @param nextMatcher
- */
- public CSSDocumentRegionEdgeMatcher() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.source.ICharacterPairMatcher#clear()
- */
- public void clear() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.source.ICharacterPairMatcher#dispose()
- */
- public void dispose() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.text.source.ICharacterPairMatcher#getAnchor()
- */
- public int getAnchor() {
- return fAnchor;
- }
-
- public IRegion match(IDocument document, int offset) {
- if (document instanceof IStructuredDocument) {
- IStructuredDocumentRegion r = ((IStructuredDocument) document).getRegionAtCharacterOffset(offset);
- if (r != null) {
- if (r.getPrevious() != null && r.getStartOffset() == offset && r.getPrevious().getType().equals(CSSRegionContexts.CSS_RBRACE)) {
- r = r.getPrevious();
- }
- if (r.getType().equals(CSSRegionContexts.CSS_RBRACE)) {
- while (r != null && !r.getType().equals(CSSRegionContexts.CSS_LBRACE)) {
- r = r.getPrevious();
- }
- if (r != null) {
- return new Region(r.getStartOffset(), 1);
- }
- } else if (r.getType().equals(CSSRegionContexts.CSS_LBRACE)) {
- while (r != null && !r.getType().equals(CSSRegionContexts.CSS_RBRACE)) {
- r = r.getNext();
- }
- if (r != null) {
- return new Region(r.getEndOffset() - 1, 1);
- }
- }
- }
- }
- return null;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/FacetModuleCoreSupport.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/FacetModuleCoreSupport.java
deleted file mode 100644
index 636c6931aa..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/FacetModuleCoreSupport.java
+++ /dev/null
@@ -1,67 +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.css.ui.internal.wizard;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
-
-/**
- * This class encapsulates any used Module Core and Facets APIs along with
- * fallbacks for use on non-compliant projects and when those services are not
- * available at runtime.
- *
- * Because ModuleCore API calls can result in locks needing to be acquired,
- * none of these methods should be called while other thread locks have
- * already been acquired.
- */
-final class FacetModuleCoreSupport {
- static final boolean _dump_NCDFE = false;
-
- /**
- * @param project
- * @return the IPath to the "root" of the web contents
- */
- public static IPath getWebContentRootPath(IProject project) {
- if (project == null)
- return null;
-
- IPath path = null;
- try {
- path = FacetModuleCoreSupportDelegate.getWebContentRootPath(project);
- }
- catch (NoClassDefFoundError e) {
- if (_dump_NCDFE)
- e.printStackTrace();
- }
- return path;
- }
-
- /**
- * @param project
- * @return
- * @throws org.eclipse.core.runtime.CoreException
- */
- public static boolean isWebProject(IProject project) {
- if (project == null)
- return false;
-
- try {
- return FacetModuleCoreSupportDelegate.isWebProject(project);
- }
- catch (NoClassDefFoundError e) {
- if (_dump_NCDFE)
- e.printStackTrace();
- }
- return true;
- }
-
-
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/FacetModuleCoreSupportDelegate.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/FacetModuleCoreSupportDelegate.java
deleted file mode 100644
index 1af190f6a6..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/FacetModuleCoreSupportDelegate.java
+++ /dev/null
@@ -1,84 +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 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.css.ui.internal.wizard;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.ModuleCoreNature;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.project.facet.core.IFacetedProject;
-import org.eclipse.wst.common.project.facet.core.IProjectFacet;
-import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
-import org.eclipse.wst.css.ui.internal.Logger;
-
-/**
- * Wrapper class for all Facet-related calls. If the Facet or ModuleCore
- * bundles are not available, this class will not load, or if it does, its
- * methods will cause NoClassDefFoundErrors. This allows us to
- * compartmentalize the dependencies.
- *
- */
-final class FacetModuleCoreSupportDelegate {
- /**
- * Copied to avoid unneeded extra dependency (plus it's unclear why the
- * value is in that plug-in).
- *
- * @see org.eclipse.wst.common.componentcore.internal.util.IModuleConstants.JST_WEB_MODULE
- */
- private final static String JST_WEB_MODULE = "jst.web"; //$NON-NLS-1$
-
- private final static String WST_WEB_MODULE = "wst.web"; //$NON-NLS-1$
-
- /**
- * @param project
- * @return the IPath to the "root" of the web contents
- */
- static IPath getWebContentRootPath(IProject project) {
- if (!ModuleCoreNature.isFlexibleProject(project))
- return project.getFullPath();
-
- IPath path = null;
- IVirtualComponent component = ComponentCore.createComponent(project);
- if (component != null && component.exists()) {
- path = component.getRootFolder().getWorkspaceRelativePath();
- }
- else {
- path = project.getFullPath();
- }
- return path;
- }
-
- /**
- * @param project
- * @return
- * @throws CoreException
- */
- static boolean isWebProject(IProject project) {
- boolean is = false;
- try {
- IFacetedProject faceted = ProjectFacetsManager.create(project);
- if (ProjectFacetsManager.isProjectFacetDefined(JST_WEB_MODULE)) {
- IProjectFacet facet = ProjectFacetsManager.getProjectFacet(JST_WEB_MODULE);
- is = is || (faceted != null && faceted.hasProjectFacet(facet));
- }
- if (ProjectFacetsManager.isProjectFacetDefined(WST_WEB_MODULE)) {
- IProjectFacet facet = ProjectFacetsManager.getProjectFacet(WST_WEB_MODULE);
- is = is || (faceted != null && faceted.hasProjectFacet(facet));
- }
- }
- catch (CoreException e) {
- Logger.logException(e);
- }
- return is;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/NewCSSFileWizardPage.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/NewCSSFileWizardPage.java
deleted file mode 100644
index 4cc64240bd..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/NewCSSFileWizardPage.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *
- *******************************************************************************/
-package org.eclipse.wst.css.ui.internal.wizard;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-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.jface.viewers.IStructuredSelection;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-import org.eclipse.wst.css.core.internal.CSSCorePlugin;
-import org.eclipse.wst.css.core.internal.preferences.CSSCorePreferenceNames;
-import org.eclipse.wst.css.core.internal.provisional.contenttype.ContentTypeIdForCSS;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-
-class NewCSSFileWizardPage extends WizardNewFileCreationPage {
-
- private IContentType fContentType;
- private List fValidExtensions = null;
-
- public NewCSSFileWizardPage(String pageName, IStructuredSelection selection) {
- super(pageName, selection);
- }
-
- /**
- * This method is overriden to set the selected folder to web contents
- * folder if the current selection is outside the web contents folder.
- */
- protected void initialPopulateContainerNameField() {
- super.initialPopulateContainerNameField();
-
- IPath fullPath = getContainerFullPath();
- IProject project = getProjectFromPath(fullPath);
- IPath webContentPath = getWebContentPath(project);
-
- if (webContentPath != null && !webContentPath.isPrefixOf(fullPath)) {
- setContainerFullPath(webContentPath);
- }
- }
-
- /**
- * This method is overriden to set additional validation specific to
- * css files.
- */
- protected boolean validatePage() {
- setMessage(null);
- setErrorMessage(null);
-
- if (!super.validatePage()) {
- return false;
- }
-
- 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(CSSUIMessages._ERROR_FILENAME_MUST_END_CSS, 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(CSSUIMessages.ResourceGroup_nameExists);
- return false;
- }
- }
-
- // get the IProject for the selection path
- IProject project = getProjectFromPath(fullPath);
- // if inside web project, check if inside webContent folder
- if (project != null && isWebProject(project)) {
- // check that the path is inside the webContent folder
- IPath webContentPath = getWebContentPath(project);
- if (!webContentPath.isPrefixOf(fullPath)) {
- setMessage(CSSUIMessages._WARNING_FOLDER_MUST_BE_INSIDE_WEB_CONTENT, WARNING);
- }
- }
- }
-
- return true;
- }
-
- /**
- * Get content type associated with this new file wizard
- *
- * @return IContentType
- */
- private IContentType getContentType() {
- if (fContentType == null)
- fContentType = Platform.getContentTypeManager().getContentType(ContentTypeIdForCSS.ContentTypeID_CSS);
- return fContentType;
- }
-
- /**
- * Get list of valid extensions for CSS Content type
- *
- * @return
- */
- private List getValidExtensions() {
- if (fValidExtensions == null) {
- IContentType type = getContentType();
- fValidExtensions = new ArrayList(Arrays.asList(type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC)));
- }
- return fValidExtensions;
- }
-
- /**
- * 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
- */
- private 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;
- }
-
- /**
- * Adds default extension to the filename
- *
- * @param filename
- * @return
- */
- String addDefaultExtension(String filename) {
- StringBuffer newFileName = new StringBuffer(filename);
-
- Preferences preference = CSSCorePlugin.getDefault().getPluginPreferences();
- String ext = preference.getString(CSSCorePreferenceNames.DEFAULT_EXTENSION);
-
- newFileName.append("."); //$NON-NLS-1$
- newFileName.append(ext);
-
- return newFileName.toString();
- }
-
- /**
- * Returns the project that contains the specified path
- *
- * @param path the path which project is needed
- * @return IProject object. If path is <code>null</code> the return value
- * is also <code>null</code>.
- */
- private IProject getProjectFromPath(IPath path) {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IProject project = null;
-
- if (path != null) {
- if (workspace.validatePath(path.toString(), IResource.PROJECT).isOK()) {
- project = workspace.getRoot().getProject(path.toString());
- } else {
- project = workspace.getRoot().getFile(path).getProject();
- }
- }
-
- return project;
- }
-
- /**
- * Checks if the specified project is a web project.
- *
- * @param project project to be checked
- * @return true if the project is web project, otherwise false
- */
- private boolean isWebProject(IProject project) {
- return FacetModuleCoreSupport.isWebProject(project);
- }
-
- /**
- * Returns the web contents folder of the specified project
- *
- * @param project the project which web contents path is needed
- * @return IPath of the web contents folder
- */
- private IPath getWebContentPath(IProject project) {
- return FacetModuleCoreSupport.getWebContentRootPath(project);
- }
-
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/NewCSSTemplatesWizardPage.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/NewCSSTemplatesWizardPage.java
deleted file mode 100644
index 220afa40dd..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/NewCSSTemplatesWizardPage.java
+++ /dev/null
@@ -1,521 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 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.css.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.css.core.internal.provisional.contenttype.ContentTypeIdForCSS;
-import org.eclipse.wst.css.ui.StructuredTextViewerConfigurationCSS;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-import org.eclipse.wst.css.ui.internal.CSSUIPlugin;
-import org.eclipse.wst.css.ui.internal.Logger;
-import org.eclipse.wst.css.ui.internal.editor.IHelpContextIds;
-import org.eclipse.wst.css.ui.internal.preferences.CSSUIPreferenceNames;
-import org.eclipse.wst.css.ui.internal.templates.TemplateContextTypeIdsCSS;
-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 NewCSSTemplatesWizardPage 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(TemplateContextTypeIdsCSS.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 NewCSSTemplatesWizardPage() {
- super("NewCSSTemplatesWizardPage", CSSUIMessages.NewCSSTemplatesWizardPage_0, null); //$NON-NLS-1$
- setDescription(CSSUIMessages.NewCSSTemplatesWizardPage_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 CSS Template
- fUseTemplateButton = new Button(parent, SWT.CHECK);
- fUseTemplateButton.setText(CSSUIMessages.NewCSSTemplatesWizardPage_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(CSSUIMessages.NewCSSTemplatesWizardPage_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(CSSUIMessages.NewCSSTemplatesWizardPage_2);
-
- TableColumn column2 = new TableColumn(table, SWT.NONE);
- column2.setText(CSSUIMessages.NewCSSTemplatesWizardPage_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 = CSSUIPlugin.getDefault().getTemplateStore();
- fTableViewer.setInput(fTemplateStore);
-
- // Create linked text to just to templates preference page
- Link link = new Link(parent, SWT.NONE);
- link.setText(CSSUIMessages.NewCSSTemplatesWizardPage_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.CSS_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 StructuredTextViewerConfigurationCSS();
-
- 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);
- viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$
- IStructuredModel scratchModel = StructuredModelManager.getModelManager().createUnManagedStructuredModelFor(ContentTypeIdForCSS.ContentTypeID_CSS);
- 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(CSSUIMessages.NewCSSTemplatesWizardPage_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.css.ui.preferences.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 = CSSUIPlugin.getDefault().getTemplateContextRegistry().getContextType(TemplateContextTypeIdsCSS.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 css", 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 CSS File wizard.
- */
- private void loadLastSavedPreferences() {
- fLastSelectedTemplateName = ""; //$NON-NLS-1$
- boolean setSelection = false;
- String templateName = CSSUIPlugin.getDefault().getPreferenceStore().getString(CSSUIPreferenceNames.NEW_FILE_TEMPLATE_NAME);
- if (templateName == null || templateName.length() == 0) {
- templateName = CSSUIPlugin.getDefault().getPreferenceStore().getString(CSSUIPreferenceNames.NEW_FILE_TEMPLATE_ID);
- if (templateName != null && templateName.length() > 0) {
- Template template = fTemplateStore.findTemplateById(templateName);
- if (template != null) {
- fLastSelectedTemplateName = template.getName();
- setSelection = true;
- }
- }
- }
- else {
- fLastSelectedTemplateName = templateName;
- setSelection = true;
- }
- fUseTemplateButton.setSelection(setSelection);
- enableTemplates();
- }
-
- /**
- * Save template name used for next call to New CSS File wizard.
- */
- void saveLastSavedPreferences() {
- String templateName = ""; //$NON-NLS-1$
-
- Template template = getSelectedTemplate();
- if (template != null) {
- templateName = template.getName();
- }
-
- CSSUIPlugin.getDefault().getPreferenceStore().setValue(CSSUIPreferenceNames.NEW_FILE_TEMPLATE_NAME, templateName);
- CSSUIPlugin.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, TemplateContextTypeIdsCSS.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.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/NewCSSWizard.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/NewCSSWizard.java
deleted file mode 100644
index 62b456d0c2..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/internal/wizard/NewCSSWizard.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *
- *******************************************************************************/
-package org.eclipse.wst.css.ui.internal.wizard;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStreamWriter;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ProjectScope;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Preferences;
-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.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.ide.IDE;
-import org.eclipse.wst.css.core.internal.CSSCorePlugin;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-import org.eclipse.wst.css.ui.internal.Logger;
-import org.eclipse.wst.css.ui.internal.editor.CSSEditorPluginImages;
-import org.eclipse.wst.css.ui.internal.image.CSSImageHelper;
-import org.eclipse.wst.sse.core.internal.encoding.CommonEncodingPreferenceNames;
-import org.eclipse.wst.sse.core.utils.StringUtils;
-
-public class NewCSSWizard extends Wizard implements INewWizard {
- private NewCSSFileWizardPage fNewFilePage;
- private NewCSSTemplatesWizardPage fNewFileTemplatesPage;
- private IStructuredSelection fSelection;
-
- public void addPages() {
- fNewFilePage = new NewCSSFileWizardPage("CSSWizardNewFileCreationPage", new StructuredSelection(IDE.computeSelectedResources(fSelection))); //$NON-NLS-1$
- fNewFilePage.setTitle(CSSUIMessages._UI_WIZARD_NEW_HEADING); //$NON-NLS-1$
- fNewFilePage.setDescription(CSSUIMessages._UI_WIZARD_NEW_DESCRIPTION); //$NON-NLS-1$
- addPage(fNewFilePage);
-
- fNewFileTemplatesPage = new NewCSSTemplatesWizardPage();
- addPage(fNewFileTemplatesPage);
- }
-
- 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;
- }
-
- public void init(IWorkbench aWorkbench, IStructuredSelection aSelection) {
- fSelection = aSelection;
- setWindowTitle(CSSUIMessages._UI_WIZARD_NEW_TITLE); //$NON-NLS-1$
- ImageDescriptor descriptor = CSSImageHelper.getInstance().getImageDescriptor(CSSEditorPluginImages.IMG_WIZBAN_NEWCSSFILE);
- 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 = fNewFilePage.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
- Preferences preference = CSSCorePlugin.getDefault().getPluginPreferences();
- String charSet = preference.getString(CommonEncodingPreferenceNames.OUTPUT_CODESET);
-
- 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 CSS file", e); //$NON-NLS-1$
- }
- }
- // open the file in editor
- openEditor(file);
-
- // everything's fine
- performedOK = true;
- }
- return performedOK;
- }
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSContentOutlineConfiguration.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSContentOutlineConfiguration.java
deleted file mode 100644
index fbc9d85e43..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSContentOutlineConfiguration.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2004, 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.css.ui.views.contentoutline;
-
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleDeclItem;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSValue;
-import org.eclipse.wst.css.ui.internal.CSSUIPlugin;
-import org.eclipse.wst.sse.ui.internal.contentoutline.PropertyChangeUpdateActionContributionItem;
-import org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration;
-
-/**
- * Configuration for outline view page which shows CSS content.
- *
- * @see org.eclipse.wst.sse.ui.views.contentoutline.ContentOutlineConfiguration
- * @since 1.0
- */
-public class CSSContentOutlineConfiguration extends ContentOutlineConfiguration {
- private IContentProvider fContentProvider = null;
- private ILabelProvider fLabelProvider = null;
- private final String OUTLINE_SORT_PREF = "outline-sort"; //$NON-NLS-1$
-
- /**
- * Create new instance of CSSContentOutlineConfiguration
- */
- public CSSContentOutlineConfiguration() {
- // Must have empty constructor to createExecutableExtension
- super();
- }
-
- public IContributionItem[] createToolbarContributions(TreeViewer viewer) {
- IContributionItem[] items = super.createToolbarContributions(viewer);
-
- SortAction sortAction = new SortAction(viewer, CSSUIPlugin.getDefault().getPreferenceStore(), OUTLINE_SORT_PREF);
- IContributionItem sortItem = new PropertyChangeUpdateActionContributionItem(sortAction);
-
- if (items == null) {
- items = new IContributionItem[1];
- items[0] = sortItem;
- }
- else {
- IContributionItem[] combinedItems = new IContributionItem[items.length + 1];
- combinedItems[0] = sortItem;
- System.arraycopy(items, 0, combinedItems, 1, items.length);
- items = combinedItems;
- }
- return items;
- }
-
- public IContentProvider getContentProvider(TreeViewer viewer) {
- if (fContentProvider == null)
- fContentProvider = new JFaceNodeContentProviderCSS();
- return fContentProvider;
- }
-
- private Object getFilteredNode(Object o) {
- ICSSNode node = null;
- if (o instanceof ICSSNode) {
- node = (ICSSNode) o;
- short nodeType = node.getNodeType();
- if (node instanceof ICSSValue) {
- while (node != null && !(node instanceof ICSSStyleDeclItem)) {
- node = node.getParentNode();
- }
- }
- else if (nodeType == ICSSNode.STYLEDECLARATION_NODE) {
- node = node.getParentNode();
- }
- else if (nodeType == ICSSNode.MEDIALIST_NODE) {
- node = node.getParentNode();
- }
- }
- return node;
- }
-
- private Object[] getFilteredNodes(Object[] objects) {
- Object[] filtered = new Object[objects.length];
- for (int i = 0; i < filtered.length; i++) {
- filtered[i] = getFilteredNode(objects[i]);
- }
- return filtered;
- }
-
- public ILabelProvider getLabelProvider(TreeViewer viewer) {
- if (fLabelProvider == null)
- fLabelProvider = new JFaceNodeLabelProviderCSS();
- return fLabelProvider;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.wst.sse.ui.views.contentoutline.StructuredContentOutlineConfiguration#getPreferenceStore()
- */
- protected IPreferenceStore getPreferenceStore() {
- return CSSUIPlugin.getDefault().getPreferenceStore();
- }
-
- public ISelection getSelection(TreeViewer viewer, ISelection selection) {
- ISelection filteredSelection = selection;
- if (selection instanceof IStructuredSelection) {
- Object[] filteredNodes = getFilteredNodes(((IStructuredSelection) selection).toArray());
- filteredSelection = new StructuredSelection(filteredNodes);
- }
- return filteredSelection;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSContentSelectionProvider.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSContentSelectionProvider.java
deleted file mode 100644
index d7f0be7204..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSContentSelectionProvider.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.css.ui.views.contentoutline;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSPrimitiveValue;
-import org.eclipse.wst.sse.ui.IContentSelectionProvider;
-
-class CSSContentSelectionProvider implements IContentSelectionProvider {
-
- public ISelection getSelection(TreeViewer viewer, ISelection selection) {
- ISelection filteredSelection = selection;
- if (selection instanceof IStructuredSelection) {
- Object[] filteredNodes = getFilteredNodes(((IStructuredSelection) selection).toArray());
- filteredSelection = new StructuredSelection(filteredNodes);
- }
- return filteredSelection;
- }
-
- private Object[] getFilteredNodes(Object[] filteredNodes) {
- for (int i = 0; i < filteredNodes.length; i++) {
- filteredNodes[i] = getFilteredNode(filteredNodes[i]);
- }
- return filteredNodes;
- }
-
- private Object getFilteredNode(Object object) {
- // If the selection is a primitive value, get the property that contains it */
- if (object instanceof ICSSPrimitiveValue) {
- ICSSPrimitiveValue value = (ICSSPrimitiveValue) object;
- object = value.getParentNode();
- }
- return object;
- }
-
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSQuickOutlineConfiguration.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSQuickOutlineConfiguration.java
deleted file mode 100644
index d226166bf9..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/CSSQuickOutlineConfiguration.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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.css.ui.views.contentoutline;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.wst.sse.ui.IContentSelectionProvider;
-import org.eclipse.wst.sse.ui.quickoutline.AbstractQuickOutlineConfiguration;
-
-public class CSSQuickOutlineConfiguration extends AbstractQuickOutlineConfiguration {
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.sse.ui.quickoutline.AbstractQuickOutlineConfiguration#getContentProvider()
- */
- public ITreeContentProvider getContentProvider() {
- return new JFaceNodeContentProviderCSS();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.sse.ui.quickoutline.AbstractQuickOutlineConfiguration#getContentSelectionProvider()
- */
- public IContentSelectionProvider getContentSelectionProvider() {
- return new CSSContentSelectionProvider();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.sse.ui.quickoutline.AbstractQuickOutlineConfiguration#getLabelProvider()
- */
- public ILabelProvider getLabelProvider() {
- return new JFaceNodeLabelProviderCSS();
- }
-
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeContentProviderCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeContentProviderCSS.java
deleted file mode 100644
index fdf353a891..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeContentProviderCSS.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.css.ui.views.contentoutline;
-
-import java.util.ArrayList;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSDocument;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.ui.internal.contentoutline.IJFaceNodeAdapter;
-import org.eclipse.wst.sse.ui.internal.contentoutline.IJFaceNodeAdapterFactory;
-import org.w3c.dom.css.CSSRule;
-
-/**
- * A Content provider for a JFace viewer used to display CSS nodes. This
- * content provider does not use adapters.
- */
-class JFaceNodeContentProviderCSS implements ITreeContentProvider {
-
- public JFaceNodeContentProviderCSS() {
- super();
- }
-
- /**
- * @deprecated
- */
- protected void addElements(Object element, ArrayList v) {
-
- ICSSNode node;
-
- if (element instanceof ICSSModel) {
- ICSSModel model = (ICSSModel) element;
- ICSSDocument doc = model.getDocument();
- node = doc.getFirstChild();
- }
- else if (element instanceof ICSSNode) {
- node = ((ICSSNode) element).getFirstChild();
- }
- else
- return;
-
- while (node != null) {
- if (node instanceof CSSRule) {
- v.add(node);
- }
-
- node = node.getNextSibling();
- }
-
- }
-
- /**
- * The visual part that is using this content provider is about to be
- * disposed. Deallocate all allocated SWT resources.
- */
- public void dispose() {
- }
-
- /**
- * Returns an enumeration containing all child nodes of the given element,
- * which represents a node in a tree. The difference to
- * <code>IStructuredContentProvider.getElements(Object)</code> is as
- * follows: <code>getElements</code> is called to obtain the tree
- * viewer's root elements. Method <code>getChildren</code> is used to
- * obtain the children of a given node in the tree, which can can be a
- * root node, too.
- */
- public Object[] getChildren(Object object) {
- IJFaceNodeAdapter adapter = getAdapter(object);
- if (adapter != null)
- return adapter.getChildren(object);
-
- return new Object[0];
- }
-
- /**
- * Returns an enumeration with the elements belonging to the passed
- * element. These elements can be presented as rows in a table, items in a
- * list etc.
- */
- public Object[] getElements(Object object) {
- IJFaceNodeAdapter adapter = getAdapter(object);
- if (adapter != null)
- return adapter.getElements(object);
-
- return new Object[0];
- }
-
- /**
- * Returns the parent for the given element. This method can return
- * <code>null</code> indicating that the parent can't be computed. In
- * this case the tree viewer can't expand a given node correctly if
- * requested.
- */
- public Object getParent(Object object) {
- IJFaceNodeAdapter adapter = getAdapter(object);
- if (adapter != null)
- return adapter.getParent(object);
-
- return null;
- }
-
- /**
- * Returns <code>true</code> if the given element has children.
- * Otherwise <code>false</code> is returned.
- */
- public boolean hasChildren(Object object) {
- IJFaceNodeAdapter adapter = getAdapter(object);
- if (adapter != null)
- return adapter.hasChildren(object);
-
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
- * java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (oldInput != null && oldInput instanceof IStructuredModel) {
- IJFaceNodeAdapterFactory factory = (IJFaceNodeAdapterFactory) ((IStructuredModel) oldInput).getFactoryRegistry().getFactoryFor(IJFaceNodeAdapter.class);
- if (factory != null) {
- factory.removeListener(viewer);
- }
- }
- if (newInput != null && newInput instanceof IStructuredModel) {
- IJFaceNodeAdapterFactory factory = (IJFaceNodeAdapterFactory) ((IStructuredModel) newInput).getFactoryRegistry().getFactoryFor(IJFaceNodeAdapter.class);
- if (factory != null) {
- factory.addListener(viewer);
- }
- }
- }
-
- /**
- * Checks whether the given element is deleted or not.
- *
- * @deprecated
- */
- public boolean isDeleted(Object element) {
- return false;
- }
-
- /**
- * Returns the JFace adapter for the specified object.
- *
- * @param adaptable
- * java.lang.Object The object to get the adapter for
- */
- private IJFaceNodeAdapter getAdapter(Object adaptable) {
- IJFaceNodeAdapter adapter = null;
- if (adaptable instanceof ICSSModel) {
- adaptable = ((ICSSModel) adaptable).getDocument();
- }
- if (adaptable instanceof ICSSNode && adaptable instanceof INodeNotifier) {
- INodeAdapter nodeAdapter = ((INodeNotifier) adaptable).getAdapterFor(IJFaceNodeAdapter.class);
- if (nodeAdapter instanceof IJFaceNodeAdapter)
- adapter = (IJFaceNodeAdapter) nodeAdapter;
- }
- return adapter;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeLabelProviderCSS.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeLabelProviderCSS.java
deleted file mode 100644
index 964de2fabf..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/JFaceNodeLabelProviderCSS.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.css.ui.views.contentoutline;
-
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
-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.contentoutline.IJFaceNodeAdapter;
-
-class JFaceNodeLabelProviderCSS extends LabelProvider {
-
- /**
- * JFaceNodeLabelProvider constructor comment.
- */
- public JFaceNodeLabelProviderCSS() {
- super();
- }
-
- /**
- * Returns the JFace adapter for the specified object.
- *
- * @param adaptable
- * java.lang.Object The object to get the adapter for
- */
- private IJFaceNodeAdapter getAdapter(Object adaptable) {
- IJFaceNodeAdapter adapter = null;
- if (adaptable instanceof ICSSModel) {
- adaptable = ((ICSSModel) adaptable).getDocument();
- }
- if (adaptable instanceof INodeNotifier) {
- INodeAdapter nodeAdapter = ((INodeNotifier) adaptable).getAdapterFor(IJFaceNodeAdapter.class);
- if (nodeAdapter instanceof IJFaceNodeAdapter)
- adapter = (IJFaceNodeAdapter) nodeAdapter;
- }
- return adapter;
- }
-
- /**
- * Returns the image for the label of the given element, for use in the
- * given viewer.
- *
- * @param viewer
- * The viewer that displays the element.
- * @param element
- * The element for which to provide the label image. Element
- * can be <code>null</code> indicating no input object is set
- * to the viewer.
- */
- public Image getImage(Object element) {
- Image image = null;
- IJFaceNodeAdapter adapter = getAdapter(element);
- if (adapter != null)
- image = adapter.getLabelImage(element);
- return image;
- }
-
- /**
- * Returns the text for the label of the given element, for use in the
- * given viewer.
- *
- * @param viewer
- * The viewer that displays the element.
- * @param element
- * The element for which to provide the label text. Element can
- * be <code>null</code> indicating no input object is set to
- * the viewer.
- */
- public String getText(Object element) {
- String text = null;
- IJFaceNodeAdapter adapter = getAdapter(element);
- if (adapter != null) {
- text = adapter.getLabelText(element);
- }
- return text;
- }
-
- /**
- * Checks whether this label provider is affected by the given domain
- * event.
- *
- * @deprecated
- */
- public boolean isAffected(Object dummy) {// DomainEvent event) {
- // return event.isModifier(DomainEvent.NON_STRUCTURE_CHANGE);
- return true;
-
- }
-
- /**
- * Returns whether the label would be affected by a change to the given
- * property of the given element. This can be used to optimize a
- * non-structural viewer update. If the property mentioned in the update
- * does not affect the label, then the viewer need not update the label.
- *
- * @param element
- * the element
- * @param property
- * the property
- * @return <code>true</code> if the label would be affected, and
- * <code>false</code> if it would be unaffected
- */
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/SortAction.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/SortAction.java
deleted file mode 100644
index 370dbff1da..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/contentoutline/SortAction.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.css.ui.views.contentoutline;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.wst.css.ui.internal.CSSUIMessages;
-import org.eclipse.wst.css.ui.internal.CSSUIPlugin;
-import org.eclipse.wst.css.ui.internal.editor.CSSEditorPluginImages;
-import org.eclipse.wst.sse.ui.internal.contentoutline.PropertyChangeUpdateAction;
-
-/*
- * Based on DTDContentOutlinePage#SortAction
- */
-class SortAction extends PropertyChangeUpdateAction {
- private TreeViewer treeViewer;
-
- public SortAction(TreeViewer viewer, IPreferenceStore store, String preferenceKey) {
- super(CSSUIMessages.SortAction_0, store, preferenceKey, false); //$NON-NLS-1$
- ImageDescriptor desc = AbstractUIPlugin.imageDescriptorFromPlugin(CSSUIPlugin.ID, CSSEditorPluginImages.IMG_OBJ_SORT);
- setImageDescriptor(desc);
- setToolTipText(getText());
- treeViewer = viewer;
- if (isChecked()) {
- treeViewer.setComparator(new ViewerComparator());
- }
- }
-
- public void update() {
- super.update();
- treeViewer.getControl().setRedraw(false);
- Object[] expandedElements = treeViewer.getExpandedElements();
- if (isChecked()) {
- treeViewer.setComparator(new ViewerComparator());
- }
- else {
- treeViewer.setComparator(null);
- }
- treeViewer.setInput(treeViewer.getInput());
- treeViewer.setExpandedElements(expandedElements);
- treeViewer.getControl().setRedraw(true);
- }
-}
diff --git a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSPropertySheetConfiguration.java b/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSPropertySheetConfiguration.java
deleted file mode 100644
index b8c1fa4c05..0000000000
--- a/bundles/org.eclipse.wst.css.ui/src/org/eclipse/wst/css/ui/views/properties/CSSPropertySheetConfiguration.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2004, 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.css.ui.views.properties;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.progress.UIJob;
-import org.eclipse.ui.views.properties.IPropertySheetPage;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.IPropertySourceProvider;
-import org.eclipse.ui.views.properties.PropertySheetPage;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
-import org.eclipse.wst.css.ui.internal.properties.CSSPropertySource;
-import org.eclipse.wst.sse.core.internal.provisional.INodeAdapter;
-import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
-import org.eclipse.wst.sse.ui.views.properties.PropertySheetConfiguration;
-import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
-
-/**
- * Configuration for property sheet page which shows CSS content.
- *
- * @see org.eclipse.wst.sse.ui.views.properties.PropertySheetConfiguration
- * @since 1.0
- */
-public class CSSPropertySheetConfiguration extends PropertySheetConfiguration {
- private class CSSPropertySheetRefreshAdapter implements INodeAdapter {
- public boolean isAdapterForType(Object type) {
- return false;
- }
-
- public void notifyChanged(INodeNotifier notifier, int eventType, Object changedFeature, Object oldValue, Object newValue, int pos) {
- if (fPropertySheetPage != null) {
- getPropertiesRefreshJob().addPropertySheetPage(fPropertySheetPage);
- }
- }
- }
-
- private class CSSPropertySourceProvider implements IPropertySourceProvider {
- private IPropertySource fPropertySource = null;
- private ICSSNode fSource = null;
-
- public IPropertySource getPropertySource(Object object) {
- if (fSource != null && object.equals(fSource)) {
- return fPropertySource;
- }
-
- if (object instanceof ICSSNode) {
- fSource = (ICSSNode)object;
- fPropertySource = new CSSPropertySource(fSource);
- }
- else {
- fSource = null;
- fPropertySource = null;
- }
- return fPropertySource;
- }
- }
-
- private class PropertiesRefreshJob extends UIJob {
- public static final int UPDATE_DELAY = 200;
-
- private Set propertySheetPages = null;
-
- public PropertiesRefreshJob() {
- super(XMLUIMessages.JFaceNodeAdapter_1);
- setSystem(true);
- setPriority(Job.SHORT);
- propertySheetPages = new HashSet(1);
- }
-
- void addPropertySheetPage(IPropertySheetPage page) {
- propertySheetPages.add(page);
- schedule(UPDATE_DELAY);
- }
-
- public IStatus runInUIThread(IProgressMonitor monitor) {
- Object[] pages = propertySheetPages.toArray();
- propertySheetPages.clear();
-
- for (int i = 0; i < pages.length; i++) {
- PropertySheetPage page = (PropertySheetPage) pages[i];
- if (page.getControl() != null && !page.getControl().isDisposed()) {
- page.refresh();
- }
- }
-
- return Status.OK_STATUS;
- }
- }
-
- private PropertiesRefreshJob fPropertiesRefreshJob = null;
-
- IPropertySheetPage fPropertySheetPage;
-
- private IPropertySourceProvider fPropertySourceProvider = null;
-
- private INodeAdapter fRefreshAdapter = new CSSPropertySheetRefreshAdapter();
-
- private INodeNotifier[] fSelectedNotifiers;
-
- /**
- * Create new instance of CSSPropertySheetConfiguration
- */
- public CSSPropertySheetConfiguration() {
- // Must have empty constructor to createExecutableExtension
- super();
- }
-
- public ISelection getInputSelection(IWorkbenchPart selectingPart, ISelection selection) {
- // remove UI refresh adapters
- if (fSelectedNotifiers != null) {
- for (int i = 0; i < fSelectedNotifiers.length; i++) {
- fSelectedNotifiers[i].removeAdapter(fRefreshAdapter);
- }
- fSelectedNotifiers = null;
- }
-
- ISelection preferredSelection = super.getInputSelection(selectingPart, selection);
- if (preferredSelection instanceof IStructuredSelection) {
- Object[] selectedObjects = new Object[((IStructuredSelection) selection).size()];
- System.arraycopy(((IStructuredSelection) selection).toArray(), 0, selectedObjects, 0, selectedObjects.length);
- for (int i = 0; i < selectedObjects.length; i++) {
- if (selectedObjects[i] instanceof ICSSNode) {
- ICSSNode node = (ICSSNode) selectedObjects[i];
- while (node.getNodeType() == ICSSNode.PRIMITIVEVALUE_NODE || node.getNodeType() == ICSSNode.STYLEDECLITEM_NODE) {
- node = node.getParentNode();
- selectedObjects[i] = node;
- }
- }
- }
-
- /*
- * Add UI refresh adapters and remember notifiers for later
- * removal
- */
- if (selectedObjects.length > 0) {
- List selectedNotifiers = new ArrayList(1);
- for (int i = 0; i < selectedObjects.length; i++) {
- if (selectedObjects[i] instanceof INodeNotifier) {
- selectedNotifiers.add(selectedObjects[i]);
- ((INodeNotifier) selectedObjects[i]).addAdapter(fRefreshAdapter);
- }
- }
- fSelectedNotifiers = (INodeNotifier[]) selectedNotifiers.toArray(new INodeNotifier[selectedNotifiers.size()]);
- }
- preferredSelection = new StructuredSelection(selectedObjects);
- }
- return preferredSelection;
- }
-
- PropertiesRefreshJob getPropertiesRefreshJob() {
- if (fPropertiesRefreshJob == null) {
- fPropertiesRefreshJob = new PropertiesRefreshJob();
- }
- return fPropertiesRefreshJob;
- }
-
- public IPropertySourceProvider getPropertySourceProvider(IPropertySheetPage page) {
- if (fPropertySourceProvider == null) {
- fPropertySourceProvider = new CSSPropertySourceProvider();
- fPropertySheetPage = page;
- }
- return fPropertySourceProvider;
- }
-
- public void unconfigure() {
- super.unconfigure();
- if (fSelectedNotifiers != null) {
- for (int i = 0; i < fSelectedNotifiers.length; i++) {
- fSelectedNotifiers[i].removeAdapter(fRefreshAdapter);
- }
- fSelectedNotifiers = null;
- }
- }
-} \ No newline at end of file

Back to the top