Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2061 - development/laboratory/ide/eclipse/magic/plugin/src/net/dpml/ide/eclipse/plugins/magic

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: peter AT neubauer.se
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2061 - development/laboratory/ide/eclipse/magic/plugin/src/net/dpml/ide/eclipse/plugins/magic
  • Date: Sun, 13 Mar 2005 21:08:10 -0500

Author: peter AT neubauer.se
Date: Sun Mar 13 21:08:10 2005
New Revision: 2061

Modified:

development/laboratory/ide/eclipse/magic/plugin/src/net/dpml/ide/eclipse/plugins/magic/MagicPlugin.java
Log:
more formatting


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
Sun Mar 13 21:08:10 2005
@@ -1,36 +1,47 @@
package net.dpml.ide.eclipse.plugins.magic;

+import java.util.Hashtable;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
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.core.runtime.Status;
-import org.eclipse.jdt.internal.compiler.ast.MagicLiteral;
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 implements IStartup
{
- // The shared instance.
- private static MagicPlugin plugin;
+ /**
+ * The shared instance.
+ */
+ private static MagicPlugin m_PLUGIN;

- // Resource bundle.
- private ResourceBundle resourceBundle;
+ /**
+ * Resource bundle.
+ */
+ private ResourceBundle m_resourceBundle;
+
+ /**
+ * number of entries we need for the DPML libs
+ */
+ private static final int MAGIC_ENTRIES_LENGTH = 3;
+
+ /**
+ * the prefix for plugin search path
+ */
+ private static final int UPDATE_PREFIX_LENGTH = 7;

/**
* The constructor.
@@ -38,11 +49,12 @@
public MagicPlugin()
{
super();
- plugin = this;
+ m_PLUGIN = this;
}

/**
- * This method is called upon plug-in activation
+ *
+ * @see
org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start( BundleContext context ) throws Exception
{
@@ -52,14 +64,19 @@
fixAntClasspath();
}

+ /**
+ * add the Transit libs to the root ant classpath for the eclipse ant
plugin
+ * in order to get it understand transit ant tasks
+ *
+ */
private void fixAntClasspath()
{
- IAntClasspathEntry[] transitClasspath = new IAntClasspathEntry[3];
+ IAntClasspathEntry[] transitClasspath = new
IAntClasspathEntry[MAGIC_ENTRIES_LENGTH];
AntCorePreferences prefs =
AntCorePlugin.getPlugin().getPreferences();
IAntClasspathEntry[] coreClasspath =
prefs.getDefaultAntHomeEntries();
IAntClasspathEntry[] newClasspath;
String pluginPath =
MagicPlugin.getDefault().getBundle().getLocation()
- .substring( 7 );
+ .substring( UPDATE_PREFIX_LENGTH );
try
{
transitClasspath[0] = new AntClasspathEntry( pluginPath
@@ -85,13 +102,15 @@

/**
* Register the artifact URL support as a service to the URLHandler
service
+ *
+ * @param context
+ * the context to register in
*/
-
private void registerArtifactHandler( BundleContext context )
{
Hashtable properties = new Hashtable( 1 );
properties.put( URLConstants.URL_HANDLER_PROTOCOL,
- new String[] { ArtifactURLHandler.PROTOCOL } );
+ new String[]{ArtifactURLHandler.PROTOCOL} );
try
{
context.registerService( URLStreamHandlerService.class.getName(),
@@ -106,21 +125,23 @@
}

/**
- * This method is called when the plug-in is stopped
+ *
+ * @see
org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop( BundleContext context ) throws Exception
{
super.stop( context );
- plugin = null;
- resourceBundle = null;
+ m_PLUGIN = null;
+ m_resourceBundle = null;
}

/**
* Returns the shared instance.
+ * @return the instance
*/
public static MagicPlugin getDefault()
{
- return plugin;
+ return m_PLUGIN;
}

/**
@@ -147,15 +168,15 @@
{
try
{
- if ( resourceBundle == null )
- resourceBundle = ResourceBundle
+ if ( m_resourceBundle == null )
+ m_resourceBundle = ResourceBundle
.getBundle( "transitPlugin.TransitPluginResources" );
}
catch ( MissingResourceException x )
{
- resourceBundle = null;
+ m_resourceBundle = null;
}
- return resourceBundle;
+ return m_resourceBundle;
}

public IPreferenceStore getPreferenceStore()



  • svn commit: r2061 - development/laboratory/ide/eclipse/magic/plugin/src/net/dpml/ide/eclipse/plugins/magic, peter, 03/13/2005

Archive powered by MHonArc 2.6.24.

Top of Page