JBoss Tools SVN: r37692 - trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2012-01-06 14:27:44 -0500 (Fri, 06 Jan 2012)
New Revision: 37692
Modified:
trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/EclipseUtil.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/src/org/jboss/tools/common/EclipseUtil.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/EclipseUtil.java 2012-01-06 19:24:35 UTC (rev 37691)
+++ trunk/common/plugins/org.jboss.tools.common/src/org/jboss/tools/common/EclipseUtil.java 2012-01-06 19:27:44 UTC (rev 37692)
@@ -25,7 +25,9 @@
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.core.JavaModelManager;
/**
* @author Alexey Kazakov, Viacheslav Kabanovich
@@ -75,11 +77,23 @@
}
return resources.toArray(new IResource[resources.size()]);
}
-
- public static ICompilationUnit getCompilationUnit(IFile f) throws CoreException {
- IJavaElement element= JavaCore.create(f);
- if (element instanceof ICompilationUnit)
- return (ICompilationUnit) element;
+
+ /**
+ * Returns compilation unit for file, if it exists in Java model, otherwise returns null.
+ *
+ * @param f
+ * @return compilation unit for file, if it exists in Java model, otherwise null
+ * @throws CoreException
+ */
+ public static ICompilationUnit getCompilationUnit(IFile f) {
+ IJavaProject jp = getJavaProject(f.getProject());
+ if(jp != null) {
+ IPackageFragment pkg = (IPackageFragment)JavaModelManager.determineIfOnClasspath(f, jp);
+ if(pkg != null) {
+ ICompilationUnit result = pkg.getCompilationUnit(f.getName());
+ return (result.exists()) ? result : null;
+ }
+ }
return null;
}
13 years, 9 months
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();
13 years, 9 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);
13 years, 9 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);
13 years, 9 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);
13 years, 9 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);
13 years, 9 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);
13 years, 9 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
13 years, 9 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();
- }
}
}
}
13 years, 9 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){
13 years, 9 months