You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ds...@apache.org on 2009/07/21 20:51:41 UTC

svn commit: r796467 [14/25] - in /felix/trunk/sigil: common/core.tests/src/org/apache/felix/sigil/core/ common/core/src/org/apache/felix/sigil/bnd/ common/core/src/org/apache/felix/sigil/config/ common/core/src/org/apache/felix/sigil/core/ common/core/...

Modified: felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/preferences/SigilPreferencesInitializer.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/preferences/SigilPreferencesInitializer.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/preferences/SigilPreferencesInitializer.java (original)
+++ felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/preferences/SigilPreferencesInitializer.java Tue Jul 21 18:51:33 2009
@@ -26,29 +26,32 @@
 import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
 import org.eclipse.jface.preference.IPreferenceStore;
 
-public class SigilPreferencesInitializer extends AbstractPreferenceInitializer {
-	
-	public static final String[] EXCLUDED_RESOURCES = new String[] {
-		".project", ".classpath", ".settings"
-	};
-	
-	@Override
-	public void initializeDefaultPreferences() {
-		IPreferenceStore store = SigilCore.getDefault().getPreferenceStore();
-
-		store.setDefault(SigilCore.OSGI_INSTALL_CHECK_PREFERENCE, true);
-
-		store.setDefault(SigilCore.DEFAULT_VERSION_LOWER_BOUND, VersionRangeBoundingRule.Micro.name());
-		store.setDefault(SigilCore.DEFAULT_VERSION_UPPER_BOUND, VersionRangeBoundingRule.Any.name());
-
-		store.setDefault(SigilCore.DEFAULT_EXCLUDED_RESOURCES, PrefsUtils.arrayToString(EXCLUDED_RESOURCES));
-		
-		store.setDefault(SigilCore.PREFERENCES_NOASK_OSGI_INSTALL, false);
-		
-		store.setDefault(SigilCore.PREFERENCES_ADD_IMPORT_FOR_EXPORT, PromptablePreference.Prompt.name());
-		
-		store.setDefault(SigilCore.PREFERENCES_REBUILD_PROJECTS, PromptablePreference.Prompt.name() );
-		
-		store.setDefault(RepositoryConfiguration.REPOSITORY_DEFAULT_SET, "org.cauldron.sigil.core.workspaceprovider" );
-	}
+
+public class SigilPreferencesInitializer extends AbstractPreferenceInitializer
+{
+
+    public static final String[] EXCLUDED_RESOURCES = new String[]
+        { ".project", ".classpath", ".settings" };
+
+
+    @Override
+    public void initializeDefaultPreferences()
+    {
+        IPreferenceStore store = SigilCore.getDefault().getPreferenceStore();
+
+        store.setDefault( SigilCore.OSGI_INSTALL_CHECK_PREFERENCE, true );
+
+        store.setDefault( SigilCore.DEFAULT_VERSION_LOWER_BOUND, VersionRangeBoundingRule.Micro.name() );
+        store.setDefault( SigilCore.DEFAULT_VERSION_UPPER_BOUND, VersionRangeBoundingRule.Any.name() );
+
+        store.setDefault( SigilCore.DEFAULT_EXCLUDED_RESOURCES, PrefsUtils.arrayToString( EXCLUDED_RESOURCES ) );
+
+        store.setDefault( SigilCore.PREFERENCES_NOASK_OSGI_INSTALL, false );
+
+        store.setDefault( SigilCore.PREFERENCES_ADD_IMPORT_FOR_EXPORT, PromptablePreference.Prompt.name() );
+
+        store.setDefault( SigilCore.PREFERENCES_REBUILD_PROJECTS, PromptablePreference.Prompt.name() );
+
+        store.setDefault( RepositoryConfiguration.REPOSITORY_DEFAULT_SET, "org.cauldron.sigil.core.workspaceprovider" );
+    }
 }

Modified: felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/property/SigilPropertyTester.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/property/SigilPropertyTester.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/property/SigilPropertyTester.java (original)
+++ felix/trunk/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/property/SigilPropertyTester.java Tue Jul 21 18:51:33 2009
@@ -19,36 +19,47 @@
 
 package org.apache.felix.sigil.eclipse.property;
 
+
 import org.apache.felix.sigil.eclipse.SigilCore;
 import org.eclipse.core.expressions.PropertyTester;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 
-public class SigilPropertyTester extends PropertyTester {
 
-	public SigilPropertyTester() {
-	}
+public class SigilPropertyTester extends PropertyTester
+{
 
-	public boolean test( Object receiver, String property, Object[] args, Object expectedValue ) {
-		IResource resource = (IResource) receiver;
-		if ( "isSigilProject".equals( property ) ) {
-			return expectedValue.equals( isSigilProjectLikeResource( resource ) );
-		}
-		return false;
-	}
-
-	/**
-	 * @param resource
-	 * @return
-	 */
-	private static boolean isSigilProjectLikeResource(IResource resource) {
-		if ( resource instanceof IProject ) {
-			IProject p = (IProject) resource;
-			return SigilCore.isSigilProject(p);
-		}
-		else {
-			return resource.getName().equals( SigilCore.SIGIL_PROJECT_FILE );
-		}
-	}
+    public SigilPropertyTester()
+    {
+    }
+
+
+    public boolean test( Object receiver, String property, Object[] args, Object expectedValue )
+    {
+        IResource resource = ( IResource ) receiver;
+        if ( "isSigilProject".equals( property ) )
+        {
+            return expectedValue.equals( isSigilProjectLikeResource( resource ) );
+        }
+        return false;
+    }
+
+
+    /**
+     * @param resource
+     * @return
+     */
+    private static boolean isSigilProjectLikeResource( IResource resource )
+    {
+        if ( resource instanceof IProject )
+        {
+            IProject p = ( IProject ) resource;
+            return SigilCore.isSigilProject( p );
+        }
+        else
+        {
+            return resource.getName().equals( SigilCore.SIGIL_PROJECT_FILE );
+        }
+    }
 
 }

Modified: felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/AbstractNewWizardAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/AbstractNewWizardAction.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/AbstractNewWizardAction.java (original)
+++ felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/AbstractNewWizardAction.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.eclipse.cheatsheets.actions;
 
+
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.viewers.ISelection;
@@ -31,36 +32,45 @@
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
 
-public abstract class AbstractNewWizardAction extends Action {
 
-	@Override
-	public void run() {
-		Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
-		
-		try {
-			INewWizard wizard = createWizard();
-			wizard.init(PlatformUI.getWorkbench(), getSelection());
-			WizardDialog dialog = new WizardDialog(shell, wizard);
-			int res = dialog.open();
-			notifyResult(res == Window.OK);
-		} catch (CoreException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}		
-	}
-	
-	protected abstract INewWizard createWizard() throws CoreException;
-
-	private IStructuredSelection getSelection() {
-		IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-		if (window != null)
-		{
-			ISelection selection = window.getSelectionService().getSelection();
-			if (selection instanceof IStructuredSelection)
-			{
-				return (IStructuredSelection)selection;
-			}
-		}
-		return StructuredSelection.EMPTY;
-	}
+public abstract class AbstractNewWizardAction extends Action
+{
+
+    @Override
+    public void run()
+    {
+        Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+
+        try
+        {
+            INewWizard wizard = createWizard();
+            wizard.init( PlatformUI.getWorkbench(), getSelection() );
+            WizardDialog dialog = new WizardDialog( shell, wizard );
+            int res = dialog.open();
+            notifyResult( res == Window.OK );
+        }
+        catch ( CoreException e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+
+    protected abstract INewWizard createWizard() throws CoreException;
+
+
+    private IStructuredSelection getSelection()
+    {
+        IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+        if ( window != null )
+        {
+            ISelection selection = window.getSelectionService().getSelection();
+            if ( selection instanceof IStructuredSelection )
+            {
+                return ( IStructuredSelection ) selection;
+            }
+        }
+        return StructuredSelection.EMPTY;
+    }
 }
\ No newline at end of file

Modified: felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/CopyResourceFromPlugin.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/CopyResourceFromPlugin.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/CopyResourceFromPlugin.java (original)
+++ felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/CopyResourceFromPlugin.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.eclipse.cheatsheets.actions;
 
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.lang.reflect.InvocationTargetException;
@@ -46,71 +47,92 @@
 import org.eclipse.ui.part.FileEditorInput;
 import org.osgi.framework.Bundle;
 
-public class CopyResourceFromPlugin extends Action implements ICheatSheetAction {
 
-	private String targetProject;
-	private String targetFolder;
-	private String sourceBundle;
-	private String sourcePath;
-	private String editorID;
-	
-	public void run(String[] params, ICheatSheetManager manager) {
-		if ( params != null && params.length > 4 )  {
-			targetProject = params[0];
-			targetFolder = params[1];
-			sourceBundle= params[2];
-			sourcePath = params[3];
-			editorID = params[4];
-		}
-		
-		WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
-			@Override
-			protected void execute(IProgressMonitor monitor) throws CoreException {
-				try {
-					Bundle b = Platform.getBundle(sourceBundle);
-					
-				    IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
-				    IProject project = workspaceRoot.getProject(targetProject);
-				    IPath path = new Path( targetFolder ).append( sourcePath.substring( sourcePath.lastIndexOf( '/' ) ) );
-					IFile file = project.getFile( path );
-					
-					if ( !file.exists() ) {
-						mkdirs( (IFolder) file.getParent(), monitor );
-						
-						InputStream in = FileLocator.openStream(b, new Path(sourcePath), false);
-						file.create(in, true, monitor);
-					}
-					
-					IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-					FileEditorInput input = new FileEditorInput(file); 
-					window.getActivePage().openEditor(input, editorID);
-				} catch (IOException e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-				}
-			}
-		};
-		
-		try {
-			new ProgressMonitorDialog(Display.getCurrent().getActiveShell()).run(false, false, op);
-		} catch (InvocationTargetException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		} catch (InterruptedException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-
-	private void mkdirs(IFolder folder, IProgressMonitor monitor) throws CoreException {
-		IContainer parent = folder.getParent();
-		if ( !parent.exists() ) {
-			mkdirs((IFolder) parent, monitor);			
-		}
-		
-		if ( !folder.exists() ) {
-			folder.create(true, true, monitor);
-		}
-		
-	}		
+public class CopyResourceFromPlugin extends Action implements ICheatSheetAction
+{
+
+    private String targetProject;
+    private String targetFolder;
+    private String sourceBundle;
+    private String sourcePath;
+    private String editorID;
+
+
+    public void run( String[] params, ICheatSheetManager manager )
+    {
+        if ( params != null && params.length > 4 )
+        {
+            targetProject = params[0];
+            targetFolder = params[1];
+            sourceBundle = params[2];
+            sourcePath = params[3];
+            editorID = params[4];
+        }
+
+        WorkspaceModifyOperation op = new WorkspaceModifyOperation()
+        {
+            @Override
+            protected void execute( IProgressMonitor monitor ) throws CoreException
+            {
+                try
+                {
+                    Bundle b = Platform.getBundle( sourceBundle );
+
+                    IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+                    IProject project = workspaceRoot.getProject( targetProject );
+                    IPath path = new Path( targetFolder )
+                        .append( sourcePath.substring( sourcePath.lastIndexOf( '/' ) ) );
+                    IFile file = project.getFile( path );
+
+                    if ( !file.exists() )
+                    {
+                        mkdirs( ( IFolder ) file.getParent(), monitor );
+
+                        InputStream in = FileLocator.openStream( b, new Path( sourcePath ), false );
+                        file.create( in, true, monitor );
+                    }
+
+                    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+                    FileEditorInput input = new FileEditorInput( file );
+                    window.getActivePage().openEditor( input, editorID );
+                }
+                catch ( IOException e )
+                {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+            }
+        };
+
+        try
+        {
+            new ProgressMonitorDialog( Display.getCurrent().getActiveShell() ).run( false, false, op );
+        }
+        catch ( InvocationTargetException e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+        catch ( InterruptedException e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+
+    private void mkdirs( IFolder folder, IProgressMonitor monitor ) throws CoreException
+    {
+        IContainer parent = folder.getParent();
+        if ( !parent.exists() )
+        {
+            mkdirs( ( IFolder ) parent, monitor );
+        }
+
+        if ( !folder.exists() )
+        {
+            folder.create( true, true, monitor );
+        }
+
+    }
 }

Modified: felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/OpenEmptySigilProjectWizardAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/OpenEmptySigilProjectWizardAction.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/OpenEmptySigilProjectWizardAction.java (original)
+++ felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/OpenEmptySigilProjectWizardAction.java Tue Jul 21 18:51:33 2009
@@ -19,28 +19,36 @@
 
 package org.apache.felix.sigil.eclipse.cheatsheets.actions;
 
+
 import org.apache.felix.sigil.ui.eclipse.ui.wizard.project.SigilProjectWizard;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.ui.INewWizard;
 import org.eclipse.ui.cheatsheets.ICheatSheetAction;
 import org.eclipse.ui.cheatsheets.ICheatSheetManager;
 
-public class OpenEmptySigilProjectWizardAction extends AbstractNewWizardAction implements ICheatSheetAction {
 
-	private String name;
-	
-	public void run(String[] params, ICheatSheetManager manager) {
-		if ( params != null && params.length > 0 )  {
-			name = params[0];
-		}
-		
-		run();
-	}
-
-	@Override
-	protected INewWizard createWizard() throws CoreException {
-		SigilProjectWizard wizard = new SigilProjectWizard();
-		wizard.setName(name);
-		return wizard;
-	}
+public class OpenEmptySigilProjectWizardAction extends AbstractNewWizardAction implements ICheatSheetAction
+{
+
+    private String name;
+
+
+    public void run( String[] params, ICheatSheetManager manager )
+    {
+        if ( params != null && params.length > 0 )
+        {
+            name = params[0];
+        }
+
+        run();
+    }
+
+
+    @Override
+    protected INewWizard createWizard() throws CoreException
+    {
+        SigilProjectWizard wizard = new SigilProjectWizard();
+        wizard.setName( name );
+        return wizard;
+    }
 }

Modified: felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/ResolveProjectDependencies.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/ResolveProjectDependencies.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/ResolveProjectDependencies.java (original)
+++ felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/ResolveProjectDependencies.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.eclipse.cheatsheets.actions;
 
+
 import org.apache.felix.sigil.eclipse.SigilCore;
 import org.apache.felix.sigil.eclipse.model.project.ISigilProjectModel;
 import org.apache.felix.sigil.ui.eclipse.actions.ResolveProjectDependenciesAction;
@@ -30,24 +31,32 @@
 import org.eclipse.ui.cheatsheets.ICheatSheetAction;
 import org.eclipse.ui.cheatsheets.ICheatSheetManager;
 
-public class ResolveProjectDependencies extends Action implements ICheatSheetAction {
 
-	private String targetProject;
-	
-	public void run(String[] params, ICheatSheetManager manager) {
-		if ( params != null && params.length > 3 )  {
-			targetProject = params[0];
-		}
-
-	    IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
-	    IProject project = workspaceRoot.getProject(targetProject);
-	    
-	    try {
-			ISigilProjectModel sigil = SigilCore.create(project);
-			new ResolveProjectDependenciesAction(sigil, false).run();
-		} catch (CoreException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
+public class ResolveProjectDependencies extends Action implements ICheatSheetAction
+{
+
+    private String targetProject;
+
+
+    public void run( String[] params, ICheatSheetManager manager )
+    {
+        if ( params != null && params.length > 3 )
+        {
+            targetProject = params[0];
+        }
+
+        IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+        IProject project = workspaceRoot.getProject( targetProject );
+
+        try
+        {
+            ISigilProjectModel sigil = SigilCore.create( project );
+            new ResolveProjectDependenciesAction( sigil, false ).run();
+        }
+        catch ( CoreException e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
 }

Modified: felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/ShowViewAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/ShowViewAction.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/ShowViewAction.java (original)
+++ felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/cheatsheets/actions/ShowViewAction.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.eclipse.cheatsheets.actions;
 
+
 import org.apache.felix.sigil.eclipse.SigilCore;
 import org.eclipse.jface.action.Action;
 import org.eclipse.ui.IWorkbenchPage;
@@ -28,18 +29,25 @@
 import org.eclipse.ui.cheatsheets.ICheatSheetAction;
 import org.eclipse.ui.cheatsheets.ICheatSheetManager;
 
-public class ShowViewAction extends Action implements ICheatSheetAction {
 
-	public void run(String[] params, ICheatSheetManager manager) {
-		if ( params != null && params.length > 0 )  {
-			IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-			IWorkbenchPage page = window.getActivePage();
-			try {
-				page.showView(params[0]);
-			} catch (PartInitException e) {
-				SigilCore.error( "Failed to show view", e);
-			}
-		}
+public class ShowViewAction extends Action implements ICheatSheetAction
+{
+
+    public void run( String[] params, ICheatSheetManager manager )
+    {
+        if ( params != null && params.length > 0 )
+        {
+            IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+            IWorkbenchPage page = window.getActivePage();
+            try
+            {
+                page.showView( params[0] );
+            }
+            catch ( PartInitException e )
+            {
+                SigilCore.error( "Failed to show view", e );
+            }
+        }
 
-	}
+    }
 }

Modified: felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/help/Activator.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/help/Activator.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/help/Activator.java (original)
+++ felix/trunk/sigil/eclipse/help/src/org/apache/felix/sigil/eclipse/help/Activator.java Tue Jul 21 18:51:33 2009
@@ -19,51 +19,62 @@
 
 package org.apache.felix.sigil.eclipse.help;
 
+
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 
+
 /**
  * The activator class controls the plug-in life cycle
  */
-public class Activator extends AbstractUIPlugin {
+public class Activator extends AbstractUIPlugin
+{
+
+    // The plug-in ID
+    public static final String PLUGIN_ID = "org.cauldron.sigil.help";
+
+    // The shared instance
+    private static Activator plugin;
 
-	// The plug-in ID
-	public static final String PLUGIN_ID = "org.cauldron.sigil.help";
 
-	// The shared instance
-	private static Activator plugin;
-	
-	/**
-	 * The constructor
-	 */
-	public Activator() {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
-	 */
-	public void start(BundleContext context) throws Exception {
-		super.start(context);
-		plugin = this;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
-	 */
-	public void stop(BundleContext context) throws Exception {
-		plugin = null;
-		super.stop(context);
-	}
-
-	/**
-	 * Returns the shared instance
-	 *
-	 * @return the shared instance
-	 */
-	public static Activator getDefault() {
-		return plugin;
-	}
+    /**
+     * The constructor
+     */
+    public Activator()
+    {
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+     */
+    public void start( BundleContext context ) throws Exception
+    {
+        super.start( context );
+        plugin = this;
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+     */
+    public void stop( BundleContext context ) throws Exception
+    {
+        plugin = null;
+        super.stop( context );
+    }
+
+
+    /**
+     * Returns the shared instance
+     *
+     * @return the shared instance
+     */
+    public static Activator getDefault()
+    {
+        return plugin;
+    }
 
 }

Modified: felix/trunk/sigil/eclipse/obr/src/org/apache/felix/sigil/obr/eclipse/Activator.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/obr/src/org/apache/felix/sigil/obr/eclipse/Activator.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/obr/src/org/apache/felix/sigil/obr/eclipse/Activator.java (original)
+++ felix/trunk/sigil/eclipse/obr/src/org/apache/felix/sigil/obr/eclipse/Activator.java Tue Jul 21 18:51:33 2009
@@ -19,51 +19,62 @@
 
 package org.apache.felix.sigil.obr.eclipse;
 
+
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 
+
 /**
  * The activator class controls the plug-in life cycle
  */
-public class Activator extends AbstractUIPlugin {
+public class Activator extends AbstractUIPlugin
+{
+
+    // The plug-in ID
+    public static final String PLUGIN_ID = "org.cauldron.sigil.obr";
+
+    // The shared instance
+    private static Activator plugin;
 
-	// The plug-in ID
-	public static final String PLUGIN_ID = "org.cauldron.sigil.obr";
 
-	// The shared instance
-	private static Activator plugin;
-	
-	/**
-	 * The constructor
-	 */
-	public Activator() {
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
-	 */
-	public void start(BundleContext context) throws Exception {
-		super.start(context);
-		plugin = this;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
-	 */
-	public void stop(BundleContext context) throws Exception {
-		plugin = null;
-		super.stop(context);
-	}
-
-	/**
-	 * Returns the shared instance
-	 *
-	 * @return the shared instance
-	 */
-	public static Activator getDefault() {
-		return plugin;
-	}
+    /**
+     * The constructor
+     */
+    public Activator()
+    {
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+     */
+    public void start( BundleContext context ) throws Exception
+    {
+        super.start( context );
+        plugin = this;
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+     */
+    public void stop( BundleContext context ) throws Exception
+    {
+        plugin = null;
+        super.stop( context );
+    }
+
+
+    /**
+     * Returns the shared instance
+     *
+     * @return the shared instance
+     */
+    public static Activator getDefault()
+    {
+        return plugin;
+    }
 
 }

Modified: felix/trunk/sigil/eclipse/obr/src/org/apache/felix/sigil/obr/eclipse/OBRRepositoryWizard.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/obr/src/org/apache/felix/sigil/obr/eclipse/OBRRepositoryWizard.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/obr/src/org/apache/felix/sigil/obr/eclipse/OBRRepositoryWizard.java (original)
+++ felix/trunk/sigil/eclipse/obr/src/org/apache/felix/sigil/obr/eclipse/OBRRepositoryWizard.java Tue Jul 21 18:51:33 2009
@@ -19,12 +19,16 @@
 
 package org.apache.felix.sigil.obr.eclipse;
 
+
 import org.apache.felix.sigil.ui.eclipse.ui.wizard.repository.RepositoryWizard;
 
-public class OBRRepositoryWizard extends RepositoryWizard {
-	
-	@Override
-	public void addPages() {
-		addPage( new OBRRepositoryWizardPage(this) );
-	}
+
+public class OBRRepositoryWizard extends RepositoryWizard
+{
+
+    @Override
+    public void addPages()
+    {
+        addPage( new OBRRepositoryWizardPage( this ) );
+    }
 }

Modified: felix/trunk/sigil/eclipse/obr/src/org/apache/felix/sigil/obr/eclipse/OBRRepositoryWizardPage.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/obr/src/org/apache/felix/sigil/obr/eclipse/OBRRepositoryWizardPage.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/obr/src/org/apache/felix/sigil/obr/eclipse/OBRRepositoryWizardPage.java (original)
+++ felix/trunk/sigil/eclipse/obr/src/org/apache/felix/sigil/obr/eclipse/OBRRepositoryWizardPage.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.obr.eclipse;
 
+
 import java.io.File;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -33,79 +34,105 @@
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
 
-public class OBRRepositoryWizardPage extends RepositoryWizardPage implements IWizardPage {
 
-	private StringFieldEditor urlEditor;
-	private StringFieldEditor cacheEditor;
+public class OBRRepositoryWizardPage extends RepositoryWizardPage implements IWizardPage
+{
+
+    private StringFieldEditor urlEditor;
+    private StringFieldEditor cacheEditor;
+
+
+    protected OBRRepositoryWizardPage( RepositoryWizard parent )
+    {
+        super( "OSGi Bundle Repository", parent );
+    }
+
+
+    @Override
+    public void createFieldEditors()
+    {
+        createField( urlEditor = new StringFieldEditor( "url", "URL:", getFieldEditorParent() ) );
+        createField( cacheEditor = new DirectoryFieldEditor( "cache", "Cache:", getFieldEditorParent() ) );
+        addField( new BooleanFieldEditor( "inmemory", "In Memory:", getFieldEditorParent() ) );
+    }
+
+
+    private void createField( StringFieldEditor editor )
+    {
+        editor.getTextControl( getFieldEditorParent() ).addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                checkPageComplete();
+            }
+        } );
+        addField( editor );
+    }
+
+
+    @Override
+    protected void checkPageComplete()
+    {
+        super.checkPageComplete();
+        if ( isPageComplete() && checkURLComplete() )
+        {
+            checkCacheComplete();
+        }
+    }
+
+
+    private boolean checkCacheComplete()
+    {
+        setPageComplete( cacheEditor.getStringValue().length() > 0 );
+
+        if ( isPageComplete() )
+        {
+            if ( new File( cacheEditor.getStringValue() ).isDirectory() )
+            {
+                setErrorMessage( null );
+            }
+            else
+            {
+                setErrorMessage( "Invalid cache directory" );
+                setPageComplete( false );
+            }
+        }
+
+        return isPageComplete();
+    }
+
+
+    private boolean checkURLComplete()
+    {
+        setPageComplete( urlEditor.getStringValue().length() > 0 );
+
+        if ( isPageComplete() )
+        {
+            try
+            {
+                new URL( urlEditor.getStringValue() );
+                setErrorMessage( null );
+            }
+            catch ( MalformedURLException e )
+            {
+                if ( !new File( urlEditor.getStringValue() ).isFile() )
+                {
+                    setErrorMessage( "Invalid repository url: " + e.getMessage() );
+                    setPageComplete( false );
+                }
+            }
+        }
+
+        return isPageComplete();
+    }
+
+
+    @Override
+    public void storeFields()
+    {
+        super.storeFields();
+        IPath dir = Activator.getDefault().getStateLocation();
+        getModel().getPreferences().setValue( "index", dir.append( getModel().getId() + ".obr" ).toOSString() );
+    }
 
-	protected OBRRepositoryWizardPage(RepositoryWizard parent) {
-		super("OSGi Bundle Repository", parent);
-	}
-
-	@Override
-	public void createFieldEditors() {
-		createField( urlEditor = new StringFieldEditor("url", "URL:", getFieldEditorParent()) );
-		createField( cacheEditor = new DirectoryFieldEditor("cache", "Cache:", getFieldEditorParent()) );
-		addField( new BooleanFieldEditor( "inmemory", "In Memory:", getFieldEditorParent() ));
-	}
-
-	private void createField(StringFieldEditor editor) {
-		editor.getTextControl(getFieldEditorParent()).addModifyListener( new ModifyListener() {
-			public void modifyText(ModifyEvent e) {
-				checkPageComplete();
-			}
-		});
-		addField(editor);
-	}
-
-	@Override
-	protected void checkPageComplete() {
-		super.checkPageComplete();
-		if ( isPageComplete() && checkURLComplete() ) {
-			checkCacheComplete();
-		}
-	}
-
-	private boolean checkCacheComplete() {
-		setPageComplete(cacheEditor.getStringValue().length() > 0);
-		
-		if ( isPageComplete() ) {
-			if ( new File( cacheEditor.getStringValue() ).isDirectory() ) {
-				setErrorMessage(null);				
-			}
-			else {
-				setErrorMessage("Invalid cache directory");
-				setPageComplete(false);
-			}
-		}
-		
-		return isPageComplete();
-	}
-
-	private boolean checkURLComplete() {
-		setPageComplete(urlEditor.getStringValue().length() > 0);
-		
-		if ( isPageComplete() ) {
-			try {
-				new URL(urlEditor.getStringValue());
-				setErrorMessage(null);
-			}
-			catch (MalformedURLException e) {
-				if ( !new File(urlEditor.getStringValue()).isFile() ) {
-					setErrorMessage("Invalid repository url: " + e.getMessage());
-					setPageComplete(false);
-				}
-			}
-		}
-		
-		return isPageComplete();
-	}
-
-	@Override
-	public void storeFields() {
-		super.storeFields();
-		IPath dir = Activator.getDefault().getStateLocation();
-		getModel().getPreferences().setValue( "index", dir.append( getModel().getId() + ".obr" ).toOSString() );
-	}
-	
 }

Modified: felix/trunk/sigil/eclipse/search/src/org/apache/felix/sigil/search/ISearchResult.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/search/src/org/apache/felix/sigil/search/ISearchResult.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/search/src/org/apache/felix/sigil/search/ISearchResult.java (original)
+++ felix/trunk/sigil/eclipse/search/src/org/apache/felix/sigil/search/ISearchResult.java Tue Jul 21 18:51:33 2009
@@ -19,12 +19,21 @@
 
 package org.apache.felix.sigil.search;
 
+
 import org.apache.felix.sigil.model.eclipse.ISigilBundle;
 import org.apache.felix.sigil.model.osgi.IPackageExport;
 
-public interface ISearchResult {
-	ISigilBundle getProvider();
-	IPackageExport getExport();
-	String getPackageName();
-	String getClassName();
+
+public interface ISearchResult
+{
+    ISigilBundle getProvider();
+
+
+    IPackageExport getExport();
+
+
+    String getPackageName();
+
+
+    String getClassName();
 }

Modified: felix/trunk/sigil/eclipse/search/src/org/apache/felix/sigil/search/SigilSearch.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/search/src/org/apache/felix/sigil/search/SigilSearch.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/search/src/org/apache/felix/sigil/search/SigilSearch.java (original)
+++ felix/trunk/sigil/eclipse/search/src/org/apache/felix/sigil/search/SigilSearch.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.search;
 
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Arrays;
@@ -51,193 +52,259 @@
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
 
+
 /**
  * The activator class controls the plug-in life cycle
  */
-public class SigilSearch extends AbstractUIPlugin {
+public class SigilSearch extends AbstractUIPlugin
+{
 
-	// The plug-in ID
-	public static final String PLUGIN_ID = "org.cauldron.sigil.search";
+    // The plug-in ID
+    public static final String PLUGIN_ID = "org.cauldron.sigil.search";
 
-	private static final String CLASS_EXTENSION = ".class";
+    private static final String CLASS_EXTENSION = ".class";
 
-	// The shared instance
-	private static SigilSearch plugin;
-	private static Index index;
-
-	/**
-	 * The constructor
-	 */
-	public SigilSearch() {
-	}
-	
-	public static List<ISearchResult> findProviders(String fullyQualifiedName, ISigilProjectModel sigil, IProgressMonitor monitor) {
-		listen(sigil);
-		return index.findProviders(fullyQualifiedName, monitor);
-	}
-	
-	public static List<ISearchResult> findProviders(Pattern namePattern, ISigilProjectModel sigil, IProgressMonitor monitor) {
-		listen(sigil);
-		return index.findProviders(namePattern, monitor);
-	}
-	
-	/*
-	 * (non-Javadoc)
-	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
-	 */
-	public void start(BundleContext context) throws Exception {
-		super.start(context);
-		plugin = this;
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
-	 */
-	public void stop(BundleContext context) throws Exception {
-		plugin = null;
-		super.stop(context);
-	}
-
-	/**
-	 * Returns the shared instance
-	 *
-	 * @return the shared instance
-	 */
-	public static SigilSearch getDefault() {
-		return plugin;
-	}
-	
-	private static void listen(ISigilProjectModel sigil) {
-		synchronized(plugin) {
-			if ( index == null ) {
-				index = new Index();
-				for ( IBundleRepository rep : SigilCore.getRepositoryManager(sigil).getRepositories() ) {
-					index(index, rep);
-				}
-				
-				SigilCore.getRepositoryManager(sigil).addRepositoryChangeListener( new IRepositoryChangeListener() {
-					public void repositoryChanged(RepositoryChangeEvent event) {
-						index(index, event.getRepository());
-					}					
-				});
-			}
-		}
-	}
-
-	private static void index(final Index index, final IBundleRepository rep) {
-		index.delete(rep);
-		rep.accept( new IRepositoryVisitor() {
-			public boolean visit(ISigilBundle bundle) {
-				ISigilProjectModel p = bundle.getAncestor(ISigilProjectModel.class);
-				if ( p == null ) {
-					if ( bundle.isSynchronized() ) {
-						IPath loc = bundle.getLocation();
-						if ( loc.isAbsolute() ) {
-							indexJar(rep, bundle, loc);
-						}
-					}
-				}
-				else {
-					indexProject(rep, p);
-				}
-				return true;
-			}					
-		});
-	}
-	
-	private static void indexProject(IBundleRepository rep, ISigilProjectModel sigil) {
-		try {
-			for (ICompilationUnit unit : JavaHelper.findCompilationUnits(sigil) ) {
-				IPackageFragment p = (IPackageFragment) unit.getParent();
-				ISigilBundle b = sigil.getBundle();
-				IPackageExport export = b.findExport(p.getElementName());
-				index.addEntry(unit, rep, b, export != null);
-			}
-		} catch (JavaModelException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
-
-	private static void indexJar(IBundleRepository rep, ISigilBundle bundle, IPath loc) {
-		JarFile jar = null;
-		try {
-			jar = new JarFile(loc.toOSString());
-			for (Map.Entry<JarEntry, IPackageExport> export : findExportedClasses(bundle, jar).entrySet() ) {
-				JarEntry entry = export.getKey();
-				InputStream in = null;
-				try {
-					in = jar.getInputStream(entry);
-					ClassParser parser = new ClassParser(in, entry.getName());
-					JavaClass c = parser.parse();
-					index.addEntry(c, rep, bundle, true);
-				}
-				finally {
-					if ( in != null ) {
-						in.close();
-					}
-				}
-			}
-		}
-		catch (IOException e) {
-			SigilCore.error( "Failed to read jar " + loc, e );
-		}
-		finally {
-			if ( jar != null ) {
-				try {
-					jar.close();
-				} catch (IOException e) {
-					SigilCore.error( "Failed to close jar " + loc, e );
-				}
-			}
-		}
-	}
-
-	private static Map<JarEntry, IPackageExport> findExportedClasses(ISigilBundle bundle, JarFile jar) {
-		HashMap<JarEntry, IPackageExport> found = new HashMap<JarEntry, IPackageExport>();
-		
-		IPackageExport[] exports = bundle.getBundleInfo().childrenOfType(IPackageExport.class);
-		if ( exports.length > 0 ) {
-			Arrays.sort(exports, new Comparator<IPackageExport> () {
-				public int compare(IPackageExport o1, IPackageExport o2) {
-					return -1 * o1.compareTo(o2);
-				}				
-			});
-			for (Enumeration<JarEntry> e = jar.entries(); e.hasMoreElements();) {
-				JarEntry entry = e.nextElement();
-				String className = toClassName(entry);
-				if ( className != null ) {
-					IPackageExport ex = findExport(className, exports);
-					
-					if ( found != null ) {
-						found.put( entry, ex );
-					}
-				}
-			}
-		}
-		
-		return found;
-	}
-
-	private static IPackageExport findExport(String className, IPackageExport[] exports) {
-		for ( IPackageExport e : exports ) {
-			if ( className.startsWith(e.getPackageName())) {
-				return e;
-			}
-		}
-		return null;
-	}
-
-	private static String toClassName(JarEntry entry) {
-		String name = entry.getName();
-		if ( name.endsWith(CLASS_EXTENSION) ) {
-			name = name.substring(0, name.length() - CLASS_EXTENSION.length());
-			name = name.replace('/', '.');
-			return name;
-		}
-		else {
-			return null;
-		}
-	}
+    // The shared instance
+    private static SigilSearch plugin;
+    private static Index index;
+
+
+    /**
+     * The constructor
+     */
+    public SigilSearch()
+    {
+    }
+
+
+    public static List<ISearchResult> findProviders( String fullyQualifiedName, ISigilProjectModel sigil,
+        IProgressMonitor monitor )
+    {
+        listen( sigil );
+        return index.findProviders( fullyQualifiedName, monitor );
+    }
+
+
+    public static List<ISearchResult> findProviders( Pattern namePattern, ISigilProjectModel sigil,
+        IProgressMonitor monitor )
+    {
+        listen( sigil );
+        return index.findProviders( namePattern, monitor );
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+     */
+    public void start( BundleContext context ) throws Exception
+    {
+        super.start( context );
+        plugin = this;
+    }
+
+
+    /*
+     * (non-Javadoc)
+     * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+     */
+    public void stop( BundleContext context ) throws Exception
+    {
+        plugin = null;
+        super.stop( context );
+    }
+
+
+    /**
+     * Returns the shared instance
+     *
+     * @return the shared instance
+     */
+    public static SigilSearch getDefault()
+    {
+        return plugin;
+    }
+
+
+    private static void listen( ISigilProjectModel sigil )
+    {
+        synchronized ( plugin )
+        {
+            if ( index == null )
+            {
+                index = new Index();
+                for ( IBundleRepository rep : SigilCore.getRepositoryManager( sigil ).getRepositories() )
+                {
+                    index( index, rep );
+                }
+
+                SigilCore.getRepositoryManager( sigil ).addRepositoryChangeListener( new IRepositoryChangeListener()
+                {
+                    public void repositoryChanged( RepositoryChangeEvent event )
+                    {
+                        index( index, event.getRepository() );
+                    }
+                } );
+            }
+        }
+    }
+
+
+    private static void index( final Index index, final IBundleRepository rep )
+    {
+        index.delete( rep );
+        rep.accept( new IRepositoryVisitor()
+        {
+            public boolean visit( ISigilBundle bundle )
+            {
+                ISigilProjectModel p = bundle.getAncestor( ISigilProjectModel.class );
+                if ( p == null )
+                {
+                    if ( bundle.isSynchronized() )
+                    {
+                        IPath loc = bundle.getLocation();
+                        if ( loc.isAbsolute() )
+                        {
+                            indexJar( rep, bundle, loc );
+                        }
+                    }
+                }
+                else
+                {
+                    indexProject( rep, p );
+                }
+                return true;
+            }
+        } );
+    }
+
+
+    private static void indexProject( IBundleRepository rep, ISigilProjectModel sigil )
+    {
+        try
+        {
+            for ( ICompilationUnit unit : JavaHelper.findCompilationUnits( sigil ) )
+            {
+                IPackageFragment p = ( IPackageFragment ) unit.getParent();
+                ISigilBundle b = sigil.getBundle();
+                IPackageExport export = b.findExport( p.getElementName() );
+                index.addEntry( unit, rep, b, export != null );
+            }
+        }
+        catch ( JavaModelException e )
+        {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
+
+
+    private static void indexJar( IBundleRepository rep, ISigilBundle bundle, IPath loc )
+    {
+        JarFile jar = null;
+        try
+        {
+            jar = new JarFile( loc.toOSString() );
+            for ( Map.Entry<JarEntry, IPackageExport> export : findExportedClasses( bundle, jar ).entrySet() )
+            {
+                JarEntry entry = export.getKey();
+                InputStream in = null;
+                try
+                {
+                    in = jar.getInputStream( entry );
+                    ClassParser parser = new ClassParser( in, entry.getName() );
+                    JavaClass c = parser.parse();
+                    index.addEntry( c, rep, bundle, true );
+                }
+                finally
+                {
+                    if ( in != null )
+                    {
+                        in.close();
+                    }
+                }
+            }
+        }
+        catch ( IOException e )
+        {
+            SigilCore.error( "Failed to read jar " + loc, e );
+        }
+        finally
+        {
+            if ( jar != null )
+            {
+                try
+                {
+                    jar.close();
+                }
+                catch ( IOException e )
+                {
+                    SigilCore.error( "Failed to close jar " + loc, e );
+                }
+            }
+        }
+    }
+
+
+    private static Map<JarEntry, IPackageExport> findExportedClasses( ISigilBundle bundle, JarFile jar )
+    {
+        HashMap<JarEntry, IPackageExport> found = new HashMap<JarEntry, IPackageExport>();
+
+        IPackageExport[] exports = bundle.getBundleInfo().childrenOfType( IPackageExport.class );
+        if ( exports.length > 0 )
+        {
+            Arrays.sort( exports, new Comparator<IPackageExport>()
+            {
+                public int compare( IPackageExport o1, IPackageExport o2 )
+                {
+                    return -1 * o1.compareTo( o2 );
+                }
+            } );
+            for ( Enumeration<JarEntry> e = jar.entries(); e.hasMoreElements(); )
+            {
+                JarEntry entry = e.nextElement();
+                String className = toClassName( entry );
+                if ( className != null )
+                {
+                    IPackageExport ex = findExport( className, exports );
+
+                    if ( found != null )
+                    {
+                        found.put( entry, ex );
+                    }
+                }
+            }
+        }
+
+        return found;
+    }
+
+
+    private static IPackageExport findExport( String className, IPackageExport[] exports )
+    {
+        for ( IPackageExport e : exports )
+        {
+            if ( className.startsWith( e.getPackageName() ) )
+            {
+                return e;
+            }
+        }
+        return null;
+    }
+
+
+    private static String toClassName( JarEntry entry )
+    {
+        String name = entry.getName();
+        if ( name.endsWith( CLASS_EXTENSION ) )
+        {
+            name = name.substring( 0, name.length() - CLASS_EXTENSION.length() );
+            name = name.replace( '/', '.' );
+            return name;
+        }
+        else
+        {
+            return null;
+        }
+    }
 }

Modified: felix/trunk/sigil/eclipse/search/src/org/apache/felix/sigil/search/index/Index.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/search/src/org/apache/felix/sigil/search/index/Index.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/search/src/org/apache/felix/sigil/search/index/Index.java (original)
+++ felix/trunk/sigil/eclipse/search/src/org/apache/felix/sigil/search/index/Index.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.search.index;
 
+
 import java.lang.ref.SoftReference;
 import java.util.Collections;
 import java.util.HashMap;
@@ -44,190 +45,248 @@
 import org.eclipse.jdt.core.IPackageFragment;
 import org.osgi.framework.Version;
 
-public class Index {
-	private HashMap<String, ClassData> primary = new HashMap<String, ClassData>();
-	private HashMap<IBundleRepository, HashSet<String>> secondary = new HashMap<IBundleRepository, HashSet<String>>();
-	
-	private final ReadWriteLock lock = new ReentrantReadWriteLock();
-	
-	static class ClassData {
-		HashMap<IBundleRepository, Set<ISearchResult>> provided = new HashMap<IBundleRepository, Set<ISearchResult>>();
-
-		void add(IBundleRepository rep, ISearchResult export) {
-			Set<ISearchResult> exports = provided.get(rep);
-			
-			if ( exports == null ) {
-				exports = new HashSet<ISearchResult>();
-				provided.put( rep, exports );
-			}
-			
-			exports.add(export);
-		}
-
-		List<ISearchResult> getResults() {
-			LinkedList<ISearchResult> exports = new LinkedList<ISearchResult>();
-			for ( Set<ISearchResult> p : provided.values() ) {
-				exports.addAll(p);
-			}
-			return exports;
-		}
-
-		void remove(IBundleRepository rep) {
-			provided.remove(rep);
-		}
-		
-		boolean isEmpty() {
-			return provided.isEmpty();
-		}
-	}
-	
-	static class SearchResult implements ISearchResult {
-		private final String className;
-		private final String packageName;
-		private final IBundleRepository rep;
-		private final String bundleSymbolicName;
-		private final Version version;
-		private final boolean exported;
-		
-		private SoftReference<ISigilBundle> bundleReference;
-		private SoftReference<IPackageExport> exportReference;
-		
-		public SearchResult(String className, IBundleRepository rep, ISigilBundle bundle, String packageName, boolean exported) {
-			this.className = className;
-			this.rep = rep;
-			this.exported = exported;
-			this.bundleSymbolicName = bundle.getBundleInfo().getSymbolicName();
-			this.version = bundle.getVersion();
-			this.packageName = packageName;
-		}
-
-		public String getClassName() {
-			return className;
-		}
-		
-		public String getPackageName() {
-			return packageName;
-		}
-
-		public IPackageExport getExport() {
-			IPackageExport ipe = null;
-			if ( exported ) {
-				ipe = exportReference == null ? null : exportReference.get();
-				if (ipe == null) {
-					ipe = getProvider().findExport(packageName);
-					exportReference = new SoftReference<IPackageExport>(ipe);
-				}
-			}
-			return ipe; 
-		}
-
-		public ISigilBundle getProvider() {
-			ISigilBundle b = bundleReference == null ? null : bundleReference.get();
-			if ( b == null ) {
-				IRequiredBundle rb = ModelElementFactory.getInstance().newModelElement(IRequiredBundle.class);
-				rb.setSymbolicName(bundleSymbolicName);
-				VersionRange versions = new VersionRange(false, version, version, false);
-				rb.setVersions(versions);
-				b = rep.findProvider(rb, 0);
-				bundleReference = new SoftReference<ISigilBundle>(b);
-			}
-			return b;
-		}
-		
-	}
-
-	public void addEntry(JavaClass c, IBundleRepository rep, ISigilBundle bundle, boolean exported) {
-		addEntry(c.getClassName(), rep, bundle, c.getPackageName(), exported);
-	}
-	
-	public void addEntry(ICompilationUnit unit, IBundleRepository rep, ISigilBundle bundle, boolean exported) {
-		String name = unit.getElementName();
-		if ( name.endsWith( ".java" ) ) {
-			name = name.substring(0, name.length() - 5 );
-		}
-		IPackageFragment p = (IPackageFragment) unit.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
-		addEntry(p.getElementName() + "." + name, rep, bundle, p.getElementName(), exported);
-	}
-
-	private void addEntry(String className, IBundleRepository rep, ISigilBundle bundle, String packageName, boolean exported) {
-		List<String> keys = genKeys(className);
-		lock.writeLock().lock();
-		try {
-			for ( String key : keys ) {
-				ClassData data = primary.get(key);
-				
-				if ( data == null ) {
-					data = new ClassData();
-					primary.put(key, data);
-				}
-				
-				SearchResult result = new SearchResult(className, rep, bundle, packageName, exported);
-				data.add(rep, result);
-			}
-			
-			HashSet<String> all = secondary.get(rep);
-			if ( all == null ) {
-				all = new HashSet<String>();
-				secondary.put(rep, all);
-			}
-			all.addAll(keys);
-		}
-		finally {
-			lock.writeLock().unlock();
-		}
-	}
-
-	
-	public List<ISearchResult> findProviders(String className, IProgressMonitor monitor) {
-		lock.readLock().lock();
-		try {
-			ClassData data = primary.get(className);
-			return data == null ? Collections.<ISearchResult>emptyList() : data.getResults();
-		}
-		finally {
-			lock.readLock().unlock();
-		}
-	}	
-	
-	public List<ISearchResult> findProviders(Pattern className, IProgressMonitor monitor) {
-		lock.readLock().lock();
-		try {
-			ClassData data = primary.get(className);
-			return data == null ? Collections.<ISearchResult>emptyList() : data.getResults();
-		}
-		finally {
-			lock.readLock().unlock();
-		}
-	}
-	
-	public void delete(IBundleRepository rep) {
-		lock.writeLock().lock();
-		try {
-			Set<String> keys = secondary.remove(rep);
-			if ( keys != null ) {
-				for ( String key : keys ) {
-					ClassData data = primary.get(key);
-					data.remove(rep);
-					if ( data.isEmpty() ) {
-						primary.remove(key);
-					}
-				}
-			}
-		}
-		finally {
-			lock.writeLock().unlock();
-		}
-	}
-	
-	private List<String> genKeys(String className) {
-		LinkedList<String> keys = new LinkedList<String>();
-		keys.add(className);
-		int i = className.lastIndexOf('.');
-		if ( i != -1 ) {
-			String name = className.substring(i + 1);
-			keys.add( name );
-		}
-		return keys;
-	}
+
+public class Index
+{
+    private HashMap<String, ClassData> primary = new HashMap<String, ClassData>();
+    private HashMap<IBundleRepository, HashSet<String>> secondary = new HashMap<IBundleRepository, HashSet<String>>();
+
+    private final ReadWriteLock lock = new ReentrantReadWriteLock();
+
+    static class ClassData
+    {
+        HashMap<IBundleRepository, Set<ISearchResult>> provided = new HashMap<IBundleRepository, Set<ISearchResult>>();
+
+
+        void add( IBundleRepository rep, ISearchResult export )
+        {
+            Set<ISearchResult> exports = provided.get( rep );
+
+            if ( exports == null )
+            {
+                exports = new HashSet<ISearchResult>();
+                provided.put( rep, exports );
+            }
+
+            exports.add( export );
+        }
+
+
+        List<ISearchResult> getResults()
+        {
+            LinkedList<ISearchResult> exports = new LinkedList<ISearchResult>();
+            for ( Set<ISearchResult> p : provided.values() )
+            {
+                exports.addAll( p );
+            }
+            return exports;
+        }
+
+
+        void remove( IBundleRepository rep )
+        {
+            provided.remove( rep );
+        }
+
+
+        boolean isEmpty()
+        {
+            return provided.isEmpty();
+        }
+    }
+
+    static class SearchResult implements ISearchResult
+    {
+        private final String className;
+        private final String packageName;
+        private final IBundleRepository rep;
+        private final String bundleSymbolicName;
+        private final Version version;
+        private final boolean exported;
+
+        private SoftReference<ISigilBundle> bundleReference;
+        private SoftReference<IPackageExport> exportReference;
+
+
+        public SearchResult( String className, IBundleRepository rep, ISigilBundle bundle, String packageName,
+            boolean exported )
+        {
+            this.className = className;
+            this.rep = rep;
+            this.exported = exported;
+            this.bundleSymbolicName = bundle.getBundleInfo().getSymbolicName();
+            this.version = bundle.getVersion();
+            this.packageName = packageName;
+        }
+
+
+        public String getClassName()
+        {
+            return className;
+        }
+
+
+        public String getPackageName()
+        {
+            return packageName;
+        }
+
+
+        public IPackageExport getExport()
+        {
+            IPackageExport ipe = null;
+            if ( exported )
+            {
+                ipe = exportReference == null ? null : exportReference.get();
+                if ( ipe == null )
+                {
+                    ipe = getProvider().findExport( packageName );
+                    exportReference = new SoftReference<IPackageExport>( ipe );
+                }
+            }
+            return ipe;
+        }
+
+
+        public ISigilBundle getProvider()
+        {
+            ISigilBundle b = bundleReference == null ? null : bundleReference.get();
+            if ( b == null )
+            {
+                IRequiredBundle rb = ModelElementFactory.getInstance().newModelElement( IRequiredBundle.class );
+                rb.setSymbolicName( bundleSymbolicName );
+                VersionRange versions = new VersionRange( false, version, version, false );
+                rb.setVersions( versions );
+                b = rep.findProvider( rb, 0 );
+                bundleReference = new SoftReference<ISigilBundle>( b );
+            }
+            return b;
+        }
+
+    }
+
+
+    public void addEntry( JavaClass c, IBundleRepository rep, ISigilBundle bundle, boolean exported )
+    {
+        addEntry( c.getClassName(), rep, bundle, c.getPackageName(), exported );
+    }
+
+
+    public void addEntry( ICompilationUnit unit, IBundleRepository rep, ISigilBundle bundle, boolean exported )
+    {
+        String name = unit.getElementName();
+        if ( name.endsWith( ".java" ) )
+        {
+            name = name.substring( 0, name.length() - 5 );
+        }
+        IPackageFragment p = ( IPackageFragment ) unit.getAncestor( IJavaElement.PACKAGE_FRAGMENT );
+        addEntry( p.getElementName() + "." + name, rep, bundle, p.getElementName(), exported );
+    }
+
+
+    private void addEntry( String className, IBundleRepository rep, ISigilBundle bundle, String packageName,
+        boolean exported )
+    {
+        List<String> keys = genKeys( className );
+        lock.writeLock().lock();
+        try
+        {
+            for ( String key : keys )
+            {
+                ClassData data = primary.get( key );
+
+                if ( data == null )
+                {
+                    data = new ClassData();
+                    primary.put( key, data );
+                }
+
+                SearchResult result = new SearchResult( className, rep, bundle, packageName, exported );
+                data.add( rep, result );
+            }
+
+            HashSet<String> all = secondary.get( rep );
+            if ( all == null )
+            {
+                all = new HashSet<String>();
+                secondary.put( rep, all );
+            }
+            all.addAll( keys );
+        }
+        finally
+        {
+            lock.writeLock().unlock();
+        }
+    }
+
+
+    public List<ISearchResult> findProviders( String className, IProgressMonitor monitor )
+    {
+        lock.readLock().lock();
+        try
+        {
+            ClassData data = primary.get( className );
+            return data == null ? Collections.<ISearchResult> emptyList() : data.getResults();
+        }
+        finally
+        {
+            lock.readLock().unlock();
+        }
+    }
+
+
+    public List<ISearchResult> findProviders( Pattern className, IProgressMonitor monitor )
+    {
+        lock.readLock().lock();
+        try
+        {
+            ClassData data = primary.get( className );
+            return data == null ? Collections.<ISearchResult> emptyList() : data.getResults();
+        }
+        finally
+        {
+            lock.readLock().unlock();
+        }
+    }
+
+
+    public void delete( IBundleRepository rep )
+    {
+        lock.writeLock().lock();
+        try
+        {
+            Set<String> keys = secondary.remove( rep );
+            if ( keys != null )
+            {
+                for ( String key : keys )
+                {
+                    ClassData data = primary.get( key );
+                    data.remove( rep );
+                    if ( data.isEmpty() )
+                    {
+                        primary.remove( key );
+                    }
+                }
+            }
+        }
+        finally
+        {
+            lock.writeLock().unlock();
+        }
+    }
+
+
+    private List<String> genKeys( String className )
+    {
+        LinkedList<String> keys = new LinkedList<String>();
+        keys.add( className );
+        int i = className.lastIndexOf( '.' );
+        if ( i != -1 )
+        {
+            String name = className.substring( i + 1 );
+            keys.add( name );
+        }
+        return keys;
+    }
 
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/actions/DisplayAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/actions/DisplayAction.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/actions/DisplayAction.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/actions/DisplayAction.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.actions;
 
+
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.resource.ImageDescriptor;
@@ -26,43 +27,61 @@
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.actions.WorkspaceModifyOperation;
 
-public abstract class DisplayAction extends Action {
 
-	public DisplayAction() {
-		super();
-	}
-
-	public DisplayAction(String text) {
-		super(text);
-	}
-
-	public DisplayAction(String text, ImageDescriptor image) {
-		super(text, image);
-	}
-
-	public DisplayAction(String text, int style) {
-		super(text, style);
-	}
-
-	protected Display findDisplay() {
-		Display d = Display.getCurrent();
-		
-		if ( d == null ) {
-			d = Display.getDefault();
-		}
-		
-		return d;
-	}
-
-	protected void runInUI(final Shell shell, final WorkspaceModifyOperation op) {
-	}
-
-	protected void info(final Shell shell, final String msg) {
-		shell.getDisplay().asyncExec( new Runnable() {
-			public void run() {
-				MessageDialog.openInformation(shell, "Information", msg );
-			}
-		} );
-	}
+public abstract class DisplayAction extends Action
+{
+
+    public DisplayAction()
+    {
+        super();
+    }
+
+
+    public DisplayAction( String text )
+    {
+        super( text );
+    }
+
+
+    public DisplayAction( String text, ImageDescriptor image )
+    {
+        super( text, image );
+    }
+
+
+    public DisplayAction( String text, int style )
+    {
+        super( text, style );
+    }
+
+
+    protected Display findDisplay()
+    {
+        Display d = Display.getCurrent();
+
+        if ( d == null )
+        {
+            d = Display.getDefault();
+        }
+
+        return d;
+    }
+
+
+    protected void runInUI( final Shell shell, final WorkspaceModifyOperation op )
+    {
+    }
+
+
+    protected void info( final Shell shell, final String msg )
+    {
+        shell.getDisplay().asyncExec( new Runnable()
+        {
+            public void run()
+            {
+                MessageDialog.openInformation( shell, "Information", msg );
+            }
+        } );
+    }
 
 }
\ No newline at end of file

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/actions/PruneProjectDependenciesAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/actions/PruneProjectDependenciesAction.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/actions/PruneProjectDependenciesAction.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/actions/PruneProjectDependenciesAction.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.actions;
 
+
 import java.util.Collection;
 
 import org.apache.felix.sigil.eclipse.SigilCore;
@@ -38,59 +39,77 @@
 import org.eclipse.ui.actions.WorkspaceModifyOperation;
 import org.eclipse.ui.progress.IProgressService;
 
-public class PruneProjectDependenciesAction extends DisplayAction {
-	
-	private ISigilProjectModel project;
-	
-	public PruneProjectDependenciesAction(ISigilProjectModel project) {
-		this.project = project;
-	}
-
-	@Override
-	public void run() {
- 		final Shell shell = findDisplay().getActiveShell();
- 		
-		Job job = new Job("Resolving imports") {
-
-			@Override
-			protected IStatus run(IProgressMonitor monitor) {
-				Collection<IModelElement> unused = JavaHelper.findUnusedReferences(project, monitor);
-				
-				if ( unused.isEmpty() ) {
-					info( shell, "No unused references found" );
-				}
-				else {
-					final ResourceReviewDialog<IModelElement> dialog = new ResourceReviewDialog<IModelElement>(shell, "Review Unused Imports", unused);
-					
-					shell.getDisplay().asyncExec( new Runnable() {
-						public void run() {
-							if ( dialog.open() == Window.OK ) {
-								WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
-									@Override
-									protected void execute(IProgressMonitor monitor) throws CoreException {
-										for ( IModelElement e : dialog.getResources() ) {
-											if ( !project.getBundle().getBundleInfo().removeChild(e) ) {
-												SigilCore.error( "Failed to remove " + e );
-											}
-										}
-										
-										project.save(monitor);
-									}			
-								};
-								
-								SigilUI.runWorkspaceOperation(op, shell);
-							}
-						}
-					});
-				}
-				
-				return Status.OK_STATUS;
-			}
-		};
-		
-		job.schedule();
-		
-		IProgressService p = PlatformUI.getWorkbench().getProgressService();
-		p.showInDialog(shell, job);				
-	}	
+
+public class PruneProjectDependenciesAction extends DisplayAction
+{
+
+    private ISigilProjectModel project;
+
+
+    public PruneProjectDependenciesAction( ISigilProjectModel project )
+    {
+        this.project = project;
+    }
+
+
+    @Override
+    public void run()
+    {
+        final Shell shell = findDisplay().getActiveShell();
+
+        Job job = new Job( "Resolving imports" )
+        {
+
+            @Override
+            protected IStatus run( IProgressMonitor monitor )
+            {
+                Collection<IModelElement> unused = JavaHelper.findUnusedReferences( project, monitor );
+
+                if ( unused.isEmpty() )
+                {
+                    info( shell, "No unused references found" );
+                }
+                else
+                {
+                    final ResourceReviewDialog<IModelElement> dialog = new ResourceReviewDialog<IModelElement>( shell,
+                        "Review Unused Imports", unused );
+
+                    shell.getDisplay().asyncExec( new Runnable()
+                    {
+                        public void run()
+                        {
+                            if ( dialog.open() == Window.OK )
+                            {
+                                WorkspaceModifyOperation op = new WorkspaceModifyOperation()
+                                {
+                                    @Override
+                                    protected void execute( IProgressMonitor monitor ) throws CoreException
+                                    {
+                                        for ( IModelElement e : dialog.getResources() )
+                                        {
+                                            if ( !project.getBundle().getBundleInfo().removeChild( e ) )
+                                            {
+                                                SigilCore.error( "Failed to remove " + e );
+                                            }
+                                        }
+
+                                        project.save( monitor );
+                                    }
+                                };
+
+                                SigilUI.runWorkspaceOperation( op, shell );
+                            }
+                        }
+                    } );
+                }
+
+                return Status.OK_STATUS;
+            }
+        };
+
+        job.schedule();
+
+        IProgressService p = PlatformUI.getWorkbench().getProgressService();
+        p.showInDialog( shell, job );
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/actions/RefreshRepositoryAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/actions/RefreshRepositoryAction.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/actions/RefreshRepositoryAction.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/actions/RefreshRepositoryAction.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.actions;
 
+
 import java.lang.reflect.InvocationTargetException;
 import java.util.List;
 
@@ -32,43 +33,55 @@
 import org.eclipse.core.runtime.SubMonitor;
 import org.eclipse.ui.actions.WorkspaceModifyOperation;
 
-public class RefreshRepositoryAction extends DisplayAction {
-	private final IRepositoryModel[] model;
 
-	public RefreshRepositoryAction(IRepositoryModel... model) {
-		super( "Refresh repository");
-		this.model = model;
-	}
-	
-	@Override
-	public void run() {
-		WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
-
-			@Override
-			protected void execute(IProgressMonitor monitor)
-					throws CoreException, InvocationTargetException,
-					InterruptedException {
-				boolean changed = false;
-				
-				for ( IBundleRepository b : SigilCore.getGlobalRepositoryManager().getRepositories() ) {
-					for ( IRepositoryModel m : model ) {
-						if ( b.getId().equals( m.getId() ) ) {
-							b.refresh();
-							changed = true;
-						}
-					}
-				}
-				
-				if ( changed ) {
-					List<ISigilProjectModel> projects = SigilCore.getRoot().getProjects();
-					SubMonitor sub = SubMonitor.convert(monitor, projects.size() * 10);
-					for ( ISigilProjectModel p : projects ) {
-						p.resetClasspath(sub.newChild(10));
-					}
-				}
-			}
-		};
-		
-		SigilUI.runWorkspaceOperation(op, null);
-	}
+public class RefreshRepositoryAction extends DisplayAction
+{
+    private final IRepositoryModel[] model;
+
+
+    public RefreshRepositoryAction( IRepositoryModel... model )
+    {
+        super( "Refresh repository" );
+        this.model = model;
+    }
+
+
+    @Override
+    public void run()
+    {
+        WorkspaceModifyOperation op = new WorkspaceModifyOperation()
+        {
+
+            @Override
+            protected void execute( IProgressMonitor monitor ) throws CoreException, InvocationTargetException,
+                InterruptedException
+            {
+                boolean changed = false;
+
+                for ( IBundleRepository b : SigilCore.getGlobalRepositoryManager().getRepositories() )
+                {
+                    for ( IRepositoryModel m : model )
+                    {
+                        if ( b.getId().equals( m.getId() ) )
+                        {
+                            b.refresh();
+                            changed = true;
+                        }
+                    }
+                }
+
+                if ( changed )
+                {
+                    List<ISigilProjectModel> projects = SigilCore.getRoot().getProjects();
+                    SubMonitor sub = SubMonitor.convert( monitor, projects.size() * 10 );
+                    for ( ISigilProjectModel p : projects )
+                    {
+                        p.resetClasspath( sub.newChild( 10 ) );
+                    }
+                }
+            }
+        };
+
+        SigilUI.runWorkspaceOperation( op, null );
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/actions/ResolveProjectDependenciesAction.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/actions/ResolveProjectDependenciesAction.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/actions/ResolveProjectDependenciesAction.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/actions/ResolveProjectDependenciesAction.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.actions;
 
+
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
@@ -39,73 +40,93 @@
 import org.eclipse.ui.actions.WorkspaceModifyOperation;
 import org.eclipse.ui.progress.IProgressService;
 
-public class ResolveProjectDependenciesAction extends DisplayAction {
 
-	private ISigilProjectModel project;
-	private boolean review;
+public class ResolveProjectDependenciesAction extends DisplayAction
+{
+
+    private ISigilProjectModel project;
+    private boolean review;
+
 
-	public ResolveProjectDependenciesAction(ISigilProjectModel project, boolean review) {
-		this.project = project;
-		this.review = review;
-	}
-	
-	public void run() {
-		final Shell shell = findDisplay().getActiveShell();
-		
-		Job job = new Job("Resolving dependencies" ) {
-			@Override
-			protected IStatus run(IProgressMonitor monitor) {
-				monitor.beginTask("", IProgressMonitor.UNKNOWN);
-				
-				List<IPackageImport> imports = JavaHelper.findRequiredImports(project, monitor);
-				
-				if ( imports.isEmpty() ) {
-					info( shell, "No new dependencies found" );
-				}
-				else {
-					Collections.sort(imports, new Comparator<IPackageImport>() {
-						public int compare(IPackageImport o1, IPackageImport o2) {
-							int i = o1.getPackageName().compareTo(o2.getPackageName());
-
-							// shouldn't get more than one import for same package
-							// but may as well sort if do...
-							if ( i == 0 ) {
-								i = o1.getVersions().getFloor().compareTo(o2.getVersions().getFloor() );
-							}
-							
-							return i;
-						}
-					});
-					
-					final ResourceReviewDialog<IPackageImport> dialog = new ResourceReviewDialog<IPackageImport>(shell, "Review New Dependencies", imports);					
-					shell.getDisplay().asyncExec( new Runnable() {
-						public void run() {
-							if ( !review || dialog.open() == Window.OK ) {
-								WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
-									@Override
-									protected void execute(IProgressMonitor monitor) throws CoreException {
-										for ( IPackageImport pi : dialog.getResources() ) {
-											project.getBundle().getBundleInfo().addImport(pi);
-										}
-										
-										project.save(monitor);
-									}			
-								};
-								
-								SigilUI.runWorkspaceOperation(op, shell);
-							}
-						}
-					} );
-				}
-				
-				return Status.OK_STATUS;
-			}
-		};
-		
-		job.schedule();
-		
-		IProgressService p = PlatformUI.getWorkbench().getProgressService();
-		p.showInDialog(shell, job);
-	}
+    public ResolveProjectDependenciesAction( ISigilProjectModel project, boolean review )
+    {
+        this.project = project;
+        this.review = review;
+    }
+
+
+    public void run()
+    {
+        final Shell shell = findDisplay().getActiveShell();
+
+        Job job = new Job( "Resolving dependencies" )
+        {
+            @Override
+            protected IStatus run( IProgressMonitor monitor )
+            {
+                monitor.beginTask( "", IProgressMonitor.UNKNOWN );
+
+                List<IPackageImport> imports = JavaHelper.findRequiredImports( project, monitor );
+
+                if ( imports.isEmpty() )
+                {
+                    info( shell, "No new dependencies found" );
+                }
+                else
+                {
+                    Collections.sort( imports, new Comparator<IPackageImport>()
+                    {
+                        public int compare( IPackageImport o1, IPackageImport o2 )
+                        {
+                            int i = o1.getPackageName().compareTo( o2.getPackageName() );
+
+                            // shouldn't get more than one import for same package
+                            // but may as well sort if do...
+                            if ( i == 0 )
+                            {
+                                i = o1.getVersions().getFloor().compareTo( o2.getVersions().getFloor() );
+                            }
+
+                            return i;
+                        }
+                    } );
+
+                    final ResourceReviewDialog<IPackageImport> dialog = new ResourceReviewDialog<IPackageImport>(
+                        shell, "Review New Dependencies", imports );
+                    shell.getDisplay().asyncExec( new Runnable()
+                    {
+                        public void run()
+                        {
+                            if ( !review || dialog.open() == Window.OK )
+                            {
+                                WorkspaceModifyOperation op = new WorkspaceModifyOperation()
+                                {
+                                    @Override
+                                    protected void execute( IProgressMonitor monitor ) throws CoreException
+                                    {
+                                        for ( IPackageImport pi : dialog.getResources() )
+                                        {
+                                            project.getBundle().getBundleInfo().addImport( pi );
+                                        }
+
+                                        project.save( monitor );
+                                    }
+                                };
+
+                                SigilUI.runWorkspaceOperation( op, shell );
+                            }
+                        }
+                    } );
+                }
+
+                return Status.OK_STATUS;
+            }
+        };
+
+        job.schedule();
+
+        IProgressService p = PlatformUI.getWorkbench().getProgressService();
+        p.showInDialog( shell, job );
+    }
 
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/classpath/SigilClassPathContainer.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/classpath/SigilClassPathContainer.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/classpath/SigilClassPathContainer.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/classpath/SigilClassPathContainer.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.classpath;
 
+
 import org.apache.felix.sigil.eclipse.SigilCore;
 import org.apache.felix.sigil.eclipse.job.ThreadProgressMonitor;
 import org.apache.felix.sigil.eclipse.model.project.ISigilProjectModel;
@@ -29,67 +30,88 @@
 import org.eclipse.jdt.core.IClasspathContainer;
 import org.eclipse.jdt.core.IClasspathEntry;
 
+
 /**
  * @author dave
  *
  */
-public class SigilClassPathContainer implements IClasspathContainer {
+public class SigilClassPathContainer implements IClasspathContainer
+{
 
     private IClasspathEntry[] entries;
     private ISigilProjectModel sigil;
 
-    public SigilClassPathContainer(ISigilProjectModel sigil) {
-    	this.sigil = sigil;
-	}
 
-	/* (non-Javadoc)
+    public SigilClassPathContainer( ISigilProjectModel sigil )
+    {
+        this.sigil = sigil;
+    }
+
+
+    /* (non-Javadoc)
      * @see org.eclipse.jdt.core.IClasspathContainer#getClasspathEntries()
      */
-    public IClasspathEntry[] getClasspathEntries() {
-        if ( entries == null ) {
-        	buildClassPathEntries();
+    public IClasspathEntry[] getClasspathEntries()
+    {
+        if ( entries == null )
+        {
+            buildClassPathEntries();
         }
-        
+
         return entries;
     }
 
+
     /* (non-Javadoc)
      * @see org.eclipse.jdt.core.IClasspathContainer#getDescription()
      */
-    public String getDescription() {
+    public String getDescription()
+    {
         return "Bundle Context Classpath";
     }
 
+
     /* (non-Javadoc)
      * @see org.eclipse.jdt.core.IClasspathContainer#getKind()
      */
-    public int getKind() {
+    public int getKind()
+    {
         return K_SYSTEM;
     }
 
+
     /* (non-Javadoc)
      * @see org.eclipse.jdt.core.IClasspathContainer#getPath()
      */
-    public IPath getPath() {
+    public IPath getPath()
+    {
         return new Path( SigilCore.CLASSPATH_CONTAINER_PATH );
     }
 
+
     /**
      * @return
      * @throws CoreException 
      * @throws CoreException 
      */
-    private void buildClassPathEntries() {
-		try {
-			IProgressMonitor monitor = ThreadProgressMonitor.getProgressMonitor();
-			entries = sigil.findExternalClasspath(monitor).toArray( new IClasspathEntry[0] );
-		} catch (CoreException e) {
-    		SigilCore.error( "Failed to build classpath entries", e);
-		}
-		finally {
-			if ( entries == null ) {
-	    		entries = new IClasspathEntry[] {};
-			}
-		}
+    private void buildClassPathEntries()
+    {
+        try
+        {
+            IProgressMonitor monitor = ThreadProgressMonitor.getProgressMonitor();
+            entries = sigil.findExternalClasspath( monitor ).toArray( new IClasspathEntry[0] );
+        }
+        catch ( CoreException e )
+        {
+            SigilCore.error( "Failed to build classpath entries", e );
+        }
+        finally
+        {
+            if ( entries == null )
+            {
+                entries = new IClasspathEntry[]
+                    {};
+            }
+        }
     }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/classpath/SigilClasspathContainerInitializer.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/classpath/SigilClasspathContainerInitializer.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/classpath/SigilClasspathContainerInitializer.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/classpath/SigilClasspathContainerInitializer.java Tue Jul 21 18:51:33 2009
@@ -17,66 +17,79 @@
  * under the License.
  */
 
-package org.apache.felix.sigil.ui.eclipse.classpath;
-
+package org.apache.felix.sigil.ui.eclipse.classpath;
+
+
 import org.apache.felix.sigil.eclipse.SigilCore;
 import org.apache.felix.sigil.eclipse.job.*;
 import org.apache.felix.sigil.eclipse.model.project.ISigilProjectModel;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jdt.core.ClasspathContainerInitializer;
-import org.eclipse.jdt.core.IClasspathContainer;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-
-public class SigilClasspathContainerInitializer extends ClasspathContainerInitializer {
-
-	public SigilClasspathContainerInitializer() {
-		// TODO Auto-generated constructor stub
-	}
-
-	@Override
-	public boolean canUpdateClasspathContainer(IPath containerPath,
-			IJavaProject project) {
-		return true;
-	}
-
-	@Override
-	public void requestClasspathContainerUpdate(IPath containerPath, IJavaProject project, IClasspathContainer containerSuggestion)
-			throws CoreException {
-		ISigilProjectModel sigil = SigilCore.create(project.getProject());
-		
-        IClasspathContainer sigilContainer = new SigilClassPathContainer(sigil);
-		
-		IJavaProject[] affectedProjects = new IJavaProject[] { project };
-        
-        IClasspathContainer[] respectiveContainers = new IClasspathContainer[] { sigilContainer };
-        
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jdt.core.ClasspathContainerInitializer;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+
+
+public class SigilClasspathContainerInitializer extends ClasspathContainerInitializer
+{
+
+    public SigilClasspathContainerInitializer()
+    {
+        // TODO Auto-generated constructor stub
+    }
+
+
+    @Override
+    public boolean canUpdateClasspathContainer( IPath containerPath, IJavaProject project )
+    {
+        return true;
+    }
+
+
+    @Override
+    public void requestClasspathContainerUpdate( IPath containerPath, IJavaProject project,
+        IClasspathContainer containerSuggestion ) throws CoreException
+    {
+        ISigilProjectModel sigil = SigilCore.create( project.getProject() );
+
+        IClasspathContainer sigilContainer = new SigilClassPathContainer( sigil );
+
+        IJavaProject[] affectedProjects = new IJavaProject[]
+            { project };
+
+        IClasspathContainer[] respectiveContainers = new IClasspathContainer[]
+            { sigilContainer };
+
         IProgressMonitor monitor = ThreadProgressMonitor.getProgressMonitor();
-        
-        if ( monitor == null ) { 
-        	monitor = Job.getJobManager().createProgressGroup();
+
+        if ( monitor == null )
+        {
+            monitor = Job.getJobManager().createProgressGroup();
         }
 
-        JavaCore.setClasspathContainer(containerPath, affectedProjects, respectiveContainers , monitor);
-	}
+        JavaCore.setClasspathContainer( containerPath, affectedProjects, respectiveContainers, monitor );
+    }
+
+
+    @Override
+    public void initialize( IPath containerPath, IJavaProject project ) throws CoreException
+    {
+        ISigilProjectModel sigil = SigilCore.create( project.getProject() );
+
+        IClasspathContainer sigilContainer = new SigilClassPathContainer( sigil );
+
+        IJavaProject[] affectedProjects = new IJavaProject[]
+            { project };
+
+        IClasspathContainer[] respectiveContainers = new IClasspathContainer[]
+            { sigilContainer };
+
+        IProgressMonitor monitor = Job.getJobManager().createProgressGroup();
+
+        JavaCore.setClasspathContainer( containerPath, affectedProjects, respectiveContainers, monitor );
+    }
 
-	@Override
-	public void initialize(IPath containerPath, IJavaProject project)
-			throws CoreException {
-		ISigilProjectModel sigil = SigilCore.create(project.getProject());
-		
-        IClasspathContainer sigilContainer = new SigilClassPathContainer(sigil);
-		
-		IJavaProject[] affectedProjects = new IJavaProject[] { project };
-        
-        IClasspathContainer[] respectiveContainers = new IClasspathContainer[] { sigilContainer };
-        
-        IProgressMonitor monitor = Job.getJobManager().createProgressGroup();
-
-        JavaCore.setClasspathContainer(containerPath, affectedProjects, respectiveContainers , monitor);
-	}
-
-}
+}