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 [23/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/views/resolution/BundleGraphLabelProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/BundleGraphLabelProvider.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/BundleGraphLabelProvider.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/BundleGraphLabelProvider.java Tue Jul 21 18:51:33 2009
@@ -19,57 +19,76 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.views.resolution;
 
+
 import org.apache.felix.sigil.model.eclipse.ISigilBundle;
 import org.apache.felix.sigil.ui.eclipse.ui.SigilUI;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.swt.graphics.Image;
 
-public class BundleGraphLabelProvider extends LabelProvider {
 
-	private BundleResolverView view;
-	
-	public BundleGraphLabelProvider(BundleResolverView view) {
-		this.view = view;
-	}
-
-	@Override
-	public String getText(Object element) {
-		if ( element instanceof Link ) {
-			Link l = (Link) element;
-			if ( l.isSatisfied() ) {
-				if ( view.isDisplayed(BundleResolverView.LINK_LABELS) ) {
-					return view.getLinkText((Link) element);
-				}
-				else {
-					return "";
-				}
-			}
-			else {
-				return view.getLinkText((Link) element);				
-			}
-		}
-		else if ( element instanceof ISigilBundle ) {
-			ISigilBundle b = (ISigilBundle) element;
-			return b.getBundleInfo().getSymbolicName() + ": " + b.getBundleInfo().getVersion();
-		}
-		else if ( element instanceof Link.Unsatisfied ) {
-			return "unsatisfied";
-		}
-		else {
-			return "unknown:" + element;
-		}
-	}
-	
-	@Override
-	public Image getImage(Object element) {
-		Image result = null;
-		if ( element instanceof ISigilBundle ) {
-			result = SigilUI.cacheImage("icons/jar_obj.png", BundleGraphLabelProvider.class.getClassLoader());
-		}
-		else if ( element instanceof Link.Unsatisfied ) {
-			result = SigilUI.cacheImage("icons/error.gif", BundleGraphLabelProvider.class.getClassLoader());
-		}
-		
-		return result;
-	}	
+public class BundleGraphLabelProvider extends LabelProvider
+{
+
+    private BundleResolverView view;
+
+
+    public BundleGraphLabelProvider( BundleResolverView view )
+    {
+        this.view = view;
+    }
+
+
+    @Override
+    public String getText( Object element )
+    {
+        if ( element instanceof Link )
+        {
+            Link l = ( Link ) element;
+            if ( l.isSatisfied() )
+            {
+                if ( view.isDisplayed( BundleResolverView.LINK_LABELS ) )
+                {
+                    return view.getLinkText( ( Link ) element );
+                }
+                else
+                {
+                    return "";
+                }
+            }
+            else
+            {
+                return view.getLinkText( ( Link ) element );
+            }
+        }
+        else if ( element instanceof ISigilBundle )
+        {
+            ISigilBundle b = ( ISigilBundle ) element;
+            return b.getBundleInfo().getSymbolicName() + ": " + b.getBundleInfo().getVersion();
+        }
+        else if ( element instanceof Link.Unsatisfied )
+        {
+            return "unsatisfied";
+        }
+        else
+        {
+            return "unknown:" + element;
+        }
+    }
+
+
+    @Override
+    public Image getImage( Object element )
+    {
+        Image result = null;
+        if ( element instanceof ISigilBundle )
+        {
+            result = SigilUI.cacheImage( "icons/jar_obj.png", BundleGraphLabelProvider.class.getClassLoader() );
+        }
+        else if ( element instanceof Link.Unsatisfied )
+        {
+            result = SigilUI.cacheImage( "icons/error.gif", BundleGraphLabelProvider.class.getClassLoader() );
+        }
+
+        return result;
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/BundleGraphViewFilter.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/BundleGraphViewFilter.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/BundleGraphViewFilter.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/BundleGraphViewFilter.java Tue Jul 21 18:51:33 2009
@@ -19,52 +19,69 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.views.resolution;
 
+
 import org.apache.felix.sigil.model.eclipse.ISigilBundle;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerFilter;
 
-public class BundleGraphViewFilter extends ViewerFilter {
 
-	private BundleResolverView view;
-	
-	public BundleGraphViewFilter(BundleResolverView view) {
-		this.view = view;
-	}
-
-	@Override
-	public boolean select(Viewer viewer, Object parentElement, Object element) {
-		if ( !view.isDisplayed(BundleResolverView.LOCAL_LINKS) ) {
-			if ( element instanceof Link ) {
-				Link l = (Link) element;
-				return l.getSource() != l.getTarget();
-			}
-		}
-		if ( !view.isDisplayed(BundleResolverView.SATISFIED) ) {
-			if ( element instanceof Link ) {
-				Link l = (Link) element;
-				return !l.isSatisfied();
-			}
-			else if ( element instanceof ISigilBundle ) {
-				ISigilBundle bundle = (ISigilBundle) element;
-				for ( Link l : view.getBundlegraph().getLinks(bundle)) {
-					if ( !l.isSatisfied() ) {
-						return true;
-					}
-				}
-				return false;
-			}
-		}
-		
-		if ( !view.isDisplayed(BundleResolverView.UNSATISFIED) ) {
-			if ( element instanceof Link ) {
-				Link l = (Link) element;
-				return l.isSatisfied();
-			}
-			else if ( element instanceof Link.Unsatisfied ) {
-				return false;
-			}
-		}
-		return true;
-	}
+public class BundleGraphViewFilter extends ViewerFilter
+{
+
+    private BundleResolverView view;
+
+
+    public BundleGraphViewFilter( BundleResolverView view )
+    {
+        this.view = view;
+    }
+
+
+    @Override
+    public boolean select( Viewer viewer, Object parentElement, Object element )
+    {
+        if ( !view.isDisplayed( BundleResolverView.LOCAL_LINKS ) )
+        {
+            if ( element instanceof Link )
+            {
+                Link l = ( Link ) element;
+                return l.getSource() != l.getTarget();
+            }
+        }
+        if ( !view.isDisplayed( BundleResolverView.SATISFIED ) )
+        {
+            if ( element instanceof Link )
+            {
+                Link l = ( Link ) element;
+                return !l.isSatisfied();
+            }
+            else if ( element instanceof ISigilBundle )
+            {
+                ISigilBundle bundle = ( ISigilBundle ) element;
+                for ( Link l : view.getBundlegraph().getLinks( bundle ) )
+                {
+                    if ( !l.isSatisfied() )
+                    {
+                        return true;
+                    }
+                }
+                return false;
+            }
+        }
+
+        if ( !view.isDisplayed( BundleResolverView.UNSATISFIED ) )
+        {
+            if ( element instanceof Link )
+            {
+                Link l = ( Link ) element;
+                return l.isSatisfied();
+            }
+            else if ( element instanceof Link.Unsatisfied )
+            {
+                return false;
+            }
+        }
+        return true;
+    }
 
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/BundleResolverView.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/BundleResolverView.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/BundleResolverView.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/BundleResolverView.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.views.resolution;
 
+
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -59,264 +60,340 @@
 import org.eclipse.zest.layouts.algorithms.RadialLayoutAlgorithm;
 import org.eclipse.zest.layouts.algorithms.TreeLayoutAlgorithm;
 
-public class BundleResolverView extends ViewPart {
 
-	private static final String SHOW_LINK_LABELS = "Show link labels";
-	private static final String HIDE_LINK_LABELS = "Hide link labels";
-	private static final String SHOW_LOCAL_LINKS = "Show local links";
-	private static final String HIDE_LOCAL_LINKS = "Hide local links";
-	private static final String SHOW_DEPENDENTS = "Show dependents";
-	private static final String HIDE_DEPENDENTS = "Hide dependents";
-	private static final String SHOW_SATISFIED = "Show satisfied bundles";
-	private static final String HIDE_SATISFIED = "Hide satisfied bundles";
-	private static final String SHOW_UNSATISFIED = "Show unsatisfied bundles";
-	private static final String HIDE_UNSATISFIED = "Hide unsatisfied bundles";
-	private static final String SHOW_OPTIONAL = "Show optional dependencies";
-	private static final String HIDE_OPTIONAL = "Hide optional dependencies";
-	
-	public static final String LINK_LABELS = "link.labels";
-	public static final String LOCAL_LINKS = "local.links";
-	public static final String DEPENDENTS = "dependents";
-	public static final String SATISFIED = "satisified";
-	public static final String UNSATISFIED = "unsatisfied";
-	public static final String OPTIONAL = "optional";
-
-	private GraphViewer viewer;
-	private IModelElement current;
-	private Job job;
-	private int lastX;
-	private int lastY;	
-	
-	private Map<String, Boolean> displayed = new HashMap<String, Boolean>();
-		
-	private class ToggleDisplayAction extends Action {	
-		private String key;
-		private String showMsg;
-		private String hideMsg;
-
-		ToggleDisplayAction(String key, String showMsg, String hideMsg) {
-			this.key = key;
-			this.showMsg = showMsg;
-			this.hideMsg = hideMsg;
-			setText(BundleResolverView.this.isDisplayed(key) ? hideMsg : showMsg);
-		}
-		
-		@Override
-		public void run() {
-			BundleResolverView.this.setDisplayed( key, !BundleResolverView.this.isDisplayed(key) );
-			setText(BundleResolverView.this.isDisplayed(key) ? hideMsg : showMsg);
-		}
-	}
-	
-	public void setInput(final IModelElement element) {
-		if ( current == null || !current.equals(element) ) {
-			SigilCore.log( "Set input " + element );
-			current = element;
-			redraw();
-		}
-	}
-	
-	public void setDisplayed(String key, boolean b) {
-		displayed.put(key, b);
-		
-		if ( key == DEPENDENTS ) {
-			int style = LayoutStyles.NO_LAYOUT_NODE_RESIZING;
-			viewer.setLayoutAlgorithm( b ? new TreeLayoutAlgorithm(style) : new RadialLayoutAlgorithm(style));
-			redraw();
-		}
-		else if ( key == OPTIONAL ) {
-			redraw();
-		}
-		else if ( key == SATISFIED || key == UNSATISFIED ) {
-			viewer.refresh();
-		}
-	}
-
-	public boolean isDisplayed(String key) {
-		return displayed.get(key);
-	}
-
-	@Override
-	public void setFocus() {
-	}
-	
-	@Override
-    public void createPartControl( Composite parent ) {
-		init();
-		createViewer(parent);
-		createListeners();
-		createMenu();
-    }
-	
-	private void init() {
-		displayed.put(LINK_LABELS, false);
-		displayed.put(LOCAL_LINKS, false);
-		displayed.put(DEPENDENTS, false);
-		displayed.put(OPTIONAL, false);
-		displayed.put(SATISFIED, true);
-		displayed.put(UNSATISFIED, true);
-	}
-
-	public BundleGraph getBundlegraph() {
-		return (BundleGraph) viewer.getInput();
-	}
-
-	GraphViewer getGraphViewer() {
-		return viewer;
-	}
-
-	String getLinkText(Link link) {
-		StringBuffer buf = new StringBuffer();
-
-		for ( IModelElement e : link.getRequirements() ) {
-			if ( buf.length() > 0 ) {
-				buf.append( "\n" );
-			}
-			if ( e instanceof IPackageImport ) {
-				IPackageImport pi = (IPackageImport) e;
-				buf.append( "import " + pi.getPackageName() + " : " + pi.getVersions() + ": " + (pi.isOptional() ? "optional" : "mandatory" ) );
-			}
-			else if ( e instanceof IRequiredBundle ) {
-				IRequiredBundle rb = (IRequiredBundle) e;
-				buf.append( "required bundle " + rb.getSymbolicName() + " : " + rb.getVersions() + ": " + (rb.isOptional() ? "optional" : "mandatory" ) );
-			}
-		}
-		
-		return buf.toString();
-	}	
-
-	private synchronized void redraw() {
-		final IModelElement element = current;
-		if ( job != null ) {
-			job.cancel();
-		}
-		
-		job = new Job("Resolving " + current) {
-			@Override
-			protected IStatus run(IProgressMonitor progress) {
-				try {
-					resolve(element, progress);
-					return Status.OK_STATUS;
-				} catch (CoreException e) {
-					return e.getStatus();
-				}
-			}
-		};
-		job.schedule();
-	}
-
-	private void resolve(IModelElement element, IProgressMonitor progress) throws CoreException {
-		final BundleGraph graph = new BundleGraph();
-		
-		IResolutionMonitor monitor = new ResolutionMonitorAdapter(progress) {
-			@Override
-			public void startResolution(IModelElement requirement) {
-				graph.startResolution(requirement);
-			}
-
-			@Override
-			public void endResolution(IModelElement requirement, ISigilBundle provider) {
-				graph.endResolution(requirement, provider);
-			}
-		};
-
-		ISigilProjectModel project = findProject(element);
-		IRepositoryManager repository = SigilCore.getRepositoryManager(project);
-		
-		int options = ResolutionConfig.IGNORE_ERRORS;
-		
-		if ( isDisplayed(DEPENDENTS) ) {
-			options |= ResolutionConfig.INCLUDE_DEPENDENTS;
-		}
-		if ( isDisplayed(OPTIONAL) ) {
-			options |= ResolutionConfig.INCLUDE_OPTIONAL;
-		}
-		
-		ResolutionConfig config = new ResolutionConfig(options);
-		
-		try {
-			repository.getBundleResolver().resolve(element, config, monitor);
-		} catch (ResolutionException e) {
-			throw SigilCore.newCoreException("Failed to resolve " + element, e);
-		}
-		
-		SigilUI.runInUI( new Runnable() {
-			public void run() {
-				viewer.setInput(graph);
-				addCustomUIElements();
-			}			
-		} );
-	}
-
-	private static ISigilProjectModel findProject(IModelElement element) {
-		if ( element == null ) {
-			return null;
-		}
-		if ( element instanceof ISigilProjectModel ) {
-			return (ISigilProjectModel) element;
-		}
-		
-		return element.getAncestor(ISigilProjectModel.class);
-	}
-
-	@SuppressWarnings("unchecked")
-	private void addCustomUIElements() {
-		if ( !isDisplayed(LINK_LABELS) ) {
-			for ( GraphConnection c : (List<GraphConnection>) viewer.getGraphControl().getConnections() ) {
-				if ( c.getData() instanceof Link ) {
-					c.setTooltip(buildToolTip((Link) c.getData()));
-				}
-			}
-		}
-	}
-
-	private IFigure buildToolTip(Link link) {
-		Label l = new Label();
-		l.setText(getLinkText(link));
-		return l;
-	}
-
-	private void createViewer(Composite parent) {
-		parent.setLayout( new FillLayout() );
-    	viewer = new GraphViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL);
-    	IContentProvider contentProvider = new BundleGraphContentProvider();
-		viewer.setContentProvider(contentProvider);
-		viewer.setLabelProvider(new BundleGraphLabelProvider(this));
-		viewer.addFilter( new BundleGraphViewFilter(this) );
-		
-		
-		int style = LayoutStyles.NO_LAYOUT_NODE_RESIZING;
-		viewer.setLayoutAlgorithm( isDisplayed(DEPENDENTS) ? new TreeLayoutAlgorithm(style) : new RadialLayoutAlgorithm(style));
-		viewer.addSelectionChangedListener( new BundleConnectionHighlighter(this) );
-		viewer.setInput(new BundleGraph());
-	}
-
-	private void createMenu() {
-		IActionBars action = getViewSite().getActionBars(); 
-		action.getMenuManager().add(new ToggleDisplayAction( LINK_LABELS, SHOW_LINK_LABELS, HIDE_LINK_LABELS ));
-		action.getMenuManager().add(new ToggleDisplayAction( LOCAL_LINKS, SHOW_LOCAL_LINKS, HIDE_LOCAL_LINKS ));
-		action.getMenuManager().add(new ToggleDisplayAction( DEPENDENTS, SHOW_DEPENDENTS, HIDE_DEPENDENTS ));
-		action.getMenuManager().add(new ToggleDisplayAction( OPTIONAL, SHOW_OPTIONAL, HIDE_OPTIONAL ));
-		action.getMenuManager().add(new ToggleDisplayAction( SATISFIED, SHOW_SATISFIED, HIDE_SATISFIED ));
-		action.getMenuManager().add(new ToggleDisplayAction( UNSATISFIED, SHOW_UNSATISFIED, HIDE_UNSATISFIED ));
-		action.updateActionBars();
-	}
-
-	private void createListeners() {
-		IPartService ps = (IPartService) getViewSite().getService(IPartService.class);
-		ps.addPartListener( new EditorViewPartListener(this) );
-		viewer.getGraphControl().addControlListener( new ControlAdapter() {
-			@Override
-			public void controlResized(ControlEvent e) {
-				Graph g = (Graph) e.getSource();
-				int x = g.getSize().x;
-				int y = g.getSize().y;
-				if ( lastX != x || lastY != y ) {
-					lastX = x;
-					lastY = y;
-					redraw();
-				}
-			}
-		} );
-	}
+public class BundleResolverView extends ViewPart
+{
+
+    private static final String SHOW_LINK_LABELS = "Show link labels";
+    private static final String HIDE_LINK_LABELS = "Hide link labels";
+    private static final String SHOW_LOCAL_LINKS = "Show local links";
+    private static final String HIDE_LOCAL_LINKS = "Hide local links";
+    private static final String SHOW_DEPENDENTS = "Show dependents";
+    private static final String HIDE_DEPENDENTS = "Hide dependents";
+    private static final String SHOW_SATISFIED = "Show satisfied bundles";
+    private static final String HIDE_SATISFIED = "Hide satisfied bundles";
+    private static final String SHOW_UNSATISFIED = "Show unsatisfied bundles";
+    private static final String HIDE_UNSATISFIED = "Hide unsatisfied bundles";
+    private static final String SHOW_OPTIONAL = "Show optional dependencies";
+    private static final String HIDE_OPTIONAL = "Hide optional dependencies";
+
+    public static final String LINK_LABELS = "link.labels";
+    public static final String LOCAL_LINKS = "local.links";
+    public static final String DEPENDENTS = "dependents";
+    public static final String SATISFIED = "satisified";
+    public static final String UNSATISFIED = "unsatisfied";
+    public static final String OPTIONAL = "optional";
+
+    private GraphViewer viewer;
+    private IModelElement current;
+    private Job job;
+    private int lastX;
+    private int lastY;
+
+    private Map<String, Boolean> displayed = new HashMap<String, Boolean>();
+
+    private class ToggleDisplayAction extends Action
+    {
+        private String key;
+        private String showMsg;
+        private String hideMsg;
+
+
+        ToggleDisplayAction( String key, String showMsg, String hideMsg )
+        {
+            this.key = key;
+            this.showMsg = showMsg;
+            this.hideMsg = hideMsg;
+            setText( BundleResolverView.this.isDisplayed( key ) ? hideMsg : showMsg );
+        }
+
+
+        @Override
+        public void run()
+        {
+            BundleResolverView.this.setDisplayed( key, !BundleResolverView.this.isDisplayed( key ) );
+            setText( BundleResolverView.this.isDisplayed( key ) ? hideMsg : showMsg );
+        }
+    }
+
+
+    public void setInput( final IModelElement element )
+    {
+        if ( current == null || !current.equals( element ) )
+        {
+            SigilCore.log( "Set input " + element );
+            current = element;
+            redraw();
+        }
+    }
+
+
+    public void setDisplayed( String key, boolean b )
+    {
+        displayed.put( key, b );
+
+        if ( key == DEPENDENTS )
+        {
+            int style = LayoutStyles.NO_LAYOUT_NODE_RESIZING;
+            viewer.setLayoutAlgorithm( b ? new TreeLayoutAlgorithm( style ) : new RadialLayoutAlgorithm( style ) );
+            redraw();
+        }
+        else if ( key == OPTIONAL )
+        {
+            redraw();
+        }
+        else if ( key == SATISFIED || key == UNSATISFIED )
+        {
+            viewer.refresh();
+        }
+    }
+
+
+    public boolean isDisplayed( String key )
+    {
+        return displayed.get( key );
+    }
+
+
+    @Override
+    public void setFocus()
+    {
+    }
+
+
+    @Override
+    public void createPartControl( Composite parent )
+    {
+        init();
+        createViewer( parent );
+        createListeners();
+        createMenu();
+    }
+
+
+    private void init()
+    {
+        displayed.put( LINK_LABELS, false );
+        displayed.put( LOCAL_LINKS, false );
+        displayed.put( DEPENDENTS, false );
+        displayed.put( OPTIONAL, false );
+        displayed.put( SATISFIED, true );
+        displayed.put( UNSATISFIED, true );
+    }
+
+
+    public BundleGraph getBundlegraph()
+    {
+        return ( BundleGraph ) viewer.getInput();
+    }
+
+
+    GraphViewer getGraphViewer()
+    {
+        return viewer;
+    }
+
+
+    String getLinkText( Link link )
+    {
+        StringBuffer buf = new StringBuffer();
+
+        for ( IModelElement e : link.getRequirements() )
+        {
+            if ( buf.length() > 0 )
+            {
+                buf.append( "\n" );
+            }
+            if ( e instanceof IPackageImport )
+            {
+                IPackageImport pi = ( IPackageImport ) e;
+                buf.append( "import " + pi.getPackageName() + " : " + pi.getVersions() + ": "
+                    + ( pi.isOptional() ? "optional" : "mandatory" ) );
+            }
+            else if ( e instanceof IRequiredBundle )
+            {
+                IRequiredBundle rb = ( IRequiredBundle ) e;
+                buf.append( "required bundle " + rb.getSymbolicName() + " : " + rb.getVersions() + ": "
+                    + ( rb.isOptional() ? "optional" : "mandatory" ) );
+            }
+        }
+
+        return buf.toString();
+    }
+
+
+    private synchronized void redraw()
+    {
+        final IModelElement element = current;
+        if ( job != null )
+        {
+            job.cancel();
+        }
+
+        job = new Job( "Resolving " + current )
+        {
+            @Override
+            protected IStatus run( IProgressMonitor progress )
+            {
+                try
+                {
+                    resolve( element, progress );
+                    return Status.OK_STATUS;
+                }
+                catch ( CoreException e )
+                {
+                    return e.getStatus();
+                }
+            }
+        };
+        job.schedule();
+    }
+
+
+    private void resolve( IModelElement element, IProgressMonitor progress ) throws CoreException
+    {
+        final BundleGraph graph = new BundleGraph();
+
+        IResolutionMonitor monitor = new ResolutionMonitorAdapter( progress )
+        {
+            @Override
+            public void startResolution( IModelElement requirement )
+            {
+                graph.startResolution( requirement );
+            }
+
+
+            @Override
+            public void endResolution( IModelElement requirement, ISigilBundle provider )
+            {
+                graph.endResolution( requirement, provider );
+            }
+        };
+
+        ISigilProjectModel project = findProject( element );
+        IRepositoryManager repository = SigilCore.getRepositoryManager( project );
+
+        int options = ResolutionConfig.IGNORE_ERRORS;
+
+        if ( isDisplayed( DEPENDENTS ) )
+        {
+            options |= ResolutionConfig.INCLUDE_DEPENDENTS;
+        }
+        if ( isDisplayed( OPTIONAL ) )
+        {
+            options |= ResolutionConfig.INCLUDE_OPTIONAL;
+        }
+
+        ResolutionConfig config = new ResolutionConfig( options );
+
+        try
+        {
+            repository.getBundleResolver().resolve( element, config, monitor );
+        }
+        catch ( ResolutionException e )
+        {
+            throw SigilCore.newCoreException( "Failed to resolve " + element, e );
+        }
+
+        SigilUI.runInUI( new Runnable()
+        {
+            public void run()
+            {
+                viewer.setInput( graph );
+                addCustomUIElements();
+            }
+        } );
+    }
+
+
+    private static ISigilProjectModel findProject( IModelElement element )
+    {
+        if ( element == null )
+        {
+            return null;
+        }
+        if ( element instanceof ISigilProjectModel )
+        {
+            return ( ISigilProjectModel ) element;
+        }
+
+        return element.getAncestor( ISigilProjectModel.class );
+    }
+
+
+    @SuppressWarnings("unchecked")
+    private void addCustomUIElements()
+    {
+        if ( !isDisplayed( LINK_LABELS ) )
+        {
+            for ( GraphConnection c : ( List<GraphConnection> ) viewer.getGraphControl().getConnections() )
+            {
+                if ( c.getData() instanceof Link )
+                {
+                    c.setTooltip( buildToolTip( ( Link ) c.getData() ) );
+                }
+            }
+        }
+    }
+
+
+    private IFigure buildToolTip( Link link )
+    {
+        Label l = new Label();
+        l.setText( getLinkText( link ) );
+        return l;
+    }
+
+
+    private void createViewer( Composite parent )
+    {
+        parent.setLayout( new FillLayout() );
+        viewer = new GraphViewer( parent, SWT.H_SCROLL | SWT.V_SCROLL );
+        IContentProvider contentProvider = new BundleGraphContentProvider();
+        viewer.setContentProvider( contentProvider );
+        viewer.setLabelProvider( new BundleGraphLabelProvider( this ) );
+        viewer.addFilter( new BundleGraphViewFilter( this ) );
+
+        int style = LayoutStyles.NO_LAYOUT_NODE_RESIZING;
+        viewer.setLayoutAlgorithm( isDisplayed( DEPENDENTS ) ? new TreeLayoutAlgorithm( style )
+            : new RadialLayoutAlgorithm( style ) );
+        viewer.addSelectionChangedListener( new BundleConnectionHighlighter( this ) );
+        viewer.setInput( new BundleGraph() );
+    }
+
+
+    private void createMenu()
+    {
+        IActionBars action = getViewSite().getActionBars();
+        action.getMenuManager().add( new ToggleDisplayAction( LINK_LABELS, SHOW_LINK_LABELS, HIDE_LINK_LABELS ) );
+        action.getMenuManager().add( new ToggleDisplayAction( LOCAL_LINKS, SHOW_LOCAL_LINKS, HIDE_LOCAL_LINKS ) );
+        action.getMenuManager().add( new ToggleDisplayAction( DEPENDENTS, SHOW_DEPENDENTS, HIDE_DEPENDENTS ) );
+        action.getMenuManager().add( new ToggleDisplayAction( OPTIONAL, SHOW_OPTIONAL, HIDE_OPTIONAL ) );
+        action.getMenuManager().add( new ToggleDisplayAction( SATISFIED, SHOW_SATISFIED, HIDE_SATISFIED ) );
+        action.getMenuManager().add( new ToggleDisplayAction( UNSATISFIED, SHOW_UNSATISFIED, HIDE_UNSATISFIED ) );
+        action.updateActionBars();
+    }
+
+
+    private void createListeners()
+    {
+        IPartService ps = ( IPartService ) getViewSite().getService( IPartService.class );
+        ps.addPartListener( new EditorViewPartListener( this ) );
+        viewer.getGraphControl().addControlListener( new ControlAdapter()
+        {
+            @Override
+            public void controlResized( ControlEvent e )
+            {
+                Graph g = ( Graph ) e.getSource();
+                int x = g.getSize().x;
+                int y = g.getSize().y;
+                if ( lastX != x || lastY != y )
+                {
+                    lastX = x;
+                    lastY = y;
+                    redraw();
+                }
+            }
+        } );
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/EditorViewPartListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/EditorViewPartListener.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/EditorViewPartListener.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/EditorViewPartListener.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.views.resolution;
 
+
 import org.apache.felix.sigil.eclipse.SigilCore;
 import org.apache.felix.sigil.eclipse.model.project.ISigilProjectModel;
 import org.eclipse.core.resources.IProject;
@@ -29,64 +30,92 @@
 import org.eclipse.ui.IPartListener2;
 import org.eclipse.ui.IWorkbenchPartReference;
 
-public class EditorViewPartListener implements IPartListener2 {
 
-	private BundleResolverView bundleResolverView;
-	
-	public EditorViewPartListener(BundleResolverView bundleResolverView) {
-		this.bundleResolverView = bundleResolverView;
-	}
-
-	public void partActivated(IWorkbenchPartReference partRef) {
-		checkRef(partRef);
-	}
-
-	public void partBroughtToTop(IWorkbenchPartReference partRef) {
-		// no action
-	}
-
-	public void partClosed(IWorkbenchPartReference partRef) {
-		// no action
-	}
-
-	public void partDeactivated(IWorkbenchPartReference partRef) {
-		// no action
-	}
-
-	public void partHidden(IWorkbenchPartReference partRef) {
-		// no action
-	}
-
-	public void partInputChanged(IWorkbenchPartReference partRef) {
-		// no action
-	}
-
-	public void partOpened(IWorkbenchPartReference partRef) {
-		// no action
-	}
-
-	public void partVisible(IWorkbenchPartReference partRef) {
-		// no action
-	}
-
-	private void checkRef(IWorkbenchPartReference partRef) {
-		IEditorPart editor = partRef.getPage().getActiveEditor();
-		if ( editor != null ) {
-			IEditorInput input = editor.getEditorInput();
-			if ( input instanceof IFileEditorInput ) {
-				IFileEditorInput f = (IFileEditorInput) input;
-				IProject project = f.getFile().getProject();
-				try {
-					ISigilProjectModel model = SigilCore.create(project);
-					if ( model != null ) {
-						bundleResolverView.setInput(model);
-					}
-				} catch (CoreException e) {
-					// TODO Auto-generated catch block
-					e.printStackTrace();
-				}
-			}
-		}
-	}
+public class EditorViewPartListener implements IPartListener2
+{
+
+    private BundleResolverView bundleResolverView;
+
+
+    public EditorViewPartListener( BundleResolverView bundleResolverView )
+    {
+        this.bundleResolverView = bundleResolverView;
+    }
+
+
+    public void partActivated( IWorkbenchPartReference partRef )
+    {
+        checkRef( partRef );
+    }
+
+
+    public void partBroughtToTop( IWorkbenchPartReference partRef )
+    {
+        // no action
+    }
+
+
+    public void partClosed( IWorkbenchPartReference partRef )
+    {
+        // no action
+    }
+
+
+    public void partDeactivated( IWorkbenchPartReference partRef )
+    {
+        // no action
+    }
+
+
+    public void partHidden( IWorkbenchPartReference partRef )
+    {
+        // no action
+    }
+
+
+    public void partInputChanged( IWorkbenchPartReference partRef )
+    {
+        // no action
+    }
+
+
+    public void partOpened( IWorkbenchPartReference partRef )
+    {
+        // no action
+    }
+
+
+    public void partVisible( IWorkbenchPartReference partRef )
+    {
+        // no action
+    }
+
+
+    private void checkRef( IWorkbenchPartReference partRef )
+    {
+        IEditorPart editor = partRef.getPage().getActiveEditor();
+        if ( editor != null )
+        {
+            IEditorInput input = editor.getEditorInput();
+            if ( input instanceof IFileEditorInput )
+            {
+                IFileEditorInput f = ( IFileEditorInput ) input;
+                IProject project = f.getFile().getProject();
+                try
+                {
+                    ISigilProjectModel model = SigilCore.create( project );
+                    if ( model != null )
+                    {
+                        bundleResolverView.setInput( model );
+                    }
+                }
+                catch ( CoreException e )
+                {
+                    // TODO Auto-generated catch block
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
 
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/Link.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/Link.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/Link.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/views/resolution/Link.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.views.resolution;
 
+
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.LinkedList;
@@ -29,110 +30,154 @@
 import org.apache.felix.sigil.model.osgi.IPackageImport;
 import org.apache.felix.sigil.model.osgi.IRequiredBundle;
 
-public class Link {	
-	public static class Unsatisfied {
-
-	}
 
-	private ISigilBundle source;
-	private ISigilBundle target;
-	
-	private LinkedList<IModelElement> requirements = new LinkedList<IModelElement>();
-	private static final Comparator<IModelElement> comparator = new Comparator<IModelElement>() {
-
-		public int compare(IModelElement o1, IModelElement o2) {
-			if (o1 instanceof IRequiredBundle) {
-				if ( o2 instanceof IRequiredBundle) {
-					return compareBundles( (IRequiredBundle) o1, (IRequiredBundle) o2 );
-				}
-				else {
-					return -1;
-				}
-			}
-			else {
-				if ( o2 instanceof IRequiredBundle ) {
-					return 1;
-				}
-				else {
-					return compareNonBundles( o1, o2 );
-				}
-			}
-		}
-
-		private int compareNonBundles(IModelElement o1, IModelElement o2) {
-			if (o1 instanceof IPackageImport) {
-				if ( o2 instanceof IPackageImport) {
-					return compareImports( (IPackageImport) o1, (IPackageImport) o2 );
-				}
-				else {
-					return -1;
-				}
-			}
-			else {
-				if ( o2 instanceof IPackageImport ) {
-					return 1;
-				}
-				else {
-					return 0;
-				}
-			}
-		}
-
-		private int compareImports(IPackageImport o1, IPackageImport o2) {
-			return o1.getPackageName().compareTo( o2.getPackageName() );
-		}
-
-		private int compareBundles(IRequiredBundle o1, IRequiredBundle o2) {
-			return o1.getSymbolicName().compareTo( o2.getSymbolicName() );
-		}
-		
-	};
-	
-	public Link(ISigilBundle source, ISigilBundle target) {
-		this.source = source;
-		this.target = target;
-	}
-
-	public ISigilBundle getSource() {
-		return source;
-	}
-	
-	public ISigilBundle getTarget() {
-		return target;
-	}
-	
-	public boolean isSatisfied() {
-		return target != null;
-	}
-
-	public void addRequirement(IModelElement requirement) {
-		requirements.add(requirement);
-		Collections.sort(requirements, comparator);
-	}
-	
-	public String toString() {
-		return "Link[" + source + "->" + target + "]";
-	}
-
-	public List<IModelElement> getRequirements() {
-		return requirements;
-	}
-
-	public boolean isOptional() {
-		for ( IModelElement e : requirements ) {
-			if ( e instanceof IPackageImport ) {
-				IPackageImport pi = (IPackageImport) e;
-				if ( !pi.isOptional() ) {
-					return false;
-				}
-			}
-			else if ( e instanceof IRequiredBundle ) {
-				IRequiredBundle rb = (IRequiredBundle) e;
-				if ( !rb.isOptional() ) {
-					return false;
-				}
-			}
-		}
-		return true;
-	}
+public class Link
+{
+    public static class Unsatisfied
+    {
+
+    }
+
+    private ISigilBundle source;
+    private ISigilBundle target;
+
+    private LinkedList<IModelElement> requirements = new LinkedList<IModelElement>();
+    private static final Comparator<IModelElement> comparator = new Comparator<IModelElement>()
+    {
+
+        public int compare( IModelElement o1, IModelElement o2 )
+        {
+            if ( o1 instanceof IRequiredBundle )
+            {
+                if ( o2 instanceof IRequiredBundle )
+                {
+                    return compareBundles( ( IRequiredBundle ) o1, ( IRequiredBundle ) o2 );
+                }
+                else
+                {
+                    return -1;
+                }
+            }
+            else
+            {
+                if ( o2 instanceof IRequiredBundle )
+                {
+                    return 1;
+                }
+                else
+                {
+                    return compareNonBundles( o1, o2 );
+                }
+            }
+        }
+
+
+        private int compareNonBundles( IModelElement o1, IModelElement o2 )
+        {
+            if ( o1 instanceof IPackageImport )
+            {
+                if ( o2 instanceof IPackageImport )
+                {
+                    return compareImports( ( IPackageImport ) o1, ( IPackageImport ) o2 );
+                }
+                else
+                {
+                    return -1;
+                }
+            }
+            else
+            {
+                if ( o2 instanceof IPackageImport )
+                {
+                    return 1;
+                }
+                else
+                {
+                    return 0;
+                }
+            }
+        }
+
+
+        private int compareImports( IPackageImport o1, IPackageImport o2 )
+        {
+            return o1.getPackageName().compareTo( o2.getPackageName() );
+        }
+
+
+        private int compareBundles( IRequiredBundle o1, IRequiredBundle o2 )
+        {
+            return o1.getSymbolicName().compareTo( o2.getSymbolicName() );
+        }
+
+    };
+
+
+    public Link( ISigilBundle source, ISigilBundle target )
+    {
+        this.source = source;
+        this.target = target;
+    }
+
+
+    public ISigilBundle getSource()
+    {
+        return source;
+    }
+
+
+    public ISigilBundle getTarget()
+    {
+        return target;
+    }
+
+
+    public boolean isSatisfied()
+    {
+        return target != null;
+    }
+
+
+    public void addRequirement( IModelElement requirement )
+    {
+        requirements.add( requirement );
+        Collections.sort( requirements, comparator );
+    }
+
+
+    public String toString()
+    {
+        return "Link[" + source + "->" + target + "]";
+    }
+
+
+    public List<IModelElement> getRequirements()
+    {
+        return requirements;
+    }
+
+
+    public boolean isOptional()
+    {
+        for ( IModelElement e : requirements )
+        {
+            if ( e instanceof IPackageImport )
+            {
+                IPackageImport pi = ( IPackageImport ) e;
+                if ( !pi.isOptional() )
+                {
+                    return false;
+                }
+            }
+            else if ( e instanceof IRequiredBundle )
+            {
+                IRequiredBundle rb = ( IRequiredBundle ) e;
+                if ( !rb.isOptional() )
+                {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/SigilNewResourceWizard.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/SigilNewResourceWizard.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/SigilNewResourceWizard.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/SigilNewResourceWizard.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.wizard;
 
+
 import org.eclipse.core.resources.IFile;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.swt.widgets.Display;
@@ -29,28 +30,35 @@
 import org.eclipse.ui.ide.IDE;
 import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
 
+
 /**
  * @author dave
  *
  */
-public abstract class SigilNewResourceWizard extends BasicNewResourceWizard implements INewWizard {
+public abstract class SigilNewResourceWizard extends BasicNewResourceWizard implements INewWizard
+{
+
+    protected void selectRevealAndShow( IFile file )
+    {
+        selectAndReveal( file );
 
-    protected void selectRevealAndShow(IFile file) {
-        selectAndReveal(file);
-    
         // Open editor on new file.
         IWorkbenchWindow dw = getWorkbench().getActiveWorkbenchWindow();
-        try {
-            if (dw != null) {
+        try
+        {
+            if ( dw != null )
+            {
                 IWorkbenchPage page = dw.getActivePage();
-                if (page != null) {
-                    IDE.openEditor(page, file, true);
+                if ( page != null )
+                {
+                    IDE.openEditor( page, file, true );
                 }
             }
         }
-        catch (PartInitException e) {
-            MessageDialog.openError(Display.getCurrent().getActiveShell(), "Initialisation error",
-                    "Failed to open " + file);
+        catch ( PartInitException e )
+        {
+            MessageDialog.openError( Display.getCurrent().getActiveShell(), "Initialisation error", "Failed to open "
+                + file );
         }
     }
 

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/WorkspaceContentProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/WorkspaceContentProvider.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/WorkspaceContentProvider.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/WorkspaceContentProvider.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.wizard;
 
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -31,80 +32,115 @@
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.Viewer;
 
-public class WorkspaceContentProvider implements ITreeContentProvider {
-	
-	private final boolean includeNonSigil;
-	private final boolean includeClosed;
-
-	public WorkspaceContentProvider(boolean includeNonSigil, boolean includeClosed) {
-		this.includeNonSigil = includeNonSigil;
-		this.includeClosed = includeClosed;
-	}
-
-	public Object[] getChildren(Object parentElement) {
-		Object[] result = null;
-		
-		if(parentElement instanceof IWorkspace) {
-			IProject[] projects = ((IWorkspace) parentElement).getRoot().getProjects();
-			if(includeNonSigil && includeClosed) {
-				result = projects;
-			} else {
-				List<IProject> includedProjects = new ArrayList<IProject>(projects.length);
-				for (IProject project : projects) {
-					if(!includeClosed && !project.isOpen()) {
-						continue;
-					}
-					
-					if(!includeNonSigil) {
-						try {
-							if(project.getNature(SigilCore.NATURE_ID) == null) {
-								continue;
-							}
-						} catch (CoreException e) {
-							continue;
-						}
-					}
-					
-					includedProjects.add(project);
-				}
-				result = includedProjects.toArray(new IProject[includedProjects.size()]);
-			}
-		} else if(parentElement instanceof IContainer) {
-			try {
-				IResource[] members = ((IContainer) parentElement).members();
-				List<IResource> children = new ArrayList<IResource>(members.length);
-				for (int i = 0; i < members.length; i++) {
-				    if (members[i].getType() != IResource.FILE) {
-				        children.add(members[i]);
-				    }
-				}
-				result = children.toArray(new IResource[children.size()]);
-			} catch (CoreException e) {
-				// Shouldn't happen
-			}
-		}
-		
-		return result;
-	}
-
-	public Object getParent(Object element) {
-		if(element instanceof IResource) {
-			return ((IResource) element).getParent();
-		}
-		return null;
-	}
-
-	public boolean hasChildren(Object element) {
-		return (element instanceof IContainer) && ((IContainer) element).isAccessible();
-	}
-
-	public Object[] getElements(Object inputElement) {
-		return getChildren(inputElement);
-	}
 
-	public void dispose() {
-	}
+public class WorkspaceContentProvider implements ITreeContentProvider
+{
+
+    private final boolean includeNonSigil;
+    private final boolean includeClosed;
+
 
-	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-	}
+    public WorkspaceContentProvider( boolean includeNonSigil, boolean includeClosed )
+    {
+        this.includeNonSigil = includeNonSigil;
+        this.includeClosed = includeClosed;
+    }
+
+
+    public Object[] getChildren( Object parentElement )
+    {
+        Object[] result = null;
+
+        if ( parentElement instanceof IWorkspace )
+        {
+            IProject[] projects = ( ( IWorkspace ) parentElement ).getRoot().getProjects();
+            if ( includeNonSigil && includeClosed )
+            {
+                result = projects;
+            }
+            else
+            {
+                List<IProject> includedProjects = new ArrayList<IProject>( projects.length );
+                for ( IProject project : projects )
+                {
+                    if ( !includeClosed && !project.isOpen() )
+                    {
+                        continue;
+                    }
+
+                    if ( !includeNonSigil )
+                    {
+                        try
+                        {
+                            if ( project.getNature( SigilCore.NATURE_ID ) == null )
+                            {
+                                continue;
+                            }
+                        }
+                        catch ( CoreException e )
+                        {
+                            continue;
+                        }
+                    }
+
+                    includedProjects.add( project );
+                }
+                result = includedProjects.toArray( new IProject[includedProjects.size()] );
+            }
+        }
+        else if ( parentElement instanceof IContainer )
+        {
+            try
+            {
+                IResource[] members = ( ( IContainer ) parentElement ).members();
+                List<IResource> children = new ArrayList<IResource>( members.length );
+                for ( int i = 0; i < members.length; i++ )
+                {
+                    if ( members[i].getType() != IResource.FILE )
+                    {
+                        children.add( members[i] );
+                    }
+                }
+                result = children.toArray( new IResource[children.size()] );
+            }
+            catch ( CoreException e )
+            {
+                // Shouldn't happen
+            }
+        }
+
+        return result;
+    }
+
+
+    public Object getParent( Object element )
+    {
+        if ( element instanceof IResource )
+        {
+            return ( ( IResource ) element ).getParent();
+        }
+        return null;
+    }
+
+
+    public boolean hasChildren( Object element )
+    {
+        return ( element instanceof IContainer ) && ( ( IContainer ) element ).isAccessible();
+    }
+
+
+    public Object[] getElements( Object inputElement )
+    {
+        return getChildren( inputElement );
+    }
+
+
+    public void dispose()
+    {
+    }
+
+
+    public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+    {
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/project/SigilProjectWizard.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/project/SigilProjectWizard.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/project/SigilProjectWizard.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/project/SigilProjectWizard.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.wizard.project;
 
+
 import org.apache.felix.sigil.eclipse.SigilCore;
 import org.apache.felix.sigil.ui.eclipse.ui.wizard.SigilNewResourceWizard;
 import org.eclipse.core.resources.IFile;
@@ -40,97 +41,123 @@
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
 
+
 /**
  * @author dave
  *
  */
-public class SigilProjectWizard extends SigilNewResourceWizard implements IExecutableExtension {
+public class SigilProjectWizard extends SigilNewResourceWizard implements IExecutableExtension
+{
 
     private SigilProjectWizardFirstPage firstPage;
     private SigilProjectWizardSecondPage secondPage;
-    
+
     private String name;
-    
+
     public static final IPath SIGIL_PROJECT_PATH = new Path( SigilCore.SIGIL_PROJECT_FILE );
-	private IConfigurationElement config;
-    
-    public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
-        super.init(workbench, currentSelection);
+    private IConfigurationElement config;
+
+
+    public void init( IWorkbench workbench, IStructuredSelection currentSelection )
+    {
+        super.init( workbench, currentSelection );
 
         firstPage = new SigilProjectWizardFirstPage();
-        firstPage.setInitialProjectName(name);
-        secondPage = new SigilProjectWizardSecondPage(firstPage);
-        
-        addPage(firstPage);
-        addPage(secondPage);
-    }
-    
-    private void finishPage(IProgressMonitor monitor) throws CoreException, InterruptedException {
-        secondPage.performFinish(monitor);
-        
+        firstPage.setInitialProjectName( name );
+        secondPage = new SigilProjectWizardSecondPage( firstPage );
+
+        addPage( firstPage );
+        addPage( secondPage );
+    }
+
+
+    private void finishPage( IProgressMonitor monitor ) throws CoreException, InterruptedException
+    {
+        secondPage.performFinish( monitor );
+
         IProject newProject = firstPage.getProjectHandle();
-        
-        if ( newProject != null && newProject.exists() ) {
+
+        if ( newProject != null && newProject.exists() )
+        {
             IFile file = newProject.getFile( SigilProjectWizard.SIGIL_PROJECT_PATH );
-            
-            selectRevealAndShow( file ); 
-           
-            new Job("Check OSGi Install" ) {
-				@Override
-				protected IStatus run(IProgressMonitor monitor) {
+
+            selectRevealAndShow( file );
+
+            new Job( "Check OSGi Install" )
+            {
+                @Override
+                protected IStatus run( IProgressMonitor monitor )
+                {
                     // prompt for osgi home if not already set.
-            		SigilCore.getInstallManager().getDefaultInstall();
-            		return Status.OK_STATUS;
-				}
+                    SigilCore.getInstallManager().getDefaultInstall();
+                    return Status.OK_STATUS;
+                }
             }.schedule();
         }
     }
 
+
     /* (non-Javadoc)
      * @see org.eclipse.jface.wizard.Wizard#performFinish()
      */
     @Override
-    public boolean performFinish() {
+    public boolean performFinish()
+    {
         IWorkspace workspace = ResourcesPlugin.getWorkspace();
-        
-        IWorkspaceRunnable op= new IWorkspaceRunnable() {
-            public void run(IProgressMonitor monitor) throws CoreException {
-                try {
-                    finishPage(monitor);
-                } catch (InterruptedException e) {
-                    throw new OperationCanceledException(e.getMessage());
+
+        IWorkspaceRunnable op = new IWorkspaceRunnable()
+        {
+            public void run( IProgressMonitor monitor ) throws CoreException
+            {
+                try
+                {
+                    finishPage( monitor );
+                }
+                catch ( InterruptedException e )
+                {
+                    throw new OperationCanceledException( e.getMessage() );
                 }
             }
         };
-        
-        try {
-            workspace.run(op, Job.getJobManager().createProgressGroup());
+
+        try
+        {
+            workspace.run( op, Job.getJobManager().createProgressGroup() );
         }
-        catch (CoreException e) {
-            SigilCore.error( "Failed to complete project wizard", e);
+        catch ( CoreException e )
+        {
+            SigilCore.error( "Failed to complete project wizard", e );
             return false;
         }
-        
-        BasicNewProjectResourceWizard.updatePerspective(config);
+
+        BasicNewProjectResourceWizard.updatePerspective( config );
         return true;
     }
 
-	public void setName(String name) {
-		this.name = name;
-	}
-	
-	public String getName() {
-		return name;
-	}
-    
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+
+    public String getName()
+    {
+        return name;
+    }
+
+
     @Override
-    public boolean performCancel() {
-    	secondPage.performCancel();
-    	return super.performCancel();
+    public boolean performCancel()
+    {
+        secondPage.performCancel();
+        return super.performCancel();
     }
 
-	public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
-			throws CoreException {
-		this.config = config;
-	}
+
+    public void setInitializationData( IConfigurationElement config, String propertyName, Object data )
+        throws CoreException
+    {
+        this.config = config;
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/project/SigilProjectWizardFirstPage.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/project/SigilProjectWizardFirstPage.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/project/SigilProjectWizardFirstPage.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/project/SigilProjectWizardFirstPage.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.wizard.project;
 
+
 import org.eclipse.core.resources.IWorkspace;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.IPath;
@@ -37,135 +38,161 @@
 import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
 import org.osgi.framework.Version;
 
+
 /**
  * @author dave
  *
  */
-public class SigilProjectWizardFirstPage extends WizardNewProjectCreationPage {
+public class SigilProjectWizardFirstPage extends WizardNewProjectCreationPage
+{
 
-	private volatile String description = "";
-	private volatile Version version = new Version(1, 0, 0);
-	private volatile String vendor = "";
-	private volatile String name = "";
-	
-	private Text txtDescription;
+    private volatile String description = "";
+    private volatile Version version = new Version( 1, 0, 0 );
+    private volatile String vendor = "";
+    private volatile String name = "";
+
+    private Text txtDescription;
     private Text txtVersion;
-	private Text txtVendor;
-	private Text txtName;
+    private Text txtVendor;
+    private Text txtName;
+
 
-	public SigilProjectWizardFirstPage() {
-        super("newSigilProjectPage");
+    public SigilProjectWizardFirstPage()
+    {
+        super( "newSigilProjectPage" );
         setTitle( "Sigil Project" );
         setDescription( "Create a new Sigil project" );
     }
 
-    public boolean isInWorkspace() {
+
+    public boolean isInWorkspace()
+    {
         IWorkspace workspace = ResourcesPlugin.getWorkspace();
-        
+
         IPath defaultDefaultLocation = workspace.getRoot().getLocation();
-        
+
         return defaultDefaultLocation.isPrefixOf( getLocationPath() );
     }
-    
+
+
     @Override
-    public boolean isPageComplete() {
-    	boolean result = super.isPageComplete();
-    	return result;
+    public boolean isPageComplete()
+    {
+        boolean result = super.isPageComplete();
+        return result;
     }
-    
+
+
     @Override
-    public void createControl(Composite parent) {
-    	FieldDecoration infoDecor = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION);
-    	
-    	// Create controls
-    	super.createControl(parent);
-    	Composite control = (Composite) getControl();
-    	
-    	Group grpProjectSettings = new Group(control, SWT.NONE);
-    	grpProjectSettings.setText("Project Settings");
-    	
-    	new Label(grpProjectSettings, SWT.NONE).setText("Version:");
-    	txtVersion = new Text(grpProjectSettings, SWT.BORDER);
-    	
-    	new Label(grpProjectSettings, SWT.NONE).setText("Name:");
-    	txtName = new Text(grpProjectSettings, SWT.BORDER);
-    	
-    	ControlDecoration txtNameDecor = new ControlDecoration(txtName, SWT.LEFT | SWT.CENTER);
-    	txtNameDecor.setImage(infoDecor.getImage());
-    	txtNameDecor.setDescriptionText("Defines a human-readable name for the bundle");
-    	
-    	new Label(grpProjectSettings, SWT.NONE).setText("Description:");
-    	txtDescription = new Text(grpProjectSettings, SWT.BORDER);
-    	
-    	ControlDecoration txtDescDecor = new ControlDecoration(txtDescription, SWT.LEFT | SWT.CENTER);
-    	txtDescDecor.setImage(infoDecor.getImage());
-    	txtDescDecor.setDescriptionText("Defines a short human-readable description for the bundle");
-    	
-    	new Label(grpProjectSettings, SWT.NONE).setText("Provider:");
-    	txtVendor = new Text(grpProjectSettings, SWT.BORDER);
-    	
-    	ControlDecoration txtVendorDecor = new ControlDecoration(txtVendor, SWT.LEFT | SWT.CENTER);
-    	txtVendorDecor.setImage(infoDecor.getImage());
-    	txtVendorDecor.setDescriptionText("The name of the company, organisation or individual providing the bundle");
-    	    	
-    	// Set values
-    	txtDescription.setText(description);
-    	txtVersion.setText(version.toString());
-    	txtVendor.setText(vendor);
-    	txtName.setText(name);
-    	
-    	// Add listeners
-    	ModifyListener txtModListener = new ModifyListener() {
-			public void modifyText(ModifyEvent e) {
-				description = txtDescription.getText();
-				vendor = txtVendor.getText();
-				name = txtName.getText();
-				
-				validateSettings();
-			}
-    	};
-    	txtDescription.addModifyListener(txtModListener);
-    	txtVersion.addModifyListener(txtModListener);
-    	txtVendor.addModifyListener(txtModListener);
-    	txtName.addModifyListener(txtModListener);
-    	
-    	// Layout
-    	control.setLayout(new GridLayout());
-    	grpProjectSettings.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-    	grpProjectSettings.setLayout(new GridLayout(2, false));
-    	txtDescription.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-    	txtVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-    	txtVendor.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-    	txtName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-    }
-
-    private void validateSettings() {
-    	try {
-			version = new Version(txtVersion.getText());
-		} catch (IllegalArgumentException e) {
-			version = null;
-			setErrorMessage("Invalid version");
-			setPageComplete(false);
-			return;
-		}
-		
-		setErrorMessage(null);
-		setPageComplete(true);
-	}
-
-	public Version getVersion() {
-		return version;
-	}
-
-	public String getVendor() {
-		return vendor;
-	}
-	
-	public String getDescription() {
-		return description;
-	}
-	
-	public String getName() {
-		return name;
-	}
+    public void createControl( Composite parent )
+    {
+        FieldDecoration infoDecor = FieldDecorationRegistry.getDefault().getFieldDecoration(
+            FieldDecorationRegistry.DEC_INFORMATION );
+
+        // Create controls
+        super.createControl( parent );
+        Composite control = ( Composite ) getControl();
+
+        Group grpProjectSettings = new Group( control, SWT.NONE );
+        grpProjectSettings.setText( "Project Settings" );
+
+        new Label( grpProjectSettings, SWT.NONE ).setText( "Version:" );
+        txtVersion = new Text( grpProjectSettings, SWT.BORDER );
+
+        new Label( grpProjectSettings, SWT.NONE ).setText( "Name:" );
+        txtName = new Text( grpProjectSettings, SWT.BORDER );
+
+        ControlDecoration txtNameDecor = new ControlDecoration( txtName, SWT.LEFT | SWT.CENTER );
+        txtNameDecor.setImage( infoDecor.getImage() );
+        txtNameDecor.setDescriptionText( "Defines a human-readable name for the bundle" );
+
+        new Label( grpProjectSettings, SWT.NONE ).setText( "Description:" );
+        txtDescription = new Text( grpProjectSettings, SWT.BORDER );
+
+        ControlDecoration txtDescDecor = new ControlDecoration( txtDescription, SWT.LEFT | SWT.CENTER );
+        txtDescDecor.setImage( infoDecor.getImage() );
+        txtDescDecor.setDescriptionText( "Defines a short human-readable description for the bundle" );
+
+        new Label( grpProjectSettings, SWT.NONE ).setText( "Provider:" );
+        txtVendor = new Text( grpProjectSettings, SWT.BORDER );
+
+        ControlDecoration txtVendorDecor = new ControlDecoration( txtVendor, SWT.LEFT | SWT.CENTER );
+        txtVendorDecor.setImage( infoDecor.getImage() );
+        txtVendorDecor.setDescriptionText( "The name of the company, organisation or individual providing the bundle" );
+
+        // Set values
+        txtDescription.setText( description );
+        txtVersion.setText( version.toString() );
+        txtVendor.setText( vendor );
+        txtName.setText( name );
+
+        // Add listeners
+        ModifyListener txtModListener = new ModifyListener()
+        {
+            public void modifyText( ModifyEvent e )
+            {
+                description = txtDescription.getText();
+                vendor = txtVendor.getText();
+                name = txtName.getText();
+
+                validateSettings();
+            }
+        };
+        txtDescription.addModifyListener( txtModListener );
+        txtVersion.addModifyListener( txtModListener );
+        txtVendor.addModifyListener( txtModListener );
+        txtName.addModifyListener( txtModListener );
+
+        // Layout
+        control.setLayout( new GridLayout() );
+        grpProjectSettings.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
+        grpProjectSettings.setLayout( new GridLayout( 2, false ) );
+        txtDescription.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
+        txtVersion.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
+        txtVendor.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
+        txtName.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
+    }
+
+
+    private void validateSettings()
+    {
+        try
+        {
+            version = new Version( txtVersion.getText() );
+        }
+        catch ( IllegalArgumentException e )
+        {
+            version = null;
+            setErrorMessage( "Invalid version" );
+            setPageComplete( false );
+            return;
+        }
+
+        setErrorMessage( null );
+        setPageComplete( true );
+    }
+
+
+    public Version getVersion()
+    {
+        return version;
+    }
+
+
+    public String getVendor()
+    {
+        return vendor;
+    }
+
+
+    public String getDescription()
+    {
+        return description;
+    }
+
+
+    public String getName()
+    {
+        return name;
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/project/SigilProjectWizardSecondPage.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/project/SigilProjectWizardSecondPage.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/project/SigilProjectWizardSecondPage.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/project/SigilProjectWizardSecondPage.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.wizard.project;
 
+
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -47,164 +48,214 @@
 import org.eclipse.jdt.ui.wizards.JavaCapabilityConfigurationPage;
 import org.osgi.framework.Version;
 
+
 /**
  * @author dave
  *
  */
-public class SigilProjectWizardSecondPage extends JavaCapabilityConfigurationPage {
-    
+public class SigilProjectWizardSecondPage extends JavaCapabilityConfigurationPage
+{
+
     private SigilProjectWizardFirstPage firstPage;
     private IProject currentProject;
     private URI currentProjectLocation;
     private boolean created;
-    
-    public SigilProjectWizardSecondPage(SigilProjectWizardFirstPage firstPage) {
+
+
+    public SigilProjectWizardSecondPage( SigilProjectWizardFirstPage firstPage )
+    {
         this.firstPage = firstPage;
     }
 
+
     @Override
-    public void setVisible(boolean visible) {
-    	super.setVisible(visible);
-        if (visible) {
+    public void setVisible( boolean visible )
+    {
+        super.setVisible( visible );
+        if ( visible )
+        {
             changeToNewProject();
-        } else {
+        }
+        else
+        {
             removeProject();
         }
     }
-    
+
+
     @Override
-    protected boolean useNewSourcePage() {
+    protected boolean useNewSourcePage()
+    {
         return true;
     }
-    
-    protected void performFinish(IProgressMonitor monitor) throws CoreException, InterruptedException {
-    	changeToNewProject();
-        updateProject(monitor);
-    }
-    
-    private void changeToNewProject() {
-    	if ( !created ) {
+
+
+    protected void performFinish( IProgressMonitor monitor ) throws CoreException, InterruptedException
+    {
+        changeToNewProject();
+        updateProject( monitor );
+    }
+
+
+    private void changeToNewProject()
+    {
+        if ( !created )
+        {
             IWorkspace workspace = ResourcesPlugin.getWorkspace();
-            
-            IWorkspaceRunnable op= new IWorkspaceRunnable() {
-                public void run(IProgressMonitor monitor) throws CoreException {
-                    try {
-                        updateProject(monitor);
-                    } catch (InterruptedException e) {
-                        throw new OperationCanceledException(e.getMessage());
+
+            IWorkspaceRunnable op = new IWorkspaceRunnable()
+            {
+                public void run( IProgressMonitor monitor ) throws CoreException
+                {
+                    try
+                    {
+                        updateProject( monitor );
+                    }
+                    catch ( InterruptedException e )
+                    {
+                        throw new OperationCanceledException( e.getMessage() );
                     }
                 }
             };
-            
-            try {
-                workspace.run(op, Job.getJobManager().createProgressGroup());
-                setErrorMessage(null);
-                setPageComplete(true);
+
+            try
+            {
+                workspace.run( op, Job.getJobManager().createProgressGroup() );
+                setErrorMessage( null );
+                setPageComplete( true );
                 created = true;
             }
-            catch (CoreException e) {
-            	SigilCore.error("Failed to run workspace job", e);
-            }        
-    	}
-    }
-    
-    private void removeProject() {
-        if (currentProject == null || !currentProject.exists()) {
+            catch ( CoreException e )
+            {
+                SigilCore.error( "Failed to run workspace job", e );
+            }
+        }
+    }
+
+
+    private void removeProject()
+    {
+        if ( currentProject == null || !currentProject.exists() )
+        {
             return;
         }
-        
-        IWorkspaceRunnable op= new IWorkspaceRunnable() {
-            public void run(IProgressMonitor monitor) throws CoreException {
-                doRemoveProject(monitor);
+
+        IWorkspaceRunnable op = new IWorkspaceRunnable()
+        {
+            public void run( IProgressMonitor monitor ) throws CoreException
+            {
+                doRemoveProject( monitor );
             }
         };
-    
+
         IWorkspace workspace = ResourcesPlugin.getWorkspace();
-        
-        try {
-            workspace.run(op, Job.getJobManager().createProgressGroup());
-        }
-        catch (CoreException e) {
-        	SigilCore.error("Failed to run workspace job", e);
-        }
-        finally {
-        	created = false;
+
+        try
+        {
+            workspace.run( op, Job.getJobManager().createProgressGroup() );
+        }
+        catch ( CoreException e )
+        {
+            SigilCore.error( "Failed to run workspace job", e );
+        }
+        finally
+        {
+            created = false;
         }
     }
-    
-    private void updateProject(IProgressMonitor monitor) throws CoreException, InterruptedException {
+
+
+    private void updateProject( IProgressMonitor monitor ) throws CoreException, InterruptedException
+    {
         currentProject = firstPage.getProjectHandle();
-        currentProjectLocation= getProjectLocationURI();
-        
+        currentProjectLocation = getProjectLocationURI();
+
         String description = firstPage.getDescription();
         Version projectVersion = firstPage.getVersion();
         String vendor = firstPage.getVendor();
         String name = firstPage.getName();
-        
-        createProject( currentProject, currentProjectLocation, monitor);
+
+        createProject( currentProject, currentProjectLocation, monitor );
 
         IPath src = createSourcePath();
-        
+
         IPath output = getOutputLocation();
-        
-        if ( output.segmentCount() == 0 ) {
-        	output = new Path( currentProject.getName() ).append( "build" ).append( "classes" );
-        }
-        
-        IClasspathEntry[] entries = getProjectClassPath(src);
-        
-    	SigilCore.makeSigilProject(currentProject, monitor);
-    	
-        init(JavaCore.create(currentProject), output.makeRelative(), entries, false);
 
-        configureJavaProject(new SubProgressMonitor(monitor, 3));
-        
+        if ( output.segmentCount() == 0 )
+        {
+            output = new Path( currentProject.getName() ).append( "build" ).append( "classes" );
+        }
+
+        IClasspathEntry[] entries = getProjectClassPath( src );
+
+        SigilCore.makeSigilProject( currentProject, monitor );
+
+        init( JavaCore.create( currentProject ), output.makeRelative(), entries, false );
+
+        configureJavaProject( new SubProgressMonitor( monitor, 3 ) );
+
         configureSigilProject( currentProject, description, projectVersion, vendor, name, src, monitor );
     }
-    
-	private IPath createSourcePath() throws CoreException {
+
+
+    private IPath createSourcePath() throws CoreException
+    {
         IPath projectPath = currentProject.getFullPath();
         IPath src = new Path( "src" );
         IFolder f = currentProject.getFolder( src );
-        if ( !f.getLocation().toFile().exists() ) {
-        	f.create(true, true, null);
+        if ( !f.getLocation().toFile().exists() )
+        {
+            f.create( true, true, null );
         }
-        
-        return projectPath.append(src);
-	}
-
-	final void doRemoveProject(IProgressMonitor monitor) throws CoreException {
-        final boolean noProgressMonitor= (currentProjectLocation == null); // inside workspace
-        
-        if (monitor == null || noProgressMonitor) {
-            monitor= new NullProgressMonitor();
-        }
-        monitor.beginTask("Remove project", 3); 
-        try {
-            try {
-                boolean removeContent= currentProject.isSynchronized(IResource.DEPTH_INFINITE);
-                currentProject.delete(removeContent, false, new SubProgressMonitor(monitor, 2));
-                
-            } finally {
+
+        return projectPath.append( src );
+    }
+
+
+    final void doRemoveProject( IProgressMonitor monitor ) throws CoreException
+    {
+        final boolean noProgressMonitor = ( currentProjectLocation == null ); // inside workspace
+
+        if ( monitor == null || noProgressMonitor )
+        {
+            monitor = new NullProgressMonitor();
+        }
+        monitor.beginTask( "Remove project", 3 );
+        try
+        {
+            try
+            {
+                boolean removeContent = currentProject.isSynchronized( IResource.DEPTH_INFINITE );
+                currentProject.delete( removeContent, false, new SubProgressMonitor( monitor, 2 ) );
+
             }
-        } finally {
+            finally
+            {
+            }
+        }
+        finally
+        {
             monitor.done();
-            currentProject= null;
-        }        
+            currentProject = null;
+        }
     }
-        
-    private IClasspathEntry[] getProjectClassPath(IPath src) throws CoreException {
-        List<IClasspathEntry> cpEntries= new ArrayList<IClasspathEntry>();
-        cpEntries.add(JavaCore.newSourceEntry(src));
-        cpEntries.addAll(Arrays.asList(getDefaultClasspathEntry()));
-        cpEntries.add(JavaCore.newContainerEntry(new Path(SigilCore.CLASSPATH_CONTAINER_PATH)));
-        IClasspathEntry[] entries= cpEntries.toArray(new IClasspathEntry[cpEntries.size()]);
-        
+
+
+    private IClasspathEntry[] getProjectClassPath( IPath src ) throws CoreException
+    {
+        List<IClasspathEntry> cpEntries = new ArrayList<IClasspathEntry>();
+        cpEntries.add( JavaCore.newSourceEntry( src ) );
+        cpEntries.addAll( Arrays.asList( getDefaultClasspathEntry() ) );
+        cpEntries.add( JavaCore.newContainerEntry( new Path( SigilCore.CLASSPATH_CONTAINER_PATH ) ) );
+        IClasspathEntry[] entries = cpEntries.toArray( new IClasspathEntry[cpEntries.size()] );
+
         return entries;
     }
-    
-    private IClasspathEntry[] getDefaultClasspathEntry() {
-        IClasspathEntry[] defaultJRELibrary= PreferenceConstants.getDefaultJRELibrary();
+
+
+    private IClasspathEntry[] getDefaultClasspathEntry()
+    {
+        IClasspathEntry[] defaultJRELibrary = PreferenceConstants.getDefaultJRELibrary();
         /*String compliance= firstPage.getCompilerCompliance();
         IPath jreContainerPath= new Path(JavaRuntime.JRE_CONTAINER);
         if (compliance == null || defaultJRELibrary.length > 1 || !jreContainerPath.isPrefixOf(defaultJRELibrary[0].getPath())) {
@@ -218,48 +269,61 @@
         }*/
         return defaultJRELibrary;
     }
-    
-    
-    private void configureSigilProject( IProject project, String description, Version projectVersion, String vendorName, String bundleName, IPath src, IProgressMonitor monitor ) throws CoreException {
-        ISigilProjectModel sigil = SigilCore.create(project);
-        IClasspathEntry cp = JavaCore.newSourceEntry(src);
-        String encodedClasspath = sigil.getJavaModel().encodeClasspathEntry(cp );
-        
+
+
+    private void configureSigilProject( IProject project, String description, Version projectVersion,
+        String vendorName, String bundleName, IPath src, IProgressMonitor monitor ) throws CoreException
+    {
+        ISigilProjectModel sigil = SigilCore.create( project );
+        IClasspathEntry cp = JavaCore.newSourceEntry( src );
+        String encodedClasspath = sigil.getJavaModel().encodeClasspathEntry( cp );
+
         ISigilBundle bundle = sigil.getBundle();
-        bundle.addClasspathEntry(encodedClasspath);
-        
-        if(description != null) {
-        	bundle.getBundleInfo().setDescription(description);
-        }
-		if(projectVersion != null) {
-        	bundle.setVersion(projectVersion);
-        }
-		if(vendorName != null) {
-			bundle.getBundleInfo().setVendor(vendorName);
-		}
-		if(bundleName != null) {
-			bundle.getBundleInfo().setName(bundleName);
-		}
-        sigil.save(monitor);
-    }
-    
-    
-    private URI getProjectLocationURI() throws CoreException {
-        if (firstPage.isInWorkspace()) {
+        bundle.addClasspathEntry( encodedClasspath );
+
+        if ( description != null )
+        {
+            bundle.getBundleInfo().setDescription( description );
+        }
+        if ( projectVersion != null )
+        {
+            bundle.setVersion( projectVersion );
+        }
+        if ( vendorName != null )
+        {
+            bundle.getBundleInfo().setVendor( vendorName );
+        }
+        if ( bundleName != null )
+        {
+            bundle.getBundleInfo().setName( bundleName );
+        }
+        sigil.save( monitor );
+    }
+
+
+    private URI getProjectLocationURI() throws CoreException
+    {
+        if ( firstPage.isInWorkspace() )
+        {
             return null;
         }
         return firstPage.getLocationURI();
     }
-    
+
+
     @Override
-    public boolean isPageComplete() {
-    	boolean result = super.isPageComplete();
-    	return result;
-    }
-    
-    protected void performCancel() {
-    	if(currentProject != null) {
-    		removeProject();
-    	}
+    public boolean isPageComplete()
+    {
+        boolean result = super.isPageComplete();
+        return result;
+    }
+
+
+    protected void performCancel()
+    {
+        if ( currentProject != null )
+        {
+            removeProject();
+        }
     }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/repository/RepositoryWizard.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/repository/RepositoryWizard.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/repository/RepositoryWizard.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/repository/RepositoryWizard.java Tue Jul 21 18:51:33 2009
@@ -19,30 +19,41 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.wizard.repository;
 
+
 import org.apache.felix.sigil.eclipse.model.repository.IRepositoryModel;
 import org.eclipse.jface.wizard.IWizardPage;
 import org.eclipse.jface.wizard.Wizard;
 
-public class RepositoryWizard extends Wizard {
-	
-	private IRepositoryModel model;
-	
-	@Override
-	public boolean performFinish() {
-		for ( IWizardPage page : getPages() ) {
-			if ( page instanceof RepositoryWizardPage ) {
-				RepositoryWizardPage rwp = (RepositoryWizardPage) page;
-				rwp.storeFields();
-			}
-		}
-		return true;
-	}
-	
-	public IRepositoryModel getModel() {
-		return model;
-	}
-
-	public void init(IRepositoryModel model) {
-		this.model = model;
-	}
+
+public class RepositoryWizard extends Wizard
+{
+
+    private IRepositoryModel model;
+
+
+    @Override
+    public boolean performFinish()
+    {
+        for ( IWizardPage page : getPages() )
+        {
+            if ( page instanceof RepositoryWizardPage )
+            {
+                RepositoryWizardPage rwp = ( RepositoryWizardPage ) page;
+                rwp.storeFields();
+            }
+        }
+        return true;
+    }
+
+
+    public IRepositoryModel getModel()
+    {
+        return model;
+    }
+
+
+    public void init( IRepositoryModel model )
+    {
+        this.model = model;
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/repository/RepositoryWizardPage.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/repository/RepositoryWizardPage.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/repository/RepositoryWizardPage.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/wizard/repository/RepositoryWizardPage.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.wizard.repository;
 
+
 import java.util.ArrayList;
 
 import org.apache.felix.sigil.eclipse.model.repository.IRepositoryModel;
@@ -31,79 +32,104 @@
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Composite;
 
-public abstract class RepositoryWizardPage extends WizardPage {
 
-	private StringFieldEditor nameEditor;
-	private ArrayList<FieldEditor> editors = new ArrayList<FieldEditor>();
-	private RepositoryWizard wizard;
-	
-	protected RepositoryWizardPage(String pageName, RepositoryWizard parent) {
-		super(pageName);
-		setTitle(pageName);
-		this.wizard = parent;
-	}
-	
-	public abstract void createFieldEditors();
-
-	public void addField(FieldEditor editor) {
-		editors.add( editor );
-	}
-	
-	public void createControl(Composite parent) {
-		Composite control = new Composite(parent, SWT.NONE);
-		setControl(control);
-		
-		if ( getModel().getType().isDynamic() ) {
-			nameEditor = new StringFieldEditor("name", "Name:", control);
-			nameEditor.setStringValue(getModel().getName());
-			nameEditor.getTextControl(getFieldEditorParent()).addModifyListener( new ModifyListener() {
-				public void modifyText(ModifyEvent e) {
-					checkPageComplete();
-				}
-			});
-		}
-		
-		createFieldEditors();
-
-		int cols = nameEditor == null ? 0 : nameEditor.getNumberOfControls();
-		for ( FieldEditor e : editors ) {
-			cols = Math.max(cols, e.getNumberOfControls());
-		}
-		
-		control.setLayout( new GridLayout(cols, false) );
-		
-		if ( nameEditor != null ) {
-			nameEditor.fillIntoGrid(getFieldEditorParent(), cols);
-		}
-
-		for ( FieldEditor e : editors ) {
-			e.fillIntoGrid(getFieldEditorParent(), cols);
-			e.setPreferenceStore(getModel().getPreferences());
-			e.load();
-		}
-		
-		checkPageComplete();
-	}
-
-	protected void checkPageComplete() {
-		if ( nameEditor != null ) {
-			setPageComplete(nameEditor.getStringValue().length() > 0);
-		}
-	}
-
-	public IRepositoryModel getModel() {
-		return wizard.getModel();
-	}
-
-	protected Composite getFieldEditorParent() {
-		return (Composite) getControl();
-	}
-
-	public void storeFields() {
-		getModel().setName(nameEditor.getStringValue());
-		for ( FieldEditor e : editors ) {
-			e.store();
-		}
-	}
-	
+public abstract class RepositoryWizardPage extends WizardPage
+{
+
+    private StringFieldEditor nameEditor;
+    private ArrayList<FieldEditor> editors = new ArrayList<FieldEditor>();
+    private RepositoryWizard wizard;
+
+
+    protected RepositoryWizardPage( String pageName, RepositoryWizard parent )
+    {
+        super( pageName );
+        setTitle( pageName );
+        this.wizard = parent;
+    }
+
+
+    public abstract void createFieldEditors();
+
+
+    public void addField( FieldEditor editor )
+    {
+        editors.add( editor );
+    }
+
+
+    public void createControl( Composite parent )
+    {
+        Composite control = new Composite( parent, SWT.NONE );
+        setControl( control );
+
+        if ( getModel().getType().isDynamic() )
+        {
+            nameEditor = new StringFieldEditor( "name", "Name:", control );
+            nameEditor.setStringValue( getModel().getName() );
+            nameEditor.getTextControl( getFieldEditorParent() ).addModifyListener( new ModifyListener()
+            {
+                public void modifyText( ModifyEvent e )
+                {
+                    checkPageComplete();
+                }
+            } );
+        }
+
+        createFieldEditors();
+
+        int cols = nameEditor == null ? 0 : nameEditor.getNumberOfControls();
+        for ( FieldEditor e : editors )
+        {
+            cols = Math.max( cols, e.getNumberOfControls() );
+        }
+
+        control.setLayout( new GridLayout( cols, false ) );
+
+        if ( nameEditor != null )
+        {
+            nameEditor.fillIntoGrid( getFieldEditorParent(), cols );
+        }
+
+        for ( FieldEditor e : editors )
+        {
+            e.fillIntoGrid( getFieldEditorParent(), cols );
+            e.setPreferenceStore( getModel().getPreferences() );
+            e.load();
+        }
+
+        checkPageComplete();
+    }
+
+
+    protected void checkPageComplete()
+    {
+        if ( nameEditor != null )
+        {
+            setPageComplete( nameEditor.getStringValue().length() > 0 );
+        }
+    }
+
+
+    public IRepositoryModel getModel()
+    {
+        return wizard.getModel();
+    }
+
+
+    protected Composite getFieldEditorParent()
+    {
+        return ( Composite ) getControl();
+    }
+
+
+    public void storeFields()
+    {
+        getModel().setName( nameEditor.getStringValue() );
+        for ( FieldEditor e : editors )
+        {
+            e.store();
+        }
+    }
+
 }

Modified: felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/GlobCompiler.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/GlobCompiler.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/GlobCompiler.java (original)
+++ felix/trunk/sigil/eclipse/utils/src/org/apache/felix/sigil/utils/GlobCompiler.java Tue Jul 21 18:51:33 2009
@@ -19,36 +19,44 @@
 
 package org.apache.felix.sigil.utils;
 
+
 import java.util.regex.Pattern;
 
-public class GlobCompiler {
-	public static final Pattern compile(String glob) {
-		char[] chars = glob.toCharArray();
-		if ( chars.length > 0 ) {
-			StringBuilder builder = new StringBuilder(chars.length + 5);
-	
-			builder.append('^');
-			
-			for (char c : chars) {
-				switch ( c ) {
-				case '*':
-					builder.append(".*");
-					break;
-				case '.':
-					builder.append("\\.");
-					break;
-				case '$':
-					builder.append( "\\$" );
-					break;
-				default:
-					builder.append( c );
-				}
-			}
-	
-			return Pattern.compile(builder.toString());
-		}
-		else {
-			return Pattern.compile(glob);
-		}
-	}
+
+public class GlobCompiler
+{
+    public static final Pattern compile( String glob )
+    {
+        char[] chars = glob.toCharArray();
+        if ( chars.length > 0 )
+        {
+            StringBuilder builder = new StringBuilder( chars.length + 5 );
+
+            builder.append( '^' );
+
+            for ( char c : chars )
+            {
+                switch ( c )
+                {
+                    case '*':
+                        builder.append( ".*" );
+                        break;
+                    case '.':
+                        builder.append( "\\." );
+                        break;
+                    case '$':
+                        builder.append( "\\$" );
+                        break;
+                    default:
+                        builder.append( c );
+                }
+            }
+
+            return Pattern.compile( builder.toString() );
+        }
+        else
+        {
+            return Pattern.compile( glob );
+        }
+    }
 }