JBoss Tools SVN: r21794 - in trunk: vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: yradtsevich
Date: 2010-04-29 10:33:58 -0400 (Thu, 29 Apr 2010)
New Revision: 21794
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6204
VPE is empty and crashing
- Fixed
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 2010-04-29 14:30:46 UTC (rev 21793)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/ValueHelper.java 2010-04-29 14:33:58 UTC (rev 21794)
@@ -82,7 +82,7 @@
}
public IVisualController getController() {
- IEditorPart editor = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ IEditorPart editor = getEditor();
if(!(editor instanceof JSPMultiPageEditor)) return null;
IVisualEditor v = ((JSPMultiPageEditor)editor).getVisualEditor();
if(v == null) return null;
@@ -91,7 +91,7 @@
boolean init() {
if(isVisualContextInitialized) return true;
- IEditorPart editor = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ IEditorPart editor = getEditor();
if(!(editor instanceof JSPMultiPageEditor)) return false;
JSPTextEditor jspEditor = ((JSPMultiPageEditor)editor).getJspEditor();
@@ -103,6 +103,11 @@
return getIVisualContext() != null;
}
+ protected IEditorPart getEditor() {
+ return ModelUIPlugin.getDefault().getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ }
+
private IVisualContext getIVisualContext(){
JSPTextEditor jspEditor = getJSPTextEditor();
return (jspEditor == null) ? null : jspEditor.getPageContext();
@@ -120,7 +125,7 @@
}
protected JSPTextEditor getJSPTextEditor() {
- IEditorPart editor = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ IEditorPart editor = getEditor();
if(!(editor instanceof JSPMultiPageEditor)) return null;
return ((JSPMultiPageEditor)editor).getJspEditor();
}
@@ -189,7 +194,7 @@
}
public IEditorInput getEditorInput() {
- IEditorPart editor = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ IEditorPart editor = getEditor();
return editor.getEditorInput();
}
@@ -221,7 +226,7 @@
//Support of StructuredTextEditor
boolean init2() {
if(isVisualContextInitialized) return true;
- IEditorPart editor = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ IEditorPart editor = getEditor();
if(!(editor instanceof StructuredTextEditor)) return false;
StructuredTextEditor jspEditor = ((StructuredTextEditor)editor);
IDocument document = jspEditor.getDocumentProvider().getDocument(getEditorInput());
@@ -266,7 +271,7 @@
public ISourceViewer getSourceViewer() {
JSPTextEditor jspEditor = getJSPTextEditor();
if(jspEditor != null) return jspEditor.getTextViewer();
- IEditorPart editor = ModelUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ IEditorPart editor = getEditor();
if (editor == null) return null;
if(editor instanceof AbstractTextEditor) {
try {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java 2010-04-29 14:30:46 UTC (rev 21793)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/expression/VpeFunctionSrc.java 2010-04-29 14:33:58 UTC (rev 21794)
@@ -19,6 +19,7 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.editors.text.ILocationProvider;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
@@ -183,8 +184,16 @@
if (document == null || query == null) {
return tagValue;
}
-
- ValueHelper valueHelper = new ValueHelper();
+ final IEditorPart editor = pageContext.getEditPart().getSite().getPage().getActiveEditor();
+ ValueHelper valueHelper = new ValueHelper() {
+ // yradtsevich: fix of JBIDE-6204: NPE was thrown in the base method
+ // because getActivePage() may be null before the page is initialized
+ @Override
+ protected IEditorPart getEditor() {
+ return editor;
+ }
+ };
+
JspContentAssistProcessor processor = valueHelper.createContentAssistProcessor();
int offset = 0;
if(sourceNode instanceof IndexedRegion) {
14 years, 8 months
JBoss Tools SVN: r21793 - branches/modular_build/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2010-04-29 10:30:46 -0400 (Thu, 29 Apr 2010)
New Revision: 21793
Modified:
branches/modular_build/build/build.xml
Log:
add -Dclean.sources option
Modified: branches/modular_build/build/build.xml
===================================================================
--- branches/modular_build/build/build.xml 2010-04-29 12:40:32 UTC (rev 21792)
+++ branches/modular_build/build/build.xml 2010-04-29 14:30:46 UTC (rev 21793)
@@ -152,6 +152,7 @@
</target>
<target name="get.sources" description="if sources not already on disk, fetch them">
+ <property name="clean.sources" value="false" />
<property name="svn.recurse" value="true" />
<!-- = = = = = = = = = = = = = = = = =
@@ -203,6 +204,12 @@
">
<sequential>
<if>
+ <equals arg1="${clean.sources}" arg2="true" />
+ <then>
+ <delete dir="${WORKINGDIR}/@{COMPONENT}" includeemptydirs="true" quiet="true" />
+ </then>
+ </if>
+ <if>
<not>
<available file="${WORKINGDIR}/@{COMPONENT}" type="dir" />
</not>
14 years, 8 months
JBoss Tools SVN: r21792 - trunk/documentation/guides/GettingStartedGuide/en-US.
by jbosstools-commits@lists.jboss.org
Author: ochikvina
Date: 2010-04-29 08:40:32 -0400 (Thu, 29 Apr 2010)
New Revision: 21792
Modified:
trunk/documentation/guides/GettingStartedGuide/en-US/getting_started.xml
Log:
<html><head><meta name="qrichtext" content="1" /></head><body style="font-size:9pt;font-family:Sans Serif">
<p>https://jira.jboss.org/jira/browse/TOOLSDOC-25 - Added info about update error(forum post : http://community.jboss.org/thread/150331?tstart=0) to 1.5.2. JBoss Tools Installation and Update section in GSG.</p>
</body></html>
Modified: trunk/documentation/guides/GettingStartedGuide/en-US/getting_started.xml
===================================================================
--- trunk/documentation/guides/GettingStartedGuide/en-US/getting_started.xml 2010-04-29 02:10:22 UTC (rev 21791)
+++ trunk/documentation/guides/GettingStartedGuide/en-US/getting_started.xml 2010-04-29 12:40:32 UTC (rev 21792)
@@ -601,6 +601,14 @@
</itemizedlist>
</para>
<itemizedlist>
+ <note>
+ <title>Note:</title>
+ <para>During the JBT installation/updating process using some of Jboss
+ update sites <emphasis>No repository found containing...</emphasis> error
+ can appear.It is a Eclipse P2 bug.To work around it try:1.Restart your Eclipse. 2.
+ Add the update site again. 3.
+ Do the update again.</para>
+ </note>
<para>To install/update Jboss Tools from one of the update sites you should follow the steps:</para>
<listitem><para>First, download the correct version of Eclipse
for your platform which is compatible with the version of JBoss
14 years, 8 months
JBoss Tools SVN: r21791 - trunk/documentation/guides/JBDS_Release_Notes/en-US.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2010-04-28 22:10:22 -0400 (Wed, 28 Apr 2010)
New Revision: 21791
Modified:
trunk/documentation/guides/JBDS_Release_Notes/en-US/Fixed_Issues.xml
Log:
now really fixed the bug lol
Modified: trunk/documentation/guides/JBDS_Release_Notes/en-US/Fixed_Issues.xml
===================================================================
--- trunk/documentation/guides/JBDS_Release_Notes/en-US/Fixed_Issues.xml 2010-04-29 02:09:39 UTC (rev 21790)
+++ trunk/documentation/guides/JBDS_Release_Notes/en-US/Fixed_Issues.xml 2010-04-29 02:10:22 UTC (rev 21791)
@@ -49,7 +49,7 @@
<itemizedlist>
<listitem>
<para>
- <ulink url="http://jira.jboss.com/jira/browse/JBIDE-6075">JBIDE-6075</ulink>: In the Hibernate reverse engineering editor it was impossible to add a parameter as the button to do so was missing. This update corrects the user interface to include the <guibutton>Add parameter</guibutton> button under the <guilabel>Id Generator details</guilabel> <guilabel>Class</guilabel> section.</ulink>
+ <ulink url="http://jira.jboss.com/jira/browse/JBIDE-6075">JBIDE-6075</ulink>: In the Hibernate reverse engineering editor it was impossible to add a parameter as the button to do so was missing. This update corrects the user interface to include the <guibutton>Add parameter</guibutton> button under the <guilabel>Id Generator details</guilabel> <guilabel>Class</guilabel> section.
</para>
</listitem>
</itemizedlist>
14 years, 8 months
JBoss Tools SVN: r21790 - trunk/documentation/guides/JBDS_Release_Notes/en-US.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2010-04-28 22:09:39 -0400 (Wed, 28 Apr 2010)
New Revision: 21790
Modified:
trunk/documentation/guides/JBDS_Release_Notes/en-US/Fixed_Issues.xml
Log:
fixed error
Modified: trunk/documentation/guides/JBDS_Release_Notes/en-US/Fixed_Issues.xml
===================================================================
--- trunk/documentation/guides/JBDS_Release_Notes/en-US/Fixed_Issues.xml 2010-04-29 02:02:31 UTC (rev 21789)
+++ trunk/documentation/guides/JBDS_Release_Notes/en-US/Fixed_Issues.xml 2010-04-29 02:09:39 UTC (rev 21790)
@@ -49,7 +49,7 @@
<itemizedlist>
<listitem>
<para>
- <ulink url="http://jira.jboss.com/jira/browse/JBIDE-6075">: In the Hibernate reverse engineering editor it was impossible to add a parameter as the button to do so was missing. This update corrects the user interface to include the <guibutton>Add parameter</guibutton> button under the <guilabel>Id Generator details</guilabel> <guilabel>Class</guilabel> section.</ulink>
+ <ulink url="http://jira.jboss.com/jira/browse/JBIDE-6075">JBIDE-6075</ulink>: In the Hibernate reverse engineering editor it was impossible to add a parameter as the button to do so was missing. This update corrects the user interface to include the <guibutton>Add parameter</guibutton> button under the <guilabel>Id Generator details</guilabel> <guilabel>Class</guilabel> section.</ulink>
</para>
</listitem>
</itemizedlist>
14 years, 8 months
JBoss Tools SVN: r21789 - trunk/documentation/guides/JBDS_Release_Notes/en-US.
by jbosstools-commits@lists.jboss.org
Author: irooskov(a)redhat.com
Date: 2010-04-28 22:02:31 -0400 (Wed, 28 Apr 2010)
New Revision: 21789
Modified:
trunk/documentation/guides/JBDS_Release_Notes/en-US/Fixed_Issues.xml
Log:
updated for JBDS 3.0.1 release
Modified: trunk/documentation/guides/JBDS_Release_Notes/en-US/Fixed_Issues.xml
===================================================================
--- trunk/documentation/guides/JBDS_Release_Notes/en-US/Fixed_Issues.xml 2010-04-28 19:01:17 UTC (rev 21788)
+++ trunk/documentation/guides/JBDS_Release_Notes/en-US/Fixed_Issues.xml 2010-04-29 02:02:31 UTC (rev 21789)
@@ -7,7 +7,7 @@
<para>
Following is a list of new and noteworthy features and bug fixes in this release:
</para>
- <formalpara>
+<!-- <formalpara>
<title>Contexts and Dependency Injection (CDI)</title>
<para>
<itemizedlist>
@@ -18,8 +18,8 @@
</listitem>
</itemizedlist>
</para>
- </formalpara>
- <formalpara>
+ </formalpara> -->
+<!-- <formalpara>
<title>ESB</title>
<para>
<itemizedlist>
@@ -30,8 +30,8 @@
</listitem>
</itemizedlist>
</para>
- </formalpara>
- <formalpara>
+ </formalpara> -->
+<!-- <formalpara>
<title>jBPM</title>
<para>
<itemizedlist>
@@ -42,14 +42,14 @@
</listitem>
</itemizedlist>
</para>
- </formalpara>
+ </formalpara> -->
<formalpara>
<title>Hibernate</title>
<para>
<itemizedlist>
<listitem>
<para>
- <ulink url="http://jira.jboss.com/jira/browse/JBIDE-6075">In the Hibernate reverse engineering editor it was impossible to add a parameter as the button to do so was missing. This update corrects the user interface to include the <guibutton>Add parameter</guibutton> button under the <guilabel>Id Generator details</guilabel> <guilabel>Class</guilabel> section.</ulink>
+ <ulink url="http://jira.jboss.com/jira/browse/JBIDE-6075">: In the Hibernate reverse engineering editor it was impossible to add a parameter as the button to do so was missing. This update corrects the user interface to include the <guibutton>Add parameter</guibutton> button under the <guilabel>Id Generator details</guilabel> <guilabel>Class</guilabel> section.</ulink>
</para>
</listitem>
</itemizedlist>
@@ -61,13 +61,13 @@
<itemizedlist>
<listitem>
<para>
- <ulink url="http://jira.jboss.com/jira/browse/JBIDE-"> </ulink>
+ <ulink url="http://jira.jboss.com/jira/browse/JBIDE-5941">JBIDE-5941</ulink>: A new JSF2 feature has been added that allows a user to type <code>#{cc.attrs.|</code> and have an attribute list returned.
</para>
</listitem>
</itemizedlist>
</para>
</formalpara>
- <formalpara>
+<!-- <formalpara>
<title>RichFaces</title>
<para>
<itemizedlist>
@@ -78,8 +78,8 @@
</listitem>
</itemizedlist>
</para>
- </formalpara>
- <formalpara>
+ </formalpara> -->
+<!-- <formalpara>
<title>Seam</title>
<para>
<itemizedlist>
@@ -90,8 +90,8 @@
</listitem>
</itemizedlist>
</para>
- </formalpara>
- <formalpara>
+ </formalpara> -->
+<!-- <formalpara>
<title>Smooks</title>
<para>
<itemizedlist>
@@ -102,8 +102,8 @@
</listitem>
</itemizedlist>
</para>
- </formalpara>
- <formalpara>
+ </formalpara> -->
+<!-- <formalpara>
<title>Struts</title>
<para>
<itemizedlist>
@@ -114,8 +114,8 @@
</listitem>
</itemizedlist>
</para>
- </formalpara>
- <formalpara>
+ </formalpara> -->
+<!-- <formalpara>
<title>Visual Page Editor</title>
<para>
<itemizedlist>
@@ -126,8 +126,8 @@
</listitem>
</itemizedlist>
</para>
- </formalpara>
- <formalpara>
+ </formalpara> -->
+<!-- <formalpara>
<title>XHTML Editor</title>
<para>
<itemizedlist>
@@ -138,8 +138,8 @@
</listitem>
</itemizedlist>
</para>
- </formalpara>
- <formalpara>
+ </formalpara> -->
+<!-- <formalpara>
<title>XML Structured Editor</title>
<para>
<itemizedlist>
@@ -150,16 +150,26 @@
</listitem>
</itemizedlist>
</para>
- </formalpara>
+ </formalpara> -->
<formalpara>
<title>General Issues</title>
<para>
<itemizedlist>
<listitem>
<para>
- <ulink url="http://jira.jboss.com/jira/browse/JBIDE-"> </ulink>
+ <ulink url="http://jira.jboss.com/jira/browse/JBDS-1155">JBDS-1155</ulink>: A regression existed in the Eclipse 3.5.2 Web Tools Platform (WTP) 3.1.2. The bug would break EAR deployments that used classpath variables by deploying dependent artifacts to <filename><root_ear>/lib/lib/lib</filename> instead of <filename><root_ear>/lib</filename>. The issue has been corrected with these updated packages so that the regression no longer exists and EAR deployments function correctly.
</para>
</listitem>
+ <listitem>
+ <para>
+ <ulink url="http://jira.jboss.com/jira/browse/JBDS-1147">JBDS-1147</ulink>: An incorrect link to the Guvnor Rules repository was included in the JBoss Developer Studio. This bug caused the repository to become unreachable. This has been fixed by correcting the link to be <ulink url="http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/webdav">http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/webdav</ulink>. The JBoss Developer Studio is now able to connect to the Guvnor Rules repository.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <ulink url="http://jira.jboss.com/jira/browse/JBDS-1091">JBDS-1091</ulink>: Two bugs were found. A problem was found in the <filename>org.jboss.tools.runtime_1.1.0</filename> plug-in and the visibility of the <property>Instance</property> field was changed from public to private. These bugs respectively caused the JBoss Developer Studio <guilabel>Server View</guilabel> to not display all available servers on occasion after using the installer and jBPM runtimes to not be initialized correctly. The <filename>org.jboss.tools.runtime_1.1.0</filename> plug-in has now been updated to force a refresh of the <guilabel>Server View</guilabel> post installation, which can be verified by a refresh message appearing in the log file and the <filename>org.jboss.tools.jbpm.common</filename> plug-in has been updated to set <code>public static final PreferencesManager INSTANCE = new PreferencesManager();</code>. By correcting the <filename>org.jboss.tools.runtime_1.1.0</filename> plug-!
in, all installed servers now appear in the <guilabel>Server View</guilabel> directly after installation of the JBoss Developer Studio through the installer. Fixing the <filename>org.jboss.tools.jbpm.common</filename> plug-in now allows for jBPM runtimes to be initialized correctly. Both issues are fixed with this update.
+ </para>
+ </listitem>
</itemizedlist>
</para>
</formalpara>
14 years, 8 months
JBoss Tools SVN: r21788 - trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/editors.
by jbosstools-commits@lists.jboss.org
Author: bbrodt
Date: 2010-04-28 15:01:17 -0400 (Wed, 28 Apr 2010)
New Revision: 21788
Modified:
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/editors/ODEDeployMultiPageEditor.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6230 Process is not removed from ODE deployment editor model if BPEL process file is deleted from project
Modified: trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/editors/ODEDeployMultiPageEditor.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/editors/ODEDeployMultiPageEditor.java 2010-04-28 18:55:26 UTC (rev 21787)
+++ trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/editors/ODEDeployMultiPageEditor.java 2010-04-28 19:01:17 UTC (rev 21788)
@@ -15,6 +15,8 @@
import java.util.Collections;
import java.util.EventObject;
import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Vector;
import org.eclipse.bpel.apache.ode.deploy.model.dd.DocumentRoot;
import org.eclipse.bpel.apache.ode.deploy.model.dd.ProcessType;
@@ -59,6 +61,8 @@
// Display this in title if no BPEL process files are found in current directory
private final static String NO_PROCESSES_FOUND = " *** No Processes Found *** ";
private boolean readOnly = false;
+ // if BPEL processes were added or deleted, DD model is not in sync and needs to be saved
+ private boolean modelInSync = true;
protected TDeployment deployDescriptor = null;
protected AdapterFactoryEditingDomain editingDomain;
@@ -79,6 +83,7 @@
commitPages(true);
saveDeploymentDescriptor();
((BasicCommandStack) editingDomain.getCommandStack()).saveIsDone();
+ modelInSync = true;
firePropertyChange(IEditorPart.PROP_DIRTY);
}
@@ -186,9 +191,11 @@
@Override
public boolean isDirty() {
- return !readOnly
- && ((BasicCommandStack) editingDomain.getCommandStack())
- .isSaveNeeded();
+ return !readOnly &&
+ (
+ ((BasicCommandStack) editingDomain.getCommandStack()).isSaveNeeded() ||
+ !modelInSync
+ );
}
@Override
@@ -228,11 +235,13 @@
deployDescriptor.getProcess().add(pt);
// set model
pt.setModel(p);
- readOnly = true; // can't save editor
+ readOnly = true; // can't save editor anyway
+ modelInSync = true; // so it might as well be in sync
}
}
public void populateModel() throws CoreException {
+ final Vector<ProcessType> processesFound = new Vector<ProcessType>();
((IFileEditorInput) getEditorInput()).getFile().getProject().accept(new IResourceVisitor() {
public boolean visit(IResource bpelfile) throws CoreException {
// https://jira.jboss.org/jira/browse/JBIDE-6006
@@ -244,14 +253,26 @@
if (pt == null) {
pt = DeployUtils.createProcessStub(p);
deployDescriptor.getProcess().add(pt);
+ modelInSync = false; // need to do a save
}
// set model
pt.setModel(p);
-
+ processesFound.add(pt);
}
- }
+ }
return true;
}
});
+ Vector<ProcessType> processesToDelete = new Vector<ProcessType>();
+ for(ProcessType pt : deployDescriptor.getProcess())
+ {
+ if (!processesFound.contains(pt))
+ processesToDelete.add(pt);
+ }
+ if ( processesToDelete.size()>0)
+ {
+ deployDescriptor.getProcess().removeAll(processesToDelete);
+ modelInSync = false; // need to do a save
+ }
}
}
14 years, 8 months
JBoss Tools SVN: r21787 - in trunk: tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-04-28 14:55:26 -0400 (Wed, 28 Apr 2010)
New Revision: 21787
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6234 Added JUnit test.
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-04-28 17:56:44 UTC (rev 21786)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-04-28 18:55:26 UTC (rev 21787)
@@ -234,7 +234,8 @@
*/
public void testInitializerMethodHasParameterAnnotatedDisposes() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/initializer/broken/parameterAnnotatedDisposes/Capercaillie_Broken.java");
- AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DISPOSER_ANNOTATED_INJECT, 25, 26);
+ AbstractResourceMarkerTest.assertMarkerIsCreatedForGivenPosition(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DISPOSER_ANNOTATED_INJECT, 25, 1003, 1010);
+ AbstractResourceMarkerTest.assertMarkerIsCreatedForGivenPosition(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.DISPOSER_ANNOTATED_INJECT, 26, 1048, 1057);
}
/**
Modified: trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java 2010-04-28 17:56:44 UTC (rev 21786)
+++ trunk/tests/plugins/org.jboss.tools.tests/src/org/jboss/tools/tests/AbstractResourceMarkerTest.java 2010-04-28 18:55:26 UTC (rev 21787)
@@ -118,6 +118,29 @@
}
}
+ public static void assertMarkerIsCreatedForGivenPosition(
+ IResource resource, String type, String pattern, int lineNumber,
+ int startPosition, int endPosition) throws CoreException {
+
+ IMarker[] markers = findMarkers(resource, type, pattern);
+ StringBuffer sb = new StringBuffer("[");
+ for (int i = 0; i < markers.length; i++) {
+ int line = markers[i].getAttribute(IMarker.LINE_NUMBER, -1);
+ int start = markers[i].getAttribute(IMarker.CHAR_START, -1);
+ int end = markers[i].getAttribute(IMarker.CHAR_END, -1);
+ if(lineNumber==line && start == startPosition && end == endPosition) {
+ return;
+ }
+ if(i>0) {
+ sb.append("; ");
+ }
+ sb.append("line number - ").append(line).append(", start - ").append(start).append(", end - ").append(end);
+ }
+ sb.append("]");
+
+ fail("Marker matches the '" + pattern + "' pattern wasn't found for line - " + lineNumber + ", start - " + startPosition + ", end - " + endPosition + ". Found markers for given patern: " + sb.toString()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
public static void assertMarkerIsNotCreated(IResource resource, String type, String pattern) throws CoreException {
IMarker[] markers = findMarkers(resource, type, pattern);
14 years, 8 months
JBoss Tools SVN: r21786 - in trunk/cdi: tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2010-04-28 13:56:44 -0400 (Wed, 28 Apr 2010)
New Revision: 21786
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2708 Fixed "Non-static method of a session bean class has a parameter annotated @Disposes, and the method is not a business method of the session bean" validation rule.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-04-28 17:23:21 UTC (rev 21785)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDICoreValidator.java 2010-04-28 17:56:44 UTC (rev 21786)
@@ -394,16 +394,16 @@
IAnnotation annotation = sourceType.getAnnotation(CDIConstants.LOCAL_ANNOTATION_TYPE_NAME);
if(annotation==null) {
annotation = sourceType.getAnnotation("Local"); //$NON-NLS-N1
- if(annotation!=null && CDIConstants.LOCAL_ANNOTATION_TYPE_NAME.equals(EclipseJavaUtil.resolveType(sourceType, "Local"))) { //$NON-NLS-N1
- IMethod[] methods = sourceType.getMethods();
- for (IMethod iMethod : methods) {
- if(method.getMethod().isSimilar(iMethod)) {
- businessMethod = true;
- break;
- }
+ }
+ if(annotation!=null && CDIConstants.LOCAL_ANNOTATION_TYPE_NAME.equals(EclipseJavaUtil.resolveType(sourceType, "Local"))) { //$NON-NLS-N1
+ IMethod[] methods = sourceType.getMethods();
+ for (IMethod iMethod : methods) {
+ if(method.getMethod().isSimilar(iMethod)) {
+ businessMethod = true;
+ break;
}
- break;
}
+ break;
}
}
if(!businessMethod) {
Modified: trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-04-28 17:23:21 UTC (rev 21785)
+++ trunk/cdi/tests/org.jboss.tools.cdi.core.test/src/org/jboss/tools/cdi/core/test/tck/ValidationTest.java 2010-04-28 17:56:44 UTC (rev 21786)
@@ -212,6 +212,8 @@
public void testDisposalMethodNotBusinessOrStatic() throws Exception {
IFile file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/disposal/method/definition/broken/methodOnSessionBean/AppleTree.java");
AbstractResourceMarkerTest.assertMarkerIsCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_DISPOSER_IN_SESSION_BEAN, 31);
+ file = tckProject.getFile("JavaSource/org/jboss/jsr299/tck/tests/implementation/enterprise/newBean/Fox.java");
+ AbstractResourceMarkerTest.assertMarkerIsNotCreated(file, AbstractResourceMarkerTest.MARKER_TYPE, CDIValidationMessages.ILLEGAL_DISPOSER_IN_SESSION_BEAN, 73);
}
/**
14 years, 8 months
JBoss Tools SVN: r21785 - in trunk: jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2010-04-28 13:23:21 -0400 (Wed, 28 Apr 2010)
New Revision: 21785
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/contentassist/
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/contentassist/XHTMLContentAssistProcessor.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/contentassist/XHTMLTemplateCompletionProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/schema/editorContentAssistent.exsd
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/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/HTMLTextViewerConfiguration.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-6131, source code vpe-templates has been added as proposals to CA, draft version
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2010-04-28 16:04:31 UTC (rev 21784)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2010-04-28 17:23:21 UTC (rev 21785)
@@ -518,5 +518,9 @@
</newWizardShortcut>
</perspectiveExtension>
</extension>
+ <extension
+ point="org.jboss.tools.jst.jsp.editorContentAssistent">
+ <contentassisten class="org.jboss.tools.jsf.ui.editor.pref.template.contentassist.XHTMLContentAssistProcessor"/>
+ </extension>
</plugin>
Added: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/contentassist/XHTMLContentAssistProcessor.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/contentassist/XHTMLContentAssistProcessor.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/contentassist/XHTMLContentAssistProcessor.java 2010-04-28 17:23:21 UTC (rev 21785)
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.ui.editor.pref.template.contentassist;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.text.contentassist.IContextInformation;
+import org.eclipse.jface.text.contentassist.IContextInformationValidator;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.jboss.tools.jsf.ui.JsfUiPlugin;
+import org.jboss.tools.jsf.ui.editor.pref.template.TemplateContextTypeIdsXHTML;
+import org.w3c.dom.Node;
+
+/**
+ * XHTML Contetn assist processor, processor which add's templates
+ * proposals to CA
+ *
+ * @author mareshkau
+ *
+ */
+public class XHTMLContentAssistProcessor implements IContentAssistProcessor,
+ IPropertyChangeListener {
+
+ protected IPreferenceStore fPreferenceStore = null;
+ protected boolean isXHTML = false;
+ private XHTMLTemplateCompletionProcessor fTemplateProcessor = null;
+
+ public XHTMLContentAssistProcessor() {
+
+ super();
+ }
+
+ /**
+ * Add the proposals for a completely empty document
+ */
+ // protected void addEmptyDocumentProposals(List<ICompletionProposal>
+ // contentAssistRequest) {
+ // addTemplates(contentAssistRequest, TemplateContextTypeIdsXHTML.NEW);
+ // }
+
+ // protected void addStartDocumentProposals(List<ICompletionProposal>
+ // contentAssistRequest) {
+ // if (isXHTML)
+ // addEmptyDocumentProposals(contentAssistRequest);
+ // }
+
+ // protected void addTagInsertionProposals(List<ICompletionProposal>
+ // contentAssistRequest, int childPosition) {
+ // addTemplates(contentAssistRequest, TemplateContextTypeIdsXHTML.TAG);
+ // }
+
+ /**
+ * Adds templates to the list of proposals
+ *
+ * @param contentAssistRequest
+ * @param context
+ */
+ // private void addTemplates(List<ICompletionProposal> contentAssistRequest,
+ // String context) {
+ // addTemplates(contentAssistRequest, context,
+ // contentAssistRequest.getReplacementBeginPosition());
+ // }
+
+ /**
+ * Adds templates to the list of proposals
+ *
+ * @param contentAssistRequest
+ * @param context
+ * @param startOffset
+ */
+ private void addTemplates(ITextViewer fTextViewer,
+ List<ICompletionProposal> contentAssistRequest,
+ List<String> fTemplateContexts, int startOffset) {
+ if (contentAssistRequest == null)
+ return;
+
+ // if already adding template proposals for a certain context type, do
+ // not add again
+ if (getTemplateCompletionProcessor() != null) {
+ for (String context : fTemplateContexts) {
+ getTemplateCompletionProcessor().setContextType(context);
+ ICompletionProposal[] proposals = getTemplateCompletionProcessor()
+ .computeCompletionProposals(fTextViewer, startOffset);
+ for (int i = 0; i < proposals.length; ++i) {
+ contentAssistRequest.add(proposals[i]);
+ }
+ }
+ }
+ }
+
+ protected boolean beginsWith(String aString, String prefix) {
+ if (aString == null || prefix == null || prefix.length() == 0)
+ return true;
+ int minimumLength = Math.min(prefix.length(), aString.length());
+ String beginning = aString.substring(0, minimumLength);
+ return beginning.equalsIgnoreCase(prefix);
+ }
+
+ // protected List<ICompletionProposal>
+ // computeCompletionProposals(ITextViewer textViewer, int documentPosition)
+ // {
+ // List<ICompletionProposal> request=new ArrayList<ICompletionProposal>();
+ // addTemplates(textViewer,request, TemplateContextTypeIdsXHTML.ALL,
+ // documentPosition);
+ // return request;
+ // }
+
+ /**
+ * Return a list of proposed code completions based on the specified
+ * location within the document that corresponds to the current cursor
+ * position within the text-editor control.
+ *
+ * @param documentPosition
+ * a location within the document
+ * @return an array of code-assist items
+ */
+ public ICompletionProposal[] computeCompletionProposals(
+ ITextViewer textViewer, int documentPosition) {
+ List<ICompletionProposal> result = new ArrayList<ICompletionProposal>();
+ List<String> fContextTypes = new ArrayList<String>();
+ //TODO Maksim Areshkau, analize and position here
+ fContextTypes.add(TemplateContextTypeIdsXHTML.ALL);
+ fContextTypes.add(TemplateContextTypeIdsXHTML.TAG);
+ fContextTypes.add(TemplateContextTypeIdsXHTML.NEW);
+ fContextTypes.add(TemplateContextTypeIdsXHTML.ATTRIBUTE);
+ fContextTypes.add(TemplateContextTypeIdsXHTML.ATTRIBUTE_VALUE);
+ addTemplates(textViewer, result, fContextTypes,
+ documentPosition);
+ return result.toArray(new ICompletionProposal[0]);
+ }
+
+ protected String getEmptyTagCloseString() {
+ if (isXHTML)
+ return " />"; //$NON-NLS-1$
+ return ">"; //$NON-NLS-1$
+ }
+
+ private XHTMLTemplateCompletionProcessor getTemplateCompletionProcessor() {
+ if (this.fTemplateProcessor == null) {
+ this.fTemplateProcessor = new XHTMLTemplateCompletionProcessor();
+ }
+ return this.fTemplateProcessor;
+ }
+
+ /**
+ * Determine if this Document is an XHTML Document. Oprates solely off of
+ * the Document Type declaration
+ */
+ protected boolean getXHTML(Node node) {
+ // TODO Maksim Areshkau, implement it
+ return true;
+ }
+
+ protected void init() {
+ getPreferenceStore().addPropertyChangeListener(this);
+ }
+
+ public void release() {
+ getPreferenceStore().removePropertyChangeListener(this);
+ }
+
+ protected boolean stringsEqual(String a, String b) {
+ return a.equalsIgnoreCase(b);
+ }
+
+ public void propertyChange(PropertyChangeEvent event) {
+ String property = event.getProperty();
+ }
+
+ protected IPreferenceStore getPreferenceStore() {
+ if (this.fPreferenceStore == null)
+ this.fPreferenceStore = JsfUiPlugin.getDefault().getPreferenceStore();
+
+ return this.fPreferenceStore;
+ }
+
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer,
+ int documentPosition, IndexedRegion indexedNode, ITextRegion region) {
+ return computeCompletionProposals(viewer, documentPosition);
+ }
+
+ public IContextInformation[] computeContextInformation(ITextViewer viewer,
+ int offset) {
+
+ return new IContextInformation[0];
+ }
+
+ public char[] getCompletionProposalAutoActivationCharacters() {
+ return new char[0];
+ }
+
+ public char[] getContextInformationAutoActivationCharacters() {
+ return new char[0];
+ }
+
+ public IContextInformationValidator getContextInformationValidator() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getErrorMessage() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Added: trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/contentassist/XHTMLTemplateCompletionProcessor.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/contentassist/XHTMLTemplateCompletionProcessor.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/editor/pref/template/contentassist/XHTMLTemplateCompletionProcessor.java 2010-04-28 17:23:21 UTC (rev 21785)
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2010 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.ui.editor.pref.template.contentassist;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.templates.ContextTypeRegistry;
+import org.eclipse.jface.text.templates.Template;
+import org.eclipse.jface.text.templates.TemplateCompletionProcessor;
+import org.eclipse.jface.text.templates.TemplateContext;
+import org.eclipse.jface.text.templates.TemplateContextType;
+import org.eclipse.jface.text.templates.TemplateException;
+import org.eclipse.jface.text.templates.TemplateProposal;
+import org.eclipse.jface.text.templates.persistence.TemplateStore;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.html.ui.internal.contentassist.ReplaceNameTemplateContext;
+import org.jboss.tools.jsf.ui.JsfUiPlugin;
+
+
+/**
+ * This class copy of HTMLTemplateCompletionProcessor, because it easiest way to
+ * use this I haven't founded a possibility to extends from class and ovveride it
+ *
+ * @author mareshkau
+ *
+ */
+public class XHTMLTemplateCompletionProcessor extends TemplateCompletionProcessor {
+
+ private static final class ProposalComparator implements Comparator<TemplateProposal> {
+ public int compare(TemplateProposal o1, TemplateProposal o2) {
+ return o2.getRelevance() - o1.getRelevance();
+ }
+ }
+
+ private static final Comparator<TemplateProposal> fgProposalComparator = new ProposalComparator();
+ private String fContextTypeId = null;
+
+ /*
+ * Copied from super class except instead of calling createContext(viewer,
+ * region) call createContext(viewer, region, offset) instead
+ */
+ @Override
+ public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) {
+
+ ITextSelection selection = (ITextSelection) viewer.getSelectionProvider().getSelection();
+
+ // adjust offset to end of normalized selection
+ if (selection.getOffset() == offset)
+ offset = selection.getOffset() + selection.getLength();
+
+ String prefix = extractPrefix(viewer, offset);
+ Region region = new Region(offset - prefix.length(), prefix.length());
+ TemplateContext context = createContext(viewer, region, offset);
+ if (context == null)
+ return new ICompletionProposal[0];
+ // name of the selection variables {line, word}_selection
+ context.setVariable("selection", selection.getText()); //$NON-NLS-1$
+
+ Template[] templates = getTemplates(context.getContextType().getId());
+
+ List matches = new ArrayList();
+ for (int i = 0; i < templates.length; i++) {
+ Template template = templates[i];
+ try {
+ context.getContextType().validate(template.getPattern());
+ }
+ catch (TemplateException e) {
+ continue;
+ }
+ if (template.matches(prefix, context.getContextType().getId()))
+ matches.add(createProposal(template, context, (IRegion) region, getRelevance(template, prefix)));
+ }
+
+ Collections.sort(matches, fgProposalComparator);
+
+ return (ICompletionProposal[]) matches.toArray(new ICompletionProposal[matches.size()]);
+ }
+
+ /**
+ * Creates a concrete template context for the given region in the
+ * document. This involves finding out which context type is valid at the
+ * given location, and then creating a context of this type. The default
+ * implementation returns a <code>SmartReplaceTemplateContext</code> for
+ * the context type at the given location. This takes the offset at which
+ * content assist was invoked into consideration.
+ *
+ * @param viewer
+ * the viewer for which the context is created
+ * @param region
+ * the region into <code>document</code> for which the
+ * context is created
+ * @param offset
+ * the original offset where content assist was invoked
+ * @return a template context that can handle template insertion at the
+ * given location, or <code>null</code>
+ */
+ private TemplateContext createContext(ITextViewer viewer, IRegion region, int offset) {
+ // pretty much same code as super.createContext except create
+ // SmartReplaceTemplateContext
+ TemplateContextType contextType = getContextType(viewer, region);
+ if (contextType != null) {
+ IDocument document = viewer.getDocument();
+ return new ReplaceNameTemplateContext(contextType, document, region.getOffset(), region.getLength(), offset);
+ }
+ return null;
+ }
+
+ protected ICompletionProposal createProposal(Template template, TemplateContext context, IRegion region, int relevance) {
+ return new TemplateProposal(template, context, region, getImage(template), relevance);
+ }
+
+ protected TemplateContextType getContextType(ITextViewer viewer, IRegion region) {
+ TemplateContextType type = null;
+
+ ContextTypeRegistry registry = getTemplateContextRegistry();
+ if (registry != null)
+ type = registry.getContextType(fContextTypeId);
+
+ return type;
+ }
+
+// protected Image getImage(Template template) {
+// // just return the same image for now
+// return HTMLEditorPluginImageHelper.getInstance().getImage(HTMLEditorPluginImages.IMG_OBJ_TAG_TEMPLATE);
+// }
+
+ private ContextTypeRegistry getTemplateContextRegistry() {
+ return JsfUiPlugin.getDefault().getTemplateContextRegistry();
+ }
+
+ protected Template[] getTemplates(String contextTypeId) {
+ Template templates[] = null;
+
+ TemplateStore store = getTemplateStore();
+ if (store != null)
+ templates = store.getTemplates(contextTypeId);
+
+ return templates;
+ }
+
+ private TemplateStore getTemplateStore() {
+ return JsfUiPlugin.getDefault().getTemplateStore();
+ }
+
+ void setContextType(String contextTypeId) {
+ fContextTypeId = contextTypeId;
+ }
+
+ @Override
+ protected Image getImage(Template template) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2010-04-28 16:04:31 UTC (rev 21784)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2010-04-28 17:23:21 UTC (rev 21785)
@@ -5,7 +5,8 @@
<extension-point id="occurrenceStructureProviders"
name="%occurrenceStructureProvidersExtensionPoint" />
<extension-point id="visulaEditorImplementations" name="Visual Editor Implementations" schema="schema/visulaEditorImplementations.exsd">
- </extension-point>
+ </extension-point>
+ <extension-point id="editorContentAssistent" name="editorContentAssistent" schema="schema/editorContentAssistent.exsd"/>
<extension point="org.eclipse.wst.sse.ui.editorConfiguration">
<sourceViewerConfiguration
Added: trunk/jst/plugins/org.jboss.tools.jst.jsp/schema/editorContentAssistent.exsd
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/schema/editorContentAssistent.exsd (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/schema/editorContentAssistent.exsd 2010-04-28 17:23:21 UTC (rev 21785)
@@ -0,0 +1,99 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.jst.jsp" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.tools.jst.jsp" id="editorContentAssistent" name="editorContentAssistent"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="contentassisten">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.jface.text.contentassist.IContentAssistProcessor" deprecated="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Modified: 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/HTMLTextViewerConfiguration.java 2010-04-28 16:04:31 UTC (rev 21784)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/HTMLTextViewerConfiguration.java 2010-04-28 17:23:21 UTC (rev 21785)
@@ -7,11 +7,20 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.jst.jsp;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.text.ITextHover;
import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
import org.eclipse.jface.text.formatter.IContentFormatter;
@@ -30,67 +39,100 @@
import org.eclipse.wst.sse.ui.internal.taginfo.TextHoverManager;
import org.jboss.tools.jst.jsp.format.HTMLFormatProcessor;
import org.jboss.tools.jst.jsp.jspeditor.info.ChainTextHover;
+import org.osgi.framework.Bundle;
@SuppressWarnings("restriction")
-public class HTMLTextViewerConfiguration extends StructuredTextViewerConfigurationHTML implements ITextViewerConfiguration{
+public class HTMLTextViewerConfiguration extends
+ StructuredTextViewerConfigurationHTML implements
+ ITextViewerConfiguration {
- TextViewerConfigurationDelegate configurationDelegate;
+ TextViewerConfigurationDelegate configurationDelegate;
+
+ private static final String TEMPLATES_CONTENT_ASSISTANT = "org.jboss.tools.jst.jsp.editorContentAssistent"; //$NON-NLS-1$
+ private static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
+
public HTMLTextViewerConfiguration() {
super();
configurationDelegate = new TextViewerConfigurationDelegate(this);
}
- protected IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
- return configurationDelegate.getContentAssistProcessors(sourceViewer, partitionType);
+ protected IContentAssistProcessor[] getContentAssistProcessors(
+ ISourceViewer sourceViewer, String partitionType) {
+ return configurationDelegate.getContentAssistProcessors(sourceViewer,
+ partitionType);
}
/*
- * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getHyperlinkDetectors(org.eclipse.jface.text.source.ISourceViewer)
+ * @see
+ * org.eclipse.jface.text.source.SourceViewerConfiguration#getHyperlinkDetectors
+ * (org.eclipse.jface.text.source.ISourceViewer)
+ *
* @since 3.1
*/
public IHyperlinkDetector[] getHyperlinkDetectors(ISourceViewer sourceViewer) {
- return configurationDelegate.getHyperlinkDetectors(
- sourceViewer,
- fPreferenceStore.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED));
+ return configurationDelegate
+ .getHyperlinkDetectors(
+ sourceViewer,
+ fPreferenceStore
+ .getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HYPERLINKS_ENABLED));
}
/*
* (non-Javadoc)
- * @see org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTML#getContentFormatter(org.eclipse.jface.text.source.ISourceViewer)
+ *
+ * @seeorg.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()));
+ MultiPassContentFormatter formatter = new MultiPassContentFormatter(
+ getConfiguredDocumentPartitioning(sourceViewer),
+ IHTMLPartitions.HTML_DEFAULT);
+ formatter.setMasterStrategy(new StructuredFormattingStrategy(
+ new HTMLFormatProcessor()));
return formatter;
}
public IContentAssistProcessor[] getContentAssistProcessorsForPartitionType(
ISourceViewer sourceViewer, String partitionType) {
- return super.getContentAssistProcessors(sourceViewer, partitionType);
+ IContentAssistProcessor[] results = super.getContentAssistProcessors(
+ sourceViewer, partitionType);
+ // added by Maksim Areshkau
+ if ("org.eclipse.wst.html.HTML_DEFAULT".equalsIgnoreCase(partitionType)) { //$NON-NLS-1$
+ List<IContentAssistProcessor> contAssists = getVpeTestExtensions();
+ contAssists.addAll(Arrays.asList(results));
+ results = contAssists.toArray(new IContentAssistProcessor[0]);
+ }
+ return results;
}
/**
* Create documentation hovers based on hovers contributed via
- * <code>org.eclipse.wst.sse.ui.editorConfiguration</code> extension
- * point
+ * <code>org.eclipse.wst.sse.ui.editorConfiguration</code> extension point
*
- * Copied from {@link org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration} because of private modifier
+ * Copied from
+ * {@link org.eclipse.wst.sse.ui.StructuredTextViewerConfiguration} because
+ * of private modifier
*
* @param partitionType
* @return
*/
@SuppressWarnings("unchecked")
private ITextHover[] createDocumentationHovers(String partitionType) {
- List extendedTextHover = ExtendedConfigurationBuilder.getInstance().getConfigurations(ExtendedConfigurationBuilder.DOCUMENTATIONTEXTHOVER, partitionType);
- ITextHover[] hovers = (ITextHover[]) extendedTextHover.toArray(new ITextHover[extendedTextHover.size()]);
+ List extendedTextHover = ExtendedConfigurationBuilder.getInstance()
+ .getConfigurations(
+ ExtendedConfigurationBuilder.DOCUMENTATIONTEXTHOVER,
+ partitionType);
+ ITextHover[] hovers = (ITextHover[]) extendedTextHover
+ .toArray(new ITextHover[extendedTextHover.size()]);
return hovers;
}
@Override
protected IInformationProvider getInformationProvider(
ISourceViewer sourceViewer, String partitionType) {
-
- ITextHover chainTextHover = new ChainTextHover(createDocumentationHovers(partitionType));
+
+ ITextHover chainTextHover = new ChainTextHover(
+ createDocumentationHovers(partitionType));
return new TextHoverInformationProvider(chainTextHover);
}
@@ -100,21 +142,27 @@
ITextHover textHover = null;
/*
- * Returns a default problem, annotation, and best match hover
- * depending on stateMask
+ * Returns a default problem, annotation, and best match hover depending
+ * on stateMask
*/
- TextHoverManager.TextHoverDescriptor[] hoverDescs = SSEUIPlugin.getDefault().getTextHoverManager().getTextHovers();
+ TextHoverManager.TextHoverDescriptor[] hoverDescs = SSEUIPlugin
+ .getDefault().getTextHoverManager().getTextHovers();
int i = 0;
while (i < hoverDescs.length && textHover == null) {
- if (hoverDescs[i].isEnabled() && computeStateMask(hoverDescs[i].getModifierString()) == stateMask) {
+ if (hoverDescs[i].isEnabled()
+ && computeStateMask(hoverDescs[i].getModifierString()) == stateMask) {
String hoverType = hoverDescs[i].getId();
if (TextHoverManager.PROBLEM_HOVER.equalsIgnoreCase(hoverType))
textHover = new ProblemAnnotationHoverProcessor();
- else if (TextHoverManager.ANNOTATION_HOVER.equalsIgnoreCase(hoverType))
+ else if (TextHoverManager.ANNOTATION_HOVER
+ .equalsIgnoreCase(hoverType))
textHover = new AnnotationHoverProcessor();
- else if (TextHoverManager.COMBINATION_HOVER.equalsIgnoreCase(hoverType))
- textHover = new ChainTextHover(createDocumentationHovers(contentType));
- else if (TextHoverManager.DOCUMENTATION_HOVER.equalsIgnoreCase(hoverType)) {
+ else if (TextHoverManager.COMBINATION_HOVER
+ .equalsIgnoreCase(hoverType))
+ textHover = new ChainTextHover(
+ createDocumentationHovers(contentType));
+ else if (TextHoverManager.DOCUMENTATION_HOVER
+ .equalsIgnoreCase(hoverType)) {
ITextHover[] hovers = createDocumentationHovers(contentType);
if (hovers.length > 0) {
textHover = hovers[0];
@@ -125,6 +173,30 @@
}
return textHover;
}
-
-
-}
\ No newline at end of file
+
+ /**
+ * Returns all extensions of {@value #VPE_TEST_EXTENTION_POINT_ID}
+ */
+ public List<IContentAssistProcessor> getVpeTestExtensions() {
+ IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
+ IExtensionPoint extensionPoint = extensionRegistry
+ .getExtensionPoint(TEMPLATES_CONTENT_ASSISTANT);
+ IExtension[] extensions = extensionPoint.getExtensions();
+ List<IContentAssistProcessor> contentAssisteProcessors = new ArrayList<IContentAssistProcessor>();
+ for (IExtension extension : extensions) {
+ IConfigurationElement[] confElements = extension
+ .getConfigurationElements();
+ for (IConfigurationElement configurationElement : confElements) {
+ IContentAssistProcessor contentAssistProcessor;
+ try {
+ contentAssistProcessor = (IContentAssistProcessor) configurationElement
+ .createExecutableExtension(CLASS_ATTRIBUTE);
+ contentAssisteProcessors.add(contentAssistProcessor);
+ } catch (CoreException e) {
+ JspEditorPlugin.getPluginLog().logError(e);
+ }
+ }
+ }
+ return contentAssisteProcessors;
+ }
+}
14 years, 8 months