JBoss Tools SVN: r31121 - in trunk/jmx/plugins: org.jboss.tools.jmx.ui/META-INF and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-05-06 03:01:52 -0400 (Fri, 06 May 2011)
New Revision: 31121
Modified:
trunk/jmx/plugins/org.jboss.tools.jmx.core/META-INF/MANIFEST.MF
trunk/jmx/plugins/org.jboss.tools.jmx.ui/META-INF/MANIFEST.MF
Log:
JBIDE-8866 - updating manifest versions to new baseline
Modified: trunk/jmx/plugins/org.jboss.tools.jmx.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/jmx/plugins/org.jboss.tools.jmx.core/META-INF/MANIFEST.MF 2011-05-06 07:01:08 UTC (rev 31120)
+++ trunk/jmx/plugins/org.jboss.tools.jmx.core/META-INF/MANIFEST.MF 2011-05-06 07:01:52 UTC (rev 31121)
@@ -5,7 +5,7 @@
Bundle-Version: 1.2.0.qualifier
Bundle-Activator: org.jboss.tools.jmx.core.JMXActivator
Bundle-Vendor: %BundleProvider
-Require-Bundle: org.eclipse.core.runtime,
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0",
org.jboss.tools.usage;bundle-version="1.0.0";resolution:=optional
Export-Package: org.jboss.tools.jmx.core,
org.jboss.tools.jmx.core.providers;
Modified: trunk/jmx/plugins/org.jboss.tools.jmx.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/jmx/plugins/org.jboss.tools.jmx.ui/META-INF/MANIFEST.MF 2011-05-06 07:01:08 UTC (rev 31120)
+++ trunk/jmx/plugins/org.jboss.tools.jmx.ui/META-INF/MANIFEST.MF 2011-05-06 07:01:52 UTC (rev 31121)
@@ -5,11 +5,11 @@
Bundle-Version: 1.2.0.qualifier
Bundle-Activator: org.jboss.tools.jmx.ui.JMXUIActivator
Bundle-Vendor: %BundleProvider
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.ui.views,
- org.eclipse.ui.forms;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.ui.navigator;bundle-version="3.3.100",
+Require-Bundle: org.eclipse.ui;bundle-version="3.7.0",
+ org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.eclipse.ui.views;bundle-version="3.6.0",
+ org.eclipse.ui.forms;bundle-version="3.5.100",
+ org.eclipse.ui.navigator;bundle-version="3.5.0",
org.jboss.tools.jmx.core;bundle-version="[1.0.0,2.0.0)"
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
13 years, 2 months
JBoss Tools SVN: r31120 - in trunk/as/plugins: org.jboss.ide.eclipse.as.management.as7/META-INF and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-05-06 03:01:08 -0400 (Fri, 06 May 2011)
New Revision: 31120
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF
Log:
JBIDE-8866 - updating manifest versions to new baseline
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/META-INF/MANIFEST.MF 2011-05-06 02:01:11 UTC (rev 31119)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.jmx.integration/META-INF/MANIFEST.MF 2011-05-06 07:01:08 UTC (rev 31120)
@@ -4,8 +4,8 @@
Bundle-SymbolicName: org.jboss.ide.eclipse.as.jmx.integration;singleton:=true
Bundle-Version: 0.9.0.qualifier
Bundle-Activator: org.jboss.ide.eclipse.as.jmx.integration.Activator
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
+Require-Bundle: org.eclipse.ui;bundle-version="3.7.0",
+ org.eclipse.core.runtime;bundle-version="3.7.0",
org.jboss.ide.eclipse.as.core,
org.eclipse.wst.server.core;bundle-version="1.1.302",
org.jboss.tools.jmx.core;bundle-version="1.2.0",
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF 2011-05-06 02:01:11 UTC (rev 31119)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.management.as7/META-INF/MANIFEST.MF 2011-05-06 07:01:08 UTC (rev 31120)
@@ -4,8 +4,8 @@
Bundle-SymbolicName: org.jboss.ide.eclipse.as.management.as7
Bundle-Version: 0.2.0.qualifier
Bundle-Activator: org.jboss.ide.eclipse.as.management.as7.Activator
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
+Require-Bundle: org.eclipse.ui;bundle-version="3.7.0",
+ org.eclipse.core.runtime;bundle-version="3.7.0",
org.jboss.ide.eclipse.as.core
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF 2011-05-06 02:01:11 UTC (rev 31119)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/META-INF/MANIFEST.MF 2011-05-06 07:01:08 UTC (rev 31120)
@@ -49,8 +49,8 @@
org.eclipse.jem.util;bundle-version="2.1.2",
org.apache.ant;bundle-version="1.7.1",
org.jboss.ide.eclipse.as.core,
- org.eclipse.ui.navigator;bundle-version="[3.5.0,4.0.0)",
- org.eclipse.ui.views.log;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.ui.navigator;bundle-version="3.5.0",
+ org.eclipse.ui.views.log;bundle-version="1.0.200",
org.eclipse.jst.j2ee.core;bundle-version="1.2.100"
Bundle-ActivationPolicy: lazy
Export-Package: org.jboss.ide.eclipse.as.ui,
13 years, 2 months
JBoss Tools SVN: r31119 - trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-05-05 22:01:11 -0400 (Thu, 05 May 2011)
New Revision: 31119
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/SeamConfigXmlCompletionProposalComputer.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/TagData.java
Log:
JBIDE-8842
https://issues.jboss.org/browse/JBIDE-8842
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/SeamConfigXmlCompletionProposalComputer.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/SeamConfigXmlCompletionProposalComputer.java 2011-05-06 01:24:53 UTC (rev 31118)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/SeamConfigXmlCompletionProposalComputer.java 2011-05-06 02:01:11 UTC (rev 31119)
@@ -40,18 +40,24 @@
import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImages;
import org.jboss.tools.cdi.core.CDICoreNature;
import org.jboss.tools.cdi.core.CDICorePlugin;
-import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.seam.config.core.CDISeamConfigConstants;
import org.jboss.tools.cdi.seam.config.core.CDISeamConfigExtension;
import org.jboss.tools.cdi.seam.config.core.util.Util;
import org.jboss.tools.cdi.seam.config.core.xml.SAXElement;
import org.jboss.tools.cdi.seam.config.ui.CDISeamConfigUIPlugin;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.jboss.tools.common.xml.XMLUtilities;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
-public class SeamConfigXmlCompletionProposalComputer extends AbstractXMLModelQueryCompletionProposalComputer {
+public class SeamConfigXmlCompletionProposalComputer extends AbstractXMLModelQueryCompletionProposalComputer implements CDISeamConfigConstants {
+ static int RELEVANCE_TAG = XMLRelevanceConstants.R_STRICTLY_VALID_TAG_NAME;
+ static int RELEVANCE_TAG_KEYWORD = RELEVANCE_TAG - 1;
+ static int RELEVANCE_TAG_ANNOTATION = RELEVANCE_TAG_KEYWORD - 1;
+ static int RELEVANCE_TAG_MEMBER = RELEVANCE_TAG_ANNOTATION - 1;
+ static int RELEVANCE_TAG_TYPE = RELEVANCE_TAG_MEMBER - 1;
+
CompletionProposalInvocationContext context;
Node currentNode;
SAXElement sax;
@@ -159,8 +165,8 @@
if(Util.isEntry(sax)) {
//Inside entry - only <key> and <value>
if(eePrefix != null) {
- addTagData(tagData, eePrefix, CDISeamConfigConstants.KEYWORD_KEY, XMLRelevanceConstants.R_STRICTLY_VALID_TAG_NAME - 1);
- addTagData(tagData, eePrefix, CDISeamConfigConstants.KEYWORD_VALUE, XMLRelevanceConstants.R_STRICTLY_VALID_TAG_NAME - 1);
+ addTagData(tagData, eePrefix, KEYWORD_KEY, true, RELEVANCE_TAG_KEYWORD);
+ addTagData(tagData, eePrefix, KEYWORD_VALUE, true, RELEVANCE_TAG_KEYWORD);
}
} else if(Util.isValue(sax) || Util.isKey(sax)) {
//Inside value or key we can define new bean.
@@ -170,30 +176,27 @@
} else if((contextType = Util.resolveType(sax, cdi)) != null) {
//We are inside bean. Suggest members and annotations.
addTypeNames(tagData, true); //only annotations allowed here.
- addTagData(tagData, getTagNamesForMembers(parentElementPrefix, contextType), XMLRelevanceConstants.R_STRICTLY_VALID_TAG_NAME - 2);
+ addTagData(tagData, getTagNamesForMembers(parentElementPrefix, contextType), RELEVANCE_TAG_MEMBER);
if(eePrefix != null) {
- TagData d = new TagData(eePrefix + ":" + CDISeamConfigConstants.KEYWORD_MODIFIES, XMLRelevanceConstants.R_STRICTLY_VALID_TAG_NAME - 1);
- d.hasClosingTag = false;
- tagData.add(d);
- d = new TagData(eePrefix + ":" + CDISeamConfigConstants.KEYWORD_REPLACES, XMLRelevanceConstants.R_STRICTLY_VALID_TAG_NAME - 1);
- tagData.add(d);
+ addTagData(tagData, eePrefix, KEYWORD_MODIFIES, false, true, RELEVANCE_TAG_KEYWORD);
+ addTagData(tagData, eePrefix, KEYWORD_REPLACES, false, true, RELEVANCE_TAG_KEYWORD);
}
} else if(sax.getParent() != null && ((contextType = Util.resolveType(sax.getParent(), cdi)) != null)) {
IMember member = null;
try {
member = Util.resolveMember(contextType, sax);
} catch (JavaModelException e) {
- CDISeamConfigUIPlugin.getDefault().log(e);
+ CDISeamConfigUIPlugin.log(e);
}
if(member != null) {
//We are inside bean member. Suggest annotations and <value>.
addTypeNames(tagData, true); //only annotations allowed here.
if(eePrefix != null) {
if(member instanceof IField) {
- addTagData(tagData, eePrefix, CDISeamConfigConstants.KEYWORD_VALUE, XMLRelevanceConstants.R_STRICTLY_VALID_TAG_NAME - 1);
+ addTagData(tagData, eePrefix, KEYWORD_VALUE, true, RELEVANCE_TAG_KEYWORD);
} else if(member instanceof IMethod) {
- addTagData(tagData, eePrefix, CDISeamConfigConstants.KEYWORD_PARAMETERS, XMLRelevanceConstants.R_STRICTLY_VALID_TAG_NAME - 1);
+ addTagData(tagData, eePrefix, KEYWORD_PARAMETERS, true, true, RELEVANCE_TAG_KEYWORD);
}
}
@@ -204,6 +207,9 @@
int begin = contentAssistRequest.getReplacementBeginPosition();;
int length = contentAssistRequest.getReplacementLength();
for (TagData tag: tagData) {
+ if(tag.isUnique) {
+ if(XMLUtilities.getUniqueChild((Element)parentElement, tag.getName()) != null) continue;
+ }
String tagText = tag.getText();
String proposedInfo = null;
CustomCompletionProposal textProposal = new CustomCompletionProposal(
@@ -217,16 +223,20 @@
private void addTypeNames(Set<TagData> tagData, boolean annotationsOnly) {
try {
Set<String> tagNames = getAllTagNames(annotationsOnly);
- addTagData(tagData, tagNames, XMLRelevanceConstants.R_STRICTLY_VALID_TAG_NAME - 3);
+ addTagData(tagData, tagNames, annotationsOnly ? RELEVANCE_TAG_ANNOTATION : RELEVANCE_TAG_TYPE);
} catch (JavaModelException e) {
- CDISeamConfigUIPlugin.getDefault().log(e);
+ CDISeamConfigUIPlugin.log(e);
}
}
- private void addTagData(Set<TagData> tagData, String prefix, String name, int relevance) {
- tagData.add(new TagData(prefix + ":" + name, relevance));
+ private void addTagData(Set<TagData> tagData, String prefix, String name, boolean hasClosingTag, int relevance) {
+ tagData.add(new TagData(prefix, name, hasClosingTag, false, relevance));
}
+ private void addTagData(Set<TagData> tagData, String prefix, String name, boolean hasClosingTag, boolean isUnique, int relevance) {
+ tagData.add(new TagData(prefix, name, hasClosingTag, isUnique, relevance));
+ }
+
private void addTagData(Set<TagData> tagData, Set<String> tagNames, int relevance) {
for (String tagName: tagNames) {
tagData.add(new TagData(tagName, relevance));
@@ -280,7 +290,7 @@
}
}
}
- eePrefix = prefixByPackage.get(CDISeamConfigConstants.PACKAGE_EE);
+ eePrefix = prefixByPackage.get(PACKAGE_EE);
node = node.getParentNode();
}
}
@@ -306,7 +316,7 @@
public static Set<String> findTypeNamesByPackage(IJavaProject javaProject, String packageName, boolean annotationsOnly) throws JavaModelException {
Set<String> result = new HashSet<String>();
- if(CDISeamConfigConstants.PACKAGE_EE.equals(packageName)) {
+ if(PACKAGE_EE.equals(packageName)) {
result.addAll(Util.EE_TYPES.keySet());
} else if(javaProject != null) {
IPackageFragmentRoot[] rs = javaProject.getAllPackageFragmentRoots();
@@ -330,9 +340,7 @@
}
private static boolean accept(IType type, boolean annotationOnly) throws JavaModelException {
- if(type == null) return false;
- if(annotationOnly && !type.isAnnotation()) return false;
- return true;
+ return (type != null) && (!annotationOnly || type.isAnnotation());
}
private Set<String> getTagNamesForMembers(String prefix, IType type) {
@@ -347,7 +355,7 @@
result.add(prefix + ":" + m.getElementName());
}
} catch (JavaModelException e) {
- CDISeamConfigUIPlugin.getDefault().log(e);
+ CDISeamConfigUIPlugin.log(e);
}
return result;
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/TagData.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/TagData.java 2011-05-06 01:24:53 UTC (rev 31118)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/TagData.java 2011-05-06 02:01:11 UTC (rev 31119)
@@ -3,6 +3,7 @@
public class TagData {
String name;
boolean hasClosingTag = true;
+ boolean isUnique = false;
int relevance;
public TagData(String name, int relevance) {
@@ -10,6 +11,13 @@
this.relevance = relevance;
}
+ public TagData(String prefix, String localName, boolean hasClosingTag, boolean isUnique, int relevance) {
+ this.name = prefix + ":" + localName;
+ this.hasClosingTag = hasClosingTag;
+ this.relevance = relevance;
+ this.isUnique = isUnique;
+ }
+
public String getText() {
return hasClosingTag ? "<" + name + "></" + name + ">" : "<" + name + "/>";
}
@@ -22,4 +30,16 @@
return relevance;
}
+ public void setHasClosingTag(boolean b) {
+ hasClosingTag = b;
+ }
+
+ public void setUnique(boolean b) {
+ isUnique = b;
+ }
+
+ public boolean isUnique() {
+ return isUnique;
+ }
+
}
13 years, 2 months
JBoss Tools SVN: r31118 - in trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui: src/org/jboss/tools/cdi/seam/config/ui and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-05-05 21:24:53 -0400 (Thu, 05 May 2011)
New Revision: 31118
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/pom.xml
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/CDISeamConfigUIMessages.java
Log:
JBIDE-8842
https://issues.jboss.org/browse/JBIDE-8842
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/pom.xml
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/pom.xml 2011-05-06 01:22:22 UTC (rev 31117)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/pom.xml 2011-05-06 01:24:53 UTC (rev 31118)
@@ -7,7 +7,7 @@
<version>0.0.2-SNAPSHOT</version>
</parent>
<groupId>org.jboss.tools.cdi.plugins</groupId>
- <artifactId>org.jboss.tools.cdi.seam.text.ext</artifactId>
+ <artifactId>org.jboss.tools.cdi.seam.config.ui</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/CDISeamConfigUIMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/CDISeamConfigUIMessages.java 2011-05-06 01:22:22 UTC (rev 31117)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/CDISeamConfigUIMessages.java 2011-05-06 01:24:53 UTC (rev 31118)
@@ -13,7 +13,7 @@
import org.eclipse.osgi.util.NLS;
public class CDISeamConfigUIMessages extends NLS{
- private static final String BUNDLE_NAME = "org.jboss.tools.cdi.seam.text.ext.messages"; //$NON-NLS-1$
+ private static final String BUNDLE_NAME = "org.jboss.tools.cdi.seam.config.ui.messages"; //$NON-NLS-1$
static {
NLS.initializeMessages(BUNDLE_NAME, CDISeamConfigUIMessages.class);
13 years, 2 months
JBoss Tools SVN: r31117 - in trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui: META-INF and 10 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-05-05 21:22:22 -0400 (Thu, 05 May 2011)
New Revision: 31117
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/.classpath
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/.project
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/META-INF/
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/META-INF/MANIFEST.MF
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/about.html
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/build.properties
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/icons/
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/icons/cdi16.png
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/plugin.properties
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/plugin.xml
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/pom.xml
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/CDISeamConfigUIMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/CDISeamConfigUIPlugin.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/SeamConfigXmlCompletionProposalComputer.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/TagData.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/messages.properties
Log:
JBIDE-8842
https://issues.jboss.org/browse/JBIDE-8842
Added: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/.classpath
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/.classpath (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/.classpath 2011-05-06 01:22:22 UTC (rev 31117)
@@ -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/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/.classpath
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/.project
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/.project (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/.project 2011-05-06 01:22:22 UTC (rev 31117)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.cdi.seam.config.ui</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.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/.project
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/META-INF/MANIFEST.MF (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/META-INF/MANIFEST.MF 2011-05-06 01:22:22 UTC (rev 31117)
@@ -0,0 +1,22 @@
+Manifest-Version: 1.0
+Bundle-ActivationPolicy: lazy
+Bundle-Name: %Bundle-Name.0
+Bundle-Activator: org.jboss.tools.cdi.seam.config.ui.CDISeamConfigUIPlugin
+Bundle-ManifestVersion: 2
+Bundle-Vendor: %providerName
+Bundle-SymbolicName: org.jboss.tools.cdi.seam.config.ui;singleton:=true
+Bundle-Localization: plugin
+Export-Package: org.jboss.tools.cdi.seam.config.ui,
+ org.jboss.tools.cdi.seam.config.ui.contentassist
+Require-Bundle: org.eclipse.ui;bundle-version="3.5.0",
+ org.jboss.tools.common.text.ext;bundle-version="2.0.0",
+ org.eclipse.jface.text;bundle-version="3.5.0",
+ org.eclipse.jdt.ui;bundle-version="3.5.0",
+ org.eclipse.wst.xml.ui,
+ org.jboss.tools.cdi.ui;bundle-version="1.2.0",
+ org.jboss.tools.cdi.core,
+ org.jboss.tools.cdi.seam.config.core,
+ org.jboss.tools.jst.web.kb,
+ org.jboss.tools.jst.web;bundle-version="3.2.0"
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/about.html
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/about.html (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/about.html 2011-05-06 01:22:22 UTC (rev 31117)
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<HTML>
+
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+
+<BODY lang="EN-US">
+
+<H3>About This Content</H3>
+
+<P>©2007 Red Hat, Inc. All rights reserved</P>
+
+<H3>License</H3>
+
+<P>Red Hat Inc., through its JBoss division, makes available all content in this plug-in
+("Content"). Unless otherwise indicated below, the Content is provided to you
+under the terms and conditions of the Eclipse Public License Version 1.0
+("EPL"). A copy of the EPL is available at
+<A href="http://www.eclipse.org/org/documents/epl-v10.php">http://www.eclipse.org/org/documents/epl-v10.php</A>.
+For purposes of the EPL, "Program" will mean the Content.</P>
+
+<P>If you did not receive this Content directly from Red Hat Inc., the
+Content is being redistributed by another party ("Redistributor") and different
+terms and conditions may apply to your use of any object code in the Content.
+Check the Redistributor's license that was provided with the Content. If no such
+license exists, contact the Redistributor. Unless otherwise indicated below, the
+terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at
+ <A href="http://www.jboss.org/tools">http://www.jboss.org/tools</A>.</P>
+
+</BODY>
+</HTML>
\ No newline at end of file
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/about.html
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/build.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/build.properties (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/build.properties 2011-05-06 01:22:22 UTC (rev 31117)
@@ -0,0 +1,12 @@
+source.. = src/
+bin.includes = META-INF/,\
+ icons/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+src.includes = plugin.xml,\
+ plugin.properties,\
+ about.html,\
+ META-INF/,\
+ src/
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/build.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/icons/cdi16.png
===================================================================
(Binary files differ)
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/icons/cdi16.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/plugin.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/plugin.properties (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/plugin.properties 2011-05-06 01:22:22 UTC (rev 31117)
@@ -0,0 +1,4 @@
+providerName=JBoss by Red Hat
+Bundle-Name.0 = CDI Seam Config UI
+
+proposalCategory.seamConfigTag=Seam Config Tag
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/plugin.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/plugin.xml
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/plugin.xml (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/plugin.xml 2011-05-06 01:22:22 UTC (rev 31117)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.wst.sse.ui.completionProposal">
+ <proposalCategory
+ icon="icons/cdi16.png"
+ id="org.jboss.tools.cdi.ui.proposalCategory.seamConfigTag"
+ name="%proposalCategory.seamConfigTag">
+ </proposalCategory>
+ <proposalComputer
+ activate="true"
+ categoryId="org.jboss.tools.cdi.ui.proposalCategory.cdiClass"
+ class="org.jboss.tools.cdi.seam.config.ui.contentassist.SeamConfigXmlCompletionProposalComputer"
+ id="org.jboss.tools.cdi.seam.config.ui.configXML">
+ <contentType id="org.eclipse.core.runtime.xml">
+ <partitionType id="org.eclipse.wst.xml.XML_DEFAULT" />
+ </contentType>
+ <contentType id="org.eclipse.wst.xml.core.xmlsource">
+ <partitionType id="org.eclipse.wst.xml.XML_DEFAULT" />
+ </contentType>
+ <contentType id="org.jboss.tools.common.model.ui.xml">
+ <partitionType id="org.eclipse.wst.xml.XML_DEFAULT" />
+ </contentType>
+ </proposalComputer>
+ </extension>
+
+</plugin>
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/plugin.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/pom.xml
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/pom.xml (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/pom.xml 2011-05-06 01:22:22 UTC (rev 31117)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.parent.pom</artifactId>
+ <version>0.0.2-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.cdi.plugins</groupId>
+ <artifactId>org.jboss.tools.cdi.seam.text.ext</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
\ No newline at end of file
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/pom.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/CDISeamConfigUIMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/CDISeamConfigUIMessages.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/CDISeamConfigUIMessages.java 2011-05-06 01:22:22 UTC (rev 31117)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.seam.config.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+public class CDISeamConfigUIMessages extends NLS{
+ private static final String BUNDLE_NAME = "org.jboss.tools.cdi.seam.text.ext.messages"; //$NON-NLS-1$
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, CDISeamConfigUIMessages.class);
+ }
+ public static String NO_MESSAGE;
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/CDISeamConfigUIMessages.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/CDISeamConfigUIPlugin.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/CDISeamConfigUIPlugin.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/CDISeamConfigUIPlugin.java 2011-05-06 01:22:22 UTC (rev 31117)
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.seam.config.ui;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+public class CDISeamConfigUIPlugin extends AbstractUIPlugin{
+ //The shared instance.
+ private static CDISeamConfigUIPlugin plugin;
+ //Resource bundle.
+ private ResourceBundle resourceBundle;
+
+ public static final String PLUGIN_ID = "org.jboss.tools.cdi.seam.config.ui"; //$NON-NLS-1$
+
+
+ /**
+ * The constructor.
+ */
+ public CDISeamConfigUIPlugin() {
+ plugin = this;
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static CDISeamConfigUIPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the workspace instance.
+ */
+ public static IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle,
+ * or 'key' if not found.
+ */
+ public static String getResourceString(String key) {
+ ResourceBundle bundle= CDISeamConfigUIPlugin.getDefault().getResourceBundle();
+ try {
+ return bundle.getString(key);
+ } catch (MissingResourceException e) {
+ return key;
+ }
+ }
+
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle() {
+ return resourceBundle;
+ }
+
+ static public void log(String msg) {
+ CDISeamConfigUIPlugin.getDefault().getLog().log(new Status(Status.INFO, PLUGIN_ID, Status.OK, msg, null));
+ }
+
+ public static void log(IStatus status) {
+ CDISeamConfigUIPlugin.getDefault().getLog().log(status);
+ }
+ public static void log(String message, Exception exception) {
+ CDISeamConfigUIPlugin.getDefault().getLog().log(new Status(Status.ERROR, CDISeamConfigUIPlugin.PLUGIN_ID, Status.OK, message, exception));
+ }
+ static public void log(Exception ex) {
+ CDISeamConfigUIPlugin.getDefault().getLog().log(new Status(Status.ERROR, CDISeamConfigUIPlugin.PLUGIN_ID, Status.OK, CDISeamConfigUIMessages.NO_MESSAGE, ex));
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/CDISeamConfigUIPlugin.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/SeamConfigXmlCompletionProposalComputer.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/SeamConfigXmlCompletionProposalComputer.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/SeamConfigXmlCompletionProposalComputer.java 2011-05-06 01:22:22 UTC (rev 31117)
@@ -0,0 +1,356 @@
+package org.jboss.tools.cdi.seam.config.ui.contentassist;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.filebuffers.FileBuffers;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClassFile;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
+import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
+import org.eclipse.wst.sse.ui.contentassist.CompletionProposalInvocationContext;
+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.CMNode;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.eclipse.wst.xml.ui.internal.contentassist.AbstractXMLModelQueryCompletionProposalComputer;
+import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
+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.XMLEditorPluginImageHelper;
+import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImages;
+import org.jboss.tools.cdi.core.CDICoreNature;
+import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.cdi.core.ICDIProject;
+import org.jboss.tools.cdi.seam.config.core.CDISeamConfigConstants;
+import org.jboss.tools.cdi.seam.config.core.CDISeamConfigExtension;
+import org.jboss.tools.cdi.seam.config.core.util.Util;
+import org.jboss.tools.cdi.seam.config.core.xml.SAXElement;
+import org.jboss.tools.cdi.seam.config.ui.CDISeamConfigUIPlugin;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+public class SeamConfigXmlCompletionProposalComputer extends AbstractXMLModelQueryCompletionProposalComputer {
+ CompletionProposalInvocationContext context;
+ Node currentNode;
+ SAXElement sax;
+
+ IFile resource;
+ IProject project;
+ IJavaProject javaProject;
+ CDICoreNature cdi;
+ CDISeamConfigExtension extension;
+
+ Map<String, String> uriByPrefix = new HashMap<String, String>();
+ Map<String, String> prefixByUri = new HashMap<String, String>();
+ String eePrefix;
+ Map<String, String> prefixByPackage = new HashMap<String, String>();
+
+ public List computeCompletionProposals(
+ CompletionProposalInvocationContext context,
+ IProgressMonitor monitor) {
+ this.context = context;
+ currentNode = findNode();
+ sax = buildSAXElement(currentNode);
+
+ fillNameSpaces(currentNode);
+ resource = findResource(getDocument());
+ if(resource != null) {
+ javaProject = EclipseResourceUtil.getJavaProject(resource.getProject());
+ cdi = CDICorePlugin.getCDI(resource.getProject(), true);
+ if(cdi != null) extension = CDISeamConfigExtension.getExtension(cdi);
+ }
+ //compute the completion proposals
+ return super.computeCompletionProposals(context, monitor);
+ }
+
+ protected boolean isActive() {
+ //Cannot work without resource.
+ //Have nothing to suggest without packages.
+ //can only add in context of an element.
+ return (resource != null && !prefixByPackage.isEmpty() && sax != null);
+ }
+
+ protected IDocument getDocument() {
+ return context.getDocument();
+ }
+
+ private Node findNode() {
+ return (Node)ContentAssistUtils.getNodeAt(context.getViewer(), context.getInvocationOffset());
+ }
+
+ private IFile findResource(IDocument document) {
+ IStructuredModel sModel = StructuredModelManager.getModelManager().getExistingModelForRead(document);
+ try {
+ if (sModel != null) {
+ String baseLocation = sModel.getBaseLocation();
+ IPath location = new Path(baseLocation).makeAbsolute();
+ return FileBuffers.getWorkspaceFileAtLocation(location);
+ }
+ } finally {
+ if (sModel != null) {
+ sModel.releaseFromRead();
+ }
+ }
+ return null;
+ }
+
+ private SAXElement buildSAXElement(Node node) {
+ while(node != null && !(node instanceof Element)) {
+ node = node.getParentNode();
+ }
+ if(node != null) {
+ SAXElement sax = new SAXElement(node);
+ SAXElement parent = buildSAXElement(node.getParentNode());
+ sax.setParent(parent);
+ return sax;
+ }
+
+ return null;
+ }
+
+ @Override
+ protected void addTagInsertionProposals(
+ ContentAssistRequest contentAssistRequest, int childPosition,
+ CompletionProposalInvocationContext context) {
+ if(!isActive()) {
+ return;
+ }
+
+ Node currentNode = contentAssistRequest.getNode();
+ Node parentElement = currentNode;
+ while(parentElement != null && !(parentElement instanceof Element)) parentElement = parentElement.getParentNode();
+ if(parentElement == null) {
+ //Can suggest nothing without parent context.
+ return;
+ }
+ String parentElementName = sax.getLocalName();
+ String parentElementPrefix = sax.getPrefix();
+
+ Set<TagData> tagData = new HashSet<TagData>();
+
+ if("beans".equals(parentElementName)) {
+ //suggest all classes in all packages.
+ addTypeNames(tagData, false);
+ } else if(parentElementPrefix != null && prefixByPackage.containsValue(parentElementPrefix)) {
+ // If we are not in <beans>, then we have to be in context of some seam package.
+ IType contextType = null;
+ if(Util.isEntry(sax)) {
+ //Inside entry - only <key> and <value>
+ if(eePrefix != null) {
+ addTagData(tagData, eePrefix, CDISeamConfigConstants.KEYWORD_KEY, XMLRelevanceConstants.R_STRICTLY_VALID_TAG_NAME - 1);
+ addTagData(tagData, eePrefix, CDISeamConfigConstants.KEYWORD_VALUE, XMLRelevanceConstants.R_STRICTLY_VALID_TAG_NAME - 1);
+ }
+ } else if(Util.isValue(sax) || Util.isKey(sax)) {
+ //Inside value or key we can define new bean.
+ addTypeNames(tagData, false);
+ } else if(Util.isParameters(sax)) {
+ //TODO find parent method name and type, and suggest parameter types.
+ } else if((contextType = Util.resolveType(sax, cdi)) != null) {
+ //We are inside bean. Suggest members and annotations.
+ addTypeNames(tagData, true); //only annotations allowed here.
+ addTagData(tagData, getTagNamesForMembers(parentElementPrefix, contextType), XMLRelevanceConstants.R_STRICTLY_VALID_TAG_NAME - 2);
+
+ if(eePrefix != null) {
+ TagData d = new TagData(eePrefix + ":" + CDISeamConfigConstants.KEYWORD_MODIFIES, XMLRelevanceConstants.R_STRICTLY_VALID_TAG_NAME - 1);
+ d.hasClosingTag = false;
+ tagData.add(d);
+ d = new TagData(eePrefix + ":" + CDISeamConfigConstants.KEYWORD_REPLACES, XMLRelevanceConstants.R_STRICTLY_VALID_TAG_NAME - 1);
+ tagData.add(d);
+ }
+ } else if(sax.getParent() != null && ((contextType = Util.resolveType(sax.getParent(), cdi)) != null)) {
+ IMember member = null;
+ try {
+ member = Util.resolveMember(contextType, sax);
+ } catch (JavaModelException e) {
+ CDISeamConfigUIPlugin.getDefault().log(e);
+ }
+ if(member != null) {
+ //We are inside bean member. Suggest annotations and <value>.
+ addTypeNames(tagData, true); //only annotations allowed here.
+ if(eePrefix != null) {
+ if(member instanceof IField) {
+ addTagData(tagData, eePrefix, CDISeamConfigConstants.KEYWORD_VALUE, XMLRelevanceConstants.R_STRICTLY_VALID_TAG_NAME - 1);
+ } else if(member instanceof IMethod) {
+ addTagData(tagData, eePrefix, CDISeamConfigConstants.KEYWORD_PARAMETERS, XMLRelevanceConstants.R_STRICTLY_VALID_TAG_NAME - 1);
+ }
+ }
+
+ }
+ }
+ }
+
+ int begin = contentAssistRequest.getReplacementBeginPosition();;
+ int length = contentAssistRequest.getReplacementLength();
+ for (TagData tag: tagData) {
+ String tagText = tag.getText();
+ String proposedInfo = null;
+ CustomCompletionProposal textProposal = new CustomCompletionProposal(
+ tagText, begin, length, tagText.length(),
+ XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC),
+ tag.getName(), null, proposedInfo, tag.getRelevance());
+ contentAssistRequest.addProposal(textProposal);
+ }
+ }
+
+ private void addTypeNames(Set<TagData> tagData, boolean annotationsOnly) {
+ try {
+ Set<String> tagNames = getAllTagNames(annotationsOnly);
+ addTagData(tagData, tagNames, XMLRelevanceConstants.R_STRICTLY_VALID_TAG_NAME - 3);
+ } catch (JavaModelException e) {
+ CDISeamConfigUIPlugin.getDefault().log(e);
+ }
+ }
+
+ private void addTagData(Set<TagData> tagData, String prefix, String name, int relevance) {
+ tagData.add(new TagData(prefix + ":" + name, relevance));
+ }
+
+ private void addTagData(Set<TagData> tagData, Set<String> tagNames, int relevance) {
+ for (String tagName: tagNames) {
+ tagData.add(new TagData(tagName, relevance));
+ }
+ }
+
+ protected void addTagNameProposals(ContentAssistRequest contentAssistRequest,
+ int childPosition, CompletionProposalInvocationContext context) {
+ if(!isActive()) {
+ return;
+ }
+ //TODO
+ // super.addTagNameProposals(contentAssistRequest, childPosition, context);
+ }
+
+ @Override
+ protected XMLContentModelGenerator getContentGenerator() {
+ return new XMLContentModelGenerator();
+ }
+
+ @Override
+ protected boolean validModelQueryNode(CMNode node) {
+ return false;
+ }
+
+ static String XMLNS_PREFIX = "xmlns:";
+
+ private void fillNameSpaces(Node node) {
+ uriByPrefix.clear();
+ prefixByUri.clear();
+ prefixByPackage.clear();
+ eePrefix = null;
+ while(node != null) {
+ if(node instanceof Element) {
+ Element element = (Element)node;
+ NamedNodeMap as = element.getAttributes();
+ for (int i = 0; i < as.getLength(); i++) {
+ Node a = as.item(i);
+ String nm = a.getNodeName();
+ if(nm.startsWith(XMLNS_PREFIX)) {
+ String prefix = nm.substring(XMLNS_PREFIX.length());
+ String uri = a.getNodeValue();
+ if(uri != null) {
+ uriByPrefix.put(prefix, uri);
+ prefixByUri.put(uri, prefix);
+ String[] packages = Util.getPackages(uri);
+ for (String pkg: packages) {
+ prefixByPackage.put(pkg, prefix);
+ }
+ }
+ }
+ }
+ }
+ eePrefix = prefixByPackage.get(CDISeamConfigConstants.PACKAGE_EE);
+ node = node.getParentNode();
+ }
+ }
+
+ Set<String> getAllTagNames(boolean annotationsOnly) throws JavaModelException {
+ Set<String> result = new HashSet<String>();
+ for (String packageName: prefixByPackage.keySet()) {
+ String prefix = prefixByPackage.get(packageName);
+ Set<String> typeNames = findTypeNamesByPackage(javaProject, packageName, annotationsOnly);
+ for (String typeName: typeNames) result.add(prefix + ":" + typeName);
+ }
+ return result;
+ }
+
+ Set<String> getTypeNamesByPrefix(String prefix, boolean annotationsOnly) throws JavaModelException {
+ Set<String> result = new HashSet<String>();
+ String uri = uriByPrefix.get(prefix);
+ for (String packageName: Util.getPackages(uri)) {
+ result.addAll(findTypeNamesByPackage(javaProject, packageName, annotationsOnly));
+ }
+ return result;
+ }
+
+ public static Set<String> findTypeNamesByPackage(IJavaProject javaProject, String packageName, boolean annotationsOnly) throws JavaModelException {
+ Set<String> result = new HashSet<String>();
+ if(CDISeamConfigConstants.PACKAGE_EE.equals(packageName)) {
+ result.addAll(Util.EE_TYPES.keySet());
+ } else if(javaProject != null) {
+ IPackageFragmentRoot[] rs = javaProject.getAllPackageFragmentRoots();
+ for (IPackageFragmentRoot r: rs) {
+ IPackageFragment pkg = r.getPackageFragment(packageName);
+ if(pkg != null && pkg.exists()) {
+ ICompilationUnit[] units = pkg.getCompilationUnits();
+ for (ICompilationUnit u: units) {
+ IType[] ts = u.getTypes();
+ for (IType t: ts) if(accept(t, annotationsOnly)) result.add(t.getElementName());
+ }
+ IClassFile[] cs = pkg.getClassFiles();
+ for (IClassFile cls: cs) {
+ if(accept(cls.getType(), annotationsOnly)) result.add(cls.getType().getElementName());
+ }
+ }
+ }
+
+ }
+ return result;
+ }
+
+ private static boolean accept(IType type, boolean annotationOnly) throws JavaModelException {
+ if(type == null) return false;
+ if(annotationOnly && !type.isAnnotation()) return false;
+ return true;
+ }
+
+ private Set<String> getTagNamesForMembers(String prefix, IType type) {
+ Set<String> result = new HashSet<String>();
+ try {
+ IField[] fs = type.getFields();
+ for (IField f: fs) {
+ result.add(prefix + ":" + f.getElementName());
+ }
+ IMethod[] ms = type.getMethods();
+ for (IMethod m: ms) {
+ result.add(prefix + ":" + m.getElementName());
+ }
+ } catch (JavaModelException e) {
+ CDISeamConfigUIPlugin.getDefault().log(e);
+ }
+ return result;
+ }
+
+}
+
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/SeamConfigXmlCompletionProposalComputer.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/TagData.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/TagData.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/TagData.java 2011-05-06 01:22:22 UTC (rev 31117)
@@ -0,0 +1,25 @@
+package org.jboss.tools.cdi.seam.config.ui.contentassist;
+
+public class TagData {
+ String name;
+ boolean hasClosingTag = true;
+ int relevance;
+
+ public TagData(String name, int relevance) {
+ this.name = name;
+ this.relevance = relevance;
+ }
+
+ public String getText() {
+ return hasClosingTag ? "<" + name + "></" + name + ">" : "<" + name + "/>";
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getRelevance() {
+ return relevance;
+ }
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/contentassist/TagData.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/messages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/messages.properties (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/messages.properties 2011-05-06 01:22:22 UTC (rev 31117)
@@ -0,0 +1 @@
+NO_MESSAGE=No message
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.ui/src/org/jboss/tools/cdi/seam/config/ui/messages.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 2 months
JBoss Tools SVN: r31115 - trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-05-05 17:53:40 -0400 (Thu, 05 May 2011)
New Revision: 31115
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXParser.java
Log:
JBIDE-3120
https://issues.jboss.org/browse/JBIDE-3120
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXElement.java 2011-05-05 20:22:54 UTC (rev 31114)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXElement.java 2011-05-05 21:53:40 UTC (rev 31115)
@@ -16,6 +16,8 @@
import java.util.Map;
import java.util.Set;
+import org.w3c.dom.Node;
+
/**
*
* @author Viacheslav Kabanovich
@@ -33,6 +35,12 @@
protected List<SAXElement> children = new ArrayList<SAXElement>();
public SAXElement() {}
+
+ public SAXElement(Node node) {
+ setName(node.getNodeName());
+ setLocalName(node.getLocalName());
+ setURI(node.getNamespaceURI());
+ }
public void setName(String name) {
this.name = name;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXParser.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXParser.java 2011-05-05 20:22:54 UTC (rev 31114)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.config.core/src/org/jboss/tools/cdi/seam/config/core/xml/SAXParser.java 2011-05-05 21:53:40 UTC (rev 31115)
@@ -111,7 +111,7 @@
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
int end = getCurrentLocation(), start = 0;
if(end > 0) {
- start = document.get().lastIndexOf("<", end);
+ start = document.get().lastIndexOf("<", end - 1);
}
SAXElement element = new SAXElement();
element.setLocalName(localName);
13 years, 2 months
JBoss Tools SVN: r31114 - trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2011-05-05 16:22:54 -0400 (Thu, 05 May 2011)
New Revision: 31114
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFFuncsELCompletionEngine.java
Log:
https://issues.jboss.org/browse/JBIDE-8865
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFFuncsELCompletionEngine.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFFuncsELCompletionEngine.java 2011-05-05 20:02:31 UTC (rev 31113)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/JSFFuncsELCompletionEngine.java 2011-05-05 20:22:54 UTC (rev 31114)
@@ -12,6 +12,7 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -95,12 +96,12 @@
ELContext context = PageContextFactory.createPageContext(file);
if (!(context instanceof XmlContextImpl)) {
- return null;
+ return Collections.emptyList();
}
ITagLibrary[] libraries = TagLibraryManager.getLibraries(file.getProject());
if (libraries == null)
- return null;
+ return Collections.emptyList();;
List<IJSFVariable> result = new ArrayList<IJSFVariable>();
13 years, 2 months
JBoss Tools SVN: r31113 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2011-05-05 16:02:31 -0400 (Thu, 05 May 2011)
New Revision: 31113
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java
Log:
https://issues.jboss.org/browse/JBIDE-8864 NullPointerExceptopn occurs after removing tag from source in HTML Visual Editor
fixed
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 2011-05-05 19:14:48 UTC (rev 31112)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java 2011-05-05 20:02:31 UTC (rev 31113)
@@ -107,8 +107,8 @@
}
public void setTarget(INodeNotifier target) {
- if(fNode == target) return;
fNode = (target instanceof Node) ? (Node) target : null;
+
if (fNode instanceof IDOMNode) {
Document ownerDocument = fNode.getOwnerDocument();
if (ownerDocument == null && fNode instanceof Document) {
@@ -120,12 +120,15 @@
fCaseSensitive = adapter.getTagNameCase() == DocumentTypeAdapter.STRICT_CASE;
offset = ((IDOMNode)fNode).getStartOffset() + ("" + fNode.getNodeName()).length(); //$NON-NLS-1$
}
- processor = valueHelper.isFacetets() ? new FaceletPageContectAssistProcessor() : new JspContentAssistProcessor();
- processor.createContext(getTextViewer(), offset);
- pageContext = processor.getContext();
- kbQuery = createKbQuery(processor);
- kbQuery.setMask(true);
- kbQueryAttr = createKbQuery(processor);
+
+ if(fNode instanceof Node) {
+ processor = valueHelper.isFacetets() ? new FaceletPageContectAssistProcessor() : new JspContentAssistProcessor();
+ processor.createContext(getTextViewer(), offset);
+ pageContext = processor.getContext();
+ kbQuery = createKbQuery(processor);
+ kbQuery.setMask(true);
+ kbQueryAttr = createKbQuery(processor);
+ }
}
//TODO move to helper
13 years, 2 months
JBoss Tools SVN: r31112 - trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/console.
by jbosstools-commits@lists.jboss.org
Author: koen.aers(a)jboss.com
Date: 2011-05-05 15:14:48 -0400 (Thu, 05 May 2011)
New Revision: 31112
Modified:
trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/console/CommandRecorder.java
Log:
- fix the selections when project explorer is open instead of package explorer
- fix the selection after the field command
Modified: trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/console/CommandRecorder.java
===================================================================
--- trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/console/CommandRecorder.java 2011-05-05 18:56:04 UTC (rev 31111)
+++ trunk/forge/plugins/org.jboss.tools.seam.forge/src/org/jboss/tools/seam/forge/console/CommandRecorder.java 2011-05-05 19:14:48 UTC (rev 31112)
@@ -3,18 +3,19 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocumentListener;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
@@ -22,7 +23,7 @@
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.ISetSelectionTarget;
-import org.eclipse.ui.views.contentoutline.ContentOutline;
+import org.eclipse.ui.texteditor.ITextEditor;
import org.jboss.tools.seam.forge.ForgePlugin;
import org.jboss.tools.seam.forge.importer.ProjectImporter;
@@ -88,6 +89,8 @@
return "field";
} else if ("prettyfaces".equals(candidateCommand)) {
return "prettyfaces";
+ } else if ("build".equals(candidateCommand)) {
+ return "build";
} else {
return null;
}
@@ -97,7 +100,6 @@
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
String projectName = currentPrompt.substring(1, currentPrompt.indexOf(']'));
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
if (project != null) {
try {
@@ -123,7 +125,8 @@
index = projectPath.lastIndexOf('/');
String projectDirName = projectPath.substring(index + 1);
String projectBaseDirPath = projectPath.substring(0, index);
- new ProjectImporter(projectBaseDirPath, projectDirName).importProject();
+ ProjectImporter importer = new ProjectImporter(projectBaseDirPath, projectDirName);
+ importer.importProject();
} else if ("persistence".equals(currentCommand)) {
int index = beforePrompt.lastIndexOf("***SUCCESS*** Installed [forge.spec.jpa] successfully.\nWrote ");
if (index == -1) return;
@@ -132,14 +135,17 @@
if (file == null) return;
Object objectToSelect = file;
IDE.openEditor(workbenchPage, file);
- IViewPart packageExplorer = workbenchPage.showView("org.eclipse.jdt.ui.PackageExplorer");
- if (packageExplorer instanceof ISetSelectionTarget) {
+ IViewPart projectExplorer = workbenchPage.findView("org.eclipse.ui.navigator.ProjectExplorer");
+ if (projectExplorer != null && projectExplorer instanceof ISetSelectionTarget) {
+ ((ISetSelectionTarget)projectExplorer).selectReveal(new StructuredSelection(objectToSelect));
+ }
+ IViewPart packageExplorer = workbenchPage.findView("org.eclipse.jdt.ui.PackageExplorer");
+ if (packageExplorer == null && projectExplorer == null) {
+ packageExplorer = workbenchPage.showView("org.eclipse.jdt.ui.PackageExplorer");
+ }
+ if (packageExplorer != null && packageExplorer instanceof ISetSelectionTarget) {
((ISetSelectionTarget)packageExplorer).selectReveal(new StructuredSelection(objectToSelect));
}
- IViewPart outlineViewer = workbenchPage.showView("org.eclipse.ui.views.ContentOutline");
- if (outlineViewer instanceof ISetSelectionTarget) {
- ((ISetSelectionTarget)outlineViewer).selectReveal(new StructuredSelection(objectToSelect));
- }
} catch (PartInitException e) {
ForgePlugin.log(e);
}
@@ -161,14 +167,17 @@
ForgePlugin.log(e);
}
}
- IViewPart packageExplorer = workbenchPage.showView("org.eclipse.jdt.ui.PackageExplorer");
- if (packageExplorer instanceof ISetSelectionTarget) {
+ IViewPart projectExplorer = workbenchPage.findView("org.eclipse.ui.navigator.ProjectExplorer");
+ if (projectExplorer != null && projectExplorer instanceof ISetSelectionTarget) {
+ ((ISetSelectionTarget)projectExplorer).selectReveal(new StructuredSelection(objectToSelect));
+ }
+ IViewPart packageExplorer = workbenchPage.findView("org.eclipse.jdt.ui.PackageExplorer");
+ if (packageExplorer == null && projectExplorer == null) {
+ packageExplorer = workbenchPage.showView("org.eclipse.jdt.ui.PackageExplorer");
+ }
+ if (packageExplorer != null && packageExplorer instanceof ISetSelectionTarget) {
((ISetSelectionTarget)packageExplorer).selectReveal(new StructuredSelection(objectToSelect));
}
- IViewPart outlineViewer = workbenchPage.showView("org.eclipse.ui.views.ContentOutline");
- if (outlineViewer instanceof ISetSelectionTarget) {
- ((ISetSelectionTarget)outlineViewer).selectReveal(new StructuredSelection(objectToSelect));
- }
} catch (PartInitException e) {
ForgePlugin.log(e);
}
@@ -190,27 +199,22 @@
String fieldName = str.substring(index + 1);
IFile file = project.getFile("/src/main/java/" + entityName.replace('.', '/') + ".java");
if (file == null) return;
- Object objectToSelect = file;
+ IEditorPart editorPart = IDE.openEditor(workbenchPage, file);
IJavaElement javaElement = JavaCore.create(file);
if (javaElement != null && javaElement.getElementType() == IJavaElement.COMPILATION_UNIT) {
try {
IType type = ((ICompilationUnit)javaElement).getTypes()[0];
IField field = type.getField(fieldName);
if (field != null) {
- objectToSelect = field;
+ ISourceRange sourceRange = field.getSourceRange();
+ if (sourceRange != null && editorPart != null && editorPart instanceof ITextEditor) {
+ ((ITextEditor)editorPart).selectAndReveal(sourceRange.getOffset(), sourceRange.getLength());
+ }
}
} catch (JavaModelException e) {
ForgePlugin.log(e);
}
}
- IViewPart packageExplorer = workbenchPage.showView("org.eclipse.jdt.ui.PackageExplorer");
- if (packageExplorer instanceof ISetSelectionTarget) {
- ((ISetSelectionTarget)packageExplorer).selectReveal(new StructuredSelection(objectToSelect));
- }
-// IViewPart outlineViewer = workbenchPage.showView("org.eclipse.ui.views.ContentOutline");
-// if (outlineViewer instanceof ContentOutline) {
-// ((ContentOutline)outlineViewer).getCurrentPage().get
-// }
} catch (PartInitException e) {
ForgePlugin.log(e);
}
@@ -231,13 +235,22 @@
Object objectToSelect = file;
try {
IDE.openEditor(workbenchPage, file);
- IViewPart packageExplorer = workbenchPage.showView("org.eclipse.jdt.ui.PackageExplorer");
- if (packageExplorer instanceof ISetSelectionTarget) {
+ IViewPart projectExplorer = workbenchPage.findView("org.eclipse.ui.navigator.ProjectExplorer");
+ if (projectExplorer != null && projectExplorer instanceof ISetSelectionTarget) {
+ ((ISetSelectionTarget)projectExplorer).selectReveal(new StructuredSelection(objectToSelect));
+ }
+ IViewPart packageExplorer = workbenchPage.findView("org.eclipse.jdt.ui.PackageExplorer");
+ if (packageExplorer == null && projectExplorer == null) {
+ packageExplorer = workbenchPage.showView("org.eclipse.jdt.ui.PackageExplorer");
+ }
+ if (packageExplorer != null && packageExplorer instanceof ISetSelectionTarget) {
((ISetSelectionTarget)packageExplorer).selectReveal(new StructuredSelection(objectToSelect));
}
} catch (PartInitException e) {
ForgePlugin.log(e);
}
+ } else if ("build".equals(currentCommand)) {
+
} else {
}
13 years, 2 months