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 [16/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/internal/editors/project/VersionsChangeListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/editors/project/VersionsChangeListener.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/editors/project/VersionsChangeListener.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/editors/project/VersionsChangeListener.java Mon Aug 2 17:08:03 2010
@@ -23,5 +23,5 @@ import org.apache.felix.sigil.common.osg
public interface VersionsChangeListener
{
- void versionsChanged( VersionRange range );
+ void versionsChanged(VersionRange range);
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/IFormValueConverter.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/IFormValueConverter.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/IFormValueConverter.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/IFormValueConverter.java Mon Aug 2 17:08:03 2010
@@ -19,11 +19,9 @@
package org.apache.felix.sigil.eclipse.ui.internal.form;
-
public interface IFormValueConverter
{
- String getLabel( Object value );
-
+ String getLabel(Object value);
- Object getValue( String label );
+ Object getValue(String label);
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/ISigilFormEntryListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/ISigilFormEntryListener.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/ISigilFormEntryListener.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/ISigilFormEntryListener.java Mon Aug 2 17:08:03 2010
@@ -19,11 +19,9 @@
package org.apache.felix.sigil.eclipse.ui.internal.form;
-
public interface ISigilFormEntryListener
{
- void browseButtonSelected( SigilFormEntry form );
-
+ void browseButtonSelected(SigilFormEntry form);
- void textValueChanged( SigilFormEntry form );
+ void textValueChanged(SigilFormEntry form);
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/SigilFormEntry.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/SigilFormEntry.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/SigilFormEntry.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/SigilFormEntry.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.internal.form;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
@@ -36,18 +35,16 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.IFormColors;
import org.eclipse.ui.forms.widgets.FormToolkit;
-
public class SigilFormEntry
{
private static final IFormValueConverter NULL_DESCRIPTOR = new IFormValueConverter()
{
- public String getLabel( Object value )
+ public String getLabel(Object value)
{
- return ( String ) value;
+ return (String) value;
}
-
- public Object getValue( String label )
+ public Object getValue(String label)
{
return label;
}
@@ -62,77 +59,69 @@ public class SigilFormEntry
private Object value;
private ISigilFormEntryListener listener;
-
- public SigilFormEntry( Composite parent, FormToolkit toolkit, String title )
+ public SigilFormEntry(Composite parent, FormToolkit toolkit, String title)
{
- this( parent, toolkit, title, null, null );
+ this(parent, toolkit, title, null, null);
}
-
- public SigilFormEntry( Composite parent, FormToolkit toolkit, String title, String browse,
- IFormValueConverter descriptor )
+ public SigilFormEntry(Composite parent, FormToolkit toolkit, String title, String browse, IFormValueConverter descriptor)
{
this.descriptor = descriptor == null ? NULL_DESCRIPTOR : descriptor;
- createComponent( parent, title, browse, toolkit );
+ createComponent(parent, title, browse, toolkit);
}
-
- public void setFormEntryListener( ISigilFormEntryListener listener )
+ public void setFormEntryListener(ISigilFormEntryListener listener)
{
this.listener = listener;
}
-
- public void setValue( Object value )
+ public void setValue(Object value)
{
this.value = value;
- String text = descriptor.getLabel( value );
- if ( text == null )
+ String text = descriptor.getLabel(value);
+ if (text == null)
{
text = "";
}
- txt.setText( text );
+ txt.setText(text);
handleValueChanged();
}
-
public Object getValue()
{
return value;
}
-
- public void setFreeText( boolean freeText )
+ public void setFreeText(boolean freeText)
{
this.freeText = freeText;
}
-
- public void setEditable( boolean editable )
+ public void setEditable(boolean editable)
{
- lbl.setEnabled( editable );
- txt.setEditable( editable );
- if ( btn != null )
+ lbl.setEnabled(editable);
+ txt.setEditable(editable);
+ if (btn != null)
{
- btn.setEnabled( editable );
+ btn.setEnabled(editable);
}
}
-
- private void createComponent( Composite parent, String title, String browse, FormToolkit toolkit )
+ private void createComponent(Composite parent, String title, String browse,
+ FormToolkit toolkit)
{
- lbl = toolkit.createLabel( parent, title );
- lbl.setForeground( toolkit.getColors().getColor( IFormColors.TITLE ) );
+ lbl = toolkit.createLabel(parent, title);
+ lbl.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- txt = toolkit.createText( parent, "", SWT.SINGLE | SWT.BORDER );
- txt.addKeyListener( new KeyAdapter()
+ txt = toolkit.createText(parent, "", SWT.SINGLE | SWT.BORDER);
+ txt.addKeyListener(new KeyAdapter()
{
@Override
- public void keyPressed( KeyEvent e )
+ public void keyPressed(KeyEvent e)
{
- if ( freeText )
+ if (freeText)
{
- switch ( e.character )
+ switch (e.character)
{
case '\r':
handleValueChanged();
@@ -140,10 +129,10 @@ public class SigilFormEntry
}
else
{
- switch ( e.character )
+ switch (e.character)
{
case '\b':
- setValue( null );
+ setValue(null);
handleValueChanged();
default:
e.doit = false;
@@ -151,72 +140,71 @@ public class SigilFormEntry
}
}
}
- } );
- txt.addFocusListener( new FocusAdapter()
+ });
+ txt.addFocusListener(new FocusAdapter()
{
@Override
- public void focusLost( FocusEvent e )
+ public void focusLost(FocusEvent e)
{
handleValueChanged();
}
- } );
+ });
- if ( browse != null )
+ if (browse != null)
{
- btn = toolkit.createButton( parent, browse, SWT.PUSH );
- btn.addSelectionListener( new SelectionAdapter()
+ btn = toolkit.createButton(parent, browse, SWT.PUSH);
+ btn.addSelectionListener(new SelectionAdapter()
{
@Override
- public void widgetSelected( SelectionEvent e )
+ public void widgetSelected(SelectionEvent e)
{
handleBrowseSelected();
}
- } );
+ });
}
- fillIntoGrid( parent );
+ fillIntoGrid(parent);
}
-
private void handleBrowseSelected()
{
- if ( listener != null )
+ if (listener != null)
{
- listener.browseButtonSelected( this );
+ listener.browseButtonSelected(this);
}
}
-
private void handleValueChanged()
{
- if ( freeText )
+ if (freeText)
{
- this.value = descriptor.getValue( txt.getText() );
+ this.value = descriptor.getValue(txt.getText());
}
- if ( listener != null )
+ if (listener != null)
{
- listener.textValueChanged( this );
+ listener.textValueChanged(this);
}
}
-
- private void fillIntoGrid( Composite parent )
+ private void fillIntoGrid(Composite parent)
{
- if ( parent.getLayout() instanceof GridLayout )
+ if (parent.getLayout() instanceof GridLayout)
{
- GridLayout layout = ( GridLayout ) parent.getLayout();
+ GridLayout layout = (GridLayout) parent.getLayout();
int cols = layout.numColumns;
- lbl.setLayoutData( new GridData( SWT.LEFT, SWT.CENTER, false, false ) );
+ lbl.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
- if ( btn == null )
+ if (btn == null)
{
- txt.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false, Math.max( 1, cols - 1 ), 1 ) );
+ txt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false,
+ Math.max(1, cols - 1), 1));
}
else
{
- txt.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false, Math.max( 1, cols - 2 ), 1 ) );
+ txt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false,
+ Math.max(1, cols - 2), 1));
}
}
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/SigilFormEntryAdapter.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/SigilFormEntryAdapter.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/SigilFormEntryAdapter.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/SigilFormEntryAdapter.java Mon Aug 2 17:08:03 2010
@@ -19,15 +19,13 @@
package org.apache.felix.sigil.eclipse.ui.internal.form;
-
public class SigilFormEntryAdapter implements ISigilFormEntryListener
{
- public void browseButtonSelected( SigilFormEntry form )
+ public void browseButtonSelected(SigilFormEntry form)
{
}
-
- public void textValueChanged( SigilFormEntry form )
+ public void textValueChanged(SigilFormEntry form)
{
}
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/SigilPage.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/SigilPage.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/SigilPage.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/SigilPage.java Mon Aug 2 17:08:03 2010
@@ -19,17 +19,15 @@
package org.apache.felix.sigil.eclipse.ui.internal.form;
-
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.editor.FormPage;
-
public class SigilPage extends FormPage
{
- public SigilPage( FormEditor editor, String id, String title )
+ public SigilPage(FormEditor editor, String id, String title)
{
- super( editor, id, title );
+ super(editor, id, title);
}
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/SigilSection.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/SigilSection.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/SigilSection.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/form/SigilSection.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.internal.form;
-
import org.apache.felix.sigil.eclipse.model.project.ISigilProjectModel;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
@@ -40,7 +39,6 @@ import org.eclipse.ui.forms.widgets.Sect
import org.eclipse.ui.forms.widgets.TableWrapData;
import org.eclipse.ui.forms.widgets.TableWrapLayout;
-
@SuppressWarnings("restriction")
public abstract class SigilSection extends SectionPart implements IHyperlinkListener, IPartSelectionListener
{
@@ -48,127 +46,122 @@ public abstract class SigilSection exten
private SigilPage page;
private ISigilProjectModel project;
-
- public SigilSection( SigilPage page, Composite parent, ISigilProjectModel project ) throws CoreException
+ public SigilSection(SigilPage page, Composite parent, ISigilProjectModel project) throws CoreException
{
- super( parent, page.getManagedForm().getToolkit(), ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE
- | ExpandableComposite.EXPANDED );
+ super(parent, page.getManagedForm().getToolkit(), ExpandableComposite.TITLE_BAR
+ | ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
this.project = project;
this.page = page;
- createSection( getSection(), page.getManagedForm().getToolkit() );
+ createSection(getSection(), page.getManagedForm().getToolkit());
}
-
public ISigilProjectModel getProjectModel()
{
return project;
}
-
public SigilPage getPage()
{
return page;
}
-
- public void setExpanded( boolean expanded )
+ public void setExpanded(boolean expanded)
{
- getSection().setExpanded( expanded );
+ getSection().setExpanded(expanded);
}
+ protected abstract void createSection(Section section, FormToolkit toolkit)
+ throws CoreException;
- protected abstract void createSection( Section section, FormToolkit toolkit ) throws CoreException;
-
-
- protected void setTitle( String title )
+ protected void setTitle(String title)
{
Section section = getSection();
- section.setText( title );
-
- TableWrapLayout layout = new TableWrapLayout();
-
- layout.topMargin = 2;
- layout.bottomMargin = 2;
- layout.leftMargin = 2;
- layout.rightMargin = 2;
-
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
-
- layout.makeColumnsEqualWidth = false;
- layout.numColumns = 1;
-
- section.setLayout( layout );
-
- TableWrapData data = new TableWrapData( TableWrapData.FILL_GRAB );
- section.setLayoutData( data );
- }
-
- protected void setMarker( String type, String message, int priority, int severity ) throws CoreException
- {
- IFileEditorInput file = ( IFileEditorInput ) getPage().getEditor().getEditorInput();
- IMarker marker = file.getFile().createMarker( type );
- marker.setAttribute( IMarker.MESSAGE, message );
- marker.setAttribute( IMarker.PRIORITY, priority );
- marker.setAttribute( IMarker.SEVERITY, severity );
+ section.setText(title);
+
+ TableWrapLayout layout = new TableWrapLayout();
+
+ layout.topMargin = 2;
+ layout.bottomMargin = 2;
+ layout.leftMargin = 2;
+ layout.rightMargin = 2;
+
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+
+ layout.makeColumnsEqualWidth = false;
+ layout.numColumns = 1;
+
+ section.setLayout(layout);
+
+ TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB);
+ section.setLayoutData(data);
}
+ protected void setMarker(String type, String message, int priority, int severity)
+ throws CoreException
+ {
+ IFileEditorInput file = (IFileEditorInput) getPage().getEditor().getEditorInput();
+ IMarker marker = file.getFile().createMarker(type);
+ marker.setAttribute(IMarker.MESSAGE, message);
+ marker.setAttribute(IMarker.PRIORITY, priority);
+ marker.setAttribute(IMarker.SEVERITY, severity);
+ }
protected void clearMarkers() throws CoreException
{
- IFileEditorInput file = ( IFileEditorInput ) getPage().getEditor().getEditorInput();
- file.getFile().deleteMarkers( null, true, IResource.DEPTH_INFINITE );
+ IFileEditorInput file = (IFileEditorInput) getPage().getEditor().getEditorInput();
+ file.getFile().deleteMarkers(null, true, IResource.DEPTH_INFINITE);
}
-
- protected Composite createTableWrapBody( int columns, FormToolkit toolkit )
+ protected Composite createTableWrapBody(int columns, FormToolkit toolkit)
{
Section section = getSection();
- Composite client = toolkit.createComposite( section );
+ Composite client = toolkit.createComposite(section);
TableWrapLayout layout = new TableWrapLayout();
- layout.leftMargin = layout.rightMargin = toolkit.getBorderStyle() != SWT.NULL ? 0 : 2;
+ layout.leftMargin = layout.rightMargin = toolkit.getBorderStyle() != SWT.NULL ? 0
+ : 2;
layout.numColumns = columns;
- client.setLayout( layout );
- client.setLayoutData( new TableWrapData( TableWrapData.FILL_GRAB ) );
+ client.setLayout(layout);
+ client.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
- section.setClient( client );
+ section.setClient(client);
return client;
}
-
- protected Composite createGridBody( int columns, boolean columnsSameWidth, FormToolkit toolkit )
+ protected Composite createGridBody(int columns, boolean columnsSameWidth,
+ FormToolkit toolkit)
{
Section section = getSection();
- Composite client = toolkit.createComposite( section );
+ Composite client = toolkit.createComposite(section);
GridLayout layout = new GridLayout();
layout.makeColumnsEqualWidth = columnsSameWidth;
layout.numColumns = columns;
- client.setLayout( layout );
+ client.setLayout(layout);
- client.setLayoutData( new TableWrapData( TableWrapData.FILL_GRAB ) );
+ client.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
- section.setClient( client );
+ section.setClient(client);
return client;
}
- public void linkActivated( HyperlinkEvent e )
- {
+ public void linkActivated(HyperlinkEvent e)
+ {
}
-
+
public void linkExited(HyperlinkEvent e)
- {
+ {
}
-
+
public void linkEntered(HyperlinkEvent e)
{
}
- public void selectionChanged( IFormPart part, ISelection selection )
+ public void selectionChanged(IFormPart part, ISelection selection)
{
}
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/AbstractResourceCommandHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/AbstractResourceCommandHandler.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/AbstractResourceCommandHandler.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/AbstractResourceCommandHandler.java Mon Aug 2 17:08:03 2010
@@ -19,10 +19,8 @@
package org.apache.felix.sigil.eclipse.ui.internal.handlers;
-
import org.eclipse.core.commands.AbstractHandler;
-
public abstract class AbstractResourceCommandHandler extends AbstractHandler
{
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/EditorResourceCommandHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/EditorResourceCommandHandler.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/EditorResourceCommandHandler.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/EditorResourceCommandHandler.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.internal.handlers;
-
import java.lang.reflect.InvocationTargetException;
import org.eclipse.core.commands.ExecutionEvent;
@@ -36,38 +35,39 @@ import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.handlers.HandlerUtil;
-
public abstract class EditorResourceCommandHandler extends AbstractResourceCommandHandler
{
- public Object execute( ExecutionEvent event ) throws ExecutionException
+ public Object execute(ExecutionEvent event) throws ExecutionException
{
- final Shell shell = HandlerUtil.getActiveShell( event );
- final IEditorPart editorPart = HandlerUtil.getActiveEditor( event );
- if ( editorPart != null )
+ final Shell shell = HandlerUtil.getActiveShell(event);
+ final IEditorPart editorPart = HandlerUtil.getActiveEditor(event);
+ if (editorPart != null)
{
IEditorInput editorInput = editorPart.getEditorInput();
- if ( !( editorInput instanceof IFileEditorInput ) )
+ if (!(editorInput instanceof IFileEditorInput))
{
- throw new ExecutionException( "Editor input must be a file" );
+ throw new ExecutionException("Editor input must be a file");
}
- IFileEditorInput fileInput = ( IFileEditorInput ) editorInput;
+ IFileEditorInput fileInput = (IFileEditorInput) editorInput;
try
{
// Save the editor content (if dirty)
IRunnableWithProgress saveOperation = new IRunnableWithProgress()
{
- public void run( IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException
+ public void run(IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException
{
- if ( editorPart.isDirty() )
+ if (editorPart.isDirty())
{
- if ( MessageDialog
- .openQuestion( shell, "Save File",
- "The file contents must be saved before the command can be executed. Do you wish to save now?" ) )
+ if (MessageDialog.openQuestion(
+ shell,
+ "Save File",
+ "The file contents must be saved before the command can be executed. Do you wish to save now?"))
{
- editorPart.doSave( monitor );
+ editorPart.doSave(monitor);
}
else
{
@@ -76,18 +76,17 @@ public abstract class EditorResourceComm
}
}
};
- new ProgressMonitorDialog( shell ).run( false, true, saveOperation );
+ new ProgressMonitorDialog(shell).run(false, true, saveOperation);
// Execute on the file
IFile file = fileInput.getFile();
- getResourceCommandHandler().execute( new IResource[]
- { file }, event );
+ getResourceCommandHandler().execute(new IResource[] { file }, event);
}
- catch ( InvocationTargetException e )
+ catch (InvocationTargetException e)
{
- throw new ExecutionException( "Error saving file", e.getTargetException() );
+ throw new ExecutionException("Error saving file", e.getTargetException());
}
- catch ( InterruptedException e )
+ catch (InterruptedException e)
{
// Exit the command silently
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/IResourceCommandHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/IResourceCommandHandler.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/IResourceCommandHandler.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/IResourceCommandHandler.java Mon Aug 2 17:08:03 2010
@@ -19,15 +19,13 @@
package org.apache.felix.sigil.eclipse.ui.internal.handlers;
-
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IResource;
-
public interface IResourceCommandHandler
{
- Object execute( IResource[] resources, ExecutionEvent event ) throws ExecutionException;
+ Object execute(IResource[] resources, ExecutionEvent event) throws ExecutionException;
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/SelectionResourceCommandHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/SelectionResourceCommandHandler.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/SelectionResourceCommandHandler.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/SelectionResourceCommandHandler.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.internal.handlers;
-
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IResource;
@@ -27,19 +26,18 @@ import org.eclipse.jface.viewers.ISelect
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.handlers.HandlerUtil;
-
public abstract class SelectionResourceCommandHandler extends AbstractResourceCommandHandler
{
- public final Object execute( ExecutionEvent event ) throws ExecutionException
+ public final Object execute(ExecutionEvent event) throws ExecutionException
{
- ISelection selection = HandlerUtil.getCurrentSelection( event );
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
- Object[] objectArray = ( ( IStructuredSelection ) selection ).toArray();
+ Object[] objectArray = ((IStructuredSelection) selection).toArray();
IResource[] resourceArray = new IResource[objectArray.length];
- System.arraycopy( objectArray, 0, resourceArray, 0, objectArray.length );
+ System.arraycopy(objectArray, 0, resourceArray, 0, objectArray.length);
- return getResourceCommandHandler().execute( resourceArray, event );
+ return getResourceCommandHandler().execute(resourceArray, event);
}
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/project/ConvertProjectCommandHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/project/ConvertProjectCommandHandler.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/project/ConvertProjectCommandHandler.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/project/ConvertProjectCommandHandler.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.internal.handlers.project;
-
import org.apache.felix.sigil.eclipse.SigilCore;
import org.apache.felix.sigil.eclipse.model.project.ISigilProjectModel;
import org.apache.felix.sigil.eclipse.ui.SigilUI;
@@ -35,39 +34,40 @@ import org.eclipse.jdt.core.IJavaProject
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
public class ConvertProjectCommandHandler implements IResourceCommandHandler
{
- public Object execute( IResource[] resources, ExecutionEvent event ) throws ExecutionException
+ public Object execute(IResource[] resources, ExecutionEvent event)
+ throws ExecutionException
{
- for ( IResource r : resources )
+ for (IResource r : resources)
{
- final IProject project = ( IProject ) r;
- if ( project != null )
+ final IProject project = (IProject) r;
+ if (project != null)
{
WorkspaceModifyOperation op = new WorkspaceModifyOperation()
{
@Override
- protected void execute( IProgressMonitor monitor ) throws CoreException
+ protected void execute(IProgressMonitor monitor) throws CoreException
{
- SigilCore.makeSigilProject( project, monitor );
- IJavaProject java = JavaCore.create( project );
- ISigilProjectModel sigil = SigilCore.create( project );
+ SigilCore.makeSigilProject(project, monitor);
+ IJavaProject java = JavaCore.create(project);
+ ISigilProjectModel sigil = SigilCore.create(project);
IClasspathEntry[] entries = java.getRawClasspath();
- for ( int i = 0; i < entries.length; i++ )
+ for (int i = 0; i < entries.length; i++)
{
IClasspathEntry entry = entries[i];
- if ( entry.getEntryKind() == IClasspathEntry.CPE_SOURCE )
+ if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE)
{
- String encodedClasspath = sigil.getJavaModel().encodeClasspathEntry( entry );
- sigil.getBundle().addClasspathEntry( encodedClasspath );
+ String encodedClasspath = sigil.getJavaModel().encodeClasspathEntry(
+ entry);
+ sigil.getBundle().addClasspathEntry(encodedClasspath);
}
}
- sigil.save( monitor );
+ sigil.save(monitor);
}
};
- SigilUI.runWorkspaceOperation( op, null );
+ SigilUI.runWorkspaceOperation(op, null);
}
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/project/ConvertProjectHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/project/ConvertProjectHandler.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/project/ConvertProjectHandler.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/project/ConvertProjectHandler.java Mon Aug 2 17:08:03 2010
@@ -19,11 +19,9 @@
package org.apache.felix.sigil.eclipse.ui.internal.handlers.project;
-
import org.apache.felix.sigil.eclipse.ui.internal.handlers.IResourceCommandHandler;
import org.apache.felix.sigil.eclipse.ui.internal.handlers.SelectionResourceCommandHandler;
-
public class ConvertProjectHandler extends SelectionResourceCommandHandler
{
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/project/RefreshSigilClasspathCommandHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/project/RefreshSigilClasspathCommandHandler.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/project/RefreshSigilClasspathCommandHandler.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/project/RefreshSigilClasspathCommandHandler.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.internal.handlers.project;
-
import java.lang.reflect.InvocationTargetException;
import org.apache.felix.sigil.eclipse.SigilCore;
@@ -34,35 +33,36 @@ import org.eclipse.core.runtime.CoreExce
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
-
public class RefreshSigilClasspathCommandHandler implements IResourceCommandHandler
{
- public Object execute( IResource[] resources, ExecutionEvent event ) throws ExecutionException
+ public Object execute(IResource[] resources, ExecutionEvent event)
+ throws ExecutionException
{
try
{
- for ( IResource res : resources )
+ for (IResource res : resources)
{
- IProject p = ( IProject ) res;
- final ISigilProjectModel model = SigilCore.create( p );
+ IProject p = (IProject) res;
+ final ISigilProjectModel model = SigilCore.create(p);
WorkspaceModifyOperation op = new WorkspaceModifyOperation()
{
@Override
- protected void execute( IProgressMonitor monitor ) throws CoreException, InvocationTargetException,
+ protected void execute(IProgressMonitor monitor)
+ throws CoreException, InvocationTargetException,
InterruptedException
{
- model.resetClasspath( monitor );
+ model.resetClasspath(monitor);
}
};
- SigilUI.runWorkspaceOperation( op, null );
+ SigilUI.runWorkspaceOperation(op, null);
}
}
- catch ( CoreException e )
+ catch (CoreException e)
{
- SigilCore.error( "Failed to create sigil project for refresh action", e );
+ SigilCore.error("Failed to create sigil project for refresh action", e);
}
return null;
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/project/RefreshSigilClasspathHandler.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/project/RefreshSigilClasspathHandler.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/project/RefreshSigilClasspathHandler.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/handlers/project/RefreshSigilClasspathHandler.java Mon Aug 2 17:08:03 2010
@@ -19,11 +19,9 @@
package org.apache.felix.sigil.eclipse.ui.internal.handlers.project;
-
import org.apache.felix.sigil.eclipse.ui.internal.handlers.IResourceCommandHandler;
import org.apache.felix.sigil.eclipse.ui.internal.handlers.SelectionResourceCommandHandler;
-
public class RefreshSigilClasspathHandler extends SelectionResourceCommandHandler
{
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/perspective/SigilPerspectiveFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/perspective/SigilPerspectiveFactory.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/perspective/SigilPerspectiveFactory.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/perspective/SigilPerspectiveFactory.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.internal.perspective;
-
import org.apache.felix.sigil.eclipse.ui.SigilUI;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jdt.ui.JavaUI;
@@ -28,7 +27,6 @@ import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
import org.eclipse.ui.progress.IProgressConstants;
-
public class SigilPerspectiveFactory implements IPerspectiveFactory
{
@@ -36,7 +34,7 @@ public class SigilPerspectiveFactory imp
private static final String ID_SEARCH_VIEW = "org.eclipse.search.ui.views.SearchView"; //$NON-NLS-1$
private static final String ID_CONSOLE_VIEW = "org.eclipse.ui.console.ConsoleView"; //$NON-NLS-1$
- public void createInitialLayout( IPageLayout layout )
+ public void createInitialLayout(IPageLayout layout)
{
/*
* Use ProjectExplorer vs PackageExplorer due to a bug with Drag and Drop on Mac OS X which affects PackageExplorer
@@ -44,66 +42,68 @@ public class SigilPerspectiveFactory imp
*/
String editorArea = layout.getEditorArea();
- IFolderLayout folder = layout.createFolder( "left", IPageLayout.LEFT, ( float ) 0.25, editorArea ); //$NON-NLS-1$
- folder.addView( ID_PROJECT_EXPLORER );
- folder.addView( JavaUI.ID_TYPE_HIERARCHY );
- folder.addPlaceholder( IPageLayout.ID_RES_NAV );
- folder.addPlaceholder( SigilUI.ID_REPOSITORY_VIEW );
- folder.addView( IPageLayout.ID_OUTLINE );
-
- IFolderLayout outputfolder = layout.createFolder( "bottom", IPageLayout.BOTTOM, ( float ) 0.75, editorArea ); //$NON-NLS-1$
- outputfolder.addView( IPageLayout.ID_PROBLEM_VIEW );
- outputfolder.addView( JavaUI.ID_JAVADOC_VIEW );
- outputfolder.addView( JavaUI.ID_SOURCE_VIEW );
- outputfolder.addPlaceholder( ID_SEARCH_VIEW );
- outputfolder.addPlaceholder( ID_CONSOLE_VIEW );
- outputfolder.addPlaceholder( IPageLayout.ID_BOOKMARKS );
- outputfolder.addPlaceholder( IProgressConstants.PROGRESS_VIEW_ID );
- outputfolder.addPlaceholder( SigilUI.ID_DEPENDENCY_VIEW );
-
- layout.addActionSet( IDebugUIConstants.LAUNCH_ACTION_SET );
- layout.addActionSet( JavaUI.ID_ACTION_SET );
- layout.addActionSet( JavaUI.ID_ELEMENT_CREATION_ACTION_SET );
- layout.addActionSet( IPageLayout.ID_NAVIGATE_ACTION_SET );
+ IFolderLayout folder = layout.createFolder(
+ "left", IPageLayout.LEFT, (float) 0.25, editorArea); //$NON-NLS-1$
+ folder.addView(ID_PROJECT_EXPLORER);
+ folder.addView(JavaUI.ID_TYPE_HIERARCHY);
+ folder.addPlaceholder(IPageLayout.ID_RES_NAV);
+ folder.addPlaceholder(SigilUI.ID_REPOSITORY_VIEW);
+ folder.addView(IPageLayout.ID_OUTLINE);
+
+ IFolderLayout outputfolder = layout.createFolder(
+ "bottom", IPageLayout.BOTTOM, (float) 0.75, editorArea); //$NON-NLS-1$
+ outputfolder.addView(IPageLayout.ID_PROBLEM_VIEW);
+ outputfolder.addView(JavaUI.ID_JAVADOC_VIEW);
+ outputfolder.addView(JavaUI.ID_SOURCE_VIEW);
+ outputfolder.addPlaceholder(ID_SEARCH_VIEW);
+ outputfolder.addPlaceholder(ID_CONSOLE_VIEW);
+ outputfolder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
+ outputfolder.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
+ outputfolder.addPlaceholder(SigilUI.ID_DEPENDENCY_VIEW);
+
+ layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
+ layout.addActionSet(JavaUI.ID_ACTION_SET);
+ layout.addActionSet(JavaUI.ID_ELEMENT_CREATION_ACTION_SET);
+ layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
// views - sigil
- layout.addShowViewShortcut( SigilUI.ID_REPOSITORY_VIEW );
- layout.addShowViewShortcut( SigilUI.ID_DEPENDENCY_VIEW );
+ layout.addShowViewShortcut(SigilUI.ID_REPOSITORY_VIEW);
+ layout.addShowViewShortcut(SigilUI.ID_DEPENDENCY_VIEW);
// views - java
- layout.addShowViewShortcut( JavaUI.ID_PACKAGES );
- layout.addShowViewShortcut( JavaUI.ID_TYPE_HIERARCHY );
- layout.addShowViewShortcut( JavaUI.ID_SOURCE_VIEW );
- layout.addShowViewShortcut( JavaUI.ID_JAVADOC_VIEW );
+ layout.addShowViewShortcut(JavaUI.ID_PACKAGES);
+ layout.addShowViewShortcut(JavaUI.ID_TYPE_HIERARCHY);
+ layout.addShowViewShortcut(JavaUI.ID_SOURCE_VIEW);
+ layout.addShowViewShortcut(JavaUI.ID_JAVADOC_VIEW);
// views - search
- layout.addShowViewShortcut( ID_SEARCH_VIEW );
+ layout.addShowViewShortcut(ID_SEARCH_VIEW);
// views - debugging
- layout.addShowViewShortcut( ID_CONSOLE_VIEW );
+ layout.addShowViewShortcut(ID_CONSOLE_VIEW);
// views - standard workbench
- layout.addShowViewShortcut( IPageLayout.ID_OUTLINE );
- layout.addShowViewShortcut( IPageLayout.ID_PROBLEM_VIEW );
- layout.addShowViewShortcut( IPageLayout.ID_RES_NAV );
- layout.addShowViewShortcut( IPageLayout.ID_TASK_LIST );
- layout.addShowViewShortcut( IProgressConstants.PROGRESS_VIEW_ID );
- layout.addShowViewShortcut( ID_PROJECT_EXPLORER );
+ layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
+ layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
+ layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
+ layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
+ layout.addShowViewShortcut(IProgressConstants.PROGRESS_VIEW_ID);
+ layout.addShowViewShortcut(ID_PROJECT_EXPLORER);
// new actions - Java project creation wizard
- layout.addNewWizardShortcut( "org.eclipse.jdt.ui.wizards.NewPackageCreationWizard" ); //$NON-NLS-1$
- layout.addNewWizardShortcut( "org.eclipse.jdt.ui.wizards.NewClassCreationWizard" ); //$NON-NLS-1$
- layout.addNewWizardShortcut( "org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard" ); //$NON-NLS-1$
- layout.addNewWizardShortcut( "org.eclipse.jdt.ui.wizards.NewEnumCreationWizard" ); //$NON-NLS-1$
- layout.addNewWizardShortcut( "org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard" ); //$NON-NLS-1$
- layout.addNewWizardShortcut( "org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard" ); //$NON-NLS-1$
- layout.addNewWizardShortcut( "org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard" ); //$NON-NLS-1$
- layout.addNewWizardShortcut( "org.eclipse.jdt.ui.wizards.NewJavaWorkingSetWizard" ); //$NON-NLS-1$
- layout.addNewWizardShortcut( "org.eclipse.ui.wizards.new.folder" );//$NON-NLS-1$
- layout.addNewWizardShortcut( "org.eclipse.ui.wizards.new.file" );//$NON-NLS-1$
- layout.addNewWizardShortcut( "org.eclipse.ui.editors.wizards.UntitledTextFileWizard" );//$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewPackageCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewClassCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewEnumCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewJavaWorkingSetWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.ui.editors.wizards.UntitledTextFileWizard");//$NON-NLS-1$
- layout.addNewWizardShortcut( "org.apache.felix.sigil.editors.newProjectWizard" );
+ layout.addNewWizardShortcut("org.apache.felix.sigil.editors.newProjectWizard");
}
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/preferences/ExcludedResourcesPrefsPage.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/preferences/ExcludedResourcesPrefsPage.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/preferences/ExcludedResourcesPrefsPage.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/preferences/ExcludedResourcesPrefsPage.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.internal.preferences;
-
import java.util.ArrayList;
import org.apache.felix.sigil.eclipse.SigilCore;
@@ -46,7 +45,6 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
-
public class ExcludedResourcesPrefsPage extends PreferencePage implements IWorkbenchPreferencePage
{
@@ -54,145 +52,138 @@ public class ExcludedResourcesPrefsPage
private IWorkbench workbench;
private ArrayList<String> resources;
-
public ExcludedResourcesPrefsPage()
{
super();
- setDescription( "Specify resources that should not be offered for inclusion in a generated bundle." );
+ setDescription("Specify resources that should not be offered for inclusion in a generated bundle.");
}
-
@Override
- protected Control createContents( Composite parent )
+ protected Control createContents(Composite parent)
{
// Create controls
- Composite composite = new Composite( parent, SWT.NONE );
- Table table = new Table( composite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION );
+ Composite composite = new Composite(parent, SWT.NONE);
+ Table table = new Table(composite, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
- Button btnAdd = new Button( composite, SWT.PUSH );
- btnAdd.setText( "Add" );
+ Button btnAdd = new Button(composite, SWT.PUSH);
+ btnAdd.setText("Add");
- final Button btnRemove = new Button( composite, SWT.PUSH );
- btnRemove.setText( "Remove" );
- btnRemove.setEnabled( false );
+ final Button btnRemove = new Button(composite, SWT.PUSH);
+ btnRemove.setText("Remove");
+ btnRemove.setEnabled(false);
// Create viewer
- viewer = new TableViewer( table );
- viewer.setContentProvider( new ArrayContentProvider() );
+ viewer = new TableViewer(table);
+ viewer.setContentProvider(new ArrayContentProvider());
// Load data
- loadPreferences( false );
- viewer.setInput( resources );
+ loadPreferences(false);
+ viewer.setInput(resources);
// Listeners
- viewer.addSelectionChangedListener( new ISelectionChangedListener()
+ viewer.addSelectionChangedListener(new ISelectionChangedListener()
{
- public void selectionChanged( SelectionChangedEvent event )
+ public void selectionChanged(SelectionChangedEvent event)
{
- btnRemove.setEnabled( !viewer.getSelection().isEmpty() );
+ btnRemove.setEnabled(!viewer.getSelection().isEmpty());
}
- } );
+ });
- btnRemove.addSelectionListener( new SelectionAdapter()
+ btnRemove.addSelectionListener(new SelectionAdapter()
{
@Override
- public void widgetSelected( SelectionEvent e )
+ public void widgetSelected(SelectionEvent e)
{
- IStructuredSelection selection = ( IStructuredSelection ) viewer.getSelection();
+ IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
Object[] deleted = selection.toArray();
- for ( Object delete : deleted )
+ for (Object delete : deleted)
{
- resources.remove( delete );
+ resources.remove(delete);
}
- viewer.remove( deleted );
+ viewer.remove(deleted);
}
- } );
+ });
- btnAdd.addSelectionListener( new SelectionAdapter()
+ btnAdd.addSelectionListener(new SelectionAdapter()
{
@Override
- public void widgetSelected( SelectionEvent e )
+ public void widgetSelected(SelectionEvent e)
{
- InputDialog dialog = new InputDialog( getShell(), "Add Resource", "Enter resource name", "",
- new IInputValidator()
+ InputDialog dialog = new InputDialog(getShell(), "Add Resource",
+ "Enter resource name", "", new IInputValidator()
{
- public String isValid( String newText )
+ public String isValid(String newText)
{
String error = null;
- if ( newText == null || newText.length() == 0 )
+ if (newText == null || newText.length() == 0)
{
error = "Name must not be empty.";
}
- else if ( resources.contains( newText ) )
+ else if (resources.contains(newText))
{
error = "Specified resource name is already on the list.";
}
return error;
}
- } );
+ });
- if ( dialog.open() == Window.OK )
+ if (dialog.open() == Window.OK)
{
String value = dialog.getValue();
- resources.add( value );
- viewer.add( value );
+ resources.add(value);
+ viewer.add(value);
}
}
- } );
+ });
// Layout
- composite.setLayout( new GridLayout( 2, false ) );
- table.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true, 1, 3 ) );
- btnAdd.setLayoutData( new GridData( SWT.FILL, SWT.FILL, false, false ) );
- btnRemove.setLayoutData( new GridData( SWT.FILL, SWT.FILL, false, false ) );
+ composite.setLayout(new GridLayout(2, false));
+ table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 3));
+ btnAdd.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+ btnRemove.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
return composite;
}
-
- private void loadPreferences( boolean useDefaults )
+ private void loadPreferences(boolean useDefaults)
{
String resourcesListStr = useDefaults ? getPreferenceStore().getDefaultString(
- SigilCore.DEFAULT_EXCLUDED_RESOURCES ) : getPreferenceStore().getString(
- SigilCore.DEFAULT_EXCLUDED_RESOURCES );
- String[] resourcesArray = PrefsUtils.stringToArray( resourcesListStr );
+ SigilCore.DEFAULT_EXCLUDED_RESOURCES) : getPreferenceStore().getString(
+ SigilCore.DEFAULT_EXCLUDED_RESOURCES);
+ String[] resourcesArray = PrefsUtils.stringToArray(resourcesListStr);
- resources = new ArrayList<String>( resourcesArray.length );
- for ( String resource : resourcesArray )
+ resources = new ArrayList<String>(resourcesArray.length);
+ for (String resource : resourcesArray)
{
- resources.add( resource );
+ resources.add(resource);
}
}
-
- public void init( IWorkbench workbench )
+ public void init(IWorkbench workbench)
{
this.workbench = workbench;
}
-
@Override
protected IPreferenceStore doGetPreferenceStore()
{
return SigilCore.getDefault().getPreferenceStore();
}
-
@Override
public boolean performOk()
{
- String resourcesStr = PrefsUtils.arrayToString( resources.toArray( new String[resources.size()] ) );
- getPreferenceStore().setValue( SigilCore.DEFAULT_EXCLUDED_RESOURCES, resourcesStr );
+ String resourcesStr = PrefsUtils.arrayToString(resources.toArray(new String[resources.size()]));
+ getPreferenceStore().setValue(SigilCore.DEFAULT_EXCLUDED_RESOURCES, resourcesStr);
return true;
}
-
@Override
protected void performDefaults()
{
super.performDefaults();
- loadPreferences( true );
- viewer.setInput( resources );
+ loadPreferences(true);
+ viewer.setInput(resources);
}
}
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/preferences/LibraryConfigurationDialog.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/preferences/LibraryConfigurationDialog.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/preferences/LibraryConfigurationDialog.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/preferences/LibraryConfigurationDialog.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.internal.preferences;
-
import java.util.Comparator;
import java.util.Iterator;
import java.util.TreeSet;
@@ -54,21 +53,21 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
import org.osgi.framework.Version;
-
public class LibraryConfigurationDialog extends TitleAreaDialog
{
private static final Comparator<IPackageImport> COMPARATOR = new Comparator<IPackageImport>()
{
- public int compare( IPackageImport o1, IPackageImport o2 )
+ public int compare(IPackageImport o1, IPackageImport o2)
{
- return o1.getPackageName().compareTo( o2.getPackageName() );
+ return o1.getPackageName().compareTo(o2.getPackageName());
}
};
private String name;
private Version version;
- private TreeSet<IPackageImport> packageImports = new TreeSet<IPackageImport>( COMPARATOR );
+ private TreeSet<IPackageImport> packageImports = new TreeSet<IPackageImport>(
+ COMPARATOR);
private boolean editOnly;
@@ -76,146 +75,142 @@ public class LibraryConfigurationDialog
private Text txtName;
private Text txtVersion;
-
- public LibraryConfigurationDialog( Shell parentShell )
+ public LibraryConfigurationDialog(Shell parentShell)
{
- super( parentShell );
+ super(parentShell);
name = "";
version = Version.emptyVersion;
}
-
- public LibraryConfigurationDialog( Shell parentShell, ILibrary lib )
+ public LibraryConfigurationDialog(Shell parentShell, ILibrary lib)
{
- super( parentShell );
+ super(parentShell);
editOnly = true;
name = lib.getName();
version = lib.getVersion();
- packageImports.addAll( lib.getImports() );
+ packageImports.addAll(lib.getImports());
}
-
@Override
- protected Control createDialogArea( Composite par )
+ protected Control createDialogArea(Composite par)
{
- setTitle( "Add Library" );
- Composite container = ( Composite ) super.createDialogArea( par );
+ setTitle("Add Library");
+ Composite container = (Composite) super.createDialogArea(par);
- Composite topPanel = new Composite( container, SWT.NONE );
+ Composite topPanel = new Composite(container, SWT.NONE);
- new Label( topPanel, SWT.NONE ).setText( "Name" );
+ new Label(topPanel, SWT.NONE).setText("Name");
- txtName = new Text( topPanel, SWT.BORDER );
- txtName.setEditable( !editOnly );
- if ( name != null )
- txtName.setText( name );
+ txtName = new Text(topPanel, SWT.BORDER);
+ txtName.setEditable(!editOnly);
+ if (name != null)
+ txtName.setText(name);
- new Label( topPanel, SWT.NONE ).setText( "Version" );
+ new Label(topPanel, SWT.NONE).setText("Version");
- txtVersion = new Text( topPanel, SWT.BORDER );
- txtVersion.setText( version.toString() );
- txtVersion.setEditable( !editOnly );
+ txtVersion = new Text(topPanel, SWT.BORDER);
+ txtVersion.setText(version.toString());
+ txtVersion.setEditable(!editOnly);
- Composite bottomPanel = new Composite( container, SWT.NONE );
+ Composite bottomPanel = new Composite(container, SWT.NONE);
- Table table = new Table( bottomPanel, SWT.BORDER );
- table.setSize( new Point( 300, 200 ) );
+ Table table = new Table(bottomPanel, SWT.BORDER);
+ table.setSize(new Point(300, 200));
- Button add = new Button( bottomPanel, SWT.PUSH );
- add.setText( "Add..." );
+ Button add = new Button(bottomPanel, SWT.PUSH);
+ add.setText("Add...");
- final Button edit = new Button( bottomPanel, SWT.PUSH );
- edit.setText( "Edit..." );
- edit.setEnabled( false );
+ final Button edit = new Button(bottomPanel, SWT.PUSH);
+ edit.setText("Edit...");
+ edit.setEnabled(false);
- final Button remove = new Button( bottomPanel, SWT.PUSH );
- remove.setText( "Remove" );
- remove.setEnabled( false );
+ final Button remove = new Button(bottomPanel, SWT.PUSH);
+ remove.setText("Remove");
+ remove.setEnabled(false);
updateState();
// Hookup Listeners
- txtName.addModifyListener( new ModifyListener()
+ txtName.addModifyListener(new ModifyListener()
{
- public void modifyText( ModifyEvent e )
+ public void modifyText(ModifyEvent e)
{
updateState();
}
- } );
- txtVersion.addModifyListener( new ModifyListener()
+ });
+ txtVersion.addModifyListener(new ModifyListener()
{
- public void modifyText( ModifyEvent e )
+ public void modifyText(ModifyEvent e)
{
updateState();
}
- } );
- add.addSelectionListener( new SelectionAdapter()
+ });
+ add.addSelectionListener(new SelectionAdapter()
{
- public void widgetSelected( SelectionEvent e )
+ public void widgetSelected(SelectionEvent e)
{
handleAdd();
}
- } );
- edit.addSelectionListener( new SelectionAdapter()
+ });
+ edit.addSelectionListener(new SelectionAdapter()
{
- public void widgetSelected( SelectionEvent e )
+ public void widgetSelected(SelectionEvent e)
{
handleEdit();
}
- } );
- remove.addSelectionListener( new SelectionAdapter()
+ });
+ remove.addSelectionListener(new SelectionAdapter()
{
- public void widgetSelected( SelectionEvent e )
+ public void widgetSelected(SelectionEvent e)
{
handleRemove();
}
- } );
+ });
// Layout
- topPanel.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
- topPanel.setLayout( new GridLayout( 2, false ) );
- txtName.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
- txtVersion.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, false ) );
-
- bottomPanel.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
- bottomPanel.setLayout( new GridLayout( 2, false ) );
- table.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true, 1, 4 ) );
- add.setLayoutData( new GridData( SWT.FILL, SWT.FILL, false, false ) );
- edit.setLayoutData( new GridData( SWT.FILL, SWT.FILL, false, false ) );
- remove.setLayoutData( new GridData( SWT.FILL, SWT.FILL, false, false ) );
+ topPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ topPanel.setLayout(new GridLayout(2, false));
+ txtName.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ txtVersion.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ bottomPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ bottomPanel.setLayout(new GridLayout(2, false));
+ table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4));
+ add.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+ edit.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+ remove.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
// Table Viewer
- viewer = new TableViewer( table );
- viewer.setLabelProvider( new LabelProvider()
+ viewer = new TableViewer(table);
+ viewer.setLabelProvider(new LabelProvider()
{
@Override
- public String getText( Object element )
+ public String getText(Object element)
{
- IPackageImport pi = ( IPackageImport ) element;
+ IPackageImport pi = (IPackageImport) element;
return pi.getPackageName() + " " + pi.getVersions();
}
- } );
- viewer.addSelectionChangedListener( new ISelectionChangedListener()
+ });
+ viewer.addSelectionChangedListener(new ISelectionChangedListener()
{
- public void selectionChanged( SelectionChangedEvent event )
+ public void selectionChanged(SelectionChangedEvent event)
{
- edit.setEnabled( !event.getSelection().isEmpty() );
- remove.setEnabled( !event.getSelection().isEmpty() );
+ edit.setEnabled(!event.getSelection().isEmpty());
+ remove.setEnabled(!event.getSelection().isEmpty());
}
- } );
- viewer.setContentProvider( new DefaultTableProvider()
+ });
+ viewer.setContentProvider(new DefaultTableProvider()
{
- public Object[] getElements( Object inputElement )
+ public Object[] getElements(Object inputElement)
{
- return toArray( inputElement );
+ return toArray(inputElement);
}
- } );
+ });
- viewer.setInput( packageImports );
+ viewer.setInput(packageImports);
return container;
}
-
private void updateState()
{
String error = null;
@@ -225,45 +220,43 @@ public class LibraryConfigurationDialog
try
{
- version = VersionTable.getVersion( txtVersion.getText() );
- if ( version.getQualifier().indexOf( '_' ) > -1 )
+ version = VersionTable.getVersion(txtVersion.getText());
+ if (version.getQualifier().indexOf('_') > -1)
{
warning = "The use of underscores in a version qualifier is discouraged.";
}
}
- catch ( IllegalArgumentException e )
+ catch (IllegalArgumentException e)
{
version = null;
error = "Invalid version format";
}
- Button okButton = getButton( IDialogConstants.OK_ID );
- if ( okButton != null && !okButton.isDisposed() )
- okButton.setEnabled( allowOkay() );
+ Button okButton = getButton(IDialogConstants.OK_ID);
+ if (okButton != null && !okButton.isDisposed())
+ okButton.setEnabled(allowOkay());
- setErrorMessage( error );
- setMessage( warning, IMessageProvider.WARNING );
+ setErrorMessage(error);
+ setMessage(warning, IMessageProvider.WARNING);
}
-
private boolean allowOkay()
{
return name != null && name.length() > 0 && version != null;
}
-
@Override
- protected Button createButton( Composite parent, int id, String label, boolean defaultButton )
+ protected Button createButton(Composite parent, int id, String label,
+ boolean defaultButton)
{
- Button button = super.createButton( parent, id, label, defaultButton );
- if ( id == IDialogConstants.OK_ID )
+ Button button = super.createButton(parent, id, label, defaultButton);
+ if (id == IDialogConstants.OK_ID)
{
- button.setEnabled( allowOkay() );
+ button.setEnabled(allowOkay());
}
return button;
}
-
private void handleAdd()
{
/*NewResourceSelectionDialog<? extends IPackageModelElement> dialog = ResourcesDialogHelper.createImportDialog(getShell(), "Add Imported Package", null, packageImports);
@@ -278,7 +271,6 @@ public class LibraryConfigurationDialog
}*/
}
-
private void handleEdit()
{
/*IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
@@ -312,33 +304,32 @@ public class LibraryConfigurationDialog
} */
}
-
private void handleRemove()
{
- IStructuredSelection selection = ( IStructuredSelection ) viewer.getSelection();
+ IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- if ( !selection.isEmpty() )
+ if (!selection.isEmpty())
{
- for ( Iterator<IPackageImport> i = selection.iterator(); i.hasNext(); )
+ for (Iterator<IPackageImport> i = selection.iterator(); i.hasNext();)
{
- packageImports.remove( i.next() );
+ packageImports.remove(i.next());
}
viewer.refresh();
}
}
-
public ILibrary getLibrary()
{
- ILibrary library = ModelElementFactory.getInstance().newModelElement( ILibrary.class );
+ ILibrary library = ModelElementFactory.getInstance().newModelElement(
+ ILibrary.class);
- library.setName( name );
- library.setVersion( version );
+ library.setName(name);
+ library.setVersion(version);
- for ( IPackageImport pi : packageImports )
+ for (IPackageImport pi : packageImports)
{
- library.addImport( pi );
+ library.addImport(pi);
}
return library;
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/preferences/LibraryPreferencePage.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/preferences/LibraryPreferencePage.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/preferences/LibraryPreferencePage.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/preferences/LibraryPreferencePage.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.internal.preferences;
-
import java.util.Comparator;
import java.util.Iterator;
import java.util.TreeSet;
@@ -50,7 +49,6 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
-
public class LibraryPreferencePage extends PreferencePage implements IWorkbenchPreferencePage
{
@@ -62,227 +60,216 @@ public class LibraryPreferencePage exten
private Button btnEdit;
private Button btnRemove;
-
- public void init( IWorkbench workbench )
+ public void init(IWorkbench workbench)
{
}
-
@Override
- protected Control createContents( Composite parent )
+ protected Control createContents(Composite parent)
{
- Control control = initContents( parent );
+ Control control = initContents(parent);
loadPreferences();
return control;
}
-
@Override
protected IPreferenceStore doGetPreferenceStore()
{
return SigilCore.getDefault().getPreferenceStore();
}
-
@Override
protected void performDefaults()
{
super.performDefaults();
}
-
@Override
public boolean performOk()
{
IPreferenceStore prefs = getPreferenceStore();
- for ( String key : prefs.getString( SigilCore.LIBRARY_KEYS_PREF ).split( "," ) )
+ for (String key : prefs.getString(SigilCore.LIBRARY_KEYS_PREF).split(","))
{
- prefs.setToDefault( key );
+ prefs.setToDefault(key);
}
StringBuffer keys = new StringBuffer();
- for ( ILibrary lib : libraries )
+ for (ILibrary lib : libraries)
{
- throw new IllegalStateException( "XXX-FIXME-XXX" );
+ throw new IllegalStateException("XXX-FIXME-XXX");
}
- prefs.setValue( SigilCore.LIBRARY_KEYS_PREF, keys.toString() );
+ prefs.setValue(SigilCore.LIBRARY_KEYS_PREF, keys.toString());
return true;
}
-
- private Control initContents( Composite parent )
+ private Control initContents(Composite parent)
{
- Composite control = new Composite( parent, SWT.NONE );
- control.setFont( parent.getFont() );
+ Composite control = new Composite(parent, SWT.NONE);
+ control.setFont(parent.getFont());
- GridLayout grid = new GridLayout( 3, false );
- control.setLayout( grid );
+ GridLayout grid = new GridLayout(3, false);
+ control.setLayout(grid);
- initRepositories( control );
+ initRepositories(control);
return control;
}
-
- private void initRepositories( Composite composite )
+ private void initRepositories(Composite composite)
{
// Create controls
- new Label( composite, SWT.NONE ).setText( "Libraries:" );
- new Label( composite, SWT.NONE ); // Spacer
- table = new Table( composite, SWT.SINGLE | SWT.BORDER );
+ new Label(composite, SWT.NONE).setText("Libraries:");
+ new Label(composite, SWT.NONE); // Spacer
+ table = new Table(composite, SWT.SINGLE | SWT.BORDER);
//table.setFont(control.getFont());
- btnAdd = new Button( composite, SWT.PUSH );
- btnAdd.setText( "Add..." );
+ btnAdd = new Button(composite, SWT.PUSH);
+ btnAdd.setText("Add...");
//add.setFont(control.getFont());
- btnEdit = new Button( composite, SWT.PUSH );
- btnEdit.setText( "Edit..." );
+ btnEdit = new Button(composite, SWT.PUSH);
+ btnEdit.setText("Edit...");
//edit.setFont(control.getFont());
- btnRemove = new Button( composite, SWT.PUSH );
- btnRemove.setText( "Remove" );
+ btnRemove = new Button(composite, SWT.PUSH);
+ btnRemove.setText("Remove");
//remove.setFont(control.getFont());
// Table Model
- libraries = new TreeSet<ILibrary>( new Comparator<ILibrary>()
+ libraries = new TreeSet<ILibrary>(new Comparator<ILibrary>()
{
- public int compare( ILibrary l1, ILibrary l2 )
+ public int compare(ILibrary l1, ILibrary l2)
{
- int c = l1.getName().compareTo( l2.getName() );
- if ( c == 0 )
+ int c = l1.getName().compareTo(l2.getName());
+ if (c == 0)
{
- c = l1.getVersion().compareTo( l2.getVersion() );
+ c = l1.getVersion().compareTo(l2.getVersion());
}
return c;
}
- } );
- libraryView = new TableViewer( table );
- libraryView.setLabelProvider( new LabelProvider()
+ });
+ libraryView = new TableViewer(table);
+ libraryView.setLabelProvider(new LabelProvider()
{
- public String getText( Object element )
+ public String getText(Object element)
{
- ILibrary rep = ( ILibrary ) element;
+ ILibrary rep = (ILibrary) element;
return rep.getName() + " " + rep.getVersion();
}
- } );
- libraryView.setContentProvider( new DefaultTableProvider()
+ });
+ libraryView.setContentProvider(new DefaultTableProvider()
{
- public Object[] getElements( Object inputElement )
+ public Object[] getElements(Object inputElement)
{
- return toArray( inputElement );
+ return toArray(inputElement);
}
- } );
- libraryView.setInput( libraries );
+ });
+ libraryView.setInput(libraries);
// Initialize controls
updateButtonStates();
// Hookup Listeners
- libraryView.addSelectionChangedListener( new ISelectionChangedListener()
+ libraryView.addSelectionChangedListener(new ISelectionChangedListener()
{
- public void selectionChanged( SelectionChangedEvent event )
+ public void selectionChanged(SelectionChangedEvent event)
{
updateButtonStates();
}
- } );
- btnAdd.addSelectionListener( new SelectionAdapter()
+ });
+ btnAdd.addSelectionListener(new SelectionAdapter()
{
- public void widgetSelected( SelectionEvent e )
+ public void widgetSelected(SelectionEvent e)
{
handleAdd();
}
- } );
- btnEdit.addSelectionListener( new SelectionAdapter()
+ });
+ btnEdit.addSelectionListener(new SelectionAdapter()
{
- public void widgetSelected( SelectionEvent e )
+ public void widgetSelected(SelectionEvent e)
{
handleEdit();
}
- } );
- btnRemove.addSelectionListener( new SelectionAdapter()
+ });
+ btnRemove.addSelectionListener(new SelectionAdapter()
{
- public void widgetSelected( SelectionEvent e )
+ public void widgetSelected(SelectionEvent e)
{
handleRemove();
}
- } );
+ });
// Layout
- composite.setLayout( new GridLayout( 2, false ) );
- table.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true, 1, 4 ) );
- GridDataFactory buttonGD = GridDataFactory.swtDefaults().align( SWT.FILL, SWT.CENTER );
- btnAdd.setLayoutData( buttonGD.create() );
- btnEdit.setLayoutData( buttonGD.create() );
- btnRemove.setLayoutData( buttonGD.create() );
+ composite.setLayout(new GridLayout(2, false));
+ table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 4));
+ GridDataFactory buttonGD = GridDataFactory.swtDefaults().align(SWT.FILL,
+ SWT.CENTER);
+ btnAdd.setLayoutData(buttonGD.create());
+ btnEdit.setLayoutData(buttonGD.create());
+ btnRemove.setLayoutData(buttonGD.create());
}
-
private void updateButtonStates()
{
ISelection sel = libraryView.getSelection();
- btnEdit.setEnabled( !sel.isEmpty() );
- btnRemove.setEnabled( !sel.isEmpty() );
+ btnEdit.setEnabled(!sel.isEmpty());
+ btnRemove.setEnabled(!sel.isEmpty());
}
-
private void handleAdd()
{
- LibraryConfigurationDialog d = new LibraryConfigurationDialog( getShell() );
- if ( d.open() == Window.OK )
+ LibraryConfigurationDialog d = new LibraryConfigurationDialog(getShell());
+ if (d.open() == Window.OK)
{
- libraries.add( d.getLibrary() );
+ libraries.add(d.getLibrary());
libraryView.refresh();
}
}
-
private void handleEdit()
{
- IStructuredSelection sel = ( IStructuredSelection ) libraryView.getSelection();
+ IStructuredSelection sel = (IStructuredSelection) libraryView.getSelection();
boolean change = false;
- for ( @SuppressWarnings("unchecked")
- Iterator<ILibrary> i = sel.iterator(); i.hasNext(); )
+ for (@SuppressWarnings("unchecked")
+ Iterator<ILibrary> i = sel.iterator(); i.hasNext();)
{
ILibrary lib = i.next();
- LibraryConfigurationDialog d = new LibraryConfigurationDialog( getShell(), lib );
- if ( d.open() == Window.OK )
+ LibraryConfigurationDialog d = new LibraryConfigurationDialog(getShell(), lib);
+ if (d.open() == Window.OK)
{
- libraries.remove( lib );
- libraries.add( d.getLibrary() );
+ libraries.remove(lib);
+ libraries.add(d.getLibrary());
change = true;
}
}
- if ( change )
+ if (change)
{
libraryView.refresh();
}
}
-
private void handleRemove()
{
- IStructuredSelection sel = ( IStructuredSelection ) libraryView.getSelection();
- for ( @SuppressWarnings("unchecked")
- Iterator<ILibrary> i = sel.iterator(); i.hasNext(); )
+ IStructuredSelection sel = (IStructuredSelection) libraryView.getSelection();
+ for (@SuppressWarnings("unchecked")
+ Iterator<ILibrary> i = sel.iterator(); i.hasNext();)
{
- libraries.remove( i );
+ libraries.remove(i);
}
libraryView.refresh();
}
-
private void loadPreferences()
{
IPreferenceStore prefs = getPreferenceStore();
- String keys = prefs.getString( SigilCore.LIBRARY_KEYS_PREF );
- if ( keys.trim().length() > 0 )
+ String keys = prefs.getString(SigilCore.LIBRARY_KEYS_PREF);
+ if (keys.trim().length() > 0)
{
- for ( String key : keys.split( "," ) )
+ for (String key : keys.split(","))
{
- String libStr = prefs.getString( key );
+ String libStr = prefs.getString(key);
// XXX-FIXME-XXX parse library string
// lib = parse(libstr);
// libraries.add(lib);
Modified: felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/preferences/OptionalPrompt.java
URL: http://svn.apache.org/viewvc/felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/preferences/OptionalPrompt.java?rev=981604&r1=981603&r2=981604&view=diff
==============================================================================
--- felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/preferences/OptionalPrompt.java (original)
+++ felix/trunk/sigil/eclipse/ui/src/org/apache/felix/sigil/eclipse/ui/internal/preferences/OptionalPrompt.java Mon Aug 2 17:08:03 2010
@@ -19,7 +19,6 @@
package org.apache.felix.sigil.eclipse.ui.internal.preferences;
-
import org.apache.felix.sigil.eclipse.SigilCore;
import org.apache.felix.sigil.eclipse.preferences.PromptablePreference;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -27,21 +26,22 @@ import org.eclipse.jface.dialogs.Message
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.swt.widgets.Shell;
-
public class OptionalPrompt
{
- public static boolean optionallyPrompt( String prefName, String title, String text, Shell parentShell)
+ public static boolean optionallyPrompt(String prefName, String title, String text,
+ Shell parentShell)
{
- return optionallyPrompt(SigilCore.getDefault().getPreferenceStore(), prefName, title, text, parentShell);
+ return optionallyPrompt(SigilCore.getDefault().getPreferenceStore(), prefName,
+ title, text, parentShell);
}
-
- public static boolean optionallyPrompt( IPreferenceStore prefStore, String prefName, String title, String text,
- Shell parentShell )
+
+ public static boolean optionallyPrompt(IPreferenceStore prefStore, String prefName,
+ String title, String text, Shell parentShell)
{
boolean result = false;
PromptablePreference value = preference(prefStore, prefName);
- switch ( value )
+ switch (value)
{
case Always:
result = true;
@@ -50,33 +50,35 @@ public class OptionalPrompt
result = false;
break;
case Prompt:
- MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion( parentShell, title, text,
- "Do not ask this again", false, null, null );
- result = ( dialog.getReturnCode() == IDialogConstants.YES_ID );
- if ( dialog.getToggleState() )
+ MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoQuestion(
+ parentShell, title, text, "Do not ask this again", false, null, null);
+ result = (dialog.getReturnCode() == IDialogConstants.YES_ID);
+ if (dialog.getToggleState())
{
// User said don't ask again... take the current answer as the new preference
- prefStore.setValue( prefName, result ? PromptablePreference.Always.name()
- : PromptablePreference.Never.name() );
+ prefStore.setValue(prefName,
+ result ? PromptablePreference.Always.name()
+ : PromptablePreference.Never.name());
}
}
return result;
}
- public static int optionallyPromptWithCancel( String prefName, String title,
- String text, Shell parentShell )
+ public static int optionallyPromptWithCancel(String prefName, String title,
+ String text, Shell parentShell)
{
- return optionallyPromptWithCancel(SigilCore.getDefault().getPreferenceStore(), prefName, title, text, parentShell);
+ return optionallyPromptWithCancel(SigilCore.getDefault().getPreferenceStore(),
+ prefName, title, text, parentShell);
}
-
- public static int optionallyPromptWithCancel( IPreferenceStore prefStore, String prefName, String title,
- String text, Shell parentShell )
+
+ public static int optionallyPromptWithCancel(IPreferenceStore prefStore,
+ String prefName, String title, String text, Shell parentShell)
{
int result = IDialogConstants.NO_ID;
PromptablePreference value = preference(prefStore, prefName);
- switch ( value )
+ switch (value)
{
case Always:
result = IDialogConstants.YES_ID;
@@ -85,32 +87,35 @@ public class OptionalPrompt
result = IDialogConstants.NO_ID;
break;
case Prompt:
- MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoCancelQuestion( parentShell, title,
- text, "Do not ask this again", false, null, null );
+ MessageDialogWithToggle dialog = MessageDialogWithToggle.openYesNoCancelQuestion(
+ parentShell, title, text, "Do not ask this again", false, null, null);
result = dialog.getReturnCode();
- if ( result != IDialogConstants.CANCEL_ID )
+ if (result != IDialogConstants.CANCEL_ID)
{
- if ( dialog.getToggleState() )
+ if (dialog.getToggleState())
{
// User said don't ask again... take the current answer as the new preference
- prefStore.setValue( prefName,
- ( result == IDialogConstants.YES_ID ) ? PromptablePreference.Always.name()
- : PromptablePreference.Never.name() );
+ prefStore.setValue(
+ prefName,
+ (result == IDialogConstants.YES_ID) ? PromptablePreference.Always.name()
+ : PromptablePreference.Never.name());
}
}
}
return result;
}
-
+
/**
* @param prefStore
* @param prefName
* @return
*/
- private static PromptablePreference preference(IPreferenceStore prefStore, String prefName)
+ private static PromptablePreference preference(IPreferenceStore prefStore,
+ String prefName)
{
- String val = prefStore.getString( prefName );
- return (val == null || val.trim().length() == 0) ? PromptablePreference.Prompt : PromptablePreference.valueOf( val );
- }
+ String val = prefStore.getString(prefName);
+ return (val == null || val.trim().length() == 0) ? PromptablePreference.Prompt
+ : PromptablePreference.valueOf(val);
+ }
}