diff options
Diffstat (limited to 'bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/preferences/ui/JSPColorPage.java')
-rw-r--r-- | bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/preferences/ui/JSPColorPage.java | 230 |
1 files changed, 0 insertions, 230 deletions
diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/preferences/ui/JSPColorPage.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/preferences/ui/JSPColorPage.java deleted file mode 100644 index d0be95b91a..0000000000 --- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/internal/preferences/ui/JSPColorPage.java +++ /dev/null @@ -1,230 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2004 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.jsdt.web.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.wst.jsdt.web.core.internal.provisional.contenttype.ContentTypeIdForJSP; -import org.eclipse.wst.jsdt.web.core.internal.regions.DOMJSPRegionContexts; -import org.eclipse.wst.jsdt.web.ui.internal.JSPUIMessages; -import org.eclipse.wst.jsdt.web.ui.internal.JSPUIPlugin; -import org.eclipse.wst.jsdt.web.ui.internal.editor.IHelpContextIds; -import org.eclipse.wst.jsdt.web.ui.internal.style.IStyleConstantsJSP; -import org.eclipse.swt.SWT; -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.html.ui.internal.style.IStyleConstantsHTML; -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.StyledTextColorPicker; -import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext; -import org.eclipse.wst.xml.ui.internal.preferences.XMLColorPage; -import org.eclipse.wst.xml.ui.internal.style.IStyleConstantsXML; - -public class JSPColorPage extends XMLColorPage { - - /** - * Overridden to set up StyledTextColorPicker differently - */ - @Override - protected void createContentsForPicker(Composite parent) { - // create the color picker - fPicker = new JSPStyledTextColorPicker(parent, SWT.NULL); - GridData data = new GridData(GridData.FILL_BOTH); - fPicker.setLayoutData(data); - - fPicker.setPreferenceStore(fOverlayStore); - setupPicker(fPicker); - - fPicker.setText(getSampleText()); - } - - /** - * Set up all the style preference keys in the overlay store - */ - @Override - 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; - } - - @Override - public String getSampleText() { - return JSPUIMessages.Sample_JSP_doc; // = "<%@ page - // \n\tlanguage=\"java\" - // \n\tcontentType=\"text/html; - // charset=ISO-8859-1\"\n%>\n<jsp:include - // flush=\"true\" - // page=\"titleBar.jsp\"/>\n\n<%-- - // Use below tags ONLY for JSP - // 1.1 - // --%>\n<%\n\tSystem.out.println(\"Welcome!\");\n%>\n<%-- - // Use below tags ONLY for JSP - // 1.2 - // --%>\n<jsp:scriptlet>\n\tSystem.out.println(\"Welcome!\");\n</jsp:scriptlet>" - } - - @Override - protected void initContextStyleMap(Dictionary contextStyleMap) { - - initCommonContextStyleMap(contextStyleMap); - contextStyleMap.remove(DOMRegionContext.XML_CONTENT); // leave content - // between tags - // alone - contextStyleMap.remove(DOMRegionContext.XML_DECLARATION_OPEN); // xml/html - // specific - contextStyleMap.remove(DOMRegionContext.XML_DECLARATION_CLOSE); // xml/html - // specific - contextStyleMap.remove(DOMRegionContext.XML_ELEMENT_DECLARATION); // xml/html - // specific - contextStyleMap.remove(DOMRegionContext.XML_ELEMENT_DECL_CLOSE); // xml/html - // specific - - // contextStyleMap.put(XMLJSPRegionContexts.JSP_CONTENT, - // HTMLColorManager.SCRIPT_AREA); - // contextStyleMap.put(XMLJSPRegionContexts.BLOCK_TEXT, - // HTMLColorManager.SCRIPT_AREA); - contextStyleMap.put(DOMJSPRegionContexts.JSP_DECLARATION_OPEN, - IStyleConstantsHTML.SCRIPT_AREA_BORDER); - contextStyleMap.put(DOMJSPRegionContexts.JSP_SCRIPTLET_OPEN, - IStyleConstantsHTML.SCRIPT_AREA_BORDER); - contextStyleMap.put(DOMJSPRegionContexts.JSP_EXPRESSION_OPEN, - IStyleConstantsHTML.SCRIPT_AREA_BORDER); - contextStyleMap.put(DOMJSPRegionContexts.JSP_DIRECTIVE_OPEN, - IStyleConstantsHTML.SCRIPT_AREA_BORDER); - contextStyleMap.put(DOMJSPRegionContexts.JSP_DIRECTIVE_CLOSE, - IStyleConstantsHTML.SCRIPT_AREA_BORDER); - contextStyleMap.put(DOMJSPRegionContexts.JSP_CLOSE, - IStyleConstantsHTML.SCRIPT_AREA_BORDER); - - contextStyleMap.put(DOMJSPRegionContexts.JSP_CONTENT, - IStyleConstantsJSP.JSP_CONTENT); - - contextStyleMap.put(DOMJSPRegionContexts.JSP_DIRECTIVE_NAME, - IStyleConstantsXML.TAG_NAME); - contextStyleMap.put(DOMJSPRegionContexts.JSP_ROOT_TAG_NAME, - IStyleConstantsXML.TAG_NAME); - contextStyleMap.put(DOMJSPRegionContexts.JSP_COMMENT_OPEN, - IStyleConstantsXML.COMMENT_BORDER); - contextStyleMap.put(DOMJSPRegionContexts.JSP_COMMENT_TEXT, - IStyleConstantsXML.COMMENT_TEXT); - contextStyleMap.put(DOMJSPRegionContexts.JSP_COMMENT_CLOSE, - IStyleConstantsXML.COMMENT_BORDER); - - contextStyleMap.put( - DOMJSPRegionContexts.XML_TAG_ATTRIBUTE_VALUE_DQUOTE, - IStyleConstantsXML.TAG_ATTRIBUTE_VALUE); - contextStyleMap.put( - DOMJSPRegionContexts.XML_TAG_ATTRIBUTE_VALUE_SQUOTE, - IStyleConstantsXML.TAG_ATTRIBUTE_VALUE); - } - - @Override - protected void initDescriptions(Dictionary descriptions) { - initCommonDescriptions(descriptions); - descriptions.remove(IStyleConstantsXML.XML_CONTENT); // leave content - // between tags - // alone - descriptions.remove(IStyleConstantsXML.DECL_BORDER); // xml/html - // specific - descriptions.put(IStyleConstantsHTML.SCRIPT_AREA_BORDER, - JSPUIMessages.JSP_Delimiters_UI_); // = "JSP Delimiters" - descriptions.put(IStyleConstantsJSP.JSP_CONTENT, - JSPUIMessages.JSPColorPage_jsp_content); - } - - @Override - protected void initStyleList(ArrayList list) { - initCommonStyleList(list); - list.remove(IStyleConstantsXML.XML_CONTENT); // leave content between - // tags alone - list.remove(IStyleConstantsXML.DECL_BORDER); // xml/html specific - list.add(IStyleConstantsHTML.SCRIPT_AREA_BORDER); - list.add(IStyleConstantsJSP.JSP_CONTENT); - } - - @Override - protected void setupPicker(StyledTextColorPicker picker) { - IModelManager mmanager = StructuredModelManager.getModelManager(); - picker.setParser(mmanager.createStructuredDocumentFor( - ContentTypeIdForJSP.ContentTypeID_JSP).getParser()); - - // create descriptions for highlighting types - Dictionary descriptions = new Hashtable(); - initDescriptions(descriptions); - - // map region types to highlighting types - Dictionary contextStyleMap = new Hashtable(); - initContextStyleMap(contextStyleMap); - - ArrayList styleList = new ArrayList(); - initStyleList(styleList); - - picker.setContextStyleMap(contextStyleMap); - picker.setDescriptions(descriptions); - picker.setStyleList(styleList); - - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) - */ - @Override - protected Control createContents(Composite parent) { - - Control c = super.createContents(parent); - PlatformUI.getWorkbench().getHelpSystem().setHelp(c, - IHelpContextIds.JSP_PREFWEBX_STYLES_HELPID); - return c; - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.preference.PreferencePage#doGetPreferenceStore() - */ - @Override - protected IPreferenceStore doGetPreferenceStore() { - return JSPUIPlugin.getDefault().getPreferenceStore(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.wst.sse.ui.preferences.ui.AbstractColorPage#savePreferences() - */ - @Override - protected void savePreferences() { - JSPUIPlugin.getDefault().savePluginPreferences(); - } -} |