Author: scabanovich
Date: 2007-07-12 07:41:09 -0400 (Thu, 12 Jul 2007)
New Revision: 2397
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IOpenableElement.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF
trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
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/SeamCoreBuilder.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
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/SeamPropertiesDeclaration.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamResourceVisitor.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaHelper.java
Log:
EXIN-217
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF 2007-07-12 07:28:17
UTC (rev 2396)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/META-INF/MANIFEST.MF 2007-07-12 11:41:09
UTC (rev 2397)
@@ -8,9 +8,11 @@
Bundle-SymbolicName: org.jboss.tools.seam.core; singleton:=true
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
+ org.eclipse.ui.ide,
org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.jdt.core,
+ org.eclipse.jdt.ui,
org.jboss.tools.common.model,
org.eclipse.wst.common.frameworks.ui,
org.eclipse.wst.common.project.facet.core,
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-07-12 07:28:17 UTC (rev
2396)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2007-07-12 11:41:09 UTC (rev
2397)
@@ -27,17 +27,6 @@
</builder>
</extension>
<extension
- id="xmlProblem"
- name="XML Problem"
- point="org.eclipse.core.resources.markers">
- <super
- type="org.eclipse.core.resources.problemmarker">
- </super>
- <persistent
- value="true">
- </persistent>
- </extension>
- <extension
id="seamProblem"
name="Seam Problem"
point="org.eclipse.core.resources.markers">
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IOpenableElement.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IOpenableElement.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/IOpenableElement.java 2007-07-12
11:41:09 UTC (rev 2397)
@@ -0,0 +1,6 @@
+package org.jboss.tools.seam.core;
+
+public interface IOpenableElement {
+
+ public void open();
+}
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-07-12
07:28:17 UTC (rev 2396)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/ISeamProject.java 2007-07-12
11:41:09 UTC (rev 2397)
@@ -145,4 +145,9 @@
*/
public void removeSeamProjectListener(ISeamProjectChangeListener listener);
+ /**
+ * Loads results of last build if that was not done before.
+ */
+ public void resolve();
+
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java 2007-07-12
07:28:17 UTC (rev 2396)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCoreBuilder.java 2007-07-12
11:41:09 UTC (rev 2397)
@@ -12,12 +12,6 @@
import java.util.Map;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
@@ -31,9 +25,6 @@
import org.jboss.tools.seam.internal.core.scanner.java.JavaScanner;
import org.jboss.tools.seam.internal.core.scanner.lib.LibraryScanner;
import org.jboss.tools.seam.internal.core.scanner.xml.XMLScanner;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.DefaultHandler;
public class SeamCoreBuilder extends IncrementalProjectBuilder {
public static String BUILDER_ID = "org.jboss.tools.seam.core.seambuilder";
@@ -46,14 +37,10 @@
SeamResourceVisitor resourceVisitor = null;
- SeamProject getSeamProject() {
- IProject p = getProject();
- try {
- return p == null ? null : (SeamProject)p.getNature(ISeamProject.NATURE_ID);
- } catch (CoreException e) {
- //TODO
- return null;
- }
+ SeamProject getSeamProject() {
+ IProject p = getProject();
+ if(p == null) return null;
+ return (SeamProject)SeamCorePlugin.getSeamProject(p, false);
}
SeamResourceVisitor getResourceVisitor() {
@@ -87,53 +74,8 @@
}
}
- class XMLErrorHandler extends DefaultHandler {
-
- private IFile file;
-
- public XMLErrorHandler(IFile file) {
- this.file = file;
- }
-
- private void addMarker(SAXParseException e, int severity) {
- SeamCoreBuilder.this.addMarker(file, e.getMessage(), e
- .getLineNumber(), severity);
- }
-
- public void error(SAXParseException exception) throws SAXException {
- addMarker(exception, IMarker.SEVERITY_ERROR);
- }
-
- public void fatalError(SAXParseException exception) throws SAXException {
- addMarker(exception, IMarker.SEVERITY_ERROR);
- }
-
- public void warning(SAXParseException exception) throws SAXException {
- addMarker(exception, IMarker.SEVERITY_WARNING);
- }
- }
-
- private static final String MARKER_TYPE =
"org.jboss.tools.seam.core.xmlProblem";
-
- private SAXParserFactory parserFactory;
-
- private void addMarker(IFile file, String message, int lineNumber,
- int severity) {
- try {
- IMarker marker = file.createMarker(MARKER_TYPE);
- marker.setAttribute(IMarker.MESSAGE, message);
- marker.setAttribute(IMarker.SEVERITY, severity);
- if (lineNumber == -1) {
- lineNumber = 1;
- }
- marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
- } catch (CoreException e) {
- }
- }
-
- /*
- *
- * @see org.eclipse.core.internal.events.InternalBuilder#build(int,
+ /**
+ * @see org.eclipse.core.resource.InternalProjectBuilder#build(int,
* java.util.Map, org.eclipse.core.runtime.IProgressMonitor)
*/
protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
@@ -159,25 +101,6 @@
return null;
}
- void checkXML(IResource resource) {
- if (resource instanceof IFile && resource.getName().endsWith(".xml"))
{
- IFile file = (IFile) resource;
- deleteMarkers(file);
- XMLErrorHandler reporter = new XMLErrorHandler(file);
- try {
- getParser().parse(file.getContents(), reporter);
- } catch (Exception e1) {
- }
- }
- }
-
- private void deleteMarkers(IFile file) {
- try {
- file.deleteMarkers(MARKER_TYPE, false, IResource.DEPTH_ZERO);
- } catch (CoreException ce) {
- }
- }
-
protected void fullBuild(final IProgressMonitor monitor)
throws CoreException {
try {
@@ -187,14 +110,6 @@
}
}
- private SAXParser getParser() throws ParserConfigurationException,
- SAXException {
- if (parserFactory == null) {
- parserFactory = SAXParserFactory.newInstance();
- }
- return parserFactory.newSAXParser();
- }
-
protected void incrementalBuild(IResourceDelta delta,
IProgressMonitor monitor) throws CoreException {
// the visitor does the work.
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java 2007-07-12
07:28:17 UTC (rev 2396)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamCorePlugin.java 2007-07-12
11:41:09 UTC (rev 2397)
@@ -15,7 +15,6 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.jboss.tools.common.log.BaseUIPlugin;
import org.jboss.tools.common.log.IPluginLog;
-import org.jboss.tools.seam.internal.core.SeamProject;
import org.osgi.framework.BundleContext;
/**
@@ -88,9 +87,10 @@
* (3) project has no seam nature
* (4) creating seam project failed.
* @param project
+ * @param resolve if true and results of last build have not been resolved they are
loaded.
* @return
*/
- public static ISeamProject getSeamProject(IProject project) {
+ public static ISeamProject getSeamProject(IProject project, boolean resolve) {
if(project == null || !project.exists() || !project.isOpen()) return null;
try {
if(!project.hasNature(ISeamProject.NATURE_ID)) return null;
@@ -99,8 +99,8 @@
return null;
}
try {
- SeamProject seamProject = (SeamProject)project.getNature(ISeamProject.NATURE_ID);
- seamProject.resolveStorage(true);
+ ISeamProject seamProject = (ISeamProject)project.getNature(ISeamProject.NATURE_ID);
+ if(resolve) seamProject.resolve();
return seamProject;
} catch (Exception e) {
getPluginLog().logError(e);
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java 2007-07-12
07:28:17 UTC (rev 2396)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponent.java 2007-07-12
11:41:09 UTC (rev 2397)
@@ -77,7 +77,7 @@
if(javaDeclaration != null) return javaDeclaration.getClassName();
Set<ISeamXmlComponentDeclaration> xml = getXmlDeclarations();
for(ISeamXmlComponentDeclaration d: xml) {
- if(d.getClassName() != null) return d.getClassName();
+ if(d.getClassName() != null && d.getClassName().length() > 0) return
d.getClassName();
}
return null;
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-12
07:28:17 UTC (rev 2396)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamComponentDeclaration.java 2007-07-12
11:41:09 UTC (rev 2397)
@@ -16,6 +16,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.jboss.tools.seam.core.IOpenableElement;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
import org.jboss.tools.seam.core.ISeamTextSourceReference;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
@@ -26,7 +27,7 @@
/**
* @author Viacheslav Kabanovich
*/
-public abstract class SeamComponentDeclaration extends SeamObject implements
ISeamComponentDeclaration {
+public abstract class SeamComponentDeclaration extends SeamObject implements
ISeamComponentDeclaration, IOpenableElement {
public static final String PATH_OF_NAME = "name";
@@ -116,5 +117,9 @@
attributes.put(ISeamXmlComponentDeclaration.NAME, value);
name = value == null ? null : value.getValue();
}
+
+ public void open() {
+
+ }
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-12
07:28:17 UTC (rev 2396)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamJavaComponentDeclaration.java 2007-07-12
11:41:09 UTC (rev 2397)
@@ -8,6 +8,7 @@
import org.eclipse.jdt.core.IMember;
import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.ui.JavaUI;
import org.jboss.tools.seam.core.BijectedAttributeType;
import org.jboss.tools.seam.core.IBijectedAttribute;
import org.jboss.tools.seam.core.IRole;
@@ -18,6 +19,7 @@
import org.jboss.tools.seam.core.ScopeType;
import org.jboss.tools.seam.core.SeamComponentMethodType;
import org.jboss.tools.seam.core.SeamComponentPrecedenceType;
+import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.event.Change;
import org.jboss.tools.seam.internal.core.scanner.java.ValueInfo;
@@ -329,4 +331,12 @@
}
}
+ public void open() {
+ if(type == null) return;
+ try {
+ JavaUI.openInEditor(type);
+ } catch (Exception e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ }
}
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-07-12
07:28:17 UTC (rev 2396)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamProject.java 2007-07-12
11:41:09 UTC (rev 2397)
@@ -119,7 +119,7 @@
setSourcePath(project.getFullPath());
resource = project;
classPath.init();
- load();
+// load();
}
public ClassPath getClassPath() {
@@ -135,6 +135,10 @@
}
}
+ public void resolve() {
+ resolveStorage(true);
+ }
+
/**
* Loads results of last build, which are considered
* actual until next build.
@@ -236,6 +240,8 @@
boolean nameChanged = current != null && !stringsEqual(name,
current.getName());
SeamComponent c = getComponent(name);
+
+ String oldClassName = c == null ? null : c.getClassName();
if(current != null) {
List<Change> changes = current.merge(loaded);
@@ -287,12 +293,23 @@
} else if(loaded instanceof ISeamXmlComponentDeclaration) {
ISeamXmlComponentDeclaration xml = (ISeamXmlComponentDeclaration)loaded;
String className = xml.getClassName();
+ List<Change> changes = null;
+ if(isClassNameChanged(oldClassName, className)) {
+ SeamComponentDeclaration[] ds1 = c.getAllDeclarations().toArray(new
SeamComponentDeclaration[0]);
+ for (int i1 = 0; i1 < ds1.length; i1++) {
+ if(!(ds1[i1] instanceof ISeamJavaComponentDeclaration)) continue;
+ ISeamJavaComponentDeclaration jcd = (ISeamJavaComponentDeclaration)ds1[i1];
+ if(jcd.getClassName().equals(className)) continue;
+ c.removeDeclaration(jcd);
+ changes = Change.addChange(changes, new Change(c, null, jcd, null));
+ }
+ }
SeamJavaComponentDeclaration j = javaDeclarations.get(className);
if(j != null) {
c.addDeclaration(j);
- List<Change> changes = Change.addChange(null, new Change(c, null, null, j));
- fireChanges(changes);
+ changes = Change.addChange(changes, new Change(c, null, null, j));
}
+ fireChanges(changes);
}
}
fireChanges(addedComponents);
@@ -323,10 +340,16 @@
factoryDeclarationsRemoved(currentFactories);
}
-
+
boolean stringsEqual(String s1, String s2) {
return s1 == null ? s2 == null : s1.equals(s2);
}
+
+ private boolean isClassNameChanged(String oldClassName, String newClassName) {
+ if(oldClassName == null || oldClassName.length() == 0) return false;
+ if(newClassName == null || newClassName.length() == 0) return false;
+ return !oldClassName.equals(newClassName);
+ }
/**
* Package local method called by builder.
@@ -354,17 +377,9 @@
changes = Change.addChange(changes, new Change(c, null, ds[i], null));
}
}
- if(c.getAllDeclarations().size() == 0) {
+ if(isComponentEmpty(c)) {
iterator.remove();
- ISeamElement p = c.getParent();
- if(p instanceof SeamScope) {
- ((SeamScope)p).removeComponent(c);
- changes = Change.addChange(changes, new Change(p, null, c, null));
- }
- allVariables.remove(c);
- changes = null;
- changes = Change.addChange(changes, new Change(this, null, c, null));
-
+ changes = removeEmptyComponent(c);
}
fireChanges(changes);
}
@@ -419,19 +434,33 @@
changes = Change.addChange(changes, new Change(c, null, ds[i], null));
}
}
- if(c.getAllDeclarations().size() == 0) {
+ if(isComponentEmpty(c)) {
iterator.remove();
- ISeamElement p = c.getParent();
- if(p instanceof SeamScope) {
- ((SeamScope)p).removeComponent(c);
- changes = Change.addChange(changes, new Change(p, null, c, null));
- }
- allVariables.remove(c);
- changes = Change.addChange(null, new Change(this, null, c, null));
+ changes = removeEmptyComponent(c);
}
fireChanges(changes);
}
}
+
+ private List<Change> removeEmptyComponent(SeamComponent c) {
+ List<Change> changes = null;
+ ISeamElement p = c.getParent();
+ if(p instanceof SeamScope) {
+ ((SeamScope)p).removeComponent(c);
+ changes = Change.addChange(null, new Change(p, null, c, null));
+ }
+ allVariables.remove(c);
+ changes = Change.addChange(changes, new Change(this, null, c, null));
+ return changes;
+ }
+
+ private boolean isComponentEmpty(SeamComponent c) {
+ if(c.getAllDeclarations().size() == 0) return true;
+ for (ISeamComponentDeclaration d: c.getAllDeclarations()) {
+ if(c.getName().equals(d.getName())) return false;
+ }
+ return true;
+ }
public Map<Object,ISeamFactory> findFactoryDeclarations(IPath source) {
Map<Object,ISeamFactory> map = new HashMap<Object, ISeamFactory>();
@@ -619,8 +648,7 @@
return result;
}
- /*
- * (non-Javadoc)
+ /**
* @see
org.jboss.tools.seam.core.ISeamProject#getVariablesByPath(org.eclipse.core.runtime.IPath)
*/
public Set<ISeamContextVariable> getVariablesByPath(IPath path) {
@@ -707,4 +735,4 @@
}
}
-}
\ No newline at end of file
+}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java 2007-07-12
07:28:17 UTC (rev 2396)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPropertiesDeclaration.java 2007-07-12
11:41:09 UTC (rev 2397)
@@ -6,8 +6,14 @@
import java.util.List;
import java.util.Map;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.ide.IDE;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.util.FindObjectHelper;
import org.jboss.tools.seam.core.ISeamPropertiesDeclaration;
import org.jboss.tools.seam.core.ISeamProperty;
+import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.event.Change;
public class SeamPropertiesDeclaration extends SeamComponentDeclaration
@@ -85,4 +91,23 @@
return changes;
}
+ public void open() {
+ if(id instanceof XModelObject) {
+ XModelObject o = (XModelObject)id;
+ try {
+ FindObjectHelper.findModelObject(o, FindObjectHelper.IN_EDITOR_ONLY);
+ } catch(Exception e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+ } else if(getResource() instanceof IFile) {
+ IFile f = (IFile)getResource();
+ try {
+ IWorkbenchPage page =
SeamCorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ if(page != null) IDE.openEditor(page, f);
+ } catch(Exception e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ }
+
+ }
+ }
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamResourceVisitor.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamResourceVisitor.java 2007-07-12
07:28:17 UTC (rev 2396)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamResourceVisitor.java 2007-07-12
11:41:09 UTC (rev 2397)
@@ -11,8 +11,15 @@
package org.jboss.tools.seam.internal.core;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.jboss.tools.common.model.plugin.ModelPlugin;
+import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.internal.core.scanner.IFileScanner;
import org.jboss.tools.seam.internal.core.scanner.LoadedDeclarations;
@@ -29,8 +36,11 @@
};
SeamProject p;
+ IPath output = null;
+
public SeamResourceVisitor(SeamProject p) {
this.p = p;
+ getJavaProjectOutput(p.getProject());
}
public IResourceVisitor getVisitor() {
@@ -40,6 +50,9 @@
public boolean visit(IResource resource) {
if(resource instanceof IFile) {
IFile f = (IFile)resource;
+ if(output != null && output.isPrefixOf(resource.getFullPath())) {
+ return false;
+ }
for (int i = 0; i < FILE_SCANNERS.length; i++) {
IFileScanner scanner = FILE_SCANNERS[i];
if(scanner.isRelevant(f)) {
@@ -57,6 +70,11 @@
}
}
}
+ if(resource instanceof IFolder) {
+ if(output != null && output.isPrefixOf(resource.getFullPath())) {
+ return false;
+ }
+ }
//return true to continue visiting children.
return true;
}
@@ -66,4 +84,17 @@
p.registerComponents(c, resource.getFullPath());
}
+ public IPath getJavaProjectOutput(IProject project) {
+ if(project == null || !project.isOpen()) return null;
+ if(output != null) return output;
+ try {
+ if(!project.hasNature(JavaCore.NATURE_ID)) return null;
+ IJavaProject javaProject = JavaCore.create(project);
+ return output = javaProject.getOutputLocation();
+ } catch (Exception e) {
+ SeamCorePlugin.getPluginLog().logError(e);
+ return null;
+ }
+ }
+
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2007-07-12
07:28:17 UTC (rev 2396)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/scanner/xml/XMLScanner.java 2007-07-12
11:41:09 UTC (rev 2397)
@@ -24,7 +24,6 @@
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.core.ISeamXmlComponentDeclaration;
-import org.jboss.tools.seam.core.ISeamXmlFactory;
import org.jboss.tools.seam.internal.core.SeamProperty;
import org.jboss.tools.seam.internal.core.SeamXmlComponentDeclaration;
import org.jboss.tools.seam.internal.core.SeamXmlFactory;
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaHelper.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaHelper.java 2007-07-12
07:28:17 UTC (rev 2396)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamJavaHelper.java 2007-07-12
11:41:09 UTC (rev 2397)
@@ -19,7 +19,7 @@
public ISeamProject getSeamProject() {
ISeamProject project = null;
try {
- project = SeamCorePlugin.getSeamProject(getProject());
+ project = SeamCorePlugin.getSeamProject(getProject(), true);
} catch (Exception e) {
SeamCorePlugin.getDefault().logError("Can't get Seam Project", e);
}