You are viewing a plain text version of this content. The canonical link for it is here.
Posted to easyant-commits@incubator.apache.org by hi...@apache.org on 2011/02/22 15:09:32 UTC
svn commit: r1073358 [3/6] - in /incubator/easyant/easyant4e/trunk:
org.apache.easyant4e.releng/ org.apache.easyant4e.releng/build-files/
org.apache.easyant4e.releng/build-files/automatedTests/
org.apache.easyant4e.tests/datas/simplejavaproject/ org.ap...
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/TestPlugin.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/TestPlugin.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/TestPlugin.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e.tests/src/org/apache/easyant4e/tests/TestPlugin.java Tue Feb 22 15:09:30 2011
@@ -25,43 +25,43 @@ import org.osgi.framework.BundleContext;
*/
public class TestPlugin extends AbstractUIPlugin {
- // The plug-in ID
- public static final String PLUGIN_ID = "org.apache.easyant4e.tests";
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.apache.easyant4e.tests";
- // The shared instance
- private static TestPlugin plugin;
-
- /**
- * The constructor
- */
- public TestPlugin() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static TestPlugin getDefault() {
- return plugin;
- }
+ // The shared instance
+ private static TestPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public TestPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static TestPlugin getDefault() {
+ return plugin;
+ }
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/plugin.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/plugin.xml?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/plugin.xml (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/plugin.xml Tue Feb 22 15:09:30 2011
@@ -17,12 +17,12 @@
limitations under the License.
-->
<plugin>
- <extension
- point="org.eclipse.core.resources.natures" id="EasyAntNature" name="EasyAntNature">
- <runtime>
- <run class="org.apache.easyant4e.natures.EasyAntNature" />
- </runtime>
- </extension>
+ <extension
+ point="org.eclipse.core.resources.natures" id="EasyAntNature" name="EasyAntNature">
+ <runtime>
+ <run class="org.apache.easyant4e.natures.EasyAntNature" />
+ </runtime>
+ </extension>
<extension point="org.eclipse.core.resources.builders" id="EasyAntBuilder" name="EasyAntBuilder">
<builder>
@@ -95,14 +95,14 @@
</extension>
<extension point="org.eclipse.ui.console.consoleFactories">
- <consoleFactory
- label="EasyAnt Console"
- class="org.apache.easyant4e.console.EasyAntConsoleFactory"
- icon="icons/full/obj16/ant_buildfile.gif">
- </consoleFactory>
- </extension>
+ <consoleFactory
+ label="EasyAnt Console"
+ class="org.apache.easyant4e.console.EasyAntConsoleFactory"
+ icon="icons/full/obj16/ant_buildfile.gif">
+ </consoleFactory>
+ </extension>
- <extension
+ <extension
point="org.eclipse.ui.startup">
<startup
class="org.apache.easyant4e.Startup"></startup>
@@ -153,7 +153,7 @@
</extension>
-->
<!--
- <extension
+ <extension
point="org.eclipse.ui.console.consolePageParticipants">
<consolePageParticipant
class="org.apache.easyant4e.console.EasyAntConsolePageParticipant"
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/ivysettings-remote.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/ivysettings-remote.xml?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/ivysettings-remote.xml (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/ivysettings-remote.xml Tue Feb 22 15:09:30 2011
@@ -15,29 +15,29 @@
limitations under the License.
-->
<ivysettings>
- <settings defaultResolver="main"/>
- <property name="easyant.repo.url" value="http://repository.easyant.org"/>
- <!-- Directory use by ivy retreive in order to store modules (plugins and build types) -->
- <property name="easyant.modules.dir" value="${user.home}/.easyant/modules"/>
- <resolvers>
- <filesystem name="local">
- <ivy pattern="${easyant.modules.dir}/[organisation]/[module]/[revision]/[module].ivy" />
- <artifact pattern="${easyant.modules.dir}/[organisation]/[module]/[revision]/[artifact](-[classifier]).[ext]"/>
- </filesystem>
- <!-- EasyAnt modules -->
- <url name="easyant-modules">
- <ivy pattern="${easyant.repo.url}/modules/[organisation]/[module]/[revision]/[module].ivy" />
- <artifact pattern="${easyant.repo.url}/modules/[organisation]/[module]/[revision]/[artifact](-[classifier]).[ext]"/>
- </url>
- <!-- External required libraries -->
- <url name="easyant-shared">
- <ivy pattern="${easyant.repo.url}/shared/[organisation]/[module]/[revision]/[module].ivy" />
- <artifact pattern="${easyant.repo.url}/shared/[organisation]/[module]/[revision]/[artifact](-[classifier]).[ext]"/>
- </url>
- <chain name="main" returnFirst="true">
- <resolver ref="local"/>
- <resolver ref="easyant-modules" />
- <resolver ref="easyant-shared" />
- </chain>
- </resolvers>
+ <settings defaultResolver="main"/>
+ <property name="easyant.repo.url" value="http://repository.easyant.org"/>
+ <!-- Directory use by ivy retreive in order to store modules (plugins and build types) -->
+ <property name="easyant.modules.dir" value="${user.home}/.easyant/modules"/>
+ <resolvers>
+ <filesystem name="local">
+ <ivy pattern="${easyant.modules.dir}/[organisation]/[module]/[revision]/[module].ivy" />
+ <artifact pattern="${easyant.modules.dir}/[organisation]/[module]/[revision]/[artifact](-[classifier]).[ext]"/>
+ </filesystem>
+ <!-- EasyAnt modules -->
+ <url name="easyant-modules">
+ <ivy pattern="${easyant.repo.url}/modules/[organisation]/[module]/[revision]/[module].ivy" />
+ <artifact pattern="${easyant.repo.url}/modules/[organisation]/[module]/[revision]/[artifact](-[classifier]).[ext]"/>
+ </url>
+ <!-- External required libraries -->
+ <url name="easyant-shared">
+ <ivy pattern="${easyant.repo.url}/shared/[organisation]/[module]/[revision]/[module].ivy" />
+ <artifact pattern="${easyant.repo.url}/shared/[organisation]/[module]/[revision]/[artifact](-[classifier]).[ext]"/>
+ </url>
+ <chain name="main" returnFirst="true">
+ <resolver ref="local"/>
+ <resolver ref="easyant-modules" />
+ <resolver ref="easyant-shared" />
+ </chain>
+ </resolvers>
</ivysettings>
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/ivysettings.xml
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/ivysettings.xml?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/ivysettings.xml (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/ivysettings.xml Tue Feb 22 15:09:30 2011
@@ -15,24 +15,24 @@
limitations under the License.
-->
<ivysettings>
- <settings defaultResolver="main"/>
- <caches useOrigin="true" defaultCacheDir="${user.home}/.easyant/easyant-cache" />
- <!-- Directory use by ivy retreive in order to store modules (plugins and build types) -->
- <property name="easyant.repo.dir" value="${user.home}/.easyant/easyant-repository"/>
- <resolvers>
- <!-- EasyAnt modules -->
- <filesystem name="easyant-modules">
- <ivy pattern="${easyant.repo.dir}/modules/[organisation]/[module]/[revision]/[module].ivy"/>
- <artifact pattern="${easyant.repo.dir}/modules/[organisation]/[module]/[revision]/[artifact](-[classifier]).[ext]"/>
- </filesystem>
- <!-- External required libraries -->
- <filesystem name="easyant-shared">
- <ivy pattern="${easyant.repo.dir}/shared/[organisation]/[module]/[revision]/[module].ivy"/>
- <artifact pattern="${easyant.repo.dir}/shared/[organisation]/[module]/[revision]/[artifact](-[classifier]).[ext]"/>
- </filesystem>
- <chain name="main" returnFirst="true">
- <resolver ref="easyant-modules"/>
- <resolver ref="easyant-shared"/>
- </chain>
- </resolvers>
-</ivysettings>
\ No newline at end of file
+ <settings defaultResolver="main"/>
+ <caches useOrigin="true" defaultCacheDir="${user.home}/.easyant/easyant-cache" />
+ <!-- Directory use by ivy retreive in order to store modules (plugins and build types) -->
+ <property name="easyant.repo.dir" value="${user.home}/.easyant/easyant-repository"/>
+ <resolvers>
+ <!-- EasyAnt modules -->
+ <filesystem name="easyant-modules">
+ <ivy pattern="${easyant.repo.dir}/modules/[organisation]/[module]/[revision]/[module].ivy"/>
+ <artifact pattern="${easyant.repo.dir}/modules/[organisation]/[module]/[revision]/[artifact](-[classifier]).[ext]"/>
+ </filesystem>
+ <!-- External required libraries -->
+ <filesystem name="easyant-shared">
+ <ivy pattern="${easyant.repo.dir}/shared/[organisation]/[module]/[revision]/[module].ivy"/>
+ <artifact pattern="${easyant.repo.dir}/shared/[organisation]/[module]/[revision]/[artifact](-[classifier]).[ext]"/>
+ </filesystem>
+ <chain name="main" returnFirst="true">
+ <resolver ref="easyant-modules"/>
+ <resolver ref="easyant-shared"/>
+ </chain>
+ </resolvers>
+</ivysettings>
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/Activator.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/Activator.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/Activator.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/Activator.java Tue Feb 22 15:09:30 2011
@@ -33,86 +33,86 @@ import com.google.inject.Inject;
*/
public class Activator extends AbstractUIPlugin {
- private EasyAntPlugin easyAntPlugin;
- private EasyAntCoreModule easyAntCoreModule;
- private EasyAnt4EclipseModule easyAnt4EclipseModule;
-
- private EasyantCoreService easyantCoreService;
-
- @Inject
- public void setEasyantCoreService(EasyantCoreService easyantCoreService) {
- this.easyantCoreService = easyantCoreService;
- }
-
- public static final String PLUGIN_ID = "org.apache.easyant4e";
-
- // The shared instance.
- private static Activator plugin;
-
-
- /**
- * Create an activator and a EasyAntModule
- *
- */
- public Activator() {
- super();
- if (plugin == null) {
- plugin = this;
- this.easyAntCoreModule = new EasyAntCoreModule();
- this.easyAnt4EclipseModule = new EasyAnt4EclipseModule();
- }
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- initializeEasyAntPlugin();
- easyantCoreService.installPluginsRepository();
- Activator.getDefault().getLog().log(
- new Status(IStatus.INFO, Activator.PLUGIN_ID, 0, "EasyAnt For Eclipse started", null));
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- Activator.getDefault().getLog().log(
- new Status(IStatus.INFO, Activator.PLUGIN_ID, 0, "EasyAnt For Eclipse shutdown", null));
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance.
- *
- * @return the plugin instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- /**
- * Returns the EasyAnt Plugin instance.
- *
- * @return the EasyAnt plugin instance
- */
- public static EasyAntPlugin getEasyAntPlugin() {
- return getDefault().getEasyAntPluginInstance();
- }
-
- /**
- * Returns the EasyAntPlugin instance.
- */
- private EasyAntPlugin getEasyAntPluginInstance() {
- if (easyAntPlugin == null) {
- initializeEasyAntPlugin();
- }
- return easyAntPlugin;
- }
-
- private void initializeEasyAntPlugin() {
- if (easyAntPlugin == null) {
- easyAntPlugin = new EasyAntPlugin(easyAntCoreModule, easyAnt4EclipseModule);
- easyAntPlugin.injectMembers(this);
- }
- }
-
+ private EasyAntPlugin easyAntPlugin;
+ private EasyAntCoreModule easyAntCoreModule;
+ private EasyAnt4EclipseModule easyAnt4EclipseModule;
+
+ private EasyantCoreService easyantCoreService;
+
+ @Inject
+ public void setEasyantCoreService(EasyantCoreService easyantCoreService) {
+ this.easyantCoreService = easyantCoreService;
+ }
+
+ public static final String PLUGIN_ID = "org.apache.easyant4e";
+
+ // The shared instance.
+ private static Activator plugin;
+
+
+ /**
+ * Create an activator and a EasyAntModule
+ *
+ */
+ public Activator() {
+ super();
+ if (plugin == null) {
+ plugin = this;
+ this.easyAntCoreModule = new EasyAntCoreModule();
+ this.easyAnt4EclipseModule = new EasyAnt4EclipseModule();
+ }
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ initializeEasyAntPlugin();
+ easyantCoreService.installPluginsRepository();
+ Activator.getDefault().getLog().log(
+ new Status(IStatus.INFO, Activator.PLUGIN_ID, 0, "EasyAnt For Eclipse started", null));
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ Activator.getDefault().getLog().log(
+ new Status(IStatus.INFO, Activator.PLUGIN_ID, 0, "EasyAnt For Eclipse shutdown", null));
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance.
+ *
+ * @return the plugin instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the EasyAnt Plugin instance.
+ *
+ * @return the EasyAnt plugin instance
+ */
+ public static EasyAntPlugin getEasyAntPlugin() {
+ return getDefault().getEasyAntPluginInstance();
+ }
+
+ /**
+ * Returns the EasyAntPlugin instance.
+ */
+ private EasyAntPlugin getEasyAntPluginInstance() {
+ if (easyAntPlugin == null) {
+ initializeEasyAntPlugin();
+ }
+ return easyAntPlugin;
+ }
+
+ private void initializeEasyAntPlugin() {
+ if (easyAntPlugin == null) {
+ easyAntPlugin = new EasyAntPlugin(easyAntCoreModule, easyAnt4EclipseModule);
+ easyAntPlugin.injectMembers(this);
+ }
+ }
+
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/EasyAntConstants.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/EasyAntConstants.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/EasyAntConstants.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/EasyAntConstants.java Tue Feb 22 15:09:30 2011
@@ -19,34 +19,34 @@ package org.apache.easyant4e;
public interface EasyAntConstants {
-
- public static final String IVY_MODULE_TAG = "ivy-module";
- public static final String IVY_INFO_TAG = "info";
- //public static final String IVY_DESCRIPTION_TAG = "description";
-
- public static final String EASYANT_TAG = "ea:build";
- public static final String EASYANT_TYPE_ATTR = "type";
-
- public static final String EASYANT_PROPERTY_TAG = "ea:property";
- public static final String EASYANT_PROPERTY_NAME_ATTR = "name";
- public static final String EASYANT_PROPERTY_VALUE_ATTR = "value";
- public static final String EASYANT_PROPERTY_FILE_ATTR = "file";
-
- public static final String EASYANT_PLUGIN_TAG = "ea:plugin";
- public static final String EASYANT_PLUGIN_MODULE_ATTR = "module";
- public static final String EASYANT_PLUGIN_AS_ATTR = "as";
- public static final String EASYANT_PLUGIN_MODE_ATTR = "mode";
- public static final String EASYANT_PLUGIN_MODE_INCLUDE = "include";
- public static final String EASYANT_PLUGIN_MODE_IMPORT = "import";
- public static final String EASYANT_PLUGIN_MANDATORY_ATTR = "mandatory";
-
- public static final String EASYANT_BUILD_TYPES_ORG = "org.apache.easyant.buildtypes";
- public static final String EASYANT_BUILD_PLUGINS_ORG = "org.apache.easyant.plugins";
-
- public static final String PLUGINS_SETTINGS = "ivysettings.xml";
-
- //Ant log level
- public static final int ANT_LOGLEVEL_ERR = 0;
+
+ public static final String IVY_MODULE_TAG = "ivy-module";
+ public static final String IVY_INFO_TAG = "info";
+ //public static final String IVY_DESCRIPTION_TAG = "description";
+
+ public static final String EASYANT_TAG = "ea:build";
+ public static final String EASYANT_TYPE_ATTR = "type";
+
+ public static final String EASYANT_PROPERTY_TAG = "ea:property";
+ public static final String EASYANT_PROPERTY_NAME_ATTR = "name";
+ public static final String EASYANT_PROPERTY_VALUE_ATTR = "value";
+ public static final String EASYANT_PROPERTY_FILE_ATTR = "file";
+
+ public static final String EASYANT_PLUGIN_TAG = "ea:plugin";
+ public static final String EASYANT_PLUGIN_MODULE_ATTR = "module";
+ public static final String EASYANT_PLUGIN_AS_ATTR = "as";
+ public static final String EASYANT_PLUGIN_MODE_ATTR = "mode";
+ public static final String EASYANT_PLUGIN_MODE_INCLUDE = "include";
+ public static final String EASYANT_PLUGIN_MODE_IMPORT = "import";
+ public static final String EASYANT_PLUGIN_MANDATORY_ATTR = "mandatory";
+
+ public static final String EASYANT_BUILD_TYPES_ORG = "org.apache.easyant.buildtypes";
+ public static final String EASYANT_BUILD_PLUGINS_ORG = "org.apache.easyant.plugins";
+
+ public static final String PLUGINS_SETTINGS = "ivysettings.xml";
+
+ //Ant log level
+ public static final int ANT_LOGLEVEL_ERR = 0;
public static final int ANT_LOGLEVEL_WARN = 1;
public static final int ANT_LOGLEVEL_INFO = 2;
public static final int ANT_LOGLEVEL_VERBOSE = 3;
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/EasyAntPlugin.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/EasyAntPlugin.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/EasyAntPlugin.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/EasyAntPlugin.java Tue Feb 22 15:09:30 2011
@@ -36,118 +36,118 @@ import com.google.inject.Module;
public class EasyAntPlugin {
- private final Injector injector;
+ private final Injector injector;
- public EasyAntPlugin(Module... modules) {
- injector = Guice.createInjector(modules);
- injectMembers(this);
- }
-
- public void injectMembers(Object instance) {
- injector.injectMembers(instance);
- }
-
- /**
- * Return the {@link EasyantCoreService}.
- */
- /*public EasyantCoreService getEasyantCoreService() {
- return getInstance(EasyantCoreService.class);
- }*/
-
- /**
- * Return the {@link EasyantProjectService}.
- */
- /*
- public EasyantProjectService getEasyantProjectService() {
- return getInstance(EasyantProjectService.class);
- }*/
-
- public IProject getCurrentProject() {
- try {
- return getSelectedProject();
- } catch (CoreException e) {
- log(e);
- }
- return null;
- }
-
- // private IJavaProject getJavaProject() throws CoreException {
- // IProject project = getSelectedProject();
- // IJavaProject javaProject=null;
- // if(project.hasNature(JavaCore.NATURE_ID)){
- // javaProject = (IJavaProject)project.getNature(JavaCore.NATURE_ID);
- // }
- // return javaProject;
- //}
-
- private IProject getSelectedProject() throws CoreException {
- IProject project = null;
- Object selectedResource = getSelectedResource();
- if (selectedResource instanceof IResource) {
- IResource resource = (IResource) selectedResource;
- project = resource.getProject();
- } else if (selectedResource instanceof ClassPathContainer) {
- // FIXME maybe use Adaptable and WorkbenchAdapter to resolve project
- // container
- project = ((ClassPathContainer) selectedResource).getJavaProject().getProject();
- }
- return project;
- }
-
- private Object getSelectedResource() {
- IStructuredSelection selection = getStructuredSelection();
- if (selection != null) {
- Object element = selection.getFirstElement();
- return element;
- }
- return null;
- }
-
- private IStructuredSelection getStructuredSelection() {
- ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService()
- .getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) selection;
- return ss;
- }
- return null;
- }
-
- public void log(int severity, String message) {
- log(severity, message, null);
- }
-
- public void log(int severity, String message, Throwable e) {
- log(new Status(severity, Activator.PLUGIN_ID, 0, message, e));
- }
-
- public void log(CoreException e) {
- log(e.getStatus().getSeverity(), "EasyAnt For Eclipse - Internal Error", e);
- }
-
- public void log(IStatus status) {
- Activator.getDefault().getLog().log(status);
- }
-
- /**
- * Return the workspace used by the workbench
- *
- * This method is internal to the workbench and must not be called by any
- * plugins.
- */
- public IWorkspace getPluginWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- /**
- * Get instances from the injector.
- *
- * @param type
- * the type to get an instance of
- * @return the instance
- */
- public <T> T getInstance(Class<T> type) {
- return injector.getInstance(type);
- }
+ public EasyAntPlugin(Module... modules) {
+ injector = Guice.createInjector(modules);
+ injectMembers(this);
+ }
+
+ public void injectMembers(Object instance) {
+ injector.injectMembers(instance);
+ }
+
+ /**
+ * Return the {@link EasyantCoreService}.
+ */
+ /*public EasyantCoreService getEasyantCoreService() {
+ return getInstance(EasyantCoreService.class);
+ }*/
+
+ /**
+ * Return the {@link EasyantProjectService}.
+ */
+ /*
+ public EasyantProjectService getEasyantProjectService() {
+ return getInstance(EasyantProjectService.class);
+ }*/
+
+ public IProject getCurrentProject() {
+ try {
+ return getSelectedProject();
+ } catch (CoreException e) {
+ log(e);
+ }
+ return null;
+ }
+
+ // private IJavaProject getJavaProject() throws CoreException {
+ // IProject project = getSelectedProject();
+ // IJavaProject javaProject=null;
+ // if(project.hasNature(JavaCore.NATURE_ID)){
+ // javaProject = (IJavaProject)project.getNature(JavaCore.NATURE_ID);
+ // }
+ // return javaProject;
+ //}
+
+ private IProject getSelectedProject() throws CoreException {
+ IProject project = null;
+ Object selectedResource = getSelectedResource();
+ if (selectedResource instanceof IResource) {
+ IResource resource = (IResource) selectedResource;
+ project = resource.getProject();
+ } else if (selectedResource instanceof ClassPathContainer) {
+ // FIXME maybe use Adaptable and WorkbenchAdapter to resolve project
+ // container
+ project = ((ClassPathContainer) selectedResource).getJavaProject().getProject();
+ }
+ return project;
+ }
+
+ private Object getSelectedResource() {
+ IStructuredSelection selection = getStructuredSelection();
+ if (selection != null) {
+ Object element = selection.getFirstElement();
+ return element;
+ }
+ return null;
+ }
+
+ private IStructuredSelection getStructuredSelection() {
+ ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService()
+ .getSelection();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ return ss;
+ }
+ return null;
+ }
+
+ public void log(int severity, String message) {
+ log(severity, message, null);
+ }
+
+ public void log(int severity, String message, Throwable e) {
+ log(new Status(severity, Activator.PLUGIN_ID, 0, message, e));
+ }
+
+ public void log(CoreException e) {
+ log(e.getStatus().getSeverity(), "EasyAnt For Eclipse - Internal Error", e);
+ }
+
+ public void log(IStatus status) {
+ Activator.getDefault().getLog().log(status);
+ }
+
+ /**
+ * Return the workspace used by the workbench
+ *
+ * This method is internal to the workbench and must not be called by any
+ * plugins.
+ */
+ public IWorkspace getPluginWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ /**
+ * Get instances from the injector.
+ *
+ * @param type
+ * the type to get an instance of
+ * @return the instance
+ */
+ public <T> T getInstance(Class<T> type) {
+ return injector.getInstance(type);
+ }
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/Startup.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/Startup.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/Startup.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/Startup.java Tue Feb 22 15:09:30 2011
@@ -27,33 +27,33 @@ import org.eclipse.ui.IStartup;
// http://wiki.eclipse.org/FAQ_How_do_I_make_my_plug-in_dynamic_enabled%3F
public class Startup implements IStartup {
- public void earlyStartup() {
- //TODO add aspect to kill
- //ExtensionRegistry -> private boolean checkReadWriteAccess(Object key, boolean persist) {
-
-// System.out.println("--- clean IvyDE extension");
-// IExtensionRegistry reg = RegistryFactory.getRegistry();
-// IExtension[] extensions = reg.getExtensions("org.apache.ivyde.eclipse");
-// for (IExtension extension : extensions) {
-// if ("org.eclipse.ui.popupMenus".equals(extension.getExtensionPointUniqueIdentifier())) {
-// System.out.println("--> remove "+extension);
-// try{
-// reg.removeExtension(extension, getUserToken());
-// }catch(Exception e){
-// e.printStackTrace();
-// }
-// System.out.println("--> extension removed!");
-// break;
-// }
-// }
- }
+ public void earlyStartup() {
+ //TODO add aspect to kill
+ //ExtensionRegistry -> private boolean checkReadWriteAccess(Object key, boolean persist) {
+
+// System.out.println("--- clean IvyDE extension");
+// IExtensionRegistry reg = RegistryFactory.getRegistry();
+// IExtension[] extensions = reg.getExtensions("org.apache.ivyde.eclipse");
+// for (IExtension extension : extensions) {
+// if ("org.eclipse.ui.popupMenus".equals(extension.getExtensionPointUniqueIdentifier())) {
+// System.out.println("--> remove "+extension);
+// try{
+// reg.removeExtension(extension, getUserToken());
+// }catch(Exception e){
+// e.printStackTrace();
+// }
+// System.out.println("--> extension removed!");
+// break;
+// }
+// }
+ }
- /*
- private Object getUserToken() {
- IExtensionRegistry registry = RegistryFactory.getRegistry();
- //return null; // require -Declipse.registry.nulltoken=true
- return ((ExtensionRegistry) registry).getTemporaryUserToken();
- }
+ /*
+ private Object getUserToken() {
+ IExtensionRegistry registry = RegistryFactory.getRegistry();
+ //return null; // require -Declipse.registry.nulltoken=true
+ return ((ExtensionRegistry) registry).getTemporaryUserToken();
+ }
*/
-
+
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/builders/EasyAntBuilder.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/builders/EasyAntBuilder.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/builders/EasyAntBuilder.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/builders/EasyAntBuilder.java Tue Feb 22 15:09:30 2011
@@ -40,61 +40,61 @@ import com.google.inject.Inject;
*/
public class EasyAntBuilder extends IncrementalProjectBuilder {
- private IProgressMonitor monitor;
+ private IProgressMonitor monitor;
- private EasyantProjectService easyantProjectService;
-
- public EasyAntBuilder(){
- Activator.getEasyAntPlugin().injectMembers(this);
- }
-
- @Inject
- public void setEasyantProjectService(EasyantProjectService easyantProjectService) {
- this.easyantProjectService = easyantProjectService;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected IProject[] build(final int kind, final Map args, final IProgressMonitor monitor) throws CoreException {
- this.monitor = monitor;
- if (!getProject().exists()) {
- return new IProject[] {};
- } else {
- try {
- if (FULL_BUILD == kind) {
- doBuild();
- } else { // FIXME maybe check INCREMENTAL_BUILD or AUTO_BUILD
- IResourceDelta delta = getDelta(getProject());
- if (delta == null) {
- doBuild();
- } else {
- doBuild(delta);
- }
- }
- } catch (OperationCanceledException e) {
- Activator.getEasyAntPlugin().log(IStatus.CANCEL, "EasyAnt build canceled", e);
- }
- return null;
- }
- }
+ private EasyantProjectService easyantProjectService;
+
+ public EasyAntBuilder(){
+ Activator.getEasyAntPlugin().injectMembers(this);
+ }
+
+ @Inject
+ public void setEasyantProjectService(EasyantProjectService easyantProjectService) {
+ this.easyantProjectService = easyantProjectService;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected IProject[] build(final int kind, final Map args, final IProgressMonitor monitor) throws CoreException {
+ this.monitor = monitor;
+ if (!getProject().exists()) {
+ return new IProject[] {};
+ } else {
+ try {
+ if (FULL_BUILD == kind) {
+ doBuild();
+ } else { // FIXME maybe check INCREMENTAL_BUILD or AUTO_BUILD
+ IResourceDelta delta = getDelta(getProject());
+ if (delta == null) {
+ doBuild();
+ } else {
+ doBuild(delta);
+ }
+ }
+ } catch (OperationCanceledException e) {
+ Activator.getEasyAntPlugin().log(IStatus.CANCEL, "EasyAnt build canceled", e);
+ }
+ return null;
+ }
+ }
- protected void doBuild() throws CoreException {
- IWorkspaceRunnable buildOperation = createBuildOperation();
- buildOperation.run(monitor);
- }
+ protected void doBuild() throws CoreException {
+ IWorkspaceRunnable buildOperation = createBuildOperation();
+ buildOperation.run(monitor);
+ }
- protected void doBuild(IResourceDelta delta) throws CoreException {
- doBuild();
- }
-
- private IWorkspaceRunnable createBuildOperation(){
- // TODO maybe use WorkspaceModifyOperation
- return new IWorkspaceRunnable(){
- public void run(IProgressMonitor monitor) throws CoreException {
- // TODO call good target
- easyantProjectService.runBuild(getProject(), "compile", EasyAntConstants.ANT_LOGLEVEL_WARN, monitor);
- }
- };
- }
+ protected void doBuild(IResourceDelta delta) throws CoreException {
+ doBuild();
+ }
+
+ private IWorkspaceRunnable createBuildOperation(){
+ // TODO maybe use WorkspaceModifyOperation
+ return new IWorkspaceRunnable(){
+ public void run(IProgressMonitor monitor) throws CoreException {
+ // TODO call good target
+ easyantProjectService.runBuild(getProject(), "compile", EasyAntConstants.ANT_LOGLEVEL_WARN, monitor);
+ }
+ };
+ }
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/console/EasyAntConsole.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/console/EasyAntConsole.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/console/EasyAntConsole.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/console/EasyAntConsole.java Tue Feb 22 15:09:30 2011
@@ -21,14 +21,14 @@ import org.eclipse.ui.console.IConsole;
public interface EasyAntConsole extends IConsole{
- void show();
- void close();
- boolean isOpen();
-
- void info(String msg);
- void error(String msg);
-
- /**
+ void show();
+ void close();
+ boolean isOpen();
+
+ void info(String msg);
+ void error(String msg);
+
+ /**
* Show the console.
*
* @param showNoMatterWhat
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/console/EasyAntConsoleFactory.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/console/EasyAntConsoleFactory.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/console/EasyAntConsoleFactory.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/console/EasyAntConsoleFactory.java Tue Feb 22 15:09:30 2011
@@ -23,21 +23,21 @@ import org.eclipse.ui.console.IConsoleFa
import com.google.inject.Inject;
public class EasyAntConsoleFactory implements IConsoleFactory {
-
- private EasyAntConsole console;
-
- public EasyAntConsoleFactory(){
- Activator.getEasyAntPlugin().injectMembers(this);
- }
-
- @Inject
- public void setConsole(EasyAntConsole console) {
- this.console = console;
- }
-
- public void openConsole() {
- if (console != null) {
- console.show();
- }
- }
+
+ private EasyAntConsole console;
+
+ public EasyAntConsoleFactory(){
+ Activator.getEasyAntPlugin().injectMembers(this);
+ }
+
+ @Inject
+ public void setConsole(EasyAntConsole console) {
+ this.console = console;
+ }
+
+ public void openConsole() {
+ if (console != null) {
+ console.show();
+ }
+ }
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/console/EasyAntConsoleImpl.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/console/EasyAntConsoleImpl.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/console/EasyAntConsoleImpl.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/console/EasyAntConsoleImpl.java Tue Feb 22 15:09:30 2011
@@ -32,66 +32,66 @@ import org.eclipse.ui.console.IConsoleMa
import com.google.inject.Inject;
public class EasyAntConsoleImpl extends IvyConsole implements EasyAntConsole {
-
- private boolean isOpen=false;
-
- public boolean isOpen() {
- //TODO get the stat
- return isOpen;
- }
+
+ private boolean isOpen=false;
+
+ public boolean isOpen() {
+ //TODO get the stat
+ return isOpen;
+ }
- public void setOpen(boolean isOpen) {
- this.isOpen = isOpen;
- }
-
- @Inject
- public EasyAntConsoleImpl(ImageProvider imageProvider) {
- super("EasyAnt", imageProvider.getConsoleImageDescriptor());
- }
+ public void setOpen(boolean isOpen) {
+ this.isOpen = isOpen;
+ }
+
+ @Inject
+ public EasyAntConsoleImpl(ImageProvider imageProvider) {
+ super("EasyAnt", imageProvider.getConsoleImageDescriptor());
+ }
- public void show() {
- IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
- IConsole[] existing = manager.getConsoles();
- boolean exists = false;
- for (int i = 0; i < existing.length; i++) {
- if (this == existing[i]) {
- exists = true;
- }
- }
- if (!exists) {
- manager.addConsoles(new IConsole[] { this });
- }
- manager.showConsoleView(this);
- setOpen(true);
-
- //show the Error log view
- showErrorLogView();
-
- }
-
- private void showErrorLogView(){
- if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
+ public void show() {
+ IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
+ IConsole[] existing = manager.getConsoles();
+ boolean exists = false;
+ for (int i = 0; i < existing.length; i++) {
+ if (this == existing[i]) {
+ exists = true;
+ }
+ }
+ if (!exists) {
+ manager.addConsoles(new IConsole[] { this });
+ }
+ manager.showConsoleView(this);
+ setOpen(true);
+
+ //show the Error log view
+ showErrorLogView();
+
+ }
+
+ private void showErrorLogView(){
+ if (PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
if (PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() != null) {
try {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("org.eclipse.pde.runtime.LogView", null, IWorkbenchPage.VIEW_ACTIVATE);
- } catch (PartInitException e) {
- Activator.getEasyAntPlugin().log(IStatus.ERROR, "Cannot show the Error Log view.", e);
- }
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("org.eclipse.pde.runtime.LogView", null, IWorkbenchPage.VIEW_ACTIVATE);
+ } catch (PartInitException e) {
+ Activator.getEasyAntPlugin().log(IStatus.ERROR, "Cannot show the Error Log view.", e);
+ }
}
- }
- }
+ }
+ }
- @Override
- public void error(String msg) {
- showErrorLogView();
- super.error(msg);
- }
+ @Override
+ public void error(String msg) {
+ showErrorLogView();
+ super.error(msg);
+ }
- public void close() {
- IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
- manager.removeConsoles(new IConsole[] { this });
- //ConsolePlugin.getDefault().getConsoleManager().addConsoleListener(new MyLifecycle());
- setOpen(false);
- }
-
+ public void close() {
+ IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
+ manager.removeConsoles(new IConsole[] { this });
+ //ConsolePlugin.getDefault().getConsoleManager().addConsoleListener(new MyLifecycle());
+ setOpen(false);
+ }
+
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/console/EasyAntConsolePageParticipant.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/console/EasyAntConsolePageParticipant.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/console/EasyAntConsolePageParticipant.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/console/EasyAntConsolePageParticipant.java Tue Feb 22 15:09:30 2011
@@ -23,28 +23,28 @@ import org.eclipse.ui.part.IPageBookView
public class EasyAntConsolePageParticipant implements IConsolePageParticipant {
- //private CloseConsoleAction closeAction;
+ //private CloseConsoleAction closeAction;
- public void init(IPageBookViewPage page, IConsole console) {
- // closeAction = new IvyConsoleRemoveAction(console);
- // IToolBarManager manager =
- // page.getSite().getActionBars().getToolBarManager();
- // manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, closeAction);
- }
-
- public void dispose() {
- // closeAction = null;
- }
-
- @SuppressWarnings("unchecked")
- public Object getAdapter(Class adapter) {
- return null;
- }
+ public void init(IPageBookViewPage page, IConsole console) {
+ // closeAction = new IvyConsoleRemoveAction(console);
+ // IToolBarManager manager =
+ // page.getSite().getActionBars().getToolBarManager();
+ // manager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, closeAction);
+ }
+
+ public void dispose() {
+ // closeAction = null;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
- public void activated() {
- }
+ public void activated() {
+ }
- public void deactivated() {
- }
+ public void deactivated() {
+ }
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/RepositoryInstaller.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/RepositoryInstaller.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/RepositoryInstaller.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/RepositoryInstaller.java Tue Feb 22 15:09:30 2011
@@ -33,70 +33,70 @@ import org.eclipse.core.runtime.IStatus;
* This class unpack the default EasyAnt repository in local file system.
*/
public class RepositoryInstaller {
- static final int BUFFER_SIZE = 102400;
- static final String REPOSITORY_ARCHIVE_PATH = "repository.zip";
- private URL interpreterZipUrl;
+ static final int BUFFER_SIZE = 102400;
+ static final String REPOSITORY_ARCHIVE_PATH = "repository.zip";
+ private URL interpreterZipUrl;
- public void install(File installDir) {
- this.interpreterZipUrl = Activator.getDefault().getBundle().getResource(REPOSITORY_ARCHIVE_PATH);
- try {
- unPackArchive(installDir);
- } catch (IOException e) {
- Activator.getEasyAntPlugin().log(IStatus.ERROR, "Cannot install EasyAnt repository", e);
- }
- }
+ public void install(File installDir) {
+ this.interpreterZipUrl = Activator.getDefault().getBundle().getResource(REPOSITORY_ARCHIVE_PATH);
+ try {
+ unPackArchive(installDir);
+ } catch (IOException e) {
+ Activator.getEasyAntPlugin().log(IStatus.ERROR, "Cannot install EasyAnt repository", e);
+ }
+ }
- private void unPackArchive(File installDir) throws IOException {
- InputStream inputStream = this.interpreterZipUrl.openStream();
- ZipInputStream zipFileStream = new ZipInputStream(inputStream);
- ZipEntry zipEntry = zipFileStream.getNextEntry();
- while (zipEntry != null) {
- File destination = new File(installDir.getPath(), zipEntry.getName());
- if (!zipEntry.isDirectory()) {
- /*
- * Copy files (and make sure parent directory exist)
- */
- File parentFile = destination.getParentFile();
- boolean parentFileExist = isFileExists(parentFile);
- if (!parentFileExist) {
- parentFileExist = parentFile.mkdirs();
- }
- if (parentFileExist) {
- OutputStream os = null;
- try {
- os = new FileOutputStream(destination);
- byte[] buffer = new byte[BUFFER_SIZE];
- while (true) {
- int len = zipFileStream.read(buffer);
- if (zipFileStream.available() == 0) {
- break;
- }
- os.write(buffer, 0, len);
- }
- } finally {
- if (null != os) {
- os.close();
- }
- }
- } else {
- Activator.getEasyAntPlugin().log(IStatus.ERROR,
- "Installing EasyAnt repository, but " + parentFile + " already exists!");
- }
- } else {
- boolean created = destination.mkdirs();
- if (!created) {
- Activator.getEasyAntPlugin().log(IStatus.ERROR,
- "Installing EasyAnt repository. Cannot create directory: " + destination);
- }
- }
- zipFileStream.closeEntry();
- zipEntry = zipFileStream.getNextEntry();
- }
- inputStream.close();
- zipFileStream.close();
- }
+ private void unPackArchive(File installDir) throws IOException {
+ InputStream inputStream = this.interpreterZipUrl.openStream();
+ ZipInputStream zipFileStream = new ZipInputStream(inputStream);
+ ZipEntry zipEntry = zipFileStream.getNextEntry();
+ while (zipEntry != null) {
+ File destination = new File(installDir.getPath(), zipEntry.getName());
+ if (!zipEntry.isDirectory()) {
+ /*
+ * Copy files (and make sure parent directory exist)
+ */
+ File parentFile = destination.getParentFile();
+ boolean parentFileExist = isFileExists(parentFile);
+ if (!parentFileExist) {
+ parentFileExist = parentFile.mkdirs();
+ }
+ if (parentFileExist) {
+ OutputStream os = null;
+ try {
+ os = new FileOutputStream(destination);
+ byte[] buffer = new byte[BUFFER_SIZE];
+ while (true) {
+ int len = zipFileStream.read(buffer);
+ if (zipFileStream.available() == 0) {
+ break;
+ }
+ os.write(buffer, 0, len);
+ }
+ } finally {
+ if (null != os) {
+ os.close();
+ }
+ }
+ } else {
+ Activator.getEasyAntPlugin().log(IStatus.ERROR,
+ "Installing EasyAnt repository, but " + parentFile + " already exists!");
+ }
+ } else {
+ boolean created = destination.mkdirs();
+ if (!created) {
+ Activator.getEasyAntPlugin().log(IStatus.ERROR,
+ "Installing EasyAnt repository. Cannot create directory: " + destination);
+ }
+ }
+ zipFileStream.closeEntry();
+ zipEntry = zipFileStream.getNextEntry();
+ }
+ inputStream.close();
+ zipFileStream.close();
+ }
- private boolean isFileExists(File file) {
- return (null != file && file.exists());
- }
+ private boolean isFileExists(File file) {
+ return (null != file && file.exists());
+ }
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/model/EasyAntModuleDescriptorExtension.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/model/EasyAntModuleDescriptorExtension.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/model/EasyAntModuleDescriptorExtension.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/model/EasyAntModuleDescriptorExtension.java Tue Feb 22 15:09:30 2011
@@ -61,267 +61,267 @@ import com.google.inject.Inject;
*/
public class EasyAntModuleDescriptorExtension implements ModuleDescriptorExtension {
- private IvyModuleDescriptorModel model;
- private IvyTag rootTag;
- private EasyantCoreService easyantCoreService;
-
- @Inject
- public void setEasyantCoreService(EasyantCoreService easyantCoreService) {
- this.easyantCoreService=easyantCoreService;
- }
-
- public EasyAntModuleDescriptorExtension() {
- super();
- Activator.getEasyAntPlugin().injectMembers(this);
- }
-
- public IvyModuleDescriptorModel contributeModel(IvyModuleDescriptorModel model) {
- this.model = model;
- this.rootTag = model.getRootIvyTag();
- contributeEasyAntTag();
- return model;
- }
-
- private IvyTag contributeEasyAntTag() {
- IvyTag easyAntTag = createEasyAndTag();
- return easyAntTag;
- }
-
- private IvyTag createEasyAndTag() {
- IvyTag easyAntTag = new IvyTag(EASYANT_TAG, "Describes how to build this module with EasyAnt.");
- easyAntTag.addAttribute(new IvyTagAttribute(EASYANT_TYPE_ATTR, "The name of the build type used to build this module.", true,
- createBuildTypesValueProvider()));
- model.addTag(easyAntTag);
- getDescriptionTag().addChildIvyTag(easyAntTag);
- easyAntTag = createEasyAndTagChilds(easyAntTag);
- return easyAntTag;
- }
-
- private IvyTag createEasyAndTagChilds(IvyTag easyAntTag) {
- createPropertyTag(rootTag, easyAntTag);
- createPluginTag(rootTag, easyAntTag);
- return easyAntTag;
- }
-
- private IvyTag getDescriptionTag() {
- return model.getIvyTag(IVY_INFO_TAG, IVY_MODULE_TAG);
- }
-
- private IDocumentedValueProvider createBuildTypesValueProvider() {
- final List<String> buildTypes = getBuildTypes();
- IDocumentedValueProvider buildTypesValueProvider = new IDocumentedValueProvider() {
- public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
- return buildTypes.toArray(new String[buildTypes.size()]);
- }
- public String getDocForValue(String value, IvyFile ivyFile) {
- String description = easyantCoreService.getBuildTypeDescription(value);
- return description;
- }
- };
- return buildTypesValueProvider;
- }
-
- private List<String> getBuildTypes() {
- // load default build types
- final ArrayList<String> buildTypes = new ArrayList<String>();
- Job job = new Job("Easyant - Getting list of Build Types (" + EASYANT_BUILD_TYPES_ORG + ") " + "from repository ...") {
- protected IStatus run(IProgressMonitor monitor) {
- for (String module : easyantCoreService.getAllCoreBuildTypes()) {
- String shortName = module.substring(module.indexOf("#")+1);
- buildTypes.add(shortName);
- buildTypes.add(module);
- }
- return Status.OK_STATUS;
- }
- };
- job.setPriority(Job.LONG);
- job.schedule();
- return buildTypes;
- }
-
- private IvyTag createPropertyTag(IvyTag root, IvyTag parent) {
- // Contribute <property name="" value=""> Tag
- IvyTag propertyTag = new IvyTag(EASYANT_PROPERTY_TAG, "Define a property in order to configure the build type or plugins.");
- propertyTag.addAttribute(new IvyTagAttribute(EASYANT_PROPERTY_NAME_ATTR, "The name of property. (associated with the 'value' tag)", false,
- createPropertyNameValueProvider()));
- propertyTag.addAttribute(new IvyTagAttribute(EASYANT_PROPERTY_VALUE_ATTR, "The value of property identified by the 'name' tag", false,
- createPropertyValueProvider()));
- propertyTag.addAttribute(new IvyTagAttribute(EASYANT_PROPERTY_FILE_ATTR, "Define a property file containing some properties 'name=value' pairs.", false));
- model.addTag(propertyTag);
- parent.addChildIvyTag(propertyTag);
- return propertyTag;
- }
-
- private IvyTag createPluginTag(IvyTag root, IvyTag parent) {
- // Contribute <plugin module="" as=""> Tag
- IvyTag propertyTag = new IvyTag(EASYANT_PLUGIN_TAG, "Define a plugin used to contribute additionnal parts of the build process.");
- propertyTag.addAttribute(new IvyTagAttribute(EASYANT_PLUGIN_MODULE_ATTR, "The name of the plugin.", true,
- createPluginModuleValueProvider()));
- propertyTag.addAttribute(new IvyTagAttribute(EASYANT_PLUGIN_AS_ATTR, "The name of the prefix used to call plugin's targets, i.e. for 'as=\"myplugin\"': myplugin:target1", true));
- propertyTag.addAttribute(new IvyTagAttribute(EASYANT_PLUGIN_MODE_ATTR, "The kind of import.", true,
- createPluginModeValueProvider()));
- propertyTag.addAttribute(new IvyTagAttribute(EASYANT_PLUGIN_MANDATORY_ATTR, "The mandatory status", false,
- createPluginMandatoryValueProvider()));
- model.addTag(propertyTag);
- parent.addChildIvyTag(propertyTag);
- return propertyTag;
- }
-
- private IDocumentedValueProvider createPluginModuleValueProvider() {
- final List<String> buildPlugins = getBuildPlugins();
- IDocumentedValueProvider pluginModuleValueProvider = new IDocumentedValueProvider() {
- public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
- return buildPlugins.toArray(new String[buildPlugins.size()]);
- }
- public String getDocForValue(String value, IvyFile ivyFile) {
- String description = easyantCoreService.getPluginDescription(value);
- return description;
- }
- };
- return pluginModuleValueProvider;
- }
-
- private List<String> getBuildPlugins() {
- final ArrayList<String> buildPlugins = new ArrayList<String>();
- // load default build plugins
- Job job = new Job("Easyant - Getting list of Plugins (" + EASYANT_BUILD_PLUGINS_ORG + ") from repository ...") {
- protected IStatus run(IProgressMonitor monitor) {
- for (String module : easyantCoreService.getAllCorePlugins()) {
- String shortName = module.substring(module.indexOf("#")+1);
- buildPlugins.add(shortName);
- buildPlugins.add(module);
- }
- return Status.OK_STATUS;
- }
- };
- job.setPriority(Job.LONG);
- job.schedule();
- return buildPlugins;
- }
-
- private IDocumentedValueProvider createPluginModeValueProvider() {
- IDocumentedValueProvider pluginModeValueProvider = new IDocumentedValueProvider() {
- public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
- return new String[] { EASYANT_PLUGIN_MODE_IMPORT, EASYANT_PLUGIN_MODE_INCLUDE };
- }
- public String getDocForValue(String value, IvyFile ivyFile) {
- //TODO get documentation for import and include
- return null;
- }
- };
- return pluginModeValueProvider;
- }
-
- private IDocumentedValueProvider createPluginMandatoryValueProvider() {
- IDocumentedValueProvider pluginMandatoryValueProvider = new IDocumentedValueProvider() {
- public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
- return new String[] { Boolean.TRUE.toString(), Boolean.FALSE.toString() };
- }
- public String getDocForValue(String value, IvyFile ivyFile) {
- return null;
- }
- };
- return pluginMandatoryValueProvider;
- }
-
- private IDocumentedValueProvider createPropertyValueProvider() {
- IDocumentedValueProvider propertyValueValueProvider = new IDocumentedValueProvider() {
-
- public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
- PropertyDescriptor propertyDescriptor = getPropertyDescriptor(att, ivyFile);
- if (propertyDescriptor != null) {
- String value = propertyDescriptor.getDefaultValue();
- if(value==null){
- value = propertyDescriptor.getValue();
- }
- if(value!=null){
- return new String[] { value };
+ private IvyModuleDescriptorModel model;
+ private IvyTag rootTag;
+ private EasyantCoreService easyantCoreService;
+
+ @Inject
+ public void setEasyantCoreService(EasyantCoreService easyantCoreService) {
+ this.easyantCoreService=easyantCoreService;
+ }
+
+ public EasyAntModuleDescriptorExtension() {
+ super();
+ Activator.getEasyAntPlugin().injectMembers(this);
+ }
+
+ public IvyModuleDescriptorModel contributeModel(IvyModuleDescriptorModel model) {
+ this.model = model;
+ this.rootTag = model.getRootIvyTag();
+ contributeEasyAntTag();
+ return model;
+ }
+
+ private IvyTag contributeEasyAntTag() {
+ IvyTag easyAntTag = createEasyAndTag();
+ return easyAntTag;
+ }
+
+ private IvyTag createEasyAndTag() {
+ IvyTag easyAntTag = new IvyTag(EASYANT_TAG, "Describes how to build this module with EasyAnt.");
+ easyAntTag.addAttribute(new IvyTagAttribute(EASYANT_TYPE_ATTR, "The name of the build type used to build this module.", true,
+ createBuildTypesValueProvider()));
+ model.addTag(easyAntTag);
+ getDescriptionTag().addChildIvyTag(easyAntTag);
+ easyAntTag = createEasyAndTagChilds(easyAntTag);
+ return easyAntTag;
+ }
+
+ private IvyTag createEasyAndTagChilds(IvyTag easyAntTag) {
+ createPropertyTag(rootTag, easyAntTag);
+ createPluginTag(rootTag, easyAntTag);
+ return easyAntTag;
+ }
+
+ private IvyTag getDescriptionTag() {
+ return model.getIvyTag(IVY_INFO_TAG, IVY_MODULE_TAG);
+ }
+
+ private IDocumentedValueProvider createBuildTypesValueProvider() {
+ final List<String> buildTypes = getBuildTypes();
+ IDocumentedValueProvider buildTypesValueProvider = new IDocumentedValueProvider() {
+ public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+ return buildTypes.toArray(new String[buildTypes.size()]);
+ }
+ public String getDocForValue(String value, IvyFile ivyFile) {
+ String description = easyantCoreService.getBuildTypeDescription(value);
+ return description;
+ }
+ };
+ return buildTypesValueProvider;
+ }
+
+ private List<String> getBuildTypes() {
+ // load default build types
+ final ArrayList<String> buildTypes = new ArrayList<String>();
+ Job job = new Job("Easyant - Getting list of Build Types (" + EASYANT_BUILD_TYPES_ORG + ") " + "from repository ...") {
+ protected IStatus run(IProgressMonitor monitor) {
+ for (String module : easyantCoreService.getAllCoreBuildTypes()) {
+ String shortName = module.substring(module.indexOf("#")+1);
+ buildTypes.add(shortName);
+ buildTypes.add(module);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.setPriority(Job.LONG);
+ job.schedule();
+ return buildTypes;
+ }
+
+ private IvyTag createPropertyTag(IvyTag root, IvyTag parent) {
+ // Contribute <property name="" value=""> Tag
+ IvyTag propertyTag = new IvyTag(EASYANT_PROPERTY_TAG, "Define a property in order to configure the build type or plugins.");
+ propertyTag.addAttribute(new IvyTagAttribute(EASYANT_PROPERTY_NAME_ATTR, "The name of property. (associated with the 'value' tag)", false,
+ createPropertyNameValueProvider()));
+ propertyTag.addAttribute(new IvyTagAttribute(EASYANT_PROPERTY_VALUE_ATTR, "The value of property identified by the 'name' tag", false,
+ createPropertyValueProvider()));
+ propertyTag.addAttribute(new IvyTagAttribute(EASYANT_PROPERTY_FILE_ATTR, "Define a property file containing some properties 'name=value' pairs.", false));
+ model.addTag(propertyTag);
+ parent.addChildIvyTag(propertyTag);
+ return propertyTag;
+ }
+
+ private IvyTag createPluginTag(IvyTag root, IvyTag parent) {
+ // Contribute <plugin module="" as=""> Tag
+ IvyTag propertyTag = new IvyTag(EASYANT_PLUGIN_TAG, "Define a plugin used to contribute additionnal parts of the build process.");
+ propertyTag.addAttribute(new IvyTagAttribute(EASYANT_PLUGIN_MODULE_ATTR, "The name of the plugin.", true,
+ createPluginModuleValueProvider()));
+ propertyTag.addAttribute(new IvyTagAttribute(EASYANT_PLUGIN_AS_ATTR, "The name of the prefix used to call plugin's targets, i.e. for 'as=\"myplugin\"': myplugin:target1", true));
+ propertyTag.addAttribute(new IvyTagAttribute(EASYANT_PLUGIN_MODE_ATTR, "The kind of import.", true,
+ createPluginModeValueProvider()));
+ propertyTag.addAttribute(new IvyTagAttribute(EASYANT_PLUGIN_MANDATORY_ATTR, "The mandatory status", false,
+ createPluginMandatoryValueProvider()));
+ model.addTag(propertyTag);
+ parent.addChildIvyTag(propertyTag);
+ return propertyTag;
+ }
+
+ private IDocumentedValueProvider createPluginModuleValueProvider() {
+ final List<String> buildPlugins = getBuildPlugins();
+ IDocumentedValueProvider pluginModuleValueProvider = new IDocumentedValueProvider() {
+ public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+ return buildPlugins.toArray(new String[buildPlugins.size()]);
+ }
+ public String getDocForValue(String value, IvyFile ivyFile) {
+ String description = easyantCoreService.getPluginDescription(value);
+ return description;
+ }
+ };
+ return pluginModuleValueProvider;
+ }
+
+ private List<String> getBuildPlugins() {
+ final ArrayList<String> buildPlugins = new ArrayList<String>();
+ // load default build plugins
+ Job job = new Job("Easyant - Getting list of Plugins (" + EASYANT_BUILD_PLUGINS_ORG + ") from repository ...") {
+ protected IStatus run(IProgressMonitor monitor) {
+ for (String module : easyantCoreService.getAllCorePlugins()) {
+ String shortName = module.substring(module.indexOf("#")+1);
+ buildPlugins.add(shortName);
+ buildPlugins.add(module);
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.setPriority(Job.LONG);
+ job.schedule();
+ return buildPlugins;
+ }
+
+ private IDocumentedValueProvider createPluginModeValueProvider() {
+ IDocumentedValueProvider pluginModeValueProvider = new IDocumentedValueProvider() {
+ public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+ return new String[] { EASYANT_PLUGIN_MODE_IMPORT, EASYANT_PLUGIN_MODE_INCLUDE };
+ }
+ public String getDocForValue(String value, IvyFile ivyFile) {
+ //TODO get documentation for import and include
+ return null;
+ }
+ };
+ return pluginModeValueProvider;
+ }
+
+ private IDocumentedValueProvider createPluginMandatoryValueProvider() {
+ IDocumentedValueProvider pluginMandatoryValueProvider = new IDocumentedValueProvider() {
+ public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+ return new String[] { Boolean.TRUE.toString(), Boolean.FALSE.toString() };
+ }
+ public String getDocForValue(String value, IvyFile ivyFile) {
+ return null;
+ }
+ };
+ return pluginMandatoryValueProvider;
+ }
+
+ private IDocumentedValueProvider createPropertyValueProvider() {
+ IDocumentedValueProvider propertyValueValueProvider = new IDocumentedValueProvider() {
+
+ public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+ PropertyDescriptor propertyDescriptor = getPropertyDescriptor(att, ivyFile);
+ if (propertyDescriptor != null) {
+ String value = propertyDescriptor.getDefaultValue();
+ if(value==null){
+ value = propertyDescriptor.getValue();
}
- return new String[] {};
- }
- return new String[] {};
- }
- public String getDocForValue(String value, IvyFile ivyFile) {
- return null;
- }
- };
- return propertyValueValueProvider;
- }
-
- private IDocumentedValueProvider createPropertyNameValueProvider() {
- IDocumentedValueProvider propertyNameValueProvider = new IDocumentedValueProvider() {
- public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
- String buildType = getBuildType(ivyFile);
- if (buildType != null) {
- List<PropertyDescriptor> propertyDescriptors = easyantCoreService.getPropertiesForBuildType(buildType);
- String[] names = new String[propertyDescriptors.size()];
- int i = 0;
- for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
- names[i] = propertyDescriptor.getName();
- i++;
- }
- return names;
- }
- return new String[] {};
- }
- public String getDocForValue(String value, IvyFile ivyFile) {
- String buildType = getBuildType(ivyFile);
- if(buildType!=null){
- PropertyDescriptor propertyDescriptor = getPropertyDescriptor(buildType, value);
- if(propertyDescriptor!=null){
- return propertyDescriptor.getDescription();
- }
- }
- return null;
- }
- };
- return propertyNameValueProvider;
- }
-
- List<PropertyDescriptor> propertyDescriptorsCache;
- private PropertyDescriptor getPropertyDescriptor(String buildType, String propertyName) {
- if(propertyDescriptorsCache==null){
- propertyDescriptorsCache= easyantCoreService.getPropertiesForBuildType(buildType);
- }
- for (PropertyDescriptor propertyDescriptor : propertyDescriptorsCache) {
- if (propertyName.equals(propertyDescriptor.getName())) {
- return propertyDescriptor;
- }
- }
- return null;
- }
-
- private PropertyDescriptor getPropertyDescriptor(IvyTagAttribute att, IvyFile ivyFile) {
- String buildType = getBuildType(ivyFile);
- if (ivyFile.getAllAttsValues().containsKey(EASYANT_PROPERTY_NAME_ATTR)) {
- String propertyNameValue = ivyFile.getAllAttsValues().get(EASYANT_PROPERTY_NAME_ATTR).toString();
- if (buildType != null && propertyNameValue != null) {
- List<PropertyDescriptor> propertyDescriptors = easyantCoreService.getPropertiesForBuildType(buildType);
- for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
- if (propertyNameValue.equals(propertyDescriptor.getName())) {
- return propertyDescriptor;
- }
- }
- }
- }
- return null;
- }
-
- @SuppressWarnings("unchecked")
- private String getBuildType(IvyFile ivyFile) {
- if (EASYANT_TAG.equals(ivyFile.getParentTagName())) {
- int[] indexes = ivyFile.getParentTagIndex();
- if (indexes != null && indexes.length > 0) {
- Map<String, String> allAttsValuesForEasyAntTag = ivyFile.getAllAttsValues(indexes[0] + 1);
- String typeValue = allAttsValuesForEasyAntTag.get(EASYANT_TYPE_ATTR);
- return typeValue;
- }
- }else if (IVY_INFO_TAG.equals(ivyFile.getParentTagName())) {
- Map<String, String> allAttsValuesForEasyAntTag = ivyFile.getAllAttsValues(ivyFile.getOffset() + 1);
- String typeValue = allAttsValuesForEasyAntTag.get(EASYANT_TYPE_ATTR);
- return typeValue;
- }
- return null;
- }
-
+ if(value!=null){
+ return new String[] { value };
+ }
+ return new String[] {};
+ }
+ return new String[] {};
+ }
+ public String getDocForValue(String value, IvyFile ivyFile) {
+ return null;
+ }
+ };
+ return propertyValueValueProvider;
+ }
+
+ private IDocumentedValueProvider createPropertyNameValueProvider() {
+ IDocumentedValueProvider propertyNameValueProvider = new IDocumentedValueProvider() {
+ public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
+ String buildType = getBuildType(ivyFile);
+ if (buildType != null) {
+ List<PropertyDescriptor> propertyDescriptors = easyantCoreService.getPropertiesForBuildType(buildType);
+ String[] names = new String[propertyDescriptors.size()];
+ int i = 0;
+ for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
+ names[i] = propertyDescriptor.getName();
+ i++;
+ }
+ return names;
+ }
+ return new String[] {};
+ }
+ public String getDocForValue(String value, IvyFile ivyFile) {
+ String buildType = getBuildType(ivyFile);
+ if(buildType!=null){
+ PropertyDescriptor propertyDescriptor = getPropertyDescriptor(buildType, value);
+ if(propertyDescriptor!=null){
+ return propertyDescriptor.getDescription();
+ }
+ }
+ return null;
+ }
+ };
+ return propertyNameValueProvider;
+ }
+
+ List<PropertyDescriptor> propertyDescriptorsCache;
+ private PropertyDescriptor getPropertyDescriptor(String buildType, String propertyName) {
+ if(propertyDescriptorsCache==null){
+ propertyDescriptorsCache= easyantCoreService.getPropertiesForBuildType(buildType);
+ }
+ for (PropertyDescriptor propertyDescriptor : propertyDescriptorsCache) {
+ if (propertyName.equals(propertyDescriptor.getName())) {
+ return propertyDescriptor;
+ }
+ }
+ return null;
+ }
+
+ private PropertyDescriptor getPropertyDescriptor(IvyTagAttribute att, IvyFile ivyFile) {
+ String buildType = getBuildType(ivyFile);
+ if (ivyFile.getAllAttsValues().containsKey(EASYANT_PROPERTY_NAME_ATTR)) {
+ String propertyNameValue = ivyFile.getAllAttsValues().get(EASYANT_PROPERTY_NAME_ATTR).toString();
+ if (buildType != null && propertyNameValue != null) {
+ List<PropertyDescriptor> propertyDescriptors = easyantCoreService.getPropertiesForBuildType(buildType);
+ for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
+ if (propertyNameValue.equals(propertyDescriptor.getName())) {
+ return propertyDescriptor;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ private String getBuildType(IvyFile ivyFile) {
+ if (EASYANT_TAG.equals(ivyFile.getParentTagName())) {
+ int[] indexes = ivyFile.getParentTagIndex();
+ if (indexes != null && indexes.length > 0) {
+ Map<String, String> allAttsValuesForEasyAntTag = ivyFile.getAllAttsValues(indexes[0] + 1);
+ String typeValue = allAttsValuesForEasyAntTag.get(EASYANT_TYPE_ATTR);
+ return typeValue;
+ }
+ }else if (IVY_INFO_TAG.equals(ivyFile.getParentTagName())) {
+ Map<String, String> allAttsValuesForEasyAntTag = ivyFile.getAllAttsValues(ivyFile.getOffset() + 1);
+ String typeValue = allAttsValuesForEasyAntTag.get(EASYANT_TYPE_ATTR);
+ return typeValue;
+ }
+ return null;
+ }
+
}
Modified: incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/BuildLifeCycleContentProvider.java
URL: http://svn.apache.org/viewvc/incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/BuildLifeCycleContentProvider.java?rev=1073358&r1=1073357&r2=1073358&view=diff
==============================================================================
--- incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/BuildLifeCycleContentProvider.java (original)
+++ incubator/easyant/easyant4e/trunk/org.apache.easyant4e/src/org/apache/easyant4e/ivyde/extension/page/BuildLifeCycleContentProvider.java Tue Feb 22 15:09:30 2011
@@ -32,60 +32,60 @@ import com.google.inject.Inject;
public class BuildLifeCycleContentProvider implements ITreeContentProvider {
- private EasyantProjectService easyantProjectService;
+ private EasyantProjectService easyantProjectService;
- public BuildLifeCycleContentProvider() {
- }
+ public BuildLifeCycleContentProvider() {
+ }
- @Inject
- public void setEasyantProjectService(EasyantProjectService easyantProjectService) {
- this.easyantProjectService = easyantProjectService;
- }
-
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof IvyFileEditorInput) {
- IvyFileEditorInput ivyFileEditorInput = (IvyFileEditorInput) inputElement;
- IFile ivyFile = ivyFileEditorInput.getFile();
- List<PhaseReport> phaseReports = easyantProjectService.getPhases(ivyFile);
- List<TargetReport> targetReports = easyantProjectService.getTargets(ivyFile);
- ArrayList<Object> o = new ArrayList<Object>();
- o.addAll(phaseReports);
- o.addAll(targetReports);
- Object[] input = o.toArray(new Object[o.size()]);
- return input;
- }
- return new Object[0];
- }
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof PhaseReport) {
- PhaseReport phaseReport = (PhaseReport) parentElement;
- //if (phaseReport.getName().equals("compile")) {
- // System.out.println("coucou");
- //}
- List<TargetReport> targetReports = phaseReport.getTargetReports();
- return targetReports.toArray(new TargetReport[targetReports.size()]);
- }
- return null;
- }
-
- public Object getParent(Object element) {
- return null;
- }
-
- public boolean hasChildren(Object element) {
- if (element instanceof PhaseReport) {
- PhaseReport phaseReport = (PhaseReport) element;
- List<TargetReport> targetReports = phaseReport.getTargetReports();
- return (targetReports != null && targetReports.size() > 0);
- }
- return false;
- }
+ @Inject
+ public void setEasyantProjectService(EasyantProjectService easyantProjectService) {
+ this.easyantProjectService = easyantProjectService;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof IvyFileEditorInput) {
+ IvyFileEditorInput ivyFileEditorInput = (IvyFileEditorInput) inputElement;
+ IFile ivyFile = ivyFileEditorInput.getFile();
+ List<PhaseReport> phaseReports = easyantProjectService.getPhases(ivyFile);
+ List<TargetReport> targetReports = easyantProjectService.getTargets(ivyFile);
+ ArrayList<Object> o = new ArrayList<Object>();
+ o.addAll(phaseReports);
+ o.addAll(targetReports);
+ Object[] input = o.toArray(new Object[o.size()]);
+ return input;
+ }
+ return new Object[0];
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof PhaseReport) {
+ PhaseReport phaseReport = (PhaseReport) parentElement;
+ //if (phaseReport.getName().equals("compile")) {
+ // System.out.println("coucou");
+ //}
+ List<TargetReport> targetReports = phaseReport.getTargetReports();
+ return targetReports.toArray(new TargetReport[targetReports.size()]);
+ }
+ return null;
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ if (element instanceof PhaseReport) {
+ PhaseReport phaseReport = (PhaseReport) element;
+ List<TargetReport> targetReports = phaseReport.getTargetReports();
+ return (targetReports != null && targetReports.size() > 0);
+ }
+ return false;
+ }
}