JBoss Tools SVN: r37691 - trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-06 14:24:35 -0500 (Fri, 06 Jan 2012)
New Revision: 37691
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/CDISearchParticipantTest.java
trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/FiveDependentProjectsSearchParticipantTest.java
Log:
JBIDE-10601
https://issues.joss.org/browse/JBIDE-10601
Method EclipseUtil.getCompilationUnit(IFile) should return existing Java element or null.
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/CDISearchParticipantTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/CDISearchParticipantTest.java 2012-01-06 19:21:36 UTC (rev 37690)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/CDISearchParticipantTest.java 2012-01-06 19:24:35 UTC (rev 37691)
@@ -43,6 +43,9 @@
assertNotNull("File - "+fileName+" not found", file);
try{
ICompilationUnit compilationUnit = EclipseUtil.getCompilationUnit(file);
+
+ assertNotNull("CompilationUnit not found", compilationUnit);
+
IJavaElement element = null;
IType type = compilationUnit.findPrimaryType();
Modified: trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/FiveDependentProjectsSearchParticipantTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/FiveDependentProjectsSearchParticipantTest.java 2012-01-06 19:21:36 UTC (rev 37690)
+++ trunk/cdi/tests/org.jboss.tools.cdi.ui.test/src/org/jboss/tools/cdi/ui/test/search/FiveDependentProjectsSearchParticipantTest.java 2012-01-06 19:24:35 UTC (rev 37691)
@@ -64,6 +64,9 @@
assertNotNull("File - "+fileName+" not found", file);
try{
ICompilationUnit compilationUnit = EclipseUtil.getCompilationUnit(file);
+
+ assertNotNull("CompilationUnit not found", compilationUnit);
+
IJavaElement element = null;
IType type = compilationUnit.findPrimaryType();
12 years, 12 months
JBoss Tools SVN: r37690 - trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-06 14:21:36 -0500 (Fri, 06 Jan 2012)
New Revision: 37690
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/AddSuppressWarningsMarkerResolution.java
Log:
JBIDE-10601
https://issues.joss.org/browse/JBIDE-10601
Method EclipseUtil.getCompilationUnit(IFile) should return existing Java element or null.
Modified: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/AddSuppressWarningsMarkerResolution.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/AddSuppressWarningsMarkerResolution.java 2012-01-06 19:20:33 UTC (rev 37689)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/marker/AddSuppressWarningsMarkerResolution.java 2012-01-06 19:21:36 UTC (rev 37690)
@@ -109,6 +109,9 @@
disablePreference();
try {
ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ if(original == null) {
+ return;
+ }
ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
CompilationUnit cuNode = ASTTools.buildASTRoot(compilationUnit);
12 years, 12 months
JBoss Tools SVN: r37689 - trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-06 14:20:33 -0500 (Fri, 06 Jan 2012)
New Revision: 37689
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddLocalBeanMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddSerializableInterfaceMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldProtectedMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldStaticMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodPublicMarkerResolution.java
Log:
JBIDE-10601
https://issues.joss.org/browse/JBIDE-10601
Method EclipseUtil.getCompilationUnit(IFile) should return existing Java element or null.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddLocalBeanMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddLocalBeanMarkerResolution.java 2012-01-06 19:19:29 UTC (rev 37688)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddLocalBeanMarkerResolution.java 2012-01-06 19:20:33 UTC (rev 37689)
@@ -62,6 +62,9 @@
public void run(IMarker marker) {
try{
ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ if(original == null) {
+ return;
+ }
ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
IBuffer buffer = compilationUnit.getBuffer();
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddSerializableInterfaceMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddSerializableInterfaceMarkerResolution.java 2012-01-06 19:19:29 UTC (rev 37688)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddSerializableInterfaceMarkerResolution.java 2012-01-06 19:20:33 UTC (rev 37689)
@@ -54,6 +54,9 @@
public void run(IMarker marker) {
try{
ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ if(original == null) {
+ return;
+ }
ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
CompilationUnitChange change = new CompilationUnitChange("", compilationUnit);
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2012-01-06 19:19:29 UTC (rev 37688)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2012-01-06 19:20:33 UTC (rev 37689)
@@ -790,7 +790,7 @@
try{
ICompilationUnit compilationUnit = EclipseUtil.getCompilationUnit(file);
- return compilationUnit.getElementAt(start);
+ return compilationUnit == null ? null : compilationUnit.getElementAt(start);
}catch(CoreException ex){
CDIUIPlugin.getDefault().logError(ex);
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java 2012-01-06 19:19:29 UTC (rev 37688)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeBeanScopedDependentMarkerResolution.java 2012-01-06 19:20:33 UTC (rev 37689)
@@ -68,6 +68,9 @@
return;
try{
ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ if(original == null) {
+ return;
+ }
ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
CompilationUnitChange change = new CompilationUnitChange("", compilationUnit);
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldProtectedMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldProtectedMarkerResolution.java 2012-01-06 19:19:29 UTC (rev 37688)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldProtectedMarkerResolution.java 2012-01-06 19:20:33 UTC (rev 37689)
@@ -75,6 +75,9 @@
}
try{
ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ if(original == null) {
+ return;
+ }
ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
CompilationUnitChange change = new CompilationUnitChange("", compilationUnit);
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldStaticMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldStaticMarkerResolution.java 2012-01-06 19:19:29 UTC (rev 37688)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeFieldStaticMarkerResolution.java 2012-01-06 19:20:33 UTC (rev 37689)
@@ -60,6 +60,9 @@
public void run(IMarker marker) {
try{
ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ if(original == null) {
+ return;
+ }
ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
CompilationUnitChange change = new CompilationUnitChange("", compilationUnit);
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java 2012-01-06 19:19:29 UTC (rev 37688)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodBusinessMarkerResolution.java 2012-01-06 19:20:33 UTC (rev 37689)
@@ -63,6 +63,9 @@
public void run(IMarker marker) {
try{
ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ if(original == null) {
+ return;
+ }
ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
IBuffer buffer = compilationUnit.getBuffer();
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodPublicMarkerResolution.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodPublicMarkerResolution.java 2012-01-06 19:19:29 UTC (rev 37688)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/MakeMethodPublicMarkerResolution.java 2012-01-06 19:20:33 UTC (rev 37689)
@@ -61,6 +61,9 @@
public void run(IMarker marker) {
try{
ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ if(original == null) {
+ return;
+ }
ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
CompilationUnitChange change = new CompilationUnitChange("", compilationUnit);
12 years, 12 months
JBoss Tools SVN: r37688 - trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-06 14:19:29 -0500 (Fri, 06 Jan 2012)
New Revision: 37688
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/CDISeamResourceLoadingHyperlinkDetector.java
Log:
JBIDE-10601
https://issues.joss.org/browse/JBIDE-10601
Method EclipseUtil.getCompilationUnit(IFile) should return existing Java element or null.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/CDISeamResourceLoadingHyperlinkDetector.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/CDISeamResourceLoadingHyperlinkDetector.java 2012-01-06 19:18:21 UTC (rev 37687)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.seam.text.ext/src/org/jboss/tools/cdi/seam/text/ext/hyperlink/CDISeamResourceLoadingHyperlinkDetector.java 2012-01-06 19:19:29 UTC (rev 37688)
@@ -71,7 +71,7 @@
ICompilationUnit cu = EclipseUtil.getCompilationUnit(file);
- IJavaElement element = cu.getElementAt(offset);
+ IJavaElement element = cu == null ? null : cu.getElementAt(offset);
if(element != null){
if(element instanceof IField){
IAnnotation annotation = CDIMarkerResolutionUtils.findAnnotation(element, RESOURCE_ANNOTATION);
12 years, 12 months
JBoss Tools SVN: r37687 - trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-06 14:18:21 -0500 (Fri, 06 Jan 2012)
New Revision: 37687
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/AddQualifiersToBeanProcessor.java
Log:
JBIDE-10601
https://issues.joss.org/browse/JBIDE-10601
Method EclipseUtil.getCompilationUnit(IFile) should return existing Java element or null.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/AddQualifiersToBeanProcessor.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/AddQualifiersToBeanProcessor.java 2012-01-06 19:16:09 UTC (rev 37686)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/AddQualifiersToBeanProcessor.java 2012-01-06 19:18:21 UTC (rev 37687)
@@ -84,6 +84,9 @@
IFile file = (IFile)selectedBean.getBeanClass().getResource();
ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ if(original == null) {
+ return rootChange;
+ }
ICompilationUnit compilationUnit = original.getWorkingCopy(pm);
12 years, 12 months
JBoss Tools SVN: r37686 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-06 14:16:09 -0500 (Fri, 06 Jan 2012)
New Revision: 37686
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/AbstractSeamMarkerResolution.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/AddSetterMarkerResolution.java
Log:
JBIDE-10601
https://issues.joss.org/browse/JBIDE-10601
Method EclipseUtil.getCompilationUnit(IFile) should return existing Java element or null.
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/AbstractSeamMarkerResolution.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/AbstractSeamMarkerResolution.java 2012-01-06 18:03:03 UTC (rev 37685)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/AbstractSeamMarkerResolution.java 2012-01-06 19:16:09 UTC (rev 37686)
@@ -56,6 +56,9 @@
protected void deleteAnnotation(){
try{
ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ if(original == null) {
+ return;
+ }
ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
IJavaElement javaElement = compilationUnit.getElementAt(start);
@@ -120,6 +123,9 @@
protected void addAnnotation(String annotationString, boolean insertName){
try{
ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ if(original == null) {
+ return;
+ }
ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
IJavaElement javaElement = compilationUnit.getElementAt(start);
@@ -153,6 +159,9 @@
protected void addAnnotatedMethod(){
try{
ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ if(original == null) {
+ return;
+ }
ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
final String lineDelim= compilationUnit.findRecommendedLineSeparator();
@@ -192,6 +201,9 @@
protected void renameAnnotation(String param, String importName, boolean generate){
try{
ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ if(original == null) {
+ return;
+ }
ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
IJavaElement javaElement = compilationUnit.getElementAt(start);
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/AddSetterMarkerResolution.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/AddSetterMarkerResolution.java 2012-01-06 18:03:03 UTC (rev 37685)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/AddSetterMarkerResolution.java 2012-01-06 19:16:09 UTC (rev 37686)
@@ -57,6 +57,9 @@
IFile file = (IFile)javaDeclaration.getResource();
try{
ICompilationUnit original = EclipseUtil.getCompilationUnit(file);
+ if(original == null) {
+ return;
+ }
ICompilationUnit compilationUnit = original.getWorkingCopy(new NullProgressMonitor());
String lineDelim= JavaPropertyGenerator.getLineDelimiterUsed(compilationUnit);
12 years, 12 months
JBoss Tools SVN: r37685 - in trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb: internal and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-06 13:03:03 -0500 (Fri, 06 Jan 2012)
New Revision: 37685
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/WebKbPlugin.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java
Log:
JBIDE-10583
https://issues.joss.org/browse/JBIDE-10583
Processed pre-delete and pre-close project events to clean dependencies.
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/WebKbPlugin.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/WebKbPlugin.java 2012-01-06 17:34:37 UTC (rev 37684)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/WebKbPlugin.java 2012-01-06 18:03:03 UTC (rev 37685)
@@ -6,6 +6,10 @@
import java.util.Set;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.ISaveContext;
import org.eclipse.core.resources.ISaveParticipant;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -39,6 +43,7 @@
* The constructor
*/
public WebKbPlugin() {
+ plugin = this;
}
/*
@@ -47,7 +52,7 @@
*/
public void start(BundleContext context) throws Exception {
super.start(context);
- plugin = this;
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener);
ResourcesPlugin.getWorkspace().addSaveParticipant(PLUGIN_ID, new ISaveParticipant() {
@@ -73,8 +78,6 @@
KbProject sp = (KbProject)KbProjectFactory.getKbProject(context.getProject(), false, true);
try {
if(sp != null && sp.getModificationsSinceLastStore() > 0) {
-// sp.printModifications();
- //Not any project is a seam project
sp.store();
}
} catch (IOException e) {
@@ -101,7 +104,9 @@
private void cleanObsoleteFiles() {
IProject[] ps = ResourcesPlugin.getWorkspace().getRoot().getProjects();
Set<String> projectNames = new HashSet<String>();
- for (IProject p: ps) projectNames.add(p.getName());
+ for (IProject p: ps) {
+ projectNames.add(p.getName());
+ }
WebKbPlugin plugin = WebKbPlugin.getDefault();
if(plugin!=null) {
IPath path = plugin.getStateLocation();
@@ -125,14 +130,34 @@
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener);
super.stop(context);
-
- // Fix for JBIDE-7621: The following line is moved to the very end of the method
- // due to prevent NullPointerException to be thrown in cleanObsoleteFiles() method --->>>
- plugin = null;
- // <<<---
}
+ IResourceChangeListener resourceChangeListener = new RCL();
+
+ class RCL implements IResourceChangeListener {
+
+ public void resourceChanged(IResourceChangeEvent event) {
+ if(event.getType() == IResourceChangeEvent.PRE_DELETE || event.getType() == IResourceChangeEvent.PRE_CLOSE) {
+ IResource r = event.getResource();
+ if(r instanceof IProject) {
+ KbProject n = (KbProject)KbProjectFactory.getKbProject((IProject)r, false, true);
+ if(n != null) {
+ n.dispose();
+ }
+ }
+ } else if(event.getType() == IResourceChangeEvent.POST_CHANGE) {
+ IResourceDelta[] cs = event.getDelta().getAffectedChildren(IResourceDelta.CHANGED);
+ for (IResourceDelta c: cs) {
+ if((c.getFlags() & IResourceDelta.OPEN) != 0 && c.getResource() instanceof IProject) {
+ IProject p = (IProject)c.getResource();
+ KbProjectFactory.getKbProject(p, true, true);
+ }
+ }
+ }
+ }
+ }
/**
* Returns the shared instance
*
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 2012-01-06 17:34:37 UTC (rev 37684)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/KbProject.java 2012-01-06 18:03:03 UTC (rev 37685)
@@ -141,6 +141,8 @@
*/
public void deconfigure() throws CoreException {
removeFromBuildSpec(KbBuilder.BUILDER_ID);
+ dispose();
+ clearStorage();
}
/*
@@ -219,7 +221,7 @@
}
}
- KbProject[] getDependentKbProjects() {
+ public KbProject[] getDependentKbProjects() {
synchronized (usedBy) {
return usedBy.toArray(new KbProject[0]);
}
@@ -336,7 +338,9 @@
} finally {
fireChanges();
- modifications = 0;
+ if(getStorageFile() != null && getStorageFile().exists()) {
+ modifications = 0;
+ }
}
}
@@ -1088,4 +1092,17 @@
public void setExtensionModel(String id, Object model) {
extensionModels.put(id, model);
}
+
+ public void dispose() {
+ KbProject[] ds = dependsOn.toArray(new KbProject[0]);
+ for (KbProject p: ds) {
+ removeKbProject(p);
+ }
+ KbProject[] us = usedBy.toArray(new KbProject[0]);
+ for (KbProject p: us) {
+ p.removeKbProject(this);
+ }
+ modifications++;
+ }
+
}
\ No newline at end of file
12 years, 12 months
JBoss Tools SVN: r37684 - trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-06 12:34:37 -0500 (Fri, 06 Jan 2012)
New Revision: 37684
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java
Log:
JBIDE-10586
https://issues.joss.org/browse/JBIDE-10586
Rolled back accidental commit of debugging code.
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 2012-01-06 17:13:57 UTC (rev 37683)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java 2012-01-06 17:34:37 UTC (rev 37684)
@@ -470,12 +470,8 @@
}
}
} else {
- try {
IType[] ts = unit.getTypes();
fileSet.add(f.getFullPath(), ts);
- } catch (Exception e) {
- e.printStackTrace();
- }
}
}
}
12 years, 12 months
JBoss Tools SVN: r37683 - trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-06 12:13:57 -0500 (Fri, 06 Jan 2012)
New Revision: 37683
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIBeanQueryParticipant.java
Log:
JBIDE-10586
https://issues.joss.org/browse/JBIDE-10586
Activation of dependent projects provided.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIBeanQueryParticipant.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIBeanQueryParticipant.java 2012-01-06 17:11:30 UTC (rev 37682)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/search/CDIBeanQueryParticipant.java 2012-01-06 17:13:57 UTC (rev 37683)
@@ -66,7 +66,7 @@
searchInProject(requestor, querySpecification, cdiProject, monitor, element);
- CDICoreNature[] natures = cdiProject.getNature().getAllDependentProjects();
+ CDICoreNature[] natures = cdiProject.getNature().getAllDependentProjects(true);
for(CDICoreNature nature : natures){
ICDIProject p = nature.getDelegate();
if(p != null){
12 years, 12 months
JBoss Tools SVN: r37682 - in trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi: internal/core/impl and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-06 12:11:30 -0500 (Fri, 06 Jan 2012)
New Revision: 37682
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/CDICoreNature.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICorePlugin.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIProjectTree.java
Log:
JBIDE-10586
https://issues.joss.org/browse/JBIDE-10586
Tests are added.
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 2012-01-06 14:23:15 UTC (rev 37681)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreBuilder.java 2012-01-06 17:11:30 UTC (rev 37682)
@@ -470,8 +470,12 @@
}
}
} else {
+ try {
IType[] ts = unit.getTypes();
fileSet.add(f.getFullPath(), ts);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
}
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java 2012-01-06 14:23:15 UTC (rev 37681)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreNature.java 2012-01-06 17:11:30 UTC (rev 37682)
@@ -25,11 +25,8 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.resources.IProjectNature;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
@@ -46,10 +43,8 @@
import org.jboss.tools.common.util.EclipseJavaUtil;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.common.validation.internal.ProjectValidationContext;
-import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.jst.web.kb.KbProjectFactory;
-import org.jboss.tools.jst.web.kb.WebKbPlugin;
-import org.w3c.dom.Element;
+import org.jboss.tools.jst.web.kb.internal.KbProject;
public class CDICoreNature implements IProjectNature {
public static String NATURE_ID = "org.jboss.tools.cdi.core.cdinature";
@@ -87,14 +82,7 @@
public void deconfigure() throws CoreException {
removeFromBuildSpec(CDICoreBuilder.BUILDER_ID);
- CDICoreNature[] ds = dependsOn.toArray(new CDICoreNature[0]);
- for (CDICoreNature d: ds) {
- removeCDIProject(d);
- }
- CDICoreNature[] us = usedBy.toArray(new CDICoreNature[0]);
- for (CDICoreNature u: us) {
- u.removeCDIProject(this);
- }
+ dispose();
}
public IProject getProject() {
@@ -267,13 +255,23 @@
return usedBy;
}
- public CDICoreNature[] getAllDependentProjects() {
+ public CDICoreNature[] getAllDependentProjects(boolean resolve) {
Map<CDICoreNature, Integer> set = new HashMap<CDICoreNature, Integer>();
getAllDependentProjects(set, 0);
+ if(resolve) {
+ for (CDICoreNature n: set.keySet()) {
+ n.resolve();
+ }
+ }
CDICoreNature[] result = set.keySet().toArray(new CDICoreNature[set.size()]);
Arrays.sort(result, new D(set));
return result;
}
+
+ public CDICoreNature[] getAllDependentProjects() {
+ return getAllDependentProjects(false);
+ }
+
private void getAllDependentProjects(Map<CDICoreNature, Integer> result, int level) {
if(level > 10) return;
for (CDICoreNature n:usedBy) {
@@ -583,56 +581,51 @@
if(projectDependenciesLoaded) return;
projectDependenciesLoaded = true;
}
- Element root = null;
- File file = getKBStorageFile();
- if(file != null && file.isFile()) {
- root = XMLUtilities.getElement(file, null);
- if(root != null) {
- loadProjectDependencies(root);
- }
- }
+ _loadProjectDependencies();
}
- private File getKBStorageFile() {
- IPath path = WebKbPlugin.getDefault().getStateLocation();
- File file = new File(path.toFile(), "projects/" + project.getName() + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$
- return file;
- }
-
- private void loadProjectDependencies(Element root) {
- Element dependsOnElement = XMLUtilities.getUniqueChild(root, "depends-on-projects"); //$NON-NLS-1$
- if(dependsOnElement != null) {
- Element[] paths = XMLUtilities.getChildren(dependsOnElement, "project"); //$NON-NLS-1$
- for (int i = 0; i < paths.length; i++) {
- String p = paths[i].getAttribute("name"); //$NON-NLS-1$
- if(p == null || p.trim().length() == 0) continue;
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(p);
- if(project == null || !project.isAccessible()) continue;
- KbProjectFactory.getKbProject(project, true, true);
- CDICoreNature sp = CDICorePlugin.getCDI(project, false);
- if(sp != null) {
- addUsedCDIProject(sp);
- sp.addDependentCDIProject(this);
- }
+ private void _loadProjectDependencies() {
+ KbProject kb = (KbProject)KbProjectFactory.getKbProject(project, true, true);
+
+ if(kb == null) {
+ return;
+ }
+
+ Set<KbProject> ps = kb.getKbProjects();
+
+ for (KbProject kb1: ps) {
+ IProject project = kb1.getProject();
+ if(project == null || !project.isAccessible()) continue;
+ KbProjectFactory.getKbProject(project, true, true);
+ CDICoreNature sp = CDICorePlugin.getCDI(project, false);
+ if(sp != null) {
+ addUsedCDIProject(sp);
+ sp.addDependentCDIProject(this);
}
}
+
+ KbProject[] ps2 = kb.getDependentKbProjects();
- Element usedElement = XMLUtilities.getUniqueChild(root, "used-by-projects"); //$NON-NLS-1$
- if(usedElement != null) {
- Element[] paths = XMLUtilities.getChildren(usedElement, "project"); //$NON-NLS-1$
- for (int i = 0; i < paths.length; i++) {
- String p = paths[i].getAttribute("name"); //$NON-NLS-1$
- if(p == null || p.trim().length() == 0) continue;
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(p);
- if(project == null || !project.isAccessible()) continue;
- KbProjectFactory.getKbProject(project, true, true);
- CDICoreNature sp = CDICorePlugin.getCDI(project, false);
- if(sp != null) {
- addDependentCDIProject(sp);
- }
+ for (KbProject kb2: ps2) {
+ IProject project = kb2.getProject();
+ if(project == null || !project.isAccessible()) continue;
+ KbProjectFactory.getKbProject(project, true, true);
+ CDICoreNature sp = CDICorePlugin.getCDI(project, false);
+ if(sp != null) {
+ addDependentCDIProject(sp);
}
}
-
}
+ public void dispose() {
+ CDICoreNature[] ds = dependsOn.toArray(new CDICoreNature[0]);
+ for (CDICoreNature d: ds) {
+ removeCDIProject(d);
+ }
+ CDICoreNature[] us = usedBy.toArray(new CDICoreNature[0]);
+ for (CDICoreNature u: us) {
+ u.removeCDIProject(this);
+ }
+ }
+
}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICorePlugin.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICorePlugin.java 2012-01-06 14:23:15 UTC (rev 37681)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICorePlugin.java 2012-01-06 17:11:30 UTC (rev 37682)
@@ -15,6 +15,11 @@
import java.util.List;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.resource.ImageDescriptor;
import org.jboss.tools.cdi.internal.core.event.CDIProjectChangeEvent;
@@ -39,6 +44,7 @@
* The constructor
*/
public CDICorePlugin() {
+ plugin = this;
}
/*
@@ -47,7 +53,7 @@
*/
public void start(BundleContext context) throws Exception {
super.start(context);
- plugin = this;
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener);
}
/*
@@ -55,10 +61,35 @@
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
- plugin = null;
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener);
super.stop(context);
}
+ IResourceChangeListener resourceChangeListener = new RCL();
+
+ class RCL implements IResourceChangeListener {
+
+ public void resourceChanged(IResourceChangeEvent event) {
+ if(event.getType() == IResourceChangeEvent.PRE_DELETE || event.getType() == IResourceChangeEvent.PRE_CLOSE) {
+ IResource r = event.getResource();
+ if(r instanceof IProject) {
+ IProject p = (IProject)r;
+ CDICoreNature n = (CDICoreNature)getCDINature(p);
+ if(n != null) {
+ n.dispose();
+ }
+ }
+ } else if(event.getType() == IResourceChangeEvent.POST_CHANGE) {
+ IResourceDelta[] cs = event.getDelta().getAffectedChildren(IResourceDelta.CHANGED);
+ for (IResourceDelta c: cs) {
+ if((c.getFlags() & IResourceDelta.OPEN) != 0 && c.getResource() instanceof IProject) {
+ IProject p = (IProject)c.getResource();
+ getCDI(p, true);
+ }
+ }
+ }
+ }
+ }
/**
* Returns the shared instance
*
@@ -93,7 +124,7 @@
return null;
}
- public static CDICoreNature getCDI(IProject project, boolean resolve) {
+ private static CDICoreNature getCDINature(IProject project) {
if(project == null || !project.exists() || !project.isOpen()) return null;
try {
if(!project.hasNature(CDICoreNature.NATURE_ID)) return null;
@@ -104,13 +135,20 @@
CDICoreNature n = null;
try {
n = (CDICoreNature)project.getNature(CDICoreNature.NATURE_ID);
+ } catch (CoreException e) {
+ getDefault().logError(e);
+ }
+ return n;
+ }
+
+ public static CDICoreNature getCDI(IProject project, boolean resolve) {
+ CDICoreNature n = getCDINature(project);
+ if(n != null) {
if(resolve) {
n.resolve();
} else {
n.loadProjectDependencies();
}
- } catch (CoreException e) {
- getDefault().logError(e);
}
return n;
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2012-01-06 14:23:15 UTC (rev 37681)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/impl/CDIProject.java 2012-01-06 17:11:30 UTC (rev 37682)
@@ -882,7 +882,7 @@
CDICorePlugin.getCDI(p, true);
}
}
- CDICoreNature[] ns = getNature().getAllDependentProjects();
+ CDICoreNature[] ns = getNature().getAllDependentProjects(true);
for (CDICoreNature n: ns) {
if(n.getDelegate() instanceof CDIProject) {
CDIProject p = (CDIProject)n.getDelegate();
@@ -956,7 +956,7 @@
CDICorePlugin.getCDI(p, true);
}
}
- CDICoreNature[] ns = getNature().getAllDependentProjects();
+ CDICoreNature[] ns = getNature().getAllDependentProjects(true);
for (CDICoreNature n: ns) {
if(n.getDelegate() instanceof CDIProject) {
CDIProject p = (CDIProject)n.getDelegate();
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIProjectTree.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIProjectTree.java 2012-01-06 14:23:15 UTC (rev 37681)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/validation/CDIProjectTree.java 2012-01-06 17:11:30 UTC (rev 37682)
@@ -109,7 +109,7 @@
private Set<CDICoreNature> getRootProjects(CDICoreNature project) {
Set<CDICoreNature> result = new HashSet<CDICoreNature>();
- CDICoreNature[] dependentProjects = project.getAllDependentProjects();
+ CDICoreNature[] dependentProjects = project.getAllDependentProjects(true);
if(dependentProjects.length == 0) {
result.add(project);
} else {
12 years, 12 months