notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r1995 - in development/laboratory/ide/eclipse/magic/plugin: . src/net/dpml/ide/eclipse/plugins/magic
- From: peter AT neubauer.se
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r1995 - in development/laboratory/ide/eclipse/magic/plugin: . src/net/dpml/ide/eclipse/plugins/magic
- Date: Wed, 09 Mar 2005 04:03:45 -0500
Author: peter AT neubauer.se
Date: Wed Mar 9 04:03:44 2005
New Revision: 1995
Removed:
development/laboratory/ide/eclipse/magic/plugin/src/net/dpml/ide/eclipse/plugins/magic/BuildActionDelegate.java
development/laboratory/ide/eclipse/magic/plugin/src/net/dpml/ide/eclipse/plugins/magic/MagicNatrue.java
Modified:
development/laboratory/ide/eclipse/magic/plugin/plugin.xml
development/laboratory/ide/eclipse/magic/plugin/src/net/dpml/ide/eclipse/plugins/magic/ArtifactURLHandler.java
development/laboratory/ide/eclipse/magic/plugin/src/net/dpml/ide/eclipse/plugins/magic/MagicPlugin.java
Log:
plugin now fixes the Ant classpath, making Eclipse ant compile magic projects.
Modified: development/laboratory/ide/eclipse/magic/plugin/plugin.xml
==============================================================================
--- development/laboratory/ide/eclipse/magic/plugin/plugin.xml (original)
+++ development/laboratory/ide/eclipse/magic/plugin/plugin.xml Wed Mar 9
04:03:44 2005
@@ -87,25 +87,6 @@
</action>
</objectContribution>
</extension>
-<extension point = "org.eclipse.ui.popupMenus">
- <objectContribution
- id="net.dpml.ide.eclipse.plugins.magic.buildtool"
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="build.xml">
- <filter
- name="projectNature"
- value="org.eclipse.jdt.core.javanature">
- </filter>
- <action
id="net.dpml.ide.eclipse.plugins.magic.indextool.setproject"
- label="build default magic target"
- icon="resources/globe.png"
- menubarPath="additions"
-
helpContextId="net.dpml.ide.eclipse.plugins.magic.indextool.setproject_action_context"
- class="net.dpml.ide.eclipse.plugins.magic.BuildActionDelegate"
- enablesFor="1">
- </action>
- </objectContribution>
- </extension>
<extension
point="org.eclipse.help.toc">
<toc file="help/book.xml" primary="true"/>
@@ -132,10 +113,8 @@
library="lib/dpml-transit-tools.jar"
name="PluginTask"/>
</extension>
- <extension point="org.eclipse.ant.core.extraClasspathEntries">
- <extraClasspathEntry library="lib/dpml-transit-main.jar"/>
- </extension>
- <extension point="org.eclipse.ant.core.extraClasspathEntries">
- <extraClasspathEntry library="lib/dpml-transit-tools.jar"/>
- </extension>
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup class="net.dpml.ide.eclipse.plugins.magic.MagicPlugin"/>
+ </extension>
</plugin>
Modified:
development/laboratory/ide/eclipse/magic/plugin/src/net/dpml/ide/eclipse/plugins/magic/ArtifactURLHandler.java
==============================================================================
---
development/laboratory/ide/eclipse/magic/plugin/src/net/dpml/ide/eclipse/plugins/magic/ArtifactURLHandler.java
(original)
+++
development/laboratory/ide/eclipse/magic/plugin/src/net/dpml/ide/eclipse/plugins/magic/ArtifactURLHandler.java
Wed Mar 9 04:03:44 2005
@@ -12,6 +12,7 @@
import java.io.IOException;
import java.lang.reflect.Constructor;
+import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Hashtable;
@@ -20,6 +21,7 @@
import net.dpml.transit.artifact.Handler;
import org.osgi.service.url.AbstractURLStreamHandlerService;
+import org.osgi.service.url.URLStreamHandlerSetter;
/**
* URL handler for the "artifact" protocol
@@ -45,9 +47,7 @@
public URLConnection openConnection(URL url) throws IOException {
URLConnection connection = null;
- //new URL( null, m_uri.toString(), handler );
- System.out.println( "opening: " + url );
- throw new IOException( "not yet implemented: " + url );
+ return null;
}
public static void register(String type, Class connectionClass) {
@@ -57,5 +57,5 @@
} catch (NoSuchMethodException e) {
//don't register connection classes that don't
conform to the spec
}
- }
+ }
}
\ No newline at end of file
Modified:
development/laboratory/ide/eclipse/magic/plugin/src/net/dpml/ide/eclipse/plugins/magic/MagicPlugin.java
==============================================================================
---
development/laboratory/ide/eclipse/magic/plugin/src/net/dpml/ide/eclipse/plugins/magic/MagicPlugin.java
(original)
+++
development/laboratory/ide/eclipse/magic/plugin/src/net/dpml/ide/eclipse/plugins/magic/MagicPlugin.java
Wed Mar 9 04:03:44 2005
@@ -1,104 +1,162 @@
package net.dpml.ide.eclipse.plugins.magic;
import net.dpml.transit.TransitException;
+import net.dpml.transit.artifact.Handler;
+import org.eclipse.ant.core.AntCorePlugin;
+import org.eclipse.ant.core.AntCorePreferences;
+import org.eclipse.ant.core.IAntClasspathEntry;
+import org.eclipse.ant.internal.core.AntClasspathEntry;
+import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.ui.IStartup;
import org.osgi.framework.BundleContext;
import org.osgi.service.url.URLConstants;
import org.osgi.service.url.URLStreamHandlerService;
-
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.*;
/**
* The main plugin class to be used in the desktop.
*/
-public class MagicPlugin extends Plugin {
- //The shared instance.
- private static MagicPlugin plugin;
- //Resource bundle.
- private ResourceBundle resourceBundle;
-
- /**
- * The constructor.
- */
- public MagicPlugin() {
- super();
- plugin = this;
- }
-
- /**
- * This method is called upon plug-in activation
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
+public class MagicPlugin extends Plugin implements IStartup
+{
+ // The shared instance.
+ private static MagicPlugin plugin;
+
+ // Resource bundle.
+ private ResourceBundle resourceBundle;
+
+ /**
+ * The constructor.
+ */
+ public MagicPlugin()
+ {
+ super();
+ plugin = this;
+ }
+
+ /**
+ * This method is called upon plug-in activation
+ */
+ public void start( BundleContext context ) throws Exception
+ {
+ super.start( context );
registerArtifactHandler( context );
- }
+
+ fixAntClasspath();
+ }
+
+ private void fixAntClasspath()
+ {
+ IAntClasspathEntry[] transitClasspath = new IAntClasspathEntry[2];
+ AntCorePreferences prefs =
AntCorePlugin.getPlugin().getPreferences();
+ IAntClasspathEntry[] coreClasspath =
prefs.getDefaultAntHomeEntries();
+ IAntClasspathEntry[] newClasspath;
+ String pluginPath =
MagicPlugin.getDefault().getBundle().getLocation().substring(7);
+ try
+ {
+ transitClasspath[0] = new AntClasspathEntry(pluginPath +
"lib/dpml-transit-main.jar");
+ transitClasspath[1] = new AntClasspathEntry(pluginPath +
"lib/dpml-transit-tools.jar");
+ }
+ catch ( Exception e )
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ newClasspath = new AntClasspathEntry[coreClasspath.length +
transitClasspath.length];
+ System.arraycopy( coreClasspath, 0, newClasspath, 0,
+ coreClasspath.length );
+ System.arraycopy( transitClasspath, 0, newClasspath,
+ coreClasspath.length, transitClasspath.length );
+ prefs.setAntHomeClasspathEntries(newClasspath);
+ }
+
/**
* Register the artifact URL support as a service to the URLHandler
service
*/
private void registerArtifactHandler( BundleContext context )
{
- Hashtable properties = new Hashtable(1);
- properties.put(URLConstants.URL_HANDLER_PROTOCOL, new String[]
{ArtifactURLHandler.PROTOCOL});
- try
- {
-
context.registerService(URLStreamHandlerService.class.getName(), new
ArtifactURLHandler(), properties);
- }
- catch ( TransitException e )
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
- /**
- * This method is called when the plug-in is stopped
- */
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- plugin = null;
- resourceBundle = null;
- }
-
- /**
- * Returns the shared instance.
- */
- public static MagicPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns the string from the plugin's resource bundle,
- * or 'key' if not found.
- */
- public static String getResourceString(String key) {
- ResourceBundle bundle =
MagicPlugin.getDefault().getResourceBundle();
- try {
- return (bundle != null) ? bundle.getString(key) : key;
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- /**
- * Returns the plugin's resource bundle,
- */
- public ResourceBundle getResourceBundle() {
- try {
- if (resourceBundle == null)
- resourceBundle =
ResourceBundle.getBundle("transitPlugin.TransitPluginResources");
- } catch (MissingResourceException x) {
- resourceBundle = null;
- }
- return resourceBundle;
- }
+ Hashtable properties = new Hashtable( 1 );
+ properties.put( URLConstants.URL_HANDLER_PROTOCOL,
+ new String[] { ArtifactURLHandler.PROTOCOL } );
+ try
+ {
+ context.registerService( URLStreamHandlerService.class.getName(),
+ new ArtifactURLHandler(), properties );
+ }
+ catch ( TransitException e )
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ public void stop( BundleContext context ) throws Exception
+ {
+ super.stop( context );
+ plugin = null;
+ resourceBundle = null;
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static MagicPlugin getDefault()
+ {
+ return plugin;
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle, or 'key' if not
+ * found.
+ */
+ public static String getResourceString( String key )
+ {
+ ResourceBundle bundle = MagicPlugin.getDefault().getResourceBundle();
+ try
+ {
+ return ( bundle != null ) ? bundle.getString( key ) : key;
+ }
+ catch ( MissingResourceException e )
+ {
+ return key;
+ }
+ }
+
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle()
+ {
+ try
+ {
+ if ( resourceBundle == null )
+ resourceBundle = ResourceBundle
+ .getBundle( "transitPlugin.TransitPluginResources" );
+ }
+ catch ( MissingResourceException x )
+ {
+ resourceBundle = null;
+ }
+ return resourceBundle;
+ }
public IPreferenceStore getPreferenceStore()
{
return null;
}
+ public void earlyStartup()
+ {
+ }
+
}
- svn commit: r1995 - in development/laboratory/ide/eclipse/magic/plugin: . src/net/dpml/ide/eclipse/plugins/magic, peter, 03/08/2005
Archive powered by MHonArc 2.6.24.