JBoss Tools SVN: r7008 - trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2008-03-19 10:37:49 -0400 (Wed, 19 Mar 2008)
New Revision: 7008
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1823, fixed, code adjustment
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-03-19 14:33:38 UTC (rev 7007)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2008-03-19 14:37:49 UTC (rev 7008)
@@ -1022,80 +1022,101 @@
}
public boolean doToggle(nsIDOMNode visualNode) {
- if (visualNode == null)
- return false;
- nsIDOMElement visualElement = null;
- try {
+ if (visualNode == null) {
+ return false;
+ }
+ nsIDOMElement visualElement = null;
+ try {
+ visualElement = (nsIDOMElement) visualNode
+ .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ } catch (XPCOMException exception) {
+ visualElement = (nsIDOMElement) visualNode.getParentNode()
+ .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ }
+ if (visualElement == null) {
+ return false;
+ }
- visualElement = (nsIDOMElement) visualNode
- .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- } catch (XPCOMException exception) {
- visualElement = (nsIDOMElement) visualNode.getParentNode()
- .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- }
- if (visualElement == null)
- return false;
+ nsIDOMAttr toggleIdAttr = visualElement
+ .getAttributeNode("vpe-user-toggle-id");
+ if (toggleIdAttr == null) {
+ return false;
+ }
+ String toggleId = toggleIdAttr.getNodeValue();
- nsIDOMAttr toggleIdAttr = visualElement
- .getAttributeNode("vpe-user-toggle-id");
- if (toggleIdAttr == null)
- return false;
- String toggleId = toggleIdAttr.getNodeValue();
+ if (toggleId == null) {
+ return false;
+ }
- if (toggleId == null)
- return false;
+ boolean toggleLookup = false;
+ nsIDOMAttr toggleLookupAttr = visualElement
+ .getAttributeNode("vpe-user-toggle-lookup-parent");
+ if (toggleLookupAttr != null) {
+ toggleLookup = "true".equals(toggleLookupAttr.getNodeValue());
+ }
- boolean toggleLookup = false;
- nsIDOMAttr toggleLookupAttr = visualElement
- .getAttributeNode("vpe-user-toggle-lookup-parent");
- if (toggleLookupAttr != null) {
- toggleLookup = "true".equals(toggleLookupAttr.getNodeValue());
- }
+ nsIDOMElement selectedElem = getLastSelectedElement();
+ // Fixes JBIDE-1823 author dmaliarevich
+ if (null == selectedElem) {
+ return false;
+ }
+ VpeElementMapping elementMapping = null;
+ VpeNodeMapping nodeMapping = domMapping.getNodeMapping(selectedElem);
+ if (nodeMapping instanceof VpeElementMapping) {
+ elementMapping = (VpeElementMapping) nodeMapping;
+ }
+ // end of fix
+ if (elementMapping == null) {
+ // may be toggle with facet
+ while (!selectedElem.getNodeName().equals(HTML.TAG_TABLE)) {
+ selectedElem = (nsIDOMElement) selectedElem.getParentNode()
+ .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
+ }
+ // Fixes JBIDE-1823 author dmaliarevich
+ nodeMapping = domMapping.getNodeMapping(selectedElem);
+ if (nodeMapping instanceof VpeElementMapping) {
+ elementMapping = (VpeElementMapping) nodeMapping;
+ }
+ // end of fix
+ }
+ Node sourceNode = (Node) domMapping.getSourceNode(selectedElem);
+ if (sourceNode == null) {
+ return false;
+ }
- nsIDOMElement selectedElem = getLastSelectedElement();
+ Element sourceElement = (Element) (sourceNode instanceof Element ? sourceNode
+ : sourceNode.getParentNode());
- VpeElementMapping elementMapping = (VpeElementMapping) domMapping
- .getNodeMapping(selectedElem);
- if (elementMapping == null) {
- // may be toggle with facet
- while (!selectedElem.getNodeName().equals(HTML.TAG_TABLE)) {
- selectedElem = (nsIDOMElement) selectedElem.getParentNode()
- .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
- }
- elementMapping = (VpeElementMapping) domMapping
- .getNodeMapping(selectedElem);
- }
- Node sourceNode = (Node) domMapping.getSourceNode(selectedElem);
- if (sourceNode == null)
- return false;
+ if (elementMapping != null) {
+ VpeTemplate template = elementMapping.getTemplate();
- Element sourceElement = (Element) (sourceNode instanceof Element ? sourceNode
- : sourceNode.getParentNode());
+ while (toggleLookup && sourceElement != null
+ && !(template instanceof VpeToggableTemplate)) {
+ sourceElement = (Element) sourceElement.getParentNode();
+ if (sourceElement == null) {
+ break;
+ }
+ // Fixes JBIDE-1823 author dmaliarevich
+ nodeMapping = domMapping.getNodeMapping(sourceElement);
+ if (nodeMapping instanceof VpeElementMapping) {
+ elementMapping = (VpeElementMapping) nodeMapping;
+ }
+ // end of fix
+ if (elementMapping == null) {
+ continue;
+ }
+ template = elementMapping.getTemplate();
+ }
- if (elementMapping != null) {
- VpeTemplate template = elementMapping.getTemplate();
-
- while (toggleLookup && sourceElement != null
- && !(template instanceof VpeToggableTemplate)) {
- sourceElement = (Element) sourceElement.getParentNode();
- if (sourceElement == null)
- break;
- elementMapping = (VpeElementMapping) domMapping
- .getNodeMapping(sourceElement);
- if (elementMapping == null)
- continue;
- template = elementMapping.getTemplate();
- }
-
- if (template instanceof VpeToggableTemplate) {
- ((VpeToggableTemplate) template).toggle(this, sourceElement,
- toggleId);
- updateElement(sourceElement);
- return true;
- }
+ if (template instanceof VpeToggableTemplate) {
+ ((VpeToggableTemplate) template).toggle(this, sourceElement,
+ toggleId);
+ updateElement(sourceElement);
+ return true;
+ }
+ }
+ return false;
}
- return false;
- }
public void removeAttribute(Element sourceElement, String name) {
VpeElementMapping elementMapping = (VpeElementMapping) domMapping
18 years
JBoss Tools SVN: r7007 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-03-19 10:33:38 -0400 (Wed, 19 Mar 2008)
New Revision: 7007
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1718
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java 2008-03-19 14:04:51 UTC (rev 7006)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java 2008-03-19 14:33:38 UTC (rev 7007)
@@ -66,11 +66,12 @@
Attr outputAttr = getOutputAttributeNode(sourceElement);
- // prepare value
- String newValue = prepareAttrValue(pageContext, sourceElement,
- outputAttr);
-
if (outputAttr != null) {
+
+ // prepare value
+ String newValue = prepareAttrValue(pageContext, sourceElement,
+ outputAttr);
+
// if escape then contents of value (or other attribute) is only
// text
if (!sourceElement.hasAttribute(JSF.ATTR_ESCAPE)
@@ -124,10 +125,9 @@
}
- creationData.setElementData(elementData);
-
}
-
+
+ creationData.setElementData(elementData);
}
protected String prepareAttrValue(VpePageContext pageContext,
18 years
JBoss Tools SVN: r7006 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.myfaces: META-INF and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2008-03-19 10:04:51 -0400 (Wed, 19 Mar 2008)
New Revision: 7006
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.myfaces/META-INF/MANIFEST.MF
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.myfaces/build.properties
Log:
fix bundle activation errors during a build
org.osgi.framework.BundleException: The activator org.jboss.tools.jsf.vpe.myfaces.MyFacesTemplatesPlugin for bundle org.jboss.tools.jsf.vpe.myfaces is invalid
[java] at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:141)
[java] at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:970)
[java] at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
[java] at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:260)
[java] at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:400)
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.myfaces/META-INF/MANIFEST.MF
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.myfaces/META-INF/MANIFEST.MF 2008-03-19 13:25:06 UTC (rev 7005)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.myfaces/META-INF/MANIFEST.MF 2008-03-19 14:04:51 UTC (rev 7006)
@@ -14,3 +14,4 @@
Eclipse-LazyStart: true
Export-Package: org.jboss.tools.jsf.vpe.myfaces,
org.jboss.tools.jsf.vpe.myfaces.template
+Bundle-ClassPath: jsf-vpe-myfaces.jar
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.myfaces/build.properties
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.myfaces/build.properties 2008-03-19 13:25:06 UTC (rev 7005)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.myfaces/build.properties 2008-03-19 14:04:51 UTC (rev 7006)
@@ -1,5 +1,16 @@
-source.. = src/
-output.. = bin/
bin.includes = META-INF/,\
templates/,\
- plugin.xml
+ plugin.xml,\
+ about.html,\
+ jsf-vpe-myfaces.jar
+src.includes = src/,\
+ templates/,\
+ plugin.xml,\
+ build.properties,\
+ about.html,\
+ META-INF/,\
+ .project,\
+ .classpath
+jars.compile.order = jsf-vpe-myfaces.jar
+output.jsf-vpe-myfaces.jar = bin/
+source.jsf-vpe-myfaces.jar = src/
18 years
JBoss Tools SVN: r7005 - trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2008-03-19 09:25:06 -0400 (Wed, 19 Mar 2008)
New Revision: 7005
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamPropertyRefactoringTest.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1919
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamPropertyRefactoringTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamPropertyRefactoringTest.java 2008-03-19 12:51:53 UTC (rev 7004)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/refactoring/SeamPropertyRefactoringTest.java 2008-03-19 13:25:06 UTC (rev 7005)
@@ -19,7 +19,6 @@
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.ui.refactoring.RenameSupport;
import org.eclipse.swt.widgets.Shell;
@@ -91,8 +90,24 @@
}
public void testWarProjectRename() throws CoreException {
- RenameSupport support = RenameSupport.create(JavaCore.create(warProject), "NewWarProjectName", RenameSupport.UPDATE_REFERENCES);
+ renameProject(warProject, "NewWarProjectName");
+ String newParentName = seamEjbProject.getParentProjectName();
+ assertEquals("NewWarProjectName", newParentName);
+ newParentName = seamTestProject.getParentProjectName();
+ assertEquals("NewWarProjectName", newParentName);
+ }
+
+ public void testEjbProjectRename() throws CoreException {
+ renameProject(ejbProject, "NewEjbProjectName");
+
+ String newEjbName = SeamCorePlugin.getSeamPreferences(ejbProject).get(ISeamFacetDataModelProperties.SEAM_EJB_PROJECT, "");
+ assertEquals("NewEjbProjectName", newEjbName);
+ }
+
+ private void renameProject(IProject project, String newProjectName) throws CoreException {
+ RenameSupport support = RenameSupport.create(JavaCore.create(project), newProjectName, RenameSupport.UPDATE_REFERENCES);
+
Shell parent = WorkbenchUtils.getActiveShell();
IWorkbenchWindow context = WorkbenchUtils.getWorkbench().getActiveWorkbenchWindow();
try {
@@ -102,8 +117,7 @@
} catch (InvocationTargetException e) {
JUnitUtils.fail("Rename failed", e);
}
+
EditorTestHelper.joinBackgroundActivities();
- String newParentName = seamEjbProject.getParentProjectName();
- assertEquals("NewWarProjectName", newParentName);
}
}
\ No newline at end of file
18 years
JBoss Tools SVN: r7004 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template: util and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-03-19 08:51:53 -0400 (Wed, 19 Mar 2008)
New Revision: 7004
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractEditableJsfTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCheckboxSelectItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfRadioSelectItemTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/JSF.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1718
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractEditableJsfTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractEditableJsfTemplate.java 2008-03-19 12:10:55 UTC (rev 7003)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractEditableJsfTemplate.java 2008-03-19 12:51:53 UTC (rev 7004)
@@ -34,7 +34,8 @@
* @author Sergey Dzmitrovich
*
*/
-public abstract class AbstractEditableJsfTemplate extends EditableTemplateAdapter {
+public abstract class AbstractEditableJsfTemplate extends
+ EditableTemplateAdapter {
// general jsf attributes
static private Map<String, String> attributes = new HashMap<String, String>();
@@ -168,10 +169,25 @@
setSourceSelection(pageContext, focusedNode, 0,
getLengthNode(focusedNode));
- pageContext.getVisualBuilder().setSelectionRectangle(
- (nsIDOMElement) mappingRealNode.getVisualElement()
- .queryInterface(
- nsIDOMElement.NS_IDOMELEMENT_IID));
+ // visual selection block
+
+ // get visual node
+ focusedVisualNode = getVisualNode(pageContext, focusedNode,
+ mappingRealNode.getElementData());
+
+ // if not find
+ if (focusedVisualNode == null)
+ focusedVisualNode = mappingRealNode.getVisualElement();
+
+ if (focusedVisualNode.getNodeType() != nsIDOMNode.ELEMENT_NODE)
+
+ focusedVisualNode = focusedVisualNode.getParentNode();
+
+ pageContext
+ .getVisualBuilder()
+ .setSelectionRectangle(
+ (nsIDOMElement) focusedVisualNode
+ .queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID));
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java 2008-03-19 12:10:55 UTC (rev 7003)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java 2008-03-19 12:51:53 UTC (rev 7004)
@@ -97,7 +97,7 @@
else {
// create info
- VpeChildrenInfo spanInfo = new VpeChildrenInfo(
+ VpeChildrenInfo targetVisualInfo = new VpeChildrenInfo(
targetVisualElement);
// get atribute's offset
@@ -114,13 +114,13 @@
Node child = list.item(i);
// add info to creation data
- spanInfo.addSourceChild(child);
+ targetVisualInfo.addSourceChild(child);
}
elementData.addAttributeData(new VpeAttributeData(outputAttr,
targetVisualElement, false));
- creationData.addChildrenInfo(spanInfo);
+ creationData.addChildrenInfo(targetVisualInfo);
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCheckboxSelectItemTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCheckboxSelectItemTemplate.java 2008-03-19 12:10:55 UTC (rev 7003)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfCheckboxSelectItemTemplate.java 2008-03-19 12:51:53 UTC (rev 7004)
@@ -1,56 +1,38 @@
/*******************************************************************************
- * 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
- ******************************************************************************/
+ * 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.jsf.template;
-import org.jboss.tools.jsf.vpe.jsf.template.util.NodeProxyUtil;
+import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
import org.jboss.tools.vpe.editor.VpeSourceDomBuilder;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.mapping.VpeNodeMapping;
-import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
-import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMText;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
/**
* @author dmaliarevich
- *
+ *
*/
-public class JsfCheckboxSelectItemTemplate extends VpeAbstractTemplate {
+public class JsfCheckboxSelectItemTemplate extends AbstractOutputJsfTemplate {
- private static final String ITEM_LABEL = "itemLabel";
- private static final String TYPE_CHECKBOX = "checkbox";
- private static final String CLASS = "class";
+ private static final String TYPE_CHECKBOX = "checkbox"; //$NON-NLS-1$
// style of span
private static final String SPAN_STYLE_VALUE = "-moz-user-modify: read-write;"; //$NON-NLS-1$
- /*h:SelectManyCheckbox attributes*/
- private static final String DIR = "dir";
- private static final String DISABLED = "disabled";
- private static final String ENABLED_CLASS = "enabledClass";
- private static final String DISABLED_CLASS = "disabledClass";
-
-
- /* "escape" attribute of f:selectItem */
- private static final String ESCAPE = "escape";
-
- private String escape;
private String dir;
private String disabled;
private String enabledClass;
@@ -62,17 +44,19 @@
public JsfCheckboxSelectItemTemplate() {
}
- /* (non-Javadoc)
- * @see org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools.vpe.editor.context.VpePageContext, org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMDocument)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.tools.vpe.editor.template.VpeTemplate#create(org.jboss.tools.vpe.editor.context.VpePageContext,
+ * org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMDocument)
*/
public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
nsIDOMDocument visualDocument) {
-
+
readParentAttributes(sourceNode.getParentNode());
- readAttributes(sourceNode);
-
+
Element element = (Element) sourceNode;
-
+
nsIDOMElement input = visualDocument.createElement(HTML.TAG_INPUT);
nsIDOMElement label = visualDocument.createElement(HTML.TAG_LABEL);
// create span element
@@ -90,41 +74,19 @@
if (attrPresents(dir)) {
input.setAttribute(HTML.ATTR_DIR, dir);
}
-
- if (attrPresents(disabled) && "true".equalsIgnoreCase(disabled)) {
- label.setAttribute(CLASS, disabledClass);
+
+ if (attrPresents(disabled) && "true".equalsIgnoreCase(disabled)) { //$NON-NLS-1$
+ label.setAttribute(HTML.ATTR_CLASS, disabledClass);
} else if (attrPresents(enabledClass)) {
- label.setAttribute(CLASS, enabledClass);
+ label.setAttribute(HTML.ATTR_CLASS, enabledClass);
}
label.appendChild(labelSpan);
span.appendChild(input);
span.appendChild(label);
-
- Attr attr = null;
- if (element.hasAttribute(ITEM_LABEL)) {
- attr = element.getAttributeNode(ITEM_LABEL);
- }
- if (null != attr) {
- if (null == escape || "true".equalsIgnoreCase(escape)) {
- // show text as is
- String itemLabel = attr.getNodeValue();
- labelSpan.appendChild(visualDocument.createTextNode(itemLabel));
- } else {
- // show formatted text
- VpeChildrenInfo labelSpanInfo = new VpeChildrenInfo(labelSpan);
- // re-parse attribute's value
- NodeList list = NodeProxyUtil.reparseAttributeValue(attr);
- // add children to info
- for (int i = 0; i < list.getLength(); i++) {
- Node child = list.item(i);
- // add info to creation data
- labelSpanInfo.addSourceChild(child);
- }
- creationData.addChildrenInfo(labelSpanInfo);
- }
- }
+ processOutputAttribute(pageContext, visualDocument, element, labelSpan,
+ creationData);
return creationData;
}
@@ -132,12 +94,13 @@
/**
* Checks is attribute presents.
*
- * @param attr the attribute
+ * @param attr
+ * the attribute
*
* @return true, if successful
*/
private boolean attrPresents(String attr) {
- return ((null != attr) && (!"".equals(attr)));
+ return ((null != attr) && (!"".equals(attr))); //$NON-NLS-1$
}
/**
@@ -166,32 +129,20 @@
/**
* Read attributes from the h:SelectManyCheckbox element.
*
- * @param sourceNode the source node
+ * @param sourceNode
+ * the source node
*/
private void readParentAttributes(Node sourceNode) {
if (null == sourceNode) {
return;
}
Element source = (Element) sourceNode;
- dir = source.getAttribute(DIR);
- disabled = source.getAttribute(DISABLED);
- enabledClass = source.getAttribute(ENABLED_CLASS);
- disabledClass = source.getAttribute(DISABLED_CLASS);
+ dir = source.getAttribute(JSF.ATTR_DIR);
+ disabled = source.getAttribute(JSF.ATTR_DISABLED);
+ enabledClass = source.getAttribute(JSF.ATTR_ENABLED_CLASS);
+ disabledClass = source.getAttribute(JSF.ATTR_DISABLED_CLASS);
}
- /**
- * Read attributes from the source element.
- *
- * @param sourceNode the source node
- */
- private void readAttributes(Node sourceNode) {
- if (null == sourceNode) {
- return;
- }
- Element source = (Element) sourceNode;
- escape = source.getAttribute(ESCAPE);
- }
-
@Override
public void setSourceAttributeSelection(VpePageContext pageContext,
Element sourceElement, int offset, int length, Object data) {
@@ -199,4 +150,19 @@
sourceBuilder.setSelection(sourceElement, 0, 0);
}
+ @Override
+ protected Attr getOutputAttributeNode(Element element) {
+
+ if (element.hasAttribute(JSF.ATTR_ITEM_LABEL))
+ return element.getAttributeNode(JSF.ATTR_ITEM_LABEL);
+ return null;
+ }
+
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfRadioSelectItemTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfRadioSelectItemTemplate.java 2008-03-19 12:10:55 UTC (rev 7003)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfRadioSelectItemTemplate.java 2008-03-19 12:51:53 UTC (rev 7004)
@@ -12,21 +12,16 @@
import org.eclipse.wst.xml.core.internal.document.ElementImpl;
import org.jboss.tools.jsf.vpe.jsf.template.util.ComponentUtil;
-import org.jboss.tools.jsf.vpe.jsf.template.util.NodeProxyUtil;
+import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.mapping.VpeAttributeData;
-import org.jboss.tools.vpe.editor.mapping.VpeElementData;
-import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMText;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
/**
* @author sdzmitrovich
@@ -34,7 +29,7 @@
* template for radio select item
*
*/
-public class JsfRadioSelectItemTemplate extends AbstractEditableJsfTemplate{
+public class JsfRadioSelectItemTemplate extends AbstractOutputJsfTemplate {
/* "itemDisabled" attribute of f:selectItem */
public static final String ITEM_DISABLED = "itemDisabled"; //$NON-NLS-1$
@@ -48,20 +43,10 @@
// style of span
private static final String SPAN_STYLE_VALUE = "-moz-user-modify: read-write;"; //$NON-NLS-1$
- /* "itemLabel" attribute of f:selectItem */
- private static final String ITEM_LABEL = "itemLabel"; //$NON-NLS-1$
-
- /* "escape" attribute of f:selectItem */
- private static final String ESCAPE = "escape"; //$NON-NLS-1$
-
- /* "dir" attribute of f:selectSelectOneRadio */
- private static final String DIR = "dir"; //$NON-NLS-1$
-
private static final String CONSTANT_TRUE = "true"; //$NON-NLS-1$
private static final String CONSTANT_EMPTY = ""; //$NON-NLS-1$
private String dir;
- private String escape;
/**
*
@@ -82,7 +67,6 @@
Element element = (Element) sourceNode;
- VpeElementData elementData = new VpeElementData();
// create table element
nsIDOMElement table = visualDocument.createElement(HTML.TAG_TABLE);
boolean disabledItem = ComponentUtil.string2boolean(ComponentUtil
@@ -100,8 +84,7 @@
table.appendChild(label);
if (null != element) {
- escape = element.getAttribute(ESCAPE);
- dir = element.getAttribute(DIR);
+ dir = element.getAttribute(JSF.ATTR_DIR);
}
VpeCreationData creationData = new VpeCreationData(table);
@@ -117,47 +100,9 @@
radio.setAttribute(HTML.ATTR_DIR, dir);
}
- Attr attr = null;
- if (element.hasAttribute(ITEM_LABEL)) {
- attr = element.getAttributeNode(ITEM_LABEL);
- }
+ processOutputAttribute(pageContext, visualDocument, element, label,
+ creationData);
- if (null != attr) {
- if (null == escape || "true".equalsIgnoreCase(escape)) {
- // show text as is
-
- String itemLabel = attr.getNodeValue();
- String bundleValue = ComponentUtil.getBundleValue(pageContext,
- attr);
-
- nsIDOMText text;
- // if bundleValue differ from value then will be represent
- // bundleValue, but text will be not edit
- boolean isEditable = itemLabel.equals(bundleValue);
-
- text = visualDocument.createTextNode(bundleValue);
- // add attribute for ability of editing
-
- elementData.addAttributeData(new VpeAttributeData(attr, text,
- isEditable));
- label.appendChild(text);
- } else {
- // show formatted text
- VpeChildrenInfo labelSpanInfo = new VpeChildrenInfo(label);
- // re-parse attribute's value
- NodeList list = NodeProxyUtil.reparseAttributeValue(attr);
- // add children to info
- for (int i = 0; i < list.getLength(); i++) {
- Node child = list.item(i);
- // add info to creation data
- labelSpanInfo.addSourceChild(child);
- }
- elementData.addAttributeData(new VpeAttributeData(attr, label,
- false));
- creationData.addChildrenInfo(labelSpanInfo);
- }
- }
- creationData.setElementData(elementData);
return creationData;
}
@@ -222,4 +167,19 @@
return ((null != attr) && (!CONSTANT_EMPTY.equals(attr)));
}
+ @Override
+ protected Attr getOutputAttributeNode(Element element) {
+
+ if (element.hasAttribute(JSF.ATTR_ITEM_LABEL))
+ return element.getAttributeNode(JSF.ATTR_ITEM_LABEL);
+ return null;
+ }
+
+ @Override
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/JSF.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/JSF.java 2008-03-19 12:10:55 UTC (rev 7003)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/JSF.java 2008-03-19 12:51:53 UTC (rev 7004)
@@ -29,4 +29,14 @@
public static final String ATTR_FOR = "for"; //$NON-NLS-1$
+ public static final String ATTR_ITEM_LABEL = "itemLabel"; //$NON-NLS-1$
+
+ public static final String ATTR_DISABLED = "disabled"; //$NON-NLS-1$
+
+ public static final String ATTR_ENABLED_CLASS = "enabledClass"; //$NON-NLS-1$
+
+ public static final String ATTR_DISABLED_CLASS = "disabledClass"; //$NON-NLS-1$
+
+ public static final String ATTR_STYLE_CLASS = "styleClass"; //$NON-NLS-1$
+
}
18 years
JBoss Tools SVN: r7003 - in trunk/seam/plugins/org.jboss.tools.seam.ui: src/org/jboss/tools/seam/ui and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2008-03-19 08:10:55 -0400 (Wed, 19 Mar 2008)
New Revision: 7003
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/factory.gif
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUiImages.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java
Log:
JBIDE-1915
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/factory.gif
===================================================================
(Binary files differ)
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.ui/icons/view/factory.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUiImages.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUiImages.java 2008-03-19 11:44:24 UTC (rev 7002)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamUiImages.java 2008-03-19 12:10:55 UTC (rev 7003)
@@ -37,6 +37,7 @@
public static final Image JAVA_IMAGE = getImage("view/java.gif"); //$NON-NLS-1$
public static final Image JAVA_BINARY_IMAGE = getImage("view/java_binary.gif"); //$NON-NLS-1$
public static final Image PACKAGE_IMAGE = getImage("view/package.gif"); //$NON-NLS-1$
+ public static final Image FACTORY_IMAGE = getImage("view/factory.gif"); //$NON-NLS-1$
public static String SEAM_CREATE_PROJECT_ACTION = "view/seam_project_new.gif"; //$NON-NLS-1$
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java 2008-03-19 11:44:24 UTC (rev 7002)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/SeamLabelProvider.java 2008-03-19 12:10:55 UTC (rev 7003)
@@ -30,6 +30,7 @@
import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamComponentDeclaration;
import org.jboss.tools.seam.core.ISeamElement;
+import org.jboss.tools.seam.core.ISeamFactory;
import org.jboss.tools.seam.core.ISeamJavaComponentDeclaration;
import org.jboss.tools.seam.core.ISeamJavaSourceReference;
import org.jboss.tools.seam.core.ISeamPackage;
@@ -118,6 +119,9 @@
return name;
} else if (element instanceof IRole) {
return "" + ((IRole)element).getName(); //$NON-NLS-1$
+ } else if (element instanceof ISeamFactory) {
+ ISeamFactory f = (ISeamFactory)element;
+ return f.getName() + " - " + f.getSourcePath();
} else if(element instanceof ISeamJavaSourceReference) {
ISeamJavaSourceReference d = (ISeamJavaSourceReference)element;
IMember m = d.getSourceMember();
@@ -149,6 +153,8 @@
return SeamUiImages.COMPONENT_IMAGE;
} else if(obj instanceof IRole) {
return SeamUiImages.ROLE_IMAGE;
+ } else if(obj instanceof ISeamFactory) {
+ return SeamUiImages.FACTORY_IMAGE;
} else if(obj instanceof ISeamJavaComponentDeclaration) {
ISeamJavaComponentDeclaration d = (ISeamJavaComponentDeclaration)obj;
IType type = (IType)d.getSourceMember();
18 years
JBoss Tools SVN: r7002 - trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template.
by jbosstools-commits@lists.jboss.org
Author: dsakovich
Date: 2008-03-19 07:44:24 -0400 (Wed, 19 Mar 2008)
New Revision: 7002
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFMediaOutput.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFReapeatTemplate.java
Log:
Code adjustment
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFMediaOutput.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFMediaOutput.java 2008-03-19 11:30:49 UTC (rev 7001)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFMediaOutput.java 2008-03-19 11:44:24 UTC (rev 7002)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.jsf.vpe.ajax4jsf.template;
import java.io.File;
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFReapeatTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFReapeatTemplate.java 2008-03-19 11:30:49 UTC (rev 7001)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.ajax4jsf/src/org/jboss/tools/jsf/vpe/ajax4jsf/template/Ajax4JSFReapeatTemplate.java 2008-03-19 11:44:24 UTC (rev 7002)
@@ -1,13 +1,26 @@
+/*******************************************************************************
+ * 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.jsf.vpe.ajax4jsf.template;
-
import org.jboss.tools.vpe.editor.context.VpePageContext;
import org.jboss.tools.vpe.editor.template.VpeAbstractTemplate;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.mozilla.interfaces.nsIDOMDocument;
-import org.mozilla.interfaces.nsIDOMElement;
import org.w3c.dom.Node;
+/**
+ *
+ * @author Dzmitry Sakovich (dsakovich(a)exadel.com)
+ *
+ */
public class Ajax4JSFReapeatTemplate extends VpeAbstractTemplate {
18 years
JBoss Tools SVN: r7001 - in trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template: util and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: sdzmitrovich
Date: 2008-03-19 07:30:49 -0400 (Wed, 19 Mar 2008)
New Revision: 7001
Added:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/JSF.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputFormatTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputLabelTemplate.java
trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputTextTemplate.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-1718
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java 2008-03-19 00:04:06 UTC (rev 7000)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/AbstractOutputJsfTemplate.java 2008-03-19 11:30:49 UTC (rev 7001)
@@ -1,46 +1,37 @@
package org.jboss.tools.jsf.vpe.jsf.template;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
-import org.jboss.tools.vpe.editor.bundle.BundleMap;
+import org.jboss.tools.jsf.vpe.jsf.template.util.ComponentUtil;
+import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
+import org.jboss.tools.jsf.vpe.jsf.template.util.NodeProxyUtil;
import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.mapping.VpeAttributeData;
+import org.jboss.tools.vpe.editor.mapping.VpeElementData;
+import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
+import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.util.HTML;
+import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
+import org.mozilla.interfaces.nsIDOMText;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
-public abstract class AbstractOutputJsfTemplate extends AbstractEditableJsfTemplate {
+public abstract class AbstractOutputJsfTemplate extends
+ AbstractEditableJsfTemplate {
/**
- * name of "value" attribute
- */
- protected static final String VALUE_ATTR_NAME = "value";
-
- /**
- * name of "binding" attribute
- */
- protected static final String BINDING_ATTR_NAME = "binding";
-
- /**
- * name of "escape" attribute
- */
- protected static final String ESCAPE_ATTR_NAME = "escape";
-
- /**
- * name of "dir" attribute
- */
- protected static final String DIR_ATTR_NAME = "dir";
-
- /**
*
* @param element
* @return
*/
protected Attr getOutputAttributeNode(Element element) {
- if (element.hasAttribute(VALUE_ATTR_NAME))
- return element.getAttributeNode(VALUE_ATTR_NAME);
- else if (element.hasAttribute(BINDING_ATTR_NAME))
- return element.getAttributeNode(BINDING_ATTR_NAME);
+ if (element.hasAttribute(JSF.ATTR_VALUE))
+ return element.getAttributeNode(JSF.ATTR_VALUE);
+ else if (element.hasAttribute(JSF.ATTR_BINDING))
+ return element.getAttributeNode(JSF.ATTR_BINDING);
return null;
@@ -55,8 +46,93 @@
protected void copyOutputJsfAttributes(nsIDOMElement visualElement,
Element sourceElement) {
copyGeneralJsfAttributes(visualElement, sourceElement);
- copyAttribute(visualElement, sourceElement, DIR_ATTR_NAME,
- HTML.ATTR_DIR);
+ copyAttribute(visualElement, sourceElement, JSF.ATTR_DIR, HTML.ATTR_DIR);
}
+
+ /**
+ *
+ * @param pageContext
+ * @param visualDocument
+ * @param sourceElement
+ * @param targetVisualElement
+ * @param creationData
+ */
+ protected void processOutputAttribute(VpePageContext pageContext,
+ nsIDOMDocument visualDocument, Element sourceElement,
+ nsIDOMElement targetVisualElement, VpeCreationData creationData) {
+
+ VpeElementData elementData = new VpeElementData();
+
+ Attr outputAttr = getOutputAttributeNode(sourceElement);
+
+ // prepare value
+ String newValue = prepareAttrValue(pageContext, sourceElement,
+ outputAttr);
+
+ if (outputAttr != null) {
+ // if escape then contents of value (or other attribute) is only
+ // text
+ if (!sourceElement.hasAttribute(JSF.ATTR_ESCAPE)
+ || "true".equalsIgnoreCase(sourceElement //$NON-NLS-1$
+ .getAttribute(JSF.ATTR_ESCAPE))) {
+
+ String value = outputAttr.getNodeValue();
+
+ nsIDOMText text;
+ // if bundleValue differ from value then will be represent
+ // bundleValue, but text will be not edit
+ boolean isEditable = value.equals(newValue);
+
+ text = visualDocument.createTextNode(newValue);
+ // add attribute for ability of editing
+
+ elementData.addAttributeData(new VpeAttributeData(outputAttr,
+ text, isEditable));
+
+ targetVisualElement.appendChild(text);
+
+ }
+ // then text can be html code
+ else {
+
+ // create info
+ VpeChildrenInfo spanInfo = new VpeChildrenInfo(
+ targetVisualElement);
+
+ // get atribute's offset
+ int offset = ((IDOMAttr) outputAttr)
+ .getValueRegionStartOffset();
+
+ // reparse attribute's value
+ NodeList list = NodeProxyUtil.reparseAttributeValue(newValue,
+ offset);
+
+ // add children to info
+ for (int i = 0; i < list.getLength(); i++) {
+
+ Node child = list.item(i);
+
+ // add info to creation data
+ spanInfo.addSourceChild(child);
+ }
+
+ elementData.addAttributeData(new VpeAttributeData(outputAttr,
+ targetVisualElement, false));
+
+ creationData.addChildrenInfo(spanInfo);
+
+ }
+
+ creationData.setElementData(elementData);
+
+ }
+
+ }
+
+ protected String prepareAttrValue(VpePageContext pageContext,
+ Element parent, Attr attr) {
+
+ return ComponentUtil.getBundleValue(pageContext, attr);
+ }
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputFormatTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputFormatTemplate.java 2008-03-19 00:04:06 UTC (rev 7000)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputFormatTemplate.java 2008-03-19 11:30:49 UTC (rev 7001)
@@ -17,16 +17,12 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.jboss.tools.jsf.vpe.jsf.template.util.ComponentUtil;
-import org.jboss.tools.jsf.vpe.jsf.template.util.NodeProxyUtil;
+import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.mapping.VpeAttributeData;
-import org.jboss.tools.vpe.editor.mapping.VpeElementData;
-import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMText;
import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -41,11 +37,6 @@
public class JsfOutputFormatTemplate extends AbstractOutputJsfTemplate {
/**
- * name of "param" tag
- */
- private static final String PARAM_NAME = "param"; //$NON-NLS-1$
-
- /**
* name of "choice"
*/
private static final String CHOICE_NAME = "choice"; //$NON-NLS-1$
@@ -81,8 +72,6 @@
Element element = (Element) sourceNode;
- VpeElementData elementData = new VpeElementData();
-
// create span element
nsIDOMElement span = visualDocument.createElement(HTML.TAG_SPAN);
@@ -92,68 +81,9 @@
// copy attributes
copyOutputJsfAttributes(span, element);
- // get attribute to represent
- Attr attr = getOutputAttributeNode(element);
+ processOutputAttribute(pageContext, visualDocument, element, span,
+ creationData);
- if (attr != null) {
-
- // offset of attr
- int offset = ((IDOMAttr) attr).getValueRegionStartOffset();
-
- // value of attribute
- String value = attr.getNodeValue();
-
- // find parameters and update value
- String newValue = updateNodeValue(value, getParams(element));
- // if escape then contents of value (or other attribute) is only
- // text
- if (!element.hasAttribute(ESCAPE_ATTR_NAME)
- || "true".equalsIgnoreCase(element
- .getAttribute(ESCAPE_ATTR_NAME))) {
-
- // get bundle value
- newValue = ComponentUtil.getBundleValue(pageContext, newValue, offset);
-
- nsIDOMText text;
- // if bundleValue differ from value then will be represent
- // bundleValue, but text will be not edit
- boolean isEditable = value.equals(newValue);
-
- text = visualDocument.createTextNode(newValue);
- // add attribute for ability of editing
- elementData.addAttributeData(new VpeAttributeData(attr, text,
- isEditable));
-
- span.appendChild(text);
- }
- // then text can be html code
- else {
-
- // create info
- VpeChildrenInfo spanInfo = new VpeChildrenInfo(span);
-
- // reparse attribute's value
- NodeList list = NodeProxyUtil.reparseAttributeValue(newValue,
- offset);
-
- // add children to info
- for (int i = 0; i < list.getLength(); i++) {
-
- Node child = list.item(i);
-
- spanInfo.addSourceChild(child);
- }
- elementData.addAttributeData(new VpeAttributeData(attr, span,
- false));
-
- creationData.addChildrenInfo(spanInfo);
-
- }
-
- }
-
- creationData.setElementData(elementData);
-
return creationData;
}
@@ -166,6 +96,16 @@
return true;
}
+ @Override
+ protected String prepareAttrValue(VpePageContext pageContext,
+ Element parent, Attr attr) {
+ int offset = ((IDOMAttr) attr).getValueRegionStartOffset();
+
+ String newString = prepareAttrValueByParams(attr.getNodeValue(),
+ getParams(parent));
+ return ComponentUtil.getBundleValue(pageContext, newString, offset);
+ }
+
/**
* find message format elements and update value
*
@@ -173,7 +113,8 @@
* @param paramList
* @return
*/
- private String updateNodeValue(String nodeValue, List<Element> paramList) {
+ private String prepareAttrValueByParams(String nodeValue,
+ List<Element> paramList) {
// matcher
Matcher matcher = Pattern.compile(MESSAGE_FORMAT_ELEMENTS_PATTERN)
@@ -249,7 +190,7 @@
if (num < paramList.size()) {
// get param's value
- value = paramList.get(num).getAttribute(VALUE_ATTR_NAME);
+ value = paramList.get(num).getAttribute(JSF.ATTR_VALUE);
}
} catch (NumberFormatException e) {
// illegal param value
@@ -299,7 +240,7 @@
Node child = nodeList.item(i);
- if (PARAM_NAME.equals(child.getLocalName()))
+ if (JSF.TAG_PARAM.equals(child.getLocalName()))
params.add((Element) child);
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputLabelTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputLabelTemplate.java 2008-03-19 00:04:06 UTC (rev 7000)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputLabelTemplate.java 2008-03-19 11:30:49 UTC (rev 7001)
@@ -10,21 +10,14 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.jsf.template;
-import org.jboss.tools.jsf.vpe.jsf.template.util.ComponentUtil;
-import org.jboss.tools.jsf.vpe.jsf.template.util.NodeProxyUtil;
+import org.jboss.tools.jsf.vpe.jsf.template.util.JSF;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.mapping.VpeAttributeData;
-import org.jboss.tools.vpe.editor.mapping.VpeElementData;
-import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
-import org.mozilla.interfaces.nsIDOMText;
-import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
/**
* @author Sergey Dzmitrovich
@@ -34,11 +27,6 @@
*/
public class JsfOutputLabelTemplate extends AbstractOutputJsfTemplate {
- /**
- * name of "for" attribute
- */
- protected static final String FOR_ATTR_NAME = "for"; //$NON-NLS-1$
-
/*
* (non-Javadoc)
*
@@ -50,75 +38,19 @@
Element element = (Element) sourceNode;
- VpeElementData elementData = new VpeElementData();
-
// create label element
nsIDOMElement label = visualDocument.createElement(HTML.TAG_LABEL);
// copy attributes
copyOutputJsfAttributes(label, element);
- copyAttribute(label, element, FOR_ATTR_NAME, HTML.ATTR_FOR);
+ copyAttribute(label, element, JSF.ATTR_FOR, HTML.ATTR_FOR);
// creation data
VpeCreationData creationData = new VpeCreationData(label);
- // get attribute to represent
- Attr attr = getOutputAttributeNode(element);
+ processOutputAttribute(pageContext, visualDocument, element, label,
+ creationData);
- if (attr != null) {
-
- // if escape then contents of value (or other attribute) is only
- // text
- if (!element.hasAttribute(ESCAPE_ATTR_NAME)
- || ("true".equalsIgnoreCase(element //$NON-NLS-1$
- .getAttribute(ESCAPE_ATTR_NAME)))) {
-
- String value = attr.getNodeValue();
-
- // get bundle value
- String bundleValue = ComponentUtil.getBundleValue(pageContext, attr);
-
- nsIDOMText text;
- // if bundleValue differ from value then will be represent
- // bundleValue, but text will be not edit
- boolean isEditable = value.equals(bundleValue);
-
- text = visualDocument.createTextNode(bundleValue);
- // add attribute for ability of editing
- elementData.addAttributeData(new VpeAttributeData(attr, text,
- isEditable));
-
- label.appendChild(text);
- }
- // then text can be html code
- else {
-
- // create info
- VpeChildrenInfo labelInfo = new VpeChildrenInfo(label);
-
- // reparse attribute's value
- NodeList list = NodeProxyUtil.reparseAttributeValue(attr);
-
- // add children to info
- for (int i = 0; i < list.getLength(); i++) {
-
- Node child = list.item(i);
-
- labelInfo.addSourceChild(child);
- }
-
- elementData.addAttributeData(new VpeAttributeData(attr, label,
- false));
-
- // add info to creation data
- creationData.addChildrenInfo(labelInfo);
-
- }
-
- }
-
- creationData.setElementData(elementData);
-
return creationData;
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputTextTemplate.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputTextTemplate.java 2008-03-19 00:04:06 UTC (rev 7000)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/JsfOutputTextTemplate.java 2008-03-19 11:30:49 UTC (rev 7001)
@@ -10,22 +10,14 @@
******************************************************************************/
package org.jboss.tools.jsf.vpe.jsf.template;
-import org.jboss.tools.jsf.vpe.jsf.template.util.ComponentUtil;
-import org.jboss.tools.jsf.vpe.jsf.template.util.NodeProxyUtil;
import org.jboss.tools.vpe.editor.context.VpePageContext;
-import org.jboss.tools.vpe.editor.mapping.VpeAttributeData;
-import org.jboss.tools.vpe.editor.mapping.VpeElementData;
-import org.jboss.tools.vpe.editor.template.VpeChildrenInfo;
import org.jboss.tools.vpe.editor.template.VpeCreationData;
import org.jboss.tools.vpe.editor.util.HTML;
import org.mozilla.interfaces.nsIDOMDocument;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNode;
-import org.mozilla.interfaces.nsIDOMText;
-import org.w3c.dom.Attr;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
/**
* @author Sergey Dzmitrovich
@@ -46,8 +38,6 @@
Element element = (Element) sourceNode;
- VpeElementData elementData = new VpeElementData();
-
// create span element
nsIDOMElement span = visualDocument.createElement(HTML.TAG_SPAN);
@@ -57,60 +47,9 @@
// copy attributes
copyOutputJsfAttributes(span, element);
- // get attribute to represent
- Attr attr = getOutputAttributeNode(element);
+ processOutputAttribute(pageContext, visualDocument, element, span,
+ creationData);
- if (attr != null) {
- // if escape then contents of value (or other attribute) is only
- // text
- if (!element.hasAttribute(ESCAPE_ATTR_NAME)
- || "true".equalsIgnoreCase(element //$NON-NLS-1$
- .getAttribute(ESCAPE_ATTR_NAME))) {
-
- String value = attr.getNodeValue();
-
- // get bundle value
- String bundleValue = ComponentUtil.getBundleValue(pageContext, attr);
-
- nsIDOMText text;
- // if bundleValue differ from value then will be represent
- // bundleValue, but text will be not edit
- boolean isEditable = value.equals(bundleValue);
-
- text = visualDocument.createTextNode(bundleValue);
- // add attribute for ability of editing
-
- elementData.addAttributeData(new VpeAttributeData(attr, text,
- isEditable));
- span.appendChild(text);
- }
- // then text can be html code
- else {
-
- // create info
- VpeChildrenInfo spanInfo = new VpeChildrenInfo(span);
-
- // reparse attribute's value
- NodeList list = NodeProxyUtil.reparseAttributeValue(attr);
-
- // add children to info
- for (int i = 0; i < list.getLength(); i++) {
-
- Node child = list.item(i);
-
- // add info to creation data
- spanInfo.addSourceChild(child);
- }
- elementData.addAttributeData(new VpeAttributeData(attr, span,
- false));
- creationData.addChildrenInfo(spanInfo);
-
- }
-
- }
-
- creationData.setElementData(elementData);
-
return creationData;
}
@@ -123,8 +62,12 @@
return true;
}
- /* (non-Javadoc)
- * @see org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#setPseudoContent(org.jboss.tools.vpe.editor.context.VpePageContext, org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMNode, org.mozilla.interfaces.nsIDOMDocument)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.jboss.tools.vpe.editor.template.VpeAbstractTemplate#setPseudoContent(org.jboss.tools.vpe.editor.context.VpePageContext,
+ * org.w3c.dom.Node, org.mozilla.interfaces.nsIDOMNode,
+ * org.mozilla.interfaces.nsIDOMDocument)
*/
@Override
public void setPseudoContent(VpePageContext pageContext,
Added: trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/JSF.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/JSF.java (rev 0)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.vpe.jsf/src/org/jboss/tools/jsf/vpe/jsf/template/util/JSF.java 2008-03-19 11:30:49 UTC (rev 7001)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.vpe.jsf.template.util;
+
+/**
+ *
+ * @author Sergey Dzmitrovich
+ *
+ */
+public class JSF {
+
+ public static final String TAG_PARAM = "param"; //$NON-NLS-1$
+
+ public static final String ATTR_VALUE = "value"; //$NON-NLS-1$
+
+ public static final String ATTR_BINDING = "binding"; //$NON-NLS-1$
+
+ public static final String ATTR_ESCAPE = "escape"; //$NON-NLS-1$
+
+ public static final String ATTR_DIR = "dir"; //$NON-NLS-1$
+
+ public static final String ATTR_FOR = "for"; //$NON-NLS-1$
+
+}
18 years
JBoss Tools SVN: r7000 - trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-03-18 20:04:06 -0400 (Tue, 18 Mar 2008)
New Revision: 7000
Modified:
trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelCreationTest.java
Log:
Fixed last test
Modified: trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelCreationTest.java
===================================================================
--- trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelCreationTest.java 2008-03-18 23:37:09 UTC (rev 6999)
+++ trunk/core/tests/org.jboss.ide.eclipse.archives.test/src/org/jboss/ide/eclipse/archives/test/model/ModelCreationTest.java 2008-03-19 00:04:06 UTC (rev 7000)
@@ -23,6 +23,9 @@
import junit.framework.TestCase;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
@@ -41,6 +44,7 @@
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackage;
import org.jboss.ide.eclipse.archives.core.model.internal.xb.XbPackages;
import org.jboss.ide.eclipse.archives.core.util.ModelUtil;
+import org.jboss.tools.common.test.util.TestProjectProvider;
/**
* @author rob.stryker <rob.stryker(a)redhat.com>
@@ -479,16 +483,29 @@
// should clash, same destinations
public void testArchiveClashingArchiveInModel() {
+ // copy a project
+ TestProjectProvider provider = null;
+ try {
+ provider = new TestProjectProvider("org.jboss.ide.eclipse.archives.test", "/inputs/projects/basicwebproject", "basicwebproject", true);
+ IProject proj = provider.getProject();
+ proj.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ } catch( CoreException ce ) { fail(); }
+
ArchiveModelNode model = createEmptyModelNode();
- IArchive root = createArchive("root.war", "blah");
- IArchive root2 = createArchive("root.war", "blah");
+ IArchive root = createArchive("root.war", "basicwebproject");
+ IArchive root2 = createArchive("root.war", "basicwebproject");
+
try {
model.addChild(root);
model.addChild(root2);
+ fail();
} catch( ArchivesModelException ame ) {
return;
+ } finally {
+ try {
+ provider.dispose();
+ } catch( CoreException ce ) {fail();}
}
- fail();
}
// Should not clash, different destinations
18 years
JBoss Tools SVN: r6999 - in trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test: util and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2008-03-18 19:37:09 -0400 (Tue, 18 Mar 2008)
New Revision: 6999
Modified:
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/CommonAllTests.java
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/util/TestProjectProvider.java
Log:
Tests Exceptions are now checked (coreexception) rather than generic Exception
Modified: trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/CommonAllTests.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/CommonAllTests.java 2008-03-18 23:20:48 UTC (rev 6998)
+++ trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/CommonAllTests.java 2008-03-18 23:37:09 UTC (rev 6999)
@@ -20,7 +20,7 @@
import org.jboss.tools.common.xml.test.XMLUtilitiesTest;
public class CommonAllTests extends TestCase {
-
+ public static final String PLUGIN_ID = "org.jboss.tools.common.test";
public static Test suite ()
{
TestSuite suite = new TestSuite(CommonAllTests.class.getName());
Modified: trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/util/TestProjectProvider.java
===================================================================
--- trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/util/TestProjectProvider.java 2008-03-18 23:20:48 UTC (rev 6998)
+++ trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/util/TestProjectProvider.java 2008-03-18 23:37:09 UTC (rev 6999)
@@ -11,6 +11,7 @@
package org.jboss.tools.common.test.util;
import java.io.File;
+import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Set;
@@ -25,9 +26,12 @@
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.jboss.tools.common.test.CommonAllTests;
import org.jboss.tools.common.util.FileUtil;
import org.osgi.framework.Bundle;
@@ -54,7 +58,7 @@
* to the test workspace; on test completing, the copy is destroyed.
* @throws Exception
*/
- public TestProjectProvider(String bundleName, String projectPath, String name, boolean makeCopy) throws Exception {
+ public TestProjectProvider(String bundleName, String projectPath, String name, boolean makeCopy) throws CoreException {
if(projectPath == null) {
projectPath = "/projects/" + name;
} else if(name == null) {
@@ -68,7 +72,7 @@
return project;
}
- private void init(String bundleName, String projectPath, String name) throws Exception {
+ private void init(String bundleName, String projectPath, String name) throws CoreException {
IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
if(p.exists()) {
project = p;
@@ -83,8 +87,10 @@
URL url = null;
try {
url = FileLocator.resolve(bundle.getEntry(projectPath));
- } catch (Exception e) {
- throw new Exception("Cannot find project " + name + " in " + bundleName);
+ } catch (IOException e) {
+ String msg = "Cannot find project " + name + " in " + bundleName;
+ IStatus status = new Status(IStatus.ERROR, CommonAllTests.PLUGIN_ID, msg, e);
+ throw new CoreException(status);
}
String location = url.getFile();
if(makeCopy) {
@@ -101,7 +107,7 @@
}
}
- static void importExistingProject(IProject project, String location, String name) throws Exception {
+ static void importExistingProject(IProject project, String location, String name) throws CoreException {
IPath path = new Path(location).append(".project");
IProjectDescription description = ResourcesPlugin.getWorkspace().loadProjectDescription(path);
description.setName(name);
@@ -114,7 +120,7 @@
}
}
- public void dispose() throws Exception {
+ public void dispose() throws CoreException {
if(project == null || !project.exists()) return;
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
18 years