Skip to Content.
Sympa Menu

notify-dpml - svn commit: r1952 - in development/laboratory/ide/eclipse/TransitPlugin: . 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: r1952 - in development/laboratory/ide/eclipse/TransitPlugin: . src/net/dpml/ide/eclipse/plugins/magic
  • Date: Fri, 04 Mar 2005 22:52:54 +0100

Author: pneubauer
Date: Fri Mar 4 22:52:53 2005
New Revision: 1952

Modified:
development/laboratory/ide/eclipse/TransitPlugin/plugin.xml

development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/IndexActionDelegate.java

development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/MagicContainer.java
Log:
plugin now seems to work, but is not handling ${properties} in index files


Modified: development/laboratory/ide/eclipse/TransitPlugin/plugin.xml
==============================================================================
--- development/laboratory/ide/eclipse/TransitPlugin/plugin.xml (original)
+++ development/laboratory/ide/eclipse/TransitPlugin/plugin.xml Fri Mar 4
22:52:53 2005
@@ -43,6 +43,9 @@

class="net.dpml.ide.eclipse.plugins.magic.MagicClasspathInitializer"
/>
</extension>
+ <extension id="preferences" point="org.eclipse.core.runtime.preferences"
name="preferences">
+ <scope name="project"
class="org.eclipse.core.internal.resources.ProjectPreferences"/>
+ </extension>
<extension
point="org.eclipse.core.resources.natures"
id="MagicNature"
@@ -66,6 +69,10 @@
id="net.dpml.ide.eclipse.plugins.magic.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.plugins.magic.indextool.setproject"
label="Reload magic index"
icon="resources/globe.png"

Modified:
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/IndexActionDelegate.java
==============================================================================
---
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/IndexActionDelegate.java
(original)
+++
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/IndexActionDelegate.java
Fri Mar 4 22:52:53 2005
@@ -9,39 +9,57 @@
import java.util.Iterator;
import java.util.List;
import java.util.TreeMap;
+import java.util.prefs.Preferences;

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.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.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.eclipse.ui.part.ShowInContext;
+import org.eclipse.ui.internal.Workbench;
+import org.osgi.service.prefs.BackingStoreException;


-public class IndexActionDelegate extends ShowInContext implements
IObjectActionDelegate
+public class IndexActionDelegate extends SelectionListenerAction implements
IObjectActionDelegate
{

- public IndexActionDelegate( Object input, ISelection iSelection )
+
+ protected IndexActionDelegate( String text )
+ {
+ super( text );
+ }
+
+ public IndexActionDelegate()
{
- super( input, iSelection );
- log = MagicPlugin.getDefault().getLog();
+ this("Index Action");
}
-
- private ILog log;
+ private ILog log = MagicPlugin.getDefault().getLog();;
private IResource mIndexFile;
private IdeIndex index;
+ private IProject proj;

public void setActivePart( IAction iAction, IWorkbenchPart iTargetPart )
{
@@ -50,14 +68,8 @@

public void run( IAction iAction )
{
-
-// List resources = getSelectedResources();
-// if (resources.size()>0)
-// {
-// mIndexFile = (IResource)resources.get(0);
-// }
-// getIndex();
- //setProjetSources();
+ getIndex();
+ setProjetSources();
}

private void getIndex()
@@ -78,10 +90,40 @@

public void selectionChanged( IAction iAction, ISelection iSelection )
{
- // TODO Auto-generated method stub
+ if (iSelection.isEmpty())
+ {
+ return;
+ }
+ StructuredSelection selection = (StructuredSelection)iSelection;
+ mIndexFile = (IFile)selection.getFirstElement();
+ 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 )
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }

+
+ }
+ /**
+ * 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()
+ private void setProjetSources()
{
TreeMap collectedSources = new TreeMap();
IdeProjectDefinition[] projects = index.getProjectDefinitions();
@@ -100,9 +142,22 @@
sourceEntries.add(srcDir);
}
//add the magic container
- IClasspathEntry magicContainer = JavaCore.newContainerEntry( path );
+ IClasspathEntry magicContainer = JavaCore.newContainerEntry( new
Path("net.dpml.MAGIC/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 )
+ {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }// = proj;
try
{
javaProject.setRawClasspath(sourcePath,
proj.getFullPath().append(new Path("bin")), null);
@@ -112,10 +167,8 @@
// TODO Auto-generated catch block
e.printStackTrace();
}
-
-
- }*/
- /**private void collectSources( IdeProjectDefinition project, TreeMap
collectedSources )
+ }
+ private void collectSources( IdeProjectDefinition project, TreeMap
collectedSources )
{
IPath basePath = new Path(project.getBasePath());
IPath main = basePath.append("src/main");
@@ -126,6 +179,5 @@
IPath source =
proj.getFullPath().append(proj.getFile(main).getProjectRelativePath());

collectedSources.put(main.toString(),JavaCore.newSourceEntry(source));
}
- }*/
-
+ }
}

Modified:
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/MagicContainer.java
==============================================================================
---
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/MagicContainer.java
(original)
+++
development/laboratory/ide/eclipse/TransitPlugin/src/net/dpml/ide/eclipse/plugins/magic/MagicContainer.java
Fri Mar 4 22:52:53 2005
@@ -33,12 +33,15 @@

import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ProjectScope;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
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.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
@@ -46,6 +49,7 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.core.ClasspathEntry;
import org.eclipse.ui.internal.Workbench;
+import org.osgi.service.prefs.BackingStoreException;

public class MagicContainer implements IClasspathContainer
{
@@ -64,13 +68,13 @@
log = MagicPlugin.getDefault().getLog();
log.log(new Status(Status.INFO, "net.dpml.MagicPlugin", 0,
"ContainerPath: " + containerPath, null));
this.path = containerPath;
- if (containerPath.segmentCount() < 2)
+ if (!containerPath.segment(0).equals(ID))
{
return;
}
proj =
ResourcesPlugin.getWorkspace().getRoot().getProject(project.getElementName());
+ getIndexFile();
log.log(new Status(Status.INFO, "net.dpml.MagicPlugin", 0,
"Project: " + proj, null));
- indexFile = proj.getFile(new
Path(containerPath.removeFirstSegments(1).toString()));
try
{
String location = indexFile.getLocation().toOSString();
@@ -89,6 +93,26 @@



+ private void getIndexFile()
+ {
+ IScopeContext projectScope = new ProjectScope(proj);
+ IEclipsePreferences projectNode =
projectScope.getNode("net.dpml.magic");
+ String indexPath = null;
+ if (projectNode != null) {
+ indexPath = projectNode.get("index.path", null);
+ }
+ if (indexPath!=null)
+ {
+ indexFile = proj.getFile(new Path(indexPath));
+ }
+
+ }
+
+
+
+
+
+
public IClasspathEntry[] getClasspathEntries()
{
if(index==null)



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

Archive powered by MHonArc 2.6.24.

Top of Page