Author: dazarov
Date: 2011-11-02 15:37:45 -0400 (Wed, 02 Nov 2011)
New Revision: 36137
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/messages.properties
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRenameProcessor.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddQualifiersToBeanProcessor.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactoringProcessor.java
Log:
Quickfix and Wizard for fixing ambigious injection warning is confusing
https://issues.jboss.org/browse/JBIDE-9940
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreMessages.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreMessages.java 2011-11-02
19:14:44 UTC (rev 36136)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/CDICoreMessages.java 2011-11-02
19:37:45 UTC (rev 36137)
@@ -26,8 +26,11 @@
public static String CDI_FACET_INSTALL_ABSTRACT_DELEGATE_CHECK_ERROR_LOG_VIEW;
public static String CDI_FACET_INSTALL_ABSTRACT_DELEGATE_ERROR;
- public static String CDI_RENAME_PROCESSOR_OUT_OF_SYNC_PROJECT;
+ public static String CDI_RENAME_PROCESSOR_ERROR_OUT_OF_SYNC_PROJECT;
+ public static String CDI_RENAME_PROCESSOR_ERROR_PHANTOM_FILE;
public static String CDI_RENAME_PROCESSOR_ERROR_READ_ONLY_FILE;
+ public static String CDI_RENAME_PROCESSOR_ERROR_BEAN_NOT_FOUND;
+ public static String CDI_RENAME_PROCESSOR_ERROR_INJECTION_POINT_NOT_FOUND;
public static String CDI_RENAME_PROCESSOR_QUESTION_DIALOG_TITLE;
public static String CDI_RENAME_PROCESSOR_QUESTION_DIALOG_MESSAGE;
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/messages.properties
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/messages.properties 2011-11-02
19:14:44 UTC (rev 36136)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/messages.properties 2011-11-02
19:37:45 UTC (rev 36137)
@@ -1,8 +1,11 @@
CDI_FACET_INSTALL_ABSTRACT_DELEGATE_ERROR=Error
CDI_FACET_INSTALL_ABSTRACT_DELEGATE_ERRORS_OCCURED=Error occured during installing CDI
facet
CDI_FACET_INSTALL_ABSTRACT_DELEGATE_CHECK_ERROR_LOG_VIEW=Check Errors View for details
-CDI_RENAME_PROCESSOR_OUT_OF_SYNC_PROJECT=Cannot change file(s). Project
''{0}'' is not in sync.
+CDI_RENAME_PROCESSOR_ERROR_OUT_OF_SYNC_PROJECT=Cannot change file(s). Project
''{0}'' is not in sync.
+CDI_RENAME_PROCESSOR_ERROR_PHANTOM_FILE=Cannot change phantom file:
''{0}''.
CDI_RENAME_PROCESSOR_ERROR_READ_ONLY_FILE=Cannot change read-only file:
''{0}''.
+CDI_RENAME_PROCESSOR_ERROR_BEAN_NOT_FOUND=CDI Bean Class not found
+CDI_RENAME_PROCESSOR_ERROR_INJECTION_POINT_NOT_FOUND=CDI Injection Point not found
CDI_RENAME_PROCESSOR_QUESTION_DIALOG_TITLE=Read-only File Encountered
CDI_RENAME_PROCESSOR_QUESTION_DIALOG_MESSAGE=File ''{0}'' is read-only.
Do you wish to make it writable?
RENAME_NAMED_BEAN_PROCESSOR_TITLE=Rename @Named Bean
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRenameProcessor.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRenameProcessor.java 2011-11-02
19:14:44 UTC (rev 36136)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/internal/core/refactoring/CDIRenameProcessor.java 2011-11-02
19:37:45 UTC (rev 36137)
@@ -170,7 +170,7 @@
@Override
protected void outOfSynch(IProject project) {
- status.addFatalError(NLS.bind(CDICoreMessages.CDI_RENAME_PROCESSOR_OUT_OF_SYNC_PROJECT,
project.getFullPath().toString()));
+ status.addFatalError(NLS.bind(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_OUT_OF_SYNC_PROJECT,
project.getFullPath().toString()));
}
@Override
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddQualifiersToBeanProcessor.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddQualifiersToBeanProcessor.java 2011-11-02
19:14:44 UTC (rev 36136)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/AddQualifiersToBeanProcessor.java 2011-11-02
19:37:45 UTC (rev 36137)
@@ -13,12 +13,14 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.ltk.core.refactoring.CompositeChange;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.jboss.tools.cdi.core.CDICoreMessages;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.ui.refactoring.CDIRefactoringProcessor;
@@ -41,7 +43,16 @@
public RefactoringStatus checkInitialConditions(IProgressMonitor pm)
throws CoreException, OperationCanceledException {
status = new RefactoringStatus();
+
+ if(injectionPoint == null){
+ status.addFatalError(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_INJECTION_POINT_NOT_FOUND);
+ return status;
+ }
+ IFile injectionPointFile = (IFile)injectionPoint.getClassBean().getResource();
+
+ isFileCorrect(injectionPointFile);
+
return status;
}
@@ -50,6 +61,17 @@
CheckConditionsContext context) throws CoreException,
OperationCanceledException {
+ if(selectedBean == null){
+ status.addFatalError(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_BEAN_NOT_FOUND);
+ return status;
+ }
+
+ IFile beanFile = (IFile)selectedBean.getBeanClass().getResource();
+
+ if(!isFileCorrect(beanFile)){
+ return status;
+ }
+
createRootChange();
MarkerResolutionUtils.addQualifiersToBean(qualifiers, selectedBean, rootChange);
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactoringProcessor.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactoringProcessor.java 2011-11-02
19:14:44 UTC (rev 36136)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/refactoring/CDIRefactoringProcessor.java 2011-11-02
19:37:45 UTC (rev 36137)
@@ -105,11 +105,12 @@
return null;
}
- private boolean isFileCorrect(IFile file){
+ protected boolean isFileCorrect(IFile file){
if(!file.isSynchronized(IResource.DEPTH_ZERO)){
- status.addFatalError(NLS.bind(CDICoreMessages.CDI_RENAME_PROCESSOR_OUT_OF_SYNC_PROJECT,
file.getProject().getFullPath().toString()));
+ status.addFatalError(NLS.bind(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_OUT_OF_SYNC_PROJECT,
file.getProject().getFullPath().toString()));
return false;
}else if(file.isPhantom()){
+ status.addFatalError(NLS.bind(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_PHANTOM_FILE,
file.getFullPath().toString()));
return false;
}else if(file.isReadOnly()){
status.addFatalError(NLS.bind(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_READ_ONLY_FILE,
file.getFullPath().toString()));
@@ -146,7 +147,7 @@
if(isFileCorrect(file)){
bean = findClassBean();
}else
- status.addFatalError("CDI Bean Class not found");
+ status.addFatalError(CDICoreMessages.CDI_RENAME_PROCESSOR_ERROR_BEAN_NOT_FOUND);
return status;
}