felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsav...@apache.org
Subject svn commit: r966640 - in /felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui: editors/project/ quickfix/
Date Thu, 22 Jul 2010 13:12:06 GMT
Author: dsavage
Date: Thu Jul 22 13:12:06 2010
New Revision: 966640

URL: http://svn.apache.org/viewvc?rev=966640&view=rev
Log:
consolidate new version range logic in new helper method

Modified:
    felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/DependencyManagementSection.java
    felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ExportPackagesSection.java
    felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/NewResourceSelectionDialog.java
    felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportPackageProposal.java
    felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportSearchResultProposal.java

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=966640&r1=966639&r2=966640&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
Thu Jul 22 13:12:06 2010
@@ -27,9 +27,8 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.felix.sigil.common.osgi.VersionRange;
-import org.apache.felix.sigil.common.osgi.VersionRangeBoundingRule;
-import org.apache.felix.sigil.eclipse.SigilCore;
 import org.apache.felix.sigil.eclipse.model.project.ISigilProjectModel;
+import org.apache.felix.sigil.eclipse.model.util.ModelHelper;
 import org.apache.felix.sigil.model.ModelElementFactory;
 import org.apache.felix.sigil.model.osgi.IBundleModelElement;
 import org.apache.felix.sigil.model.osgi.IPackageExport;
@@ -51,7 +50,6 @@ import org.eclipse.jdt.core.IJavaProject
 import org.eclipse.jdt.core.IPackageFragment;
 import org.eclipse.jdt.core.JavaModelException;
 import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.widgets.Composite;
@@ -167,13 +165,6 @@ public class DependencyManagementSection
             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();
         Collection<IPackageImport> existingImports = bundleInfo.getImports();
@@ -191,8 +182,7 @@ public class DependencyManagementSection
             IPackageExport export = exports.get( pkgImport );
             if ( export != null && !existingImportsMap.containsKey( pkgImport ) )
             {
-                VersionRange versionRange = VersionRange.newInstance( export.getVersion(),
lowerBoundRule,
-                    upperBoundRule );
+                VersionRange versionRange = ModelHelper.getDefaultRange(export.getVersion());
                 IPackageImport newImport = elementFactory.newModelElement( IPackageImport.class
);
                 newImport.setPackageName( pkgImport );
                 newImport.setVersions( versionRange );

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=966640&r1=966639&r2=966640&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
Thu Jul 22 13:12:06 2010
@@ -24,9 +24,9 @@ import java.util.Iterator;
 import java.util.List;
 
 import org.apache.felix.sigil.common.osgi.VersionRange;
-import org.apache.felix.sigil.common.osgi.VersionRangeBoundingRule;
 import org.apache.felix.sigil.eclipse.SigilCore;
 import org.apache.felix.sigil.eclipse.model.project.ISigilProjectModel;
+import org.apache.felix.sigil.eclipse.model.util.ModelHelper;
 import org.apache.felix.sigil.model.ModelElementFactory;
 import org.apache.felix.sigil.model.ModelElementFactoryException;
 import org.apache.felix.sigil.model.eclipse.ISigilBundle;
@@ -122,16 +122,12 @@ public class ExportPackagesSection exten
                         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 );
+                        VersionRange versionRange = ModelHelper.getDefaultRange(version);
                         pkgImport.setVersions( versionRange );
 
                         getBundle().getBundleInfo().addImport( pkgImport );

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=966640&r1=966639&r2=966640&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
Thu Jul 22 13:12:06 2010
@@ -21,12 +21,10 @@ package org.apache.felix.sigil.ui.eclips
 
 
 import org.apache.felix.sigil.common.osgi.VersionRange;
-import org.apache.felix.sigil.common.osgi.VersionRangeBoundingRule;
-import org.apache.felix.sigil.eclipse.SigilCore;
+import org.apache.felix.sigil.eclipse.model.util.ModelHelper;
 import org.apache.felix.sigil.model.osgi.IVersionedModelElement;
 import org.apache.felix.sigil.ui.eclipse.ui.util.BackgroundLoadingSelectionDialog;
 import org.apache.felix.sigil.ui.eclipse.ui.util.IValidationListener;
-import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
@@ -146,14 +144,8 @@ public class NewResourceSelectionDialog<
     {
         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
);
+            selectedVersions = ModelHelper.getDefaultRange(version);
             pnlVersionRange.setVersions( selectedVersions );
         }
     }

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportPackageProposal.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportPackageProposal.java?rev=966640&r1=966639&r2=966640&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportPackageProposal.java
(original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportPackageProposal.java
Thu Jul 22 13:12:06 2010
@@ -24,6 +24,7 @@ import org.apache.felix.sigil.common.osg
 import org.apache.felix.sigil.common.osgi.VersionRangeBoundingRule;
 import org.apache.felix.sigil.eclipse.SigilCore;
 import org.apache.felix.sigil.eclipse.model.project.ISigilProjectModel;
+import org.apache.felix.sigil.eclipse.model.util.ModelHelper;
 import org.apache.felix.sigil.model.ModelElementFactory;
 import org.apache.felix.sigil.model.ModelElementFactoryException;
 import org.apache.felix.sigil.model.osgi.IPackageExport;
@@ -68,14 +69,7 @@ public class ImportPackageProposal imple
 
             final IPackageImport i = ModelElementFactory.getInstance().newModelElement( IPackageImport.class
);
             i.setPackageName( e.getPackageName() );
-            IPreferenceStore store = SigilCore.getDefault().getPreferenceStore();
-            VersionRangeBoundingRule lowerBoundRule = VersionRangeBoundingRule.valueOf( store
-                .getString( SigilCore.DEFAULT_VERSION_LOWER_BOUND ) );
-            VersionRangeBoundingRule upperBoundRule = VersionRangeBoundingRule.valueOf( store
-                .getString( SigilCore.DEFAULT_VERSION_UPPER_BOUND ) );
-
-            Version version = e.getVersion();
-            VersionRange selectedVersions = VersionRange.newInstance( version, lowerBoundRule,
upperBoundRule );
+            VersionRange selectedVersions = ModelHelper.getDefaultRange(e.getVersion());
             i.setVersions( selectedVersions );
 
             WorkspaceModifyOperation op = new WorkspaceModifyOperation()

Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportSearchResultProposal.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportSearchResultProposal.java?rev=966640&r1=966639&r2=966640&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportSearchResultProposal.java
(original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/quickfix/ImportSearchResultProposal.java
Thu Jul 22 13:12:06 2010
@@ -24,6 +24,7 @@ import org.apache.felix.sigil.common.osg
 import org.apache.felix.sigil.common.osgi.VersionRangeBoundingRule;
 import org.apache.felix.sigil.eclipse.SigilCore;
 import org.apache.felix.sigil.eclipse.model.project.ISigilProjectModel;
+import org.apache.felix.sigil.eclipse.model.util.ModelHelper;
 import org.apache.felix.sigil.model.ModelElementFactory;
 import org.apache.felix.sigil.model.osgi.IPackageExport;
 import org.apache.felix.sigil.model.osgi.IPackageImport;
@@ -112,14 +113,7 @@ public class ImportSearchResultProposal 
 
         final IPackageImport i = ModelElementFactory.getInstance().newModelElement( IPackageImport.class
);
         i.setPackageName( e.getPackageName() );
-        IPreferenceStore store = SigilCore.getDefault().getPreferenceStore();
-        VersionRangeBoundingRule lowerBoundRule = VersionRangeBoundingRule.valueOf( store
-            .getString( SigilCore.DEFAULT_VERSION_LOWER_BOUND ) );
-        VersionRangeBoundingRule upperBoundRule = VersionRangeBoundingRule.valueOf( store
-            .getString( SigilCore.DEFAULT_VERSION_UPPER_BOUND ) );
-
-        Version version = e.getVersion();
-        VersionRange selectedVersions = VersionRange.newInstance( version, lowerBoundRule,
upperBoundRule );
+        VersionRange selectedVersions = ModelHelper.getDefaultRange(e.getVersion());
         i.setVersions( selectedVersions );
 
         WorkspaceModifyOperation op = new WorkspaceModifyOperation()



Mime
View raw message