You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ds...@apache.org on 2010/08/02 19:08:20 UTC
svn commit: r981604 [20/22] - in /felix/trunk/sigil:
common/core.tests/src/org/apache/felix/sigil/common/core/
common/core.tests/src/org/apache/felix/sigil/common/core/internal/model/osgi/
common/core/src/org/apache/felix/sigil/common/bnd/ common/core/...
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/BackgroundLoadingSelectionDialog.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/BackgroundLoadingSelectionDialog.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/BackgroundLoadingSelectionDialog.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/BackgroundLoadingSelectionDialog.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -71,24 +70,23 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.progress.IJobRunnable;
-
public class BackgroundLoadingSelectionDialog<E> extends TitleAreaDialog implements IAccumulator<E>
{
private final ILabelProvider DEFAULT_LABEL_PROVIDER = new LabelProvider()
{
@SuppressWarnings("unchecked")
- public String getText( Object element )
+ public String getText(Object element)
{
String result;
- if ( element instanceof WrappedContentProposal<?> )
+ if (element instanceof WrappedContentProposal<?>)
{
- WrappedContentProposal<E> contentProposal = (org.apache.felix.sigil.eclipse.ui.util.WrappedContentProposal<E> ) element;
+ WrappedContentProposal<E> contentProposal = (org.apache.felix.sigil.eclipse.ui.util.WrappedContentProposal<E>) element;
result = contentProposal.getLabel();
}
else
{
- result = descriptor.getLabel( ( E ) element );
+ result = descriptor.getLabel((E) element);
}
return result;
}
@@ -96,13 +94,12 @@ public class BackgroundLoadingSelectionD
private final IElementDescriptor<E> DEFAULT_DESCRIPTOR = new IElementDescriptor<E>()
{
- public String getLabel( E element )
+ public String getLabel(E element)
{
- return getName( element );
+ return getName(element);
}
-
- public String getName( E element )
+ public String getName(E element)
{
return element == null ? "null" : element.toString();
}
@@ -124,25 +121,22 @@ public class BackgroundLoadingSelectionD
private HashMap<String, IJobRunnable> background = new HashMap<String, IJobRunnable>();
-
- public BackgroundLoadingSelectionDialog( Shell parentShell, String selectionLabel, boolean multi )
+ public BackgroundLoadingSelectionDialog(Shell parentShell, String selectionLabel, boolean multi)
{
- super( parentShell );
+ super(parentShell);
elements = new ArrayList<E>();
this.selectionLabel = selectionLabel;
this.multi = multi;
}
-
- public void setFilter( IFilter<? super E> filter )
+ public void setFilter(IFilter<? super E> filter)
{
this.filter = filter;
}
-
- public void setDescriptor( final IElementDescriptor<? super E> descriptor )
+ public void setDescriptor(final IElementDescriptor<? super E> descriptor)
{
- if ( descriptor != null )
+ if (descriptor != null)
{
this.descriptor = descriptor;
}
@@ -152,22 +146,19 @@ public class BackgroundLoadingSelectionD
}
}
-
public IElementDescriptor<? super E> getDescriptor()
{
return descriptor;
}
-
- public void setComparator( Comparator<? super E> comparator )
+ public void setComparator(Comparator<? super E> comparator)
{
this.comparator = comparator;
}
-
- public void setLabelProvider( ILabelProvider labelProvider )
+ public void setLabelProvider(ILabelProvider labelProvider)
{
- if ( labelProvider != null )
+ if (labelProvider != null)
{
this.labelProvider = labelProvider;
}
@@ -177,13 +168,11 @@ public class BackgroundLoadingSelectionD
}
}
-
- public void addBackgroundJob( String name, IJobRunnable job )
+ public void addBackgroundJob(String name, IJobRunnable job)
{
- background.put( name, job );
+ background.put(name, job);
}
-
@Override
public int open()
{
@@ -194,216 +183,211 @@ public class BackgroundLoadingSelectionD
}
finally
{
- for ( Job j : jobs )
+ for (Job j : jobs)
{
j.cancel();
}
}
}
-
private Job[] scheduleJobs()
{
- if ( background.isEmpty() )
+ if (background.isEmpty())
{
- return new Job[]
- {};
+ return new Job[] {};
}
else
{
- ArrayList<Job> jobs = new ArrayList<Job>( background.size() );
- for ( Map.Entry<String, IJobRunnable> e : background.entrySet() )
+ ArrayList<Job> jobs = new ArrayList<Job>(background.size());
+ for (Map.Entry<String, IJobRunnable> e : background.entrySet())
{
final IJobRunnable run = e.getValue();
- Job job = new Job( e.getKey() )
+ Job job = new Job(e.getKey())
{
@Override
- protected IStatus run( IProgressMonitor monitor )
+ protected IStatus run(IProgressMonitor monitor)
{
- return run.run( monitor );
+ return run.run(monitor);
}
};
job.schedule();
}
- return jobs.toArray( new Job[jobs.size()] );
+ return jobs.toArray(new Job[jobs.size()]);
}
}
-
@Override
- protected Control createDialogArea( Composite parent )
+ protected Control createDialogArea(Composite parent)
{
// Create Controls
- Composite container = ( Composite ) super.createDialogArea( parent );
- Composite composite = new Composite( container, SWT.NONE );
+ Composite container = (Composite) super.createDialogArea(parent);
+ Composite composite = new Composite(container, SWT.NONE);
- new Label( composite, SWT.NONE ).setText( selectionLabel );
+ new Label(composite, SWT.NONE).setText(selectionLabel);
ContentProposalAdapter proposalAdapter = null;
Text txtSelection = null;
Table table = null;
- if ( multi )
+ if (multi)
{
- table = new Table( composite, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER );
- viewer = new TableViewer( table );
- viewer.setContentProvider( new ArrayContentProvider() );
- viewer.addFilter( new ViewerFilter()
+ table = new Table(composite, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
+ viewer = new TableViewer(table);
+ viewer.setContentProvider(new ArrayContentProvider());
+ viewer.addFilter(new ViewerFilter()
{
- public boolean select( Viewer viewer, Object parentElement, Object element )
+ public boolean select(Viewer viewer, Object parentElement, Object element)
{
@SuppressWarnings("unchecked")
- E castedElement = ( E ) element;
- return filter == null || filter.select( castedElement );
+ E castedElement = (E) element;
+ return filter == null || filter.select(castedElement);
}
- } );
- if ( comparator != null )
+ });
+ if (comparator != null)
{
- viewer.setSorter( new ViewerSorter()
+ viewer.setSorter(new ViewerSorter()
{
@Override
- public int compare( Viewer viewer, Object o1, Object o2 )
+ public int compare(Viewer viewer, Object o1, Object o2)
{
@SuppressWarnings("unchecked")
- E e1 = ( E ) o1;
+ E e1 = (E) o1;
@SuppressWarnings("unchecked")
- E e2 = ( E ) o2;
- return comparator.compare( e1, e2 );
+ E e2 = (E) o2;
+ return comparator.compare(e1, e2);
}
- } );
+ });
}
- synchronized ( elements )
+ synchronized (elements)
{
- viewer.setInput( elements );
+ viewer.setInput(elements);
}
- if ( labelProvider != null )
+ if (labelProvider != null)
{
- viewer.setLabelProvider( labelProvider );
+ viewer.setLabelProvider(labelProvider);
}
}
else
{
- txtSelection = new Text( composite, SWT.BORDER );
- ControlDecoration selectionDecor = new ControlDecoration( txtSelection, SWT.LEFT | SWT.TOP );
+ txtSelection = new Text(composite, SWT.BORDER);
+ ControlDecoration selectionDecor = new ControlDecoration(txtSelection,
+ SWT.LEFT | SWT.TOP);
FieldDecoration proposalDecor = FieldDecorationRegistry.getDefault().getFieldDecoration(
- FieldDecorationRegistry.DEC_CONTENT_PROPOSAL );
- selectionDecor.setImage( proposalDecor.getImage() );
- selectionDecor.setDescriptionText( proposalDecor.getDescription() );
+ FieldDecorationRegistry.DEC_CONTENT_PROPOSAL);
+ selectionDecor.setImage(proposalDecor.getImage());
+ selectionDecor.setDescriptionText(proposalDecor.getDescription());
- ExclusionContentProposalProvider<E> proposalProvider = new ExclusionContentProposalProvider<E>( elements,
- filter, descriptor );
+ ExclusionContentProposalProvider<E> proposalProvider = new ExclusionContentProposalProvider<E>(
+ elements, filter, descriptor);
- proposalAdapter = new ContentProposalAdapter( txtSelection, new TextContentAdapter(), proposalProvider,
- null, null );
- proposalAdapter.setProposalAcceptanceStyle( ContentProposalAdapter.PROPOSAL_REPLACE );
- if ( labelProvider != null )
+ proposalAdapter = new ContentProposalAdapter(txtSelection,
+ new TextContentAdapter(), proposalProvider, null, null);
+ proposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
+ if (labelProvider != null)
{
- proposalAdapter.setLabelProvider( labelProvider );
+ proposalAdapter.setLabelProvider(labelProvider);
}
- if ( selectedName != null )
+ if (selectedName != null)
{
- txtSelection.setText( selectedName );
+ txtSelection.setText(selectedName);
}
}
updateSelection();
updateButtons();
// Hookup listeners
- if ( proposalAdapter != null )
+ if (proposalAdapter != null)
{
- proposalAdapter.addContentProposalListener( new IContentProposalListener()
+ proposalAdapter.addContentProposalListener(new IContentProposalListener()
{
- public void proposalAccepted( IContentProposal proposal )
+ public void proposalAccepted(IContentProposal proposal)
{
@SuppressWarnings("unchecked")
- WrappedContentProposal<E> valueProposal = (org.apache.felix.sigil.eclipse.ui.util.WrappedContentProposal<E> ) proposal;
+ WrappedContentProposal<E> valueProposal = (org.apache.felix.sigil.eclipse.ui.util.WrappedContentProposal<E>) proposal;
E selected = valueProposal.getElement();
- selection = new ArrayList<E>( 1 );
- selection.add( selected );
+ selection = new ArrayList<E>(1);
+ selection.add(selected);
- elementSelected( selected );
+ elementSelected(selected);
updateButtons();
}
- } );
+ });
}
- if ( txtSelection != null )
+ if (txtSelection != null)
{
- txtSelection.addModifyListener( new ModifyListener()
+ txtSelection.addModifyListener(new ModifyListener()
{
- public void modifyText( ModifyEvent e )
+ public void modifyText(ModifyEvent e)
{
- selectedName = ( ( Text ) e.widget ).getText();
+ selectedName = ((Text) e.widget).getText();
updateButtons();
}
- } );
+ });
}
- if ( viewer != null )
+ if (viewer != null)
{
- viewer.addSelectionChangedListener( new ISelectionChangedListener()
+ viewer.addSelectionChangedListener(new ISelectionChangedListener()
{
- public void selectionChanged( SelectionChangedEvent event )
+ public void selectionChanged(SelectionChangedEvent event)
{
- IStructuredSelection sel = ( IStructuredSelection ) event.getSelection();
- selection = new ArrayList<E>( sel.size() );
- for ( Iterator<?> iter = sel.iterator(); iter.hasNext(); )
+ IStructuredSelection sel = (IStructuredSelection) event.getSelection();
+ selection = new ArrayList<E>(sel.size());
+ for (Iterator<?> iter = sel.iterator(); iter.hasNext();)
{
@SuppressWarnings("unchecked")
- E element = ( E ) iter.next();
- selection.add( element );
+ E element = (E) iter.next();
+ selection.add(element);
}
updateButtons();
}
- } );
- viewer.addOpenListener( new IOpenListener()
+ });
+ viewer.addOpenListener(new IOpenListener()
{
- public void open( OpenEvent event )
+ public void open(OpenEvent event)
{
- if ( canComplete() )
+ if (canComplete())
{
- setReturnCode( IDialogConstants.OK_ID );
+ setReturnCode(IDialogConstants.OK_ID);
close();
}
}
- } );
+ });
}
// Layout
- composite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
- if ( multi )
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ if (multi)
{
- composite.setLayout( new GridLayout( 1, false ) );
- GridData layoutTable = new GridData( SWT.FILL, SWT.FILL, true, true );
+ composite.setLayout(new GridLayout(1, false));
+ GridData layoutTable = new GridData(SWT.FILL, SWT.FILL, true, true);
layoutTable.heightHint = 200;
- table.setLayoutData( layoutTable );
+ table.setLayoutData(layoutTable);
}
else
{
- composite.setLayout( new GridLayout( 2, false ) );
- txtSelection.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
+ composite.setLayout(new GridLayout(2, false));
+ txtSelection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
}
return container;
}
-
- protected void elementSelected( E selection )
+ protected void elementSelected(E selection)
{
}
-
@Override
- protected Control createButtonBar( Composite parent )
+ protected Control createButtonBar(Composite parent)
{
- Control bar = super.createButtonBar( parent );
+ Control bar = super.createButtonBar(parent);
updateButtons();
return bar;
}
-
/**
* Can be called from any thread
*/
@@ -414,24 +398,23 @@ public class BackgroundLoadingSelectionD
public void run()
{
Shell shell = getShell();
- if ( shell != null && !shell.isDisposed() )
+ if (shell != null && !shell.isDisposed())
{
- Button okButton = getButton( IDialogConstants.OK_ID );
- if ( okButton != null && !okButton.isDisposed() )
+ Button okButton = getButton(IDialogConstants.OK_ID);
+ if (okButton != null && !okButton.isDisposed())
{
- okButton.setEnabled( canComplete() );
+ okButton.setEnabled(canComplete());
}
}
}
};
Shell shell = getShell();
- if ( shell != null )
+ if (shell != null)
{
- onUIThread( shell, updateButtonsRunnable );
+ onUIThread(shell, updateButtonsRunnable);
}
}
-
/**
* Subclasses may override but must call super.canComplete
* @return
@@ -440,60 +423,58 @@ public class BackgroundLoadingSelectionD
{
boolean result = false;
- if ( selection != null )
+ if (selection != null)
{
- if ( multi )
+ if (multi)
{
result = selection.size() > 0;
}
else
{
E sel = getSelectedElement();
- result = sel != null && descriptor.getName( sel ).equals( selectedName );
+ result = sel != null && descriptor.getName(sel).equals(selectedName);
}
}
return result;
}
-
- public final void addElement( E added )
+ public final void addElement(E added)
{
- addElements( Collections.singleton( added ) );
+ addElements(Collections.singleton(added));
}
-
/**
* Can be called from any thread
*/
- public final void addElements( Collection<? extends E> added )
+ public final void addElements(Collection<? extends E> added)
{
final LinkedList<E> toAdd = new LinkedList<E>();
- synchronized ( elements )
+ synchronized (elements)
{
- for ( E e : added )
+ for (E e : added)
{
- if ( !elements.contains( e ) )
+ if (!elements.contains(e))
{
- elements.add( e );
- toAdd.add( e );
+ elements.add(e);
+ toAdd.add(e);
}
}
- Collections.sort( elements, comparator );
+ Collections.sort(elements, comparator);
}
- if ( viewer != null )
+ if (viewer != null)
{
- onUIThread( viewer.getControl(), new Runnable()
+ onUIThread(viewer.getControl(), new Runnable()
{
public void run()
{
- if ( !viewer.getControl().isDisposed() )
+ if (!viewer.getControl().isDisposed())
{
- viewer.add( toAdd.toArray() );
+ viewer.add(toAdd.toArray());
viewer.refresh();
}
}
- } );
+ });
}
else
{
@@ -503,23 +484,22 @@ public class BackgroundLoadingSelectionD
updateButtons();
}
-
protected void updateSelection()
{
- onUIThread( getShell(), new Runnable()
+ onUIThread(getShell(), new Runnable()
{
public void run()
{
- if ( selectedName != null )
+ if (selectedName != null)
{
ArrayList<E> newSelection = new ArrayList<E>();
- synchronized ( elements )
+ synchronized (elements)
{
- for ( E e : elements )
+ for (E e : elements)
{
- if ( selectedName.equals( descriptor.getName( e ) ) )
+ if (selectedName.equals(descriptor.getName(e)))
{
- newSelection.add( e );
+ newSelection.add(e);
break;
}
}
@@ -530,24 +510,23 @@ public class BackgroundLoadingSelectionD
{
selection = Collections.emptyList();
}
- if ( viewer != null && !viewer.getControl().isDisposed() )
+ if (viewer != null && !viewer.getControl().isDisposed())
{
- viewer.setSelection( selection.isEmpty() ? StructuredSelection.EMPTY : new StructuredSelection(
- selection ) );
+ viewer.setSelection(selection.isEmpty() ? StructuredSelection.EMPTY
+ : new StructuredSelection(selection));
}
}
- } );
+ });
}
-
- private static final void onUIThread( Control control, Runnable r )
+ private static final void onUIThread(Control control, Runnable r)
{
- if ( control != null && !control.isDisposed() )
+ if (control != null && !control.isDisposed())
{
try
{
Display display = control.getDisplay();
- if ( Thread.currentThread() == display.getThread() )
+ if (Thread.currentThread() == display.getThread())
{
// We are on the UI thread already, just do the work
r.run();
@@ -555,12 +534,12 @@ public class BackgroundLoadingSelectionD
else
{
// Not on the UI thread, need to bung over the runnable
- display.asyncExec( r );
+ display.asyncExec(r);
}
}
- catch ( SWTError e )
+ catch (SWTError e)
{
- if ( e.code == SWT.ERROR_WIDGET_DISPOSED )
+ if (e.code == SWT.ERROR_WIDGET_DISPOSED)
{
// ignore
}
@@ -572,60 +551,57 @@ public class BackgroundLoadingSelectionD
}
}
-
public String getSelectedName()
{
return selectedName;
}
-
- public void setSelectedName( String selectedName )
+ public void setSelectedName(String selectedName)
{
this.selectedName = selectedName;
boolean change = false;
- if ( selectedName == null )
+ if (selectedName == null)
{
- if ( selection != null && !selection.isEmpty() )
+ if (selection != null && !selection.isEmpty())
{
change = true;
}
}
else
{
- if ( selection == null )
+ if (selection == null)
{
change = true;
}
- else if ( selection.size() != 1 || !descriptor.getLabel( selection.get( 0 ) ).equals( selectedName ) )
+ else if (selection.size() != 1
+ || !descriptor.getLabel(selection.get(0)).equals(selectedName))
{
change = true;
}
}
- if ( change )
+ if (change)
{
updateSelection();
updateButtons();
}
}
-
public List<E> getSelectedElements()
{
return selection;
}
-
public E getSelectedElement()
{
E result;
- if ( selection == null || selection.isEmpty() )
+ if (selection == null || selection.isEmpty())
{
result = null;
}
else
{
- result = selection.get( 0 );
+ result = selection.get(0);
}
return result;
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ColumnModelLabelProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ColumnModelLabelProvider.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ColumnModelLabelProvider.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ColumnModelLabelProvider.java Mon Aug 2 17:08:03 2010
@@ -19,28 +19,24 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.swt.graphics.Image;
-
public class ColumnModelLabelProvider extends ColumnLabelProvider
{
private ModelLabelProvider provider = new ModelLabelProvider();
-
@Override
- public Image getImage( Object element )
+ public Image getImage(Object element)
{
- return provider.getImage( element );
+ return provider.getImage(element);
}
-
@Override
- public String getText( Object element )
+ public String getText(Object element)
{
- return provider.getText( element );
+ return provider.getText(element);
}
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/DefaultContentProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/DefaultContentProvider.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/DefaultContentProvider.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/DefaultContentProvider.java Mon Aug 2 17:08:03 2010
@@ -19,11 +19,9 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.jface.viewers.Viewer;
-
public class DefaultContentProvider implements IContentProvider
{
@@ -31,8 +29,7 @@ public class DefaultContentProvider impl
{
}
-
- public void inputChanged( Viewer viewer, Object oldInput, Object newInput )
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
{
}
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/DefaultLabelProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/DefaultLabelProvider.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/DefaultLabelProvider.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/DefaultLabelProvider.java Mon Aug 2 17:08:03 2010
@@ -19,32 +19,27 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
import org.eclipse.jface.viewers.IBaseLabelProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
-
public abstract class DefaultLabelProvider implements IBaseLabelProvider, ILabelProvider
{
- public boolean isLabelProperty( Object element, String property )
+ public boolean isLabelProperty(Object element, String property)
{
return false;
}
-
public void dispose()
{
}
-
- public void addListener( ILabelProviderListener listener )
+ public void addListener(ILabelProviderListener listener)
{
}
-
- public void removeListener( ILabelProviderListener listener )
+ public void removeListener(ILabelProviderListener listener)
{
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/DefaultTableProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/DefaultTableProvider.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/DefaultTableProvider.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/DefaultTableProvider.java Mon Aug 2 17:08:03 2010
@@ -19,12 +19,10 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
import java.util.Collection;
import org.eclipse.jface.viewers.IStructuredContentProvider;
-
public abstract class DefaultTableProvider extends DefaultContentProvider implements IStructuredContentProvider
{
@@ -39,25 +37,25 @@ public abstract class DefaultTableProvid
*
* @throws IllegalArgumentException if the element cannot be converted.
*/
- public Object[] toArray( Object inputElement )
+ public Object[] toArray(Object inputElement)
{
- if ( inputElement == null )
+ if (inputElement == null)
{
- return new Object[]
- {};
+ return new Object[] {};
}
- else if ( inputElement instanceof Collection )
+ else if (inputElement instanceof Collection)
{
- Collection<?> col = ( Collection<?> ) inputElement;
+ Collection<?> col = (Collection<?>) inputElement;
return col.toArray();
}
- else if ( inputElement.getClass().isArray() )
+ else if (inputElement.getClass().isArray())
{
- return ( Object[] ) inputElement;
+ return (Object[]) inputElement;
}
else
{
- throw new IllegalArgumentException( "Invalid inputElement " + inputElement.getClass() );
+ throw new IllegalArgumentException("Invalid inputElement "
+ + inputElement.getClass());
}
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/DefaultTreeContentProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/DefaultTreeContentProvider.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/DefaultTreeContentProvider.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/DefaultTreeContentProvider.java Mon Aug 2 17:08:03 2010
@@ -19,10 +19,8 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
import org.eclipse.jface.viewers.ITreeContentProvider;
-
public abstract class DefaultTreeContentProvider extends DefaultContentProvider implements ITreeContentProvider
{
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ExclusionContentProposalProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ExclusionContentProposalProvider.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ExclusionContentProposalProvider.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ExclusionContentProposalProvider.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -31,7 +30,6 @@ import org.apache.felix.sigil.utils.Glob
import org.eclipse.jface.fieldassist.IContentProposal;
import org.eclipse.jface.fieldassist.IContentProposalProvider;
-
public class ExclusionContentProposalProvider<T> implements IContentProposalProvider
{
@@ -39,46 +37,44 @@ public class ExclusionContentProposalPro
private final IFilter<? super T> filter;
private final IElementDescriptor<? super T> descriptor;
-
- public ExclusionContentProposalProvider( Collection<? extends T> elements, IFilter<? super T> filter,
- IElementDescriptor<? super T> descriptor )
+ public ExclusionContentProposalProvider(Collection<? extends T> elements, IFilter<? super T> filter, IElementDescriptor<? super T> descriptor)
{
this.elements = elements;
this.filter = filter;
this.descriptor = descriptor;
}
-
- public IContentProposal[] getProposals( String contents, int position )
+ public IContentProposal[] getProposals(String contents, int position)
{
- String matchString = contents.substring( 0, position );
- Pattern pattern = GlobCompiler.compile( matchString );
+ String matchString = contents.substring(0, position);
+ Pattern pattern = GlobCompiler.compile(matchString);
// Get a snapshot of the elements
T[] elementArray;
- synchronized ( elements )
+ synchronized (elements)
{
@SuppressWarnings("unchecked")
- T[] temp = ( T[] ) elements.toArray();
+ T[] temp = (T[]) elements.toArray();
elementArray = temp;
}
List<IContentProposal> result = new ArrayList<IContentProposal>();
- for ( T element : elementArray )
+ 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() );
- if ( matcher.find() )
+ IContentProposal proposal = WrappedContentProposal.newInstance(element,
+ descriptor);
+ Matcher matcher = pattern.matcher(proposal.getContent());
+ if (matcher.find())
{
- result.add( proposal );
+ result.add(proposal);
}
}
}
- return result.toArray( new IContentProposal[result.size()] );
+ return result.toArray(new IContentProposal[result.size()]);
}
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ExportedPackageFinder.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ExportedPackageFinder.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ExportedPackageFinder.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ExportedPackageFinder.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
import java.util.ArrayList;
import java.util.List;
@@ -33,46 +32,44 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.ui.progress.IJobRunnable;
-
public class ExportedPackageFinder implements IJobRunnable
{
private final IAccumulator<? super IPackageExport> accumulator;
private final ISigilProjectModel sigil;
-
- public ExportedPackageFinder( ISigilProjectModel sigil, IAccumulator<? super IPackageExport> accumulator )
+ public ExportedPackageFinder(ISigilProjectModel sigil, IAccumulator<? super IPackageExport> accumulator)
{
this.sigil = sigil;
this.accumulator = accumulator;
}
-
- public IStatus run( final IProgressMonitor monitor )
+ public IStatus run(final IProgressMonitor monitor)
{
- final List<IPackageExport> exports = new ArrayList<IPackageExport>( ResourcesDialogHelper.UPDATE_BATCH_SIZE );
+ final List<IPackageExport> exports = new ArrayList<IPackageExport>(
+ ResourcesDialogHelper.UPDATE_BATCH_SIZE);
final IModelWalker walker = new IModelWalker()
{
- public boolean visit( IModelElement element )
+ public boolean visit(IModelElement element)
{
- if ( element instanceof IPackageExport )
+ if (element instanceof IPackageExport)
{
- IPackageExport pkgExport = ( IPackageExport ) element;
- exports.add( pkgExport );
+ IPackageExport pkgExport = (IPackageExport) element;
+ exports.add(pkgExport);
- if ( exports.size() >= ResourcesDialogHelper.UPDATE_BATCH_SIZE )
+ if (exports.size() >= ResourcesDialogHelper.UPDATE_BATCH_SIZE)
{
- accumulator.addElements( exports );
+ accumulator.addElements(exports);
exports.clear();
}
}
return !monitor.isCanceled();
}
};
- SigilCore.getRepositoryManager( sigil ).visit( walker );
- if ( exports.size() > 0 )
+ SigilCore.getRepositoryManager(sigil).visit(walker);
+ if (exports.size() > 0)
{
- accumulator.addElements( exports );
+ accumulator.addElements(exports);
}
return Status.OK_STATUS;
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/FileUtils.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/FileUtils.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/FileUtils.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/FileUtils.java Mon Aug 2 17:08:03 2010
@@ -19,36 +19,34 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-
public class FileUtils
{
- public static void loadFile( Shell shell, Text text, String msg, boolean isDirectory )
+ public static void loadFile(Shell shell, Text text, String msg, boolean isDirectory)
{
- if ( isDirectory )
+ if (isDirectory)
{
- DirectoryDialog dialog = new DirectoryDialog( shell, SWT.NONE );
- dialog.setMessage( msg );
+ DirectoryDialog dialog = new DirectoryDialog(shell, SWT.NONE);
+ dialog.setMessage(msg);
String value = dialog.open();
- if ( value != null )
+ if (value != null)
{
- text.setText( value );
+ text.setText(value);
}
}
else
{
- FileDialog dialog = new FileDialog( shell, SWT.NONE );
- dialog.setText( msg );
+ FileDialog dialog = new FileDialog(shell, SWT.NONE);
+ dialog.setText(msg);
String value = dialog.open();
- if ( value != null )
+ if (value != null)
{
- text.setText( value );
+ text.setText(value);
}
}
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IAccumulator.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IAccumulator.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IAccumulator.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IAccumulator.java Mon Aug 2 17:08:03 2010
@@ -19,14 +19,11 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
import java.util.Collection;
-
public interface IAccumulator<E>
{
- public void addElement( E element );
-
+ public void addElement(E element);
- public void addElements( Collection<? extends E> elements );
+ public void addElements(Collection<? extends E> elements);
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IElementDescriptor.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IElementDescriptor.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IElementDescriptor.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IElementDescriptor.java Mon Aug 2 17:08:03 2010
@@ -19,14 +19,12 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
public interface IElementDescriptor<E>
{
/**
* Return the short identifying name of the element.
*/
- String getName( E element );
-
+ String getName(E element);
/**
* Return a label for the element, including the name but possibly supplying
@@ -35,5 +33,5 @@ public interface IElementDescriptor<E>
* @param element
* @return
*/
- String getLabel( E element );
+ String getLabel(E element);
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IExportToImportConverter.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IExportToImportConverter.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IExportToImportConverter.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IExportToImportConverter.java Mon Aug 2 17:08:03 2010
@@ -19,8 +19,7 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
public interface IExportToImportConverter<E, I>
{
- I convert( E exportElement );
+ I convert(E exportElement);
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IFilter.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IFilter.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IFilter.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IFilter.java Mon Aug 2 17:08:03 2010
@@ -19,8 +19,7 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
public interface IFilter<T>
{
- boolean select( T element );
+ boolean select(T element);
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IValidationListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IValidationListener.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IValidationListener.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/IValidationListener.java Mon Aug 2 17:08:03 2010
@@ -19,10 +19,9 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
public interface IValidationListener
{
- void validationMessage( String message, int level );
+ void validationMessage(String message, int level);
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ModelLabelProvider.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ModelLabelProvider.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ModelLabelProvider.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ModelLabelProvider.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
import java.util.Set;
import org.apache.felix.sigil.common.model.IModelElement;
@@ -41,40 +40,39 @@ import org.eclipse.jface.viewers.LabelPr
import org.eclipse.swt.graphics.Image;
import org.osgi.framework.Version;
-
public class ModelLabelProvider extends LabelProvider
{
private volatile Set<? extends IModelElement> unresolvedElements = null;
-
- public Image getImage( Object element )
+ public Image getImage(Object element)
{
- boolean unresolved = ( unresolvedElements == null ) ? false : unresolvedElements.contains( element );
+ boolean unresolved = (unresolvedElements == null) ? false
+ : unresolvedElements.contains(element);
- if ( element instanceof ISigilBundle || element instanceof IBundleModelElement )
+ if (element instanceof ISigilBundle || element instanceof IBundleModelElement)
{
return findBundle();
}
- else if ( element instanceof IRequiredBundle )
+ else if (element instanceof IRequiredBundle)
{
- boolean optional = ( ( IRequiredBundle ) element ).isOptional();
- return findRequiredBundle( optional, unresolved );
+ boolean optional = ((IRequiredBundle) element).isOptional();
+ return findRequiredBundle(optional, unresolved);
}
- else if ( element instanceof IPackageImport )
+ else if (element instanceof IPackageImport)
{
- boolean optional = ( ( IPackageImport ) element ).isOptional();
- return findPackageImport( optional, unresolved );
+ boolean optional = ((IPackageImport) element).isOptional();
+ return findPackageImport(optional, unresolved);
}
- else if ( element instanceof IPackageExport )
+ else if (element instanceof IPackageExport)
{
return findPackageExport();
}
- else if ( element instanceof IPackageFragmentRoot )
+ else if (element instanceof IPackageFragmentRoot)
{
- IPackageFragmentRoot root = ( IPackageFragmentRoot ) element;
+ IPackageFragmentRoot root = (IPackageFragmentRoot) element;
try
{
- if ( root.getKind() == IPackageFragmentRoot.K_SOURCE )
+ if (root.getKind() == IPackageFragmentRoot.K_SOURCE)
{
return findPackage();
}
@@ -83,154 +81,154 @@ public class ModelLabelProvider extends
return findBundle();
}
}
- catch ( JavaModelException e )
+ catch (JavaModelException e)
{
- SigilCore.error( "Failed to inspect package fragment root", e );
+ SigilCore.error("Failed to inspect package fragment root", e);
}
}
- else if ( element instanceof IClasspathEntry )
+ else if (element instanceof IClasspathEntry)
{
return findPackage();
}
- if ( element instanceof IBundleRepository )
+ if (element instanceof IBundleRepository)
{
- IBundleRepository rep = ( IBundleRepository ) element;
- IRepositoryModel config = SigilCore.getRepositoryConfiguration().findRepository( rep.getId() );
+ IBundleRepository rep = (IBundleRepository) element;
+ IRepositoryModel config = SigilCore.getRepositoryConfiguration().findRepository(
+ rep.getId());
return config.getType().getIcon();
}
return null;
}
-
- public String getText( Object element )
+ public String getText(Object element)
{
- if ( element instanceof ISigilBundle )
+ if (element instanceof ISigilBundle)
{
- ISigilBundle bundle = ( ISigilBundle ) element;
- return bundle.getBundleInfo().getSymbolicName() + " " + bundle.getBundleInfo().getVersion();
+ ISigilBundle bundle = (ISigilBundle) element;
+ return bundle.getBundleInfo().getSymbolicName() + " "
+ + bundle.getBundleInfo().getVersion();
}
- if ( element instanceof IBundleModelElement )
+ if (element instanceof IBundleModelElement)
{
- IBundleModelElement bundle = ( IBundleModelElement ) element;
+ IBundleModelElement bundle = (IBundleModelElement) element;
return bundle.getSymbolicName();
}
- if ( element instanceof IRequiredBundle )
+ if (element instanceof IRequiredBundle)
{
- IRequiredBundle req = ( IRequiredBundle ) element;
+ IRequiredBundle req = (IRequiredBundle) element;
return req.getSymbolicName() + " " + req.getVersions();
}
- if ( element instanceof IPackageImport )
+ if (element instanceof IPackageImport)
{
- IPackageImport req = ( IPackageImport ) element;
+ IPackageImport req = (IPackageImport) element;
return req.getPackageName() + " " + req.getVersions();
}
- if ( element instanceof IPackageExport )
+ if (element instanceof IPackageExport)
{
- IPackageExport pe = ( IPackageExport ) element;
+ IPackageExport pe = (IPackageExport) element;
Version rawVersion = pe.getRawVersion();
- return rawVersion != null ? pe.getPackageName() + " " + rawVersion : pe.getPackageName();
+ return rawVersion != null ? pe.getPackageName() + " " + rawVersion
+ : pe.getPackageName();
}
- if ( element instanceof IResource )
+ if (element instanceof IResource)
{
- IResource resource = ( IResource ) element;
+ IResource resource = (IResource) element;
return resource.getName();
}
- if ( element instanceof IPackageFragment )
+ if (element instanceof IPackageFragment)
{
- IPackageFragment f = ( IPackageFragment ) element;
+ IPackageFragment f = (IPackageFragment) element;
return f.getElementName();
}
- if ( element instanceof IPackageFragmentRoot )
+ if (element instanceof IPackageFragmentRoot)
{
- IPackageFragmentRoot f = ( IPackageFragmentRoot ) element;
+ IPackageFragmentRoot f = (IPackageFragmentRoot) element;
try
{
return f.getUnderlyingResource().getName();
}
- catch ( JavaModelException e )
+ catch (JavaModelException e)
{
return "unknown";
}
}
- if ( element instanceof IClasspathEntry )
+ if (element instanceof IClasspathEntry)
{
- IClasspathEntry cp = ( IClasspathEntry ) element;
+ IClasspathEntry cp = (IClasspathEntry) element;
return cp.getPath().toString();
}
- if ( element instanceof IBundleRepository )
+ if (element instanceof IBundleRepository)
{
- IBundleRepository rep = ( IBundleRepository ) element;
- IRepositoryModel config = SigilCore.getRepositoryConfiguration().findRepository( rep.getId() );
+ IBundleRepository rep = (IBundleRepository) element;
+ IRepositoryModel config = SigilCore.getRepositoryConfiguration().findRepository(
+ rep.getId());
return config.getName();
}
return element.toString();
}
-
private Image findPackage()
{
- return cacheImage( "icons/package.gif" );
+ return cacheImage("icons/package.gif");
}
-
- private Image findPackageImport( boolean optional, boolean unresolved )
+ private Image findPackageImport(boolean optional, boolean unresolved)
{
String path;
- if ( optional )
+ if (optional)
{
- path = unresolved ? "icons/import-package-optional-error.gif" : "icons/import-package-optional.gif";
+ path = unresolved ? "icons/import-package-optional-error.gif"
+ : "icons/import-package-optional.gif";
}
else
{
- path = unresolved ? "icons/import-package-error.gif" : "icons/import-package.gif";
+ path = unresolved ? "icons/import-package-error.gif"
+ : "icons/import-package.gif";
}
- return cacheImage( path );
+ return cacheImage(path);
}
-
private Image findPackageExport()
{
- return cacheImage( "icons/export-package.gif" );
+ return cacheImage("icons/export-package.gif");
}
-
private Image findBundle()
{
- return cacheImage( "icons/bundle.gif" );
+ return cacheImage("icons/bundle.gif");
}
-
- private Image findRequiredBundle( boolean optional, boolean unresolved )
+ private Image findRequiredBundle(boolean optional, boolean unresolved)
{
String path;
- if ( optional )
+ if (optional)
{
- path = unresolved ? "icons/require-bundle-optional-error.gif" : "icons/require-bundle-optional.gif";
+ path = unresolved ? "icons/require-bundle-optional-error.gif"
+ : "icons/require-bundle-optional.gif";
}
else
{
- path = unresolved ? "icons/require-bundle-error.gif" : "icons/require-bundle.gif";
+ path = unresolved ? "icons/require-bundle-error.gif"
+ : "icons/require-bundle.gif";
}
- return cacheImage( path );
+ return cacheImage(path);
}
-
- private static Image cacheImage( String path )
+ private static Image cacheImage(String path)
{
- return SigilUI.cacheImage( path, ModelLabelProvider.class.getClassLoader() );
+ return SigilUI.cacheImage(path, ModelLabelProvider.class.getClassLoader());
}
-
- public void setUnresolvedElements( Set<? extends IModelElement> elements )
+ public void setUnresolvedElements(Set<? extends IModelElement> elements)
{
this.unresolvedElements = elements;
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/PackageFilter.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/PackageFilter.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/PackageFilter.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/PackageFilter.java Mon Aug 2 17:08:03 2010
@@ -19,41 +19,36 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
import java.util.HashSet;
import java.util.Set;
import org.apache.felix.sigil.common.model.osgi.IPackageExport;
import org.apache.felix.sigil.common.model.osgi.IPackageImport;
-
public class PackageFilter implements IFilter<IPackageImport>
{
private Set<String> names = new HashSet<String>();
-
- public PackageFilter( String[] packageNames )
+ public PackageFilter(String[] packageNames)
{
- for ( String name : packageNames )
+ for (String name : packageNames)
{
- names.add( name );
+ names.add(name);
}
}
-
- public PackageFilter( IPackageExport[] packages )
+ public PackageFilter(IPackageExport[] packages)
{
- for ( IPackageExport packageExport : packages )
+ for (IPackageExport packageExport : packages)
{
- names.add( packageExport.getPackageName() );
+ names.add(packageExport.getPackageName());
}
}
-
- public boolean select( IPackageImport element )
+ public boolean select(IPackageImport element)
{
- return !names.contains( element.getPackageName() );
+ return !names.contains(element.getPackageName());
}
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ProjectUtils.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ProjectUtils.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ProjectUtils.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ProjectUtils.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
import java.util.concurrent.Callable;
import org.apache.felix.sigil.eclipse.SigilCore;
@@ -30,26 +29,24 @@ import org.eclipse.jface.dialogs.IDialog
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
public class ProjectUtils
{
- public static boolean runTaskWithRebuildCheck( final Runnable task, Shell shell )
+ public static boolean runTaskWithRebuildCheck(final Runnable task, Shell shell)
{
- return runTaskWithRebuildCheck( new Callable<Boolean>()
+ return runTaskWithRebuildCheck(new Callable<Boolean>()
{
public Boolean call() throws Exception
{
task.run();
return true;
}
- }, shell );
+ }, shell);
}
-
- public static boolean runTaskWithRebuildCheck( Callable<Boolean> callable, Shell shell )
+ public static boolean runTaskWithRebuildCheck(Callable<Boolean> callable, Shell shell)
{
- int result = checkRebuild( shell );
- if ( result == IDialogConstants.CANCEL_ID )
+ int result = checkRebuild(shell);
+ if (result == IDialogConstants.CANCEL_ID)
{
return false;
}
@@ -57,18 +54,18 @@ public class ProjectUtils
{
try
{
- if ( Boolean.TRUE == callable.call() )
+ if (Boolean.TRUE == callable.call())
{
- if ( result == IDialogConstants.YES_ID )
+ if (result == IDialogConstants.YES_ID)
{
- SigilUI.runWorkspaceOperation( new WorkspaceModifyOperation()
+ SigilUI.runWorkspaceOperation(new WorkspaceModifyOperation()
{
@Override
- protected void execute( IProgressMonitor monitor )
+ protected void execute(IProgressMonitor monitor)
{
- SigilCore.rebuildAllBundleDependencies( monitor );
+ SigilCore.rebuildAllBundleDependencies(monitor);
}
- }, shell );
+ }, shell);
}
return true;
}
@@ -77,25 +74,25 @@ public class ProjectUtils
return false;
}
}
- catch ( Exception e )
+ catch (Exception e)
{
- SigilCore.error( "Failed to run caller", e );
+ SigilCore.error("Failed to run caller", e);
return false;
}
}
}
-
- private static int checkRebuild( Shell shell )
+ private static int checkRebuild(Shell shell)
{
- if ( SigilCore.getRoot().getProjects().isEmpty() )
+ if (SigilCore.getRoot().getProjects().isEmpty())
{
return IDialogConstants.NO_ID;
}
else
{
return OptionalPrompt.optionallyPromptWithCancel(
- SigilCore.PREFERENCES_REBUILD_PROJECTS, "Rebuild", "Do you wish to rebuild all Sigil projects", shell );
+ SigilCore.PREFERENCES_REBUILD_PROJECTS, "Rebuild",
+ "Do you wish to rebuild all Sigil projects", shell);
}
}
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ResourceReviewDialog.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ResourceReviewDialog.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ResourceReviewDialog.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ResourceReviewDialog.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
import java.util.Collection;
import org.apache.felix.sigil.common.model.IModelElement;
@@ -40,7 +39,6 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
-
public class ResourceReviewDialog<T extends IModelElement> extends TitleAreaDialog
{
@@ -49,80 +47,76 @@ public class ResourceReviewDialog<T exte
private TableViewer viewer;
-
- public ResourceReviewDialog( Shell parentShell, String title, Collection<T> resources )
+ public ResourceReviewDialog(Shell parentShell, String title, Collection<T> resources)
{
- super( parentShell );
+ super(parentShell);
this.title = title;
this.resources = resources;
}
-
public Collection<T> getResources()
{
return resources;
}
-
@Override
- protected Control createDialogArea( Composite parent )
+ protected Control createDialogArea(Composite parent)
{
- setTitle( title );
+ setTitle(title);
// Create controls
- Composite container = ( Composite ) super.createDialogArea( parent );
- Composite composite = new Composite( container, SWT.NONE );
- Table table = new Table( composite, SWT.BORDER | SWT.VIRTUAL );
-
- final Button remove = new Button( composite, SWT.PUSH );
- remove.setText( "Remove" );
- remove.setEnabled( false );
+ Composite container = (Composite) super.createDialogArea(parent);
+ Composite composite = new Composite(container, SWT.NONE);
+ Table table = new Table(composite, SWT.BORDER | SWT.VIRTUAL);
+
+ final Button remove = new Button(composite, SWT.PUSH);
+ remove.setText("Remove");
+ remove.setEnabled(false);
- remove.addSelectionListener( new SelectionAdapter()
+ remove.addSelectionListener(new SelectionAdapter()
{
@Override
- public void widgetSelected( SelectionEvent e )
+ public void widgetSelected(SelectionEvent e)
{
handleRemove();
}
- } );
+ });
- viewer = new TableViewer( table );
- viewer.setContentProvider( new DefaultTableProvider()
+ viewer = new TableViewer(table);
+ viewer.setContentProvider(new DefaultTableProvider()
{
- public Object[] getElements( Object inputElement )
+ public Object[] getElements(Object inputElement)
{
- return toArray( inputElement );
+ return toArray(inputElement);
}
- } );
+ });
- viewer.setInput( resources );
- viewer.addSelectionChangedListener( new ISelectionChangedListener()
+ viewer.setInput(resources);
+ viewer.addSelectionChangedListener(new ISelectionChangedListener()
{
- public void selectionChanged( SelectionChangedEvent event )
+ public void selectionChanged(SelectionChangedEvent event)
{
- remove.setEnabled( !event.getSelection().isEmpty() );
+ remove.setEnabled(!event.getSelection().isEmpty());
}
- } );
+ });
// layout
- composite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
- composite.setLayout( new GridLayout( 2, false ) );
- GridData tableLayoutData = new GridData( SWT.FILL, SWT.FILL, true, true, 1, 4 );
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ composite.setLayout(new GridLayout(2, false));
+ GridData tableLayoutData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4);
tableLayoutData.heightHint = 150;
- table.setLayoutData( tableLayoutData );
+ table.setLayoutData(tableLayoutData);
return container;
}
-
private void handleRemove()
{
ISelection s = viewer.getSelection();
- if ( !s.isEmpty() )
+ if (!s.isEmpty())
{
- IStructuredSelection sel = ( IStructuredSelection ) s;
- resources.remove( sel.getFirstElement() );
+ IStructuredSelection sel = (IStructuredSelection) s;
+ resources.remove(sel.getFirstElement());
viewer.refresh();
}
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ResourcesDialogHelper.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ResourcesDialogHelper.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ResourcesDialogHelper.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/ResourcesDialogHelper.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
import java.util.ArrayList;
import java.util.Collection;
@@ -51,39 +50,39 @@ import org.eclipse.jdt.core.JavaModelExc
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.progress.IJobRunnable;
-
public class ResourcesDialogHelper
{
static final int UPDATE_BATCH_SIZE = 100;
-
- public static BackgroundLoadingSelectionDialog<String> createClassSelectDialog( Shell shell, String title,
- final ISigilProjectModel project, String selected, final String ifaceOrParentClass )
+ public static BackgroundLoadingSelectionDialog<String> createClassSelectDialog(
+ Shell shell, String title, final ISigilProjectModel project, String selected,
+ final String ifaceOrParentClass)
{
- final BackgroundLoadingSelectionDialog<String> dialog = new BackgroundLoadingSelectionDialog<String>( shell,
- "Class Name", true );
+ final BackgroundLoadingSelectionDialog<String> dialog = new BackgroundLoadingSelectionDialog<String>(
+ shell, "Class Name", true);
IJobRunnable job = new IJobRunnable()
{
- public IStatus run( IProgressMonitor monitor )
+ public IStatus run(IProgressMonitor monitor)
{
try
{
- for ( IJavaElement e : JavaHelper.findTypes( project.getJavaModel(),
- IJavaElement.PACKAGE_FRAGMENT ) )
+ for (IJavaElement e : JavaHelper.findTypes(project.getJavaModel(),
+ IJavaElement.PACKAGE_FRAGMENT))
{
- IPackageFragment root = ( IPackageFragment ) e;
- if ( project.isInBundleClasspath( root ) )
+ IPackageFragment root = (IPackageFragment) e;
+ if (project.isInBundleClasspath(root))
{
- for ( IJavaElement e1 : JavaHelper.findTypes( root, IJavaElement.COMPILATION_UNIT,
- IJavaElement.CLASS_FILE ) )
+ for (IJavaElement e1 : JavaHelper.findTypes(root,
+ IJavaElement.COMPILATION_UNIT, IJavaElement.CLASS_FILE))
{
- ITypeRoot typeRoot = ( ITypeRoot ) e1;
- IType type = ( IType ) JavaHelper.findType( typeRoot, IJavaElement.TYPE );
- if ( JavaHelper.isAssignableTo( ifaceOrParentClass, type ) )
+ ITypeRoot typeRoot = (ITypeRoot) e1;
+ IType type = (IType) JavaHelper.findType(typeRoot,
+ IJavaElement.TYPE);
+ if (JavaHelper.isAssignableTo(ifaceOrParentClass, type))
{
- dialog.addElement( type.getFullyQualifiedName() );
+ dialog.addElement(type.getFullyQualifiedName());
}
}
}
@@ -91,7 +90,7 @@ public class ResourcesDialogHelper
return Status.OK_STATUS;
}
- catch ( JavaModelException e )
+ catch (JavaModelException e)
{
return e.getStatus();
}
@@ -99,88 +98,89 @@ public class ResourcesDialogHelper
};
- dialog.addBackgroundJob( "Scanning for activators in project", job );
+ dialog.addBackgroundJob("Scanning for activators in project", job);
return dialog;
}
-
- public static NewResourceSelectionDialog<IPackageExport> createImportDialog( Shell shell, String title,
- ISigilProjectModel sigil, final IPackageImport selected, final Collection<IPackageImport> existing )
+ public static NewResourceSelectionDialog<IPackageExport> createImportDialog(
+ Shell shell, String title, ISigilProjectModel sigil,
+ final IPackageImport selected, final Collection<IPackageImport> existing)
{
final Set<String> existingNames = new HashSet<String>();
- for ( IPackageImport existingImport : existing )
+ for (IPackageImport existingImport : existing)
{
- existingNames.add( existingImport.getPackageName() );
+ existingNames.add(existingImport.getPackageName());
}
final NewResourceSelectionDialog<IPackageExport> dialog = new NewResourceSelectionDialog<IPackageExport>(
- shell, "Package Name:", false );
+ shell, "Package Name:", false);
- dialog.setFilter( new IFilter<IPackageModelElement>()
+ dialog.setFilter(new IFilter<IPackageModelElement>()
{
- public boolean select( IPackageModelElement element )
+ public boolean select(IPackageModelElement element)
{
- return !existingNames.contains( element.getPackageName() );
+ return !existingNames.contains(element.getPackageName());
}
- } );
+ });
- dialog.setComparator( new Comparator<IPackageExport>()
+ dialog.setComparator(new Comparator<IPackageExport>()
{
- public int compare( IPackageExport o1, IPackageExport o2 )
+ public int compare(IPackageExport o1, IPackageExport o2)
{
- return o1.compareTo( o2 );
+ return o1.compareTo(o2);
}
- } );
+ });
- dialog.setDescriptor( new IElementDescriptor<IPackageExport>()
+ dialog.setDescriptor(new IElementDescriptor<IPackageExport>()
{
- public String getLabel( IPackageExport element )
+ public String getLabel(IPackageExport element)
{
- return getName( element ) + " (" + element.getVersion().toString() + ")";
+ return getName(element) + " (" + element.getVersion().toString() + ")";
}
-
- public String getName( IPackageExport element )
+ public String getName(IPackageExport element)
{
return element.getPackageName();
}
- } );
+ });
- dialog.setLabelProvider( new WrappedContentProposalLabelProvider<IPackageExport>( dialog.getDescriptor() ) );
+ dialog.setLabelProvider(new WrappedContentProposalLabelProvider<IPackageExport>(
+ dialog.getDescriptor()));
- if ( selected != null )
+ if (selected != null)
{
- dialog.setSelectedName( selected.getPackageName() );
- dialog.setVersions( selected.getVersions() );
- dialog.setOptional( selected.isOptional() );
+ dialog.setSelectedName(selected.getPackageName());
+ dialog.setVersions(selected.getVersions());
+ dialog.setOptional(selected.isOptional());
}
- IJobRunnable job = new ExportedPackageFinder( sigil, dialog );
- dialog.addBackgroundJob( "Scanning for exports in workspace", job );
+ IJobRunnable job = new ExportedPackageFinder(sigil, dialog);
+ dialog.addBackgroundJob("Scanning for exports in workspace", job);
return dialog;
}
-
- public static NewPackageExportDialog createNewExportDialog( Shell shell, String title,
- final IPackageExport selected, final ISigilProjectModel project, boolean multiSelect )
+ public static NewPackageExportDialog createNewExportDialog(Shell shell, String title,
+ final IPackageExport selected, final ISigilProjectModel project,
+ boolean multiSelect)
{
IFilter<IJavaElement> selectFilter = new IFilter<IJavaElement>()
{
- public boolean select( IJavaElement e )
+ public boolean select(IJavaElement e)
{
- if ( selected != null && e.getElementName().equals( selected.getPackageName() ) )
+ if (selected != null
+ && e.getElementName().equals(selected.getPackageName()))
{
return true;
}
- if ( e.getElementName().trim().length() > 0 && isLocal( e ) )
+ if (e.getElementName().trim().length() > 0 && isLocal(e))
{
- for ( IPackageExport p : project.getBundle().getBundleInfo().getExports() )
+ for (IPackageExport p : project.getBundle().getBundleInfo().getExports())
{
- if ( p.getPackageName().equals( e.getElementName() ) )
+ if (p.getPackageName().equals(e.getElementName()))
{
return false;
}
@@ -194,150 +194,151 @@ public class ResourcesDialogHelper
}
}
-
- private boolean isLocal( IJavaElement java )
+ private boolean isLocal(IJavaElement java)
{
try
{
- switch ( java.getElementType() )
+ switch (java.getElementType())
{
case IJavaElement.PACKAGE_FRAGMENT:
- IPackageFragment fragment = ( IPackageFragment ) java;
+ IPackageFragment fragment = (IPackageFragment) java;
return fragment.containsJavaResources();
default:
- throw new IllegalStateException( "Unexpected resource type " + java );
+ throw new IllegalStateException("Unexpected resource type "
+ + java);
}
}
- catch ( JavaModelException e )
+ catch (JavaModelException e)
{
- SigilCore.error( "Failed to inspect java element ", e );
+ SigilCore.error("Failed to inspect java element ", e);
return false;
}
}
};
- final NewPackageExportDialog dialog = new NewPackageExportDialog( shell, multiSelect );
- dialog.setFilter( selectFilter );
+ final NewPackageExportDialog dialog = new NewPackageExportDialog(shell,
+ multiSelect);
+ dialog.setFilter(selectFilter);
- dialog.setProjectVersion( project.getVersion() );
- if ( selected != null )
+ dialog.setProjectVersion(project.getVersion());
+ if (selected != null)
{
- dialog.setSelectedName( selected.getPackageName() );
- dialog.setVersion( selected.getRawVersion() );
+ dialog.setSelectedName(selected.getPackageName());
+ dialog.setVersion(selected.getRawVersion());
}
IJobRunnable job = new IJobRunnable()
{
- public IStatus run( IProgressMonitor monitor )
+ public IStatus run(IProgressMonitor monitor)
{
try
{
- ArrayList<IPackageFragment> list = new ArrayList<IPackageFragment>( UPDATE_BATCH_SIZE );
- for ( IJavaElement e : JavaHelper.findTypes( project.getJavaModel(),
- IJavaElement.PACKAGE_FRAGMENT ) )
+ ArrayList<IPackageFragment> list = new ArrayList<IPackageFragment>(
+ UPDATE_BATCH_SIZE);
+ for (IJavaElement e : JavaHelper.findTypes(project.getJavaModel(),
+ IJavaElement.PACKAGE_FRAGMENT))
{
- IPackageFragment root = ( IPackageFragment ) e;
- if ( project.isInBundleClasspath( root ) )
+ IPackageFragment root = (IPackageFragment) e;
+ if (project.isInBundleClasspath(root))
{
- list.add( root );
- if ( list.size() >= UPDATE_BATCH_SIZE )
+ list.add(root);
+ if (list.size() >= UPDATE_BATCH_SIZE)
{
- dialog.addElements( list );
+ dialog.addElements(list);
list.clear();
}
}
}
- if ( !list.isEmpty() )
+ if (!list.isEmpty())
{
- dialog.addElements( list );
+ dialog.addElements(list);
}
return Status.OK_STATUS;
}
- catch ( JavaModelException e )
+ catch (JavaModelException e)
{
return e.getStatus();
}
}
};
- dialog.addBackgroundJob( "Scanning for packages in project", job );
+ dialog.addBackgroundJob("Scanning for packages in project", job);
return dialog;
}
-
- public static NewResourceSelectionDialog<IBundleModelElement> createRequiredBundleDialog( Shell shell,
- String title, final ISigilProjectModel sigil, final IRequiredBundle selected,
- final Collection<IRequiredBundle> existing )
+ public static NewResourceSelectionDialog<IBundleModelElement> createRequiredBundleDialog(
+ Shell shell, String title, final ISigilProjectModel sigil,
+ final IRequiredBundle selected, final Collection<IRequiredBundle> existing)
{
final Set<String> existingNames = new HashSet<String>();
- for ( IRequiredBundle existingBundle : existing )
+ for (IRequiredBundle existingBundle : existing)
{
- existingNames.add( existingBundle.getSymbolicName() );
+ existingNames.add(existingBundle.getSymbolicName());
}
final NewResourceSelectionDialog<IBundleModelElement> dialog = new NewResourceSelectionDialog<IBundleModelElement>(
- shell, "Bundle:", false );
+ shell, "Bundle:", false);
- dialog.setDescriptor( new IElementDescriptor<IBundleModelElement>()
+ dialog.setDescriptor(new IElementDescriptor<IBundleModelElement>()
{
- public String getLabel( IBundleModelElement element )
+ public String getLabel(IBundleModelElement element)
{
- return getName( element ) + " (" + element.getVersion() + ")";
+ return getName(element) + " (" + element.getVersion() + ")";
}
-
- public String getName( IBundleModelElement element )
+ public String getName(IBundleModelElement element)
{
return element.getSymbolicName();
}
- } );
+ });
- dialog
- .setLabelProvider( new WrappedContentProposalLabelProvider<IBundleModelElement>( dialog.getDescriptor() ) );
+ dialog.setLabelProvider(new WrappedContentProposalLabelProvider<IBundleModelElement>(
+ dialog.getDescriptor()));
- dialog.setFilter( new IFilter<IBundleModelElement>()
+ dialog.setFilter(new IFilter<IBundleModelElement>()
{
- public boolean select( IBundleModelElement element )
+ public boolean select(IBundleModelElement element)
{
- return !existingNames.contains( element.getSymbolicName() );
+ return !existingNames.contains(element.getSymbolicName());
}
- } );
+ });
- dialog.setComparator( new Comparator<IBundleModelElement>()
+ dialog.setComparator(new Comparator<IBundleModelElement>()
{
- public int compare( IBundleModelElement o1, IBundleModelElement o2 )
+ public int compare(IBundleModelElement o1, IBundleModelElement o2)
{
- return o1.getSymbolicName().compareTo( o2.getSymbolicName() );
+ return o1.getSymbolicName().compareTo(o2.getSymbolicName());
}
- } );
+ });
- if ( selected != null )
+ if (selected != null)
{
- dialog.setSelectedName( selected.getSymbolicName() );
- dialog.setVersions( selected.getVersions() );
- dialog.setOptional( selected.isOptional() );
+ dialog.setSelectedName(selected.getSymbolicName());
+ dialog.setVersions(selected.getVersions());
+ dialog.setOptional(selected.isOptional());
}
IJobRunnable job = new IJobRunnable()
{
- public IStatus run( final IProgressMonitor monitor )
+ public IStatus run(final IProgressMonitor monitor)
{
- final List<IBundleModelElement> bundles = new ArrayList<IBundleModelElement>( UPDATE_BATCH_SIZE );
+ final List<IBundleModelElement> bundles = new ArrayList<IBundleModelElement>(
+ UPDATE_BATCH_SIZE);
final IModelWalker walker = new IModelWalker()
{
//int count = 0;
- public boolean visit( IModelElement element )
+ public boolean visit(IModelElement element)
{
- if ( element instanceof IBundleModelElement )
+ if (element instanceof IBundleModelElement)
{
- IBundleModelElement b = ( IBundleModelElement ) element;
- bundles.add( b );
+ IBundleModelElement b = (IBundleModelElement) element;
+ bundles.add(b);
- if ( bundles.size() >= UPDATE_BATCH_SIZE )
+ if (bundles.size() >= UPDATE_BATCH_SIZE)
{
- dialog.addElements( bundles );
+ dialog.addElements(bundles);
bundles.clear();
}
// no need to recurse further.
@@ -346,16 +347,16 @@ public class ResourcesDialogHelper
return !monitor.isCanceled();
}
};
- SigilCore.getRepositoryManager( sigil ).visit( walker );
- if ( !bundles.isEmpty() )
+ SigilCore.getRepositoryManager(sigil).visit(walker);
+ if (!bundles.isEmpty())
{
- dialog.addElements( bundles );
+ dialog.addElements(bundles);
}
return Status.OK_STATUS;
}
};
- dialog.addBackgroundJob( "Scanning for bundles in workspace", job );
+ dialog.addBackgroundJob("Scanning for bundles in workspace", job);
return dialog;
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/SingletonSelection.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/SingletonSelection.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/SingletonSelection.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/util/SingletonSelection.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.util;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
@@ -27,53 +26,44 @@ import java.util.List;
import org.eclipse.jface.viewers.IStructuredSelection;
-
@SuppressWarnings("unchecked")
public class SingletonSelection implements IStructuredSelection
{
private final Object singleton;
-
- public SingletonSelection( Object singleton )
+ public SingletonSelection(Object singleton)
{
this.singleton = singleton;
}
-
public Object getFirstElement()
{
return singleton;
}
-
public Iterator iterator()
{
- return Collections.singleton( singleton ).iterator();
+ return Collections.singleton(singleton).iterator();
}
-
public int size()
{
return 1;
}
-
public Object[] toArray()
{
- return new Object[]
- { singleton };
+ return new Object[] { singleton };
}
-
public List toList()
{
- ArrayList list = new ArrayList( 1 );
- list.add( singleton );
+ ArrayList list = new ArrayList(1);
+ list.add(singleton);
return list;
}
-
public boolean isEmpty()
{
return false;