+ */
move classes related to util functions to util package
add UIHelper class for trivial filter and label provider impls
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@814604 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/sigil/eclipse/ui/sigil.properties b/sigil/eclipse/ui/sigil.properties
index 46c1592..3b28dad 100644
--- a/sigil/eclipse/ui/sigil.properties
+++ b/sigil/eclipse/ui/sigil.properties
@@ -19,6 +19,8 @@
-exports: \
org.apache.felix.sigil.ui.eclipse.actions, \
+ org.apache.felix.sigil.ui.eclipse.ui, \
+ org.apache.felix.sigil.ui.eclipse.ui.util, \
org.apache.felix.sigil.ui.eclipse.ui.wizard.project, \
org.apache.felix.sigil.ui.eclipse.ui.wizard.repository, \
@@ -37,6 +39,8 @@
org.apache.felix.sigil.repository, \
org.apache.felix.sigil.search, \
org.apache.felix.sigil.ui.eclipse.actions, \
+ org.apache.felix.sigil.ui.eclipse.ui, \
+ org.apache.felix.sigil.ui.eclipse.ui.util, \
org.apache.felix.sigil.ui.eclipse.ui.wizard.project, \
org.apache.felix.sigil.ui.eclipse.ui.wizard.repository, \
org.apache.felix.sigil.utils, \
diff --git a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ClasspathSection.java b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ClasspathSection.java
index 1e8e718..11a6c98 100644
--- a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ClasspathSection.java
+++ b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/ClasspathSection.java
@@ -34,6 +34,7 @@
import org.apache.felix.sigil.ui.eclipse.ui.form.SigilSection;
import org.apache.felix.sigil.ui.eclipse.ui.util.BackgroundLoadingSelectionDialog;
import org.apache.felix.sigil.ui.eclipse.ui.util.DefaultTableProvider;
+import org.apache.felix.sigil.ui.eclipse.ui.util.IElementDescriptor;
import org.apache.felix.sigil.ui.eclipse.ui.util.IFilter;
import org.apache.felix.sigil.ui.eclipse.ui.util.ModelLabelProvider;
import org.eclipse.core.runtime.CoreException;
diff --git a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/NewPackageExportDialog.java b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/NewPackageExportDialog.java
index f6db23f..6558114 100644
--- a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/NewPackageExportDialog.java
+++ b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/NewPackageExportDialog.java
@@ -23,6 +23,7 @@
import java.util.Comparator;
import org.apache.felix.sigil.ui.eclipse.ui.util.BackgroundLoadingSelectionDialog;
+import org.apache.felix.sigil.ui.eclipse.ui.util.IElementDescriptor;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
diff --git a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/BackgroundLoadingSelectionDialog.java b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/BackgroundLoadingSelectionDialog.java
index ce025ee..50a0839 100644
--- a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/BackgroundLoadingSelectionDialog.java
+++ b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/BackgroundLoadingSelectionDialog.java
@@ -30,8 +30,6 @@
import java.util.List;
import java.util.Map;
-import org.apache.felix.sigil.ui.eclipse.ui.editors.project.IElementDescriptor;
-import org.apache.felix.sigil.ui.eclipse.ui.editors.project.WrappedContentProposal;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.Job;
@@ -85,7 +83,7 @@
String result;
if ( element instanceof WrappedContentProposal<?> )
{
- WrappedContentProposal<E> contentProposal = ( WrappedContentProposal<E> ) element;
+ WrappedContentProposal<E> contentProposal = (org.apache.felix.sigil.ui.eclipse.ui.util.WrappedContentProposal<E> ) element;
result = contentProposal.getLabel();
}
else
@@ -321,7 +319,7 @@
public void proposalAccepted( IContentProposal proposal )
{
@SuppressWarnings("unchecked")
- WrappedContentProposal<E> valueProposal = ( WrappedContentProposal<E> ) proposal;
+ WrappedContentProposal<E> valueProposal = (org.apache.felix.sigil.ui.eclipse.ui.util.WrappedContentProposal<E> ) proposal;
E selected = valueProposal.getElement();
selection = new ArrayList<E>( 1 );
selection.add( selected );
diff --git a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ExclusionContentProposalProvider.java b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ExclusionContentProposalProvider.java
index 371c464..09c78b3 100644
--- a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ExclusionContentProposalProvider.java
+++ b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ExclusionContentProposalProvider.java
@@ -26,8 +26,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.apache.felix.sigil.ui.eclipse.ui.editors.project.IElementDescriptor;
-import org.apache.felix.sigil.ui.eclipse.ui.editors.project.WrappedContentProposal;
+import org.apache.felix.sigil.eclipse.SigilCore;
import org.apache.felix.sigil.utils.GlobCompiler;
import org.eclipse.jface.fieldassist.IContentProposal;
import org.eclipse.jface.fieldassist.IContentProposalProvider;
@@ -68,7 +67,7 @@
for ( T element : elementArray )
{
- if ( filter != null && filter.select( element ) )
+ if ( filter == null || filter.select( element ) )
{
IContentProposal proposal = WrappedContentProposal.newInstance( element, descriptor );
Matcher matcher = pattern.matcher( proposal.getContent() );
diff --git a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/IElementDescriptor.java b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IElementDescriptor.java
similarity index 94%
rename from sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/IElementDescriptor.java
rename to sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IElementDescriptor.java
index 16c85d5..e395fe8 100644
--- a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/IElementDescriptor.java
+++ b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/IElementDescriptor.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.felix.sigil.ui.eclipse.ui.editors.project;
+package org.apache.felix.sigil.ui.eclipse.ui.util;
public interface IElementDescriptor<E>
diff --git a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ResourcesDialogHelper.java b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ResourcesDialogHelper.java
index 928c7db..32d48b4 100644
--- a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ResourcesDialogHelper.java
+++ b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/ResourcesDialogHelper.java
@@ -37,7 +37,6 @@
import org.apache.felix.sigil.model.osgi.IPackageImport;
import org.apache.felix.sigil.model.osgi.IPackageModelElement;
import org.apache.felix.sigil.model.osgi.IRequiredBundle;
-import org.apache.felix.sigil.ui.eclipse.ui.editors.project.IElementDescriptor;
import org.apache.felix.sigil.ui.eclipse.ui.editors.project.NewPackageExportDialog;
import org.apache.felix.sigil.ui.eclipse.ui.editors.project.NewResourceSelectionDialog;
import org.eclipse.core.runtime.IProgressMonitor;
diff --git a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/UIHelper.java b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/UIHelper.java
new file mode 100644
index 0000000..dc05f3b
--- /dev/null
+++ b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/UIHelper.java
@@ -0,0 +1,29 @@
+package org.apache.felix.sigil.ui.eclipse.ui.util;
+
+public class UIHelper
+{
+ public static <T> IElementDescriptor<T> getDefaultElementDescriptor() {
+ return new IElementDescriptor<T>()
+ {
+ public String getLabel( T element )
+ {
+ return element == null ? "null" : element.toString();
+ }
+
+
+ public String getName( T element )
+ {
+ return getLabel( element );
+ }
+ };
+ }
+
+ public static <T> IFilter<T> getDefaultFilter() {
+ return new IFilter<T> () {
+ public boolean select( T element )
+ {
+ return true;
+ }
+ };
+ }
+}
diff --git a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/WrappedContentProposal.java b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/WrappedContentProposal.java
similarity index 96%
rename from sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/WrappedContentProposal.java
rename to sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/WrappedContentProposal.java
index fccfa94..25a038d 100644
--- a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/editors/project/WrappedContentProposal.java
+++ b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/WrappedContentProposal.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.felix.sigil.ui.eclipse.ui.editors.project;
+package org.apache.felix.sigil.ui.eclipse.ui.util;
import org.eclipse.jface.fieldassist.IContentProposal;
diff --git a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/WrappedContentProposalLabelProvider.java b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/WrappedContentProposalLabelProvider.java
index fa52a0e..64371ef 100644
--- a/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/WrappedContentProposalLabelProvider.java
+++ b/sigil/eclipse/ui/src/org/apache/felix/sigil/ui/eclipse/ui/util/WrappedContentProposalLabelProvider.java
@@ -20,8 +20,6 @@
package org.apache.felix.sigil.ui.eclipse.ui.util;
-import org.apache.felix.sigil.ui.eclipse.ui.editors.project.IElementDescriptor;
-import org.apache.felix.sigil.ui.eclipse.ui.editors.project.WrappedContentProposal;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
@@ -46,7 +44,7 @@
E result;
if ( element instanceof WrappedContentProposal<?> )
{
- WrappedContentProposal<?> proposal = ( WrappedContentProposal<?> ) element;
+ WrappedContentProposal<?> proposal = (org.apache.felix.sigil.ui.eclipse.ui.util.WrappedContentProposal<?> ) element;
result = ( E ) proposal.getElement();
}
else