JBoss Tools SVN: r9560 - trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-08-06 05:44:17 -0400 (Wed, 06 Aug 2008)
New Revision: 9560
Removed:
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/CommonRichFacesTestCase.java
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/RichFacesComboBoxTemplateTestCase.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesFileUploadTemplateTestCase.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesInplaceInputTemplateTestCase.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesInplaceSelectTemplateTestCase.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/RichFacesProgressBarTemplateTestCase.java
Log:
Move test cases from *.vpe.test to the vpe.ui.test package.
Deleted: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/CommonRichFacesTestCase.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/CommonRichFacesTestCase.java 2008-08-06 09:39:08 UTC (rev 9559)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/CommonRichFacesTestCase.java 2008-08-06 09:44:17 UTC (rev 9560)
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007-2008 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.jsf.vpe.richfaces.test;
-
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.FileEditorInput;
-import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
-import org.jboss.tools.vpe.editor.VpeController;
-import org.jboss.tools.vpe.editor.VpeEditorPart;
-import org.jboss.tools.vpe.ui.test.TestUtil;
-import org.jboss.tools.vpe.ui.test.VpeTest;
-import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
-import org.mozilla.interfaces.nsIDOMDocument;
-import org.mozilla.interfaces.nsIDOMElement;
-
-
-/**
- * The Class CommonRichFacesTestCase.
- *
- * @author Eugene Stherbin
- */
-public abstract class CommonRichFacesTestCase extends VpeTest {
-
- /**
- * The Constructor.
- *
- * @param name the name
- */
- public CommonRichFacesTestCase(String name) {
- super(name);
- setCheckWarning(false);
- }
-
- /**
- * get xulrunner source page.
- *
- * @param part - JSPMultiPageEditor
- *
- * @return nsIDOMDocument
- */
- protected nsIDOMDocument getVpeVisualDocument(JSPMultiPageEditor part) {
-
- VpeEditorPart visualEditor = (VpeEditorPart) part.getVisualEditor();
-
- VpeController vpeController = visualEditor.getController();
-
- // get xulRunner editor
- XulRunnerEditor xulRunnerEditor = vpeController.getXulRunnerEditor();
-
- // get dom document
- nsIDOMDocument document = xulRunnerEditor.getDOMDocument();
-
- return document;
- }
-
- /**
- * Perform test for rich faces component.
- *
- * @param componentPage the component page
- *
- * @return the ns IDOM element
- *
- * @throws Throwable the throwable
- */
- protected nsIDOMElement performTestForRichFacesComponent(IFile componentPage) throws Throwable {
- nsIDOMElement rst = null;
- TestUtil.waitForJobs();
-
- setException(null);
-
- // 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);
-
- // get dom document
- nsIDOMDocument document = getVpeVisualDocument(editor);
- rst = document.getDocumentElement();
- // check that element is not null
- assertNotNull(rst);
- return rst;
- }
-
- void fail(Throwable t){
- fail("Test case was fail "+t.getMessage()+":"+t);
- }
-}
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 2008-08-06 09:39:08 UTC (rev 9559)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesColumnsTemplateTestCase.java 2008-08-06 09:44:17 UTC (rev 9560)
@@ -13,6 +13,8 @@
package org.jboss.tools.jsf.vpe.richfaces.test;
+import static org.jboss.tools.vpe.ui.test.TestUtil.performTestForRichFacesComponent;
+
import java.util.ArrayList;
import java.util.List;
@@ -20,17 +22,16 @@
import org.eclipse.core.runtime.CoreException;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
-
/**
* Test case for testing <rich:columns>.
*
* @author Eugene Stherbin
*/
-public class RichFacesColumnsTemplateTestCase extends CommonRichFacesTestCase {
-
+public class RichFacesColumnsTemplateTestCase extends VpeTest {
/** The Constant COLUMNS_WITH_ATTRIBUTES. */
private static final String COLUMNS_WITH_ATTRIBUTES = "components/columns/columnsWithAttributes.xhtml";
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComboBoxTemplateTestCase.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComboBoxTemplateTestCase.java 2008-08-06 09:39:08 UTC (rev 9559)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesComboBoxTemplateTestCase.java 2008-08-06 09:44:17 UTC (rev 9560)
@@ -20,6 +20,7 @@
import org.eclipse.ui.PartInitException;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
@@ -29,37 +30,37 @@
*
* @author Eugene Stherbin
*/
-public class RichFacesComboBoxTemplateTestCase extends CommonRichFacesTestCase {
+public class RichFacesComboBoxTemplateTestCase extends VpeTest {
/** The Constant _150PX. */
- private static final String _150PX = "150px";
+ private static final String _150PX = "150px"; //$NON-NLS-1$
/** The Constant _250PX. */
- private static final String _250PX = "150px";
+ private static final String _250PX = "150px"; //$NON-NLS-1$
/** The Constant _255PX. */
- private static final String _255PX = "255px";
+ private static final String _255PX = "255px"; //$NON-NLS-1$
/** The Constant COMPONENTS_COMBO_BOX_WITHOUT_ATTR. */
- private static final String COMPONENTS_COMBO_BOX_WITHOUT_ATTR = "components/comboBox/comboBox.xhtml";
+ private static final String COMPONENTS_COMBO_BOX_WITHOUT_ATTR = "components/comboBox/comboBox.xhtml"; //$NON-NLS-1$
/** The Constant COMPONENTS_COMBO_WITH_ATTR_TEMPLATE. */
- private static final String COMPONENTS_COMBO_WITH_ATTR_TEMPLATE = "components/comboBox/comboBoxWithAttributes.xhtml";
+ private static final String COMPONENTS_COMBO_WITH_ATTR_TEMPLATE = "components/comboBox/comboBoxWithAttributes.xhtml"; //$NON-NLS-1$
/** The Constant COMPONENTS_COMBO_WITH_ATTR_TEMPLATE2. */
- private static final String COMPONENTS_COMBO_WITH_ATTR_TEMPLATE2 = "components/comboBox/comboBoxWithAttributes2.xhtml";
+ private static final String COMPONENTS_COMBO_WITH_ATTR_TEMPLATE2 = "components/comboBox/comboBoxWithAttributes2.xhtml"; //$NON-NLS-1$
/** DEFAULT_INPUT_STYLE. */
- private static final String DEFAULT_INPUT_STYLE = "rich-combobox-font-disabled rich-combobox-input-inactive";
+ private static final String DEFAULT_INPUT_STYLE = "rich-combobox-font-disabled rich-combobox-input-inactive"; //$NON-NLS-1$
/** The Constant DEFAULT_WIDTH. */
- private static final String DEFAULT_WIDTH = "width: 150px;";
+ private static final String DEFAULT_WIDTH = "width: 150px;"; //$NON-NLS-1$
/** The Constant EL_VALUE. */
- private static final String EL_VALUE = "#{bean.value}";
+ private static final String EL_VALUE = "#{bean.value}"; //$NON-NLS-1$
/** The Constant SELECT_ANY_VALUE. */
- private static final String SELECT_ANY_VALUE = "Select Any Value";
+ private static final String SELECT_ANY_VALUE = "Select Any Value"; //$NON-NLS-1$
/** The Constant ZERO. */
private static final int ZERO = 0;
@@ -85,7 +86,7 @@
* @throws PartInitException the part init exception
*/
private nsIDOMElement baseTableCheck(String page, String width) throws PartInitException, Throwable {
- final nsIDOMElement rst = performTestForRichFacesComponent((IFile) TestUtil.getComponentPath(page,
+ final nsIDOMElement rst = TestUtil.performTestForRichFacesComponent((IFile) TestUtil.getComponentPath(page,
RichFacesComponentTest.IMPORT_PROJECT_NAME));
List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
@@ -95,15 +96,15 @@
TestUtil.findAllElementsByName(rst, elements, HTML.TAG_DIV);
for(nsIDOMNode e:elements){
nsIDOMElement div = (nsIDOMElement) e.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- System.err.println(div.getNodeName()+":"+div.getAttribute(HTML.ATTR_CLASS));
+ System.err.println(div.getNodeName()+":"+div.getAttribute(HTML.ATTR_CLASS)); //$NON-NLS-1$
}
// assertEquals("Size should be 5", 5, elements.size());
nsIDOMElement divOne = (nsIDOMElement) elements.get(4).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- assertTrue("Style classes should be contains ",divOne.getAttribute(HTML.ATTR_CLASS).contains("rich-combobox-font rich-combobox"));
- assertTrue("Defaule style should be contains " + width, divOne.getAttribute(HTML.ATTR_STYLE).indexOf(width) > 1);
- assertTrue("Defaule style should be contains " + width, divOne.getAttribute(HTML.ATTR_STYLE).contains("width"));
+ assertTrue("Style classes should be contains ",divOne.getAttribute(HTML.ATTR_CLASS).contains("rich-combobox-font rich-combobox")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Defaule style should be contains " + width, divOne.getAttribute(HTML.ATTR_STYLE).indexOf(width) > 1); //$NON-NLS-1$
+ assertTrue("Defaule style should be contains " + width, divOne.getAttribute(HTML.ATTR_STYLE).contains("width")); //$NON-NLS-1$ //$NON-NLS-2$
// Check input
return rst;
@@ -120,9 +121,9 @@
TestUtil.findAllElementsByName(rst, elements, HTML.TAG_INPUT);
- assertEquals("Size should be equals 2", 3, elements.size());
+ assertEquals("Size should be equals 2", 3, elements.size()); //$NON-NLS-1$
final nsIDOMElement input = (nsIDOMElement) elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- assertEquals("Value should be equals " + inputValue, inputValue, input.getAttribute(HTML.ATTR_VALUE));
+ assertEquals("Value should be equals " + inputValue, inputValue, input.getAttribute(HTML.ATTR_VALUE)); //$NON-NLS-1$
}
/**
@@ -164,11 +165,11 @@
TestUtil.findAllElementsByName(rst, elements, HTML.TAG_INPUT);
- assertEquals("Size should be equals 2", 3, elements.size());
+ assertEquals("Size should be equals 2", 3, elements.size()); //$NON-NLS-1$
final nsIDOMElement input = (nsIDOMElement) elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- assertEquals("Default input class should be equals " + DEFAULT_INPUT_STYLE, input.getAttribute(HTML.ATTR_CLASS),
+ assertEquals("Default input class should be equals " + DEFAULT_INPUT_STYLE, input.getAttribute(HTML.ATTR_CLASS), //$NON-NLS-1$
DEFAULT_INPUT_STYLE);
// assertEquals("Input style style should be empty", "", input.getAttribute(HTML.ATTR_STYLE));
// assertEquals("Input type should be text", HTML.VALUE_TEXT_TYPE, input.getAttribute(HTML.ATTR_TYPE));
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesFileUploadTemplateTestCase.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesFileUploadTemplateTestCase.java 2008-08-06 09:39:08 UTC (rev 9559)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesFileUploadTemplateTestCase.java 2008-08-06 09:44:17 UTC (rev 9560)
@@ -6,6 +6,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.ui.PartInitException;
import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
/**
@@ -13,10 +14,10 @@
*
* @author Eugene Stherbin
*/
-public class RichFacesFileUploadTemplateTestCase extends CommonRichFacesTestCase {
+public class RichFacesFileUploadTemplateTestCase extends VpeTest {
/** The Constant COMPONENTS_FILE_UPLOAD_FILE_UPLOAD_BASE. */
- private static final String COMPONENTS_FILE_UPLOAD_FILE_UPLOAD_BASE = "components/fileUpload/fileUpload.xhtml";
+ private static final String COMPONENTS_FILE_UPLOAD_FILE_UPLOAD_BASE = "components/fileUpload/fileUpload.xhtml"; //$NON-NLS-1$
/**
* The Constructor.
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesInplaceInputTemplateTestCase.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesInplaceInputTemplateTestCase.java 2008-08-06 09:39:08 UTC (rev 9559)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesInplaceInputTemplateTestCase.java 2008-08-06 09:44:17 UTC (rev 9560)
@@ -20,6 +20,7 @@
import org.eclipse.core.runtime.CoreException;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
@@ -29,28 +30,28 @@
*
* @author Eugene Stherbin
*/
-public class RichFacesInplaceInputTemplateTestCase extends CommonRichFacesTestCase {
+public class RichFacesInplaceInputTemplateTestCase extends VpeTest {
/** The Constant EL_VALUE. */
- private static final String EL_VALUE = "#{person.name}";
+ private static final String EL_VALUE = "#{person.name}"; //$NON-NLS-1$
/** The Constant MY_STYLE_CLASS. */
- private static final String MY_STYLE_CLASS = "myStyleClass";
+ private static final String MY_STYLE_CLASS = "myStyleClass"; //$NON-NLS-1$
/** The Constant NULL. */
- private static final String NULL = "null";
+ private static final String NULL = "null"; //$NON-NLS-1$
/** The Constant RICH_INPLACE_VIEW. */
- private static final String RICH_INPLACE_VIEW = "rich-inplace rich-inplace-view";
+ private static final String RICH_INPLACE_VIEW = "rich-inplace rich-inplace-view"; //$NON-NLS-1$
/** The Constant TEMPLATE_WITH_EMPTY_TAG. */
- private static final String TEMPLATE_WITH_EMPTY_TAG = "components/inplaceInput/inplaceInput.xhtml";
+ private static final String TEMPLATE_WITH_EMPTY_TAG = "components/inplaceInput/inplaceInput.xhtml"; //$NON-NLS-1$
/** The Constant TEMPLATE_WITH_VALUE_AND_STYLE_CLASS. */
- private static final String TEMPLATE_WITH_VALUE_AND_STYLE_CLASS = "components/inplaceInput/inplaceInputWithStyleClassAttribute.xhtml";
+ private static final String TEMPLATE_WITH_VALUE_AND_STYLE_CLASS = "components/inplaceInput/inplaceInputWithStyleClassAttribute.xhtml"; //$NON-NLS-1$
/** The Constant TEMPLATE_WITH_VALUE_ATTR. */
- private static final String TEMPLATE_WITH_VALUE_ATTR = "components/inplaceInput/inplaceInputWithValueAttribute.xhtml";
+ private static final String TEMPLATE_WITH_VALUE_ATTR = "components/inplaceInput/inplaceInputWithValueAttribute.xhtml"; //$NON-NLS-1$
/**
* The Constructor.
@@ -72,19 +73,19 @@
* @throws Throwable the throwable
*/
private void baseCheck(String page, String value, String styleClass) throws Throwable, CoreException {
- final nsIDOMElement rst = performTestForRichFacesComponent((IFile) TestUtil.getComponentPath(page,
+ final nsIDOMElement rst = TestUtil.performTestForRichFacesComponent((IFile) TestUtil.getComponentPath(page,
RichFacesComponentTest.IMPORT_PROJECT_NAME));
List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
TestUtil.findAllElementsByName(rst, elements, HTML.TAG_SPAN);
- assertEquals("Count of items should be 1", 1, elements.size());
+ assertEquals("Count of items should be 1", 1, elements.size()); //$NON-NLS-1$
final nsIDOMElement element = (nsIDOMElement) elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- String first = "null";
- String second = "null";
+ String first = "null"; //$NON-NLS-1$
+ String second = "null"; //$NON-NLS-1$
if(value!=null){
first = value;
@@ -93,9 +94,9 @@
if(element.getFirstChild().getNodeValue()!=null){
second = element.getFirstChild().getNodeValue();
}
- assertEquals("Text value should be equals 'null'", first, second);
+ assertEquals("Text value should be equals 'null'", first, second); //$NON-NLS-1$
- assertTrue("Style class should be equals " + styleClass, element.getAttribute(HTML.ATTR_CLASS).contains(styleClass));
+ assertTrue("Style class should be equals " + styleClass, element.getAttribute(HTML.ATTR_CLASS).contains(styleClass)); //$NON-NLS-1$
}
/**
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesInplaceSelectTemplateTestCase.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesInplaceSelectTemplateTestCase.java 2008-08-06 09:39:08 UTC (rev 9559)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesInplaceSelectTemplateTestCase.java 2008-08-06 09:44:17 UTC (rev 9560)
@@ -17,6 +17,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.PartInitException;
import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
/**
@@ -24,7 +25,7 @@
*
* @author Eugene Stherbin
*/
-public class RichFacesInplaceSelectTemplateTestCase extends CommonRichFacesTestCase {
+public class RichFacesInplaceSelectTemplateTestCase extends VpeTest {
/** The Constant COMPONENTS_INPLACE_SELECT_INPLACE_SELECT_XHTML. */
private static final String COMPONENTS_INPLACE_SELECT_INPLACE_SELECT_XHTML = "components/inplaceSelect/inplaceSelect.xhtml";
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 2008-08-06 09:39:08 UTC (rev 9559)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesPickListTemplateTestCase.java 2008-08-06 09:44:17 UTC (rev 9560)
@@ -20,6 +20,7 @@
import org.eclipse.core.runtime.CoreException;
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
@@ -29,7 +30,7 @@
*
* @author Eugene Stherbin
*/
-public class RichFacesPickListTemplateTestCase extends CommonRichFacesTestCase {
+public class RichFacesPickListTemplateTestCase extends VpeTest {
/**
* The Constructor.
@@ -46,28 +47,28 @@
public void testSimplePickList() {
nsIDOMElement rst;
try {
- rst = performTestForRichFacesComponent((IFile) TestUtil.getComponentPath("components/pickList/pickList.xhtml",
+ rst = TestUtil.performTestForRichFacesComponent((IFile) TestUtil.getComponentPath("components/pickList/pickList.xhtml", //$NON-NLS-1$
RichFacesComponentTest.IMPORT_PROJECT_NAME));
final List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
TestUtil.findAllElementsByName(rst, elements, HTML.TAG_TABLE);
- assertEquals("Count of tables should be 3", 3, elements.size());
+ assertEquals("Count of tables should be 3", 3, elements.size()); //$NON-NLS-1$
nsIDOMElement tableOne = (nsIDOMElement) elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- assertEquals("Style class should be equals", "rich-list-picklist", tableOne.getAttribute(HTML.ATTR_CLASS));
- assertEquals("Style should be empty", "", tableOne.getAttribute(HTML.ATTR_STYLE));
+ assertEquals("Style class should be equals", "rich-list-picklist", tableOne.getAttribute(HTML.ATTR_CLASS)); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Style should be empty", "", tableOne.getAttribute(HTML.ATTR_STYLE)); //$NON-NLS-1$ //$NON-NLS-2$
elements.clear();
TestUtil.findAllElementsByName(rst, elements, HTML.TAG_DIV);
- assertEquals("Count of divs should be 18", 18, elements.size());
+ assertEquals("Count of divs should be 18", 18, elements.size()); //$NON-NLS-1$
elements.clear();
TestUtil.findAllElementsByName(rst, elements, HTML.TAG_IMG);
- assertEquals("Count of divs should be 18", 4, elements.size());
+ assertEquals("Count of divs should be 18", 4, elements.size()); //$NON-NLS-1$
} catch (CoreException e) {
- fail(e);
+ TestUtil.fail(e);
} catch (Throwable e) {
- fail(e);
+ TestUtil.fail(e);
}
}
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesProgressBarTemplateTestCase.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesProgressBarTemplateTestCase.java 2008-08-06 09:39:08 UTC (rev 9559)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.richfaces.test/src/org/jboss/tools/jsf/vpe/richfaces/test/RichFacesProgressBarTemplateTestCase.java 2008-08-06 09:44:17 UTC (rev 9560)
@@ -20,6 +20,7 @@
import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
import org.jboss.tools.vpe.ui.test.TestUtil;
+import org.jboss.tools.vpe.ui.test.VpeTest;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
@@ -29,28 +30,28 @@
*
* @author Eugene Stherbin
*/
-public class RichFacesProgressBarTemplateTestCase extends CommonRichFacesTestCase {
+public class RichFacesProgressBarTemplateTestCase extends VpeTest {
/** The Constant CHECK_BASE_STYLE. */
- private static final String CHECK_BASE_STYLE = "rich-progress-bar-block rich-progress-bar-width rich-progress-bar-shell";
+ private static final String CHECK_BASE_STYLE = "rich-progress-bar-block rich-progress-bar-width rich-progress-bar-shell"; //$NON-NLS-1$
/** The Constant MY_STYLE_CLASS. */
- private static final String MY_STYLE_CLASS = " myStyleClass";
+ private static final String MY_STYLE_CLASS = " myStyleClass"; //$NON-NLS-1$
/** The Constant PERCENTAGES. */
- private static final String PERCENTAGES = " 60%;";
+ private static final String PERCENTAGES = " 60%;"; //$NON-NLS-1$
/** The Constant SIMPLE_PAGE. */
- private static final String SIMPLE_PAGE = "/components/progressBar/progressBar.xhtml";
+ private static final String SIMPLE_PAGE = "/components/progressBar/progressBar.xhtml"; //$NON-NLS-1$
/** The Constant SIMPLE_WITH_ATTRIBUTES. */
- private static final String SIMPLE_WITH_ATTRIBUTES = "/components/progressBar/progressBarWithAttributes.xhtml";
+ private static final String SIMPLE_WITH_ATTRIBUTES = "/components/progressBar/progressBarWithAttributes.xhtml"; //$NON-NLS-1$
/** The Constant STYLE_1_FOR_CHECK. */
- private static final String STYLE_1_FOR_CHECK = "width: 250px; text-align: left;";
+ private static final String STYLE_1_FOR_CHECK = "width: 250px; text-align: left;"; //$NON-NLS-1$
/** The Constant STYLE_CLASS_2. */
- private static final String STYLE_CLASS_2 = "rich-progress-bar-height rich-progress-bar-uploaded null";
+ private static final String STYLE_CLASS_2 = "rich-progress-bar-height rich-progress-bar-uploaded null"; //$NON-NLS-1$
/**
* The Constructor.
@@ -74,7 +75,7 @@
nsIDOMElement rst = null;
try {
- rst = performTestForRichFacesComponent((IFile) TestUtil.getComponentPath(page, RichFacesComponentTest.IMPORT_PROJECT_NAME));
+ rst = TestUtil.performTestForRichFacesComponent((IFile) TestUtil.getComponentPath(page, RichFacesComponentTest.IMPORT_PROJECT_NAME));
} catch (CoreException e) {
fail(e.getMessage() + e);
} catch (Throwable e) {
@@ -84,16 +85,16 @@
final List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
TestUtil.findAllElementsByName(rst, elements, HTML.TAG_DIV);
- assertEquals("Size should be 2", 5, elements.size());
+ assertEquals("Size should be 2", 5, elements.size()); //$NON-NLS-1$
final nsIDOMElement divOne = (nsIDOMElement) elements.get(3).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- assertEquals("Style class should be equals" + styleClass, styleClass, divOne.getAttribute(HTML.ATTR_CLASS));
- assertEquals("Style should be equals" + style, style, divOne.getAttribute(HTML.ATTR_STYLE));
+ assertEquals("Style class should be equals" + styleClass, styleClass, divOne.getAttribute(HTML.ATTR_CLASS)); //$NON-NLS-1$
+ assertEquals("Style should be equals" + style, style, divOne.getAttribute(HTML.ATTR_STYLE)); //$NON-NLS-1$
final nsIDOMElement divTwo = (nsIDOMElement) elements.get(4).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- assertEquals("Style class should be equals" + twoStyleClass, twoStyleClass, divTwo.getAttribute(HTML.ATTR_CLASS));
- assertEquals("Style should be equals" + style2, style2, divTwo.getAttribute(HTML.ATTR_STYLE));
+ assertEquals("Style class should be equals" + twoStyleClass, twoStyleClass, divTwo.getAttribute(HTML.ATTR_CLASS)); //$NON-NLS-1$
+ assertEquals("Style should be equals" + style2, style2, divTwo.getAttribute(HTML.ATTR_STYLE)); //$NON-NLS-1$
}
@@ -101,7 +102,7 @@
* Test simple.
*/
public void testSimple() {
- baseTest(SIMPLE_PAGE, CHECK_BASE_STYLE, "height: 13px; text-align: left;", STYLE_CLASS_2,"height: 13px; width: 60%;");
+ baseTest(SIMPLE_PAGE, CHECK_BASE_STYLE, "height: 13px; text-align: left;", STYLE_CLASS_2,"height: 13px; width: 60%;"); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
16 years, 7 months
JBoss Tools SVN: r9559 - trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-08-06 05:39:08 -0400 (Wed, 06 Aug 2008)
New Revision: 9559
Added:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/CommonJBIDE2010Test.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ElPreferencesTestCase.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/JBIDE2010Test.java
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/JBIDE2582Test.java
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java
Log:
Move test cases from *.vpe.test to the vpe.ui.test package.
Copied: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/CommonJBIDE2010Test.java (from rev 9489, trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/CommonJBIDE2010Test.java)
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/CommonJBIDE2010Test.java (rev 0)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/CommonJBIDE2010Test.java 2008-08-06 09:39:08 UTC (rev 9559)
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * 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.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.core.resources.IFile;
+import org.jboss.tools.vpe.editor.css.ELReferenceList;
+import org.jboss.tools.vpe.editor.css.ResourceReference;
+
+
+/**
+ * The common test case for the all test cases related to the <a
+ * href="https://jira.jboss.com:8443/jira/browse/JBIDE-2010"
+ * >JBIDE-2010</a>issue.
+ */
+public abstract class CommonJBIDE2010Test extends VpeTest {
+
+ /** The Constant DIR_TEST_PAGE_NAME_3. */
+ protected static final String DIR_TEST_PAGE_NAME_3 = "JBIDE/2010/page3.xhtml"; //$NON-NLS-1$
+
+ /** The Constant VALUE_5. */
+ protected static final String VALUE_5 = "world"; //$NON-NLS-1$
+
+ /** The Constant KEY_5. */
+ protected static final String KEY_5 = "#{bean1.property3}"; //$NON-NLS-1$
+
+ /** The Constant VALUE_4. */
+ protected static final String VALUE_4 = "background: red"; //$NON-NLS-1$
+
+ /** The Constant KEY_4. */
+ protected static final String KEY_4 = "#{bean1.property2}"; //$NON-NLS-1$
+
+ /** The Constant IMPORT_PROJECT_NAME. */
+ public static final String IMPORT_PROJECT_NAME = "jsfTest"; //$NON-NLS-1$
+
+ /** The Constant KEY_3. */
+ protected static final String KEY_3 = "#{facesContext.requestPath}"; //$NON-NLS-1$
+
+ /** The Constant KEY_2. */
+ protected static final String KEY_2 = "#{beanA.property2}"; //$NON-NLS-1$
+
+ /** The Constant DIR_TEST_PAGE_NAME. */
+ protected static final String DIR_TEST_PAGE_NAME_2 = "JBIDE/2010/page2.jsp"; //$NON-NLS-1$
+
+ /** The Constant DIR_TEST_PAGE_NAME. */
+ protected static final String DIR_TEST_PAGE_NAME = "JBIDE/2010/page.jsp"; //$NON-NLS-1$
+
+ /** The Constant KEY_1. */
+ protected static final String KEY_1 = "#{beanA.property1}"; //$NON-NLS-1$
+
+ /** The Constant elValuesMap. */
+ protected static final Map<String, String> elValuesMap = new HashMap<String, String>();
+
+ /** The file. */
+ protected IFile file;
+
+ /**
+ * The Constructor.
+ *
+ * @param name the name
+ */
+ public CommonJBIDE2010Test(String name) {
+ super(name);
+
+ }
+
+ /**
+ * Sets the up.
+ *
+ * @throws Exception the exception
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ elValuesMap.put(KEY_1, "/path/image/path/to/image/"); //$NON-NLS-1$
+ elValuesMap.put(KEY_2, "/path2/"); //$NON-NLS-1$
+ elValuesMap.put(KEY_3, "/facesContext/"); //$NON-NLS-1$
+ elValuesMap.put(KEY_4, VALUE_4);
+ elValuesMap.put(KEY_5, VALUE_5);
+ file = (IFile) TestUtil.getComponentPath(getOpenPageName(), getOpenProjectName());
+ ResourceReference[] entries = new ResourceReference[elValuesMap.size()];
+ int i = 0;
+ for (Entry<String, String> string : elValuesMap.entrySet()) {
+
+ entries[i] = new ResourceReference(string.getKey(), ResourceReference.PROJECT_SCOPE);
+ entries[i].setProperties(string.getValue());
+ i++;
+
+
+ }
+ setValues(entries);
+ }
+
+
+ protected String getOpenPageName(){
+ return DIR_TEST_PAGE_NAME;
+ }
+
+ protected String getOpenProjectName(){
+ return IMPORT_PROJECT_NAME;
+ }
+ /**
+ * Sets the values.
+ *
+ * @param key the key
+ * @param value the value
+ * @param scope the scope
+ * @param entries the entries
+ */
+ protected void setValues(ResourceReference[] entries) {
+ ELReferenceList.getInstance().setAllResources(file, entries);
+ }
+
+ /**
+ * Tear down.
+ *
+ * @throws Exception the exception
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ ELReferenceList.getInstance().setAllResources(this.file, new ResourceReference[0]);
+ this.file = null;
+
+ }
+
+}
Copied: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ElPreferencesTestCase.java (from rev 9489, trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/ElPreferencesTestCase.java)
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ElPreferencesTestCase.java (rev 0)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/ElPreferencesTestCase.java 2008-08-06 09:39:08 UTC (rev 9559)
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * 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.eclipse.core.runtime.CoreException;
+import org.jboss.tools.vpe.editor.util.ElService;
+
+/**
+ * <p>
+ * Test case for testing service {@link ElService}
+ * <p>
+ * See <a href="http://jira.jboss.com/jira/browse/JBIDE-2010">JBIDE-2010</a> issue
+ *
+ */
+public class ElPreferencesTestCase extends CommonJBIDE2010Test {
+
+
+ /**
+ * The Constructor.
+ *
+ * @param name the name
+ */
+ public ElPreferencesTestCase(String name) {
+ super(name);
+
+ }
+
+ /**
+ * Test replace attribute value.
+ *
+ * @throws CoreException the core exception
+ */
+ public void testReplaceAttributeValue() throws CoreException {
+ String string1 = "#{beanA.property1}/images/smalle.gif"; //$NON-NLS-1$
+ String replacedValue = ElService.getInstance().replaceEl(file, string1);
+
+ assertEquals("Should be equals " + elValuesMap.get(KEY_1) + "/images/smalle.gif", replacedValue, elValuesMap.get(KEY_1) //$NON-NLS-1$ //$NON-NLS-2$
+ + "/images/smalle.gif"); //$NON-NLS-1$
+
+ }
+
+ /**
+ * Test replace attribute value2.
+ *
+ * @throws CoreException the core exception
+ */
+ public void testReplaceAttributeValue2() throws CoreException {
+ String string1 = "#{beanA.property1}/images/#{beanA.property2}/path2/#{facesContext.requestPath}/smalle.gif"; //$NON-NLS-1$
+
+ final String replacedValue = ElService.getInstance().replaceEl(file, string1);
+ final String check = elValuesMap.get(KEY_1) + "/images/" + elValuesMap.get(KEY_2) + "/path2/" + elValuesMap.get(KEY_3) //$NON-NLS-1$ //$NON-NLS-2$
+ + "/smalle.gif"; //$NON-NLS-1$
+ assertEquals("Should be equals " + check, check, replacedValue); //$NON-NLS-1$
+
+ }
+
+ /**
+ * Test replace not in set.
+ */
+ public void testReplaceNotInSet() {
+ String string1 = "#{requestScope}/smalle.gif"; //$NON-NLS-1$
+
+ assertEquals("Should be equals", string1, ElService.getInstance().replaceEl(file, string1)); //$NON-NLS-1$
+ }
+}
Copied: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/JBIDE2010Test.java (from rev 9489, trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/JBIDE2010Test.java)
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/JBIDE2010Test.java (rev 0)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/JBIDE2010Test.java 2008-08-06 09:39:08 UTC (rev 9559)
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+
+package org.jboss.tools.vpe.ui.test;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMNode;
+
+
+/**
+ * Test case for testing https://jira.jboss.com:8443/jira/browse/JBIDE-2010
+ * issue.
+ *
+ * @author Eugeny Stherbin
+ */
+public class JBIDE2010Test extends CommonJBIDE2010Test {
+
+
+ /**
+ * The Constructor.
+ *
+ * @param name the name
+ */
+ public JBIDE2010Test(String name) {
+ super(name);
+ }
+
+ /**
+ * Test el template simple.
+ *
+ * @throws CoreException the core exception
+ * @throws Throwable the throwable
+ */
+ public void testElTemplateSimple() throws CoreException, Throwable {
+ final nsIDOMElement rst = TestUtil.performTestForRichFacesComponent((IFile) TestUtil.getComponentPath(DIR_TEST_PAGE_NAME_2,
+ IMPORT_PROJECT_NAME));
+
+ List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
+
+ // find "td" elements
+
+ TestUtil.findAllElementsByName(rst, elements, HTML.TAG_SPAN);
+
+ assertEquals("Count of divs should be equals 1", 1, elements.size()); //$NON-NLS-1$
+ final nsIDOMElement spanOne = (nsIDOMElement) elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ assertEquals("Style attribute should be substituted", VALUE_4, spanOne.getFirstChild().getNodeValue()); //$NON-NLS-1$
+
+ }
+
+
+ /**
+ * Test el template simple.
+ *
+ * @throws CoreException the core exception
+ * @throws Throwable the throwable
+ */
+ public void testElTemplateSimple2() throws CoreException, Throwable {
+ final nsIDOMElement rst = TestUtil.performTestForRichFacesComponent((IFile) TestUtil.getComponentPath(DIR_TEST_PAGE_NAME_3,
+ IMPORT_PROJECT_NAME));
+
+ List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
+
+ // find "td" elements
+
+ TestUtil.findAllElementsByName(rst, elements, HTML.TAG_P);
+
+ assertEquals("Value should be equals", 1, elements.size()); //$NON-NLS-1$
+ final nsIDOMElement pOne = (nsIDOMElement) elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ // DOMTreeDumper d = new DOMTreeDumper();
+ // d.dumpToStream(System.out, rst);
+// assertEquals("Value should be equals", "Hello "+VALUE_5, pOne.getFirstChild().getFirstChild().getNodeValue());
+ assertTrue("Value should be contains",pOne.getAttribute(HTML.ATTR_STYLE).startsWith(VALUE_4)); //$NON-NLS-1$
+
+ }
+
+}
Copied: trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/JBIDE2582Test.java (from rev 9511, trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/JBIDE2582Test.java)
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/JBIDE2582Test.java (rev 0)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/JBIDE2582Test.java 2008-08-06 09:39:08 UTC (rev 9559)
@@ -0,0 +1,184 @@
+/*******************************************************************************
+ * 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.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
+import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
+import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
+import org.jboss.tools.vpe.editor.util.HTML;
+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.Node;
+
+
+/**
+ * Test case for testing <a
+ * href="https://jira.jboss.org/jira/browse/JBIDE-2582"> JBIDE-2582 </a> issue
+ *
+ * @author Evgenij Stherbin
+ */
+public class JBIDE2582Test extends CommonJBIDE2010Test {
+
+ /** The Constant DIR_TEST_PAGE_NAME_3. */
+ protected static final String PAGE_1 = "JBIDE/2582/page1.xhtml"; //$NON-NLS-1$
+
+ /** The Constant DIR_TEST_PAGE_NAME_3. */
+ protected static final String PAGE_2 = "JBIDE/2582/page2.xhtml"; //$NON-NLS-1$
+
+ /**
+ * The Constructor.
+ *
+ * @param name the name
+ */
+ public JBIDE2582Test(String name) {
+ super(name);
+
+ }
+
+ /**
+ * Test rs substitution.
+ *
+ * @throws Throwable the throwable
+ */
+ public void _testRsSubstitution() throws Throwable {
+ final nsIDOMElement rst = TestUtil.performTestForRichFacesComponent(file);
+
+ assertNotNull(rst);
+
+ final List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
+
+ TestUtil.findAllElementsByName(rst, elements, HTML.TAG_SPAN);
+
+ assertEquals("Size should be equals 1", 1, elements.size()); //$NON-NLS-1$
+
+ final nsIDOMElement spanOne = (nsIDOMElement) elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ assertEquals("Style attribute should be substituted", "Hello", spanOne.getFirstChild().getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
+
+ }
+
+ /**
+ * _test resource substitution in text.
+ *
+ * @throws CoreException the core exception
+ * @throws Throwable the throwable
+ */
+ public void _testResourceSubstitutionInText() throws CoreException, Throwable {
+ final nsIDOMElement rst = TestUtil.performTestForRichFacesComponent((IFile) TestUtil.getComponentPath(PAGE_2, getOpenProjectName()));
+ final List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
+ // DOMTreeDumper dumper = new DOMTreeDumper();
+ // dumper.dumpToStream(System.out, rst);
+ TestUtil.findAllElementsByName(rst, elements, "H3"); //$NON-NLS-1$
+ assertEquals("Size should be equals 1", 1, elements.size()); //$NON-NLS-1$
+
+ final nsIDOMElement h3one = (nsIDOMElement) elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+
+ assertEquals("Style attribute should be substituted", "Hello", h3one.getFirstChild().getFirstChild().getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
+
+ // There are the label:#{msg.header}f
+
+ TestUtil.findAllElementsByName(rst, elements, "SPAN"); //$NON-NLS-1$
+ assertEquals("Size should be equals 1", 4, elements.size()); //$NON-NLS-1$
+ final nsIDOMElement pOne = ((nsIDOMElement) elements.get(2).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID));
+
+ assertEquals(
+ "Style attribute should be substituted", "There are the label:Hello Demo Application", pOne.getFirstChild().getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
+
+ }
+
+ /**
+ * Test selection with resource string.
+ *
+ * @throws CoreException the core exception
+ */
+ @SuppressWarnings("restriction")
+ public void testSelectionWithResourceString() throws CoreException {
+ IFile lfile = (IFile) TestUtil.getComponentPath(PAGE_2, getOpenProjectName());
+ IEditorInput input = new FileEditorInput(lfile);
+ // open and get editor
+ JSPMultiPageEditor part = openEditor(input);
+
+ // get controller
+ VpeController controller = 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 xulrunner editor
+ XulRunnerEditor xulRunnerEditor = controller.getXulRunnerEditor();
+ assertNotNull(xulRunnerEditor);
+
+ int start = controller.getPageContext().getSourceBuilder().getStructuredTextViewer().getTextWidget().getText().indexOf(
+ "#{msg.hello_message}"); //$NON-NLS-1$
+
+ assertTrue("Should be gt that 100", start > 100); //$NON-NLS-1$
+
+ IStructuredModel model;
+ model = StructuredModelManager.getModelManager()
+ .getExistingModelForRead(controller.getSourceEditor().getTextViewer().getDocument());
+ IDOMDocument document = null;
+ document = ((IDOMModel) model).getDocument();
+ ;
+ org.w3c.dom.NodeList nodeList = document.getElementsByTagName("h:outputText"); //$NON-NLS-1$
+
+ assertNotNull("Can't be null", nodeList); //$NON-NLS-1$
+ assertTrue("Size should be great that 0", nodeList.getLength() > 0); //$NON-NLS-1$
+
+ final Node elementNode = nodeList.item(0);
+
+ SelectionUtil.setSourceSelection(controller.getPageContext(), elementNode, 0, 0);
+
+ nsIDOMNode node = SelectionUtil.getLastSelectedNode(controller.getPageContext());
+
+ assertEquals("Node names should be equals", "Hello", node.getFirstChild().getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
+
+ }
+
+ /**
+ * Gets the open page name.
+ *
+ * @return the open page name
+ */
+ protected String getOpenPageName() {
+ return PAGE_1;
+ }
+
+}
Modified: 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 2008-08-06 09:38:59 UTC (rev 9558)
+++ trunk/vpe/tests/org.jboss.tools.vpe.ui.test/src/org/jboss/tools/vpe/ui/test/TestUtil.java 2008-08-06 09:39:08 UTC (rev 9559)
@@ -15,6 +15,9 @@
import java.util.ArrayList;
import java.util.List;
+import junit.framework.Assert;
+
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -22,35 +25,52 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.IOverwriteQuery;
+import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.wizards.datatransfer.ImportOperation;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
-import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+import org.jboss.tools.vpe.editor.VpeController;
+import org.jboss.tools.vpe.editor.VpeEditorPart;
import org.jboss.tools.vpe.ui.test.beans.ImportBean;
+import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
+import org.mozilla.interfaces.nsIDOMDocument;
+import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMNodeList;
import org.mozilla.xpcom.XPCOMException;
import org.w3c.dom.Node;
/**
- * Class for importing project from jar file
+ * Class for importing project from jar file.
*
* @author sdzmitrovich
- *
*/
public class TestUtil {
+ /** The Constant COMPONENTS_PATH. */
private static final String COMPONENTS_PATH = "WebContent/pages"; //$NON-NLS-1$
+ /** The Constant WEBCONTENT_PATH. */
private static final String WEBCONTENT_PATH = "WebContent"; //$NON-NLS-1$
+
+ /** Editor in which we open visual page. */
+ protected final static String EDITOR_ID = "org.jboss.tools.jst.jsp.jspeditor.JSPTextEditor"; //$NON-NLS-1$
+ /** The Constant MAX_IDLE. */
private static final long MAX_IDLE = 30*60*1000L;
+ /**
+ * Import project into workspace.
+ *
+ * @param path the path
+ * @param projectName the project name
+ */
static void importProjectIntoWorkspace(String path, String projectName) {
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
@@ -93,9 +113,14 @@
}
/**
+ * Gets the component path.
*
- * @return
- * @throws CoreException
+ * @param componentPage the component page
+ * @param projectName the project name
+ *
+ * @return the component path
+ *
+ * @throws CoreException the core exception
*/
public static IResource getComponentPath(String componentPage,
String projectName) throws CoreException {
@@ -110,9 +135,14 @@
}
/**
+ * Gets the web content path.
*
- * @return
- * @throws CoreException
+ * @param componentPage the component page
+ * @param projectName the project name
+ *
+ * @return the web content path
+ *
+ * @throws CoreException the core exception
*/
public static IResource getWebContentPath(String componentPage,
String projectName) throws CoreException {
@@ -126,8 +156,11 @@
}
/**
+ * Removes the project.
*
- * @throws CoreException
+ * @param projectName the project name
+ *
+ * @throws CoreException the core exception
*/
static void removeProject(String projectName) throws CoreException {
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
@@ -141,8 +174,7 @@
/**
* Process UI input but do not return for the specified time interval.
*
- * @param waitTimeMillis
- * the number of milliseconds
+ * @param waitTimeMillis the number of milliseconds
*/
public static void delay(long waitTimeMillis) {
Display display = Display.getCurrent();
@@ -172,6 +204,9 @@
delay(100);
}
+ /**
+ * Wait for idle.
+ */
public static void waitForIdle() {
long start = System.currentTimeMillis();
while (!Job.getJobManager().isIdle()) {
@@ -182,14 +217,14 @@
}
/**
- * find elements by name
+ * find elements by name.
*
* @param node -
- * current node
+ * current node
+ * @param name -
+ * name element
* @param elements -
- * list of found elements
- * @param name -
- * name element
+ * list of found elements
*/
static public void findElementsByName(nsIDOMNode node,
List<nsIDOMNode> elements, String name) {
@@ -214,14 +249,14 @@
}
/**
- * find all elements by name
+ * find all elements by name.
*
* @param node -
- * current node
+ * current node
+ * @param name -
+ * name element
* @param elements -
- * list of found elements
- * @param name -
- * name element
+ * list of found elements
*/
static public void findAllElementsByName(nsIDOMNode node,
List<nsIDOMNode> elements, String name) {
@@ -240,6 +275,14 @@
}
}
+ /**
+ * Creates the import bean list.
+ *
+ * @param projectName the project name
+ * @param resourcePath the resource path
+ *
+ * @return the list< import bean>
+ */
static public List<ImportBean> createImportBeanList(String projectName,
String resourcePath) {
List<ImportBean> projectToImport = new ArrayList<ImportBean>();
@@ -247,6 +290,14 @@
return projectToImport;
}
+ /**
+ * Creates the import bean.
+ *
+ * @param projectName the project name
+ * @param resourcePath the resource path
+ *
+ * @return the import bean
+ */
static public ImportBean createImportBean(String projectName,
String resourcePath) {
ImportBean importBean = new ImportBean();
@@ -254,27 +305,33 @@
importBean.setImportProjectPath(resourcePath);
return importBean;
}
+
/**
- * Utility function which returns node mapping by source position(line and position in line)
- * @param lineIndex
- * @param linePosition
+ * Utility function which returns node mapping by source position(line and position in line).
+ *
+ * @param linePosition the line position
+ * @param lineIndex the line index
+ * @param itextViewer the itext viewer
+ *
* @return node for specified src position
*/
- public static Node getNodeMappingBySourcePosition(ITextViewer itextViewer, int lineIndex, int linePosition) {
+ @SuppressWarnings("restriction")
+ public static Node getNodeMappingBySourcePosition(ITextViewer itextViewer, int lineIndex, int linePosition) {
int offset = getLinePositionOffcet(itextViewer, lineIndex, linePosition);
IndexedRegion treeNode = ContentAssistUtils.getNodeAt(itextViewer, offset);
return (Node) treeNode;
}
/**
- * Utility function which is used to calculate offcet in document by line number and character position
+ * Utility function which is used to calculate offcet in document by line number and character position.
*
- * @param textViewer
- * @param lineIndex
- * @param linePosition
+ * @param linePosition the line position
+ * @param textViewer the text viewer
+ * @param lineIndex the line index
+ *
* @return offcet in document
- * @throws IllegalArgumentException
- */
+ *
+ * @throws IllegalArgumentException */
public static final int getLinePositionOffcet(ITextViewer textViewer, int lineIndex, int linePosition) {
int resultOffcet = 0;
@@ -308,4 +365,66 @@
}
return resultOffcet;
}
+
+
+ /**
+ * get xulrunner source page.
+ *
+ * @param part - JSPMultiPageEditor
+ *
+ * @return nsIDOMDocument
+ */
+ public static nsIDOMDocument getVpeVisualDocument(JSPMultiPageEditor part) {
+
+ VpeEditorPart visualEditor = (VpeEditorPart) part.getVisualEditor();
+
+ VpeController vpeController = visualEditor.getController();
+
+ // get xulRunner editor
+ XulRunnerEditor xulRunnerEditor = vpeController.getXulRunnerEditor();
+
+ // get dom document
+ nsIDOMDocument document = xulRunnerEditor.getDOMDocument();
+
+ return document;
+ }
+
+ /**
+ * Perform test for rich faces component.
+ *
+ * @param componentPage the component page
+ *
+ * @return the ns IDOM element
+ *
+ * @throws Throwable the throwable
+ */
+ 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);
+
+ // get dom document
+ nsIDOMDocument document = getVpeVisualDocument(editor);
+ rst = document.getDocumentElement();
+ // check that element is not null
+ Assert.assertNotNull(rst);
+ return rst;
+ }
+
+ /**
+ * Fail.
+ *
+ * @param t the t
+ */
+ public static void fail(Throwable t){
+ Assert.fail("Test case was fail "+t.getMessage()+":"+t);
+ }
}
16 years, 7 months
JBoss Tools SVN: r9558 - trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test.
by jbosstools-commits@lists.jboss.org
Author: estherbin
Date: 2008-08-06 05:38:59 -0400 (Wed, 06 Aug 2008)
New Revision: 9558
Removed:
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/CommonJBIDE2010Test.java
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/ElPreferencesTestCase.java
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/JBIDE2010Test.java
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/JBIDE2582Test.java
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/VpeAllTests.java
Log:
Move test cases from *.vpe.test to the vpe.ui.test package.
Deleted: trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/CommonJBIDE2010Test.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/CommonJBIDE2010Test.java 2008-08-06 09:09:26 UTC (rev 9557)
+++ trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/CommonJBIDE2010Test.java 2008-08-06 09:38:59 UTC (rev 9558)
@@ -1,142 +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.test;
-
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.core.resources.IFile;
-import org.jboss.tools.jsf.vpe.richfaces.test.CommonRichFacesTestCase;
-import org.jboss.tools.vpe.editor.css.ELReferenceList;
-import org.jboss.tools.vpe.editor.css.ResourceReference;
-import org.jboss.tools.vpe.ui.test.TestUtil;
-
-
-/**
- * The common test case for the all test cases related to the <a
- * href="https://jira.jboss.com:8443/jira/browse/JBIDE-2010"
- * >JBIDE-2010</a>issue.
- */
-public abstract class CommonJBIDE2010Test extends CommonRichFacesTestCase {
-
- /** The Constant DIR_TEST_PAGE_NAME_3. */
- protected static final String DIR_TEST_PAGE_NAME_3 = "JBIDE/2010/page3.xhtml";
-
- /** The Constant VALUE_5. */
- protected static final String VALUE_5 = "world";
-
- /** The Constant KEY_5. */
- protected static final String KEY_5 = "#{bean1.property3}";
-
- /** The Constant VALUE_4. */
- protected static final String VALUE_4 = "background: red";
-
- /** The Constant KEY_4. */
- protected static final String KEY_4 = "#{bean1.property2}";
-
- /** The Constant IMPORT_PROJECT_NAME. */
- public static final String IMPORT_PROJECT_NAME = "jsfTest";
-
- /** The Constant KEY_3. */
- protected static final String KEY_3 = "#{facesContext.requestPath}";
-
- /** The Constant KEY_2. */
- protected static final String KEY_2 = "#{beanA.property2}";
-
- /** The Constant DIR_TEST_PAGE_NAME. */
- protected static final String DIR_TEST_PAGE_NAME_2 = "JBIDE/2010/page2.jsp";
-
- /** The Constant DIR_TEST_PAGE_NAME. */
- protected static final String DIR_TEST_PAGE_NAME = "JBIDE/2010/page.jsp";
-
- /** The Constant KEY_1. */
- protected static final String KEY_1 = "#{beanA.property1}";
-
- /** The Constant elValuesMap. */
- protected static final Map<String, String> elValuesMap = new HashMap<String, String>();
-
- /** The file. */
- protected IFile file;
-
- /**
- * The Constructor.
- *
- * @param name the name
- */
- public CommonJBIDE2010Test(String name) {
- super(name);
-
- }
-
- /**
- * Sets the up.
- *
- * @throws Exception the exception
- */
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- elValuesMap.put(KEY_1, "/path/image/path/to/image/");
- elValuesMap.put(KEY_2, "/path2/");
- elValuesMap.put(KEY_3, "/facesContext/");
- elValuesMap.put(KEY_4, VALUE_4);
- elValuesMap.put(KEY_5, VALUE_5);
- file = (IFile) TestUtil.getComponentPath(getOpenPageName(), getOpenProjectName());
- ResourceReference[] entries = new ResourceReference[elValuesMap.size()];
- int i = 0;
- for (Entry<String, String> string : elValuesMap.entrySet()) {
-
- entries[i] = new ResourceReference(string.getKey(), ResourceReference.PROJECT_SCOPE);
- entries[i].setProperties(string.getValue());
- i++;
-
-
- }
- setValues(entries);
- }
-
-
- protected String getOpenPageName(){
- return DIR_TEST_PAGE_NAME;
- }
-
- protected String getOpenProjectName(){
- return IMPORT_PROJECT_NAME;
- }
- /**
- * Sets the values.
- *
- * @param key the key
- * @param value the value
- * @param scope the scope
- * @param entries the entries
- */
- protected void setValues(ResourceReference[] entries) {
- ELReferenceList.getInstance().setAllResources(file, entries);
- }
-
- /**
- * Tear down.
- *
- * @throws Exception the exception
- */
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- ELReferenceList.getInstance().setAllResources(this.file, new ResourceReference[0]);
- this.file = null;
-
- }
-
-}
Deleted: trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/ElPreferencesTestCase.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/ElPreferencesTestCase.java 2008-08-06 09:09:26 UTC (rev 9557)
+++ trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/ElPreferencesTestCase.java 2008-08-06 09:38:59 UTC (rev 9558)
@@ -1,75 +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.test;
-
-
-import org.eclipse.core.runtime.CoreException;
-import org.jboss.tools.vpe.editor.util.ElService;
-
-/**
- * <p>
- * Test case for testing service {@link ElService}
- * <p>
- * See <a href="http://jira.jboss.com/jira/browse/JBIDE-2010">JBIDE-2010</a> issue
- *
- */
-public class ElPreferencesTestCase extends CommonJBIDE2010Test {
-
-
- /**
- * The Constructor.
- *
- * @param name the name
- */
- public ElPreferencesTestCase(String name) {
- super(name);
-
- }
-
- /**
- * Test replace attribute value.
- *
- * @throws CoreException the core exception
- */
- public void testReplaceAttributeValue() throws CoreException {
- String string1 = "#{beanA.property1}/images/smalle.gif";
- String replacedValue = ElService.getInstance().replaceEl(file, string1);
-
- assertEquals("Should be equals " + elValuesMap.get(KEY_1) + "/images/smalle.gif", replacedValue, elValuesMap.get(KEY_1)
- + "/images/smalle.gif");
-
- }
-
- /**
- * Test replace attribute value2.
- *
- * @throws CoreException the core exception
- */
- public void testReplaceAttributeValue2() throws CoreException {
- String string1 = "#{beanA.property1}/images/#{beanA.property2}/path2/#{facesContext.requestPath}/smalle.gif";
-
- final String replacedValue = ElService.getInstance().replaceEl(file, string1);
- final String check = elValuesMap.get(KEY_1) + "/images/" + elValuesMap.get(KEY_2) + "/path2/" + elValuesMap.get(KEY_3)
- + "/smalle.gif";
- assertEquals("Should be equals " + check, check, replacedValue);
-
- }
-
- /**
- * Test replace not in set.
- */
- public void testReplaceNotInSet() {
- String string1 = "#{requestScope}/smalle.gif";
-
- assertEquals("Should be equals", string1, ElService.getInstance().replaceEl(file, string1));
- }
-}
Deleted: trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/JBIDE2010Test.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/JBIDE2010Test.java 2008-08-06 09:09:26 UTC (rev 9557)
+++ trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/JBIDE2010Test.java 2008-08-06 09:38:59 UTC (rev 9558)
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Exadel, Inc. and 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:
- * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-
-package org.jboss.tools.vpe.test;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.jboss.tools.vpe.editor.util.HTML;
-import org.jboss.tools.vpe.ui.test.TestUtil;
-import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMNode;
-
-
-/**
- * Test case for testing https://jira.jboss.com:8443/jira/browse/JBIDE-2010
- * issue.
- *
- * @author Eugeny Stherbin
- */
-public class JBIDE2010Test extends CommonJBIDE2010Test {
-
-
- /**
- * The Constructor.
- *
- * @param name the name
- */
- public JBIDE2010Test(String name) {
- super(name);
- }
-
- /**
- * Test el template simple.
- *
- * @throws CoreException the core exception
- * @throws Throwable the throwable
- */
- public void testElTemplateSimple() throws CoreException, Throwable {
- final nsIDOMElement rst = performTestForRichFacesComponent((IFile) TestUtil.getComponentPath(DIR_TEST_PAGE_NAME_2,
- IMPORT_PROJECT_NAME));
-
- List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
-
- // find "td" elements
-
- TestUtil.findAllElementsByName(rst, elements, HTML.TAG_SPAN);
-
- assertEquals("Count of divs should be equals 1", 1, elements.size());
- final nsIDOMElement spanOne = (nsIDOMElement) elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- assertEquals("Style attribute should be substituted", VALUE_4, spanOne.getFirstChild().getNodeValue());
-
- }
-
-
- /**
- * Test el template simple.
- *
- * @throws CoreException the core exception
- * @throws Throwable the throwable
- */
- public void testElTemplateSimple2() throws CoreException, Throwable {
- final nsIDOMElement rst = performTestForRichFacesComponent((IFile) TestUtil.getComponentPath(DIR_TEST_PAGE_NAME_3,
- IMPORT_PROJECT_NAME));
-
- List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
-
- // find "td" elements
-
- TestUtil.findAllElementsByName(rst, elements, HTML.TAG_P);
-
- assertEquals("Value should be equals", 1, elements.size());
- final nsIDOMElement pOne = (nsIDOMElement) elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- // DOMTreeDumper d = new DOMTreeDumper();
- // d.dumpToStream(System.out, rst);
-// assertEquals("Value should be equals", "Hello "+VALUE_5, pOne.getFirstChild().getFirstChild().getNodeValue());
- assertTrue("Value should be contains",pOne.getAttribute(HTML.ATTR_STYLE).startsWith(VALUE_4));
-
- }
-
-}
Deleted: trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/JBIDE2582Test.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/JBIDE2582Test.java 2008-08-06 09:09:26 UTC (rev 9557)
+++ trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/JBIDE2582Test.java 2008-08-06 09:38:59 UTC (rev 9558)
@@ -1,185 +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.test;
-
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
-import org.jboss.tools.vpe.editor.VpeController;
-import org.jboss.tools.vpe.editor.mapping.VpeDomMapping;
-import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
-import org.jboss.tools.vpe.editor.util.HTML;
-import org.jboss.tools.vpe.editor.util.SelectionUtil;
-import org.jboss.tools.vpe.ui.test.TestUtil;
-import org.jboss.tools.vpe.xulrunner.editor.XulRunnerEditor;
-import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMNode;
-import org.w3c.dom.Node;
-
-
-/**
- * Test case for testing <a
- * href="https://jira.jboss.org/jira/browse/JBIDE-2582"> JBIDE-2582 </a> issue
- *
- * @author Evgenij Stherbin
- */
-public class JBIDE2582Test extends CommonJBIDE2010Test {
-
- /** The Constant DIR_TEST_PAGE_NAME_3. */
- protected static final String PAGE_1 = "JBIDE/2582/page1.xhtml"; //$NON-NLS-1$
-
- /** The Constant DIR_TEST_PAGE_NAME_3. */
- protected static final String PAGE_2 = "JBIDE/2582/page2.xhtml"; //$NON-NLS-1$
-
- /**
- * The Constructor.
- *
- * @param name the name
- */
- public JBIDE2582Test(String name) {
- super(name);
-
- }
-
- /**
- * Test rs substitution.
- *
- * @throws Throwable the throwable
- */
- public void _testRsSubstitution() throws Throwable {
- final nsIDOMElement rst = performTestForRichFacesComponent(file);
-
- assertNotNull(rst);
-
- final List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
-
- TestUtil.findAllElementsByName(rst, elements, HTML.TAG_SPAN);
-
- assertEquals("Size should be equals 1", 1, elements.size()); //$NON-NLS-1$
-
- final nsIDOMElement spanOne = (nsIDOMElement) elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- assertEquals("Style attribute should be substituted", "Hello", spanOne.getFirstChild().getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
-
- }
-
- /**
- * _test resource substitution in text.
- *
- * @throws CoreException the core exception
- * @throws Throwable the throwable
- */
- public void _testResourceSubstitutionInText() throws CoreException, Throwable {
- final nsIDOMElement rst = performTestForRichFacesComponent((IFile) TestUtil.getComponentPath(PAGE_2, getOpenProjectName()));
- final List<nsIDOMNode> elements = new ArrayList<nsIDOMNode>();
- // DOMTreeDumper dumper = new DOMTreeDumper();
- // dumper.dumpToStream(System.out, rst);
- TestUtil.findAllElementsByName(rst, elements, "H3"); //$NON-NLS-1$
- assertEquals("Size should be equals 1", 1, elements.size()); //$NON-NLS-1$
-
- final nsIDOMElement h3one = (nsIDOMElement) elements.get(0).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
-
- assertEquals("Style attribute should be substituted", "Hello", h3one.getFirstChild().getFirstChild().getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
-
- // There are the label:#{msg.header}f
-
- TestUtil.findAllElementsByName(rst, elements, "SPAN"); //$NON-NLS-1$
- assertEquals("Size should be equals 1", 4, elements.size()); //$NON-NLS-1$
- final nsIDOMElement pOne = ((nsIDOMElement) elements.get(2).queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID));
-
- assertEquals(
- "Style attribute should be substituted", "There are the label:Hello Demo Application", pOne.getFirstChild().getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
-
- }
-
- /**
- * Test selection with resource string.
- *
- * @throws CoreException the core exception
- */
- @SuppressWarnings("restriction")
- public void testSelectionWithResourceString() throws CoreException {
- IFile lfile = (IFile) TestUtil.getComponentPath(PAGE_2, getOpenProjectName());
- IEditorInput input = new FileEditorInput(lfile);
- // open and get editor
- JSPMultiPageEditor part = openEditor(input);
-
- // get controller
- VpeController controller = 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 xulrunner editor
- XulRunnerEditor xulRunnerEditor = controller.getXulRunnerEditor();
- assertNotNull(xulRunnerEditor);
-
- int start = controller.getPageContext().getSourceBuilder().getStructuredTextViewer().getTextWidget().getText().indexOf(
- "#{msg.hello_message}"); //$NON-NLS-1$
-
- assertTrue("Should be gt that 100", start > 100); //$NON-NLS-1$
-
- IStructuredModel model;
- model = StructuredModelManager.getModelManager()
- .getExistingModelForRead(controller.getSourceEditor().getTextViewer().getDocument());
- IDOMDocument document = null;
- document = ((IDOMModel) model).getDocument();
- ;
- org.w3c.dom.NodeList nodeList = document.getElementsByTagName("h:outputText"); //$NON-NLS-1$
-
- assertNotNull("Can't be null", nodeList); //$NON-NLS-1$
- assertTrue("Size should be great that 0", nodeList.getLength() > 0); //$NON-NLS-1$
-
- final Node elementNode = nodeList.item(0);
-
- SelectionUtil.setSourceSelection(controller.getPageContext(), elementNode, 0, 0);
-
- nsIDOMNode node = SelectionUtil.getLastSelectedNode(controller.getPageContext());
-
- assertEquals("Node names should be equals", "Hello", node.getFirstChild().getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
-
- }
-
- /**
- * Gets the open page name.
- *
- * @return the open page name
- */
- protected String getOpenPageName() {
- return PAGE_1;
- }
-
-}
Modified: trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/VpeAllTests.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/VpeAllTests.java 2008-08-06 09:09:26 UTC (rev 9557)
+++ trunk/vpe/tests/org.jboss.tools.vpe.test/src/org/jboss/tools/vpe/test/VpeAllTests.java 2008-08-06 09:38:59 UTC (rev 9558)
@@ -21,6 +21,9 @@
import org.jboss.tools.jsf.vpe.jsf.test.JsfTestPlugin;
import org.jboss.tools.vpe.editor.preferences.VpeEditorPreferencesPageTest;
import org.jboss.tools.vpe.editor.template.VpeTemplateManagerTest;
+import org.jboss.tools.vpe.ui.test.ElPreferencesTestCase;
+import org.jboss.tools.vpe.ui.test.JBIDE2010Test;
+import org.jboss.tools.vpe.ui.test.JBIDE2582Test;
import org.jboss.tools.vpe.ui.test.VpeTestSetup;
import org.jboss.tools.vpe.ui.test.beans.ImportBean;
16 years, 7 months
JBoss Tools SVN: r9557 - trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2008-08-06 05:09:26 -0400 (Wed, 06 Aug 2008)
New Revision: 9557
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ConnectionFigure.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-1189
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ConnectionFigure.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ConnectionFigure.java 2008-08-05 23:07:10 UTC (rev 9556)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui.pages/src/org/jboss/tools/seam/ui/pages/editor/figures/ConnectionFigure.java 2008-08-06 09:09:26 UTC (rev 9557)
@@ -17,7 +17,6 @@
import org.eclipse.draw2d.PolylineConnection;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.PointList;
-import org.eclipse.swt.graphics.Color;
import org.jboss.tools.seam.ui.pages.editor.ecore.pages.Link;
import org.jboss.tools.seam.ui.pages.editor.edit.LinkEditPart;
@@ -85,51 +84,59 @@
editPart.clear();
}
- PointList points;
- Point point;
- /**
- * begin ,end points
- */
- Point beg = new Point(0, 0), end = new Point(0, 0);
-
- Point bCorner = new Point(0, 0);
- Point eCorner = new Point(0, 0);
- boolean horiz;
private boolean selected;
- @Override
- public void setForegroundColor(Color fg) {
- // TODO Auto-generated method stub
- super.setForegroundColor(fg);
- }
-
protected void outlineShape(Graphics g) {
-
if(selected) {
g.setForegroundColor(FigureFactory.selectedColor);
} else {
g.setForegroundColor(getForegroundColor());
}
- points = getPoints();
- point = points.getPoint(0);
+ PointList points = getPoints();
+ Point point = points.getPoint(0);
+ Point beg = new Point();
+ Point end = new Point();
+ Point eCorner = new Point();
+ Point bCorner = new Point();
+ boolean horiz;
beg.x = point.x;
beg.y = point.y;
-
+
if (points.getFirstPoint().y == points.getLastPoint().y) {
super.outlineShape(g);
return;
}
-
+ if (Math.abs(points.getFirstPoint().y - points.getLastPoint().y) < 4) {
+ int delta = Math.abs(points.getFirstPoint().y - points.getLastPoint().y);
+ if(points.size() == 4){
+ Point point1 = points.getPoint(0);
+ Point point2 = points.getPoint(1);
+ Point point3 = points.getPoint(2);
+ Point point4 = points.getPoint(3);
+ if(point1.x < point4.x){
+ point2.x -= delta/2;
+ point3.x += delta/2;
+ }else{
+ point2.x += delta/2;
+ point3.x -= delta/2;
+ }
+ g.drawLine(point1, point2);
+ g.drawLine(point2, point3);
+ g.drawLine(point3, point4);
+ return;
+ }
+ }
+
for (int i = 1; i < points.size(); i++) {
point = points.getPoint(i);
end.x = point.x;
end.y = point.y;
-
+
if (beg.y == end.y)
horiz = true;
else
horiz = false;
-
+
eCorner.x = 0;
if (i != 1) {
if (horiz) {
@@ -152,7 +159,7 @@
if (bCorner.x != 0 && eCorner.x != 0)
g.drawLine(bCorner, eCorner);
bCorner.x = 0;
-
+
if (i != points.size() - 1) {
if (horiz) {
if (end.x > beg.x) {
@@ -177,8 +184,6 @@
beg.y = point.y;
}
}
-
-
public void setSelected(boolean selected) {
this.selected = selected;
repaint();
16 years, 7 months
JBoss Tools SVN: r9556 - in trunk/common/plugins/org.jboss.tools.common.model/resources: meta and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2008-08-05 19:07:10 -0400 (Tue, 05 Aug 2008)
New Revision: 9556
Modified:
trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model.properties
trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta
Log:
JBIDE-2588 VPE on separate tab w/ lazy initialization
Modified: trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model.properties 2008-08-05 23:07:04 UTC (rev 9555)
+++ trunk/common/plugins/org.jboss.tools.common.model/resources/help/keys-model.properties 2008-08-05 23:07:10 UTC (rev 9556)
@@ -631,7 +631,7 @@
SharableNewProject.Register_Web_Context_in_server.xml=Register Web Context in server.xml
SharableVPEEditor.option_list=Default Editor Tab
-SharableVPEEditor.source_visual_editors_weights=Source-Visual Editor Weights
+SharableVPEEditor.source_visual_editors_weights=Size of Visual Editor pane 0-100%
##### XBundle model #####
Modified: trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta 2008-08-05 23:07:04 UTC (rev 9555)
+++ trunk/common/plugins/org.jboss.tools.common.model/resources/meta/studio_eclipse_option.meta 2008-08-05 23:07:10 UTC (rev 9556)
@@ -1227,12 +1227,13 @@
<XModelAttribute default="Visual/Source" name="option list" xmlname="option_list">
<Constraint loader="List">
<value name="Visual/Source"/>
+ <value name="Source"/>
<value name="Preview"/>
</Constraint>
<Editor name="List"/>
</XModelAttribute>
- <XModelAttribute default="500" name="Source-Visual Editors Weights" xmlname="source_visual_editors_weights">
- <Editor name="Slider"/>
+ <XModelAttribute default="500" name="Size of Visual Editor pane 0-100%" xmlname="source_visual_editors_weights">
+ <Editor name="Slider2"/>
</XModelAttribute>
</XModelAttributes>
<XActionItem kind="list"/>
16 years, 7 months
JBoss Tools SVN: r9555 - in trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe: messages and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2008-08-05 19:07:04 -0400 (Tue, 05 Aug 2008)
New Revision: 9555
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
Log:
JBIDE-2588 VPE on separate tab w/ lazy initialization
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2008-08-05 23:06:58 UTC (rev 9554)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeEditorPart.java 2008-08-05 23:07:04 UTC (rev 9555)
@@ -232,12 +232,12 @@
}
public void setStatusField(IStatusField field, String category) {
- if (visualMode == VISUAL_MODE) {
- if (field != null) {
- field.setImage(null);
- field.setText(null);
- }
- } else if (sourceEditor != null)
+// if (visualMode == VISUAL_MODE) {
+// if (field != null) {
+// field.setImage(null);
+// field.setText(null);
+// }
+// } else if (sourceEditor != null)
sourceEditor.setStatusField(field, category);
}
@@ -372,16 +372,16 @@
}
break;
- case VISUAL_MODE:
- selectionBar.showBar(showSelectionBar);
- if (sourceContent != null)
- sourceContent.setVisible(false);
- if (visualContent != null)
- visualContent.setVisible(true);
- if (previewContent != null) {
- previewContent.setVisible(false);
- }
- break;
+// case VISUAL_MODE:
+// selectionBar.showBar(showSelectionBar);
+// if (sourceContent != null)
+// sourceContent.setVisible(false);
+// if (visualContent != null)
+// visualContent.setVisible(true);
+// if (previewContent != null) {
+// previewContent.setVisible(false);
+// }
+// break;
case SOURCE_MODE:
selectionBar.showBar(showSelectionBar);
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2008-08-05 23:06:58 UTC (rev 9554)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/messages/messages.properties 2008-08-05 23:07:04 UTC (rev 9555)
@@ -15,7 +15,7 @@
USE_ABSOLUTE_POSITION=use absolute position
ALWAYS_PROMPT_FOR_TAG_ATTRIBUTES_DURING_TAG_INSERT=always prompt for tag attributes during tag insert
OPTION_LIST=option list
-SOURCE_VISUAL_EDITORS_WEIGHTS=Source-Visual Editors Weights
+SOURCE_VISUAL_EDITORS_WEIGHTS=Size of Visual Editor pane 0-100%
GENERAL=General
TEMPLATES=Templates
TEMPLATE=Template
16 years, 7 months
JBoss Tools SVN: r9554 - in trunk/common/plugins/org.jboss.tools.common.model.ui: src/org/jboss/tools/common/model/ui/attribute/editor and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2008-08-05 19:06:58 -0400 (Tue, 05 Aug 2008)
New Revision: 9554
Added:
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderEditor2.java
trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderFieldEditor2.java
Modified:
trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
Log:
JBIDE-2588 VPE on separate tab w/ lazy initialization
Modified: trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2008-08-05 23:06:49 UTC (rev 9553)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/plugin.xml 2008-08-05 23:06:58 UTC (rev 9554)
@@ -109,6 +109,9 @@
</attributeEditor>
<attributeEditor class="org.jboss.tools.common.model.ui.attribute.editor.SliderEditor" id="Slider">
</attributeEditor>
+ <attributeEditor class="org.jboss.tools.common.model.ui.attribute.editor.SliderEditor2" id="Slider2">
+ </attributeEditor>
+
</extension>
<extension point="org.jboss.tools.common.model.ui.attributeAdapter">
<attributeAdapter class="org.jboss.tools.common.model.ui.attribute.adapter.DefaultValueAdapter" id="Slider">
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderEditor2.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderEditor2.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderEditor2.java 2008-08-05 23:06:58 UTC (rev 9554)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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.common.model.ui.attribute.editor;
+
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.widgets.Composite;
+import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
+
+public class SliderEditor2 extends ValueEditor {
+
+ public SliderEditor2() {}
+
+ public SliderEditor2(IWidgetSettings settings) {
+ super(settings);
+ lineEditor = true;
+ }
+
+ public void dispose() {
+ super.dispose();
+ if (cellEditor != null) {
+ cellEditor.dispose();
+ }
+ cellEditor = null;
+ if (fieldEditor != null) {
+ fieldEditor.dispose();
+ }
+ fieldEditor = null;
+ }
+
+ @Override
+ protected CellEditor createCellEditor(Composite parent) {
+ cellEditor = new SliderCellEditorEx();
+ return cellEditor;
+ }
+
+ @Override
+ protected ExtendedFieldEditor createFieldEditor(Composite parent) {
+ fieldEditor = new SliderFieldEditor2();
+ fieldEditor.setLabelText(getLabelText());
+ return fieldEditor;
+ }
+
+}
Added: trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderFieldEditor2.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderFieldEditor2.java (rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/attribute/editor/SliderFieldEditor2.java 2008-08-05 23:06:58 UTC (rev 9554)
@@ -0,0 +1,286 @@
+/*******************************************************************************
+ * Copyright (c) 2007-2008 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.common.model.ui.attribute.editor;
+
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+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.Label;
+import org.eclipse.swt.widgets.Slider;
+import org.jboss.tools.common.model.ui.IAttributeErrorProvider;
+import org.jboss.tools.common.model.ui.IValueChangeListener;
+import org.jboss.tools.common.model.ui.IValueProvider;
+import org.jboss.tools.common.model.ui.widgets.IWidgetSettings;
+
+public class SliderFieldEditor2 extends ExtendedFieldEditor implements
+ IFieldEditor, IPropertyFieldEditor, IPropertyChangeListener,
+ PropertyChangeListener {
+
+ protected IPropertyEditor propertyEditor;
+
+ protected IValueProvider valueProvider;
+ protected IValueChangeListener valueChangeListener;
+
+ private static final String SLIDER_LABEL_DEFAULT_TEXT = "50% "; //$NON-NLS-1$
+ private static final int MAX_SLIDER_VALUE = 1000;
+ private static final int MIN_SLIDER_VALUE = 0;
+ private static final int INCREMENT_SLIDER_VALUE = 10;
+ private static final int DEFAULT_SLIDER_VALUE = 500;
+ private Composite composite = null;
+ private Label sliderLabel = null;
+ private Slider slider = null;
+ private SelectionListener selectionListener = null;
+ private int intValue = 0;
+
+ public SliderFieldEditor2() {
+ super();
+ }
+
+ public SliderFieldEditor2(IWidgetSettings settings) {
+ super(settings);
+ }
+
+ public SliderFieldEditor2(IPropertyEditor propertyEditor) {
+ super();
+ this.propertyEditor = propertyEditor;
+ }
+
+ /**
+ * Initializes the slider.
+ */
+ protected void init() {
+ /*
+ * Initialize slider selection value with stored value
+ */
+ try {
+ intValue = Integer.parseInt(valueProvider.getStringValue(true));
+ } catch (Exception e) {
+ // Do nothing
+ }
+ setPropertyChangeListener(this);
+ valueProvider.addValueChangeListener(this);
+ }
+
+ @Override
+ protected void adjustForNumColumns(int numColumns) {
+ if (null != composite) {
+ if (null != composite.getLayoutData()) {
+ ((GridData)slider.getLayoutData()).horizontalSpan = numColumns;
+ }
+ }
+ }
+
+ @Override
+ protected void doFillIntoGrid(Composite parent, int numColumns) {
+ getLabelComposite(parent);
+ Control control = createSpinnerControl(parent);
+ GridData gd;
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ control.setLayoutData(gd);
+ }
+
+ @Override
+ protected void doLoad() {
+ if (null != slider) {
+ slider.setSelection(getPreferenceStore().getInt(getPreferenceName()));
+ valueChanged();
+ }
+ }
+
+ @Override
+ protected void doLoadDefault() {
+ if (null != slider) {
+ slider.setSelection(getPreferenceStore().getDefaultInt(getPreferenceName()));
+ valueChanged();
+ }
+ }
+
+ @Override
+ protected void doStore() {
+ if (null != slider) {
+ getPreferenceStore().setValue(getPreferenceName(), slider.getSelection());
+ }
+ }
+
+ public int getNumberOfControls() {
+ return 2;
+ }
+
+ public Control[] getControls(Composite parent) {
+ return new Control[] {
+ getLabelComposite(parent),
+ createSpinnerControl(parent)
+ };
+ }
+
+ public void setPropertyEditor(IPropertyEditor propertyEditor) {
+ this.propertyEditor = propertyEditor;
+ if (null != propertyEditor) {
+ valueProvider = (IValueProvider)propertyEditor.getAdapter(IValueProvider.class);
+ valueChangeListener = (IValueChangeListener)propertyEditor.getAdapter(IValueChangeListener.class);
+ setErrorProvider((IAttributeErrorProvider)propertyEditor.getAdapter(IAttributeErrorProvider.class));
+ }
+ init();
+ }
+
+ public void propertyChange(PropertyChangeEvent event) {
+ if(ExtendedFieldEditor.VALUE.equals(event.getProperty())) {
+ setPropertyChangeListener(null);
+ java.beans.PropertyChangeEvent e = new java.beans.PropertyChangeEvent(this, IPropertyEditor.VALUE, event.getOldValue(), event.getNewValue());
+ valueChangeListener.valueChange(e);
+ setPropertyChangeListener(this);
+ }
+ }
+
+ public void propertyChange(java.beans.PropertyChangeEvent evt) {
+ valueProvider.removeValueChangeListener(this);
+ if (IPropertyEditor.VALUE.equals(evt.getPropertyName())) {
+ Object v = evt.getNewValue();
+ if (null != v) {
+ this.setStringValue(v.toString());
+ }
+ }
+ valueProvider.addValueChangeListener(this);
+ }
+
+ protected Control createSpinnerControl(Composite parent) {
+ /*
+ * Create composite control with label and slider in it.
+ */
+ composite = new Composite(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 2;
+ gridLayout.marginWidth = 0;
+ gridLayout.marginHeight = 0;
+ gridLayout.horizontalSpacing = HORIZONTAL_GAP;
+ composite.setLayout(gridLayout);
+ GridData gd;
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ composite.setLayoutData(gd);
+
+ /*
+ * Create label
+ */
+ sliderLabel = new Label(composite,SWT.NONE);
+ gd = new GridData(SWT.LEFT);
+ sliderLabel.setLayoutData(gd);
+ sliderLabel.setText(SLIDER_LABEL_DEFAULT_TEXT);
+ Point size = sliderLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ sliderLabel.setSize(size);
+
+ /*
+ * Create slider
+ */
+ slider = new Slider(composite, SWT.HORIZONTAL);
+ gd = new GridData(SWT.RIGHT | GridData.FILL_HORIZONTAL);
+ slider.setLayoutData(gd);
+
+ slider.setMaximum(MAX_SLIDER_VALUE + slider.getThumb());
+ slider.setMinimum(MIN_SLIDER_VALUE);
+ slider.setIncrement(INCREMENT_SLIDER_VALUE);
+
+ /*
+ * Add listener to handle value change
+ */
+ selectionListener = new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ valueChanged();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // Do nothing
+ }
+ };
+ slider.addSelectionListener(selectionListener);
+ try {
+ intValue = Integer.parseInt(valueProvider.getStringValue(true).toString());
+ } catch (Exception e) {
+ intValue = DEFAULT_SLIDER_VALUE;
+ }
+
+ /*
+ * Initialize slider presentation
+ */
+ slider.setSelection(intValue);
+ String weightsString = "" + (intValue /10) + "%"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ slider.setToolTipText(weightsString);
+ sliderLabel.setText(weightsString);
+
+ slider.pack();
+ sliderLabel.pack();
+ return composite;
+ }
+
+ /**
+ * Notifies listeners of value change.
+ */
+ protected void valueChanged() {
+ int newValue = slider.getSelection();
+ int oldValue = this.intValue;
+ intValue = newValue;
+ java.beans.PropertyChangeEvent event = new java.beans.PropertyChangeEvent(
+ this, IPropertyEditor.VALUE, oldValue, newValue);
+ valueChangeListener.valueChange(event);
+ }
+
+ /**
+ * Sets the value to slider and updates controls presentation.
+ *
+ * @param stringValue the new slider value
+ */
+ private void setStringValue(String stringValue) {
+ if (null != slider) {
+ try {
+ intValue = Integer.parseInt(stringValue);
+ slider.setSelection(intValue);
+ /*
+ * Show value in percents.
+ */
+ String weightsString = "" + (intValue / 10) + "%"; //$NON-NLS-1$ //$NON-NLS-2$
+ slider.setToolTipText(weightsString);
+ if (null != sliderLabel) {
+ sliderLabel.setText(weightsString);
+ }
+ } catch (Exception e) {
+ // Do nothing
+ }
+ }
+ }
+
+ @Override
+ public void copy() {
+
+ }
+
+ @Override
+ public void cut() {
+
+ }
+
+ @Override
+ public void delete() {
+
+ }
+
+ @Override
+ public void paste() {
+
+ }
+}
16 years, 7 months
JBoss Tools SVN: r9553 - in trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp: jspeditor and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: snjeza
Date: 2008-08-05 19:06:49 -0400 (Tue, 05 Aug 2008)
New Revision: 9553
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/IVisualEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreference.java
Log:
JBIDE-2588 VPE on separate tab w/ lazy initialization
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/IVisualEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/IVisualEditor.java 2008-08-05 17:18:27 UTC (rev 9552)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/editor/IVisualEditor.java 2008-08-05 23:06:49 UTC (rev 9553)
@@ -15,11 +15,11 @@
public interface IVisualEditor extends ITextEditor, IReusableEditor {
public static final int VISUALSOURCE_MODE = 0;
- public static final int VISUAL_MODE = 1;
- public static final int SOURCE_MODE = 2;
+ //public static final int VISUAL_MODE = 1;
+ public static final int SOURCE_MODE = 1;
/** PREVIEW_MODE */
- public static final int PREVIEW_MODE = 3;
+ public static final int PREVIEW_MODE = 2;
public void setVisualMode(int mode);
public IVisualController getController();
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2008-08-05 17:18:27 UTC (rev 9552)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPMultiPageEditor.java 2008-08-05 23:06:49 UTC (rev 9553)
@@ -90,6 +90,8 @@
private static final String VISUALSOURCE_TAB_LABEL = "JSPMultiPageEditor.TabLabel.VisualSource"; //$NON-NLS-1$
+ private static final String SOURCE_TAB_LABEL = "JSPMultiPageEditor.TabLabel.Source"; //$NON-NLS-1$
+
/** PREVIEW_TAB_LABEL */
private static final String PREVIEW_TAB_LABEL = "JSPMultiPageEditor.TabLabel.Preview"; //$NON-NLS-1$
@@ -97,6 +99,8 @@
private static final String PREVIEW_TAB="Preview"; //$NON-NLS-1$
//visual tab
private static final String VISUAL_SOURCE_TAB="Visual/Source"; //$NON-NLS-1$
+ //source tab
+ private static final String SOURCE_TAB="Source"; //$NON-NLS-1$
private IVisualEditor visualEditor;
@@ -106,6 +110,8 @@
private JSPTextEditor sourceEditor;
+ private int sourceIndex;
+
/** composite control for default web-browser */
//private IVisualEditor previewWebBrowser;
@@ -149,10 +155,14 @@
if (VISUAL_SOURCE_TAB.equalsIgnoreCase(VpePreference.EDITOR_VIEW_OPTION
.getValue()))
selectedPageIndex = 0;
+ else if (SOURCE_TAB
+ .equalsIgnoreCase(VpePreference.EDITOR_VIEW_OPTION
+ .getValue()))
+ selectedPageIndex = 1;
else if (PREVIEW_TAB
.equalsIgnoreCase(VpePreference.EDITOR_VIEW_OPTION
.getValue()))
- selectedPageIndex = 1;
+ selectedPageIndex = 2;
else
selectedPageIndex = 0;
} else {
@@ -213,7 +223,10 @@
visualEditor.createVisualEditor();
}
visualEditor.setVisualMode(IVisualEditor.VISUALSOURCE_MODE);
- }else if (newPageIndex == previewIndex) {
+
+ }else if (newPageIndex == sourceIndex)
+ visualEditor.setVisualMode(IVisualEditor.SOURCE_MODE);
+ else if (newPageIndex == previewIndex) {
if (visualEditor.getPreviewWebBrowser() == null) {
visualEditor.createPreviewBrowser();
}
@@ -409,10 +422,16 @@
break;
}
case 1: {
- //preview mode
+ //source mode
setActivePage(selectedPageIndex);
pageChange(selectedPageIndex);
break;
+ }
+ case 2: {
+ //preview mode
+ setActivePage(selectedPageIndex);
+ pageChange(selectedPageIndex);
+ break;
}
default: {
//by default we sets source/visual mode
@@ -447,7 +466,7 @@
setPartName(visualEditor.getTitle());
} catch (PartInitException e) {
JspEditorPlugin.getPluginLog().logError(e);
- }
+ }*/
try {
sourceIndex = addPage(visualEditor, getEditorInput());
@@ -456,7 +475,7 @@
setPartName(visualEditor.getTitle());
} catch (PartInitException e) {
JspEditorPlugin.getPluginLog().logError(e);
- }*/
+ }
// Add tab contain default web-browser
try {
@@ -501,8 +520,10 @@
}
public void gotoMarker(final IMarker marker) {
- setActivePage(IVisualEditor.VISUALSOURCE_MODE);
- pageChange(IVisualEditor.VISUALSOURCE_MODE);
+ //setActivePage(IVisualEditor.VISUALSOURCE_MODE);
+ //pageChange(IVisualEditor.VISUALSOURCE_MODE);
+ setActivePage(IVisualEditor.SOURCE_MODE);
+ pageChange(IVisualEditor.SOURCE_MODE);
IGotoMarker adapter = (IGotoMarker) sourceEditor
.getAdapter(IGotoMarker.class);
if (adapter != null) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreference.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreference.java 2008-08-05 17:18:27 UTC (rev 9552)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/preferences/VpePreference.java 2008-08-05 23:06:49 UTC (rev 9553)
@@ -21,7 +21,7 @@
public static String ATT_USE_ABSOLUTE_POSITION = "";
public static String ATT_ALWAYS_PROMPT_FOR_TAG_ATTRIBUTES_DURING_TAG_INSERT = "always prompt for tag attributes during tag insert";
public static String ATT_OPTION_LIST = "option list";
- public static String ATT_SOURCE_VISUAL_EDITORS_WEIGHTS = "Source-Visual Editors Weights";
+ public static String ATT_SOURCE_VISUAL_EDITORS_WEIGHTS = "Size of Visual Editor pane 0-100%";
public static String ATT_SHOW_SELECTION_TAG_BAR = "show selection tag bar";
public static String ATT_ALWAYS_HIDE_SELECTION_BAR_WITHOUT_PROMT="always hide selection bar without prompt";
public static String SHOW_COMMENTS_VALUE;
16 years, 7 months