Author: scabanovich
Date: 2009-05-15 12:33:08 -0400 (Fri, 15 May 2009)
New Revision: 15304
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/LibraryScanner.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/XMLScanner.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-2808
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2009-05-15
16:32:30 UTC (rev 15303)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2009-05-15
16:33:08 UTC (rev 15304)
@@ -29,6 +29,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import org.jboss.tools.common.model.project.ext.event.Change;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.jst.web.WebModelPlugin;
@@ -500,17 +501,49 @@
* @param source
*/
public void pathRemoved(IPath source) {
+ if(!sourcePaths.contains(source) && !sourcePaths2.containsKey(source)) return;
+ sourcePaths.remove(source);
+ sourcePaths2.remove(source);
+
+ List<Change> changes = null;
//TODO
+
+ Set<ITagLibrary> ls = libraries.removePath(source);
+ if(ls != null) for (ITagLibrary l: ls) {
+ changes = Change.addChange(changes, new Change(this, null, l, null));
+ }
+ fireChanges(changes);
+
+// firePathRemovedToDependentProjects(source);
}
+ List<Change> postponedChanges = null;
+
public void postponeFiring() {
- //TODO
+ if(postponedChanges == null) {
+ postponedChanges = new ArrayList<Change>();
+ }
}
public void fireChanges() {
+ if(postponedChanges == null) return;
+ List<Change> changes = postponedChanges;
+ postponedChanges = null;
+ fireChanges(changes);
+ }
+
+ /**
+ *
+ * @param changes
+ */
+ void fireChanges(List<Change> changes) {
+ if(changes == null || changes.isEmpty()) return;
+ if(postponedChanges != null) {
+ postponedChanges.addAll(changes);
+ return;
+ }
//TODO
}
-
class LibraryStorage {
private Set<ITagLibrary> allFactories = new HashSet<ITagLibrary>();
private ITagLibrary[] allFactoriesArray = null;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/LibraryScanner.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/LibraryScanner.java 2009-05-15
16:32:30 UTC (rev 15303)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/LibraryScanner.java 2009-05-15
16:33:08 UTC (rev 15304)
@@ -10,26 +10,12 @@
******************************************************************************/
package org.jboss.tools.jst.web.kb.internal.scanner;
-import java.io.ByteArrayInputStream;
-
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClassFile;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.IParent;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.impl.FileSystemsImpl;
-import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.common.model.util.XModelObjectUtil;
import org.jboss.tools.jst.web.kb.IKbProject;
import org.jboss.tools.jst.web.model.helpers.InnerModelHelper;
@@ -81,25 +67,26 @@
public boolean isLikelyComponentSource(XModelObject o) {
if(o == null) return false;
- if(o.getChildByPath("seam.properties") != null) return true; //$NON-NLS-1$
- if(o.getChildByPath("META-INF/seam.properties") != null) return true;
//$NON-NLS-1$
- if(o.getChildByPath("META-INF/components.xml") != null) return true;
//$NON-NLS-1$
+ if(o.getChildByPath("META-INF") != null) return true; //$NON-NLS-1$
return false;
}
public LoadedDeclarations parse(XModelObject o, IPath path, IKbProject sp) throws
ScannerException {
if(o == null) return null;
sourcePath = path;
- XModelObject seamProperties = o.getChildByPath("META-INF/seam.properties");
//$NON-NLS-1$
- if(seamProperties == null) seamProperties =
o.getChildByPath("seam.properties"); //$NON-NLS-1$
- XModelObject componentsXML = o.getChildByPath("META-INF/components.xml");
//$NON-NLS-1$
- if(componentsXML == null && seamProperties == null) return null;
+ XModelObject metaInf = o.getChildByPath("META-INF"); //$NON-NLS-1$
+ if(metaInf == null) return null;
LoadedDeclarations ds = new LoadedDeclarations();
- if(componentsXML != null) {
- LoadedDeclarations ds1 = new XMLScanner().parse(componentsXML, path, sp);
- if(ds1 != null) ds.add(ds1);
+ if(metaInf != null) {
+ XModelObject[] tlds = metaInf.getChildren();
+ for (XModelObject tld: tlds) {
+ XMLScanner s = new XMLScanner();
+ //TODO check that tld object is correct.
+ LoadedDeclarations ds1 = s.parse(tld, path, sp);
+ if(ds1 != null) ds.add(ds1);
+ }
}
return ds;
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/XMLScanner.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/XMLScanner.java 2009-05-15
16:32:30 UTC (rev 15303)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/XMLScanner.java 2009-05-15
16:33:08 UTC (rev 15304)
@@ -66,6 +66,7 @@
if(model == null) return false;
XModelObject o = EclipseResourceUtil.getObjectByResource(model, f);
if(o == null) return false;
+ //TODO
if(o.getModelEntity().getName().startsWith("FileSeamComponent")) return true;
//$NON-NLS-1$
return false;
}