JBoss Tools SVN: r6332 - in trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test: META-INF and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: svasilyev
Date: 2008-02-15 06:07:01 -0500 (Fri, 15 Feb 2008)
New Revision: 6332
Added:
trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/plugin.xml
Modified:
trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/META-INF/MANIFEST.MF
trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/src/org/jboss/tools/struts/vpe/struts/test/StrutsAllTests.java
trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/src/org/jboss/tools/struts/vpe/struts/test/StrutsTestPlugin.java
Log:
Some code adjustment and improvement
Modified: trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/META-INF/MANIFEST.MF 2008-02-15 11:04:43 UTC (rev 6331)
+++ trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/META-INF/MANIFEST.MF 2008-02-15 11:07:01 UTC (rev 6332)
@@ -1,8 +1,8 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Struts Test Plug-in
-Bundle-SymbolicName: org.jboss.tools.struts.vpe.struts.test
-Bundle-Version: 1.0.0
+Bundle-SymbolicName: org.jboss.tools.struts.vpe.struts.test;singleton:=true
+Bundle-Version: 2.1.0
Bundle-Activator: org.jboss.tools.struts.vpe.struts.test.StrutsTestPlugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
@@ -15,3 +15,4 @@
Eclipse-LazyStart: true
Bundle-ClassPath: struts-test.jar
Export-Package: org.jboss.tools.struts.vpe.struts.test
+Bundle-Vendor: Red Hat, Inc.
Added: trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/plugin.xml
===================================================================
--- trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/plugin.xml (rev 0)
+++ trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/plugin.xml 2008-02-15 11:07:01 UTC (rev 6332)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.3"?>
+<plugin>
+ <extension
+ point="org.jboss.tools.jsf.vpe.ui.tests">
+ <tests
+ description="Unit tests for Struts support in VPE"
+ name="Struts Tests"
+ testSuite="org.jboss.tools.struts.vpe.struts.test.StrutsAllTests">
+ </tests>
+ </extension>
+
+</plugin>
Modified: trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/src/org/jboss/tools/struts/vpe/struts/test/StrutsAllTests.java
===================================================================
--- trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/src/org/jboss/tools/struts/vpe/struts/test/StrutsAllTests.java 2008-02-15 11:04:43 UTC (rev 6331)
+++ trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/src/org/jboss/tools/struts/vpe/struts/test/StrutsAllTests.java 2008-02-15 11:07:01 UTC (rev 6332)
@@ -28,7 +28,7 @@
public static Test suite() {
- TestSuite suite = new TestSuite("Tests for Vpe Struts components"); // $NON-NLS-1$
+ TestSuite suite = new TestSuite("Tests for Vpe Struts components"); //$NON-NLS-1$
// $JUnit-BEGIN$
suite.addTestSuite(StrutsHTMLComponentTest.class);
suite.addTestSuite(StrutsBeanComponentTest.class);
Modified: trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/src/org/jboss/tools/struts/vpe/struts/test/StrutsTestPlugin.java
===================================================================
--- trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/src/org/jboss/tools/struts/vpe/struts/test/StrutsTestPlugin.java 2008-02-15 11:04:43 UTC (rev 6331)
+++ trunk/struts/tests/org.jboss.tools.struts.vpe.struts.test/src/org/jboss/tools/struts/vpe/struts/test/StrutsTestPlugin.java 2008-02-15 11:07:01 UTC (rev 6332)
@@ -28,7 +28,7 @@
public class StrutsTestPlugin extends BaseUIPlugin {
// The plug-in ID
- public static final String PLUGIN_ID = "org.jboss.tools.struts.vpe.struts.test";
+ public static final String PLUGIN_ID = "org.jboss.tools.struts.vpe.struts.test"; //$NON-NLS-1$
// The shared instance
private static StrutsTestPlugin plugin;
@@ -77,9 +77,9 @@
URL url = null;
try {
url = bundle == null ? null : FileLocator.resolve(bundle
- .getEntry("/resources")); // $NON-NLS-1$
+ .getEntry("/resources")); //$NON-NLS-1$
} catch (Exception e) {
- url = bundle.getEntry("/resources"); // $NON-NLS-1$
+ url = bundle.getEntry("/resources"); //$NON-NLS-1$
}
return (url == null) ? null : url.getPath();
}
16 years, 7 months
JBoss Tools SVN: r6331 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-02-15 06:04:43 -0500 (Fri, 15 Feb 2008)
New Revision: 6331
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-1682, resizing was removed
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-02-15 10:41:43 UTC (rev 6330)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2008-02-15 11:04:43 UTC (rev 6331)
@@ -575,10 +575,6 @@
<vpe:tag name="rich:calendar" case-sensitive="yes">
<vpe:template children="yes" modify="no"
class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesCalendarTemplate">
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
<vpe:dnd>
<vpe:drag start-enable="yes" />
<vpe:drop container="no" />
16 years, 7 months
JBoss Tools SVN: r6330 - in trunk: common/plugins/org.jboss.tools.common.text.xml and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-02-15 05:41:43 -0500 (Fri, 15 Feb 2008)
New Revision: 6330
Added:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoContentAssistantProposal.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/ExtendedJSPContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletsHtmlContentAssistProcessor.java
Removed:
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/RedHatStructuredTextViewerConfigurationXML.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationHTML.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationJSP.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatCustomCompletionProposal.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatHtmlContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatJSPContentAssistProcessor.java
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/xmleditor/XMLTextEditor.java
trunk/common/plugins/org.jboss.tools.common.text.xml/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPDialogCellEditorContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPDialogCellEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/FaceletsJsfCResource.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1704Test.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1717Test.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1585Test.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1641Test.java
trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/StrutsJspJbide1648Test.java
trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
Log:
Got rid of "RedHat" in class names.
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/xmleditor/XMLTextEditor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/xmleditor/XMLTextEditor.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/texteditors/xmleditor/XMLTextEditor.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -77,7 +77,7 @@
import org.jboss.tools.common.model.ui.editors.dnd.context.InnerDragBuffer;
import org.jboss.tools.common.model.ui.views.palette.PaletteInsertHelper;
import org.jboss.tools.common.text.xml.IOccurrencePreferenceProvider;
-import org.jboss.tools.common.text.xml.RedHatStructuredTextViewerConfigurationXML;
+import org.jboss.tools.common.text.xml.XMLTextViewerConfiguration;
import org.jboss.tools.common.text.xml.XmlEditorPlugin;
import org.jboss.tools.jst.jsp.text.xpl.IStructuredTextOccurrenceStructureProvider;
@@ -102,7 +102,7 @@
/// dnd.setTextEditorDropProvider(new TextEditorDropProviderImpl());
if (useRHDSConfig) {
- super.setSourceViewerConfiguration(new RedHatStructuredTextViewerConfigurationXML());
+ super.setSourceViewerConfiguration(new XMLTextViewerConfiguration());
}
}
@@ -110,12 +110,12 @@
protected void setSourceViewerConfiguration(SourceViewerConfiguration config) {
if( useRHDSConfig
- && !(config instanceof RedHatStructuredTextViewerConfigurationXML)
+ && !(config instanceof XMLTextViewerConfiguration)
&& (config instanceof StructuredTextViewerConfigurationXML
|| !(config instanceof StructuredTextViewerConfiguration)
)
) {
- RedHatStructuredTextViewerConfigurationXML r = new RedHatStructuredTextViewerConfigurationXML();
+ XMLTextViewerConfiguration r = new XMLTextViewerConfiguration();
r.setInitialConfiguration(config);
config = r;
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/plugin.xml 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/plugin.xml 2008-02-15 10:41:43 UTC (rev 6330)
@@ -21,7 +21,7 @@
<extension
point="org.eclipse.wst.sse.ui.editorConfiguration">
<sourceViewerConfiguration
- class="org.jboss.tools.common.text.xml.RedHatStructuredTextViewerConfigurationXML"
+ class="org.jboss.tools.common.text.xml.XMLTextViewerConfiguration"
target="org.eclipse.core.runtime.xml"/>
<contentOutlineConfiguration
class="org.eclipse.wst.xml.ui.views.contentoutline.XMLContentOutlineConfiguration"
@@ -66,7 +66,7 @@
<extension
point="org.eclipse.wst.sse.ui.editorConfiguration">
<sourceViewerConfiguration
- class="org.jboss.tools.common.text.xml.RedHatStructuredTextViewerConfigurationXML"
+ class="org.jboss.tools.common.text.xml.XMLTextViewerConfiguration"
target="org.jboss.tools.common.model.ui.xml"/>
<contentOutlineConfiguration
class="org.eclipse.wst.xml.ui.views.contentoutline.XMLContentOutlineConfiguration"
Deleted: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/RedHatStructuredTextViewerConfigurationXML.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/RedHatStructuredTextViewerConfigurationXML.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/RedHatStructuredTextViewerConfigurationXML.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.common.text.xml;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
-import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
-import org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML;
-import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorBuilder;
-import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorDefinition;
-
-/**
- * @author Igels
- */
-public class RedHatStructuredTextViewerConfigurationXML extends StructuredTextViewerConfigurationXML {
-
- SourceViewerConfiguration initial = null;
-
- public RedHatStructuredTextViewerConfigurationXML() {
- super();
- }
-
- public void setInitialConfiguration(SourceViewerConfiguration initial) {
- this.initial = initial;
- }
-
- protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
-
- // if we have our own processors we need
- // to define them in plugin.xml file of their
- // plugins using extention point
- // "org.jboss.tools.common.text.xml.contentAssistProcessor"
-
- ContentAssistProcessorDefinition[] defs = ContentAssistProcessorBuilder.getInstance().getContentAssistProcessorDefinitions(partitionType);
-
- if(defs==null) return null;
-
- List processors = new ArrayList();
- for(int i=0; i<defs.length; i++) {
- IContentAssistProcessor processor = defs[i].createContentAssistProcessor();
- if(!processors.contains(processor)) {
- processors.add(processor);
- }
- }
-
- IContentAssistProcessor[] in = getInitialProcessors(sourceViewer, partitionType);
- if(in != null && in.length > 0) {
-
- //we do not need super processors - make initial processors responcible for that
- for(int i=0; i<in.length; i++) {
- if(!processors.contains(in[i])) {
- processors.add(in[i]);
- }
- }
- } else {
- IContentAssistProcessor[] ps = super.getContentAssistProcessors(sourceViewer, partitionType);
- for(int i=0; ps != null && i<ps.length; i++) {
- if(!processors.contains(ps[i])) {
- processors.add(ps[i]);
- }
- }
- }
- return (IContentAssistProcessor[])processors.toArray(new IContentAssistProcessor[0]);
- }
-
- /*
- * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getHyperlinkDetectors(org.eclipse.jface.text.source.ISourceViewer)
- * @since 3.1
- */
- public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
- if (fPreferenceStore == null)
- return null;
- if (sourceViewer == null || !fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED))
- return null;
-
- List allDetectors = new ArrayList(0);
-
- IHyperlinkDetector extHyperlinkDetector = getTextEditorsExtensionsHyperlinkDetector();
-
- if (extHyperlinkDetector != null) allDetectors.add(extHyperlinkDetector);
-
-/*
- IHyperlinkDetector[] superDetectors = super.getHyperlinkDetectors(sourceViewer);
- for (int m = 0; m < superDetectors.length; m++) {
- IHyperlinkDetector detector = superDetectors[m];
- if (!allDetectors.contains(detector)) {
- allDetectors.add(detector);
- }
- }
-*/
- IHyperlinkDetector[] ts = (IHyperlinkDetector[]) allDetectors.toArray(new IHyperlinkDetector[0]);
- IHyperlinkDetector[] in = (initial != null) ? initial.getHyperlinkDetectors(sourceViewer) : null;
- if(in == null || in.length == 0) return ts;
- if(ts == null || ts.length == 0) return in;
- ArrayList<IHyperlinkDetector> total = new ArrayList<IHyperlinkDetector>();
- for (int i = 0; i < ts.length; i++) total.add(ts[i]);
- for (int i = 0; i < in.length; i++) if(!total.contains(in[i])) total.add(in[i]);
- return total.toArray(new IHyperlinkDetector[0]);
- }
-
- private IHyperlinkDetector getTextEditorsExtensionsHyperlinkDetector() {
- Plugin plugin = Platform.getPlugin("org.jboss.tools.common.text.ext");
- return (plugin != null && plugin instanceof IAdaptable ? (IHyperlinkDetector)((IAdaptable)plugin).getAdapter(IHyperlinkDetector.class):null);
- }
-
- IContentAssistProcessor[] getInitialProcessors(ISourceViewer sourceViewer, String partitionType) {
- if(initial == null) return null;
- try {
- Method m = initial.getClass().getDeclaredMethod("getContentAssistProcessors", new Class[]{ISourceViewer.class, String.class});
- m.setAccessible(true);
- return (IContentAssistProcessor[])m.invoke(initial, new Object[]{sourceViewer, partitionType});
- } catch (Exception e) {
- XmlEditorPlugin.getPluginLog().logError(e);
- }
-
- return null;
- }
-
-}
Copied: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java (from rev 2297, trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/RedHatStructuredTextViewerConfigurationXML.java)
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/XMLTextViewerConfiguration.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.text.xml;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
+import org.eclipse.wst.xml.ui.StructuredTextViewerConfigurationXML;
+import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorBuilder;
+import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorDefinition;
+
+/**
+ * @author Igels
+ */
+public class XMLTextViewerConfiguration extends StructuredTextViewerConfigurationXML {
+
+ SourceViewerConfiguration initial = null;
+
+ public XMLTextViewerConfiguration() {
+ super();
+ }
+
+ public void setInitialConfiguration(SourceViewerConfiguration initial) {
+ this.initial = initial;
+ }
+
+ protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
+
+ // if we have our own processors we need
+ // to define them in plugin.xml file of their
+ // plugins using extention point
+ // "org.jboss.tools.common.text.xml.contentAssistProcessor"
+
+ ContentAssistProcessorDefinition[] defs = ContentAssistProcessorBuilder.getInstance().getContentAssistProcessorDefinitions(partitionType);
+
+ if(defs==null) return null;
+
+ List processors = new ArrayList();
+ for(int i=0; i<defs.length; i++) {
+ IContentAssistProcessor processor = defs[i].createContentAssistProcessor();
+ if(!processors.contains(processor)) {
+ processors.add(processor);
+ }
+ }
+
+ IContentAssistProcessor[] in = getInitialProcessors(sourceViewer, partitionType);
+ if(in != null && in.length > 0) {
+
+ //we do not need super processors - make initial processors responcible for that
+ for(int i=0; i<in.length; i++) {
+ if(!processors.contains(in[i])) {
+ processors.add(in[i]);
+ }
+ }
+ } else {
+ IContentAssistProcessor[] ps = super.getContentAssistProcessors(sourceViewer, partitionType);
+ for(int i=0; ps != null && i<ps.length; i++) {
+ if(!processors.contains(ps[i])) {
+ processors.add(ps[i]);
+ }
+ }
+ }
+ return (IContentAssistProcessor[])processors.toArray(new IContentAssistProcessor[0]);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getHyperlinkDetectors(org.eclipse.jface.text.source.ISourceViewer)
+ * @since 3.1
+ */
+ public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
+ if (fPreferenceStore == null)
+ return null;
+ if (sourceViewer == null || !fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED))
+ return null;
+
+ List allDetectors = new ArrayList(0);
+
+ IHyperlinkDetector extHyperlinkDetector = getTextEditorsExtensionsHyperlinkDetector();
+
+ if (extHyperlinkDetector != null) allDetectors.add(extHyperlinkDetector);
+
+/*
+ IHyperlinkDetector[] superDetectors = super.getHyperlinkDetectors(sourceViewer);
+ for (int m = 0; m < superDetectors.length; m++) {
+ IHyperlinkDetector detector = superDetectors[m];
+ if (!allDetectors.contains(detector)) {
+ allDetectors.add(detector);
+ }
+ }
+*/
+ IHyperlinkDetector[] ts = (IHyperlinkDetector[]) allDetectors.toArray(new IHyperlinkDetector[0]);
+ IHyperlinkDetector[] in = (initial != null) ? initial.getHyperlinkDetectors(sourceViewer) : null;
+ if(in == null || in.length == 0) return ts;
+ if(ts == null || ts.length == 0) return in;
+ ArrayList<IHyperlinkDetector> total = new ArrayList<IHyperlinkDetector>();
+ for (int i = 0; i < ts.length; i++) total.add(ts[i]);
+ for (int i = 0; i < in.length; i++) if(!total.contains(in[i])) total.add(in[i]);
+ return total.toArray(new IHyperlinkDetector[0]);
+ }
+
+ private IHyperlinkDetector getTextEditorsExtensionsHyperlinkDetector() {
+ Plugin plugin = Platform.getPlugin("org.jboss.tools.common.text.ext");
+ return (plugin != null && plugin instanceof IAdaptable ? (IHyperlinkDetector)((IAdaptable)plugin).getAdapter(IHyperlinkDetector.class):null);
+ }
+
+ IContentAssistProcessor[] getInitialProcessors(ISourceViewer sourceViewer, String partitionType) {
+ if(initial == null) return null;
+ try {
+ Method m = initial.getClass().getDeclaredMethod("getContentAssistProcessors", new Class[]{ISourceViewer.class, String.class});
+ m.setAccessible(true);
+ return (IContentAssistProcessor[])m.invoke(initial, new Object[]{sourceViewer, partitionType});
+ } catch (Exception e) {
+ XmlEditorPlugin.getPluginLog().logError(e);
+ }
+
+ return null;
+ }
+
+}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2008-02-15 10:41:43 UTC (rev 6330)
@@ -7,7 +7,7 @@
<extension point="org.eclipse.wst.sse.ui.editorConfiguration">
<sourceViewerConfiguration
- class="org.jboss.tools.jst.jsp.ExtendedStructuredTextViewerConfigurationJSP"
+ class="org.jboss.tools.jst.jsp.JSPTextViewerConfiguration"
target="org.eclipse.jst.jsp.core.jspsource"/>
<contentOutlineConfiguration
class="org.eclipse.jst.jsp.ui.views.contentoutline.JSPContentOutlineConfiguration"
@@ -53,7 +53,7 @@
target="org.eclipse.jst.jsp.core.jspsource"/>
<sourceViewerConfiguration
- class="org.jboss.tools.jst.jsp.ExtendedStructuredTextViewerConfigurationHTML"
+ class="org.jboss.tools.jst.jsp.HTMLTextViewerConfiguration"
target="org.eclipse.wst.html.core.htmlsource"/>
<contentOutlineConfiguration
class="org.eclipse.wst.html.ui.views.contentoutline.HTMLContentOutlineConfiguration"
Deleted: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationHTML.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationHTML.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationHTML.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.jsp;
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-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.hyperlink.IHyperlinkDetector;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jst.jsp.core.text.IJSPPartitions;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
-import org.eclipse.wst.html.core.text.IHTMLPartitions;
-import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML;
-import org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy;
-import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorBuilder;
-import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorDefinition;
-import org.jboss.tools.jst.jsp.contentassist.RedHatHtmlContentAssistProcessor;
-import org.jboss.tools.jst.jsp.format.HTMLFormatProcessor;
-import org.osgi.framework.Bundle;
-
-public class ExtendedStructuredTextViewerConfigurationHTML extends StructuredTextViewerConfigurationHTML {
-
- public ExtendedStructuredTextViewerConfigurationHTML() {
- super();
- }
-
- protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
-// IContentAssistProcessor[] processors = null;
-
- // if we have our own processors we need
- // to define them in plugin.xml file of their
- // plugins using extention point
- // "org.jboss.tools.common.text.xml.contentAssistProcessor"
-
- ContentAssistProcessorDefinition[] defs = ContentAssistProcessorBuilder.getInstance().getContentAssistProcessorDefinitions(partitionType);
-
- if(defs==null) return null;
-
- List<IContentAssistProcessor> processors = new ArrayList<IContentAssistProcessor>();
- for(int i=0; i<defs.length; i++) {
- IContentAssistProcessor processor = defs[i].createContentAssistProcessor();
- if(!processors.contains(processor)) {
- processors.add(processor);
- }
- }
-
- if (partitionType == IHTMLPartitions.HTML_DEFAULT ||
- partitionType == IJSPPartitions.JSP_DEFAULT_EL) {
- processors.add(new RedHatHtmlContentAssistProcessor());
- }
-
- return (IContentAssistProcessor[])processors.toArray(new IContentAssistProcessor[0]);
- }
-
-
- /*
- * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getHyperlinkDetectors(org.eclipse.jface.text.source.ISourceViewer)
- * @since 3.1
- */
- public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
- if (fPreferenceStore == null)
- return null;
- if (sourceViewer == null || !fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED))
- return null;
-
- List allDetectors = new ArrayList(0);
-
- IHyperlinkDetector extHyperlinkDetector = getTextEditorsExtensionsHyperlinkDetector();
-
- if (extHyperlinkDetector != null) allDetectors.add(extHyperlinkDetector);
-
-/*
- IHyperlinkDetector[] superDetectors = super.getHyperlinkDetectors(sourceViewer);
- for (int m = 0; m < superDetectors.length; m++) {
- IHyperlinkDetector detector = superDetectors[m];
- if (!allDetectors.contains(detector)) {
- allDetectors.add(detector);
- }
- }
-*/
- return (IHyperlinkDetector[]) allDetectors.toArray(new IHyperlinkDetector[0]);
- }
-
- private IHyperlinkDetector getTextEditorsExtensionsHyperlinkDetector() {
- Plugin plugin = Platform.getPlugin("org.jboss.tools.common.text.ext");
- return (plugin != null && plugin instanceof IAdaptable ? (IHyperlinkDetector)((IAdaptable)plugin).getAdapter(IHyperlinkDetector.class):null);
- }
-
- private IHyperlinkDetector getTextEditorsExtensionsHyperlinkDetector1() {
- IHyperlinkDetector result = null;
- final Object[] bundleActivationResult = new Object[] { Boolean.FALSE };
- final Bundle bundle = Platform.getBundle("org.jboss.tools.common.text.ext");
- if (bundle != null && bundle.getState() == org.osgi.framework.Bundle.ACTIVE) {
- bundleActivationResult[0] = Boolean.TRUE;
- } else {
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- bundleActivationResult[0] = Boolean.TRUE;
- }
- });
- }
-
- if (Boolean.TRUE.equals(bundleActivationResult[0])) {
- try {
- Dictionary headers = bundle.getHeaders();
- String pluginClass = (String)headers.get("Plugin-Class");
- Class plugin = bundle.loadClass(pluginClass);
-
- Object obj = plugin.newInstance();
- if (obj instanceof IAdaptable) {
- result = (IHyperlinkDetector)((IAdaptable)obj).getAdapter(IHyperlinkDetector.class);
- }
- } catch (Exception x) {
- JspEditorPlugin.getPluginLog().logError("Error in loading hyperlink detector", x);
- }
- }
- return result;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML#getContentFormatter(org.eclipse.jface.text.source.ISourceViewer)
- */
- public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
- MultiPassContentFormatter formatter = new MultiPassContentFormatter(getConfiguredDocumentPartitioning(sourceViewer), IHTMLPartitions.HTML_DEFAULT);
- formatter.setMasterStrategy(new StructuredFormattingStrategy(new HTMLFormatProcessor()));
- return formatter;
- }
-}
\ No newline at end of file
Deleted: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationJSP.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationJSP.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationJSP.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.jsp;
-
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jst.jsp.core.text.IJSPPartitions;
-import org.eclipse.jst.jsp.ui.StructuredTextViewerConfigurationJSP;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
-import org.eclipse.wst.html.core.text.IHTMLPartitions;
-import org.eclipse.wst.xml.core.text.IXMLPartitions;
-import org.osgi.framework.Bundle;
-
-import org.jboss.tools.common.model.plugin.ModelPlugin;
-import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorBuilder;
-import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorDefinition;
-import org.jboss.tools.jst.jsp.contentassist.RedHatHtmlContentAssistProcessor;
-import org.jboss.tools.jst.jsp.contentassist.RedHatJSPContentAssistProcessor;
-
-/**
- * @author Igels
- */
-public class ExtendedStructuredTextViewerConfigurationJSP extends StructuredTextViewerConfigurationJSP {
-
- public ExtendedStructuredTextViewerConfigurationJSP() {
- super();
- }
-
- protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
- // if we have our own processors we need
- // to define them in plugin.xml file of their
- // plugins using extention point
- // "org.jboss.tools.common.text.xml.contentAssistProcessor"
-
- ContentAssistProcessorDefinition[] defs = ContentAssistProcessorBuilder.getInstance().getContentAssistProcessorDefinitions(partitionType);
-
- if(defs==null) return null;
-
- List processors = new ArrayList();
- for(int i=0; i<defs.length; i++) {
- IContentAssistProcessor processor = defs[i].createContentAssistProcessor();
- if(!processors.contains(processor)) {
- processors.add(processor);
- }
- }
-
- if ((partitionType == IXMLPartitions.XML_DEFAULT) ||
- (partitionType == IHTMLPartitions.HTML_DEFAULT) ||
- (partitionType == IJSPPartitions.JSP_DEFAULT) ||
- (partitionType == IJSPPartitions.JSP_DIRECTIVE) ||
- (partitionType == IJSPPartitions.JSP_CONTENT_DELIMITER) ||
- (partitionType == IJSPPartitions.JSP_DEFAULT_EL) ||
- (partitionType == IJSPPartitions.JSP_DEFAULT_EL2)) {
- processors.add(new RedHatJSPContentAssistProcessor());
- return (IContentAssistProcessor[])processors.toArray(new IContentAssistProcessor[0]);
- }
- IContentAssistProcessor[] superProcessors = super.getContentAssistProcessors(sourceViewer, partitionType);
-
- if (superProcessors != null && superProcessors.length > 0) {
- for (int i = 0; i < superProcessors.length; i++)
- processors.add(superProcessors[i]);
- }
-
- return (IContentAssistProcessor[])processors.toArray(new IContentAssistProcessor[0]);
- }
-
- /*
- * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getHyperlinkDetectors(org.eclipse.jface.text.source.ISourceViewer)
- * @since 3.1
- */
- public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
- if (fPreferenceStore == null)
- return null;
- if (sourceViewer == null || !fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED))
- return null;
-
- List allDetectors = new ArrayList(0);
-
- IHyperlinkDetector extHyperlinkDetector = getTextEditorsExtensionsHyperlinkDetector();
-
- if (extHyperlinkDetector != null) allDetectors.add(extHyperlinkDetector);
-
-/* IHyperlinkDetector[] superDetectors = super.getHyperlinkDetectors(sourceViewer);
- for (int m = 0; m < superDetectors.length; m++) {
- IHyperlinkDetector detector = superDetectors[m];
- if (!allDetectors.contains(detector)) {
- allDetectors.add(detector);
- }
- }
-*/
- return (IHyperlinkDetector[]) allDetectors.toArray(new IHyperlinkDetector[0]);
- }
-
- private IHyperlinkDetector getTextEditorsExtensionsHyperlinkDetector() {
- Plugin plugin = Platform.getPlugin("org.jboss.tools.common.text.ext");
- return (plugin != null && plugin instanceof IAdaptable ? (IHyperlinkDetector)((IAdaptable)plugin).getAdapter(IHyperlinkDetector.class):null);
- }
-
- private IHyperlinkDetector getTextEditorsExtensionsHyperlinkDetector1() {
- IHyperlinkDetector result = null;
- final Object[] bundleActivationResult = new Object[] { Boolean.FALSE };
- final Bundle bundle = Platform.getBundle("org.jboss.tools.common.text.ext");
- if (bundle != null && bundle.getState() == org.osgi.framework.Bundle.ACTIVE) {
- bundleActivationResult[0] = Boolean.TRUE;
- } else {
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- bundleActivationResult[0] = Boolean.TRUE;
- }
- });
- }
-
- if (Boolean.TRUE.equals(bundleActivationResult[0])) {
- try {
- Dictionary headers = bundle.getHeaders();
- String pluginClass = (String)headers.get("Plugin-Class");
- Class plugin = bundle.loadClass(pluginClass);
-
- Object obj = plugin.newInstance();
- if (obj instanceof IAdaptable) {
- result = (IHyperlinkDetector)((IAdaptable)obj).getAdapter(IHyperlinkDetector.class);
- }
- } catch (Exception x) {
- JspEditorPlugin.getPluginLog().logError("Error in loading hyperlink detector", x);
- }
- }
- return result;
- }
-}
\ No newline at end of file
Copied: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java (from rev 6207, trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationHTML.java)
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -0,0 +1,145 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp;
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+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.hyperlink.IHyperlinkDetector;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jst.jsp.core.text.IJSPPartitions;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
+import org.eclipse.wst.html.core.text.IHTMLPartitions;
+import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML;
+import org.eclipse.wst.sse.ui.internal.format.StructuredFormattingStrategy;
+import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorBuilder;
+import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorDefinition;
+import org.jboss.tools.jst.jsp.contentassist.FaceletsHtmlContentAssistProcessor;
+import org.jboss.tools.jst.jsp.format.HTMLFormatProcessor;
+import org.osgi.framework.Bundle;
+
+public class HTMLTextViewerConfiguration extends StructuredTextViewerConfigurationHTML {
+
+ public HTMLTextViewerConfiguration() {
+ super();
+ }
+
+ protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
+// IContentAssistProcessor[] processors = null;
+
+ // if we have our own processors we need
+ // to define them in plugin.xml file of their
+ // plugins using extention point
+ // "org.jboss.tools.common.text.xml.contentAssistProcessor"
+
+ ContentAssistProcessorDefinition[] defs = ContentAssistProcessorBuilder.getInstance().getContentAssistProcessorDefinitions(partitionType);
+
+ if(defs==null) return null;
+
+ List<IContentAssistProcessor> processors = new ArrayList<IContentAssistProcessor>();
+ for(int i=0; i<defs.length; i++) {
+ IContentAssistProcessor processor = defs[i].createContentAssistProcessor();
+ if(!processors.contains(processor)) {
+ processors.add(processor);
+ }
+ }
+
+ if (partitionType == IHTMLPartitions.HTML_DEFAULT ||
+ partitionType == IJSPPartitions.JSP_DEFAULT_EL) {
+ processors.add(new FaceletsHtmlContentAssistProcessor());
+ }
+
+ return (IContentAssistProcessor[])processors.toArray(new IContentAssistProcessor[0]);
+ }
+
+
+ /*
+ * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getHyperlinkDetectors(org.eclipse.jface.text.source.ISourceViewer)
+ * @since 3.1
+ */
+ public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
+ if (fPreferenceStore == null)
+ return null;
+ if (sourceViewer == null || !fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED))
+ return null;
+
+ List allDetectors = new ArrayList(0);
+
+ IHyperlinkDetector extHyperlinkDetector = getTextEditorsExtensionsHyperlinkDetector();
+
+ if (extHyperlinkDetector != null) allDetectors.add(extHyperlinkDetector);
+
+/*
+ IHyperlinkDetector[] superDetectors = super.getHyperlinkDetectors(sourceViewer);
+ for (int m = 0; m < superDetectors.length; m++) {
+ IHyperlinkDetector detector = superDetectors[m];
+ if (!allDetectors.contains(detector)) {
+ allDetectors.add(detector);
+ }
+ }
+*/
+ return (IHyperlinkDetector[]) allDetectors.toArray(new IHyperlinkDetector[0]);
+ }
+
+ private IHyperlinkDetector getTextEditorsExtensionsHyperlinkDetector() {
+ Plugin plugin = Platform.getPlugin("org.jboss.tools.common.text.ext");
+ return (plugin != null && plugin instanceof IAdaptable ? (IHyperlinkDetector)((IAdaptable)plugin).getAdapter(IHyperlinkDetector.class):null);
+ }
+
+ private IHyperlinkDetector getTextEditorsExtensionsHyperlinkDetector1() {
+ IHyperlinkDetector result = null;
+ final Object[] bundleActivationResult = new Object[] { Boolean.FALSE };
+ final Bundle bundle = Platform.getBundle("org.jboss.tools.common.text.ext");
+ if (bundle != null && bundle.getState() == org.osgi.framework.Bundle.ACTIVE) {
+ bundleActivationResult[0] = Boolean.TRUE;
+ } else {
+ BusyIndicator.showWhile(null, new Runnable() {
+ public void run() {
+ bundleActivationResult[0] = Boolean.TRUE;
+ }
+ });
+ }
+
+ if (Boolean.TRUE.equals(bundleActivationResult[0])) {
+ try {
+ Dictionary headers = bundle.getHeaders();
+ String pluginClass = (String)headers.get("Plugin-Class");
+ Class plugin = bundle.loadClass(pluginClass);
+
+ Object obj = plugin.newInstance();
+ if (obj instanceof IAdaptable) {
+ result = (IHyperlinkDetector)((IAdaptable)obj).getAdapter(IHyperlinkDetector.class);
+ }
+ } catch (Exception x) {
+ JspEditorPlugin.getPluginLog().logError("Error in loading hyperlink detector", x);
+ }
+ }
+ return result;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML#getContentFormatter(org.eclipse.jface.text.source.ISourceViewer)
+ */
+ public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
+ MultiPassContentFormatter formatter = new MultiPassContentFormatter(getConfiguredDocumentPartitioning(sourceViewer), IHTMLPartitions.HTML_DEFAULT);
+ formatter.setMasterStrategy(new StructuredFormattingStrategy(new HTMLFormatProcessor()));
+ return formatter;
+ }
+}
\ No newline at end of file
Copied: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java (from rev 6207, trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/ExtendedStructuredTextViewerConfigurationJSP.java)
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/JSPTextViewerConfiguration.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp;
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jst.jsp.core.text.IJSPPartitions;
+import org.eclipse.jst.jsp.ui.StructuredTextViewerConfigurationJSP;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants;
+import org.eclipse.wst.html.core.text.IHTMLPartitions;
+import org.eclipse.wst.xml.core.text.IXMLPartitions;
+import org.osgi.framework.Bundle;
+
+import org.jboss.tools.common.model.plugin.ModelPlugin;
+import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorBuilder;
+import org.jboss.tools.common.text.xml.contentassist.ContentAssistProcessorDefinition;
+import org.jboss.tools.jst.jsp.contentassist.FaceletsHtmlContentAssistProcessor;
+import org.jboss.tools.jst.jsp.contentassist.ExtendedJSPContentAssistProcessor;
+
+/**
+ * @author Igels
+ */
+public class JSPTextViewerConfiguration extends StructuredTextViewerConfigurationJSP {
+
+ public JSPTextViewerConfiguration() {
+ super();
+ }
+
+ protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
+ // if we have our own processors we need
+ // to define them in plugin.xml file of their
+ // plugins using extention point
+ // "org.jboss.tools.common.text.xml.contentAssistProcessor"
+
+ ContentAssistProcessorDefinition[] defs = ContentAssistProcessorBuilder.getInstance().getContentAssistProcessorDefinitions(partitionType);
+
+ if(defs==null) return null;
+
+ List processors = new ArrayList();
+ for(int i=0; i<defs.length; i++) {
+ IContentAssistProcessor processor = defs[i].createContentAssistProcessor();
+ if(!processors.contains(processor)) {
+ processors.add(processor);
+ }
+ }
+
+ if ((partitionType == IXMLPartitions.XML_DEFAULT) ||
+ (partitionType == IHTMLPartitions.HTML_DEFAULT) ||
+ (partitionType == IJSPPartitions.JSP_DEFAULT) ||
+ (partitionType == IJSPPartitions.JSP_DIRECTIVE) ||
+ (partitionType == IJSPPartitions.JSP_CONTENT_DELIMITER) ||
+ (partitionType == IJSPPartitions.JSP_DEFAULT_EL) ||
+ (partitionType == IJSPPartitions.JSP_DEFAULT_EL2)) {
+ processors.add(new ExtendedJSPContentAssistProcessor());
+ return (IContentAssistProcessor[])processors.toArray(new IContentAssistProcessor[0]);
+ }
+ IContentAssistProcessor[] superProcessors = super.getContentAssistProcessors(sourceViewer, partitionType);
+
+ if (superProcessors != null && superProcessors.length > 0) {
+ for (int i = 0; i < superProcessors.length; i++)
+ processors.add(superProcessors[i]);
+ }
+
+ return (IContentAssistProcessor[])processors.toArray(new IContentAssistProcessor[0]);
+ }
+
+ /*
+ * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getHyperlinkDetectors(org.eclipse.jface.text.source.ISourceViewer)
+ * @since 3.1
+ */
+ public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
+ if (fPreferenceStore == null)
+ return null;
+ if (sourceViewer == null || !fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED))
+ return null;
+
+ List allDetectors = new ArrayList(0);
+
+ IHyperlinkDetector extHyperlinkDetector = getTextEditorsExtensionsHyperlinkDetector();
+
+ if (extHyperlinkDetector != null) allDetectors.add(extHyperlinkDetector);
+
+/* IHyperlinkDetector[] superDetectors = super.getHyperlinkDetectors(sourceViewer);
+ for (int m = 0; m < superDetectors.length; m++) {
+ IHyperlinkDetector detector = superDetectors[m];
+ if (!allDetectors.contains(detector)) {
+ allDetectors.add(detector);
+ }
+ }
+*/
+ return (IHyperlinkDetector[]) allDetectors.toArray(new IHyperlinkDetector[0]);
+ }
+
+ private IHyperlinkDetector getTextEditorsExtensionsHyperlinkDetector() {
+ Plugin plugin = Platform.getPlugin("org.jboss.tools.common.text.ext");
+ return (plugin != null && plugin instanceof IAdaptable ? (IHyperlinkDetector)((IAdaptable)plugin).getAdapter(IHyperlinkDetector.class):null);
+ }
+
+ private IHyperlinkDetector getTextEditorsExtensionsHyperlinkDetector1() {
+ IHyperlinkDetector result = null;
+ final Object[] bundleActivationResult = new Object[] { Boolean.FALSE };
+ final Bundle bundle = Platform.getBundle("org.jboss.tools.common.text.ext");
+ if (bundle != null && bundle.getState() == org.osgi.framework.Bundle.ACTIVE) {
+ bundleActivationResult[0] = Boolean.TRUE;
+ } else {
+ BusyIndicator.showWhile(null, new Runnable() {
+ public void run() {
+ bundleActivationResult[0] = Boolean.TRUE;
+ }
+ });
+ }
+
+ if (Boolean.TRUE.equals(bundleActivationResult[0])) {
+ try {
+ Dictionary headers = bundle.getHeaders();
+ String pluginClass = (String)headers.get("Plugin-Class");
+ Class plugin = bundle.loadClass(pluginClass);
+
+ Object obj = plugin.newInstance();
+ if (obj instanceof IAdaptable) {
+ result = (IHyperlinkDetector)((IAdaptable)obj).getAdapter(IHyperlinkDetector.class);
+ }
+ } catch (Exception x) {
+ JspEditorPlugin.getPluginLog().logError("Error in loading hyperlink detector", x);
+ }
+ }
+ return result;
+ }
+}
\ No newline at end of file
Copied: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoContentAssistantProposal.java (from rev 6207, trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatCustomCompletionProposal.java)
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoContentAssistantProposal.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AutoContentAssistantProposal.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.contentassist;
+
+import org.eclipse.jface.text.ITextOperationTarget;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
+import org.eclipse.wst.sse.ui.internal.contentassist.IRelevanceConstants;
+
+/**
+ * @author Igels
+ */
+public class AutoContentAssistantProposal extends CustomCompletionProposal {
+
+ private boolean autoContentAssistant = false;
+
+ public AutoContentAssistantProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo) {
+ super(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, contextInformation, additionalProposalInfo, IRelevanceConstants.R_NONE);
+ }
+
+ public AutoContentAssistantProposal(boolean autoContentAssistant, String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo, int relevance) {
+ super(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, contextInformation, additionalProposalInfo, relevance);
+ this.autoContentAssistant = autoContentAssistant;
+ }
+
+ public AutoContentAssistantProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo, int relevance, boolean updateReplacementLengthOnValidate) {
+ super(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, contextInformation, additionalProposalInfo, relevance, updateReplacementLengthOnValidate);
+ }
+
+ public void apply(ITextViewer viewer, char trigger, int stateMask, int offset) {
+ super.apply(viewer, trigger, stateMask, offset);
+ if(autoContentAssistant) {
+ Point selection = getSelection(viewer.getDocument());
+ viewer.setSelectedRange(selection.x, selection.y);
+ if(viewer instanceof ITextOperationTarget) {
+ ((ITextOperationTarget)viewer).doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
+ }
+ }
+ }
+
+ /**
+ * Return cursor position of proposal replacement string.
+ */
+ public int getCursorPosition() {
+ int cursorPosition = -1;
+ int firstAttributeEndPosition = getReplacementString().indexOf("=");
+ int openEndTagPosition = getReplacementString().indexOf("</");
+ int closeStartAndEndTagPosition = getReplacementString().indexOf("/>");
+ if(firstAttributeEndPosition>-1) {
+ cursorPosition = firstAttributeEndPosition + 2;
+ } else if(openEndTagPosition>-1) {
+ cursorPosition = openEndTagPosition;
+ } else if(closeStartAndEndTagPosition>-1) {
+ cursorPosition = closeStartAndEndTagPosition;
+ }
+ return cursorPosition>-1?cursorPosition:super.getCursorPosition();
+ }
+}
\ No newline at end of file
Copied: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/ExtendedJSPContentAssistProcessor.java (from rev 6327, trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatJSPContentAssistProcessor.java)
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/ExtendedJSPContentAssistProcessor.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/ExtendedJSPContentAssistProcessor.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -0,0 +1,712 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.contentassist;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jst.jsp.core.internal.contentmodel.TaglibController;
+import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TLDCMDocumentManager;
+import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TaglibTracker;
+import org.eclipse.jst.jsp.core.internal.regions.DOMJSPRegionContexts;
+import org.eclipse.jst.jsp.core.text.IJSPPartitions;
+import org.eclipse.jst.jsp.ui.internal.JSPUIPlugin;
+import org.eclipse.jst.jsp.ui.internal.contentassist.JSPContentAssistProcessor;
+import org.eclipse.jst.jsp.ui.internal.preferences.JSPUIPreferenceNames;
+import org.eclipse.jst.jsp.ui.internal.templates.TemplateContextTypeIdsJSP;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.css.ui.internal.contentassist.CSSContentAssistProcessor;
+import org.eclipse.wst.html.core.text.IHTMLPartitions;
+import org.eclipse.wst.javascript.ui.internal.common.contentassist.JavaScriptContentAssistProcessor;
+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;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionContainer;
+import org.eclipse.wst.sse.core.utils.StringUtils;
+import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
+import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
+import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;
+import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQueryAction;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
+import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
+import org.eclipse.wst.xml.ui.internal.XMLUIPlugin;
+import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
+import org.eclipse.wst.xml.ui.internal.contentassist.XMLContentAssistUtilities;
+import org.eclipse.wst.xml.ui.internal.contentassist.XMLContentModelGenerator;
+import org.eclipse.wst.xml.ui.internal.contentassist.XMLRelevanceConstants;
+import org.eclipse.wst.xml.ui.internal.editor.CMImageUtil;
+import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImageHelper;
+import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImages;
+import org.eclipse.wst.xml.ui.internal.preferences.XMLUIPreferenceNames;
+import org.jboss.tools.common.kb.KbConnectorFactory;
+import org.jboss.tools.common.kb.KbConnectorType;
+import org.jboss.tools.common.kb.KbException;
+import org.jboss.tools.common.kb.KbProposal;
+import org.jboss.tools.common.kb.KbTldResource;
+import org.jboss.tools.common.kb.TagDescriptor;
+import org.jboss.tools.common.kb.wtp.TLDVersionHelper;
+import org.jboss.tools.common.kb.wtp.WtpKbConnector;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.web.project.WebProject;
+import org.jboss.tools.jst.web.tld.TaglibData;
+import org.jboss.tools.jst.web.tld.VpeTaglibListener;
+import org.jboss.tools.jst.web.tld.VpeTaglibManager;
+import org.jboss.tools.jst.web.tld.VpeTaglibManagerProvider;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * @author Igels
+ */
+public class ExtendedJSPContentAssistProcessor extends JSPContentAssistProcessor{
+
+ private JSPActiveContentAssistProcessor jspActiveCAP;
+ private WtpKbConnector wtpKbConnector;
+ private IDocument document;
+ private boolean dontOpenTag = false;
+
+
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentPosition) {
+ try {
+ String text = viewer.getDocument().get(0, documentPosition);
+ int lastOpenTag = text.lastIndexOf('<');
+ int lastCloseTag = text.lastIndexOf('>');
+ dontOpenTag = lastCloseTag<lastOpenTag;
+ } catch (Exception e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
+
+ document = viewer.getDocument();
+ //added by Max Areshkau JBIDE-788
+ updateActiveContentAssistProcessor(document);
+ ICompletionProposal[] proposals = super.computeCompletionProposals(viewer, documentPosition);
+ // If proposal list from super is empty to try to get it from Red Hat dinamic jsp content assist processor.
+ try {
+ if(proposals.length == 0) {
+ String partitionType = getPartitionType((StructuredTextViewer) viewer, documentPosition);
+ IContentAssistProcessor p = (IContentAssistProcessor) fPartitionToProcessorMap.get(partitionType);
+ if (!(p instanceof JavaScriptContentAssistProcessor || p instanceof CSSContentAssistProcessor)) {
+
+ IndexedRegion treeNode = ContentAssistUtils.getNodeAt((StructuredTextViewer) viewer, documentPosition);
+ Node node = (Node) treeNode;
+
+ while (node != null && node.getNodeType() == Node.TEXT_NODE && node.getParentNode() != null)
+ node = node.getParentNode();
+ IDOMNode xmlnode = (IDOMNode) node;
+ if(xmlnode!=null) {
+ fTextViewer = viewer;
+ IStructuredDocumentRegion sdRegion = getStructuredDocumentRegion(documentPosition);
+ ITextRegion completionRegion = getCompletionRegion(documentPosition, node);
+ if(completionRegion!=null) {
+ String matchString = getMatchString(sdRegion, completionRegion, documentPosition);
+ ContentAssistRequest contentAssistRequest = computeCompletionProposals(documentPosition, matchString, completionRegion, (IDOMNode) treeNode, xmlnode);
+ if(contentAssistRequest!=null) {
+ proposals = contentAssistRequest.getCompletionProposals();
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
+ proposals = getUniqProposals(proposals);
+ return proposals;
+ }
+
+ public static ICompletionProposal[] getUniqProposals(ICompletionProposal[] proposals) {
+ ArrayList uniqProposals = new ArrayList(proposals.length);
+ HashSet displayStrings = new HashSet(proposals.length);
+ for(int i=0; i<proposals.length; i++) {
+ String str = proposals[i].getDisplayString();
+ if(str==null || !displayStrings.contains(str)) {
+ displayStrings.add(str);
+ uniqProposals.add(proposals[i]);
+ }
+ }
+ return (ICompletionProposal[])uniqProposals.toArray(new ICompletionProposal[uniqProposals.size()]);
+ }
+
+ /**
+ * int map that points [partition > processor]. This takes place of
+ * embedded adapters for now.
+ */
+ protected void initPartitionToProcessorMap() {
+ super.initPartitionToProcessorMap();
+ }
+
+ public char[] getCompletionProposalAutoActivationCharacters() {
+ char[] autoActivChars = null;
+ char[] superAutoActivChars = super.getCompletionProposalAutoActivationCharacters();
+ if(superAutoActivChars==null) {
+ return superAutoActivChars;
+ }
+
+ autoActivChars = superAutoActivChars;
+ IPreferenceStore store = JSPUIPlugin.getDefault().getPreferenceStore();
+ if(store.isDefault(JSPUIPreferenceNames.AUTO_PROPOSE_CODE)) {
+// String superDefaultChars = store.getDefaultString(JSPUIPreferenceNames.AUTO_PROPOSE_CODE);
+ StringBuffer redhatDefaultChars = new StringBuffer(new String(superAutoActivChars));
+ if(redhatDefaultChars.indexOf(".")<0) {
+ redhatDefaultChars.append('.');
+ store.setDefault(JSPUIPreferenceNames.AUTO_PROPOSE_CODE, redhatDefaultChars.toString());
+ store.setValue(JSPUIPreferenceNames.AUTO_PROPOSE_CODE, redhatDefaultChars.toString());
+ }
+ autoActivChars = new char[redhatDefaultChars.length()];
+ redhatDefaultChars.getChars(0, redhatDefaultChars.length(), autoActivChars, 0);
+ }
+
+ return autoActivChars;
+ }
+
+ public void updateActiveContentAssistProcessor(IDocument document) {
+ TLDCMDocumentManager manager = TaglibController.getTLDCMDocumentManager(document);
+ if (manager != null) {
+ List list = manager.getTaglibTrackers();
+ for(int i=0; i<list.size(); i++) {
+ TaglibTracker tracker = (TaglibTracker)list.get(i);
+
+ String version = TLDVersionHelper.getTldVersion(tracker);
+ KbTldResource resource = new KbTldResource(tracker.getURI(), "", tracker.getPrefix(), version);
+ getWtpKbConnector().registerResource(resource);
+ addActiveContentAssistProcessorToProcessorMap(tracker.getURI(), tracker.getPrefix(), version);
+ }
+ }
+ }
+
+ private void addActiveContentAssistProcessorToProcessorMap(String uri, String prefix, String version) {
+ try {
+ List names = getWtpKbConnector().getAllTagNamesFromTldByUri(uri, version);
+ for(Iterator iter = names.iterator(); iter.hasNext();) {
+ String fullName = prefix + ":" + iter.next();
+ fNameToProcessorMap.put(fullName, jspActiveCAP);
+ }
+ } catch (KbException e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
+ }
+
+ private WtpKbConnector getWtpKbConnector() {
+ if(wtpKbConnector == null && document != null) {
+ try {
+ wtpKbConnector = (WtpKbConnector)KbConnectorFactory.getIntstance().createConnector(KbConnectorType.JSP_WTP_KB_CONNECTOR, document);
+ jspActiveCAP.setKbConnector(wtpKbConnector);
+ } catch (ClassNotFoundException e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ } catch (InstantiationException e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ } catch (IllegalAccessException e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
+ }
+ return wtpKbConnector;
+ }
+
+ protected void init() {
+ super.init();
+ jspActiveCAP = new JSPActiveContentAssistProcessor();
+ jspActiveCAP.init();
+ }
+
+ public XMLContentModelGenerator getContentGenerator() {
+ if (fGenerator == null){
+ fGenerator = new XMLContentModelGenerator(){
+ public void generateTag(Node parent, CMElementDeclaration elementDecl, StringBuffer buffer) {
+ if (elementDecl == null || buffer == null) {
+ return;
+ }
+ try {
+ String tagName = getRequiredName(parent, elementDecl);
+ TagDescriptor info = getWtpKbConnector().getTagInformation("/" + tagName + "/");
+ if (info != null) {
+ KbProposal proposal = info.generateProposal();
+ String replString = proposal.getReplacementString();
+ boolean hasBody = info.hasBody();
+
+ if (replString != null && replString.length() > 0) {
+ if(!dontOpenTag) {
+ buffer.append("<");
+ }
+ buffer.append(replString);
+ buffer.append(">");
+ if (hasBody) {
+ buffer.append("</");
+ buffer.append(tagName);
+ buffer.append(">");
+ }
+ return;
+ }
+ }
+ } catch (Exception x) {
+ JspEditorPlugin.getPluginLog().logError("", x);
+ }
+ super.generateTag(parent, elementDecl, buffer);
+ return;
+ }
+ };
+ }
+ return fGenerator;
+ }
+
+ protected void addTagInsertionProposals(ContentAssistRequest contentAssistRequest, int childPosition) {
+ List cmnodes = null;
+ Node parent = contentAssistRequest.getParent();
+ String error = null;
+
+ if (parent != null && parent.getNodeType() == Node.DOCUMENT_NODE && ((IDOMDocument) parent).isXMLType() && !isCursorAfterXMLPI(contentAssistRequest)) {
+ return;
+ }
+ // only want proposals if cursor is after doctype...
+ if (!isCursorAfterDoctype(contentAssistRequest))
+ return;
+
+ if (parent != null && parent instanceof IDOMNode && isCommentNode((IDOMNode) parent)) {
+ // loop and find non comment node?
+ while (parent != null && isCommentNode((IDOMNode) parent)) {
+ parent = parent.getParentNode();
+ }
+ }
+
+ if (parent.getNodeType() == Node.ELEMENT_NODE) {
+ CMElementDeclaration parentDecl = getCMElementDeclaration(parent);
+ if (parentDecl != null) {
+ // XSD-specific ability - no filtering
+ CMDataType childType = parentDecl.getDataType();
+ if (childType != null) {
+ String[] childStrings = childType.getEnumeratedValues();
+ if (childStrings != null) {
+ // the content string is the sole valid child...so
+ // replace the rest
+ int begin = contentAssistRequest.getReplacementBeginPosition();
+ int length = contentAssistRequest.getReplacementLength();
+ if (parent instanceof IDOMNode) {
+ if (((IDOMNode) parent).getLastStructuredDocumentRegion() != ((IDOMNode) parent).getFirstStructuredDocumentRegion()) {
+ begin = ((IDOMNode) parent).getFirstStructuredDocumentRegion().getEndOffset();
+ length = ((IDOMNode) parent).getLastStructuredDocumentRegion().getStartOffset() - begin;
+ }
+ }
+ String proposedInfo = getAdditionalInfo(parentDecl, childType);
+ for (int i = 0; i < childStrings.length; i++) {
+ CustomCompletionProposal textProposal = new AutoContentAssistantProposal(childStrings[i].indexOf("=")>-1, childStrings[i], begin, length, childStrings[i].length(), XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_ENUM), childStrings[i], null, proposedInfo, XMLRelevanceConstants.R_TAG_INSERTION);
+ contentAssistRequest.addProposal(textProposal);
+ }
+ }
+ }
+ }
+ if (parentDecl != null && parentDecl.getContentType() == CMElementDeclaration.PCDATA) {
+ addPCDATAProposal(parentDecl.getNodeName(), contentAssistRequest);
+ }
+ else {
+ // retrieve the list of all possible children within this parent context
+ cmnodes = getAvailableChildElementDeclarations((Element)parent, childPosition, ModelQueryAction.INSERT);
+
+ // retrieve the list of the possible children within this parent context and at this index
+ List strictCMNodeSuggestions = null;
+ if (XMLUIPreferenceNames.SUGGESTION_STRATEGY_VALUE_STRICT.equals(XMLUIPlugin.getInstance().getPreferenceStore().getString(XMLUIPreferenceNames.SUGGESTION_STRATEGY)))
+ {
+ strictCMNodeSuggestions = getValidChildElementDeclarations((Element)parent, childPosition, ModelQueryAction.INSERT);
+ }
+ Iterator nodeIterator = cmnodes.iterator();
+ if (!nodeIterator.hasNext()) {
+ if (getCMElementDeclaration(parent) != null)
+ error = NLS.bind(XMLUIMessages._Has_no_available_child, (new Object[]{parent.getNodeName()}));
+ else
+ error = NLS.bind(XMLUIMessages.Element__is_unknown, (new Object[]{parent.getNodeName()}));
+ }
+ String matchString = contentAssistRequest.getMatchString();
+ // chop off any leading <'s and whitespace from the
+ // matchstring
+ while ((matchString.length() > 0) && (Character.isWhitespace(matchString.charAt(0)) || beginsWith(matchString, "<"))) //$NON-NLS-1$
+ //$NON-NLS-1$
+ matchString = matchString.substring(1);
+ while (nodeIterator.hasNext()) {
+ Object o = nodeIterator.next();
+ if (o instanceof CMElementDeclaration) {
+ CMElementDeclaration elementDecl = (CMElementDeclaration) o;
+ // only add proposals for the child element's that
+ // begin with the matchstring
+ String tagname = getRequiredName(parent, elementDecl);
+ boolean isStrictCMNodeSuggestion = strictCMNodeSuggestions != null ? strictCMNodeSuggestions.contains(elementDecl) : false;
+
+ Image image = CMImageUtil.getImage(elementDecl);
+
+ if (image == null) {
+ if (strictCMNodeSuggestions != null) {
+ image = isStrictCMNodeSuggestion ?
+ XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC_EMPHASIZED) :
+ XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC_DEEMPHASIZED);
+ }
+ else {
+ image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
+ }
+
+ }
+ // Account for the < and >. If attributes were
+ // added, the cursor will be placed
+ // at the offset before of the first character of the
+ // first attribute name.
+// int markupAdjustment = getContentGenerator().getMinimalStartTagLength(parent, elementDecl);
+ if (beginsWith(tagname, matchString)) {
+ String proposedText = getRequiredText(parent, elementDecl);
+
+ int markupAdjustment = getCursorPositionForProposedText(proposedText);
+
+ String proposedInfo = getAdditionalInfo(parentDecl, elementDecl);
+ int relevance = isStrictCMNodeSuggestion ? XMLRelevanceConstants.R_STRICTLY_VALID_TAG_INSERTION : XMLRelevanceConstants.R_TAG_INSERTION;
+ CustomCompletionProposal proposal = new AutoContentAssistantProposal(true, proposedText, contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), markupAdjustment, image, tagname, null, proposedInfo, relevance);
+ contentAssistRequest.addProposal(proposal);
+ }
+ }
+ }
+ if (contentAssistRequest.getProposals().size() == 0) {
+ if (error != null)
+ setErrorMessage(error);
+ else if (contentAssistRequest.getMatchString() != null && contentAssistRequest.getMatchString().length() > 0)
+ setErrorMessage(NLS.bind(XMLUIMessages.No_known_child_tag, (new Object[]{parent.getNodeName(), contentAssistRequest.getMatchString()})));
+ //$NON-NLS-1$ = "No known child tag names of <{0}> begin with \"{1}\"."
+ else
+ setErrorMessage(NLS.bind(XMLUIMessages.__Has_no_known_child, (new Object[]{parent.getNodeName()})));
+ }
+ }
+ }
+ else if (parent.getNodeType() == Node.DOCUMENT_NODE) {
+ // Can only prompt with elements if the cursor position is past
+ // the XML processing
+ // instruction and DOCTYPE declaration
+ boolean xmlpiFound = false;
+ boolean doctypeFound = false;
+ int minimumOffset = -1;
+
+ for (Node child = parent.getFirstChild(); child != null; child = child.getNextSibling()) {
+
+ boolean xmlpi = (child.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE && child.getNodeName().equals("xml")); //$NON-NLS-1$
+ boolean doctype = child.getNodeType() == Node.DOCUMENT_TYPE_NODE;
+ if (xmlpi || doctype && minimumOffset < 0)
+ minimumOffset = ((IDOMNode) child).getFirstStructuredDocumentRegion().getStartOffset() + ((IDOMNode) child).getFirstStructuredDocumentRegion().getTextLength();
+ xmlpiFound = xmlpiFound || xmlpi;
+ doctypeFound = doctypeFound || doctype;
+ }
+
+ if (contentAssistRequest.getReplacementBeginPosition() >= minimumOffset) {
+ List childDecls = getAvailableRootChildren((Document) parent, childPosition);
+ for (int i = 0; i < childDecls.size(); i++) {
+ CMElementDeclaration ed = (CMElementDeclaration) childDecls.get(i);
+ if (ed != null) {
+ Image image = CMImageUtil.getImage(ed);
+ if (image == null) {
+ image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
+ }
+ String proposedText = getRequiredText(parent, ed);
+ String tagname = getRequiredName(parent, ed);
+ // account for the < and >
+ int markupAdjustment = getContentGenerator().getMinimalStartTagLength(parent, ed);
+ String proposedInfo = getAdditionalInfo(null, ed);
+ CustomCompletionProposal proposal = new AutoContentAssistantProposal(false, proposedText, contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), markupAdjustment, image, tagname, null, proposedInfo, XMLRelevanceConstants.R_TAG_INSERTION);
+
+ contentAssistRequest.addProposal(proposal);
+ }
+ }
+ }
+ }
+ }
+
+ // WTP
+ private int getCursorPositionForProposedText(String proposedText) {
+ int cursorAdjustment;
+ cursorAdjustment = proposedText.indexOf("\"\"") + 1; //$NON-NLS-1$
+ // otherwise, after the first tag
+ if(cursorAdjustment==0)
+ cursorAdjustment = proposedText.indexOf('>') + 1;
+ if(cursorAdjustment==0)
+ cursorAdjustment = proposedText.length() + 1;
+
+ return cursorAdjustment;
+ }
+
+ protected void addTagNameProposals(ContentAssistRequest contentAssistRequest, int childPosition) {
+ List cmnodes = null;
+ Node parent = contentAssistRequest.getParent();
+ IDOMNode node = (IDOMNode) contentAssistRequest.getNode();
+ String error = null;
+ String matchString = contentAssistRequest.getMatchString();
+ if (parent.getNodeType() == Node.ELEMENT_NODE) {
+ // retrieve the list of children
+ cmnodes = getAvailableChildElementDeclarations((Element)parent, childPosition, ModelQueryAction.INSERT);
+ Iterator nodeIterator = cmnodes.iterator();
+ // chop off any leading <'s and whitespace from the matchstring
+ while ((matchString.length() > 0) && (Character.isWhitespace(matchString.charAt(0)) || beginsWith(matchString, "<"))) //$NON-NLS-1$
+ //$NON-NLS-1$
+ matchString = matchString.substring(1);
+ if (!nodeIterator.hasNext())
+ error = NLS.bind(XMLUIMessages.__Has_no_known_child, (new Object[]{parent.getNodeName()}));
+ while (nodeIterator.hasNext()) {
+ CMNode elementDecl = (CMNode) nodeIterator.next();
+ if (elementDecl != null) {
+ // only add proposals for the child element's that begin
+ // with the matchstring
+ String proposedText = null;
+ int cursorAdjustment = 0;
+
+ // do a check to see if partial attributes of partial tag
+ // names are in list
+ if ((node != null && node.getAttributes() != null && node.getAttributes().getLength() > 0 && attributeInList(node, parent, elementDecl)) || ((node.getNodeType() != Node.TEXT_NODE) && node.getFirstStructuredDocumentRegion().isEnded())) {
+
+ proposedText = getRequiredName(parent, elementDecl);
+ cursorAdjustment = proposedText.length();
+ }
+ else {
+ proposedText = getRequiredName(parent, elementDecl);
+
+ StringBuffer buffer = new StringBuffer();
+ KbProposal proposal;
+ TagDescriptor info;
+ try {
+ proposal = getWtpKbConnector().getProposal("/" + proposedText);
+ info = getWtpKbConnector().getTagInformation("/" + proposedText + "/");
+ if (proposal != null && info != null) {
+ String replString = proposal.getReplacementString();
+ boolean hasBody = info.hasBody();
+
+ if (replString != null && replString.length() > 0) {
+ if(!dontOpenTag) {
+ buffer.append("<");
+ }
+ buffer.append(replString);
+ buffer.append(">");
+ if (hasBody) {
+ buffer.append("</");
+ buffer.append(proposedText);
+ buffer.append(">");
+ }
+ proposedText = buffer.toString();
+ }
+ } else {
+ if(elementDecl instanceof CMElementDeclaration) {
+ cursorAdjustment = proposedText.length();
+ if (elementDecl instanceof CMElementDeclaration) {
+ CMElementDeclaration ed = (CMElementDeclaration) elementDecl;
+ if (ed.getContentType() == CMElementDeclaration.EMPTY) {
+ proposedText += getContentGenerator().getStartTagClose(parent, ed);
+ cursorAdjustment = proposedText.length();
+ }
+ else {
+ cursorAdjustment = proposedText.length() + 1;
+ proposedText += "></" + getRequiredName(parent, elementDecl) + ">"; //$NON-NLS-2$//$NON-NLS-1$
+ }
+ }
+ }
+ }
+ } catch (KbException e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
+ }
+ if (beginsWith(proposedText, matchString) || beginsWith(proposedText, "<" + matchString)) {
+ Image image = CMImageUtil.getImage(elementDecl);
+ if (image == null) {
+ image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
+ }
+ String proposedInfo = getAdditionalInfo(getCMElementDeclaration(parent), elementDecl);
+ CustomCompletionProposal proposal = new AutoContentAssistantProposal(proposedText.indexOf('\"')>-1 && proposedText.indexOf("=")>-1, proposedText, contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), cursorAdjustment, image, getRequiredName(parent, elementDecl), null, proposedInfo, XMLRelevanceConstants.R_TAG_NAME);
+ contentAssistRequest.addProposal(proposal);
+ }
+ }
+ }
+ if (contentAssistRequest.getProposals().size() == 0) {
+ if (error != null)
+ setErrorMessage(error);
+ else if (contentAssistRequest.getMatchString() != null && contentAssistRequest.getMatchString().length() > 0)
+ setErrorMessage(NLS.bind(XMLUIMessages.No_known_child_tag_names, (new Object[]{parent.getNodeName(), contentAssistRequest.getMatchString()})));
+ //$NON-NLS-1$ = "No known child tag names of <{0}> begin with \"{1}\""
+ else
+ setErrorMessage(NLS.bind(XMLUIMessages.__Has_no_known_child, (new Object[]{parent.getNodeName()})));
+ }
+ }
+ else if (parent.getNodeType() == Node.DOCUMENT_NODE) {
+ List childElements = getAvailableRootChildren((Document) parent, childPosition);
+ for (int i = 0; i < childElements.size(); i++) {
+ CMNode ed = (CMNode) childElements.get(i);
+ if (ed == null)
+ continue;
+ String proposedText = null;
+ int cursorAdjustment = 0;
+ if(ed instanceof CMElementDeclaration) {
+ // proposedText = getRequiredName(parent, ed);
+ StringBuffer sb = new StringBuffer();
+ getContentGenerator().generateTag(parent, (CMElementDeclaration)ed, sb);
+ // tag starts w/ '<', but we want to compare to name
+ proposedText = sb.toString().substring(1);
+
+ if (!beginsWith(proposedText, matchString))
+ continue;
+
+ cursorAdjustment = getCursorPositionForProposedText(proposedText);
+
+ if (ed instanceof CMElementDeclaration) {
+ CMElementDeclaration elementDecl = (CMElementDeclaration) ed;
+ if (elementDecl.getContentType() == CMElementDeclaration.EMPTY) {
+ proposedText += getContentGenerator().getStartTagClose(parent, elementDecl);
+ cursorAdjustment = proposedText.length();
+ }
+ }
+
+ String proposedInfo = getAdditionalInfo(null, ed);
+ Image image = CMImageUtil.getImage(ed);
+ if (image == null) {
+ image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
+ }
+ CustomCompletionProposal proposal = new AutoContentAssistantProposal(proposedText.indexOf('\"')>-1, proposedText, contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), cursorAdjustment, image, getRequiredName(parent, ed), null, proposedInfo, XMLRelevanceConstants.R_TAG_NAME);
+ contentAssistRequest.addProposal(proposal);
+ contentAssistRequest.addProposal(proposal);
+ }
+ }
+ }
+ }
+
+ private boolean isCommentNode(IDOMNode node) {
+ return (node != null && node instanceof IDOMElement && ((IDOMElement) node).isCommentTag());
+ }
+
+ protected void addAttributeNameProposals(ContentAssistRequest contentAssistRequest) {
+
+ // JBIDE-1717 Workaround:
+ // The WTP processes the Attribute Containers in a different way comparing to how it does for
+ // the simple attributes.
+ // Also the whitespace-text placed after the attribute value is the part of that attribute value.
+ // These facts both are the reason of the JBIDE-1717 issue appeared.
+ // This workaround tries to add the attribute name proposals in case of WTP itself doesn't adds them
+ // because it faced the attribute container (In other words, some JSF-variable is used as the
+ // attribute's value
+ if (fViewer != null) {
+ int documentPosition = contentAssistRequest.getReplacementBeginPosition();
+ // check the actual partition type
+ String partitionType = getPartitionType((StructuredTextViewer) fViewer, documentPosition);
+
+ IStructuredDocument structuredDocument = (IStructuredDocument) fViewer.getDocument();
+ IStructuredDocumentRegion fn = structuredDocument.getRegionAtCharacterOffset(documentPosition);
+ // check if it's in an attribute value, if so, don't add CDATA
+ // proposal
+ ITextRegion attrContainer = (fn != null) ? fn.getRegionAtCharacterOffset(documentPosition) : null;
+ boolean doPerformProposalsComputing = false;
+
+ if (attrContainer != null && attrContainer instanceof ITextRegionContainer) {
+ if (attrContainer.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE) {
+ // test location of the cursor
+ // return null if it's in the middle of an open/close
+ // delimeter
+ Iterator attrRegions = ((ITextRegionContainer) attrContainer).getRegions().iterator();
+ ITextRegion testRegion = null;
+ while (attrRegions.hasNext()) {
+ testRegion = (ITextRegion) attrRegions.next();
+ // need to check for other valid attribute regions
+ if (XMLContentAssistUtilities.isJSPOpenDelimiter(testRegion.getType())) {
+ if (!(((ITextRegionContainer) attrContainer).getEndOffset(testRegion) <= documentPosition))
+ break;
+ }
+ else if (XMLContentAssistUtilities.isJSPCloseDelimiter(testRegion.getType())) {
+ if (!(((ITextRegionContainer) attrContainer).getStartOffset(testRegion) >= documentPosition))
+ break;
+ }
+ }
+ if (!(testRegion.getType().equals(DOMJSPRegionContexts.JSP_CONTENT)))
+ doPerformProposalsComputing = true;
+ }
+ }
+ //
+
+ if (doPerformProposalsComputing) {
+ ICompletionProposal[] embeddedResults = null;
+ IContentAssistProcessor p = (IContentAssistProcessor) fPartitionToProcessorMap.get(partitionType);
+ if (p != null) {
+ embeddedResults = p.computeCompletionProposals(fViewer, documentPosition);
+ // TODO: Probably it's needed to get bean methods, objects, and constants if there are any...
+ // as it's done in JSPContentAssistProcessor but...
+ }
+ else {
+ // the partition type is probably not mapped
+ }
+ for (int i = 0; embeddedResults != null && i < embeddedResults.length; i++)
+ contentAssistRequest.addProposal(embeddedResults[i]);
+ }
+ }
+ super.addAttributeNameProposals(contentAssistRequest);
+ }
+
+ protected void addAttributeValueProposals(ContentAssistRequest contentAssistRequest) {
+ // JBIDE-1704:
+ // Check the position in the value:
+ // The following position:
+ // <nodeName attrName="attrValue"| .../>
+ // is marked as attribute value, but the value itself is complete.
+ // There are no proposals to be correct at this position.
+
+ String text = contentAssistRequest.getText();
+ String matchString = contentAssistRequest.getMatchString();
+
+ if (matchString.length() > StringUtils.strip(text).length() &&
+ ( (matchString.startsWith("\"") && matchString.endsWith("\"") &&
+ (matchString.indexOf("\"") != matchString.lastIndexOf("\"")))
+ || (matchString.startsWith("'") && matchString.endsWith("\"") &&
+ (matchString.indexOf("\"") != matchString.lastIndexOf("\""))))) {
+ return;
+ }
+
+ super.addAttributeValueProposals(contentAssistRequest);
+ }
+
+ /**
+ * StructuredTextViewer must be set before using this.
+ */
+ public IStructuredDocumentRegion getStructuredDocumentRegion(int pos) {
+ IStructuredDocumentRegion sdRegion = ContentAssistUtils.getStructuredDocumentRegion(fTextViewer, pos);
+ ITextRegion region = (sdRegion == null ? null : sdRegion.getRegionAtCharacterOffset(pos));
+ if (region == null) {
+ return null;
+ }
+
+ if (region.getType() == DOMRegionContext.XML_TAG_OPEN &&
+ sdRegion.getStartOffset(region) == pos) {
+ // The offset is at the beginning of the region
+ if ((sdRegion.getStartOffset(region) == sdRegion.getStartOffset()) && (sdRegion.getPrevious() != null) && (!sdRegion.getPrevious().isEnded())) {
+ // Is the region also the start of the node? If so, the
+ // previous IStructuredDocumentRegion is
+ // where to look for a useful region.
+ sdRegion = sdRegion.getPrevious();
+ }
+ else {
+ // Is there no separating whitespace from the previous region?
+ // If not,
+ // then that region is the important one
+ ITextRegion previousRegion = sdRegion.getRegionAtCharacterOffset(pos - 1);
+ if ((previousRegion != null) && (previousRegion != region) && (previousRegion.getTextLength() == previousRegion.getLength())) {
+ sdRegion = sdRegion.getPrevious();
+ }
+ }
+ }
+
+ return sdRegion;
+ }
+
+}
\ No newline at end of file
Copied: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletsHtmlContentAssistProcessor.java (from rev 6300, trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatHtmlContentAssistProcessor.java)
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletsHtmlContentAssistProcessor.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletsHtmlContentAssistProcessor.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -0,0 +1,608 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.jsp.contentassist;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jst.jsp.core.internal.contentmodel.TaglibController;
+import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TLDCMDocumentManager;
+import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TaglibTracker;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.wst.html.ui.internal.HTMLUIPlugin;
+import org.eclipse.wst.html.ui.internal.contentassist.HTMLContentAssistProcessor;
+import org.eclipse.wst.html.ui.internal.preferences.HTMLUIPreferenceNames;
+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.core.internal.provisional.text.ITextRegionList;
+import org.eclipse.wst.sse.core.utils.StringUtils;
+import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration;
+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.contentmodel.util.DOMNamespaceHelper;
+import org.eclipse.wst.xml.core.internal.document.AttrImpl;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
+import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
+import org.eclipse.wst.xml.ui.internal.contentassist.XMLRelevanceConstants;
+import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImageHelper;
+import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImages;
+import org.eclipse.wst.xml.ui.internal.util.SharedXMLEditorPluginImageHelper;
+import org.jboss.tools.common.kb.AttributeDescriptor;
+import org.jboss.tools.common.kb.KbConnectorFactory;
+import org.jboss.tools.common.kb.KbConnectorType;
+import org.jboss.tools.common.kb.KbProposal;
+import org.jboss.tools.common.kb.KbQuery;
+import org.jboss.tools.common.kb.KbTldResource;
+import org.jboss.tools.common.kb.wtp.JspWtpKbConnector;
+import org.jboss.tools.common.kb.wtp.TLDVersionHelper;
+import org.jboss.tools.common.kb.wtp.WtpKbConnector;
+import org.jboss.tools.common.model.util.ELParser;
+import org.jboss.tools.common.reporting.ProblemReportingHelper;
+import org.jboss.tools.jst.jsp.JspEditorPlugin;
+import org.jboss.tools.jst.jsp.editor.TLDRegisterHelper;
+import org.jboss.tools.jst.jsp.outline.ValueHelper;
+import org.jboss.tools.jst.jsp.support.kb.FaceletsJsfCResource;
+import org.jboss.tools.jst.jsp.support.kb.WTPKbdBeanMethodResource;
+import org.jboss.tools.jst.jsp.support.kb.WTPKbdBeanPropertyResource;
+import org.jboss.tools.jst.jsp.support.kb.WTPKbdBundlePropertyResource;
+import org.jboss.tools.jst.web.tld.TaglibData;
+import org.jboss.tools.jst.web.tld.VpeTaglibListener;
+import org.jboss.tools.jst.web.tld.VpeTaglibManager;
+import org.jboss.tools.jst.web.tld.VpeTaglibManagerProvider;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+/**
+ * @author Igels
+ */
+public class FaceletsHtmlContentAssistProcessor extends HTMLContentAssistProcessor implements VpeTaglibListener {
+
+ private JSPActiveContentAssistProcessor jspActiveCAP;
+ private WtpKbConnector wtpKbConnector;
+ private IDocument document;
+ private IEditorInput editorInput;
+ private VpeTaglibManager tldManager;
+ private boolean isFacelets = false;
+ public static final String faceletUri = "http://java.sun.com/jsf/facelets";
+ public static final String faceletHtmlUri = "http://www.w3.org/1999/xhtml/facelets";
+ public static final String faceletHtmlPrefix = "0fHP";
+ public static final String JSFCAttributeName = "jsfc";
+ public static final String faceletHtmlPrefixStart = faceletHtmlPrefix + ":";
+ //Added by Max Areshkau JBIDE-788
+ public static final KbTldResource faceletHtmlResource = new KbTldResource(faceletHtmlUri, "", faceletHtmlPrefix, null);
+
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer textViewer, int documentPosition) {
+ document = textViewer.getDocument();
+ editorInput = JspEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorInput();
+ //added by Max Areshkau JBIDE-788
+ IndexedRegion treeNode = ContentAssistUtils.getNodeAt(textViewer, documentPosition);
+ IDOMNode node = (IDOMNode) treeNode;
+ registerToTldManager(textViewer, node);
+
+ ICompletionProposal[] proposals = super.computeCompletionProposals(textViewer, documentPosition);
+ if(proposals!=null) {
+ for(int i=0; i<proposals.length; i++) {
+ if(proposals[i] instanceof AutoContentAssistantProposal) {
+ fErrorMessage = null;
+ break;
+ }
+ }
+ }
+ if(isFacelets) {
+ return getUniqProposals(proposals);
+ }
+ proposals = getUniqProposals(proposals);
+ return proposals;
+ }
+
+ private ICompletionProposal[] getUniqProposals(ICompletionProposal[] proposals) {
+ if(proposals==null) {
+ return null;
+ }
+ HashMap uniqProposals = new HashMap(proposals.length);
+ ArrayList uniqProposalList = new ArrayList(proposals.length);
+ for(int i=0; i<proposals.length; i++) {
+ int eq = proposals[i].getDisplayString().indexOf('=');
+ String str = proposals[i].getDisplayString();;
+ if(eq>0) {
+ str = str.substring(0, eq);
+ }
+ Object proposal = uniqProposals.get(str);
+ if(proposal==null || proposals[i] instanceof AutoContentAssistantProposal) {
+ uniqProposals.put(str, proposals[i]);
+ uniqProposalList.add(proposals[i]);
+ if(proposal!=null) {
+ uniqProposalList.remove(proposal);
+ }
+ }
+ }
+ return (ICompletionProposal[])uniqProposalList.toArray(new ICompletionProposal[uniqProposals.size()]);
+ }
+
+ protected void addTagInsertionProposals(ContentAssistRequest contentAssistRequest, int childPosition) {
+ if(!addELFaceletsProposals(contentAssistRequest, childPosition)) {
+ String request = "/" + contentAssistRequest.getMatchString();
+ Collection kbProposals = null;
+ try {
+ kbProposals = getWtpKbConnector().getProposals(request);
+ } catch(Exception e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
+ for (Iterator iter = kbProposals.iterator(); iter.hasNext();) {
+ KbProposal kbProposal = (KbProposal) iter.next();
+ if(ignoreProposal(kbProposal)) {
+ continue;
+ }
+ String proposedInfo = kbProposal.getContextInfo();
+ String kbReplacementString = kbProposal.getReplacementString();
+ String replacementString = "<" + kbReplacementString + ">";
+ String displayString = kbProposal.getLabel();
+ boolean autoContentAssistant = replacementString.indexOf('\"')>-1 && replacementString.indexOf("=")>-1;
+ int cursorAdjustment = replacementString.length();;
+ if(!kbReplacementString.endsWith("/")) {
+ replacementString = replacementString + "</" + displayString + ">";
+ }
+ Image image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(autoContentAssistant, replacementString, contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), cursorAdjustment, image, displayString, null, proposedInfo, XMLRelevanceConstants.R_TAG_NAME);
+ contentAssistRequest.addProposal(proposal);
+ }
+ super.addTagInsertionProposals(contentAssistRequest, childPosition);
+ }
+ }
+
+ private boolean addELFaceletsProposals(ContentAssistRequest contentAssistRequest, int childPosition) {
+ if(isFacelets) {
+ IDOMNode node = (IDOMNode)contentAssistRequest.getNode();
+ IStructuredDocumentRegion open = node.getFirstStructuredDocumentRegion();
+ ITextRegionList openRegions = open.getRegions();
+ int i = openRegions.indexOf(contentAssistRequest.getRegion());
+ if(i < 0) return false;
+ String currentValue = contentAssistRequest.getText();
+ int start = contentAssistRequest.getStartOffset();
+ int offset = contentAssistRequest.getReplacementBeginPosition() - start;
+ String matchString = currentValue.substring(0, offset);
+ ValueHelper h = new ValueHelper();
+ IEditorInput input = h.getEditorInput();
+ ArrayList proposals = new ArrayList();
+ WTPKbdBeanPropertyResource r1 = new WTPKbdBeanPropertyResource(input, h.getConnector());
+ proposals.addAll(r1.queryProposal(matchString));
+ WTPKbdBeanMethodResource r2 = new WTPKbdBeanMethodResource(input, h.getConnector());
+ proposals.addAll(r2.queryProposal(matchString));
+ WTPKbdBundlePropertyResource r3 = new WTPKbdBundlePropertyResource(input, h.getConnector());
+ proposals.addAll(r3.queryProposal(matchString));
+
+ for (Iterator iter = proposals.iterator(); iter.hasNext();) {
+ KbProposal kbProposal = cleanFaceletProposal((KbProposal)iter.next());
+ kbProposal.postProcess(currentValue, offset);
+ int relevance = kbProposal.getRelevance();
+ if(relevance==KbProposal.R_NONE) {
+ relevance = XMLRelevanceConstants.R_XML_ATTRIBUTE_VALUE;
+ }
+
+ if(kbProposal.getStart() >= 0) {
+ String replacementString = kbProposal.getReplacementString();
+ int replacementBeginPosition = start + kbProposal.getStart();
+ int replacementLength = kbProposal.getEnd() - kbProposal.getStart();
+ int cursorPositionDelta = 0;
+ int cursorPosition = kbProposal.getPosition() + cursorPositionDelta;
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
+ replacementBeginPosition, replacementLength, cursorPosition, SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
+ kbProposal.getLabel(), null, kbProposal.getContextInfo(), relevance);
+ contentAssistRequest.addProposal(proposal);
+ continue;
+ } else {
+ StringBuffer replacementStringBuffer = new StringBuffer(kbProposal.getReplacementString());
+ int replacementBeginPosition = start;
+ int replacementLength = 0;
+ int cursorPositionDelta = 0;
+ String replacementString = replacementStringBuffer.toString();
+ int cursorPosition = kbProposal.getPosition() + cursorPositionDelta;
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
+ replacementBeginPosition, replacementLength, cursorPosition, SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
+ kbProposal.getLabel(), null, kbProposal.getContextInfo(), relevance);
+ contentAssistRequest.addProposal(proposal);
+ }
+ }
+ ELParser p = new ELParser();
+ ELParser.Token root = p.parse(currentValue);
+ ELParser.Token c = root == null ? null : ELParser.getTokenAt(root, offset);
+ if(ELParser.getPrecedingOpen(c, offset) != null) return true;
+ }
+ return false;
+ }
+
+ protected void addAttributeNameProposals(ContentAssistRequest contentAssistRequest) {
+ Element element = (Element)contentAssistRequest.getNode();
+ NamedNodeMap attributes = element.getAttributes();
+
+ String tagName = element.getNodeName();
+ if(isFacelets && tagName.indexOf(':')<0) {
+ tagName = faceletHtmlPrefixStart + tagName;
+ }
+ String request = "/" + tagName + "@" + contentAssistRequest.getMatchString();
+ Collection kbProposals = null;
+ try {
+ kbProposals = getWtpKbConnector().getProposals(request);
+ } catch(Exception e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
+ for (Iterator iter = kbProposals.iterator(); iter.hasNext();) {
+ KbProposal kbProposal = cleanFaceletProposal((KbProposal)iter.next());
+ String proposedInfo = kbProposal.getContextInfo();
+ String replacementString = kbProposal.getReplacementString() + "=\"\"";
+ String displayString = kbProposal.getLabel();
+ AttrImpl attr = (AttrImpl)attributes.getNamedItem(displayString);
+ if(attr!=null) {
+ ITextRegion region = attr.getNameRegion();
+ IStructuredDocumentRegion docRegion = contentAssistRequest.getDocumentRegion();
+ if(docRegion.getStartOffset(region)>contentAssistRequest.getReplacementBeginPosition() ||
+ docRegion.getEndOffset(region)< contentAssistRequest.getReplacementBeginPosition() + contentAssistRequest.getReplacementLength()) {
+ continue;
+ }
+ }
+ boolean autoContentAssistant = true;
+ int cursorAdjustment = replacementString.length() - 1;
+ Image image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_ATTRIBUTE);
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(autoContentAssistant, replacementString, contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), cursorAdjustment, image, displayString, null, proposedInfo, XMLRelevanceConstants.R_TAG_NAME);
+ contentAssistRequest.addProposal(proposal);
+ }
+ addJsfAttributeNameProposalsForFaceletTag(contentAssistRequest);
+ super.addAttributeNameProposals(contentAssistRequest);
+ }
+
+ private void addJsfAttributeNameProposalsForFaceletTag(ContentAssistRequest contentAssistRequest) {
+ // Ignore if jsp is not facelet jsp
+ if(!isFacelets) {
+ return;
+ }
+
+ Element element = (Element)contentAssistRequest.getNode();
+
+ String tagName = element.getNodeName();
+ // Only HTML tags
+ if(tagName.indexOf(':')>0) {
+ return;
+ }
+
+ NamedNodeMap attributes = element.getAttributes();
+ Node jsfC = attributes.getNamedItem(JSFCAttributeName);
+ if(jsfC==null || (!(jsfC instanceof Attr))) {
+ return;
+ }
+ Attr jsfCAttribute = (Attr)jsfC;
+ String jsfTagName = jsfCAttribute.getValue();
+ if(jsfTagName==null || jsfTagName.indexOf(':')<1) {
+ return;
+ }
+
+ String request = "/" + jsfTagName + "@" + contentAssistRequest.getMatchString();
+ Collection kbProposals = null;
+ try {
+ kbProposals = getWtpKbConnector().getProposals(request);
+ } catch(Exception e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
+ for (Iterator iter = kbProposals.iterator(); iter.hasNext();) {
+ KbProposal kbProposal = (KbProposal)iter.next();
+ if(ignoreProposal(kbProposal)) {
+ continue;
+ }
+ String proposedInfo = kbProposal.getContextInfo();
+ String replacementString = kbProposal.getReplacementString() + "=\"\"";
+ String displayString = kbProposal.getLabel();
+ AttrImpl attr = (AttrImpl)attributes.getNamedItem(displayString);
+ if(attr!=null) {
+ ITextRegion region = attr.getNameRegion();
+ IStructuredDocumentRegion docRegion = contentAssistRequest.getDocumentRegion();
+ if(docRegion.getStartOffset(region)>contentAssistRequest.getReplacementBeginPosition() ||
+ docRegion.getEndOffset(region)< contentAssistRequest.getReplacementBeginPosition() + contentAssistRequest.getReplacementLength()) {
+ continue;
+ }
+ }
+ boolean autoContentAssistant = true;
+ int cursorAdjustment = replacementString.length() - 1;
+ Image image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_ATTRIBUTE);
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(autoContentAssistant, replacementString, contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), cursorAdjustment, image, displayString, null, proposedInfo, XMLRelevanceConstants.R_TAG_NAME);
+ contentAssistRequest.addProposal(proposal);
+ }
+ }
+
+ protected void addAttributeValueProposals(ContentAssistRequest contentAssistRequest) {
+ // JBIDE-1704:
+ // Check the position in the value:
+ // The following position:
+ // <nodeName attrName="attrValue"| .../>
+ // is marked as attribute value, but the value itself is complete.
+ // There are no proposals to be correct at this position.
+
+ String text = contentAssistRequest.getText();
+ String matchString = contentAssistRequest.getMatchString();
+
+ if (matchString.length() > StringUtils.strip(text).length() &&
+ ( (matchString.startsWith("\"") && matchString.endsWith("\"") &&
+ (matchString.indexOf("\"") != matchString.lastIndexOf("\"")))
+ || (matchString.startsWith("'") && matchString.endsWith("\"") &&
+ (matchString.indexOf("\"") != matchString.lastIndexOf("\""))))) {
+ return;
+ }
+
+ if (jspActiveCAP != null) {
+ jspActiveCAP.setFacelets(isFacelets);
+ jspActiveCAP.addAttributeValueProposals(contentAssistRequest);
+ }
+ IDOMNode node = (IDOMNode) contentAssistRequest.getNode();
+ String tagName = node.getNodeName();
+ CMElementDeclaration elementDecl = getCMElementDeclaration(node);
+
+ IStructuredDocumentRegion open = node.getFirstStructuredDocumentRegion();
+ ITextRegionList openRegions = open.getRegions();
+ int i = openRegions.indexOf(contentAssistRequest.getRegion());
+ if (i < 0)
+ return;
+ ITextRegion nameRegion = null;
+ while (i >= 0) {
+ nameRegion = openRegions.get(i--);
+ if (nameRegion.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME)
+ break;
+ }
+
+ String attributeName = open.getText(nameRegion);
+
+ boolean faceletJsfTag = false;
+ if(isFacelets && tagName.indexOf(':')<1 && !JSFCAttributeName.equals(attributeName)) {
+ Element element = (Element)node;
+
+ NamedNodeMap attributes = element.getAttributes();
+ Node jsfC = attributes.getNamedItem(FaceletsHtmlContentAssistProcessor.JSFCAttributeName);
+ if(jsfC!=null && (jsfC instanceof Attr)) {
+ Attr jsfCAttribute = (Attr)jsfC;
+ String jsfTagName = jsfCAttribute.getValue();
+ if(jsfTagName!=null && jsfTagName.indexOf(':')>0) {
+ tagName = jsfTagName;
+ faceletJsfTag = true;
+ }
+ }
+ }
+
+ if(!faceletJsfTag && isFacelets && tagName.indexOf(':')<0) {
+ tagName = faceletHtmlPrefixStart + tagName;
+ }
+ String query = new StringBuffer(KbQuery.TAG_SEPARATOR).append(tagName).append(KbQuery.ATTRIBUTE_SEPARATOR).append(attributeName).toString();
+ AttributeDescriptor ad = null;
+ try {
+ ad = getWtpKbConnector().getAttributeInformation(query);
+ } catch(Exception e) {
+ ProblemReportingHelper.reportProblem(JspEditorPlugin.PLUGIN_ID, "ERROR: Can't get Attribute Descriptor from KB by " + query + "", e);
+ }
+ if(ad!=null) {
+ CMAttributeDeclaration attrDecl = null;
+ if (elementDecl != null) {
+ CMNamedNodeMap attributes = elementDecl.getAttributes();
+ String noprefixName = DOMNamespaceHelper.getUnprefixedName(attributeName);
+ if (attributes != null) {
+ attrDecl = (CMAttributeDeclaration) attributes.getNamedItem(noprefixName);
+ if (attrDecl == null) {
+ attrDecl = (CMAttributeDeclaration) attributes.getNamedItem(attributeName);
+ }
+ }
+ }
+ if (attrDecl == null || attrDecl.getAttrType() == null) {
+ return;
+ }
+ }
+
+ super.addAttributeValueProposals(contentAssistRequest);
+ }
+
+ protected void addTagNameProposals(ContentAssistRequest contentAssistRequest, int childPosition) {
+ String request = "/" + contentAssistRequest.getMatchString();
+ Collection kbProposals = null;
+ try {
+ kbProposals = getWtpKbConnector().getProposals(request);
+ } catch(Exception e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
+ if(kbProposals!=null) {
+ for (Iterator iter = kbProposals.iterator(); iter.hasNext();) {
+ KbProposal kbProposal = (KbProposal) iter.next();
+ if(ignoreProposal(kbProposal)) {
+ continue;
+ }
+ String proposedInfo = kbProposal.getContextInfo();
+ String kbReplacementString = kbProposal.getReplacementString();
+ String replacementString = kbReplacementString + ">";
+ String displayString = kbProposal.getLabel();
+ boolean autoContentAssistant = replacementString.indexOf('\"')>-1 && replacementString.indexOf("=")>-1;
+ int cursorAdjustment = replacementString.length();
+ if(!kbReplacementString.endsWith("/")) {
+ replacementString = replacementString + "</" + displayString + ">";
+ }
+ Image image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(autoContentAssistant, replacementString, contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), cursorAdjustment, image, displayString, null, proposedInfo, XMLRelevanceConstants.R_TAG_NAME);
+ contentAssistRequest.addProposal(proposal);
+ }
+ }
+ super.addTagNameProposals(contentAssistRequest, childPosition);
+ }
+
+ private boolean ignoreProposal(KbProposal proposal) {
+ if(isFacelets) {
+ return proposal.getLabel().startsWith(faceletHtmlPrefixStart);
+ }
+ return false;
+ }
+
+ private KbProposal cleanFaceletProposal(KbProposal proposal) {
+ if(isFacelets) {
+ proposal.setLabel(removeFaceletsPrefix(proposal.getLabel()));
+ proposal.setReplacementString(removeFaceletsPrefix(proposal.getReplacementString()));
+ }
+ return proposal;
+ }
+
+ private String removeFaceletsPrefix(String tagName) {
+ if(tagName.startsWith(faceletHtmlPrefixStart)) {
+ return tagName.substring(faceletHtmlPrefixStart.length());
+ }
+ return tagName;
+ }
+
+ private WtpKbConnector getWtpKbConnector() {
+ if(wtpKbConnector == null && document != null) {
+ try {
+ wtpKbConnector = (WtpKbConnector)KbConnectorFactory.getIntstance().createConnector(KbConnectorType.JSP_WTP_KB_CONNECTOR, document);
+ jspActiveCAP.setKbConnector(wtpKbConnector);
+ FaceletsJsfCResource fsfCResource = new FaceletsJsfCResource(wtpKbConnector);
+ wtpKbConnector.registerResource(fsfCResource);
+ } catch(Exception e) {
+ ProblemReportingHelper.reportProblem(JspEditorPlugin.PLUGIN_ID, "ERROR: Can't create WtpKbConnector.", e);
+ }
+ }
+ return wtpKbConnector;
+ }
+
+ private void registerToTldManager(ITextViewer viewer,IDOMNode node) {
+ if((tldManager==null) && (viewer instanceof VpeTaglibManagerProvider)) {
+ tldManager = ((VpeTaglibManagerProvider)viewer).getTaglibManager();
+ tldManager.setReferenceNode(node);
+ if(tldManager!=null) {
+ tldManager.addTaglibListener(this);
+ updateActiveContentAssistProcessor(document);
+ }
+ } else if(tldManager!=null) {
+ tldManager.setReferenceNode(node);
+ updateActiveContentAssistProcessor(document);
+ }
+ }
+
+ public void taglibPrefixChanged(String[] prefixs) {
+ updateActiveContentAssistProcessor(document);
+ }
+
+ public void addTaglib(String uri, String prefix) {
+ }
+
+ public void removeTaglib(String uri, String prefix) {
+ }
+
+ public static void registerTld(TaglibData data, JspWtpKbConnector wtpKbConnector, IDocument document, IEditorInput input) {
+ TLDRegisterHelper.registerTld(data, wtpKbConnector, document, input);
+ }
+
+ public void updateActiveContentAssistProcessor(IDocument document) {
+ if(tldManager==null) {
+ TLDCMDocumentManager manager = TaglibController.getTLDCMDocumentManager(document);
+ if (manager != null) {
+ List list = manager.getTaglibTrackers();
+ for(int i=0; i<list.size(); i++) {
+ TaglibTracker tracker = (TaglibTracker)list.get(i);
+ String version = TLDVersionHelper.getTldVersion(tracker);
+ KbTldResource resource = new KbTldResource(tracker.getURI(), "", tracker.getPrefix(), version);
+ getWtpKbConnector().registerResource(resource);
+ }
+ }
+ } else {
+ List list = tldManager.getTagLibs();
+ if(list==null) {
+ return;
+ }
+ ((JspWtpKbConnector)getWtpKbConnector()).unregisterAllResources(true);
+ isFacelets = false;
+ for(int i=0; i<list.size(); i++) {
+ TaglibData data = (TaglibData)list.get(i);
+ registerTld(data, (JspWtpKbConnector)getWtpKbConnector(), document, editorInput);
+ isFacelets = isFacelets || data.getUri().equals(faceletUri);
+ }
+ if(isFacelets) {
+ getWtpKbConnector().registerResource(faceletHtmlResource);
+ ((JspWtpKbConnector)getWtpKbConnector()).unregisterJspResource();
+ }
+ }
+ }
+
+ public char[] getCompletionProposalAutoActivationCharacters() {
+ char[] autoActivChars = null;
+ char[] superAutoActivChars = super.getCompletionProposalAutoActivationCharacters();
+ if(superAutoActivChars==null) {
+ return superAutoActivChars;
+ }
+
+ autoActivChars = superAutoActivChars;
+ IPreferenceStore store = HTMLUIPlugin.getDefault().getPreferenceStore();
+ if(store.isDefault(HTMLUIPreferenceNames.AUTO_PROPOSE_CODE)) {
+// String superDefaultChars = store.getDefaultString(JSPUIPreferenceNames.AUTO_PROPOSE_CODE);
+ StringBuffer redhatDefaultChars = new StringBuffer(new String(superAutoActivChars));
+ if(redhatDefaultChars.indexOf(".")<0) {
+ redhatDefaultChars.append('.');
+ store.setDefault(HTMLUIPreferenceNames.AUTO_PROPOSE_CODE, redhatDefaultChars.toString());
+ store.setValue(HTMLUIPreferenceNames.AUTO_PROPOSE_CODE, redhatDefaultChars.toString());
+ }
+ autoActivChars = new char[redhatDefaultChars.length()];
+ redhatDefaultChars.getChars(0, redhatDefaultChars.length(), autoActivChars, 0);
+ }
+
+ return autoActivChars;
+ }
+
+ protected void init() {
+ super.init();
+ jspActiveCAP = new JSPActiveContentAssistProcessor();
+ jspActiveCAP.init();
+ }
+
+
+ /**
+ * StructuredTextViewer must be set before using this.
+ */
+ public IStructuredDocumentRegion getStructuredDocumentRegion(int pos) {
+ IStructuredDocumentRegion sdRegion = ContentAssistUtils.getStructuredDocumentRegion(fTextViewer, pos);
+ ITextRegion region = (sdRegion == null ? null : sdRegion.getRegionAtCharacterOffset(pos));
+ if (region == null) {
+ return null;
+ }
+
+ if (region.getType() == DOMRegionContext.XML_TAG_OPEN &&
+ sdRegion.getStartOffset(region) == pos) {
+ // The offset is at the beginning of the region
+ if ((sdRegion.getStartOffset(region) == sdRegion.getStartOffset()) && (sdRegion.getPrevious() != null) && (!sdRegion.getPrevious().isEnded())) {
+ // Is the region also the start of the node? If so, the
+ // previous IStructuredDocumentRegion is
+ // where to look for a useful region.
+ sdRegion = sdRegion.getPrevious();
+ }
+ else {
+ // Is there no separating whitespace from the previous region?
+ // If not,
+ // then that region is the important one
+ ITextRegion previousRegion = sdRegion.getRegionAtCharacterOffset(pos - 1);
+ if ((previousRegion != null) && (previousRegion != region) && (previousRegion.getTextLength() == previousRegion.getLength())) {
+ sdRegion = sdRegion.getPrevious();
+ }
+ }
+ }
+
+ return sdRegion;
+ }
+
+}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPActiveContentAssistProcessor.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -53,16 +53,16 @@
boolean faceletJsfTag = false;
String htmlQuery = null;
- if(isFacelets && tagName.indexOf(':')<1 && !RedHatHtmlContentAssistProcessor.JSFCAttributeName.equals(attributeName)) {
+ if(isFacelets && tagName.indexOf(':')<1 && !FaceletsHtmlContentAssistProcessor.JSFCAttributeName.equals(attributeName)) {
Element element = (Element)node;
NamedNodeMap attributes = element.getAttributes();
- Node jsfC = attributes.getNamedItem(RedHatHtmlContentAssistProcessor.JSFCAttributeName);
+ Node jsfC = attributes.getNamedItem(FaceletsHtmlContentAssistProcessor.JSFCAttributeName);
if(jsfC!=null && (jsfC instanceof Attr)) {
Attr jsfCAttribute = (Attr)jsfC;
String jsfTagName = jsfCAttribute.getValue();
if(jsfTagName!=null && jsfTagName.indexOf(':')>0) {
- htmlQuery = new StringBuffer(KbQuery.TAG_SEPARATOR).append(RedHatHtmlContentAssistProcessor.faceletHtmlPrefixStart + tagName).append(KbQuery.ATTRIBUTE_SEPARATOR).append(attributeName).append(KbQuery.ENUMERATION_SEPARATOR).append(matchString).toString();
+ htmlQuery = new StringBuffer(KbQuery.TAG_SEPARATOR).append(FaceletsHtmlContentAssistProcessor.faceletHtmlPrefixStart + tagName).append(KbQuery.ATTRIBUTE_SEPARATOR).append(attributeName).append(KbQuery.ENUMERATION_SEPARATOR).append(matchString).toString();
tagName = jsfTagName;
faceletJsfTag = true;
}
@@ -70,7 +70,7 @@
}
if(!faceletJsfTag && isFacelets && tagName.indexOf(':')<0) {
- tagName = RedHatHtmlContentAssistProcessor.faceletHtmlPrefixStart + tagName;
+ tagName = FaceletsHtmlContentAssistProcessor.faceletHtmlPrefixStart + tagName;
}
String query = new StringBuffer(KbQuery.TAG_SEPARATOR).append(tagName).append(KbQuery.ATTRIBUTE_SEPARATOR).append(attributeName).append(KbQuery.ENUMERATION_SEPARATOR).append(matchString).toString();
@@ -107,7 +107,7 @@
replacementString += ("\"");
}
int cursorPosition = kbProposal.getPosition() + cursorPositionDelta;
- RedHatCustomCompletionProposal proposal = new RedHatCustomCompletionProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
replacementBeginPosition, replacementLength, cursorPosition, SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
kbProposal.getLabel(), null, kbProposal.getContextInfo(), relevance);
contentAssistRequest.addProposal(proposal);
@@ -138,7 +138,7 @@
}
String replacementString = replacementStringBuffer.toString();
int cursorPosition = kbProposal.getPosition() + cursorPositionDelta;
- RedHatCustomCompletionProposal proposal = new RedHatCustomCompletionProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
replacementBeginPosition, replacementLength, cursorPosition, SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
kbProposal.getLabel(), null, kbProposal.getContextInfo(), relevance);
contentAssistRequest.addProposal(proposal);
@@ -157,8 +157,8 @@
}
private String removeFaceletsPrefix(String tagName) {
- if(tagName.startsWith(RedHatHtmlContentAssistProcessor.faceletHtmlPrefixStart)) {
- return tagName.substring(RedHatHtmlContentAssistProcessor.faceletHtmlPrefixStart.length());
+ if(tagName.startsWith(FaceletsHtmlContentAssistProcessor.faceletHtmlPrefixStart)) {
+ return tagName.substring(FaceletsHtmlContentAssistProcessor.faceletHtmlPrefixStart.length());
}
return tagName;
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPDialogCellEditorContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPDialogCellEditorContentAssistProcessor.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JSPDialogCellEditorContentAssistProcessor.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -84,18 +84,18 @@
boolean faceletJsfTag = false;
String htmlQuery = null;
- if(isFacelets && tagName.indexOf(':')<1 && !RedHatHtmlContentAssistProcessor.JSFCAttributeName.equals(attributeName)) {
+ if(isFacelets && tagName.indexOf(':')<1 && !FaceletsHtmlContentAssistProcessor.JSFCAttributeName.equals(attributeName)) {
Element element = (Element)node;
String jsfTagName = valueHelper.getFaceletJsfTag(element);
if(jsfTagName != null) {
faceletJsfTag = true;
tagName = jsfTagName;
- htmlQuery = new StringBuffer(KbQuery.TAG_SEPARATOR).append(RedHatHtmlContentAssistProcessor.faceletHtmlPrefixStart + tagName).append(KbQuery.ATTRIBUTE_SEPARATOR).append(attributeName).append(KbQuery.ENUMERATION_SEPARATOR).append(matchString).toString();
+ htmlQuery = new StringBuffer(KbQuery.TAG_SEPARATOR).append(FaceletsHtmlContentAssistProcessor.faceletHtmlPrefixStart + tagName).append(KbQuery.ATTRIBUTE_SEPARATOR).append(attributeName).append(KbQuery.ENUMERATION_SEPARATOR).append(matchString).toString();
}
}
if(!faceletJsfTag && isFacelets && tagName.indexOf(':')<0) {
- tagName = RedHatHtmlContentAssistProcessor.faceletHtmlPrefixStart + tagName;
+ tagName = FaceletsHtmlContentAssistProcessor.faceletHtmlPrefixStart + tagName;
}
String query = new StringBuffer(KbQuery.TAG_SEPARATOR).append(tagName).append(KbQuery.ATTRIBUTE_SEPARATOR).append(attributeName).append(KbQuery.ENUMERATION_SEPARATOR).append(matchString).toString();
@@ -121,7 +121,7 @@
int replacementLength = kbProposal.getEnd() - kbProposal.getStart();
int cursorPositionDelta = 0;
int cursorPosition = kbProposal.getPosition() + cursorPositionDelta;
- RedHatCustomCompletionProposal proposal = new RedHatCustomCompletionProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
replacementBeginPosition, replacementLength, cursorPosition, SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
kbProposal.getLabel(), null, kbProposal.getContextInfo(), relevance);
proposalsList.add(proposal);
@@ -132,7 +132,7 @@
int cursorPositionDelta = 0;
String replacementString = replacementStringBuffer.toString();
int cursorPosition = kbProposal.getPosition() + cursorPositionDelta;
- RedHatCustomCompletionProposal proposal = new RedHatCustomCompletionProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
+ AutoContentAssistantProposal proposal = new AutoContentAssistantProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
replacementBeginPosition, replacementLength, cursorPosition, SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
kbProposal.getLabel(), null, kbProposal.getContextInfo(), relevance);
proposalsList.add(proposal);
@@ -150,8 +150,8 @@
return proposal;
}
private String removeFaceletsPrefix(String tagName) {
- if(tagName.startsWith(RedHatHtmlContentAssistProcessor.faceletHtmlPrefixStart)) {
- return tagName.substring(RedHatHtmlContentAssistProcessor.faceletHtmlPrefixStart.length());
+ if(tagName.startsWith(FaceletsHtmlContentAssistProcessor.faceletHtmlPrefixStart)) {
+ return tagName.substring(FaceletsHtmlContentAssistProcessor.faceletHtmlPrefixStart.length());
}
return tagName;
}
Deleted: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatCustomCompletionProposal.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatCustomCompletionProposal.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatCustomCompletionProposal.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.jsp.contentassist;
-
-import org.eclipse.jface.text.ITextOperationTarget;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
-import org.eclipse.wst.sse.ui.internal.contentassist.IRelevanceConstants;
-
-/**
- * @author Igels
- */
-public class RedHatCustomCompletionProposal extends CustomCompletionProposal {
-
- private boolean autoContentAssistant = false;
-
- public RedHatCustomCompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo) {
- super(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, contextInformation, additionalProposalInfo, IRelevanceConstants.R_NONE);
- }
-
- public RedHatCustomCompletionProposal(boolean autoContentAssistant, String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo, int relevance) {
- super(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, contextInformation, additionalProposalInfo, relevance);
- this.autoContentAssistant = autoContentAssistant;
- }
-
- public RedHatCustomCompletionProposal(String replacementString, int replacementOffset, int replacementLength, int cursorPosition, Image image, String displayString, IContextInformation contextInformation, String additionalProposalInfo, int relevance, boolean updateReplacementLengthOnValidate) {
- super(replacementString, replacementOffset, replacementLength, cursorPosition, image, displayString, contextInformation, additionalProposalInfo, relevance, updateReplacementLengthOnValidate);
- }
-
- public void apply(ITextViewer viewer, char trigger, int stateMask, int offset) {
- super.apply(viewer, trigger, stateMask, offset);
- if(autoContentAssistant) {
- Point selection = getSelection(viewer.getDocument());
- viewer.setSelectedRange(selection.x, selection.y);
- if(viewer instanceof ITextOperationTarget) {
- ((ITextOperationTarget)viewer).doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
- }
- }
- }
-
- /**
- * Red Hat. Return cursor position of proposal replasement string.
- */
- public int getCursorPosition() {
- int cursorPosition = -1;
- int firstAttributeEndPosition = getReplacementString().indexOf("=");
- int openEndTagPosition = getReplacementString().indexOf("</");
- int closeStartAndEndTagPosition = getReplacementString().indexOf("/>");
- if(firstAttributeEndPosition>-1) {
- cursorPosition = firstAttributeEndPosition + 2;
- } else if(openEndTagPosition>-1) {
- cursorPosition = openEndTagPosition;
- } else if(closeStartAndEndTagPosition>-1) {
- cursorPosition = closeStartAndEndTagPosition;
- }
- return cursorPosition>-1?cursorPosition:super.getCursorPosition();
- }
-}
\ No newline at end of file
Deleted: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatHtmlContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatHtmlContentAssistProcessor.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatHtmlContentAssistProcessor.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -1,608 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.jsp.contentassist;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jst.jsp.core.internal.contentmodel.TaglibController;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TLDCMDocumentManager;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TaglibTracker;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.wst.html.ui.internal.HTMLUIPlugin;
-import org.eclipse.wst.html.ui.internal.contentassist.HTMLContentAssistProcessor;
-import org.eclipse.wst.html.ui.internal.preferences.HTMLUIPreferenceNames;
-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.core.internal.provisional.text.ITextRegionList;
-import org.eclipse.wst.sse.core.utils.StringUtils;
-import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration;
-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.contentmodel.util.DOMNamespaceHelper;
-import org.eclipse.wst.xml.core.internal.document.AttrImpl;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
-import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
-import org.eclipse.wst.xml.ui.internal.contentassist.XMLRelevanceConstants;
-import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImageHelper;
-import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImages;
-import org.eclipse.wst.xml.ui.internal.util.SharedXMLEditorPluginImageHelper;
-import org.jboss.tools.common.kb.AttributeDescriptor;
-import org.jboss.tools.common.kb.KbConnectorFactory;
-import org.jboss.tools.common.kb.KbConnectorType;
-import org.jboss.tools.common.kb.KbProposal;
-import org.jboss.tools.common.kb.KbQuery;
-import org.jboss.tools.common.kb.KbTldResource;
-import org.jboss.tools.common.kb.wtp.JspWtpKbConnector;
-import org.jboss.tools.common.kb.wtp.TLDVersionHelper;
-import org.jboss.tools.common.kb.wtp.WtpKbConnector;
-import org.jboss.tools.common.model.util.ELParser;
-import org.jboss.tools.common.reporting.ProblemReportingHelper;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.editor.TLDRegisterHelper;
-import org.jboss.tools.jst.jsp.outline.ValueHelper;
-import org.jboss.tools.jst.jsp.support.kb.FaceletsJsfCResource;
-import org.jboss.tools.jst.jsp.support.kb.WTPKbdBeanMethodResource;
-import org.jboss.tools.jst.jsp.support.kb.WTPKbdBeanPropertyResource;
-import org.jboss.tools.jst.jsp.support.kb.WTPKbdBundlePropertyResource;
-import org.jboss.tools.jst.web.tld.TaglibData;
-import org.jboss.tools.jst.web.tld.VpeTaglibListener;
-import org.jboss.tools.jst.web.tld.VpeTaglibManager;
-import org.jboss.tools.jst.web.tld.VpeTaglibManagerProvider;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
-/**
- * @author Igels
- */
-public class RedHatHtmlContentAssistProcessor extends HTMLContentAssistProcessor implements VpeTaglibListener {
-
- private JSPActiveContentAssistProcessor jspActiveCAP;
- private WtpKbConnector wtpKbConnector;
- private IDocument document;
- private IEditorInput editorInput;
- private VpeTaglibManager tldManager;
- private boolean isFacelets = false;
- public static final String faceletUri = "http://java.sun.com/jsf/facelets";
- public static final String faceletHtmlUri = "http://www.w3.org/1999/xhtml/facelets";
- public static final String faceletHtmlPrefix = "0fHP";
- public static final String JSFCAttributeName = "jsfc";
- public static final String faceletHtmlPrefixStart = faceletHtmlPrefix + ":";
- //Added by Max Areshkau JBIDE-788
- public static final KbTldResource faceletHtmlResource = new KbTldResource(faceletHtmlUri, "", faceletHtmlPrefix, null);
-
- public ICompletionProposal[] computeCompletionProposals(ITextViewer textViewer, int documentPosition) {
- document = textViewer.getDocument();
- editorInput = JspEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorInput();
- //added by Max Areshkau JBIDE-788
- IndexedRegion treeNode = ContentAssistUtils.getNodeAt(textViewer, documentPosition);
- IDOMNode node = (IDOMNode) treeNode;
- registerToTldManager(textViewer, node);
-
- ICompletionProposal[] proposals = super.computeCompletionProposals(textViewer, documentPosition);
- if(proposals!=null) {
- for(int i=0; i<proposals.length; i++) {
- if(proposals[i] instanceof RedHatCustomCompletionProposal) {
- fErrorMessage = null;
- break;
- }
- }
- }
- if(isFacelets) {
- return getUniqProposals(proposals);
- }
- proposals = getUniqProposals(proposals);
- return proposals;
- }
-
- private ICompletionProposal[] getUniqProposals(ICompletionProposal[] proposals) {
- if(proposals==null) {
- return null;
- }
- HashMap uniqProposals = new HashMap(proposals.length);
- ArrayList uniqProposalList = new ArrayList(proposals.length);
- for(int i=0; i<proposals.length; i++) {
- int eq = proposals[i].getDisplayString().indexOf('=');
- String str = proposals[i].getDisplayString();;
- if(eq>0) {
- str = str.substring(0, eq);
- }
- Object proposal = uniqProposals.get(str);
- if(proposal==null || proposals[i] instanceof RedHatCustomCompletionProposal) {
- uniqProposals.put(str, proposals[i]);
- uniqProposalList.add(proposals[i]);
- if(proposal!=null) {
- uniqProposalList.remove(proposal);
- }
- }
- }
- return (ICompletionProposal[])uniqProposalList.toArray(new ICompletionProposal[uniqProposals.size()]);
- }
-
- protected void addTagInsertionProposals(ContentAssistRequest contentAssistRequest, int childPosition) {
- if(!addELFaceletsProposals(contentAssistRequest, childPosition)) {
- String request = "/" + contentAssistRequest.getMatchString();
- Collection kbProposals = null;
- try {
- kbProposals = getWtpKbConnector().getProposals(request);
- } catch(Exception e) {
- JspEditorPlugin.getPluginLog().logError(e);
- }
- for (Iterator iter = kbProposals.iterator(); iter.hasNext();) {
- KbProposal kbProposal = (KbProposal) iter.next();
- if(ignoreProposal(kbProposal)) {
- continue;
- }
- String proposedInfo = kbProposal.getContextInfo();
- String kbReplacementString = kbProposal.getReplacementString();
- String replacementString = "<" + kbReplacementString + ">";
- String displayString = kbProposal.getLabel();
- boolean autoContentAssistant = replacementString.indexOf('\"')>-1 && replacementString.indexOf("=")>-1;
- int cursorAdjustment = replacementString.length();;
- if(!kbReplacementString.endsWith("/")) {
- replacementString = replacementString + "</" + displayString + ">";
- }
- Image image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
- RedHatCustomCompletionProposal proposal = new RedHatCustomCompletionProposal(autoContentAssistant, replacementString, contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), cursorAdjustment, image, displayString, null, proposedInfo, XMLRelevanceConstants.R_TAG_NAME);
- contentAssistRequest.addProposal(proposal);
- }
- super.addTagInsertionProposals(contentAssistRequest, childPosition);
- }
- }
-
- private boolean addELFaceletsProposals(ContentAssistRequest contentAssistRequest, int childPosition) {
- if(isFacelets) {
- IDOMNode node = (IDOMNode)contentAssistRequest.getNode();
- IStructuredDocumentRegion open = node.getFirstStructuredDocumentRegion();
- ITextRegionList openRegions = open.getRegions();
- int i = openRegions.indexOf(contentAssistRequest.getRegion());
- if(i < 0) return false;
- String currentValue = contentAssistRequest.getText();
- int start = contentAssistRequest.getStartOffset();
- int offset = contentAssistRequest.getReplacementBeginPosition() - start;
- String matchString = currentValue.substring(0, offset);
- ValueHelper h = new ValueHelper();
- IEditorInput input = h.getEditorInput();
- ArrayList proposals = new ArrayList();
- WTPKbdBeanPropertyResource r1 = new WTPKbdBeanPropertyResource(input, h.getConnector());
- proposals.addAll(r1.queryProposal(matchString));
- WTPKbdBeanMethodResource r2 = new WTPKbdBeanMethodResource(input, h.getConnector());
- proposals.addAll(r2.queryProposal(matchString));
- WTPKbdBundlePropertyResource r3 = new WTPKbdBundlePropertyResource(input, h.getConnector());
- proposals.addAll(r3.queryProposal(matchString));
-
- for (Iterator iter = proposals.iterator(); iter.hasNext();) {
- KbProposal kbProposal = cleanFaceletProposal((KbProposal)iter.next());
- kbProposal.postProcess(currentValue, offset);
- int relevance = kbProposal.getRelevance();
- if(relevance==KbProposal.R_NONE) {
- relevance = XMLRelevanceConstants.R_XML_ATTRIBUTE_VALUE;
- }
-
- if(kbProposal.getStart() >= 0) {
- String replacementString = kbProposal.getReplacementString();
- int replacementBeginPosition = start + kbProposal.getStart();
- int replacementLength = kbProposal.getEnd() - kbProposal.getStart();
- int cursorPositionDelta = 0;
- int cursorPosition = kbProposal.getPosition() + cursorPositionDelta;
- RedHatCustomCompletionProposal proposal = new RedHatCustomCompletionProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
- replacementBeginPosition, replacementLength, cursorPosition, SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
- kbProposal.getLabel(), null, kbProposal.getContextInfo(), relevance);
- contentAssistRequest.addProposal(proposal);
- continue;
- } else {
- StringBuffer replacementStringBuffer = new StringBuffer(kbProposal.getReplacementString());
- int replacementBeginPosition = start;
- int replacementLength = 0;
- int cursorPositionDelta = 0;
- String replacementString = replacementStringBuffer.toString();
- int cursorPosition = kbProposal.getPosition() + cursorPositionDelta;
- RedHatCustomCompletionProposal proposal = new RedHatCustomCompletionProposal(kbProposal.autoActivationContentAssistantAfterApplication(), replacementString,
- replacementBeginPosition, replacementLength, cursorPosition, SharedXMLEditorPluginImageHelper.getImage(SharedXMLEditorPluginImageHelper.IMG_OBJ_ATTRIBUTE),
- kbProposal.getLabel(), null, kbProposal.getContextInfo(), relevance);
- contentAssistRequest.addProposal(proposal);
- }
- }
- ELParser p = new ELParser();
- ELParser.Token root = p.parse(currentValue);
- ELParser.Token c = root == null ? null : ELParser.getTokenAt(root, offset);
- if(ELParser.getPrecedingOpen(c, offset) != null) return true;
- }
- return false;
- }
-
- protected void addAttributeNameProposals(ContentAssistRequest contentAssistRequest) {
- Element element = (Element)contentAssistRequest.getNode();
- NamedNodeMap attributes = element.getAttributes();
-
- String tagName = element.getNodeName();
- if(isFacelets && tagName.indexOf(':')<0) {
- tagName = faceletHtmlPrefixStart + tagName;
- }
- String request = "/" + tagName + "@" + contentAssistRequest.getMatchString();
- Collection kbProposals = null;
- try {
- kbProposals = getWtpKbConnector().getProposals(request);
- } catch(Exception e) {
- JspEditorPlugin.getPluginLog().logError(e);
- }
- for (Iterator iter = kbProposals.iterator(); iter.hasNext();) {
- KbProposal kbProposal = cleanFaceletProposal((KbProposal)iter.next());
- String proposedInfo = kbProposal.getContextInfo();
- String replacementString = kbProposal.getReplacementString() + "=\"\"";
- String displayString = kbProposal.getLabel();
- AttrImpl attr = (AttrImpl)attributes.getNamedItem(displayString);
- if(attr!=null) {
- ITextRegion region = attr.getNameRegion();
- IStructuredDocumentRegion docRegion = contentAssistRequest.getDocumentRegion();
- if(docRegion.getStartOffset(region)>contentAssistRequest.getReplacementBeginPosition() ||
- docRegion.getEndOffset(region)< contentAssistRequest.getReplacementBeginPosition() + contentAssistRequest.getReplacementLength()) {
- continue;
- }
- }
- boolean autoContentAssistant = true;
- int cursorAdjustment = replacementString.length() - 1;
- Image image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_ATTRIBUTE);
- RedHatCustomCompletionProposal proposal = new RedHatCustomCompletionProposal(autoContentAssistant, replacementString, contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), cursorAdjustment, image, displayString, null, proposedInfo, XMLRelevanceConstants.R_TAG_NAME);
- contentAssistRequest.addProposal(proposal);
- }
- addJsfAttributeNameProposalsForFaceletTag(contentAssistRequest);
- super.addAttributeNameProposals(contentAssistRequest);
- }
-
- private void addJsfAttributeNameProposalsForFaceletTag(ContentAssistRequest contentAssistRequest) {
- // Ignore if jsp is not facelet jsp
- if(!isFacelets) {
- return;
- }
-
- Element element = (Element)contentAssistRequest.getNode();
-
- String tagName = element.getNodeName();
- // Only HTML tags
- if(tagName.indexOf(':')>0) {
- return;
- }
-
- NamedNodeMap attributes = element.getAttributes();
- Node jsfC = attributes.getNamedItem(JSFCAttributeName);
- if(jsfC==null || (!(jsfC instanceof Attr))) {
- return;
- }
- Attr jsfCAttribute = (Attr)jsfC;
- String jsfTagName = jsfCAttribute.getValue();
- if(jsfTagName==null || jsfTagName.indexOf(':')<1) {
- return;
- }
-
- String request = "/" + jsfTagName + "@" + contentAssistRequest.getMatchString();
- Collection kbProposals = null;
- try {
- kbProposals = getWtpKbConnector().getProposals(request);
- } catch(Exception e) {
- JspEditorPlugin.getPluginLog().logError(e);
- }
- for (Iterator iter = kbProposals.iterator(); iter.hasNext();) {
- KbProposal kbProposal = (KbProposal)iter.next();
- if(ignoreProposal(kbProposal)) {
- continue;
- }
- String proposedInfo = kbProposal.getContextInfo();
- String replacementString = kbProposal.getReplacementString() + "=\"\"";
- String displayString = kbProposal.getLabel();
- AttrImpl attr = (AttrImpl)attributes.getNamedItem(displayString);
- if(attr!=null) {
- ITextRegion region = attr.getNameRegion();
- IStructuredDocumentRegion docRegion = contentAssistRequest.getDocumentRegion();
- if(docRegion.getStartOffset(region)>contentAssistRequest.getReplacementBeginPosition() ||
- docRegion.getEndOffset(region)< contentAssistRequest.getReplacementBeginPosition() + contentAssistRequest.getReplacementLength()) {
- continue;
- }
- }
- boolean autoContentAssistant = true;
- int cursorAdjustment = replacementString.length() - 1;
- Image image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_ATTRIBUTE);
- RedHatCustomCompletionProposal proposal = new RedHatCustomCompletionProposal(autoContentAssistant, replacementString, contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), cursorAdjustment, image, displayString, null, proposedInfo, XMLRelevanceConstants.R_TAG_NAME);
- contentAssistRequest.addProposal(proposal);
- }
- }
-
- protected void addAttributeValueProposals(ContentAssistRequest contentAssistRequest) {
- // JBIDE-1704:
- // Check the position in the value:
- // The following position:
- // <nodeName attrName="attrValue"| .../>
- // is marked as attribute value, but the value itself is complete.
- // There are no proposals to be correct at this position.
-
- String text = contentAssistRequest.getText();
- String matchString = contentAssistRequest.getMatchString();
-
- if (matchString.length() > StringUtils.strip(text).length() &&
- ( (matchString.startsWith("\"") && matchString.endsWith("\"") &&
- (matchString.indexOf("\"") != matchString.lastIndexOf("\"")))
- || (matchString.startsWith("'") && matchString.endsWith("\"") &&
- (matchString.indexOf("\"") != matchString.lastIndexOf("\""))))) {
- return;
- }
-
- if (jspActiveCAP != null) {
- jspActiveCAP.setFacelets(isFacelets);
- jspActiveCAP.addAttributeValueProposals(contentAssistRequest);
- }
- IDOMNode node = (IDOMNode) contentAssistRequest.getNode();
- String tagName = node.getNodeName();
- CMElementDeclaration elementDecl = getCMElementDeclaration(node);
-
- IStructuredDocumentRegion open = node.getFirstStructuredDocumentRegion();
- ITextRegionList openRegions = open.getRegions();
- int i = openRegions.indexOf(contentAssistRequest.getRegion());
- if (i < 0)
- return;
- ITextRegion nameRegion = null;
- while (i >= 0) {
- nameRegion = openRegions.get(i--);
- if (nameRegion.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_NAME)
- break;
- }
-
- String attributeName = open.getText(nameRegion);
-
- boolean faceletJsfTag = false;
- if(isFacelets && tagName.indexOf(':')<1 && !JSFCAttributeName.equals(attributeName)) {
- Element element = (Element)node;
-
- NamedNodeMap attributes = element.getAttributes();
- Node jsfC = attributes.getNamedItem(RedHatHtmlContentAssistProcessor.JSFCAttributeName);
- if(jsfC!=null && (jsfC instanceof Attr)) {
- Attr jsfCAttribute = (Attr)jsfC;
- String jsfTagName = jsfCAttribute.getValue();
- if(jsfTagName!=null && jsfTagName.indexOf(':')>0) {
- tagName = jsfTagName;
- faceletJsfTag = true;
- }
- }
- }
-
- if(!faceletJsfTag && isFacelets && tagName.indexOf(':')<0) {
- tagName = faceletHtmlPrefixStart + tagName;
- }
- String query = new StringBuffer(KbQuery.TAG_SEPARATOR).append(tagName).append(KbQuery.ATTRIBUTE_SEPARATOR).append(attributeName).toString();
- AttributeDescriptor ad = null;
- try {
- ad = getWtpKbConnector().getAttributeInformation(query);
- } catch(Exception e) {
- ProblemReportingHelper.reportProblem(JspEditorPlugin.PLUGIN_ID, "ERROR: Can't get Attribute Descriptor from KB by " + query + "", e);
- }
- if(ad!=null) {
- CMAttributeDeclaration attrDecl = null;
- if (elementDecl != null) {
- CMNamedNodeMap attributes = elementDecl.getAttributes();
- String noprefixName = DOMNamespaceHelper.getUnprefixedName(attributeName);
- if (attributes != null) {
- attrDecl = (CMAttributeDeclaration) attributes.getNamedItem(noprefixName);
- if (attrDecl == null) {
- attrDecl = (CMAttributeDeclaration) attributes.getNamedItem(attributeName);
- }
- }
- }
- if (attrDecl == null || attrDecl.getAttrType() == null) {
- return;
- }
- }
-
- super.addAttributeValueProposals(contentAssistRequest);
- }
-
- protected void addTagNameProposals(ContentAssistRequest contentAssistRequest, int childPosition) {
- String request = "/" + contentAssistRequest.getMatchString();
- Collection kbProposals = null;
- try {
- kbProposals = getWtpKbConnector().getProposals(request);
- } catch(Exception e) {
- JspEditorPlugin.getPluginLog().logError(e);
- }
- if(kbProposals!=null) {
- for (Iterator iter = kbProposals.iterator(); iter.hasNext();) {
- KbProposal kbProposal = (KbProposal) iter.next();
- if(ignoreProposal(kbProposal)) {
- continue;
- }
- String proposedInfo = kbProposal.getContextInfo();
- String kbReplacementString = kbProposal.getReplacementString();
- String replacementString = kbReplacementString + ">";
- String displayString = kbProposal.getLabel();
- boolean autoContentAssistant = replacementString.indexOf('\"')>-1 && replacementString.indexOf("=")>-1;
- int cursorAdjustment = replacementString.length();
- if(!kbReplacementString.endsWith("/")) {
- replacementString = replacementString + "</" + displayString + ">";
- }
- Image image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
- RedHatCustomCompletionProposal proposal = new RedHatCustomCompletionProposal(autoContentAssistant, replacementString, contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), cursorAdjustment, image, displayString, null, proposedInfo, XMLRelevanceConstants.R_TAG_NAME);
- contentAssistRequest.addProposal(proposal);
- }
- }
- super.addTagNameProposals(contentAssistRequest, childPosition);
- }
-
- private boolean ignoreProposal(KbProposal proposal) {
- if(isFacelets) {
- return proposal.getLabel().startsWith(faceletHtmlPrefixStart);
- }
- return false;
- }
-
- private KbProposal cleanFaceletProposal(KbProposal proposal) {
- if(isFacelets) {
- proposal.setLabel(removeFaceletsPrefix(proposal.getLabel()));
- proposal.setReplacementString(removeFaceletsPrefix(proposal.getReplacementString()));
- }
- return proposal;
- }
-
- private String removeFaceletsPrefix(String tagName) {
- if(tagName.startsWith(faceletHtmlPrefixStart)) {
- return tagName.substring(faceletHtmlPrefixStart.length());
- }
- return tagName;
- }
-
- private WtpKbConnector getWtpKbConnector() {
- if(wtpKbConnector == null && document != null) {
- try {
- wtpKbConnector = (WtpKbConnector)KbConnectorFactory.getIntstance().createConnector(KbConnectorType.JSP_WTP_KB_CONNECTOR, document);
- jspActiveCAP.setKbConnector(wtpKbConnector);
- FaceletsJsfCResource fsfCResource = new FaceletsJsfCResource(wtpKbConnector);
- wtpKbConnector.registerResource(fsfCResource);
- } catch(Exception e) {
- ProblemReportingHelper.reportProblem(JspEditorPlugin.PLUGIN_ID, "ERROR: Can't create WtpKbConnector.", e);
- }
- }
- return wtpKbConnector;
- }
-
- private void registerToTldManager(ITextViewer viewer,IDOMNode node) {
- if((tldManager==null) && (viewer instanceof VpeTaglibManagerProvider)) {
- tldManager = ((VpeTaglibManagerProvider)viewer).getTaglibManager();
- tldManager.setReferenceNode(node);
- if(tldManager!=null) {
- tldManager.addTaglibListener(this);
- updateActiveContentAssistProcessor(document);
- }
- } else if(tldManager!=null) {
- tldManager.setReferenceNode(node);
- updateActiveContentAssistProcessor(document);
- }
- }
-
- public void taglibPrefixChanged(String[] prefixs) {
- updateActiveContentAssistProcessor(document);
- }
-
- public void addTaglib(String uri, String prefix) {
- }
-
- public void removeTaglib(String uri, String prefix) {
- }
-
- public static void registerTld(TaglibData data, JspWtpKbConnector wtpKbConnector, IDocument document, IEditorInput input) {
- TLDRegisterHelper.registerTld(data, wtpKbConnector, document, input);
- }
-
- public void updateActiveContentAssistProcessor(IDocument document) {
- if(tldManager==null) {
- TLDCMDocumentManager manager = TaglibController.getTLDCMDocumentManager(document);
- if (manager != null) {
- List list = manager.getTaglibTrackers();
- for(int i=0; i<list.size(); i++) {
- TaglibTracker tracker = (TaglibTracker)list.get(i);
- String version = TLDVersionHelper.getTldVersion(tracker);
- KbTldResource resource = new KbTldResource(tracker.getURI(), "", tracker.getPrefix(), version);
- getWtpKbConnector().registerResource(resource);
- }
- }
- } else {
- List list = tldManager.getTagLibs();
- if(list==null) {
- return;
- }
- ((JspWtpKbConnector)getWtpKbConnector()).unregisterAllResources(true);
- isFacelets = false;
- for(int i=0; i<list.size(); i++) {
- TaglibData data = (TaglibData)list.get(i);
- registerTld(data, (JspWtpKbConnector)getWtpKbConnector(), document, editorInput);
- isFacelets = isFacelets || data.getUri().equals(faceletUri);
- }
- if(isFacelets) {
- getWtpKbConnector().registerResource(faceletHtmlResource);
- ((JspWtpKbConnector)getWtpKbConnector()).unregisterJspResource();
- }
- }
- }
-
- public char[] getCompletionProposalAutoActivationCharacters() {
- char[] autoActivChars = null;
- char[] superAutoActivChars = super.getCompletionProposalAutoActivationCharacters();
- if(superAutoActivChars==null) {
- return superAutoActivChars;
- }
-
- autoActivChars = superAutoActivChars;
- IPreferenceStore store = HTMLUIPlugin.getDefault().getPreferenceStore();
- if(store.isDefault(HTMLUIPreferenceNames.AUTO_PROPOSE_CODE)) {
-// String superDefaultChars = store.getDefaultString(JSPUIPreferenceNames.AUTO_PROPOSE_CODE);
- StringBuffer redhatDefaultChars = new StringBuffer(new String(superAutoActivChars));
- if(redhatDefaultChars.indexOf(".")<0) {
- redhatDefaultChars.append('.');
- store.setDefault(HTMLUIPreferenceNames.AUTO_PROPOSE_CODE, redhatDefaultChars.toString());
- store.setValue(HTMLUIPreferenceNames.AUTO_PROPOSE_CODE, redhatDefaultChars.toString());
- }
- autoActivChars = new char[redhatDefaultChars.length()];
- redhatDefaultChars.getChars(0, redhatDefaultChars.length(), autoActivChars, 0);
- }
-
- return autoActivChars;
- }
-
- protected void init() {
- super.init();
- jspActiveCAP = new JSPActiveContentAssistProcessor();
- jspActiveCAP.init();
- }
-
-
- /**
- * StructuredTextViewer must be set before using this.
- */
- public IStructuredDocumentRegion getStructuredDocumentRegion(int pos) {
- IStructuredDocumentRegion sdRegion = ContentAssistUtils.getStructuredDocumentRegion(fTextViewer, pos);
- ITextRegion region = (sdRegion == null ? null : sdRegion.getRegionAtCharacterOffset(pos));
- if (region == null) {
- return null;
- }
-
- if (region.getType() == DOMRegionContext.XML_TAG_OPEN &&
- sdRegion.getStartOffset(region) == pos) {
- // The offset is at the beginning of the region
- if ((sdRegion.getStartOffset(region) == sdRegion.getStartOffset()) && (sdRegion.getPrevious() != null) && (!sdRegion.getPrevious().isEnded())) {
- // Is the region also the start of the node? If so, the
- // previous IStructuredDocumentRegion is
- // where to look for a useful region.
- sdRegion = sdRegion.getPrevious();
- }
- else {
- // Is there no separating whitespace from the previous region?
- // If not,
- // then that region is the important one
- ITextRegion previousRegion = sdRegion.getRegionAtCharacterOffset(pos - 1);
- if ((previousRegion != null) && (previousRegion != region) && (previousRegion.getTextLength() == previousRegion.getLength())) {
- sdRegion = sdRegion.getPrevious();
- }
- }
- }
-
- return sdRegion;
- }
-
-}
\ No newline at end of file
Deleted: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatJSPContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatJSPContentAssistProcessor.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/RedHatJSPContentAssistProcessor.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -1,712 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.jst.jsp.contentassist;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.jface.text.contentassist.ICompletionProposal;
-import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
-import org.eclipse.jst.jsp.core.internal.contentmodel.TaglibController;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TLDCMDocumentManager;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TaglibTracker;
-import org.eclipse.jst.jsp.core.internal.regions.DOMJSPRegionContexts;
-import org.eclipse.jst.jsp.core.text.IJSPPartitions;
-import org.eclipse.jst.jsp.ui.internal.JSPUIPlugin;
-import org.eclipse.jst.jsp.ui.internal.contentassist.JSPContentAssistProcessor;
-import org.eclipse.jst.jsp.ui.internal.preferences.JSPUIPreferenceNames;
-import org.eclipse.jst.jsp.ui.internal.templates.TemplateContextTypeIdsJSP;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.css.ui.internal.contentassist.CSSContentAssistProcessor;
-import org.eclipse.wst.html.core.text.IHTMLPartitions;
-import org.eclipse.wst.javascript.ui.internal.common.contentassist.JavaScriptContentAssistProcessor;
-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;
-import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionContainer;
-import org.eclipse.wst.sse.core.utils.StringUtils;
-import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
-import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
-import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
-import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;
-import org.eclipse.wst.xml.core.internal.contentmodel.modelquery.ModelQueryAction;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
-import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
-import org.eclipse.wst.xml.ui.internal.XMLUIPlugin;
-import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
-import org.eclipse.wst.xml.ui.internal.contentassist.XMLContentAssistUtilities;
-import org.eclipse.wst.xml.ui.internal.contentassist.XMLContentModelGenerator;
-import org.eclipse.wst.xml.ui.internal.contentassist.XMLRelevanceConstants;
-import org.eclipse.wst.xml.ui.internal.editor.CMImageUtil;
-import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImageHelper;
-import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImages;
-import org.eclipse.wst.xml.ui.internal.preferences.XMLUIPreferenceNames;
-import org.jboss.tools.common.kb.KbConnectorFactory;
-import org.jboss.tools.common.kb.KbConnectorType;
-import org.jboss.tools.common.kb.KbException;
-import org.jboss.tools.common.kb.KbProposal;
-import org.jboss.tools.common.kb.KbTldResource;
-import org.jboss.tools.common.kb.TagDescriptor;
-import org.jboss.tools.common.kb.wtp.TLDVersionHelper;
-import org.jboss.tools.common.kb.wtp.WtpKbConnector;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.web.project.WebProject;
-import org.jboss.tools.jst.web.tld.TaglibData;
-import org.jboss.tools.jst.web.tld.VpeTaglibListener;
-import org.jboss.tools.jst.web.tld.VpeTaglibManager;
-import org.jboss.tools.jst.web.tld.VpeTaglibManagerProvider;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * @author Igels
- */
-public class RedHatJSPContentAssistProcessor extends JSPContentAssistProcessor{
-
- private JSPActiveContentAssistProcessor jspActiveCAP;
- private WtpKbConnector wtpKbConnector;
- private IDocument document;
- private boolean dontOpenTag = false;
-
-
- public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int documentPosition) {
- try {
- String text = viewer.getDocument().get(0, documentPosition);
- int lastOpenTag = text.lastIndexOf('<');
- int lastCloseTag = text.lastIndexOf('>');
- dontOpenTag = lastCloseTag<lastOpenTag;
- } catch (Exception e) {
- JspEditorPlugin.getPluginLog().logError(e);
- }
-
- document = viewer.getDocument();
- //added by Max Areshkau JBIDE-788
- updateActiveContentAssistProcessor(document);
- ICompletionProposal[] proposals = super.computeCompletionProposals(viewer, documentPosition);
- // If proposal list from super is empty to try to get it from Red Hat dinamic jsp content assist processor.
- try {
- if(proposals.length == 0) {
- String partitionType = getPartitionType((StructuredTextViewer) viewer, documentPosition);
- IContentAssistProcessor p = (IContentAssistProcessor) fPartitionToProcessorMap.get(partitionType);
- if (!(p instanceof JavaScriptContentAssistProcessor || p instanceof CSSContentAssistProcessor)) {
-
- IndexedRegion treeNode = ContentAssistUtils.getNodeAt((StructuredTextViewer) viewer, documentPosition);
- Node node = (Node) treeNode;
-
- while (node != null && node.getNodeType() == Node.TEXT_NODE && node.getParentNode() != null)
- node = node.getParentNode();
- IDOMNode xmlnode = (IDOMNode) node;
- if(xmlnode!=null) {
- fTextViewer = viewer;
- IStructuredDocumentRegion sdRegion = getStructuredDocumentRegion(documentPosition);
- ITextRegion completionRegion = getCompletionRegion(documentPosition, node);
- if(completionRegion!=null) {
- String matchString = getMatchString(sdRegion, completionRegion, documentPosition);
- ContentAssistRequest contentAssistRequest = computeCompletionProposals(documentPosition, matchString, completionRegion, (IDOMNode) treeNode, xmlnode);
- if(contentAssistRequest!=null) {
- proposals = contentAssistRequest.getCompletionProposals();
- }
- }
- }
- }
- }
- } catch (Exception e) {
- JspEditorPlugin.getPluginLog().logError(e);
- }
- proposals = getUniqProposals(proposals);
- return proposals;
- }
-
- public static ICompletionProposal[] getUniqProposals(ICompletionProposal[] proposals) {
- ArrayList uniqProposals = new ArrayList(proposals.length);
- HashSet displayStrings = new HashSet(proposals.length);
- for(int i=0; i<proposals.length; i++) {
- String str = proposals[i].getDisplayString();
- if(str==null || !displayStrings.contains(str)) {
- displayStrings.add(str);
- uniqProposals.add(proposals[i]);
- }
- }
- return (ICompletionProposal[])uniqProposals.toArray(new ICompletionProposal[uniqProposals.size()]);
- }
-
- /**
- * int map that points [partition > processor]. This takes place of
- * embedded adapters for now.
- */
- protected void initPartitionToProcessorMap() {
- super.initPartitionToProcessorMap();
- }
-
- public char[] getCompletionProposalAutoActivationCharacters() {
- char[] autoActivChars = null;
- char[] superAutoActivChars = super.getCompletionProposalAutoActivationCharacters();
- if(superAutoActivChars==null) {
- return superAutoActivChars;
- }
-
- autoActivChars = superAutoActivChars;
- IPreferenceStore store = JSPUIPlugin.getDefault().getPreferenceStore();
- if(store.isDefault(JSPUIPreferenceNames.AUTO_PROPOSE_CODE)) {
-// String superDefaultChars = store.getDefaultString(JSPUIPreferenceNames.AUTO_PROPOSE_CODE);
- StringBuffer redhatDefaultChars = new StringBuffer(new String(superAutoActivChars));
- if(redhatDefaultChars.indexOf(".")<0) {
- redhatDefaultChars.append('.');
- store.setDefault(JSPUIPreferenceNames.AUTO_PROPOSE_CODE, redhatDefaultChars.toString());
- store.setValue(JSPUIPreferenceNames.AUTO_PROPOSE_CODE, redhatDefaultChars.toString());
- }
- autoActivChars = new char[redhatDefaultChars.length()];
- redhatDefaultChars.getChars(0, redhatDefaultChars.length(), autoActivChars, 0);
- }
-
- return autoActivChars;
- }
-
- public void updateActiveContentAssistProcessor(IDocument document) {
- TLDCMDocumentManager manager = TaglibController.getTLDCMDocumentManager(document);
- if (manager != null) {
- List list = manager.getTaglibTrackers();
- for(int i=0; i<list.size(); i++) {
- TaglibTracker tracker = (TaglibTracker)list.get(i);
-
- String version = TLDVersionHelper.getTldVersion(tracker);
- KbTldResource resource = new KbTldResource(tracker.getURI(), "", tracker.getPrefix(), version);
- getWtpKbConnector().registerResource(resource);
- addActiveContentAssistProcessorToProcessorMap(tracker.getURI(), tracker.getPrefix(), version);
- }
- }
- }
-
- private void addActiveContentAssistProcessorToProcessorMap(String uri, String prefix, String version) {
- try {
- List names = getWtpKbConnector().getAllTagNamesFromTldByUri(uri, version);
- for(Iterator iter = names.iterator(); iter.hasNext();) {
- String fullName = prefix + ":" + iter.next();
- fNameToProcessorMap.put(fullName, jspActiveCAP);
- }
- } catch (KbException e) {
- JspEditorPlugin.getPluginLog().logError(e);
- }
- }
-
- private WtpKbConnector getWtpKbConnector() {
- if(wtpKbConnector == null && document != null) {
- try {
- wtpKbConnector = (WtpKbConnector)KbConnectorFactory.getIntstance().createConnector(KbConnectorType.JSP_WTP_KB_CONNECTOR, document);
- jspActiveCAP.setKbConnector(wtpKbConnector);
- } catch (ClassNotFoundException e) {
- JspEditorPlugin.getPluginLog().logError(e);
- } catch (InstantiationException e) {
- JspEditorPlugin.getPluginLog().logError(e);
- } catch (IllegalAccessException e) {
- JspEditorPlugin.getPluginLog().logError(e);
- }
- }
- return wtpKbConnector;
- }
-
- protected void init() {
- super.init();
- jspActiveCAP = new JSPActiveContentAssistProcessor();
- jspActiveCAP.init();
- }
-
- public XMLContentModelGenerator getContentGenerator() {
- if (fGenerator == null){
- fGenerator = new XMLContentModelGenerator(){
- public void generateTag(Node parent, CMElementDeclaration elementDecl, StringBuffer buffer) {
- if (elementDecl == null || buffer == null) {
- return;
- }
- try {
- String tagName = getRequiredName(parent, elementDecl);
- TagDescriptor info = getWtpKbConnector().getTagInformation("/" + tagName + "/");
- if (info != null) {
- KbProposal proposal = info.generateProposal();
- String replString = proposal.getReplacementString();
- boolean hasBody = info.hasBody();
-
- if (replString != null && replString.length() > 0) {
- if(!dontOpenTag) {
- buffer.append("<");
- }
- buffer.append(replString);
- buffer.append(">");
- if (hasBody) {
- buffer.append("</");
- buffer.append(tagName);
- buffer.append(">");
- }
- return;
- }
- }
- } catch (Exception x) {
- JspEditorPlugin.getPluginLog().logError("", x);
- }
- super.generateTag(parent, elementDecl, buffer);
- return;
- }
- };
- }
- return fGenerator;
- }
-
- protected void addTagInsertionProposals(ContentAssistRequest contentAssistRequest, int childPosition) {
- List cmnodes = null;
- Node parent = contentAssistRequest.getParent();
- String error = null;
-
- if (parent != null && parent.getNodeType() == Node.DOCUMENT_NODE && ((IDOMDocument) parent).isXMLType() && !isCursorAfterXMLPI(contentAssistRequest)) {
- return;
- }
- // only want proposals if cursor is after doctype...
- if (!isCursorAfterDoctype(contentAssistRequest))
- return;
-
- if (parent != null && parent instanceof IDOMNode && isCommentNode((IDOMNode) parent)) {
- // loop and find non comment node?
- while (parent != null && isCommentNode((IDOMNode) parent)) {
- parent = parent.getParentNode();
- }
- }
-
- if (parent.getNodeType() == Node.ELEMENT_NODE) {
- CMElementDeclaration parentDecl = getCMElementDeclaration(parent);
- if (parentDecl != null) {
- // XSD-specific ability - no filtering
- CMDataType childType = parentDecl.getDataType();
- if (childType != null) {
- String[] childStrings = childType.getEnumeratedValues();
- if (childStrings != null) {
- // the content string is the sole valid child...so
- // replace the rest
- int begin = contentAssistRequest.getReplacementBeginPosition();
- int length = contentAssistRequest.getReplacementLength();
- if (parent instanceof IDOMNode) {
- if (((IDOMNode) parent).getLastStructuredDocumentRegion() != ((IDOMNode) parent).getFirstStructuredDocumentRegion()) {
- begin = ((IDOMNode) parent).getFirstStructuredDocumentRegion().getEndOffset();
- length = ((IDOMNode) parent).getLastStructuredDocumentRegion().getStartOffset() - begin;
- }
- }
- String proposedInfo = getAdditionalInfo(parentDecl, childType);
- for (int i = 0; i < childStrings.length; i++) {
- CustomCompletionProposal textProposal = new RedHatCustomCompletionProposal(childStrings[i].indexOf("=")>-1, childStrings[i], begin, length, childStrings[i].length(), XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_ENUM), childStrings[i], null, proposedInfo, XMLRelevanceConstants.R_TAG_INSERTION);
- contentAssistRequest.addProposal(textProposal);
- }
- }
- }
- }
- if (parentDecl != null && parentDecl.getContentType() == CMElementDeclaration.PCDATA) {
- addPCDATAProposal(parentDecl.getNodeName(), contentAssistRequest);
- }
- else {
- // retrieve the list of all possible children within this parent context
- cmnodes = getAvailableChildElementDeclarations((Element)parent, childPosition, ModelQueryAction.INSERT);
-
- // retrieve the list of the possible children within this parent context and at this index
- List strictCMNodeSuggestions = null;
- if (XMLUIPreferenceNames.SUGGESTION_STRATEGY_VALUE_STRICT.equals(XMLUIPlugin.getInstance().getPreferenceStore().getString(XMLUIPreferenceNames.SUGGESTION_STRATEGY)))
- {
- strictCMNodeSuggestions = getValidChildElementDeclarations((Element)parent, childPosition, ModelQueryAction.INSERT);
- }
- Iterator nodeIterator = cmnodes.iterator();
- if (!nodeIterator.hasNext()) {
- if (getCMElementDeclaration(parent) != null)
- error = NLS.bind(XMLUIMessages._Has_no_available_child, (new Object[]{parent.getNodeName()}));
- else
- error = NLS.bind(XMLUIMessages.Element__is_unknown, (new Object[]{parent.getNodeName()}));
- }
- String matchString = contentAssistRequest.getMatchString();
- // chop off any leading <'s and whitespace from the
- // matchstring
- while ((matchString.length() > 0) && (Character.isWhitespace(matchString.charAt(0)) || beginsWith(matchString, "<"))) //$NON-NLS-1$
- //$NON-NLS-1$
- matchString = matchString.substring(1);
- while (nodeIterator.hasNext()) {
- Object o = nodeIterator.next();
- if (o instanceof CMElementDeclaration) {
- CMElementDeclaration elementDecl = (CMElementDeclaration) o;
- // only add proposals for the child element's that
- // begin with the matchstring
- String tagname = getRequiredName(parent, elementDecl);
- boolean isStrictCMNodeSuggestion = strictCMNodeSuggestions != null ? strictCMNodeSuggestions.contains(elementDecl) : false;
-
- Image image = CMImageUtil.getImage(elementDecl);
-
- if (image == null) {
- if (strictCMNodeSuggestions != null) {
- image = isStrictCMNodeSuggestion ?
- XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC_EMPHASIZED) :
- XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC_DEEMPHASIZED);
- }
- else {
- image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
- }
-
- }
- // Account for the < and >. If attributes were
- // added, the cursor will be placed
- // at the offset before of the first character of the
- // first attribute name.
-// int markupAdjustment = getContentGenerator().getMinimalStartTagLength(parent, elementDecl);
- if (beginsWith(tagname, matchString)) {
- String proposedText = getRequiredText(parent, elementDecl);
-
- int markupAdjustment = getCursorPositionForProposedText(proposedText);
-
- String proposedInfo = getAdditionalInfo(parentDecl, elementDecl);
- int relevance = isStrictCMNodeSuggestion ? XMLRelevanceConstants.R_STRICTLY_VALID_TAG_INSERTION : XMLRelevanceConstants.R_TAG_INSERTION;
- CustomCompletionProposal proposal = new RedHatCustomCompletionProposal(true, proposedText, contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), markupAdjustment, image, tagname, null, proposedInfo, relevance);
- contentAssistRequest.addProposal(proposal);
- }
- }
- }
- if (contentAssistRequest.getProposals().size() == 0) {
- if (error != null)
- setErrorMessage(error);
- else if (contentAssistRequest.getMatchString() != null && contentAssistRequest.getMatchString().length() > 0)
- setErrorMessage(NLS.bind(XMLUIMessages.No_known_child_tag, (new Object[]{parent.getNodeName(), contentAssistRequest.getMatchString()})));
- //$NON-NLS-1$ = "No known child tag names of <{0}> begin with \"{1}\"."
- else
- setErrorMessage(NLS.bind(XMLUIMessages.__Has_no_known_child, (new Object[]{parent.getNodeName()})));
- }
- }
- }
- else if (parent.getNodeType() == Node.DOCUMENT_NODE) {
- // Can only prompt with elements if the cursor position is past
- // the XML processing
- // instruction and DOCTYPE declaration
- boolean xmlpiFound = false;
- boolean doctypeFound = false;
- int minimumOffset = -1;
-
- for (Node child = parent.getFirstChild(); child != null; child = child.getNextSibling()) {
-
- boolean xmlpi = (child.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE && child.getNodeName().equals("xml")); //$NON-NLS-1$
- boolean doctype = child.getNodeType() == Node.DOCUMENT_TYPE_NODE;
- if (xmlpi || doctype && minimumOffset < 0)
- minimumOffset = ((IDOMNode) child).getFirstStructuredDocumentRegion().getStartOffset() + ((IDOMNode) child).getFirstStructuredDocumentRegion().getTextLength();
- xmlpiFound = xmlpiFound || xmlpi;
- doctypeFound = doctypeFound || doctype;
- }
-
- if (contentAssistRequest.getReplacementBeginPosition() >= minimumOffset) {
- List childDecls = getAvailableRootChildren((Document) parent, childPosition);
- for (int i = 0; i < childDecls.size(); i++) {
- CMElementDeclaration ed = (CMElementDeclaration) childDecls.get(i);
- if (ed != null) {
- Image image = CMImageUtil.getImage(ed);
- if (image == null) {
- image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
- }
- String proposedText = getRequiredText(parent, ed);
- String tagname = getRequiredName(parent, ed);
- // account for the < and >
- int markupAdjustment = getContentGenerator().getMinimalStartTagLength(parent, ed);
- String proposedInfo = getAdditionalInfo(null, ed);
- CustomCompletionProposal proposal = new RedHatCustomCompletionProposal(false, proposedText, contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), markupAdjustment, image, tagname, null, proposedInfo, XMLRelevanceConstants.R_TAG_INSERTION);
-
- contentAssistRequest.addProposal(proposal);
- }
- }
- }
- }
- }
-
- // WTP
- private int getCursorPositionForProposedText(String proposedText) {
- int cursorAdjustment;
- cursorAdjustment = proposedText.indexOf("\"\"") + 1; //$NON-NLS-1$
- // otherwise, after the first tag
- if(cursorAdjustment==0)
- cursorAdjustment = proposedText.indexOf('>') + 1;
- if(cursorAdjustment==0)
- cursorAdjustment = proposedText.length() + 1;
-
- return cursorAdjustment;
- }
-
- protected void addTagNameProposals(ContentAssistRequest contentAssistRequest, int childPosition) {
- List cmnodes = null;
- Node parent = contentAssistRequest.getParent();
- IDOMNode node = (IDOMNode) contentAssistRequest.getNode();
- String error = null;
- String matchString = contentAssistRequest.getMatchString();
- if (parent.getNodeType() == Node.ELEMENT_NODE) {
- // retrieve the list of children
- cmnodes = getAvailableChildElementDeclarations((Element)parent, childPosition, ModelQueryAction.INSERT);
- Iterator nodeIterator = cmnodes.iterator();
- // chop off any leading <'s and whitespace from the matchstring
- while ((matchString.length() > 0) && (Character.isWhitespace(matchString.charAt(0)) || beginsWith(matchString, "<"))) //$NON-NLS-1$
- //$NON-NLS-1$
- matchString = matchString.substring(1);
- if (!nodeIterator.hasNext())
- error = NLS.bind(XMLUIMessages.__Has_no_known_child, (new Object[]{parent.getNodeName()}));
- while (nodeIterator.hasNext()) {
- CMNode elementDecl = (CMNode) nodeIterator.next();
- if (elementDecl != null) {
- // only add proposals for the child element's that begin
- // with the matchstring
- String proposedText = null;
- int cursorAdjustment = 0;
-
- // do a check to see if partial attributes of partial tag
- // names are in list
- if ((node != null && node.getAttributes() != null && node.getAttributes().getLength() > 0 && attributeInList(node, parent, elementDecl)) || ((node.getNodeType() != Node.TEXT_NODE) && node.getFirstStructuredDocumentRegion().isEnded())) {
-
- proposedText = getRequiredName(parent, elementDecl);
- cursorAdjustment = proposedText.length();
- }
- else {
- proposedText = getRequiredName(parent, elementDecl);
-
- StringBuffer buffer = new StringBuffer();
- KbProposal proposal;
- TagDescriptor info;
- try {
- proposal = getWtpKbConnector().getProposal("/" + proposedText);
- info = getWtpKbConnector().getTagInformation("/" + proposedText + "/");
- if (proposal != null && info != null) {
- String replString = proposal.getReplacementString();
- boolean hasBody = info.hasBody();
-
- if (replString != null && replString.length() > 0) {
- if(!dontOpenTag) {
- buffer.append("<");
- }
- buffer.append(replString);
- buffer.append(">");
- if (hasBody) {
- buffer.append("</");
- buffer.append(proposedText);
- buffer.append(">");
- }
- proposedText = buffer.toString();
- }
- } else {
- if(elementDecl instanceof CMElementDeclaration) {
- cursorAdjustment = proposedText.length();
- if (elementDecl instanceof CMElementDeclaration) {
- CMElementDeclaration ed = (CMElementDeclaration) elementDecl;
- if (ed.getContentType() == CMElementDeclaration.EMPTY) {
- proposedText += getContentGenerator().getStartTagClose(parent, ed);
- cursorAdjustment = proposedText.length();
- }
- else {
- cursorAdjustment = proposedText.length() + 1;
- proposedText += "></" + getRequiredName(parent, elementDecl) + ">"; //$NON-NLS-2$//$NON-NLS-1$
- }
- }
- }
- }
- } catch (KbException e) {
- JspEditorPlugin.getPluginLog().logError(e);
- }
- }
- if (beginsWith(proposedText, matchString) || beginsWith(proposedText, "<" + matchString)) {
- Image image = CMImageUtil.getImage(elementDecl);
- if (image == null) {
- image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
- }
- String proposedInfo = getAdditionalInfo(getCMElementDeclaration(parent), elementDecl);
- CustomCompletionProposal proposal = new RedHatCustomCompletionProposal(proposedText.indexOf('\"')>-1 && proposedText.indexOf("=")>-1, proposedText, contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), cursorAdjustment, image, getRequiredName(parent, elementDecl), null, proposedInfo, XMLRelevanceConstants.R_TAG_NAME);
- contentAssistRequest.addProposal(proposal);
- }
- }
- }
- if (contentAssistRequest.getProposals().size() == 0) {
- if (error != null)
- setErrorMessage(error);
- else if (contentAssistRequest.getMatchString() != null && contentAssistRequest.getMatchString().length() > 0)
- setErrorMessage(NLS.bind(XMLUIMessages.No_known_child_tag_names, (new Object[]{parent.getNodeName(), contentAssistRequest.getMatchString()})));
- //$NON-NLS-1$ = "No known child tag names of <{0}> begin with \"{1}\""
- else
- setErrorMessage(NLS.bind(XMLUIMessages.__Has_no_known_child, (new Object[]{parent.getNodeName()})));
- }
- }
- else if (parent.getNodeType() == Node.DOCUMENT_NODE) {
- List childElements = getAvailableRootChildren((Document) parent, childPosition);
- for (int i = 0; i < childElements.size(); i++) {
- CMNode ed = (CMNode) childElements.get(i);
- if (ed == null)
- continue;
- String proposedText = null;
- int cursorAdjustment = 0;
- if(ed instanceof CMElementDeclaration) {
- // proposedText = getRequiredName(parent, ed);
- StringBuffer sb = new StringBuffer();
- getContentGenerator().generateTag(parent, (CMElementDeclaration)ed, sb);
- // tag starts w/ '<', but we want to compare to name
- proposedText = sb.toString().substring(1);
-
- if (!beginsWith(proposedText, matchString))
- continue;
-
- cursorAdjustment = getCursorPositionForProposedText(proposedText);
-
- if (ed instanceof CMElementDeclaration) {
- CMElementDeclaration elementDecl = (CMElementDeclaration) ed;
- if (elementDecl.getContentType() == CMElementDeclaration.EMPTY) {
- proposedText += getContentGenerator().getStartTagClose(parent, elementDecl);
- cursorAdjustment = proposedText.length();
- }
- }
-
- String proposedInfo = getAdditionalInfo(null, ed);
- Image image = CMImageUtil.getImage(ed);
- if (image == null) {
- image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
- }
- CustomCompletionProposal proposal = new RedHatCustomCompletionProposal(proposedText.indexOf('\"')>-1, proposedText, contentAssistRequest.getReplacementBeginPosition(), contentAssistRequest.getReplacementLength(), cursorAdjustment, image, getRequiredName(parent, ed), null, proposedInfo, XMLRelevanceConstants.R_TAG_NAME);
- contentAssistRequest.addProposal(proposal);
- contentAssistRequest.addProposal(proposal);
- }
- }
- }
- }
-
- private boolean isCommentNode(IDOMNode node) {
- return (node != null && node instanceof IDOMElement && ((IDOMElement) node).isCommentTag());
- }
-
- protected void addAttributeNameProposals(ContentAssistRequest contentAssistRequest) {
-
- // JBIDE-1717 Workaround:
- // The WTP processes the Attribute Containers in a different way comparing to how it does for
- // the simple attributes.
- // Also the whitespace-text placed after the attribute value is the part of that attribute value.
- // These facts both are the reason of the JBIDE-1717 issue appeared.
- // This workaround tries to add the attribute name proposals in case of WTP itself doesn't adds them
- // because it faced the attribute container (In other words, some JSF-variable is used as the
- // attribute's value
- if (fViewer != null) {
- int documentPosition = contentAssistRequest.getReplacementBeginPosition();
- // check the actual partition type
- String partitionType = getPartitionType((StructuredTextViewer) fViewer, documentPosition);
-
- IStructuredDocument structuredDocument = (IStructuredDocument) fViewer.getDocument();
- IStructuredDocumentRegion fn = structuredDocument.getRegionAtCharacterOffset(documentPosition);
- // check if it's in an attribute value, if so, don't add CDATA
- // proposal
- ITextRegion attrContainer = (fn != null) ? fn.getRegionAtCharacterOffset(documentPosition) : null;
- boolean doPerformProposalsComputing = false;
-
- if (attrContainer != null && attrContainer instanceof ITextRegionContainer) {
- if (attrContainer.getType() == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE) {
- // test location of the cursor
- // return null if it's in the middle of an open/close
- // delimeter
- Iterator attrRegions = ((ITextRegionContainer) attrContainer).getRegions().iterator();
- ITextRegion testRegion = null;
- while (attrRegions.hasNext()) {
- testRegion = (ITextRegion) attrRegions.next();
- // need to check for other valid attribute regions
- if (XMLContentAssistUtilities.isJSPOpenDelimiter(testRegion.getType())) {
- if (!(((ITextRegionContainer) attrContainer).getEndOffset(testRegion) <= documentPosition))
- break;
- }
- else if (XMLContentAssistUtilities.isJSPCloseDelimiter(testRegion.getType())) {
- if (!(((ITextRegionContainer) attrContainer).getStartOffset(testRegion) >= documentPosition))
- break;
- }
- }
- if (!(testRegion.getType().equals(DOMJSPRegionContexts.JSP_CONTENT)))
- doPerformProposalsComputing = true;
- }
- }
- //
-
- if (doPerformProposalsComputing) {
- ICompletionProposal[] embeddedResults = null;
- IContentAssistProcessor p = (IContentAssistProcessor) fPartitionToProcessorMap.get(partitionType);
- if (p != null) {
- embeddedResults = p.computeCompletionProposals(fViewer, documentPosition);
- // TODO: Probably it's needed to get bean methods, objects, and constants if there are any...
- // as it's done in JSPContentAssistProcessor but...
- }
- else {
- // the partition type is probably not mapped
- }
- for (int i = 0; embeddedResults != null && i < embeddedResults.length; i++)
- contentAssistRequest.addProposal(embeddedResults[i]);
- }
- }
- super.addAttributeNameProposals(contentAssistRequest);
- }
-
- protected void addAttributeValueProposals(ContentAssistRequest contentAssistRequest) {
- // JBIDE-1704:
- // Check the position in the value:
- // The following position:
- // <nodeName attrName="attrValue"| .../>
- // is marked as attribute value, but the value itself is complete.
- // There are no proposals to be correct at this position.
-
- String text = contentAssistRequest.getText();
- String matchString = contentAssistRequest.getMatchString();
-
- if (matchString.length() > StringUtils.strip(text).length() &&
- ( (matchString.startsWith("\"") && matchString.endsWith("\"") &&
- (matchString.indexOf("\"") != matchString.lastIndexOf("\"")))
- || (matchString.startsWith("'") && matchString.endsWith("\"") &&
- (matchString.indexOf("\"") != matchString.lastIndexOf("\""))))) {
- return;
- }
-
- super.addAttributeValueProposals(contentAssistRequest);
- }
-
- /**
- * StructuredTextViewer must be set before using this.
- */
- public IStructuredDocumentRegion getStructuredDocumentRegion(int pos) {
- IStructuredDocumentRegion sdRegion = ContentAssistUtils.getStructuredDocumentRegion(fTextViewer, pos);
- ITextRegion region = (sdRegion == null ? null : sdRegion.getRegionAtCharacterOffset(pos));
- if (region == null) {
- return null;
- }
-
- if (region.getType() == DOMRegionContext.XML_TAG_OPEN &&
- sdRegion.getStartOffset(region) == pos) {
- // The offset is at the beginning of the region
- if ((sdRegion.getStartOffset(region) == sdRegion.getStartOffset()) && (sdRegion.getPrevious() != null) && (!sdRegion.getPrevious().isEnded())) {
- // Is the region also the start of the node? If so, the
- // previous IStructuredDocumentRegion is
- // where to look for a useful region.
- sdRegion = sdRegion.getPrevious();
- }
- else {
- // Is there no separating whitespace from the previous region?
- // If not,
- // then that region is the important one
- ITextRegion previousRegion = sdRegion.getRegionAtCharacterOffset(pos - 1);
- if ((previousRegion != null) && (previousRegion != region) && (previousRegion.getTextLength() == previousRegion.getLength())) {
- sdRegion = sdRegion.getPrevious();
- }
- }
- }
-
- return sdRegion;
- }
-
-}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -104,8 +104,8 @@
import org.jboss.tools.common.text.xml.IOccurrencePreferenceProvider;
import org.jboss.tools.common.text.xml.XmlEditorPlugin;
import org.jboss.tools.common.text.xml.ui.FreeCaretStyledText;
-import org.jboss.tools.jst.jsp.ExtendedStructuredTextViewerConfigurationHTML;
-import org.jboss.tools.jst.jsp.ExtendedStructuredTextViewerConfigurationJSP;
+import org.jboss.tools.jst.jsp.HTMLTextViewerConfiguration;
+import org.jboss.tools.jst.jsp.JSPTextViewerConfiguration;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.editor.IJSPTextEditor;
import org.jboss.tools.jst.jsp.editor.ITextFormatter;
@@ -153,20 +153,20 @@
dnd.setTextEditorDropProvider(new TextEditorDropProviderImpl());
this.parentEditor = parentEditor;
super
- .setSourceViewerConfiguration(new ExtendedStructuredTextViewerConfigurationJSP());
+ .setSourceViewerConfiguration(new JSPTextViewerConfiguration());
}
protected void setSourceViewerConfiguration(SourceViewerConfiguration config) {
if (config instanceof StructuredTextViewerConfigurationJSP) {
- if (!(config instanceof ExtendedStructuredTextViewerConfigurationJSP)) {
- config = new ExtendedStructuredTextViewerConfigurationJSP();
+ if (!(config instanceof JSPTextViewerConfiguration)) {
+ config = new JSPTextViewerConfiguration();
}
} else if (config instanceof StructuredTextViewerConfigurationHTML) {
- if (!(config instanceof ExtendedStructuredTextViewerConfigurationHTML)) {
- config = new ExtendedStructuredTextViewerConfigurationHTML();
+ if (!(config instanceof HTMLTextViewerConfiguration)) {
+ config = new HTMLTextViewerConfiguration();
}
} else {
- config = new ExtendedStructuredTextViewerConfigurationJSP();
+ config = new JSPTextViewerConfiguration();
}
super.setSourceViewerConfiguration(config);
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPDialogCellEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPDialogCellEditor.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPDialogCellEditor.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -24,7 +24,7 @@
import org.eclipse.ui.contentassist.ContentAssistHandler;
import org.jboss.tools.common.meta.key.WizardKeys;
import org.jboss.tools.jst.jsp.contentassist.JSPDialogCellEditorContentAssistProcessor;
-import org.jboss.tools.jst.jsp.contentassist.RedHatHtmlContentAssistProcessor;
+import org.jboss.tools.jst.jsp.contentassist.FaceletsHtmlContentAssistProcessor;
import org.jboss.tools.jst.jsp.drop.treeviewer.model.RootElement;
/**
@@ -66,7 +66,7 @@
String nodeName = "" + context.getProperty("nodeName");
String query = "/";
if(valueHelper.isFacetets() && nodeName.indexOf(':') < 0) {
- query += RedHatHtmlContentAssistProcessor.faceletHtmlPrefixStart;
+ query += FaceletsHtmlContentAssistProcessor.faceletHtmlPrefixStart;
}
query += nodeName + "@" + attributeName;
RootElement root = (RootElement)valueHelper.getInitalInput(query);
@@ -89,7 +89,7 @@
String nodeName = "" + context.getProperty("nodeName");
String query = "/";
if(valueHelper != null && valueHelper.isFacetets() && nodeName.indexOf(":") < 0) {
- query += RedHatHtmlContentAssistProcessor.faceletHtmlPrefixStart;
+ query += FaceletsHtmlContentAssistProcessor.faceletHtmlPrefixStart;
}
query += nodeName + "@" + attributeName;
context.setProperty("query", query);
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -36,7 +36,7 @@
import org.eclipse.wst.xml.ui.internal.XMLUIMessages;
import org.eclipse.wst.xml.ui.internal.properties.EnumeratedStringPropertyDescriptor;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.contentassist.RedHatHtmlContentAssistProcessor;
+import org.jboss.tools.jst.jsp.contentassist.FaceletsHtmlContentAssistProcessor;
import org.jboss.tools.jst.jsp.editor.IVisualController;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
@@ -126,8 +126,8 @@
jsfTagName = valueHelper.getFaceletJsfTag((Element)fNode);
}
if(jsfTagName != null) tagName = jsfTagName;
- if(jsfTagName == null && valueHelper.isFacetets() && tagName.indexOf(':') < 0 && !RedHatHtmlContentAssistProcessor.JSFCAttributeName.equals(attributeName)) {
- tagName = RedHatHtmlContentAssistProcessor.faceletHtmlPrefixStart + tagName;
+ if(jsfTagName == null && valueHelper.isFacetets() && tagName.indexOf(':') < 0 && !FaceletsHtmlContentAssistProcessor.JSFCAttributeName.equals(attributeName)) {
+ tagName = FaceletsHtmlContentAssistProcessor.faceletHtmlPrefixStart + tagName;
}
return "/" + tagName + "@" + attributeName;
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -46,7 +46,7 @@
import org.jboss.tools.common.model.ui.ModelUIPlugin;
import org.jboss.tools.common.model.util.ModelFeatureFactory;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.contentassist.RedHatHtmlContentAssistProcessor;
+import org.jboss.tools.jst.jsp.contentassist.FaceletsHtmlContentAssistProcessor;
import org.jboss.tools.jst.jsp.drop.treeviewer.model.AttributeValueResource;
import org.jboss.tools.jst.jsp.drop.treeviewer.model.AttributeValueResourceFactory;
import org.jboss.tools.jst.jsp.drop.treeviewer.model.ModelElement;
@@ -325,11 +325,11 @@
kbConnector.unregisterAllResources(true);
for(int i = 0; i < list.size(); i++) {
TaglibData data = list.get(i);
- RedHatHtmlContentAssistProcessor.registerTld(data, kbConnector, document, editorInput);
- isFacelets = isFacelets || data.getUri().equals(RedHatHtmlContentAssistProcessor.faceletUri);
+ FaceletsHtmlContentAssistProcessor.registerTld(data, kbConnector, document, editorInput);
+ isFacelets = isFacelets || data.getUri().equals(FaceletsHtmlContentAssistProcessor.faceletUri);
}
if(isFacelets) {
- kbConnector.registerResource(RedHatHtmlContentAssistProcessor.faceletHtmlResource);
+ kbConnector.registerResource(FaceletsHtmlContentAssistProcessor.faceletHtmlResource);
kbConnector.unregisterJspResource();
}
}
@@ -340,7 +340,7 @@
if(name.indexOf(':') >= 0) return null;
NamedNodeMap attributes = element.getAttributes();
- Node jsfC = attributes.getNamedItem(RedHatHtmlContentAssistProcessor.JSFCAttributeName);
+ Node jsfC = attributes.getNamedItem(FaceletsHtmlContentAssistProcessor.JSFCAttributeName);
if(jsfC != null && (jsfC instanceof Attr)) {
Attr jsfCAttribute = (Attr)jsfC;
String jsfTagName = jsfCAttribute.getValue();
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/FaceletsJsfCResource.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/FaceletsJsfCResource.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/support/kb/FaceletsJsfCResource.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -16,7 +16,7 @@
import java.util.Iterator;
import org.jboss.tools.common.reporting.ProblemReportingHelper;
-import org.jboss.tools.jst.jsp.contentassist.RedHatHtmlContentAssistProcessor;
+import org.jboss.tools.jst.jsp.contentassist.FaceletsHtmlContentAssistProcessor;
import org.jboss.tools.common.kb.KbDinamicResource;
import org.jboss.tools.common.kb.KbException;
import org.jboss.tools.common.kb.KbProposal;
@@ -90,7 +90,7 @@
}
private boolean ignoreProposal(KbProposal proposal) {
- return proposal.getLabel().startsWith(RedHatHtmlContentAssistProcessor.faceletHtmlPrefixStart) || proposal.getLabel().indexOf(':')<0;
+ return proposal.getLabel().startsWith(FaceletsHtmlContentAssistProcessor.faceletHtmlPrefixStart) || proposal.getLabel().indexOf(':')<0;
}
/**
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1704Test.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1704Test.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1704Test.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -20,8 +20,8 @@
import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
import org.jboss.tools.common.test.util.TestProjectProvider;
-import org.jboss.tools.jst.jsp.contentassist.RedHatCustomCompletionProposal;
-import org.jboss.tools.jst.jsp.contentassist.RedHatJSPContentAssistProcessor;
+import org.jboss.tools.jst.jsp.contentassist.AutoContentAssistantProposal;
+import org.jboss.tools.jst.jsp.contentassist.ExtendedJSPContentAssistProcessor;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor;
import org.jboss.tools.jst.jsp.test.TestUtil;
@@ -169,7 +169,7 @@
for (int k = 0; result != null && k < result.length; k++) {
// There should not be a proposal of type Red.Proposal in the result
- assertFalse("Content Assistant peturned proposals of type (" + result[k].getClass().getName() + ").", (result[k] instanceof RedHatCustomCompletionProposal));
+ assertFalse("Content Assistant peturned proposals of type (" + result[k].getClass().getName() + ").", (result[k] instanceof AutoContentAssistantProposal));
}
}
}
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1717Test.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1717Test.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JsfJspJbide1717Test.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -17,7 +17,7 @@
import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.eclipse.wst.sse.ui.internal.contentassist.CustomCompletionProposal;
import org.jboss.tools.common.test.util.TestProjectProvider;
-import org.jboss.tools.jst.jsp.contentassist.RedHatCustomCompletionProposal;
+import org.jboss.tools.jst.jsp.contentassist.AutoContentAssistantProposal;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor;
import org.jboss.tools.jst.jsp.test.TestUtil;
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1585Test.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1585Test.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1585Test.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -24,7 +24,7 @@
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.jboss.tools.common.test.util.TestProjectProvider;
-import org.jboss.tools.jst.jsp.contentassist.RedHatCustomCompletionProposal;
+import org.jboss.tools.jst.jsp.contentassist.AutoContentAssistantProposal;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor;
import org.jboss.tools.jst.jsp.test.TestUtil;
@@ -147,8 +147,8 @@
assertTrue("Content Assistant peturned no proposals", (result != null && result.length > 0));
for (int i = 0; i < result.length; i++) {
- assertTrue("Content Assistant peturned proposals which type (" + result[i].getClass().getName() + ") differs from RedHatCustomCompletionProposal", (result[i] instanceof RedHatCustomCompletionProposal));
- RedHatCustomCompletionProposal proposal = (RedHatCustomCompletionProposal)result[i];
+ assertTrue("Content Assistant peturned proposals which type (" + result[i].getClass().getName() + ") differs from RedHatCustomCompletionProposal", (result[i] instanceof AutoContentAssistantProposal));
+ AutoContentAssistantProposal proposal = (AutoContentAssistantProposal)result[i];
String proposalString = proposal.getReplacementString();
int proposalReplacementOffset = proposal.getReplacementOffset();
int proposalReplacementLength = proposal.getReplacementLength();
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1641Test.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1641Test.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/JstJspJbide1641Test.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -15,7 +15,7 @@
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.jboss.tools.common.test.util.TestProjectProvider;
-import org.jboss.tools.jst.jsp.contentassist.RedHatCustomCompletionProposal;
+import org.jboss.tools.jst.jsp.contentassist.AutoContentAssistantProposal;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor;
import org.jboss.tools.jst.jsp.test.TestUtil;
@@ -144,9 +144,9 @@
boolean bPropoosalToApplyFound = false;
for (int i = 0; i < result.length; i++) {
- if (!(result[i] instanceof RedHatCustomCompletionProposal))
+ if (!(result[i] instanceof AutoContentAssistantProposal))
continue;
- RedHatCustomCompletionProposal proposal = (RedHatCustomCompletionProposal)result[i];
+ AutoContentAssistantProposal proposal = (AutoContentAssistantProposal)result[i];
String proposalString = proposal.getReplacementString();
// try {
// System.out.println("Result#" + i + " ==> Offs: " + offsetToTest + " RedHatCustomCompletionProposal[" + proposalString + "], Offs: " + proposalReplacementOffset + ", Len: " + proposalReplacementLength + ", Doc: [" + document.get(proposalReplacementOffset, proposalReplacementLength));
Modified: trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/StrutsJspJbide1648Test.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/StrutsJspJbide1648Test.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/jst/tests/org.jboss.tools.jst.jsp.test/src/org/jboss/tools/jst/jsp/test/ca/StrutsJspJbide1648Test.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -14,7 +14,7 @@
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.wst.sse.ui.internal.StructuredTextViewer;
import org.jboss.tools.common.test.util.TestProjectProvider;
-import org.jboss.tools.jst.jsp.contentassist.RedHatCustomCompletionProposal;
+import org.jboss.tools.jst.jsp.contentassist.AutoContentAssistantProposal;
import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor;
import org.jboss.tools.jst.jsp.test.TestUtil;
Modified: trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
===================================================================
--- trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java 2008-02-15 10:36:08 UTC (rev 6329)
+++ trunk/tests/tests/org.jboss.tools.test/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java 2008-02-15 10:41:43 UTC (rev 6330)
@@ -27,9 +27,8 @@
*
*/
public AbstractResourceMarkerTest() {
- // TODO Auto-generated constructor stub
}
-
+
/**
*
*/
@@ -53,11 +52,11 @@
return number;
}
-
+
protected void assertMarkerIsCreated(IFile file, MarkerData markerData) throws CoreException {
assertMarkerIsCreated(file, markerData.type, markerData.pattern, markerData.line);
}
-
+
protected void assertMarkerIsCreated(IFile file, String type, String pattern, int expectedLine)
throws CoreException {
@@ -70,20 +69,20 @@
assertEquals("Marker matches the '" + pattern + "' pattern was found at wrong line",
expectedLine,line);
}
-
+
protected void assertMarkersIsCreated(IFile file, MarkerData[] markersData) throws CoreException {
for (MarkerData markerData : markersData) {
assertMarkerIsCreated(file, markerData);
}
}
-
+
/**
*
* @author eskimo
*
*/
public static class MarkerData {
-
+
private String type;
private String pattern;
private int line = -1;
@@ -93,7 +92,7 @@
this.pattern = pattern;
this.line = line;
}
-
+
public int getLine() {
return line;
}
@@ -117,7 +116,5 @@
public void setPattern(String pattern) {
this.pattern = pattern;
}
-
}
-
-}
+}
\ No newline at end of file
16 years, 7 months
JBoss Tools SVN: r6329 - in trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test: src/org/jboss/tools/jsf/vpe/jsf/test/jbide and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2008-02-15 05:36:08 -0500 (Fri, 15 Feb 2008)
New Revision: 6329
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/TestChangeUriInInnerNodes.xhtml
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-788
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/TestChangeUriInInnerNodes.xhtml
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/TestChangeUriInInnerNodes.xhtml 2008-02-15 10:30:55 UTC (rev 6328)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/resources/jsfTest/WebContent/pages/JBIDE/788/TestChangeUriInInnerNodes.xhtml 2008-02-15 10:36:08 UTC (rev 6329)
@@ -1,15 +1,21 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:rich="http://richfaces.org/rich"
- xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:a4j="http://richfaces.org/a4j">
<head>
XHTML TEST Page
</head>
<body>
<s:button value="Submit"></s:button>
+
<div xmlns:rich="http://jboss.com/products/seam/taglib">
<rich:button value="Submit"></rich:button>
+
</div>
-</body>
+
+<div xmlns:c="http://java.sun.com/jsp/jstl/core">
+
+</div>
+</body>
</html>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java 2008-02-15 10:30:55 UTC (rev 6328)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE788Test.java 2008-02-15 10:36:08 UTC (rev 6329)
@@ -40,6 +40,27 @@
super(name);
}
/**
+ * Tests inner nodes include URI
+ * @throws Throwable
+ */
+ public void testCAforIncludeTaglibInInenerNodes() throws Throwable {
+ // wait
+ TestUtil.waitForJobs();
+ // set exception
+ setException(null);
+ //Tests CA
+
+ baseCheckofCA(CA_NAME, "JBIDE/788/TestChangeUriInInnerNodes.xhtml", 395, 185);
+ baseCheckofCA(CA_NAME, "JBIDE/788/TestChangeUriInInnerNodes.xhtml", 503, 125);
+ baseCheckofCA(CA_NAME, "JBIDE/788/TestChangeUriInInnerNodes.xhtml", 567, 199);
+ // check exception
+ if (getException() != null) {
+
+ throw getException();
+ }
+ }
+
+ /**
* Tests CA for Messages Bundles and EL Values
* @throws Throwable
*/
16 years, 7 months
JBoss Tools SVN: r6328 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2008-02-15 05:30:55 -0500 (Fri, 15 Feb 2008)
New Revision: 6328
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesRecursiveTreeNodesAdaptorTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1460
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesRecursiveTreeNodesAdaptorTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesRecursiveTreeNodesAdaptorTemplate.java 2008-02-15 10:09:18 UTC (rev 6327)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesRecursiveTreeNodesAdaptorTemplate.java 2008-02-15 10:30:55 UTC (rev 6328)
@@ -14,11 +14,11 @@
import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
import org.jboss.tools.jsf.vpe.richfaces.RichFacesTemplatesActivator;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -30,7 +30,7 @@
*
*/
public class RichFacesRecursiveTreeNodesAdaptorTemplate extends
- VpeAbstractTemplate {
+ RichFacesTreeNodeTemplate {
private static final String TREE_NAME = "tree";
@@ -48,29 +48,37 @@
public static final String ID_ATTR_NAME = "ID";
+ public static final String NODES_NAME = "nodes";
+
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
- ComponentUtil.setCSSLink(pageContext, STYLE_PATH, "treeNodesAdaptor");
- nsIDOMElement visualElement = visualDocument
- .createElement(HtmlComponentUtil.HTML_TAG_DIV);
- visualElement.setAttribute(ID_ATTR_NAME, TREE_NODES_ADAPTOR_NAME);
- if (isHasParentAdapter(sourceNode)) {
- visualElement.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
- "dr-tree-h-ic-div");
- if (getShowLinesAttr(sourceNode)
- && (isAdapterBetweenNodes(sourceNode) || isHasNextParentAdaptorElement(sourceNode))) {
- String path = RichFacesTemplatesActivator
- .getPluginResourcePath()
- + ICON_DIV_LINE;
- visualElement.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR,
- "background-image: url(file://" + path + "); "
- + ADAPTER_LINES_STYLE);
+ if (isEmptyNode(sourceNode)) {
+ return super.create(pageContext, sourceNode, visualDocument);
+ } else {
+ ComponentUtil.setCSSLink(pageContext, STYLE_PATH,
+ "treeNodesAdaptor");
+ nsIDOMElement visualElement = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+ visualElement.setAttribute(ID_ATTR_NAME, TREE_NODES_ADAPTOR_NAME);
+ if (isHasParentAdapter(sourceNode)) {
+ visualElement.setAttribute(HtmlComponentUtil.HTML_CLASS_ATTR,
+ "dr-tree-h-ic-div");
+ if (getShowLinesAttr(sourceNode)
+ && (isAdapterBetweenNodes(sourceNode) || isHasNextParentAdaptorElement(sourceNode))) {
+ String path = RichFacesTemplatesActivator
+ .getPluginResourcePath()
+ + ICON_DIV_LINE;
+ visualElement.setAttribute(
+ HtmlComponentUtil.HTML_STYLE_ATTR,
+ "background-image: url(file://" + path + "); "
+ + ADAPTER_LINES_STYLE);
+ }
}
+ VpeCreationData vpeCreationData = new VpeCreationData(visualElement);
+ parseTree(pageContext, sourceNode, visualDocument, vpeCreationData,
+ visualElement);
+ return vpeCreationData;
}
- VpeCreationData vpeCreationData = new VpeCreationData(visualElement);
- parseTree(pageContext, sourceNode, visualDocument, vpeCreationData,
- visualElement);
- return vpeCreationData;
}
/**
@@ -243,4 +251,29 @@
return false;
}
+ /**
+ *
+ * @param sourceElement
+ * @return
+ */
+ private boolean isEmptyNode(Node sourceNode) {
+
+ NodeList childs = sourceNode.getChildNodes();
+ for (int i = 0; i < childs.getLength(); i++) {
+ Node el = childs.item(i);
+ if (!(el instanceof Element)) {
+ continue;
+ }
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public void setPseudoContent(VpePageContext pageContext,
+ Node sourceContainer, nsIDOMNode visualContainer,
+ nsIDOMDocument visualDocument) {
+ // Empty
+ }
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java 2008-02-15 10:09:18 UTC (rev 6327)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesTreeNodeTemplate.java 2008-02-15 10:30:55 UTC (rev 6328)
@@ -23,6 +23,7 @@
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMNodeList;
+import org.mozilla.interfaces.nsIDOMText;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -216,11 +217,8 @@
Node sourceNode, VpeCreationData vpeCreationData) {
// creates icon node
String backgroundLinePath = null;
- if (RichFacesTemplatesActivator.getDefault().isDebugging()) {
- System.out.println("call createBasicTree");
- }
+
boolean showLinesValue = getShowLinesAttr((Element) sourceNode);
-
nsIDOMElement iconNode = visualDocument
.createElement(HtmlComponentUtil.HTML_TAG_TD);
// creates icon with status of node(collapsed or not) node
@@ -331,15 +329,29 @@
.createElement(HtmlComponentUtil.HTML_TAG_TD);
addBasicNodeTitleAttributes(nodeTitle);
// Create mapping to Encode body
- VpeChildrenInfo tdInfo = new VpeChildrenInfo(nodeTitle);
+ String treeRecursiveNodesAdaptorName = sourceNode.getPrefix() + ":"
+ + RichFacesTreeTemplate.TREE_RECURSIVE_NODES_ADAPTOR;
+ if (sourceNode.getNodeName().equals(treeRecursiveNodesAdaptorName)) {
+ Element sourceElement = (Element) sourceNode;
+ String nodes = sourceElement
+ .getAttribute(RichFacesRecursiveTreeNodesAdaptorTemplate.NODES_NAME);
+ nsIDOMElement span = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_SPAN);
+ nsIDOMText text = visualDocument
+ .createTextNode((nodes == null) ? "" : nodes);
+ span.appendChild(text);
+ nodeTitle.appendChild(span);
+ } else {
+ VpeChildrenInfo tdInfo = new VpeChildrenInfo(nodeTitle);
- // Create mapping to Encode body
- List<Node> children = ComponentUtil.getChildren((Element) sourceNode,
- false);
- for (Node child : children) {
- tdInfo.addSourceChild(child);
+ // Create mapping to Encode body
+ List<Node> children = ComponentUtil.getChildren(
+ (Element) sourceNode, false);
+ for (Node child : children) {
+ tdInfo.addSourceChild(child);
+ }
+ vpeCreationData.addChildrenInfo(tdInfo);
}
- vpeCreationData.addChildrenInfo(tdInfo);
treeRow.appendChild(nodeTitle);
}
16 years, 7 months
JBoss Tools SVN: r6327 - in trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui: wizard and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2008-02-15 05:09:18 -0500 (Fri, 15 Feb 2008)
New Revision: 6327
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/actions/OpenSeamComponentAction.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/OpenSeamComponentDialog.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-518
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/actions/OpenSeamComponentAction.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/actions/OpenSeamComponentAction.java 2008-02-15 09:27:45 UTC (rev 6326)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/actions/OpenSeamComponentAction.java 2008-02-15 10:09:18 UTC (rev 6327)
@@ -25,12 +25,12 @@
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.SelectionDialog;
-import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamJavaComponentDeclaration;
import org.jboss.tools.seam.ui.SeamUIMessages;
import org.jboss.tools.seam.ui.wizard.OpenSeamComponentDialog;
+import org.jboss.tools.seam.ui.wizard.OpenSeamComponentDialog.SeamComponentWrapper;
/**
* @author Daniel Azarov
@@ -64,14 +64,14 @@
Object[] components= dialog.getResult();
if (components != null && components.length > 0) {
- ISeamComponent component= null;
+ SeamComponentWrapper wrapper= null;
for (int i= 0; i < components.length; i++) {
- component= (ISeamComponent) components[i];
- SeamJavaComponentDeclaration javaDeclaration = (SeamJavaComponentDeclaration)component.getJavaDeclaration();
+ wrapper= (SeamComponentWrapper) components[i];
+ SeamJavaComponentDeclaration javaDeclaration = (SeamJavaComponentDeclaration)wrapper.getComponent().getJavaDeclaration();
if(javaDeclaration != null){
javaDeclaration.open();
}else{
- Set<ISeamComponentDeclaration> declarations = component.getAllDeclarations();
+ Set<ISeamComponentDeclaration> declarations = wrapper.getComponent().getAllDeclarations();
if(declarations.iterator().hasNext()){
((SeamComponentDeclaration)declarations.iterator().next()).open();
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/OpenSeamComponentDialog.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/OpenSeamComponentDialog.java 2008-02-15 09:27:45 UTC (rev 6326)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/OpenSeamComponentDialog.java 2008-02-15 10:09:18 UTC (rev 6327)
@@ -37,7 +37,6 @@
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
-import org.jboss.tools.seam.internal.core.SeamComponent;
import org.jboss.tools.seam.ui.SeamGuiPlugin;
import org.jboss.tools.seam.ui.SeamUIMessages;
import org.jboss.tools.seam.ui.SeamUiImages;
@@ -48,21 +47,23 @@
*
*/
public class OpenSeamComponentDialog extends FilteredItemsSelectionDialog {
- private static final String fileName="OpenSeamComponentHistory.xml";
-
+ private static final String FILE_NAME = "OpenSeamComponentHistory.xml"; //$NON-NLS-1$
+ private static final String PROJECT_NAME = "ProjectName"; //$NON-NLS-1$
+ private static final String COMPONENT_NAME = "ComponentName"; //$NON-NLS-1$
+
public OpenSeamComponentDialog(Shell shell) {
super(shell);
-
+
setSelectionHistory(new SeamComponentSelectionHistory());
-
+
setListLabelProvider(new SeamComponentLabelProvider());
setDetailsLabelProvider(new SeamComponentLabelProvider());
-
+
XMLMemento memento = load();
- if(memento != null)
+ if (memento != null)
getSelectionHistory().load(memento);
}
-
+
protected Control createExtendedContentArea(Composite parent) {
return null;
}
@@ -70,43 +71,52 @@
protected ItemsFilter createFilter() {
return new SeamComponentFilter();
}
-
+
protected void fillContentProvider(AbstractContentProvider contentProvider,
ItemsFilter itemsFilter, IProgressMonitor progressMonitor)
throws CoreException {
-
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
-
- progressMonitor.beginTask(SeamUIMessages.OPEN_SEAM_COMPONENT_DIALOG_LOADING, projects.length);
-
- for(int i = 0; i < projects.length; i++){
+
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot()
+ .getProjects();
+
+ progressMonitor.beginTask(
+ SeamUIMessages.OPEN_SEAM_COMPONENT_DIALOG_LOADING,
+ projects.length);
+
+ for (int i = 0; i < projects.length; i++) {
IProject project = projects[i];
progressMonitor.subTask(project.getName());
-
- ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, true);
- if(seamProject != null){
- Iterator<ISeamComponent> iter = seamProject.getComponents().iterator();
- while(iter.hasNext()){
+
+ ISeamProject seamProject = SeamCorePlugin.getSeamProject(project,
+ true);
+ if (seamProject != null) {
+ Iterator<ISeamComponent> iter = seamProject.getComponents()
+ .iterator();
+ while (iter.hasNext()) {
ISeamComponent component = iter.next();
- if(SeamReferencedFilter.isComponentDeclaredInThisProject(component))
- contentProvider.add(component, itemsFilter);
+ if (SeamReferencedFilter
+ .isComponentDeclaredInThisProject(component))
+ contentProvider.add(new SeamComponentWrapper(component
+ .getName(), project.getName(), component),
+ itemsFilter);
}
}
progressMonitor.worked(1);
}
progressMonitor.done();
}
-
- public XMLMemento load() {
- XMLMemento memento=null;
- IPath stateLocation= SeamGuiPlugin.getDefault().getStateLocation().append(fileName);
- File file= new File(stateLocation.toOSString());
- if(file.exists()){
- FileReader reader= null;
+
+ private XMLMemento load() {
+ XMLMemento memento = null;
+ IPath stateLocation = SeamGuiPlugin.getDefault().getStateLocation()
+ .append(FILE_NAME);
+ File file = new File(stateLocation.toOSString());
+ if (file.exists()) {
+ FileReader reader = null;
try {
reader = new FileReader(file);
-
+
memento = XMLMemento.createReadRoot(reader);
reader.close();
} catch (Exception ex) {
@@ -117,47 +127,50 @@
}
protected IDialogSettings getDialogSettings() {
- return new DialogSettings(SeamUIMessages.OPEN_SEAM_COMPONENT_DIALOG_NAME);
+ return new DialogSettings(
+ SeamUIMessages.OPEN_SEAM_COMPONENT_DIALOG_NAME);
}
public String getElementName(Object item) {
- if(item instanceof ISeamComponent){
- ISeamComponent component = (ISeamComponent)item;
- return component.getName();
+ if (item instanceof SeamComponentWrapper) {
+ SeamComponentWrapper componentWrapper = (SeamComponentWrapper) item;
+ return componentWrapper.getComponentName();
}
return null;
}
- protected Comparator<SeamComponent> getItemsComparator() {
+ protected Comparator<SeamComponentWrapper> getItemsComparator() {
return new SeamComponentComparator();
}
protected IStatus validateItem(Object item) {
return new SeamComponentStatus();
}
-
- public class SeamComponentComparator implements Comparator<SeamComponent>{
- public int compare(SeamComponent left, SeamComponent right) {
- return left.getName().compareTo(right.getName());
+
+ public class SeamComponentComparator implements
+ Comparator<SeamComponentWrapper> {
+ public int compare(SeamComponentWrapper left, SeamComponentWrapper right) {
+ return left.getComponentName().compareTo(right.getComponentName());
}
-
+
}
-
- public class SeamComponentFilter extends ItemsFilter{
+
+ public class SeamComponentFilter extends ItemsFilter {
public boolean isConsistentItem(Object item) {
return true;
}
public boolean matchItem(Object item) {
- if(item instanceof ISeamComponent){
- ISeamComponent component = (ISeamComponent)item;
- return patternMatcher.matches(component.getName());
+ if (item instanceof SeamComponentWrapper) {
+ SeamComponentWrapper componentWrapper = (SeamComponentWrapper) item;
+ return patternMatcher.matches(componentWrapper
+ .getComponentName());
}
return false;
}
}
-
- public class SeamComponentStatus implements IStatus{
+
+ public class SeamComponentStatus implements IStatus {
public IStatus[] getChildren() {
return null;
}
@@ -187,78 +200,74 @@
}
public boolean isOK() {
- if(getSelectedItems().size() < 0) return false;
-
+ if (getSelectedItems().size() < 0)
+ return false;
+
return true;
}
public boolean matches(int severityMask) {
return false;
}
-
+
}
-
- public class SeamComponentSelectionHistory extends SelectionHistory{
-
- public SeamComponentSelectionHistory(){
+
+ public class SeamComponentSelectionHistory extends SelectionHistory {
+
+ public SeamComponentSelectionHistory() {
super();
}
-
+
protected Object restoreItemFromMemento(IMemento memento) {
- XMLMemento mem = (XMLMemento)memento;
- String projectName = mem.getString("ProjectName");
- if(projectName == null) return null;
- String componentName = mem.getString("ComponentName");
- if(componentName == null) return null;
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- if(project != null){
- ISeamProject seamProject = SeamCorePlugin.getSeamProject(project, true);
- if(seamProject != null){
- ISeamComponent component = seamProject.getComponent(componentName);
- return component;
- }
- }
- return null;
+ XMLMemento mem = (XMLMemento) memento;
+ String projectName = mem.getString(PROJECT_NAME);
+ if (projectName == null)
+ return null;
+ String componentName = mem.getString(COMPONENT_NAME);
+ if (componentName == null)
+ return null;
+ return new SeamComponentWrapper(componentName, projectName);
}
@Override
protected void storeItemToMemento(Object item, IMemento memento) {
- SeamComponent component = (SeamComponent)item;
- XMLMemento mem = (XMLMemento)memento;
- mem.putString("ProjectName", component.getSeamProject().getProject().getName());
- mem.putString("ComponentName", component.getName());
+ SeamComponentWrapper componentWrapper = (SeamComponentWrapper) item;
+ XMLMemento mem = (XMLMemento) memento;
+ mem.putString(PROJECT_NAME, componentWrapper.getProjectName());
+ mem.putString(COMPONENT_NAME, componentWrapper.getComponentName());
}
-
+
public void save(IMemento memento) {
super.save(memento);
- if(!(memento instanceof XMLMemento)) return;
- XMLMemento xmlMemento = (XMLMemento)memento;
- IPath stateLocation= SeamGuiPlugin.getDefault().getStateLocation().append(fileName);
- File file= new File(stateLocation.toOSString());
- FileWriter writer= null;
+ if (!(memento instanceof XMLMemento))
+ return;
+ XMLMemento xmlMemento = (XMLMemento) memento;
+ IPath stateLocation = SeamGuiPlugin.getDefault().getStateLocation()
+ .append(FILE_NAME);
+ File file = new File(stateLocation.toOSString());
+ FileWriter writer = null;
try {
writer = new FileWriter(file);
-
+
xmlMemento.save(writer);
writer.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
-
-
}
-
- public class SeamComponentLabelProvider implements ILabelProvider{
+ public class SeamComponentLabelProvider implements ILabelProvider {
+
public Image getImage(Object element) {
return SeamUiImages.COMPONENT_IMAGE;
}
public String getText(Object element) {
- if(element instanceof ISeamComponent){
- ISeamComponent component = (ISeamComponent)element;
- return component.getName()+" - "+component.getSeamProject().getProject().getName(); //$NON-NLS-1$
+ if (element instanceof SeamComponentWrapper) {
+ SeamComponentWrapper componentWrapper = (SeamComponentWrapper) element;
+ return componentWrapper.getComponentName()
+ + " - " + componentWrapper.getProjectName(); //$NON-NLS-1$
}
return null;
}
@@ -275,6 +284,61 @@
public void removeListener(ILabelProviderListener listener) {
}
-
}
+
+ public class SeamComponentWrapper {
+ private String componentName;
+ private String projectName;
+ private ISeamComponent component;
+
+ public SeamComponentWrapper(String componentName, String projectName) {
+ this.componentName = componentName;
+ this.projectName = projectName;
+ }
+
+ public SeamComponentWrapper(String componentName, String projectName,
+ ISeamComponent component) {
+ this(componentName, projectName);
+ this.component = component;
+ }
+
+ public String getComponentName() {
+ return componentName;
+ }
+
+ public void setComponentName(String componentName) {
+ this.componentName = componentName;
+ }
+
+ public String getProjectName() {
+ return projectName;
+ }
+
+ public void setProjectName(String projectName) {
+ this.projectName = projectName;
+ }
+
+ public ISeamComponent getComponent() {
+ if (component == null) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot()
+ .getProject(projectName);
+ if (project != null) {
+ ISeamProject seamProject = SeamCorePlugin.getSeamProject(
+ project, true);
+ if (seamProject != null) {
+ ISeamComponent component = seamProject
+ .getComponent(componentName);
+ return component;
+ }
+ }
+ return null;
+ }
+ return component;
+ }
+
+ public void setComponent(ISeamComponent component) {
+ this.component = component;
+ }
+
+ }
}
16 years, 7 months
JBoss Tools SVN: r6325 - trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/META-INF.
by jbosstools-commits@lists.jboss.org
Author: svasilyev
Date: 2008-02-15 04:15:42 -0500 (Fri, 15 Feb 2008)
New Revision: 6325
Modified:
trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/META-INF/MANIFEST.MF
Log:
http://jira.jboss.com/jira/browse/JBIDE-1687
Modified: trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/META-INF/MANIFEST.MF
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/META-INF/MANIFEST.MF 2008-02-15 08:32:45 UTC (rev 6324)
+++ trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/META-INF/MANIFEST.MF 2008-02-15 09:15:42 UTC (rev 6325)
@@ -3,9 +3,8 @@
Bundle-Name: Struts support for JBoss Visual Page Editor Plug-in
Bundle-SymbolicName: org.jboss.tools.struts.vpe.struts;singleton:=true
Bundle-Version: 2.1.0
-Bundle-Activator: org.jboss.tools.struts.vpe.struts.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.jboss.tools.vpe
-Eclipse-LazyStart: true
+Eclipse-LazyStart: false
Bundle-Vendor: Red Hat, Inc.
16 years, 7 months
JBoss Tools SVN: r6324 - in trunk/vpe/plugins/org.jboss.tools.vpe: templates and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: svasilyev
Date: 2008-02-15 03:32:45 -0500 (Fri, 15 Feb 2008)
New Revision: 6324
Removed:
trunk/vpe/plugins/org.jboss.tools.vpe/templates/vpe-templates-struts.xml
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml
Log:
http://jira.jboss.org/jira/browse/JBIDE-1687
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml 2008-02-15 08:32:11 UTC (rev 6323)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/plugin.xml 2008-02-15 08:32:45 UTC (rev 6324)
@@ -29,9 +29,6 @@
<templates
name="Apache MyFaces"
path="templates/vpe-templates-myfaces.xml"/>
- <templates
- name="Struts"
- path="templates/vpe-templates-struts.xml"/>
</extension>
<extension
point="org.jboss.tools.common.model.resourceMapping">
Deleted: trunk/vpe/plugins/org.jboss.tools.vpe/templates/vpe-templates-struts.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/templates/vpe-templates-struts.xml 2008-02-15 08:32:11 UTC (rev 6323)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/templates/vpe-templates-struts.xml 2008-02-15 08:32:45 UTC (rev 6324)
@@ -1,912 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<vpe:templates>
- <vpe:template-taglib uri="http://struts.apache.org/tags-html"
- prefix="html" />
- <vpe:template-taglib
- uri="http://jakarta.apache.org/struts/tags-html" prefix="html" />
- <vpe:template-taglib uri="/WEB-INF/struts-html" prefix="html" />
- <vpe:template-taglib uri="/WEB-INF/struts-html.tld" prefix="html" />
-
- <vpe:template-taglib uri="http://struts.apache.org/tags-logic"
- prefix="logic" />
- <vpe:template-taglib
- uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" />
- <vpe:template-taglib uri="/WEB-INF/struts-logic" prefix="logic" />
- <vpe:template-taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" />
-
- <vpe:tag name="html:base" case-sensitive="yes">
- <vpe:template children="no" modify="no">
- <div />
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:button" case-sensitive="yes">
- <vpe:if test="@value=''">
- <vpe:template children="no" modify="no">
- <input type="button" value="Click" class="{@styleClass}"
- style="{@style}" title="{tagstring()}" />
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="UnderlineFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:if>
- <vpe:template children="no" modify="no">
- <input type="button" value="{@value}" class="{@styleClass}"
- style="{@style}" title="{tagstring()}"/>
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="UnderlineFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:cancel" case-sensitive="yes">
- <vpe:if test="@value=''">
- <vpe:template children="no" modify="no">
- <button value="Reset" class="{@styleClass}"
- style="{@style}" title="{tagstring()}">
- Reset
- </button>
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="UnderlineFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:if>
- <vpe:template children="no" modify="no">
- <button value="{@value}" class="{@styleClass}"
- style="{@style}" title="{tagstring()}">
- <vpe:value expr="{@value}" />
- </button>
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="UnderlineFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:checkbox" case-sensitive="yes">
- <vpe:template children="yes" modify="yes">
- <nobr>
- <input type="checkbox" class="{@styleClass}"
- style="{@style}" title="{tagstring()}" />
- </nobr>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:html" case-sensitive="yes">
- <vpe:template children="yes" modify="yes">
- <div />
- <vpe:dnd>
- <vpe:drop container="yes" />
- </vpe:dnd>
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:form" case-sensitive="yes">
- <vpe:template children="yes" modify="yes">
- <div style="border:1px dotted #FF6600;padding: 5px;"
- title="{tagstring()}" />
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="yes" />
- </vpe:dnd>
- </vpe:template>
- </vpe:tag>
-
-
- <vpe:tag name="html:frame" case-sensitive="yes">
- <vpe:template children="yes" modify="no" />
- </vpe:tag>
-
- <vpe:tag name="html:image" case-sensitive="yes">
- <vpe:if test="attrpresent('src')">
- <vpe:template children="no" modify="yes">
- <img src="{src(@src)}" width="{@width}"
- height="{@height}" class="{@styleClass}" style="{@style}"
- border="{@border}" title="{@title}" alt="{@alt}" />
- <vpe:resize>
- <vpe:width width-attr="width" />
- <vpe:height height-attr="height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- </vpe:template>
- </vpe:if>
- <vpe:template children="no" modify="yes">
- <img src="{src(@page)}" width="{@width}" height="{@height}"
- class="{@styleClass}" style="{@style}" border="{@border}"
- title="{@title}" alt="{@alt}" />
- <vpe:resize>
- <vpe:width width-attr="width" />
- <vpe:height height-attr="height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:img" case-sensitive="yes">
- <vpe:if test="attrpresent('src')">
- <vpe:template children="no" modify="yes">
- <img src="{src(@src)}" width="{@width}"
- height="{@height}" class="{@styleClass}" style="{@style}"
- border="{@border}" title="{@title}" alt="{@alt}" />
- <vpe:resize>
- <vpe:width width-attr="width" />
- <vpe:height height-attr="height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- </vpe:template>
- </vpe:if>
- <vpe:template children="no" modify="yes">
- <img src="{src(@page)}" width="{@width}" height="{@height}"
- class="{@styleClass}" style="{@style}" border="{@border}"
- title="{@title}" alt="{@alt}" />
- <vpe:resize>
- <vpe:width width-attr="width" />
- <vpe:height height-attr="height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:file" case-sensitive="yes">
- <vpe:template children="no" modify="no">
- <nobr>
- <input value="{@value}" class="{@styleClass}"
- style="{@style}" />
- <input type="button" value="Browse" />
- </nobr>
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="UnderlineFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:hidden" case-sensitive="yes">
- <vpe:template children="no" modify="yes">
- <input type="hidden" value="{@value}" class="{@styleClass}"
- style="{@style}" title="{tagstring()}" size="{@size}" />
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:link" case-sensitive="yes">
- <vpe:template children="yes" modify="yes">
- <span class="{@styleClass}"
- style="color:blue;text-decoration:underline;{@style}"
- title="{tagstring()}" />
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="BlockFormat" handler="org.jboss.tools.vpe.editor.toolbar.format.handler.BlockFormatHandler" />
- <vpe:format type="UnderlineFormat" setDefault="true">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:messages" case-sensitive="yes">
- <vpe:template children="yes" modify="no" >
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:multibox" case-sensitive="yes">
- <vpe:template children="yes" modify="yes">
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:option" case-sensitive="yes">
- <vpe:if test="attrpresent('key')">
- <vpe:template children="no" modify="yes">
- <option value="{@value}" title="{tagstring()}">
- <vpe:value expr="{@key}"/>
- </option>
- </vpe:template>
- </vpe:if>
- <vpe:template children="yes" modify="yes">
- <option value="{@value}" title="{tagstring()}">
- </option>
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:options" case-sensitive="yes">
- <vpe:template children="yes" modify="yes"></vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:password" case-sensitive="yes">
- <vpe:template children="no" modify="yes">
- <input type="text" value="{@value}" class="{@styleClass}"
- style="{@style}" title="{tagstring()}" size="{@size}" />
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="UnderlineFormat">
- <vpe:formatAttribute type="style"/>
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style"/>
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style"/>
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style"/>
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style"/>
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style"/>
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style"/>
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:radio" case-sensitive="yes">
- <vpe:template children="no" modify="yes">
- <nobr>
- <input type="radio" class="{@styleClass}"
- style="{@style}" title="{tagstring()}" />
- </nobr>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:reset_" case-sensitive="yes">
- <vpe:if test="@value=''">
- <vpe:template children="yes" modify="yes">
- <input type="button" value="Reset" class="{@styleClass}"
- style="{@style}" title="{tagstring()}"/>
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="UnderlineFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:if>
- <vpe:template children="yes" modify="yes">
- <input type="button" value="{@value}" class="{@styleClass}"
- style="{@style}" title="{tagstring()}"/>
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="UnderlineFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:reset" case-sensitive="yes">
- <vpe:if test="@value=''">
- <vpe:if test="hascontent()">
- <vpe:template children="yes" modify="yes">
- <button class="{@styleClass}"
- style="{@style}" title="{tagstring()}"/>
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="UnderlineFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:if>
- <vpe:template children="no" modify="yes">
- <input type="button" value="Reset" class="{@styleClass}"
- style="{@style}" title="{tagstring()}"/>
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="UnderlineFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:if>
- <vpe:template children="no" modify="yes">
- <input type="button" value="{@value}" class="{@styleClass}"
- style="{@style}" title="{tagstring()}"/>
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="UnderlineFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:select" case-sensitive="yes">
- <vpe:template children="yes" modify="yes">
- <select style="{@style}" size="{@size}"
- class="{@styleClass}" title="{tagstring()}">
- </select>
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="yes" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="UnderlineFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:submit" case-sensitive="yes">
- <vpe:if test="@value=''">
- <vpe:if test="hascontent()">
- <vpe:template children="yes" modify="yes">
- <button class="{@styleClass}"
- style="{@style}" title="{tagstring()}"/>
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="UnderlineFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:if>
- <vpe:template children="no" modify="yes">
- <input type="button" value="Submit" class="{@styleClass}"
- style="{@style}" title="{tagstring()}"/>
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="UnderlineFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:if>
- <vpe:template children="no" modify="yes">
- <input type="button" value="{@value}" class="{@styleClass}"
- style="{@style}" title="{tagstring()}"/>
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="UnderlineFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:text" case-sensitive="yes">
- <vpe:if test="(not(attrpresent('value'))|(@value=''))">
- <vpe:template children="no" modify="yes">
- <input type="text" value="{tagtext()}"
- class="{@styleClass}" style="{@style}" title="{tagstring()}"
- size="{@size}" />
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="UnderlineFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:if>
- <vpe:template children="no" modify="yes">
- <input type="text" value="{@value}" class="{@styleClass}"
- style="{@style}" title="{tagstring()}" size="{@size}" />
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="UnderlineFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:tag>
-
- <vpe:tag name="html:textarea" case-sensitive="yes">
- <vpe:if test="attrpresent('__vpe__fake__')" />
- <vpe:template children="yes" modify="no">
- <textarea class="{@styleClass}" style="{@style}"
- rows="{@rows}" cols="{@cols}" title="{tagstring()}">
- <vpe:value expr="{@value}" />
- </textarea>
- <vpe:resize>
- <vpe:width width-attr="style.width" />
- <vpe:height height-attr="style.height" />
- </vpe:resize>
- <vpe:dnd>
- <vpe:drag start-enable="yes" />
- <vpe:drop container="no" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="UnderlineFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BoldFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ItalicFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontNameFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="FontSizeFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="BackgroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- <vpe:format type="ForegroundColorFormat">
- <vpe:formatAttribute type="style" />
- </vpe:format>
- </vpe:textFormating>
- </vpe:template>
- </vpe:tag>
-
-
- <!-- Struts Logic -->
- <vpe:tag name="logic:redirect" case-sensitive="yes">
- <vpe:template children="no" modify="no">
- <div />
- </vpe:template>
- </vpe:tag>
-
-</vpe:templates>
16 years, 7 months
JBoss Tools SVN: r6323 - in trunk/struts/plugins/org.jboss.tools.struts.vpe.struts: META-INF and 8 other directories.
by jbosstools-commits@lists.jboss.org
Author: svasilyev
Date: 2008-02-15 03:32:11 -0500 (Fri, 15 Feb 2008)
New Revision: 6323
Added:
trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/.classpath
trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/.project
trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/META-INF/
trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/META-INF/MANIFEST.MF
trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/build.properties
trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/plugin.xml
trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/src/
trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/src/org/
trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/src/org/jboss/
trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/src/org/jboss/tools/
trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/src/org/jboss/tools/struts/
trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/src/org/jboss/tools/struts/vpe/
trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/src/org/jboss/tools/struts/vpe/struts/
trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/src/org/jboss/tools/struts/vpe/struts/Activator.java
trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/templates/
trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/templates/vpe-templates-struts.xml
Log:
http://jira.jboss.org/jira/browse/JBIDE-1687
Added: trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/.classpath
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/.classpath (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/.classpath 2008-02-15 08:32:11 UTC (rev 6323)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/.project
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/.project (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/.project 2008-02-15 08:32:11 UTC (rev 6323)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.struts.vpe.struts</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/META-INF/MANIFEST.MF
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/META-INF/MANIFEST.MF (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/META-INF/MANIFEST.MF 2008-02-15 08:32:11 UTC (rev 6323)
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Struts support for JBoss Visual Page Editor Plug-in
+Bundle-SymbolicName: org.jboss.tools.struts.vpe.struts;singleton:=true
+Bundle-Version: 2.1.0
+Bundle-Activator: org.jboss.tools.struts.vpe.struts.Activator
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.jboss.tools.vpe
+Eclipse-LazyStart: true
+Bundle-Vendor: Red Hat, Inc.
Added: trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/build.properties
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/build.properties (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/build.properties 2008-02-15 08:32:11 UTC (rev 6323)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ templates/
Added: trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/plugin.xml
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/plugin.xml (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/plugin.xml 2008-02-15 08:32:11 UTC (rev 6323)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.jboss.tools.vpe.templates">
+ <templates
+ decsription="VPE templates for Struts support"
+ name="Struts"
+ path="templates/vpe-templates-struts.xml">
+ </templates>
+ </extension>
+
+</plugin>
Added: trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/src/org/jboss/tools/struts/vpe/struts/Activator.java
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/src/org/jboss/tools/struts/vpe/struts/Activator.java (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/src/org/jboss/tools/struts/vpe/struts/Activator.java 2008-02-15 08:32:11 UTC (rev 6323)
@@ -0,0 +1,50 @@
+package org.jboss.tools.struts.vpe.struts;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.struts.vpe.struts";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
Added: trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/templates/vpe-templates-struts.xml
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/templates/vpe-templates-struts.xml (rev 0)
+++ trunk/struts/plugins/org.jboss.tools.struts.vpe.struts/templates/vpe-templates-struts.xml 2008-02-15 08:32:11 UTC (rev 6323)
@@ -0,0 +1,916 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<vpe:templates>
+ <vpe:template-taglib uri="http://struts.apache.org/tags-html"
+ prefix="html" />
+ <vpe:template-taglib
+ uri="http://jakarta.apache.org/struts/tags-html" prefix="html" />
+ <vpe:template-taglib uri="/WEB-INF/struts-html" prefix="html" />
+ <vpe:template-taglib uri="/WEB-INF/struts-html.tld" prefix="html" />
+
+ <vpe:template-taglib uri="http://struts.apache.org/tags-logic"
+ prefix="logic" />
+ <vpe:template-taglib
+ uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" />
+ <vpe:template-taglib uri="/WEB-INF/struts-logic" prefix="logic" />
+ <vpe:template-taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" />
+
+ <vpe:tag name="html:base" case-sensitive="yes">
+ <vpe:template children="no" modify="no">
+ <div />
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:button" case-sensitive="yes">
+ <vpe:if test="@value=''">
+ <vpe:template children="no" modify="no">
+ <input type="button" value="Click" class="{@styleClass}"
+ style="{@style}" title="{tagstring()}" />
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:if>
+ <vpe:template children="no" modify="no">
+ <input type="button" value="{@value}" class="{@styleClass}"
+ style="{@style}" title="{tagstring()}"/>
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:cancel" case-sensitive="yes">
+ <vpe:if test="@value=''">
+ <vpe:template children="no" modify="no">
+ <button value="Reset" class="{@styleClass}"
+ style="{@style}" title="{tagstring()}">
+ Reset
+ </button>
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:if>
+ <vpe:template children="no" modify="no">
+ <button value="{@value}" class="{@styleClass}"
+ style="{@style}" title="{tagstring()}">
+ <vpe:value expr="{@value}" />
+ </button>
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:checkbox" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes">
+ <nobr>
+ <input type="checkbox" class="{@styleClass}"
+ style="{@style}" title="{tagstring()}" />
+ </nobr>
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:html" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes">
+ <div />
+ <vpe:dnd>
+ <vpe:drop container="yes" />
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:form" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes">
+ <div style="border:1px dotted #FF6600;padding: 5px;"
+ title="{tagstring()}" />
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="yes" />
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+
+
+ <vpe:tag name="html:frame" case-sensitive="yes">
+ <vpe:template children="yes" modify="no" />
+ </vpe:tag>
+
+ <vpe:tag name="html:image" case-sensitive="yes">
+ <vpe:if test="attrpresent('src')">
+ <vpe:template children="no" modify="yes">
+ <img src="{src(@src)}" width="{@width}"
+ height="{@height}" class="{@styleClass}" style="{@style}"
+ border="{@border}" title="{@title}" alt="{@alt}" />
+ <vpe:resize>
+ <vpe:width width-attr="width" />
+ <vpe:height height-attr="height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:if>
+ <vpe:template children="no" modify="yes">
+ <img src="{src(@page)}" width="{@width}" height="{@height}"
+ class="{@styleClass}" style="{@style}" border="{@border}"
+ title="{@title}" alt="{@alt}" />
+ <vpe:resize>
+ <vpe:width width-attr="width" />
+ <vpe:height height-attr="height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:img" case-sensitive="yes">
+ <vpe:if test="attrpresent('src')">
+ <vpe:template children="no" modify="yes">
+ <img src="{src(@src)}" width="{@width}"
+ height="{@height}" class="{@styleClass}" style="{@style}"
+ border="{@border}" title="{@title}" alt="{@alt}" />
+ <vpe:resize>
+ <vpe:width width-attr="width" />
+ <vpe:height height-attr="height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:if>
+ <vpe:template children="no" modify="yes">
+ <img src="{src(@page)}" width="{@width}" height="{@height}"
+ class="{@styleClass}" style="{@style}" border="{@border}"
+ title="{@title}" alt="{@alt}" />
+ <vpe:resize>
+ <vpe:width width-attr="width" />
+ <vpe:height height-attr="height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:file" case-sensitive="yes">
+ <vpe:template children="no" modify="no">
+ <nobr>
+ <input value="{@value}" class="{@styleClass}"
+ style="{@style}" />
+ <input type="button" value="Browse" />
+ </nobr>
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:hidden" case-sensitive="yes">
+ <vpe:template children="no" modify="yes">
+ <input type="hidden" value="{@value}" class="{@styleClass}"
+ style="{@style}" title="{tagstring()}" size="{@size}" />
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:link" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes">
+ <span class="{@styleClass}"
+ style="color:blue;text-decoration:underline;{@style}"
+ title="{tagstring()}" />
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="BlockFormat" handler="org.jboss.tools.vpe.editor.toolbar.format.handler.BlockFormatHandler" />
+ <vpe:format type="UnderlineFormat" setDefault="true">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:messages" case-sensitive="yes">
+ <vpe:template children="yes" modify="no" >
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:multibox" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes">
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:option" case-sensitive="yes">
+ <vpe:if test="attrpresent('key')">
+ <vpe:template children="no" modify="yes">
+ <option value="{@value}" title="{tagstring()}">
+ <vpe:value expr="{@key}"/>
+ </option>
+ </vpe:template>
+ </vpe:if>
+ <vpe:template children="yes" modify="yes">
+ <option value="{@value}" title="{tagstring()}">
+ </option>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:options" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes"></vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:password" case-sensitive="yes">
+ <vpe:template children="no" modify="yes">
+ <input type="text" value="{@value}" class="{@styleClass}"
+ style="{@style}" title="{tagstring()}" size="{@size}" />
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style"/>
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style"/>
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style"/>
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style"/>
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style"/>
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style"/>
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style"/>
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:radio" case-sensitive="yes">
+ <vpe:template children="no" modify="yes">
+ <nobr>
+ <input type="radio" class="{@styleClass}"
+ style="{@style}" title="{tagstring()}" />
+ </nobr>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:reset_" case-sensitive="yes">
+ <vpe:if test="@value=''">
+ <vpe:template children="yes" modify="yes">
+ <input type="button" value="Reset" class="{@styleClass}"
+ style="{@style}" title="{tagstring()}"/>
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:if>
+ <vpe:template children="yes" modify="yes">
+ <input type="button" value="{@value}" class="{@styleClass}"
+ style="{@style}" title="{tagstring()}"/>
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:reset" case-sensitive="yes">
+ <vpe:if test="@value=''">
+ <vpe:if test="hascontent()">
+ <vpe:template children="yes" modify="yes">
+ <button class="{@styleClass}"
+ style="{@style}" title="{tagstring()}"/>
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:if>
+ <vpe:template children="no" modify="yes">
+ <input type="button" value="Reset" class="{@styleClass}"
+ style="{@style}" title="{tagstring()}"/>
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:if>
+ <vpe:template children="no" modify="yes">
+ <input type="button" value="{@value}" class="{@styleClass}"
+ style="{@style}" title="{tagstring()}"/>
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:select" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes">
+ <select style="{@style}" size="{@size}"
+ class="{@styleClass}" title="{tagstring()}">
+ </select>
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="yes" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:submit" case-sensitive="yes">
+ <vpe:if test="@value=''">
+ <vpe:if test="hascontent()">
+ <vpe:template children="yes" modify="yes">
+ <button class="{@styleClass}"
+ style="{@style}" title="{tagstring()}"/>
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:if>
+ <vpe:template children="no" modify="yes">
+ <input type="button" value="Submit" class="{@styleClass}"
+ style="{@style}" title="{tagstring()}"/>
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:if>
+ <vpe:template children="no" modify="yes">
+ <input type="button" value="{@value}" class="{@styleClass}"
+ style="{@style}" title="{tagstring()}"/>
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:text" case-sensitive="yes">
+ <vpe:if test="(not(attrpresent('value'))|(@value=''))">
+ <vpe:template children="no" modify="yes">
+ <input type="text" value="{tagtext()}"
+ class="{@styleClass}" style="{@style}" title="{tagstring()}"
+ size="{@size}" />
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:if>
+ <vpe:template children="no" modify="yes">
+ <input type="text" value="{@value}" class="{@styleClass}"
+ style="{@style}" title="{tagstring()}" size="{@size}" />
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:tag>
+
+ <vpe:tag name="html:textarea" case-sensitive="yes">
+ <vpe:if test="attrpresent('__vpe__fake__')" />
+ <vpe:template children="yes" modify="no">
+ <textarea class="{@styleClass}" style="{@style}"
+ rows="{@rows}" cols="{@cols}" title="{tagstring()}">
+ <vpe:value expr="{@value}" />
+ </textarea>
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no" />
+ </vpe:dnd>
+ <vpe:textFormating>
+ <vpe:format type="UnderlineFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BoldFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ItalicFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontNameFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="FontSizeFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="BackgroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ <vpe:format type="ForegroundColorFormat">
+ <vpe:formatAttribute type="style" />
+ </vpe:format>
+ </vpe:textFormating>
+ </vpe:template>
+ </vpe:tag>
+
+
+ <!-- Struts Logic -->
+ <vpe:tag name="logic:redirect" case-sensitive="yes">
+ <vpe:template children="no" modify="no">
+ <div />
+ </vpe:template>
+ </vpe:tag>
+
+</vpe:templates>
16 years, 7 months