Author: rob.stryker(a)jboss.com
Date: 2008-05-14 17:29:09 -0400 (Wed, 14 May 2008)
New Revision: 8088
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/schema/actionTypes.exsd
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/AntActionType.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IActionType.java
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/schema/archiveTypes.exsd
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntExtensionManager.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveAction.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IExtensionManager.java
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveActionImpl.java
Log:
JBIDE-476
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml 2008-05-14 19:27:11
UTC (rev 8087)
+++ trunk/core/plugins/org.jboss.ide.eclipse.archives.core/plugin.xml 2008-05-14 21:29:09
UTC (rev 8088)
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
- <extension-point id="archiveTypes" name="JBossIDE Package Type"
schema="schema/archiveTypes.exsd"/>
+ <extension-point id="archiveTypes" name="JBoss Tools Package
Type" schema="schema/archiveTypes.exsd"/>
+ <extension-point id="actionTypes" name="JBoss Tools Build Action
Type" schema="schema/actionTypes.exsd"/>
<extension
id="archivesNature"
name="JBossIDE Packages Nature"
@@ -43,5 +44,13 @@
content-type="org.eclipse.ant.core.antBuildFile">
</file-association>
</extension>
+ <extension
+ point="org.jboss.ide.eclipse.archives.core.actionTypes">
+ <actionType
+
class="org.jboss.ide.eclipse.archives.core.model.types.AntActionType"
+ id="org.jboss.ide.eclipse.archives.core.antActionType"
+ label="Ant Task">
+ </actionType>
+ </extension>
</plugin>
Added: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/schema/actionTypes.exsd
===================================================================
--- trunk/core/plugins/org.jboss.ide.eclipse.archives.core/schema/actionTypes.exsd
(rev 0)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/schema/actionTypes.exsd 2008-05-14
21:29:09 UTC (rev 8088)
@@ -0,0 +1,119 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.ide.eclipse.archives.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.ide.eclipse.archives.core"
id="actionTypes" name="JBoss Tools Build Action Type"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="actionType" minOccurs="1"
maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="actionType">
+ <complexType>
+ <attribute name="id" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="label" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java"
basedOn=":org.jboss.ide.eclipse.archives.core.model.IActionType"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
Modified: trunk/core/plugins/org.jboss.ide.eclipse.archives.core/schema/archiveTypes.exsd
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/schema/archiveTypes.exsd 2008-05-14
19:27:11 UTC (rev 8087)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/schema/archiveTypes.exsd 2008-05-14
21:29:09 UTC (rev 8088)
@@ -1,119 +1,119 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.jboss.ide.eclipse.archives.core">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.jboss.ide.eclipse.archives.core"
id="packageTypes" name="JBossIDE Package Type"/>
- </appInfo>
- <documentation>
- [Enter description of this extension point.]
- </documentation>
- </annotation>
-
- <element name="extension">
- <complexType>
- <sequence>
- <element ref="packageType" minOccurs="1"
maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string"
use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="packageType">
- <complexType>
- <attribute name="id" type="string"
use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="label" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string"
use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute kind="java"
basedOn="org.jboss.ide.eclipse.archives.core.model.types.IPackageType"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- [Enter the first release in which this extension point appears.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiInfo"/>
- </appInfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
-
- </documentation>
- </annotation>
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.ide.eclipse.archives.core">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.ide.eclipse.archives.core"
id="packageTypes" name="JBoss Tools Package Type"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="packageType" minOccurs="1"
maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="packageType">
+ <complexType>
+ <attribute name="id" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="label" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string"
use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java"
basedOn=":org.jboss.ide.eclipse.archives.core.model.IArchiveType"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java 2008-05-14
19:27:11 UTC (rev 8087)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/other/internal/WorkspaceExtensionManager.java 2008-05-14
21:29:09 UTC (rev 8088)
@@ -33,6 +33,7 @@
import org.eclipse.core.runtime.InvalidRegistryObjectException;
import org.eclipse.core.runtime.Platform;
import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.model.IActionType;
import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
import org.jboss.ide.eclipse.archives.core.model.IExtensionManager;
@@ -44,6 +45,7 @@
*/
public class WorkspaceExtensionManager implements IExtensionManager {
public static final String ARCHIVE_TYPES_EXTENSION_ID =
"org.jboss.ide.eclipse.archives.core.archiveTypes";
+ public static final String ACTION_TYPES_EXTENSION_ID =
"org.jboss.ide.eclipse.archives.core.actionTypes";
private IExtension[] findExtension (String extensionId) {
IExtensionRegistry registry = Platform.getExtensionRegistry();
@@ -85,5 +87,40 @@
return (IArchiveType[]) c.toArray(new IArchiveType[c.size()]);
}
-
+
+ private static Hashtable actionTypes;
+ public IActionType getActionType(String id) {
+ if (actionTypes == null)
+ loadActionTypes();
+ return (IActionType)actionTypes.get(id);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IExtensionManager#getActionTypes()
+ */
+ public IActionType[] getActionTypes() {
+ if( actionTypes == null )
+ loadActionTypes();
+ Collection c = archiveTypes.values();
+ return (IActionType[]) c.toArray(new IActionType[c.size()]);
+ }
+
+ private void loadActionTypes() {
+ actionTypes = new Hashtable();
+ IExtension[] extensions = findExtension(ACTION_TYPES_EXTENSION_ID);
+ for (int i = 0; i < extensions.length; i++) {
+ IConfigurationElement elements[] = extensions[i].getConfigurationElements();
+ for (int j = 0; j < elements.length; j++) {
+ try {
+ Object executable = elements[j].createExecutableExtension("class");
+ IActionType type = (IActionType)executable;
+ actionTypes.put(type.getId(), type);
+ } catch (InvalidRegistryObjectException e) {
+ ArchivesCore.getInstance().getLogger().log(IStatus.WARNING, e.getMessage(), e);
+ } catch( CoreException e ) {
+ ArchivesCore.getInstance().getLogger().log(IStatus.WARNING, e.getMessage(), e);
+ }
+ }
+ }
+ }
}
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/AntActionType.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/AntActionType.java
(rev 0)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/eclipse/org/jboss/ide/eclipse/archives/core/model/types/AntActionType.java 2008-05-14
21:29:09 UTC (rev 8088)
@@ -0,0 +1,55 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model.types;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExecutableExtension;
+import org.jboss.ide.eclipse.archives.core.model.IActionType;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveAction;
+
+/**
+ * @author rob.stryker <rob.stryker(a)redhat.com>
+ *
+ */
+public class AntActionType implements IActionType, IExecutableExtension {
+
+ private IConfigurationElement element;
+ public void setInitializationData(IConfigurationElement config, String propertyName,
Object data) throws CoreException {
+ if( element == null ) element = config;
+ }
+ public String getId() {
+ return element.getAttribute("id");
+ }
+
+ public String getLabel() {
+ return element.getAttribute("label");
+ }
+
+ public void execute(IArchiveAction action) {
+ System.out.println("Ant Working!");
+ }
+
+ public String getStringRepresentation(IArchiveAction action) {
+ return "Ant action";
+ }
+}
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntExtensionManager.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntExtensionManager.java 2008-05-14
19:27:11 UTC (rev 8087)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/ant/AntExtensionManager.java 2008-05-14
21:29:09 UTC (rev 8088)
@@ -1,6 +1,7 @@
package org.jboss.ide.eclipse.archives.core.ant;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.jboss.ide.eclipse.archives.core.model.IActionType;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveType;
import org.jboss.ide.eclipse.archives.core.model.IExtensionManager;
@@ -24,11 +25,11 @@
return typeId;
}
public IArchive createDefaultConfiguration(String projectName, IProgressMonitor
monitor) {
- // TODO Auto-generated method stub
+ // do nothing, should not be called from ant
return null;
}
public IArchive fillDefaultConfiguration(String projectName, IArchive topLevel,
IProgressMonitor monitor) {
- // TODO Auto-generated method stub
+ // do nothing, should not be called from ant
return null;
}
};
@@ -38,4 +39,12 @@
return new IArchiveType[0];
}
+ public IActionType getActionType(String id) {
+ return null;
+ }
+
+ public IActionType[] getActionTypes() {
+ return new IActionType[0];
+ }
+
}
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java 2008-05-14
19:27:11 UTC (rev 8087)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/build/ArchiveBuildDelegate.java 2008-05-14
21:29:09 UTC (rev 8088)
@@ -29,6 +29,7 @@
import org.jboss.ide.eclipse.archives.core.model.ArchivesModel;
import org.jboss.ide.eclipse.archives.core.model.EventManager;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
+import org.jboss.ide.eclipse.archives.core.model.IArchiveAction;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFileSet;
import org.jboss.ide.eclipse.archives.core.model.IArchiveFolder;
import org.jboss.ide.eclipse.archives.core.model.IArchiveModelRootNode;
@@ -82,6 +83,15 @@
if( !pkg.getGlobalDestinationPath().toFile().exists() ) {
pkg.getGlobalDestinationPath().toFile().mkdirs();
}
+
+ // Run the pre actions
+ IArchiveAction[] actions = pkg.getActions();
+ for( int i = 0; i < actions.length; i++ ) {
+ if( actions[i].getTime().equals(IArchiveAction.PRE_BUILD)) {
+ actions[i].execute();
+ }
+ }
+
ModelTruezipBridge.createFile(pkg);
// force create all folders
@@ -96,6 +106,13 @@
fullFilesetBuild(filesets[i], pkg);
}
+ // Run the post actions
+ for( int i = 0; i < actions.length; i++ ) {
+ if( actions[i].getTime().equals(IArchiveAction.POST_BUILD)) {
+ actions[i].execute();
+ }
+ }
+
EventManager.finishedBuildingArchive(pkg);
}
Added:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IActionType.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IActionType.java
(rev 0)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IActionType.java 2008-05-14
21:29:09 UTC (rev 8088)
@@ -0,0 +1,50 @@
+/**
+ * JBoss, a Division of Red Hat
+ * Copyright 2006, Red Hat Middleware, LLC, and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+* This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.archives.core.model;
+
+/**
+ * @author rob.stryker <rob.stryker(a)redhat.com>
+ *
+ */
+public interface IActionType {
+ /**
+ * Get the id for this action type
+ * @return
+ */
+ public String getId();
+
+ /**
+ * Get a label for this action type
+ * @return
+ */
+ public String getLabel();
+
+ /**
+ * Execute an action of your type
+ */
+ public void execute(IArchiveAction action);
+
+ /**
+ * Get a string representation for this action
+ */
+ public String getStringRepresentation(IArchiveAction action);
+}
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveAction.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveAction.java 2008-05-14
19:27:11 UTC (rev 8087)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IArchiveAction.java 2008-05-14
21:29:09 UTC (rev 8088)
@@ -57,12 +57,22 @@
public void setTime(String time);
/**
+ * Get the id of this action's type.
+ * These are to be provided via an extension point
+ * or ant task to be discovered in ArchivesCore.
+ * @return
+ */
+ public String getTypeString();
+
+ /**
* Get the type of action this is.
* These are to be provided via an extension point
* or ant task to be discovered in ArchivesCore.
* @return
*/
- public String getType();
+ public IActionType getType();
+
+
/**
* Set the type of action this is.
@@ -71,4 +81,14 @@
* @return
*/
public void setType(String type);
+
+ /**
+ * Execute me
+ */
+ public void execute();
+
+ /**
+ * ToString must give something usable
+ */
+ public String toString();
}
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IExtensionManager.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IExtensionManager.java 2008-05-14
19:27:11 UTC (rev 8087)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/IExtensionManager.java 2008-05-14
21:29:09 UTC (rev 8088)
@@ -24,4 +24,6 @@
public interface IExtensionManager {
public IArchiveType[] getArchiveTypes();
public IArchiveType getArchiveType(String id);
+ public IActionType[] getActionTypes();
+ public IActionType getActionType(String id);
}
Modified:
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveActionImpl.java
===================================================================
---
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveActionImpl.java 2008-05-14
19:27:11 UTC (rev 8087)
+++
trunk/core/plugins/org.jboss.ide.eclipse.archives.core/src/main/org/jboss/ide/eclipse/archives/core/model/internal/ArchiveActionImpl.java 2008-05-14
21:29:09 UTC (rev 8088)
@@ -22,6 +22,8 @@
package org.jboss.ide.eclipse.archives.core.model.internal;
import org.eclipse.core.runtime.IPath;
+import org.jboss.ide.eclipse.archives.core.ArchivesCore;
+import org.jboss.ide.eclipse.archives.core.model.IActionType;
import org.jboss.ide.eclipse.archives.core.model.IArchive;
import org.jboss.ide.eclipse.archives.core.model.IArchiveAction;
import org.jboss.ide.eclipse.archives.core.model.IArchiveNode;
@@ -67,9 +69,17 @@
/* (non-Javadoc)
* @see org.jboss.ide.eclipse.archives.core.model.IArchiveAction#getType()
*/
- public String getType() {
+ public String getTypeString() {
return actionDelegate.getType();
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveAction#getType()
+ */
+ public IActionType getType() {
+ return
ArchivesCore.getInstance().getExtensionManager().getActionType(getTypeString());
+ }
/* (non-Javadoc)
* @see
org.jboss.ide.eclipse.archives.core.model.IArchiveAction#setTime(java.lang.String)
@@ -99,5 +109,16 @@
return false;
return true;
}
-
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.ide.eclipse.archives.core.model.IArchiveAction#execute()
+ */
+ public void execute() {
+ getType().execute(this);
+ }
+
+ public String toString() {
+ return getType().getStringRepresentation(this);
+ }
}
\ No newline at end of file