[jbosstools-commits] JBoss Tools SVN: r22787 - in trunk/jsf: plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/refactoring/action/rename and 4 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Mon Jun 14 09:56:50 EDT 2010
Author: yzhishko
Date: 2010-06-14 09:56:50 -0400 (Mon, 14 Jun 2010)
New Revision: 22787
Added:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/compositeComponentAfterRename.html
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/refactoring/JSF2RenameParticipant.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/refactoring/action/rename/CompositeAttributeRenameProcessor.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/util/JSF2ComponentUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/JSFUIMessages.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/messages.properties
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/compositeComponent.html
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AbstractRefactorTest.java
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AttributeRenameTest.java
Log:
https://jira.jboss.org/browse/JBIDE-6417 - fixed
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/refactoring/JSF2RenameParticipant.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/refactoring/JSF2RenameParticipant.java 2010-06-14 13:55:13 UTC (rev 22786)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/refactoring/JSF2RenameParticipant.java 2010-06-14 13:56:50 UTC (rev 22787)
@@ -90,7 +90,7 @@
return false;
}
IContentType contentType = IDE.getContentType(file);
- if (!"org.eclipse.wst.html.core.htmlsource".equals(contentType.getId())) { //$NON-NLS-1$
+ if (!"jsf.facelet.composite".equals(contentType.getId()) && !"jsf.facelet".equals(contentType.getId())) { //$NON-NLS-1$ //$NON-NLS-2$
return false;
}
// if ((JSF2ComponentModelManager.getManager()
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/refactoring/action/rename/CompositeAttributeRenameProcessor.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/refactoring/action/rename/CompositeAttributeRenameProcessor.java 2010-06-14 13:55:13 UTC (rev 22786)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/refactoring/action/rename/CompositeAttributeRenameProcessor.java 2010-06-14 13:56:50 UTC (rev 22787)
@@ -32,6 +32,7 @@
import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;
import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
+import org.jboss.tools.jsf.jsf2.model.JSF2ComponentModelManager;
import org.jboss.tools.jsf.jsf2.refactoring.core.StructuredChanges;
import org.jboss.tools.jsf.jsf2.refactoring.core.StructuredTextFileChange;
import org.jboss.tools.jsf.jsf2.util.JSF2ComponentUtil;
@@ -57,7 +58,7 @@
private static final GroupCategorySet CATEGORY_COMPOSITE_ATTR_RENAME = new GroupCategorySet(
new GroupCategory(
"org.jboss.tools.jsf.jsf2.refactoring.rename.composite.attr.type", JSFUIMessages.Refactoring_JSF_2_Rename_Composite_Attr_Changes, JSFUIMessages.Refactoring_JSF_2_Changes_Rename_Composite_Attr)); //$NON-NLS-1$
- public static String IDENTIFIER = "org.jboss.tools.jsf.jsf2.refactor.compositeattrrenameprocessor"; //$NON-NLS-1$
+ public static final String IDENTIFIER = "org.jboss.tools.jsf.jsf2.refactor.compositeattrrenameprocessor"; //$NON-NLS-1$
private String newAttrName;
private String currentAttrName;
private IProject project;
@@ -91,10 +92,7 @@
OperationCanceledException {
StructuredChanges changes = new StructuredChanges(
JSFUIMessages.Refactoring_JSF_2_Composite_Attr_Rename_Changes);
- StructuredTextFileChange baseFileChange = new StructuredTextFileChange(baseFile.getFullPath().toOSString(), baseFile);
- ReplaceEdit edit = new ReplaceEdit(attrToRename.getValueRegionStartOffset()+1, attrToRename.getValue().length(), getNewElementName());
- TextChangeCompatibility.addTextEdit(baseFileChange, JSFUIMessages.Refactoring_JSF_2_Rename_Composite_Attr_Name, edit, CATEGORY_COMPOSITE_ATTR_RENAME);
- changes.add(baseFileChange);
+ changes.add(createBaseFileChange());
Map<IFile, List<IDOMNode>> nodesMap = JSF2ComponentUtil
.findCompositeComponentsWithURI(getProject(), getURI());
Set<Entry<IFile, List<IDOMNode>>> entries = nodesMap.entrySet();
@@ -107,7 +105,31 @@
}
return changes;
}
+
+ private StructuredTextFileChange createBaseFileChange(){
+ StructuredTextFileChange baseFileChange = new StructuredTextFileChange(baseFile.getFullPath().toOSString(), baseFile);
+ ReplaceEdit edit = new ReplaceEdit(attrToRename.getValueRegionStartOffset()+1, attrToRename.getValue().length(), getNewElementName());
+ TextChangeCompatibility.addTextEdit(baseFileChange, JSFUIMessages.Refactoring_JSF_2_Rename_Composite_Attr_Name, edit, CATEGORY_COMPOSITE_ATTR_RENAME);
+ IDOMElement element = JSF2ComponentUtil.findCompositeImpl(JSF2ComponentModelManager.getReadableDOMDocument(baseFile));
+ if (element != null) {
+ IDOMAttr[] attrs = JSF2ComponentUtil.extractAttrsWithValue(element, computeAttrOldValue());
+ for (int i = 0; i < attrs.length; i++) {
+ edit = new ReplaceEdit(attrs[i].getValueRegionStartOffset()+1, attrs[i].getValue().length(), computeAttrNewValue());
+ TextChangeCompatibility.addTextEdit(baseFileChange, JSFUIMessages.Refactoring_JSF_2_Rename_Attr_Ref_Decl, edit, CATEGORY_COMPOSITE_ATTR_RENAME);
+ }
+ }
+ return baseFileChange;
+
+ }
+ private String computeAttrOldValue(){
+ return "#{cc.attrs." + getCurrentElementName() + "}"; //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ private String computeAttrNewValue(){
+ return "#{cc.attrs." + getNewElementName() + "}"; //$NON-NLS-1$//$NON-NLS-2$
+ }
+
private StructuredTextFileChange createFileChange(IFile file,
List<IDOMNode> nodeList) {
StructuredTextFileChange fileChange = null;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/util/JSF2ComponentUtil.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/util/JSF2ComponentUtil.java 2010-06-14 13:55:13 UTC (rev 22786)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/util/JSF2ComponentUtil.java 2010-06-14 13:56:50 UTC (rev 22787)
@@ -27,6 +27,7 @@
import org.eclipse.wst.xml.core.internal.document.ElementImpl;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.jboss.tools.jsf.jsf2.model.JSF2ComponentModelManager;
import org.w3c.dom.Element;
@@ -184,5 +185,66 @@
}
}
}
-
+
+ public static IDOMElement findCompositeImpl(Node node){
+ IDOMElement[] compositeImpl = new IDOMElement[1];
+ findCompositeImpl(node, compositeImpl);
+ return compositeImpl[0];
+ }
+
+ private static void findCompositeImpl(Node node,
+ IDOMElement[] interfaceElement) {
+ if (node instanceof IDOMDocument) {
+ IDOMDocument document = (IDOMDocument) node;
+ findCompositeImpl(document.getDocumentElement(),
+ interfaceElement);
+ }
+ if (node instanceof ElementImpl) {
+ ElementImpl impl = (ElementImpl) node;
+ String nameSpace = impl.getNamespaceURI();
+ if (JSF2ResourceUtil.JSF2_URI_PREFIX.equals(nameSpace)) {
+ String nodeName = impl.getLocalName();
+ if ("implementation".equals(nodeName)) { //$NON-NLS-1$
+ interfaceElement[0] = impl;
+ return;
+ }
+ } else {
+ NodeList nodeList = node.getChildNodes();
+ if (nodeList != null) {
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ findCompositeImpl(nodeList.item(i),
+ interfaceElement);
+ }
+ }
+ }
+ }
+ }
+
+ public static IDOMAttr[] extractAttrsWithValue(IDOMElement elToExtract, String value){
+ List<IDOMAttr> attrs = new ArrayList<IDOMAttr>();
+ extractAttrsWithValue(elToExtract, value, attrs);
+ return attrs.toArray(new IDOMAttr[0]);
+ }
+
+ private static void extractAttrsWithValue(IDOMElement elToExtract, String value, List<IDOMAttr> attrs){
+ NamedNodeMap namedNodeMap = elToExtract.getAttributes();
+ if (namedNodeMap != null) {
+ for (int i = 0; i < namedNodeMap.getLength(); i++) {
+ IDOMAttr attr = (IDOMAttr) namedNodeMap.item(i);
+ if (value.equals(attr.getValue().trim())) {
+ attrs.add(attr);
+ }
+ }
+ }
+ NodeList children = elToExtract.getChildNodes();
+ if (children != null) {
+ for (int i = 0; i < children.getLength(); i++) {
+ Node node = children.item(i);
+ if (node instanceof IDOMElement) {
+ extractAttrsWithValue((IDOMElement) node, value, attrs);
+ }
+ }
+ }
+ }
+
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/JSFUIMessages.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/JSFUIMessages.java 2010-06-14 13:55:13 UTC (rev 22786)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/JSFUIMessages.java 2010-06-14 13:56:50 UTC (rev 22787)
@@ -146,6 +146,7 @@
public static String Refactoring_JSF_2_Rename_Composite_Component_Changes;
public static String Refactoring_JSF_2_Changes_Rename_Composite_Component;
public static String Refactoring_JSF_2_Rename_Composite_Component;
+ public static String Refactoring_JSF_2_Rename_Attr_Ref_Decl;
static {
// load message values from bundle file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/messages.properties
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/messages.properties 2010-06-14 13:55:13 UTC (rev 22786)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/messages/messages.properties 2010-06-14 13:56:50 UTC (rev 22787)
@@ -122,4 +122,5 @@
Refactoring_JSF_2_Rename_Composite_URI=Rename composite URI
Refactoring_JSF_2_Rename_Composite_Component_Changes=Rename composite component changes
Refactoring_JSF_2_Changes_Rename_Composite_Component=Changes to rename composite component
-Refactoring_JSF_2_Rename_Composite_Component=Rename composite component
\ No newline at end of file
+Refactoring_JSF_2_Rename_Composite_Component=Rename composite component
+Refactoring_JSF_2_Rename_Attr_Ref_Decl=Rename composite attribute reference in declaration
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/compositeComponent.html
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/compositeComponent.html 2010-06-14 13:55:13 UTC (rev 22786)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/compositeComponent.html 2010-06-14 13:56:50 UTC (rev 22787)
@@ -11,6 +11,10 @@
</composite:interface>
<!-- IMPLEMENTATION -->
-<composite:implementation></composite:implementation>
+<composite:implementation>
+ <composite:implementation>
+ <h1><h:outputText value="#{cc.attrs.echo}" /></h1>
+ </composite:implementation>
+</composite:implementation>
</html>
\ No newline at end of file
Added: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/compositeComponentAfterRename.html
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/compositeComponentAfterRename.html (rev 0)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/resources/refactor/compositeComponentAfterRename.html 2010-06-14 13:56:50 UTC (rev 22787)
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:composite="http://java.sun.com/jsf/composite">
+
+<!-- INTERFACE -->
+<composite:interface>
+ <composite:attribute name="echo1"></composite:attribute>
+</composite:interface>
+
+<!-- IMPLEMENTATION -->
+<composite:implementation>
+ <composite:implementation>
+ <h1><h:outputText value="#{cc.attrs.echo1}" /></h1>
+ </composite:implementation>
+</composite:implementation>
+
+</html>
\ No newline at end of file
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AbstractRefactorTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AbstractRefactorTest.java 2010-06-14 13:55:13 UTC (rev 22786)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AbstractRefactorTest.java 2010-06-14 13:56:50 UTC (rev 22787)
@@ -8,53 +8,41 @@
import org.jboss.tools.ui.bot.test.WidgetVariables;
public abstract class JSF2AbstractRefactorTest extends JSFAutoTestCase {
-
+
protected static final String JSF2_Test_Page_Name = "jsf2TestPage"; //$NON-NLS-1$
-
+
protected void createCompositeComponent() throws Exception {
SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
.bot();
SWTBotTree tree = innerBot.tree();
try {
- tree
- .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ tree.expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} catch (WidgetNotFoundException e) {
- tree
- .getTreeItem(
- projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").select(); //$NON-NLS-1$ //$NON-NLS-2$
+ tree.getTreeItem(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").select(); //$NON-NLS-1$ //$NON-NLS-2$
bot.menu("File").menu("New").menu("Folder").click(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
bot.textWithLabel("Folder name:").setText("resources"); //$NON-NLS-1$ //$NON-NLS-2$
bot.button("Finish").click(); //$NON-NLS-1$
}
try {
- tree
- .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ tree.expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
} catch (WidgetNotFoundException e) {
- tree
- .getTreeItem(
- projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ tree.getTreeItem(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
bot.menu("File").menu("New").menu("Folder").click(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
bot.textWithLabel("Folder name:").setText("mycomp"); //$NON-NLS-1$ //$NON-NLS-2$
bot.button("Finish").click(); //$NON-NLS-1$
}
try {
- tree
- .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ tree.expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
} catch (WidgetNotFoundException e) {
- tree
- .getTreeItem(
- projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ tree.getTreeItem(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
bot.menu("File").menu("New").menu("Folder").click(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
bot.textWithLabel("Folder name:").setText("mycomp"); //$NON-NLS-1$ //$NON-NLS-2$
bot.button("Finish").click(); //$NON-NLS-1$
}
try {
- tree
- .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").expandNode("echo.xhtml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ tree.expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").expandNode("echo.xhtml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
} catch (WidgetNotFoundException e) {
- tree
- .getTreeItem(
- projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ tree.getTreeItem(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
bot.menu("File").menu("New").menu("Other...").click(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
bot.shell("New").activate(); //$NON-NLS-1$
tree = bot.tree();
@@ -63,7 +51,14 @@
bot.textWithLabel("File name:").setText("echo"); //$NON-NLS-1$ //$NON-NLS-2$
bot.button("Finish").click(); //$NON-NLS-1$
bot.sleep(2000);
- bot.editorByTitle("echo.xhtml").saveAndClose(); //$NON-NLS-1$
+ SWTBotEclipseEditor editor = bot
+ .editorByTitle("echo.xhtml").toTextEditor(); //$NON-NLS-1$
+ bot.menu("Edit").menu("Select All").click(); //$NON-NLS-1$ //$NON-NLS-2$
+ bot.menu("Edit").menu("Delete").click(); //$NON-NLS-1$//$NON-NLS-2$
+ bot.sleep(2000);
+ editor.setText(loadFileContent("refactor/compositeComponent.html")); //$NON-NLS-1$
+ editor.save();
+ bot.sleep(2000);
}
}
@@ -75,9 +70,7 @@
tree.expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent"). //$NON-NLS-1$ //$NON-NLS-2$
getNode(JSF2_Test_Page_Name + ".xhtml").doubleClick(); //$NON-NLS-1$
} catch (WidgetNotFoundException e) {
- tree
- .getTreeItem(
- projectProperties.getProperty("JSFProjectName")).select(); //$NON-NLS-1$
+ tree.getTreeItem(projectProperties.getProperty("JSFProjectName")).select(); //$NON-NLS-1$
bot.menu("File").menu("New").menu("Other...").click(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
bot.shell("New").activate(); //$NON-NLS-1$
tree = bot.tree();
@@ -97,5 +90,5 @@
bot.sleep(2000);
editor.saveAndClose();
}
-
+
}
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AttributeRenameTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AttributeRenameTest.java 2010-06-14 13:55:13 UTC (rev 22786)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/jsf2/refactor/JSF2AttributeRenameTest.java 2010-06-14 13:56:50 UTC (rev 22787)
@@ -33,8 +33,7 @@
SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
.bot();
SWTBotTree tree = innerBot.tree();
- tree
- .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode(JSF2_Test_Page_Name + ".xhtml").doubleClick(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ tree.expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode(JSF2_Test_Page_Name + ".xhtml").doubleClick(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
delay();
SWTBotEclipseEditor editor = bot.editorByTitle(
JSF2_Test_Page_Name + ".xhtml").toTextEditor(); //$NON-NLS-1$
@@ -42,6 +41,13 @@
loadFileContent("refactor/jsf2RenameAttrTestPageRefactor.html"), editor.getText()); //$NON-NLS-1$
delay();
editor.close();
+ innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER).bot();
+ tree = innerBot.tree();
+ tree.expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").expandNode("echo.xhtml").doubleClick(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ delay();
+ editor = bot.editorByTitle("echo.xhtml").toTextEditor(); //$NON-NLS-1$
+ assertEquals(
+ loadFileContent("refactor/compositeComponentAfterRename.html"), editor.getText()); //$NON-NLS-1$
}
@Override
@@ -50,8 +56,7 @@
SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
.bot();
SWTBotTree tree = innerBot.tree();
- tree
- .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").expandNode("echo.xhtml").doubleClick(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ tree.expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").expandNode("echo.xhtml").doubleClick(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
SWTBotEclipseEditor editor = bot
.editorByTitle("echo.xhtml").toTextEditor(); //$NON-NLS-1$
bot.menu("Edit").menu("Select All").click(); //$NON-NLS-1$ //$NON-NLS-2$
@@ -67,13 +72,11 @@
SWTBot innerBot = bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER)
.bot();
SWTBotTree tree = innerBot.tree();
- tree
- .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode(JSF2_Test_Page_Name + ".xhtml").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ tree.expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode(JSF2_Test_Page_Name + ".xhtml").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
bot.menu("Edit").menu("Delete").click(); //$NON-NLS-1$ //$NON-NLS-2$
bot.button("OK").click(); //$NON-NLS-1$
delay();
- tree
- .expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").expandNode("echo.xhtml").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ tree.expandNode(projectProperties.getProperty("JSFProjectName")).expandNode("WebContent").expandNode("resources").expandNode("mycomp").expandNode("echo.xhtml").select(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
bot.menu("Edit").menu("Delete").click(); //$NON-NLS-1$ //$NON-NLS-2$
bot.button("OK").click(); //$NON-NLS-1$
delay();
@@ -83,12 +86,11 @@
private void checkPreview() throws IOException {
delay();
SWTBotTree tree = bot.tree();
- tree
- .expandNode("Composite attribute name changes").expandNode("echo.xhtml - " + projectProperties.getProperty("JSFProjectName") + "/WebContent/resources/mycomp").expandNode("Rename composite attribute name"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- tree
- .expandNode("Composite attribute name changes").expandNode("jsf2TestPage.xhtml - " + projectProperties.getProperty("JSFProjectName") + "/WebContent").expandNode("Rename composite attribute"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ tree.expandNode("Composite attribute name changes").expandNode("echo.xhtml - " + projectProperties.getProperty("JSFProjectName") + "/WebContent/resources/mycomp").expandNode("Rename composite attribute name"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+ tree.expandNode("Composite attribute name changes").expandNode("jsf2TestPage.xhtml - " + projectProperties.getProperty("JSFProjectName") + "/WebContent").expandNode("Rename composite attribute"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
SWTBotStyledText styledText = bot.styledText(0);
- assertEquals(loadFileContent("refactor/compositeComponent.html"), styledText.getText()); //$NON-NLS-1$
+ assertEquals(
+ loadFileContent("refactor/compositeComponent.html"), styledText.getText()); //$NON-NLS-1$
System.out.println(styledText.getText());
}
More information about the jbosstools-commits
mailing list