Author: dazarov
Date: 2012-01-09 14:24:00 -0500 (Mon, 09 Jan 2012)
New Revision: 37728
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELRefactorContributionFactory.java
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/MessagePropertyRefactoringTest.java
Log:
Ctrl+Shift+G on a java element doesn't work for complex ELs
https://issues.jboss.org/browse/JBIDE-10593
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELRefactorContributionFactory.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELRefactorContributionFactory.java 2012-01-09
18:08:56 UTC (rev 37727)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/el/refactoring/ELRefactorContributionFactory.java 2012-01-09
19:24:00 UTC (rev 37728)
@@ -150,7 +150,7 @@
}
- private ELSegment findELSegment(IFile file, TextSelection selection){
+ public static ELSegment findELSegment(IFile file, TextSelection selection){
ELContext context = PageContextFactory.createPageContext(file);
if(context == null)
@@ -179,7 +179,7 @@
return null;
}
- private ELSegment getSegment(ELResolver[] resolvers, ELContext context, TextSelection
selection, ELReference reference, ELExpression operand){
+ private static ELSegment getSegment(ELResolver[] resolvers, ELContext context,
TextSelection selection, ELReference reference, ELExpression operand){
for (ELResolver resolver : resolvers) {
ELResolution resolution = resolver.resolve(context, operand, selection.getOffset());
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/MessagePropertyRefactoringTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/MessagePropertyRefactoringTest.java 2012-01-09
18:08:56 UTC (rev 37727)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/refactoring/MessagePropertyRefactoringTest.java 2012-01-09
19:24:00 UTC (rev 37728)
@@ -7,11 +7,13 @@
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.text.TextSelection;
import org.jboss.tools.common.base.test.AbstractRefactorTest;
-import org.jboss.tools.common.el.core.parser.LexicalToken;
+import org.jboss.tools.common.el.core.resolver.ELSegment;
+import org.jboss.tools.common.el.core.resolver.MessagePropertyELSegment;
import org.jboss.tools.common.util.FileUtil;
import org.jboss.tools.jsf.el.refactoring.RenameMessagePropertyProcessor;
-import org.jboss.tools.jst.web.kb.el.MessagePropertyELSegmentImpl;
+import org.jboss.tools.jsf.ui.el.refactoring.ELRefactorContributionFactory;
import org.jboss.tools.test.util.ProjectImportTestSetup;
public class MessagePropertyRefactoringTest extends AbstractRefactorTest{
@@ -58,14 +60,19 @@
structure.addTextChange(change);
list.add(structure);
- MessagePropertyELSegmentImpl segment = new MessagePropertyELSegmentImpl(new
LexicalToken(position,13,"hello_message",-1000));
- segment.setMessageBundleResource(propertyFile);
- segment.setBaseName("demo.Messages");
- segment.setMessagePropertySourceReference(0,10);
- RenameMessagePropertyProcessor processor = new
RenameMessagePropertyProcessor(sourceFile, segment);
- processor.setNewName(NEW_NAME);
+ //MessagePropertyELSegmentImpl segment = new MessagePropertyELSegmentImpl(new
LexicalToken(position,13,"hello_message",-1000));
+ //segment.setMessageBundleResource(propertyFile);
+ //segment.setBaseName("demo.Messages");
+ //segment.setMessagePropertySourceReference(0,10);
+ ELSegment segment = ELRefactorContributionFactory.findELSegment(sourceFile, new
TextSelection(position, 13));
+ if(segment instanceof MessagePropertyELSegment){
+ RenameMessagePropertyProcessor processor = new
RenameMessagePropertyProcessor(sourceFile, (MessagePropertyELSegment)segment);
+ processor.setNewName(NEW_NAME);
- checkRename(processor, list);
+ checkRename(processor, list);
+ }else{
+ fail("segment must be instance of MessagePropertyELSegment");
+ }
}
}