JBoss Tools SVN: r34787 - trunk/cdi/tests/org.jboss.tools.cdi.seam.text.ext.test/src/org/jboss/tools/cdi/seam/text/ext/test.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2011-09-15 17:17:40 -0400 (Thu, 15 Sep 2011)
New Revision: 34787
Modified:
trunk/cdi/tests/org.jboss.tools.cdi.seam.text.ext.test/src/org/jboss/tools/cdi/seam/text/ext/test/SeamResourceBundleHyperlinkTest.java
Log:
JBIDE-9288
Open On for bundle messages doesn't work for CDI projects with International Module enabled
JUnit test is added.
Modified: trunk/cdi/tests/org.jboss.tools.cdi.seam.text.ext.test/src/org/jboss/tools/cdi/seam/text/ext/test/SeamResourceBundleHyperlinkTest.java
===================================================================
--- trunk/cdi/tests/org.jboss.tools.cdi.seam.text.ext.test/src/org/jboss/tools/cdi/seam/text/ext/test/SeamResourceBundleHyperlinkTest.java 2011-09-15 19:31:29 UTC (rev 34786)
+++ trunk/cdi/tests/org.jboss.tools.cdi.seam.text.ext.test/src/org/jboss/tools/cdi/seam/text/ext/test/SeamResourceBundleHyperlinkTest.java 2011-09-15 21:17:40 UTC (rev 34787)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.cdi.seam.text.ext.test;
import java.util.ArrayList;
@@ -7,6 +17,11 @@
import org.jboss.tools.cdi.text.ext.test.CDIHyperlinkTestUtil;
import org.jboss.tools.jst.text.ext.hyperlink.ELHyperlink;
+/**
+ * The JUnit test cases for JBIDE-9288 issue
+ *
+ * @author Victor Rubezhny
+ */
public class SeamResourceBundleHyperlinkTest extends SeamCoreTest {
private static final String PAGE_NAME = "WebContent/seam-international.xhtml";
@@ -14,7 +29,7 @@
* The test case finds the hyperlinks for bundle property and checks that there are only Messages Hyperlinks
* @throws Exception
*/
- public void testCDIInternationalMessagesHyperLink () throws Exception {
+ public void testSeamResourceBundleHyperlink () throws Exception {
ArrayList<CDIHyperlinkTestUtil.TestRegion> regionList = new ArrayList<CDIHyperlinkTestUtil.TestRegion>();
regionList.add(new CDIHyperlinkTestUtil.TestRegion(398, 11,
new CDIHyperlinkTestUtil.TestHyperlink[]{new CDIHyperlinkTestUtil.TestHyperlink(ELHyperlink.class, "Open property 'home_header' of bundle 'messages'", "messages.properties")}));
@@ -35,7 +50,4 @@
CDIHyperlinkTestUtil.checkTestRegion(hyperlinks, testRegion);
}
}
-
-
-
}
\ No newline at end of file
14 years, 7 months
JBoss Tools SVN: r34786 - trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-09-15 15:31:29 -0400 (Thu, 15 Sep 2011)
New Revision: 34786
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansDialog.java
Log:
JBIDE-9347
https://issues.jboss.org/browse/JBIDE-9347
Added text filter.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansDialog.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansDialog.java 2011-09-15 19:28:55 UTC (rev 34785)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansDialog.java 2011-09-15 19:31:29 UTC (rev 34786)
@@ -12,6 +12,7 @@
import java.util.ArrayList;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -21,6 +22,7 @@
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.PopupDialog;
@@ -44,6 +46,10 @@
import org.eclipse.jface.viewers.ViewerCell;
import org.eclipse.jface.viewers.StyledString.Styler;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
@@ -59,7 +65,9 @@
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.dialogs.SearchPattern;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.IBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
@@ -92,6 +100,7 @@
Group filterPanel;
CheckboxTreeViewer filterView;
+ private Text fFilterText;
TableViewer list;
public AssignableBeansDialog(Shell parentShell) {
@@ -158,6 +167,12 @@
}
}
+ protected Control createTitleMenuArea(Composite parent) {
+ Composite fViewMenuButtonComposite= (Composite) super.createTitleMenuArea(parent);
+ fFilterText = createFilterText(parent);
+ return fViewMenuButtonComposite;
+ }
+
protected Control createDialogArea(Composite parent) {
composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
@@ -176,6 +191,7 @@
if(showHideOptions) {
createFilterView(composite);
}
+ installFilter();
return composite;
}
@@ -220,21 +236,22 @@
});
list.getTable().addMouseListener(new MouseAdapter() {
public void mouseUp(MouseEvent e) {
- ViewerCell cell = list.getCell(new Point(e.x, e.y));
- if(cell != null) {
- Widget w = cell.getItem();
- if(w != null && w.getData() instanceof IBean) {
- IBean bean = (IBean)w.getData();
- bean.open();
- close();
- }
- }
+ gotoSelectedElement();
}
});
list.refresh();
}
+ protected void gotoSelectedElement() {
+ ISelection s = list.getSelection();
+ if(!s.isEmpty() && s instanceof IStructuredSelection) {
+ IBean b = (IBean)((IStructuredSelection)s).getFirstElement();
+ b.open();
+ close();
+ }
+ }
+
void createFilterView(Composite parent) {
Group g = filterPanel = new Group(parent, 0);
g.setBackground(parent.getBackground());
@@ -273,6 +290,47 @@
});
}
+ protected Text getFilterText() {
+ return fFilterText;
+ }
+
+ protected Text createFilterText(Composite parent) {
+ fFilterText= new Text(parent, SWT.NONE);
+ Dialog.applyDialogFont(fFilterText);
+
+ GridData data= new GridData(GridData.FILL_HORIZONTAL);
+ data.horizontalAlignment= GridData.FILL;
+ data.verticalAlignment= GridData.CENTER;
+ fFilterText.setLayoutData(data);
+
+ fFilterText.addKeyListener(new KeyListener() {
+ public void keyPressed(KeyEvent e) {
+ if (e.keyCode == 0x0D) // return
+ gotoSelectedElement();
+ if (e.keyCode == SWT.ARROW_DOWN)
+ list.getTable().setFocus();
+ if (e.keyCode == SWT.ARROW_UP)
+ list.getTable().setFocus();
+ if (e.character == 0x1B) // ESC
+ close();
+ }
+ public void keyReleased(KeyEvent e) {
+ // do nothing
+ }
+ });
+ return fFilterText;
+ }
+
+ private void installFilter() {
+ fFilterText.setText(""); //$NON-NLS-1$
+
+ fFilterText.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent e) {
+ list.refresh();
+ }
+ });
+ }
+
protected String getId() {
return AssignableBeansDialog.class.getName();
}
@@ -383,7 +441,30 @@
return !((Checkbox)element).children.isEmpty();
}
}
-
+
+ TextFilter textFilter = new TextFilter();
+
+ class TextFilter implements Filter {
+ SearchPattern patternMatcher = new SearchPattern();
+ @Override
+ public void filter(Set<IBean> beans) {
+ if(fFilterText != null && !fFilterText.isDisposed()) {
+ String text = fFilterText.getText();
+ if(text.length() > 0) {
+ patternMatcher.setPattern(text);
+ Iterator<IBean> it = beans.iterator();
+ while(it.hasNext()) {
+ IBean bean = it.next();
+ if(!patternMatcher.matches(bean.getElementName())) {
+ it.remove();
+ }
+ }
+ }
+ }
+
+ }
+
+ }
class ListContent implements IStructuredContentProvider {
@Override
@@ -400,6 +481,7 @@
Set<String> keys = new HashSet<String>();
LP p = new LP();
AssignableBeanFilters.ROOT.filter(bs);
+ textFilter.filter(bs);
Map<String, IBean> map = new TreeMap<String, IBean>();
for (IBean b: bs) {
if(resolvedBeans.contains(b)) {
@@ -506,6 +588,9 @@
.append("()", nameStyler);
}
} else {
+ if(b.getBeanClass().getElementName().length() == 0) {
+ System.out.println("oops");
+ }
sb.append(b.getBeanClass().getElementName(), nameStyler);
}
14 years, 7 months
JBoss Tools SVN: r34785 - in trunk: jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/handlers/tile and 18 other directories.
by jbosstools-commits@lists.jboss.org
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));
14 years, 7 months
JBoss Tools SVN: r34784 - trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-09-15 14:45:40 -0400 (Thu, 15 Sep 2011)
New Revision: 34784
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeanFilters.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansDialog.java
trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansHyperlink.java
Log:
JBIDE-9347
https://issues.jboss.org/browse/JBIDE-9347
Added option 'Show/Hide panel'; implemented persistence.
Added: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeanFilters.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeanFilters.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeanFilters.java 2011-09-15 18:45:40 UTC (rev 34784)
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.cdi.text.ext.hyperlink;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.tools.cdi.core.CDIConstants;
+import org.jboss.tools.cdi.core.IBean;
+import org.jboss.tools.cdi.core.IBeanMember;
+import org.jboss.tools.cdi.core.IClassBean;
+import org.jboss.tools.cdi.core.IProducer;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class AssignableBeanFilters {
+
+ public static interface Filter {
+ public void filter(Set<IBean> beans);
+ }
+
+ static int OPTION_UNAVAILABLE_BEANS = 1;
+ static int OPTION_DECORATOR = 2;
+ static int OPTION_INTERCEPTOR = 3;
+ static int OPTION_UNSELECTED_ALTERNATIVE = 4;
+ static int OPTION_PRODUCER_IN_UNAVAILABLE_BEAN = 5;
+ static int OPTION_SPECIALIZED_BEAN = 6;
+ static int OPTION_ELIMINATED_AMBIGUOUS = 7;
+
+ public static class Checkbox {
+ int id;
+ String label;
+ Filter filter;
+ boolean state = true;
+ Checkbox(int id, String label, Filter filter) {
+ this.id = id;
+ this.label = label;
+ this.filter = filter;
+ ALL_OPTIONS[id] = this;
+ }
+ Checkbox parent = null;
+ List<Checkbox> children = new ArrayList<Checkbox>();
+
+ Checkbox add(int id, String label, Filter f) {
+ Checkbox c = new Checkbox(id, label, f);
+ c.parent = this;
+ children.add(c);
+ return c;
+ }
+
+ public String toString() {
+ return label;
+ }
+
+ public boolean isEnabled() {
+ return state && (parent == null || parent.isEnabled());
+ }
+
+ public void filter(Set<IBean> beans) {
+ if(id == OPTION_ELIMINATED_AMBIGUOUS) filter = new EliminatedAmbiguousFilter();
+ if(!isEnabled() && filter != null) {
+ filter.filter(beans);
+ }
+ for (Checkbox c: children) {
+ c.filter(beans);
+ }
+ }
+ }
+
+ public static Checkbox[] ALL_OPTIONS = new Checkbox[8];
+
+ public static Checkbox ROOT = new Checkbox(0, "", null);
+
+ static {
+ Checkbox unavailable = ROOT.add(OPTION_UNAVAILABLE_BEANS, "Unavailable Beans", null);
+ unavailable.add(OPTION_DECORATOR, "@Decorator", new DecoratorFilter());
+ unavailable.add(OPTION_INTERCEPTOR, "@Interceptor", new InterceptorFilter());
+ unavailable.add(OPTION_UNSELECTED_ALTERNATIVE, "Unselected @Alternative", new UnselectedAlternativeFilter());
+ unavailable.add(OPTION_PRODUCER_IN_UNAVAILABLE_BEAN, "@Produces in unavailable bean", new ProducerFilter());
+ unavailable.add(OPTION_SPECIALIZED_BEAN, "Specialized beans", new SpecializedBeanFilter());
+ ROOT.add(OPTION_ELIMINATED_AMBIGUOUS, "Eliminated ambiguous", new EliminatedAmbiguousFilter());
+ }
+
+ public static class DecoratorFilter implements Filter {
+ public void filter(Set<IBean> beans) {
+ Iterator<IBean> it = beans.iterator();
+ while(it.hasNext()) {
+ IBean b = it.next();
+ if(b.isAnnotationPresent(CDIConstants.DECORATOR_STEREOTYPE_TYPE_NAME)) {
+ it.remove();
+ }
+ }
+ }
+ }
+
+ public static class InterceptorFilter implements Filter {
+ public void filter(Set<IBean> beans) {
+ Iterator<IBean> it = beans.iterator();
+ while(it.hasNext()) {
+ IBean b = it.next();
+ if(b.isAnnotationPresent(CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME)) {
+ it.remove();
+ }
+ }
+ }
+ }
+
+ public static class UnselectedAlternativeFilter implements Filter {
+ public void filter(Set<IBean> beans) {
+ Iterator<IBean> it = beans.iterator();
+ while(it.hasNext()) {
+ IBean b = it.next();
+ if(b.isAlternative() && !b.isSelectedAlternative()) {
+ it.remove();
+ }
+ }
+ }
+ }
+
+ public static class SpecializedBeanFilter implements Filter {
+ public void filter(Set<IBean> beans) {
+ Iterator<IBean> it = beans.iterator();
+ while(it.hasNext()) {
+ IBean b = it.next();
+ if(b instanceof IClassBean && !((IClassBean) b).getSpecializingBeans().isEmpty()) {
+ it.remove();
+ }
+ }
+ }
+ }
+
+ public static class ProducerFilter implements Filter {
+ public void filter(Set<IBean> beans) {
+ Iterator<IBean> it = beans.iterator();
+ while(it.hasNext()) {
+ IBean b = it.next();
+ if(b instanceof IProducer && ((IProducer) b).getClassBean() != null && !((IProducer) b).getClassBean().isEnabled()) {
+ it.remove();
+ }
+ }
+ }
+ }
+
+ public static class EliminatedAmbiguousFilter implements Filter {
+ public void filter(Set<IBean> beans) {
+ Set<IBean> eligible = new HashSet<IBean>(beans);
+ for (int i = OPTION_UNAVAILABLE_BEANS + 1; i < OPTION_ELIMINATED_AMBIGUOUS; i++) {
+ Filter f = ALL_OPTIONS[i].filter;
+ if(f != null) {
+ f.filter(eligible);
+ }
+ }
+ boolean hasAlternative = false;
+ for (IBean b: eligible) {
+ if(b.isEnabled() && b.isAlternative() && b.isSelectedAlternative()) {
+ hasAlternative = true;
+ }
+ }
+ if(hasAlternative) {
+ Iterator<IBean> it = beans.iterator();
+ while(it.hasNext()) {
+ IBean bean = it.next();
+ if(!eligible.contains(bean) || bean.isAlternative()) continue;
+ if(bean instanceof IProducer && bean instanceof IBeanMember) {
+ IBeanMember p = (IBeanMember)bean;
+ if(p.getClassBean() != null && p.getClassBean().isAlternative()) continue;
+ }
+ it.remove();
+ }
+ }
+ }
+
+ }
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeanFilters.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansDialog.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansDialog.java 2011-09-15 18:09:30 UTC (rev 34783)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansDialog.java 2011-09-15 18:45:40 UTC (rev 34784)
@@ -12,7 +12,6 @@
import java.util.ArrayList;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -20,23 +19,24 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.PopupDialog;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTreeViewer;
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
-import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.ICheckStateProvider;
-import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.OpenEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StyledCellLabelProvider;
import org.eclipse.jface.viewers.StyledString;
import org.eclipse.jface.viewers.TableViewer;
@@ -44,19 +44,24 @@
import org.eclipse.jface.viewers.ViewerCell;
import org.eclipse.jface.viewers.StyledString.Styler;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.graphics.TextStyle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Widget;
import org.jboss.tools.cdi.core.CDIConstants;
import org.jboss.tools.cdi.core.IBean;
-import org.jboss.tools.cdi.core.IBeanMember;
-import org.jboss.tools.cdi.core.IClassBean;
import org.jboss.tools.cdi.core.IInjectionPoint;
import org.jboss.tools.cdi.core.IInjectionPointParameter;
import org.jboss.tools.cdi.core.IProducer;
@@ -64,15 +69,27 @@
import org.jboss.tools.cdi.core.IProducerMethod;
import org.jboss.tools.cdi.core.IQualifierDeclaration;
import org.jboss.tools.cdi.internal.core.impl.AbstractBeanElement;
+import org.jboss.tools.cdi.text.ext.CDIExtensionsPlugin;
+import org.jboss.tools.cdi.text.ext.hyperlink.AssignableBeanFilters.Checkbox;
+import org.jboss.tools.cdi.text.ext.hyperlink.AssignableBeanFilters.Filter;
import org.jboss.tools.common.java.IParametedType;
import org.jboss.tools.common.text.ITextSourceReference;
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
public class AssignableBeansDialog extends PopupDialog {// TitleAreaDialog {
IInjectionPoint injectionPoint;
Set<IBean> beans = new HashSet<IBean>();
Set<IBean> eligibleBeans = new HashSet<IBean>();
Set<IBean> resolvedBeans = new HashSet<IBean>();
+ Composite composite;
+
+ boolean showHideOptions = true;
+ Group filterPanel;
CheckboxTreeViewer filterView;
TableViewer list;
@@ -83,14 +100,24 @@
//PopupDialog
super(parentShell, 0, true, true, true, true, true, "title", null);
setShellStyle(getShellStyle() | SWT.RESIZE);
+ initSettings();
}
+ protected void initSettings() {
+ IDialogSettings settings = getDialogSettings();
+ showHideOptions = settings.getBoolean(SHOW_HIDE_PANEL);
+ for (Checkbox c: AssignableBeanFilters.ALL_OPTIONS) {
+ c.state = settings.getBoolean(FILTER_OPTION + c.id);
+ }
+ AssignableBeanFilters.ROOT.state = true;
+ }
+
public void setInjectionPoint(IInjectionPoint injectionPoint) {
this.injectionPoint = injectionPoint;
beans = injectionPoint.getCDIProject().getBeans(false, injectionPoint);
eligibleBeans = new HashSet<IBean>(beans);
- for (int i = OPTION_UNAVAILABLE_BEANS + 1; i < OPTION_ELIMINATED_AMBIGUOUS; i++) {
- Filter f = ALL_OPTIONS[i].filter;
+ for (int i = AssignableBeanFilters.OPTION_UNAVAILABLE_BEANS + 1; i < AssignableBeanFilters.OPTION_ELIMINATED_AMBIGUOUS; i++) {
+ Filter f = AssignableBeanFilters.ALL_OPTIONS[i].filter;
if(f != null) {
f.filter(eligibleBeans);
}
@@ -132,7 +159,7 @@
}
protected Control createDialogArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
+ composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
@@ -146,7 +173,9 @@
// PopupDialog
setTitleText(computeTitle());
createListView(composite);
- createFilterView(composite);
+ if(showHideOptions) {
+ createFilterView(composite);
+ }
return composite;
}
@@ -156,7 +185,7 @@
}
void createListView(Composite parent) {
- list = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER/* | SWT.VIRTUAL*/);
+ list = new TableViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER/* | SWT.VIRTUAL*/);
GridData g = new GridData(GridData.FILL_BOTH);
list.getControl().setLayoutData(g);
list.setContentProvider(new ListContent());
@@ -175,25 +204,49 @@
}
}
});
- list.addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
+
+ // PopupDialog
+ list.getTable().addMouseMoveListener(new MouseMoveListener() {
+ public void mouseMove(MouseEvent e) {
+ ViewerCell cell = list.getCell(new Point(e.x, e.y));
+ if(cell != null) {
+ Widget w = cell.getItem();
+ if(w != null && w.getData() != null) {
+ list.setSelection(new StructuredSelection(w.getData()));
+ }
+ }
+ list.getTable().setCursor(cell == null ? null : list.getTable().getDisplay().getSystemCursor(SWT.CURSOR_HAND));
}
});
+ list.getTable().addMouseListener(new MouseAdapter() {
+ public void mouseUp(MouseEvent e) {
+ ViewerCell cell = list.getCell(new Point(e.x, e.y));
+ if(cell != null) {
+ Widget w = cell.getItem();
+ if(w != null && w.getData() instanceof IBean) {
+ IBean bean = (IBean)w.getData();
+ bean.open();
+ close();
+ }
+ }
+ }
+ });
+
list.refresh();
}
void createFilterView(Composite parent) {
- Group g = new Group(parent, 0);
+ Group g = filterPanel = new Group(parent, 0);
+ g.setBackground(parent.getBackground());
g.setText("Show/Hide");
g.setLayoutData(new GridData(GridData.FILL_VERTICAL | GridData.VERTICAL_ALIGN_BEGINNING));
g.setLayout(new GridLayout(1, false));
- filterView = new CheckboxTreeViewer(g);
+ filterView = new CheckboxTreeViewer(g, 0);
filterView.setAutoExpandLevel(3);
filterView.setContentProvider(checkboxContentProvider);
- filterView.setInput(ROOT);
- for (int i = 1; i < ALL_OPTIONS.length; i++) {
- filterView.setChecked(ALL_OPTIONS[i], true);
+ filterView.setInput(AssignableBeanFilters.ROOT);
+ for (int i = 1; i < AssignableBeanFilters.ALL_OPTIONS.length; i++) {
+ filterView.setChecked(AssignableBeanFilters.ALL_OPTIONS[i], true);
}
filterView.getControl().setBackground(g.getBackground());
g.setData(new GridData(GridData.FILL_BOTH));
@@ -220,68 +273,84 @@
});
}
- static int OPTION_UNAVAILABLE_BEANS = 1;
- static int OPTION_DECORATOR = 2;
- static int OPTION_INTERCEPTOR = 3;
- static int OPTION_UNSELECTED_ALTERNATIVE = 4;
- static int OPTION_PRODUCER_IN_UNAVAILABLE_BEAN = 5;
- static int OPTION_SPECIALIZED_BEAN = 6;
- static int OPTION_ELIMINATED_AMBIGUOUS = 7;
+ protected String getId() {
+ return AssignableBeansDialog.class.getName();
+ }
- static class Checkbox {
- int id;
- String label;
- Filter filter;
- boolean state = true;
- Checkbox(int id, String label, Filter filter) {
- this.id = id;
- this.label = label;
- this.filter = filter;
+ protected Point getDefaultSize() {
+ return new Point(700, 400);
+ }
+
+ protected Point getDefaultLocation(Point size) {
+ Display display = Display.getCurrent();
+ if(display == null) {
+ display = Display.getDefault();
}
- Checkbox parent = null;
- List<Checkbox> children = new ArrayList<Checkbox>();
+ Rectangle b = display.getActiveShell().getBounds();
+ int x = b.x + (b.width - size.x) / 2;
+ int y = b.y + (b.height - size.y) / 2;
+ return new Point(x, y);
+ }
- Checkbox add(int id, String label, Filter f) {
- Checkbox c = new Checkbox(id, label, f);
- ALL_OPTIONS[id] = c;
- c.parent = this;
- children.add(c);
- return c;
+ // PopupDialog
+ protected void fillDialogMenu(IMenuManager dialogMenu) {
+ super.fillDialogMenu(dialogMenu);
+ dialogMenu.add(new ShowHideAction());
+ }
+ protected IDialogSettings getDialogSettings() {
+ IDialogSettings settings = CDIExtensionsPlugin.getDefault().getDialogSettings().getSection(getId());
+ if(settings == null) {
+ settings = CDIExtensionsPlugin.getDefault().getDialogSettings().addNewSection(getId());
+ settings.put(SHOW_HIDE_PANEL, true);
+ for (Checkbox c: AssignableBeanFilters.ALL_OPTIONS) {
+ settings.put(FILTER_OPTION + c.id, c.state);
+ }
}
-
- public String toString() {
- return label;
+ return settings;
+ }
+
+ public boolean close() {
+ saveFilterOptions();
+ return super.close();
+ }
+
+ private static final String SHOW_HIDE_PANEL = "SHOW_HIDE_PANEL";
+ private static final String FILTER_OPTION = "FILTER_OPTION_";
+
+ private void saveFilterOptions() {
+ IDialogSettings settings = getDialogSettings();
+ settings.put(SHOW_HIDE_PANEL, showHideOptions);
+ for (Checkbox c: AssignableBeanFilters.ALL_OPTIONS) {
+ settings.put(FILTER_OPTION + c.id, c.state);
}
-
- public boolean isEnabled() {
- return state && (parent == null || parent.isEnabled());
+ }
+
+
+ class ShowHideAction extends Action {
+ public ShowHideAction() {
+ super("Show/Hide panel", Action.AS_CHECK_BOX);
+ setChecked(showHideOptions);
}
-
- public void filter(Set<IBean> beans) {
- if(id == OPTION_ELIMINATED_AMBIGUOUS) filter = new EliminatedAmbiguousFilter();
- if(!isEnabled() && filter != null) {
- filter.filter(beans);
- }
- for (Checkbox c: children) {
- c.filter(beans);
- }
+ public void run() {
+ setFiltersEnabled(isChecked());
}
}
- static Checkbox[] ALL_OPTIONS = new Checkbox[8];
-
- static Checkbox ROOT = new Checkbox(0, "", null);
-
- static {
- Checkbox unavailable = ROOT.add(OPTION_UNAVAILABLE_BEANS, "Unavailable Beans", null);
- unavailable.add(OPTION_DECORATOR, "@Decorator", new DecoratorFilter());
- unavailable.add(OPTION_INTERCEPTOR, "@Interceptor", new InterceptorFilter());
- unavailable.add(OPTION_UNSELECTED_ALTERNATIVE, "Unselected @Alternative", new UnselectedAlternativeFilter());
- unavailable.add(OPTION_PRODUCER_IN_UNAVAILABLE_BEAN, "@Produces in unavailable bean", new ProducerFilter());
- unavailable.add(OPTION_SPECIALIZED_BEAN, "Specialized beans", new SpecializedBeanFilter());
- ROOT.add(OPTION_ELIMINATED_AMBIGUOUS, "Eliminated ambiguous", new EliminatedAmbiguousFilter());
+ protected void setFiltersEnabled(boolean enabled) {
+ if(enabled != showHideOptions) {
+ showHideOptions = enabled;
+ if(!enabled && filterPanel != null) {
+ filterPanel.dispose();
+ filterPanel = null;
+ filterView = null;
+ } else if(enabled && filterPanel == null) {
+ createFilterView(composite);
+ }
+ composite.update();
+ composite.layout(true);
+ }
}
-
+
static CheckboxContentProvider checkboxContentProvider = new CheckboxContentProvider();
static class CheckboxContentProvider implements ITreeContentProvider {
@@ -330,7 +399,7 @@
Set<IBean> bs = new HashSet<IBean>(beans);
Set<String> keys = new HashSet<String>();
LP p = new LP();
- ROOT.filter(bs);
+ AssignableBeanFilters.ROOT.filter(bs);
Map<String, IBean> map = new TreeMap<String, IBean>();
for (IBean b: bs) {
if(resolvedBeans.contains(b)) {
@@ -464,99 +533,4 @@
}
}
- static class Filter {
- public void filter(Set<IBean> beans) {
- }
- }
-
- static class DecoratorFilter extends Filter {
- public void filter(Set<IBean> beans) {
- Iterator<IBean> it = beans.iterator();
- while(it.hasNext()) {
- IBean b = it.next();
- if(b.isAnnotationPresent(CDIConstants.DECORATOR_STEREOTYPE_TYPE_NAME)) {
- it.remove();
- }
- }
- }
- }
-
- static class InterceptorFilter extends Filter {
- public void filter(Set<IBean> beans) {
- Iterator<IBean> it = beans.iterator();
- while(it.hasNext()) {
- IBean b = it.next();
- if(b.isAnnotationPresent(CDIConstants.INTERCEPTOR_ANNOTATION_TYPE_NAME)) {
- it.remove();
- }
- }
- }
- }
-
- static class UnselectedAlternativeFilter extends Filter {
- public void filter(Set<IBean> beans) {
- Iterator<IBean> it = beans.iterator();
- while(it.hasNext()) {
- IBean b = it.next();
- if(b.isAlternative() && !b.isSelectedAlternative()) {
- it.remove();
- }
- }
- }
- }
-
- static class SpecializedBeanFilter extends Filter {
- public void filter(Set<IBean> beans) {
- Iterator<IBean> it = beans.iterator();
- while(it.hasNext()) {
- IBean b = it.next();
- if(b instanceof IClassBean && !((IClassBean) b).getSpecializingBeans().isEmpty()) {
- it.remove();
- }
- }
- }
- }
-
- static class ProducerFilter extends Filter {
- public void filter(Set<IBean> beans) {
- Iterator<IBean> it = beans.iterator();
- while(it.hasNext()) {
- IBean b = it.next();
- if(b instanceof IProducer && ((IProducer) b).getClassBean() != null && !((IProducer) b).getClassBean().isEnabled()) {
- it.remove();
- }
- }
- }
- }
-
- static class EliminatedAmbiguousFilter extends Filter {
- public void filter(Set<IBean> beans) {
- Set<IBean> eligible = new HashSet<IBean>(beans);
- for (int i = OPTION_UNAVAILABLE_BEANS + 1; i < OPTION_ELIMINATED_AMBIGUOUS; i++) {
- Filter f = ALL_OPTIONS[i].filter;
- if(f != null) {
- f.filter(eligible);
- }
- }
- boolean hasAlternative = false;
- for (IBean b: eligible) {
- if(b.isEnabled() && b.isAlternative() && b.isSelectedAlternative()) {
- hasAlternative = true;
- }
- }
- if(hasAlternative) {
- Iterator<IBean> it = beans.iterator();
- while(it.hasNext()) {
- IBean bean = it.next();
- if(!eligible.contains(bean) || bean.isAlternative()) continue;
- if(bean instanceof IProducer && bean instanceof IBeanMember) {
- IBeanMember p = (IBeanMember)bean;
- if(p.getClassBean() != null && p.getClassBean().isAlternative()) continue;
- }
- it.remove();
- }
- }
- }
-
- }
}
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansHyperlink.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansHyperlink.java 2011-09-15 18:09:30 UTC (rev 34783)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.text.ext/src/org/jboss/tools/cdi/text/ext/hyperlink/AssignableBeansHyperlink.java 2011-09-15 18:45:40 UTC (rev 34784)
@@ -14,7 +14,6 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.jboss.tools.cdi.core.ICDIElement;
import org.jboss.tools.cdi.core.IInjectionPoint;
@@ -45,12 +44,6 @@
dialog.setInjectionPoint(injectionPoint);
dialog.create();
dialog.getShell().setText(CDIExtensionsMessages.ASSIGNABLE_BEANS_DIALOG_TITLE);
- int width = 700;
- int height = 400;
- Rectangle b = display.getActiveShell().getBounds();
- int x = b.x + (b.width - width) / 2;
- int y = b.y + (b.height - height) / 2;
- dialog.getShell().setBounds(x, y, width, height);
dialog.open();
}
14 years, 7 months
JBoss Tools SVN: r34783 - trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2011-09-15 14:09:30 -0400 (Thu, 15 Sep 2011)
New Revision: 34783
Removed:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ComponentContentTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/DOMComparisonException.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/OpenOnUtil.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ProjectsLoader.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestDomUtil.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTestSetup.java
Log:
removing files from vpe.ui.test that were moved to vpe.base.test.
Deleted: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ComponentContentTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ComponentContentTest.java 2011-09-15 17:49:22 UTC (rev 34782)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ComponentContentTest.java 2011-09-15 18:09:30 UTC (rev 34783)
@@ -1,372 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.ui.test;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.wst.xml.xpath.core.util.XSLTXPathHelper;
-import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
-import org.jboss.tools.test.util.WorkbenchUtils;
-import org.jboss.tools.vpe.editor.VpeController;
-import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
-import org.jboss.tools.vpe.editor.util.SourceDomUtil;
-import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMNode;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * @author Sergey Dzmitrovich
- *
- */
-public abstract class ComponentContentTest extends VpeTest {
-
- public static final String XML_FILE_EXTENSION = ".xml"; //$NON-NLS-1$
-
- public ComponentContentTest(String name) {
- super(name);
- }
-
- /**
- *
- * there are several conditions:
- * <p>
- * 1) xml file which contain tests must be named 'name of test page' +
- * '.xml'
- * <br>
- * Example: test.jsp and test.jsp.xml
- * <p>
- * 2) a tag <test> in xml file and required element in test page must have
- * the same attribute "id"
- * <br>
- * Example: <tests>... <test id="testId" > ...<tests> - in xml file and
- * <br>
- * <html>... <x:testElement id="testId" > ... </html> - in test page
- *
- * @param elementPagePath
- * - path to test page
- * @throws Throwable
- */
- protected void performContentTest(String elementPagePath) throws Throwable {
- performContentTestByFullPath(TestUtil.COMPONENTS_PATH + elementPagePath);
- }
-
- protected void performContentTestByFullPath(String elementPagePath) throws Throwable {
- setException(null);
- IFile elementPageFile = (IFile) TestUtil.getComponentFileByFullPath(
- elementPagePath, getTestProjectName());
- TestUtil.waitForIdle();
- /*
- * Test that test file was found and exists
- */
- assertNotNull("Could not find component file '"+elementPagePath+"'", elementPageFile); //$NON-NLS-1$ //$NON-NLS-2$
-
- IEditorPart editor = WorkbenchUtils.openEditor(elementPageFile,getEditorID());
- assertNotNull("Editor should be opened.", editor); //$NON-NLS-1$
- VpeController controller = TestUtil.getVpeController((JSPMultiPageEditor) editor);
- /*
- * Get xml test file
- */
- File xmlTestFile = TestUtil.getComponentFileByFullPath(
- elementPagePath + XML_FILE_EXTENSION, getTestProjectName())
- .getLocation().toFile();
- /*
- * Test that XML test file was found and exists
- */
- assertNotNull("Could not find XML component file '"+elementPagePath + XML_FILE_EXTENSION+"'", elementPageFile); //$NON-NLS-1$ //$NON-NLS-2$
- /*
- * Get document
- */
- compareContent(controller, xmlTestFile);
- if (getException() != null) {
- throw getException();
- }
- }
-
- 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$
-
- List<String> ids = TestDomUtil.getTestIds(xmlTestDocument);
-
- for (String id : ids) {
- try{
- compareElements(controller, xmlTestDocument, id, id);
- } catch (DOMComparisonException e) {
- String xPathToNode = SourceDomUtil.getXPath(e.getNode());
- String testFileName = xmlTestFile.getPath();
- String message = e.getMessage();
- fail(String.format("%s[%s]:\n%s", testFileName, xPathToNode, message)); //$NON-NLS-1$
- }
- }
- }
-
- /**
- *
- * @param controller
- * @param xmlTestDocument
- * @param elementId
- * @param xmlTestId
- * @return
- * @throws DOMComparisonException
- */
- private void compareElements(VpeController controller,
- Document xmlTestDocument, String elementId, String xmlTestId)
- throws DOMComparisonException {
- // get element by id
- nsIDOMElement vpeElement = findElementById(controller, elementId);
- assertNotNull("Cann't find element with id="+elementId,vpeElement); //$NON-NLS-1$
-
- // DOMTreeDumper dumper = new DOMTreeDumper(
- // VpeDebug.VISUAL_DUMP_PRINT_HASH);
- // dumper.dumpToStream(System.out, vpeElement);
-
- // get test element by id - get <test id="..." > element and get his
- // first child
- Element xmlModelElement = TestDomUtil.getFirstChildElement(TestDomUtil
- .getElemenById(xmlTestDocument, xmlTestId));
-
- assertNotNull(xmlModelElement);
-
- TestDomUtil.compareNodes(vpeElement, xmlModelElement);
- }
-
- /**
- * test for invisible tags
- *
- * @param elementPagePath
- * - path to test page
- * @param elementId
- * - id of element on page
- * @throws Throwable
- */
- protected void performInvisibleTagTest(String elementPagePath,
- String elementId) throws Throwable {
- performInvisibleTagTestByFullPath(TestUtil.COMPONENTS_PATH
- + elementPagePath, elementId);
- }
-
- /**
- * test for invisible tags
- *
- * @param elementPagePath
- * - path to test page
- * @param elementId
- * - id of element on page
- * @throws Throwable
- */
- protected void performInvisibleTagTestByFullPath(String elementPagePath,
- String elementId) throws Throwable {
- setException(null);
-
- IFile elementPageFile = (IFile) TestUtil.getComponentFileByFullPath(
- elementPagePath, getTestProjectName());
- /*
- * Test that test file was found and exists
- */
- assertNotNull("Could not find component file '"+elementPagePath+"'", elementPageFile); //$NON-NLS-1$ //$NON-NLS-2$
- /*
- * 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
- */
- VpeController controller = TestUtil.getVpeController((JSPMultiPageEditor) editor);
- /*
- * Find source element and check if it is not null
- */
- Element sourceElement = findSourceElementById(controller, elementId);
- assertNotNull("Source node with id '" + elementId + "' was not found.", sourceElement); //$NON-NLS-1$ //$NON-NLS-2$
- /*
- * Find visual element and check if it is null
- */
- nsIDOMElement visualElement = findElementById(controller, elementId);
- assertNull("Source node with id '" + elementId + "' has visual representation.", visualElement); //$NON-NLS-1$ //$NON-NLS-2$
-
- /*
- * Set show invisible tag's flag to true
- */
- controller.getVisualBuilder().setShowInvisibleTags(true);
- controller.visualRefresh();
-
- /*
- * Find visual element and check if it is not null
- */
- visualElement = findElementById(controller, elementId,TestUtil.MAX_IDLE);
- assertNotNull(visualElement);
-
- /*
- * Generate text for invisible tag
- */
- String modelInvisibleTagText = generateInvisibleTagText(sourceElement
- .getNodeName());
-
- /*
- * Generate dom document and get root element
- */
- Element modelElement = TestDomUtil.getDocument(modelInvisibleTagText)
- .getDocumentElement();
- assertNotNull(modelElement);
-
- TestDomUtil.compareNodes(visualElement, modelElement);
-
- if (getException() != null) {
- throw getException();
- }
-
- }
-
- /**
- * test for invisible tags which can have visible children
- *
- * @param elementPagePath
- * - path to test page
- * @param elementId
- * - id of element on page
- * @throws Throwable
- */
- protected void performInvisibleWrapperTagTest(String elementPagePath,
- String elementId) throws Throwable {
- setException(null);
-
- IFile elementPageFile = (IFile) TestUtil.getComponentPath(
- elementPagePath, getTestProjectName());
-
- 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
- Element sourceELement = findSourceElementById(controller, elementId);
- assertNotNull(sourceELement);
-
- // find visual element and check if it is null
- nsIDOMElement visualElement = findElementById(controller, elementId);
- assertNull(visualElement);
-
- // check children of non-visual
- NodeList children = sourceELement.getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
- Node child = children.item(i);
- assertNotNull(findNode(controller, child));
- }
-
- // set show invisible tag's flag to true
- controller.getVisualBuilder().setShowInvisibleTags(true);
- controller.visualRefresh();
-
- TestUtil.waitForIdle();
-
- // find visual element and check if it is not null
- visualElement = findElementById(controller, elementId);
- assertNotNull(visualElement);
-
- // generate text for invisible tag
- String modelInvisibleTagText = generateInvisibleTagText(sourceELement
- .getNodeName());
-
- // generate dom document and get root element
- Element modelElement = TestDomUtil.getDocument(modelInvisibleTagText)
- .getDocumentElement();
- assertNotNull(modelElement);
-
- // compare elements
- TestDomUtil.compareNodes(visualElement, modelElement);
-
- if (getException() != null) {
- throw getException();
- }
-
- }
-
- /**
- *
- * @param tagName
- * @return
- */
- private String generateInvisibleTagText(String tagName) {
- return "<span style=\"border: 1px dashed GREY; color: GREY; font-size: 12px;\" >" //$NON-NLS-1$
- + tagName + "</span>"; //$NON-NLS-1$
- }
-
- /**
- * find visual element by "id" entered in source part of vpe
- *
- * @param controller
- * @param elementId
- * @param idle try element for some time period, for example when we need
- * to wait for refresh job
- * @return
- */
- protected nsIDOMElement findElementById(VpeController controller,
- String elementId, long idle) {
- long start = System.currentTimeMillis();
- nsIDOMElement result = null;
- while (result==null) {
- result = findElementById(controller, elementId);
- TestUtil.delay(50);
- if (result==null && ((System.currentTimeMillis()-start) > idle) )
- throw new RuntimeException("A long running task detected"); //$NON-NLS-1$
- }
- return result;
- }
- /**
- * find visual element by "id" entered in source part of vpe
- *
- * @param controller
- * @param elementId
- * @return
- */
- protected nsIDOMNode findNode(VpeController controller, Node node) {
-
- VpeNodeMapping nodeMapping = controller.getDomMapping().getNodeMapping(
- node);
-
- if (nodeMapping == null)
- return null;
-
- return nodeMapping.getVisualNode();
- }
-
- /**
- *
- * @return
- */
- abstract protected String getTestProjectName();
-
-}
Deleted: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/DOMComparisonException.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/DOMComparisonException.java 2011-09-15 17:49:22 UTC (rev 34782)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/DOMComparisonException.java 2011-09-15 18:09:30 UTC (rev 34783)
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.ui.test;
-
-import org.w3c.dom.Node;
-
-/**
- * @author Sergey Dzmitrovich
- * @author Yahor Radtsevich (yradtsevich)
- *
- */
-public class DOMComparisonException extends Exception {
- private static final long serialVersionUID = 7127064462771778364L;
- private Node node;
-
- public DOMComparisonException(String message, Node node) {
- super(message);
- this.node = node;
- }
-
- public Node getNode() {
- return node;
- }
-}
Deleted: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/OpenOnUtil.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/OpenOnUtil.java 2011-09-15 17:49:22 UTC (rev 34782)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/OpenOnUtil.java 2011-09-15 18:09:30 UTC (rev 34783)
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2009 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.ui.test;
-
-import java.lang.reflect.Method;
-import static junit.framework.Assert.assertEquals;
-import org.eclipse.jface.text.Region;
-import org.eclipse.jface.text.hyperlink.IHyperlink;
-import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
-import org.eclipse.jface.text.source.SourceViewerConfiguration;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.MultiPageEditorPart;
-import org.eclipse.ui.texteditor.AbstractTextEditor;
-import org.eclipse.wst.sse.ui.StructuredTextEditor;
-import org.jboss.tools.common.model.ui.editor.EditorPartWrapper;
-import org.jboss.tools.common.model.ui.texteditors.XMLTextEditorStandAlone;
-import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
-import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
-
-/**
- * @author Sergey Dzmitrovich
- *
- */
-public class OpenOnUtil {
-
- /**
- * method does open on action in editor
- *
- * @param textEditor
- * @param lineNumber
- * @param lineOffset
- * @throws Throwable
- */
- public static final void performOpenOnAction(
- StructuredTextEditor textEditor, int offset) throws Throwable {
-
- // hack to get hyperlinks detectors, no other was have been founded
- Method method = AbstractTextEditor.class
- .getDeclaredMethod("getSourceViewerConfiguration"); //$NON-NLS-1$
- method.setAccessible(true);
- SourceViewerConfiguration sourceViewerConfiguration = (SourceViewerConfiguration) method
- .invoke(textEditor);
- IHyperlinkDetector[] hyperlinkDetectors = sourceViewerConfiguration
- .getHyperlinkDetectors(textEditor.getTextViewer());
-
- for (IHyperlinkDetector iHyperlinkDetector : hyperlinkDetectors) {
- IHyperlink[] hyperLinks = iHyperlinkDetector.detectHyperlinks(
- textEditor.getTextViewer(), new Region(offset, 0), false);
- if (hyperLinks != null && hyperLinks.length > 0
- && hyperLinks[0] instanceof AbstractHyperlink) {
- AbstractHyperlink abstractHyperlink = (AbstractHyperlink) hyperLinks[0];
- abstractHyperlink.open();
- break;
- }
- }
-
- }
-
- /**
- * Function for checking openOn functionality
- *
- * @param editorInput
- * @param editorId
- * @param lineNumber
- * @param lineOffset
- * @param openedOnFileName
- * @throws Throwable
- *
- * @author mareshkau
- */
-
- public static final void checkOpenOnInEditor(IEditorInput editorInput,String editorId,int lineNumber, int lineOffset, String openedOnFileName) throws Throwable {
- StructuredTextEditor textEditor = getStructuredTextEditorPart(editorInput, editorId);
-
- int openOnPosition = TestUtil.getLinePositionOffcet(textEditor
- .getTextViewer(),lineNumber, lineOffset);
- // hack to get hyperlinks detectors, no other was have been founded
- Method method = AbstractTextEditor.class
- .getDeclaredMethod("getSourceViewerConfiguration"); //$NON-NLS-1$
- method.setAccessible(true);
- SourceViewerConfiguration sourceViewerConfiguration = (SourceViewerConfiguration) method
- .invoke(textEditor);
- IHyperlinkDetector[] hyperlinkDetectors = sourceViewerConfiguration
- .getHyperlinkDetectors(textEditor.getTextViewer());
- for (IHyperlinkDetector iHyperlinkDetector : hyperlinkDetectors) {
- IHyperlink[] hyperLinks = iHyperlinkDetector.detectHyperlinks(
- textEditor.getTextViewer(), new Region(openOnPosition, 0),
- false);
- if (hyperLinks != null && hyperLinks.length > 0
- && hyperLinks[0] instanceof AbstractHyperlink) {
- AbstractHyperlink abstractHyperlink = (AbstractHyperlink) hyperLinks[0];
- abstractHyperlink.open();
- break;
- }
- }
- IEditorPart activeEditor = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
- assertEquals(
- "Active page should be ", openedOnFileName, activeEditor.getEditorInput().getName()); //$NON-NLS-1$
- }
-
- private static StructuredTextEditor getStructuredTextEditorPart(IEditorInput editorInput,String editorId) throws PartInitException{
- IEditorPart editorPart = PlatformUI
- .getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .openEditor(editorInput, editorId);
- StructuredTextEditor textEditor = null;
- if(editorPart instanceof MultiPageEditorPart){
- StructuredTextEditor structuredTextEditor = findStructEditor((MultiPageEditorPart)editorPart, editorInput);
- ((MultiPageEditorPart)editorPart).setActiveEditor(structuredTextEditor);
- textEditor = structuredTextEditor;
- } else if(editorPart instanceof JSPMultiPageEditor) {
- textEditor = ((JSPMultiPageEditor)editorPart).getSourceEditor();
- } else if(editorPart instanceof EditorPartWrapper
- &&(((EditorPartWrapper)editorPart).getEditor()) instanceof MultiPageEditorPart) {
- StructuredTextEditor structuredTextEditor = findStructEditor((MultiPageEditorPart)((EditorPartWrapper)editorPart).getEditor(), editorInput);
- ((MultiPageEditorPart)((EditorPartWrapper)editorPart).getEditor()).setActiveEditor(structuredTextEditor);
- textEditor = structuredTextEditor;
- } else if(editorPart instanceof EditorPartWrapper &&
- (((EditorPartWrapper)editorPart).getEditor()) instanceof StructuredTextEditor){
- textEditor = (StructuredTextEditor) (((EditorPartWrapper)editorPart).getEditor());
- }
- return textEditor;
- }
-
- private static StructuredTextEditor findStructEditor (MultiPageEditorPart part, IEditorInput input){
- IEditorPart[] editorParts = part.findEditors(input);
- for (int i = 0; i < editorParts.length; i++) {
- if (editorParts[i] instanceof StructuredTextEditor) {
- return (StructuredTextEditor) editorParts[i];
- }
- }
- return null;
- }
-
-}
Deleted: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ProjectsLoader.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ProjectsLoader.java 2011-09-15 17:49:22 UTC (rev 34782)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ProjectsLoader.java 2011-09-15 18:09:30 UTC (rev 34783)
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributor:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.ui.test;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import junit.framework.Assert;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.jboss.tools.test.util.JobUtils;
-import org.jboss.tools.test.util.ResourcesUtils;
-import org.osgi.framework.Bundle;
-
-/**
- * Singleton class to operate on test projects.
- *
- * @see {@code org.jboss.tools.vpe.ui.tests} extension point
- * @author Yahor Radtsevich (yradtsevich)
- */
-public class ProjectsLoader {
- private static final String TEST_PROJECT_ELEMENT = "testProject";
- private static final String TEST_PROJECT_PATH_ATTRIBUTE = "path";
- private static final String TEST_PROJECT_NAME_ATTRIBUTE = "name";
- private Map<String, ProjectLocation> projectNameToLocation;
- private static ProjectsLoader instance = null;
-
- private ProjectsLoader() {
- /*
- * Load project names and paths to them from the extensions of
- * {@link VpeAllTests#VPE_TEST_EXTENTION_POINT_ID}. And store
- * loaded data in {@link #projectNameToLocation}.
- */
- projectNameToLocation = new HashMap<String, ProjectLocation>();
- IExtension[] extensions = VPETestPlugin.getDefault().getVpeTestExtensions();
- for (IExtension extension : extensions) {
- 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));
- }
- }
- }
- }
-
- /**
- * Returns the instance of {@link ProjectsLoader}
- */
- public static ProjectsLoader getInstance() {
- if (instance == null) {
- instance = new ProjectsLoader();
- }
-
- return instance;
- }
-
- /**
- * Returns instance of {@link IProject} by {@code projectName}.
- * If the project does not exist in the workspace, imports it from the
- * resources specified by extensions of {@code org.jboss.tools.vpe.ui.tests}
- * extension point.
- * <p>
- * This method has <i>fail-fast</i> behavior. It never returns {@code null}.
- * It throws exceptions in the cases if the project is not defined,
- * can not be opened, etc.
- */
- public IProject getProject(String projectName) throws IOException {
- IProject project = getExistingProject(projectName);
-
- if (!project.isAccessible()) {
- ProjectLocation location = projectNameToLocation.get(projectName);
- if (location == null) {
- throw new RuntimeException(
- "Project '" + project + "' is not defined.");
- }
-
- try {
- project = ResourcesUtils.importProject(location.getBundle(), location.getPath(), projectName, new NullProgressMonitor());
- } catch (CoreException e) {
- throw new RuntimeException("Project by the path='" + location.getPath()
- + "' cannot be imported.",e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException("Project by the path='" + location.getPath()
- + "' cannot be imported.",e);
- } catch (InterruptedException e) {
- throw new RuntimeException("Project by the path='" + location.getPath()
- + "' cannot be imported.",e);
- }
- }
-
- return project;
- }
-
- /**
- * Returns a workspace project by its {@code projectName}, or {@code null}
- * if there is no project with this name in the workspace.
- */
- public static IProject getExistingProject(String projectName) {
- return ResourcesPlugin.getWorkspace().getRoot()
- .getProject(projectName);
- }
-
- /**
- * Removes the project with the {@code projectName} from the workspace.
- *
- * @param projectName the project name
- * @throws CoreException the core exception
- */
- static public void removeProject(String projectName) throws CoreException {
- IProject project = ProjectsLoader.getExistingProject(projectName);
- removeProject(project);
- }
-
- /**
- * Removes given {@code project} from the workspace
- *
- * @param project project to remove
- * @throws CoreException
- */
- private static void removeProject(IProject project) throws CoreException {
- boolean saveAutoBuild = ResourcesUtils.setBuildAutomatically(false);
- try {
- if (project != null) {
- project.delete(IResource.ALWAYS_DELETE_PROJECT_CONTENT,
- new NullProgressMonitor());
- JobUtils.waitForIdle();
- }
- } finally {
- ResourcesUtils.setBuildAutomatically(saveAutoBuild);
- }
- }
-
- /**
- * Removes all projects from the workspace
- *
- * @throws CoreException
- */
- static public void removeAllProjects() throws CoreException {
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot()
- .getProjects();
- for (IProject project: projects) {
- removeProject(project);
- }
- }
-
- /**
- * Stores the {@code path} to a project and the owning {@code bundle}.
- *
- * @author Yahor Radtsevich (yradtsevich)
- */
- private class ProjectLocation {
- private Bundle bundle;
- private String path;
-
- public ProjectLocation(Bundle bundle, String path) {
- this.bundle = bundle;
- this.path = path;
- }
- public Bundle getBundle() {
- return bundle;
- }
- public String getPath() {
- return path;
- }
-
- public String toString() {
- return String.format("(%s, %s)",
- bundle == null ? null : bundle.getLocation(), path);
- }
- }
-}
Deleted: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestDomUtil.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestDomUtil.java 2011-09-15 17:49:22 UTC (rev 34782)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestDomUtil.java 2011-09-15 18:09:30 UTC (rev 34783)
@@ -1,381 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.ui.test;
-
-import static org.jboss.tools.vpe.xulrunner.util.XPCOM.queryInterface;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.jboss.tools.common.model.util.XMLUtil;
-import org.jboss.tools.jst.css.common.CSSStyleManager;
-import org.jboss.tools.vpe.editor.util.Constants;
-import org.jboss.tools.vpe.editor.util.HTML;
-import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
-import org.mozilla.interfaces.nsIDOMAttr;
-import org.mozilla.interfaces.nsIDOMCSSStyleDeclaration;
-import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMNamedNodeMap;
-import org.mozilla.interfaces.nsIDOMNode;
-import org.mozilla.interfaces.nsIDOMNodeList;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.css.CSSStyleDeclaration;
-import org.w3c.dom.css.ElementCSSInlineStyle;
-
-/**
- * @author Sergey Dzmitrovich
- *
- */
-public class TestDomUtil {
- /**
- * Attributes names that will be skipped in attribute comparison.
- */
- public static final Set<String> skippedAtributes = new HashSet<String>();
- static {
- // Add here all attributes names to be skipped (IN UPPER CASE!)
- skippedAtributes.addAll(Arrays.asList("DIR"));//$NON-NLS-1$
- }
-
- final public static String ID_ATTRIBUTE = "id"; //$NON-NLS-1$
-
- final public static String ILLEGAL_ATTRIBUTES = "illegalAttributes"; //$NON-NLS-1$
-
- final public static String ILLEGAL_ATTRIBUTES_SEPARATOR = Constants.COMMA;
-
- final public static String START_REGEX = "/"; //$NON-NLS-1$
-
- final public static String END_REGEX = "/"; //$NON-NLS-1$
-
- public static Document getDocument(File file) throws FileNotFoundException {
- // create reader
- FileReader reader = new FileReader(file);
-
- // return document
- return XMLUtil.getDocument(reader);
- }
-
- public static Document getDocument(String content)
- throws FileNotFoundException {
- // create reader
- StringReader reader = new StringReader(content);
-
- // return document
- return XMLUtil.getDocument(reader);
- }
-
- /**
- *
- * @param document
- * @param elementId
- * @return
- */
- public static Element getElemenById(Document document, String elementId) {
-
- Element element = document.getDocumentElement();
-
- NodeList children = element.getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
- Node child = children.item(i);
- if ((child.getNodeType() == Node.ELEMENT_NODE)
- && elementId.equals(((Element) child)
- .getAttribute(ID_ATTRIBUTE)))
- return (Element) child;
-
- }
-
- return null;
-
- }
-
- /**
- *
- * @param element
- * @return
- */
- public static Element getFirstChildElement(Element element) {
-
- if (element != null) {
- NodeList children = element.getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
- Node child = children.item(i);
-
- if (child.getNodeType() == Node.ELEMENT_NODE)
- return (Element) child;
-
- }
- }
- return null;
-
- }
-
- /**
- *
- * @param vpeNode
- * @param schemeNode
- * @return
- * @throws DOMComparisonException
- */
- public static void compareNodes(nsIDOMNode vpeNode, Node modelNode)
- throws DOMComparisonException {
-
- if (!modelNode.getNodeName().equalsIgnoreCase(vpeNode.getNodeName())) {
- throw new DOMComparisonException("name of tag is \"" //$NON-NLS-1$
- + vpeNode.getNodeName() + "\"but must be \"" //$NON-NLS-1$
- + modelNode.getNodeName() + "\"", modelNode); //$NON-NLS-1$
- }
- if ((modelNode.getNodeValue() != null)
- && (!modelNode.getNodeValue().trim().equalsIgnoreCase(
- vpeNode.getNodeValue().trim()))) {
- throw new DOMComparisonException("value of " + vpeNode.getNodeName() //$NON-NLS-1$
- + " is \"" + vpeNode.getNodeValue().trim() //$NON-NLS-1$
- + "\" but must be \"" + modelNode.getNodeValue().trim() //$NON-NLS-1$
- + "\"", modelNode); //$NON-NLS-1$
- }
-
- // compare node's attributes
- if (modelNode.getNodeType() == Node.ELEMENT_NODE) {
- compareAttributes(modelNode.getAttributes(), vpeNode
- .getAttributes());
- }
-
- // compare children
- nsIDOMNodeList vpeChildren = vpeNode.getChildNodes();
- NodeList schemeChildren = modelNode.getChildNodes();
- int realCount = 0;
- for (int i = 0; i < schemeChildren.getLength(); 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++);
- 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);
-
- }
-
- }
-
- /**
- * get ids of tests
- *
- * @param testDocument
- * @return
- */
- public static List<String> getTestIds(Document testDocument) {
- Element rootElement = testDocument.getDocumentElement();
- List<String> ids = new ArrayList<String>();
- NodeList children = rootElement.getChildNodes();
- for (int i = 0; i < children.getLength(); i++) {
- Node child = children.item(i);
- if (child.getNodeType() == Node.ELEMENT_NODE)
- ids.add(((Element) child).getAttribute(ID_ATTRIBUTE));
-
- }
- return ids;
- }
-
- private static void compareAttributes(NamedNodeMap modelAttributes,
- nsIDOMNamedNodeMap vpeAttributes) throws DOMComparisonException {
-
- for (int i = 0; i < modelAttributes.getLength(); i++) {
- Attr modelAttr = (Attr) modelAttributes.item(i);
- String name = modelAttr.getName();
- // if the attribute has to be skipped, then do it
- if ( name != null
- && skippedAtributes.contains(name.toUpperCase()) ) {
- continue;
- }
- // if there are limitation of attributes
- if (ILLEGAL_ATTRIBUTES.equals(name)) {
- String[] illegalAttributes = modelAttr.getNodeValue().split(
- ILLEGAL_ATTRIBUTES_SEPARATOR);
- for (String illegalAttributeName : illegalAttributes) {
- if (vpeAttributes.getNamedItem(illegalAttributeName.trim()) != null)
- throw new DOMComparisonException("illegal attribute :" //$NON-NLS-1$
- + illegalAttributeName, modelAttr);
- }
- } else {
- if (vpeAttributes.getNamedItem(name) == null) {
- throw new DOMComparisonException("there is not : \"" + name //$NON-NLS-1$
- + "\" attribute", modelAttr); //$NON-NLS-1$
- }
- nsIDOMAttr vpeAttr = queryInterface(
- vpeAttributes.getNamedItem(name), nsIDOMAttr.class);
- /*
- * By default every attribute show pass through
- * compareComplexStrings(..) method.
- * For "style" attribute there is a separate comparison.
- */
- boolean performComplexStringsComparison = true;
- if (HTML.ATTR_STYLE.equalsIgnoreCase(name)) {
- String xmlAttrValue = modelAttr.getNodeValue();
- /*
- * Check if it is not a regular expression.
- * Otherwise perform Complex Strings Comparison
- * as usual.
- */
- if (!(xmlAttrValue.startsWith(START_REGEX)
- && xmlAttrValue.endsWith(END_REGEX))) {
- performComplexStringsComparison = false;
- /*
- * Parse style attribute value
- */
- Map<String, String> vpeStyle = CSSStyleManager
- .getStyleAttributes(vpeAttr.getNodeValue());
- Map<String, String> xmlStyle = CSSStyleManager
- .getStyleAttributes(xmlAttrValue);
- /*
- * Major condition is that
- * all styles from the xml file should present
- * in the style attribute of the vpe element.
- */
- if (xmlStyle.size() > vpeStyle.size()) {
- throw new DOMComparisonException(
- "VPE element has less style parameters [" //$NON-NLS-1$
- + vpeStyle.size()
- + "] than was specified [" //$NON-NLS-1$
- + xmlStyle.size() + "]." //$NON-NLS-1$
- + "\n Expected: " + xmlStyle //$NON-NLS-1$
- + "\n Was: " + vpeStyle, //$NON-NLS-1$
- modelAttr);
- } else {
- if ((xmlStyle.size() > 0) && (vpeStyle.size() > 0)) {
- for (String key : xmlStyle.keySet()) {
- if (vpeStyle.containsKey(key)) {
- if (!xmlStyle.get(key).equalsIgnoreCase(
- vpeStyle.get(key))) {
- throw new DOMComparisonException(
- "Style value for parameter [" //$NON-NLS-1$
- + key
- + "] is different. Expected [" //$NON-NLS-1$
- + xmlStyle.get(key)
- + "] but was [" //$NON-NLS-1$
- + vpeStyle.get(key)
- + "]", modelAttr); //$NON-NLS-1$
- }
- } else {
- throw new DOMComparisonException(
- "Style parameter [" //$NON-NLS-1$
- + key
- + "] is missing in the VPE element", //$NON-NLS-1$
- modelAttr);
- }
- }
- }
- }
- }
- }
- if (performComplexStringsComparison) {
- compareComplexAttributes(modelAttr, vpeAttr);
- }
- }
- }
- }
-
- static private void compareComplexAttributes(Attr modelAttr, nsIDOMAttr vpeAttr)
- throws DOMComparisonException {
- String modelString = modelAttr.getNodeValue().trim();
- String vpeString = vpeAttr.getNodeValue().trim();
-
- if (modelString.startsWith(START_REGEX)
- && modelString.endsWith(END_REGEX)) {
- String regex = modelString.substring(START_REGEX.length(),
- modelString.length() - END_REGEX.length());
- int firstPos = regex.indexOf("url\\("); //$NON-NLS-1$
- if (firstPos > -1) {
- String subString = regex.substring(firstPos + 5, firstPos + 5 + 2);
- if (!"\"?".equalsIgnoreCase(subString)) { //$NON-NLS-1$
- String firstPart = regex.substring(0, firstPos + 5);
- String secondPart = regex.substring(firstPos + 5, regex.length());
- int lastPos = secondPart.indexOf("\\)"); //$NON-NLS-1$
- if (lastPos > -1) {
- String subs = secondPart.substring(lastPos - 2, lastPos);
- if (!"\"?".equalsIgnoreCase(subs)) { //$NON-NLS-1$
- String fpart = secondPart.substring(0, lastPos);
- String spart = secondPart.substring(lastPos, secondPart.length());
- regex = firstPart + "\"?" + fpart + "\"?" + spart; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- }
- }
- Matcher matcher = Pattern.compile(regex).matcher(vpeString);
- if (!matcher.find()) {
- throw new DOMComparisonException("string is\"" + vpeString //$NON-NLS-1$
- + "\" but pattern is \"" + regex + "\"", modelAttr); //$NON-NLS-1$ //$NON-NLS-2$
- }
- } else if (!modelString.equals(vpeString)) {
- throw new DOMComparisonException("string is\"" + vpeString //$NON-NLS-1$
- + "\" but must be \"" + modelString + "\"", modelAttr); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- }
-
- /**
- * is created to be sure that attributes/parameters will be correctly
- * compared ( ignore case )
- *
- * @param list
- * @param string
- * @return
- */
- static private boolean findIgnoreCase(String[] strings,
- String requiredString) {
- for (String string : strings) {
- if (string.equalsIgnoreCase(requiredString))
- return true;
- }
-
- return false;
- }
-}
Deleted: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java 2011-09-15 17:49:22 UTC (rev 34782)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java 2011-09-15 18:09:30 UTC (rev 34783)
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.vpe.ui.test;
-
-import org.jboss.tools.test.util.JobUtils;
-
-/**
- * Class for importing project from jar file.
- *
- * @author sdzmitrovich
- */
-public class TestUtil extends org.jboss.tools.vpe.base.test.TestUtil {
-
- /**
- * Wait until all background tasks are complete.
- */
- public static void waitForJobs() {
- //commented by Maksim Areshkau
- //because this method wait only for jobs which has been runned in current thread,
- //and don't wait for others. It can cause https://jira.jboss.org/jira/browse/JBIDE-5820
- //https://jira.jboss.org/jira/browse/JBIDE-5821
-// while (Job.getJobManager().currentJob() != null)
-// delay(100);
- waitForIdle();
- }
-
- /**
- * Wait for idle.
- */
- public static void waitForIdle(long maxIdle) {
- JobUtils.waitForIdle(500, maxIdle);
- }
-
- public static void waitForIdle() {
- waitForIdle(MAX_IDLE);
- }
-
-}
Deleted: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2011-09-15 17:49:22 UTC (rev 34782)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTest.java 2011-09-15 18:09:30 UTC (rev 34783)
@@ -1,438 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.vpe.ui.test;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Map;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.ILogListener;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.jboss.tools.jst.jsp.JspEditorPlugin;
-import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
-import org.jboss.tools.jst.jsp.preferences.IVpePreferencesPage;
-import org.jboss.tools.vpe.editor.VpeController;
-import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
-import org.jboss.tools.vpe.editor.mapping.VpeElementMapping;
-import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
-import org.jboss.tools.vpe.editor.util.SelectionUtil;
-import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
-import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMNode;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * The Class VpeTest.
- *
- * @author Max Areshkau
- *
- * Base Class for VPE tests
- */
-public class VpeTest extends TestCase implements ILogListener {
-
- /** Editor in which we open visual page. */
- protected final static String EDITOR_ID = "org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"; //$NON-NLS-1$
-
- /** Collects exceptions. */
- private Throwable exception;
-
- /** check warning log. */
- private boolean checkWarning = false;
-
- // FIX for JBIDE-1628
- static {
- JspEditorPlugin
- .getDefault()
- .getPreferenceStore()
- .setValue(
- IVpePreferencesPage.INFORM_WHEN_PROJECT_MIGHT_NOT_BE_CONFIGURED_PROPERLY_FOR_VPE,
- false);
- }
-
- /**
- * The Constructor.
- *
- * @param importProjectName
- * * @param name the name
- */
-
- public VpeTest(String name) {
- super(name);
-
- }
-
- /**
- * Perform pre-test initialization.
- *
- * @throws Exception
- * the exception
- *
- * @see TestCase#setUp()
- */
- @Override
- 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();
- }
-
- /**
- * Perform post-test cleanup.
- *
- * @throws Exception
- * the exception
- *
- * @see TestCase#tearDown()
- */
- @Override
- protected void tearDown() throws Exception {
-//Has been commented by Maksim Areshkau,
-//this lines was a fix for JBIDE-6197 and not needed under eclipse 3.6
-// boolean isJobsCheck = true;
-// while (isJobsCheck) {
-// isJobsCheck = false;
-// Job[] jobs = Job.getJobManager().find(null);
-// for (Job job : jobs) {
-// if (job instanceof StructuredRegionProcessor) {
-// TestUtil.delay(50);
-// isJobsCheck = true;
-// break;
-// }
-// }
-// }
-
- closeEditors();
-
- Platform.removeLogListener(this);
-
- if (getException() != null) {
- throw new Exception(getException());
- }
-
- super.tearDown();
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.core.runtime.ILogListener#logging(org.eclipse.core.runtime
- * .IStatus, java.lang.String)
- */
- /**
- * Logging.
- *
- * @param status
- * the status
- * @param plugin
- * the plugin
- */
- public void logging(IStatus status, String plugin) {
- switch (status.getSeverity()) {
- case IStatus.ERROR:
- setException(status.getException());
- break;
- case IStatus.WARNING:
- if (isCheckWarning())
- setException(status.getException());
- break;
- default:
- break;
- }
-
- }
-
- /**
- * close all opened editors.
- */
- protected void closeEditors() {
-
- // wait
- // TestUtil.waitForJobs();
- IWorkbenchPage page = PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getActivePage();
- IWorkbenchPart part = page.getActivePart();
- page.activate(part);
- // close
- page.closeAllEditors(false);
-
- }
-
- /**
- *
- * @return source document
- */
- protected Document getSourceDocument(VpeController controller) {
-
- return controller.getSourceBuilder().getSourceDocument();
-
- }
-
- /**
- * Perfoms test for some page.
- *
- * @param componentPage
- * the component page
- *
- * @throws Throwable
- * the throwable
- * @throws PartInitException
- * the part init exception
- */
- 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);
- // here we wait for inintialization VPE controller
- TestUtil.getVpeController((JSPMultiPageEditor) editor);
-
- assertNotNull(editor);
-
- TestUtil.waitForJobs();
- // JBIDE-1628
- // TestUtil.delay(1000);
-
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .closeAllEditors(true);
-
- if (getException() != null) {
- throw getException();
- }
- }
-
- /**
- * Open JSPMultiPageEditor editor.
- *
- * @param input
- * the input
- *
- * @return the JSP multi page editor
- *
- * @throws PartInitException
- * the part init exception
- */
- protected JSPMultiPageEditor openEditor(IEditorInput input)
- throws PartInitException {
-
- // get editor
- JSPMultiPageEditor part = (JSPMultiPageEditor) PlatformUI
- .getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .openEditor(input, getEditorID(), true);
-
- assertNotNull(part);
- return part;
-
- }
-
- /**
- * Gets the exception.
- *
- * @return the exception
- */
- protected Throwable getException() {
- return exception;
- }
-
- /**
- * Sets the exception.
- *
- * @param exception
- * the exception to set
- */
- protected void setException(Throwable exception) {
- this.exception = exception;
- }
-
- /**
- * Checks if is check warning.
- *
- * @return the checkWarning
- */
- protected boolean isCheckWarning() {
- return checkWarning;
- }
-
- /**
- * Sets the check warning.
- *
- * @param checkWarning
- * the checkWarning to set
- */
- protected void setCheckWarning(boolean checkWarning) {
- this.checkWarning = checkWarning;
- }
-
- /**
- * Compares source nodes selection and visual selection
- *
- * @param VPE
- * Editor part
- */
- protected void checkSourceSelection(JSPMultiPageEditor part) {
- // get controller
- VpeController controller = TestUtil.getVpeController(part);
- assertNotNull(controller);
-
- // get dommapping
- VpeDomMapping domMapping = controller.getDomMapping();
-
- assertNotNull(domMapping);
-
- // get source map
- Map<Node, VpeNodeMapping> sourceMap = domMapping.getSourceMap();
- assertNotNull(sourceMap);
-
- // get collection of VpeNodeMapping
- Collection<VpeNodeMapping> mappings = sourceMap.values();
- assertNotNull(mappings);
-
- // get editor control
- StyledText styledText = part.getSourceEditor().getTextViewer()
- .getTextWidget();
- assertNotNull(styledText);
-
- // get xulrunner editor
- XulRunnerEditor xulRunnerEditor = controller.getXulRunnerEditor();
- assertNotNull(xulRunnerEditor);
-
- for (VpeNodeMapping nodeMapping : mappings) {
-
- /**
- * exclude out DomDocument ( it is added to mapping specially ) and
- * nodes without visual representation
- */
- if (!(nodeMapping.getSourceNode() instanceof IDOMDocument)
- && (nodeMapping.getVisualNode() != null)) {
-
- SelectionUtil.setSourceSelection(controller.getPageContext(),
- nodeMapping.getSourceNode(), 1, 0);
-
- TestUtil.delay(50);
-
- assertNotNull(xulRunnerEditor.getSelectedElement());
-
- nsIDOMNode sample;
- if (nodeMapping.getSourceNode().getNodeType() == Node.TEXT_NODE
- && ((VpeElementMapping) nodeMapping).getElementData() != null) {
-
- sample = ((VpeElementMapping) nodeMapping).getElementData()
- .getNodesData().get(0).getVisualNode();
- } else {
- sample = nodeMapping.getVisualNode();
- }
-
- assertEquals(sample, xulRunnerEditor.getSelectedElement());
- }
- }
- }
-
- /**
- * Opens specified file in the VPE editor.
- *
- * @param projectName
- * the name of the project
- * @param fileName
- * the name of the file
- *
- * @return VpeController
- * @throws CoreException
- * @throws IOException
- */
- protected VpeController openInVpe(String projectName, String fileName)
- throws CoreException, IOException {
- // get test page path
- final IFile file = (IFile) TestUtil.getComponentPath(fileName,
- projectName);
- assertNotNull("Could not open specified file." //$NON-NLS-1$
- + " componentPage = " + fileName //$NON-NLS-1$
- + ";projectName = " + projectName, file); //$NON-NLS-1$
-
- final IEditorInput input = new FileEditorInput(file);
- assertNotNull("Editor input is null", input); //$NON-NLS-1$
-
- // open and get the editor
- final JSPMultiPageEditor part = openEditor(input);
-
- final VpeController vpeController = TestUtil.getVpeController(part);
- return vpeController;
- }
-
- /**
- * find source element by "id"
- *
- * @param controller
- * @param elementId
- * @return
- */
- protected Element findSourceElementById(VpeController controller,
- String elementId) {
-
- return getSourceDocument(controller).getElementById(elementId);
- }
-
- /**
- * find visual element by "id" entered in source part of vpe
- *
- * @param controller
- * @param elementId
- * @return
- */
- protected nsIDOMElement findElementById(VpeController controller,
- String elementId) {
-
- Element sourceElement = findSourceElementById(controller, elementId);
-
- VpeNodeMapping nodeMapping = controller.getDomMapping().getNodeMapping(
- sourceElement);
-
- if (nodeMapping == null)
- return null;
-
- return (nsIDOMElement) nodeMapping.getVisualNode();
- }
-
- protected String getEditorID(){
- return EDITOR_ID;
- }
-}
Deleted: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTestSetup.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTestSetup.java 2011-09-15 17:49:22 UTC (rev 34782)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/VpeTestSetup.java 2011-09-15 18:09:30 UTC (rev 34783)
@@ -1,55 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2007-2010 Red Hat, Inc.
-* Distributed under license by Red Hat, Inc. All rights reserved.
-* This program is made available under the terms of the
-* Eclipse Public License v1.0 which accompanies this distribution,
-* and is available at http://www.eclipse.org/legal/epl-v10.html
-*
-* Contributors:
-* Red Hat, Inc. - initial API and implementation
-******************************************************************************/
-package org.jboss.tools.vpe.ui.test;
-
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.PlatformUI;
-
-import junit.extensions.TestSetup;
-import junit.framework.TestSuite;
-
-/**
- * @author Max Areshkau
- * @author Yahor Radtsevich (yradtsevich)
- *
- * Class for tear down JUnit tests (remove projects from workspace)
- *
- */
-public class VpeTestSetup extends TestSetup {
- private static final String CONTENT_OUTLINE_VIEW_ID = "org.eclipse.ui.views.ContentOutline";
-
- public VpeTestSetup(TestSuite test) {
- super(test);
- }
-
- /* (non-Javadoc)
- * @see junit.extensions.TestSetup#setUp()
- */
- @Override
- protected void setUp() throws Exception {
- //added by Maksim Areshkau, Fix for https://jira.jboss.org/jira/browse/JBIDE-5820 https://jira.jboss.org/jira/browse/JBIDE-5821
- //remove this code when we will move on wtp 3.2
- IViewReference[] iviewReferences= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences();
- for (IViewReference iViewReference : iviewReferences) {
- if(VpeTestSetup.CONTENT_OUTLINE_VIEW_ID.equalsIgnoreCase(iViewReference.getId())){
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().hideView(iViewReference);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see junit.extensions.TestSetup#tearDown()
- */
- @Override
- protected void tearDown() throws Exception {
- ProjectsLoader.removeAllProjects();
- }
-}
14 years, 7 months
JBoss Tools SVN: r34782 - in trunk/as/tests: org.jboss.ide.eclipse.as.openshift.test/META-INF and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-15 13:49:22 -0400 (Thu, 15 Sep 2011)
New Revision: 34782
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.egit.test/META-INF/MANIFEST.MF
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/META-INF/MANIFEST.MF
Log:
bumping versions back to 2.3.0 to have consistent versions across all as plugins
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.egit.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.egit.test/META-INF/MANIFEST.MF 2011-09-15 17:47:54 UTC (rev 34781)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.egit.test/META-INF/MANIFEST.MF 2011-09-15 17:49:22 UTC (rev 34782)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: EGit Tests
Bundle-SymbolicName: org.jboss.ide.eclipse.as.egit.test
-Bundle-Version: 0.0.1.qualifier
+Bundle-Version: 2.3.0.qualifier
Bundle-Activator: org.jboss.ide.eclipse.as.egit.internal.test.EGitTestActivator
Bundle-Vendor: JBoss by Red Hat
Require-Bundle: org.jboss.ide.eclipse.as.egit.core;bundle-version="0.0.1",
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/META-INF/MANIFEST.MF 2011-09-15 17:47:54 UTC (rev 34781)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/META-INF/MANIFEST.MF 2011-09-15 17:49:22 UTC (rev 34782)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Openshift Test Plugin
Bundle-SymbolicName: org.jboss.ide.eclipse.as.openshift.test
-Bundle-Version: 0.0.1.qualifier
+Bundle-Version: 2.3.0.qualifier
Bundle-Activator: org.jboss.ide.eclipse.as.openshift.test.internal.core.Activator
Bundle-Vendor: JBoss by Red Hat
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
14 years, 7 months
JBoss Tools SVN: r34781 - in trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core: META-INF and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-15 13:47:54 -0400 (Thu, 15 Sep 2011)
New Revision: 34781
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/pom.xml
Log:
bumping versions back to 2.3.0 to have consistent versions across all as plugins
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF 2011-09-15 17:46:31 UTC (rev 34780)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/META-INF/MANIFEST.MF 2011-09-15 17:47:54 UTC (rev 34781)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: Openshift Core Plugin
Bundle-SymbolicName: org.jboss.ide.eclipse.as.openshift.core
-Bundle-Version: 0.0.1.qualifier
+Bundle-Version: 2.3.0.qualifier
Bundle-Activator: org.jboss.ide.eclipse.as.openshift.core.internal.OpenshiftCoreActivator
Bundle-Vendor: JBoss by Red Hat
Require-Bundle: org.eclipse.core.runtime,
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/pom.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/pom.xml 2011-09-15 17:46:31 UTC (rev 34780)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.core/pom.xml 2011-09-15 17:47:54 UTC (rev 34781)
@@ -8,6 +8,5 @@
</parent>
<groupId>org.jboss.tools.as.plugins</groupId>
<artifactId>org.jboss.ide.eclipse.as.openshift.core</artifactId>
- <version>0.0.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
14 years, 7 months
JBoss Tools SVN: r34780 - in trunk/as/plugins: org.jboss.ide.eclipse.as.egit.core/META-INF and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-15 13:46:31 -0400 (Thu, 15 Sep 2011)
New Revision: 34780
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/META-INF/MANIFEST.MF
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/pom.xml
trunk/as/plugins/org.jboss.ide.eclipse.as.egit.ui/META-INF/MANIFEST.MF
Log:
bumping versions back to 2.3.0 to have consistent versioning across all as components
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/META-INF/MANIFEST.MF 2011-09-15 17:35:38 UTC (rev 34779)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/META-INF/MANIFEST.MF 2011-09-15 17:46:31 UTC (rev 34780)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: EGit Integration Core
Bundle-SymbolicName: org.jboss.ide.eclipse.as.egit.core;singleton:=true
-Bundle-Version: 0.0.1.qualifier
+Bundle-Version: 2.3.0.qualifier
Bundle-Activator: org.jboss.ide.eclipse.as.egit.core.internal.EGitCoreActivator
Require-Bundle: org.jboss.ide.eclipse.as.core;bundle-version="2.3.0",
org.eclipse.jgit;bundle-version="[1.0.0,2.1.0)",
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/pom.xml
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/pom.xml 2011-09-15 17:35:38 UTC (rev 34779)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.egit.core/pom.xml 2011-09-15 17:46:31 UTC (rev 34780)
@@ -6,7 +6,6 @@
<artifactId>plugins</artifactId>
<version>2.3.0-SNAPSHOT</version>
</parent>
- <version>0.0.1-SNAPSHOT</version>
<groupId>org.jboss.tools.as.plugins</groupId>
<artifactId>org.jboss.ide.eclipse.as.egit.core</artifactId>
<packaging>eclipse-plugin</packaging>
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.egit.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.egit.ui/META-INF/MANIFEST.MF 2011-09-15 17:35:38 UTC (rev 34779)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.egit.ui/META-INF/MANIFEST.MF 2011-09-15 17:46:31 UTC (rev 34780)
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: EGit integration UI
Bundle-SymbolicName: org.jboss.ide.eclipse.as.egit.ui;singleton:=true
-Bundle-Version: 0.0.1.qualifier
+Bundle-Version: 2.3.0.qualifier
Bundle-Activator: org.jboss.ide.eclipse.as.egit.internal.ui.EGitUIActivator
Require-Bundle: org.eclipse.egit.core;bundle-version="1.0.0",
org.eclipse.jgit;bundle-version="1.0.0",
14 years, 7 months
JBoss Tools SVN: r34779 - trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-09-15 13:35:38 -0400 (Thu, 15 Sep 2011)
New Revision: 34779
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java
Log:
[JBIDE-9510] implementing IOpenshiftService#getApplicationStatus and ApplicationStatusReader
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java 2011-09-15 17:30:02 UTC (rev 34778)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.openshift.test/src/org/jboss/ide/eclipse/as/openshift/test/internal/core/UserInfoTest.java 2011-09-15 17:35:38 UTC (rev 34779)
@@ -27,6 +27,58 @@
private static final String USERNAME = "toolsjboss(a)gmail.com";
private static final String PASSWORD = "1q2w3e";
+ private static final String userInfoRespose =
+ "{"
+ + " \"messages\":\"\","
+ + " \"debug\":\"\","
+ + " \"data\":\""
+ + ""
+ + " {"
+ + " \\\"user_info\\\":"
+ + " {"
+ + " \\\"rhc_domain\\\":\\\"rhcloud.com\\\","
+ + " \\\"rhlogin\\\":\\\"toolsjboss(a)gmail.com\\\","
+ + " \\\"namespace\\\":\\\"1315839296868\\\","
+ + " \\\"uuid\\\":\\\"5f34b742db754cc9ab70fd1db2c9a2bd\\\","
+ + " \\\"ssh_key\\\":\\\"AAAAB3NzaC1yc2EAAAADAQABAAAAgQC6BGRDydfGsQHhnZgo43dEfLzSJBke/hE8MLBBG1+5ZwktsrE+f2VdVt0McRLVAO6rdJRyMUX0rTbm7SABRVSX+zeQjlfqbbUtYFc7TIfd4RQc3GaISG1rS3C4svRSjdWaG36vDY2KxowdFvpKj8i8IYNPlLoRA/7EzzyneS6iyw==\\\""
+ + " },"
+ + " \\\"app_info\\\":"
+ + " {"
+ + " \\\"1315836963263\\\":"
+ + " {"
+ + " \\\"embedded\\\":null,"
+ + " \\\"uuid\\\":\\\"810540bafc1c4b5e8cac830fb8ca786f\\\","
+ + " \\\"framework\\\":\\\"jbossas-7.0\\\","
+ + " \\\"creation_time\\\":\\\"2011-09-12T10:15:48-04:00\\\""
+ + " },"
+ + " \\\"1315903559289\\\":"
+ + " {"
+ + " \\\"embedded\\\":null,"
+ + " \\\"uuid\\\":\\\"f5496311f43b42cd8fa5db5ecf83a352\\\","
+ + " \\\"framework\\\":\\\"jbossas-7.0\\\","
+ + " \\\"creation_time\\\":\\\"2011-09-13T04:45:44-04:00\\\""
+ + " }"
+ + " }"
+ + " }\","
+ + " \"api\":\"1.1.1\","
+ + " \"api_c\":[\"placeholder\"],"
+ + " \"result\":null,"
+ + " \"broker\":\"1.1.1\","
+ + " \"broker_c\":["
+ + " \"namespace\","
+ + " \"rhlogin\","
+ + " \"ssh\","
+ + " \"app_uuid\","
+ + " \"debug\","
+ + " \"alter\","
+ + " \"cartridge\","
+ + " \"cart_type\","
+ + " \"action\","
+ + " \"app_name\","
+ + " \"api\""
+ + " ],"
+ + " \"exit_code\":0"
+ + "}";
@Test
public void canMarshallUserInfoRequest() throws Exception {
String expectedRequestString =
@@ -41,4 +93,10 @@
assertEquals(expectedRequestString, effectiveRequest);
}
+
+ @Test
+ public void canUnmarshallUserInfoResponse() throws Exception {
+
+ }
+
}
14 years, 7 months
JBoss Tools SVN: r34778 - trunk/build.
by jbosstools-commits@lists.jboss.org
Author: nickboldt
Date: 2011-09-15 13:30:02 -0400 (Thu, 15 Sep 2011)
New Revision: 34778
Modified:
trunk/build/publish.sh
Log:
add --protocol=28 to rsync -l for bad slaves
Modified: trunk/build/publish.sh
===================================================================
--- trunk/build/publish.sh 2011-09-15 17:26:16 UTC (rev 34777)
+++ trunk/build/publish.sh 2011-09-15 17:30:02 UTC (rev 34778)
@@ -41,21 +41,12 @@
z=""
if [[ -d ${WORKSPACE}/sources/aggregate/site/target ]]; then
siteZip=${WORKSPACE}/sources/aggregate/site/target/site_assembly.zip
- if [[ ! -f ${WORKSPACE}/sources/aggregate/site/target/site_assembly.zip ]]; then
- siteZip=${WORKSPACE}/sources/aggregate/site/target/site.zip
- fi
z=$siteZip
elif [[ -d ${WORKSPACE}/sources/aggregate/site/site/target ]]; then
siteZip=${WORKSPACE}/sources/aggregate/site/site/target/site_assembly.zip
- if [[ ! -f ${WORKSPACE}/sources/aggregate/site/site/target/site_assembly.zip ]]; then
- siteZip=${WORKSPACE}/sources/aggregate/site/site/target/site.zip
- fi
z=$siteZip
elif [[ -d ${WORKSPACE}/sources/site/target ]]; then
siteZip=${WORKSPACE}/sources/site/target/site_assembly.zip
- if [[ ! -f ${WORKSPACE}/sources/site/target/site_assembly.zip ]]; then
- siteZip=${WORKSPACE}/sources/site/target/site.zip
- fi
z=$siteZip
fi
@@ -113,8 +104,8 @@
fi
z=""
-# if component zips exist, copy them too; first site.zip, then site_assembly.zip
-for z in $(find ${WORKSPACE}/sources/*/site/target -type f -name "site*.zip" | sort -r); do
+# if component zips exist, copy site_assembly.zip too
+for z in $(find ${WORKSPACE}/sources/*/site/target -type f -name "site_assembly.zip"); do
y=${z%%/site/target/*}; y=${y##*/}
if [[ $y != "aggregate" ]]; then # prevent duplicate nested sites
#echo "[$y] $z ..."
@@ -275,13 +266,13 @@
date; rsync -arzq --protocol=28 --delete ${STAGINGDIR}/* $DESTINATION/builds/nightly/${PUBLISHPATHSUFFIX}/${BUILD_ID}-H${BUILD_NUMBER}/
# sftp only works with user@server, not with local $DESTINATIONS, so use rsync to push symlink instead
# echo -e "rm latest\nln ${BUILD_ID}-H${BUILD_NUMBER} latest" | sftp ${DESTINATIONREDUX}/builds/nightly/${PUBLISHPATHSUFFIX}/
- pushd /tmp >/dev/null; ln -s ${BUILD_ID}-H${BUILD_NUMBER} latest; rsync -l latest ${DESTINATION}/builds/nightly/${PUBLISHPATHSUFFIX}/; rm -f latest; popd >/dev/null
+ pushd /tmp >/dev/null; ln -s ${BUILD_ID}-H${BUILD_NUMBER} latest; rsync --protocol=28 -l latest ${DESTINATION}/builds/nightly/${PUBLISHPATHSUFFIX}/; rm -f latest; popd >/dev/null
date; rsync -arzq --protocol=28 --delete /tmp/latestBuild.html $DESTINATION/builds/nightly/${PUBLISHPATHSUFFIX}/
else
date; rsync -arzq --protocol=28 --delete /tmp/latestBuild.html $DESTINATION/builds/nightly/${JOBNAMEREDUX}/
# sftp only works with user@server, not with local $DESTINATIONS, so use rsync to push symlink instead
# echo -e "rm latest\nln ${BUILD_ID}-H${BUILD_NUMBER} latest" | sftp ${DESTINATIONREDUX}/builds/nightly/${JOBNAMEREDUX}/
- pushd /tmp >/dev/null; ln -s ${BUILD_ID}-H${BUILD_NUMBER} latest; rsync -l latest ${DESTINATION}/builds/nightly/${JOBNAMEREDUX}/; rm -f latest; popd >/dev/null
+ pushd /tmp >/dev/null; ln -s ${BUILD_ID}-H${BUILD_NUMBER} latest; rsync --protocol=28 -l latest ${DESTINATION}/builds/nightly/${JOBNAMEREDUX}/; rm -f latest; popd >/dev/null
date; rsync -arzq --protocol=28 --delete ${STAGINGDIR}/* $DESTINATION/builds/nightly/${JOBNAMEREDUX}/${BUILD_ID}-H${BUILD_NUMBER}/
fi
rm -f /tmp/latestBuild.html
14 years, 7 months