Author: dgolovin
Date: 2007-07-27 21:46:15 -0400 (Fri, 27 Jul 2007)
New Revision: 2713
Modified:
trunk/seam/plugins/org.jboss.ide.seam.gen/META-INF/MANIFEST.MF
trunk/seam/plugins/org.jboss.ide.seam.gen/src/org/jboss/ide/seam/gen/SeamGenPlugin.java
Log:
http://jira.jboss.com/jira/browse/EXIN-287
seam-gen/build.xml path initialization is added
Modified: trunk/seam/plugins/org.jboss.ide.seam.gen/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/plugins/org.jboss.ide.seam.gen/META-INF/MANIFEST.MF 2007-07-28 01:42:37 UTC
(rev 2712)
+++ trunk/seam/plugins/org.jboss.ide.seam.gen/META-INF/MANIFEST.MF 2007-07-28 01:46:15 UTC
(rev 2713)
@@ -16,7 +16,8 @@
org.eclipse.ant.ui,
org.eclipse.core.filesystem,
org.eclipse.datatools.connectivity,
- org.eclipse.datatools.connectivity.db.generic
+ org.eclipse.datatools.connectivity.db.generic,
+ org.jboss.tools.seam.core
Bundle-ClassPath: org.jboss.ide.seam.gen.jar
Export-Package: org.jboss.ide.seam.gen,
org.jboss.ide.seam.gen.actions
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:42:37 UTC (rev 2712)
+++
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)
@@ -1,9 +1,19 @@
package org.jboss.ide.seam.gen;
+import java.io.File;
+import java.io.IOException;
+
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+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.project.facet.SeamFacetPreference;
import org.osgi.framework.BundleContext;
/**
@@ -30,8 +40,43 @@
*/
public void start(BundleContext context) throws Exception {
super.start(context);
+ initSeamGen();
}
+ private void initSeamGen() {
+ ILaunchConfiguration config=null;
+ try {
+ config = findLaunchConfig("seamgen");
+ } catch (CoreException e1) {
+ logError("Exception occured during search in Launch Configuration list.",
e1);
+ }
+ String 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);
+ } catch (CoreException e) {
+ logError("Cannot create configuration for Seam-Gen tool. Seamgen build.xml file:
" + buildXmlPath, e);
+ return;
+ }
+ }
+ }
+
+ static public ILaunchConfiguration findLaunchConfig(String name) throws CoreException {
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType launchConfigurationType =
launchManager.getLaunchConfigurationType(
"org.eclipse.ant.AntLaunchConfigurationType" );
+ ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(
launchConfigurationType );
+
+ for (int i = 0; i < launchConfigurations.length; i++) { // can't believe there
is no look up by name API
+ ILaunchConfiguration launchConfiguration = launchConfigurations[i];
+ if(launchConfiguration.getName().equals(name)) {
+ return launchConfiguration;
+ }
+ }
+ return null;
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
@@ -67,4 +112,6 @@
log(new Status(IStatus.ERROR, PLUGIN_ID, 12345, message, e));
}
+
+
}