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 [21/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/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportQuickFixProcessor.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportQuickFixProcessor.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportQuickFixProcessor.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportQuickFixProcessor.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.quickfix;
 
+
 import java.util.ArrayList;
 import java.util.HashMap;
 
@@ -48,206 +49,267 @@
 import org.eclipse.jdt.ui.text.java.IProblemLocation;
 import org.eclipse.jdt.ui.text.java.IQuickFixProcessor;
 
+
 @SuppressWarnings("restriction")
-public class ImportQuickFixProcessor implements IQuickFixProcessor {
+public class ImportQuickFixProcessor implements IQuickFixProcessor
+{
+
+    private static final Object SYNC_FLAG = new Object();
+
 
-	private static final Object SYNC_FLAG = new Object();
-	
-	public boolean hasCorrections(ICompilationUnit unit, int problemId) {
-		switch ( problemId ) {
-		case IProblem.ImportNotFound:
-		case IProblem.ForbiddenReference:
-		case IProblem.NotVisibleType:
-		case IProblem.UndefinedType:
-			return true;
-		default:
-			return false;
-		}
-	}
-
-	public IJavaCompletionProposal[] getCorrections(IInvocationContext context,
-			IProblemLocation[] locations) throws CoreException {
-		try {
-			HashMap<Object, IJavaCompletionProposal> results = new HashMap<Object, IJavaCompletionProposal>();
-			
-			ISigilProjectModel project = findProject(context);
-			
-			if ( project != null ) {
-				for ( int i = 0; i < locations.length; i++ ) {
-					switch ( locations[i].getProblemId() ) {
-					case IProblem.ForbiddenReference:
-						handleImportNotFound(project, context, locations[i], results);
-						break;
-					case IProblem.ImportNotFound:
-						handleImportNotFound(project, context, locations[i], results);
-						break;
-					case IProblem.IsClassPathCorrect:
-						handleIsClassPathCorrect(project, context, locations[i], results);
-						break;
-					case IProblem.UndefinedType:
-						handleUndefinedType(project, context, locations[i], results);
-						break;
-					case IProblem.UndefinedName:
-						handleUndefinedName(project, context, locations[i], results);
-						break;
-					}
-				}
-			}		
-			
-			return (IJavaCompletionProposal[])results.values().toArray(new IJavaCompletionProposal[results.size()]);
-		}
-		catch ( RuntimeException e ) {
-			e.printStackTrace();
-			throw e;
-		}
-	}
-
-	private void handleUndefinedName(ISigilProjectModel project,
-			IInvocationContext context, IProblemLocation problem,
-			HashMap<Object, IJavaCompletionProposal> results) {
-		Name node = findNode(context, problem);
-		
-		if ( node == null ) {
-			return;
-		}
-		addSearchResults(node, project, results);
-	}
-
-	private void handleIsClassPathCorrect(ISigilProjectModel project, final IInvocationContext context,
-			IProblemLocation problemLocation,
-			final HashMap<Object, IJavaCompletionProposal> results) {
-		for ( final String type : problemLocation.getProblemArguments() ) {
-			final String iPackage = type.substring(0, type.lastIndexOf("."));
-			
-			for ( IPackageExport pe : JavaHelper.findExportsForPackage(project, iPackage) ) { 
-				results.put( type, new ImportPackageProposal( pe, project ) );
-			}
-		}
-		
-		if ( !results.containsKey(SYNC_FLAG) ) {
-			//results.put( SYNC_FLAG, null);
-		}
-	}
-
-	private void handleUndefinedType(ISigilProjectModel project, IInvocationContext context,
-			IProblemLocation problem,
-			HashMap<Object, IJavaCompletionProposal> results) throws CoreException {
-		Name node = findNode(context, problem);
-		
-		if ( node == null ) {
-			return;
-		}
-		addSearchResults(node, project, results);
-	}
-
-	private void handleImportNotFound(ISigilProjectModel project, final IInvocationContext context, IProblemLocation location, final HashMap<Object, IJavaCompletionProposal> results) throws CoreException {
-		ASTNode selectedNode= location.getCoveringNode(context.getASTRoot());
-		if (selectedNode == null) return;
-		
-		if ( selectedNode instanceof ClassInstanceCreation ) {
-			ClassInstanceCreation c = (ClassInstanceCreation) selectedNode;
-			Type t = c.getType();
-			Name node = findName( t );
-			if ( node != null ) {
-				addSearchResults(node, project, results);
-			}
-		}
-		else {
-			for ( final String iPackage : readPackage(selectedNode, location) ) {
-				if ( !results.containsKey(iPackage) ) {
-					for ( IPackageExport pe : JavaHelper.findExportsForPackage(project, iPackage) ) { 
-						results.put( iPackage, new ImportPackageProposal( pe, project ) );
-					}
-				}
-			}
-		}
-	}
-
-	private void addSearchResults(Name node, ISigilProjectModel project,
-			HashMap<Object, IJavaCompletionProposal> results) {
-		for ( ISearchResult result : SigilSearch.findProviders( node.getFullyQualifiedName(), project, null) ) {
-			if ( project.getBundle().findImport( result.getPackageName() ) == null ) {
-				String type = result.getPackageName() + "." + node.getFullyQualifiedName();
-				results.put( type, new ImportSearchResultProposal( SigilUI.getActiveWorkbenchShell(), result, node, project ) );
-			}
-		}		
-	}
-
-	private Name findName(Type t) {
-		if ( t.isSimpleType() ) {
-			SimpleType st = (SimpleType) t;
-			return st.getName();
-		}
-		else if ( t.isArrayType() ) {
-			ArrayType at = (ArrayType) t;
-			return findName(at.getElementType());
-		}
-		else {
-			return null;
-		}
-	}
-
-	private Name findNode(IInvocationContext context, IProblemLocation problem) {
-		ASTNode selectedNode= problem.getCoveringNode(context.getASTRoot());
-		if (selectedNode == null) {
-			return null;
-		}
-
-		while (selectedNode.getLocationInParent() == QualifiedName.NAME_PROPERTY) {
-			selectedNode= selectedNode.getParent();
-		}
-
-		Name node= null;
-		
-		if (selectedNode instanceof Type) {
-			node = findName( (Type) selectedNode );
-		} else if (selectedNode instanceof Name) {
-			node= (Name) selectedNode;
-		}
-		
-		return node;
-	}
-
-	private ISigilProjectModel findProject(IInvocationContext context) throws CoreException {
-		IProject project = context.getCompilationUnit().getJavaProject().getProject();
-		if ( project.hasNature( SigilCore.NATURE_ID ) ) {
-			return SigilCore.create(project);
-		}
-		else {
-			return null;
-		}
-	}
-
-	private String[] readPackage(ASTNode selectedNode, IProblemLocation location) {
-		ArrayList<String> packages = new ArrayList<String>();
-		
-		ImportDeclaration id = (ImportDeclaration) ASTNodes.getParent(selectedNode, ASTNode.IMPORT_DECLARATION);
-
-		if ( id == null ) {
-			MethodInvocation m = (MethodInvocation) ASTNodes.getParent(selectedNode, ASTNode.METHOD_INVOCATION);
-
-			if (m != null) {
-				packages.add( readPackage( m ) );
-				while ( m.getExpression() != null && m.getExpression() instanceof MethodInvocation) {
-					m = (MethodInvocation) m.getExpression();
-					packages.add( readPackage( m ) );
-				}
-			}
-		}
-		else {
-			if ( id.isOnDemand() ) {
-				packages.add(id.getName().toString());
-			}
-			else {
-				String iStr = id.getName().toString();
-				packages.add(iStr.substring(0, iStr.lastIndexOf( "." ) ));
-			}
-		}
-		
-		return packages.toArray( new String[packages.size()] );
-	}
-
-	private String readPackage(MethodInvocation m) {
-		return m.resolveMethodBinding().getDeclaringClass().getPackage().getName();
-	}
+    public boolean hasCorrections( ICompilationUnit unit, int problemId )
+    {
+        switch ( problemId )
+        {
+            case IProblem.ImportNotFound:
+            case IProblem.ForbiddenReference:
+            case IProblem.NotVisibleType:
+            case IProblem.UndefinedType:
+                return true;
+            default:
+                return false;
+        }
+    }
+
+
+    public IJavaCompletionProposal[] getCorrections( IInvocationContext context, IProblemLocation[] locations )
+        throws CoreException
+    {
+        try
+        {
+            HashMap<Object, IJavaCompletionProposal> results = new HashMap<Object, IJavaCompletionProposal>();
+
+            ISigilProjectModel project = findProject( context );
+
+            if ( project != null )
+            {
+                for ( int i = 0; i < locations.length; i++ )
+                {
+                    switch ( locations[i].getProblemId() )
+                    {
+                        case IProblem.ForbiddenReference:
+                            handleImportNotFound( project, context, locations[i], results );
+                            break;
+                        case IProblem.ImportNotFound:
+                            handleImportNotFound( project, context, locations[i], results );
+                            break;
+                        case IProblem.IsClassPathCorrect:
+                            handleIsClassPathCorrect( project, context, locations[i], results );
+                            break;
+                        case IProblem.UndefinedType:
+                            handleUndefinedType( project, context, locations[i], results );
+                            break;
+                        case IProblem.UndefinedName:
+                            handleUndefinedName( project, context, locations[i], results );
+                            break;
+                    }
+                }
+            }
+
+            return ( IJavaCompletionProposal[] ) results.values().toArray( new IJavaCompletionProposal[results.size()] );
+        }
+        catch ( RuntimeException e )
+        {
+            e.printStackTrace();
+            throw e;
+        }
+    }
+
+
+    private void handleUndefinedName( ISigilProjectModel project, IInvocationContext context, IProblemLocation problem,
+        HashMap<Object, IJavaCompletionProposal> results )
+    {
+        Name node = findNode( context, problem );
+
+        if ( node == null )
+        {
+            return;
+        }
+        addSearchResults( node, project, results );
+    }
+
+
+    private void handleIsClassPathCorrect( ISigilProjectModel project, final IInvocationContext context,
+        IProblemLocation problemLocation, final HashMap<Object, IJavaCompletionProposal> results )
+    {
+        for ( final String type : problemLocation.getProblemArguments() )
+        {
+            final String iPackage = type.substring( 0, type.lastIndexOf( "." ) );
+
+            for ( IPackageExport pe : JavaHelper.findExportsForPackage( project, iPackage ) )
+            {
+                results.put( type, new ImportPackageProposal( pe, project ) );
+            }
+        }
+
+        if ( !results.containsKey( SYNC_FLAG ) )
+        {
+            //results.put( SYNC_FLAG, null);
+        }
+    }
+
+
+    private void handleUndefinedType( ISigilProjectModel project, IInvocationContext context, IProblemLocation problem,
+        HashMap<Object, IJavaCompletionProposal> results ) throws CoreException
+    {
+        Name node = findNode( context, problem );
+
+        if ( node == null )
+        {
+            return;
+        }
+        addSearchResults( node, project, results );
+    }
+
+
+    private void handleImportNotFound( ISigilProjectModel project, final IInvocationContext context,
+        IProblemLocation location, final HashMap<Object, IJavaCompletionProposal> results ) throws CoreException
+    {
+        ASTNode selectedNode = location.getCoveringNode( context.getASTRoot() );
+        if ( selectedNode == null )
+            return;
+
+        if ( selectedNode instanceof ClassInstanceCreation )
+        {
+            ClassInstanceCreation c = ( ClassInstanceCreation ) selectedNode;
+            Type t = c.getType();
+            Name node = findName( t );
+            if ( node != null )
+            {
+                addSearchResults( node, project, results );
+            }
+        }
+        else
+        {
+            for ( final String iPackage : readPackage( selectedNode, location ) )
+            {
+                if ( !results.containsKey( iPackage ) )
+                {
+                    for ( IPackageExport pe : JavaHelper.findExportsForPackage( project, iPackage ) )
+                    {
+                        results.put( iPackage, new ImportPackageProposal( pe, project ) );
+                    }
+                }
+            }
+        }
+    }
+
+
+    private void addSearchResults( Name node, ISigilProjectModel project,
+        HashMap<Object, IJavaCompletionProposal> results )
+    {
+        for ( ISearchResult result : SigilSearch.findProviders( node.getFullyQualifiedName(), project, null ) )
+        {
+            if ( project.getBundle().findImport( result.getPackageName() ) == null )
+            {
+                String type = result.getPackageName() + "." + node.getFullyQualifiedName();
+                results.put( type, new ImportSearchResultProposal( SigilUI.getActiveWorkbenchShell(), result, node,
+                    project ) );
+            }
+        }
+    }
+
+
+    private Name findName( Type t )
+    {
+        if ( t.isSimpleType() )
+        {
+            SimpleType st = ( SimpleType ) t;
+            return st.getName();
+        }
+        else if ( t.isArrayType() )
+        {
+            ArrayType at = ( ArrayType ) t;
+            return findName( at.getElementType() );
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    private Name findNode( IInvocationContext context, IProblemLocation problem )
+    {
+        ASTNode selectedNode = problem.getCoveringNode( context.getASTRoot() );
+        if ( selectedNode == null )
+        {
+            return null;
+        }
+
+        while ( selectedNode.getLocationInParent() == QualifiedName.NAME_PROPERTY )
+        {
+            selectedNode = selectedNode.getParent();
+        }
+
+        Name node = null;
+
+        if ( selectedNode instanceof Type )
+        {
+            node = findName( ( Type ) selectedNode );
+        }
+        else if ( selectedNode instanceof Name )
+        {
+            node = ( Name ) selectedNode;
+        }
+
+        return node;
+    }
+
+
+    private ISigilProjectModel findProject( IInvocationContext context ) throws CoreException
+    {
+        IProject project = context.getCompilationUnit().getJavaProject().getProject();
+        if ( project.hasNature( SigilCore.NATURE_ID ) )
+        {
+            return SigilCore.create( project );
+        }
+        else
+        {
+            return null;
+        }
+    }
+
+
+    private String[] readPackage( ASTNode selectedNode, IProblemLocation location )
+    {
+        ArrayList<String> packages = new ArrayList<String>();
+
+        ImportDeclaration id = ( ImportDeclaration ) ASTNodes.getParent( selectedNode, ASTNode.IMPORT_DECLARATION );
+
+        if ( id == null )
+        {
+            MethodInvocation m = ( MethodInvocation ) ASTNodes.getParent( selectedNode, ASTNode.METHOD_INVOCATION );
+
+            if ( m != null )
+            {
+                packages.add( readPackage( m ) );
+                while ( m.getExpression() != null && m.getExpression() instanceof MethodInvocation )
+                {
+                    m = ( MethodInvocation ) m.getExpression();
+                    packages.add( readPackage( m ) );
+                }
+            }
+        }
+        else
+        {
+            if ( id.isOnDemand() )
+            {
+                packages.add( id.getName().toString() );
+            }
+            else
+            {
+                String iStr = id.getName().toString();
+                packages.add( iStr.substring( 0, iStr.lastIndexOf( "." ) ) );
+            }
+        }
+
+        return packages.toArray( new String[packages.size()] );
+    }
+
+
+    private String readPackage( MethodInvocation m )
+    {
+        return m.resolveMethodBinding().getDeclaringClass().getPackage().getName();
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportSearchResultProposal.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportSearchResultProposal.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportSearchResultProposal.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportSearchResultProposal.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.quickfix;
 
+
 import org.apache.felix.sigil.eclipse.SigilCore;
 import org.apache.felix.sigil.eclipse.model.project.ISigilProjectModel;
 import org.apache.felix.sigil.model.ModelElementFactory;
@@ -50,107 +51,140 @@
 import org.eclipse.ui.actions.WorkspaceModifyOperation;
 import org.osgi.framework.Version;
 
-public class ImportSearchResultProposal implements IJavaCompletionProposal {
 
-	private ISigilProjectModel project;
-	private ICompilationUnit fCompilationUnit;
-	private final ISearchResult result;
-	private final Shell shell;
-	
-	public ImportSearchResultProposal(Shell shell, ISearchResult result, Name node, ISigilProjectModel project) {
-		this.shell = shell;
-		this.result = result;
-		this.project = project;
-		if ( node != null ) {
-			CompilationUnit cu = (CompilationUnit) ASTNodes.getParent(node, ASTNode.COMPILATION_UNIT);
-			this.fCompilationUnit = (ICompilationUnit) cu.getJavaElement();
-		}
-	}
-
-	public int getRelevance() {
-		return 100;
-	}
-
-	public void apply(IDocument document) {
-		IPackageExport e = result.getExport();
-		if ( result.getExport() == null ) {
-			if ( MessageDialog.openQuestion(shell, "Modify " + result.getProvider().getBundleInfo().getSymbolicName(), result.getPackageName() + " is not exported. Do you want to export it now?" ) ) {
-				final IPackageExport pe = ModelElementFactory.getInstance().newModelElement(IPackageExport.class);
-				pe.setPackageName(result.getPackageName());
-				//e.setVersion(version)
-				final ISigilProjectModel mod = result.getProvider().getAncestor(ISigilProjectModel.class);
-				if ( mod == null ) {
-					throw new IllegalStateException( "Attempt to modify binary package export" );
-				}
-				WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
-					@Override
-					protected void execute(IProgressMonitor monitor)
-					throws CoreException {
-						mod.getBundle().getBundleInfo().addExport(pe);
-						mod.save(null);
-					}
-				};
-
-				SigilUI.runWorkspaceOperation(op, null);
-				e = pe;
-			}
-		}
-
-		final IPackageImport i = ModelElementFactory.getInstance().newModelElement(IPackageImport.class);
-		i.setPackageName(e.getPackageName());
-		IPreferenceStore store = SigilCore.getDefault().getPreferenceStore();
-		VersionRangeBoundingRule lowerBoundRule = VersionRangeBoundingRule.valueOf(store.getString(SigilCore.DEFAULT_VERSION_LOWER_BOUND));
-		VersionRangeBoundingRule upperBoundRule = VersionRangeBoundingRule.valueOf(store.getString(SigilCore.DEFAULT_VERSION_UPPER_BOUND));
-
-		Version version = e.getVersion();
-		VersionRange selectedVersions = VersionRange.newInstance(version, lowerBoundRule, upperBoundRule);
-		i.setVersions( selectedVersions );
-
-		WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
-			@Override
-			protected void execute(IProgressMonitor monitor)
-			throws CoreException {
-				project.getBundle().getBundleInfo().addImport( i );
-				project.save(null);
-			}
-		};
-
-		SigilUI.runWorkspaceOperation(op, null);
-		addSourceImport();
-	}
-
-	private void addSourceImport() {
-		// add import
-		try {
-			ImportRewrite rewrite= CodeStyleConfiguration.createImportRewrite(fCompilationUnit, true);
-			rewrite.addImport(result.getClassName());
-			JavaModelUtil.applyEdit(fCompilationUnit, rewrite.rewriteImports(null), false, null);
-		} catch (CoreException e) {
-			SigilCore.error( "Failed to add import", e);
-		}
-	}
-
-	public String getAdditionalProposalInfo() {
-		return null;
-	}
-
-	public IContextInformation getContextInformation() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-	
-	public String getDisplayString() {
-		String type = result.getClassName();
-		String loc = result.getExport() == null ? " from " + result.getProvider().getBundleInfo().getSymbolicName() : " version " + result.getExport().getVersion();
-		return "Import " + type + loc;
-	}
-
-	public Image getImage() {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public Point getSelection(IDocument document) {
-		return null;
-	}
+public class ImportSearchResultProposal implements IJavaCompletionProposal
+{
+
+    private ISigilProjectModel project;
+    private ICompilationUnit fCompilationUnit;
+    private final ISearchResult result;
+    private final Shell shell;
+
+
+    public ImportSearchResultProposal( Shell shell, ISearchResult result, Name node, ISigilProjectModel project )
+    {
+        this.shell = shell;
+        this.result = result;
+        this.project = project;
+        if ( node != null )
+        {
+            CompilationUnit cu = ( CompilationUnit ) ASTNodes.getParent( node, ASTNode.COMPILATION_UNIT );
+            this.fCompilationUnit = ( ICompilationUnit ) cu.getJavaElement();
+        }
+    }
+
+
+    public int getRelevance()
+    {
+        return 100;
+    }
+
+
+    public void apply( IDocument document )
+    {
+        IPackageExport e = result.getExport();
+        if ( result.getExport() == null )
+        {
+            if ( MessageDialog.openQuestion( shell, "Modify " + result.getProvider().getBundleInfo().getSymbolicName(),
+                result.getPackageName() + " is not exported. Do you want to export it now?" ) )
+            {
+                final IPackageExport pe = ModelElementFactory.getInstance().newModelElement( IPackageExport.class );
+                pe.setPackageName( result.getPackageName() );
+                //e.setVersion(version)
+                final ISigilProjectModel mod = result.getProvider().getAncestor( ISigilProjectModel.class );
+                if ( mod == null )
+                {
+                    throw new IllegalStateException( "Attempt to modify binary package export" );
+                }
+                WorkspaceModifyOperation op = new WorkspaceModifyOperation()
+                {
+                    @Override
+                    protected void execute( IProgressMonitor monitor ) throws CoreException
+                    {
+                        mod.getBundle().getBundleInfo().addExport( pe );
+                        mod.save( null );
+                    }
+                };
+
+                SigilUI.runWorkspaceOperation( op, null );
+                e = pe;
+            }
+        }
+
+        final IPackageImport i = ModelElementFactory.getInstance().newModelElement( IPackageImport.class );
+        i.setPackageName( e.getPackageName() );
+        IPreferenceStore store = SigilCore.getDefault().getPreferenceStore();
+        VersionRangeBoundingRule lowerBoundRule = VersionRangeBoundingRule.valueOf( store
+            .getString( SigilCore.DEFAULT_VERSION_LOWER_BOUND ) );
+        VersionRangeBoundingRule upperBoundRule = VersionRangeBoundingRule.valueOf( store
+            .getString( SigilCore.DEFAULT_VERSION_UPPER_BOUND ) );
+
+        Version version = e.getVersion();
+        VersionRange selectedVersions = VersionRange.newInstance( version, lowerBoundRule, upperBoundRule );
+        i.setVersions( selectedVersions );
+
+        WorkspaceModifyOperation op = new WorkspaceModifyOperation()
+        {
+            @Override
+            protected void execute( IProgressMonitor monitor ) throws CoreException
+            {
+                project.getBundle().getBundleInfo().addImport( i );
+                project.save( null );
+            }
+        };
+
+        SigilUI.runWorkspaceOperation( op, null );
+        addSourceImport();
+    }
+
+
+    private void addSourceImport()
+    {
+        // add import
+        try
+        {
+            ImportRewrite rewrite = CodeStyleConfiguration.createImportRewrite( fCompilationUnit, true );
+            rewrite.addImport( result.getClassName() );
+            JavaModelUtil.applyEdit( fCompilationUnit, rewrite.rewriteImports( null ), false, null );
+        }
+        catch ( CoreException e )
+        {
+            SigilCore.error( "Failed to add import", e );
+        }
+    }
+
+
+    public String getAdditionalProposalInfo()
+    {
+        return null;
+    }
+
+
+    public IContextInformation getContextInformation()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public String getDisplayString()
+    {
+        String type = result.getClassName();
+        String loc = result.getExport() == null ? " from " + result.getProvider().getBundleInfo().getSymbolicName()
+            : " version " + result.getExport().getVersion();
+        return "Import " + type + loc;
+    }
+
+
+    public Image getImage()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public Point getSelection( IDocument document )
+    {
+        return null;
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportedClassReference.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportedClassReference.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportedClassReference.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportedClassReference.java Tue Jul 21 18:51:33 2009
@@ -19,22 +19,31 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.quickfix;
 
+
 import org.apache.felix.sigil.model.osgi.IPackageImport;
 
-public class ImportedClassReference {
-	private IPackageImport pi;
-	private String type;
-	
-	public ImportedClassReference(IPackageImport packageImport, String typeName) {
-		this.pi = packageImport;
-		this.type = typeName;
-	}
-
-	public IPackageImport getPackageImport() {
-		return pi;
-	}
-
-	public String getFullType() {
-		return type;
-	}
+
+public class ImportedClassReference
+{
+    private IPackageImport pi;
+    private String type;
+
+
+    public ImportedClassReference( IPackageImport packageImport, String typeName )
+    {
+        this.pi = packageImport;
+        this.type = typeName;
+    }
+
+
+    public IPackageImport getPackageImport()
+    {
+        return pi;
+    }
+
+
+    public String getFullType()
+    {
+        return type;
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/refactor/RenameCompositeRefactoring.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/refactor/RenameCompositeRefactoring.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/refactor/RenameCompositeRefactoring.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/refactor/RenameCompositeRefactoring.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.refactor;
 
+
 import java.util.Map;
 
 import org.eclipse.core.runtime.CoreException;
@@ -28,32 +29,40 @@
 import org.eclipse.ltk.core.refactoring.Refactoring;
 import org.eclipse.ltk.core.refactoring.RefactoringStatus;
 
-public class RenameCompositeRefactoring extends Refactoring {
 
-	@Override
-	public RefactoringStatus checkFinalConditions(IProgressMonitor pm) throws CoreException,
-			OperationCanceledException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException,
-			OperationCanceledException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public Change createChange(IProgressMonitor pm) throws CoreException,
-			OperationCanceledException {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
-	public String getName() {
-		// TODO Auto-generated method stub
-		return null;
-	}
+public class RenameCompositeRefactoring extends Refactoring
+{
+
+    @Override
+    public RefactoringStatus checkFinalConditions( IProgressMonitor pm ) throws CoreException,
+        OperationCanceledException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    @Override
+    public RefactoringStatus checkInitialConditions( IProgressMonitor pm ) throws CoreException,
+        OperationCanceledException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    @Override
+    public Change createChange( IProgressMonitor pm ) throws CoreException, OperationCanceledException
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    @Override
+    public String getName()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/AccumulatorAdapter.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/AccumulatorAdapter.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/AccumulatorAdapter.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/AccumulatorAdapter.java Tue Jul 21 18:51:33 2009
@@ -19,16 +19,22 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.util;
 
+
 import java.util.Collection;
 import java.util.LinkedList;
 
-public abstract class AccumulatorAdapter<E> implements IAccumulator<E> {
-	public void addElement(E element) {
-		LinkedList<E> list = new LinkedList<E>();
-		list.add(element);
-		addElements(list);
-	};
-	
-	public void addElements(Collection<? extends E> elements) {
-	}
+
+public abstract class AccumulatorAdapter<E> implements IAccumulator<E>
+{
+    public void addElement( E element )
+    {
+        LinkedList<E> list = new LinkedList<E>();
+        list.add( element );
+        addElements( list );
+    };
+
+
+    public void addElements( Collection<? extends E> elements )
+    {
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/BackgroundLoadingSelectionDialog.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/BackgroundLoadingSelectionDialog.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/BackgroundLoadingSelectionDialog.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/BackgroundLoadingSelectionDialog.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.util;
 
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -72,416 +73,562 @@
 import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.progress.IJobRunnable;
 
-public class BackgroundLoadingSelectionDialog<E> extends TitleAreaDialog implements IAccumulator<E> {
 
-	private final ILabelProvider DEFAULT_LABEL_PROVIDER = new LabelProvider() {
-		@SuppressWarnings("unchecked")
-		public String getText(Object element) {
-			String result;
-			if(element instanceof WrappedContentProposal<?>) {
-				WrappedContentProposal<E> contentProposal = (WrappedContentProposal<E>) element;
-				result = contentProposal.getLabel();
-			} else {
-				result = descriptor.getLabel((E) element);
-			}
-			return result;
-		}
-	};
-
-	private final IElementDescriptor<E> DEFAULT_DESCRIPTOR = new IElementDescriptor<E>() {
-		public String getLabel(E element) {
-			return getName(element);
-		}
-		public String getName(E element) {
-			return element == null ? "null" : element.toString();
-		}
-	};
-	
-	private final String selectionLabel;
-	private IFilter<? super E> filter;
-	private IElementDescriptor<? super E> descriptor = DEFAULT_DESCRIPTOR;
-	private ILabelProvider labelProvider = DEFAULT_LABEL_PROVIDER;
-	private final boolean multi;
-	
-	private final List<E> elements;
-	
-	private List<E> selection = null;
-	private String selectedName = null;
-	
-	private TableViewer viewer = null;
-	private Comparator<? super E> comparator;
-	
-	private HashMap<String, IJobRunnable> background = new HashMap<String, IJobRunnable>(); 
-	
-	public BackgroundLoadingSelectionDialog(Shell parentShell, String selectionLabel, boolean multi) {
-		super(parentShell);
-		elements = new ArrayList<E>();		
-		this.selectionLabel = selectionLabel;
-		this.multi = multi;
-	}
-	
-	public void setFilter(IFilter<? super E> filter) {
-		this.filter = filter;		
-	}
-	
-	public void setDescriptor(final IElementDescriptor<? super E> descriptor) {
-		if(descriptor != null) {
-			this.descriptor = descriptor;
-		} else {
-			this.descriptor = DEFAULT_DESCRIPTOR;
-		}
-	}
-	
-	public IElementDescriptor<? super E> getDescriptor() {
-		return descriptor;
-	}
-
-	public void setComparator(Comparator<? super E> comparator) {
-		this.comparator = comparator;		
-	}
-	
-	public void setLabelProvider(ILabelProvider labelProvider) {
-		if(labelProvider != null) {
-			this.labelProvider = labelProvider;
-		} else {
-			this.labelProvider = DEFAULT_LABEL_PROVIDER;
-		}
-	}
-	
-	public void addBackgroundJob(String name, IJobRunnable job) {
-		background.put(name, job);
-	}
-	
-	@Override
-	public int open() {
-		Job[] jobs = scheduleJobs();
-		try {
-			return super.open();
-		}
-		finally {
-			for ( Job j : jobs ) {
-				j.cancel();
-			}
-		}
-	}
-
-	private Job[] scheduleJobs() {
-		if ( background.isEmpty() ) {
-			return new Job[] {};
-		}
-		else {
-			ArrayList<Job> jobs = new ArrayList<Job>(background.size()); 
-			for ( Map.Entry<String, IJobRunnable> e : background.entrySet() ) {
-				final IJobRunnable run = e.getValue();
-				Job job = new Job(e.getKey()) {
-					@Override
-					protected IStatus run(IProgressMonitor monitor) {
-						return run.run(monitor);
-					}
-				};				
-				job.schedule();
-			}
-			
-			return jobs.toArray( new Job[jobs.size()] );
-		}
-	}
-
-	@Override
-	protected Control createDialogArea(Composite parent) {
-		// Create Controls
-		Composite container = (Composite) super.createDialogArea(parent);
-		Composite composite = new Composite(container, SWT.NONE);
-		
-		new Label(composite, SWT.NONE).setText(selectionLabel);
-		
-		ContentProposalAdapter proposalAdapter = null;
-		Text txtSelection = null;
-		
-		Table table = null;
-		if(multi) {
-			table = new Table(composite, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
-			viewer = new TableViewer(table);
-			viewer.setContentProvider(new ArrayContentProvider());
-			viewer.addFilter(new ViewerFilter() {
-				public boolean select(Viewer viewer, Object parentElement, Object element) {
-					@SuppressWarnings("unchecked") E castedElement = (E) element;
-					return filter == null || filter.select(castedElement);
-				}
-			});
-			if(comparator != null) {
-				viewer.setSorter(new ViewerSorter() {
-					@Override
-					public int compare(Viewer viewer, Object o1, Object o2) {
-						@SuppressWarnings("unchecked")
-						E e1 = (E) o1;
-						@SuppressWarnings("unchecked")
-						E e2 = (E) o2;
-						return comparator.compare(e1, e2);
-					}
-				});
-			}
-			synchronized (elements) {
-				viewer.setInput(elements);
-			}
-			
-			if(labelProvider != null) {
-				viewer.setLabelProvider(labelProvider);
-			}
-		} else {
-			txtSelection = new Text(composite, SWT.BORDER);
-			ControlDecoration selectionDecor = new ControlDecoration(txtSelection, SWT.LEFT | SWT.TOP);
-			FieldDecoration proposalDecor = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
-			selectionDecor.setImage(proposalDecor.getImage());
-			selectionDecor.setDescriptionText(proposalDecor.getDescription());
-			
-			ExclusionContentProposalProvider<E> proposalProvider = new ExclusionContentProposalProvider<E>(elements, filter, descriptor);
-			
-			proposalAdapter = new ContentProposalAdapter(txtSelection, new TextContentAdapter(), proposalProvider, null, null);
-			proposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
-			if(labelProvider != null) {
-				proposalAdapter.setLabelProvider(labelProvider);
-			}
-			
-			if(selectedName != null) {
-				txtSelection.setText(selectedName);
-			}
-		}
-		updateSelection();
-		updateButtons();
-		
-		// Hookup listeners
-		if(proposalAdapter != null) {
-			proposalAdapter.addContentProposalListener(new IContentProposalListener() {
-				public void proposalAccepted(IContentProposal proposal) {
-					@SuppressWarnings("unchecked")
-					WrappedContentProposal<E> valueProposal = (WrappedContentProposal<E>) proposal;
-					E selected = valueProposal.getElement();
-					selection = new ArrayList<E>(1);
-					selection.add(selected);
-					
-					elementSelected(selected);
-					
-					updateButtons();
-				}
-			});
-		}
-		if(txtSelection != null) {
-			txtSelection.addModifyListener(new ModifyListener() {
-				public void modifyText(ModifyEvent e) {
-					selectedName = ((Text) e.widget).getText();
-					updateButtons();
-				}
-			});
-		}
-		if(viewer != null) {
-			viewer.addSelectionChangedListener(new ISelectionChangedListener() {
-				public void selectionChanged(SelectionChangedEvent event) {
-					IStructuredSelection sel = (IStructuredSelection) event.getSelection();
-					selection = new ArrayList<E>(sel.size());
-					for(Iterator<?> iter = sel.iterator(); iter.hasNext(); ) {
-						@SuppressWarnings("unchecked")
-						E element = (E) iter.next();
-						selection.add(element);
-					}
-					updateButtons();
-				}
-			});
-			viewer.addOpenListener(new IOpenListener() {
-				public void open(OpenEvent event) {
-					if(canComplete()) {
-						setReturnCode(IDialogConstants.OK_ID);
-						close();
-					}
-				}
-			});
-		}
-		
-		// Layout
-		composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-		if(multi) {
-			composite.setLayout(new GridLayout(1, false));
-			GridData layoutTable = new GridData(SWT.FILL, SWT.FILL, true, true);
-			layoutTable.heightHint = 200;
-			table.setLayoutData(layoutTable);
-		} else {
-			composite.setLayout(new GridLayout(2, false));
-			txtSelection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-		}
-
-		return container;
-	}
-	
-	protected void elementSelected(E selection) {
-	}
-	
-	@Override
-	protected Control createButtonBar(Composite parent) {
-		Control bar = super.createButtonBar(parent);
-		updateButtons();
-		return bar;
-	}
-
-	/**
-	 * Can be called from any thread
-	 */
-	protected final void updateButtons() {
-		Runnable updateButtonsRunnable = new Runnable() {
-			public void run() {
-				Shell shell = getShell();
-				if(shell != null && !shell.isDisposed()) {
-					Button okButton = getButton(IDialogConstants.OK_ID);
-					if(okButton != null && !okButton.isDisposed()) {
-						okButton.setEnabled(canComplete());
-					}
-				}
-			}
-		};
-		Shell shell = getShell();
-		if (shell != null) {
-			onUIThread(shell, updateButtonsRunnable);
-		}
-	}
-	
-	/**
-	 * Subclasses may override but must call super.canComplete
-	 * @return
-	 */
-	protected synchronized boolean canComplete() {
-		boolean result = false;
-		
-		if ( selection != null ) {
-			if(multi) {
-				result = selection.size() > 0;
-			} else {
-				E sel = getSelectedElement();
-				result = sel != null && descriptor.getName(sel).equals(selectedName);
-			}
-		}
-		
-		return result;
-	}
-	
-	public final void addElement(E added) {
-		addElements(Collections.singleton(added));
-	}
-	
-	/**
-	 * Can be called from any thread
-	 */
-	public final void addElements(Collection<? extends E> added) {
-		final LinkedList<E> toAdd = new LinkedList<E>();
-		synchronized (elements) {
-			for ( E e : added ) {
-				if ( !elements.contains(e) ) {
-					elements.add( e );
-					toAdd.add(e);
-				}
-			}
-			Collections.sort(elements, comparator);
-		}
-		if(viewer != null) {
-			onUIThread(viewer.getControl(), new Runnable() {
-				public void run() {
-					if(!viewer.getControl().isDisposed()) {
-						viewer.add( toAdd.toArray() );
-						viewer.refresh();
-					}
-				}
-			});
-		}
-		else {
-			
-		}
-		updateSelection();
-		updateButtons();
-	}
-
-	protected void updateSelection() {
-		onUIThread(getShell(), new Runnable() {
-			public void run() {
-				if(selectedName != null) {
-					ArrayList<E> newSelection = new ArrayList<E>();
-					synchronized (elements) {
-						for (E e : elements) {
-							if(selectedName.equals(descriptor.getName(e))) {
-								newSelection.add(e);
-								break;
-							}
-						}
-					}
-					selection = newSelection;
-				}
-				else {
-					selection = Collections.emptyList();
-				}
-				if(viewer != null && !viewer.getControl().isDisposed()) {
-					viewer.setSelection(selection.isEmpty() ? StructuredSelection.EMPTY : new StructuredSelection(selection));
-				}
-			}
-		});			
-	}
-
-	private static final void onUIThread(Control control, Runnable r) {
-		if(control != null && !control.isDisposed()) {
-			try {
-				Display display = control.getDisplay();
-				if(Thread.currentThread() == display.getThread()) {
-					// We are on the UI thread already, just do the work
-					r.run();
-				} else {
-					// Not on the UI thread, need to bung over the runnable
-					display.asyncExec(r);
-				}
-			}
-			catch (SWTError e) {
-				if ( e.code == SWT.ERROR_WIDGET_DISPOSED ) {
-					// ignore
-				}
-				else {
-					throw e;
-				}
-			}
-		}
-	}
-	
-	public String getSelectedName() {
-		return selectedName;
-	}
-	
-	public void setSelectedName(String selectedName) {
-		this.selectedName = selectedName;
-		boolean change = false;
-		if ( selectedName == null ) {
-			if ( selection != null && !selection.isEmpty() ) {
-				change = true;
-			}
-		}
-		else {
-			if ( selection == null ) {
-				change = true;
-			}
-			else if ( selection.size() != 1 || !descriptor.getLabel(selection.get(0)).equals(selectedName)) {
-				change = true;				
-			}
-		}
-		
-		if ( change ) {
-			updateSelection();
-			updateButtons();
-		}
-	}
-	
-	public List<E> getSelectedElements() {
-		return selection;
-	}
-	
-	public E getSelectedElement() {
-		E result;
-		if(selection == null || selection.isEmpty()) {
-			result = null;
-		} else {
-			result = selection.get(0);
-		}
-		return result;
-	}
+public class BackgroundLoadingSelectionDialog<E> extends TitleAreaDialog implements IAccumulator<E>
+{
+
+    private final ILabelProvider DEFAULT_LABEL_PROVIDER = new LabelProvider()
+    {
+        @SuppressWarnings("unchecked")
+        public String getText( Object element )
+        {
+            String result;
+            if ( element instanceof WrappedContentProposal<?> )
+            {
+                WrappedContentProposal<E> contentProposal = ( WrappedContentProposal<E> ) element;
+                result = contentProposal.getLabel();
+            }
+            else
+            {
+                result = descriptor.getLabel( ( E ) element );
+            }
+            return result;
+        }
+    };
+
+    private final IElementDescriptor<E> DEFAULT_DESCRIPTOR = new IElementDescriptor<E>()
+    {
+        public String getLabel( E element )
+        {
+            return getName( element );
+        }
+
+
+        public String getName( E element )
+        {
+            return element == null ? "null" : element.toString();
+        }
+    };
+
+    private final String selectionLabel;
+    private IFilter<? super E> filter;
+    private IElementDescriptor<? super E> descriptor = DEFAULT_DESCRIPTOR;
+    private ILabelProvider labelProvider = DEFAULT_LABEL_PROVIDER;
+    private final boolean multi;
+
+    private final List<E> elements;
+
+    private List<E> selection = null;
+    private String selectedName = null;
+
+    private TableViewer viewer = null;
+    private Comparator<? super E> comparator;
+
+    private HashMap<String, IJobRunnable> background = new HashMap<String, IJobRunnable>();
+
+
+    public BackgroundLoadingSelectionDialog( Shell parentShell, String selectionLabel, boolean multi )
+    {
+        super( parentShell );
+        elements = new ArrayList<E>();
+        this.selectionLabel = selectionLabel;
+        this.multi = multi;
+    }
+
+
+    public void setFilter( IFilter<? super E> filter )
+    {
+        this.filter = filter;
+    }
+
+
+    public void setDescriptor( final IElementDescriptor<? super E> descriptor )
+    {
+        if ( descriptor != null )
+        {
+            this.descriptor = descriptor;
+        }
+        else
+        {
+            this.descriptor = DEFAULT_DESCRIPTOR;
+        }
+    }
+
+
+    public IElementDescriptor<? super E> getDescriptor()
+    {
+        return descriptor;
+    }
+
+
+    public void setComparator( Comparator<? super E> comparator )
+    {
+        this.comparator = comparator;
+    }
+
+
+    public void setLabelProvider( ILabelProvider labelProvider )
+    {
+        if ( labelProvider != null )
+        {
+            this.labelProvider = labelProvider;
+        }
+        else
+        {
+            this.labelProvider = DEFAULT_LABEL_PROVIDER;
+        }
+    }
+
+
+    public void addBackgroundJob( String name, IJobRunnable job )
+    {
+        background.put( name, job );
+    }
+
+
+    @Override
+    public int open()
+    {
+        Job[] jobs = scheduleJobs();
+        try
+        {
+            return super.open();
+        }
+        finally
+        {
+            for ( Job j : jobs )
+            {
+                j.cancel();
+            }
+        }
+    }
+
+
+    private Job[] scheduleJobs()
+    {
+        if ( background.isEmpty() )
+        {
+            return new Job[]
+                {};
+        }
+        else
+        {
+            ArrayList<Job> jobs = new ArrayList<Job>( background.size() );
+            for ( Map.Entry<String, IJobRunnable> e : background.entrySet() )
+            {
+                final IJobRunnable run = e.getValue();
+                Job job = new Job( e.getKey() )
+                {
+                    @Override
+                    protected IStatus run( IProgressMonitor monitor )
+                    {
+                        return run.run( monitor );
+                    }
+                };
+                job.schedule();
+            }
+
+            return jobs.toArray( new Job[jobs.size()] );
+        }
+    }
+
+
+    @Override
+    protected Control createDialogArea( Composite parent )
+    {
+        // Create Controls
+        Composite container = ( Composite ) super.createDialogArea( parent );
+        Composite composite = new Composite( container, SWT.NONE );
+
+        new Label( composite, SWT.NONE ).setText( selectionLabel );
+
+        ContentProposalAdapter proposalAdapter = null;
+        Text txtSelection = null;
+
+        Table table = null;
+        if ( multi )
+        {
+            table = new Table( composite, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER );
+            viewer = new TableViewer( table );
+            viewer.setContentProvider( new ArrayContentProvider() );
+            viewer.addFilter( new ViewerFilter()
+            {
+                public boolean select( Viewer viewer, Object parentElement, Object element )
+                {
+                    @SuppressWarnings("unchecked")
+                    E castedElement = ( E ) element;
+                    return filter == null || filter.select( castedElement );
+                }
+            } );
+            if ( comparator != null )
+            {
+                viewer.setSorter( new ViewerSorter()
+                {
+                    @Override
+                    public int compare( Viewer viewer, Object o1, Object o2 )
+                    {
+                        @SuppressWarnings("unchecked")
+                        E e1 = ( E ) o1;
+                        @SuppressWarnings("unchecked")
+                        E e2 = ( E ) o2;
+                        return comparator.compare( e1, e2 );
+                    }
+                } );
+            }
+            synchronized ( elements )
+            {
+                viewer.setInput( elements );
+            }
+
+            if ( labelProvider != null )
+            {
+                viewer.setLabelProvider( labelProvider );
+            }
+        }
+        else
+        {
+            txtSelection = new Text( composite, SWT.BORDER );
+            ControlDecoration selectionDecor = new ControlDecoration( txtSelection, SWT.LEFT | SWT.TOP );
+            FieldDecoration proposalDecor = FieldDecorationRegistry.getDefault().getFieldDecoration(
+                FieldDecorationRegistry.DEC_CONTENT_PROPOSAL );
+            selectionDecor.setImage( proposalDecor.getImage() );
+            selectionDecor.setDescriptionText( proposalDecor.getDescription() );
+
+            ExclusionContentProposalProvider<E> proposalProvider = new ExclusionContentProposalProvider<E>( elements,
+                filter, descriptor );
+
+            proposalAdapter = new ContentProposalAdapter( txtSelection, new TextContentAdapter(), proposalProvider,
+                null, null );
+            proposalAdapter.setProposalAcceptanceStyle( ContentProposalAdapter.PROPOSAL_REPLACE );
+            if ( labelProvider != null )
+            {
+                proposalAdapter.setLabelProvider( labelProvider );
+            }
+
+            if ( selectedName != null )
+            {
+                txtSelection.setText( selectedName );
+            }
+        }
+        updateSelection();
+        updateButtons();
+
+        // Hookup listeners
+        if ( proposalAdapter != null )
+        {
+            proposalAdapter.addContentProposalListener( new IContentProposalListener()
+            {
+                public void proposalAccepted( IContentProposal proposal )
+                {
+                    @SuppressWarnings("unchecked")
+                    WrappedContentProposal<E> valueProposal = ( WrappedContentProposal<E> ) proposal;
+                    E selected = valueProposal.getElement();
+                    selection = new ArrayList<E>( 1 );
+                    selection.add( selected );
+
+                    elementSelected( selected );
+
+                    updateButtons();
+                }
+            } );
+        }
+        if ( txtSelection != null )
+        {
+            txtSelection.addModifyListener( new ModifyListener()
+            {
+                public void modifyText( ModifyEvent e )
+                {
+                    selectedName = ( ( Text ) e.widget ).getText();
+                    updateButtons();
+                }
+            } );
+        }
+        if ( viewer != null )
+        {
+            viewer.addSelectionChangedListener( new ISelectionChangedListener()
+            {
+                public void selectionChanged( SelectionChangedEvent event )
+                {
+                    IStructuredSelection sel = ( IStructuredSelection ) event.getSelection();
+                    selection = new ArrayList<E>( sel.size() );
+                    for ( Iterator<?> iter = sel.iterator(); iter.hasNext(); )
+                    {
+                        @SuppressWarnings("unchecked")
+                        E element = ( E ) iter.next();
+                        selection.add( element );
+                    }
+                    updateButtons();
+                }
+            } );
+            viewer.addOpenListener( new IOpenListener()
+            {
+                public void open( OpenEvent event )
+                {
+                    if ( canComplete() )
+                    {
+                        setReturnCode( IDialogConstants.OK_ID );
+                        close();
+                    }
+                }
+            } );
+        }
+
+        // Layout
+        composite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
+        if ( multi )
+        {
+            composite.setLayout( new GridLayout( 1, false ) );
+            GridData layoutTable = new GridData( SWT.FILL, SWT.FILL, true, true );
+            layoutTable.heightHint = 200;
+            table.setLayoutData( layoutTable );
+        }
+        else
+        {
+            composite.setLayout( new GridLayout( 2, false ) );
+            txtSelection.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
+        }
+
+        return container;
+    }
+
+
+    protected void elementSelected( E selection )
+    {
+    }
+
+
+    @Override
+    protected Control createButtonBar( Composite parent )
+    {
+        Control bar = super.createButtonBar( parent );
+        updateButtons();
+        return bar;
+    }
+
+
+    /**
+     * Can be called from any thread
+     */
+    protected final void updateButtons()
+    {
+        Runnable updateButtonsRunnable = new Runnable()
+        {
+            public void run()
+            {
+                Shell shell = getShell();
+                if ( shell != null && !shell.isDisposed() )
+                {
+                    Button okButton = getButton( IDialogConstants.OK_ID );
+                    if ( okButton != null && !okButton.isDisposed() )
+                    {
+                        okButton.setEnabled( canComplete() );
+                    }
+                }
+            }
+        };
+        Shell shell = getShell();
+        if ( shell != null )
+        {
+            onUIThread( shell, updateButtonsRunnable );
+        }
+    }
+
+
+    /**
+     * Subclasses may override but must call super.canComplete
+     * @return
+     */
+    protected synchronized boolean canComplete()
+    {
+        boolean result = false;
+
+        if ( selection != null )
+        {
+            if ( multi )
+            {
+                result = selection.size() > 0;
+            }
+            else
+            {
+                E sel = getSelectedElement();
+                result = sel != null && descriptor.getName( sel ).equals( selectedName );
+            }
+        }
+
+        return result;
+    }
+
+
+    public final void addElement( E added )
+    {
+        addElements( Collections.singleton( added ) );
+    }
+
+
+    /**
+     * Can be called from any thread
+     */
+    public final void addElements( Collection<? extends E> added )
+    {
+        final LinkedList<E> toAdd = new LinkedList<E>();
+        synchronized ( elements )
+        {
+            for ( E e : added )
+            {
+                if ( !elements.contains( e ) )
+                {
+                    elements.add( e );
+                    toAdd.add( e );
+                }
+            }
+            Collections.sort( elements, comparator );
+        }
+        if ( viewer != null )
+        {
+            onUIThread( viewer.getControl(), new Runnable()
+            {
+                public void run()
+                {
+                    if ( !viewer.getControl().isDisposed() )
+                    {
+                        viewer.add( toAdd.toArray() );
+                        viewer.refresh();
+                    }
+                }
+            } );
+        }
+        else
+        {
+
+        }
+        updateSelection();
+        updateButtons();
+    }
+
+
+    protected void updateSelection()
+    {
+        onUIThread( getShell(), new Runnable()
+        {
+            public void run()
+            {
+                if ( selectedName != null )
+                {
+                    ArrayList<E> newSelection = new ArrayList<E>();
+                    synchronized ( elements )
+                    {
+                        for ( E e : elements )
+                        {
+                            if ( selectedName.equals( descriptor.getName( e ) ) )
+                            {
+                                newSelection.add( e );
+                                break;
+                            }
+                        }
+                    }
+                    selection = newSelection;
+                }
+                else
+                {
+                    selection = Collections.emptyList();
+                }
+                if ( viewer != null && !viewer.getControl().isDisposed() )
+                {
+                    viewer.setSelection( selection.isEmpty() ? StructuredSelection.EMPTY : new StructuredSelection(
+                        selection ) );
+                }
+            }
+        } );
+    }
+
+
+    private static final void onUIThread( Control control, Runnable r )
+    {
+        if ( control != null && !control.isDisposed() )
+        {
+            try
+            {
+                Display display = control.getDisplay();
+                if ( Thread.currentThread() == display.getThread() )
+                {
+                    // We are on the UI thread already, just do the work
+                    r.run();
+                }
+                else
+                {
+                    // Not on the UI thread, need to bung over the runnable
+                    display.asyncExec( r );
+                }
+            }
+            catch ( SWTError e )
+            {
+                if ( e.code == SWT.ERROR_WIDGET_DISPOSED )
+                {
+                    // ignore
+                }
+                else
+                {
+                    throw e;
+                }
+            }
+        }
+    }
+
+
+    public String getSelectedName()
+    {
+        return selectedName;
+    }
+
+
+    public void setSelectedName( String selectedName )
+    {
+        this.selectedName = selectedName;
+        boolean change = false;
+        if ( selectedName == null )
+        {
+            if ( selection != null && !selection.isEmpty() )
+            {
+                change = true;
+            }
+        }
+        else
+        {
+            if ( selection == null )
+            {
+                change = true;
+            }
+            else if ( selection.size() != 1 || !descriptor.getLabel( selection.get( 0 ) ).equals( selectedName ) )
+            {
+                change = true;
+            }
+        }
+
+        if ( change )
+        {
+            updateSelection();
+            updateButtons();
+        }
+    }
+
+
+    public List<E> getSelectedElements()
+    {
+        return selection;
+    }
+
+
+    public E getSelectedElement()
+    {
+        E result;
+        if ( selection == null || selection.isEmpty() )
+        {
+            result = null;
+        }
+        else
+        {
+            result = selection.get( 0 );
+        }
+        return result;
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ColumnModelLabelProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ColumnModelLabelProvider.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ColumnModelLabelProvider.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ColumnModelLabelProvider.java Tue Jul 21 18:51:33 2009
@@ -19,21 +19,28 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.util;
 
+
 import org.eclipse.jface.viewers.ColumnLabelProvider;
 import org.eclipse.swt.graphics.Image;
 
-public class ColumnModelLabelProvider extends ColumnLabelProvider {
 
-	private ModelLabelProvider provider = new ModelLabelProvider();
-	
-	@Override
-	public Image getImage(Object element) {
-		return provider.getImage(element);
-	}
-
-	@Override
-	public String getText(Object element) {
-		return provider.getText(element);
-	}
+public class ColumnModelLabelProvider extends ColumnLabelProvider
+{
+
+    private ModelLabelProvider provider = new ModelLabelProvider();
+
+
+    @Override
+    public Image getImage( Object element )
+    {
+        return provider.getImage( element );
+    }
+
+
+    @Override
+    public String getText( Object element )
+    {
+        return provider.getText( element );
+    }
 
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/DefaultContentProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/DefaultContentProvider.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/DefaultContentProvider.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/DefaultContentProvider.java Tue Jul 21 18:51:33 2009
@@ -19,14 +19,20 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.util;
 
+
 import org.eclipse.jface.viewers.IContentProvider;
 import org.eclipse.jface.viewers.Viewer;
 
-public class DefaultContentProvider implements IContentProvider {
 
-	public void dispose() {
-	}
+public class DefaultContentProvider implements IContentProvider
+{
+
+    public void dispose()
+    {
+    }
+
 
-	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-	}
+    public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+    {
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/DefaultLabelProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/DefaultLabelProvider.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/DefaultLabelProvider.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/DefaultLabelProvider.java Tue Jul 21 18:51:33 2009
@@ -19,23 +19,33 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.util;
 
+
 import org.eclipse.jface.viewers.IBaseLabelProvider;
 import org.eclipse.jface.viewers.ILabelProvider;
 import org.eclipse.jface.viewers.ILabelProviderListener;
 
-public abstract class DefaultLabelProvider implements IBaseLabelProvider, ILabelProvider {
 
-	public boolean isLabelProperty(Object element, String property) {
-		return false;
-	}
+public abstract class DefaultLabelProvider implements IBaseLabelProvider, ILabelProvider
+{
+
+    public boolean isLabelProperty( Object element, String property )
+    {
+        return false;
+    }
+
+
+    public void dispose()
+    {
+    }
+
 
-	public void dispose() {
-	}
+    public void addListener( ILabelProviderListener listener )
+    {
+    }
 
-	public void addListener(ILabelProviderListener listener) {
-	}
 
-	public void removeListener(ILabelProviderListener listener) {
-	}
+    public void removeListener( ILabelProviderListener listener )
+    {
+    }
 
 }
\ No newline at end of file

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/DefaultTableProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/DefaultTableProvider.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/DefaultTableProvider.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/DefaultTableProvider.java Tue Jul 21 18:51:33 2009
@@ -19,37 +19,46 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.util;
 
+
 import java.util.Collection;
 
 import org.eclipse.jface.viewers.IStructuredContentProvider;
 
-public abstract class DefaultTableProvider extends DefaultContentProvider implements IStructuredContentProvider {
 
-	/**
-	 * Utility method to convert the input element to an Object[].
-	 * 
-	 * @param inputElement
-	 * 
-	 * @return if inputElement is null -> empty array <br/>
-	 *         if inputElement is a {@link Collection} returns {@link Collection#toArray()}<br/>
-	 *         if inputElement is an Array class cast of inputElement to Object[]<br/>
-	 *  
-	 * @throws IllegalArgumentException if the element cannot be converted. 
-	 */
-	public Object[] toArray(Object inputElement) {
-		if ( inputElement == null ) {
-			return new Object[] {};
-		}
-		else if ( inputElement instanceof Collection ) {
-			Collection<?> col = (Collection<?>) inputElement;
-			return col.toArray();
-		}
-		else if ( inputElement.getClass().isArray() ) {
-			return (Object[]) inputElement;
-		}
-		else {
-			throw new IllegalArgumentException( "Invalid inputElement " + inputElement.getClass() );
-		}		
-	}
-	
+public abstract class DefaultTableProvider extends DefaultContentProvider implements IStructuredContentProvider
+{
+
+    /**
+     * Utility method to convert the input element to an Object[].
+     * 
+     * @param inputElement
+     * 
+     * @return if inputElement is null -> empty array <br/>
+     *         if inputElement is a {@link Collection} returns {@link Collection#toArray()}<br/>
+     *         if inputElement is an Array class cast of inputElement to Object[]<br/>
+     *  
+     * @throws IllegalArgumentException if the element cannot be converted. 
+     */
+    public Object[] toArray( Object inputElement )
+    {
+        if ( inputElement == null )
+        {
+            return new Object[]
+                {};
+        }
+        else if ( inputElement instanceof Collection )
+        {
+            Collection<?> col = ( Collection<?> ) inputElement;
+            return col.toArray();
+        }
+        else if ( inputElement.getClass().isArray() )
+        {
+            return ( Object[] ) inputElement;
+        }
+        else
+        {
+            throw new IllegalArgumentException( "Invalid inputElement " + inputElement.getClass() );
+        }
+    }
+
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/DefaultTreeContentProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/DefaultTreeContentProvider.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/DefaultTreeContentProvider.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/DefaultTreeContentProvider.java Tue Jul 21 18:51:33 2009
@@ -19,7 +19,10 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.util;
 
+
 import org.eclipse.jface.viewers.ITreeContentProvider;
 
-public abstract class DefaultTreeContentProvider extends DefaultContentProvider implements ITreeContentProvider {
+
+public abstract class DefaultTreeContentProvider extends DefaultContentProvider implements ITreeContentProvider
+{
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ExclusionContentProposalProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ExclusionContentProposalProvider.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ExclusionContentProposalProvider.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ExclusionContentProposalProvider.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.util;
 
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
@@ -31,43 +32,54 @@
 import org.eclipse.jface.fieldassist.IContentProposal;
 import org.eclipse.jface.fieldassist.IContentProposalProvider;
 
-public class ExclusionContentProposalProvider<T> implements
-		IContentProposalProvider {
-	
-	private final Collection<? extends T> elements;
-	private final IFilter<? super T> filter;
-	private final IElementDescriptor<? super T> descriptor;
-
-	public ExclusionContentProposalProvider(Collection<? extends T> elements, IFilter<? super T> filter, IElementDescriptor<? super T> descriptor) {
-		this.elements = elements;
-		this.filter = filter;
-		this.descriptor = descriptor;
-	}
-	
-	public IContentProposal[] getProposals(String contents, int position) {
-		String matchString = contents.substring(0, position);
-		Pattern pattern = GlobCompiler.compile(matchString);
-
-		// Get a snapshot of the elements
-		T[] elementArray;
-		synchronized (elements) {
-			@SuppressWarnings("unchecked") T[] temp = (T[]) elements.toArray();
-			elementArray = temp;
-		}
-		
-		List<IContentProposal> result = new ArrayList<IContentProposal>();
-		
-		for (T element : elementArray) {
-			if(filter != null && filter.select(element)) {
-				IContentProposal proposal = WrappedContentProposal.newInstance(element, descriptor);
-				Matcher matcher = pattern.matcher(proposal.getContent());
-				if(matcher.find()) {
-					result.add(proposal);
-				}
-			}
-		}
-		
-		return result.toArray(new IContentProposal[result.size()]);
-	}
+
+public class ExclusionContentProposalProvider<T> implements IContentProposalProvider
+{
+
+    private final Collection<? extends T> elements;
+    private final IFilter<? super T> filter;
+    private final IElementDescriptor<? super T> descriptor;
+
+
+    public ExclusionContentProposalProvider( Collection<? extends T> elements, IFilter<? super T> filter,
+        IElementDescriptor<? super T> descriptor )
+    {
+        this.elements = elements;
+        this.filter = filter;
+        this.descriptor = descriptor;
+    }
+
+
+    public IContentProposal[] getProposals( String contents, int position )
+    {
+        String matchString = contents.substring( 0, position );
+        Pattern pattern = GlobCompiler.compile( matchString );
+
+        // Get a snapshot of the elements
+        T[] elementArray;
+        synchronized ( elements )
+        {
+            @SuppressWarnings("unchecked")
+            T[] temp = ( T[] ) elements.toArray();
+            elementArray = temp;
+        }
+
+        List<IContentProposal> result = new ArrayList<IContentProposal>();
+
+        for ( T element : elementArray )
+        {
+            if ( filter != null && filter.select( element ) )
+            {
+                IContentProposal proposal = WrappedContentProposal.newInstance( element, descriptor );
+                Matcher matcher = pattern.matcher( proposal.getContent() );
+                if ( matcher.find() )
+                {
+                    result.add( proposal );
+                }
+            }
+        }
+
+        return result.toArray( new IContentProposal[result.size()] );
+    }
 
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ExportedPackageFinder.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ExportedPackageFinder.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ExportedPackageFinder.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ExportedPackageFinder.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.util;
 
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -32,37 +33,48 @@
 import org.eclipse.core.runtime.Status;
 import org.eclipse.ui.progress.IJobRunnable;
 
-public class ExportedPackageFinder implements IJobRunnable {
-	
-	private final IAccumulator<? super IPackageExport> accumulator;
-	private final ISigilProjectModel sigil;
-
-	public ExportedPackageFinder(ISigilProjectModel sigil, IAccumulator<? super IPackageExport> accumulator) {
-		this.sigil = sigil;
-		this.accumulator = accumulator;
-	}
-
-	public IStatus run(final IProgressMonitor monitor) {
-		final List<IPackageExport> exports = new ArrayList<IPackageExport>(ResourcesDialogHelper.UPDATE_BATCH_SIZE);
-		final IModelWalker walker = new IModelWalker() {
-			public boolean visit(IModelElement element) {
-				if ( element instanceof IPackageExport ) {
-					IPackageExport pkgExport = (IPackageExport) element;
-					exports.add(pkgExport);
-
-					if(exports.size() >= ResourcesDialogHelper.UPDATE_BATCH_SIZE) {
-						accumulator.addElements(exports);
-						exports.clear();
-					}
-				}
-				return !monitor.isCanceled();
-			}
-		};
-		SigilCore.getRepositoryManager(sigil).visit(walker);
-		if(exports.size() > 0) {
-			accumulator.addElements(exports);
-		}
 
-		return Status.OK_STATUS;
-	}
+public class ExportedPackageFinder implements IJobRunnable
+{
+
+    private final IAccumulator<? super IPackageExport> accumulator;
+    private final ISigilProjectModel sigil;
+
+
+    public ExportedPackageFinder( ISigilProjectModel sigil, IAccumulator<? super IPackageExport> accumulator )
+    {
+        this.sigil = sigil;
+        this.accumulator = accumulator;
+    }
+
+
+    public IStatus run( final IProgressMonitor monitor )
+    {
+        final List<IPackageExport> exports = new ArrayList<IPackageExport>( ResourcesDialogHelper.UPDATE_BATCH_SIZE );
+        final IModelWalker walker = new IModelWalker()
+        {
+            public boolean visit( IModelElement element )
+            {
+                if ( element instanceof IPackageExport )
+                {
+                    IPackageExport pkgExport = ( IPackageExport ) element;
+                    exports.add( pkgExport );
+
+                    if ( exports.size() >= ResourcesDialogHelper.UPDATE_BATCH_SIZE )
+                    {
+                        accumulator.addElements( exports );
+                        exports.clear();
+                    }
+                }
+                return !monitor.isCanceled();
+            }
+        };
+        SigilCore.getRepositoryManager( sigil ).visit( walker );
+        if ( exports.size() > 0 )
+        {
+            accumulator.addElements( exports );
+        }
+
+        return Status.OK_STATUS;
+    }
 }
\ No newline at end of file

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/FileUtils.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/FileUtils.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/FileUtils.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/FileUtils.java Tue Jul 21 18:51:33 2009
@@ -17,32 +17,40 @@
  * under the License.
  */
 
-package org.apache.felix.sigil.ui.eclipse.ui.util;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-public class FileUtils {
-	public static void loadFile( Shell shell, Text text, String msg, boolean isDirectory ) {
-		if ( isDirectory ) {
-			DirectoryDialog dialog = new DirectoryDialog(shell, SWT.NONE);
-			dialog.setMessage(msg);
-			String value = dialog.open();
-			if ( value != null ) {
-				text.setText( value );
-			}
-		}
-		else {
-			FileDialog dialog = new FileDialog(shell, SWT.NONE);
-			dialog.setText(msg);
-			String value = dialog.open();
-			if ( value != null ) {
-				text.setText( value );
-			}
-		}
-	}
-
-}
+package org.apache.felix.sigil.ui.eclipse.ui.util;
+
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+
+public class FileUtils
+{
+    public static void loadFile( Shell shell, Text text, String msg, boolean isDirectory )
+    {
+        if ( isDirectory )
+        {
+            DirectoryDialog dialog = new DirectoryDialog( shell, SWT.NONE );
+            dialog.setMessage( msg );
+            String value = dialog.open();
+            if ( value != null )
+            {
+                text.setText( value );
+            }
+        }
+        else
+        {
+            FileDialog dialog = new FileDialog( shell, SWT.NONE );
+            dialog.setText( msg );
+            String value = dialog.open();
+            if ( value != null )
+            {
+                text.setText( value );
+            }
+        }
+    }
+
+}

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IAccumulator.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IAccumulator.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IAccumulator.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IAccumulator.java Tue Jul 21 18:51:33 2009
@@ -19,9 +19,14 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.util;
 
+
 import java.util.Collection;
 
-public interface IAccumulator<E> {
-	public void addElement(E element);
-	public void addElements(Collection<? extends E> elements);
+
+public interface IAccumulator<E>
+{
+    public void addElement( E element );
+
+
+    public void addElements( Collection<? extends E> elements );
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IExportToImportConverter.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IExportToImportConverter.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IExportToImportConverter.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IExportToImportConverter.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,8 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.util;
 
-public interface IExportToImportConverter<E,I> {
-	I convert(E exportElement);
+
+public interface IExportToImportConverter<E, I>
+{
+    I convert( E exportElement );
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IFilter.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IFilter.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IFilter.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IFilter.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,8 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.util;
 
-public interface IFilter<T> {
-	boolean select(T element);
+
+public interface IFilter<T>
+{
+    boolean select( T element );
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IValidationListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IValidationListener.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IValidationListener.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IValidationListener.java Tue Jul 21 18:51:33 2009
@@ -19,8 +19,10 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.util;
 
-public interface IValidationListener {
 
-	void validationMessage(String message, int level);
+public interface IValidationListener
+{
+
+    void validationMessage( String message, int level );
 
 }