notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r2398 - in development/laboratory/ide/eclipse/plugins: net.dpml.ide.eclipse.core net.dpml.ide.eclipse.ui net.dpml.ide.eclipse.ui/src net.dpml.ide.eclipse.ui/src/main net.dpml.ide.eclipse.ui/src/main/net net.dpml.ide.eclipse.ui/src/main/net/dpml net.dpml.ide.eclipse.ui/src/main/net/dpml/ide net.dpml.ide.eclipse.ui/src/main/net/dpml/ide/eclipse net.dpml.ide.eclipse.ui/src/main/net/dpml/ide/eclipse/ui
- From: peter AT neubauer.se
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r2398 - in development/laboratory/ide/eclipse/plugins: net.dpml.ide.eclipse.core net.dpml.ide.eclipse.ui net.dpml.ide.eclipse.ui/src net.dpml.ide.eclipse.ui/src/main net.dpml.ide.eclipse.ui/src/main/net net.dpml.ide.eclipse.ui/src/main/net/dpml net.dpml.ide.eclipse.ui/src/main/net/dpml/ide net.dpml.ide.eclipse.ui/src/main/net/dpml/ide/eclipse net.dpml.ide.eclipse.ui/src/main/net/dpml/ide/eclipse/ui
- Date: Mon, 25 Apr 2005 01:02:36 -0400
Author: peter AT neubauer.se
Date: Mon Apr 25 01:02:31 2005
New Revision: 2398
Added:
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/.classpath
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/.project
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/build.properties
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/plugin.xml
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/src/
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/src/main/
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/src/main/net/
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/src/main/net/dpml/
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/src/main/net/dpml/ide/
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/src/main/net/dpml/ide/eclipse/
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/src/main/net/dpml/ide/eclipse/ui/
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/src/main/net/dpml/ide/eclipse/ui/DpmlUiPlugin.java
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/src/main/net/dpml/ide/eclipse/ui/IndexActionDelegate.java
Modified:
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.core/.classpath
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.core/plugin.xml
Log:
separating core and ui
Modified:
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.core/.classpath
==============================================================================
---
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.core/.classpath
(original)
+++
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.core/.classpath
Mon Apr 25 01:02:31 2005
@@ -1,36 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry exported="true" kind="lib"
path="lib/dpml-ide-common-magic-SNAPSHOT.jar">
- <attributes>
- </attributes>
- </classpathentry>
- <classpathentry exported="true" kind="lib"
path="lib/dpml-magic-core-SNAPSHOT.jar">
- <attributes>
- </attributes>
- </classpathentry>
- <classpathentry exported="true" kind="lib" path="lib/junit-3.8.1.jar">
- <attributes>
- </attributes>
- </classpathentry>
- <classpathentry exported="true" kind="lib"
path="lib/dpml-transit-main-SNAPSHOT.jar">
- <attributes>
- </attributes>
- </classpathentry>
- <classpathentry exported="true" kind="lib"
path="lib/dpml-transit-tools-SNAPSHOT.jar">
- <attributes>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" path="src">
- <attributes>
- </attributes>
- </classpathentry>
- <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins">
- <attributes>
- </attributes>
- </classpathentry>
- <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER">
- <attributes>
- </attributes>
- </classpathentry>
+ <classpathentry kind="src" path="bin/"/>
+ <classpathentry exported="true" kind="lib"
path="lib/dpml-ide-common-magic-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib"
path="lib/dpml-magic-core-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib"
path="lib/junit-3.8.1.jar"/>
+ <classpathentry exported="true" kind="lib"
path="lib/dpml-transit-main-SNAPSHOT.jar"/>
+ <classpathentry exported="true" kind="lib"
path="lib/dpml-transit-tools-SNAPSHOT.jar"/>
+ <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="output" path="bin"/>
</classpath>
Modified:
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.core/plugin.xml
==============================================================================
---
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.core/plugin.xml
(original)
+++
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.core/plugin.xml
Mon Apr 25 01:02:31 2005
@@ -3,7 +3,7 @@
<plugin
id="net.dpml.ide.eclipse.core"
name="DPML Studio Core"
- version="0.1.93"
+ version="0.1.94"
provider-name="DPML"
class="net.dpml.ide.eclipse.core.DpmlCorePlugin">
<runtime>
@@ -54,25 +54,6 @@
<scope name="project"
class="org.eclipse.core.internal.resources.ProjectPreferences"/>
</extension>
- <extension point = "org.eclipse.ui.popupMenus">
- <objectContribution
- id="net.dpml.ide.eclipse.ui.indextool"
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="index.xml">
- <filter
- name="projectNature"
- value="org.eclipse.jdt.core.javanature">
- </filter>
- <action id="net.dpml.ide.eclipse.ui.indextool.setproject"
- label="Reload magic index"
- icon="resources/globe.png"
- menubarPath="additions"
-
helpContextId="net.dpml.ide.eclipse.plugins.magic.indextool.setproject_action_context"
- class="net.dpml.ide.eclipse.core.IndexActionDelegate"
- enablesFor="1">
- </action>
- </objectContribution>
- </extension>
<extension
point="org.eclipse.help.toc">
<toc file="help/book.xml" primary="true"/>
Added:
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/.classpath
==============================================================================
--- (empty file)
+++
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/.classpath
Mon Apr 25 01:02:31 2005
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="target/classes/"/>
+ <classpathentry kind="src" path="src/main">
+ <attributes>
+ </attributes>
+ </classpathentry>
+ <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/plugins/net.dpml.ide.eclipse.ui/.project
==============================================================================
--- (empty file)
+++
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/.project
Mon Apr 25 01:02:31 2005
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>net.dpml.ide.eclipse.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+
<name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <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>
+
<nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature>
+ </natures>
+</projectDescription>
Added:
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/build.properties
==============================================================================
--- (empty file)
+++
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/build.properties
Mon Apr 25 01:02:31 2005
@@ -0,0 +1,9 @@
+bin.includes = plugin.xml,\
+ resources/,\
+ lib/,\
+ META-INF/,\
+ help/,\
+ lib/dpmlui.jar,\
+ target/classes/
+jars.compile.order = lib/dpmlui.jar
+source.lib/dpmlui.jar = target/classes/
Added:
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/plugin.xml
==============================================================================
--- (empty file)
+++
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/plugin.xml
Mon Apr 25 01:02:31 2005
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin
+ id="net.dpml.ide.eclipse.ui"
+ name="DPML Studio UI"
+ version="0.1.94"
+ provider-name="DPML"
+ class="net.dpml.ide.eclipse.ui.DpmlUiPlugin">
+ <runtime>
+ <library name="lib/dpmlui.jar">
+ <export name="*"/>
+ </library>
+ <library name="lib/dpml-ide-common-magic-SNAPSHOT.jar">
+ <export name="*"/>
+ </library>
+ <library name="lib/dpml-magic-core-SNAPSHOT.jar">
+ <export name="*"/>
+ </library>
+ <library name="lib/junit-3.8.1.jar">
+ <export name="*"/>
+ </library>
+ <library name="lib/dpml-transit-main-SNAPSHOT.jar">
+ <export name="*"/>
+ </library>
+ <library name="lib/dpml-transit-tools-SNAPSHOT.jar">
+ <export name="*"/>
+ </library>
+ </runtime>
+
+ <requires>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.jdt"/>
+ <import plugin="org.apache.ant"/>
+ <import plugin="org.eclipse.jdt.launching"/>
+ <import plugin="org.eclipse.platform"/>
+ <import plugin="org.eclipse.jdt.core"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.debug.core"/>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.help"/>
+ <import plugin="org.eclipse.ant.core"/>
+ <import plugin="org.eclipse.debug.ui"/>
+ <import plugin="org.eclipse.ui.externaltools"/>
+ <import plugin="net.dpml.ide.eclipse.core"/>
+ </requires>
+
+ <extension point = "org.eclipse.ui.popupMenus">
+ <objectContribution
+ id="net.dpml.ide.eclipse.ui.indextool"
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="index.xml">
+ <filter
+ name="projectNature"
+ value="org.eclipse.jdt.core.javanature">
+ </filter>
+ <action id="net.dpml.ide.eclipse.ui.indextool.setproject"
+ label="Reload magic index"
+ icon="resources/globe.png"
+ menubarPath="additions"
+
helpContextId="net.dpml.ide.eclipse.plugins.magic.indextool.setproject_action_context"
+ class="net.dpml.ide.eclipse.ui.IndexActionDelegate"
+ enablesFor="1">
+ </action>
+ </objectContribution>
+ </extension>
+</plugin>
Added:
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/src/main/net/dpml/ide/eclipse/ui/DpmlUiPlugin.java
==============================================================================
--- (empty file)
+++
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/src/main/net/dpml/ide/eclipse/ui/DpmlUiPlugin.java
Mon Apr 25 01:02:31 2005
@@ -0,0 +1,205 @@
+package net.dpml.ide.eclipse.ui;
+
+import java.util.Hashtable;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+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.Plugin;
+import org.eclipse.core.runtime.Status;
+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;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class DpmlUiPlugin extends Plugin implements IStartup
+{
+ /**
+ * The shared instance.
+ */
+ private static DpmlUiPlugin m_PLUGIN;
+
+ /**
+ * 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.
+ */
+ public DpmlUiPlugin()
+ {
+ super();
+ m_PLUGIN = this;
+ }
+
+ /**
+ *
+ * @see
org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start( BundleContext context ) throws Exception
+ {
+ super.start( context );
+ //registerArtifactHandler( context );
+
+ 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[MAGIC_ENTRIES_LENGTH];
+ AntCorePreferences prefs =
AntCorePlugin.getPlugin().getPreferences();
+ IAntClasspathEntry[] coreClasspath =
prefs.getDefaultAntHomeEntries();
+ IAntClasspathEntry[] newClasspath;
+ String pluginPath =
DpmlUiPlugin.getDefault().getBundle().getLocation()
+ .substring( UPDATE_PREFIX_LENGTH );
+ try
+ {
+ transitClasspath[0] = new AntClasspathEntry( pluginPath
+ + "lib/dpml-transit-main-SNAPSHOT.jar" );
+ transitClasspath[1] = new AntClasspathEntry( pluginPath
+ + "lib/dpml-transit-tools.jar" );
+ transitClasspath[2] = new AntClasspathEntry( pluginPath
+ + "lib/junit-3.8.1.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
+ *
+ * @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} );
+ try
+ {
+ context.registerService(
URLStreamHandlerService.class.getName(),
+ new ArtifactURLHandler(), properties
);
+
+
+ }
+ catch ( Exception e )
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ }
+
+ /**
+ *
+ * @see
org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop( BundleContext context ) throws Exception
+ {
+ super.stop( context );
+ m_PLUGIN = null;
+ m_resourceBundle = null;
+ }
+
+ /**
+ * Returns the shared instance.
+ * @return the instance
+ */
+ public static DpmlUiPlugin getDefault()
+ {
+ return m_PLUGIN;
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle, or 'key' if not
+ * found.
+ */
+ public static String getResourceString( String key )
+ {
+ ResourceBundle bundle =
DpmlUiPlugin.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 ( m_resourceBundle == null )
+ m_resourceBundle = ResourceBundle
+ .getBundle( "transitPlugin.TransitPluginResources" );
+ }
+ catch ( MissingResourceException x )
+ {
+ m_resourceBundle = null;
+ }
+ return m_resourceBundle;
+ }
+
+ public IPreferenceStore getPreferenceStore()
+ {
+ return null;
+ }
+
+ public void earlyStartup()
+ {
+ }
+
+ public static void log( String string, int severity )
+ {
+ DpmlUiPlugin.getDefault().getLog().log(
+ new Status( Status.INFO, DpmlUiPlugin.getDefault().getClass()
+ .getName(), 0, string, null ) );
+
+ }
+
+ public static void logInfo( String message )
+ {
+ log( message, Status.INFO );
+
+ }
+
+}
Added:
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/src/main/net/dpml/ide/eclipse/ui/IndexActionDelegate.java
==============================================================================
--- (empty file)
+++
development/laboratory/ide/eclipse/plugins/net.dpml.ide.eclipse.ui/src/main/net/dpml/ide/eclipse/ui/IndexActionDelegate.java
Mon Apr 25 01:02:31 2005
@@ -0,0 +1,221 @@
+package net.dpml.ide.eclipse.ui;
+
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.TreeMap;
+
+import net.dpml.ide.common.magic.IdeIndex;
+import net.dpml.ide.common.magic.IdeProjectDefinition;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.ILog;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.core.ClasspathEntry;
+import org.eclipse.jdt.internal.core.JavaProject;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.actions.SelectionListenerAction;
+import org.osgi.service.prefs.BackingStoreException;
+
+public class IndexActionDelegate extends SelectionListenerAction implements
+ IObjectActionDelegate
+{
+
+ protected IndexActionDelegate( String text )
+ {
+ super( text );
+ }
+
+ public IndexActionDelegate()
+ {
+ this( "Index Action" );
+ }
+
+ private ILog log = DpmlUiPlugin.getDefault().getLog();
+
+ private IResource mIndexFile;
+
+ private IdeIndex index;
+
+ private IProject proj;
+
+ public void setActivePart( IAction iAction, IWorkbenchPart iTargetPart )
+ {
+
+ }
+
+ public void run( IAction iAction )
+ {
+ getIndex();
+ storeNewIndex();
+ setProjetSources();
+ }
+
+ private void storeNewIndex()
+ {
+ proj = mIndexFile.getProject();
+
+ IScopeContext projectScope = new ProjectScope( proj );
+ IEclipsePreferences projectNode = projectScope
+ .getNode( "net.dpml.magic" );
+ if ( projectNode != null )
+ {
+ projectNode.put( "index.path",
mIndexFile.getProjectRelativePath()
+ .toPortableString() );
+ try
+ {
+ projectNode.flush();
+ }
+ catch ( BackingStoreException e )
+ {
+ log.log( new Status( Status.WARNING, "net.dpml.MagicPlugin",
0,
+ "Could not store new index" +
mIndexFile.getProjectRelativePath(), e ) );
+ }
+ }
+
+ }
+
+ private void getIndex()
+ {
+ try
+ {
+ String location = mIndexFile.getLocation().toOSString();
+ File absoluteIndexFile = new File( location );
+ index = new IdeIndex();
+ index.loadIndex( absoluteIndexFile );
+ }
+ catch ( NullPointerException npe )
+ {
+ log.log( new Status( Status.WARNING, "net.dpml.MagicPlugin", 0,
+ "Could not initialize MagicContainer ", npe ) );
+ }
+
+ }
+
+ public void selectionChanged( IAction iAction, ISelection iSelection )
+ {
+ if ( iSelection.isEmpty() )
+ {
+ return;
+ }
+ StructuredSelection selection = (StructuredSelection) iSelection;
+ mIndexFile = (IFile) selection.getFirstElement();
+
+
+ }
+
+ /**
+ * The <code>DeleteResourceAction</code> implementation of this
+ * <code>SelectionListenerAction</code> method disables the action if the
+ * selection contains phantom resources or non-resources
+ */
+ protected boolean updateSelection( IStructuredSelection selection )
+ {
+ return super.updateSelection( selection );
+ }
+
+ private void setProjetSources()
+ {
+ TreeMap collectedSources = new TreeMap();
+ IdeProjectDefinition[] projects = index.getProjectDefinitions();
+ for ( int i = 0; i < projects.length; i++ )
+ {
+ IdeProjectDefinition project = projects[i];
+ DpmlUiPlugin.logInfo( "Checking project " + project.getName() );
+ collectSources( project, collectedSources );
+ }
+
+ List sourceEntries = new ArrayList();
+
+ Iterator collSources = collectedSources.values().iterator();
+ while ( collSources.hasNext() )
+ {
+ IClasspathEntry srcDir = (IClasspathEntry) collSources.next();
+ sourceEntries.add( srcDir );
+ }
+ // add the magic container
+ IClasspathEntry magicContainer = JavaCore.newContainerEntry( new
Path(
+ "net.dpml.MAGIC/deps" ) );
+ sourceEntries.add( magicContainer );
+ IClasspathEntry jreContainer = JavaCore.newContainerEntry( new Path(
+ "org.eclipse.jdt.launching.JRE_CONTAINER" ) );
+ sourceEntries.add( jreContainer );
+ IClasspathEntry[] sourcePath = (IClasspathEntry[]) sourceEntries
+ .toArray( new IClasspathEntry[sourceEntries.size()] );
+ IJavaProject javaProject = null;
+ try
+ {
+ IProjectNature nature = proj
+ .getNature( "org.eclipse.jdt.core.javanature" );
+ javaProject = (JavaProject) nature;
+ }
+ catch ( CoreException e1 )
+ {
+ log.log( new Status( Status.ERROR, "net.dpml.MagicPlugin", 0,
+ "Could not initialize MagicContainer 0", e1 ) );
+ }// = proj;
+ try
+ {
+ javaProject.setRawClasspath( sourcePath, null );
+ }
+ catch ( JavaModelException e )
+ {
+ log.log( new Status( Status.ERROR, "net.dpml.MagicPlugin", 0,
+ "Could not initialize MagicContainer 1", e ) );
+ }
+ }
+
+ private void collectSources( IdeProjectDefinition project,
+ TreeMap collectedSources )
+ {
+ IPath projectPath = new Path( project.getFullBaseDir().toString() );
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ IResource fileForLocation = root.getContainerForLocation(
projectPath );
+ IPath absoluteProjectPath = fileForLocation.getFullPath();
+ IPath main = absoluteProjectPath.append( "src/main" );
+ IPath test = absoluteProjectPath.append( "src/test" );
+ IPath java = absoluteProjectPath.append( "src/java" );
+ if ( proj.exists( main.removeFirstSegments( 1 ) ) )
+ {
+ // IPath source =
+ //
proj.getFullPath().append(proj.getFile(main).getProjectRelativePath());
+ IPath out = absoluteProjectPath.append( "target/classes" );
+ collectedSources.put( main.toString(), JavaCore.newSourceEntry(
+ main, ClasspathEntry.INCLUDE_ALL, out ) );
+ }
+ if ( proj.exists( test.removeFirstSegments( 1 ) ) )
+ {
+ IPath out = absoluteProjectPath.append( "target/test-classes" );
+ collectedSources.put( test.toString(), JavaCore.newSourceEntry(
+ test, ClasspathEntry.INCLUDE_ALL, out ) );
+ }
+ if ( proj.exists( java.removeFirstSegments( 1 ) ) )
+ {
+ IPath out = absoluteProjectPath.append( "target/classes" );
+ collectedSources.put( test.toString(), JavaCore.newSourceEntry(
+ java, ClasspathEntry.INCLUDE_ALL, out ) );
+ }
+ }
+}
- svn commit: r2398 - in development/laboratory/ide/eclipse/plugins: net.dpml.ide.eclipse.core net.dpml.ide.eclipse.ui net.dpml.ide.eclipse.ui/src net.dpml.ide.eclipse.ui/src/main net.dpml.ide.eclipse.ui/src/main/net net.dpml.ide.eclipse.ui/src/main/net/dpml net.dpml.ide.eclipse.ui/src/main/net/dpml/ide net.dpml.ide.eclipse.ui/src/main/net/dpml/ide/eclipse net.dpml.ide.eclipse.ui/src/main/net/dpml/ide/eclipse/ui, peter, 04/24/2005
Archive powered by MHonArc 2.6.24.