[jbosstools-commits] JBoss Tools SVN: r43446 - in trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi: internal/core/impl and 1 other directory.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Wed Sep 5 20:34:02 EDT 2012
Author: scabanovich
Date: 2012-09-05 20:34:02 -0400 (Wed, 05 Sep 2012)
New Revision: 43446
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIProject.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProjectAsYouType.java
Log:
JBIDE-12546
https://issues.jboss.org/browse/JBIDE-12546
Implement in CDIProjectAsYouType ICDIElement, and set it as the parent to class bean of the modified resource.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIProject.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIProject.java 2012-09-06 00:24:29 UTC (rev 43445)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/ICDIProject.java 2012-09-06 00:34:02 UTC (rev 43446)
@@ -18,4 +18,8 @@
public CDICoreNature getNature();
public void setNature(CDICoreNature n);
public void update(boolean updateDependent);
+
+ public boolean isTypeAlternative(String qualifiedName);
+ public boolean isStereotypeAlternative(String qualifiedName);
+ public boolean isClassAlternativeActivated(String fullQualifiedTypeName);
}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java 2012-09-06 00:24:29 UTC (rev 43445)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIElement.java 2012-09-06 00:34:02 UTC (rev 43446)
@@ -28,11 +28,11 @@
*
*/
public abstract class CDIElement implements ICDIElement {
- protected CDIElement parent;
+ protected ICDIElement parent;
protected IPath source;
@Override
- public CDIProject getCDIProject() {
+ public ICDIProject getCDIProject() {
return parent != null ? parent.getCDIProject() : null;
}
@@ -42,7 +42,7 @@
}
public CDIExtensionManager getExtensionManager() {
- CDIProject project = getCDIProject();
+ ICDIProject project = getCDIProject();
return project == null ? null : project.getNature().getExtensionManager();
}
@@ -55,11 +55,11 @@
}
}
- public void setParent(CDIElement parent) {
+ public void setParent(ICDIElement parent) {
this.parent = parent;
}
- public CDIElement getParent() {
+ public ICDIElement getParent() {
return parent;
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProjectAsYouType.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProjectAsYouType.java 2012-09-06 00:24:29 UTC (rev 43445)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProjectAsYouType.java 2012-09-06 00:34:02 UTC (rev 43446)
@@ -19,6 +19,7 @@
import java.util.Set;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -41,6 +42,7 @@
import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IBeanMethod;
+import org.jboss.tools.cdi.core.ICDIElement;
import org.jboss.tools.cdi.core.ICDIProject;
import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IDecorator;
@@ -62,7 +64,6 @@
import org.jboss.tools.cdi.internal.core.scanner.FileSet;
import org.jboss.tools.cdi.internal.core.scanner.ImplementationCollector;
import org.jboss.tools.common.CommonPlugin;
-import org.jboss.tools.common.EclipseUtil;
import org.jboss.tools.common.java.IJavaReference;
import org.jboss.tools.common.java.IParametedType;
import org.jboss.tools.common.text.INodeReference;
@@ -72,7 +73,7 @@
* @author Viacheslav Kabanovich
*
*/
-public class CDIProjectAsYouType implements ICDIProject {
+public class CDIProjectAsYouType implements ICDIProject, ICDIElement {
ICDIProject project;
IFile file;
@@ -243,7 +244,12 @@
} else {
bean = new ClassBean();
}
- bean.setParent((CDIElement)project);
+ /*
+ * Parent can be either 'this' or 'project'. In the second case, it is an original project
+ * that will return 'unmodified' data. In the first case, correctness of 'declaring project'
+ * needs attention.
+ */
+ bean.setParent(this);
bean.setDefinition(typeDefinition);
newDefinitionToClassbeans.put(typeDefinition, bean);
@@ -552,4 +558,53 @@
//nothing
}
+ /**
+ *
+ */
+
+ @Override
+ public ICDIProject getCDIProject() {
+ return this;
+ }
+
+ @Override
+ public ICDIProject getDeclaringProject() {
+ return ((ICDIElement)project).getDeclaringProject();
+ }
+
+ @Override
+ public IPath getSourcePath() {
+ return getResource().getFullPath();
+ }
+
+ @Override
+ public IResource getResource() {
+ return getNature().getProject();
+ }
+
+ @Override
+ public boolean exists() {
+ return true;
+ }
+
+ @Override
+ public String getElementName() {
+ return getNature().getProject().getName();
+ }
+
+ @Override
+ public boolean isTypeAlternative(String qualifiedName) {
+ return project.isTypeAlternative(qualifiedName);
+ }
+
+ @Override
+ public boolean isStereotypeAlternative(String qualifiedName) {
+ return project.isStereotypeAlternative(qualifiedName);
+ }
+
+ @Override
+ public boolean isClassAlternativeActivated(String fullQualifiedTypeName) {
+ return project.isClassAlternativeActivated(fullQualifiedTypeName);
+ }
+
}
More information about the jbosstools-commits
mailing list