felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsav...@apache.org
Subject svn commit: r796467 [16/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/...
Date Tue, 21 Jul 2009 18:51:41 GMT
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/DependenciesForm.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/DependenciesForm.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/DependenciesForm.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/DependenciesForm.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.editors.project;
 
+
 import java.util.Set;
 
 import org.apache.felix.sigil.eclipse.SigilCore;
@@ -34,36 +35,43 @@
 import org.eclipse.ui.forms.widgets.TableWrapData;
 import org.eclipse.ui.forms.widgets.TableWrapLayout;
 
-public class DependenciesForm extends SigilPage  {
 
-	public static final String PAGE_ID = "dependencies";
-	
-	private final ISigilProjectModel project;
-	private final Set<IModelElement> unresolvedElements;
-
-	private ImportPackagesSection importPackages;
-	private RequiresBundleSection requiresSection;
-
-	
-	public DependenciesForm(FormEditor editor, ISigilProjectModel project, Set<IModelElement> unresolved) {
-		super(editor, PAGE_ID, "Dependencies");
-		this.project = project;
-		this.unresolvedElements = unresolved;
-	}
-	
+public class DependenciesForm extends SigilPage
+{
+
+    public static final String PAGE_ID = "dependencies";
+
+    private final ISigilProjectModel project;
+    private final Set<IModelElement> unresolvedElements;
+
+    private ImportPackagesSection importPackages;
+    private RequiresBundleSection requiresSection;
+
+
+    public DependenciesForm( FormEditor editor, ISigilProjectModel project, Set<IModelElement> unresolved )
+    {
+        super( editor, PAGE_ID, "Dependencies" );
+        this.project = project;
+        this.unresolvedElements = unresolved;
+    }
+
+
     @Override
-	public boolean canLeaveThePage() {
-    	return !isDirty();
-	}
+    public boolean canLeaveThePage()
+    {
+        return !isDirty();
+    }
 
-	@Override
-    protected void createFormContent(IManagedForm managedForm) {
+
+    @Override
+    protected void createFormContent( IManagedForm managedForm )
+    {
         FormToolkit toolkit = managedForm.getToolkit();
-        
+
         ScrolledForm form = managedForm.getForm();
         form.setText( "Dependencies" );
-        
-        Composite body = form.getBody();        
+
+        Composite body = form.getBody();
         TableWrapLayout layout = new TableWrapLayout();
         layout.bottomMargin = 10;
         layout.topMargin = 5;
@@ -71,41 +79,43 @@
         layout.rightMargin = 10;
         layout.numColumns = 2;
         layout.horizontalSpacing = 10;
-        body.setLayout(layout);
-        body.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
-        
-        Composite left = toolkit.createComposite(body);
+        body.setLayout( layout );
+        body.setLayoutData( new TableWrapData( TableWrapData.FILL_GRAB ) );
+
+        Composite left = toolkit.createComposite( body );
         layout = new TableWrapLayout();
         layout.verticalSpacing = 20;
-        left.setLayout(layout);
-        TableWrapData layoutData = new TableWrapData(TableWrapData.FILL_GRAB);
+        left.setLayout( layout );
+        TableWrapData layoutData = new TableWrapData( TableWrapData.FILL_GRAB );
         layoutData.rowspan = 2;
-        left.setLayoutData(layoutData);
-        
-        Composite right = toolkit.createComposite(body);
+        left.setLayoutData( layoutData );
+
+        Composite right = toolkit.createComposite( body );
         layout = new TableWrapLayout();
         layout.verticalSpacing = 20;
-        right.setLayout(layout);
-        right.setLayoutData(new TableWrapData( TableWrapData.FILL_GRAB) );
-        
-        Composite bottom = toolkit.createComposite(body);
+        right.setLayout( layout );
+        right.setLayoutData( new TableWrapData( TableWrapData.FILL_GRAB ) );
+
+        Composite bottom = toolkit.createComposite( body );
         layout = new TableWrapLayout();
         layout.verticalSpacing = 20;
-        bottom.setLayout(layout);
-        bottom.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
-                
-        try {
-	        importPackages = new ImportPackagesSection( this, left, project, unresolvedElements );
-	        managedForm.addPart( importPackages );
-	        
-	        requiresSection = new RequiresBundleSection(this, right, project, unresolvedElements );
-	        managedForm.addPart(requiresSection);
-	        
-	        DependencyManagementSection depMgmt = new DependencyManagementSection(this, bottom, project);
-	        managedForm.addPart(depMgmt);
+        bottom.setLayout( layout );
+        bottom.setLayoutData( new TableWrapData( TableWrapData.FILL_GRAB ) );
+
+        try
+        {
+            importPackages = new ImportPackagesSection( this, left, project, unresolvedElements );
+            managedForm.addPart( importPackages );
+
+            requiresSection = new RequiresBundleSection( this, right, project, unresolvedElements );
+            managedForm.addPart( requiresSection );
+
+            DependencyManagementSection depMgmt = new DependencyManagementSection( this, bottom, project );
+            managedForm.addPart( depMgmt );
         }
-        catch (CoreException e) {
-        	SigilCore.error( "Failed to create dependencies form", e);
+        catch ( CoreException e )
+        {
+            SigilCore.error( "Failed to create dependencies form", e );
         }
     }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/DependencyManagementSection.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/DependencyManagementSection.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/DependencyManagementSection.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/DependencyManagementSection.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.editors.project;
 
+
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -62,135 +63,174 @@
 import org.eclipse.ui.forms.widgets.Hyperlink;
 import org.eclipse.ui.forms.widgets.Section;
 
-public class DependencyManagementSection extends SigilSection {
 
-	private Hyperlink hypConvertRBtoIP;
+public class DependencyManagementSection extends SigilSection
+{
+
+    private Hyperlink hypConvertRBtoIP;
+
 
-	public DependencyManagementSection(SigilPage page, Composite parent,
-			ISigilProjectModel project) throws CoreException {
-		super(page, parent, project);
-	}
-
-	protected void createSection(Section section, FormToolkit toolkit) throws CoreException {
-		setTitle("Dependency Management");
-		
-		Composite body = createGridBody(1, false, toolkit);
-		
-		hypConvertRBtoIP = toolkit.createHyperlink(body, "Convert Required Bundles to Imported Packages", SWT.NONE);
-		hypConvertRBtoIP.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-		
-		hypConvertRBtoIP.addHyperlinkListener(new HyperlinkAdapter() {
-			public void linkActivated(HyperlinkEvent e) {
-				run();
-			}
-		});
-	}
-	
-	protected void run() {
-		final Map<String, IPackageExport> exports = new HashMap<String, IPackageExport>();
-		final Set<String> imports = new HashSet<String>();
-		
-		// Find all exports
-		final ExportedPackageFinder exportFinder = new ExportedPackageFinder(getProjectModel(), new AccumulatorAdapter<IPackageExport>() {
-			public void addElements(Collection<? extends IPackageExport> elements) {
-				for (IPackageExport export : elements) {
-					exports.put(export.getPackageName(), export);
-				}
-			}
-		});
-		Job findExportsJob = new Job("Find exports") {
-			protected IStatus run(IProgressMonitor monitor) {
-				return exportFinder.run(monitor);
-			}
-		};
-		findExportsJob.setUser(true);
-		findExportsJob.schedule();
-		
-		// Find imports from Java source
-		Job findImportsJob = new Job("Find imports") {
-			protected IStatus run(IProgressMonitor monitor) {
-				IJavaProject javaProject = getProjectModel().getJavaModel();
-				try {
-					IPackageFragment[] packages = javaProject.getPackageFragments();
-					for (IPackageFragment pkg : packages) {
-						ICompilationUnit[] compilationUnits = pkg.getCompilationUnits();
-						for (ICompilationUnit compilationUnit : compilationUnits) {
-							IImportDeclaration[] importDecls = compilationUnit.getImports();
-							for (IImportDeclaration importDecl : importDecls) {
-								imports.add(getPackageName(importDecl));
-							}
-						}
-					}
-					return Status.OK_STATUS;
-				} catch (JavaModelException e) {
-					return new Status(IStatus.ERROR, SigilUI.PLUGIN_ID, 0, "Error finding imports", e);
-				}
-			}
-		};
-		findImportsJob.setUser(true);
-		findImportsJob.schedule();
-		
-		// Wait for both jobs to complete
-		try {
-			findImportsJob.join();
-			findExportsJob.join();
-		} catch (InterruptedException e) {
-			// Aborted, just do nothing
-			return;
-		}
-		
-		// Get the version rules
-		IPreferenceStore prefStore = SigilCore.getDefault().getPreferenceStore();
-		VersionRangeBoundingRule lowerBoundRule = VersionRangeBoundingRule.valueOf(prefStore.getString(SigilCore.DEFAULT_VERSION_LOWER_BOUND));
-		VersionRangeBoundingRule upperBoundRule = VersionRangeBoundingRule.valueOf(prefStore.getString(SigilCore.DEFAULT_VERSION_UPPER_BOUND));
-		
-		// Get the existing imports for the bundle
-		IBundleModelElement bundleInfo = getProjectModel().getBundle().getBundleInfo();
-		Set<IPackageImport> existingImports = bundleInfo.getImports();
-		Map<String, IPackageImport> existingImportsMap = new HashMap<String, IPackageImport>();
-		for (IPackageImport existingImport : existingImports) {
-			existingImportsMap.put(existingImport.getPackageName(), existingImport);
-		}
-		
-		// Add imports to the bundle
-		ModelElementFactory elementFactory = ModelElementFactory.getInstance();
-		int count = 0;
-		for (String pkgImport : imports) {
-			IPackageExport export = exports.get(pkgImport);
-			if(export != null && !existingImportsMap.containsKey(pkgImport)) {
-				VersionRange versionRange = VersionRange.newInstance(export.getVersion(), lowerBoundRule, upperBoundRule);
-				IPackageImport newImport = elementFactory.newModelElement(IPackageImport.class);
-				newImport.setPackageName(pkgImport);
-				newImport.setVersions(versionRange);
-				newImport.setOptional(false);
-				
-				bundleInfo.addImport(newImport);
-				count++;
-			}
-		}
-		
-		// Remove required bundles
-		Set<IRequiredBundle> requiredBundles = bundleInfo.getRequiredBundles();
-		int requiredBundlesSize = requiredBundles.size();
-		for (IRequiredBundle requiredBundle : requiredBundles) {
-			bundleInfo.removeRequiredBundle(requiredBundle);
-		}
-
-		// Update the editor
-		if(count + requiredBundlesSize > 0) {
-			IFormPart[] parts = getPage().getManagedForm().getParts();
-			for (IFormPart formPart : parts) {
-				formPart.refresh();
-				((AbstractFormPart) formPart).markDirty();
-			}
-		}
-		
-		MessageDialog.openInformation(getManagedForm().getForm().getShell(), "Dependency Management", "Removed " + requiredBundlesSize + " required bundle(s) and added " + count + " imported package(s).");
-	}
-	
-	private static String getPackageName(IImportDeclaration decl) {
-		String name = decl.getElementName();
-		int lastDot = name.lastIndexOf('.');
-		return name.substring(0, lastDot);
-	}
+    public DependencyManagementSection( SigilPage page, Composite parent, ISigilProjectModel project )
+        throws CoreException
+    {
+        super( page, parent, project );
+    }
+
+
+    protected void createSection( Section section, FormToolkit toolkit ) throws CoreException
+    {
+        setTitle( "Dependency Management" );
+
+        Composite body = createGridBody( 1, false, toolkit );
+
+        hypConvertRBtoIP = toolkit.createHyperlink( body, "Convert Required Bundles to Imported Packages", SWT.NONE );
+        hypConvertRBtoIP.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
+
+        hypConvertRBtoIP.addHyperlinkListener( new HyperlinkAdapter()
+        {
+            public void linkActivated( HyperlinkEvent e )
+            {
+                run();
+            }
+        } );
+    }
+
+
+    protected void run()
+    {
+        final Map<String, IPackageExport> exports = new HashMap<String, IPackageExport>();
+        final Set<String> imports = new HashSet<String>();
+
+        // Find all exports
+        final ExportedPackageFinder exportFinder = new ExportedPackageFinder( getProjectModel(),
+            new AccumulatorAdapter<IPackageExport>()
+            {
+                public void addElements( Collection<? extends IPackageExport> elements )
+                {
+                    for ( IPackageExport export : elements )
+                    {
+                        exports.put( export.getPackageName(), export );
+                    }
+                }
+            } );
+        Job findExportsJob = new Job( "Find exports" )
+        {
+            protected IStatus run( IProgressMonitor monitor )
+            {
+                return exportFinder.run( monitor );
+            }
+        };
+        findExportsJob.setUser( true );
+        findExportsJob.schedule();
+
+        // Find imports from Java source
+        Job findImportsJob = new Job( "Find imports" )
+        {
+            protected IStatus run( IProgressMonitor monitor )
+            {
+                IJavaProject javaProject = getProjectModel().getJavaModel();
+                try
+                {
+                    IPackageFragment[] packages = javaProject.getPackageFragments();
+                    for ( IPackageFragment pkg : packages )
+                    {
+                        ICompilationUnit[] compilationUnits = pkg.getCompilationUnits();
+                        for ( ICompilationUnit compilationUnit : compilationUnits )
+                        {
+                            IImportDeclaration[] importDecls = compilationUnit.getImports();
+                            for ( IImportDeclaration importDecl : importDecls )
+                            {
+                                imports.add( getPackageName( importDecl ) );
+                            }
+                        }
+                    }
+                    return Status.OK_STATUS;
+                }
+                catch ( JavaModelException e )
+                {
+                    return new Status( IStatus.ERROR, SigilUI.PLUGIN_ID, 0, "Error finding imports", e );
+                }
+            }
+        };
+        findImportsJob.setUser( true );
+        findImportsJob.schedule();
+
+        // Wait for both jobs to complete
+        try
+        {
+            findImportsJob.join();
+            findExportsJob.join();
+        }
+        catch ( InterruptedException e )
+        {
+            // Aborted, just do nothing
+            return;
+        }
+
+        // Get the version rules
+        IPreferenceStore prefStore = SigilCore.getDefault().getPreferenceStore();
+        VersionRangeBoundingRule lowerBoundRule = VersionRangeBoundingRule.valueOf( prefStore
+            .getString( SigilCore.DEFAULT_VERSION_LOWER_BOUND ) );
+        VersionRangeBoundingRule upperBoundRule = VersionRangeBoundingRule.valueOf( prefStore
+            .getString( SigilCore.DEFAULT_VERSION_UPPER_BOUND ) );
+
+        // Get the existing imports for the bundle
+        IBundleModelElement bundleInfo = getProjectModel().getBundle().getBundleInfo();
+        Set<IPackageImport> existingImports = bundleInfo.getImports();
+        Map<String, IPackageImport> existingImportsMap = new HashMap<String, IPackageImport>();
+        for ( IPackageImport existingImport : existingImports )
+        {
+            existingImportsMap.put( existingImport.getPackageName(), existingImport );
+        }
+
+        // Add imports to the bundle
+        ModelElementFactory elementFactory = ModelElementFactory.getInstance();
+        int count = 0;
+        for ( String pkgImport : imports )
+        {
+            IPackageExport export = exports.get( pkgImport );
+            if ( export != null && !existingImportsMap.containsKey( pkgImport ) )
+            {
+                VersionRange versionRange = VersionRange.newInstance( export.getVersion(), lowerBoundRule,
+                    upperBoundRule );
+                IPackageImport newImport = elementFactory.newModelElement( IPackageImport.class );
+                newImport.setPackageName( pkgImport );
+                newImport.setVersions( versionRange );
+                newImport.setOptional( false );
+
+                bundleInfo.addImport( newImport );
+                count++;
+            }
+        }
+
+        // Remove required bundles
+        Set<IRequiredBundle> requiredBundles = bundleInfo.getRequiredBundles();
+        int requiredBundlesSize = requiredBundles.size();
+        for ( IRequiredBundle requiredBundle : requiredBundles )
+        {
+            bundleInfo.removeRequiredBundle( requiredBundle );
+        }
+
+        // Update the editor
+        if ( count + requiredBundlesSize > 0 )
+        {
+            IFormPart[] parts = getPage().getManagedForm().getParts();
+            for ( IFormPart formPart : parts )
+            {
+                formPart.refresh();
+                ( ( AbstractFormPart ) formPart ).markDirty();
+            }
+        }
+
+        MessageDialog.openInformation( getManagedForm().getForm().getShell(), "Dependency Management", "Removed "
+            + requiredBundlesSize + " required bundle(s) and added " + count + " imported package(s)." );
+    }
+
+
+    private static String getPackageName( IImportDeclaration decl )
+    {
+        String name = decl.getElementName();
+        int lastDot = name.lastIndexOf( '.' );
+        return name.substring( 0, lastDot );
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/DownloadSection.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/DownloadSection.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/DownloadSection.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/DownloadSection.java Tue Jul 21 18:51:33 2009
@@ -20,8 +20,6 @@
 package org.apache.felix.sigil.ui.eclipse.ui.editors.project;
 
 
-
-
 import org.apache.felix.sigil.eclipse.SigilCore;
 import org.apache.felix.sigil.eclipse.model.project.ISigilProjectModel;
 import org.apache.felix.sigil.model.ModelElementFactory;
@@ -41,100 +39,124 @@
 import org.eclipse.ui.forms.widgets.Section;
 import org.eclipse.ui.forms.widgets.TableWrapData;
 
+
 /**
  * @author dave
  *
  */
-public class DownloadSection extends AbstractResourceSection {
+public class DownloadSection extends AbstractResourceSection
+{
+
+    /**
+     * @param page
+     * @param parent
+     * @param project
+     * @throws CoreException 
+     */
+
+    private IDownloadJar dl;
+
 
-	/**
-	 * @param page
-	 * @param parent
-	 * @param project
-	 * @throws CoreException 
-	 */
-	
-	private IDownloadJar dl;
-	
-	public DownloadSection(SigilPage page, Composite parent, ISigilProjectModel project) throws CoreException {
-		super( page, parent, project );
-	}
-
-	@Override
-	protected void createSection(Section section, FormToolkit toolkit) throws CoreException {
-		setTitle( "Codebase" );
-		
-		Composite body = createTableWrapBody(1, toolkit);
+    public DownloadSection( SigilPage page, Composite parent, ISigilProjectModel project ) throws CoreException
+    {
+        super( page, parent, project );
+    }
+
+
+    @Override
+    protected void createSection( Section section, FormToolkit toolkit ) throws CoreException
+    {
+        setTitle( "Codebase" );
+
+        Composite body = createTableWrapBody( 1, toolkit );
 
         toolkit.createLabel( body, "Specify which resources are included as part of this bundles remote codebase." );
-		
-		tree = toolkit.createTree( body, SWT.CHECK | SWT.BORDER );
-		
-		TableWrapData data = new TableWrapData( TableWrapData.FILL_GRAB);
-		data.heightHint = 200;
-		tree.setLayoutData( data );
-		
-		viewer = new CheckboxTreeViewer( tree );
-		IFolder base = ResourcesPlugin.getWorkspace().getRoot().getFolder(getProjectModel().getJavaModel().getOutputLocation());
-		viewer.setContentProvider( new ContainerTreeProvider() );
-		viewer.setLabelProvider( new ModelLabelProvider() );
-		viewer.addCheckStateListener( this );
-		viewer.setInput( base );
-		
-		dl = getProjectModel().getBundle().getDownloadJar();
-		
-		startWorkspaceListener(base.getWorkspace());
-	}
-
-	@Override
-	public void refresh() {
-		dl = getProjectModel().getBundle().getDownloadJar();
-		super.refresh();
-	}
-
-	@Override
-	public void commit(boolean onSave) {
-		getProjectModel().getBundle().setDownloadJar(dl);			
-		super.commit(onSave);
-	}
-
-	@Override
-	protected void refreshSelections() {
-		// zero the state
-		if ( dl != null ) {
-			for ( IPath path : dl.getEntrys() ) {
-				IResource r = findResource( path );
-				if ( r != null ) {
-					viewer.expandToLevel(r, 0);
-					viewer.setChecked( r, true );
-					viewer.setGrayed( r, false );
-					handleStateChanged(r, true, false, false);
-				}
-				else {
-					SigilCore.error( "Unknown path " + path );
-				}
-			}
-		}
-	}	
-	
-	protected void syncResourceModel(IResource element, boolean checked) {
-		try {
-			if ( dl == null ) {
-				dl = ModelElementFactory.getInstance().newModelElement(IDownloadJar.class);
-				getProjectModel().getBundle().setDownloadJar(dl);
-			}
-			
-			if ( checked ) {
-				dl.addEntry( element.getProjectRelativePath() );
-			}
-			else {
-				dl.removeEntry( element.getProjectRelativePath() );
-			}
-			
-			markDirty();
-		}
-		catch (ModelElementFactoryException e) {
-			SigilCore.error( "Failed to create model element", e );
-		}
-	}	
+
+        tree = toolkit.createTree( body, SWT.CHECK | SWT.BORDER );
+
+        TableWrapData data = new TableWrapData( TableWrapData.FILL_GRAB );
+        data.heightHint = 200;
+        tree.setLayoutData( data );
+
+        viewer = new CheckboxTreeViewer( tree );
+        IFolder base = ResourcesPlugin.getWorkspace().getRoot().getFolder(
+            getProjectModel().getJavaModel().getOutputLocation() );
+        viewer.setContentProvider( new ContainerTreeProvider() );
+        viewer.setLabelProvider( new ModelLabelProvider() );
+        viewer.addCheckStateListener( this );
+        viewer.setInput( base );
+
+        dl = getProjectModel().getBundle().getDownloadJar();
+
+        startWorkspaceListener( base.getWorkspace() );
+    }
+
+
+    @Override
+    public void refresh()
+    {
+        dl = getProjectModel().getBundle().getDownloadJar();
+        super.refresh();
+    }
+
+
+    @Override
+    public void commit( boolean onSave )
+    {
+        getProjectModel().getBundle().setDownloadJar( dl );
+        super.commit( onSave );
+    }
+
+
+    @Override
+    protected void refreshSelections()
+    {
+        // zero the state
+        if ( dl != null )
+        {
+            for ( IPath path : dl.getEntrys() )
+            {
+                IResource r = findResource( path );
+                if ( r != null )
+                {
+                    viewer.expandToLevel( r, 0 );
+                    viewer.setChecked( r, true );
+                    viewer.setGrayed( r, false );
+                    handleStateChanged( r, true, false, false );
+                }
+                else
+                {
+                    SigilCore.error( "Unknown path " + path );
+                }
+            }
+        }
+    }
+
+
+    protected void syncResourceModel( IResource element, boolean checked )
+    {
+        try
+        {
+            if ( dl == null )
+            {
+                dl = ModelElementFactory.getInstance().newModelElement( IDownloadJar.class );
+                getProjectModel().getBundle().setDownloadJar( dl );
+            }
+
+            if ( checked )
+            {
+                dl.addEntry( element.getProjectRelativePath() );
+            }
+            else
+            {
+                dl.removeEntry( element.getProjectRelativePath() );
+            }
+
+            markDirty();
+        }
+        catch ( ModelElementFactoryException e )
+        {
+            SigilCore.error( "Failed to create model element", e );
+        }
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ExcludedResourcesFilter.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ExcludedResourcesFilter.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ExcludedResourcesFilter.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ExcludedResourcesFilter.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.editors.project;
 
+
 import java.util.HashSet;
 import java.util.Set;
 import java.util.regex.Pattern;
@@ -31,33 +32,44 @@
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerFilter;
 
-public class ExcludedResourcesFilter extends ViewerFilter {
 
-	private final Set<Pattern> exclusionSet = new HashSet<Pattern>();
-	
-	public ExcludedResourcesFilter() {
-		loadExclusions();
-	}
-
-	public final synchronized void loadExclusions() {
-		exclusionSet.clear();
-		IPreferenceStore store = SigilCore.getDefault().getPreferenceStore();
-		String[] exclusions = PrefsUtils.stringToArray(store.getString(SigilCore.DEFAULT_EXCLUDED_RESOURCES));
-		for (String exclusion : exclusions) {
-			exclusionSet.add(GlobCompiler.compile(exclusion));
-		}
-	}
-
-	@Override
-	public synchronized boolean select(Viewer viewer, Object parentElement, Object element) {
-		IResource file = (IResource) element;
-		String path = file.getName();
-		for ( Pattern p :exclusionSet ) {
-			if ( p.matcher(path).matches() ) {
-				return false;
-			}
-		}
-		return true;
-	}
+public class ExcludedResourcesFilter extends ViewerFilter
+{
+
+    private final Set<Pattern> exclusionSet = new HashSet<Pattern>();
+
+
+    public ExcludedResourcesFilter()
+    {
+        loadExclusions();
+    }
+
+
+    public final synchronized void loadExclusions()
+    {
+        exclusionSet.clear();
+        IPreferenceStore store = SigilCore.getDefault().getPreferenceStore();
+        String[] exclusions = PrefsUtils.stringToArray( store.getString( SigilCore.DEFAULT_EXCLUDED_RESOURCES ) );
+        for ( String exclusion : exclusions )
+        {
+            exclusionSet.add( GlobCompiler.compile( exclusion ) );
+        }
+    }
+
+
+    @Override
+    public synchronized boolean select( Viewer viewer, Object parentElement, Object element )
+    {
+        IResource file = ( IResource ) element;
+        String path = file.getName();
+        for ( Pattern p : exclusionSet )
+        {
+            if ( p.matcher( path ).matches() )
+            {
+                return false;
+            }
+        }
+        return true;
+    }
 
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ExportPackagesSection.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ExportPackagesSection.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ExportPackagesSection.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ExportPackagesSection.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.editors.project;
 
+
 import java.util.Iterator;
 import java.util.List;
 
@@ -46,131 +47,173 @@
 import org.eclipse.ui.forms.widgets.FormToolkit;
 import org.osgi.framework.Version;
 
-public class ExportPackagesSection extends BundleDependencySection {
 
-	public ExportPackagesSection(SigilPage page, Composite parent, ISigilProjectModel project) throws CoreException {
-		super( page, parent, project );
-	}
-		
-	@Override
-	protected String getTitle() {
-		return "Export Packages";
-	}
-
-	@Override
-	protected Label createLabel(Composite parent, FormToolkit toolkit) {
-		return toolkit.createLabel( parent, "Specify which packages this bundle shares with other bundles." );
-	}
-
-	@Override
-	protected IContentProvider getContentProvider() {
-        return new DefaultTableProvider() {
-			public Object[] getElements(Object inputElement) {
-				return getBundle().getBundleInfo().getExports().toArray();
-			}
-	    };
-	}
-
-	@Override
-	protected void handleAdd() {
-		NewPackageExportDialog dialog = ResourcesDialogHelper.createNewExportDialog(getSection().getShell(), "Add Exported Package", null, getProjectModel(), true);
-
-		if ( dialog.open() == Window.OK ) {
-			try {
-				// Add selected exports
-				boolean exportsAdded = false;
-				
-				List<IPackageFragment> newPkgFragments = dialog.getSelectedElements();
-				for (IPackageFragment pkgFragment : newPkgFragments) {
-					IPackageExport pkgExport = ModelElementFactory.getInstance().newModelElement(IPackageExport.class);
-					pkgExport.setPackageName(pkgFragment.getElementName());
-					pkgExport.setVersion(dialog.getVersion());
-					getBundle().getBundleInfo().addExport(pkgExport);
-					
-					exportsAdded = true;
-				}
-
-				// Add corresponding imports (maybe)
-				boolean importsAdded = false;
-				
-				IPreferenceStore store = SigilCore.getDefault().getPreferenceStore();
-				boolean shouldAddImports = OptionalPrompt.optionallyPrompt(store, SigilCore.PREFERENCES_ADD_IMPORT_FOR_EXPORT, "Add Exports", "Should corresponding imports be added?", getSection().getShell());
-				if(shouldAddImports) {
-					for (IPackageFragment pkgFragment : newPkgFragments) {
-						IPackageImport pkgImport = ModelElementFactory.getInstance().newModelElement(IPackageImport.class);
-						pkgImport.setPackageName(pkgFragment.getElementName());
-						VersionRangeBoundingRule lowerBound = VersionRangeBoundingRule.valueOf(store.getString(SigilCore.DEFAULT_VERSION_LOWER_BOUND));
-						VersionRangeBoundingRule upperBound = VersionRangeBoundingRule.valueOf(store.getString(SigilCore.DEFAULT_VERSION_UPPER_BOUND));
-						Version version = dialog.getVersion();
-						if(version == null) {
-							version = getBundle().getVersion();
-						}
-						VersionRange versionRange = VersionRange.newInstance(version, lowerBound, upperBound);
-						pkgImport.setVersions(versionRange);
-						
-						getBundle().getBundleInfo().addImport(pkgImport);
-						
-						importsAdded = true;
-					}
-				}
-				
-				if(importsAdded) {
-					((SigilProjectEditorPart) getPage().getEditor()).refreshAllPages();
-					markDirty();
-				} else if(exportsAdded) {
-					refresh();
-					markDirty();
-				}
-			}
-			catch (ModelElementFactoryException e) {
-				SigilCore.error( "Failed to buiild model element for package export", e);
-			}
-		}
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	protected void handleEdit() {
-		IStructuredSelection selection = (IStructuredSelection) getSelection();
-		
-		boolean changed = false;
-		
-		if ( !selection.isEmpty() ) {
-			for ( Iterator<IPackageExport> i = selection.iterator(); i.hasNext(); ) {	
-				IPackageExport packageExport = i.next();
-				NewPackageExportDialog dialog = ResourcesDialogHelper.createNewExportDialog(getSection().getShell(), "Edit Imported Package", packageExport, getProjectModel(), false);
-				if ( dialog.open() == Window.OK ) {
-					changed = true;
-					IPackageFragment pkgFragment = dialog.getSelectedElement();
-					packageExport.setPackageName(pkgFragment.getElementName());
-					packageExport.setVersion(dialog.getVersion());
-				}
-			}
-		}
-		
-		if ( changed ) {
-			refresh();
-			markDirty();
-		}
-	}
-
-	@SuppressWarnings("unchecked") 
-	@Override
-	protected void handleRemoved() {
-		IStructuredSelection selection = (IStructuredSelection) getSelection();
-
-		if ( !selection.isEmpty() ) {
-			for ( Iterator<IPackageExport> i = selection.iterator(); i.hasNext(); ) {			
-				getBundle().getBundleInfo().removeExport( i.next() );
-			}		
-			
-			refresh();
-			markDirty();
-		}
-	}
-		
-	private ISigilBundle getBundle() {
-		return getProjectModel().getBundle();
-	}
+public class ExportPackagesSection extends BundleDependencySection
+{
+
+    public ExportPackagesSection( SigilPage page, Composite parent, ISigilProjectModel project ) throws CoreException
+    {
+        super( page, parent, project );
+    }
+
+
+    @Override
+    protected String getTitle()
+    {
+        return "Export Packages";
+    }
+
+
+    @Override
+    protected Label createLabel( Composite parent, FormToolkit toolkit )
+    {
+        return toolkit.createLabel( parent, "Specify which packages this bundle shares with other bundles." );
+    }
+
+
+    @Override
+    protected IContentProvider getContentProvider()
+    {
+        return new DefaultTableProvider()
+        {
+            public Object[] getElements( Object inputElement )
+            {
+                return getBundle().getBundleInfo().getExports().toArray();
+            }
+        };
+    }
+
+
+    @Override
+    protected void handleAdd()
+    {
+        NewPackageExportDialog dialog = ResourcesDialogHelper.createNewExportDialog( getSection().getShell(),
+            "Add Exported Package", null, getProjectModel(), true );
+
+        if ( dialog.open() == Window.OK )
+        {
+            try
+            {
+                // Add selected exports
+                boolean exportsAdded = false;
+
+                List<IPackageFragment> newPkgFragments = dialog.getSelectedElements();
+                for ( IPackageFragment pkgFragment : newPkgFragments )
+                {
+                    IPackageExport pkgExport = ModelElementFactory.getInstance().newModelElement( IPackageExport.class );
+                    pkgExport.setPackageName( pkgFragment.getElementName() );
+                    pkgExport.setVersion( dialog.getVersion() );
+                    getBundle().getBundleInfo().addExport( pkgExport );
+
+                    exportsAdded = true;
+                }
+
+                // Add corresponding imports (maybe)
+                boolean importsAdded = false;
+
+                IPreferenceStore store = SigilCore.getDefault().getPreferenceStore();
+                boolean shouldAddImports = OptionalPrompt.optionallyPrompt( store,
+                    SigilCore.PREFERENCES_ADD_IMPORT_FOR_EXPORT, "Add Exports",
+                    "Should corresponding imports be added?", getSection().getShell() );
+                if ( shouldAddImports )
+                {
+                    for ( IPackageFragment pkgFragment : newPkgFragments )
+                    {
+                        IPackageImport pkgImport = ModelElementFactory.getInstance().newModelElement(
+                            IPackageImport.class );
+                        pkgImport.setPackageName( pkgFragment.getElementName() );
+                        VersionRangeBoundingRule lowerBound = VersionRangeBoundingRule.valueOf( store
+                            .getString( SigilCore.DEFAULT_VERSION_LOWER_BOUND ) );
+                        VersionRangeBoundingRule upperBound = VersionRangeBoundingRule.valueOf( store
+                            .getString( SigilCore.DEFAULT_VERSION_UPPER_BOUND ) );
+                        Version version = dialog.getVersion();
+                        if ( version == null )
+                        {
+                            version = getBundle().getVersion();
+                        }
+                        VersionRange versionRange = VersionRange.newInstance( version, lowerBound, upperBound );
+                        pkgImport.setVersions( versionRange );
+
+                        getBundle().getBundleInfo().addImport( pkgImport );
+
+                        importsAdded = true;
+                    }
+                }
+
+                if ( importsAdded )
+                {
+                    ( ( SigilProjectEditorPart ) getPage().getEditor() ).refreshAllPages();
+                    markDirty();
+                }
+                else if ( exportsAdded )
+                {
+                    refresh();
+                    markDirty();
+                }
+            }
+            catch ( ModelElementFactoryException e )
+            {
+                SigilCore.error( "Failed to buiild model element for package export", e );
+            }
+        }
+    }
+
+
+    @SuppressWarnings("unchecked")
+    @Override
+    protected void handleEdit()
+    {
+        IStructuredSelection selection = ( IStructuredSelection ) getSelection();
+
+        boolean changed = false;
+
+        if ( !selection.isEmpty() )
+        {
+            for ( Iterator<IPackageExport> i = selection.iterator(); i.hasNext(); )
+            {
+                IPackageExport packageExport = i.next();
+                NewPackageExportDialog dialog = ResourcesDialogHelper.createNewExportDialog( getSection().getShell(),
+                    "Edit Imported Package", packageExport, getProjectModel(), false );
+                if ( dialog.open() == Window.OK )
+                {
+                    changed = true;
+                    IPackageFragment pkgFragment = dialog.getSelectedElement();
+                    packageExport.setPackageName( pkgFragment.getElementName() );
+                    packageExport.setVersion( dialog.getVersion() );
+                }
+            }
+        }
+
+        if ( changed )
+        {
+            refresh();
+            markDirty();
+        }
+    }
+
+
+    @SuppressWarnings("unchecked")
+    @Override
+    protected void handleRemoved()
+    {
+        IStructuredSelection selection = ( IStructuredSelection ) getSelection();
+
+        if ( !selection.isEmpty() )
+        {
+            for ( Iterator<IPackageExport> i = selection.iterator(); i.hasNext(); )
+            {
+                getBundle().getBundleInfo().removeExport( i.next() );
+            }
+
+            refresh();
+            markDirty();
+        }
+    }
+
+
+    private ISigilBundle getBundle()
+    {
+        return getProjectModel().getBundle();
+    }
 
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ExportsForm.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ExportsForm.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ExportsForm.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ExportsForm.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.editors.project;
 
+
 import org.apache.felix.sigil.eclipse.SigilCore;
 import org.apache.felix.sigil.eclipse.model.project.ISigilProjectModel;
 import org.apache.felix.sigil.ui.eclipse.ui.form.SigilPage;
@@ -30,23 +31,29 @@
 import org.eclipse.ui.forms.widgets.TableWrapData;
 import org.eclipse.ui.forms.widgets.TableWrapLayout;
 
-public class ExportsForm extends SigilPage  {
 
-	public static final String PAGE_ID = "exports";
-	
-	private ISigilProjectModel project;
-	
-	public ExportsForm(FormEditor editor, ISigilProjectModel project) {
-		super(editor, PAGE_ID, "Exports");
-		this.project = project;
-	}
-	
+public class ExportsForm extends SigilPage
+{
+
+    public static final String PAGE_ID = "exports";
+
+    private ISigilProjectModel project;
+
+
+    public ExportsForm( FormEditor editor, ISigilProjectModel project )
+    {
+        super( editor, PAGE_ID, "Exports" );
+        this.project = project;
+    }
+
+
     @Override
-    protected void createFormContent(IManagedForm managedForm) {
+    protected void createFormContent( IManagedForm managedForm )
+    {
         ScrolledForm form = managedForm.getForm();
         form.setText( "Exports" );
-        
-        Composite body = form.getBody();        
+
+        Composite body = form.getBody();
         TableWrapLayout layout = new TableWrapLayout();
         layout.bottomMargin = 10;
         layout.topMargin = 5;
@@ -55,15 +62,17 @@
         layout.numColumns = 1;
         layout.horizontalSpacing = 10;
         layout.verticalSpacing = 20;
-        body.setLayout(layout);
-        body.setLayoutData(new TableWrapData(TableWrapData.FILL));
-                       
-        try {
-	        ExportPackagesSection exportPackages = new ExportPackagesSection( this, body, project );
-	        managedForm.addPart( exportPackages );
+        body.setLayout( layout );
+        body.setLayoutData( new TableWrapData( TableWrapData.FILL ) );
+
+        try
+        {
+            ExportPackagesSection exportPackages = new ExportPackagesSection( this, body, project );
+            managedForm.addPart( exportPackages );
         }
-        catch (CoreException e) {
-        	SigilCore.error( "Failed to create contents form", e);
+        catch ( CoreException e )
+        {
+            SigilCore.error( "Failed to create contents form", e );
         }
     }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/GeneralInfoSection.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/GeneralInfoSection.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/GeneralInfoSection.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/GeneralInfoSection.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.editors.project;
 
+
 import org.apache.felix.sigil.eclipse.model.project.ISigilProjectModel;
 import org.apache.felix.sigil.model.ModelElementFactory;
 import org.apache.felix.sigil.model.eclipse.ISigilBundle;
@@ -43,180 +44,227 @@
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.Version;
 
+
 /**
  * @author dave
  *
  */
-public class GeneralInfoSection extends SigilSection {
+public class GeneralInfoSection extends SigilSection
+{
 
-	private String name;
-	private String symbolicName;
+    private String name;
+    private String symbolicName;
     private Version version;
     private String description;
     private String provider;
     private String activator;
     private IRequiredBundle fragmentHost;
-    
+
     private SigilFormEntry nameEntry;
-	private SigilFormEntry symbolicNameEntry;
+    private SigilFormEntry symbolicNameEntry;
     private SigilFormEntry versionEntry;
     private SigilFormEntry descriptionEntry;
     private SigilFormEntry providerEntry;
     private SigilFormEntry activatorEntry;
     private SigilFormEntry fragmentHostEntry;
-    
+
+
     /**
      * @param parent
      * @param toolkit
      * @param style
      * @throws CoreException 
      */
-    public GeneralInfoSection(SigilPage page, Composite parent, ISigilProjectModel project) throws CoreException {
-		super( page, parent, project );
-	}    
-
-    protected void createSection(Section section,FormToolkit toolkit ) {
-        setTitle("General Information");
-                
-		Composite body = createGridBody(3, false, toolkit);
-        
+    public GeneralInfoSection( SigilPage page, Composite parent, ISigilProjectModel project ) throws CoreException
+    {
+        super( page, parent, project );
+    }
+
+
+    protected void createSection( Section section, FormToolkit toolkit )
+    {
+        setTitle( "General Information" );
+
+        Composite body = createGridBody( 3, false, toolkit );
+
         Label label = toolkit.createLabel( body, "This section describes general information about this project." );
-        label.setLayoutData( new GridData(SWT.LEFT, SWT.CENTER, true, false, 3, 1) );
-       
-        symbolicNameEntry = new SigilFormEntry(body, toolkit, "Symbolic Name");
-        symbolicNameEntry.setFormEntryListener( new SigilFormEntryAdapter() {
-			@Override
-			public void textValueChanged(SigilFormEntry form) {
-				symbolicName = nullIfEmpty((String) form.getValue());
-				checkDirty();
-			}
-        });
-        
-        nameEntry = new SigilFormEntry(body, toolkit, "Name");
-        nameEntry.setFormEntryListener( new SigilFormEntryAdapter() {
-			@Override
-			public void textValueChanged(SigilFormEntry form) {
-				name = nullIfEmpty((String) form.getValue());
-				checkDirty();
-			}
-        });
-        
-        descriptionEntry = new SigilFormEntry(body, toolkit, "Description");
-        descriptionEntry.setFormEntryListener( new SigilFormEntryAdapter() {
-			@Override
-			public void textValueChanged(SigilFormEntry form) {
-				description = nullIfEmpty((String) form.getValue());
-				checkDirty();
-			}
-        });
-        
-        IFormValueConverter converter = new IFormValueConverter() {
-			public String getLabel(Object value) {
-				Version v = (Version) value;
-				return v.toString();
-			}
-
-			public Object getValue(String label) {
-				return Version.parseVersion(label);
-			}        	
+        label.setLayoutData( new GridData( SWT.LEFT, SWT.CENTER, true, false, 3, 1 ) );
+
+        symbolicNameEntry = new SigilFormEntry( body, toolkit, "Symbolic Name" );
+        symbolicNameEntry.setFormEntryListener( new SigilFormEntryAdapter()
+        {
+            @Override
+            public void textValueChanged( SigilFormEntry form )
+            {
+                symbolicName = nullIfEmpty( ( String ) form.getValue() );
+                checkDirty();
+            }
+        } );
+
+        nameEntry = new SigilFormEntry( body, toolkit, "Name" );
+        nameEntry.setFormEntryListener( new SigilFormEntryAdapter()
+        {
+            @Override
+            public void textValueChanged( SigilFormEntry form )
+            {
+                name = nullIfEmpty( ( String ) form.getValue() );
+                checkDirty();
+            }
+        } );
+
+        descriptionEntry = new SigilFormEntry( body, toolkit, "Description" );
+        descriptionEntry.setFormEntryListener( new SigilFormEntryAdapter()
+        {
+            @Override
+            public void textValueChanged( SigilFormEntry form )
+            {
+                description = nullIfEmpty( ( String ) form.getValue() );
+                checkDirty();
+            }
+        } );
+
+        IFormValueConverter converter = new IFormValueConverter()
+        {
+            public String getLabel( Object value )
+            {
+                Version v = ( Version ) value;
+                return v.toString();
+            }
+
+
+            public Object getValue( String label )
+            {
+                return Version.parseVersion( label );
+            }
+        };
+
+        versionEntry = new SigilFormEntry( body, toolkit, "Version", null, converter );
+        versionEntry.setFormEntryListener( new SigilFormEntryAdapter()
+        {
+            @Override
+            public void textValueChanged( SigilFormEntry form )
+            {
+                version = ( Version ) form.getValue();
+                checkDirty();
+            }
+        } );
+
+        providerEntry = new SigilFormEntry( body, toolkit, "Provider" );
+        providerEntry.setFormEntryListener( new SigilFormEntryAdapter()
+        {
+            @Override
+            public void textValueChanged( SigilFormEntry form )
+            {
+                provider = nullIfEmpty( ( String ) form.getValue() );
+                checkDirty();
+            }
+        } );
+
+        activatorEntry = new SigilFormEntry( body, toolkit, "Bundle Activator", "Browse...", null );
+        activatorEntry.setFormEntryListener( new SigilFormEntryAdapter()
+        {
+            @Override
+            public void textValueChanged( SigilFormEntry form )
+            {
+                activator = ( String ) form.getValue();
+                checkDirty();
+            }
+
+
+            @Override
+            public void browseButtonSelected( SigilFormEntry form )
+            {
+                BackgroundLoadingSelectionDialog<String> dialog = ResourcesDialogHelper.createClassSelectDialog(
+                    getShell(), "Add Bundle Activator", getProjectModel(), activator, BundleActivator.class.getName() );
+
+                if ( dialog.open() == Window.OK )
+                {
+                    form.setValue( dialog.getSelectedElement() );
+                }
+            }
+        } );
+
+        converter = new IFormValueConverter()
+        {
+            public String getLabel( Object value )
+            {
+                IRequiredBundle b = ( IRequiredBundle ) value;
+                return b == null ? null : b.getSymbolicName() + " " + b.getVersions();
+            }
+
+
+            public Object getValue( String label )
+            {
+                return null;
+            }
         };
-        
-        versionEntry = new SigilFormEntry(body, toolkit, "Version", null, converter);
-        versionEntry.setFormEntryListener( new SigilFormEntryAdapter() {
-			@Override
-			public void textValueChanged(SigilFormEntry form) {
-				version = (Version) form.getValue();
-				checkDirty();
-			}
-        });
-        
-        providerEntry = new SigilFormEntry(body, toolkit, "Provider");
-        providerEntry.setFormEntryListener( new SigilFormEntryAdapter() {
-			@Override
-			public void textValueChanged(SigilFormEntry form) {
-				provider = nullIfEmpty((String) form.getValue());
-				checkDirty();
-			}
-        });
-
-		activatorEntry = new SigilFormEntry(body, toolkit, "Bundle Activator", "Browse...", null);
-		activatorEntry.setFormEntryListener( new SigilFormEntryAdapter() {
-			@Override
-			public void textValueChanged(SigilFormEntry form) {
-				activator = (String) form.getValue();
-				checkDirty();
-			}
-
-			@Override
-			public void browseButtonSelected(SigilFormEntry form) {
-				BackgroundLoadingSelectionDialog<String> dialog = ResourcesDialogHelper.createClassSelectDialog(getShell(), "Add Bundle Activator", getProjectModel(), activator, BundleActivator.class.getName());
-				
-				if (dialog.open() == Window.OK) {
-					form.setValue(dialog.getSelectedElement());
-				}				
-			}			
-		});
-		
-		converter = new IFormValueConverter() {
-			public String getLabel(Object value) {
-				IRequiredBundle b = (IRequiredBundle) value;
-				return b == null ? null : b.getSymbolicName() + " " + b.getVersions();
-			}
-
-			public Object getValue(String label) {
-				return null;
-			}			
-		};
-		
-		fragmentHostEntry = new SigilFormEntry(body, toolkit, "Fragment Host", "Browse...", converter );
-		fragmentHostEntry.setFormEntryListener( new SigilFormEntryAdapter() {
-			@Override
-			public void textValueChanged(SigilFormEntry form) {
-				fragmentHost = (IRequiredBundle) form.getValue();
-				checkDirty();
-			}
-
-			@Override
-			public void browseButtonSelected(SigilFormEntry form) {
-				NewResourceSelectionDialog<IBundleModelElement> dialog = ResourcesDialogHelper.createRequiredBundleDialog( getSection().getShell(), "Add Required Bundle", getProjectModel(), null, getBundle().getBundleInfo().getRequiredBundles() );
-				
-				if (dialog.open() == Window.OK) {
-					IRequiredBundle required = ModelElementFactory.getInstance().newModelElement( IRequiredBundle.class );
-					required.setSymbolicName(dialog.getSelectedName());
-					required.setVersions(dialog.getSelectedVersions());				
-					form.setValue(required);
-				}				
-			}			
-		});
-		fragmentHostEntry.setFreeText(false);
-    }
-    
-	private static String nullIfEmpty(String value) {
-		if ( value.trim().length() == 0 ) {
-			return null;
-		}
-		return value;
-	}
-	
-	private Shell getShell() {
-		return getSection().getShell();
-	}
-
-	@Override
-	public void commit(boolean onSave) {
-		getBundle().getBundleInfo().setSymbolicName( symbolicName );
-		getBundle().getBundleInfo().setName( name );
-		getBundle().getBundleInfo().setVersion( version );
-		getBundle().getBundleInfo().setDescription( description );
-		getBundle().getBundleInfo().setVendor( provider );
-		getBundle().getBundleInfo().setFragmentHost(fragmentHost);
-		getBundle().getBundleInfo().setActivator(activator);
-		
-		super.commit(onSave);
-	}
 
-	@Override
-	public void refresh() {
+        fragmentHostEntry = new SigilFormEntry( body, toolkit, "Fragment Host", "Browse...", converter );
+        fragmentHostEntry.setFormEntryListener( new SigilFormEntryAdapter()
+        {
+            @Override
+            public void textValueChanged( SigilFormEntry form )
+            {
+                fragmentHost = ( IRequiredBundle ) form.getValue();
+                checkDirty();
+            }
+
+
+            @Override
+            public void browseButtonSelected( SigilFormEntry form )
+            {
+                NewResourceSelectionDialog<IBundleModelElement> dialog = ResourcesDialogHelper
+                    .createRequiredBundleDialog( getSection().getShell(), "Add Required Bundle", getProjectModel(),
+                        null, getBundle().getBundleInfo().getRequiredBundles() );
+
+                if ( dialog.open() == Window.OK )
+                {
+                    IRequiredBundle required = ModelElementFactory.getInstance()
+                        .newModelElement( IRequiredBundle.class );
+                    required.setSymbolicName( dialog.getSelectedName() );
+                    required.setVersions( dialog.getSelectedVersions() );
+                    form.setValue( required );
+                }
+            }
+        } );
+        fragmentHostEntry.setFreeText( false );
+    }
+
+
+    private static String nullIfEmpty( String value )
+    {
+        if ( value.trim().length() == 0 )
+        {
+            return null;
+        }
+        return value;
+    }
+
+
+    private Shell getShell()
+    {
+        return getSection().getShell();
+    }
+
+
+    @Override
+    public void commit( boolean onSave )
+    {
+        getBundle().getBundleInfo().setSymbolicName( symbolicName );
+        getBundle().getBundleInfo().setName( name );
+        getBundle().getBundleInfo().setVersion( version );
+        getBundle().getBundleInfo().setDescription( description );
+        getBundle().getBundleInfo().setVendor( provider );
+        getBundle().getBundleInfo().setFragmentHost( fragmentHost );
+        getBundle().getBundleInfo().setActivator( activator );
+
+        super.commit( onSave );
+    }
+
+
+    @Override
+    public void refresh()
+    {
         symbolicName = getProjectModel().getBundle().getBundleInfo().getSymbolicName();
         name = getProjectModel().getBundle().getBundleInfo().getName();
         description = getProjectModel().getBundle().getBundleInfo().getDescription();
@@ -224,35 +272,42 @@
         provider = getProjectModel().getBundle().getBundleInfo().getVendor();
         fragmentHost = getProjectModel().getBundle().getBundleInfo().getFragmentHost();
         activator = getProjectModel().getBundle().getBundleInfo().getActivator();
-        
-        nameEntry.setValue(name);
-    	symbolicNameEntry.setValue(symbolicName);
-    	versionEntry.setValue(version);
-        descriptionEntry.setValue(description);
-        providerEntry.setValue(provider);
-        fragmentHostEntry.setValue(fragmentHost);
-        activatorEntry.setValue(activator);
-        
-		super.refresh();
-	}
-
-	private void checkDirty() {
-		boolean dirty = different(symbolicName, getProjectModel().getBundle().getBundleInfo().getSymbolicName() ) ||
-						different(name, getProjectModel().getBundle().getBundleInfo().getName() ) ||
-						different(version, getProjectModel().getBundle().getBundleInfo().getVersion() ) ||
-						different(description, getProjectModel().getBundle().getBundleInfo().getDescription()) ||
-						different(provider, getProjectModel().getBundle().getBundleInfo().getVendor()) ||
-						different(fragmentHost, getProjectModel().getBundle().getBundleInfo().getFragmentHost()) ||
-						different(activator, getProjectModel().getBundle().getBundleInfo().getActivator());
-				
-		if ( dirty ) markDirty();
-	}
-	
-	private boolean different(Object val1, Object val2) {
-		return val1 == null ? val2 != null : !val1.equals( val2 );
-	}
-
-	private ISigilBundle getBundle() {
-		return getProjectModel().getBundle();
-	}
+
+        nameEntry.setValue( name );
+        symbolicNameEntry.setValue( symbolicName );
+        versionEntry.setValue( version );
+        descriptionEntry.setValue( description );
+        providerEntry.setValue( provider );
+        fragmentHostEntry.setValue( fragmentHost );
+        activatorEntry.setValue( activator );
+
+        super.refresh();
+    }
+
+
+    private void checkDirty()
+    {
+        boolean dirty = different( symbolicName, getProjectModel().getBundle().getBundleInfo().getSymbolicName() )
+            || different( name, getProjectModel().getBundle().getBundleInfo().getName() )
+            || different( version, getProjectModel().getBundle().getBundleInfo().getVersion() )
+            || different( description, getProjectModel().getBundle().getBundleInfo().getDescription() )
+            || different( provider, getProjectModel().getBundle().getBundleInfo().getVendor() )
+            || different( fragmentHost, getProjectModel().getBundle().getBundleInfo().getFragmentHost() )
+            || different( activator, getProjectModel().getBundle().getBundleInfo().getActivator() );
+
+        if ( dirty )
+            markDirty();
+    }
+
+
+    private boolean different( Object val1, Object val2 )
+    {
+        return val1 == null ? val2 != null : !val1.equals( val2 );
+    }
+
+
+    private ISigilBundle getBundle()
+    {
+        return getProjectModel().getBundle();
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/IDependencyChecker.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/IDependencyChecker.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/IDependencyChecker.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/IDependencyChecker.java Tue Jul 21 18:51:33 2009
@@ -19,10 +19,15 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.editors.project;
 
+
 import org.apache.felix.sigil.model.osgi.IPackageImport;
 import org.apache.felix.sigil.model.osgi.IRequiredBundle;
 
-public interface IDependencyChecker {
-	boolean isSatisfied(IPackageImport packageImport);
-	boolean isSatisfied(IRequiredBundle requiredBundle);
+
+public interface IDependencyChecker
+{
+    boolean isSatisfied( IPackageImport packageImport );
+
+
+    boolean isSatisfied( IRequiredBundle requiredBundle );
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/IElementDescriptor.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/IElementDescriptor.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/IElementDescriptor.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/IElementDescriptor.java Tue Jul 21 18:51:33 2009
@@ -19,18 +19,21 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.editors.project;
 
-public interface IElementDescriptor<E> {	
-	/**
-	 * Return the short identifying name of the element.
-	 */
-	String getName(E element);
 
-	/**
-	 * Return a label for the element, including the name but possibly supplying
-	 * additional information.
-	 * 
-	 * @param element
-	 * @return
-	 */
-	String getLabel(E element);
+public interface IElementDescriptor<E>
+{
+    /**
+     * Return the short identifying name of the element.
+     */
+    String getName( E element );
+
+
+    /**
+     * Return a label for the element, including the name but possibly supplying
+     * additional information.
+     * 
+     * @param element
+     * @return
+     */
+    String getLabel( E element );
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ImportPackagesSection.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ImportPackagesSection.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ImportPackagesSection.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ImportPackagesSection.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.editors.project;
 
+
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -42,112 +43,133 @@
 import org.eclipse.swt.widgets.Label;
 import org.eclipse.ui.forms.widgets.FormToolkit;
 
-public class ImportPackagesSection extends BundleDependencySection {
-	
-	public ImportPackagesSection(SigilPage page, Composite parent, ISigilProjectModel project, Set<IModelElement> unresolvedPackages) throws CoreException {
-		super( page, parent, project, unresolvedPackages );
-	}
-
-	@Override
-	protected String getTitle() {
-		return "Import Packages";
-	}
-	
-	@Override
-	protected Label createLabel(Composite parent, FormToolkit toolkit) {
-		return toolkit.createLabel( parent, "Specify which packages this bundle imports from other bundles." );
-	}
-
-
-	@Override
-	protected IContentProvider getContentProvider() {
-		return new DefaultTableProvider() {
-			public Object[] getElements(Object inputElement) {
-				ArrayList<IPackageImport> imports = new ArrayList<IPackageImport>(getBundle().getBundleInfo().getImports());
-				Collections.sort(imports, new Comparator<IPackageImport>() {
-					public int compare(IPackageImport o1, IPackageImport o2) {
-						return o1.getPackageName().compareTo( o2.getPackageName() );
-					}
-				});
-				return imports.toArray();
-			}
+
+public class ImportPackagesSection extends BundleDependencySection
+{
+
+    public ImportPackagesSection( SigilPage page, Composite parent, ISigilProjectModel project,
+        Set<IModelElement> unresolvedPackages ) throws CoreException
+    {
+        super( page, parent, project, unresolvedPackages );
+    }
+
+
+    @Override
+    protected String getTitle()
+    {
+        return "Import Packages";
+    }
+
+
+    @Override
+    protected Label createLabel( Composite parent, FormToolkit toolkit )
+    {
+        return toolkit.createLabel( parent, "Specify which packages this bundle imports from other bundles." );
+    }
+
+
+    @Override
+    protected IContentProvider getContentProvider()
+    {
+        return new DefaultTableProvider()
+        {
+            public Object[] getElements( Object inputElement )
+            {
+                ArrayList<IPackageImport> imports = new ArrayList<IPackageImport>( getBundle().getBundleInfo()
+                    .getImports() );
+                Collections.sort( imports, new Comparator<IPackageImport>()
+                {
+                    public int compare( IPackageImport o1, IPackageImport o2 )
+                    {
+                        return o1.getPackageName().compareTo( o2.getPackageName() );
+                    }
+                } );
+                return imports.toArray();
+            }
         };
-	}
+    }
+
 
-	protected ISigilBundle getBundle() {
-		return getProjectModel().getBundle();
-	}
-
-	@Override
-	protected void handleAdd() {
-		NewResourceSelectionDialog<? extends IPackageModelElement> dialog = 
-			ResourcesDialogHelper.createImportDialog(
-					getSection().getShell(), 
-					"Add Imported Package", 
-					getProjectModel(), 
-					null, 
-					getBundle().getBundleInfo().getImports() );
-		
-		if ( dialog.open() == Window.OK ) {
-			IPackageImport pi = ModelElementFactory.getInstance().newModelElement(IPackageImport.class);
-			pi.setPackageName(dialog.getSelectedName());
-			pi.setVersions(dialog.getSelectedVersions());
-			pi.setOptional(dialog.isOptional());
-			
-			getBundle().getBundleInfo().addImport(pi);
-			refresh();
-			markDirty();
-		}
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	protected void handleRemoved() {
-		IStructuredSelection selection = (IStructuredSelection) getSelection();
-
-		if ( !selection.isEmpty() ) {
-			for ( Iterator<IPackageImport> i = selection.iterator(); i.hasNext(); ) {			
-				getBundle().getBundleInfo().removeImport( i.next() );
-			}		
-			
-			refresh();
-			markDirty();
-		}
-	}
-	
-	@SuppressWarnings("unchecked")
-	@Override
-	protected void handleEdit() {
-		IStructuredSelection selection = (IStructuredSelection) getSelection();
-		
-		boolean changed = false;
-		
-		if ( !selection.isEmpty() ) {
-			for ( Iterator<IPackageImport> i = selection.iterator(); i.hasNext(); ) {	
-				IPackageImport packageImport = i.next();
-				NewResourceSelectionDialog<? extends IPackageModelElement> dialog = 
-					ResourcesDialogHelper.createImportDialog( 
-							getSection().getShell(), 
-							"Edit Imported Package", 
-							getProjectModel(), 
-							packageImport, 
-							getBundle().getBundleInfo().getImports() );
-				if ( dialog.open() == Window.OK ) {
-					changed = true;
-					IPackageImport newImport = ModelElementFactory.getInstance().newModelElement(IPackageImport.class);
-					newImport.setPackageName(dialog.getSelectedName());
-					newImport.setVersions(dialog.getSelectedVersions());
-					newImport.setOptional(dialog.isOptional());
-					
-					getBundle().getBundleInfo().removeImport( packageImport );
-					getBundle().getBundleInfo().addImport(newImport);
-				}
-			}					
-		}
-		
-		if ( changed ) {
-			refresh();
-			markDirty();
-		}
-	}
+    protected ISigilBundle getBundle()
+    {
+        return getProjectModel().getBundle();
+    }
+
+
+    @Override
+    protected void handleAdd()
+    {
+        NewResourceSelectionDialog<? extends IPackageModelElement> dialog = ResourcesDialogHelper.createImportDialog(
+            getSection().getShell(), "Add Imported Package", getProjectModel(), null, getBundle().getBundleInfo()
+                .getImports() );
+
+        if ( dialog.open() == Window.OK )
+        {
+            IPackageImport pi = ModelElementFactory.getInstance().newModelElement( IPackageImport.class );
+            pi.setPackageName( dialog.getSelectedName() );
+            pi.setVersions( dialog.getSelectedVersions() );
+            pi.setOptional( dialog.isOptional() );
+
+            getBundle().getBundleInfo().addImport( pi );
+            refresh();
+            markDirty();
+        }
+    }
+
+
+    @SuppressWarnings("unchecked")
+    @Override
+    protected void handleRemoved()
+    {
+        IStructuredSelection selection = ( IStructuredSelection ) getSelection();
+
+        if ( !selection.isEmpty() )
+        {
+            for ( Iterator<IPackageImport> i = selection.iterator(); i.hasNext(); )
+            {
+                getBundle().getBundleInfo().removeImport( i.next() );
+            }
+
+            refresh();
+            markDirty();
+        }
+    }
+
+
+    @SuppressWarnings("unchecked")
+    @Override
+    protected void handleEdit()
+    {
+        IStructuredSelection selection = ( IStructuredSelection ) getSelection();
+
+        boolean changed = false;
+
+        if ( !selection.isEmpty() )
+        {
+            for ( Iterator<IPackageImport> i = selection.iterator(); i.hasNext(); )
+            {
+                IPackageImport packageImport = i.next();
+                NewResourceSelectionDialog<? extends IPackageModelElement> dialog = ResourcesDialogHelper
+                    .createImportDialog( getSection().getShell(), "Edit Imported Package", getProjectModel(),
+                        packageImport, getBundle().getBundleInfo().getImports() );
+                if ( dialog.open() == Window.OK )
+                {
+                    changed = true;
+                    IPackageImport newImport = ModelElementFactory.getInstance().newModelElement( IPackageImport.class );
+                    newImport.setPackageName( dialog.getSelectedName() );
+                    newImport.setVersions( dialog.getSelectedVersions() );
+                    newImport.setOptional( dialog.isOptional() );
+
+                    getBundle().getBundleInfo().removeImport( packageImport );
+                    getBundle().getBundleInfo().addImport( newImport );
+                }
+            }
+        }
+
+        if ( changed )
+        {
+            refresh();
+            markDirty();
+        }
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/NewPackageExportDialog.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/NewPackageExportDialog.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/NewPackageExportDialog.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/NewPackageExportDialog.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.editors.project;
 
+
 import java.util.Comparator;
 
 import org.apache.felix.sigil.ui.eclipse.ui.util.BackgroundLoadingSelectionDialog;
@@ -37,114 +38,144 @@
 import org.eclipse.swt.widgets.Text;
 import org.osgi.framework.Version;
 
-public class NewPackageExportDialog extends BackgroundLoadingSelectionDialog<IPackageFragment> {
-	
-	private static final IElementDescriptor<IPackageFragment> PKG_FRAGMENT_STRINGIFIER = new IElementDescriptor<IPackageFragment>() {
-		public String getLabel(IPackageFragment element) {
-			return getName(element);
-		}
-		public String getName(IPackageFragment element) {
-			return element.getElementName();
-		}
-	};
-	
-	private static final Comparator<IPackageFragment> PKG_FRAGMENT_COMPARATOR = new Comparator<IPackageFragment>() {
-		public int compare(IPackageFragment o1, IPackageFragment o2) {
-			return o1.getElementName().compareTo(o2.getElementName());
-		}
-	};
-	
-	private Version version = null;
-	private String error = null;
-	private Version projectVersion = new Version(0,0,0);
-	
-	private Button btnInheritBundleVersion;
-	private Button btnExplicitVersion;
-	private Text txtVersion;
-
-	
-	public NewPackageExportDialog(Shell parentShell, boolean multiSelect) {
-		super(parentShell, "Package:", multiSelect);
-		setDescriptor(PKG_FRAGMENT_STRINGIFIER);
-		setComparator(PKG_FRAGMENT_COMPARATOR);
-	}
-
-	@Override
-	protected Control createDialogArea(Composite parent) {
-		// Create controls
-		Composite container = (Composite) super.createDialogArea(parent);
-		Composite composite = new Composite(container, SWT.NONE);
-		
-		Group grpVersion = new Group(composite, SWT.NONE);
-		grpVersion.setText("Version");
-		
-		btnInheritBundleVersion = new Button(grpVersion, SWT.RADIO);
-		btnInheritBundleVersion.setText("Inherit bundle version");
-		new Label(grpVersion, SWT.NONE); // Spacer
-		btnExplicitVersion = new Button(grpVersion, SWT.RADIO);
-		btnExplicitVersion.setText("Fixed version:");
-		txtVersion = new Text(grpVersion, SWT.BORDER);
-		
-		// Initialize
-		if(version == null) {
-			btnInheritBundleVersion.setSelection(true);
-			txtVersion.setEnabled(false);
-			txtVersion.setText(projectVersion.toString());
-		} else {
-			btnExplicitVersion.setSelection(true);
-			txtVersion.setEnabled(true);
-			txtVersion.setText(version.toString());
-		}
-		updateButtons();
-		
-		// Listeners
-		Listener radioAndTextListener = new Listener() {
-			public void handleEvent(Event event) {
-				error = null;
-				if(btnInheritBundleVersion.getSelection()) {
-					version = null;
-					txtVersion.setEnabled(false);
-				} else {
-					txtVersion.setEnabled(true);
-					try {
-						version = new Version(txtVersion.getText());
-					} catch (IllegalArgumentException e) {
-						error = "Invalid version";
-					}
-				}
-				setErrorMessage(error);
-				updateButtons();
-			}
-		};
-		txtVersion.addListener(SWT.Modify, radioAndTextListener);
-		btnInheritBundleVersion.addListener(SWT.Selection, radioAndTextListener);
-		btnExplicitVersion.addListener(SWT.Selection, radioAndTextListener);
-		
-		
-		// Layout
-		composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-		composite.setLayout(new GridLayout(1, false));
-		grpVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-		grpVersion.setLayout(new GridLayout(2, false));
-		txtVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-		
-		return container;
-	}
-	
-	@Override
-	protected boolean canComplete() {
-		return super.canComplete() && error == null;
-	}
-	
-	public void setProjectVersion(Version projectVersion) {
-		this.projectVersion = projectVersion;
-	}
-
-	public void setVersion(Version version) {
-		this.version = version;
-	}
-	
-	public Version getVersion() {
-		return version;
-	}
+
+public class NewPackageExportDialog extends BackgroundLoadingSelectionDialog<IPackageFragment>
+{
+
+    private static final IElementDescriptor<IPackageFragment> PKG_FRAGMENT_STRINGIFIER = new IElementDescriptor<IPackageFragment>()
+    {
+        public String getLabel( IPackageFragment element )
+        {
+            return getName( element );
+        }
+
+
+        public String getName( IPackageFragment element )
+        {
+            return element.getElementName();
+        }
+    };
+
+    private static final Comparator<IPackageFragment> PKG_FRAGMENT_COMPARATOR = new Comparator<IPackageFragment>()
+    {
+        public int compare( IPackageFragment o1, IPackageFragment o2 )
+        {
+            return o1.getElementName().compareTo( o2.getElementName() );
+        }
+    };
+
+    private Version version = null;
+    private String error = null;
+    private Version projectVersion = new Version( 0, 0, 0 );
+
+    private Button btnInheritBundleVersion;
+    private Button btnExplicitVersion;
+    private Text txtVersion;
+
+
+    public NewPackageExportDialog( Shell parentShell, boolean multiSelect )
+    {
+        super( parentShell, "Package:", multiSelect );
+        setDescriptor( PKG_FRAGMENT_STRINGIFIER );
+        setComparator( PKG_FRAGMENT_COMPARATOR );
+    }
+
+
+    @Override
+    protected Control createDialogArea( Composite parent )
+    {
+        // Create controls
+        Composite container = ( Composite ) super.createDialogArea( parent );
+        Composite composite = new Composite( container, SWT.NONE );
+
+        Group grpVersion = new Group( composite, SWT.NONE );
+        grpVersion.setText( "Version" );
+
+        btnInheritBundleVersion = new Button( grpVersion, SWT.RADIO );
+        btnInheritBundleVersion.setText( "Inherit bundle version" );
+        new Label( grpVersion, SWT.NONE ); // Spacer
+        btnExplicitVersion = new Button( grpVersion, SWT.RADIO );
+        btnExplicitVersion.setText( "Fixed version:" );
+        txtVersion = new Text( grpVersion, SWT.BORDER );
+
+        // Initialize
+        if ( version == null )
+        {
+            btnInheritBundleVersion.setSelection( true );
+            txtVersion.setEnabled( false );
+            txtVersion.setText( projectVersion.toString() );
+        }
+        else
+        {
+            btnExplicitVersion.setSelection( true );
+            txtVersion.setEnabled( true );
+            txtVersion.setText( version.toString() );
+        }
+        updateButtons();
+
+        // Listeners
+        Listener radioAndTextListener = new Listener()
+        {
+            public void handleEvent( Event event )
+            {
+                error = null;
+                if ( btnInheritBundleVersion.getSelection() )
+                {
+                    version = null;
+                    txtVersion.setEnabled( false );
+                }
+                else
+                {
+                    txtVersion.setEnabled( true );
+                    try
+                    {
+                        version = new Version( txtVersion.getText() );
+                    }
+                    catch ( IllegalArgumentException e )
+                    {
+                        error = "Invalid version";
+                    }
+                }
+                setErrorMessage( error );
+                updateButtons();
+            }
+        };
+        txtVersion.addListener( SWT.Modify, radioAndTextListener );
+        btnInheritBundleVersion.addListener( SWT.Selection, radioAndTextListener );
+        btnExplicitVersion.addListener( SWT.Selection, radioAndTextListener );
+
+        // Layout
+        composite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
+        composite.setLayout( new GridLayout( 1, false ) );
+        grpVersion.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
+        grpVersion.setLayout( new GridLayout( 2, false ) );
+        txtVersion.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
+
+        return container;
+    }
+
+
+    @Override
+    protected boolean canComplete()
+    {
+        return super.canComplete() && error == null;
+    }
+
+
+    public void setProjectVersion( Version projectVersion )
+    {
+        this.projectVersion = projectVersion;
+    }
+
+
+    public void setVersion( Version version )
+    {
+        this.version = version;
+    }
+
+
+    public Version getVersion()
+    {
+        return version;
+    }
 }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/NewResourceSelectionDialog.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/NewResourceSelectionDialog.java?rev=796467&r1=796466&r2=796467&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/NewResourceSelectionDialog.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/NewResourceSelectionDialog.java Tue Jul 21 18:51:33 2009
@@ -19,6 +19,7 @@
 
 package org.apache.felix.sigil.ui.eclipse.ui.editors.project;
 
+
 import org.apache.felix.sigil.eclipse.SigilCore;
 import org.apache.felix.sigil.model.common.VersionRange;
 import org.apache.felix.sigil.model.common.VersionRangeBoundingRule;
@@ -40,122 +41,156 @@
 import org.eclipse.swt.widgets.Shell;
 import org.osgi.framework.Version;
 
-public class NewResourceSelectionDialog<E extends IVersionedModelElement> extends BackgroundLoadingSelectionDialog<E> {
 
-	private VersionRangeComponent pnlVersionRange;
-	private boolean optionalEnabled = true;
-	private Button btnOptional;
-
-	private VersionRange selectedVersions = null;
-	private boolean optional = false;
-
-	public NewResourceSelectionDialog(Shell parentShell, String selectionLabel, boolean multi) {
-		super(parentShell, selectionLabel, multi);
-	}
-	
-	public void setOptionalEnabled(boolean enabled) {
-		optionalEnabled = enabled;
-	}
-
-	@Override
-	protected Control createDialogArea(Composite parent) {
-		// Create controls
-		Composite container = (Composite) super.createDialogArea(parent);
-		Composite composite = new Composite(container, SWT.NONE);
-		
-		if ( optionalEnabled ) {
-			new Label(composite, SWT.NONE); //Spacer
-			btnOptional = new Button(composite, SWT.CHECK);
-			btnOptional.setText("Optional");
-		}
-		
-		Label lblVersionRange = new Label(composite, SWT.NONE);
-		lblVersionRange.setText("Version Range:");
-		Group group = new Group(composite, SWT.BORDER);
-
-		pnlVersionRange = new VersionRangeComponent(group, SWT.NONE);
-		
-		// Initialize
-		if (selectedVersions != null) {
-			pnlVersionRange.setVersions(selectedVersions);
-		}
-		
-		if ( optionalEnabled ) {		
-			btnOptional.setSelection(optional);
-			updateButtons();
-		}
-		
-		// Hookup Listeners
-		pnlVersionRange.addVersionChangeListener(new VersionsChangeListener() {
-			public void versionsChanged(VersionRange range) {
-				selectedVersions = range;
-				updateButtons();
-			}
-		});
-		pnlVersionRange.addValidationListener(new IValidationListener() {
-			public void validationMessage(String message, int level) {
-				setMessage(message, level);
-				updateButtons();
-			}
-		});
-		
-		if ( optionalEnabled ) {		
-			btnOptional.addSelectionListener(new SelectionAdapter() {
-				public void widgetSelected(SelectionEvent e) {
-					optional = btnOptional.getSelection();
-				}
-			});
-		}
-		
-		// Layout
-		composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-		GridLayout layout = new GridLayout(2, false);
-		layout.verticalSpacing = 10;
-		layout.horizontalSpacing = 10;
-		composite.setLayout(layout);
-
-		lblVersionRange.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false));
-		group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-		group.setLayout(new FillLayout());
-
-		return container;
-	}
-
-	@Override
-	protected void elementSelected(E selection) {
-		if(selection != null) {
-			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 = selection.getVersion();
-			selectedVersions = VersionRange.newInstance(version, lowerBoundRule, upperBoundRule);
-			pnlVersionRange.setVersions(selectedVersions);
-		}
-	}
-
-	@Override
-	protected synchronized boolean canComplete() {
-		return super.canComplete() && selectedVersions != null;
-	}
-
-	public VersionRange getSelectedVersions() {
-		return selectedVersions;
-	}
-
-	public void setVersions(VersionRange versions) {
-		selectedVersions = versions;
-		if(pnlVersionRange != null && !pnlVersionRange.isDisposed()) {
-			pnlVersionRange.setVersions(versions);
-			updateButtons();
-		}
-	}
-	
-	public boolean isOptional() {
-		return optional;
-	}
-	
-	public void setOptional(boolean optional) {
-		this.optional = optional;
-	}
+public class NewResourceSelectionDialog<E extends IVersionedModelElement> extends BackgroundLoadingSelectionDialog<E>
+{
+
+    private VersionRangeComponent pnlVersionRange;
+    private boolean optionalEnabled = true;
+    private Button btnOptional;
+
+    private VersionRange selectedVersions = null;
+    private boolean optional = false;
+
+
+    public NewResourceSelectionDialog( Shell parentShell, String selectionLabel, boolean multi )
+    {
+        super( parentShell, selectionLabel, multi );
+    }
+
+
+    public void setOptionalEnabled( boolean enabled )
+    {
+        optionalEnabled = enabled;
+    }
+
+
+    @Override
+    protected Control createDialogArea( Composite parent )
+    {
+        // Create controls
+        Composite container = ( Composite ) super.createDialogArea( parent );
+        Composite composite = new Composite( container, SWT.NONE );
+
+        if ( optionalEnabled )
+        {
+            new Label( composite, SWT.NONE ); //Spacer
+            btnOptional = new Button( composite, SWT.CHECK );
+            btnOptional.setText( "Optional" );
+        }
+
+        Label lblVersionRange = new Label( composite, SWT.NONE );
+        lblVersionRange.setText( "Version Range:" );
+        Group group = new Group( composite, SWT.BORDER );
+
+        pnlVersionRange = new VersionRangeComponent( group, SWT.NONE );
+
+        // Initialize
+        if ( selectedVersions != null )
+        {
+            pnlVersionRange.setVersions( selectedVersions );
+        }
+
+        if ( optionalEnabled )
+        {
+            btnOptional.setSelection( optional );
+            updateButtons();
+        }
+
+        // Hookup Listeners
+        pnlVersionRange.addVersionChangeListener( new VersionsChangeListener()
+        {
+            public void versionsChanged( VersionRange range )
+            {
+                selectedVersions = range;
+                updateButtons();
+            }
+        } );
+        pnlVersionRange.addValidationListener( new IValidationListener()
+        {
+            public void validationMessage( String message, int level )
+            {
+                setMessage( message, level );
+                updateButtons();
+            }
+        } );
+
+        if ( optionalEnabled )
+        {
+            btnOptional.addSelectionListener( new SelectionAdapter()
+            {
+                public void widgetSelected( SelectionEvent e )
+                {
+                    optional = btnOptional.getSelection();
+                }
+            } );
+        }
+
+        // Layout
+        composite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
+        GridLayout layout = new GridLayout( 2, false );
+        layout.verticalSpacing = 10;
+        layout.horizontalSpacing = 10;
+        composite.setLayout( layout );
+
+        lblVersionRange.setLayoutData( new GridData( SWT.LEFT, SWT.TOP, false, false ) );
+        group.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
+        group.setLayout( new FillLayout() );
+
+        return container;
+    }
+
+
+    @Override
+    protected void elementSelected( E selection )
+    {
+        if ( selection != null )
+        {
+            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 = selection.getVersion();
+            selectedVersions = VersionRange.newInstance( version, lowerBoundRule, upperBoundRule );
+            pnlVersionRange.setVersions( selectedVersions );
+        }
+    }
+
+
+    @Override
+    protected synchronized boolean canComplete()
+    {
+        return super.canComplete() && selectedVersions != null;
+    }
+
+
+    public VersionRange getSelectedVersions()
+    {
+        return selectedVersions;
+    }
+
+
+    public void setVersions( VersionRange versions )
+    {
+        selectedVersions = versions;
+        if ( pnlVersionRange != null && !pnlVersionRange.isDisposed() )
+        {
+            pnlVersionRange.setVersions( versions );
+            updateButtons();
+        }
+    }
+
+
+    public boolean isOptional()
+    {
+        return optional;
+    }
+
+
+    public void setOptional( boolean optional )
+    {
+        this.optional = optional;
+    }
 }



Mime
View raw message