JBoss Tools SVN: r3486 - trunk/seam/tests/org.jboss.tools.seam.ui.test.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-09-07 07:24:41 -0400 (Fri, 07 Sep 2007)
New Revision: 3486
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/build.properties
Log:
fix test errors
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/build.properties
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/build.properties 2007-09-07 10:26:18 UTC (rev 3485)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/build.properties 2007-09-07 11:24:41 UTC (rev 3486)
@@ -1,7 +1,9 @@
bin.includes = META-INF/,\
- seam-ui.jar
+ seam-ui.jar,\
+ projects/
source.seam-ui.jar = src/
jars.compile.order = seam-ui.jar
src.includes = src/,\
build.properties,\
- META-INF/
+ META-INF/,\
+ projects/
17 years, 4 months
JBoss Tools SVN: r3485 - in branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces: META-INF and 4 other directories.
by jbosstools-commits@lists.jboss.org
Author: ezheleznyakov
Date: 2007-09-07 06:26:18 -0400 (Fri, 07 Sep 2007)
New Revision: 3485
Added:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/lib/
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/lib/jhighlight-1.0.jar
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInsertTemplate.java
Modified:
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.classpath
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/META-INF/MANIFEST.MF
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/build.properties
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-847
Create <rich:insert> template
Modified: branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.classpath
===================================================================
--- branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.classpath 2007-09-07 10:03:06 UTC (rev 3484)
+++ branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/.classpath 2007-09-07 10:26:18 UTC (rev 3485)
@@ -3,5 +3,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="lib" path="lib/jhighlight-1.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Modified: branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/META-INF/MANIFEST.MF
===================================================================
--- branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/META-INF/MANIFEST.MF 2007-09-07 10:03:06 UTC (rev 3484)
+++ branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/META-INF/MANIFEST.MF 2007-09-07 10:26:18 UTC (rev 3485)
@@ -16,3 +16,5 @@
org.mozilla.xpcom
Eclipse-LazyStart: true
Bundle-Vendor: Red Hat, Inc.
+Bundle-ClassPath: lib/jhighlight-1.0.jar,
+ .
Modified: branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/build.properties
===================================================================
--- branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/build.properties 2007-09-07 10:03:06 UTC (rev 3484)
+++ branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/build.properties 2007-09-07 10:26:18 UTC (rev 3485)
@@ -4,7 +4,8 @@
.,\
resources/,\
templates/,\
- plugin.xml
+ plugin.xml,\
+ lib/jhighlight-1.0.jar
src.includes = src/,\
resources/,\
templates/
Added: branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/lib/jhighlight-1.0.jar
===================================================================
(Binary files differ)
Property changes on: branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/lib/jhighlight-1.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/x-jar
Modified: branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java
===================================================================
--- branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2007-09-07 10:03:06 UTC (rev 3484)
+++ branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/ComponentUtil.java 2007-09-07 10:26:18 UTC (rev 3485)
@@ -7,7 +7,7 @@
*
* Contributors:
* Exadel, Inc. and Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.jsf.vpe.richfaces;
import java.io.File;
@@ -33,32 +33,36 @@
public class ComponentUtil {
/**
- * Gets child of Facet element by name.
- * If facet has a few children the method will return first one.
+ * Gets child of Facet element by name. If facet has a few children the
+ * method will return first one.
+ *
* @param sourceElement
* @param facetName
- * @param returnTextNode return child text node if facet doesn't have any child elements;
+ * @param returnTextNode
+ * return child text node if facet doesn't have any child
+ * elements;
* @return
*/
- public static Node getFacet(Element sourceElement, String facetName, boolean returnTextNode) {
+ public static Node getFacet(Element sourceElement, String facetName,
+ boolean returnTextNode) {
NodeList children = sourceElement.getChildNodes();
- for(int i=0; i<children.getLength(); i++) {
+ for (int i = 0; i < children.getLength(); i++) {
Node node = children.item(i);
- if(node instanceof Element && "f:facet".equals(node.getNodeName())) {
- Element element = (Element)node;
+ if (node instanceof Element && "f:facet".equals(node.getNodeName())) {
+ Element element = (Element) node;
String name = element.getAttribute("name");
- if(facetName.equals(name)) {
+ if (facetName.equals(name)) {
NodeList childNodes = element.getChildNodes();
Text textNode = null;
- for(int j=0; j<childNodes.getLength(); j++) {
+ for (int j = 0; j < childNodes.getLength(); j++) {
Node child = childNodes.item(j);
- if(child instanceof Element) {
+ if (child instanceof Element) {
return child;
- } else if(child instanceof Text) {
- textNode = (Text)child;
+ } else if (child instanceof Text) {
+ textNode = (Text) child;
}
}
- if(returnTextNode) {
+ if (returnTextNode) {
return textNode;
}
}
@@ -68,32 +72,36 @@
}
/**
- * Gets all facets of sourceElement.
- * If facet has a few children the method will return first one.
+ * Gets all facets of sourceElement. If facet has a few children the method
+ * will return first one.
+ *
* @param sourceElement
* @param facetName
- * @param returnTextNode return child text node if facet doesn't have any child elements;
+ * @param returnTextNode
+ * return child text node if facet doesn't have any child
+ * elements;
* @return
*/
- public static ArrayList<Node> getFacets(Element sourceElement, boolean returnTextNode) {
+ public static ArrayList<Node> getFacets(Element sourceElement,
+ boolean returnTextNode) {
ArrayList<Node> facets = new ArrayList<Node>();
NodeList children = sourceElement.getChildNodes();
- for(int i=0; i<children.getLength(); i++) {
+ for (int i = 0; i < children.getLength(); i++) {
Node node = children.item(i);
- if(node instanceof Element && "f:facet".equals(node.getNodeName())) {
- Element element = (Element)node;
+ if (node instanceof Element && "f:facet".equals(node.getNodeName())) {
+ Element element = (Element) node;
NodeList childNodes = element.getChildNodes();
Text textNode = null;
- for(int j=0; j<childNodes.getLength(); j++) {
+ for (int j = 0; j < childNodes.getLength(); j++) {
Node child = childNodes.item(j);
- if(child instanceof Element) {
+ if (child instanceof Element) {
facets.add(child);
break;
- } else if(child instanceof Text) {
- textNode = (Text)child;
+ } else if (child instanceof Text) {
+ textNode = (Text) child;
}
}
- if(returnTextNode && facets.isEmpty()) {
+ if (returnTextNode && facets.isEmpty()) {
facets.add(textNode);
}
}
@@ -102,31 +110,37 @@
}
/**
- * Gets child of Facet element by name.
- * If facet has a few children the method will return first one.
+ * Gets child of Facet element by name. If facet has a few children the
+ * method will return first one.
+ *
* @param sourceElement
* @param facetName
* @return
*/
public static Element getFacet(Element sourceElement, String facetName) {
- return (Element)getFacet(sourceElement, facetName, false);
+ return (Element) getFacet(sourceElement, facetName, false);
}
/**
- * Returns true if "rendered" attribute of source element does not contain "false" value.
+ * Returns true if "rendered" attribute of source element does not contain
+ * "false" value.
+ *
* @param sourceElement
* @return
*/
public static boolean isRendered(Element sourceElement) {
- return !"false".equalsIgnoreCase(sourceElement.getAttribute("rendered"));
+ return !"false"
+ .equalsIgnoreCase(sourceElement.getAttribute("rendered"));
}
/**
* Sets CSS link in visual html document.
+ *
* @param pageContext
* @param cssHref
*/
- public static void setCSSLink(VpePageContext pageContext, String cssHref, String ext) {
+ public static void setCSSLink(VpePageContext pageContext, String cssHref,
+ String ext) {
String pluginPath = RichFacesTemplatesActivator.getPluginResourcePath();
IPath pluginFile = new Path(pluginPath);
File cssFile = pluginFile.append(cssHref).toFile();
@@ -137,104 +151,120 @@
}
public static String getAbsoluteResourcePath(String resourcePathInPlugin) {
- String pluginPath = RichFacesTemplatesActivator.getPluginResourcePath();
- IPath pluginFile = new Path(pluginPath);
- File file = pluginFile.append(resourcePathInPlugin).toFile();
- if (file.exists()) {
- return file.getAbsolutePath();
- } else {
- throw new RuntimeException("Can't get path for " + resourcePathInPlugin);
- }
+ String pluginPath = RichFacesTemplatesActivator.getPluginResourcePath();
+ IPath pluginFile = new Path(pluginPath);
+ File file = pluginFile.append(resourcePathInPlugin).toFile();
+ if (file.exists()) {
+ return file.getAbsolutePath();
+ } else {
+ throw new RuntimeException("Can't get path for "
+ + resourcePathInPlugin);
+ }
}
-
- /**
- * Adds image as attribute to IMG tag
- *
- * @param img
- * @param fileImageName
- */
- public static void setImg(nsIDOMElement img, String fileImageName) {
- img.setAttribute("src", "file://" + getAbsoluteResourcePath(fileImageName));
- }
- /**
- * Returns all child source elements of component but facets.
- * @param sourceElement
- * @param returnTextNodes return child text nodes and elements or elements only;
- * @return
- */
- public static List<Node> getChildren(Element sourceElement, boolean returnTextNodes) {
- ArrayList<Node> children = new ArrayList<Node>();
+ /**
+ * Adds image as attribute to IMG tag
+ *
+ * @param img
+ * @param fileImageName
+ */
+ public static void setImg(nsIDOMElement img, String fileImageName) {
+ img.setAttribute("src", "file://"
+ + getAbsoluteResourcePath(fileImageName));
+ }
+
+ /**
+ * Returns all child source elements of component but facets.
+ *
+ * @param sourceElement
+ * @param returnTextNodes
+ * return child text nodes and elements or elements only;
+ * @return
+ */
+ public static List<Node> getChildren(Element sourceElement,
+ boolean returnTextNodes) {
+ ArrayList<Node> children = new ArrayList<Node>();
NodeList nodeList = sourceElement.getChildNodes();
- for(int i=0; i<nodeList.getLength(); i++) {
+ for (int i = 0; i < nodeList.getLength(); i++) {
Node child = nodeList.item(i);
- if((child instanceof Element || returnTextNodes) && (!child.getNodeName().equals("f:facet"))) {
+ if ((child instanceof Element || returnTextNodes)
+ && (!child.getNodeName().equals("f:facet"))) {
children.add(child);
}
}
- return children;
- }
+ return children;
+ }
- /**
- * Returns all child source elements of component but facets.
- * @param sourceElement
- * @return
- */
- public static List<Node> getChildren(Element sourceElement) {
- return getChildren(sourceElement, false);
- }
-
-
- /**
- * Returns all child visual elements of component but facets.
- * @param visualElement
- * @param
- * @return returnTextNodes return child text nodes and elements or elements only;
- */
- public static List<nsIDOMNode> getChildren(nsIDOMElement visualElement, boolean returnTextNodes) {
- ArrayList<nsIDOMNode> children = new ArrayList<nsIDOMNode>();
+ /**
+ * Returns all child source elements of component but facets.
+ *
+ * @param sourceElement
+ * @return
+ */
+ public static List<Node> getChildren(Element sourceElement) {
+ return getChildren(sourceElement, false);
+ }
+
+ /**
+ * Returns all child visual elements of component but facets.
+ *
+ * @param visualElement
+ * @param
+ * @return returnTextNodes return child text nodes and elements or elements
+ * only;
+ */
+ public static List<nsIDOMNode> getChildren(nsIDOMElement visualElement,
+ boolean returnTextNodes) {
+ ArrayList<nsIDOMNode> children = new ArrayList<nsIDOMNode>();
nsIDOMNodeList nodeList = visualElement.getChildNodes();
- for(int i=0; i<nodeList.getLength(); i++) {
- nsIDOMNode child = nodeList.item(i);
- if((child instanceof nsIDOMElement || returnTextNodes) && (!child.getNodeName().equals("f:facet"))) {
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ nsIDOMNode child = nodeList.item(i);
+ if ((child instanceof nsIDOMElement || returnTextNodes)
+ && (!child.getNodeName().equals("f:facet"))) {
children.add(child);
}
}
- return children;
- }
-
- /**
- * Returns all child visual elements of component but facets.
- * @param visualElement
- * @return
- */
- public static List<nsIDOMNode> getChildren(nsIDOMElement visualElement) {
- return getChildren(visualElement, false);
- }
+ return children;
+ }
- /**
- * Copies all attributes from source node to visual node.
- * @param sourceNode
- * @param visualNode
- */
- public static void copyAttributes(Node sourceNode, nsIDOMElement visualElement) {
+ /**
+ * Returns all child visual elements of component but facets.
+ *
+ * @param visualElement
+ * @return
+ */
+ public static List<nsIDOMNode> getChildren(nsIDOMElement visualElement) {
+ return getChildren(visualElement, false);
+ }
+
+ /**
+ * Copies all attributes from source node to visual node.
+ *
+ * @param sourceNode
+ * @param visualNode
+ */
+ public static void copyAttributes(Node sourceNode,
+ nsIDOMElement visualElement) {
NamedNodeMap namedNodeMap = sourceNode.getAttributes();
for (int i = 0; i < namedNodeMap.getLength(); i++) {
Node attribute = namedNodeMap.item(i);
- visualElement.setAttribute(attribute.getNodeName(), attribute.getNodeValue());
+ visualElement.setAttribute(attribute.getNodeName(), attribute
+ .getNodeValue());
}
}
-
+
/**
* Returns true if sourceNode is Facet
+ *
* @param sourceNode
* @param facetName
* @return
*/
public static boolean isFacet(Node sourceNode, String facetName) {
- if(sourceNode!=null && sourceNode instanceof Element && sourceNode.getNodeName().equals("f:facet")) {
- String name = ((Element)sourceNode).getAttribute("name");
- if(facetName.equals(name)) {
+ if (sourceNode != null && sourceNode instanceof Element
+ && sourceNode.getNodeName().equals("f:facet")) {
+ String name = ((Element) sourceNode).getAttribute("name");
+ if (facetName.equals(name)) {
return true;
}
}
@@ -242,24 +272,29 @@
}
/**
- * Returns Style with background image for default RichFaces skin.
+ * Returns Style with background image for default RichFaces skin.
+ *
* @return
*/
public static String getHeaderBackgoundImgStyle() {
- String imgPath = ComponentUtil.getAbsoluteResourcePath("common/background.gif");
- String style = "background-image: url(file:///" + imgPath.replace('\\', '/') + ");";
+ String imgPath = ComponentUtil
+ .getAbsoluteResourcePath("common/background.gif");
+ String style = "background-image: url(file:///"
+ + imgPath.replace('\\', '/') + ");";
return style;
}
-
+
/**
* Returns value of attribute.
+ *
* @param sourceElement
* @param attributeName
* @return
*/
- public static String getAttribute(Element sourceElement, String attributeName) {
+ public static String getAttribute(Element sourceElement,
+ String attributeName) {
String attribute = sourceElement.getAttribute(attributeName);
- if(attribute==null) {
+ if (attribute == null) {
attribute = "";
}
return attribute;
@@ -267,18 +302,20 @@
/**
* Returns value of attribute.
+ *
* @param sourceElement
* @param attributeName
* @return
*/
- public static String getAttribute(nsIDOMElement sourceElement, String attributeName) {
+ public static String getAttribute(nsIDOMElement sourceElement,
+ String attributeName) {
String attribute = sourceElement.getAttribute(attributeName);
- if(attribute==null) {
+ if (attribute == null) {
attribute = "";
}
return attribute;
}
-
+
/**
* @param style
* @param name
@@ -305,51 +342,78 @@
*/
public static String addParameter(String style, String element) {
String s = style.trim();
- return style + (s.length() == 0 || s.endsWith(";") ? "" : ";") + element;
+ return style + (s.length() == 0 || s.endsWith(";") ? "" : ";")
+ + element;
}
-
- /** Adds image as attribute to IMG tag from users worcpace
- * @param pageContext Page Context
- * @param img img element to which set picture
- * @param fileImageName image name
- * @param undefinedImgName default image when image is undefined
+
+ /**
+ * Adds image as attribute to IMG tag from users worcpace
+ *
+ * @param pageContext
+ * Page Context
+ * @param img
+ * img element to which set picture
+ * @param fileImageName
+ * image name
+ * @param undefinedImgName
+ * default image when image is undefined
*/
- public static void setImgFromResources(VpePageContext pageContext, nsIDOMElement img, String fileImageName, String undefinedImgName) {
- IEditorInput input = pageContext.getEditPart().getEditorInput();
- IPath inputPath = getInputParentPath(input);
- File file=new File(inputPath.toOSString()+File.separator+fileImageName);
- if(file.exists()){
- img.setAttribute(HtmlComponentUtil.HTML_ATR_SRC,
- HtmlComponentUtil.FILE_PROTOCOL+inputPath.toOSString()+
- File.separator+fileImageName);
- } else {
- img.setAttribute(HtmlComponentUtil.HTML_ATR_SRC, undefinedImgName);
+ public static void setImgFromResources(VpePageContext pageContext,
+ nsIDOMElement img, String fileImageName, String undefinedImgName) {
+ IEditorInput input = pageContext.getEditPart().getEditorInput();
+ IPath inputPath = getInputParentPath(input);
+ File file = new File(inputPath.toOSString() + File.separator
+ + fileImageName);
+ if (file.exists()) {
+ img.setAttribute(HtmlComponentUtil.HTML_ATR_SRC,
+ HtmlComponentUtil.FILE_PROTOCOL + inputPath.toOSString()
+ + File.separator + fileImageName);
+ } else {
+ img.setAttribute(HtmlComponentUtil.HTML_ATR_SRC, undefinedImgName);
}
}
- /**
- * Returns locale of user input
- * @param input
- * @return
- */
+ /**
+ * Open file
+ *
+ * @param pageContext
+ * Page Context
+ * @param fileName
+ * file name
+ * @return file
+ */
+ public static File openFile(VpePageContext pageContext, String fileName) {
+ IEditorInput input = pageContext.getEditPart().getEditorInput();
+ IPath inputPath = getInputParentPath(input);
+ File file = new File(inputPath.toOSString() + File.separator + fileName);
+ return file;
+ }
+
+ /**
+ * Returns locale of user input
+ *
+ * @param input
+ * @return
+ */
public static IPath getInputParentPath(IEditorInput input) {
- IPath inputPath = null;
+ IPath inputPath = null;
if (input instanceof ILocationProvider) {
- inputPath = ((ILocationProvider)input).getPath(input);
+ inputPath = ((ILocationProvider) input).getPath(input);
} else if (input instanceof IFileEditorInput) {
- IFile inputFile = ((IFileEditorInput)input).getFile();
- if (inputFile != null) {
- inputPath = inputFile.getLocation();
- }
+ IFile inputFile = ((IFileEditorInput) input).getFile();
+ if (inputFile != null) {
+ inputPath = inputFile.getLocation();
+ }
}
if (inputPath != null && !inputPath.isEmpty()) {
- inputPath = inputPath.removeLastSegments(1);
+ inputPath = inputPath.removeLastSegments(1);
}
- return inputPath;
+ return inputPath;
}
/**
* Move attributes from sourceNode to html
+ *
* @param sourceNode
* @param visualNode
* @param attrName
@@ -357,10 +421,12 @@
* @param prefValue
* @param defValue
*/
- public static void correctAttribute(Element sourceNode, nsIDOMElement visualNode,
- String attrName, String htmlAttrName, String prefValue, String defValue) {
+ public static void correctAttribute(Element sourceNode,
+ nsIDOMElement visualNode, String attrName, String htmlAttrName,
+ String prefValue, String defValue) {
String attrValue = ((Element) sourceNode).getAttribute(attrName);
- if (prefValue != null && prefValue.trim().length() > 0 && attrValue != null) {
+ if (prefValue != null && prefValue.trim().length() > 0
+ && attrValue != null) {
attrValue = prefValue.trim() + " " + attrValue;
}
if (attrValue != null) {
Added: branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInsertTemplate.java
===================================================================
--- branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInsertTemplate.java (rev 0)
+++ branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInsertTemplate.java 2007-09-07 10:26:18 UTC (rev 3485)
@@ -0,0 +1,276 @@
+/*******************************************************************************
+ * 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.richfaces.template;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.StringBufferInputStream;
+import java.util.HashMap;
+import java.util.Set;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.jboss.tools.jsf.vpe.richfaces.ComponentUtil;
+import org.jboss.tools.jsf.vpe.richfaces.HtmlComponentUtil;
+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.mozilla.interfaces.nsIDOMText;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
+import com.uwyn.jhighlight.renderer.Renderer;
+import com.uwyn.jhighlight.renderer.XhtmlRendererFactory;
+
+/**
+ *
+ * @author ezheleznyakov(a)exadel.com
+ *
+ */
+public class RichFacesInsertTemplate extends VpeAbstractTemplate {
+
+ private static String SRC_ATTR_NAME = "src";
+ private static String HIGHTLIGHT_ATTR_NAME = "highlight";
+
+ private static String CODE_TAG = "code>";
+
+ private static String CLASS = "class=";
+
+ private static String STYLE = "style=";
+
+ private static String OPEN_BRACKET = "{";
+
+ private static String CLOSE_BRACKET = "}";
+
+ private static String SPACE = " ";
+
+ private static String SPAN_TAG = "<span style=\"color: rgb(255,255,255)\">_</span>";
+
+ private static String EMPTY_STRING = "";
+
+ private nsIDOMDocument visualDocument;
+
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ nsIDOMDocument visualDocument) {
+
+ this.visualDocument = visualDocument;
+
+ nsIDOMElement div = visualDocument
+ .createElement(HtmlComponentUtil.HTML_TAG_DIV);
+
+ String srcValue = ((Element) sourceNode).getAttribute(SRC_ATTR_NAME);
+ String highlightValue = ((Element) sourceNode)
+ .getAttribute(HIGHTLIGHT_ATTR_NAME);
+
+ VpeCreationData vpeCreationData = new VpeCreationData(div);
+
+ File file = ComponentUtil.openFile(pageContext, srcValue);
+ String finalStr = "";
+ String buf = "";
+
+ try {
+ BufferedReader br = new BufferedReader(new InputStreamReader(
+ new FileInputStream(file)));
+
+ while ((buf = br.readLine()) != null)
+ finalStr += buf + "\n";
+
+ } catch (Exception e) {
+ finalStr = "Resources " + srcValue + " not found.";
+ div.setAttribute(HtmlComponentUtil.HTML_STYLE_ATTR, "color: red; "
+ + "font-weight: bold;");
+ nsIDOMText text = visualDocument.createTextNode(finalStr);
+ div.appendChild(text);
+ return vpeCreationData;
+ }
+
+ if (!serchInSupportedTypes(highlightValue))
+ return vpeCreationData;
+
+ if (highlightValue == null) {
+ finalStr = finalStr.replace('\n', ' ');
+ nsIDOMText text = visualDocument.createTextNode(finalStr);
+ div.appendChild(text);
+ return vpeCreationData;
+ }
+
+ Renderer renderer = XhtmlRendererFactory.getRenderer(highlightValue);
+ String transformStr = null;
+ try {
+ transformStr = renderer.highlight("", finalStr, "utf-8", false);
+ transformStr = convertString(transformStr, highlightValue);
+ Node node = parseTransformString(transformStr);
+ buildVisualNode(node, div);
+ } catch (IOException e1) {
+ return vpeCreationData;
+ }
+ return vpeCreationData;
+ }
+
+ /**
+ *
+ * @param str
+ * @param highlightValue
+ * highlight attribute value
+ */
+ private String convertString(String str, String highlightValue) {
+
+ HashMap<String, String> map = new HashMap<String, String>();
+
+ if (highlightValue.equalsIgnoreCase("html")
+ || highlightValue.equalsIgnoreCase("xhtml")
+ || highlightValue.equalsIgnoreCase("lzx"))
+ highlightValue = "xml";
+ if (highlightValue.equalsIgnoreCase("groovy")) {
+ highlightValue = "java";
+ }
+ if (highlightValue.equalsIgnoreCase("c++")) {
+ highlightValue = "cpp";
+ }
+
+ String sym = "." + highlightValue + "_";
+
+ for (int i = 0; i < str.length();) {
+ int start = str.indexOf(sym, i);
+ if (start == -1)
+ break;
+ int startBracket = str.indexOf(OPEN_BRACKET, start);
+ String key = str.substring(start + 1, startBracket - 1);
+ int endBracket = str.indexOf(CLOSE_BRACKET, startBracket);
+ String value = str.substring(startBracket + 2, endBracket - 2);
+ i = endBracket;
+ map.put(key, value);
+ }
+
+ int start = str.indexOf(CODE_TAG);
+ int end = str.indexOf(CODE_TAG, start + 1);
+ str = str.substring(start - 1, end + 5);
+
+ str = str.replaceAll(CLASS, STYLE);
+
+ Set<String> set = map.keySet();
+
+ for (String key : set) {
+ String value = map.get(key);
+ str = str.replaceAll(key, value);
+ }
+ str = str.replace(SPACE, SPAN_TAG);
+ return str;
+ }
+
+ /**
+ *
+ * @param fileTransform
+ */
+ @SuppressWarnings("deprecation")
+ public Node parseTransformString(String transformString) {
+
+ DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
+
+ DocumentBuilder builder = null;
+ Document doc = null;
+ Node node = null;
+ try {
+ builder = fact.newDocumentBuilder();
+ doc = builder.parse(new StringBufferInputStream(transformString));
+ node = doc.getElementsByTagName("code").item(0);
+ } catch (Exception e) {
+ return node;
+ }
+ return node;
+ }
+
+ /**
+ *
+ * @param highlightValue
+ * value of highlight attribute
+ * @return true of highlight value correct
+ */
+
+ private boolean serchInSupportedTypes(String highlightValue) {
+
+ if (highlightValue == null)
+ return true;
+
+ if (highlightValue.trim().equals(EMPTY_STRING))
+ return false;
+
+ Set<?> set = XhtmlRendererFactory.getSupportedTypes();
+
+ for (Object object : set)
+ if (highlightValue.equalsIgnoreCase((String) object))
+ return true;
+
+ return false;
+ }
+
+ /**
+ *
+ * @param node
+ * @param el
+ * @return
+ */
+ private void buildVisualNode(Node node, nsIDOMElement el) {
+
+ if (node instanceof Text) {
+ nsIDOMText text = visualDocument.createTextNode(node
+ .getTextContent());
+ el.appendChild(text);
+
+ } else {
+ nsIDOMElement elem = visualDocument.createElement(node
+ .getNodeName());
+ el.appendChild(elem);
+
+ for (int i = 0; i < node.getAttributes().getLength(); i++)
+ elem.setAttribute(node.getAttributes().item(i).getNodeName(),
+ node.getAttributes().item(i).getNodeValue());
+
+ for (int i = 0; i < node.getChildNodes().getLength(); i++)
+ buildVisualNode(node.getChildNodes().item(i), elem);
+ }
+ }
+
+ /**
+ * Checks, whether it is necessary to re-create an element at change of
+ * attribute
+ *
+ * @param pageContext
+ * Contains the information on edited page.
+ * @param sourceElement
+ * The current element of the source tree.
+ * @param visualDocument
+ * The document of the visual tree.
+ * @param visualNode
+ * The current node of the visual tree.
+ * @param data
+ * The arbitrary data, built by a method <code>create</code>
+ * @param name
+ * Atrribute name
+ * @param value
+ * Attribute value
+ * @return <code>true</code> if it is required to re-create an element at
+ * a modification of attribute, <code>false</code> otherwise.
+ */
+ public boolean isRecreateAtAttrChange(VpePageContext pageContext,
+ Element sourceElement, nsIDOMDocument visualDocument,
+ nsIDOMElement visualNode, Object data, String name, String value) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/src/org/jboss/tools/jsf/vpe/richfaces/template/RichFacesInsertTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml
===================================================================
--- branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2007-09-07 10:03:06 UTC (rev 3484)
+++ branches/jbosstools_xulrunner/jsf/plugins/org.jboss.tools.jsf.vpe.richfaces/templates/vpe-templates-richfaces.xml 2007-09-07 10:26:18 UTC (rev 3485)
@@ -529,5 +529,18 @@
</span>
</vpe:template>
</vpe:tag>
+
+ <vpe:tag name="rich:insert" case-sensetive="yes">
+ <vpe:template children="yes" modify="yes" class="org.jboss.tools.jsf.vpe.richfaces.template.RichFacesInsertTemplate">
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
+ <vpe:dnd>
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="yes"/>
+ </vpe:dnd>
+ </vpe:template>
+ </vpe:tag>
</vpe:templates>
\ No newline at end of file
17 years, 4 months
JBoss Tools SVN: r3484 - in trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui: internal/project/facet and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-09-07 06:03:06 -0400 (Fri, 07 Sep 2007)
New Revision: 3484
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamGuiPlugin.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencePage.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/TaggedComboFieldEditor.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-825
Seam Runtimes lis added on seam preference page
Seam runtime selection added to seam facet wizard page
JUnit tests for SeamRuntime manager
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamGuiPlugin.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamGuiPlugin.java 2007-09-07 10:02:58 UTC (rev 3483)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/SeamGuiPlugin.java 2007-09-07 10:03:06 UTC (rev 3484)
@@ -10,10 +10,25 @@
******************************************************************************/
package org.jboss.tools.seam.ui;
+import java.util.Properties;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.datatools.connectivity.ConnectionProfileConstants;
+import org.eclipse.datatools.connectivity.ProfileManager;
+import org.eclipse.datatools.connectivity.db.generic.IDBConnectionProfileConstants;
+import org.eclipse.datatools.connectivity.db.generic.IDBDriverDefinitionConstants;
+import org.eclipse.datatools.connectivity.drivers.DriverInstance;
+import org.eclipse.datatools.connectivity.drivers.DriverManager;
+import org.eclipse.datatools.connectivity.drivers.IDriverMgmtConstants;
+import org.eclipse.datatools.connectivity.drivers.IPropertySet;
+import org.eclipse.datatools.connectivity.drivers.PropertySetImpl;
+import org.eclipse.datatools.connectivity.drivers.models.OverrideTemplateDescriptor;
+import org.eclipse.datatools.connectivity.drivers.models.TemplateDescriptor;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.jboss.tools.common.log.BaseUIPlugin;
import org.jboss.tools.common.log.IPluginLog;
+import org.jboss.tools.seam.core.SeamPreferences;
+import org.jboss.tools.seam.core.project.facet.SeamFacetPreference;
import org.osgi.framework.BundleContext;
/**
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-09-07 10:02:58 UTC (rev 3483)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/SeamInstallWizardPage.java 2007-09-07 10:03:06 UTC (rev 3484)
@@ -7,7 +7,7 @@
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
+ ******************************************************************************/
package org.jboss.tools.seam.ui.internal.project.facet;
import java.beans.PropertyChangeEvent;
@@ -23,11 +23,11 @@
import org.eclipse.datatools.connectivity.ProfileManager;
import org.eclipse.datatools.connectivity.db.generic.IDBConnectionProfileConstants;
import org.eclipse.datatools.connectivity.db.generic.ui.NewConnectionProfileWizard;
-import org.eclipse.datatools.connectivity.ui.dse.dialogs.ProfileSelectionComposite;
import org.eclipse.jdt.core.JavaConventions;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jst.j2ee.project.facet.IJ2EEModuleFacetInstallDataModelProperties;
import org.eclipse.swt.SWT;
@@ -47,12 +47,16 @@
import org.hibernate.eclipse.console.utils.DriverClassHelpers;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamFacetPreference;
+import org.jboss.tools.seam.core.project.facet.SeamRuntime;
+import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
+import org.jboss.tools.seam.core.project.facet.SeamVersion;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor;
import org.jboss.tools.seam.ui.widget.editor.CompositeEditor;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditorFactory;
import org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor;
+import org.jboss.tools.seam.ui.widget.editor.SeamRuntimeListFieldEditor.SeamRuntimeNewWizard;
import org.jboss.tools.seam.ui.wizard.SeamFormWizard;
/**
@@ -61,12 +65,13 @@
*/
public class SeamInstallWizardPage extends AbstractFacetWizardPage implements
IFacetWizardPage, IDataModelListener {
-
+
public static final String PAGE_DESCRIPTION = "Configure Seam Facet Settings";
/**
- *
+ *
*/
- boolean seamHomeRequiresSave = SeamFacetPreference.getStringPreference(SeamFacetPreference.SEAM_HOME_FOLDER).equals("");
+ boolean seamHomeRequiresSave = SeamFacetPreference.getStringPreference(
+ SeamFacetPreference.SEAM_HOME_FOLDER).equals("");
/**
*
*/
@@ -81,13 +86,17 @@
*
*/
DataModelValidatorDelegate validatorDelegate;
-
+
IFieldEditor jBossSeamHomeEditor = IFieldEditorFactory.INSTANCE
- .createBrowseFolderEditor(
- ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
- "JBoss Seam Home Folder:",
- SeamFacetPreference
- .getStringPreference(SeamFacetPreference.SEAM_HOME_FOLDER));
+ .createComboWithButton(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
+ "Seam Runtime", getRuntimeNames(), SeamRuntimeManager.getInstance().getDefaultRuntime().getName(), true, new NewSeamRuntimeAction(), (IValidator)null);
+
+// IFieldEditor jBossSeamHomeEditor = IFieldEditorFactory.INSTANCE
+// .createBrowseFolderEditor(
+// ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
+// "JBoss Seam Home Folder:",
+// SeamFacetPreference
+// .getStringPreference(SeamFacetPreference.SEAM_HOME_FOLDER));
IFieldEditor jBossAsDeployAsEditor = IFieldEditorFactory.INSTANCE
.createComboEditor(
ISeamFacetDataModelProperties.JBOSS_AS_DEPLOY_AS,
@@ -100,9 +109,10 @@
IFieldEditor connProfileSelEditor = IFieldEditorFactory.INSTANCE
.createComboWithTwoButtons(
ISeamFacetDataModelProperties.SEAM_CONNECTION_PROFILE,
- "Connection profile:", getProfileNameList(), SeamCorePlugin.getDefault().getPluginPreferences().getString(
- SeamFacetPreference.SEAM_DEFAULT_CONNECTION_PROFILE), true,
- new EditConnectionProfileAction(),
+ "Connection profile:",
+ getProfileNameList(),
+ "DefaultDS",
+ true, new EditConnectionProfileAction(),
new NewConnectionProfileAction(),
ValidatorFactory.NO_ERRORS_VALIDATOR);
IFieldEditor jBossAsDbTypeEditor = IFieldEditorFactory.INSTANCE
@@ -173,8 +183,7 @@
IFieldEditor testsPkgNameditor = IFieldEditorFactory.INSTANCE
.createTextEditor(
ISeamFacetDataModelProperties.TEST_CASES_PACKAGE_NAME,
- "Test Package Name:",
- "com.mydomain.projectname.test");
+ "Test Package Name:", "com.mydomain.projectname.test");
/**
*
@@ -210,24 +219,27 @@
}
/**
- * Finish has been pressed.
+ * Finish has been pressed.
*/
public void transferStateToConfig() {
- if( seamHomeRequiresSave) {
+ if (seamHomeRequiresSave) {
SeamCorePlugin.getDefault().getPluginPreferences().setValue(
- SeamFacetPreference.SEAM_HOME_FOLDER, jBossSeamHomeEditor.getValueAsString());
+ SeamFacetPreference.SEAM_HOME_FOLDER,
+ jBossSeamHomeEditor.getValueAsString());
}
- if("".equals(SeamCorePlugin.getDefault().getPluginPreferences().getString((
- SeamFacetPreference.SEAM_DEFAULT_CONNECTION_PROFILE)))) {
+ if ("".equals(SeamCorePlugin.getDefault().getPluginPreferences()
+ .getString(
+ (SeamFacetPreference.SEAM_DEFAULT_CONNECTION_PROFILE)))) {
SeamCorePlugin.getDefault().getPluginPreferences().setValue(
- SeamFacetPreference.SEAM_DEFAULT_CONNECTION_PROFILE, connProfileSelEditor.getValueAsString());
+ SeamFacetPreference.SEAM_DEFAULT_CONNECTION_PROFILE,
+ connProfileSelEditor.getValueAsString());
}
}
-
/**
* Registers editor in data synchronizer and put SWT controls for it at
* wizard page.
+ *
* @param editor
* @param parent
* @param columns
@@ -238,6 +250,15 @@
editor.doFillIntoGrid(parent);
}
+ public List<String> getRuntimeNames() {
+ SeamRuntime[] rts = SeamRuntimeManager.getInstance().getRuntimes(SeamVersion.SEAM_1_2);
+ List<String> result = new ArrayList<String>();
+ for(SeamRuntime seamRuntime : rts) {
+ result.add(seamRuntime.getName());
+ }
+ return result;
+ }
+
/**
* Creates Seam Facet Wizard Page contents
*/
@@ -300,36 +321,35 @@
setControl(root);
NewProjectDataModelFacetWizard wizard = (NewProjectDataModelFacetWizard) getWizard();
-
+
IDataModel model = wizard.getDataModel();
- if(validatorDelegate==null) {
+ if (validatorDelegate == null) {
validatorDelegate = new DataModelValidatorDelegate(this.model, this);
- validatorDelegate.addValidatorForProperty(
- jBossSeamHomeEditor.getName(),
- ValidatorFactory.JBOSS_SEAM_HOME_FOLDER_VALIDATOR);
- validatorDelegate
- .addValidatorForProperty(connProfileSelEditor.getName(),
- ValidatorFactory.CONNECTION_PROFILE_IS_NOT_SELECTED);
- validatorDelegate
- .addValidatorForProperty(testsPkgNameditor.getName(),
- new PackageNameValidator(
- testsPkgNameditor.getName(), "tests"));
- validatorDelegate
- .addValidatorForProperty(entityBeanPkgNameditor.getName(),
- new PackageNameValidator(
- entityBeanPkgNameditor.getName(), "entity beans"));
- validatorDelegate
- .addValidatorForProperty(sessionBeanPkgNameditor.getName(),
- new PackageNameValidator(
- sessionBeanPkgNameditor.getName(), "session beans"));
- }
-
- jBossAsDbTypeEditor.addPropertyChangeListener(new PropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent evt) {
- jBossHibernateDialectEditor.setValue(HIBERNATE_HELPER.getDialectClass(evt.getNewValue().toString()));
- }
- });
+ validatorDelegate.addValidatorForProperty(jBossSeamHomeEditor
+ .getName(),
+ ValidatorFactory.JBOSS_SEAM_HOME_IS_NOT_SELECTED);
+ validatorDelegate.addValidatorForProperty(connProfileSelEditor
+ .getName(),
+ ValidatorFactory.CONNECTION_PROFILE_IS_NOT_SELECTED);
+ validatorDelegate.addValidatorForProperty(testsPkgNameditor
+ .getName(), new PackageNameValidator(testsPkgNameditor
+ .getName(), "tests"));
+ validatorDelegate.addValidatorForProperty(entityBeanPkgNameditor
+ .getName(), new PackageNameValidator(entityBeanPkgNameditor
+ .getName(), "entity beans"));
+ validatorDelegate.addValidatorForProperty(sessionBeanPkgNameditor
+ .getName(), new PackageNameValidator(
+ sessionBeanPkgNameditor.getName(), "session beans"));
+ }
+
+ jBossAsDbTypeEditor
+ .addPropertyChangeListener(new PropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent evt) {
+ jBossHibernateDialectEditor.setValue(HIBERNATE_HELPER
+ .getDialectClass(evt.getNewValue().toString()));
+ }
+ });
}
/**
@@ -350,7 +370,7 @@
public static final String GENERIC_JDBC_PROVIDER_ID
= "org.eclipse.datatools.connectivity.db.generic.connectionProfile";
-
+
/*
*
*/
@@ -458,7 +478,9 @@
}
}
}
+
+
/**
* It is overridden to fill Code Generation group with the default package
* names
@@ -466,30 +488,33 @@
@Override
public void setVisible(boolean visible) {
sessionBeanPkgNameditor
- .setValue("org.domain."
- + model.getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME)
- + ".session");
+ .setValue("org.domain."
+ + model
+ .getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME)
+ + ".session");
entityBeanPkgNameditor
- .setValue("org.domain."
- + model.getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME)
- + ".entity");
+ .setValue("org.domain."
+ + model
+ .getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME)
+ + ".entity");
testsPkgNameditor
- .setValue("org.domain."
- + model.getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME)
- + ".test");
- if(visible) {
+ .setValue("org.domain."
+ + model
+ .getProperty(IFacetDataModelProperties.FACET_PROJECT_NAME)
+ + ".test");
+ if (visible) {
String message = validatorDelegate.getFirstValidationError();
- this.setPageComplete(message==null);
+ this.setPageComplete(message == null);
this.setMessage(message);
}
super.setVisible(visible);
};
-
+
public class PackageNameValidator implements IValidator {
String fieldName;
String targetName;
-
+
/**
* @param fieldName
* @param targetName
@@ -498,19 +523,47 @@
this.fieldName = fieldName;
this.targetName = targetName;
}
-
+
/**
* @see IValidator#validate(Object, Object)
*/
public Map<String, String> validate(Object value, Object context) {
- IStatus status = JavaConventions.validatePackageName(
- value.toString(),
- CompilerOptions.VERSION_1_5,
- CompilerOptions.VERSION_1_5);
- if(!status.isOK()) {
- return ValidatorFactory.createErrormessage(fieldName, "Package name for " + targetName + " is not valid" );
+ IStatus status = JavaConventions.validatePackageName(value
+ .toString(), CompilerOptions.VERSION_1_5,
+ CompilerOptions.VERSION_1_5);
+ if (!status.isOK()) {
+ return ValidatorFactory.createErrormessage(fieldName,
+ "Package name for " + targetName + " is not valid");
}
return ValidatorFactory.NO_ERRORS;
}
}
+
+ public class NewSeamRuntimeAction extends
+ ButtonFieldEditor.ButtonPressedAction {
+ /**
+ * @param label
+ */
+ public NewSeamRuntimeAction() {
+ super("Add");
+ }
+
+ public void run() {
+ List<SeamRuntime> added = new ArrayList<SeamRuntime>();
+ Wizard wiz = new SeamRuntimeNewWizard((List<SeamRuntime>)
+ new ArrayList<SeamRuntime>(Arrays.asList(SeamRuntimeManager.getInstance().getRuntimes()))
+ ,added);
+ WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wiz);
+ dialog.open();
+
+
+ if (added.size()>0) {
+ SeamRuntimeManager.getInstance().addRuntime(added.get(0));
+ getFieldEditor().setValue(added.get(0).getName());
+ ((ITaggedFieldEditor) ((CompositeEditor) jBossSeamHomeEditor)
+ .getEditors().get(1)).setTags(getRuntimeNames()
+ .toArray(new String[0]));
+ }
+ }
+ }
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java 2007-09-07 10:02:58 UTC (rev 3483)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/internal/project/facet/ValidatorFactory.java 2007-09-07 10:03:06 UTC (rev 3484)
@@ -125,7 +125,6 @@
+ "' points to file");
return NO_ERRORS;
}
-
};
/**
@@ -144,7 +143,6 @@
if (!new File(value.toString(), "seam").isFile()) {
errors = createErrormessage("Seam Home Folde field points to " +
"location that doesn't look like seam home folder");
-
}
return errors;
}
@@ -332,6 +330,17 @@
}
};
+ public static IValidator JBOSS_SEAM_HOME_IS_NOT_SELECTED = new IValidator() {
+ public Map<String, String> validate(Object value, Object context) {
+ if (value == null || "".equals(value.toString().trim())) {
+ return createErrormessage(
+ ISeamFacetDataModelProperties.JBOSS_SEAM_HOME,
+ "Seam Runtime is not selected");
+ }
+ return NO_ERRORS;
+ }
+ };
+
public static CompilationUnit createCompilationUnit(String classDecl,
IProject project) {
ASTParser parser = ASTParser.newParser(AST.JLS3);
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencePage.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencePage.java 2007-09-07 10:02:58 UTC (rev 3483)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencePage.java 2007-09-07 10:03:06 UTC (rev 3484)
@@ -13,6 +13,8 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Map;
import org.eclipse.jface.dialogs.IMessageProvider;
@@ -20,16 +22,17 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamFacetPreference;
-import org.jboss.tools.seam.ui.internal.project.facet.IValidator;
+import org.jboss.tools.seam.core.project.facet.SeamRuntime;
+import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.ui.internal.project.facet.ValidatorFactory;
import org.jboss.tools.seam.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.seam.ui.widget.editor.SeamRuntimeListFieldEditor;
import org.jboss.tools.seam.ui.widget.editor.SwtFieldEditorFactory;
/**
@@ -42,11 +45,9 @@
/**
*
*/
- IFieldEditor editor
- = SwtFieldEditorFactory.INSTANCE.createBrowseFolderEditor(
- "seam.home.folder", "Seam Home Folder:",
- SeamFacetPreference.getStringPreference(SeamFacetPreference.SEAM_HOME_FOLDER));
-
+ SeamRuntimeListFieldEditor seamRuntimes
+ = new SeamRuntimeListFieldEditor("rtlist","Runtime List",new ArrayList<SeamRuntime>(Arrays.asList(SeamRuntimeManager.getInstance().getRuntimes())));
+
/**
*
*/
@@ -75,8 +76,7 @@
Composite root = new Composite(parent, SWT.NONE);
GridLayout gl = new GridLayout(3,false);
root.setLayout(gl);
- editor.doFillIntoGrid(root);
- editor.addPropertyChangeListener(this);
+ seamRuntimes.doFillIntoGrid(root);
return root;
}
@@ -90,15 +90,6 @@
*
*/
public void propertyChange(PropertyChangeEvent arg0) {
- Map errors
- = ValidatorFactory.JBOSS_SEAM_HOME_FOLDER_VALIDATOR.validate(editor.getValue(), null);
- if(errors.size()>0) {
- setValid(false);
- setMessage(errors.get(errors.keySet().iterator().next()).toString(), IMessageProvider.ERROR);
- } else {
- setMessage(null);
- setValid(true);
- }
}
/**
@@ -106,8 +97,11 @@
*/
@Override
protected void performApply() {
- SeamCorePlugin.getDefault().getPluginPreferences().setValue(
- SeamFacetPreference.SEAM_HOME_FOLDER, editor.getValueAsString());
+ for (SeamRuntime rt : seamRuntimes.getAddedSeamRuntimes()) {
+ SeamRuntimeManager.getInstance().addRuntime(rt);
+ }
+ seamRuntimes.getDefaultSeamRuntime().setDefault(true);
+ SeamRuntimeManager.getInstance().save();
}
/**
@@ -115,11 +109,6 @@
*/
@Override
protected void performDefaults() {
- editor.removePropertyChangeListener(this);
- editor.setValue(
- SeamCorePlugin.getDefault().getPluginPreferences().getDefaultString(
- SeamFacetPreference.SEAM_HOME_FOLDER));
- editor.addPropertyChangeListener(this);
setValid(true);
setMessage(null);
performApply();
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java 2007-09-07 10:02:58 UTC (rev 3483)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/IFieldEditorFactory.java 2007-09-07 10:03:06 UTC (rev 3484)
@@ -13,6 +13,7 @@
import java.util.List;
import org.jboss.tools.seam.ui.internal.project.facet.IValidator;
+import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor.ButtonPressedAction;
public interface IFieldEditorFactory {
@@ -123,4 +124,9 @@
ButtonFieldEditor.ButtonPressedAction action2, IValidator validator);
public ButtonFieldEditor.ButtonPressedAction createNotImplementedYetAction(String buttonName);
+
+ public IFieldEditor createComboWithButton(String name, String label,
+ List values, Object defaultValue, boolean flat,
+ ButtonPressedAction action1,
+ IValidator validator);
}
Added: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java 2007-09-07 10:03:06 UTC (rev 3484)
@@ -0,0 +1,451 @@
+/*******************************************************************************
+ * 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.seam.ui.widget.editor;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TableColumn;
+import org.jboss.tools.seam.core.project.facet.SeamRuntime;
+import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
+import org.jboss.tools.seam.core.project.facet.SeamVersion;
+import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.ui.internal.project.facet.ValidatorFactory;
+import org.jboss.tools.seam.ui.wizard.SeamFormWizard;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamRuntimeListFieldEditor extends BaseFieldEditor {
+
+ CheckboxTableViewer tableView = null;
+ Composite root = null;
+ /**
+ * @param name
+ * @param label
+ * @param defaultValue
+ */
+ public SeamRuntimeListFieldEditor(String name, String label, Object defaultValue) {
+ super(name, label, defaultValue);
+
+ }
+
+ private SeamRuntime checkedElement = null;
+
+ /**
+ *
+ * @return
+ */
+ public SeamRuntime getDefaultSeamRuntime() {
+ return checkedElement;
+ }
+
+ private List<SeamRuntime> added = new ArrayList<SeamRuntime>();
+
+ /**
+ *
+ * @return
+ */
+ public List<SeamRuntime> getAddedSeamRuntimes() {
+ return added;
+ }
+
+ private Map<SeamRuntime,SeamRuntime> changed = new HashMap<SeamRuntime,SeamRuntime>();
+
+ /**
+ *
+ * @return
+ */
+ public Map<SeamRuntime,SeamRuntime> getChangedSeamRuntimes() {
+ return changed;
+ }
+
+ private List<SeamRuntime> removed = new ArrayList<SeamRuntime>();
+
+ /**
+ *
+ * @return
+ */
+ public List<SeamRuntime> getRemoved() {
+ return removed;
+ }
+
+ @Override
+ public Object[] getEditorControls(Object composite) {
+
+ root = new Composite((Composite)composite,SWT.NONE);
+ root.setLayout(new GridLayout(2,false));
+ GridData gd = new GridData();
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+ root.setLayoutData(gd);
+
+ tableView = CheckboxTableViewer.newCheckList((Composite) root,
+ SWT.V_SCROLL|SWT.BORDER|SWT.FULL_SELECTION|SWT.SINGLE);
+
+ gd = new GridData();
+ gd.heightHint = 200;
+ gd.horizontalAlignment = GridData.FILL;
+ gd.grabExcessHorizontalSpace = true;
+
+ tableView.getControl().setLayoutData(gd);
+
+ Composite buttons = new Composite(root,SWT.NONE);
+ buttons.setLayout(new GridLayout(1,false));
+ gd = new GridData();
+ gd.horizontalAlignment = GridData.FILL;
+ gd.verticalAlignment = GridData.FILL;
+ gd.grabExcessVerticalSpace = true;
+ buttons.setLayoutData(gd);
+
+ final Button addBtn = new Button(buttons,SWT.PUSH);
+ addBtn.setText("Add");
+ gd = new GridData(GridData.FILL_HORIZONTAL,GridData.CENTER,false,false);
+ gd.horizontalAlignment = GridData.FILL;
+ gd.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
+ gd.widthHint = 50;
+
+ addBtn.setLayoutData(gd);
+ addBtn.addSelectionListener(new SelectionListener() {
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ public void widgetSelected(SelectionEvent e) {
+
+ Wizard wiz = new SeamRuntimeNewWizard((List<SeamRuntime>)getValue(), added);
+ WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wiz);
+ dialog.open();
+ tableView.refresh();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ });
+
+ /*final Button rmBtn = new Button(buttons,SWT.PUSH);
+ rmBtn.setText("Remove");
+ gd = new GridData(GridData.FILL_HORIZONTAL,GridData.CENTER,false,false);
+ gd.horizontalAlignment = GridData.FILL;
+ gd.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
+ rmBtn.setLayoutData(gd);
+
+ final Button editBtn = new Button(buttons,SWT.PUSH);
+ editBtn.setText("Edit");
+ gd = new GridData(GridData.FILL_HORIZONTAL,GridData.CENTER,false,false);
+ gd.horizontalAlignment = GridData.FILL;
+ gd.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
+ editBtn.setLayoutData(gd);*/
+
+ TableColumn tc1 = new TableColumn(tableView.getTable(),SWT.CENTER);
+ tc1.setWidth(21);
+ tc1.setResizable(false);
+
+ TableColumn tc2 = new TableColumn(tableView.getTable(),SWT.LEFT);
+ tc2.setWidth(100);
+ tc2.setText("Name");
+
+ TableColumn tc3 = new TableColumn(tableView.getTable(),SWT.LEFT);
+ tc3.setWidth(50);
+ tc3.setText("Version");
+
+ TableColumn tc4 = new TableColumn(tableView.getTable(),SWT.LEFT);
+ tc4.setWidth(100);
+ tc4.setText("Path");
+
+ tableView.setContentProvider(new IStructuredContentProvider() {
+
+ public Object[] getElements(Object inputElement) {
+ if(inputElement instanceof List)
+ return ((List<SeamRuntime>)inputElement).toArray();
+ else
+ throw new IllegalArgumentException("inputElement must be " +
+ "n instance of List<SeamRuntime>.");
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput,
+ Object newInput) {
+ viewer.refresh();
+ }
+ });
+
+ tableView.setLabelProvider(new ITableLabelProvider() {
+
+ public void addListener(ILabelProviderListener listener) {}
+
+ public void dispose() { }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {}
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ SeamRuntime rt = (SeamRuntime)element;
+ if(columnIndex==0) return "";
+ if(columnIndex==1) return rt.getName();
+ if(columnIndex==2) return rt.getVersion().toString();
+ if(columnIndex==3) return rt.getHomeDir();
+ return "";
+ }
+ });
+
+ tableView.setInput(getValue());
+ tableView.getTable().setLinesVisible(true);
+ tableView.getTable().setHeaderVisible(true);
+ tableView.addCheckStateListener( new ICheckStateListener () {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ if(event.getChecked()) {
+ tableView.setCheckedElements(new Object[]{event.getElement()});
+ //checkedElement.setDefault(false);
+ checkedElement = (SeamRuntime)event.getElement();
+ //checkedElement.setDefault(true);
+ } else if(checkedElement==event.getElement()) {
+ tableView.setCheckedElements(new Object[]{event.getElement()});
+ }
+ pcs.firePropertyChange(getName(), null, getValue());
+ }
+ });
+
+ for (SeamRuntime rt : (List<SeamRuntime>) getValue()) {
+ if(rt.isDefault()) {
+ tableView.setCheckedElements(new Object[]{rt});
+ checkedElement = rt;
+ break;
+ }
+ }
+
+ return new Control[]{tableView.getControl()};
+ }
+
+ @Override
+ public Object[] getEditorControls() {
+ return new Control[]{root};
+ }
+
+ @Override
+ public int getNumberOfControls() {
+ return 1;
+ }
+
+ public static void main (String [] args) {
+ Display display = new Display ();
+ Shell shell = new Shell(display);
+ shell.setLayout(new GridLayout());
+ SeamRuntime rt = new SeamRuntime();
+ rt.setName("rtName1");
+ rt.setDefault(true);
+ rt.setHomeDir("/home");
+ rt.setVersion(SeamVersion.SEAM_1_2);
+ SeamRuntime rt2 = new SeamRuntime();
+ rt2.setName("rtName2");
+ rt2.setDefault(false);
+ rt2.setHomeDir("/home1");
+ rt2.setVersion(SeamVersion.SEAM_2_0);
+ List<SeamRuntime> rts = Arrays.asList(new SeamRuntime[]{rt,rt2});
+
+
+ new SeamRuntimeListFieldEditor("name","label",rts).doFillIntoGrid(shell);
+
+ shell.open ();
+ while (!shell.isDisposed ()) {
+ if (!display.readAndDispatch ()) display.sleep ();
+ }
+ display.dispose ();
+ }
+
+ /**
+ *
+ * @param parent
+ */
+ public void doFillIntoGrid(Object parent) {
+ Assert.isTrue(parent instanceof Composite,
+ "Parent control should be Composite");
+ Assert.isTrue(((Composite)parent).getLayout()
+ instanceof GridLayout,"Editor supports only grid layout");
+ Composite aComposite = (Composite) parent;
+ Control[] controls = (Control[])getEditorControls(aComposite);
+ GridLayout gl = (GridLayout)((Composite)parent).getLayout();
+
+ GridData gd = new GridData();
+ gd.horizontalSpan = gl.numColumns;
+ gd.grabExcessHorizontalSpace = true;
+ gd.horizontalAlignment = GridData.FILL;
+
+ ((Control)getEditorControls()[0]).setLayoutData(gd);
+ }
+
+ public static class SeamRuntimeWizardPage extends WizardPage implements PropertyChangeListener {
+
+ List<SeamRuntime> value = null;
+
+ IFieldEditor name = SwtFieldEditorFactory.INSTANCE.createTextEditor(
+ "name", "Name:", "");
+
+ IFieldEditor version = SwtFieldEditorFactory.INSTANCE.createComboEditor(
+ "version", "Version:", Arrays.asList(
+ new Object[]{SeamVersion.SEAM_1_2.toString()}),
+ SeamVersion.SEAM_1_2.toString(), true);
+
+ IFieldEditor homeDir = SwtFieldEditorFactory.INSTANCE.createBrowseFolderEditor(
+ "homeDir", "Home Folder:", "");
+
+ IFieldEditor dflt = SwtFieldEditorFactory.INSTANCE.createCheckboxEditor(
+ "default", "Use as default:", false);
+
+ /**
+ * @param parent
+ * @param style
+ */
+ public SeamRuntimeWizardPage(List<SeamRuntime> editedList) {
+ super("New Seam Runtime");
+ setMessage("Create a Seam Runtime");
+ setTitle("Seam Runtime");
+ setImageDescriptor(ImageDescriptor.createFromFile(
+ SeamFormWizard.class, "SeamWebProjectWizBan.png"));
+ value = editedList;
+ }
+ /**
+ *
+ */
+ public void createControl(Composite parent) {
+ parent.setLayout(new GridLayout(1, false));
+ GridData dg = new GridData();
+ dg.horizontalAlignment = GridData.FILL;
+ dg.grabExcessHorizontalSpace = true;
+ Composite root = new Composite(parent, SWT.NONE);
+ root.setLayoutData(dg);
+ GridLayout gl = new GridLayout(3, false);
+ root.setLayout(gl);
+ name.doFillIntoGrid(root);
+ name.addPropertyChangeListener(this);
+ version.doFillIntoGrid(root);
+ version.addPropertyChangeListener(this);
+ homeDir.doFillIntoGrid(root);
+ homeDir.addPropertyChangeListener(this);
+ setPageComplete(false);
+ setControl(root);
+ }
+
+ /**
+ *
+ */
+ public void propertyChange(PropertyChangeEvent evt) {
+
+ if(name.getValueAsString()==null || "".equals(
+ name.getValueAsString().toString().trim())) {
+ setErrorMessage("Name cannot be empty");
+ setPageComplete(false);
+ return;
+ }
+
+ if(!name.getValueAsString().matches("[a-zA-Z_][a-zA-Z0-9_\\-\\.]*")) {
+ setErrorMessage("Runtime name is not correct");
+ setPageComplete(false);
+ return;
+ }
+ for (SeamRuntime rt : value) {
+ if(rt.getName().equals(name.getValueAsString())) {
+ setErrorMessage("Runtime '"+name.getValueAsString()+ "' already exists");
+ setPageComplete(false);
+ return;
+ }
+ }
+
+ if(homeDir.getValueAsString()==null || "".equals(homeDir.getValueAsString().trim())) {
+ setErrorMessage("Path to seam home directory cannot be empty");
+ setPageComplete(false);
+ return;
+ }
+
+ Map errors = ValidatorFactory.JBOSS_SEAM_HOME_FOLDER_VALIDATOR.validate(
+ homeDir.getValueAsString(), null);
+ if( errors != ValidatorFactory.NO_ERRORS) {
+ setErrorMessage(errors.get(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME).toString());
+ setPageComplete(false);
+ return;
+ }
+
+ setErrorMessage(null);
+ setPageComplete(true);
+ }
+
+ /**
+ *
+ * @return
+ */
+ public SeamRuntime getRuntime() {
+ SeamRuntime newRt = new SeamRuntime();
+ newRt.setName(name.getValueAsString());
+ newRt.setVersion(SeamVersion.parseFromString(version.getValueAsString()));
+ newRt.setHomeDir(homeDir.getValueAsString());
+ //newRt.setDefault((Boolean)dflt.getValue());
+ return newRt;
+ }
+ }
+
+ public static class SeamRuntimeNewWizard extends Wizard {
+
+ SeamRuntimeWizardPage page1 = null;
+ List<SeamRuntime> added = null;
+ List<SeamRuntime> value = null;
+ public SeamRuntimeNewWizard(List<SeamRuntime> value, List<SeamRuntime> added) {
+ super();
+ setWindowTitle("New Seam Runtime");
+ page1 = new SeamRuntimeWizardPage(value);
+ addPage(page1);
+ this.value = value;
+ this.added = added;
+ }
+
+ public boolean performFinish() {
+ added.add(page1.getRuntime());
+ value.add(page1.getRuntime());
+ return true;
+ }
+ }
+}
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SeamRuntimeListFieldEditor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java 2007-09-07 10:02:58 UTC (rev 3483)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/SwtFieldEditorFactory.java 2007-09-07 10:03:06 UTC (rev 3484)
@@ -17,13 +17,16 @@
import org.eclipse.datatools.connectivity.db.generic.IDBConnectionProfileConstants;
import org.eclipse.datatools.connectivity.db.generic.ui.NewConnectionProfileWizard;
import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.wizard.Wizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.project.facet.SeamRuntime;
import org.jboss.tools.seam.ui.internal.project.facet.IValidator;
import org.jboss.tools.seam.ui.widget.editor.ButtonFieldEditor.ButtonPressedAction;
+import org.jboss.tools.seam.ui.widget.editor.SeamRuntimeListFieldEditor.SeamRuntimeNewWizard;
/**
*
@@ -154,7 +157,9 @@
};
}
-
+ /**
+ *
+ */
public ButtonFieldEditor.ButtonPressedAction createNotImplementedYetAction(String buttonName) {
return new ButtonFieldEditor.ButtonPressedAction(buttonName) {
@Override
@@ -183,4 +188,20 @@
return editor;
}
+
+ /**
+ *
+ */
+ public IFieldEditor createComboWithButton(String name, String label,
+ List values, Object defaultValue, boolean flat,
+ ButtonPressedAction action1,
+ IValidator validator) {
+ CompositeEditor editor = new CompositeEditor(name,label,defaultValue);
+ editor.addFieldEditors(new IFieldEditor[]{
+ new LabelFieldEditor(name,label),
+ new ComboFieldEditor(name,label, values, defaultValue, false),
+ new ButtonFieldEditor(name, action1, defaultValue)
+ });
+ return editor;
+ }
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/TaggedComboFieldEditor.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/TaggedComboFieldEditor.java 2007-09-07 10:02:58 UTC (rev 3483)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/widget/editor/TaggedComboFieldEditor.java 2007-09-07 10:03:06 UTC (rev 3484)
@@ -16,20 +16,27 @@
import org.eclipse.swt.widgets.Combo;
+/**
+ *
+ */
public class TaggedComboFieldEditor extends CompositeEditor implements ITaggedFieldEditor, PropertyChangeListener{
List values = null;
boolean floatStyle = true;
+
ComboFieldEditor combo = null;
- public TaggedComboFieldEditor(String name, String label, List values, Object defaultValue, boolean floatStyle) {
+ public TaggedComboFieldEditor(String name, String label, List values,
+ Object defaultValue, boolean floatStyle) {
+
super(name, label, defaultValue);
this.values = Collections.unmodifiableList(values);
this.floatStyle = floatStyle;
- combo = new ComboFieldEditor(name,label,values,defaultValue.toString(),floatStyle);
+ combo = new ComboFieldEditor(
+ name,label,values,defaultValue.toString(),floatStyle);
addFieldEditors(new IFieldEditor[]{new LabelFieldEditor(name,label),
- combo});
+ combo});
}
/* (non-Javadoc)
17 years, 4 months
JBoss Tools SVN: r3483 - in trunk/seam/plugins/org.jboss.tools.seam.core: src/org/jboss/tools/seam/internal/core/project/facet and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-09-07 06:02:58 -0400 (Fri, 07 Sep 2007)
New Revision: 3483
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntime.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeListConverter1.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeManager.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamVersion.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamFacetPreference.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java
trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/ejbModule/META-INF/MANIFEST.MF
Log:
http://jira.jboss.org/jira/browse/JBIDE-825
Seam Runtimes lis added on seam preference page
Seam runtime selection added to seam facet wizard page
JUnit tests for SeamRuntime manager
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamFacetPreference.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamFacetPreference.java 2007-09-07 10:02:48 UTC (rev 3482)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamFacetPreference.java 2007-09-07 10:02:58 UTC (rev 3483)
@@ -20,8 +20,12 @@
public class SeamFacetPreference {
public static final String SEAM_HOME_FOLDER = SeamCorePlugin.PLUGIN_ID + ".project.facet.seamhome";
public static final String SEAM_DEFAULT_CONNECTION_PROFILE = SeamCorePlugin.PLUGIN_ID + ".project.facet.default.conn.profile";
+ public static final String RUNTIME_CONFIG_FORMAT_VERSION = SeamCorePlugin.PLUGIN_ID + ".runtime.config.format.version";
+ public static final String RUNTIME_LIST = SeamCorePlugin.PLUGIN_ID+".runtime.list";
+ public static final String RUNTIME_DEFAULT = SeamCorePlugin.PLUGIN_ID+".runtime.default";
+
public static String getStringPreference(final String name) {
- return SeamCorePlugin.getDefault().getPreferenceStore().getString(SeamFacetPreference.SEAM_HOME_FOLDER);
+ return SeamCorePlugin.getDefault().getPreferenceStore().getString(name);
}
}
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntime.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntime.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntime.java 2007-09-07 10:02:58 UTC (rev 3483)
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * 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.seam.core.project.facet;
+
+import java.io.File;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamRuntime {
+
+ /**
+ *
+ */
+ SeamVersion version = null;
+
+ /**
+ *
+ */
+ String name = null;
+
+ /**
+ *
+ */
+ String homeDir = null;
+
+ /**
+ *
+ */
+ boolean defaultRt = false;
+
+ /**
+ *
+ */
+ public SeamRuntime() {}
+
+ /**
+ *
+ * @return
+ */
+ public SeamVersion getVersion() {
+ return version;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ *
+ * @return
+ */
+ public String getHomeDir() {
+ return homeDir;
+ }
+
+ /**
+ *
+ * @param version
+ */
+ public void setVersion(SeamVersion version) {
+ this.version = version;
+ }
+
+ /**
+ *
+ * @param name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ *
+ * @param homeDir
+ */
+ public void setHomeDir(String homeDir) {
+ this.homeDir = homeDir;
+ }
+
+ /**
+ * @param b
+ */
+ public void setDefault(boolean b) {
+ this.defaultRt = b;
+ }
+
+ /**
+ * @return
+ */
+ public boolean isDefault() {
+ return defaultRt;
+ }
+}
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntime.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeListConverter1.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeListConverter1.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeListConverter1.java 2007-09-07 10:02:58 UTC (rev 3483)
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * 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.seam.core.project.facet;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamRuntimeListConverter1 {
+
+ public Map<String,SeamRuntime> getMap(String input) {
+
+ Map<String,SeamRuntime> result = new HashMap<String,SeamRuntime>();
+ if(input==null || "".equals(input.trim())) {
+ return result;
+ }
+
+ StringTokenizer runtimes = new StringTokenizer(input,",");
+ while (runtimes.hasMoreTokens()) {
+ String runtime = runtimes.nextToken();
+ String[] map = runtime.split("\\|");
+ SeamRuntime rt = new SeamRuntime();
+ for (int i=0;i<map.length;i+=2) {
+ String name = map[i];
+ String value = i+1<map.length?map[i+1]:"";
+ if("name".equals(name)) {
+ rt.setName(value);
+ } else if("homeDir".equals(name)) {
+ rt.setHomeDir(value);
+ } else if ("version".equals(name)) {
+ rt.setVersion(SeamVersion.parseFromString(value));
+ } else if("default".equals(name)) {
+ rt.setDefault(Boolean.parseBoolean(value));
+ }
+ }
+ result.put(rt.getName(),rt);
+ }
+
+ return result;
+ }
+
+ public String getString(Map<String,SeamRuntime> runtimeMap) {
+ StringBuffer buffer = new StringBuffer();
+ SeamRuntime[] runtimes = runtimeMap.values().toArray(new SeamRuntime[runtimeMap.size()]);
+ for (int i=0;i<runtimes.length;i++) {
+ buffer.append("name|");
+ buffer.append(runtimes[i].getName());
+ buffer.append("|version|");
+ buffer.append(runtimes[i].getVersion().toString());
+ buffer.append("|homeDir|");
+ buffer.append(runtimes[i].getHomeDir());
+ buffer.append("|default|");
+ buffer.append(runtimes[i].isDefault());
+ if(i!=runtimes.length-1) buffer.append(",");
+ }
+ return buffer.toString();
+ }
+}
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeListConverter1.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeManager.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeManager.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeManager.java 2007-09-07 10:02:58 UTC (rev 3483)
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * 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.seam.core.project.facet;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.internal.core.SeamPreferenceInitializer;
+import org.jboss.tools.seam.internal.core.project.facet.SeamFacetPreferenceInitializer;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamRuntimeManager {
+
+ private static SeamRuntimeListConverter1 converter = new SeamRuntimeListConverter1();
+
+ private Map<String, SeamRuntime> runtimes = new HashMap<String, SeamRuntime>();
+
+ private SeamRuntime defaultRt = null;
+
+ /**
+ *
+ */
+ static class SeamRuntimeManagerHolder {
+ private static final SeamRuntimeManager INSTANCE = new SeamRuntimeManager();
+ }
+
+ /**
+ *
+ * @return
+ */
+ public static SeamRuntimeManager getInstance() {
+ return SeamRuntimeManagerHolder.INSTANCE;
+ }
+
+ /**
+ *
+ */
+ private SeamRuntimeManager() {
+ String configVersion = SeamFacetPreference.getStringPreference(
+ SeamFacetPreference.RUNTIME_CONFIG_FORMAT_VERSION);
+ String runtimeListString = SeamFacetPreference.getStringPreference(
+ SeamFacetPreference.RUNTIME_LIST);
+
+ runtimes = converter.getMap(runtimeListString);
+ }
+
+ /**
+ *
+ * @return
+ */
+ public SeamRuntime[] getRuntimes() {
+ Collection<SeamRuntime> c = runtimes.values();
+ return c.toArray(new SeamRuntime[runtimes.size()]);
+ }
+
+ /**
+ *
+ * @param version
+ * @return
+ */
+ public SeamRuntime[] getRuntimes(SeamVersion version) {
+ Collection<SeamRuntime> c = runtimes.values();
+ List<SeamRuntime> rts = new ArrayList<SeamRuntime>();
+ for (SeamRuntime seamRuntime : c) {
+ if(seamRuntime.getVersion()==version)rts.add(seamRuntime);
+ }
+ return rts.toArray(new SeamRuntime[rts.size()]);
+ }
+
+ /**
+ *
+ * @param runtime
+ */
+ public void addRuntime(SeamRuntime runtime) {
+ runtimes.put(runtime.getName(),runtime);
+ if(getDefaultRuntime()!=null && runtime.isDefault()) {
+ getDefaultRuntime().setDefault(false);
+ }
+
+ save();
+ }
+
+ /**
+ *
+ * @param name
+ * @param path
+ * @param version
+ * @param defaultRt
+ */
+ public void addRuntime(String name, String path, SeamVersion version, boolean defaultRt) {
+ SeamRuntime seamRt = new SeamRuntime();
+ seamRt.setVersion(version);
+ seamRt.setHomeDir(path);
+ seamRt.setName(name);
+ seamRt.setDefault(defaultRt);
+ addRuntime(seamRt);
+ }
+
+ /**
+ *
+ * @param name
+ * @return
+ */
+ public SeamRuntime findRuntimeByName(String name) {
+ for (SeamRuntime seamRuntime : runtimes.values()) {
+ if(seamRuntime.getName().equals(name))return seamRuntime;
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param rt
+ */
+ public void removeRuntime(SeamRuntime rt) {
+ runtimes.remove(rt.getName());
+ }
+
+ /**
+ *
+ * @param project
+ * @return
+ */
+ public SeamRuntime getRuntimeForProject(IProject project) {
+ return null;
+ }
+
+ /**
+ *
+ */
+ public void save() {
+ SeamCorePlugin.getDefault().getPluginPreferences().setValue(
+ SeamFacetPreference.RUNTIME_LIST, converter.getString(runtimes));
+ }
+
+ /**
+ *
+ * @return
+ */
+ public SeamRuntime getDefaultRuntime() {
+ for (SeamRuntime rt : runtimes.values()) {
+ if(rt.isDefault())return rt;
+ }
+ return null;
+ }
+
+ /**
+ *
+ */
+ public String getConfigurationVersion() {
+ return SeamFacetPreferenceInitializer.RUNTIME_CONFIG_FORMAT_VERSION;
+ }
+}
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamRuntimeManager.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamVersion.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamVersion.java (rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamVersion.java 2007-09-07 10:02:58 UTC (rev 3483)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.seam.core.project.facet;
+
+/**
+ * @author eskimo
+ *
+ */
+public enum SeamVersion {
+ SEAM_1_2("1.2"), SEAM_2_0("2.0");
+
+ String version = "";
+
+ public static final String V_1_2 = "1.2";
+
+ public static final String V_2_0 = "2.0";
+
+ SeamVersion(String version) {
+ this.version = version;
+ }
+
+ public String toString() {
+ return version;
+ }
+
+ static public SeamVersion parseFromString(String version) {
+ if(V_1_2.equals(version)) {
+ return SEAM_1_2;
+ } else if(V_2_0.equals(version)) {
+ return SEAM_2_0;
+ }
+ throw new IllegalArgumentException("Seam version " + version + "is not supported");
+ }
+}
Property changes on: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/project/facet/SeamVersion.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-09-07 10:02:48 UTC (rev 3482)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetInstallDelegete.java 2007-09-07 10:02:58 UTC (rev 3483)
@@ -47,6 +47,8 @@
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
+import org.jboss.tools.seam.core.project.facet.SeamRuntime;
+import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
public class SeamFacetInstallDelegete extends Object implements IDelegate {
@@ -205,9 +207,10 @@
final File webLibFolder = new File(webContentFolder,WEB_LIBRARIES_RELATED_PATH);
final File srcFolder = srcRootFolder.getUnderlyingFolder().getLocation().toFile();
final File webMetaInf = new File(webContentFolder, "META-INF");
+ final SeamRuntime selectedRuntime = SeamRuntimeManager.getInstance().findRuntimeByName(model.getProperty(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME).toString());
+
+ final String seamHomePath = selectedRuntime.getHomeDir();
- final String seamHomePath = model.getProperty(ISeamFacetDataModelProperties.JBOSS_SEAM_HOME).toString();
-
final File seamHomeFolder = new File(seamHomePath);
final File seamLibFolder = new File(seamHomePath,SEAM_LIB_RELATED_PATH);
final File seamGenResFolder = new File(seamHomePath,"seam-gen/resources");
@@ -260,15 +263,12 @@
AntCopyUtils.copyFilesAndFolders(
seamGenResFolder,srcFolder,new AntCopyUtils.FileSetFileFilter(webInfClassesSet), viewFilterSetCollection, true);
- FilterSetCollection hibernateDialectFilterSet = new FilterSetCollection();
+ final FilterSetCollection hibernateDialectFilterSet = new FilterSetCollection();
hibernateDialectFilterSet.addFilterSet(jdbcFilterSet);
hibernateDialectFilterSet.addFilterSet(projectFilterSet);
hibernateDialectFilterSet.addFilterSet(SeamFacetFilterSetFactory.createHibernateDialectFilterSet(model));
- AntCopyUtils.copyFileToFolder(
- hibernateConsolePropsFile,
- project.getLocation().toFile(),
- hibernateDialectFilterSet, true);
+
// ********************************************************************************************
// Handle WAR/EAR configurations
@@ -312,6 +312,11 @@
new File(project.getLocation().toFile(),project.getName()+".launch"),
new FilterSetCollection(projectFilterSet), true);
+ AntCopyUtils.copyFileToFolder(
+ hibernateConsolePropsFile,
+ project.getLocation().toFile(),
+ hibernateDialectFilterSet, true);
+
// Copy JDBC driver if there is any
if(model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH)!=null)
AntCopyUtils.copyFiles((String[])model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH), webLibFolder);
@@ -391,11 +396,17 @@
protected IStatus run(IProgressMonitor monitor) {
IProject ear = WtpUtils.createEclipseProject(model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME)+"-ear", monitor);
- IProject ejb = WtpUtils.createEclipseProject(model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME)+"-ejb", monitor); try {
+ IProject ejb = WtpUtils.createEclipseProject(model.getProperty(ISeamFacetDataModelProperties.SEAM_PROJECT_NAME)+"-ejb", monitor);
+ try {
FilterSet filterSet = new FilterSet();
filterSet.addFilter("projectName", project.getName());
- filterSet.addFilter("runtimeName", WtpUtils.getServerRuntimeName(project));
-
+ filterSet.addFilter("runtimeName", WtpUtils.getServerRuntimeName(project));
+ if(model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH)!=null) {
+ File driver = new File(((String[])model.getProperty(ISeamFacetDataModelProperties.JDBC_DRIVER_JAR_PATH))[0]);
+ filterSet.addFilter("driverJar"," " + driver.getName() + "\n");
+ } else {
+ filterSet.addFilter("driverJar","");
+ }
AntCopyUtils.FileSet excludeCvsSvn = new AntCopyUtils.FileSet(CVS_SVN).dir(seamGenResFolder);
AntCopyUtils.copyFilesAndFolders(
@@ -434,11 +445,18 @@
new File(ejb.getLocation().toFile(),".settings"),
new FilterSetCollection(projectFilterSet), true);
+ FilterSet ejbFilterSet = new FilterSet();
+ ejbFilterSet.addFilter("projectName",ejb.getName());
+
AntCopyUtils.copyFileToFile(
hibernateConsoleLaunchFile,
new File(ejb.getLocation().toFile(),ejb.getName()+".launch"),
- new FilterSetCollection(projectFilterSet), true);
+ new FilterSetCollection(ejbFilterSet), true);
+ AntCopyUtils.copyFileToFolder(
+ hibernateConsolePropsFile,
+ ejb.getLocation().toFile(),
+ hibernateDialectFilterSet, true);
File earContentsFolder = new File(ear.getLocation().toFile(),"EarContent");
File earContentsMetaInfFolder = new File(earContentsFolder,"META-INF");
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java 2007-09-07 10:02:48 UTC (rev 3482)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java 2007-09-07 10:02:58 UTC (rev 3483)
@@ -13,6 +13,8 @@
import java.io.File;
import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
@@ -22,6 +24,9 @@
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamFacetPreference;
+import org.jboss.tools.seam.core.project.facet.SeamRuntime;
+import org.jboss.tools.seam.core.project.facet.SeamRuntimeListConverter1;
+import org.jboss.tools.seam.core.project.facet.SeamVersion;
/**
* @author eskimo
@@ -30,6 +35,8 @@
public class SeamFacetPreferenceInitializer extends
AbstractPreferenceInitializer {
+ public static String RUNTIME_CONFIG_FORMAT_VERSION = "1.0";
+
/**
*
*/
@@ -39,7 +46,8 @@
public void initializeDefaultPreferences() {
IScopeContext context = new DefaultScope();
IEclipsePreferences node = context.getNode(SeamCorePlugin.PLUGIN_ID);
- node.put(SeamFacetPreference.SEAM_HOME_FOLDER, getSeamGenBuildPath());
+ node.put(SeamFacetPreference.RUNTIME_CONFIG_FORMAT_VERSION, RUNTIME_CONFIG_FORMAT_VERSION);
+ initializeDefault(node,getSeamGenBuildPath());
}
public static final String SEAM_GEN_HOME = "../../../../jboss-eap/seam";
@@ -61,4 +69,22 @@
}
}
+ /**
+ * @param node
+ * @param seamGenBuildPath
+ * @return
+ */
+ public void initializeDefault(IEclipsePreferences node, String seamGenBuildPath) {
+ Map<String, SeamRuntime> map = new HashMap<String,SeamRuntime>();
+ File seamFolder = new File(seamGenBuildPath);
+ if(seamFolder.exists() && seamFolder.isDirectory()) {
+ SeamRuntime rt = new SeamRuntime();
+ rt.setHomeDir(seamGenBuildPath);
+ rt.setName(seamFolder.getName()+"."+SeamVersion.V_1_2);
+ rt.setDefault(true);
+ rt.setVersion(SeamVersion.SEAM_1_2);
+ map.put(rt.getName(), rt);
+ }
+ node.put(SeamFacetPreference.RUNTIME_LIST, new SeamRuntimeListConverter1().getString(map));
+ }
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/ejbModule/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/ejbModule/META-INF/MANIFEST.MF 2007-09-07 10:02:48 UTC (rev 3482)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/ejb/ejbModule/META-INF/MANIFEST.MF 2007-09-07 10:02:58 UTC (rev 3483)
@@ -1,3 +1,4 @@
Manifest-Version: 1.0
Class-Path: jboss-seam.jar
- testng-4.5.1-jdk15.jar
+ testng-4.5.1-jdk15.jar
+@driverJar@
\ No newline at end of file
17 years, 4 months
JBoss Tools SVN: r3482 - in trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test: project/facet and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-09-07 06:02:48 -0400 (Fri, 07 Sep 2007)
New Revision: 3482
Added:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamRuntimeListConverterTest.java
Modified:
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-825
Seam Runtimes lis added on seam preference page
Seam runtime selection added to seam facet wizard page
JUnit tests for SeamRuntime manager
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java 2007-09-07 10:02:44 UTC (rev 3481)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/SeamCoreAllTests.java 2007-09-07 10:02:48 UTC (rev 3482)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.seam.core.test;
+import org.jboss.tools.seam.core.test.project.facet.SeamRuntimeListConverterTest;
+
import junit.framework.Test;
import junit.framework.TestSuite;
/**
@@ -24,7 +26,7 @@
suite.setName("All tests for " + PLUGIN_ID);
suite.addTestSuite(ScannerTest.class);
suite.addTestSuite(SeamEARTest.class);
- //suite.addTestSuite();
+ suite.addTestSuite(SeamRuntimeListConverterTest.class);
return suite;
}
}
Added: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamRuntimeListConverterTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamRuntimeListConverterTest.java (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamRuntimeListConverterTest.java 2007-09-07 10:02:48 UTC (rev 3482)
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * 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.seam.core.test.project.facet;
+
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.jboss.tools.seam.core.project.facet.SeamRuntime;
+import org.jboss.tools.seam.core.project.facet.SeamRuntimeListConverter1;
+import org.jboss.tools.seam.core.project.facet.SeamVersion;
+
+/**
+ * @author eskimo
+ *
+ */
+public class SeamRuntimeListConverterTest extends TestCase {
+
+ /**
+ * Test method for {@link org.jboss.tools.seam.core.project.facet.SeamRuntimeListConverter1#getMap(java.lang.String)}.
+ */
+ public void testSerializeSeamRuntimeListToString() {
+ Map<String,SeamRuntime> runtimes = new HashMap<String,SeamRuntime>();
+ SeamRuntime rt1 = new SeamRuntime();
+ rt1.setName("rt1");
+ rt1.setHomeDir("homeDir");
+ rt1.setVersion(SeamVersion.parseFromString("1.2"));
+ runtimes.put(rt1.getName(),rt1);
+ SeamRuntime rt2 = new SeamRuntime();
+ rt2.setName("rt2");
+ rt2.setHomeDir("homeDir");
+ rt2.setVersion(SeamVersion.parseFromString("1.2"));
+ runtimes.put(rt2.getName(),rt2);
+ SeamRuntimeListConverter1 converter = new SeamRuntimeListConverter1();
+ String config = converter.getString(runtimes);
+ assertNotNull("Saved runtime list cannot be null", config);
+ assertTrue("Saved list of runtimes cannot be empty.", !"".equals(config.trim()));
+ Map<String,SeamRuntime> result = converter.getMap(config);
+
+ Comparator comparator = new SeamRuntimeComparator();
+ for (SeamRuntime runtime : runtimes.values()) {
+ SeamRuntime curr = result.get(runtime.getName());
+ assertEquals("Saved runtime was not restored correctly", 0, comparator.compare(runtime, curr));
+ }
+ }
+
+ /**
+ * Test method for {@link org.jboss.tools.seam.core.project.facet.SeamRuntimeListConverter1#getString(java.util.List)}.
+ */
+ public void testLoadingSeamRuntimeListFromString() {
+ SeamRuntimeListConverter1 converter = new SeamRuntimeListConverter1();
+ Map<String,SeamRuntime> runtimes =
+ converter.getMap("name|rt1|homeDir|homeDirPath1|version|1.2|default|true," +
+ "name|rt2|homeDir|homeDirPath2|version|1.2|default|false");
+ assertNotNull("Loading runtime from string is failed",runtimes.get("rt1"));
+ assertNotNull("Loading runtime from string is failed",runtimes.get("rt2"));
+ SeamRuntime rt = runtimes.get("rt1");
+ assertTrue("Seam Runtime loaded incorrect",
+ "rt1".equals(rt.getName())
+ && "homeDirPath1".equals(rt.getHomeDir())
+ && SeamVersion.SEAM_1_2 ==rt.getVersion()
+ && rt.isDefault());
+ rt = runtimes.get("rt2");
+ assertTrue("Seam Runtime loaded incorrect",
+ "rt2".equals(rt.getName())
+ && "homeDirPath2".equals(rt.getHomeDir())
+ && SeamVersion.SEAM_1_2 ==rt.getVersion()
+ && !rt.isDefault());
+ runtimes = converter.getMap("");
+ assertTrue("Loading runtimes from empty string should produce empty map",runtimes.size()==0);
+ runtimes = converter.getMap(null);
+ assertTrue("Loading runtimes from null string should produce empty map", runtimes.size()==0);
+ }
+
+ public static class SeamRuntimeComparator implements Comparator<SeamRuntime> {
+
+ /* (non-Javadoc)
+ * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+ */
+ public int compare(SeamRuntime o1, SeamRuntime o2) {
+ if(o1.getName().equals(o2.getName())
+ && o1.getVersion()==o2.getVersion()
+ && o1.getHomeDir().equals(o2.getHomeDir())) {
+ return 0;
+ }
+ return 1;
+ }
+ }
+}
Property changes on: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/SeamRuntimeListConverterTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
17 years, 4 months
JBoss Tools SVN: r3481 - trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-09-07 06:02:44 -0400 (Fri, 07 Sep 2007)
New Revision: 3481
Modified:
trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/CommonAllTests.java
Log:
http://jira.jboss.org/jira/browse/JBIDE-825
Seam Runtimes lis added on seam preference page
Seam runtime selection added to seam facet wizard page
JUnit tests for SeamRuntime manager
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 2007-09-07 09:56:20 UTC (rev 3480)
+++ trunk/common/tests/org.jboss.tools.common.test/src/org/jboss/tools/common/test/CommonAllTests.java 2007-09-07 10:02:44 UTC (rev 3481)
@@ -32,5 +32,4 @@
suite.addTestSuite(CommonPluginTest.class);
return suite;
}
-
}
\ No newline at end of file
17 years, 4 months
JBoss Tools SVN: r3480 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-09-07 05:56:20 -0400 (Fri, 07 Sep 2007)
New Revision: 3480
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/ServerLaunchDefaults.java
Log:
fix for compilation problems.
@Override annotations removed
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/ServerLaunchDefaults.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/ServerLaunchDefaults.java 2007-09-07 07:46:55 UTC (rev 3479)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/launch/ServerLaunchDefaults.java 2007-09-07 09:56:20 UTC (rev 3480)
@@ -49,56 +49,47 @@
*/
public class ServerLaunchDefaults implements IJBossServerLaunchDefaults {
- @Override
public void fillDefaults(ILaunchConfigurationWorkingCopy wc)
throws CoreException {
// TODO Auto-generated method stub
}
- @Override
public List getRuntimeClasspath(String action) {
// TODO Auto-generated method stub
return null;
}
- @Override
public String getShutdownJar() {
// TODO Auto-generated method stub
return null;
}
- @Override
public String getStartArgs() {
// TODO Auto-generated method stub
return null;
}
- @Override
public String getStartJar() {
// TODO Auto-generated method stub
return null;
}
- @Override
public String getStartMainType() {
// TODO Auto-generated method stub
return null;
}
- @Override
public String getStopArgs() {
// TODO Auto-generated method stub
return null;
}
- @Override
public String getStopMainType() {
// TODO Auto-generated method stub
return null;
}
- @Override
public String getVMArgs() {
// TODO Auto-generated method stub
return null;
17 years, 4 months
JBoss Tools SVN: r3479 - branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor.
by jbosstools-commits@lists.jboss.org
Author: ayukhovich
Date: 2007-09-07 03:46:55 -0400 (Fri, 07 Sep 2007)
New Revision: 3479
Modified:
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseListener.java
branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerVpeResizer.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-742
Restoring functionality of resizing
Modified: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseListener.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseListener.java 2007-09-06 20:19:57 UTC (rev 3478)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/VpeResizerMouseListener.java 2007-09-07 07:46:55 UTC (rev 3479)
@@ -96,15 +96,11 @@
nsIDOMElement domElement = (nsIDOMElement) eventTarget
.queryInterface(nsIDOMElement.NS_IDOMELEMENT_IID);
if (domElement != null) {
- System.out.println("ELEMENT IS: " + domElement.getNodeName());
int clientX = mouseEvent.getClientX();
int clientY = mouseEvent.getClientY();
vpeResizer.mouseDown(clientX, clientY, domElement);
- } else {
- System.out.println("ELEMENT IS NULL ");
}
-
} // if
} // if
Modified: branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerVpeResizer.java
===================================================================
--- branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerVpeResizer.java 2007-09-06 20:19:57 UTC (rev 3478)
+++ branches/jbosstools_xulrunner/vpe/plugins/org.jboss.tools.vpe.xulrunner/src/org/jboss/tools/vpe/xulrunner/editor/XulRunnerVpeResizer.java 2007-09-07 07:46:55 UTC (rev 3479)
@@ -140,14 +140,11 @@
public void show(nsIDOMElement domElement, int resizers) {
if ( resizingObject != null ) {
- System.out.println("XulRunnerVpeResizer.show before hide for element: " + resizingObject.getNodeName() );
hide();
}
resizingObject = domElement;
- System.out.println("XulRunnerVpeResizer.show for element: " + resizingObject.getNodeName() );
-
elementBounds = XulRunnerVpeUtils.getElementBounds(domElement);
if ((elementBounds.width <= 0) ||
@@ -227,10 +224,6 @@
* @see org.jboss.vpe.mozilla.resizer.IVpeResizer#hide()
*/
public void hide() {
- if ( resizingObject != null ) {
- System.out.println("XulRunnerVpeResizer.hide for element: " + resizingObject.getNodeName() );
- }
-
nsIDOMElement bodyElement;
bodyElement = getRootElement();
17 years, 4 months
JBoss Tools SVN: r3478 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-06 16:19:57 -0400 (Thu, 06 Sep 2007)
New Revision: 3478
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
Log:
Really bad oversight in packaging. hard-coded name from testing was committed.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2007-09-06 19:24:41 UTC (rev 3477)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/publishers/JstPublisher.java 2007-09-06 20:19:57 UTC (rev 3478)
@@ -36,6 +36,7 @@
import org.eclipse.jst.server.core.IWebModule;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.internal.DeletedModule;
import org.eclipse.wst.server.core.internal.Server;
import org.eclipse.wst.server.core.model.IModuleFolder;
import org.eclipse.wst.server.core.model.IModuleResource;
@@ -47,7 +48,6 @@
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.model.EventLogModel.EventLogTreeItem;
import org.jboss.ide.eclipse.as.core.server.NestedPublishInfo;
-import org.jboss.ide.eclipse.as.core.server.NestedPublishInfo.OpenedModulePublishInfo;
import org.jboss.ide.eclipse.as.core.server.attributes.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.xpl.ModulePackager;
import org.jboss.ide.eclipse.as.core.util.FileUtil;
@@ -104,6 +104,12 @@
}
}
protected void fullEarPublish(IModule module, IPath root, IProgressMonitor monitor) throws CoreException {
+ if( module instanceof DeletedModule ) {
+ // TODO FIX ME
+ return;
+ }
+
+
ModuleDelegate md = (ModuleDelegate)module.loadAdapter(ModuleDelegate.class, monitor);
IModuleResource[] members = md.members();
IEnterpriseApplication earModule = (IEnterpriseApplication)module.loadAdapter(IEnterpriseApplication.class, monitor);
@@ -215,7 +221,7 @@
} else {
// cannot incrementally publish something unknown
// just package it
- packModuleIntoJar(module, "blah" + module.getName().hashCode() + ".jar", root);
+ packModuleIntoJar(module, module.getName() + ".jar", root);
}
return new Status(IStatus.OK, JBossServerCorePlugin.PLUGIN_ID,
IStatus.OK, "", null);
17 years, 4 months
JBoss Tools SVN: r3477 - trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-06 15:24:41 -0400 (Thu, 06 Sep 2007)
New Revision: 3477
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesView.java
Log:
view was left with items in it when selected project was deleted
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesView.java
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesView.java 2007-09-06 19:24:39 UTC (rev 3476)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.ui/src/main/org/jboss/ide/eclipse/archives/ui/views/ProjectArchivesView.java 2007-09-06 19:24:41 UTC (rev 3477)
@@ -82,8 +82,13 @@
Object element = ((IStructuredSelection)selection).getFirstElement();
IProject project = getProject(element);
- if( project != null )
+ if( project != null ) {
viewSelectionChanged(project);
+ } else {
+ if( getCurrentProject() != null && !getCurrentProject().exists() ) {
+ viewSelectionChanged(null);
+ }
+ }
}
public IProject getProject (Object element) {
@@ -209,6 +214,7 @@
if( project == null ) {
this.project = null;
packageViewer.setInput(null);
+ book.showPage(noSelectionComposite);
return;
}
17 years, 4 months