Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1933 - in development/laboratory/ide/eclipse/TransitPlugin: . META-INF src/net/dpml/ide src/net/dpml/ide/eclipse src/net/dpml/ide/eclipse/plugins src/net/dpml/ide/eclipse/plugins/magic

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: pneubauer AT netcompartner.com
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r1933 - in development/laboratory/ide/eclipse/TransitPlugin: . META-INF src/net/dpml/ide src/net/dpml/ide/eclipse src/net/dpml/ide/eclipse/plugins src/net/dpml/ide/eclipse/plugins/magic
  • Date: Thu, 03 Mar 2005 11:40:38 +0100

Author: pneubauer
Date: Thu Mar 3 11:40:35 2005
New Revision: 1933

Added:
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/

development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/

development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/

development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/ArtifactURLHandler.java
(contents, props changed)

development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/MagicClasspathInitializer.java
(contents, props changed)

development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/MagicContainer.java
(contents, props changed)

development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/MagicPlugin.java
(contents, props changed)
Modified:
development/laboratory/ide/eclipse/TransitPlugin/.classpath
development/laboratory/ide/eclipse/TransitPlugin/META-INF/MANIFEST.MF
development/laboratory/ide/eclipse/TransitPlugin/plugin.xml
Log:
Eclipse plugin now loads deps!

Modified: development/laboratory/ide/eclipse/TransitPlugin/.classpath
==============================================================================
--- development/laboratory/ide/eclipse/TransitPlugin/.classpath (original)
+++ development/laboratory/ide/eclipse/TransitPlugin/.classpath Thu Mar 3
11:40:35 2005
@@ -1,16 +1,13 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry exported="true" sourcepath="/dpml-main" kind="lib"
path="dpml-transit-main.jar"/>
- <classpathentry exported="true" kind="lib"
path="dpml-transit-tools.jar"/>
- <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="lib" path="dpml-magic-core-SNAPSHOT.jar"/>
- <classpathentry kind="lib" path="ant-1.6.2.jar"/>
- <classpathentry kind="lib" path="lib/ant-1.6.2.jar"/>
- <classpathentry kind="lib"
path="lib/dpml-ide-common-magic-SNAPSHOT.jar"/>
- <classpathentry kind="lib" path="lib/dpml-magic-core-SNAPSHOT.jar"/>
- <classpathentry kind="lib" path="lib/dpml-transit-main.jar"/>
- <classpathentry kind="lib" path="lib/dpml-transit-tools.jar"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="lib/ant-1.6.2.jar"/>
+ <classpathentry kind="lib"
path="lib/dpml-ide-common-magic-SNAPSHOT.jar"/>
+ <classpathentry kind="lib" path="lib/dpml-magic-core-SNAPSHOT.jar"/>
+ <classpathentry kind="lib" path="lib/dpml-transit-main.jar"/>
+ <classpathentry kind="lib" path="lib/dpml-transit-tools.jar"/>
+ <classpathentry kind="src" path="/dpml-main"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>

Modified:
development/laboratory/ide/eclipse/TransitPlugin/META-INF/MANIFEST.MF
==============================================================================
--- development/laboratory/ide/eclipse/TransitPlugin/META-INF/MANIFEST.MF
(original)
+++ development/laboratory/ide/eclipse/TransitPlugin/META-INF/MANIFEST.MF
Thu Mar 3 11:40:35 2005
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: TransitPlugin Plug-in
-Bundle-SymbolicName: TransitPlugin
+Bundle-Name: Eclipse Magic Plug-in
+Bundle-SymbolicName: net.dpm.ide.eclipse.plugins.Magic
Bundle-Version: 1.0.0
Bundle-ClassPath: TransitPlugin.jar,
lib/ant-1.6.2.jar,
@@ -9,12 +9,12 @@
lib/dpml-magic-core-SNAPSHOT.jar,
lib/dpml-transit-main.jar,
lib/dpml-transit-tools.jar
-Bundle-Activator: transitPlugin.TransitPlugin
+Bundle-Activator: net.dpml.ide.eclipse.plugins.magic.MagicPlugin
Bundle-Localization: plugin
-Export-Package: transitPlugin
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.ui,
- org.eclipse.jdt.launching,
- org.eclipse.debug.core,
- org.eclipse.jdt.core
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ui,
+ org.eclipse.jdt.launching,
+ org.eclipse.jdt.core,
+ org.eclipse.jdt.debug,
+ org.eclipse.core.resources
Eclipse-AutoStart: true

Modified: development/laboratory/ide/eclipse/TransitPlugin/plugin.xml
==============================================================================
--- development/laboratory/ide/eclipse/TransitPlugin/plugin.xml (original)
+++ development/laboratory/ide/eclipse/TransitPlugin/plugin.xml Thu Mar 3
11:40:35 2005
@@ -1,45 +1,40 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin
- id="Transit"
- name="Transit Plug-in"
- version="1.0.0"
- provider-name=""
- class="transitPlugin.TransitPlugin">
-
- <runtime>
- <library name="Transit.jar">
- <export name="*"/>
- </library>
- </runtime>
-
- <requires>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.eclipse.core.resources"/>
- </requires>
-
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- class="transitPlugin.preferences.TransitPreferencePage"
- id="transitPlugin.preferences.TransitPreferencePage"
- name="Transit"/>
- </extension>
- <extension
- point="org.eclipse.core.runtime.preferences">
- <initializer class="transitPlugin.preferences.PreferenceInitializer"/>
- </extension>
-
-<extension point="org.eclipse.jdt.core.classpathContainerInitializer">

- <classpathContainerInitializer
- id="MAGIC"
- class="net.dpml.transit.MagicClasspathInitializer"/>

- </extension>
-
-
-
-
-
-
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin
+ id="TransitPlugin"
+ name="TransitPlugin Plug-in"
+ version="1.0.0"
+ provider-name=""
+ class="transitPlugin.TransitPluginPlugin">
+
+ <runtime>
+ <library name="TransitPlugin.jar">
+ <export name="*"/>
+ </library>
+ </runtime>
+
+ <requires>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ </requires>
+ <extension
+ point="org.eclipse.jdt.core.classpathContainerInitializer">
+ <classpathContainerInitializer
+ id="net.dpml.MAGIC"
+
class="net.dpml.ide.eclipse.plugins.magic.MagicClasspathInitializer"
+ />
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ category="Java"
+
class="net.dpml.ide.eclipse.plugins.magic.preferences.MagicPreferencePage"
+ id="MagicPreferencePage"
+ name="Magic"/>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
class="net.dpml.ide.eclipse.plugins.magic.preferences.MagicPreferenceInitializer"/>
+ </extension>
+
+</plugin>

Added:
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/ArtifactURLHandler.java
==============================================================================
--- (empty file)
+++
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/ArtifactURLHandler.java
Thu Mar 3 11:40:35 2005
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+
*******************************************************************************/
+package net.dpml.ide.eclipse.plugins.magic;
+
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Hashtable;
+
+import net.dpml.transit.TransitException;
+import net.dpml.transit.artifact.Handler;
+
+import org.osgi.service.url.AbstractURLStreamHandlerService;
+
+/**
+ * URL handler for the "artifact" protocol
+ */
+public class ArtifactURLHandler extends AbstractURLStreamHandlerService {
+
+ private static Hashtable connectionType = new Hashtable();
+
+ // URL protocol designations
+ public static final String PROTOCOL = "artifact"; //$NON-NLS-1$
+ public static final String FILE = "file"; //$NON-NLS-1$
+ public static final String JAR = "jar"; //$NON-NLS-1$
+ public static final String BUNDLE = "bundle"; //$NON-NLS-1$
+ public static final String JAR_SEPARATOR = "!/"; //$NON-NLS-1$
+ public static final String PROTOCOL_SEPARATOR = ":"; //$NON-NLS-1$
+
+ private Handler transitHandler;
+ public ArtifactURLHandler() throws TransitException {
+ super();
+ transitHandler = new Handler() ;
+ }
+
+ 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 );
+ }
+
+ public static void register(String type, Class connectionClass) {
+ try {
+ Constructor c = connectionClass.getConstructor(new
Class[] {URL.class});
+ connectionType.put(type, c);
+ } catch (NoSuchMethodException e) {
+ //don't register connection classes that don't
conform to the spec
+ }
+ }
+}
\ No newline at end of file

Added:
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/MagicClasspathInitializer.java
==============================================================================
--- (empty file)
+++
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/MagicClasspathInitializer.java
Thu Mar 3 11:40:35 2005
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2004 Stephen J. McConnell.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.dpml.ide.eclipse.plugins.magic;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.ClasspathContainerInitializer;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.launching.JREContainer;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+
+public class MagicClasspathInitializer extends ClasspathContainerInitializer
+{
+
+ private static final String MAGIC = "net.dpml.MAGIC";
+
+ public void initialize( IPath containerPath, IJavaProject project )
+ throws CoreException
+ {
+ int size = containerPath.segmentCount();
+ if (size > 1) {
+ if (containerPath.segment(0).equals(MAGIC)) {
+ MagicContainer container = new MagicContainer(project,
containerPath);
+ JavaCore.setClasspathContainer(containerPath, new
IJavaProject[] {project}, new IClasspathContainer[] {container}, null);
+ }
+ }
+
+ }
+
+}

Added:
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/MagicContainer.java
==============================================================================
--- (empty file)
+++
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/MagicContainer.java
Thu Mar 3 11:40:35 2005
@@ -0,0 +1,149 @@
+/*
+ * Copyright 2004 Stephen J. McConnell.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied.
+ *
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.dpml.ide.eclipse.plugins.magic;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.TreeMap;
+
+import net.dpml.ide.common.magic.IdeDefinition;
+import net.dpml.ide.common.magic.IdeDependency;
+import net.dpml.ide.common.magic.IdeIndex;
+import net.dpml.ide.common.magic.IdeProjectDefinition;
+import net.dpml.ide.common.magic.IdeResourceDefinition;
+import net.dpml.ide.common.magic.UnresolvedDependencyException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.ui.internal.Workbench;
+
+public class MagicContainer implements IClasspathContainer
+{
+
+ private IPath path;
+ private IdeIndex index = new IdeIndex();
+
+ public MagicContainer( IJavaProject project, IPath containerPath )
+ {
+ this.path = containerPath;
+ IProject proj =
ResourcesPlugin.getWorkspace().getRoot().getProject("test");
+ IFile indexFile = proj.getFile(new
Path(containerPath.segment(1)));
+ String location = indexFile.getLocation().toOSString();
+ File absoluteIndexFile = new File( location );
+ index.loadIndex( absoluteIndexFile );
+
+ }
+
+ public IClasspathEntry[] getClasspathEntries()
+ {
+
+ try
+ {
+ index.flattenProjectDependencies();
+ }
+ catch ( UnresolvedDependencyException e )
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ TreeMap collectedDeps = new TreeMap();
+ IdeProjectDefinition[] projects = index.getProjectDefinitions();
+ for ( int i = 0; i < projects.length; i++ ) {
+ IdeProjectDefinition project = projects[i];
+ System.out.println( "Checking project " + project.getName());
+ try
+ {
+ String basedir =
project.getFullBaseFile().getCanonicalPath();
+ }
+ catch ( IOException e )
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ IdeDependency[] deps = project.getDependencies();
+ for (int k= 0; k<deps.length;k++ )
+ {
+ IdeDependency dep = deps[k];
+ IdeDefinition resolved = index.resolve(dep.getKey());
+ File depPath = getDependencyPath( resolved );
+ if (depPath!=null)
+ {
+ collectedDeps.put(dep.getKey(), depPath);
+ }
+ }
+ }
+ List entries = new ArrayList();
+ Iterator collEntries = collectedDeps.values().iterator();
+ //for (int i = 0; i < rs.length; i++) {
+ while (collEntries.hasNext())
+ {
+ File dep = (File) collEntries.next();
+ entries.add(JavaCore.newLibraryEntry(new
Path(dep.getAbsolutePath()), null, null));
+ }
+ return (IClasspathEntry[])entries.toArray(new
IClasspathEntry[entries.size()]);
+ }
+
+ private File getDependencyPath( IdeDefinition resolved )
+ {
+ File resolvedPath = null;
+ if ( resolved != null ) {
+ if ( resolved.isProjectDefinition() ) {
+ IdeProjectDefinition projectDependency =
(IdeProjectDefinition)resolved;
+ //not handled right now
+ resolvedPath = null;
+ }
+ else {
+ IdeResourceDefinition resource =
(IdeResourceDefinition)resolved;
+ resolvedPath = resource.getFullPath();
+ String libName = resource.getGroup().replace('/', '.')
+ + "." + resource.getName()
+ + "." + resource.getType()
+ + "#" + resource.getVersion();
+ }
+ }
+ return resolvedPath;
+ }
+
+ public String getDescription()
+ {
+ return "Deps [" +path + "]";
+ }
+
+ public int getKind()
+ {
+ return IClasspathContainer.K_APPLICATION;
+ }
+
+ public IPath getPath()
+ {
+ return path;
+ }
+
+
+}

Added:
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/MagicPlugin.java
==============================================================================
--- (empty file)
+++
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/MagicPlugin.java
Thu Mar 3 11:40:35 2005
@@ -0,0 +1,104 @@
+package net.dpml.ide.eclipse.plugins.magic;
+
+import net.dpml.transit.TransitException;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.url.URLConstants;
+import org.osgi.service.url.URLStreamHandlerService;
+
+
+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);
+ registerArtifactHandler( context );
+ }
+ /**
+ * 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;
+ }
+
+ public IPreferenceStore getPreferenceStore()
+ {
+ return null;
+ }
+
+}



  • svn commit: r1933 - in development/laboratory/ide/eclipse/TransitPlugin: . META-INF src/net/dpml/ide src/net/dpml/ide/eclipse src/net/dpml/ide/eclipse/plugins src/net/dpml/ide/eclipse/plugins/magic, pneubauer, 03/03/2005

Archive powered by MHonArc 2.6.24.

Top of Page