Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1910 - in development/laboratory/ide/eclipse: . TransitPlugin TransitPlugin/META-INF TransitPlugin/bin TransitPlugin/src TransitPlugin/src/net TransitPlugin/src/net/dpml TransitPlugin/src/net/dpml/transit TransitPlugin/src/transit TransitPlugin/src/transitPlugin TransitPlugin/src/transitPlugin/preferences

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: r1910 - in development/laboratory/ide/eclipse: . TransitPlugin TransitPlugin/META-INF TransitPlugin/bin TransitPlugin/src TransitPlugin/src/net TransitPlugin/src/net/dpml TransitPlugin/src/net/dpml/transit TransitPlugin/src/transit TransitPlugin/src/transitPlugin TransitPlugin/src/transitPlugin/preferences
  • Date: Sun, 27 Feb 2005 21:15:37 +0100

Author: pneubauer
Date: Sun Feb 27 21:15:36 2005
New Revision: 1910

Added:
development/laboratory/ide/eclipse/
development/laboratory/ide/eclipse/TransitPlugin/
development/laboratory/ide/eclipse/TransitPlugin/.classpath
development/laboratory/ide/eclipse/TransitPlugin/.project
development/laboratory/ide/eclipse/TransitPlugin/META-INF/
development/laboratory/ide/eclipse/TransitPlugin/META-INF/MANIFEST.MF
development/laboratory/ide/eclipse/TransitPlugin/bin/
development/laboratory/ide/eclipse/TransitPlugin/build.properties
development/laboratory/ide/eclipse/TransitPlugin/dpml-transit-main.jar
(contents, props changed)
development/laboratory/ide/eclipse/TransitPlugin/dpml-transit-tools.jar
(contents, props changed)
development/laboratory/ide/eclipse/TransitPlugin/plugin.xml
development/laboratory/ide/eclipse/TransitPlugin/src/
development/laboratory/ide/eclipse/TransitPlugin/src/net/
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/transit/

development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/transit/TransitProviderImpl.java
development/laboratory/ide/eclipse/TransitPlugin/src/transit/
development/laboratory/ide/eclipse/TransitPlugin/src/transitPlugin/

development/laboratory/ide/eclipse/TransitPlugin/src/transitPlugin/ArtifactURLHandler.java

development/laboratory/ide/eclipse/TransitPlugin/src/transitPlugin/TransitPlugin.java

development/laboratory/ide/eclipse/TransitPlugin/src/transitPlugin/preferences/

development/laboratory/ide/eclipse/TransitPlugin/src/transitPlugin/preferences/PreferenceConstants.java

development/laboratory/ide/eclipse/TransitPlugin/src/transitPlugin/preferences/PreferenceInitializer.java

development/laboratory/ide/eclipse/TransitPlugin/src/transitPlugin/preferences/TransitPreferencePage.java
Log:
first try to provide support for transit in Eclipse.
Right now, the artifact protocal is registered, but need to figure out:
- how to start the plugin at eclipse startup, and not upon opening the
preferences page
- how to actually activate e.g. the javadoc resolving into artifacts
- how to get eclipse handle URL in the project files (jar files)
--This line, and those below, will be ignor--


A ide/eclipse
A ide/eclipse/TransitPlugin
A ide/eclipse/TransitPlugin/.classpath
A ide/eclipse/TransitPlugin/META-INF
A ide/eclipse/TransitPlugin/META-INF/MANIFEST.MF
A ide/eclipse/TransitPlugin/.project
A ide/eclipse/TransitPlugin/src
A ide/eclipse/TransitPlugin/src/transitPlugin
A ide/eclipse/TransitPlugin/src/transitPlugin/preferences
A
ide/eclipse/TransitPlugin/src/transitPlugin/preferences/TransitPreferencePage.java
A
ide/eclipse/TransitPlugin/src/transitPlugin/preferences/PreferenceInitializer.java
A
ide/eclipse/TransitPlugin/src/transitPlugin/preferences/PreferenceConstants.java
A ide/eclipse/TransitPlugin/src/transitPlugin/TransitPlugin.java
A ide/eclipse/TransitPlugin/src/transitPlugin/ArtifactURLHandler.java
A ide/eclipse/TransitPlugin/src/transit
A ide/eclipse/TransitPlugin/src/net
A ide/eclipse/TransitPlugin/src/net/dpml
A ide/eclipse/TransitPlugin/src/net/dpml/transit
A ide/eclipse/TransitPlugin/src/net/dpml/transit/TransitProviderImpl.java
AM ide/eclipse/TransitPlugin/dpml-transit-tools.jar
A ide/eclipse/TransitPlugin/bin
A ide/eclipse/TransitPlugin/build.properties
AM ide/eclipse/TransitPlugin/dpml-transit-main.jar
A ide/eclipse/TransitPlugin/plugin.xml


Added: development/laboratory/ide/eclipse/TransitPlugin/.classpath
==============================================================================
--- (empty file)
+++ development/laboratory/ide/eclipse/TransitPlugin/.classpath Sun Feb 27
21:15:36 2005
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/"/>
+ <classpathentry exported="true" 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="output" path="bin"/>
+</classpath>

Added: development/laboratory/ide/eclipse/TransitPlugin/.project
==============================================================================
--- (empty file)
+++ development/laboratory/ide/eclipse/TransitPlugin/.project Sun Feb 27
21:15:36 2005
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>TransitPlugin</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>

Added: development/laboratory/ide/eclipse/TransitPlugin/META-INF/MANIFEST.MF
==============================================================================
--- (empty file)
+++ development/laboratory/ide/eclipse/TransitPlugin/META-INF/MANIFEST.MF
Sun Feb 27 21:15:36 2005
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: TransitPlugin Plug-in
+Bundle-SymbolicName: TransitPlugin
+Bundle-Version: 1.0.0
+Bundle-ClassPath: TransitPlugin.jar,
+ dpml-transit-main.jar,
+ dpml-transit-tools.jar
+Bundle-Activator: transitPlugin.TransitPlugin
+Bundle-Localization: plugin
+Export-Package: transitPlugin
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ui,
+ org.eclipse.jdt.launching,
+ org.eclipse.debug.core
+Eclipse-AutoStart: true

Added: development/laboratory/ide/eclipse/TransitPlugin/build.properties
==============================================================================
--- (empty file)
+++ development/laboratory/ide/eclipse/TransitPlugin/build.properties Sun
Feb 27 21:15:36 2005
@@ -0,0 +1,4 @@
+source.TransitPlugin.jar = src/
+output.TransitPlugin.jar = bin/
+bin.includes = plugin.xml,\
+ TransitPlugin.jar

Added: development/laboratory/ide/eclipse/TransitPlugin/dpml-transit-main.jar
==============================================================================
Binary file. No diff available.

Added: development/laboratory/ide/eclipse/TransitPlugin/dpml-transit-tools.jar
==============================================================================
Binary file. No diff available.

Added: development/laboratory/ide/eclipse/TransitPlugin/plugin.xml
==============================================================================
--- (empty file)
+++ development/laboratory/ide/eclipse/TransitPlugin/plugin.xml Sun Feb 27
21:15:36 2005
@@ -0,0 +1,45 @@
+<?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.launching.classpathProviders">
+ <classpathProvider
+ class="net.dpml.transit.TransitProviderImpl"
+ id="net.dpml.transit.ProviderId">
+ </classpathProvider>
+ </extension>
+
+
+
+</plugin>

Added:
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/transit/TransitProviderImpl.java
==============================================================================
--- (empty file)
+++
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/transit/TransitProviderImpl.java
Sun Feb 27 21:15:36 2005
@@ -0,0 +1,39 @@
+/*
+ * 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.transit;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.jdt.launching.IRuntimeClasspathProvider;
+
+public class TransitProviderImpl implements IRuntimeClasspathProvider
+{
+
+ public IRuntimeClasspathEntry[] computeUnresolvedClasspath(
ILaunchConfiguration configuration ) throws CoreException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public IRuntimeClasspathEntry[] resolveClasspath(
IRuntimeClasspathEntry[] entries, ILaunchConfiguration configuration ) throws
CoreException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}

Added:
development/laboratory/ide/eclipse/TransitPlugin/src/transitPlugin/ArtifactURLHandler.java
==============================================================================
--- (empty file)
+++
development/laboratory/ide/eclipse/TransitPlugin/src/transitPlugin/ArtifactURLHandler.java
Sun Feb 27 21:15:36 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 transitPlugin;
+
+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 artifactUrlHandler;
+ public ArtifactURLHandler() throws TransitException {
+ super();
+ artifactUrlHandler = 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/transitPlugin/TransitPlugin.java
==============================================================================
--- (empty file)
+++
development/laboratory/ide/eclipse/TransitPlugin/src/transitPlugin/TransitPlugin.java
Sun Feb 27 21:15:36 2005
@@ -0,0 +1,104 @@
+package transitPlugin;
+
+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 TransitPlugin extends Plugin {
+ //The shared instance.
+ private static TransitPlugin plugin;
+ //Resource bundle.
+ private ResourceBundle resourceBundle;
+
+ /**
+ * The constructor.
+ */
+ public TransitPlugin() {
+ 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 TransitPlugin 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 =
TransitPlugin.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;
+ }
+
+}

Added:
development/laboratory/ide/eclipse/TransitPlugin/src/transitPlugin/preferences/PreferenceConstants.java
==============================================================================
--- (empty file)
+++
development/laboratory/ide/eclipse/TransitPlugin/src/transitPlugin/preferences/PreferenceConstants.java
Sun Feb 27 21:15:36 2005
@@ -0,0 +1,16 @@
+package transitPlugin.preferences;
+
+/**
+ * Constant definitions for plug-in preferences
+ */
+public class PreferenceConstants {
+
+ public static final String P_PATH = "pathPreference";
+
+ public static final String P_BOOLEAN = "booleanPreference";
+
+ public static final String P_CHOICE = "choicePreference";
+
+ public static final String P_STRING = "stringPreference";
+
+}

Added:
development/laboratory/ide/eclipse/TransitPlugin/src/transitPlugin/preferences/PreferenceInitializer.java
==============================================================================
--- (empty file)
+++
development/laboratory/ide/eclipse/TransitPlugin/src/transitPlugin/preferences/PreferenceInitializer.java
Sun Feb 27 21:15:36 2005
@@ -0,0 +1,27 @@
+package transitPlugin.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+import transitPlugin.TransitPlugin;
+
+/**
+ * Class used to initialize default preference values.
+ */
+public class PreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
+ */
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = TransitPlugin.getDefault()
+ .getPreferenceStore();
+ store.setDefault(PreferenceConstants.P_BOOLEAN, true);
+ store.setDefault(PreferenceConstants.P_CHOICE, "choice2");
+ store.setDefault(PreferenceConstants.P_STRING,
+ "Default value");
+ }
+
+}

Added:
development/laboratory/ide/eclipse/TransitPlugin/src/transitPlugin/preferences/TransitPreferencePage.java
==============================================================================
--- (empty file)
+++
development/laboratory/ide/eclipse/TransitPlugin/src/transitPlugin/preferences/TransitPreferencePage.java
Sun Feb 27 21:15:36 2005
@@ -0,0 +1,105 @@
+package transitPlugin.preferences;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import net.dpml.transit.TransitException;
+import net.dpml.transit.artifact.Handler;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.preference.*;
+import org.eclipse.jface.util.Policy;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.IWorkbench;
+import transitPlugin.TransitPlugin;
+
+/**
+ * This class represents a preference page that
+ * is contributed to the Preferences dialog. By
+ * subclassing <samp>FieldEditorPreferencePage</samp>, we
+ * can use the field support built into JFace that allows
+ * us to create a page that is small and knows how to
+ * save, restore and apply itself.
+ * <p>
+ * This page is used to modify preferences only. They
+ * are stored in the preference store that belongs to
+ * the main plug-in class. That way, preferences can
+ * be accessed directly via the preference store.
+ */
+
+public class TransitPreferencePage
+ extends PreferencePage
+ implements IWorkbenchPreferencePage {
+
+ private Label artifactUrlLabel;
+ private Text artifactUrlTest;
+ public void performApply() {
+ testUrl(artifactUrlTest.getText());
+ //performOk();
+ }
+ private void testUrl( String text )
+ {
+ System.out.println("testing URL: "+ text);
+ URL url;
+ URL resolved;
+ try
+ {
+ url = new URL(null, text, new Handler());
+ resolved = Platform.resolve(url);
+ System.out.println("resolved: "+ resolved);
+
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+ public void propertyChange( PropertyChangeEvent event )
+ {
+ //super.propertyChange( event );
+ }
+
+ public TransitPreferencePage() {
+ //super(GRID);
+
setPreferenceStore(TransitPlugin.getDefault().getPreferenceStore());
+ setDescription("Transit preferences");
+ }
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+ }
+
+ protected Control createContents( Composite parent )
+ {
+ Composite group=new Composite(parent, SWT.NULL);
+ GridLayout layout=new GridLayout();
+ layout.numColumns=3;
+ group.setLayout(layout);
+ GridData data = new GridData();
+ data.horizontalAlignment = GridData.FILL;
+ group.setLayoutData(data);
+ artifactUrlLabel = new Label(group, SWT.NONE);
+ artifactUrlLabel.setText("Hello transit"); //$NON-NLS-1$
+ artifactUrlTest = new Text(group, SWT.NONE);
+
artifactUrlTest.setText("artifact:jar:dpml/transit/dpml-transit-main#SNAPSHOT");
+ Button testArtifactButton = new Button(group, SWT.NONE);
+ testArtifactButton.setText("test");
+ System.out.println("hello transit");
+ return group;
+ }
+
+
+
+
+}
\ No newline at end of file



  • svn commit: r1910 - in development/laboratory/ide/eclipse: . TransitPlugin TransitPlugin/META-INF TransitPlugin/bin TransitPlugin/src TransitPlugin/src/net TransitPlugin/src/net/dpml TransitPlugin/src/net/dpml/transit TransitPlugin/src/transit TransitPlugin/src/transitPlugin TransitPlugin/src/transitPlugin/preferences, pneubauer, 02/27/2005

Archive powered by MHonArc 2.6.24.

Top of Page