Author: dazarov
Date: 2011-08-09 20:42:25 -0400 (Tue, 09 Aug 2011)
New Revision: 33745
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/elProjectSet.exsd
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/ELProjectSetExtension.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/ELReferencesQueryParticipant.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/IProjectsSet.java
Removed:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELReferencesQueryParticipant.java
trunk/jsf/plugins/org.jboss.tools.jsf/schemas/elProjectSet.exsd
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ELProjectSetExtension.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ProjectsSet.java
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/DefaultJavaRelevanceCheck.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameMethodParticipant.java
trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java
trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/ELProjectSet.java
Log:
https://issues.jboss.org/browse/JBIDE-9473
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/DefaultJavaRelevanceCheck.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/DefaultJavaRelevanceCheck.java 2011-08-10
00:01:27 UTC (rev 33744)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ca/DefaultJavaRelevanceCheck.java 2011-08-10
00:42:25 UTC (rev 33745)
@@ -12,12 +12,14 @@
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
import org.jboss.tools.common.el.core.resolver.IRelevanceCheck;
public class DefaultJavaRelevanceCheck implements IRelevanceCheck {
String test1 = null;
String test2 = null;
String test3 = null;
+ boolean isIType = false;
public DefaultJavaRelevanceCheck(IJavaElement element) {
if(element == null) return;
@@ -31,10 +33,15 @@
test3 = test1.substring(2);
}
if(test3 != null && test3.equals(test2)) test3 = null;
+ }else if(element instanceof IType){
+ isIType = true;
}
}
public boolean isRelevant(String content) {
+ if(isIType)
+ return true;
+
if(test1 != null && content.contains(test1)) return true;
if(test2 != null && content.contains(test2)) return true;
if(test3 != null && content.contains(test3)) return true;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2011-08-10 00:01:27 UTC (rev 33744)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2011-08-10 00:42:25 UTC (rev 33745)
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
- <extension-point id="elProjectSet" name="EL Project Set"
schema="schemas/elProjectSet.exsd"/>
-
<extension point="org.jboss.tools.common.model.meta">
<meta path="meta/jsf.meta">
</meta>
Deleted: trunk/jsf/plugins/org.jboss.tools.jsf/schemas/elProjectSet.exsd
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/schemas/elProjectSet.exsd 2011-08-10 00:01:27
UTC (rev 33744)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/schemas/elProjectSet.exsd 2011-08-10 00:42:25
UTC (rev 33745)
@@ -1,127 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.jboss.tools.common.el.core"
xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appinfo>
- <meta.schema plugin="org.jboss.tools.common.el.core"
id="elSearch" name="EL Search"/>
- </appinfo>
- <documentation>
- This extenion point is used to send information about seam project to search and
rename participants. In order to have one search participand and one rename participant
for seam and jsf projects.
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appinfo>
- <meta.element />
- </appinfo>
- </annotation>
- <complexType>
- <sequence>
- <element ref="project-set" minOccurs="1"
maxOccurs="unbounded"/>
- </sequence>
- <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="project-set">
- <complexType>
- <attribute name="id" type="string"
use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="identifier"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="projectset-class" type="string"
use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="java"
basedOn=":org.jboss.tools.common.el.core.refactoring.ProjectsSet"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appinfo>
- <meta.section type="since"/>
- </appinfo>
- <documentation>
- JBoss Tools 3.1
- </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>
-
- <annotation>
- <appinfo>
- <meta.section type="copyright"/>
- </appinfo>
- <documentation>
- Copyright (c) 2009 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
- </documentation>
- </annotation>
-
-</schema>
Deleted:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ELProjectSetExtension.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ELProjectSetExtension.java 2011-08-10
00:01:27 UTC (rev 33744)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ELProjectSetExtension.java 2011-08-10
00:42:25 UTC (rev 33745)
@@ -1,47 +0,0 @@
-package org.jboss.tools.jsf.el.refactoring;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-import org.jboss.tools.common.el.core.ELCorePlugin;
-
-public class ELProjectSetExtension {
- public static String EXTENSION_POINT = "org.jboss.tools.jsf.elProjectSet";
//$NON-NLS-1$
-
- String id;
- ProjectsSet searcher;
-
- public ELProjectSetExtension() {}
-
- public String getId() {
- return id;
- }
-
- public ProjectsSet getProjectSet() {
- return searcher;
- }
-
- static ELProjectSetExtension[] INSTANCES;
-
- public static ELProjectSetExtension[] getInstances() {
- if(INSTANCES != null) return INSTANCES;
- List<ELProjectSetExtension> list = new ArrayList<ELProjectSetExtension>();
- IExtensionPoint point =
Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT);
- IConfigurationElement[] es = point.getConfigurationElements();
- for (IConfigurationElement e: es) {
- ELProjectSetExtension n = new ELProjectSetExtension();
- n.id = e.getAttribute("id"); //$NON-NLS-1$
- try{
- n.searcher = (ProjectsSet)e.createExecutableExtension("projectset-class");
//$NON-NLS-1$
- }catch(CoreException ex){
- ELCorePlugin.getDefault().logError(ex);
- }
- list.add(n);
- }
- return INSTANCES = list.toArray(new ELProjectSetExtension[0]);
- }
-}
Deleted:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ProjectsSet.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ProjectsSet.java 2011-08-10
00:01:27 UTC (rev 33744)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/el/refactoring/ProjectsSet.java 2011-08-10
00:42:25 UTC (rev 33745)
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.jsf.el.refactoring;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-
-/**
- *
- * @author Daniel
- *
- * This interface is used for transmit information about seam project structure from seam
plugins through org.jboss.tools.common.el.core.elSearcher extension point
- */
-public interface ProjectsSet {
- /**
- * inits seam project structure
- * @param project
- */
- public void init(IProject project);
-
- /**
- * returns all linked seam projects
- * @return
- */
- public IProject[] getLinkedProjects();
-
- /**
- * returns view folder (like WEB_CONTENT, EAR_CONTENT) for each seam project
- * @param project
- * @return
- */
- public IContainer getViewFolder(IProject project);
-}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2011-08-10 00:01:27 UTC (rev
33744)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.ui/plugin.xml 2011-08-10 00:42:25 UTC (rev
33745)
@@ -415,15 +415,6 @@
</perspectiveExtension>
</extension>
- <extension
- point="org.eclipse.jdt.ui.queryParticipants">
- <queryParticipant
-
class="org.jboss.tools.jsf.ui.el.refactoring.ELReferencesQueryParticipant"
-
id="org.jboss.tools.jsf.ui.el.refactoring.ELReferencesQueryParticipant"
- name="jsf-SearchELReferencesParticipant"
- nature="org.jboss.tools.jsf.jsfnature">
- </queryParticipant>
- </extension>
<extension
point="org.eclipse.ltk.core.refactoring.renameParticipants">
<renameParticipant
Deleted:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELReferencesQueryParticipant.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELReferencesQueryParticipant.java 2011-08-10
00:01:27 UTC (rev 33744)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELReferencesQueryParticipant.java 2011-08-10
00:42:25 UTC (rev 33745)
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 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.jsf.ui.el.refactoring;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
-import org.eclipse.jdt.ui.search.ElementQuerySpecification;
-import org.eclipse.jdt.ui.search.IMatchPresentation;
-import org.eclipse.jdt.ui.search.IQueryParticipant;
-import org.eclipse.jdt.ui.search.ISearchRequestor;
-import org.eclipse.jdt.ui.search.QuerySpecification;
-import org.eclipse.search.ui.text.Match;
-import org.jboss.tools.common.model.project.ProjectHome;
-import org.jboss.tools.jsf.el.refactoring.ELProjectSetExtension;
-import org.jboss.tools.jsf.el.refactoring.ProjectsSet;
-import org.jboss.tools.jst.web.kb.refactoring.RefactorSearcher;
-
-public class ELReferencesQueryParticipant implements IQueryParticipant{
- private ELSearcher searcher;
-
- public int estimateTicks(QuerySpecification specification) {
- return 10;
- }
-
- public IMatchPresentation getUIParticipant() {
- return null;
- }
-
- public void search(ISearchRequestor requestor,
- QuerySpecification querySpecification, IProgressMonitor monitor)
- throws CoreException {
-
- if(querySpecification instanceof ElementQuerySpecification){
- if (!isSearchForReferences(querySpecification.getLimitTo()))
- return;
-
- ElementQuerySpecification qs = (ElementQuerySpecification)querySpecification;
- if(qs.getElement() instanceof IMethod || qs.getElement() instanceof IType){
- IFile file = (IFile)qs.getElement().getResource();
- if(file == null)
- return;
-
- String name = qs.getElement().getElementName();
-
- searcher = new ELSearcher(requestor, qs.getElement(), file, name);
- searcher.setSearchScope(qs.getScope());
-
- searcher.findELReferences();
- }
- }
- }
-
- public boolean isSearchForReferences(int limitTo) {
- int maskedLimitTo = limitTo &
~(IJavaSearchConstants.IGNORE_DECLARING_TYPE+IJavaSearchConstants.IGNORE_RETURN_TYPE);
- if (maskedLimitTo == IJavaSearchConstants.REFERENCES || maskedLimitTo ==
IJavaSearchConstants.ALL_OCCURRENCES) {
- return true;
- }
-
- return false;
- }
-
- class ELSearcher extends RefactorSearcher{
- ISearchRequestor requestor;
- ProjectsSet projectSet=null;
-
- public ELSearcher(ISearchRequestor requestor, IJavaElement element, IFile file, String
name){
- super(file, name, element);
- this.requestor = requestor;
- ELProjectSetExtension[] extensions = ELProjectSetExtension.getInstances();
- if(extensions.length > 0){
- projectSet = extensions[0].getProjectSet();
- if(projectSet != null)
- projectSet.init(file.getProject());
- }
-
- }
-
- protected void outOfSynch(IProject file){
- // do nothing
- }
-
- @Override
- protected void match(IFile file, int offset, int length) {
- Match match = new Match(file, offset, length);
- requestor.reportMatch(match);
- }
-
- protected IProject[] getProjects(){
- if(projectSet != null){
- return projectSet.getLinkedProjects();
- }
- return new IProject[]{baseFile.getProject()};
- }
-
- protected IContainer getViewFolder(IProject project){
- if(projectSet != null){
- return projectSet.getViewFolder(project);
- }
-
- IPath path = ProjectHome.getFirstWebContentPath(baseFile.getProject());
-
- if(path != null)
- return project.getFolder(path.removeFirstSegments(1));
-
- return null;
- }
- }
-}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameMethodParticipant.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameMethodParticipant.java 2011-08-10
00:01:27 UTC (rev 33744)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/RenameMethodParticipant.java 2011-08-10
00:42:25 UTC (rev 33745)
@@ -35,9 +35,9 @@
import org.eclipse.text.edits.TextEdit;
import org.jboss.tools.common.model.project.ProjectHome;
import org.jboss.tools.common.util.BeanUtil;
-import org.jboss.tools.jsf.el.refactoring.ELProjectSetExtension;
-import org.jboss.tools.jsf.el.refactoring.ProjectsSet;
import org.jboss.tools.jsf.ui.JsfUIMessages;
+import org.jboss.tools.jst.web.kb.refactoring.ELProjectSetExtension;
+import org.jboss.tools.jst.web.kb.refactoring.IProjectsSet;
import org.jboss.tools.jst.web.kb.refactoring.RefactorSearcher;
public class RenameMethodParticipant extends RenameParticipant implements
ISharableParticipant{
@@ -168,7 +168,7 @@
}
class RenameMethodSearcher extends RefactorSearcher{
- ProjectsSet projectSet=null;
+ IProjectsSet projectSet=null;
public RenameMethodSearcher(IFile file, String name){
super(file, name, element);
ELProjectSetExtension[] extensions = ELProjectSetExtension.getInstances();
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF 2011-08-10 00:01:27
UTC (rev 33744)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/META-INF/MANIFEST.MF 2011-08-10 00:42:25
UTC (rev 33745)
@@ -47,3 +47,4 @@
org.jboss.tools.jst.web.kb.taglib,
org.jboss.tools.jst.web.kb.validation
Bundle-ClassPath: .
+Import-Package: org.eclipse.search.ui.text
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2011-08-10 00:01:27 UTC (rev
33744)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2011-08-10 00:42:25 UTC (rev
33745)
@@ -6,6 +6,7 @@
<extension-point id="validator" name="KB Validator"
schema="schema/validator.exsd"/>
<extension-point id="elValidationDelegate" name="EL Validation
Delegate" schema="schema/elValidationDelegate.exsd"/>
<extension-point id="KbRequire" name="KB Builder Requirement"
schema="schema/KbRequire.exsd"/>
+ <extension-point id="elProjectSet" name="EL Project Set"
schema="schema/elProjectSet.exsd"/>
<extension
id="kbbuilder"
@@ -383,5 +384,14 @@
</objectContribution>
</extension>
-
+
+ <extension
+ point="org.eclipse.jdt.ui.queryParticipants">
+ <queryParticipant
+
class="org.jboss.tools.jst.web.kb.refactoring.ELReferencesQueryParticipant"
+
id="org.jboss.tools.jst.web.kb.refactoring.ELReferencesQueryParticipant"
+ name="SearchELReferencesParticipant"
+ nature="org.eclipse.jdt.core.javanature">
+ </queryParticipant>
+ </extension>
</plugin>
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/elProjectSet.exsd
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/elProjectSet.exsd
(rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/elProjectSet.exsd 2011-08-10
00:42:25 UTC (rev 33745)
@@ -0,0 +1,129 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.jst.web.kb"
xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.tools.jst.web.kb"
id="elSearch" name="EL Search"/>
+ </appInfo>
+ <documentation>
+ This extenion point is used to send information about seam project to search and
rename participants. In order to have one search participand and one rename participant
for seam and jsf projects.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="project-set" minOccurs="1"
maxOccurs="unbounded"/>
+ </sequence>
+ <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="project-set">
+ <complexType>
+ <attribute name="id" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="identifier"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="projectset-class" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java"
basedOn=":org.jboss.tools.common.el.core.refactoring.ProjectsSet"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ JBoss Tools 3.3
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ <extension
point="org.jboss.tools.jst.web.kb.elProjectSet">
+ <project-set id="seam.searcher"
projectset-class="org.jboss.tools.seam.internal.core.refactoring.ELProjectSet"
/>
+</extension>
+ </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>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2009 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
+ </documentation>
+ </annotation>
+
+</schema>
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/schema/elProjectSet.exsd
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/ELProjectSetExtension.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/ELProjectSetExtension.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/ELProjectSetExtension.java 2011-08-10
00:42:25 UTC (rev 33745)
@@ -0,0 +1,47 @@
+package org.jboss.tools.jst.web.kb.refactoring;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.common.el.core.ELCorePlugin;
+
+public class ELProjectSetExtension {
+ public static String EXTENSION_POINT =
"org.jboss.tools.jst.web.kb.elProjectSet"; //$NON-NLS-1$
+
+ String id;
+ IProjectsSet searcher;
+
+ public ELProjectSetExtension() {}
+
+ public String getId() {
+ return id;
+ }
+
+ public IProjectsSet getProjectSet() {
+ return searcher;
+ }
+
+ static ELProjectSetExtension[] INSTANCES;
+
+ public static ELProjectSetExtension[] getInstances() {
+ if(INSTANCES != null) return INSTANCES;
+ List<ELProjectSetExtension> list = new ArrayList<ELProjectSetExtension>();
+ IExtensionPoint point =
Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT);
+ IConfigurationElement[] es = point.getConfigurationElements();
+ for (IConfigurationElement e: es) {
+ ELProjectSetExtension n = new ELProjectSetExtension();
+ n.id = e.getAttribute("id"); //$NON-NLS-1$
+ try{
+ n.searcher = (IProjectsSet)e.createExecutableExtension("projectset-class");
//$NON-NLS-1$
+ }catch(CoreException ex){
+ ELCorePlugin.getDefault().logError(ex);
+ }
+ list.add(n);
+ }
+ return INSTANCES = list.toArray(new ELProjectSetExtension[0]);
+ }
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/ELProjectSetExtension.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/ELReferencesQueryParticipant.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/ELReferencesQueryParticipant.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/ELReferencesQueryParticipant.java 2011-08-10
00:42:25 UTC (rev 33745)
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.jst.web.kb.refactoring;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.ui.search.ElementQuerySpecification;
+import org.eclipse.jdt.ui.search.IMatchPresentation;
+import org.eclipse.jdt.ui.search.IQueryParticipant;
+import org.eclipse.jdt.ui.search.ISearchRequestor;
+import org.eclipse.jdt.ui.search.QuerySpecification;
+import org.eclipse.search.ui.text.Match;
+import org.jboss.tools.common.model.project.ProjectHome;
+import org.jboss.tools.jst.web.kb.refactoring.ELProjectSetExtension;
+import org.jboss.tools.jst.web.kb.refactoring.IProjectsSet;
+import org.jboss.tools.jst.web.kb.refactoring.RefactorSearcher;
+
+public class ELReferencesQueryParticipant implements IQueryParticipant{
+ private ELSearcher searcher;
+
+ public int estimateTicks(QuerySpecification specification) {
+ return 10;
+ }
+
+ public IMatchPresentation getUIParticipant() {
+ return null;
+ }
+
+ public void search(ISearchRequestor requestor,
+ QuerySpecification querySpecification, IProgressMonitor monitor)
+ throws CoreException {
+
+ if(querySpecification instanceof ElementQuerySpecification){
+ if (!isSearchForReferences(querySpecification.getLimitTo()))
+ return;
+
+ ElementQuerySpecification qs = (ElementQuerySpecification)querySpecification;
+ if(qs.getElement() instanceof IMethod || qs.getElement() instanceof IType){
+ IFile file = (IFile)qs.getElement().getResource();
+ if(file == null)
+ return;
+
+ String name = qs.getElement().getElementName();
+
+ searcher = new ELSearcher(requestor, qs.getElement(), file, name);
+ searcher.setSearchScope(qs.getScope());
+
+ searcher.findELReferences();
+ }
+ }
+ }
+
+ public boolean isSearchForReferences(int limitTo) {
+ int maskedLimitTo = limitTo &
~(IJavaSearchConstants.IGNORE_DECLARING_TYPE+IJavaSearchConstants.IGNORE_RETURN_TYPE);
+ if (maskedLimitTo == IJavaSearchConstants.REFERENCES || maskedLimitTo ==
IJavaSearchConstants.ALL_OCCURRENCES) {
+ return true;
+ }
+
+ return false;
+ }
+
+ class ELSearcher extends RefactorSearcher{
+ ISearchRequestor requestor;
+ IProjectsSet projectSet=null;
+
+ public ELSearcher(ISearchRequestor requestor, IJavaElement element, IFile file, String
name){
+ super(file, name, element);
+ this.requestor = requestor;
+ ELProjectSetExtension[] extensions = ELProjectSetExtension.getInstances();
+ if(extensions.length > 0){
+ projectSet = extensions[0].getProjectSet();
+ if(projectSet != null)
+ projectSet.init(file.getProject());
+ }
+
+ }
+
+ protected void outOfSynch(IProject file){
+ // do nothing
+ }
+
+ @Override
+ protected void match(IFile file, int offset, int length) {
+ Match match = new Match(file, offset, length);
+ requestor.reportMatch(match);
+ }
+
+ protected IProject[] getProjects(){
+ if(projectSet != null){
+ return projectSet.getLinkedProjects();
+ }
+ return new IProject[]{baseFile.getProject()};
+ }
+
+ protected IContainer getViewFolder(IProject project){
+ if(projectSet != null){
+ return projectSet.getViewFolder(project);
+ }
+
+ IPath path = ProjectHome.getFirstWebContentPath(baseFile.getProject());
+
+ if(path != null)
+ return project.getFolder(path.removeFirstSegments(1));
+
+ return null;
+ }
+ }
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/ELReferencesQueryParticipant.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/IProjectsSet.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/IProjectsSet.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/IProjectsSet.java 2011-08-10
00:42:25 UTC (rev 33745)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.jst.web.kb.refactoring;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+
+/**
+ *
+ * @author Daniel
+ *
+ * This interface is used for transmit information about seam project structure from seam
plugins through org.jboss.tools.common.el.core.elSearcher extension point
+ */
+public interface IProjectsSet {
+ /**
+ * inits seam project structure
+ * @param project
+ */
+ public void init(IProject project);
+
+ /**
+ * returns all linked seam projects
+ * @return
+ */
+ public IProject[] getLinkedProjects();
+
+ /**
+ * returns view folder (like WEB_CONTENT, EAR_CONTENT) for each seam project
+ * @param project
+ * @return
+ */
+ public IContainer getViewFolder(IProject project);
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/IProjectsSet.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java 2011-08-10
00:01:27 UTC (rev 33744)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/refactoring/RefactorSearcher.java 2011-08-10
00:42:25 UTC (rev 33745)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.jst.web.kb.refactoring;
-import java.io.InputStream;
import java.util.List;
import java.util.StringTokenizer;
@@ -46,7 +45,6 @@
import org.jboss.tools.common.util.BeanUtil;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.jst.web.kb.PageContextFactory;
-import org.jboss.tools.jst.web.kb.WebKbPlugin;
public abstract class RefactorSearcher {
protected static final String JAVA_EXT = "java"; //$NON-NLS-1$
@@ -243,24 +241,6 @@
protected void searchInCach(IFile file){
if(file == null) return;
ELResolver[] resolvers = ELResolverFactoryManager.getInstance().getResolvers(file);
- IRelevanceCheck[] checks = getRelevanceChecks(resolvers);
- String text = null;
- try {
- InputStream is = file.getContents();
- if(is != null) text = FileUtil.readStream(is);
- } catch (CoreException e) {
- WebKbPlugin.getDefault().logError(e);
- }
- if(text != null) {
- boolean found = false;
- for (IRelevanceCheck check: checks) {
- if(check != null && check.isRelevant(text)) {
- found = true;
- break;
- }
- }
- if(!found) return;
- }
ELContext context = PageContextFactory.createPageContext(file);
@@ -269,7 +249,7 @@
ELReference[] references = context.getELReferences();
resolvers = context.getElResolvers();
- checks = getRelevanceChecks(resolvers);
+ IRelevanceCheck[] checks = getRelevanceChecks(resolvers);
if(javaElement != null){
for(ELReference reference : references){
@@ -323,25 +303,6 @@
return checks;
}
- // looking for component references in EL
-// private void scanString(IFile file, String string, int offset) {
-// int startEl = string.indexOf("#{"); //$NON-NLS-1$
-// if(startEl<0)
-// startEl = string.indexOf("${"); //$NON-NLS-1$
-// if(startEl>-1) {
-// ELParser parser = ELParserUtil.getJbossFactory().createParser();
-// ELModel model = parser.parse(string);
-// for (ELInstance instance : model.getInstances()) {
-// for(ELInvocationExpression ie : instance.getExpression().getInvocations()){
-// ELInvocationExpression expression = findComponentReference(ie);
-// if(expression != null){
-// checkMatch(file, expression, offset+getOffset(expression),
getLength(expression));
-// }
-// }
-// }
-// }
-// }
-
protected int getOffset(ELInvocationExpression expression){
if(expression instanceof ELPropertyInvocation){
ELPropertyInvocation pi = (ELPropertyInvocation)expression;
@@ -373,8 +334,6 @@
}
private void scanProperties(IFile file, String content){
- //scanString(file, content, 0);
-
if(!file.getName().equals(SEAM_PROPERTIES_FILE))
return;
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2011-08-10 00:01:27 UTC (rev
33744)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2011-08-10 00:42:25 UTC (rev
33745)
@@ -506,7 +506,7 @@
</extension>
<extension
- point="org.jboss.tools.jsf.elProjectSet">
+ point="org.jboss.tools.jst.web.kb.elProjectSet">
<project-set id="seam.searcher"
projectset-class="org.jboss.tools.seam.internal.core.refactoring.ELProjectSet"
/>
</extension>
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/ELProjectSet.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/ELProjectSet.java 2011-08-10
00:01:27 UTC (rev 33744)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/refactoring/ELProjectSet.java 2011-08-10
00:42:25 UTC (rev 33745)
@@ -14,10 +14,10 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.jboss.tools.common.model.project.ProjectHome;
-import org.jboss.tools.jsf.el.refactoring.ProjectsSet;
+import org.jboss.tools.jst.web.kb.refactoring.IProjectsSet;
import org.jboss.tools.seam.core.SeamProjectsSet;
-public class ELProjectSet implements ProjectsSet {
+public class ELProjectSet implements IProjectsSet {
SeamProjectsSet projectsSet;
IProject project;