remove non osgi concepts, create plugin functions later via extender and service patterns


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@800915 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/common/core/src/org/apache/felix/sigil/core/BldCore.java b/sigil/common/core/src/org/apache/felix/sigil/core/BldCore.java
index 6041ea4..450b93d 100644
--- a/sigil/common/core/src/org/apache/felix/sigil/core/BldCore.java
+++ b/sigil/common/core/src/org/apache/felix/sigil/core/BldCore.java
@@ -24,7 +24,6 @@
 import java.util.logging.Logger;
 
 import org.apache.felix.sigil.core.internal.license.LicenseManager;
-import org.apache.felix.sigil.core.internal.model.eclipse.DownloadJar;
 import org.apache.felix.sigil.core.internal.model.eclipse.Library;
 import org.apache.felix.sigil.core.internal.model.eclipse.LibraryImport;
 import org.apache.felix.sigil.core.internal.model.eclipse.SigilBundle;
@@ -34,11 +33,8 @@
 import org.apache.felix.sigil.core.internal.model.osgi.RequiredBundle;
 import org.apache.felix.sigil.core.licence.ILicenseManager;
 import org.apache.felix.sigil.model.ModelElementFactory;
-import org.apache.felix.sigil.model.eclipse.IDownloadJar;
 import org.apache.felix.sigil.model.eclipse.ILibrary;
 import org.apache.felix.sigil.model.eclipse.ILibraryImport;
-import org.apache.felix.sigil.model.eclipse.INewtonSystem;
-import org.apache.felix.sigil.model.eclipse.ISCAComposite;
 import org.apache.felix.sigil.model.eclipse.ISigilBundle;
 import org.apache.felix.sigil.model.osgi.IBundleModelElement;
 import org.apache.felix.sigil.model.osgi.IPackageExport;
@@ -84,7 +80,6 @@
     {
         String uri = "http://sigil.codecauldron.org/xml/sigil-namespace";
         ModelElementFactory.getInstance().register( ISigilBundle.class, SigilBundle.class, "bundle", "sigil", uri );
-        ModelElementFactory.getInstance().register( IDownloadJar.class, DownloadJar.class, "download", "sigil", uri );
         ModelElementFactory.getInstance().register( ILibrary.class, Library.class, "library", "sigil", uri );
         ModelElementFactory.getInstance().register( ILibraryImport.class, LibraryImport.class, "library-import",
             "sigil", uri );
diff --git a/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/DownloadJar.java b/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/DownloadJar.java
deleted file mode 100644
index 37f3fc2..0000000
--- a/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/DownloadJar.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.sigil.core.internal.model.eclipse;
-
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.apache.felix.sigil.model.AbstractCompoundModelElement;
-import org.apache.felix.sigil.model.eclipse.IDownloadJar;
-import org.eclipse.core.runtime.IPath;
-
-
-public class DownloadJar extends AbstractCompoundModelElement implements IDownloadJar
-{
-
-    private static final long serialVersionUID = 1L;
-
-    private Set<IPath> entries = new HashSet<IPath>();
-
-
-    public DownloadJar()
-    {
-        super( "RMI Classpath Download Jar" );
-    }
-
-
-    public void addEntry( IPath entry )
-    {
-        entries.add( entry );
-    }
-
-
-    public void removeEntry( IPath entry )
-    {
-        entries.remove( entry );
-    }
-
-
-    public Set<IPath> getEntrys()
-    {
-        return entries;
-    }
-
-
-    public void clearEntries()
-    {
-        entries.clear();
-    }
-}
diff --git a/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java b/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java
index ee038c0..99178f2 100644
--- a/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java
+++ b/sigil/common/core/src/org/apache/felix/sigil/core/internal/model/eclipse/SigilBundle.java
@@ -35,8 +35,6 @@
 
 import org.apache.felix.sigil.core.BldCore;
 import org.apache.felix.sigil.model.AbstractCompoundModelElement;
-import org.apache.felix.sigil.model.eclipse.IDownloadJar;
-import org.apache.felix.sigil.model.eclipse.ISCAComposite;
 import org.apache.felix.sigil.model.eclipse.ISigilBundle;
 import org.apache.felix.sigil.model.osgi.IBundleModelElement;
 import org.apache.felix.sigil.model.osgi.IPackageExport;
@@ -57,10 +55,8 @@
     private static final long serialVersionUID = 1L;
 
     private IBundleModelElement bundle;
-    private IDownloadJar download;
     private Set<IPath> sourcePaths;
     private Set<IPath> libraryPaths;
-    private Set<ISCAComposite> composites;
     private Set<String> classpath;
     private Set<String> packages;
     private Set<String> dlPackages;
@@ -77,7 +73,6 @@
         super( "Sigil Bundle" );
         sourcePaths = new HashSet<IPath>();
         libraryPaths = new HashSet<IPath>();
-        composites = new HashSet<ISCAComposite>();
         classpath = new HashSet<String>();
         packages = new HashSet<String>();
         dlPackages = new HashSet<String>();
@@ -217,18 +212,6 @@
     }
 
 
-    public IDownloadJar getDownloadJar()
-    {
-        return download;
-    }
-
-
-    public void setDownloadJar( IDownloadJar download )
-    {
-        this.download = download;
-    }
-
-
     public void addLibraryPath( IPath path )
     {
         libraryPaths.add( path );
@@ -271,28 +254,6 @@
     }
 
 
-    public void addComposite( ISCAComposite composite )
-    {
-        composites.add( composite );
-        composite.setParent( this );
-    }
-
-
-    public Set<ISCAComposite> getComposites()
-    {
-        return composites;
-    }
-
-
-    public void removeComposite( ISCAComposite composite )
-    {
-        if ( composites.remove( composite ) )
-        {
-            composite.setParent( null );
-        }
-    }
-
-
     public void addClasspathEntry( String encodedClasspath )
     {
         classpath.add( encodedClasspath.trim() );
diff --git a/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/IDownloadJar.java b/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/IDownloadJar.java
deleted file mode 100644
index a500c34..0000000
--- a/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/IDownloadJar.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.sigil.model.eclipse;
-
-
-import java.util.Set;
-
-import org.apache.felix.sigil.model.IModelElement;
-import org.eclipse.core.runtime.IPath;
-
-
-public interface IDownloadJar extends IModelElement
-{
-    void addEntry( IPath entry );
-
-
-    void removeEntry( IPath entry );
-
-
-    // XXX bad spelling on purpose so that ModelElementSupport picks up method
-    // TODO fix in ModelElementSupport
-    Set<IPath> getEntrys();
-
-
-    void clearEntries();
-}
diff --git a/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/INewtonSystem.java b/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/INewtonSystem.java
deleted file mode 100644
index d19966b..0000000
--- a/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/INewtonSystem.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.sigil.model.eclipse;
-
-
-import org.apache.felix.sigil.model.IModelElement;
-import org.eclipse.core.runtime.IPath;
-
-
-/**
- * @author dave
- *
- */
-public interface INewtonSystem extends IModelElement
-{
-    IPath getLocation();
-
-
-    void setLocation( IPath location );
-}
diff --git a/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISCAComposite.java b/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISCAComposite.java
deleted file mode 100644
index cf0c603..0000000
--- a/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISCAComposite.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.felix.sigil.model.eclipse;
-
-
-import org.apache.felix.sigil.model.IModelElement;
-import org.eclipse.core.runtime.IPath;
-
-
-/**
- * @author dave
- *
- */
-public interface ISCAComposite extends IModelElement
-{
-    IPath getLocation();
-
-
-    void setLocation( IPath location );
-}
\ No newline at end of file
diff --git a/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java b/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java
index e0f61f3..9a76918 100644
--- a/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java
+++ b/sigil/common/core/src/org/apache/felix/sigil/model/eclipse/ISigilBundle.java
@@ -53,21 +53,6 @@
     void setBundleInfo( IBundleModelElement bundle );
 
 
-    IDownloadJar getDownloadJar();
-
-
-    void setDownloadJar( IDownloadJar download );
-
-
-    void addComposite( ISCAComposite composite );
-
-
-    void removeComposite( ISCAComposite composite );
-
-
-    Set<ISCAComposite> getComposites();
-
-
     void addLibraryPath( IPath path );
 
 
diff --git a/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/builders/SigilIncrementalProjectBuilder.java b/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/builders/SigilIncrementalProjectBuilder.java
index 09451d0..7c1f517 100644
--- a/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/builders/SigilIncrementalProjectBuilder.java
+++ b/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/internal/builders/SigilIncrementalProjectBuilder.java
@@ -303,11 +303,6 @@
         {
             convert( cp, sigil, files );
         }
-
-        if ( !sigil.getBundle().getComposites().isEmpty() )
-        {
-            throw new IllegalStateException( "XXX-FIXME-XXX" );
-        }
     }
 
 
diff --git a/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/model/util/JavaHelper.java b/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/model/util/JavaHelper.java
index 2c15218..d560c74 100644
--- a/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/model/util/JavaHelper.java
+++ b/sigil/eclipse/core/src/org/apache/felix/sigil/eclipse/model/util/JavaHelper.java
@@ -48,7 +48,6 @@
 import org.apache.felix.sigil.model.ModelElementFactory;
 import org.apache.felix.sigil.model.common.VersionRange;
 import org.apache.felix.sigil.model.common.VersionRangeBoundingRule;
-import org.apache.felix.sigil.model.eclipse.ISCAComposite;
 import org.apache.felix.sigil.model.eclipse.ISigilBundle;
 import org.apache.felix.sigil.model.osgi.IBundleModelElement;
 import org.apache.felix.sigil.model.osgi.IPackageExport;
@@ -875,34 +874,12 @@
         Set<String> imports = new HashSet<String>();
 
         findJavaModelImports( project, imports, monitor );
-        findSCAImports( project, imports, monitor );
         findTextImports( project, imports, monitor );
 
         return imports;
     }
 
 
-    private static void findSCAImports( ISigilProjectModel project, Set<String> imports, IProgressMonitor monitor )
-    {
-        for ( ISCAComposite sca : project.getBundle().getComposites() )
-        {
-            IFile f = project.getProject().getFile( sca.getLocation() );
-            if ( f.exists() )
-            {
-                try
-                {
-                    // TODO for now just treats sca as text files - should build in richer model that is able to detect java elements
-                    parseText( f, imports );
-                }
-                catch ( CoreException e )
-                {
-                    SigilCore.error( "Failed to parse sca file " + f, e );
-                }
-            }
-        }
-    }
-
-
     private static void findTextImports( ISigilProjectModel project, Set<String> imports, IProgressMonitor monitor )
     {
         IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
diff --git a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ContentsForm.java b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ContentsForm.java
index ca0e74b..8666271 100644
--- a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ContentsForm.java
+++ b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ContentsForm.java
@@ -62,7 +62,7 @@
         layout.topMargin = 5;
         layout.leftMargin = 10;
         layout.rightMargin = 10;
-        layout.numColumns = 2;
+        layout.numColumns = 1;
         layout.horizontalSpacing = 10;
         body.setLayout( layout );
         body.setLayoutData( new TableWrapData( TableWrapData.FILL ) );
@@ -72,31 +72,22 @@
         layout.verticalSpacing = 20;
         top.setLayout( layout );
         TableWrapData data = new TableWrapData( TableWrapData.FILL_GRAB );
-        data.colspan = 2;
+        //data.colspan = 2;
         top.setLayoutData( data );
 
-        Composite left = toolkit.createComposite( body );
+        Composite bottom = toolkit.createComposite( body );
         layout = new TableWrapLayout();
         layout.verticalSpacing = 20;
-        left.setLayout( layout );
-        left.setLayoutData( new TableWrapData( TableWrapData.FILL_GRAB ) );
-
-        Composite right = toolkit.createComposite( body );
-        layout = new TableWrapLayout();
-        layout.verticalSpacing = 20;
-        right.setLayout( layout );
-        right.setLayoutData( new TableWrapData( TableWrapData.FILL_GRAB ) );
+        bottom.setLayout( layout );
+        bottom.setLayoutData( new TableWrapData( TableWrapData.FILL_GRAB ) );
 
         try
         {
             ClasspathSection classpath = new ClasspathSection( this, top, project );
             managedForm.addPart( classpath );
 
-            ResourceBuildSection runtimeBuild = new ResourceBuildSection( this, left, project );
+            ResourceBuildSection runtimeBuild = new ResourceBuildSection( this, bottom, project );
             managedForm.addPart( runtimeBuild );
-
-            DownloadSection download = new DownloadSection( this, right, project );
-            managedForm.addPart( download );
         }
         catch ( CoreException e )
         {
diff --git a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/DownloadSection.java b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/DownloadSection.java
deleted file mode 100644
index 1cf045c..0000000
--- a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/DownloadSection.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-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;
-import org.apache.felix.sigil.model.ModelElementFactoryException;
-import org.apache.felix.sigil.model.eclipse.IDownloadJar;
-import org.apache.felix.sigil.ui.eclipse.ui.form.SigilPage;
-import org.apache.felix.sigil.ui.eclipse.ui.util.ModelLabelProvider;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-
-
-/**
- * @author dave
- *
- */
-public class DownloadSection extends AbstractResourceSection
-{
-
-    /**
-     * @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 );
-
-        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 );
-        }
-    }
-}