View | Details | Raw Unified | Return to bug 256339 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.xml (+29 lines)
Lines 274-278 Link Here
274
			<contentType id="org.eclipse.wst.xml.core.xslsource" />
274
			<contentType id="org.eclipse.wst.xml.core.xslsource" />
275
		</adapterFactoryDescription>
275
		</adapterFactoryDescription>
276
	</extension>
276
	</extension>
277
 <extension
278
       point="org.eclipse.wst.sse.ui.semanticHighlighting">
279
    <highlighting
280
          class="org.eclipse.wst.xsl.ui.internal.style.XSLTagNameSemanticHighlighting"
281
          target="org.eclipse.core.runtime.xml, org.eclipse.wst.xml.core.xslsource">
282
    </highlighting>
283
 </extension>
284
 <extension
285
       point="org.eclipse.wst.sse.ui.semanticHighlighting">
286
    <highlighting
287
          class="org.eclipse.wst.xsl.ui.internal.style.XSLAttrNameSemanticHighlighting"
288
          target="org.eclipse.core.runtime.xml, org.eclipse.wst.xml.core.xslsource">
289
    </highlighting>
290
 </extension>
291
<extension
292
       point="org.eclipse.wst.sse.ui.semanticHighlighting">
293
    <highlighting
294
          class="org.eclipse.wst.xsl.ui.internal.style.XSLAttrValueSemanticHighlighting"
295
          target="org.eclipse.core.runtime.xml, org.eclipse.wst.xml.core.xslsource">
296
    </highlighting>
297
 </extension> <!--
298
 <extension
299
       point="org.eclipse.wst.sse.ui.semanticHighlighting">
300
    <highlighting
301
          class="org.eclipse.wst.xsl.ui.internal.style.XSLTagDelimsSemanticHighlighting"
302
          target="org.eclipse.core.runtime.xml, org.eclipse.wst.xml.core.xslsource">
303
    </highlighting>
304
 </extension>
305
-->
277
  
306
  
278
</plugin>
307
</plugin>
(-)src/org/eclipse/wst/xsl/ui/internal/StructuredTextViewerConfigurationXSL.java (-9 / +10 lines)
Lines 7-12 Link Here
7
 *
7
 *
8
 * Contributors:
8
 * Contributors:
9
 *     David Carver - STAR - bug 213849 - initial API and implementation
9
 *     David Carver - STAR - bug 213849 - initial API and implementation
10
 *     David Carver - Intalio - bug 256339 - Switched to SemanticHighlighting for XSL
10
 *******************************************************************************/
11
 *******************************************************************************/
11
12
12
package org.eclipse.wst.xsl.ui.internal;
13
package org.eclipse.wst.xsl.ui.internal;
Lines 115-129 Link Here
115
		return fConfiguredContentTypes;
116
		return fConfiguredContentTypes;
116
	}
117
	}
117
118
118
	@Override
119
//	@Override
119
	public LineStyleProvider[] getLineStyleProviders(
120
//	public LineStyleProvider[] getLineStyleProviders(
120
			ISourceViewer sourceViewer, String partitionType) {
121
//			ISourceViewer sourceViewer, String partitionType) {
121
		LineStyleProvider[] providers = null;
122
//		LineStyleProvider[] providers = null;
122
        if (isXMLPartition(partitionType)) {
123
//        if (isXMLPartition(partitionType)) {
123
    		providers = new LineStyleProvider[] {getLineStyleProviderForXSL()};
124
//    		providers = new LineStyleProvider[] {getLineStyleProviderForXSL()};
124
		}
125
//		}
125
		return providers;
126
//		return providers;
126
	}
127
//	}
127
128
128
	private boolean isXMLPartition(String partitionType) {
129
	private boolean isXMLPartition(String partitionType) {
129
		return partitionType.equals(IXMLPartitions.XML_DEFAULT)
130
		return partitionType.equals(IXMLPartitions.XML_DEFAULT)
(-)src/org/eclipse/wst/xsl/ui/internal/preferences/XSLUIPreferenceInitializer.java (+13 lines)
Lines 52-56 Link Here
52
		styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXSL.TAG_NAME, 63, 127, 127) + BOLD;
52
		styleValue = ColorHelper.findRGBString(registry, IStyleConstantsXSL.TAG_NAME, 63, 127, 127) + BOLD;
53
		store.setDefault(IStyleConstantsXSL.TAG_NAME, styleValue);
53
		store.setDefault(IStyleConstantsXSL.TAG_NAME, styleValue);
54
		
54
		
55
		store.setDefault("xsl.ui.highlighting.tag.bold", true); //$NON-NLS-1$
56
		store.setDefault("xsl.ui.highlighting.tag.italic", false); //$NON-NLS-1$
57
		store.setDefault("xsl.ui.highlighting.tag.strikethrough", false); //$NON-NLS-1$
58
		store.setDefault("xsl.ui.highlighting.tag.underline", false); //$NON-NLS-1$
59
		store.setDefault("xsl.ui.highlighting.tag.enabled", true); //$NON-NLS-1$
60
		store.setDefault("xsl.ui.highlighting.tag.color", "#FF00FF"); //$NON-NLS-1$ //$NON-NLS-2$
61
		
62
		store.setDefault("xsl.ui.highlighting.attr.bold", true); //$NON-NLS-1$
63
		store.setDefault("xsl.ui.highlighting.attr.italic", false); //$NON-NLS-1$
64
		store.setDefault("xsl.ui.highlighting.attr.strikethrough", false); //$NON-NLS-1$
65
		store.setDefault("xsl.ui.highlighting.attr.underline", false); //$NON-NLS-1$
66
		store.setDefault("xsl.ui.highlighting.attr.enabled", true); //$NON-NLS-1$
67
		store.setDefault("xsl.ui.highlighting.attr.color", "#FF00FF"); //$NON-NLS-1$ //$NON-NLS-2$
55
	}
68
	}
56
}
69
}
(-)src/org/eclipse/wst/xsl/ui/internal/style/AbstractXSLSemanticHighlighting.java (+88 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 Intalio, Inc. and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     David Carver (Intalio) - bug 256339 - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.wst.xsl.ui.internal.style;
12
13
import java.util.ArrayList;
14
15
import org.eclipse.jface.preference.IPreferenceStore;
16
import org.eclipse.jface.text.Position;
17
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
18
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
19
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
20
import org.eclipse.wst.sse.ui.internal.style.ISemanticHighlightingExtension;
21
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
22
import org.eclipse.wst.xsl.ui.internal.XSLUIPlugin;
23
24
public abstract class AbstractXSLSemanticHighlighting implements
25
		ISemanticHighlightingExtension {
26
27
	public abstract String getStylePreferenceKey();
28
29
	public String getBoldPreferenceKey() {
30
		return null;
31
	}
32
33
	public String getUnderlinePreferenceKey() {
34
		return null;
35
	}
36
37
	public String getStrikethroughPreferenceKey() {
38
		return null;
39
	}
40
41
	public String getItalicPreferenceKey() {
42
		return null;
43
	}
44
45
	public String getColorPreferenceKey() {
46
		return null;
47
	}
48
49
	public IPreferenceStore getPreferenceStore() {
50
		return XSLUIPlugin.getDefault().getPreferenceStore();
51
	}
52
53
	public String getEnabledPreferenceKey() {
54
		return null;
55
	}
56
57
	public String getDisplayName() {
58
		return null;
59
	}
60
61
	public abstract Position[] consumes(IStructuredDocumentRegion region);
62
63
	protected Position[] createSemanticPositions(IStructuredDocumentRegion region, String regionType) {
64
		if (!region.getType().equals(DOMRegionContext.XML_TAG_NAME)) {
65
			return null;
66
		}
67
	
68
		Position p[] = null;
69
		ITextRegionList regionList = region.getRegions();
70
		ITextRegion tagRegion = regionList.get(1);
71
		
72
		if (region.getFullText(tagRegion).contains("xsl:")) { //$NON-NLS-1$
73
			ArrayList arrpos = new ArrayList();
74
			for (int i = 0; i < regionList.size(); i++) {
75
				ITextRegion textRegion = regionList.get(i);
76
				if (textRegion.getType().equals(regionType)) {
77
					Position pos = new Position(region
78
							.getStartOffset(textRegion), textRegion.getLength());
79
					arrpos.add(pos);
80
				}
81
			}
82
			p = new Position[arrpos.size()];
83
			arrpos.toArray(p);
84
		}
85
		return p;
86
	}
87
	
88
}
(-)src/org/eclipse/wst/xsl/ui/internal/style/LineStyleProviderForXSL.java (-1 / +2 lines)
Lines 45-52 Link Here
45
 * 
45
 * 
46
 * @author David Carver
46
 * @author David Carver
47
 * @since 1.0
47
 * @since 1.0
48
 * 
48
 * @deprecated Use AbstractXSLSemanticHighlighting and the SemanticHighlighting extension point
49
 */
49
 */
50
@Deprecated
50
public class LineStyleProviderForXSL extends AbstractLineStyleProvider implements LineStyleProvider {
51
public class LineStyleProviderForXSL extends AbstractLineStyleProvider implements LineStyleProvider {
51
52
52
	protected IStructuredDocument structuredDocument;
53
	protected IStructuredDocument structuredDocument;
(-)src/org/eclipse/wst/xsl/ui/internal/style/XSLAttrNameSemanticHighlighting.java (+38 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 Intalio, Inc. and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     David Carver (Intalio) - bug 256339 - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.wst.xsl.ui.internal.style;
12
13
14
import org.eclipse.jface.text.Position;
15
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
16
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
17
18
public class XSLAttrNameSemanticHighlighting extends
19
		AbstractXSLSemanticHighlighting {
20
21
	public XSLAttrNameSemanticHighlighting() {
22
	}
23
24
	public String getStylePreferenceKey() {
25
		return IStyleConstantsXSL.TAG_ATTRIBUTE_VALUE;
26
	}
27
28
	@Override
29
	public String getEnabledPreferenceKey() {
30
		return "xsl.ui.highlighting.tag.enabled"; //$NON-NLS-1$
31
	}
32
33
	public Position[] consumes(IStructuredDocumentRegion region) {
34
		return createSemanticPositions(region,
35
				DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE);
36
	}
37
38
}
(-)src/org/eclipse/wst/xsl/ui/internal/style/XSLAttrValueSemanticHighlighting.java (+38 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 Intalio, Inc. and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     David Carver (Intalio) - bug 256339 - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.wst.xsl.ui.internal.style;
12
13
14
import org.eclipse.jface.text.Position;
15
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
16
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
17
18
public class XSLAttrValueSemanticHighlighting extends
19
		AbstractXSLSemanticHighlighting {
20
21
	public XSLAttrValueSemanticHighlighting() {
22
	}
23
24
	public String getStylePreferenceKey() {
25
		return IStyleConstantsXSL.TAG_ATTRIBUTE_NAME;
26
	}
27
28
	@Override
29
	public String getEnabledPreferenceKey() {
30
		return "xsl.ui.highlighting.tag.enabled"; //$NON-NLS-1$
31
	}
32
33
	public Position[] consumes(IStructuredDocumentRegion region) {
34
		return createSemanticPositions(region,
35
				DOMRegionContext.XML_TAG_ATTRIBUTE_NAME);
36
	}
37
38
}
(-)src/org/eclipse/wst/xsl/ui/internal/style/XSLTagDelimsSemanticHighlighting.java (+52 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 Intalio, Inc. and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     David Carver (Intalio) - bug 256339 - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.wst.xsl.ui.internal.style;
12
13
14
import java.util.ArrayList;
15
import java.util.Arrays;
16
17
import org.eclipse.jface.text.Position;
18
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
19
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
20
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
21
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
22
23
public class XSLTagDelimsSemanticHighlighting extends
24
		AbstractXSLSemanticHighlighting {
25
26
	public XSLTagDelimsSemanticHighlighting() {
27
	}
28
29
	public String getStylePreferenceKey() {
30
		return IStyleConstantsXSL.TAG_BORDER;
31
	}
32
33
	@Override
34
	public String getEnabledPreferenceKey() {
35
		return "xsl.ui.highlighting.tag.enabled"; //$NON-NLS-1$
36
	}
37
38
	public Position[] consumes(IStructuredDocumentRegion region) {
39
		
40
		Position[] openPos = createSemanticPositions(region,
41
				DOMRegionContext.XML_TAG_OPEN);
42
		Position[] closePos = createSemanticPositions(region,
43
				DOMRegionContext.XML_TAG_CLOSE);
44
		ArrayList arrpos = new ArrayList();
45
		arrpos.addAll(Arrays.asList(openPos));
46
		arrpos.addAll(Arrays.asList(closePos));
47
		Position[] allPos = new Position[arrpos.size()];
48
		arrpos.toArray(allPos);
49
		return allPos;
50
	}
51
52
}
(-)src/org/eclipse/wst/xsl/ui/internal/style/XSLTagNameSemanticHighlighting.java (+34 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 Intalio, Inc. and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     David Carver (Intalio) - bug 256339 - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.wst.xsl.ui.internal.style;
12
13
import org.eclipse.jface.text.Position;
14
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
15
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
16
17
public class XSLTagNameSemanticHighlighting extends AbstractXSLSemanticHighlighting {
18
19
	public XSLTagNameSemanticHighlighting() {
20
	}
21
22
	public String getStylePreferenceKey() {
23
		return IStyleConstantsXSL.TAG_NAME;
24
	}
25
	
26
	@Override
27
	public String getEnabledPreferenceKey() {
28
		return "xsl.ui.highlighting.tag.enabled"; //$NON-NLS-1$
29
	}
30
31
	public Position[] consumes(IStructuredDocumentRegion region) {
32
		return createSemanticPositions(region, DOMRegionContext.XML_TAG_NAME);
33
	}
34
}

Return to bug 256339