Author: scabanovich
Date: 2011-07-22 21:09:07 -0400 (Fri, 22 Jul 2011)
New Revision: 33153
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IBuildParticipant2Feature.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/lib/JarSet.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/lib/ClassPathMonitor.java
Log:
JBIDE-9395
https://issues.jboss.org/browse/JBIDE-9395
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java 2011-07-23
00:37:36 UTC (rev 33152)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java 2011-07-23
01:09:07 UTC (rev 33153)
@@ -42,11 +42,13 @@
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
import org.jboss.tools.cdi.core.extension.IDefinitionContextExtension;
+import org.jboss.tools.cdi.core.extension.feature.IBuildParticipant2Feature;
import org.jboss.tools.cdi.core.extension.feature.IBuildParticipantFeature;
import org.jboss.tools.cdi.internal.core.impl.definition.AnnotationHelper;
import org.jboss.tools.cdi.internal.core.impl.definition.Dependencies;
import org.jboss.tools.cdi.internal.core.scanner.CDIBuilderDelegate;
import org.jboss.tools.cdi.internal.core.scanner.FileSet;
+import org.jboss.tools.cdi.internal.core.scanner.lib.JarSet;
import org.jboss.tools.common.EclipseUtil;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.plugin.ModelPlugin;
@@ -73,6 +75,7 @@
CDIResourceVisitor resourceVisitor = null;
Set<IBuildParticipantFeature> buildParticipants = null;
+ Set<IBuildParticipant2Feature> buildParticipants2 = null;
public CDICoreBuilder() {}
@@ -150,7 +153,7 @@
//1. Check class path.
boolean isClassPathUpdated = n.getClassPath().update();
- Map<String, XModelObject> newJars = new HashMap<String, XModelObject>();
+ JarSet newJars = new JarSet();
if(isClassPathUpdated) {
//2. Update class path. Removed paths will be cached to be applied to working copy of
context.
n.getClassPath().setSrcs(getResourceVisitor().srcs);
@@ -158,10 +161,14 @@
//3. Install extensions. That should be done before constructing working copy of
context.
buildParticipants = n.getExtensionManager().getBuildParticipantFeature();
+ buildParticipants2 = new HashSet<IBuildParticipant2Feature>();
Set<IDefinitionContextExtension> es = new
HashSet<IDefinitionContextExtension>();
for (IBuildParticipantFeature p: buildParticipants) {
IDefinitionContextExtension e = p.getContext();
if(e != null) es.add(e);
+ if(p instanceof IBuildParticipant2Feature) {
+ buildParticipants2.add((IBuildParticipant2Feature)p);
+ }
}
n.getDefinitions().setExtensions(es);
}
@@ -243,12 +250,12 @@
invokeBuilderDelegates(fs, getCDICoreNature());
}
- protected void buildJars(Map<String, XModelObject> newJars) throws CoreException
{
+ protected void buildJars(JarSet newJars) throws CoreException {
IJavaProject jp = EclipseResourceUtil.getJavaProject(getCDICoreNature().getProject());
if(jp == null) return;
FileSet fileSet = new FileSet();
- for (String jar: newJars.keySet()) {
+ for (String jar: newJars.getBeanModules().keySet()) {
Path path = new Path(jar);
IPackageFragmentRoot root = jp.getPackageFragmentRoot(jar);
if(root == null) continue;
@@ -275,11 +282,18 @@
}
}
}
- XModelObject beansXML = newJars.get(jar);
+ XModelObject beansXML = newJars.getBeanModules().get(jar);
fileSet.setBeanXML(path, beansXML);
for (IBuildParticipantFeature p: buildParticipants) p.visitJar(path, root, beansXML);
}
+ if(!buildParticipants2.isEmpty()) {
+ for (String jar: newJars.getFileSystems().keySet()) {
+ Path path = new Path(jar);
+ XModelObject fs = newJars.getFileSystems().get(jar);
+ for (IBuildParticipant2Feature p: buildParticipants2) p.visitJar(path, fs);
+ }
+ }
addBasicTypes(fileSet);
invokeBuilderDelegates(fileSet, getCDICoreNature());
}
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IBuildParticipant2Feature.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IBuildParticipant2Feature.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IBuildParticipant2Feature.java 2011-07-23
01:09:07 UTC (rev 33153)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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.core.extension.feature;
+
+import org.eclipse.core.runtime.IPath;
+import org.jboss.tools.common.model.XModelObject;
+
+/**
+ * This feature visits any jar in classpath.
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public interface IBuildParticipant2Feature extends IBuildParticipantFeature {
+
+ /**
+ * Looks for artifacts in any jar entries.
+ *
+ * @param path
+ * @param beansXML
+ */
+ public void visitJar(IPath path, XModelObject fs);
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/extension/feature/IBuildParticipant2Feature.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/lib/ClassPathMonitor.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/lib/ClassPathMonitor.java 2011-07-23
00:37:36 UTC (rev 33152)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/lib/ClassPathMonitor.java 2011-07-23
01:09:07 UTC (rev 33153)
@@ -50,8 +50,8 @@
super.init();
}
- public Map<String, XModelObject> process() {
- Map<String, XModelObject> newJars = new HashMap<String, XModelObject>();
+ public JarSet process() {
+ JarSet newJars = new JarSet();
for (String p: syncProcessedPaths()) {
synchronized (removedPaths) {
removedPaths.add(new Path(p));
@@ -71,11 +71,13 @@
//Load cdi extensions. Do we need beans.xml to look for extensions?
project.getExtensionManager().setRuntimes(p, readRuntimes(o));
+ newJars.getFileSystems().put(p, o);
+
XModelObject b = o.getChildByPath("META-INF/beans.xml");
if(b == null && !isWeldJar(fileName)) {
continue;
}
- newJars.put(p, b);
+ newJars.getBeanModules().put(p, b);
}
validateProjectDependencies();
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/lib/JarSet.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/lib/JarSet.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/lib/JarSet.java 2011-07-23
01:09:07 UTC (rev 33153)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.internal.core.scanner.lib;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.tools.common.model.XModelObject;
+
+/**
+ *
+ * @author Viacheslav Kabanlvich
+ *
+ */
+public class JarSet {
+ Map<String, XModelObject> fileSystems = new HashMap<String,
XModelObject>();
+ Map<String, XModelObject> beanModules = new HashMap<String,
XModelObject>();
+
+ public Map<String, XModelObject> getBeanModules() {
+ return beanModules;
+ }
+
+ public Map<String, XModelObject> getFileSystems() {
+ return fileSystems;
+ }
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/scanner/lib/JarSet.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain