JBoss Tools SVN: r3802 - in trunk/vpe/plugins/org.jboss.tools.vpe: src/org/jboss/tools/vpe/editor and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: ezheleznyakov
Date: 2007-09-26 04:34:58 -0400 (Wed, 26 Sep 2007)
New Revision: 3802
Added:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/HtmlBodyTemplate.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpeDebug.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCopyCreator.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java
trunk/vpe/plugins/org.jboss.tools.vpe/templates/vpe-templates-html.xml
Log:
http://jira.jboss.com/jira/browse/JBIDE-897
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpeDebug.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpeDebug.java 2007-09-25 20:37:32 UTC (rev 3801)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpeDebug.java 2007-09-26 08:34:58 UTC (rev 3802)
@@ -25,7 +25,7 @@
public static final boolean visualAddPseudoElement = false;
- public static final boolean visualContextMenuDumpSource = false;
+ public static final boolean visualContextMenuDumpSource = true;
public static final boolean visualContextMenuDumpMapping = false;
public static final boolean visualContextMenuTest = false;
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2007-09-25 20:37:32 UTC (rev 3801)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/VpeVisualDomBuilder.java 2007-09-26 08:34:58 UTC (rev 3802)
@@ -58,6 +58,7 @@
import org.jboss.tools.vpe.editor.template.VpeTemplateManager;
import org.jboss.tools.vpe.editor.template.VpeToggableTemplate;
import org.jboss.tools.vpe.editor.template.dnd.VpeDnd;
+import org.jboss.tools.vpe.editor.util.HTML;
import org.jboss.tools.vpe.editor.util.MozillaSupports;
import org.jboss.tools.vpe.editor.util.TextUtil;
import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
@@ -335,6 +336,10 @@
pageContext.setCurrentVisualNode(null);
Element visualNewElement;
visualNewElement = (Element)creationData.getNode();
+
+ if (visualNewElement != null)
+ correctVisualAttribute(visualNewElement);
+
Element border = null;
setTooltip((Element)sourceNode, visualNewElement);
if (YES_STRING.equals(VpePreference.SHOW_BORDER_FOR_ALL_TAGS.getValue()) && visualNewElement != null) {
@@ -380,6 +385,26 @@
return null;
}
+ private void correctVisualAttribute(Element element) {
+
+ String styleValue = element.getAttribute(HTML.TAG_STYLE);
+ String backgroundValue = element
+ .getAttribute(VpeStyleUtil.PARAMETR_BACKGROND);
+
+ if (styleValue != null) {
+ styleValue = VpeStyleUtil.addFullPathIntoURLValue(styleValue,
+ pageContext.getEditPart().getEditorInput());
+ element.setAttribute(HTML.TAG_STYLE, styleValue);
+ }
+ if (backgroundValue != null) {
+ backgroundValue = VpeStyleUtil
+ .addFullPathIntoBackgroundValue(backgroundValue,
+ pageContext.getEditPart().getEditorInput());
+ element.setAttribute(VpeStyleUtil.PARAMETR_BACKGROND,
+ backgroundValue);
+ }
+ }
+
/**
* Create a visual element for text node
* @param sourceNode
Added: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/HtmlBodyTemplate.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/HtmlBodyTemplate.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/HtmlBodyTemplate.java 2007-09-26 08:34:58 UTC (rev 3802)
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.vpe.editor.template;
+
+import org.jboss.tools.vpe.editor.context.VpePageContext;
+import org.jboss.tools.vpe.editor.util.HTML;
+import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ *
+ * @author ezheleznyakov(a)exadel.com
+ *
+ */
+public class HtmlBodyTemplate extends VpeAbstractTemplate {
+
+ private Element bodyOld;
+ private static String STYLE_FOR_DIV = "width: 100%; height: 100%";
+
+ /**
+ *
+ */
+ public VpeCreationData create(VpePageContext pageContext, Node sourceNode,
+ Document visualDocument) {
+
+ goToTree(visualDocument.getChildNodes().item(0));
+
+ for (int i = 0; i < sourceNode.getAttributes().getLength(); i++) {
+ String name = sourceNode.getAttributes().item(i).getNodeName();
+ String value = sourceNode.getAttributes().item(i).getNodeValue();
+ // all full path for 'url'
+ if (VpeStyleUtil.ATTRIBUTE_STYLE.equalsIgnoreCase(name))
+ value = VpeStyleUtil.addFullPathIntoURLValue(value, pageContext
+ .getEditPart().getEditorInput());
+ if (VpeStyleUtil.PARAMETR_BACKGROND.equalsIgnoreCase(name))
+ value = VpeStyleUtil.addFullPathIntoBackgroundValue(value,
+ pageContext.getEditPart().getEditorInput());
+
+ bodyOld.setAttribute(name, value);
+
+ }
+
+ Element div = visualDocument.createElement(HTML.TAG_DIV);
+ div.setAttribute(VpeStyleUtil.ATTRIBUTE_STYLE, STYLE_FOR_DIV);
+
+ return new VpeCreationData(div);
+ }
+
+ /**
+ *
+ * @param node
+ */
+ private void goToTree(Node node) {
+
+ for (int i = 0; i < node.getChildNodes().getLength(); i++)
+ if (HTML.TAG_BODY.equalsIgnoreCase(node.getChildNodes().item(i)
+ .getNodeName()))
+ bodyOld = (Element) node.getChildNodes().item(i);
+ else
+ goToTree(node.getChildNodes().item(i));
+ }
+
+ /**
+ * 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
+ * Attribute 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, Document visualDocument,
+ Element visualNode, Object data, String name, String value) {
+ return true;
+ }
+}
\ No newline at end of file
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/HtmlBodyTemplate.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCopyCreator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCopyCreator.java 2007-09-25 20:37:32 UTC (rev 3801)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/template/VpeCopyCreator.java 2007-09-26 08:34:58 UTC (rev 3802)
@@ -125,9 +125,7 @@
String name = sourceAttr.getName();
String value = sourceAttr.getValue();
- if (name.equalsIgnoreCase(STYLE_ATTR_NAME))
- value = VpeStyleUtil.addFullPathIntoURLValue(sourceAttr.getValue(), pageContext.getEditPart().getEditorInput());
-
+
if (isAttribute(name)) {
visualElement.setAttribute(name, value);
}
Added: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java (rev 0)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java 2007-09-26 08:34:58 UTC (rev 3802)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.vpe.editor.util;
+
+/**
+ * @author Sergey Vasilyev (svasilyev(a)exadel.com)
+ *
+ */
+public final class HTML {
+
+ private HTML() {}
+
+ public static final String TAG_HTML = "HTML";
+ public static final String TAG_HEAD = "HEAD";
+ public static final String TAG_BODY = "BODY";
+ public static final String TAG_IMG = "IMG";
+ public static final String TAG_LINK = "LINK";
+ public static final String TAG_SELECT = "SELECT";
+ public static final String TAG_OPTION = "OPTION";
+ public static final String TAG_STYLE = "STYLE";
+ public static final String TAG_TABLE = "TABLE";
+ public static final String TAG_TBODY = "TBODY";
+ public static final String TAG_THEAD = "THEAD";
+ public static final String TAG_TFOOT = "TFOOT";
+ public static final String TAG_TH = "TH";
+ public static final String TAG_TR = "TR";
+ public static final String TAG_TD = "TD";
+ public static final String TAG_COL = "COL";
+ public static final String TAG_COLS = "COLS";
+ public static final String TAG_COLGROUP = "COLGROUP";
+ public static final String TAG_BR = "BR";
+ public static final String TAG_LI = "LI";
+ public static final String TAG_DIV = "DIV";
+ public static final String TAG_SPAN = "SPAN";
+ public static final String TAG_P = "P";
+ public static final String TAG_TEXTAREA = "TEXTAREA";
+ public static final String TAG_INPUT = "INPUT";
+ public static final String TAG_BUTTON = "BUTTON";
+ public static final String TAG_OL = "OL";
+ public static final String TAG_UL = "UL";
+
+
+
+ public static final String ATTR_ID = "ID";
+}
\ No newline at end of file
Property changes on: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/HTML.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:keywords
+ Author Id Revision Date
Name: svn:eol-style
+ native
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java 2007-09-25 20:37:32 UTC (rev 3801)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/util/VpeStyleUtil.java 2007-09-26 08:34:58 UTC (rev 3802)
@@ -30,6 +30,7 @@
public static final String PARAMETER_LEFT = "left";
public static final String PARAMETER_WIDTH = "width";
public static final String PARAMETER_HEIGHT = "height";
+ public static final String PARAMETR_BACKGROND = "background";
public static final String VALUE_ABSOLUTE = "absolute";
@@ -335,7 +336,35 @@
}
return inputPath;
}
+
+ /**
+ *
+ * @param value
+ * Css string
+ * @param input
+ * The editor input
+ * @return format style string
+ */
+ public static String addFullPathIntoBackgroundValue(String value,
+ IEditorInput input) {
+ if (value.indexOf(FILE_STR) != -1)
+ return value;
+
+ if (!new File(value).isAbsolute())
+ value = getFilePath(input, value);
+
+ value = FILE_PRTOCOL + value;
+ URL url = null;
+ try {
+ url = new URL(value);
+ } catch (MalformedURLException e) {
+ return value;
+ }
+
+ return url.toString();
+ }
+
/**
*
* @param value
@@ -410,7 +439,7 @@
try {
url = new URL(pathCssAbsolute);
} catch (MalformedURLException e) {
-
+ return pathImgRelative;
}
pathCssAbsolute = url.toString();
while (j != -1) {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/templates/vpe-templates-html.xml
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/templates/vpe-templates-html.xml 2007-09-25 20:37:32 UTC (rev 3801)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/templates/vpe-templates-html.xml 2007-09-26 08:34:58 UTC (rev 3802)
@@ -352,35 +352,17 @@
</vpe:template>
</vpe:tag>
- <vpe:tag name="body" case-sensitive="no">
- <vpe:if test="attrpresent('background')">
- <vpe:template children="yes" modify="yes">
- <div
- style="background-color:{@bgcolor};background-image:url({src(@background)});" />
- <vpe:dnd>
- <vpe:drop container="yes" />
- </vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="BlockFormat" addParent="deny" addChildren="allow"
- handler="org.jboss.tools.vpe.editor.toolbar.format.handler.BlockFormatHandler" />
- <vpe:format type="BoldFormat" addParent="deny" addChildren="allow" handler="org.jboss.tools.vpe.editor.toolbar.format.handler.BoldFormatHandler" />
- <vpe:format type="ItalicFormat" addParent="deny" addChildren="allow" handler="org.jboss.tools.vpe.editor.toolbar.format.handler.ItalicFormatHandler" />
- <vpe:format type="UnderlineFormat" addParent="deny" addChildren="allow" handler="org.jboss.tools.vpe.editor.toolbar.format.handler.UnderlineFormatHandler" />
- </vpe:textFormating>
- </vpe:template>
- </vpe:if>
- <vpe:template children="yes" modify="yes">
- <div style="background-color:{@bgcolor};" />
+ <vpe:tag name="body" case-sensitive="yes">
+ <vpe:template children="yes" modify="yes"
+ class="org.jboss.tools.vpe.editor.template.HtmlBodyTemplate">
+ <vpe:resize>
+ <vpe:width width-attr="style.width" />
+ <vpe:height height-attr="style.height" />
+ </vpe:resize>
<vpe:dnd>
- <vpe:drop container="yes" />
+ <vpe:drag start-enable="yes" />
+ <vpe:drop container="no"></vpe:drop>
</vpe:dnd>
- <vpe:textFormating>
- <vpe:format type="BlockFormat" addParent="deny" addChildren="allow"
- handler="org.jboss.tools.vpe.editor.toolbar.format.handler.BlockFormatHandler" />
- <vpe:format type="BoldFormat" addParent="deny" addChildren="allow" handler="org.jboss.tools.vpe.editor.toolbar.format.handler.BoldFormatHandler" />
- <vpe:format type="ItalicFormat" addParent="deny" addChildren="allow" handler="org.jboss.tools.vpe.editor.toolbar.format.handler.ItalicFormatHandler" />
- <vpe:format type="UnderlineFormat" addParent="deny" addChildren="allow" handler="org.jboss.tools.vpe.editor.toolbar.format.handler.UnderlineFormatHandler" />
- </vpe:textFormating>
</vpe:template>
</vpe:tag>
@@ -2293,7 +2275,7 @@
<vpe:tag name="table" case-sensitive="no">
<vpe:template children="yes" modify="yes">
<vpe:copy
- attrs="style,class,width,border,frame,rules,cellspacing,cellpadding,align,bgcolor" />
+ attrs="style,class,width,border,frame,rules,cellspacing,cellpadding,align,bgcolor,background" />
<vpe:resize>
<vpe:width width-attr="style.width" />
<vpe:height height-attr="style.height" />
17 years, 3 months
JBoss Tools SVN: r3801 - in trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui: views/server/providers and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-25 16:37:32 -0400 (Tue, 25 Sep 2007)
New Revision: 3801
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java
Log:
filesets messages moved to proper NLS api
filesets now work with any server
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2007-09-25 19:47:05 UTC (rev 3800)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.java 2007-09-25 20:37:32 UTC (rev 3801)
@@ -183,6 +183,21 @@
public static String DescriptorXPathComplex;
public static String DescriptorXPathMatch;
+
+ /* Filesets addition */
+ public static String FilesetsCreateFilter;
+ public static String FilesetsDeleteFilter;
+ public static String FilesetsEditFilter;
+ public static String FilesetsDeleteFile;
+ public static String FilesetsEditFile;
+ public static String FilesetsNewFileset;
+ public static String FilesetsNewName;
+ public static String FilesetsNewRootDir;
+ public static String FilesetsNewBrowse;
+ public static String FilesetsNewIncludes;
+ public static String FilesetsNewExcludes;
+ public static String FilesetsNewPreview;
+
static {
NLS.initializeMessages(JBossServerUIPlugin.PLUGIN_ID + ".Messages",
Messages.class);
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2007-09-25 19:47:05 UTC (rev 3800)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/Messages.properties 2007-09-25 20:37:32 UTC (rev 3801)
@@ -163,4 +163,19 @@
DescriptorXPathPortCategory=Port Category\:
DescriptorXPathSimple=Show only xpath value in properties view.
DescriptorXPathComplex=Show all details in properties view.
-DescriptorXPathMatch=Match
\ No newline at end of file
+DescriptorXPathMatch=Match
+
+
+#Filesets
+FilesetsCreateFilter=Create Filter
+FilesetsDeleteFilter=Delete Filter
+FilesetsEditFilter=Edit Filter
+FilesetsDeleteFile=Delete File
+FilesetsEditFile=Edit File
+FilesetsNewFileset=New Fileset
+FilesetsNewName=Name:
+FilesetsNewRootDir=Root Directory:
+FilesetsNewBrowse=Browse...
+FilesetsNewIncludes=Includes:
+FilesetsNewExcludes=Excludes:
+FilesetsNewPreview=Preview
\ No newline at end of file
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java 2007-09-25 19:47:05 UTC (rev 3800)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java 2007-09-25 20:37:32 UTC (rev 3801)
@@ -13,9 +13,11 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.content.IContentType;
import org.eclipse.core.runtime.content.IContentTypeManager;
import org.eclipse.core.runtime.content.IContentTypeMatcher;
@@ -61,6 +63,8 @@
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
import org.jboss.ide.eclipse.as.core.util.FileUtil;
+import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
+import org.jboss.ide.eclipse.as.ui.Messages;
import org.jboss.ide.eclipse.as.ui.views.server.extensions.ServerViewProvider;
import org.jboss.ide.eclipse.as.ui.views.server.extensions.SimplePropertiesViewExtension;
@@ -81,25 +85,34 @@
createActions();
}
+ protected boolean supports(IServer server) {
+ return isJBossDeployable(server) || server.getRuntime() != null;
+ }
+
protected void createActions() {
createFilter = new Action() {
public void run() {
IDeployableServer server = (IDeployableServer)contentProvider.server.loadAdapter(IDeployableServer.class, new NullProgressMonitor());
- if( server != null ) {
- FilesetDialog d = new FilesetDialog(new Shell(), server);
+ String location = null;
+ if( server != null )
+ location = server.getDeployDirectory();
+ else
+ location = contentProvider.server.getRuntime().getLocation().toOSString();
+
+ if( location != null ) {
+ FilesetDialog d = new FilesetDialog(new Shell(), location);
if( d.open() == Window.OK ) {
Fileset fs = d.getFileset();
Fileset[] filesetsNew = new Fileset[filesets.length + 1];
System.arraycopy(filesets, 0, filesetsNew, 0, filesets.length);
filesetsNew[filesetsNew.length-1] = fs;
filesets = filesetsNew;
- saveFilesets(true);
- refreshViewer();
+ saveFilesets();
}
}
}
};
- createFilter.setText("Create Filter");
+ createFilter.setText(Messages.FilesetsCreateFilter);
deleteFilter = new Action() {
public void run() {
if( selection instanceof Fileset ) {
@@ -107,15 +120,14 @@
ArrayList asList = new ArrayList(Arrays.asList(filesets));
asList.remove(selection);
filesets = (Fileset[]) asList.toArray(new Fileset[asList.size()]);
- saveFilesets(true);
- removeElement(selection);
+ saveFilesets();
} catch( Exception e ) {
e.printStackTrace();
}
}
}
};
- deleteFilter.setText("Delete Filter");
+ deleteFilter.setText(Messages.FilesetsDeleteFilter);
editFilter = new Action() {
public void run() {
Fileset sel = (Fileset)selection;
@@ -126,12 +138,11 @@
sel.setFolder(ret.getFolder());
sel.setIncludesPattern(ret.getIncludesPattern());
sel.setExcludesPattern(ret.getExcludesPattern());
- saveFilesets(true);
- refreshViewer(sel);
+ saveFilesets();
}
}
};
- editFilter.setText("Edit Filter");
+ editFilter.setText(Messages.FilesetsEditFilter);
deleteFileAction = new Action() {
public void run() {
try {
@@ -143,7 +154,7 @@
}
}
};
- deleteFileAction.setText("Delete File");
+ deleteFileAction.setText(Messages.FilesetsDeleteFile);
editFileAction = new Action() {
public void run() {
try {
@@ -169,11 +180,12 @@
page.openEditor(input, desc.getId());
}
} catch( Exception e ) {
- e.printStackTrace();
+ IStatus status = new Status(IStatus.ERROR, JBossServerUIPlugin.PLUGIN_ID, "Cannot open file", e);
+ JBossServerUIPlugin.getDefault().getLog().log(status);
}
}
};
- editFileAction.setText("Edit File");
+ editFileAction.setText(Messages.FilesetsEditFile);
}
public static class PathWrapper {
@@ -294,40 +306,26 @@
public void loadFilesets() {
IServer server = contentProvider.server;
if( server != null ) {
- IDeployableServer jbs = (IDeployableServer)server.loadAdapter(IDeployableServer.class, new NullProgressMonitor());
- if( jbs != null ) {
- ServerAttributeHelper helper = jbs.getAttributeHelper();
- List tmp = helper.getAttribute(FILESET_KEY, new ArrayList());
- String[] asStrings = (String[]) tmp.toArray(new String[tmp.size()]);
- filesets = new Fileset[asStrings.length];
- for( int i = 0; i < asStrings.length; i++ ) {
- filesets[i] = new Fileset(asStrings[i]);
- }
+ ServerAttributeHelper helper = ServerAttributeHelper.createHelper(server);
+ List tmp = helper.getAttribute(FILESET_KEY, new ArrayList());
+ String[] asStrings = (String[]) tmp.toArray(new String[tmp.size()]);
+ filesets = new Fileset[asStrings.length];
+ for( int i = 0; i < asStrings.length; i++ ) {
+ filesets[i] = new Fileset(asStrings[i]);
}
}
}
- public void saveFilesets(boolean suppressRefresh) {
- Runnable r = new Runnable() {
- public void run() {
- IServer server = contentProvider.server;
- if( server != null ) {
- ArrayList list = new ArrayList();
- for( int i = 0; i < filesets.length; i++ ) {
- list.add(filesets[i].toString());
- }
- IDeployableServer jbs = (IDeployableServer)server.loadAdapter(IDeployableServer.class, new NullProgressMonitor());
- ServerAttributeHelper helper = jbs.getAttributeHelper();
- helper.setAttribute(FILESET_KEY, list);
- helper.save();
- }
+ public void saveFilesets() {
+ IServer server = contentProvider.server;
+ if( server != null ) {
+ ArrayList list = new ArrayList();
+ for( int i = 0; i < filesets.length; i++ ) {
+ list.add(filesets[i].toString());
}
- };
-
- if( suppressRefresh ) {
- suppressingRefresh(r);
- } else {
- r.run();
+ ServerAttributeHelper helper = ServerAttributeHelper.createHelper(server);
+ helper.setAttribute(FILESET_KEY, list);
+ helper.save();
}
}
@@ -464,11 +462,6 @@
}
- public Image createIcon() {
- return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
- }
-
-
public void fillContextMenu(Shell shell, IMenuManager menu, Object selection) {
this.selection = selection;
if( selection instanceof ServerViewProvider ) {
@@ -517,19 +510,17 @@
return null;
}
-
-
protected class FilesetDialog extends Dialog {
- Fileset fileset;
+ protected Fileset fileset;
private String name, dir, includes, excludes;
private Button browse;
private Text includesText, excludesText, folderText, nameText;
private Composite main;
private FilesetPreviewComposite preview;
- protected FilesetDialog(Shell parentShell, IDeployableServer server) {
+ protected FilesetDialog(Shell parentShell, String defaultLocation) {
super(parentShell);
this.fileset = new Fileset();
- this.fileset.setFolder(server.getDeployDirectory());
+ this.fileset.setFolder(defaultLocation);
}
protected FilesetDialog(Shell parentShell, Fileset fileset) {
super(parentShell);
@@ -546,7 +537,7 @@
protected void configureShell(Shell shell) {
super.configureShell(shell);
- shell.setText("New Fileset");
+ shell.setText(Messages.FilesetsNewFileset);
}
protected Control createDialogArea(Composite parent) {
@@ -602,34 +593,34 @@
}
protected void fillArea(Composite main) {
Label nameLabel = new Label(main, SWT.NONE);
- nameLabel.setText("Name: ");
+ nameLabel.setText(Messages.FilesetsNewName);
nameText = new Text(main, SWT.BORDER);
nameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
Label folderLabel = new Label(main, SWT.NONE);
- folderLabel.setText("Root Directory: ");
+ folderLabel.setText(Messages.FilesetsNewRootDir);
folderText = new Text(main, SWT.BORDER);
folderText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
browse = new Button(main, SWT.PUSH);
- browse.setText("Browse...");
+ browse.setText(Messages.FilesetsNewBrowse);
Label includesLabel = new Label(main, SWT.NONE);
- includesLabel.setText("Includes: ");
+ includesLabel.setText(Messages.FilesetsNewIncludes);
includesText = new Text(main, SWT.BORDER);
includesText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
Label excludeLabel= new Label(main, SWT.NONE);
- excludeLabel.setText("Excludes: ");
+ excludeLabel.setText(Messages.FilesetsNewExcludes);
excludesText = new Text(main, SWT.BORDER);
excludesText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
Group previewWrapper = new Group(main, SWT.NONE);
previewWrapper.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 3, 3));
- previewWrapper.setText("Preview");
+ previewWrapper.setText(Messages.FilesetsNewPreview);
previewWrapper.setLayout(new FillLayout());
preview = new FilesetPreviewComposite(previewWrapper, SWT.NONE);
17 years, 3 months
JBoss Tools SVN: r3800 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-25 15:47:05 -0400 (Tue, 25 Sep 2007)
New Revision: 3800
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java
Log:
Edit File action was flaky. Is fixed
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java 2007-09-25 19:29:15 UTC (rev 3799)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java 2007-09-25 19:47:05 UTC (rev 3800)
@@ -52,6 +52,7 @@
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.FileStoreEditorInput;
import org.eclipse.ui.internal.util.SWTResourceUtil;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.wst.server.core.IServer;
@@ -153,14 +154,20 @@
IWorkbench wb = PlatformUI.getWorkbench();
IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
IWorkbenchPage page = win.getActivePage();
-// IFileStore fileStore= EFS.getLocalFileSystem().fromLocalFile(file);
+ IFileStore fileStore= EFS.getLocalFileSystem().fromLocalFile(file);
if( eclipseFile != null ) {
IEditorInput input = new FileEditorInput(eclipseFile);
IEditorDescriptor desc = PlatformUI.getWorkbench().
getEditorRegistry().getDefaultEditor(file.getName());
if( desc != null )
page.openEditor(input, desc.getId());
- }
+ } else if( fileStore != null ){
+ IEditorInput input = new FileStoreEditorInput(fileStore);
+ IEditorDescriptor desc = PlatformUI.getWorkbench().
+ getEditorRegistry().getDefaultEditor(file.getName());
+ if( desc != null )
+ page.openEditor(input, desc.getId());
+ }
} catch( Exception e ) {
e.printStackTrace();
}
@@ -480,6 +487,12 @@
getEditorRegistry().getDefaultEditor(file.getName());
if( input != null && desc != null )
editable = true;
+ } else if( fileStore != null ){
+ IEditorInput input = new FileStoreEditorInput(fileStore);
+ IEditorDescriptor desc = PlatformUI.getWorkbench().
+ getEditorRegistry().getDefaultEditor(file.getName());
+ if( input != null && desc != null )
+ editable = true;
}
editFileAction.setEnabled(editable);
deleteFileAction.setEnabled(file.exists());
17 years, 3 months
JBoss Tools SVN: r3799 - trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-25 15:29:15 -0400 (Tue, 25 Sep 2007)
New Revision: 3799
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java
Log:
exceptions during deletion... now caught and return blank.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java 2007-09-25 19:28:38 UTC (rev 3798)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/server/providers/FilesetViewProvider.java 2007-09-25 19:29:15 UTC (rev 3799)
@@ -7,6 +7,7 @@
import java.util.List;
import java.util.Properties;
+import org.apache.tools.ant.BuildException;
import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.resources.IFile;
@@ -58,6 +59,7 @@
import org.jboss.ide.eclipse.archives.ui.util.composites.FilesetPreviewComposite;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
+import org.jboss.ide.eclipse.as.core.util.FileUtil;
import org.jboss.ide.eclipse.as.ui.views.server.extensions.ServerViewProvider;
import org.jboss.ide.eclipse.as.ui.views.server.extensions.SimplePropertiesViewExtension;
@@ -134,7 +136,7 @@
try {
PathWrapper wrapper = (PathWrapper)selection;
File file = wrapper.getPath().toFile();
- file.delete();
+ FileUtil.safeDelete(file);
refreshViewer();
} catch( Exception e ) {
}
@@ -235,9 +237,14 @@
return filesets == null ? new Object[]{} : filesets;
} else if( parentElement instanceof Fileset ) {
Fileset fs = (Fileset)parentElement;
- IPath[] paths = ArchivesModelCore.findMatchingPaths(
- new Path(fs.getFolder()), fs.getIncludesPattern(), fs.getExcludesPattern());
-
+ IPath[] paths = null;
+ try {
+ paths = ArchivesModelCore.findMatchingPaths(
+ new Path(fs.getFolder()), fs.getIncludesPattern(), fs.getExcludesPattern());
+ } catch( BuildException be ) {
+ return new Object[]{};
+ }
+
HashMap folders = new HashMap();
ArrayList wrappers = new ArrayList();
for( int i = 0; i < paths.length; i++ ) {
@@ -475,7 +482,7 @@
editable = true;
}
editFileAction.setEnabled(editable);
- deleteFileAction.setEnabled(file.isFile());
+ deleteFileAction.setEnabled(file.exists());
menu.add(editFileAction);
menu.add(deleteFileAction);
}
17 years, 3 months
JBoss Tools SVN: r3798 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2007-09-25 15:28:38 -0400 (Tue, 25 Sep 2007)
New Revision: 3798
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
Log:
must remove in opposite order as you publish (inner first)
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2007-09-25 19:15:59 UTC (rev 3797)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DeployableServerBehavior.java 2007-09-25 19:28:38 UTC (rev 3798)
@@ -2,6 +2,7 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import org.eclipse.core.runtime.CoreException;
@@ -161,7 +162,7 @@
ArrayList moduleList = new ArrayList();
ArrayList deltaKindList = new ArrayList();
fillPublishOneModuleLists(module, moduleList, deltaKindList, deltaKind, recurse);
-
+
try {
((Server)getServer()).getServerPublishInfo().startCaching();
@@ -198,6 +199,8 @@
}
protected void fillPublishOneModuleLists(IModule[] module, ArrayList moduleList, ArrayList deltaKindList, int deltaKind, boolean recurse) {
+ moduleList.add(module);
+ deltaKindList.add(new Integer(deltaKind));
if( recurse ) {
ArrayList tmp = new ArrayList();
IModule[] children = getServer().getChildModules(module, new NullProgressMonitor());
@@ -207,8 +210,12 @@
fillPublishOneModuleLists((IModule[]) tmp.toArray(new IModule[tmp.size()]), moduleList, deltaKindList, deltaKind, recurse);
}
}
- moduleList.add(module);
- deltaKindList.add(new Integer(deltaKind));
+
+ // if removing, we must remove child first
+ if( deltaKind == ServerBehaviourDelegate.REMOVED ) {
+ Collections.reverse(moduleList);
+ Collections.reverse(deltaKindList);
+ }
}
protected void addAndRemoveModules(IModule[] module, int deltaKind) {
17 years, 3 months
JBoss Tools SVN: r3797 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-09-25 15:15:59 -0400 (Tue, 25 Sep 2007)
New Revision: 3797
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-769
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java 2007-09-25 19:12:35 UTC (rev 3796)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java 2007-09-25 19:15:59 UTC (rev 3797)
@@ -144,6 +144,7 @@
hbmtemplate1Attributes.put("file_pattern", "{class-name}List.xhtml");
hbmtemplate1Attributes.put("template_path", template);
hbmtemplate1Attributes.put("template_name", "list.xhtml.ftl");
+ // TODO create "view" folder
hbmtemplate1Attributes.put("outputdir", webContentPath.toString() + "/view");
hbmtemplate1Attributes.put("for_each", "entity");
wc.setAttribute(HibernateLaunchConstants.ATTR_EXPORTERS + ".hbmtemplate1.properties", hbmtemplate1Attributes);
17 years, 3 months
JBoss Tools SVN: r3796 - trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-09-25 15:12:35 -0400 (Tue, 25 Sep 2007)
New Revision: 3796
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/J2EEProjects.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-769
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/J2EEProjects.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/J2EEProjects.java 2007-09-25 19:11:43 UTC (rev 3795)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/J2EEProjects.java 2007-09-25 19:12:35 UTC (rev 3796)
@@ -85,7 +85,7 @@
for (int i = 0; i < rs.length; i++) {
IVirtualComponent c = rs[i].getReferencedComponent();
if(c == null) continue;
- IProject p = c.getRootFolder().getProject();
+ IProject p = c.getProject();
if(J2EEProjectUtilities.isDynamicWebProject(p)) {
if(!wars.contains(p)) wars.add(p);
} else if(J2EEProjectUtilities.isEJBProject(project)) {
17 years, 3 months
JBoss Tools SVN: r3795 - trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2007-09-25 15:11:43 -0400 (Tue, 25 Sep 2007)
New Revision: 3795
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-769
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java 2007-09-25 19:10:22 UTC (rev 3794)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEnitiesWizard.java 2007-09-25 19:11:43 UTC (rev 3795)
@@ -10,6 +10,8 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -17,6 +19,7 @@
import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
@@ -28,18 +31,13 @@
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
import org.eclipse.ui.INewWizard;
-import org.hibernate.eclipse.console.ExtensionManager;
-import org.hibernate.eclipse.console.model.impl.ExporterDefinition;
import org.hibernate.eclipse.launch.HibernateLaunchConstants;
+import org.jboss.tools.seam.core.J2EEProjects;
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;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
-import org.jboss.tools.seam.ui.SeamGuiPlugin;
import org.jboss.tools.seam.ui.SeamUIMessages;
/**
@@ -61,27 +59,33 @@
Map<String, String> params = (Map)info.getAdapter(Map.class);
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(
params.get(IParameter.SEAM_PROJECT_NAME));
-
+
try {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType launchConfigurationType =
- launchManager.getLaunchConfigurationType(
- "org.hibernate.eclipse.launch.CodeGenerationLaunchConfigurationType");
+ launchManager.getLaunchConfigurationType("org.hibernate.eclipse.launch.CodeGenerationLaunchConfigurationType");
ILaunchConfigurationWorkingCopy wc =
launchConfigurationType.newInstance(project, project.getName() + "generate-entities");
-
+
//Main
wc.setAttribute(
- HibernateLaunchConstants.ATTR_CONSOLE_CONFIGURATION_NAME,
- params.get(IParameter.HIBERNATE_CONFIGURATION_NAME));
-
- IPath src = getSourceFolder(project);
- if(src == null) {
- throw new CoreException(
- new Status(IStatus.ERROR, SeamCorePlugin.PLUGIN_ID, "Source folder not found in project " + project.getName()));
+ HibernateLaunchConstants.ATTR_CONSOLE_CONFIGURATION_NAME,
+ params.get(IParameter.HIBERNATE_CONFIGURATION_NAME));
+
+ J2EEProjects seamProjectUtil = J2EEProjects.create(project);
+ IPath webContentPath = null;
+ IFolder webContent = seamProjectUtil.getWARContentFolder();
+ IProject webProject = null;
+ if(webContent!=null && webContent.exists()) {
+ webContentPath = webContent.getFullPath();
+ webProject = seamProjectUtil.getWARProjects().get(0);
}
- wc.setAttribute(HibernateLaunchConstants.ATTR_OUTPUT_DIR, src.toString());
+ if(webContentPath == null) {
+ throw new CoreException(new Status(IStatus.ERROR, SeamCorePlugin.PLUGIN_ID, "WebContent folder not found in project " + project.getName()));
+ }
+ wc.setAttribute(HibernateLaunchConstants.ATTR_OUTPUT_DIR, webContentPath.toString());
+
boolean isReverseEngineer = "true".equals(params.get(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER));
wc.setAttribute(HibernateLaunchConstants.ATTR_REVERSE_ENGINEER, isReverseEngineer);
@@ -91,29 +95,77 @@
wc.setAttribute(HibernateLaunchConstants.ATTR_AUTOMATIC_MANY_TO_MANY, true);
wc.setAttribute(HibernateLaunchConstants.ATTR_AUTOMATIC_VERSIONING, true);
}
-
+
wc.setAttribute(HibernateLaunchConstants.ATTR_USE_OWN_TEMPLATES, true);
- SeamRuntime seamRt = SeamRuntimeManager.getInstance().getDefaultRuntime();
-
- String runtimeName = SeamCorePlugin.getSeamPreferences(project)
- .get(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,"");
-
- if(!"".equals(runtimeName)) {
- seamRt = SeamRuntimeManager.getInstance().findRuntimeByName(runtimeName);
+ SeamRuntime seamRt = getRuntime(project);
+ if(seamRt==null) {
+ seamRt = getRuntime(webProject);
}
-
+ if(seamRt == null) {
+ throw new CoreException(new Status(IStatus.ERROR, SeamCorePlugin.PLUGIN_ID, "Can't find seam runtime for project " + project.getName()));
+ }
+
+ IResource[] resources = seamProjectUtil.getEJBSourceRoots();
+ IPath javaSource = null;
+ if(resources!=null && resources.length>0) {
+ javaSource = resources[0].getFullPath();
+ }
+ if(javaSource == null) {
+ throw new CoreException(new Status(IStatus.ERROR, SeamCorePlugin.PLUGIN_ID, "Source folder not found in project " + project.getName()));
+ }
+
String template = "" + seamRt.getHomeDir() + "/seam-gen/view";
wc.setAttribute(HibernateLaunchConstants.ATTR_TEMPLATE_DIR, template);
-
+
wc.setAttribute(HibernateLaunchConstants.ATTR_ENABLE_JDK5, true);
wc.setAttribute(HibernateLaunchConstants.ATTR_ENABLE_EJB3_ANNOTATIONS, true);
-
- ExporterDefinition[] ds = ExtensionManager.findExporterDefinitions();
- wc.setAttribute("org.hibernate.tools.hbm2java", true);
+ // Create exporters
+ // TODO Add others exporters
+ List<String> exporters = new ArrayList<String>();
+ exporters.add("hbmtemplate1");
+ exporters.add("hbmtemplate2");
+ wc.setAttribute(HibernateLaunchConstants.ATTR_EXPORTERS, exporters);
+
+ wc.setAttribute(HibernateLaunchConstants.ATTR_EXPORTERS + ".hbmtemplate1", true);
+ wc.setAttribute(HibernateLaunchConstants.ATTR_EXPORTERS + ".hbmtemplate1.extension_id", "org.hibernate.tools.hbmtemplate");
+ wc.setAttribute(HibernateLaunchConstants.ATTR_EXPORTERS + ".hbmtemplate2", true);
+ wc.setAttribute(HibernateLaunchConstants.ATTR_EXPORTERS + ".hbmtemplate2.extension_id", "org.hibernate.tools.hbmtemplate");
+
+// ExporterDefinition[] ds = ExtensionManager.findExporterDefinitions();
+
+ // Set properties:
+ // <hbmtemplate filepattern="{class-name}List.xhtml"
+ // template="view/list.xhtml.ftl"
+ // destdir="${project.home}/view"
+ // foreach="entity"/>
+
+ Map<String, String> hbmtemplate1Attributes = new HashMap<String, String>();
+ hbmtemplate1Attributes.put("file_pattern", "{class-name}List.xhtml");
+ hbmtemplate1Attributes.put("template_path", template);
+ hbmtemplate1Attributes.put("template_name", "list.xhtml.ftl");
+ hbmtemplate1Attributes.put("outputdir", webContentPath.toString() + "/view");
+ hbmtemplate1Attributes.put("for_each", "entity");
+ wc.setAttribute(HibernateLaunchConstants.ATTR_EXPORTERS + ".hbmtemplate1.properties", hbmtemplate1Attributes);
+
+ // Set properties:
+ // <hbmtemplate filepattern="{class-name}.page.xml"
+ // template="view/view.page.xml.ftl"
+ // destdir="${project.home}/view"
+ // foreach="entity"/>
+
+ Map<String, String> hbmtemplate2Attributes = new HashMap<String, String>();
+ hbmtemplate2Attributes.put("file_pattern", "{class-name}.page.xml");
+ hbmtemplate1Attributes.put("template_path", template);
+ hbmtemplate1Attributes.put("template_name", "view.page.xml.ftl");
+ hbmtemplate2Attributes.put("outputdir", webContentPath.toString() + "/view");
+ hbmtemplate2Attributes.put("for_each", "entity");
+ wc.setAttribute(HibernateLaunchConstants.ATTR_EXPORTERS + ".hbmtemplate2.properties", hbmtemplate2Attributes);
+
+ // TODO Set properties for others exporters
+
wc.doSave();
launchManager.addLaunch(wc.launch(ILaunchManager.RUN_MODE, monitor));
-
} catch (CoreException e) {
SeamCorePlugin.getDefault().showError("Can't generate seam entities", e);
}
@@ -124,23 +176,20 @@
public List<String[]> getFileMappings(Map<String, Object> vars) {
throw new UnsupportedOperationException("This method is not relevant in generating seam entities.");
}
-
};
-
- static IPath getSourceFolder(IProject project) throws CoreException {
- if(!project.hasNature(JavaCore.NATURE_ID)) return null;
- IJavaProject javaProject = JavaCore.create(project);
- IClasspathEntry[] es = javaProject.getRawClasspath();
- for (int i = 0; i < es.length; i++) {
- if(es[i].getEntryKind() != IClasspathEntry.CPE_SOURCE) continue;
- IPath p = es[i].getPath();
- if(p == null) continue;
- IFolder f = ResourcesPlugin.getWorkspace().getRoot().getFolder(p);
- if(f != null && f.exists()) {
- return p;
- }
+
+ static SeamRuntime getRuntime(IProject project) {
+ if(project==null) {
+ return null;
}
- return null;
+ SeamRuntime seamRt = SeamRuntimeManager.getInstance().getDefaultRuntime();
+
+ String runtimeName = SeamCorePlugin.getSeamPreferences(project)
+ .get(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,"");
+
+ if(!"".equals(runtimeName)) {
+ seamRt = SeamRuntimeManager.getInstance().findRuntimeByName(runtimeName);
+ }
+ return seamRt;
}
-
-}
+}
\ No newline at end of file
17 years, 3 months
JBoss Tools SVN: r3794 - trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-09-25 15:10:22 -0400 (Tue, 25 Sep 2007)
New Revision: 3794
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java
Log:
fix JUnit test errors
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java 2007-09-25 18:57:19 UTC (rev 3793)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java 2007-09-25 19:10:22 UTC (rev 3794)
@@ -77,6 +77,14 @@
assertTrue("Cannot find components.xml in test project", componentsFile != null && componentsFile.exists());
}
+ public void testCreatedProjectIsShownOnTree() {
+
+ IStructuredContentProvider content
+ = (IStructuredContentProvider)getSeamComponentsView().getCommonViewer().getContentProvider();
+ assertTrue("Created Seam enabled project haven't been shown in tree",1==content.getElements(ResourcesPlugin.getWorkspace().getRoot()).length);
+
+ }
+
public void testAddComponentInXmlFile(){
SeamCorePlugin.getSeamProject(project, true);
@@ -366,36 +374,6 @@
assertNotNull("Cannot show the Seam Components View", part);
}
- public void testCreatedProjectIsShownOnTree() {
- TestProjectProvider provider=null;
- try {
- provider = new TestProjectProvider("org.jboss.tools.seam.ui.test", null, "TestComponentView1", true);
- } catch (Exception e1) {
- JUnitUtils.fail("Cannot create Project Provider", e1);
- }
- IProject project = provider.getProject();
- try {
- project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- } catch (Exception e) {
- JUnitUtils.fail("Cannot refresh created test Project", e);
- }
- IStructuredContentProvider content
- = (IStructuredContentProvider)getSeamComponentsView().getCommonViewer().getContentProvider();
- assertTrue("Created Seam enabled project haven't been shown in tree",1==content.getElements(ResourcesPlugin.getWorkspace().getRoot()).length);
-
- }
-
- public void testThatDeletedProjectIsDisappearedFromTree() {
- try {
- ResourcesPlugin.getWorkspace().getRoot().findMember("TestComponentView1").delete(true, new NullProgressMonitor());
- } catch (CoreException e) {
- JUnitUtils.fail(e.getMessage(),e);
- }
- IStructuredContentProvider content
- = (IStructuredContentProvider)getSeamComponentsView().getCommonViewer().getContentProvider();
- assertTrue("Created Seam enabled project haven't been deleted from tree",0==content.getElements(ResourcesPlugin.getWorkspace().getRoot()).length);
- }
-
public void testFlatSeamPackages(){
SeamCorePlugin.getSeamProject(project, true);
@@ -470,6 +448,17 @@
" found",seamPackage!=null);
}
+ public void testThatDeletedProjectIsDisappearedFromTree() {
+ try {
+ ResourcesPlugin.getWorkspace().getRoot().findMember("TestComponentView").delete(true, new NullProgressMonitor());
+ } catch (CoreException e) {
+ JUnitUtils.fail(e.getMessage(),e);
+ }
+ IStructuredContentProvider content
+ = (IStructuredContentProvider)getSeamComponentsView().getCommonViewer().getContentProvider();
+ assertTrue("Created Seam enabled project haven't been deleted from tree",0==content.getElements(ResourcesPlugin.getWorkspace().getRoot()).length);
+ }
+
private CommonNavigator getSeamComponentsView() {
IWorkbenchPage page = WorkbenchUtils.getWorkbenchActivePage();
CommonNavigator part = (CommonNavigator)page.findView(ISeamUiConstants.SEAM_COMPONENTS_VIEW_ID);
17 years, 3 months
JBoss Tools SVN: r3793 - trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2007-09-25 14:57:19 -0400 (Tue, 25 Sep 2007)
New Revision: 3793
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java
Log:
fix JUnit test errors
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java 2007-09-25 16:06:51 UTC (rev 3792)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/view/SeamComponentsViewTest.java 2007-09-25 18:57:19 UTC (rev 3793)
@@ -369,7 +369,7 @@
public void testCreatedProjectIsShownOnTree() {
TestProjectProvider provider=null;
try {
- provider = new TestProjectProvider("org.jboss.tools.seam.ui.test", null, "TestComponentView", true);
+ provider = new TestProjectProvider("org.jboss.tools.seam.ui.test", null, "TestComponentView1", true);
} catch (Exception e1) {
JUnitUtils.fail("Cannot create Project Provider", e1);
}
@@ -387,7 +387,7 @@
public void testThatDeletedProjectIsDisappearedFromTree() {
try {
- ResourcesPlugin.getWorkspace().getRoot().findMember("TestComponentView").delete(true, new NullProgressMonitor());
+ ResourcesPlugin.getWorkspace().getRoot().findMember("TestComponentView1").delete(true, new NullProgressMonitor());
} catch (CoreException e) {
JUnitUtils.fail(e.getMessage(),e);
}
17 years, 3 months