diff options
author | jonas | 2014-12-07 13:39:33 +0000 |
---|---|---|
committer | jonas | 2014-12-07 13:39:33 +0000 |
commit | a0124fa4721a4afc454b46607aa7500955cae686 (patch) | |
tree | 2dc0ad597a8cc463a31170416f809a8f663233c1 /bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4 | |
parent | cefbf79daf5814b142b950bd5947caf6c71acf8e (diff) | |
download | org.eclipse.e4.tools-I20141215-0900.tar.gz org.eclipse.e4.tools-I20141215-0900.tar.xz org.eclipse.e4.tools-I20141215-0900.zip |
Bug 444692 - Remove WarningsI20141217-2200I20141216-2200I20141215-2200I20141215-0900I20141214-2200I20141213-2200I20141212-2200I20141211-2200I20141210-2200I20141209-2200I20141208-2200I20141208-0900I20141207-2200
Diffstat (limited to 'bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4')
28 files changed, 442 insertions, 421 deletions
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/AbstractPickList.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/AbstractPickList.java index a3e7d4db..f487aa0c 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/AbstractPickList.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/AbstractPickList.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation + * Steven Spungin <steven@spungin.tv> - initial API and implementation *******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common; @@ -16,6 +16,7 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeMap; + import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; @@ -48,8 +49,8 @@ import org.eclipse.swt.widgets.ToolItem; /** * <p> - * A composite widget containing a combo for picking items, a list with - * selectable items, and action buttons for modifying the list. + * A composite widget containing a combo for picking items, a list with selectable items, and action buttons for + * modifying the list. * </p> * * @author Steven Spungin @@ -64,16 +65,17 @@ public abstract class AbstractPickList extends Composite { protected ComboViewer picker; protected TableViewer viewer; - private Group group; - private ToolBar toolBar; - private ToolItem tiRemove; - private ToolItem tiUp; - private ToolItem tiDown; - private ToolItem tiAdd; - private AutoCompleteField autoCompleteField; + private final Group group; + private final ToolBar toolBar; + private final ToolItem tiRemove; + private final ToolItem tiUp; + private final ToolItem tiDown; + private final ToolItem tiAdd; + private final AutoCompleteField autoCompleteField; private Map<String, Object> proposals; - public AbstractPickList(Composite parent, int style, List<PickListFeatures> listFeatures, Messages messages, AbstractComponentEditor componentEditor) { + public AbstractPickList(Composite parent, int style, List<PickListFeatures> listFeatures, Messages messages, + AbstractComponentEditor componentEditor) { super(parent, style); // TODO remove dependency to Messages and AbstractComponentEditor. They @@ -130,14 +132,14 @@ public abstract class AbstractPickList extends Composite { }); picker = new ComboViewer(group, SWT.DROP_DOWN); - Combo control = picker.getCombo(); + final Combo control = picker.getCombo(); control.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); - ComboContentAdapter controlContentAdapter = new ComboContentAdapter() { + final ComboContentAdapter controlContentAdapter = new ComboContentAdapter() { @Override public void setControlContents(Control control, String text1, int cursorPosition) { super.setControlContents(control, text1, cursorPosition); - Object valueInModel = proposals.get(text1); + final Object valueInModel = proposals.get(text1); if (valueInModel != null) { getPicker().setSelection(new StructuredSelection(valueInModel)); } @@ -154,7 +156,7 @@ public abstract class AbstractPickList extends Composite { }); viewer = new TableViewer(group); - GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true, 1, 1); + final GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true, 1, 1); viewer.getControl().setLayoutData(gd); viewer.addSelectionChangedListener(new ISelectionChangedListener() { @@ -194,7 +196,7 @@ public abstract class AbstractPickList extends Composite { getPicker().setInput(input); proposals = toProposals(input); - Set<String> keySet = proposals.keySet(); + final Set<String> keySet = proposals.keySet(); autoCompleteField.setProposals(keySet.toArray(new String[keySet.size()])); } @@ -208,15 +210,15 @@ public abstract class AbstractPickList extends Composite { private Map<String, Object> toProposals(Object inputElement) { - Map<String, Object> props = new TreeMap<String, Object>(); + final Map<String, Object> props = new TreeMap<String, Object>(); if (inputElement instanceof Object[]) { - for (Object value : (Object[]) inputElement) { + for (final Object value : (Object[]) inputElement) { props.put(getTextualValue(value), value); } } if (inputElement instanceof Collection) { - for (Object value : (Collection<Object>) inputElement) { + for (final Object value : (Collection<Object>) inputElement) { props.put(getTextualValue(value), value); } @@ -263,9 +265,9 @@ public abstract class AbstractPickList extends Composite { } public void updateUiState() { - IStructuredSelection selection = (IStructuredSelection) getList().getSelection(); - boolean selected = selection.size() > 0; - int count = getItemCount(); + final IStructuredSelection selection = (IStructuredSelection) getList().getSelection(); + final boolean selected = selection.size() > 0; + final int count = getItemCount(); if (tiDown.isDisposed() == false) { tiDown.setEnabled(selected && count > 1); tiUp.setEnabled(selected && count > 1); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/FeatureClassLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/FeatureClassLabelProvider.java index 16cc4c39..64900bd9 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/FeatureClassLabelProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/FeatureClassLabelProvider.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation + * Steven Spungin <steven@spungin.tv> - initial API and implementation *******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common; @@ -23,7 +23,7 @@ import org.eclipse.jface.viewers.LabelProvider; * */ public class FeatureClassLabelProvider extends LabelProvider { - private ModelEditor editor; + private final ModelEditor editor; public FeatureClassLabelProvider(ModelEditor editor) { this.editor = editor; @@ -31,13 +31,12 @@ public class FeatureClassLabelProvider extends LabelProvider { @Override public String getText(Object element) { - FeatureClass eFeatureClass = (FeatureClass) element; - EClass eclass = eFeatureClass.eClass; - AbstractComponentEditor elementEditor = editor.getEditor(eclass); + final FeatureClass eFeatureClass = (FeatureClass) element; + final EClass eclass = eFeatureClass.eClass; + final AbstractComponentEditor elementEditor = editor.getEditor(eclass); if (elementEditor != null) { return elementEditor.getLabel(null); - } else { - return eclass.getName(); } + return eclass.getName(); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java index 07b3e16c..8d95a548 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java @@ -1482,9 +1482,8 @@ public class ModelEditor implements IGotoObject { return editor; } } - if (editor == null) { - editor = ContextInjectionFactory.make(DefaultEditor.class, context); - } + + editor = ContextInjectionFactory.make(DefaultEditor.class, context); } return editor; } @@ -1774,7 +1773,7 @@ public class ModelEditor implements IGotoObject { final TreeItem item = (TreeItem) getCurrentEvent().item; if (item != null) { final TreeItem parentItem = item.getParentItem(); - if (item != null) { + if (parentItem != null) { if (parentItem.getData() instanceof VirtualEntry<?>) { final VirtualEntry<?> vE = (VirtualEntry<?>) parentItem.getData(); parent = (EObject) vE.getOriginalParent(); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java index e97ff8a8..66ccc252 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractCommandSelectionDialog.java @@ -48,7 +48,6 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -@SuppressWarnings("restriction") public abstract class AbstractCommandSelectionDialog extends SaveDialogBoundsSettingsDialog { private final IModelResource resource; private TableViewer viewer; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIdDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIdDialog.java index 2abd149a..5299094b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIdDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AbstractIdDialog.java @@ -45,7 +45,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; public abstract class AbstractIdDialog<ContributionClass, ElementClass extends MApplicationElement> extends - SaveDialogBoundsSettingsDialog { +SaveDialogBoundsSettingsDialog { protected EModelService modelService; @@ -92,16 +92,16 @@ public abstract class AbstractIdDialog<ContributionClass, ElementClass extends M final ElementClass el = (ElementClass) cell.getElement(); final String elementId = el.getElementId() != null && el.getElementId().trim().length() > 0 ? el .getElementId() : "(Id missing)"; //$NON-NLS-1$ - final StyledString str = new StyledString(elementId); + final StyledString str = new StyledString(elementId); - final String infoString = getListItemInformation(el); - if (infoString != null && infoString.trim().length() > 0) - { - str.append(" - " + getListItemInformation(el), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ - } + final String infoString = getListItemInformation(el); + if (infoString != null && infoString.trim().length() > 0) + { + str.append(" - " + getListItemInformation(el), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ + } - cell.setText(str.getString()); - cell.setStyleRanges(str.getStyleRanges()); + cell.setText(str.getString()); + cell.setStyleRanges(str.getStyleRanges()); } }; } @@ -123,7 +123,6 @@ public abstract class AbstractIdDialog<ContributionClass, ElementClass extends M idField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); final PatternFilter filter = new PatternFilter() { - @SuppressWarnings("restriction") @Override protected boolean isParentMatch(Viewer viewer, Object element) { return viewer instanceof AbstractTreeViewer && super.isParentMatch(viewer, element); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java index 03c813d3..0d1a5391 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/AreaIconDialogEditor.java @@ -19,7 +19,6 @@ import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; -@SuppressWarnings("restriction") public class AreaIconDialogEditor extends AbstractIconDialog { public AreaIconDialogEditor(Shell parentShell, IEclipseContext context, IProject project, diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java index b4918296..37fdb263 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/BindingContextSelectionDialog.java @@ -46,7 +46,6 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -@SuppressWarnings("restriction") public class BindingContextSelectionDialog extends SaveDialogBoundsSettingsDialog { private final IModelResource resource; private TableViewer viewer; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java index 83f71d94..c78e9907 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/CommandCategorySelectionDialog.java @@ -49,7 +49,6 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -@SuppressWarnings("restriction") public class CommandCategorySelectionDialog extends SaveDialogBoundsSettingsDialog { private final IModelResource resource; private TableViewer viewer; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java index f3f859b4..9f6ccf0f 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/ExpressionIdDialog.java @@ -46,7 +46,6 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -@SuppressWarnings("restriction") public class ExpressionIdDialog extends SaveDialogBoundsSettingsDialog { private final IExtensionLookup lookup; private TableViewer viewer; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java index 866fcd9f..43ff0299 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FeatureSelectionDialog.java @@ -59,7 +59,6 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -@SuppressWarnings("restriction") public class FeatureSelectionDialog extends SaveDialogBoundsSettingsDialog { private TreeViewer viewer; private final MStringModelFragment fragment; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FilteredContributionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FilteredContributionDialog.java index 1ee9389b..bb9c845a 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FilteredContributionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FilteredContributionDialog.java @@ -6,9 +6,9 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730, Bug 435625, Bug 436281 - * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283 - * Marco Descher <marco@descher.at> - Bug 442647 + * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730, Bug 435625, Bug 436281 + * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283 + * Marco Descher <marco@descher.at> - Bug 442647 *******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; @@ -26,6 +26,7 @@ import java.util.EnumSet; import java.util.HashSet; import java.util.List; import java.util.Scanner; + import org.eclipse.core.databinding.observable.list.IObservableList; import org.eclipse.core.databinding.observable.list.WritableList; import org.eclipse.core.resources.IFile; @@ -53,7 +54,6 @@ import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.TargetPlatfor import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs.NonReferencedResourceDialog; import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs.NonReferencedResourceWizard; import org.eclipse.jface.databinding.viewers.ObservableListContentProvider; -import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.text.Document; import org.eclipse.jface.viewers.ColumnLabelProvider; @@ -64,6 +64,7 @@ import org.eclipse.jface.viewers.StyledCellLabelProvider; import org.eclipse.jface.viewers.StyledString; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.jface.window.Window; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.pde.internal.core.project.PDEProject; import org.eclipse.pde.internal.core.text.bundle.BundleModel; @@ -121,7 +122,7 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting private Button btnFilterLocation; private List<String> filterLocations; private Button btnClearCache; - private IEclipseContext context; + private final IEclipseContext context; private Composite compOptions; protected boolean includeNonBundles; private Label lblStatus; @@ -158,7 +159,8 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting if (hint == ContributionResultHandler.MORE_CANCELED) { message += Messages.FilteredContributionDialog_SearchWasCancelled; } else { - message += Messages.FilteredContributionDialog_MoreThan + maxResults + Messages.FilteredContributionDialog_itemsWereFound; + message += Messages.FilteredContributionDialog_MoreThan + maxResults + + Messages.FilteredContributionDialog_itemsWereFound; } } @@ -181,7 +183,7 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting private class ContributionResultHandlerImpl implements ContributionResultHandler { private boolean cancled = false; - private IObservableList list; + private final IObservableList list; public ContributionResultHandlerImpl(IObservableList list) { this.list = list; @@ -207,7 +209,7 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting @Override public void run() { - FilteredContributionDialog dlg = (FilteredContributionDialog) filter.userData; + final FilteredContributionDialog dlg = (FilteredContributionDialog) filter.userData; dlg.hint = hint; dlg.maxResults = filter.maxResults; dlg.updateStatusMessage(); @@ -227,7 +229,7 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting @Override protected Control createContents(Composite parent) { - Control ret = super.createContents(parent); + final Control ret = super.createContents(parent); textBox.notifyListeners(SWT.Modify, new Event()); textBox.setFocus(); return ret; @@ -238,18 +240,20 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting this.context = context; imageCache = new BundleImageCache(context.get(Display.class), getClass().getClassLoader()); - String searchScopeString = getPreferences().get(PREF_SEARCHSCOPE, ResourceSearchScope.PROJECT.toString()); + final String searchScopeString = getPreferences().get(PREF_SEARCHSCOPE, ResourceSearchScope.PROJECT.toString()); searchScope = ResourceSearchScope.valueOf(searchScopeString); - String searchScopesString = getPreferences().get(PREF_SEARCHSCOPES, EnumSet.of(ResourceSearchScope.PROJECT).toString()); + final String searchScopesString = getPreferences().get(PREF_SEARCHSCOPES, + EnumSet.of(ResourceSearchScope.PROJECT).toString()); searchScopes = valueOf(ResourceSearchScope.class, searchScopesString); } public static <TheType extends Enum<TheType>> EnumSet<TheType> valueOf(Class<TheType> eClass, String str) { - String[] arr = str.substring(1, str.length() - 1).split(","); //$NON-NLS-1$ - EnumSet<TheType> set = EnumSet.noneOf(eClass); - for (String e : arr) - set.add(TheType.valueOf(eClass, e.trim())); + final String[] arr = str.substring(1, str.length() - 1).split(","); //$NON-NLS-1$ + final EnumSet<TheType> set = EnumSet.noneOf(eClass); + for (final String e : arr) { + set.add(Enum.valueOf(eClass, e.trim())); + } return set; } @@ -292,7 +296,7 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting // TODO add results found (and/or more indicator) @Override protected Control createDialogArea(Composite parent) { - Composite comp = (Composite) super.createDialogArea(parent); + final Composite comp = (Composite) super.createDialogArea(parent); getShell().addDisposeListener(new DisposeListener() { @Override @@ -324,7 +328,7 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting createOptions(compOptions); - Label l = new Label(compOptions, SWT.NONE); + final Label l = new Label(compOptions, SWT.NONE); l.setText(getResourceNameText()); textBox = new Text(compOptions, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); @@ -353,7 +357,7 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting @Override public void keyPressed(KeyEvent e) { super.keyPressed(e); - if ((e.keyCode == SWT.ARROW_UP) && (viewer.getTable().getSelectionIndex() == 0)) { + if (e.keyCode == SWT.ARROW_UP && viewer.getTable().getSelectionIndex() == 0) { textBox.setFocus(); } } @@ -379,7 +383,8 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting @Override protected IStatus run(IProgressMonitor monitor) { - monitor.beginTask(Messages.FilteredContributionDialog_ContributionSearch, IProgressMonitor.UNKNOWN); + monitor.beginTask(Messages.FilteredContributionDialog_ContributionSearch, + IProgressMonitor.UNKNOWN); currentResultHandler = new ContributionResultHandlerImpl(viewerList); getShell().getDisplay().syncExec(new Runnable() { @@ -406,7 +411,7 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting @Override public void onStatusChanged(final ProviderStatus status) { - FilteredContributionDialog.this.providerStatus = status; + providerStatus = status; try { getShell().getDisplay().syncExec(new Runnable() { @@ -430,7 +435,7 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting } } }); - } catch (Exception e2) { + } catch (final Exception e2) { // Dialog may have been closed while // provider was still indexing } @@ -466,11 +471,11 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting protected void createOptions(Composite compOptions) { { - Label lblScope = new Label(compOptions, SWT.NONE); + final Label lblScope = new Label(compOptions, SWT.NONE); lblScope.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); lblScope.setText(Messages.FilteredContributionDialog_Scope); - Composite compScope = new Composite(compOptions, SWT.NONE); + final Composite compScope = new Composite(compOptions, SWT.NONE); compScope.setLayoutData(new GridData(SWT.BEGINNING, SWT.TOP, false, false)); compScope.setLayout(new RowLayout()); @@ -488,7 +493,8 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting } } }); - btnScopeProject.setSelection(searchScopes.contains(ResourceSearchScope.PROJECT) && !searchScopes.contains(ResourceSearchScope.REFERENCES)); + btnScopeProject.setSelection(searchScopes.contains(ResourceSearchScope.PROJECT) + && !searchScopes.contains(ResourceSearchScope.REFERENCES)); final Button btnProjectAndReferences = new Button(compScope, SWT.RADIO); btnProjectAndReferences.setText(Messages.FilteredContributionDialog_ProjectAndReferences); @@ -504,7 +510,8 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting } } }); - btnProjectAndReferences.setSelection(searchScopes.contains(ResourceSearchScope.PROJECT) && searchScopes.contains(ResourceSearchScope.REFERENCES)); + btnProjectAndReferences.setSelection(searchScopes.contains(ResourceSearchScope.PROJECT) + && searchScopes.contains(ResourceSearchScope.REFERENCES)); final Button btnScopeWorkspace = new Button(compScope, SWT.RADIO); btnScopeWorkspace.setText(Messages.FilteredContributionDialog_Workspace); @@ -540,11 +547,11 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting } { - Label lblFilter = new Label(compOptions, SWT.NONE); + final Label lblFilter = new Label(compOptions, SWT.NONE); lblFilter.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); lblFilter.setText(Messages.FilteredContributionDialog_ScopeFilter); - Composite compFilter = new Composite(compOptions, SWT.NONE); + final Composite compFilter = new Composite(compOptions, SWT.NONE); compFilter.setLayoutData(new GridData(SWT.BEGINNING, SWT.TOP, false, false)); compFilter.setLayout(new RowLayout()); @@ -606,7 +613,7 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting } { - Label lblIncludeNoneBundle = new Label(compOptions, SWT.NONE); + final Label lblIncludeNoneBundle = new Label(compOptions, SWT.NONE); lblIncludeNoneBundle.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); lblIncludeNoneBundle.setText(Messages.FilteredContributionDialog_NonBundles); @@ -640,7 +647,7 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting // original (default) contribution filter does not support this // filtering API - boolean enabled = !searchScopes.contains(ResourceSearchScope.PROJECT); + final boolean enabled = !searchScopes.contains(ResourceSearchScope.PROJECT); btnFilterNone.setEnabled(enabled); btnFilterBundle.setEnabled(enabled); btnFilterLocation.setEnabled(enabled); @@ -705,24 +712,24 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting final ArrayList<String> sorted = new ArrayList<String>(bundleIds); Collections.sort(sorted); - TitleAreaFilterDialog dlg = new TitleAreaFilterDialog(getShell(), new ColumnLabelProvider()) { + final TitleAreaFilterDialog dlg = new TitleAreaFilterDialog(getShell(), new ColumnLabelProvider()) { @Override protected Control createContents(Composite parent) { - Control ret = super.createContents(parent); + final Control ret = super.createContents(parent); getViewer().setInput(sorted); setMessage(Messages.FilteredContributionDialog_SelectTheBundle); setTitle(Messages.FilteredContributionDialog_BundleFilter); getShell().setText(Messages.FilteredContributionDialog_BundleFilter); try { setTitleImage(imageCache.create("/icons/full/wizban/plugin_wiz.gif")); //$NON-NLS-1$ - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } return ret; } }; - if (dlg.open() == Dialog.OK) { - ArrayList<String> result = new ArrayList<String>(); + if (dlg.open() == Window.OK) { + final ArrayList<String> result = new ArrayList<String>(); result.add(dlg.getFirstSelection()); setFilterBundles(result); refreshSearch(); @@ -745,10 +752,10 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting final ArrayList<String> sorted = new ArrayList<String>(packages); Collections.sort(sorted); - TitleAreaFilterDialog dlg = new TitleAreaFilterDialog(getShell(), new ColumnLabelProvider()) { + final TitleAreaFilterDialog dlg = new TitleAreaFilterDialog(getShell(), new ColumnLabelProvider()) { @Override protected Control createContents(Composite parent) { - Control ret = super.createContents(parent); + final Control ret = super.createContents(parent); getViewer().setInput(sorted); setMessage(Messages.FilteredContributionDialog_SelectThePackage); setTitle(Messages.FilteredContributionDialog_PackageFilter); @@ -757,8 +764,8 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting return ret; } }; - if (dlg.open() == Dialog.OK) { - ArrayList<String> result = new ArrayList<String>(); + if (dlg.open() == Window.OK) { + final ArrayList<String> result = new ArrayList<String>(); result.add(dlg.getFirstSelection()); setFilterBundles(result); refreshSearch(); @@ -771,7 +778,7 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting } public void setScope(ResourceSearchScope scope) { - this.searchScope = scope; + searchScope = scope; } public void setCollector(ClassContributionCollector collector) { @@ -794,7 +801,7 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting final HashSet<String> parentLocations = new HashSet<String>(); for (String location : locations) { if (location.endsWith(".jar")) { //$NON-NLS-1$ - int index = location.lastIndexOf(File.separator); + final int index = location.lastIndexOf(File.separator); if (index >= 0) { location = location.substring(0, index); parentLocations.add(location); @@ -807,10 +814,10 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting final ArrayList<String> sorted = new ArrayList<String>(parentLocations); Collections.sort(sorted); - TitleAreaFilterDialog dlg = new TitleAreaFilterDialog(getShell(), new ColumnLabelProvider()) { + final TitleAreaFilterDialog dlg = new TitleAreaFilterDialog(getShell(), new ColumnLabelProvider()) { @Override protected Control createContents(Composite parent) { - Control ret = super.createContents(parent); + final Control ret = super.createContents(parent); getViewer().setInput(sorted); setMessage(Messages.FilteredContributionDialog_SelectTheLocation); setTitle(Messages.FilteredContributionDialog_LocationFilter); @@ -819,8 +826,8 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting return ret; } }; - if (dlg.open() == Dialog.OK) { - ArrayList<String> result = new ArrayList<String>(); + if (dlg.open() == Window.OK) { + final ArrayList<String> result = new ArrayList<String>(); result.add(dlg.getFirstSelection()); setFilterBundles(result); refreshSearch(); @@ -832,13 +839,13 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting viewerList = new WritableList(); - TableViewer oldViewer = viewer; + final TableViewer oldViewer = viewer; viewer = new TableViewer(compOptions, SWT.FULL_SELECTION | SWT.BORDER); if (oldViewer != null) { viewer.getTable().moveAbove(oldViewer.getTable()); oldViewer.getTable().dispose(); } - GridData gd = new GridData(GridData.FILL_BOTH); + final GridData gd = new GridData(GridData.FILL_BOTH); viewer.getControl().setLayoutData(gd); viewer.setContentProvider(new ObservableListContentProvider()); viewer.setLabelProvider(new StyledCellLabelProvider() { @@ -853,7 +860,7 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting return; } - StyledString styledString = new StyledString(); + final StyledString styledString = new StyledString(); if (data.className != null) { styledString.append(data.className, null); } @@ -910,17 +917,18 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting } protected IFile getSelectedIfile() { - IStructuredSelection s = (IStructuredSelection) getViewer().getSelection(); + final IStructuredSelection s = (IStructuredSelection) getViewer().getSelection(); if (!s.isEmpty()) { - Object selected = s.getFirstElement(); + final Object selected = s.getFirstElement(); if (selected instanceof ContributionData) { - ContributionData contributionData = (ContributionData) selected; + final ContributionData contributionData = (ContributionData) selected; return new ContributionDataFile(contributionData); } else if (selected instanceof IFile) { return (IFile) selected; } else if (selected instanceof Entry) { - Entry entry = (Entry) selected; - ContributionData cd = new ContributionData(null, null, Messages.FilteredContributionDialog_Java, entry.file.getFullPath().toOSString()); + final Entry entry = (Entry) selected; + final ContributionData cd = new ContributionData(null, null, Messages.FilteredContributionDialog_Java, + entry.file.getFullPath().toOSString()); cd.installLocation = entry.installLocation; cd.resourceRelativePath = entry.file.getProjectRelativePath().toOSString(); return new ContributionDataFile(cd); @@ -951,29 +959,30 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting // Not a bundle final String bundle = getBundle(file); if (bundle == null) { - String message = Messages.FilteredContributionDialog_ResourceIsNotContainedInABundle; - NonReferencedResourceWizard wizard = new NonReferencedResourceWizard(getShell(), context.get(IProject.class), bundle, file, installLocation, context); + final String message = Messages.FilteredContributionDialog_ResourceIsNotContainedInABundle; + final NonReferencedResourceWizard wizard = new NonReferencedResourceWizard(getShell(), + context.get(IProject.class), bundle, file, installLocation, context); wizard.setMessage(message); - WizardDialog wizDlg = new WizardDialog(getShell(), wizard); + final WizardDialog wizDlg = new WizardDialog(getShell(), wizard); wizDlg.setBlockOnOpen(true); if (wizDlg.open() == IDialogConstants.OK_ID) { return wizard.getResult(); - } else { - return null; } + return null; } // Reference by current project - IProject currentProject = context.get(IProject.class); + final IProject currentProject = context.get(IProject.class); if (currentProject != null && !getBundle(currentProject).equals(bundle)) { boolean found = false; // search the current project's manifest for require-bundle try { - BundleModel model = loadBundleModel(currentProject); + final BundleModel model = loadBundleModel(currentProject); - RequireBundleHeader rbh = (RequireBundleHeader) model.getBundle().getManifestHeader("Require-Bundle"); //$NON-NLS-1$ + final RequireBundleHeader rbh = (RequireBundleHeader) model.getBundle().getManifestHeader( + "Require-Bundle"); //$NON-NLS-1$ if (rbh != null) { - for (RequireBundleObject item : rbh.getRequiredBundles()) { + for (final RequireBundleObject item : rbh.getRequiredBundles()) { if (item.getValue().equals(bundle)) { found = true; break; @@ -983,13 +992,14 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting // search the current project's manifest for import-package if (!found) { if (file instanceof ContributionDataFile) { - ContributionDataFile cdFile = (ContributionDataFile) file; - String className = cdFile.getContributionData().className; + final ContributionDataFile cdFile = (ContributionDataFile) file; + final String className = cdFile.getContributionData().className; if (className != null) { - String pakage = NonReferencedResourceDialog.getPackageFromClassName(className); - ImportPackageHeader iph = (ImportPackageHeader) model.getBundle().getManifestHeader("Import-Package"); //$NON-NLS-1$ + final String pakage = NonReferencedResourceDialog.getPackageFromClassName(className); + final ImportPackageHeader iph = (ImportPackageHeader) model.getBundle().getManifestHeader( + "Import-Package"); //$NON-NLS-1$ if (iph != null) { - for (ImportPackageObject item : iph.getPackages()) { + for (final ImportPackageObject item : iph.getPackages()) { if (item.getValue().equals(pakage)) { found = true; break; @@ -999,32 +1009,32 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting } } } - } catch (Exception e) { + } catch (final Exception e) { } if (!found) { - String message = Messages.FilteredContributionDialog_ResourceIsNotReferencedByThisBundle; - NonReferencedResourceWizard wizard = new NonReferencedResourceWizard(getShell(), context.get(IProject.class), bundle, file, installLocation, context); + final String message = Messages.FilteredContributionDialog_ResourceIsNotReferencedByThisBundle; + final NonReferencedResourceWizard wizard = new NonReferencedResourceWizard(getShell(), + context.get(IProject.class), bundle, file, installLocation, context); wizard.setMessage(message); - WizardDialog wiz = new WizardDialog(getShell(), wizard); + final WizardDialog wiz = new WizardDialog(getShell(), wizard); wiz.setBlockOnOpen(true); if (wiz.open() == IDialogConstants.OK_ID) { return wizard.getResult(); - } else { - return null; } + return null; } } return file; } public BundleModel loadBundleModel(IProject currentProject) throws CoreException { - Document document = new Document(); - Scanner scanner = new Scanner(PDEProject.getManifest(currentProject).getContents()); + final Document document = new Document(); + final Scanner scanner = new Scanner(PDEProject.getManifest(currentProject).getContents()); try { - String content = scanner.useDelimiter("\\Z").next(); //$NON-NLS-1$ + final String content = scanner.useDelimiter("\\Z").next(); //$NON-NLS-1$ document.set(content); - BundleModel model = new BundleModel(document, false); + final BundleModel model = new BundleModel(document, false); model.load(); return model; } finally { @@ -1043,7 +1053,7 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting if (bJoin) { try { currentSearchThread.join(); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { } finally { currentSearchThread = null; } @@ -1056,8 +1066,8 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting static public String getBundle(IFile file) { if (file instanceof ContributionDataFile) { - ContributionDataFile cdFile = (ContributionDataFile) file; - String ret = cdFile.getBundle(); + final ContributionDataFile cdFile = (ContributionDataFile) file; + final String ret = cdFile.getBundle(); if (ret != null) { return ret; } else if (cdFile.getContributionData().installLocation != null) { @@ -1067,22 +1077,22 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting } } - IProject project = file.getProject(); + final IProject project = file.getProject(); return getBundle(project); } static String getBundle(IProject project) { - IFile f = project.getFile("/META-INF/MANIFEST.MF"); //$NON-NLS-1$ + final IFile f = project.getFile("/META-INF/MANIFEST.MF"); //$NON-NLS-1$ if (f != null && f.exists()) { BufferedReader r = null; try { - InputStream s = f.getContents(); + final InputStream s = f.getContents(); r = new BufferedReader(new InputStreamReader(s)); String line; while ((line = r.readLine()) != null) { if (line.startsWith("Bundle-SymbolicName:")) { //$NON-NLS-1$ - int start = line.indexOf(':'); + final int start = line.indexOf(':'); int end = line.indexOf(';'); if (end == -1) { end = line.length(); @@ -1090,15 +1100,15 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting return line.substring(start + 1, end).trim(); } } - } catch (CoreException e) { + } catch (final CoreException e) { e.printStackTrace(); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } finally { if (r != null) { try { r.close(); - } catch (IOException e) { + } catch (final IOException e) { } } } @@ -1110,20 +1120,20 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting * Searches the directory for a manifest and parses the symbolic name. * * @param rootDirectory - * @return + * @return the id of the bundle if existing */ public static String getBundle(String rootDirectory) { - File f = new File(new File(rootDirectory), "/META-INF/MANIFEST.MF"); //$NON-NLS-1$ + final File f = new File(new File(rootDirectory), "/META-INF/MANIFEST.MF"); //$NON-NLS-1$ if (f.exists()) { BufferedReader r = null; try { - InputStream s = new FileInputStream(f); + final InputStream s = new FileInputStream(f); r = new BufferedReader(new InputStreamReader(s)); String line; while ((line = r.readLine()) != null) { if (line.startsWith("Bundle-SymbolicName:")) { //$NON-NLS-1$ - int start = line.indexOf(':'); + final int start = line.indexOf(':'); int end = line.indexOf(';'); if (end == -1) { end = line.length(); @@ -1131,13 +1141,13 @@ public abstract class FilteredContributionDialog extends SaveDialogBoundsSetting return line.substring(start + 1, end).trim(); } } - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } finally { if (r != null) { try { r.close(); - } catch (IOException e) { + } catch (final IOException e) { } } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java index 25e5a20d..e0e4c007 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindImportElementDialog.java @@ -53,7 +53,6 @@ import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; import org.osgi.framework.ServiceReference; -@SuppressWarnings("restriction") public class FindImportElementDialog extends SaveDialogBoundsSettingsDialog { private final EObject element; private final AbstractComponentEditor editor; @@ -112,7 +111,7 @@ public class FindImportElementDialog extends SaveDialogBoundsSettingsDialog { final MApplicationElement appEl = (MApplicationElement) o; final StyledString styledString = new StyledString( editor.getLabel(o) - + " (" + (appEl.getElementId() == null ? "<" + Messages.FindImportElementDialog_noId + ">" : appEl.getElementId()) + ")", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + + " (" + (appEl.getElementId() == null ? "<" + Messages.FindImportElementDialog_noId + ">" : appEl.getElementId()) + ")", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ final String detailLabel = editor.getDetailLabel(o); if (detailLabel != null && !detailLabel.equals(appEl.getElementId())) { styledString.append(" - " + detailLabel, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java index e8d15918..ddef9008 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/FindParentReferenceElementDialog.java @@ -73,7 +73,6 @@ import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; import org.osgi.framework.ServiceReference; -@SuppressWarnings("restriction") public class FindParentReferenceElementDialog extends TitleAreaDialog { private final MStringModelFragment fragment; private final AbstractComponentEditor editor; @@ -196,7 +195,7 @@ public class FindParentReferenceElementDialog extends TitleAreaDialog { final StyledString styledString = new StyledString( editor.getLabel(o) - + " (" + (appEl.getElementId() == null ? "<" + Messages.FindParentReferenceElementDialog_NoId + ">" : appEl.getElementId()) + ")", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + + " (" + (appEl.getElementId() == null ? "<" + Messages.FindParentReferenceElementDialog_NoId + ">" : appEl.getElementId()) + ")", null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ final String detailLabel = editor.getDetailLabel(o); if (detailLabel != null && !detailLabel.equals(appEl.getElementId())) { styledString.append(" - " + detailLabel, StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java index 1fb224d4..7f0d166b 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledMenuItemCommandSelectionDialog.java @@ -20,7 +20,6 @@ import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; -@SuppressWarnings("restriction") public class HandledMenuItemCommandSelectionDialog extends AbstractCommandSelectionDialog { private final MHandledItem handler; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java index 44a2a074..fdb375df 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java @@ -20,7 +20,6 @@ import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; -@SuppressWarnings("restriction") public class HandledToolItemCommandSelectionDialog extends AbstractCommandSelectionDialog { private final MHandledItem handler; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java index 2cda1c45..e566e1b1 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java @@ -20,7 +20,6 @@ import org.eclipse.emf.edit.command.SetCommand; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.swt.widgets.Shell; -@SuppressWarnings("restriction") public class HandlerCommandSelectionDialog extends AbstractCommandSelectionDialog { private final MHandler handler; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java index 9743e709..9ba04e58 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/SharedElementsDialog.java @@ -6,14 +6,15 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283 + * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation + * Andrej ten Brummelhuis <andrejbrummelhuis@gmail.com> - Bug 395283 ******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs; import java.util.ArrayList; import java.util.Collections; import java.util.List; + import org.eclipse.e4.tools.emf.ui.common.IModelResource; import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor; import org.eclipse.e4.tools.emf.ui.internal.Messages; @@ -60,12 +61,13 @@ import org.eclipse.swt.widgets.Text; public class SharedElementsDialog extends SaveDialogBoundsSettingsDialog { private TableViewer viewer; - private MPlaceholder placeholder; - private IModelResource resource; - private ModelEditor editor; - private Messages Messages; + private final MPlaceholder placeholder; + private final IModelResource resource; + private final ModelEditor editor; + private final Messages Messages; - public SharedElementsDialog(Shell parentShell, ModelEditor editor, MPlaceholder placeholder, IModelResource resource, Messages Messages) { + public SharedElementsDialog(Shell parentShell, ModelEditor editor, MPlaceholder placeholder, + IModelResource resource, Messages Messages) { super(parentShell); this.editor = editor; this.placeholder = placeholder; @@ -75,20 +77,20 @@ public class SharedElementsDialog extends SaveDialogBoundsSettingsDialog { @Override protected Control createDialogArea(Composite parent) { - Composite comp = (Composite) super.createDialogArea(parent); + final Composite comp = (Composite) super.createDialogArea(parent); getShell().setText(Messages.SharedElementsDialog_ShellTitle); setTitle(Messages.SharedElementsDialog_Title); setMessage(Messages.SharedElementsDialog_Message); - Composite container = new Composite(comp, SWT.NONE); + final Composite container = new Composite(comp, SWT.NONE); container.setLayout(new GridLayout(2, false)); container.setLayoutData(new GridData(GridData.FILL_BOTH)); Label l = new Label(container, SWT.NONE); l.setText(Messages.SharedElementsDialog_Name); - Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); + final Text searchText = new Text(container, SWT.BORDER | SWT.SEARCH | SWT.ICON_SEARCH); searchText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); l = new Label(container, SWT.NONE); @@ -107,14 +109,14 @@ public class SharedElementsDialog extends SaveDialogBoundsSettingsDialog { }); if (resource.getRoot().get(0) instanceof MApplication) { - List<MUIElement> list = new ArrayList<MUIElement>(); - for (MWindow m : ((MApplication) resource.getRoot().get(0)).getChildren()) { + final List<MUIElement> list = new ArrayList<MUIElement>(); + for (final MWindow m : ((MApplication) resource.getRoot().get(0)).getChildren()) { list.addAll(filter(m.getSharedElements())); } viewer.setInput(list); } else if (resource.getRoot().get(0) instanceof MModelFragments) { - List<MApplicationElement> list = new ArrayList<MApplicationElement>(); - for (MModelFragment f : ((MModelFragments) resource.getRoot().get(0)).getFragments()) { + final List<MApplicationElement> list = new ArrayList<MApplicationElement>(); + for (final MModelFragment f : ((MModelFragments) resource.getRoot().get(0)).getFragments()) { if (f instanceof MStringModelFragment) { if (((MStringModelFragment) f).getFeaturename().equals("sharedElements")) { //$NON-NLS-1$ list.addAll(filter(f.getElements())); @@ -123,7 +125,7 @@ public class SharedElementsDialog extends SaveDialogBoundsSettingsDialog { } // NEW IMPLEMENTATION: - for (MApplicationElement f : ((MModelFragments) resource.getRoot().get(0)).getImports()) { + for (final MApplicationElement f : ((MModelFragments) resource.getRoot().get(0)).getImports()) { // let filter() do its job list.addAll(filter(Collections.singletonList(f))); } @@ -146,8 +148,9 @@ public class SharedElementsDialog extends SaveDialogBoundsSettingsDialog { @Override protected void okPressed() { if (!viewer.getSelection().isEmpty()) { - IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); - Command cmd = SetCommand.create(resource.getEditingDomain(), placeholder, AdvancedPackageImpl.Literals.PLACEHOLDER__REF, s.getFirstElement()); + final IStructuredSelection s = (IStructuredSelection) viewer.getSelection(); + final Command cmd = SetCommand.create(resource.getEditingDomain(), placeholder, + AdvancedPackageImpl.Literals.PLACEHOLDER__REF, s.getFirstElement()); if (cmd.canExecute()) { resource.getEditingDomain().getCommandStack().execute(cmd); super.okPressed(); @@ -156,8 +159,8 @@ public class SharedElementsDialog extends SaveDialogBoundsSettingsDialog { } private static <T> List<T> filter(List<T> o) { - List<T> rv = new ArrayList<T>(); - for (T i : o) { + final List<T> rv = new ArrayList<T>(); + for (final T i : o) { if (i instanceof MPart || i instanceof MPartSashContainer || i instanceof MArea || i instanceof MPartStack) { rv.add(i); } @@ -168,15 +171,15 @@ public class SharedElementsDialog extends SaveDialogBoundsSettingsDialog { private class LabelProviderImpl extends StyledCellLabelProvider implements ILabelProvider { @Override public void update(final ViewerCell cell) { - EObject o = (EObject) cell.getElement(); + final EObject o = (EObject) cell.getElement(); - StyledString string = new StyledString(getTypename(o)); + final StyledString string = new StyledString(getTypename(o)); if (o instanceof MUILabel) { string.append(" - " + ((MUILabel) o).getLabel(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ } - MApplicationElement el = (MApplicationElement) o; + final MApplicationElement el = (MApplicationElement) o; string.append(" - " + el.getElementId(), StyledString.DECORATIONS_STYLER); //$NON-NLS-1$ cell.setText(string.getString()); @@ -186,29 +189,28 @@ public class SharedElementsDialog extends SaveDialogBoundsSettingsDialog { @Override public String getText(Object element) { - EObject o = (EObject) element; - MApplicationElement el = (MApplicationElement) o; + final EObject o = (EObject) element; + final MApplicationElement el = (MApplicationElement) o; if (el instanceof MUILabel) { - MUILabel label = (MUILabel) el; + final MUILabel label = (MUILabel) el; return getTypename(o) + " - " + el.getElementId() + " - " + label.getLabel(); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - return getTypename(o) + " - " + el.getElementId() + " - "; //$NON-NLS-1$ //$NON-NLS-2$ } + return getTypename(o) + " - " + el.getElementId() + " - "; //$NON-NLS-1$ //$NON-NLS-2$ } private String getTypename(EObject o) { - AbstractComponentEditor editor = SharedElementsDialog.this.editor.getEditor((o).eClass()); + final AbstractComponentEditor editor = SharedElementsDialog.this.editor.getEditor(o.eClass()); if (editor != null) { return editor.getLabel(o); - } else { - return o.eClass().getName(); } + return o.eClass().getName(); } @Override public Image getImage(Object element) { - AbstractComponentEditor editor = SharedElementsDialog.this.editor.getEditor(((EObject) element).eClass()); + final AbstractComponentEditor editor = SharedElementsDialog.this.editor.getEditor(((EObject) element) + .eClass()); if (editor != null) { return editor.getImage(element, getShell().getDisplay()); } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/ListTab.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/ListTab.java index 268d7342..f81eb4d7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/ListTab.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/ListTab.java @@ -857,9 +857,8 @@ public class ListTab implements IViewEObjects { Color ret; if (isHighlighted(element)) { return ret = tvResults.getTable().getDisplay().getSystemColor(SWT.COLOR_YELLOW); - } else { - ret = super.getBackground(element); } + ret = super.getBackground(element); return ret; } } @@ -937,22 +936,19 @@ public class ListTab implements IViewEObjects { case EXCLUDE: if (E.isEmpty(EmfUtil.getAttributeValue((EObject) element, filterByAttrName))) { return false; - } else { - return filtered.contains(element); } + return filtered.contains(element); case ONLY: if (E.notEmpty(EmfUtil.getAttributeValue((EObject) element, filterByAttrName))) { return false; - } else { - return true; } + return true; default: case INCLUDE: if (E.isEmpty(EmfUtil.getAttributeValue((EObject) element, filterByAttrName))) { return true; - } else { - return filtered.contains(element); } + return filtered.contains(element); } } }; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/TableViewerUtil.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/TableViewerUtil.java index 728cf3fb..1440b060 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/TableViewerUtil.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/TableViewerUtil.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, ongoing maintenance + * Steven Spungin <steven@spungin.tv> - initial API and implementation, ongoing maintenance *******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs; @@ -15,6 +15,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; + import org.eclipse.jface.viewers.ColumnLabelProvider; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; @@ -40,8 +41,9 @@ public class TableViewerUtil { @Override public int compare(Viewer viewer, Object e1, Object e2) { - TableViewer tableViewer = (TableViewer) viewer; - ColumnLabelProvider labelProvider = (ColumnLabelProvider) tableViewer.getLabelProvider(Arrays.asList(tableViewer.getTable().getColumns()).indexOf(col)); + final TableViewer tableViewer = (TableViewer) viewer; + final ColumnLabelProvider labelProvider = (ColumnLabelProvider) tableViewer.getLabelProvider(Arrays.asList( + tableViewer.getTable().getColumns()).indexOf(col)); return labelProvider.getText(e1).compareTo(labelProvider.getText(e2)); } } @@ -60,7 +62,7 @@ public class TableViewerUtil { @Override public int compare(Viewer viewer, Object e1, Object e2) { - return (-1) * AbstractInvertableTableSorter.this.compare(viewer, e1, e2); + return -1 * AbstractInvertableTableSorter.this.compare(viewer, e1, e2); } @Override @@ -110,12 +112,13 @@ public class TableViewerUtil { * column is reselected. If false, the listener will use the * default sorting direction */ - public TableSortSelectionListener(TableViewer viewer, TableColumn column, AbstractInvertableTableSorter sorter, int defaultDirection, boolean keepDirection) { + public TableSortSelectionListener(TableViewer viewer, TableColumn column, AbstractInvertableTableSorter sorter, + int defaultDirection, boolean keepDirection) { this.viewer = viewer; this.column = column; this.keepDirection = keepDirection; - this.sorter = (defaultDirection == SWT.UP) ? sorter : sorter.getInverseSorter(); - this.currentSorter = this.sorter; + this.sorter = defaultDirection == SWT.UP ? sorter : sorter.getInverseSorter(); + currentSorter = this.sorter; this.column.addSelectionListener(this); } @@ -165,11 +168,11 @@ public class TableViewerUtil { public static boolean isColumnClicked(TableViewer viewer, MouseEvent e, TableViewerColumn tvColumn) { boolean ret; - ViewerCell cell = viewer.getCell(new Point(e.x, e.y)); + final ViewerCell cell = viewer.getCell(new Point(e.x, e.y)); if (cell == null) { ret = false; } else { - int index = Arrays.asList(viewer.getTable().getColumns()).indexOf(tvColumn.getColumn()); + final int index = Arrays.asList(viewer.getTable().getColumns()).indexOf(tvColumn.getColumn()); if (index == -1) { ret = false; } else { @@ -180,22 +183,21 @@ public class TableViewerUtil { } public static Object getData(TableViewer viewer, MouseEvent e) { - ViewerCell cell = viewer.getCell(new Point(e.x, e.y)); + final ViewerCell cell = viewer.getCell(new Point(e.x, e.y)); if (cell == null) { return null; - } else { - return cell.getElement(); } + return cell.getElement(); } public static void packAllColumns(TableViewer viewer) { - for (TableColumn col : viewer.getTable().getColumns()) { + for (final TableColumn col : viewer.getTable().getColumns()) { col.pack(); } } static public void resetColumnOrder(TableViewer tvResults) { - int[] order = tvResults.getTable().getColumnOrder(); + final int[] order = tvResults.getTable().getColumnOrder(); for (int i = 0; i < order.length; i++) { order[i] = i; } @@ -216,11 +218,10 @@ public class TableViewerUtil { } static public int getVisibleColumnIndex(TableViewer tvResults2, TableColumn col) { - int createOrder = Arrays.asList(tvResults2.getTable().getColumns()).indexOf(col); + final int createOrder = Arrays.asList(tvResults2.getTable().getColumns()).indexOf(col); if (createOrder == -1) { return -1; - } else { - return tvResults2.getTable().getColumnOrder()[createOrder]; } + return tvResults2.getTable().getColumnOrder()[createOrder]; } }
\ No newline at end of file diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/XmiTab.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/XmiTab.java index f5698606..7887ffc4 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/XmiTab.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/XmiTab.java @@ -7,13 +7,14 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 391089, Bug 437543, Ongoing Maintenance + * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 391089, Bug 437543, Ongoing Maintenance *******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs; import javax.annotation.PostConstruct; import javax.inject.Inject; + import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.e4.core.contexts.IEclipseContext; @@ -96,8 +97,8 @@ public class XmiTab extends Composite { }); final AnnotationModel model = new AnnotationModel(); - VerticalRuler verticalRuler = new VerticalRuler(VERTICAL_RULER_WIDTH, new AnnotationAccess(resourcePool)); - int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION; + final VerticalRuler verticalRuler = new VerticalRuler(VERTICAL_RULER_WIDTH, new AnnotationAccess(resourcePool)); + final int styles = SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION; sourceViewer = new SourceViewer(this, verticalRuler, styles); sourceViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); @@ -106,7 +107,8 @@ public class XmiTab extends Composite { sourceViewer.getTextWidget().setFont(JFaceResources.getTextFont()); final IDocument document = emfDocumentProvider.getDocument(); - IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(), new String[] { XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT }); + final IDocumentPartitioner partitioner = new FastPartitioner(new XMLPartitionScanner(), new String[] { + XMLPartitionScanner.XML_TAG, XMLPartitionScanner.XML_COMMENT }); partitioner.connect(document); document.setDocumentPartitioner(partitioner); sourceViewer.setDocument(document); @@ -118,13 +120,13 @@ public class XmiTab extends Composite { public void run() { model.removeAllAnnotations(); - for (Diagnostic d : emfDocumentProvider.getErrorList()) { - Annotation a = new Annotation("e4xmi.error", false, d.getMessage()); //$NON-NLS-1$ + for (final Diagnostic d : emfDocumentProvider.getErrorList()) { + final Annotation a = new Annotation("e4xmi.error", false, d.getMessage()); //$NON-NLS-1$ int l; try { l = document.getLineOffset(d.getLine() - 1); model.addAnnotation(a, new Position(l)); - } catch (BadLocationException e) { + } catch (final BadLocationException e) { // TODO Auto-generated catch block e.printStackTrace(); } @@ -132,7 +134,8 @@ public class XmiTab extends Composite { } }); - String property = System.getProperty(ORG_ECLIPSE_E4_TOOLS_MODELEDITOR_FILTEREDTREE_ENABLED_XMITAB_DISABLED); + final String property = System + .getProperty(ORG_ECLIPSE_E4_TOOLS_MODELEDITOR_FILTEREDTREE_ENABLED_XMITAB_DISABLED); if (property != null || preferences.getBoolean("tab-form-search-show", false)) { //$NON-NLS-1$ sourceViewer.setEditable(false); sourceViewer.getTextWidget().setEnabled(false); @@ -156,11 +159,10 @@ public class XmiTab extends Composite { if (region != null) { sourceViewer.setSelection(new TextSelection(region.getOffset(), region.getLength()), true); return region.getOffset() + region.getLength(); - } else { - sourceViewer.setSelection(new TextSelection(0, 0), true); - return -1; } - } catch (Exception e) { + sourceViewer.setSelection(new TextSelection(0, 0), true); + return -1; + } catch (final Exception e) { e.printStackTrace(); return -1; } @@ -172,7 +174,7 @@ public class XmiTab extends Composite { public void gotoEObject(EObject object) { // select the entire start tag - IRegion region = emfDocumentProvider.findStartTag(object); + final IRegion region = emfDocumentProvider.findStartTag(object); if (region != null) { sourceViewer.setSelection(new TextSelection(region.getOffset(), region.getLength()), true); } else { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/TargetPlatformContributionCollector.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/TargetPlatformContributionCollector.java index e18e2b53..b6b17902 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/TargetPlatformContributionCollector.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/TargetPlatformContributionCollector.java @@ -6,8 +6,9 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730, Bug 435625, Bug 436133, Bug 436132, Bug 436283, Bug 436281, Bug 443510 - * Fabian Miehe - Bug 440327 + * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730, Bug 435625, Bug 436133, Bug 436132, + * Bug 436283, Bug 436281, Bug 443510 + * Fabian Miehe - Bug 440327 *******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator; @@ -31,10 +32,12 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; + import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathFactory; + import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.runtime.IPath; @@ -112,7 +115,7 @@ public abstract class TargetPlatformContributionCollector extends ClassContribut @Override public void findContribution(Filter filter, ContributionResultHandler handler) { - Pattern patternName = Pattern.compile(filter.namePattern, Pattern.CASE_INSENSITIVE); + final Pattern patternName = Pattern.compile(filter.namePattern, Pattern.CASE_INSENSITIVE); reloadCache(false, filter.getProviderStatusCallback()); @@ -125,18 +128,18 @@ public abstract class TargetPlatformContributionCollector extends ClassContribut boolean more = false; stopFiltering = false; - for (Entry e : cacheEntry) { + for (final Entry e : cacheEntry) { if (stopFiltering) { break; } - IProgressMonitor monitor = filter.getProgressMonitor(); + final IProgressMonitor monitor = filter.getProgressMonitor(); if (monitor != null) { if (monitor.isCanceled()) { stopFiltering = true; break; - } else { - monitor.subTask(Messages.TargetPlatformContributionCollector_Searching + " " + e.installLocation); //$NON-NLS-1$ } + monitor.subTask(Messages.TargetPlatformContributionCollector_Searching + + " " + e.installLocation); //$NON-NLS-1$ } if (E.notEmpty(filter.getBundles())) { @@ -151,7 +154,7 @@ public abstract class TargetPlatformContributionCollector extends ClassContribut } if (E.notEmpty(filter.getLocations())) { boolean locationFound = false; - for (String location : filter.getLocations()) { + for (final String location : filter.getLocations()) { if (e.installLocation.startsWith(location)) { locationFound = true; break; @@ -168,12 +171,12 @@ public abstract class TargetPlatformContributionCollector extends ClassContribut } if (filter.getSearchScope().contains(ResourceSearchScope.WORKSPACE)) { if (filter.project != null) { - IWorkspace workspace = filter.project.getWorkspace(); + final IWorkspace workspace = filter.project.getWorkspace(); boolean fnd = false; - for (IProject project : workspace.getRoot().getProjects()) { + for (final IProject project : workspace.getRoot().getProjects()) { // String path = // project.getLocationURI().getPath(); - String path = project.getName(); + final String path = project.getName(); if (e.installLocation.contains(path)) { fnd = true; break; @@ -185,16 +188,15 @@ public abstract class TargetPlatformContributionCollector extends ClassContribut } } - Matcher m = patternName.matcher(e.name); + final Matcher m = patternName.matcher(e.name); if (m.find()) { found++; if (found > maxResults) { more = true; handler.moreResults(ContributionResultHandler.MORE_UNKNOWN, filter); break; - } else { - handler.result(makeData(e)); } + handler.result(makeData(e)); } } @@ -234,8 +236,8 @@ public abstract class TargetPlatformContributionCollector extends ClassContribut IPath ip = Path.fromOSString(e.path); ip = ip.addTrailingSeparator().makeRelative(); ip = ip.append(e.name); - String className = ip.toOSString().replace(File.separatorChar, '.'); - ContributionData data = new ContributionData(e.bundleSymName, className, "Java", e.installLocation); //$NON-NLS-1$ + final String className = ip.toOSString().replace(File.separatorChar, '.'); + final ContributionData data = new ContributionData(e.bundleSymName, className, "Java", e.installLocation); //$NON-NLS-1$ data.installLocation = e.installLocation; data.resourceRelativePath = e.relativePath; return data; @@ -292,95 +294,97 @@ public abstract class TargetPlatformContributionCollector extends ClassContribut @Override protected IStatus run(IProgressMonitor monitor) { // load workspace projects - IProject[] projects = PDECore.getWorkspace().getRoot().getProjects(); - IPluginModelBase[] models = TargetPlatformHelper.getPDEState().getTargetModels(); - int total = projects.length + models.length; - monitor.beginTask(Messages.TargetPlatformContributionCollector_updatingTargetPlatformCache + cacheName + ")", total); //$NON-NLS-1$ + final IProject[] projects = PDECore.getWorkspace().getRoot().getProjects(); + final IPluginModelBase[] models = TargetPlatformHelper.getPDEState().getTargetModels(); + final int total = projects.length + models.length; + monitor.beginTask(Messages.TargetPlatformContributionCollector_updatingTargetPlatformCache + + cacheName + ")", total); //$NON-NLS-1$ for (final IProject pj : projects) { if (monitor.isCanceled()) { break; } - String rootDirectory = pj.getLocation().toOSString(); + final String rootDirectory = pj.getLocation().toOSString(); monitor.subTask(rootDirectory); monitor.worked(1); - TargetPlatformContributionCollector.this.visit(monitor, FilteredContributionDialog.getBundle(rootDirectory), rootDirectory, new File(rootDirectory)); + TargetPlatformContributionCollector.this + .visit(monitor, FilteredContributionDialog.getBundle(rootDirectory), rootDirectory, + new File(rootDirectory)); } // load target platform bundles - for (IPluginModelBase pluginModelBase : models) { + for (final IPluginModelBase pluginModelBase : models) { monitor.subTask(pluginModelBase.getPluginBase().getId()); monitor.worked(1); if (monitor.isCanceled()) { break; } - IPluginBase pluginBase = pluginModelBase.getPluginBase(); + final IPluginBase pluginBase = pluginModelBase.getPluginBase(); if (pluginBase == null) { // bundle = getBundle(new File()) continue; } URL url; try { - String installLocation = pluginModelBase.getInstallLocation(); + final String installLocation = pluginModelBase.getInstallLocation(); if (installLocation.endsWith(".jar")) { //$NON-NLS-1$ url = new URL("file://" + installLocation); //$NON-NLS-1$ - ZipInputStream zis = new ZipInputStream(url.openStream()); + final ZipInputStream zis = new ZipInputStream(url.openStream()); while (true) { - ZipEntry entry = zis.getNextEntry(); + final ZipEntry entry = zis.getNextEntry(); if (entry == null) { break; - } else { - String name2 = entry.getName(); - if (shouldIgnore(name2)) { - continue; - } - Matcher m = patternFile.matcher(name2); - if (m.matches()) { - Entry e = new Entry(); - e.installLocation = installLocation; - cacheLocation.add(installLocation); - e.name = m.group(2); - e.path = m.group(1); - if (e.path != null) { - e.pakage = e.path.replace("/", "."); //$NON-NLS-1$ //$NON-NLS-2$ - if (e.pakage.startsWith(".")) { //$NON-NLS-1$ - e.pakage = e.pakage.substring(1); - } - if (e.pakage.endsWith(".")) { //$NON-NLS-1$ - e.pakage = e.pakage.substring(0, e.pakage.length() - 1); - } - } else { - e.pakage = ""; //$NON-NLS-1$ + } + final String name2 = entry.getName(); + if (shouldIgnore(name2)) { + continue; + } + final Matcher m = patternFile.matcher(name2); + if (m.matches()) { + final Entry e = new Entry(); + e.installLocation = installLocation; + cacheLocation.add(installLocation); + e.name = m.group(2); + e.path = m.group(1); + if (e.path != null) { + e.pakage = e.path.replace("/", "."); //$NON-NLS-1$ //$NON-NLS-2$ + if (e.pakage.startsWith(".")) { //$NON-NLS-1$ + e.pakage = e.pakage.substring(1); } - cachePackage.add(e.pakage); - - e.bundleSymName = pluginBase.getId(); - if (e.path == null) { - e.path = ""; //$NON-NLS-1$ + if (e.pakage.endsWith(".")) { //$NON-NLS-1$ + e.pakage = e.pakage.substring(0, e.pakage.length() - 1); } - cacheEntry.add(e); - cacheBundleId.add(pluginBase.getId()); - - // - // System.out.println(group - // + " -> " - // + - // m.group(2)); + } else { + e.pakage = ""; //$NON-NLS-1$ } + cachePackage.add(e.pakage); + + e.bundleSymName = pluginBase.getId(); + if (e.path == null) { + e.path = ""; //$NON-NLS-1$ + } + cacheEntry.add(e); + cacheBundleId.add(pluginBase.getId()); + + // + // System.out.println(group + // + " -> " + // + + // m.group(2)); } } } else { // not a jar file - String bundle = getBundle(new File(installLocation)); + final String bundle = getBundle(new File(installLocation)); if (bundle != null) { visit(monitor, bundle, installLocation, new File(installLocation)); } } - } catch (MalformedURLException e) { + } catch (final MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); - } catch (IOException e) { + } catch (final IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } @@ -391,12 +395,11 @@ public abstract class TargetPlatformContributionCollector extends ClassContribut providerStatusCallback.onStatusChanged(ProviderStatus.CANCELLED); } return Status.CANCEL_STATUS; - } else { - if (providerStatusCallback != null) { - providerStatusCallback.onStatusChanged(ProviderStatus.READY); - } - return Status.OK_STATUS; } + if (providerStatusCallback != null) { + providerStatusCallback.onStatusChanged(ProviderStatus.READY); + } + return Status.OK_STATUS; } }; job.schedule(); @@ -409,13 +412,13 @@ public abstract class TargetPlatformContributionCollector extends ClassContribut @Override public void run() { - ProgressMonitorDialog dlg = new ProgressMonitorDialog(Display.getDefault().getActiveShell()) { + final ProgressMonitorDialog dlg = new ProgressMonitorDialog(Display.getDefault().getActiveShell()) { @Override protected Control createContents(Composite parent) { // TODO odd this is not a bean. - Composite ret = (Composite) super.createContents(parent); - Label label = new Label(ret, SWT.NONE); + final Composite ret = (Composite) super.createContents(parent); + final Label label = new Label(ret, SWT.NONE); label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 2, 1)); label.setText(Messages.TargetPlatformContributionCollector_pleaseWait); @@ -424,7 +427,8 @@ public abstract class TargetPlatformContributionCollector extends ClassContribut @Override protected void createButtonsForButtonBar(Composite parent) { - Button button = createButton(parent, 101, Messages.TargetPlatformContributionCollector_RunInBackground, false); + final Button button = createButton(parent, 101, + Messages.TargetPlatformContributionCollector_RunInBackground, false); // TODO JA button.addSelectionListener(new SelectionAdapter() { @Override @@ -449,18 +453,22 @@ public abstract class TargetPlatformContributionCollector extends ClassContribut dlg.run(true, true, new IRunnableWithProgress() { @Override - public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - monitor.beginTask(Messages.TargetPlatformContributionCollector_WaitingForTargetPlatformIndexingToComplete, IProgressMonitor.UNKNOWN); + public void run(final IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + monitor + .beginTask( + Messages.TargetPlatformContributionCollector_WaitingForTargetPlatformIndexingToComplete, + IProgressMonitor.UNKNOWN); while (job.getState() == Job.RUNNING && !runInBackground) { Thread.sleep(100); } monitor.done(); } }); - } catch (InvocationTargetException e1) { + } catch (final InvocationTargetException e1) { // TODO Auto-generated catch block e1.printStackTrace(); - } catch (InterruptedException e1) { + } catch (final InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } @@ -476,17 +484,17 @@ public abstract class TargetPlatformContributionCollector extends ClassContribut return null; } - File f = new File(file, "META-INF/MANIFEST.MF"); //$NON-NLS-1$ + final File f = new File(file, "META-INF/MANIFEST.MF"); //$NON-NLS-1$ if (f.exists() && f.isFile()) { BufferedReader r = null; try { - InputStream s = new FileInputStream(f); + final InputStream s = new FileInputStream(f); r = new BufferedReader(new InputStreamReader(s)); String line; while ((line = r.readLine()) != null) { if (line.startsWith("Bundle-SymbolicName:")) { //$NON-NLS-1$ - int start = line.indexOf(':'); + final int start = line.indexOf(':'); int end = line.indexOf(';'); if (end == -1) { end = line.length(); @@ -494,13 +502,13 @@ public abstract class TargetPlatformContributionCollector extends ClassContribut return line.substring(start + 1, end).trim(); } } - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } finally { if (r != null) { try { r.close(); - } catch (IOException e) { + } catch (final IOException e) { } } } @@ -509,7 +517,7 @@ public abstract class TargetPlatformContributionCollector extends ClassContribut } protected void visit(IProgressMonitor monitor, String bundleName, String installLocation, File file) { - for (File fChild : file.listFiles()) { + for (final File fChild : file.listFiles()) { if (monitor.isCanceled()) { break; } @@ -521,9 +529,9 @@ public abstract class TargetPlatformContributionCollector extends ClassContribut if (shouldIgnore(name2)) { continue; } - Matcher m = patternFile.matcher(name2); + final Matcher m = patternFile.matcher(name2); if (m.matches()) { - Entry e = new Entry(); + final Entry e = new Entry(); e.installLocation = installLocation; cacheLocation.add(installLocation); e.name = m.group(2); @@ -545,7 +553,8 @@ public abstract class TargetPlatformContributionCollector extends ClassContribut if (e.path == null) { e.path = ""; //$NON-NLS-1$ } - e.relativePath = Path.fromOSString(file.getAbsolutePath().replace(e.installLocation, "")).makeRelative().toOSString(); //$NON-NLS-1$ + e.relativePath = Path + .fromOSString(file.getAbsolutePath().replace(e.installLocation, "")).makeRelative().toOSString(); //$NON-NLS-1$ e.bundleSymName = bundleName; // TODO we need project to strip source paths. @@ -565,7 +574,7 @@ public abstract class TargetPlatformContributionCollector extends ClassContribut if (installLocation.matches(".*\\.jar")) { //$NON-NLS-1$ return path; } - for (String sourceDirectory : getOutputDirectories(installLocation)) { + for (final String sourceDirectory : getOutputDirectories(installLocation)) { if (path.startsWith(sourceDirectory)) { path = path.substring(sourceDirectory.length()); break; @@ -589,14 +598,16 @@ public abstract class TargetPlatformContributionCollector extends ClassContribut ret = new ArrayList<String>(); outputDirectories.put(installLocation, ret); try { - Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new File(installLocation + File.separator + ".classpath")); //$NON-NLS-1$ - XPath xp = XPathFactory.newInstance().newXPath(); - NodeList list = (NodeList) xp.evaluate("//classpathentry[@kind='output']/@path", doc, XPathConstants.NODESET); //$NON-NLS-1$ + final Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder() + .parse(new File(installLocation + File.separator + ".classpath")); //$NON-NLS-1$ + final XPath xp = XPathFactory.newInstance().newXPath(); + final NodeList list = (NodeList) xp.evaluate( + "//classpathentry[@kind='output']/@path", doc, XPathConstants.NODESET); //$NON-NLS-1$ for (int i = 0; i < list.getLength(); i++) { - String value = list.item(i).getNodeValue(); + final String value = list.item(i).getNodeValue(); ret.add(value); } - } catch (Exception e) { + } catch (final Exception e) { } } return ret; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/TargetPlatformIconContributionCollector.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/TargetPlatformIconContributionCollector.java index 56eeb909..b50ff3b7 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/TargetPlatformIconContributionCollector.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/TargetPlatformIconContributionCollector.java @@ -6,12 +6,13 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730 + * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730 *******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator; import java.util.regex.Pattern; + import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionData; /** @@ -32,7 +33,8 @@ public class TargetPlatformIconContributionCollector extends TargetPlatformContr static public TargetPlatformIconContributionCollector getInstance() { if (instance == null) { - instance = new TargetPlatformIconContributionCollector(Messages.TargetPlatformIconContributionCollector_images); + instance = new TargetPlatformIconContributionCollector( + Messages.TargetPlatformIconContributionCollector_images); } return instance; } @@ -40,11 +42,11 @@ public class TargetPlatformIconContributionCollector extends TargetPlatformContr @Override protected Pattern getFilePattern() { return pattern; - }; + } @Override protected ContributionData makeData(Entry e) { - ContributionData data = new ContributionData(e.bundleSymName, null, "Java", e.path + e.name); //$NON-NLS-1$ + final ContributionData data = new ContributionData(e.bundleSymName, null, "Java", e.path + e.name); //$NON-NLS-1$ data.installLocation = e.installLocation; data.resourceRelativePath = data.iconPath; return data; diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/DynamicWizard.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/DynamicWizard.java index 1be8e4f3..467b7668 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/DynamicWizard.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/DynamicWizard.java @@ -6,12 +6,13 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation + * Steven Spungin <steven@spungin.tv> - initial API and implementation *******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; import java.util.ArrayList; + import org.eclipse.e4.tools.emf.ui.internal.common.component.tabs.empty.E; import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.jface.wizard.Wizard; @@ -41,11 +42,11 @@ public class DynamicWizard extends Wizard { @Override public boolean canFinish() { - IWizardPage cur = getContainer().getCurrentPage(); - IWizardPage nextPage = getNextPage(cur); + final IWizardPage cur = getContainer().getCurrentPage(); + final IWizardPage nextPage = getNextPage(cur); // We need to call get next page first, as that may add or remove pages - for (IWizardPage page : pages) { + for (final IWizardPage page : pages) { if (page.isPageComplete() == false) { return false; } @@ -74,9 +75,9 @@ public class DynamicWizard extends Wizard { private void updateMessage() { if (E.notEmpty(message) && pages.size() > 0) { // TODO file bug: IWizardPage is missing the setMessage method! - IWizardPage page = pages.get(0); + final IWizardPage page = pages.get(0); if (page instanceof WizardPage) { - WizardPage wizPage = (WizardPage) page; + final WizardPage wizPage = (WizardPage) page; wizPage.setMessage(message); } } @@ -84,23 +85,21 @@ public class DynamicWizard extends Wizard { @Override public IWizardPage getPreviousPage(IWizardPage page) { - IWizardPage cur = getContainer().getCurrentPage(); - int index = pages.indexOf(cur); + final IWizardPage cur = getContainer().getCurrentPage(); + final int index = pages.indexOf(cur); if (index > 0) { return pages.get(index - 1); - } else { - return null; } + return null; } @Override public IWizardPage getNextPage(IWizardPage page) { - int index = pages.indexOf(page); + final int index = pages.indexOf(page); if (index < pages.size() - 1) { return pages.get(index + 1); - } else { - return null; } + return null; } public void clearDynamicPages() { diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedActionPage.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedActionPage.java index d1a55456..f84d3e03 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedActionPage.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedActionPage.java @@ -197,7 +197,7 @@ public class NonReferencedActionPage extends WizardPage { final Text label6 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); label6.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); label6 - .setText("platform:/plugin/" + bundle + "/" + file.getFullPath().removeFirstSegments(1).toOSString()); //$NON-NLS-1$ //$NON-NLS-2$ + .setText("platform:/plugin/" + bundle + "/" + file.getFullPath().removeFirstSegments(1).toOSString()); //$NON-NLS-1$ //$NON-NLS-2$ } } @@ -495,9 +495,8 @@ public class NonReferencedActionPage extends WizardPage { final int index = className.lastIndexOf('.'); if (index >= 0) { return className.substring(0, index); - } else { - return ""; //$NON-NLS-1$ } + return ""; //$NON-NLS-1$ } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedResourceDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedResourceDialog.java index 410ed63d..969c9260 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedResourceDialog.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedResourceDialog.java @@ -6,13 +6,11 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730, Ongoing Maintenance + * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 424730, Ongoing Maintenance *******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; -import org.eclipse.e4.tools.emf.ui.common.Plugin; - import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -21,6 +19,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.jar.Manifest; import java.util.zip.ZipFile; + import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; @@ -28,6 +27,7 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.tools.emf.ui.common.IClassContributionProvider.ContributionData; +import org.eclipse.e4.tools.emf.ui.common.Plugin; import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.BundleImageCache; import org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs.ContributionDataFile; @@ -58,14 +58,15 @@ public class NonReferencedResourceDialog extends TitleAreaDialog { private String bundle; private final IFile file; private IFile result; - private IProject project; + private final IProject project; private String className; - private String installLocation; + private final String installLocation; protected Runnable okAction; private BundleImageCache imageCache; - private IEclipseContext context; + private final IEclipseContext context; - public NonReferencedResourceDialog(Shell parentShell, IProject project, String bundle, IFile file, String installLocation, IEclipseContext context) { + public NonReferencedResourceDialog(Shell parentShell, IProject project, String bundle, IFile file, + String installLocation, IEclipseContext context) { super(parentShell); this.project = project; this.bundle = bundle; @@ -77,8 +78,8 @@ public class NonReferencedResourceDialog extends TitleAreaDialog { this.bundle = FilteredContributionDialog.getBundle(installLocation); } if (file instanceof ContributionDataFile) { - ContributionDataFile cdf = (ContributionDataFile) file; - this.className = cdf.getContributionData().className; + final ContributionDataFile cdf = (ContributionDataFile) file; + className = cdf.getContributionData().className; } } @@ -88,7 +89,7 @@ public class NonReferencedResourceDialog extends TitleAreaDialog { try { okAction.run(); super.okPressed(); - } catch (Exception e) { + } catch (final Exception e) { } } else { super.okPressed(); @@ -97,34 +98,34 @@ public class NonReferencedResourceDialog extends TitleAreaDialog { @Override protected Control createDialogArea(Composite parent) { - Composite compParent = (Composite) super.createDialogArea(parent); + final Composite compParent = (Composite) super.createDialogArea(parent); - Composite comp = new Composite(compParent, SWT.NONE); - GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true); + final Composite comp = new Composite(compParent, SWT.NONE); + final GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true); layoutData.horizontalSpan = 2; comp.setLayoutData(layoutData); comp.setLayout(new GridLayout(2, false)); - String message = ""; //$NON-NLS-1$ + final String message = ""; //$NON-NLS-1$ Button defaultButton = null; if (installLocation != null) { - Label label = new Label(comp, SWT.NONE); + final Label label = new Label(comp, SWT.NONE); label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); label.setText(Messages.NonReferencedResourceDialog_installLocation); - Text label2 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); + final Text label2 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); label2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); label2.setText(installLocation); } if (className != null) { - ContributionData cd = ((ContributionDataFile) file).getContributionData(); - Label label = new Label(comp, SWT.NONE); + final ContributionData cd = ((ContributionDataFile) file).getContributionData(); + final Label label = new Label(comp, SWT.NONE); label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); label.setText(Messages.NonReferencedResourceDialog_2); - Text label2 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); + final Text label2 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); label2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); if (bundle != null) { label2.setText(bundle); @@ -132,37 +133,37 @@ public class NonReferencedResourceDialog extends TitleAreaDialog { label2.setText(Messages.NonReferencedResourceDialog__ast_notInABundle_ast); } - Label label3 = new Label(comp, SWT.NONE); + final Label label3 = new Label(comp, SWT.NONE); label3.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); label3.setText(Messages.NonReferencedResourceDialog_package); - Text label4 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); + final Text label4 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); label4.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); label4.setText(getPackageFromClassName(className)); - Label label5 = new Label(comp, SWT.NONE); + final Label label5 = new Label(comp, SWT.NONE); label5.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); label5.setText(Messages.NonReferencedResourceDialog_class); - Text label6 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); + final Text label6 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); label6.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); label6.setText(cd.className.substring(cd.className.lastIndexOf('.') + 1)); if (bundle != null) { - Label label7 = new Label(comp, SWT.NONE); + final Label label7 = new Label(comp, SWT.NONE); label7.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); label7.setText(Messages.NonReferencedResourceDialog_url); - Text label8 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); + final Text label8 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); label8.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); label8.setText("bundleclass://" + bundle + "/" + className); //$NON-NLS-1$ //$NON-NLS-2$ } } else { - Label label = new Label(comp, SWT.NONE); + final Label label = new Label(comp, SWT.NONE); label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); label.setText(Messages.NonReferencedResourceDialog_bundle); - Text label2 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); + final Text label2 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); label2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); if (bundle != null) { label2.setText(bundle); @@ -170,38 +171,39 @@ public class NonReferencedResourceDialog extends TitleAreaDialog { label2.setText(Messages.NonReferencedResourceDialog_ast_notInABundle_ast); } - Label label7 = new Label(comp, SWT.NONE); + final Label label7 = new Label(comp, SWT.NONE); label7.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); label7.setText(Messages.NonReferencedResourceDialog_directory); - Text label8 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); + final Text label8 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); label8.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); label8.setText(file.getFullPath().removeFirstSegments(1).removeLastSegments(1).toOSString()); - Label label3 = new Label(comp, SWT.NONE); + final Label label3 = new Label(comp, SWT.NONE); label3.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); label3.setText(Messages.NonReferencedResourceDialog_resource); - Text label4 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); + final Text label4 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); label4.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); label4.setText(file.getFullPath().lastSegment()); if (bundle != null) { - Label label5 = new Label(comp, SWT.NONE); + final Label label5 = new Label(comp, SWT.NONE); label5.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); label5.setText(Messages.NonReferencedResourceDialog_url); - Text label6 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); + final Text label6 = new Text(comp, SWT.SINGLE | SWT.LEAD | SWT.READ_ONLY); label6.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); - label6.setText("platform:/plugin/" + bundle + "/" + file.getFullPath().removeFirstSegments(1).toOSString()); //$NON-NLS-1$ //$NON-NLS-2$ + label6 + .setText("platform:/plugin/" + bundle + "/" + file.getFullPath().removeFirstSegments(1).toOSString()); //$NON-NLS-1$ //$NON-NLS-2$ } } - Label lblMessage = new Label(comp, SWT.NONE); + final Label lblMessage = new Label(comp, SWT.NONE); lblMessage.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 0)); lblMessage.setText(message); - Group group = new Group(comp, SWT.NONE); + final Group group = new Group(comp, SWT.NONE); group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 0)); group.setLayout(new GridLayout(1, false)); group.setText(Messages.NonReferencedResourceDialog_Action); @@ -241,13 +243,13 @@ public class NonReferencedResourceDialog extends TitleAreaDialog { okAction = new Runnable() { @Override public void run() { - IFile fileManifest = project.getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$ + final IFile fileManifest = project.getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$ Manifest manifest; try { manifest = new Manifest(fileManifest.getContents()); String value = manifest.getMainAttributes().getValue("Import-Package"); //$NON-NLS-1$ - String packageName = getPackageFromClassName(className); + final String packageName = getPackageFromClassName(className); // TODO ensure the packageName is not // already in the manifest (although it // should not be if we are here) @@ -257,12 +259,12 @@ public class NonReferencedResourceDialog extends TitleAreaDialog { value += "," + packageName; //$NON-NLS-1$ } manifest.getMainAttributes().putValue("Import-Package", value); //$NON-NLS-1$ - ByteArrayOutputStream bos = new ByteArrayOutputStream(); + final ByteArrayOutputStream bos = new ByteArrayOutputStream(); manifest.write(bos); - ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); + final ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); fileManifest.setContents(bis, true, true, null); result = file; - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -304,18 +306,24 @@ public class NonReferencedResourceDialog extends TitleAreaDialog { public void run() { String bundleId; try { - ContributionData contributionData = cdf.getContributionData(); - bundleId = BundleConverter.convertProjectToBundle(contributionData.installLocation, project.getWorkspace()); + final ContributionData contributionData = cdf.getContributionData(); + bundleId = BundleConverter.convertProjectToBundle( + contributionData.installLocation, project.getWorkspace()); if (bundleId != null) { - ContributionData cdConverted = new ContributionData(bundleId, contributionData.className, contributionData.sourceType, contributionData.iconPath); + final ContributionData cdConverted = new ContributionData(bundleId, + contributionData.className, contributionData.sourceType, + contributionData.iconPath); cdConverted.installLocation = installLocation; - cdConverted.resourceRelativePath = Path.fromOSString(contributionData.iconPath).removeFirstSegments(1).toOSString(); + cdConverted.resourceRelativePath = Path + .fromOSString(contributionData.iconPath).removeFirstSegments(1) + .toOSString(); doRequireBundle(bundleId, installLocation); result = new ContributionDataFile(cdConverted); } - } catch (Exception e1) { - MessageDialog.openError(getShell(), Messages.NonReferencedResourceDialog_error, e1.getMessage()); + } catch (final Exception e1) { + MessageDialog.openError(getShell(), Messages.NonReferencedResourceDialog_error, + e1.getMessage()); } } }; @@ -360,10 +368,11 @@ public class NonReferencedResourceDialog extends TitleAreaDialog { @Override public void run() { - ReferencedProjectPickerDialog dlg = new ReferencedProjectPickerDialog(getShell(), project) { + final ReferencedProjectPickerDialog dlg = new ReferencedProjectPickerDialog(getShell(), + project) { @Override protected Control createContents(Composite parent) { - Control ret = super.createContents(parent); + final Control ret = super.createContents(parent); setMessage(Messages.NonReferencedResourceDialog_selectProjectToReceiveCopy); setTitleImage(imageCache.create("/icons/full/wizban/plugin_wiz.gif")); //$NON-NLS-1$ @@ -389,12 +398,11 @@ public class NonReferencedResourceDialog extends TitleAreaDialog { // @Refactor static public String getPackageFromClassName(String className) { - int index = className.lastIndexOf('.'); + final int index = className.lastIndexOf('.'); if (index >= 0) { return className.substring(0, index); - } else { - return ""; //$NON-NLS-1$ } + return ""; //$NON-NLS-1$ } @Override @@ -408,15 +416,15 @@ public class NonReferencedResourceDialog extends TitleAreaDialog { } }); - Control ret = super.createContents(parent); + final Control ret = super.createContents(parent); setMessage(Messages.NonReferencedResourceDialog_resourceNotReferenced); - String message = getMessage(); + final String message = getMessage(); setMessage(message); setTitle(Messages.NonReferencedResourceDialog_resourceReferenceWarning); getShell().setText(Messages.NonReferencedResourceDialog_resourceReferenceWarning); try { setTitleImage(imageCache.create(Plugin.ID, "/icons/full/wizban/newefix_wizban.png")); //$NON-NLS-1$ - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } return ret; @@ -428,10 +436,11 @@ public class NonReferencedResourceDialog extends TitleAreaDialog { public void copyResourceToProject(IProject project) { try { - ProjectFolderPickerDialog dlg = new ProjectFolderPickerDialog(getShell(), project, file.getFullPath().toOSString()) { + final ProjectFolderPickerDialog dlg = new ProjectFolderPickerDialog(getShell(), project, file.getFullPath() + .toOSString()) { @Override protected Control createContents(Composite parent) { - Control ret = super.createContents(parent); + final Control ret = super.createContents(parent); setMessage(Messages.NonReferencedResourceDialog_selectTheFolderResourceCopy); setTitleImage(imageCache.create(Plugin.ID, "/icons/full/wizban/add_to_dir_wiz.png")); //$NON-NLS-1$ @@ -449,14 +458,14 @@ public class NonReferencedResourceDialog extends TitleAreaDialog { if (className != null) { newPath.append(className + ".class"); //$NON-NLS-1$ } else { - String name = file.getFullPath().lastSegment(); + final String name = file.getFullPath().lastSegment(); newPath = newPath.append(name); } - IFile fileClone = project.getFile(newPath); + final IFile fileClone = project.getFile(newPath); fileClone.create(file.getContents(), false, null); result = fileClone; } - } catch (CoreException e1) { + } catch (final CoreException e1) { e1.printStackTrace(); MessageDialog.openError(getShell(), "Error", e1.getMessage()); //$NON-NLS-1$ @@ -471,7 +480,7 @@ public class NonReferencedResourceDialog extends TitleAreaDialog { try { Manifest manifestSource; if (installLocation.endsWith(".jar")) { //$NON-NLS-1$ - ZipFile zip = new ZipFile(installLocation); + final ZipFile zip = new ZipFile(installLocation); srcStream = zip.getInputStream(zip.getEntry("META-INF/MANIFEST.MF")); //$NON-NLS-1$ manifestSource = new Manifest(srcStream); zip.close(); @@ -483,17 +492,17 @@ public class NonReferencedResourceDialog extends TitleAreaDialog { if (version != null) { version = version.replaceFirst("\\.qualifier", ""); //$NON-NLS-1$ //$NON-NLS-2$ } - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); return; } finally { try { srcStream.close(); - } catch (Exception e) { + } catch (final Exception e) { } } - IFile fileManifest = project.getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$ + final IFile fileManifest = project.getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$ Manifest manifest; try { manifest = new Manifest(fileManifest.getContents()); @@ -507,15 +516,15 @@ public class NonReferencedResourceDialog extends TitleAreaDialog { } manifest.getMainAttributes().putValue("Require-Bundle", value); //$NON-NLS-1$ } - ByteArrayOutputStream bos = new ByteArrayOutputStream(); + final ByteArrayOutputStream bos = new ByteArrayOutputStream(); manifest.write(bos); // StringReader reader = new - ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); + final ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); fileManifest.setContents(bis, true, true, null); result = file; - } catch (IOException e1) { + } catch (final IOException e1) { e1.printStackTrace(); - } catch (CoreException e1) { + } catch (final CoreException e1) { e1.printStackTrace(); } } diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedResourceWizard.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedResourceWizard.java index dbb731ca..5868da52 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedResourceWizard.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/NonReferencedResourceWizard.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 436848 + * Steven Spungin <steven@spungin.tv> - initial API and implementation, Bug 436848 *******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; @@ -28,13 +28,14 @@ import org.eclipse.swt.widgets.Shell; */ public class NonReferencedResourceWizard extends DynamicWizard { - private NonReferencedActionPage nonReferencedActionPage; + private final NonReferencedActionPage nonReferencedActionPage; protected IProject project; IEclipseContext wizContext; BundleImageCache imageCache; - public NonReferencedResourceWizard(Shell parentShell, IProject project, String bundle, IFile file, String installLocation, IEclipseContext context) { + public NonReferencedResourceWizard(Shell parentShell, IProject project, String bundle, IFile file, + String installLocation, IEclipseContext context) { this.project = project; wizContext = context.createChild(); @@ -58,7 +59,7 @@ public class NonReferencedResourceWizard extends DynamicWizard { @Override public boolean performFinish() { - Runnable action = wizContext.get(Runnable.class); + final Runnable action = wizContext.get(Runnable.class); if (action != null) { action.run(); } @@ -73,20 +74,20 @@ public class NonReferencedResourceWizard extends DynamicWizard { public IWizardPage getNextPage(IWizardPage page) { if (page instanceof NonReferencedActionPage) { clearDynamicPages(); - NonReferencedAction action = wizContext.get(NonReferencedAction.class); + final NonReferencedAction action = wizContext.get(NonReferencedAction.class); if (action == null) { return null; } switch (action) { case COPY: { - PickProjectFolderPage pickProjectFolderPage = new PickProjectFolderPage(wizContext); + final PickProjectFolderPage pickProjectFolderPage = new PickProjectFolderPage(wizContext); addPage(pickProjectFolderPage); return pickProjectFolderPage; } case COPY_TO_OTHER: - PickProjectPage pickProjectPage = new PickProjectPage(wizContext); + final PickProjectPage pickProjectPage = new PickProjectPage(wizContext); addPage(pickProjectPage); - PickProjectFolderPage pickProjectFolderPage = new PickProjectFolderPage(wizContext); + final PickProjectFolderPage pickProjectFolderPage = new PickProjectFolderPage(wizContext); addPage(pickProjectFolderPage); return pickProjectPage; case USE_ANYWAY: @@ -103,9 +104,8 @@ public class NonReferencedResourceWizard extends DynamicWizard { default: return null; } - } else { - return super.getNextPage(page); } + return super.getNextPage(page); } @Override diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/PickProjectPage.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/PickProjectPage.java index e5dff6b1..572054aa 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/PickProjectPage.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/resourcelocator/dialogs/PickProjectPage.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Steven Spungin <steven@spungin.tv> - initial API and implementation, Ongoing Maintenance + * Steven Spungin <steven@spungin.tv> - initial API and implementation, Ongoing Maintenance *******************************************************************************/ package org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs; @@ -23,7 +23,6 @@ import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.DisposeEvent; @@ -39,20 +38,20 @@ import org.eclipse.swt.widgets.Composite; * @author Steven Spungin * */ -public class PickProjectPage extends WizardPage implements IWizardPage { +public class PickProjectPage extends WizardPage { private TableViewer viewer; private BundleImageCache imageCache; private Image imgProject; private IProject[] projects; - private IEclipseContext context; + private final IEclipseContext context; protected PickProjectPage(IEclipseContext context) { super(Messages.PickProjectPage_SelectReferencedProject); this.context = context; try { - this.projects = context.get(IProject.class).getReferencedProjects(); - } catch (CoreException e) { + projects = context.get(IProject.class).getReferencedProjects(); + } catch (final CoreException e) { setErrorMessage(e.getMessage()); e.printStackTrace(); } @@ -73,7 +72,7 @@ public class PickProjectPage extends WizardPage implements IWizardPage { }); imgProject = imageCache.create("/icons/full/obj16/projects.png"); //$NON-NLS-1$ - Composite comp = new Composite(parent, SWT.NONE); + final Composite comp = new Composite(parent, SWT.NONE); comp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); comp.setLayout(new GridLayout(1, false)); @@ -82,7 +81,7 @@ public class PickProjectPage extends WizardPage implements IWizardPage { viewer.setLabelProvider(new ColumnLabelProvider() { @Override public String getText(Object element) { - IProject project = (IProject) element; + final IProject project = (IProject) element; return project.getName(); } @@ -99,19 +98,19 @@ public class PickProjectPage extends WizardPage implements IWizardPage { @Override public void selectionChanged(SelectionChangedEvent event) { - Object firstElement = ((StructuredSelection) event.getSelection()).getFirstElement(); + final Object firstElement = ((StructuredSelection) event.getSelection()).getFirstElement(); context.set("projectToCopyTo", firstElement); //$NON-NLS-1$ setPageComplete(firstElement != null); getContainer().updateButtons(); } }); - String message = Messages.ReferencedProjectPickerDialog_selectReferencedProject; + final String message = Messages.ReferencedProjectPickerDialog_selectReferencedProject; setMessage(message); getShell().setText(message); setTitle(message); - Image image = context.get(BundleImageCache.class).create("/icons/full/obj16/projects.png"); //$NON-NLS-1$ + final Image image = context.get(BundleImageCache.class).create("/icons/full/obj16/projects.png"); //$NON-NLS-1$ setImageDescriptor(ImageDescriptor.createFromImage(image)); setControl(comp); @@ -119,7 +118,7 @@ public class PickProjectPage extends WizardPage implements IWizardPage { @Override public void setVisible(boolean visible) { - Object object = context.get("projectToCopyTo"); //$NON-NLS-1$ + final Object object = context.get("projectToCopyTo"); //$NON-NLS-1$ if (visible) { if (object != null) { viewer.setSelection(new StructuredSelection(object)); diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/AnnotationAccess.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/AnnotationAccess.java index fcbc3e8b..e6ef7aaa 100644 --- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/AnnotationAccess.java +++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/xml/AnnotationAccess.java @@ -10,7 +10,7 @@ import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Canvas; public class AnnotationAccess implements IAnnotationAccess, IAnnotationAccessExtension { - private IResourcePool pool; + private final IResourcePool pool; public AnnotationAccess(IResourcePool pool) { this.pool = pool; @@ -49,18 +49,21 @@ public class AnnotationAccess implements IAnnotationAccess, IAnnotationAccessExt return null; } + @Deprecated @Override public Object getType(Annotation annotation) { // TODO Auto-generated method stub return null; } + @Deprecated @Override public boolean isMultiLine(Annotation annotation) { // TODO Auto-generated method stub return false; } + @Deprecated @Override public boolean isTemporary(Annotation annotation) { // TODO Auto-generated method stub |