Author: dgolovin
Date: 2011-09-15 15:28:55 -0400 (Thu, 15 Sep 2011)
New Revision: 34785
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/adopt/JSPAdoptHelper.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/adopt/JSPTokenizer.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/JSFProjectCreationOperation.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizard.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizardPage.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizard.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizardPage.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizard.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizardPage.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizard.java
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizardPage.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFStatusTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/AbstractRichFacesTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/InputNumberSliderTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCollapsibleSubTableTogglerTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/util/SeamUtil.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/model/JSF2ComponentModelManager.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/tile/TilesFileRegistration.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/JSFWebHelper.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/XHTMLSyntaxValidator.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/composite/CompositeComponentValidator.java
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JSFModelTest.java
trunk/jsf/tests/org.jboss.tools.jsf.verification.test/src/org/jboss/tools/jsf/verification/test/JSFVerificationTest.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesColumnsTemplateTestCase.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesPickListTemplateTestCase.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1579Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1613Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1713Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1548Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1580Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1614Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1639Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1682Test.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/RichFacesJBIDE1169Test.java
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleManager.java
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/ComponentContentTest.java
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/ProjectsLoader.java
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestDomUtil.java
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestUtil.java
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/VpeTest.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
Log:
Vpe JSF tests performance fix:
1. StringBuffer => StringBuilder, didn't check if it is required at all, just
replaced where I saw it
2. Removed unnecessary delays
3. Minor code clean ups
Tested by running JUnits for vpe and jsf components
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/model/JSF2ComponentModelManager.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/model/JSF2ComponentModelManager.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/model/JSF2ComponentModelManager.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -317,7 +317,7 @@
try {
inputStream = file.getContents();
if (inputStream != null) {
- StringBuffer buffer = new StringBuffer(""); //$NON-NLS-1$
+ StringBuilder buffer = new StringBuilder(); //$NON-NLS-1$
Scanner in = new Scanner(inputStream);
while (in.hasNextLine()) {
buffer.append(in.nextLine());
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/tile/TilesFileRegistration.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/tile/TilesFileRegistration.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/tile/TilesFileRegistration.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -84,7 +84,7 @@
servlet = WebAppHelper.findOrCreateServlet(webxml,
JSFProjectTiles.TILES_SERVLET_CLASS, JSFProjectTiles.TILES_SERVLET_DEFAULT_NAME, 2);
s = WebAppHelper.getWebAppInitParamValueList(servlet,
JSFProjectTiles.TILES_DEFINITIONS);
}
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
boolean replaced = false;
for (int i = 0; i < s.length; i++) {
String add = null;
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/JSFWebHelper.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/JSFWebHelper.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/JSFWebHelper.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -132,7 +132,7 @@
}
if(data.defaultList == null || data.defaultList.length == 0) return "";
if(data.defaultList.length == 1) return data.defaultList[0];
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for (int i = 0; i < data.defaultList.length; i++) {
if(sb.length() > 0) sb.append(data.separator.charAt(0));
sb.append(data.defaultList[i]);
@@ -220,7 +220,7 @@
if(webxml == null) return;
XModelObject p = findInitParam(webxml, data.param);
if(p == null) return;
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
String[] cs = getConfigFilesList(webxml, data);
for (int i = 0; i < cs.length; i++) {
if(cs[i].toLowerCase().equals(path.toLowerCase())) continue;
@@ -240,7 +240,7 @@
}
return;
}
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
String[] cs = getConfigFilesList(webxml, data);
boolean done = false;
for (int i = 0; i < cs.length; i++) {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/XHTMLSyntaxValidator.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/XHTMLSyntaxValidator.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/XHTMLSyntaxValidator.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -223,7 +223,7 @@
final String createStringForInputStream(InputStream inputStream) {
// Here we are reading the file and storing to a stringbuffer.
- StringBuffer fileString = new StringBuffer();
+ StringBuilder fileString = new StringBuilder();
try {
InputStreamReader inputReader = new InputStreamReader(inputStream,
"UTF-8");
BufferedReader reader = new BufferedReader(inputReader);
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/composite/CompositeComponentValidator.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/composite/CompositeComponentValidator.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/composite/CompositeComponentValidator.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -103,7 +103,7 @@
IContainer folder = file.getParent();
if(folder!=null) {
String[] segemnts = folder.getFullPath().segments();
- StringBuffer libUri = new StringBuffer();
+ StringBuilder libUri = new StringBuilder();
for (String segment : segemnts) {
if(libUri.length()==0) {
if(segment.equalsIgnoreCase("resources")) {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/BundleBasenameHyperlink.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -357,7 +357,7 @@
if (start > offset || end < offset) return null;
String text = getDocument().get(start, end - start);
- StringBuffer sb = new StringBuffer(text);
+ StringBuilder sb = new StringBuilder(text);
//find start and end of path property
int bStart = 0;
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/adopt/JSPAdoptHelper.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/adopt/JSPAdoptHelper.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/adopt/JSPAdoptHelper.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -138,7 +138,7 @@
public static String cutOffQuotes(String text) {
if (text == null) return null;
- StringBuffer buffer = new StringBuffer(text);
+ StringBuilder buffer = new StringBuilder(text);
boolean doCutOff = false;
if (buffer.charAt(0) == '"' && buffer.charAt(buffer.length()
- 1) == '"') doCutOff = true;
if (buffer.charAt(0) == '\'' && buffer.charAt(buffer.length()
- 1) == '\'') doCutOff = true;
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/adopt/JSPTokenizer.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/adopt/JSPTokenizer.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/adopt/JSPTokenizer.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -24,7 +24,7 @@
static int DOCTYPE = 7;
String text;
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
Token root;
int selectionStart;
@@ -257,8 +257,8 @@
int VALUE = 2;
int state = 0;
char quote = '\0';
- StringBuffer name = new StringBuffer();
- StringBuffer value = new StringBuffer();
+ StringBuilder name = new StringBuilder();
+ StringBuilder value = new StringBuilder();
for (int i = 0; i < length; i++) {
char ch = text.charAt(i + off);
if(state == NOTHING) {
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/JSFProjectCreationOperation.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/JSFProjectCreationOperation.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/operation/JSFProjectCreationOperation.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -126,7 +126,7 @@
String servletVersion = getProperty(SERVLET_VERSION_ID);
String[] servletJars = WebUtils.getServletLibraries(template.getTemplatesBase(),
servletVersion);
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for (int i = 0; i < servletJars.length;
sb.append(servletJars[i++]).append(';'));
Properties buildProperties = new Properties();
buildProperties.setProperty("classpath.external", sb.toString());
//$NON-NLS-1$
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizard.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizard.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizard.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -100,7 +100,7 @@
public void fillColumn(){
Properties properties = fDropCommand.getProperties();
String[] vs = page2.getSelectedProperties();
- StringBuffer text = new StringBuffer();
+ StringBuilder text = new StringBuilder();
text.append(properties.getProperty("start text")); //$NON-NLS-1$
String value = null;
@@ -129,7 +129,7 @@
fDropCommand.getProperties().setProperty("start text", text.toString());
//$NON-NLS-1$
}
- private void fillin(StringBuffer text, String[] vs, String val) {
+ private void fillin(StringBuilder text, String[] vs, String val) {
for (int i = 0; i < vs.length; i++){
text.append("\n\t<" + H_PREFIX + "column>\n" + //$NON-NLS-1$
//$NON-NLS-2$
"\t\t<"+ H_PREFIX + "outputText value=\"#{" //$NON-NLS-1$
//$NON-NLS-2$
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizardPage.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizardPage.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/DataTableWizardPage.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -164,7 +164,7 @@
protected void updateTitle() {
TagProposal tagProposal = (TagProposal) getDropWizardModel()
.getTagProposal();
- StringBuffer titleText = new StringBuffer();
+ StringBuilder titleText = new StringBuilder();
titleText.append("<"); //$NON-NLS-1$
if (!TagProposal.EMPTY_PREFIX.equals(tagProposal.getPrefix())) {
titleText.append(tagProposal.getPrefix()).append(":"); //$NON-NLS-1$
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizard.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizard.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizard.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -97,7 +97,7 @@
static String F_PREFIX = "%prefix|http://java.sun.com/jsf/core|f%";
//$NON-NLS-1$
public void setText(){
- StringBuffer text = new StringBuffer();
+ StringBuilder text = new StringBuilder();
if(page2.getText()==null || page2.getText().trim().length() == 0) {
return;
@@ -109,7 +109,7 @@
fDropCommand.getProperties().setProperty("start text", text.toString());
//$NON-NLS-1$
if (page2.isValue()) {
- StringBuffer text2 = new StringBuffer();
+ StringBuilder text2 = new StringBuilder();
text2.append(fDropCommand.getProperties().getProperty("end text"));
//$NON-NLS-1$
text2.append('|');
fDropCommand.getProperties().setProperty("end text", text2.toString());
//$NON-NLS-1$
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizardPage.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizardPage.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/OutputLinkWizardPage.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -101,7 +101,7 @@
protected void updateTitle() {
TagProposal tagProposal = (TagProposal)getDropWizardModel().getTagProposal();
- StringBuffer titleText = new StringBuffer();
+ StringBuilder titleText = new StringBuilder();
titleText.append("<"); //$NON-NLS-1$
if(!TagProposal.EMPTY_PREFIX.equals(tagProposal.getPrefix())) {
titleText
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizard.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizard.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizard.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -132,7 +132,7 @@
public void setOptionsString(boolean header, boolean footer) {
- StringBuffer text = new StringBuffer();
+ StringBuilder text = new StringBuilder();
text.append(fDropCommand.getProperties().getProperty("start text"));
//$NON-NLS-1$
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizardPage.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizardPage.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/PanelGridWizardPage.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -95,7 +95,7 @@
protected void updateTitle() {
TagProposal tagProposal = (TagProposal)getDropWizardModel().getTagProposal();
- StringBuffer titleText = new StringBuffer();
+ StringBuilder titleText = new StringBuilder();
titleText.append("<"); //$NON-NLS-1$
if(!TagProposal.EMPTY_PREFIX.equals(tagProposal.getPrefix())) {
titleText
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizard.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizard.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizard.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -99,7 +99,7 @@
static String F_PREFIX = "%prefix|http://java.sun.com/jsf/core|f%";
//$NON-NLS-1$
public void setText() {
- StringBuffer text = new StringBuffer();
+ StringBuilder text = new StringBuilder();
if (page2.getText() != null && page2.getText().trim().length() > 0) {
text.append(fDropCommand.getProperties().getProperty("start text"));
//$NON-NLS-1$
text.append("\n\t<" + F_PREFIX + "selectItems value=\""
//$NON-NLS-1$ //$NON-NLS-2$
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizardPage.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizardPage.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/wizard/palette/SelectItemsWizardPage.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -114,7 +114,7 @@
protected void updateTitle() {
TagProposal tagProposal = (TagProposal)getDropWizardModel().getTagProposal();
- StringBuffer titleText = new StringBuffer();
+ StringBuilder titleText = new StringBuilder();
titleText.append("<"); //$NON-NLS-1$
if(!TagProposal.EMPTY_PREFIX.equals(tagProposal.getPrefix())) {
titleText
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFStatusTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFStatusTemplate.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFStatusTemplate.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -93,7 +93,7 @@
// set class of the span to "{@styleClass} {@stopStyleClass}"
{
- StringBuffer spanClass = new StringBuffer();
+ StringBuilder spanClass = new StringBuilder();
if (sourceElement.hasAttribute(RichFaces.ATTR_STYLE_CLASS)) {
String styleClass = sourceElement.getAttribute(RichFaces.ATTR_STYLE_CLASS);
spanClass.append(styleClass);
@@ -107,7 +107,7 @@
// set style of the span to "{@style};{@stopStyle}"
{
- StringBuffer spanStyle = new StringBuffer();
+ StringBuilder spanStyle = new StringBuilder();
if (sourceElement.hasAttribute(RichFaces.ATTR_STYLE)) {
String style = sourceElement.getAttribute(RichFaces.ATTR_STYLE);
spanStyle.append(style).append(HTML.VALUE_STYLE_DELIMITER);
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -895,7 +895,7 @@
*/
public static String encodeStyleClass(Object parentPredefined,
Object predefined, Object parent, Object custom) {
- StringBuffer styleClass = new StringBuffer();
+ StringBuilder styleClass = new StringBuilder();
// Construct predefined classes
if (null != parentPredefined) {
styleClass.append(parentPredefined).append(Constants.WHITE_SPACE);
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/AbstractRichFacesTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/AbstractRichFacesTemplate.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/AbstractRichFacesTemplate.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -10,12 +10,10 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.richfaces.template;
-import java.util.StringTokenizer;
+import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
-import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-
/**
* The Class AbstractRichFacesTemplate.
*/
@@ -41,75 +39,14 @@
public String getAttribute(String nameAttr, Node sourceNode) {
String returnValue = ""; //$NON-NLS-1$
NamedNodeMap sourceAttrbutes = sourceNode.getAttributes();
-
- for (int i = 0; i < sourceAttrbutes.getLength(); i++) {
- if (sourceAttrbutes.item(i).getNodeName()
- .equalsIgnoreCase(nameAttr)) {
- returnValue = sourceAttrbutes.item(i).getNodeValue();
+ int length = sourceAttrbutes.getLength();
+ for (int i = 0; i < length; i++) {
+ Node item = sourceAttrbutes.item(i);
+ if (item.getNodeName().equalsIgnoreCase(nameAttr)) {
+ returnValue = item.getNodeValue();
+ break;
}
}
return returnValue;
}
-
- /**
- * Checks if is empty attribute.
- *
- * @param sourceNode The current node of the source tree.
- * @param nameAttr name of attribute
- *
- * @return True if value of attribute is empty or attribute dont exist
- */
- public boolean isEmptyAttribute(String nameAttr, Node sourceNode) {
-
- return getAttribute(nameAttr, sourceNode).equalsIgnoreCase("");
//$NON-NLS-1$
-
- }
-
- /**
- * Parses the style.
- *
- * @param sourceNode The current node of the source tree.
- *
- * @return the string
- */
- public String parseStyle(Node sourceNode) {
- String style = getAttribute("style", sourceNode); //$NON-NLS-1$
- String str=""; //$NON-NLS-1$
- StringTokenizer st = new StringTokenizer(style,";:"); //$NON-NLS-1$
-
- while(st.hasMoreTokens()) {
- String token = st.nextToken();
- if(token.trim().equalsIgnoreCase("width") ||
token.trim().equalsIgnoreCase("height")) { //$NON-NLS-1$ //$NON-NLS-2$
- st.nextToken();
- continue;
- }
- str+=token + ":" + st.nextToken() + "; "; //$NON-NLS-1$
//$NON-NLS-2$
- }
-
- return str;
- }
-
- /**
- * Parses the style width.
- *
- * @param sourceNode The current node of the source tree.
- *
- * @return width value
- */
- public String parseStyleWidth(Node sourceNode) {
-
- String style = getAttribute("style", sourceNode); //$NON-NLS-1$
- String widthValue = ""; //$NON-NLS-1$
- StringTokenizer st = new StringTokenizer(style, ":;"); //$NON-NLS-1$
-
- while (st.hasMoreTokens()) {
- String str = st.nextToken();
- if (str.trim().equalsIgnoreCase("width")) { //$NON-NLS-1$
- widthValue = st.nextToken();
- }
- }
- return widthValue;
-
- }
-
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/InputNumberSliderTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/InputNumberSliderTemplate.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/InputNumberSliderTemplate.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -133,9 +133,9 @@
// create and initialize basic table element
nsIDOMElement basicTable = visualDocument.createElement(HTML.TAG_TABLE);
- String style = new StringBuffer(HTML.STYLE_PARAMETER_WIDTH).append(Constants.COLON).
+ String style = new StringBuilder(HTML.STYLE_PARAMETER_WIDTH + Constants.COLON).
append(getNumberValue(sourceElement, RichFaces.ATTR_WIDTH, SLYDER_WIDTH_DEFAULT)).
- append(Constants.PIXEL).append(Constants.SEMICOLON).
+ append(Constants.PIXEL + Constants.SEMICOLON).
append(getAttribute(sourceElement,
RichFaces.ATTR_STYLE)).append(Constants.SEMICOLON).toString();
basicTable.setAttribute(HTML.ATTR_STYLE, style);
basicTable.setAttribute(HTML.ATTR_CLASS, styleClasses.get("style"));
//$NON-NLS-1$
@@ -289,7 +289,7 @@
} else {
inputClass = INPUT_LEFT_STYLE_CLASSES;
}
- inputClass = new StringBuffer(inputClass).append(Constants.WHITE_SPACE).
+ inputClass = new StringBuilder(inputClass).append(Constants.WHITE_SPACE).
append(styleClasses.get("input")).toString(); //$NON-NLS-1$
inputField.setAttribute(HTML.ATTR_CLASS, inputClass);
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCollapsibleSubTableTogglerTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCollapsibleSubTableTogglerTemplate.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesCollapsibleSubTableTogglerTemplate.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -107,25 +107,4 @@
* Do nothing
*/
}
-
- class CollapsedState {
- /*
- * This attribute should be synchronized with the same one
- * in RichFacesCollapsibleSubTableTemplate
- */
- private boolean collapsed = false;
-
- public CollapsedState() {
- super();
- }
-
- public boolean isCollapsed() {
- return collapsed;
- }
-
- public void setCollapsed(boolean collapsed) {
- this.collapsed = collapsed;
- }
- }
-
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesDataFilterSliderTemplate.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -118,8 +118,7 @@
// create high level container DIV tag element
String style = ComponentUtil.getAttribute(sourceElement, RichFaces.ATTR_STYLE);
String styleClass = ComponentUtil.getAttribute(sourceElement,
RichFaces.ATTR_STYLE_CLASS);
- styleClass = new
StringBuffer(DEFAULT_SLIDER_CONTAINER_STYLE).append(Constants.WHITE_SPACE).
- append(RICH_DFS_CONTAINER_STYLE).append(Constants.WHITE_SPACE).append(styleClass).toString();
+ styleClass = DEFAULT_SLIDER_CONTAINER_STYLE + Constants.WHITE_SPACE +
RICH_DFS_CONTAINER_STYLE + Constants.WHITE_SPACE + styleClass;
nsIDOMElement parentDiv = createDIV(visualDocument, styleClass, style);
// create RANGE container DIV tag element
@@ -127,40 +126,41 @@
if (width == null || width.equals(Constants.EMPTY)) {
width = new Integer(DEFAULT_WIDTH).toString();
}
- style = new StringBuffer(HTML.STYLE_PARAMETER_WIDTH).append(Constants.COLON).
- append(width).append(Constants.PIXEL).append(Constants.SEMICOLON).toString();
+ style = HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + width + Constants.PIXEL +
Constants.SEMICOLON;
styleClass = ComponentUtil.getAttribute(sourceElement, RANGE_STYLE_CLASS_ATTR);
- styleClass = new StringBuffer(DEFAULT_RANGE_STYLE).append(Constants.WHITE_SPACE).
- append(RICH_DFS_RANGE_STYLE).append(Constants.WHITE_SPACE).append(styleClass).toString();
+ styleClass = DEFAULT_RANGE_STYLE + Constants.WHITE_SPACE
+ + RICH_DFS_RANGE_STYLE + Constants.WHITE_SPACE + styleClass;
nsIDOMElement rangeDiv = createDIV(visualDocument, styleClass, style);
// create RANGE-DECOR container DIV tag element
- styleClass = new
StringBuffer(DEFAULT_RANGE_DECOR_STYLE).append(Constants.WHITE_SPACE).
- append(RICH_DFS_RANGE_DECOR_STYLE).toString();
+ styleClass = DEFAULT_RANGE_DECOR_STYLE + Constants.WHITE_SPACE
+ + RICH_DFS_RANGE_DECOR_STYLE;
nsIDOMElement rangeDecorDiv = createDIV(visualDocument, styleClass, null);
// create TRAILER container DIV tag element
- style = new StringBuffer(HTML.STYLE_PARAMETER_LEFT).append(Constants.COLON).
- append(TRAILER_LEFT_OFFSET).append(Constants.PIXEL).append(Constants.SEMICOLON).toString();
+ style = HTML.STYLE_PARAMETER_LEFT + Constants.COLON + TRAILER_LEFT_OFFSET +
Constants.PIXEL + Constants.SEMICOLON;
styleClass = ComponentUtil.getAttribute(sourceElement, TRAILER_STYLE_CLASS_ATTR);
- styleClass = new StringBuffer(DEFAULT_TRAILER_STYLE).append(Constants.WHITE_SPACE).
- append(RICH_DFS_TRAILER_STYLE).append(Constants.WHITE_SPACE).append(styleClass).toString();
+ styleClass = DEFAULT_TRAILER_STYLE + Constants.WHITE_SPACE
+ + RICH_DFS_TRAILER_STYLE + Constants.WHITE_SPACE +styleClass;
nsIDOMElement trailerDiv = createDIV(visualDocument, styleClass, style);
// create TRACK container DIV tag element
- style = new StringBuffer(HTML.STYLE_PARAMETER_WIDTH).append(Constants.COLON).
- append(DEFAULT_WIDTH).append(Constants.PIXEL).append(Constants.SEMICOLON).toString();
- styleClass = ComponentUtil.getAttribute(sourceElement, TRACK_STYLE_CLASS_ATTR);
- styleClass = new StringBuffer(DEFAULT_TRACK_STYLE).append(Constants.WHITE_SPACE).
- append(RICH_DFS_TRACK_STYLE).append(Constants.WHITE_SPACE).append(styleClass).toString();
+ style = HTML.STYLE_PARAMETER_WIDTH + Constants.COLON + DEFAULT_WIDTH + Constants.PIXEL
+ Constants.SEMICOLON;
+
+ styleClass = DEFAULT_TRACK_STYLE
+ + Constants.WHITE_SPACE
+ + RICH_DFS_TRACK_STYLE
+ + Constants.WHITE_SPACE
+ + ComponentUtil.getAttribute(sourceElement, TRACK_STYLE_CLASS_ATTR);
nsIDOMElement trackDiv = createDIV(visualDocument, styleClass, style);
// create HANDLE container DIV tag element
- style = new StringBuffer(HTML.STYLE_PARAMETER_LEFT).append(Constants.COLON).
- append(ZERO).append(Constants.PIXEL).append(Constants.SEMICOLON).toString();
- styleClass = ComponentUtil.getAttribute(sourceElement, HANDLE_STYLE_CLASS_ATTR);
- styleClass = new StringBuffer(DEFAULT_HANDLE_STYLE).append(Constants.WHITE_SPACE).
- append(RICH_DFS_HANDLE_STYLE).append(Constants.WHITE_SPACE).append(styleClass).toString();
+ style = HTML.STYLE_PARAMETER_LEFT + Constants.COLON + ZERO + Constants.PIXEL +
Constants.SEMICOLON;
+ styleClass = DEFAULT_HANDLE_STYLE
+ + Constants.WHITE_SPACE
+ + RICH_DFS_HANDLE_STYLE
+ + Constants.WHITE_SPACE
+ + ComponentUtil.getAttribute(sourceElement, HANDLE_STYLE_CLASS_ATTR);
nsIDOMElement handleDiv = createDIV(visualDocument, styleClass, style);
// create element that represents trailer element
@@ -177,8 +177,7 @@
// create BR tag element
nsIDOMElement br = visualDocument.createElement(HTML.TAG_BR);
- style = new StringBuffer(HTML.STYLE_PARAMETER_CLEAR).append(Constants.COLON).
- append(HTML.VALUE_CLEAR_BOTH).append(Constants.SEMICOLON).toString();
+ style = HTML.STYLE_PARAMETER_CLEAR + Constants.COLON + HTML.VALUE_CLEAR_BOTH +
Constants.SEMICOLON;
br.setAttribute(HTML.ATTR_STYLE, style);
// create DOM tree in correspondence order
@@ -223,8 +222,7 @@
*/
private void setAttributesToInputElement(nsIDOMElement inputElement, Element
sourceElement) {
String styleClass = ComponentUtil.getAttribute(sourceElement, FIELD_STYLE_CLASS_ATTR);
- styleClass = new
StringBuffer(DEFAULT_SLIDER_INPUT_FIELD_STYLE).append(Constants.WHITE_SPACE).
- append(RICH_DFS_INPUT_FIELD_STYLE).append(Constants.WHITE_SPACE).append(styleClass).toString();
+ styleClass = DEFAULT_SLIDER_INPUT_FIELD_STYLE + Constants.WHITE_SPACE +
RICH_DFS_INPUT_FIELD_STYLE + Constants.WHITE_SPACE + styleClass;
String value = getAttribute("handleValue", sourceElement); //$NON-NLS-1$
inputElement.setAttribute(HTML.ATTR_CLASS, styleClass);
inputElement.setAttribute(HTML.ATTR_VALUE, value);
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInputNumberSpinnerTemplate.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -141,9 +141,7 @@
if (!tmp.equals(Constants.EMPTY)) {
table.setAttribute(HTML.ATTR_STYLE, tmp);
}
- tmp = getAttribute(sourceElement, RichFaces.ATTR_STYLE_CLASS);
- tmp = new StringBuffer(DEFAULT_CONTAINER_STYLE).append(Constants.WHITE_SPACE).
- append(RICH_SPINNER_C_STYLE).append(Constants.WHITE_SPACE).append(tmp).toString();
+ tmp = DEFAULT_CONTAINER_STYLE + Constants.WHITE_SPACE + RICH_SPINNER_C_STYLE +
Constants.WHITE_SPACE + getAttribute(sourceElement, RichFaces.ATTR_STYLE_CLASS);
table.setAttribute(HTML.ATTR_CLASS, tmp);
/*
@@ -264,8 +262,7 @@
if ((sourceElement).hasAttribute(RichFaces.ATTR_DISABLED)) {
String disabled = getAttribute(sourceElement, RichFaces.ATTR_DISABLED);
if (disabled != null && disabled.equals(Constants.TRUE)) {
- returnValue = new StringBuffer().append(returnValue).append(Constants.SEMICOLON)
- .append(DISABLED_INPUT_STYLE).toString();
+ returnValue += Constants.SEMICOLON + DISABLED_INPUT_STYLE;
}
}
@@ -302,7 +299,7 @@
// append custom input style class
String tmp = getAttribute(sourceElement, RichFaces.ATTR_INPUT_CLASS);
if (tmp.length() != 0) {
- returnValue = new
StringBuffer().append(returnValue).append(Constants.WHITE_SPACE).append(tmp).toString();
+ returnValue += Constants.WHITE_SPACE +tmp;
}
return returnValue;
}
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesPanelBarTemplate.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -58,10 +58,12 @@
table.setAttribute(HTML.ATTR_CLASS, styleClass);
// Set style attribute
- StringBuffer styleValue = new StringBuffer("padding: 0px; ");
//$NON-NLS-1$
- styleValue.append(height(sourceElement)).append(Constants.WHITE_SPACE)
- .append(width(sourceElement)).append(Constants.WHITE_SPACE)
- .append(ComponentUtil.getAttribute(sourceElement, HTML.ATTR_STYLE));
+ String styleValue = "padding: 0px; " //$NON-NLS-1$
+ + height(sourceElement)
+ + Constants.WHITE_SPACE
+ + width(sourceElement)
+ + Constants.WHITE_SPACE
+ + ComponentUtil.getAttribute(sourceElement, HTML.ATTR_STYLE);
// Encode Body
List<Node> children = ComponentUtil.getChildren(sourceElement);
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/util/SeamUtil.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/util/SeamUtil.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.seam/src/org/jboss/tools/jsf/vpe/seam/template/util/SeamUtil.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -143,7 +143,7 @@
}
private static String parseFontStyleValue(Node sourceFontNode) {
- StringBuffer styleAttrValue = new StringBuffer(""); //$NON-NLS-1$
+ StringBuilder styleAttrValue = new StringBuilder(); //$NON-NLS-1$
Element sourceFontElement = (Element) sourceFontNode;
if (sourceFontElement.hasAttribute(HTML.ATTR_STYLE)) {
String stringValueToParse = sourceFontElement.getAttribute(HTML.ATTR_STYLE);
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JSFModelTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JSFModelTest.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/tests/org.jboss.tools.jsf.test/src/org/jboss/tools/jsf/test/JSFModelTest.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -64,7 +64,7 @@
IFile f = project.getFile(new Path("/testCases.xml"));
ArrayList<TestDescription> tests = new
TestDescriptionFactory(f).getTestDescriptions(testName);
System.out.println(testName + " " + (tests == null ? -1 : tests.size()));
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
int errorCount = 0;
if(tests != null) for (int i = 0; i < tests.size(); i++) {
@@ -101,7 +101,7 @@
IFile f = project.getFile(new Path("/testCases.xml"));
ArrayList<TestDescription> tests = new
TestDescriptionFactory(f).getTestDescriptions(testName);
System.out.println(testName + " " + (tests == null ? -1 : tests.size()));
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
int errorCount = 0;
if(tests != null) for (int i = 0; i < tests.size(); i++) {
TestDescription t = tests.get(i);
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.verification.test/src/org/jboss/tools/jsf/verification/test/JSFVerificationTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.verification.test/src/org/jboss/tools/jsf/verification/test/JSFVerificationTest.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/tests/org.jboss.tools.jsf.verification.test/src/org/jboss/tools/jsf/verification/test/JSFVerificationTest.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -47,9 +47,9 @@
ArrayList<TestDescription> tests = provider.getTestDescriptions(testName);
System.out.println(testName + " " + (tests == null ? -1 : tests.size()));
if(tests == null) return;
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
int errorCount = 0;
- StringBuffer sb2 = new StringBuffer();
+ StringBuilder sb2 = new StringBuilder();
int errorCount2 = 0;
for (int i = 0; i < tests.size(); i++) {
TestDescription t = tests.get(i);
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesColumnsTemplateTestCase.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesColumnsTemplateTestCase.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesColumnsTemplateTestCase.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -16,6 +16,7 @@
import static org.jboss.tools.vpe.base.test.TestUtil.performTestForRichFacesComponent;
import static org.jboss.tools.vpe.xulrunner.util.XPCOM.queryInterface;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -50,45 +51,39 @@
/**
* Test columns with attributes.
+ * @throws Throwable
+ * @throws IOException
+ * @throws CoreException
*/
- public void testColumnsWithAttributes() {
- try {
- final nsIDOMElement rst = performTestForRichFacesComponent((IFile)
TestUtil.getComponentPath(COLUMNS_WITH_ATTRIBUTES,
- RichFacesAllTests.IMPORT_PROJECT_NAME));
+ public void testColumnsWithAttributes() throws CoreException, IOException, Throwable
{
+ final nsIDOMElement rst = performTestForRichFacesComponent((IFile)
TestUtil.getComponentPath(COLUMNS_WITH_ATTRIBUTES,
+ RichFacesAllTests.IMPORT_PROJECT_NAME));
- final List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
- TestUtil.findAllElementsByName(rst, elements, HTML.TAG_TD);
+ final List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
+ TestUtil.findAllElementsByName(rst, elements, HTML.TAG_TD);
- nsIDOMElement divOne = queryInterface(elements.get(0), nsIDOMElement.class);
+ nsIDOMElement divOne = queryInterface(elements.get(0), nsIDOMElement.class);
- assertEquals("Style class should be equals", "dr-table-cell
rich-table-cell myClass", divOne.getAttribute(HTML.ATTR_CLASS));
- assertEquals("Style should be equals ", "text-align:
center;", divOne.getAttribute(HTML.ATTR_STYLE));
- assertTrue("Style should contains of 52 value ",
divOne.getAttribute("width").contains("52"));
- } catch (CoreException e) {
- fail(e.getMessage() + ":" + e);
- } catch (Throwable e) {
- fail(e.getMessage() + ":" + e);
- }
- }
+ assertEquals("Style class should be equals", "dr-table-cell
rich-table-cell myClass", divOne.getAttribute(HTML.ATTR_CLASS));
+ assertEquals("Style should be equals ", "text-align:
center;", divOne.getAttribute(HTML.ATTR_STYLE));
+ assertTrue("Style should contains of 52 value ",
divOne.getAttribute("width").contains("52"));
+ }
/**
* Test simple columns.
+ * @throws Throwable
+ * @throws IOException
+ * @throws CoreException
*/
- public void testSimpleColumns() {
- try {
- final nsIDOMElement rst = performTestForRichFacesComponent((IFile)
TestUtil.getComponentPath(COMPONENTS_COLUMNS_COLUMNS_XHTML,
- RichFacesAllTests.IMPORT_PROJECT_NAME));
+ public void testSimpleColumns() throws CoreException, IOException, Throwable {
+ final nsIDOMElement rst = performTestForRichFacesComponent((IFile)
TestUtil.getComponentPath(COMPONENTS_COLUMNS_COLUMNS_XHTML,
+ RichFacesAllTests.IMPORT_PROJECT_NAME));
- final List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
- TestUtil.findAllElementsByName(rst, elements, HTML.TAG_TD);
+ final List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
+ TestUtil.findAllElementsByName(rst, elements, HTML.TAG_TD);
- nsIDOMElement divOne = queryInterface(elements.get(0), nsIDOMElement.class);
+ nsIDOMElement divOne = queryInterface(elements.get(0), nsIDOMElement.class);
- assertEquals("Style class should be equals", "dr-table-cell
rich-table-cell", divOne.getAttribute(HTML.ATTR_CLASS));
- } catch (CoreException e) {
- fail(e.getMessage() + ":" + e);
- } catch (Throwable e) {
- fail(e.getMessage() + ":" + e);
- }
+ assertEquals("Style class should be equals", "dr-table-cell
rich-table-cell", divOne.getAttribute(HTML.ATTR_CLASS));
}
}
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesPickListTemplateTestCase.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesPickListTemplateTestCase.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesPickListTemplateTestCase.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -50,10 +50,6 @@
* Test simple pick list.
*/
public void testSimplePickList() throws Throwable {
- // wait
- TestUtil.waitForJobs();
- // set exception
- setException(null);
// get test page path
IFile file = (IFile) TestUtil.getComponentPath(FILE_NAME,
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1579Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1579Test.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1579Test.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -28,11 +28,6 @@
}
public void testJBIDE_1579_2buttons() throws Throwable{
- // wait
- TestUtil.waitForJobs();
- // set exception
- setException(null);
-
// get test page path
IFile file = (IFile) TestUtil.getComponentPath(
TEST_PAGE_NAME_2BUTTONS, RichFacesAllTests.IMPORT_PROJECT_NAME);
@@ -64,10 +59,6 @@
}
public void testJBIDE_1579_4buttons() throws Throwable{
- // wait
- TestUtil.waitForJobs();
- // set exception
- setException(null);
// get test page path
IFile file = (IFile) TestUtil.getComponentPath(
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1613Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1613Test.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1613Test.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -26,11 +26,6 @@
}
public void testJBIDE_1613() throws Throwable{
- // wait
- TestUtil.waitForJobs();
- // set exception
- setException(null);
-
// get test page path
IFile file = (IFile) TestUtil.getComponentPath(
TEST_PAGE_NAME, RichFacesAllTests.IMPORT_PROJECT_NAME);
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1713Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1713Test.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/JBIDE1713Test.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -44,11 +44,6 @@
// test method for JBIDE 1713 component
public void testJBIDE_1713() throws Throwable {
- // wait
- TestUtil.waitForJobs();
- // set exception
- setException(null);
-
// get test page path
IFile file = (IFile) TestUtil.getComponentPath(TEST_PAGE_NAME,
IMPORT_PROJECT_NAME);
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1548Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1548Test.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1548Test.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -54,11 +54,6 @@
public void testJbide() throws Throwable {
- // wait
- TestUtil.waitForJobs();
- // set exception
- setException(null);
-
// get test page path
IFile file = (IFile) TestUtil.getComponentPath(
TEST_PAGE_NAME, RichFacesAllTests.IMPORT_PROJECT_NAME);
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1580Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1580Test.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1580Test.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -47,12 +47,6 @@
}
public void testUsualState() throws Throwable {
-
- // wait
- TestUtil.waitForJobs();
- // set exception
- setException(null);
-
// get test page path
IFile file = (IFile) TestUtil.getComponentPath(FILE_NAME1,
RichFacesAllTests.IMPORT_PROJECT_NAME);
@@ -90,11 +84,6 @@
public void testWithoutSomeButton() throws Throwable {
- // wait
- TestUtil.waitForJobs();
- // set exception
- setException(null);
-
// get test page path
IFile file = (IFile) TestUtil.getComponentPath(FILE_NAME2,
RichFacesAllTests.IMPORT_PROJECT_NAME);
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1614Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1614Test.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1614Test.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -46,12 +46,6 @@
}
public void testAbsolutePath() throws Throwable {
-
- // wait
- TestUtil.waitForJobs();
- // set exception
- setException(null);
-
// get test page path
IFile file = (IFile) TestUtil.getComponentPath(FILE_NAME1,
RichFacesAllTests.IMPORT_PROJECT_NAME);
@@ -87,12 +81,6 @@
}
public void testRelatedPath() throws Throwable {
-
- // wait
- TestUtil.waitForJobs();
- // set exception
- setException(null);
-
// get test page path
IFile file = (IFile) TestUtil.getComponentPath(FILE_NAME2,
RichFacesAllTests.IMPORT_PROJECT_NAME);
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1639Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1639Test.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1639Test.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -45,12 +45,6 @@
}
public void testStyleClass() throws Throwable {
-
- // wait
- TestUtil.waitForJobs();
- // set exception
- setException(null);
-
// get test page path
IFile file = (IFile) TestUtil.getComponentPath(FILE_NAME,
RichFacesAllTests.IMPORT_PROJECT_NAME);
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1682Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1682Test.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/Jbide1682Test.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -36,11 +36,6 @@
}
public void testJBIDE_1682_With_Popup() throws Throwable {
- // wait
- TestUtil.waitForJobs();
- // set exception
- setException(null);
-
// get test page path
IFile file = (IFile) TestUtil.getComponentPath(
TEST_PAGE_WITH_POPUP, RichFacesAllTests.IMPORT_PROJECT_NAME);
@@ -78,11 +73,6 @@
}
public void testJBIDE_1682_Without_Popup() throws Throwable {
- // wait
- TestUtil.waitForJobs();
- // set exception
- setException(null);
-
// get test page path
IFile file = (IFile) TestUtil.getComponentPath(
TEST_PAGE_WITHOUT_POPUP, RichFacesAllTests.IMPORT_PROJECT_NAME);
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/RichFacesJBIDE1169Test.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/RichFacesJBIDE1169Test.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/jbide/RichFacesJBIDE1169Test.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -43,8 +43,6 @@
entries[0] = new
ResourceReference(RICH_FACES_SKIN_KEY,ResourceReference.PROJECT_SCOPE);
entries[0].setProperties(SKIN_VALUE);
ELReferenceList.getInstance().setAllResources(testFile, entries);
- //clear exception
- setException(null);
}
public void testJBIDE1169() {
Modified:
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleManager.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleManager.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/jst/plugins/org.jboss.tools.jst.css/src/org/jboss/tools/jst/css/common/CSSStyleManager.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jst.css.common;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
@@ -240,21 +241,17 @@
* @return the style attributes
*/
public static Map<String, String> getStyleAttributes(String styleString) {
- Map<String, String> styleMap = new HashMap<String, String>();
+ Map<String, String> styleMap = Collections.emptyMap();
if ((styleString != null) && (styleString.length() > 0)) {
+ styleMap = new HashMap<String, String>();
String[] styles = styleString.split(Constants.SEMICOLON);
for (String styleElement : styles) {
- String[] styleElementParts = styleElement.trim().split(
- Constants.COLON);
- if ((styleElementParts != null)
- && (styleElementParts.length == 2)
- && Util.searchInElement(styleElementParts[0],
- CSSConstants.CSS_STYLES_MAP)) {
+ String[] styleElementParts = styleElement.trim().split(Constants.COLON);
+ if (styleElementParts.length == 2 &&
Util.searchInElement(styleElementParts[0], CSSConstants.CSS_STYLES_MAP)) {
styleMap.put(styleElementParts[0], styleElementParts[1]);
}
}
}
return styleMap;
}
-
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeController.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -1471,34 +1471,11 @@
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
- if (!switcher
- .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
- return Status.CANCEL_STATUS;
- }
- try {
- monitor.beginTask(VpeUIMessages.VPE_VISUAL_REFRESH_JOB,
- IProgressMonitor.UNKNOWN);
- visualRefreshImpl();
- monitor.done();
- setSynced(true);
- } catch (VpeDisposeException exc) {
- // just ignore this exception
- } catch (NullPointerException ex) {
- if (switcher != null) {
- throw ex;
- } else {
- // class was disposed and exception result of
- // that we can't stop
- // refresh job in time, so we just ignore this
- // exception
- }
- } catch (RuntimeException ex) {
- VpePlugin.getPluginLog().logError(ex);
- } finally {
- if (switcher != null) {
- switcher.stopActiveEditor();
- }
- }
+ monitor.beginTask(VpeUIMessages.VPE_VISUAL_REFRESH_JOB,
+ IProgressMonitor.UNKNOWN);
+ visualRefreshImpl();
+ monitor.done();
+ setSynced(true);
return Status.OK_STATUS;
}
};
@@ -1508,31 +1485,42 @@
}
}
- void visualRefreshImpl() {
- visualEditor.hideResizer();
-
- String currentDoctype = DocTypeUtil.getDoctype(visualEditor
- .getEditorInput());
- /*
- *
https://jira.jboss.org/jira/browse/JBIDE-3591 Avoid using missing
- * resource.
- */
- String visualEditorDoctype = visualEditor.getDoctype();
- if ((null != currentDoctype) && (null != visualEditorDoctype)
- && (!visualEditorDoctype.equals(currentDoctype))) {
- visualEditor.reload();
- } else {
- // Fix bugs JBIDE-2750
- visualBuilder.clearSelectionRectangle();
- visualEditor.reload();
- // IDOMModel sourceModel = (IDOMModel) getModel();
- // if (sourceModel != null) {
- // IDOMDocument sourceDocument = sourceModel.getDocument();
- // visualBuilder.rebuildDom(sourceDocument);
- // } else {
- // visualBuilder.rebuildDom(null);
- // }
+ public void visualRefreshImpl() {
+ if (!switcher
+ .startActiveEditor(ActiveEditorSwitcher.ACTIVE_EDITOR_SOURCE)) {
+ return;
}
+ try {
+ visualEditor.hideResizer();
+
+ String currentDoctype = DocTypeUtil.getDoctype(visualEditor
+ .getEditorInput());
+ /*
+ *
https://jira.jboss.org/jira/browse/JBIDE-3591 Avoid using missing
+ * resource.
+ */
+ String visualEditorDoctype = visualEditor.getDoctype();
+ if ((null != currentDoctype) && (null != visualEditorDoctype)
+ && (!visualEditorDoctype.equals(currentDoctype))) {
+ visualEditor.reload();
+ } else {
+ // Fix bugs JBIDE-2750
+ visualBuilder.clearSelectionRectangle();
+ visualEditor.reload();
+ // IDOMModel sourceModel = (IDOMModel) getModel();
+ // if (sourceModel != null) {
+ // IDOMDocument sourceDocument = sourceModel.getDocument();
+ // visualBuilder.rebuildDom(sourceDocument);
+ // } else {
+ // visualBuilder.rebuildDom(null);
+ // }
+ }
+ } finally {
+ if (switcher != null) {
+ switcher.stopActiveEditor();
+ }
+ }
+
}
public void preLongOperation() {
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/ComponentContentTest.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/ComponentContentTest.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/ComponentContentTest.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -15,6 +15,7 @@
import java.util.List;
import org.eclipse.core.resources.IFile;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
@@ -73,7 +74,6 @@
setException(null);
IFile elementPageFile = (IFile) TestUtil.getComponentFileByFullPath(
elementPagePath, getTestProjectName());
- TestUtil.waitForIdle();
/*
* Test that test file was found and exists
*/
@@ -104,7 +104,7 @@
protected void compareContent(VpeController controller, File xmlTestFile)
throws FileNotFoundException {
Document xmlTestDocument = TestDomUtil.getDocument(xmlTestFile);
- assertNotNull("Can't get test file, possibly file not exists
"+xmlTestFile,xmlTestDocument); //$NON-NLS-1$
+ assertNotNull("Can't get test file, possibly file not exists " +
xmlTestFile,xmlTestDocument); //$NON-NLS-1$
List<String> ids = TestDomUtil.getTestIds(xmlTestDocument);
@@ -176,7 +176,6 @@
*/
protected void performInvisibleTagTestByFullPath(String elementPagePath,
String elementId) throws Throwable {
- setException(null);
IFile elementPageFile = (IFile) TestUtil.getComponentFileByFullPath(
elementPagePath, getTestProjectName());
@@ -188,12 +187,10 @@
* Open the editor
*/
IEditorInput input = new FileEditorInput(elementPageFile);
- TestUtil.waitForJobs();
IEditorPart editor = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().openEditor(input,
getEditorID(), true);
assertNotNull("Editor should be opened.", editor); //$NON-NLS-1$
- TestUtil.waitForJobs();
/*
* Get the controller
*/
@@ -213,7 +210,7 @@
* Set show invisible tag's flag to true
*/
controller.getVisualBuilder().setShowInvisibleTags(true);
- controller.visualRefresh();
+ controller.visualRefreshImpl();
/*
* Find visual element and check if it is not null
@@ -260,16 +257,12 @@
IEditorInput input = new FileEditorInput(elementPageFile);
- TestUtil.waitForJobs();
-
IEditorPart editor = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().openEditor(input,
getEditorID(), true);
assertNotNull(editor);
- TestUtil.waitForJobs();
-
VpeController controller = TestUtil.getVpeController((JSPMultiPageEditor) editor);
// find source element and check if it is not null
@@ -289,12 +282,10 @@
// set show invisible tag's flag to true
controller.getVisualBuilder().setShowInvisibleTags(true);
- controller.visualRefresh();
+ controller.visualRefreshImpl();
- TestUtil.waitForIdle();
-
// find visual element and check if it is not null
- visualElement = findElementById(controller, elementId);
+ visualElement = findElementById(controller, elementId,TestUtil.MAX_IDLE);
assertNotNull(visualElement);
// generate text for invisible tag
@@ -340,7 +331,9 @@
nsIDOMElement result = null;
while (result==null) {
result = findElementById(controller, elementId);
- TestUtil.delay();
+ if(!Display.getCurrent().readAndDispatch()) {
+ Display.getCurrent().sleep();
+ }
if (result==null && ((System.currentTimeMillis()-start) > idle) )
throw new RuntimeException("A long running task detected"); //$NON-NLS-1$
}
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/ProjectsLoader.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/ProjectsLoader.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/ProjectsLoader.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -53,20 +53,13 @@
projectNameToLocation = new HashMap<String, ProjectLocation>();
IExtension[] extensions = VPEBaseTestPlugin.getDefault().getVpeTestExtensions();
for (IExtension extension : extensions) {
- IConfigurationElement[] confElements = extension
- .getConfigurationElements();
+ IConfigurationElement[] confElements = extension.getConfigurationElements();
for (IConfigurationElement configurationElement : confElements) {
- if (TEST_PROJECT_ELEMENT.equals(
- configurationElement.getName())) {
- Bundle bundle = Platform.getBundle(
- configurationElement.getNamespaceIdentifier());
- String name = configurationElement.getAttribute(
- TEST_PROJECT_NAME_ATTRIBUTE);
- String path = configurationElement.getAttribute(
- TEST_PROJECT_PATH_ATTRIBUTE);
-
- projectNameToLocation.put(name,
- new ProjectLocation(bundle, path));
+ if (TEST_PROJECT_ELEMENT.equals(configurationElement.getName())) {
+ Bundle bundle = Platform.getBundle(configurationElement.getNamespaceIdentifier());
+ String name = configurationElement.getAttribute(TEST_PROJECT_NAME_ATTRIBUTE);
+ String path = configurationElement.getAttribute(TEST_PROJECT_PATH_ATTRIBUTE);
+ projectNameToLocation.put(name,new ProjectLocation(bundle, path));
}
}
}
@@ -104,7 +97,7 @@
}
try {
- project = ResourcesUtils.importProject(location.getBundle(), location.getPath(),
projectName, new NullProgressMonitor());
+ project = ResourcesUtils.importProject(location.getBundle(), location.getPath(),
projectName, new NullProgressMonitor(),true);
} catch (CoreException e) {
throw new RuntimeException("Project by the path='" +
location.getPath()
+ "' cannot be imported.",e);
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestDomUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestDomUtil.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestDomUtil.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -15,6 +15,7 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
+import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Arrays;
@@ -29,6 +30,7 @@
import org.jboss.tools.common.model.ui.util.StringUtil;
import org.jboss.tools.common.model.util.XMLUtil;
+import org.jboss.tools.common.xml.XMLUtilities;
import org.jboss.tools.jst.css.common.CSSStyleManager;
import org.jboss.tools.vpe.editor.util.Constants;
import org.jboss.tools.vpe.editor.util.HTML;
@@ -75,9 +77,16 @@
public static Document getDocument(File file) throws FileNotFoundException {
// create reader
FileReader reader = new FileReader(file);
-
- // return document
- return XMLUtil.getDocument(reader);
+ try {
+ // return document
+ return XMLUtilities.getDocument(reader, null);
+ } finally {
+ try {
+ reader.close();
+ } catch (IOException e) {
+ VPEBaseTestPlugin.getDefault().logError(e);
+ }
+ }
}
public static Document getDocument(String content)
@@ -86,7 +95,7 @@
StringReader reader = new StringReader(content);
// return document
- return XMLUtil.getDocument(reader);
+ return XMLUtilities.getDocument(reader, null);
}
/**
@@ -100,7 +109,8 @@
Element element = document.getDocumentElement();
NodeList children = element.getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
+ int length = children.getLength();
+ for (int i = 0; i < length; i++) {
Node child = children.item(i);
if ((child.getNodeType() == Node.ELEMENT_NODE)
&& elementId.equals(((Element) child)
@@ -122,7 +132,8 @@
if (element != null) {
NodeList children = element.getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
+ int length = children.getLength();
+ for (int i = 0; i < length; i++) {
Node child = children.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE)
@@ -168,31 +179,18 @@
nsIDOMNodeList vpeChildren = vpeNode.getChildNodes();
NodeList schemeChildren = modelNode.getChildNodes();
int realCount = 0;
- for (int i = 0; i < schemeChildren.getLength(); i++) {
+ int length = schemeChildren.getLength();
+ for (int i = 0; i < length; i++) {
Node schemeChild = schemeChildren.item(i);
// leave out empty text nodes in test dom model
- if ((schemeChild.getNodeType() == Node.TEXT_NODE)
- && ((schemeChild.getNodeValue() == null) || (schemeChild
- .getNodeValue().trim().length() == 0)))
- continue;
-
- nsIDOMNode vpeChild = vpeChildren.item(realCount++);
-
- if (null == vpeChild) {
- throw new DOMComparisonException(
- "Child of node \"" //$NON-NLS-1$
- + vpeNode.getNodeName()
- + "\" is \"null\", but should be \"" +
schemeChild.getNodeName() + "\"",//$NON-NLS-1$ //$NON-NLS-2$
- schemeChild);
- }
-
- // leave out empty text nodes in vpe dom model
- while (((vpeChild.getNodeType() == Node.TEXT_NODE) && ((vpeChild
- .getNodeValue() == null) || (vpeChild.getNodeValue().trim()
- .length() == 0)))) {
- vpeChild = vpeChildren.item(realCount++);
+ String nodeValue = schemeChild.getNodeValue();
+ if ((schemeChild.getNodeType() != Node.TEXT_NODE)
+ || ((nodeValue != null) && (nodeValue.trim().length() > 0))) {
+
+ nsIDOMNode vpeChild = vpeChildren.item(realCount++);
+
if (null == vpeChild) {
throw new DOMComparisonException(
"Child of node \"" //$NON-NLS-1$
@@ -200,10 +198,21 @@
+ "\" is \"null\", but should be \"" +
schemeChild.getNodeName() + "\"",//$NON-NLS-1$ //$NON-NLS-2$
schemeChild);
}
+ // leave out empty text nodes in vpe dom model
+ while (((vpeChild.getNodeType() == Node.TEXT_NODE) && ((vpeChild
+ .getNodeValue() == null) || (vpeChild.getNodeValue().trim()
+ .length() == 0)))) {
+ vpeChild = vpeChildren.item(realCount++);
+ if (null == vpeChild) {
+ throw new DOMComparisonException(
+ "Child of node \"" //$NON-NLS-1$
+ + vpeNode.getNodeName()
+ + "\" is \"null\", but should be \"" +
schemeChild.getNodeName() + "\"",//$NON-NLS-1$ //$NON-NLS-2$
+ schemeChild);
+ }
+ }
+ compareNodes(vpeChild, schemeChild);
}
-
- compareNodes(vpeChild, schemeChild);
-
}
}
@@ -218,7 +227,8 @@
Element rootElement = testDocument.getDocumentElement();
List<String> ids = new ArrayList<String>();
NodeList children = rootElement.getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
+ int length = children.getLength();
+ for (int i = 0; i < length; i++) {
Node child = children.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE)
ids.add(((Element) child).getAttribute(ID_ATTRIBUTE));
@@ -338,17 +348,7 @@
List<String> propertyParts1 = splitAndSort(property1);
List<String> propertyParts2 = splitAndSort(property2);
- if (propertyParts1.size() != propertyParts2.size()) {
- return false;
- }
-
- for (int i = 0; i < propertyParts1.size(); i++) {
- if (!propertyParts1.get(i).equals(propertyParts2.get(i))) {
- return false;
- }
- }
-
- return true;
+ return propertyParts1.equals(propertyParts2);
}
private static List<String> splitAndSort(String property) {
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestUtil.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestUtil.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestUtil.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -331,14 +331,11 @@
*/
public static nsIDOMElement performTestForRichFacesComponent(IFile componentPage)
throws Throwable {
nsIDOMElement rst = null;
- TestUtil.waitForJobs();
// IFile file = (IFile)
// TestUtil.getComponentPath(componentPage,getImportProjectName());
IEditorInput input = new FileEditorInput(componentPage);
- TestUtil.waitForJobs();
- //
JSPMultiPageEditor editor = (JSPMultiPageEditor)
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(
input, EDITOR_ID, true);
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/VpeTest.java
===================================================================
---
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/VpeTest.java 2011-09-15
18:45:40 UTC (rev 34784)
+++
trunk/vpe/plugins/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/VpeTest.java 2011-09-15
19:28:55 UTC (rev 34785)
@@ -100,11 +100,8 @@
protected void setUp() throws Exception {
super.setUp();
Platform.addLogListener(this);
- // String jbossPath = System.getProperty(
- // "jbosstools.test.jboss.home.4.2", "C:\\java\\jboss-4.2.2.GA");
- // JBossASAdapterInitializer.initJBossAS(jbossPath, new
- // NullProgressMonitor());
closeEditors();
+ setException(null);
}
/**
@@ -197,16 +194,10 @@
*/
protected void performTestForVpeComponent(IFile componentPage)
throws PartInitException, Throwable {
- TestUtil.waitForJobs();
-
- setException(null);
-
// IFile file = (IFile)
// TestUtil.getComponentPath(componentPage,getImportProjectName());
IEditorInput input = new FileEditorInput(componentPage);
- TestUtil.waitForJobs();
-
IEditorPart editor = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage().openEditor(input,
getEditorID(), true);
@@ -215,10 +206,6 @@
assertNotNull(editor);
- TestUtil.waitForJobs();
- // JBIDE-1628
- // TestUtil.delay(1000);
-
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.closeAllEditors(true);
@@ -361,24 +348,25 @@
* exclude out DomDocument ( it is added to mapping specially ) and
* nodes without visual representation
*/
- if (!(nodeMapping.getSourceNode() instanceof IDOMDocument)
- && (nodeMapping.getVisualNode() != null)) {
+ Node sourceNode = nodeMapping.getSourceNode();
+ nsIDOMNode visualNode = nodeMapping.getVisualNode();
+ if (!(sourceNode instanceof IDOMDocument)
+ && (visualNode != null)) {
SelectionUtil.setSourceSelection(controller.getPageContext(),
- nodeMapping.getSourceNode(), 1, 0);
+ sourceNode, 1, 0);
TestUtil.delay();
assertNotNull(getSelectedNode(xulRunnerEditor));
nsIDOMNode sample;
- if (nodeMapping.getSourceNode().getNodeType() == Node.TEXT_NODE
- && ((VpeElementMapping) nodeMapping).getElementData() != null) {
+ if (sourceNode.getNodeType() == Node.TEXT_NODE) {
sample = ((VpeElementMapping) nodeMapping).getElementData()
.getNodesData().get(0).getVisualNode();
} else {
- sample = nodeMapping.getVisualNode();
+ sample = visualNode;
}
assertEquals(sample, getSelectedNode(xulRunnerEditor));