Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 155669 Details for
Bug 256339
Migrate XSL Syntax Highlighting to Semantic Highlighting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to add XSL Semantic Highlighting
xslsemantic.patch (text/plain), 16.88 KB, created by
David Carver
on 2010-01-09 21:37:25 EST
(
hide
)
Description:
Patch to add XSL Semantic Highlighting
Filename:
MIME Type:
Creator:
David Carver
Created:
2010-01-09 21:37:25 EST
Size:
16.88 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.xsl.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xsl.ui/plugin.xml,v >retrieving revision 1.53 >diff -u -r1.53 plugin.xml >--- plugin.xml 12 Oct 2009 17:47:00 -0000 1.53 >+++ plugin.xml 10 Jan 2010 02:40:08 -0000 >@@ -274,5 +274,34 @@ > <contentType id="org.eclipse.wst.xml.core.xslsource" /> > </adapterFactoryDescription> > </extension> >+ <extension >+ point="org.eclipse.wst.sse.ui.semanticHighlighting"> >+ <highlighting >+ class="org.eclipse.wst.xsl.ui.internal.style.XSLTagNameSemanticHighlighting" >+ target="org.eclipse.core.runtime.xml, org.eclipse.wst.xml.core.xslsource"> >+ </highlighting> >+ </extension> >+ <extension >+ point="org.eclipse.wst.sse.ui.semanticHighlighting"> >+ <highlighting >+ class="org.eclipse.wst.xsl.ui.internal.style.XSLAttrNameSemanticHighlighting" >+ target="org.eclipse.core.runtime.xml, org.eclipse.wst.xml.core.xslsource"> >+ </highlighting> >+ </extension> >+<extension >+ point="org.eclipse.wst.sse.ui.semanticHighlighting"> >+ <highlighting >+ class="org.eclipse.wst.xsl.ui.internal.style.XSLAttrValueSemanticHighlighting" >+ target="org.eclipse.core.runtime.xml, org.eclipse.wst.xml.core.xslsource"> >+ </highlighting> >+ </extension> <!-- >+ <extension >+ point="org.eclipse.wst.sse.ui.semanticHighlighting"> >+ <highlighting >+ class="org.eclipse.wst.xsl.ui.internal.style.XSLTagDelimsSemanticHighlighting" >+ target="org.eclipse.core.runtime.xml, org.eclipse.wst.xml.core.xslsource"> >+ </highlighting> >+ </extension> >+--> > > </plugin> >Index: src/org/eclipse/wst/xsl/ui/internal/StructuredTextViewerConfigurationXSL.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/StructuredTextViewerConfigurationXSL.java,v >retrieving revision 1.10 >diff -u -r1.10 StructuredTextViewerConfigurationXSL.java >--- src/org/eclipse/wst/xsl/ui/internal/StructuredTextViewerConfigurationXSL.java 25 Sep 2009 16:21:43 -0000 1.10 >+++ src/org/eclipse/wst/xsl/ui/internal/StructuredTextViewerConfigurationXSL.java 10 Jan 2010 02:40:08 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * David Carver - STAR - bug 213849 - initial API and implementation >+ * David Carver - Intalio - bug 256339 - Switched to SemanticHighlighting for XSL > *******************************************************************************/ > > package org.eclipse.wst.xsl.ui.internal; >@@ -115,15 +116,15 @@ > return fConfiguredContentTypes; > } > >- @Override >- public LineStyleProvider[] getLineStyleProviders( >- ISourceViewer sourceViewer, String partitionType) { >- LineStyleProvider[] providers = null; >- if (isXMLPartition(partitionType)) { >- providers = new LineStyleProvider[] {getLineStyleProviderForXSL()}; >- } >- return providers; >- } >+// @Override >+// public LineStyleProvider[] getLineStyleProviders( >+// ISourceViewer sourceViewer, String partitionType) { >+// LineStyleProvider[] providers = null; >+// if (isXMLPartition(partitionType)) { >+// providers = new LineStyleProvider[] {getLineStyleProviderForXSL()}; >+// } >+// return providers; >+// } > > private boolean isXMLPartition(String partitionType) { > return partitionType.equals(IXMLPartitions.XML_DEFAULT) >Index: src/org/eclipse/wst/xsl/ui/internal/preferences/XSLUIPreferenceInitializer.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/preferences/XSLUIPreferenceInitializer.java,v >retrieving revision 1.5 >diff -u -r1.5 XSLUIPreferenceInitializer.java >--- src/org/eclipse/wst/xsl/ui/internal/preferences/XSLUIPreferenceInitializer.java 10 Feb 2009 00:46:35 -0000 1.5 >+++ src/org/eclipse/wst/xsl/ui/internal/preferences/XSLUIPreferenceInitializer.java 10 Jan 2010 02:40:08 -0000 >@@ -52,5 +52,18 @@ > styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXSL.TAG_NAME, 63, 127, 127) + BOLD; > store.setDefault(IStyleConstantsXSL.TAG_NAME, styleValue); > >+ store.setDefault("xsl.ui.highlighting.tag.bold", true); //$NON-NLS-1$ >+ store.setDefault("xsl.ui.highlighting.tag.italic", false); //$NON-NLS-1$ >+ store.setDefault("xsl.ui.highlighting.tag.strikethrough", false); //$NON-NLS-1$ >+ store.setDefault("xsl.ui.highlighting.tag.underline", false); //$NON-NLS-1$ >+ store.setDefault("xsl.ui.highlighting.tag.enabled", true); //$NON-NLS-1$ >+ store.setDefault("xsl.ui.highlighting.tag.color", "#FF00FF"); //$NON-NLS-1$ //$NON-NLS-2$ >+ >+ store.setDefault("xsl.ui.highlighting.attr.bold", true); //$NON-NLS-1$ >+ store.setDefault("xsl.ui.highlighting.attr.italic", false); //$NON-NLS-1$ >+ store.setDefault("xsl.ui.highlighting.attr.strikethrough", false); //$NON-NLS-1$ >+ store.setDefault("xsl.ui.highlighting.attr.underline", false); //$NON-NLS-1$ >+ store.setDefault("xsl.ui.highlighting.attr.enabled", true); //$NON-NLS-1$ >+ store.setDefault("xsl.ui.highlighting.attr.color", "#FF00FF"); //$NON-NLS-1$ //$NON-NLS-2$ > } > } >Index: src/org/eclipse/wst/xsl/ui/internal/style/AbstractXSLSemanticHighlighting.java >=================================================================== >RCS file: src/org/eclipse/wst/xsl/ui/internal/style/AbstractXSLSemanticHighlighting.java >diff -N src/org/eclipse/wst/xsl/ui/internal/style/AbstractXSLSemanticHighlighting.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xsl/ui/internal/style/AbstractXSLSemanticHighlighting.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,88 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Intalio, Inc. 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: >+ * David Carver (Intalio) - bug 256339 - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.wst.xsl.ui.internal.style; >+ >+import java.util.ArrayList; >+ >+import org.eclipse.jface.preference.IPreferenceStore; >+import org.eclipse.jface.text.Position; >+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.style.ISemanticHighlightingExtension; >+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext; >+import org.eclipse.wst.xsl.ui.internal.XSLUIPlugin; >+ >+public abstract class AbstractXSLSemanticHighlighting implements >+ ISemanticHighlightingExtension { >+ >+ public abstract String getStylePreferenceKey(); >+ >+ public String getBoldPreferenceKey() { >+ return null; >+ } >+ >+ public String getUnderlinePreferenceKey() { >+ return null; >+ } >+ >+ public String getStrikethroughPreferenceKey() { >+ return null; >+ } >+ >+ public String getItalicPreferenceKey() { >+ return null; >+ } >+ >+ public String getColorPreferenceKey() { >+ return null; >+ } >+ >+ public IPreferenceStore getPreferenceStore() { >+ return XSLUIPlugin.getDefault().getPreferenceStore(); >+ } >+ >+ public String getEnabledPreferenceKey() { >+ return null; >+ } >+ >+ public String getDisplayName() { >+ return null; >+ } >+ >+ public abstract Position[] consumes(IStructuredDocumentRegion region); >+ >+ protected Position[] createSemanticPositions(IStructuredDocumentRegion region, String regionType) { >+ if (!region.getType().equals(DOMRegionContext.XML_TAG_NAME)) { >+ return null; >+ } >+ >+ Position p[] = null; >+ ITextRegionList regionList = region.getRegions(); >+ ITextRegion tagRegion = regionList.get(1); >+ >+ if (region.getFullText(tagRegion).contains("xsl:")) { //$NON-NLS-1$ >+ ArrayList arrpos = new ArrayList(); >+ for (int i = 0; i < regionList.size(); i++) { >+ ITextRegion textRegion = regionList.get(i); >+ if (textRegion.getType().equals(regionType)) { >+ Position pos = new Position(region >+ .getStartOffset(textRegion), textRegion.getLength()); >+ arrpos.add(pos); >+ } >+ } >+ p = new Position[arrpos.size()]; >+ arrpos.toArray(p); >+ } >+ return p; >+ } >+ >+} >Index: src/org/eclipse/wst/xsl/ui/internal/style/LineStyleProviderForXSL.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/style/LineStyleProviderForXSL.java,v >retrieving revision 1.9 >diff -u -r1.9 LineStyleProviderForXSL.java >--- src/org/eclipse/wst/xsl/ui/internal/style/LineStyleProviderForXSL.java 10 Apr 2009 22:04:43 -0000 1.9 >+++ src/org/eclipse/wst/xsl/ui/internal/style/LineStyleProviderForXSL.java 10 Jan 2010 02:40:09 -0000 >@@ -45,8 +45,9 @@ > * > * @author David Carver > * @since 1.0 >- * >+ * @deprecated Use AbstractXSLSemanticHighlighting and the SemanticHighlighting extension point > */ >+@Deprecated > public class LineStyleProviderForXSL extends AbstractLineStyleProvider implements LineStyleProvider { > > protected IStructuredDocument structuredDocument; >Index: src/org/eclipse/wst/xsl/ui/internal/style/XSLAttrNameSemanticHighlighting.java >=================================================================== >RCS file: src/org/eclipse/wst/xsl/ui/internal/style/XSLAttrNameSemanticHighlighting.java >diff -N src/org/eclipse/wst/xsl/ui/internal/style/XSLAttrNameSemanticHighlighting.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xsl/ui/internal/style/XSLAttrNameSemanticHighlighting.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,38 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Intalio, Inc. 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: >+ * David Carver (Intalio) - bug 256339 - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.wst.xsl.ui.internal.style; >+ >+ >+import org.eclipse.jface.text.Position; >+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; >+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext; >+ >+public class XSLAttrNameSemanticHighlighting extends >+ AbstractXSLSemanticHighlighting { >+ >+ public XSLAttrNameSemanticHighlighting() { >+ } >+ >+ public String getStylePreferenceKey() { >+ return IStyleConstantsXSL.TAG_ATTRIBUTE_VALUE; >+ } >+ >+ @Override >+ public String getEnabledPreferenceKey() { >+ return "xsl.ui.highlighting.tag.enabled"; //$NON-NLS-1$ >+ } >+ >+ public Position[] consumes(IStructuredDocumentRegion region) { >+ return createSemanticPositions(region, >+ DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE); >+ } >+ >+} >Index: src/org/eclipse/wst/xsl/ui/internal/style/XSLAttrValueSemanticHighlighting.java >=================================================================== >RCS file: src/org/eclipse/wst/xsl/ui/internal/style/XSLAttrValueSemanticHighlighting.java >diff -N src/org/eclipse/wst/xsl/ui/internal/style/XSLAttrValueSemanticHighlighting.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xsl/ui/internal/style/XSLAttrValueSemanticHighlighting.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,38 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Intalio, Inc. 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: >+ * David Carver (Intalio) - bug 256339 - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.wst.xsl.ui.internal.style; >+ >+ >+import org.eclipse.jface.text.Position; >+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; >+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext; >+ >+public class XSLAttrValueSemanticHighlighting extends >+ AbstractXSLSemanticHighlighting { >+ >+ public XSLAttrValueSemanticHighlighting() { >+ } >+ >+ public String getStylePreferenceKey() { >+ return IStyleConstantsXSL.TAG_ATTRIBUTE_NAME; >+ } >+ >+ @Override >+ public String getEnabledPreferenceKey() { >+ return "xsl.ui.highlighting.tag.enabled"; //$NON-NLS-1$ >+ } >+ >+ public Position[] consumes(IStructuredDocumentRegion region) { >+ return createSemanticPositions(region, >+ DOMRegionContext.XML_TAG_ATTRIBUTE_NAME); >+ } >+ >+} >Index: src/org/eclipse/wst/xsl/ui/internal/style/XSLTagDelimsSemanticHighlighting.java >=================================================================== >RCS file: src/org/eclipse/wst/xsl/ui/internal/style/XSLTagDelimsSemanticHighlighting.java >diff -N src/org/eclipse/wst/xsl/ui/internal/style/XSLTagDelimsSemanticHighlighting.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xsl/ui/internal/style/XSLTagDelimsSemanticHighlighting.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,52 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Intalio, Inc. 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: >+ * David Carver (Intalio) - bug 256339 - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.wst.xsl.ui.internal.style; >+ >+ >+import java.util.ArrayList; >+import java.util.Arrays; >+ >+import org.eclipse.jface.text.Position; >+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.xml.core.internal.regions.DOMRegionContext; >+ >+public class XSLTagDelimsSemanticHighlighting extends >+ AbstractXSLSemanticHighlighting { >+ >+ public XSLTagDelimsSemanticHighlighting() { >+ } >+ >+ public String getStylePreferenceKey() { >+ return IStyleConstantsXSL.TAG_BORDER; >+ } >+ >+ @Override >+ public String getEnabledPreferenceKey() { >+ return "xsl.ui.highlighting.tag.enabled"; //$NON-NLS-1$ >+ } >+ >+ public Position[] consumes(IStructuredDocumentRegion region) { >+ >+ Position[] openPos = createSemanticPositions(region, >+ DOMRegionContext.XML_TAG_OPEN); >+ Position[] closePos = createSemanticPositions(region, >+ DOMRegionContext.XML_TAG_CLOSE); >+ ArrayList arrpos = new ArrayList(); >+ arrpos.addAll(Arrays.asList(openPos)); >+ arrpos.addAll(Arrays.asList(closePos)); >+ Position[] allPos = new Position[arrpos.size()]; >+ arrpos.toArray(allPos); >+ return allPos; >+ } >+ >+} >Index: src/org/eclipse/wst/xsl/ui/internal/style/XSLTagNameSemanticHighlighting.java >=================================================================== >RCS file: src/org/eclipse/wst/xsl/ui/internal/style/XSLTagNameSemanticHighlighting.java >diff -N src/org/eclipse/wst/xsl/ui/internal/style/XSLTagNameSemanticHighlighting.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/wst/xsl/ui/internal/style/XSLTagNameSemanticHighlighting.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,34 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Intalio, Inc. 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: >+ * David Carver (Intalio) - bug 256339 - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.wst.xsl.ui.internal.style; >+ >+import org.eclipse.jface.text.Position; >+import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; >+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext; >+ >+public class XSLTagNameSemanticHighlighting extends AbstractXSLSemanticHighlighting { >+ >+ public XSLTagNameSemanticHighlighting() { >+ } >+ >+ public String getStylePreferenceKey() { >+ return IStyleConstantsXSL.TAG_NAME; >+ } >+ >+ @Override >+ public String getEnabledPreferenceKey() { >+ return "xsl.ui.highlighting.tag.enabled"; //$NON-NLS-1$ >+ } >+ >+ public Position[] consumes(IStructuredDocumentRegion region) { >+ return createSemanticPositions(region, DOMRegionContext.XML_TAG_NAME); >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 256339
:
153113
|
153114
| 155669 |
159679