Author: dgolovin
Date: 2007-07-30 05:34:05 -0400 (Mon, 30 Jul 2007)
New Revision: 2714
Modified:
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenPlugin.java
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenProperty.java
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/actions/SetupDeluxeAction.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java
Log:
http://jira.jboss.org/jira/browse/EXIN-287
http://jira.jboss.org/jira/browse/EXIN-302
Seam gen now have three parameters initialized if installed with RHDS:
1. JBoss AS Home
2. Path to current Eclipse Workspace
3. Seam-gen build.xml
Modified:
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenPlugin.java
===================================================================
---
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenPlugin.java 2007-07-28
01:46:15 UTC (rev 2713)
+++
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenPlugin.java 2007-07-30
09:34:05 UTC (rev 2714)
@@ -3,9 +3,11 @@
import java.io.File;
import java.io.IOException;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -13,6 +15,7 @@
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.jboss.ide.seam.gen.actions.SeamGenAction;
+import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.project.facet.SeamFacetPreference;
import org.osgi.framework.BundleContext;
@@ -50,12 +53,13 @@
} catch (CoreException e1) {
logError("Exception occured during search in Launch Configuration list.",
e1);
}
- String buildXmlPath = null;
+ File buildXmlPath = null;
if(config==null) {
try {
String seamHome =
SeamFacetPreference.getStringPreference(SeamFacetPreference.SEAM_HOME_FOLDER);
- buildXmlPath =
seamHome+File.separator+"seam-gen"+File.separator+"build.xml";
- SeamGenAction.createSeamgenLaunchConfig(buildXmlPath);
+ buildXmlPath = new
File(seamHome+File.separator+"seam-gen"+File.separator+"build.xml");
+ if(buildXmlPath.exists())
+ SeamGenAction.createSeamgenLaunchConfig(buildXmlPath.getAbsolutePath());
} catch (CoreException e) {
logError("Cannot create configuration for Seam-Gen tool. Seamgen build.xml file:
" + buildXmlPath, e);
return;
@@ -63,6 +67,29 @@
}
}
+ public static final String JBOSS_AS_HOME = "../../../../jboss-eap/jboss-as";
+
+ static public String assumeJBossASHome() {
+ String pluginLocation=null;
+ try {
+ pluginLocation =
FileLocator.resolve(SeamGenPlugin.getDefault().getBundle().getEntry("/")).getFile();
+ } catch (IOException e) {
+ SeamGenPlugin.log(new
Status(IStatus.ERROR,SeamGenPlugin.PLUGIN_ID,e.getMessage(),e));
+ };
+ File seamGenDir = new File(pluginLocation, JBOSS_AS_HOME);
+ Path p = new Path(seamGenDir.getPath());
+ p.makeAbsolute();
+ if(p.toFile().exists()) {
+ return p.toOSString();
+ } else {
+ return "";
+ }
+ }
+
+ public static String assumeWorkspacePath() {
+ return ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString();
+ }
+
static public ILaunchConfiguration findLaunchConfig(String name) throws CoreException {
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType launchConfigurationType =
launchManager.getLaunchConfigurationType(
"org.eclipse.ant.AntLaunchConfigurationType" );
Modified:
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenProperty.java
===================================================================
---
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenProperty.java 2007-07-28
01:46:15 UTC (rev 2713)
+++
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenProperty.java 2007-07-30
09:34:05 UTC (rev 2714)
@@ -66,7 +66,12 @@
public void applyValue(Properties existing, Control control) {
if(getDefaultPropertyName()==null) return;
- String property = existing==null?null:existing.getProperty( getDefaultPropertyName()
);
+ String property = "";
+ if(existing == null || existing.get(getDefaultPropertyName())==null) {
+ property = getDefaultValue(existing)==null?"":getDefaultValue(existing);
+ } else {
+ property = existing.getProperty( getDefaultPropertyName() );
+ }
if(property!=null) {
if(control instanceof Text) {
((Text)control).setText( property );
Modified:
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/actions/SetupDeluxeAction.java
===================================================================
---
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/actions/SetupDeluxeAction.java 2007-07-28
01:46:15 UTC (rev 2713)
+++
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/actions/SetupDeluxeAction.java 2007-07-30
09:34:05 UTC (rev 2714)
@@ -8,6 +8,7 @@
import java.util.Set;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.jboss.ide.seam.gen.SeamGenPlugin;
import org.jboss.ide.seam.gen.SeamGenProperty;
public class SetupDeluxeAction extends SeamGenAction implements
@@ -51,7 +52,7 @@
"Seam project workspace", "workspace.home" ) {
public String getDefaultValue(Properties others) {
String property = others.getProperty( "workspace.home",
- "c:/projects" );
+ SeamGenPlugin.assumeWorkspacePath() );
return property;
}
@@ -77,7 +78,7 @@
"JBoss AS home directory", "jboss.home" ) {
public String getDefaultValue(Properties others) {
String property = others.getProperty( "jboss.home.new",
- "C:/Program Files/jboss-4.0.5.GA" );
+ SeamGenPlugin.assumeJBossASHome() );
return property;
}
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-07-28
01:46:15 UTC (rev 2713)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetPreferenceInitializer.java 2007-07-30
09:34:05 UTC (rev 2714)
@@ -55,7 +55,7 @@
Path p = new Path(seamGenDir.getPath());
p.makeAbsolute();
if(p.toFile().exists()) {
- return p.toFile().getAbsolutePath();
+ return p.toOSString();
} else {
return "";
}