Author: scabanovich
Date: 2007-08-08 11:50:16 -0400 (Wed, 08 Aug 2007)
New Revision: 2966
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
Log:
JBIDE-670 - added methods allowing to collect all variables or components visible in
specified scope
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java 2007-08-08
15:48:05 UTC (rev 2965)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java 2007-08-08
15:50:16 UTC (rev 2966)
@@ -69,6 +69,14 @@
public Set<ISeamComponent> getComponentsByScope(ScopeType type);
/**
+ *
+ * @param type
+ * @param addVisibleScopes
+ * @return Set of all ISeamComponents visible in specified context.
+ */
+ public Set<ISeamComponent> getComponentsByScope(ScopeType type, boolean
addVisibleScopes);
+
+ /**
* @param resource path of ISeamComponentDeclaration that belongs to component
* @return Set of ISeamComponents by resource path.
*/
@@ -115,6 +123,14 @@
public Set<ISeamContextVariable> getVariablesByScope(ScopeType scope);
/**
+ *
+ * @param scope
+ * @param addVisibleScopes
+ * @return all seam variables visible in specific context
+ */
+ public Set<ISeamContextVariable> getVariablesByScope(ScopeType scope, boolean
addVisibleScopes);
+
+ /**
* @param full path of IResource where the variable is declared.
* @return Set of ISeamContextVariables by resource path.
*/
@@ -139,6 +155,14 @@
* @return Factories methods of project by scope
*/
public Set<ISeamFactory> getFactoriesByScope(ScopeType scope);
+
+ /**
+ *
+ * @param scope
+ * @param addVisibleScopes
+ * @return Factories of project visible in specified scope
+ */
+ public Set<ISeamFactory> getFactoriesByScope(ScopeType scope, boolean
addVisibleScopes);
/**
* @param resource path of ISeamFactory that belongs to factory declaration
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-08-08
15:48:05 UTC (rev 2965)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-08-08
15:50:16 UTC (rev 2966)
@@ -543,9 +543,13 @@
* @see
org.jboss.tools.seam.core.ISeamProject#getComponentsByScope(org.jboss.tools.seam.core.ScopeType)
*/
public Set<ISeamComponent> getComponentsByScope(ScopeType type) {
+ return getComponentsByScope(type, false);
+ }
+
+ public Set<ISeamComponent> getComponentsByScope(ScopeType type, boolean
addVisibleScopes) {
Set<ISeamComponent> result = new HashSet<ISeamComponent>();
for(SeamComponent component: allComponents.values()) {
- if(type.equals(component.getScope())) {
+ if(isVisibleInScope(component, type, addVisibleScopes)) {
result.add(component);
}
}
@@ -590,15 +594,30 @@
* @see
org.jboss.tools.seam.core.ISeamProject#getVariablesByScope(org.jboss.tools.seam.core.ScopeType)
*/
public Set<ISeamContextVariable> getVariablesByScope(ScopeType scope) {
+ return getVariablesByScope(scope, false);
+ }
+
+ public Set<ISeamContextVariable> getVariablesByScope(ScopeType scope, boolean
addVisibleScopes) {
Set<ISeamContextVariable> result = new HashSet<ISeamContextVariable>();
for (ISeamContextVariable v: allVariables) {
- if(scope.equals(v.getScope())) {
+ if(isVisibleInScope(v, scope, addVisibleScopes)) {
result.add(v);
}
}
return result;
}
+ private boolean isVisibleInScope(ISeamContextVariable v, ScopeType scope, boolean
addVisibleScopes) {
+ if(scope == v.getScope()) {
+ return true;
+ } else if(addVisibleScopes && scope != null && v.getScope() != null) {
+ if(v.getScope().getPriority() >= scope.getPriority()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
public void addFactory(ISeamFactory factory) {
allFactories.add(factory);
}
@@ -624,9 +643,15 @@
}
public Set<ISeamFactory> getFactoriesByScope(ScopeType scope) {
+ return getFactoriesByScope(scope, false);
+ }
+
+ public Set<ISeamFactory> getFactoriesByScope(ScopeType scope, boolean
addVisibleScopes) {
Set<ISeamFactory> result = new HashSet<ISeamFactory>();
for (ISeamFactory f: allFactories) {
- if(scope.equals(f.getScope())) result.add(f);
+ if(isVisibleInScope(f, scope, addVisibleScopes)) {
+ result.add(f);
+ }
}
return result;
}
Show replies by date