diff options
author | Mike Rennie | 2013-07-29 13:20:16 -0400 |
---|---|---|
committer | Mike Rennie | 2013-07-29 14:52:25 -0400 |
commit | 374fa3fa8070a7ff9d119ce17faeeae5a6e5fb17 (patch) | |
tree | 4369123c57e575e62006d1f2189b71e3788d5048 | |
parent | 495c721097fd8703c544a8a69b7c64694d3b871d (diff) | |
download | eclipse.pde.ui-374fa3fa8070a7ff9d119ce17faeeae5a6e5fb17.zip eclipse.pde.ui-374fa3fa8070a7ff9d119ce17faeeae5a6e5fb17.tar.gz eclipse.pde.ui-374fa3fa8070a7ff9d119ce17faeeae5a6e5fb17.tar.xz |
Bug 413935 - Remove redundant interfaces
Change-Id: Idb5514bfcc77c1117c1a724f7c2d384ff9f34f47
59 files changed, 699 insertions, 231 deletions
diff --git a/ui/org.eclipse.pde.ui/.settings/org.eclipse.jdt.ui.prefs b/ui/org.eclipse.pde.ui/.settings/org.eclipse.jdt.ui.prefs index 4079175..87ab70a 100644 --- a/ui/org.eclipse.pde.ui/.settings/org.eclipse.jdt.ui.prefs +++ b/ui/org.eclipse.pde.ui/.settings/org.eclipse.jdt.ui.prefs @@ -1,4 +1,3 @@ -#Sun Dec 23 21:49:35 CST 2007 eclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=_core @@ -14,6 +13,7 @@ sp_cleanup.add_missing_deprecated_annotations=true sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=false sp_cleanup.add_serial_version_id=false sp_cleanup.always_use_blocks=true sp_cleanup.always_use_parentheses_in_expressions=false @@ -26,10 +26,11 @@ sp_cleanup.format_source_code_changes_only=false sp_cleanup.make_local_variable_final=false sp_cleanup.make_parameters_final=false sp_cleanup.make_private_fields_final=true -sp_cleanup.make_variable_declarations_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false sp_cleanup.never_use_blocks=false sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true @@ -37,12 +38,12 @@ sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class= sp_cleanup.qualify_static_member_accesses_with_declaring_class=false sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces=true sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true sp_cleanup.remove_unused_local_variables=false sp_cleanup.remove_unused_private_fields=true sp_cleanup.remove_unused_private_members=false diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/build/BaseBuildAction.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/build/BaseBuildAction.java index 9abee38..d82c7fa 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/build/BaseBuildAction.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/build/BaseBuildAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2012 IBM Corporation and others. + * Copyright (c) 2003, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -153,7 +153,6 @@ public abstract class BaseBuildAction extends AbstractHandler { project.refreshLocal(IResource.DEPTH_ONE, monitor); } - @SuppressWarnings("unchecked") public static void setDefaultValues(IFile generatedFile) { try { List<?> configs = AntLaunchShortcut.findExistingLaunchConfigurations(generatedFile); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/MultiFixResolution.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/MultiFixResolution.java index 5fd182d..225e4ae 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/MultiFixResolution.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/MultiFixResolution.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2012 IBM Corporation and others. + * Copyright (c) 2009, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -41,6 +41,7 @@ public class MultiFixResolution extends WorkbenchMarkerResolution { problemViewQuickFix = false; } + @Override public IMarker[] findOtherMarkers(IMarker[] markers) { ArrayList<IMarker> relatedMarkers = new ArrayList<IMarker>(); try { @@ -99,6 +100,7 @@ public class MultiFixResolution extends WorkbenchMarkerResolution { /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ + @Override public boolean equals(Object obj) { if (!(obj instanceof MultiFixResolution)) return false; @@ -113,4 +115,14 @@ public class MultiFixResolution extends WorkbenchMarkerResolution { return false; } + @Override + public int hashCode() { + try { + String category = (String) fMarker.getAttribute(PDEMarkerFactory.CAT_ID); + return category.hashCode(); + } catch (CoreException e) { + //fall-through and use Object.hashCode + } + return super.hashCode(); + } } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/RemoveExportPackageResolution.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/RemoveExportPackageResolution.java index 34c164f..52ba5f8 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/RemoveExportPackageResolution.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/RemoveExportPackageResolution.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. + * Copyright (c) 2005, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -13,10 +13,9 @@ package org.eclipse.pde.internal.ui.correction; import org.eclipse.osgi.util.NLS; import org.eclipse.pde.internal.core.text.bundle.*; import org.eclipse.pde.internal.ui.PDEUIMessages; -import org.eclipse.ui.IMarkerResolution; import org.osgi.framework.Constants; -public class RemoveExportPackageResolution extends AbstractManifestMarkerResolution implements IMarkerResolution { +public class RemoveExportPackageResolution extends AbstractManifestMarkerResolution { String fPackage; @@ -25,6 +24,7 @@ public class RemoveExportPackageResolution extends AbstractManifestMarkerResolut fPackage = pkgName; } + @Override protected void createChange(BundleModel model) { Bundle bundle = (Bundle) model.getBundle(); ExportPackageHeader header = (ExportPackageHeader) bundle.getManifestHeader(Constants.EXPORT_PACKAGE); @@ -36,6 +36,7 @@ public class RemoveExportPackageResolution extends AbstractManifestMarkerResolut return NLS.bind(PDEUIMessages.RemoveExportPkgs_label, fPackage); } + @Override public String getDescription() { return NLS.bind(PDEUIMessages.RemoveExportPkgs_description, fPackage); } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/RemoveImportExportServicesResolution.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/RemoveImportExportServicesResolution.java index 18e4323..c7d13e0 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/RemoveImportExportServicesResolution.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/correction/RemoveImportExportServicesResolution.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2008 IBM Corporation and others. + * Copyright (c) 2006, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -15,9 +15,8 @@ import org.eclipse.pde.internal.core.ibundle.IManifestHeader; import org.eclipse.pde.internal.core.text.bundle.Bundle; import org.eclipse.pde.internal.core.text.bundle.BundleModel; import org.eclipse.pde.internal.ui.PDEUIMessages; -import org.eclipse.ui.IMarkerResolution; -public class RemoveImportExportServicesResolution extends AbstractManifestMarkerResolution implements IMarkerResolution { +public class RemoveImportExportServicesResolution extends AbstractManifestMarkerResolution { String fServiceHeader; @@ -26,6 +25,7 @@ public class RemoveImportExportServicesResolution extends AbstractManifestMarker fServiceHeader = serviceHeader; } + @Override protected void createChange(BundleModel model) { Bundle bundle = (Bundle) model.getBundle(); IManifestHeader header = bundle.getManifestHeader(fServiceHeader); @@ -37,6 +37,7 @@ public class RemoveImportExportServicesResolution extends AbstractManifestMarker return NLS.bind(PDEUIMessages.RemoveImportExportServices_label, fServiceHeader); } + @Override public String getDescription() { return NLS.bind(PDEUIMessages.RemoveImportExportServices_description, fServiceHeader); } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/JarEntryEditorInput.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/JarEntryEditorInput.java index 83e3f25..4c627a4 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/JarEntryEditorInput.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/JarEntryEditorInput.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,6 +28,7 @@ public class JarEntryEditorInput implements IStorageEditorInput { /* */ + @Override public boolean equals(Object obj) { if (this == obj) return true; @@ -37,6 +38,11 @@ public class JarEntryEditorInput implements IStorageEditorInput { return fJarEntryFile.equals(other.fJarEntryFile); } + @Override + public int hashCode() { + return fJarEntryFile.hashCode(); + } + /* * @see IEditorInput#getPersistable() */ diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/JarEntryFile.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/JarEntryFile.java index fcd3923..0df4385 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/JarEntryFile.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/JarEntryFile.java @@ -65,6 +65,7 @@ public class JarEntryFile extends PlatformObject implements IStorage { * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) */ @SuppressWarnings("rawtypes") + @Override public Object getAdapter(Class adapter) { if (adapter.equals(ZipFile.class)) return fZipFile; @@ -73,14 +74,20 @@ public class JarEntryFile extends PlatformObject implements IStorage { return super.getAdapter(adapter); } + @Override public String toString() { return "JarEntryFile[" + fZipFile.getName() + "::" + fEntryName + "]"; //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-1$ } + @Override public boolean equals(Object obj) { if (!(obj instanceof JarEntryFile)) return false; return toString().equals(obj.toString()); } + @Override + public int hashCode() { + return toString().hashCode(); + } } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEMultiPageContentOutline.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEMultiPageContentOutline.java index eec4ac3..2f89606 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEMultiPageContentOutline.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDEMultiPageContentOutline.java @@ -25,7 +25,7 @@ import org.eclipse.ui.part.Page; import org.eclipse.ui.part.PageBook; import org.eclipse.ui.views.contentoutline.IContentOutlinePage; -public class PDEMultiPageContentOutline extends Page implements IContentOutlinePage, ISelectionProvider, ISelectionChangedListener, ILaunchingPreferenceConstants { +public class PDEMultiPageContentOutline extends Page implements IContentOutlinePage, ISelectionChangedListener, ILaunchingPreferenceConstants { private PageBook pagebook; private ISelection selection; private ArrayList<ISelectionChangedListener> listeners; @@ -50,10 +50,12 @@ public class PDEMultiPageContentOutline extends Page implements IContentOutlineP listeners.add(listener); } + @Override public void createControl(Composite parent) { pagebook = new PageBook(parent, SWT.NONE); } + @Override public void dispose() { if (pagebook != null && !pagebook.isDisposed()) pagebook.dispose(); @@ -81,6 +83,7 @@ public class PDEMultiPageContentOutline extends Page implements IContentOutlineP return listeners == null; } + @Override public Control getControl() { return pagebook; } @@ -93,6 +96,7 @@ public class PDEMultiPageContentOutline extends Page implements IContentOutlineP return selection; } + @Override public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) { } @@ -107,6 +111,7 @@ public class PDEMultiPageContentOutline extends Page implements IContentOutlineP setSelection(event.getSelection()); } + @Override public void setActionBars(IActionBars actionBars) { this.actionBars = actionBars; registerToolbarActions(actionBars); @@ -119,6 +124,7 @@ public class PDEMultiPageContentOutline extends Page implements IContentOutlineP return actionBars; } + @Override public void setFocus() { if (currentPage != null) currentPage.setFocus(); @@ -192,6 +198,7 @@ public class PDEMultiPageContentOutline extends Page implements IContentOutlineP setChecked(sortingOn); } + @Override public void run() { setChecked(isChecked()); valueChanged(isChecked()); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDESection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDESection.java index 0b3964a..24c0282 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDESection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/PDESection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2012 IBM Corporation and others. + * Copyright (c) 2003, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -13,13 +13,14 @@ package org.eclipse.pde.internal.ui.editor; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.jface.viewers.ISelection; -import org.eclipse.pde.core.*; +import org.eclipse.pde.core.IBaseModel; +import org.eclipse.pde.core.IModelChangedEvent; import org.eclipse.swt.dnd.Clipboard; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.forms.SectionPart; import org.eclipse.ui.forms.widgets.*; -public abstract class PDESection extends SectionPart implements IModelChangedListener, IContextPart, IAdaptable { +public abstract class PDESection extends SectionPart implements IContextPart, IAdaptable { private PDEFormPage fPage; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BinSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BinSection.java index 3d189ae..1d9dca0 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BinSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BinSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,14 +14,13 @@ package org.eclipse.pde.internal.ui.editor.build; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.Path; import org.eclipse.pde.core.IModelChangedEvent; -import org.eclipse.pde.core.IModelChangedListener; import org.eclipse.pde.core.build.IBuild; import org.eclipse.pde.core.build.IBuildEntry; import org.eclipse.pde.internal.build.IBuildPropertiesConstants; import org.eclipse.pde.internal.ui.PDEUIMessages; import org.eclipse.swt.widgets.Composite; -public class BinSection extends BuildContentsSection implements IModelChangedListener { +public class BinSection extends BuildContentsSection { public BinSection(BuildPage page, Composite parent) { super(page, parent); @@ -29,6 +28,7 @@ public class BinSection extends BuildContentsSection implements IModelChangedLis getSection().setDescription(PDEUIMessages.BuildEditor_BinSection_desc); } + @Override protected void initializeCheckState() { super.initializeCheckState(); IBuild build = fBuildModel.getBuild(); @@ -41,6 +41,7 @@ public class BinSection extends BuildContentsSection implements IModelChangedLis super.initializeCheckState(binIncl, binExcl); } + @Override protected void deleteFolderChildrenFromEntries(IFolder folder) { IBuild build = fBuildModel.getBuild(); IBuildEntry binIncl = build.getEntry(IBuildPropertiesConstants.PROPERTY_BIN_INCLUDES); @@ -51,6 +52,7 @@ public class BinSection extends BuildContentsSection implements IModelChangedLis removeChildren(binExcl, parentFolder); } + @Override protected void handleBuildCheckStateChange(boolean wasTopParentChecked) { IResource resource = fParentResource; String resourceName = fParentResource.getProjectRelativePath().makeRelativeTo(fBundleRoot.getProjectRelativePath()).toPortableString(); @@ -69,6 +71,7 @@ public class BinSection extends BuildContentsSection implements IModelChangedLis fParentResource = fOriginalResource = null; } + @Override public void modelChanged(IModelChangedEvent event) { if (event.getChangeType() == IModelChangedEvent.WORLD_CHANGED) { markStale(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildClasspathSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildClasspathSection.java index 94b1481..7e91eae 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildClasspathSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildClasspathSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -16,7 +16,6 @@ import org.eclipse.jface.action.*; import org.eclipse.jface.viewers.*; import org.eclipse.jface.window.Window; import org.eclipse.pde.core.IModelChangedEvent; -import org.eclipse.pde.core.IModelChangedListener; import org.eclipse.pde.core.build.*; import org.eclipse.pde.core.plugin.IPluginModelBase; import org.eclipse.pde.core.plugin.PluginRegistry; @@ -43,7 +42,7 @@ import org.eclipse.ui.model.WorkbenchContentProvider; import org.eclipse.ui.model.WorkbenchLabelProvider; import org.eclipse.ui.views.navigator.ResourceComparator; -public class BuildClasspathSection extends TableSection implements IModelChangedListener { +public class BuildClasspathSection extends TableSection { private TableViewer fTableViewer; private boolean fEnabled = true; @@ -55,8 +54,7 @@ public class BuildClasspathSection extends TableSection implements IModelChanged */ class ElementSelectionValidator implements ISelectionStatusValidator { - @SuppressWarnings("rawtypes") - private Class[] fAcceptedTypes; + private Class<?>[] fAcceptedTypes; private boolean fAllowMultipleSelection; /** @@ -64,8 +62,7 @@ public class BuildClasspathSection extends TableSection implements IModelChanged * @param allowMultipleSelection If set to <code>true</code>, the validator * allows multiple selection. */ - public ElementSelectionValidator(@SuppressWarnings("rawtypes") - Class[] acceptedTypes, boolean allowMultipleSelection) { + public ElementSelectionValidator(Class<?>[] acceptedTypes, boolean allowMultipleSelection) { Assert.isNotNull(acceptedTypes); fAcceptedTypes = acceptedTypes; fAllowMultipleSelection = allowMultipleSelection; @@ -156,6 +153,7 @@ public class BuildClasspathSection extends TableSection implements IModelChanged getSection().setExpanded(entry != null && entry.getTokens().length > 0); } + @Override public void createClient(Section section, FormToolkit toolkit) { Composite container = createClientContainer(section, 2, toolkit); createViewerPartControl(container, SWT.FULL_SELECTION, 2, toolkit); @@ -177,11 +175,13 @@ public class BuildClasspathSection extends TableSection implements IModelChanged section.setClient(container); } + @Override protected void fillContextMenu(IMenuManager manager) { ISelection selection = fTableViewer.getSelection(); // add NEW action Action action = new Action(PDEUIMessages.BuildEditor_ClasspathSection_add) { + @Override public void run() { handleNew(); } @@ -193,6 +193,7 @@ public class BuildClasspathSection extends TableSection implements IModelChanged // add DELETE action action = new Action(PDEUIMessages.BuildEditor_ClasspathSection_remove) { + @Override public void run() { handleDelete(); } @@ -203,6 +204,7 @@ public class BuildClasspathSection extends TableSection implements IModelChanged getPage().getPDEEditor().getContributor().contextMenuAboutToShow(manager, false); } + @Override public void dispose() { IBuildModel model = getBuildModel(); if (model != null) @@ -210,10 +212,12 @@ public class BuildClasspathSection extends TableSection implements IModelChanged super.dispose(); } + @Override public void refresh() { fTableViewer.refresh(); } + @Override public boolean doGlobalAction(String actionId) { if (actionId.equals(ActionFactory.DELETE.getId())) { if (fEnabled) { @@ -231,6 +235,7 @@ public class BuildClasspathSection extends TableSection implements IModelChanged tablePart.setButtonEnabled(0, enable); } + @Override protected void selectionChanged(IStructuredSelection selection) { getPage().getPDEEditor().setSelection(selection); getTablePart().setButtonEnabled(1, selection != null && selection.size() > 0 && fEnabled); @@ -257,13 +262,13 @@ public class BuildClasspathSection extends TableSection implements IModelChanged } private void initializeDialogSettings(ElementTreeSelectionDialog dialog) { - @SuppressWarnings("rawtypes") - Class[] acceptedClasses = new Class[] {IFile.class}; + Class<?>[] acceptedClasses = new Class[] {IFile.class}; dialog.setValidator(new ElementSelectionValidator(acceptedClasses, true)); dialog.setTitle(PDEUIMessages.BuildEditor_ClasspathSection_jarsTitle); dialog.setMessage(PDEUIMessages.BuildEditor_ClasspathSection_jarsDesc); dialog.addFilter(new JARFileFilter()); dialog.addFilter(new ViewerFilter() { + @Override public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof IProject) { try { @@ -330,6 +335,7 @@ public class BuildClasspathSection extends TableSection implements IModelChanged return null; } + @Override protected void buttonSelected(int index) { switch (index) { case 0 : @@ -343,6 +349,7 @@ public class BuildClasspathSection extends TableSection implements IModelChanged } } + @Override public void modelChanged(IModelChangedEvent event) { if (event.getChangeType() == IModelChangedEvent.WORLD_CHANGED) markStale(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildContentsSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildContentsSection.java index 420a350..4f693d1 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildContentsSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/BuildContentsSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -17,7 +17,6 @@ import org.eclipse.core.runtime.*; import org.eclipse.jface.action.*; import org.eclipse.jface.viewers.*; import org.eclipse.pde.core.IModelChangedEvent; -import org.eclipse.pde.core.IModelChangedListener; import org.eclipse.pde.core.build.*; import org.eclipse.pde.internal.build.IBuildPropertiesConstants; import org.eclipse.pde.internal.core.project.PDEProject; @@ -33,7 +32,7 @@ import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; import org.eclipse.ui.model.WorkbenchLabelProvider; -public abstract class BuildContentsSection extends TableSection implements IModelChangedListener, IResourceChangeListener, IResourceDeltaVisitor { +public abstract class BuildContentsSection extends TableSection implements IResourceChangeListener, IResourceDeltaVisitor { protected CheckboxTreeViewer fTreeViewer; private boolean fDoRefresh = false; @@ -107,6 +106,7 @@ public abstract class BuildContentsSection extends TableSection implements IMode } } + @Override protected void createViewerPartControl(Composite parent, int style, int span, FormToolkit toolkit) { MenuManager popupMenuManager = new MenuManager(); IMenuListener listener = new IMenuListener() { @@ -124,6 +124,7 @@ public abstract class BuildContentsSection extends TableSection implements IMode /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#fillContextMenu(org.eclipse.jface.action.IMenuManager) */ + @Override protected void fillContextMenu(IMenuManager manager) { manager.add(getPage().getPDEEditor().getContributor().getRevertAction()); getPage().getPDEEditor().getContributor().contextMenuAboutToShow(manager, false); @@ -139,6 +140,7 @@ public abstract class BuildContentsSection extends TableSection implements IMode PDEPlugin.getWorkspace().addResourceChangeListener(this); } + @Override public void createClient(final Section section, FormToolkit toolkit) { Composite container = createClientContainer(section, 2, toolkit); fBuildModel = getBuildModel(); @@ -421,6 +423,7 @@ public abstract class BuildContentsSection extends TableSection implements IMode fBuildModel.addModelChangedListener(this); } + @Override public void dispose() { fBuildModel.removeModelChangedListener(this); PDEPlugin.getWorkspace().removeResourceChangeListener(this); @@ -444,10 +447,12 @@ public abstract class BuildContentsSection extends TableSection implements IMode return fTreeViewer; } + @Override protected ISelection getViewerSelection() { return getTreeViewer().getSelection(); } + @Override public void refresh() { initializeCheckState(); super.refresh(); @@ -523,11 +528,13 @@ public abstract class BuildContentsSection extends TableSection implements IMode * * @see org.eclipse.pde.internal.ui.editor.TableSection#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection) */ + @Override protected void selectionChanged(IStructuredSelection selection) { getPage().getPDEEditor().setSelection(selection); } + @Override public void modelChanged(IModelChangedEvent event) { if (event.getChangeType() == IModelChangedEvent.WORLD_CHANGED) { diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/RuntimeInfoSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/RuntimeInfoSection.java index 6a3bc34..c5d467a 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/RuntimeInfoSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/RuntimeInfoSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -45,7 +45,7 @@ import org.eclipse.ui.forms.widgets.Section; import org.eclipse.ui.model.WorkbenchContentProvider; import org.eclipse.ui.model.WorkbenchLabelProvider; -public class RuntimeInfoSection extends PDESection implements IModelChangedListener, IBuildPropertiesConstants { +public class RuntimeInfoSection extends PDESection implements IBuildPropertiesConstants { private static final int F_NEW_INDEX = 0; private static final int F_UP_UNDEX = 2; @@ -65,6 +65,7 @@ public class RuntimeInfoSection extends PDESection implements IModelChangedListe super(buttonLabels); } + @Override public void selectionChanged(IStructuredSelection selection) { getPage().getPDEEditor().setSelection(selection); Object item = selection.getFirstElement(); @@ -75,6 +76,7 @@ public class RuntimeInfoSection extends PDESection implements IModelChangedListe updateDirectionalButtons(); } + @Override public void handleDoubleClick(IStructuredSelection selection) { Object element = selection.getFirstElement(); if (getLibrarySelection() == element) @@ -83,6 +85,7 @@ public class RuntimeInfoSection extends PDESection implements IModelChangedListe handleRenameFolder((String) element); } + @Override public void buttonSelected(Button button, int index) { if (getViewer() == fLibraryPart.getViewer()) { switch (index) { @@ -144,6 +147,7 @@ public class RuntimeInfoSection extends PDESection implements IModelChangedListe } class JarsNewContentProvider extends WorkbenchContentProvider { + @Override public boolean hasChildren(Object element) { Object[] children = getChildren(element); for (int i = 0; i < children.length; i++) @@ -284,6 +288,7 @@ public class RuntimeInfoSection extends PDESection implements IModelChangedListe return folders.toArray(new IPackageFragmentRoot[folders.size()]); } + @Override public void createClient(Section section, FormToolkit toolkit) { Composite container = toolkit.createComposite(section); container.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 2)); @@ -326,6 +331,7 @@ public class RuntimeInfoSection extends PDESection implements IModelChangedListe Composite container = createContainer(parent, toolkit); fFolderPart = new PartAdapter(new String[] {PDEUIMessages.BuildEditor_RuntimeInfoSection_addFolder}) { + @Override public void selectionChanged(IStructuredSelection selection) { // folder selection ignored } @@ -360,6 +366,7 @@ public class RuntimeInfoSection extends PDESection implements IModelChangedListe ISelection libSelection = fLibraryViewer.getSelection(); if (libSelection != null && !libSelection.isEmpty()) { Action newAction = new Action(PDEUIMessages.BuildEditor_RuntimeInfoSection_popupFolder) { + @Override public void run() { handleNewFolder(); } @@ -371,6 +378,7 @@ public class RuntimeInfoSection extends PDESection implements IModelChangedListe manager.add(new Separator()); Action replace = new Action(PDEUIMessages.RuntimeInfoSection_replace) { + @Override public void run() { handleRenameFolder(((IStructuredSelection) selection).getFirstElement().toString()); } @@ -379,6 +387,7 @@ public class RuntimeInfoSection extends PDESection implements IModelChangedListe manager.add(replace); Action deleteAction = new Action(PDEUIMessages.Actions_delete_label) { + @Override public void run() { handleDeleteFolder(); } @@ -393,6 +402,7 @@ public class RuntimeInfoSection extends PDESection implements IModelChangedListe protected void fillLibraryContextMenu(IMenuManager manager) { ISelection selection = fLibraryViewer.getSelection(); Action newAction = new Action(PDEUIMessages.BuildEditor_RuntimeInfoSection_popupAdd) { + @Override public void run() { handleNew(); } @@ -402,6 +412,7 @@ public class RuntimeInfoSection extends PDESection implements IModelChangedListe manager.add(new Separator()); IAction renameAction = new Action(PDEUIMessages.EditableTablePart_renameAction) { + @Override public void run() { doRename(); } @@ -410,6 +421,7 @@ public class RuntimeInfoSection extends PDESection implements IModelChangedListe manager.add(renameAction); Action deleteAction = new Action(PDEUIMessages.Actions_delete_label) { + @Override public void run() { handleDelete(); } @@ -473,6 +485,7 @@ public class RuntimeInfoSection extends PDESection implements IModelChangedListe fFolderPart.setButtonEnabled(F_NEW_INDEX, enable && !fLibraryViewer.getSelection().isEmpty()); } + @Override public boolean doGlobalAction(String actionId) { if (actionId.equals(ActionFactory.DELETE.getId())) { if (fEnabled && fLibraryViewer.getControl().isFocusControl()) @@ -505,6 +518,7 @@ public class RuntimeInfoSection extends PDESection implements IModelChangedListe } } + @Override public void dispose() { IBuildModel buildModel = getBuildModel(); if (buildModel != null) @@ -770,6 +784,7 @@ public class RuntimeInfoSection extends PDESection implements IModelChangedListe dialog.setInput(project.getWorkspace()); dialog.addFilter(new ViewerFilter() { + @Override public boolean select(Viewer viewer, Object parentElement, Object element) { if (element instanceof IProject) return ((IProject) element).equals(project); @@ -865,6 +880,7 @@ public class RuntimeInfoSection extends PDESection implements IModelChangedListe } } + @Override public void modelChanged(IModelChangedEvent event) { if (event.getChangeType() == IModelChangedEvent.WORLD_CHANGED) markStale(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/SrcSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/SrcSection.java index 8f3378e..1ad6cc7 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/SrcSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/build/SrcSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -13,14 +13,13 @@ package org.eclipse.pde.internal.ui.editor.build; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IResource; -import org.eclipse.pde.core.IModelChangedListener; import org.eclipse.pde.core.build.IBuild; import org.eclipse.pde.core.build.IBuildEntry; import org.eclipse.pde.internal.build.IBuildPropertiesConstants; import org.eclipse.pde.internal.ui.PDEUIMessages; import org.eclipse.swt.widgets.Composite; -public class SrcSection extends BuildContentsSection implements IModelChangedListener { +public class SrcSection extends BuildContentsSection { public SrcSection(BuildPage page, Composite parent) { super(page, parent); @@ -29,6 +28,7 @@ public class SrcSection extends BuildContentsSection implements IModelChangedLis } + @Override protected void initializeCheckState() { super.initializeCheckState(); @@ -42,6 +42,7 @@ public class SrcSection extends BuildContentsSection implements IModelChangedLis super.initializeCheckState(srcIncl, srcExcl); } + @Override protected void deleteFolderChildrenFromEntries(IFolder folder) { IBuild build = fBuildModel.getBuild(); IBuildEntry srcIncl = build.getEntry(IBuildPropertiesConstants.PROPERTY_SRC_INCLUDES); @@ -52,6 +53,7 @@ public class SrcSection extends BuildContentsSection implements IModelChangedLis removeChildren(srcExcl, parentFolder); } + @Override protected void handleBuildCheckStateChange(boolean wasTopParentChecked) { IResource resource = fParentResource; String resourceName = fParentResource.getProjectRelativePath().makeRelativeTo(fBundleRoot.getProjectRelativePath()).toPortableString(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/CategoryDetailsSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/CategoryDetailsSection.java index 4d800d2..20aac99 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/CategoryDetailsSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/category/CategoryDetailsSection.java @@ -6,6 +6,7 @@ * * Contributors: * EclipseSource - initial API and implementation +* IBM Corporation - bug fixing ******************************************************************************/ package org.eclipse.pde.internal.ui.editor.category; @@ -28,7 +29,7 @@ import org.eclipse.ui.forms.IPartSelectionListener; import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; -public class CategoryDetailsSection extends PDESection implements IFormPart, IPartSelectionListener { +public class CategoryDetailsSection extends PDESection implements IPartSelectionListener { private static final String PROPERTY_DESC = "desc"; //$NON-NLS-1$ private static final String PROPERTY_NAME = "url"; //$NON-NLS-1$ @@ -89,6 +90,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa } } + @Override public void cancelEdit() { fNameText.cancelEdit(); fLabelText.cancelEdit(); @@ -96,6 +98,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa super.cancelEdit(); } + @Override public boolean canPaste(Clipboard clipboard) { TransferData[] types = clipboard.getAvailableTypes(); Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()}; @@ -123,6 +126,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa fDescriptionText.setValue(null, true); } + @Override public void commit(boolean onSave) { fNameText.commit(); fLabelText.commit(); @@ -131,6 +135,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa super.commit(onSave); } + @Override public void createClient(Section section, FormToolkit toolkit) { section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); @@ -143,6 +148,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa fNameText = new FormEntry(container, toolkit, PDEUIMessages.CategoryDetails_name, null, false); fNameText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void textValueChanged(FormEntry text) { try { if (text.getValue().length() <= 0 || alreadyExists(text.getValue())) { @@ -162,6 +168,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa fLabelText = new FormEntry(container, toolkit, PDEUIMessages.CategoryDetails_label, null, false); fLabelText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void textValueChanged(FormEntry text) { try { applyValue(PROPERTY_TYPE, text.getValue()); @@ -179,6 +186,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa fDescriptionText.getLabel().setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); fDescriptionText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void textValueChanged(FormEntry text) { try { applyValue(PROPERTY_DESC, text.getValue()); @@ -197,6 +205,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa model.addModelChangedListener(this); } + @Override public void dispose() { ISiteModel model = (ISiteModel) getPage().getModel(); if (model != null) @@ -209,6 +218,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa gd.widthHint = 30; } + @Override public void modelChanged(IModelChangedEvent e) { markStale(); } @@ -240,6 +250,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa } } + @Override public void refresh() { if (fCurrentCategoryDefinition == null) { clearFields(); @@ -265,6 +276,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa refresh(); } + @Override public void setFocus() { if (fNameText != null) fNameText.getText().setFocus(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/TypeCompletionProposal.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/TypeCompletionProposal.java index ee1aa23..0c5a7f1 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/TypeCompletionProposal.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/TypeCompletionProposal.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2012 IBM Corporation and others. + * Copyright (c) 2006, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,11 +18,11 @@ import org.eclipse.jdt.core.*; import org.eclipse.jdt.internal.ui.text.java.AbstractJavaCompletionProposal; import org.eclipse.jdt.internal.ui.text.java.ProposalInfo; import org.eclipse.jface.text.*; -import org.eclipse.jface.text.contentassist.*; +import org.eclipse.jface.text.contentassist.ICompletionProposalExtension4; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; -public class TypeCompletionProposal extends AbstractJavaCompletionProposal implements ICompletionProposal, ICompletionProposalExtension3, ICompletionProposalExtension4, ICompletionProposalExtension5 { +public class TypeCompletionProposal extends AbstractJavaCompletionProposal implements ICompletionProposalExtension4 { private static final class PDETypeProposalInfo extends ProposalInfo { private IJavaProject fJavaProject; @@ -71,6 +71,7 @@ public class TypeCompletionProposal extends AbstractJavaCompletionProposal imple /* (non-Javadoc) * @see org.eclipse.jface.text.contentassist.ICompletionProposal#apply(org.eclipse.jface.text.IDocument) */ + @Override public void apply(ITextViewer viewer, char trigger, int stateMask, int offset) { IDocument document = viewer.getDocument(); if (getReplacementLength() == -1) { @@ -87,6 +88,7 @@ public class TypeCompletionProposal extends AbstractJavaCompletionProposal imple /* (non-Javadoc) * @see org.eclipse.jface.text.contentassist.ICompletionProposal#getSelection(org.eclipse.jface.text.IDocument) */ + @Override public Point getSelection(IDocument document) { if (getReplacementString().equals("\"\"")) //$NON-NLS-1$ return new Point(getReplacementOffset() + 1, 0); @@ -96,6 +98,7 @@ public class TypeCompletionProposal extends AbstractJavaCompletionProposal imple /* * @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension5#getAdditionalProposalInfo(org.eclipse.core.runtime.IProgressMonitor) */ + @Override public Object getAdditionalProposalInfo(IProgressMonitor monitor) { if (fAdditionalInfo != null) return fAdditionalInfo; @@ -120,6 +123,7 @@ public class TypeCompletionProposal extends AbstractJavaCompletionProposal imple * @return the additional proposal info, or <code>null</code> if none * exists */ + @Override protected final ProposalInfo getProposalInfo() { if (!fProposalInfoComputed) { setProposalInfo(computeProposalInfo()); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/XMLContentAssistProcessor.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/XMLContentAssistProcessor.java index 0b2bef6..cee9300 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/XMLContentAssistProcessor.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/contentassist/XMLContentAssistProcessor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2012 IBM Corporation and others. + * Copyright (c) 2006, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -36,7 +36,7 @@ import org.eclipse.pde.internal.ui.editor.text.XMLUtil; import org.eclipse.swt.graphics.Image; import org.eclipse.ui.forms.editor.FormEditor; -public class XMLContentAssistProcessor extends TypePackageCompletionProcessor implements IContentAssistProcessor, ICompletionListener { +public class XMLContentAssistProcessor extends TypePackageCompletionProcessor implements ICompletionListener { protected boolean fAssistSessionStarted; @@ -97,6 +97,7 @@ public class XMLContentAssistProcessor extends TypePackageCompletionProcessor im fSourcePage = sourcePage; } + @Override public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { IDocument doc = viewer.getDocument(); int docLen = doc.getLength(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/DataPortabilitySection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/DataPortabilitySection.java index 944c0c4..e9963a4 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/DataPortabilitySection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/DataPortabilitySection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -30,7 +30,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.forms.*; import org.eclipse.ui.forms.widgets.*; -public class DataPortabilitySection extends PDESection implements IFormPart, IPartSelectionListener { +public class DataPortabilitySection extends PDESection implements IPartSelectionListener { public static Choice[] getArchChoices() { return getKnownChoices(Platform.knownOSArchValues()); } @@ -95,6 +95,7 @@ public class DataPortabilitySection extends PDESection implements IFormPart, IPa fCurrentInput.setArch(value); } + @Override public void cancelEdit() { fOsText.cancelEdit(); fWsText.cancelEdit(); @@ -103,6 +104,7 @@ public class DataPortabilitySection extends PDESection implements IFormPart, IPa super.cancelEdit(); } + @Override public boolean canPaste(Clipboard clipboard) { TransferData[] types = clipboard.getAvailableTypes(); Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()}; @@ -133,6 +135,7 @@ public class DataPortabilitySection extends PDESection implements IFormPart, IPa fArchText.setValue(null, true); } + @Override public void commit(boolean onSave) { fOsText.commit(); fWsText.commit(); @@ -141,6 +144,7 @@ public class DataPortabilitySection extends PDESection implements IFormPart, IPa super.commit(onSave); } + @Override public void createClient(Section section, FormToolkit toolkit) { section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); @@ -156,6 +160,7 @@ public class DataPortabilitySection extends PDESection implements IFormPart, IPa fOsText = new FormEntry(container, toolkit, PDEUIMessages.SiteEditor_PortabilitySection_os, editLabel, false); fOsText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void browseButtonSelected(FormEntry entry) { BusyIndicator.showWhile(fOsText.getText().getDisplay(), new Runnable() { public void run() { @@ -165,6 +170,7 @@ public class DataPortabilitySection extends PDESection implements IFormPart, IPa }); } + @Override public void textValueChanged(FormEntry text) { try { applyValue(IEnvironment.P_OS, text.getValue()); @@ -179,6 +185,7 @@ public class DataPortabilitySection extends PDESection implements IFormPart, IPa fWsText = new FormEntry(container, toolkit, PDEUIMessages.SiteEditor_PortabilitySection_ws, editLabel, false); fWsText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void browseButtonSelected(FormEntry entry) { BusyIndicator.showWhile(fWsText.getText().getDisplay(), new Runnable() { public void run() { @@ -188,6 +195,7 @@ public class DataPortabilitySection extends PDESection implements IFormPart, IPa }); } + @Override public void textValueChanged(FormEntry text) { try { applyValue(IEnvironment.P_WS, text.getValue()); @@ -203,6 +211,7 @@ public class DataPortabilitySection extends PDESection implements IFormPart, IPa fNlText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void browseButtonSelected(FormEntry entry) { BusyIndicator.showWhile(fNlText.getText().getDisplay(), new Runnable() { public void run() { @@ -212,6 +221,7 @@ public class DataPortabilitySection extends PDESection implements IFormPart, IPa }); } + @Override public void textValueChanged(FormEntry text) { try { applyValue(IEnvironment.P_NL, text.getValue()); @@ -226,6 +236,7 @@ public class DataPortabilitySection extends PDESection implements IFormPart, IPa fArchText = new FormEntry(container, toolkit, PDEUIMessages.SiteEditor_PortabilitySection_arch, editLabel, false); fArchText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void browseButtonSelected(FormEntry entry) { BusyIndicator.showWhile(fArchText.getText().getDisplay(), new Runnable() { public void run() { @@ -235,6 +246,7 @@ public class DataPortabilitySection extends PDESection implements IFormPart, IPa }); } + @Override public void textValueChanged(FormEntry text) { try { applyValue(IEnvironment.P_ARCH, text.getValue()); @@ -251,6 +263,7 @@ public class DataPortabilitySection extends PDESection implements IFormPart, IPa section.setClient(container); } + @Override public void dispose() { IFeatureModel model = (IFeatureModel) getPage().getModel(); if (model != null) @@ -263,6 +276,7 @@ public class DataPortabilitySection extends PDESection implements IFormPart, IPa * * @see org.eclipse.ui.forms.AbstractFormPart#initialize(org.eclipse.ui.forms.IManagedForm) */ + @Override public void initialize(IManagedForm form) { IFeatureModel model = (IFeatureModel) getPage().getModel(); if (model != null) @@ -275,6 +289,7 @@ public class DataPortabilitySection extends PDESection implements IFormPart, IPa gd.widthHint = 30; } + @Override public void modelChanged(IModelChangedEvent e) { markStale(); } @@ -298,6 +313,7 @@ public class DataPortabilitySection extends PDESection implements IFormPart, IPa } } + @Override public void refresh() { if (fCurrentInput == null) { clearFields(); @@ -329,6 +345,7 @@ public class DataPortabilitySection extends PDESection implements IFormPart, IPa refresh(); } + @Override public void setFocus() { if (fOsText != null) fOsText.getText().setFocus(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/IncludedFeaturesDetailsSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/IncludedFeaturesDetailsSection.java index 3efa58a..a79c1d6 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/IncludedFeaturesDetailsSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/IncludedFeaturesDetailsSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -28,7 +28,7 @@ import org.eclipse.swt.widgets.*; import org.eclipse.ui.forms.*; import org.eclipse.ui.forms.widgets.*; -public class IncludedFeaturesDetailsSection extends PDESection implements IFormPart, IPartSelectionListener { +public class IncludedFeaturesDetailsSection extends PDESection implements IPartSelectionListener { protected IFeatureChild fInput; private FormEntry fNameText; @@ -56,18 +56,21 @@ public class IncludedFeaturesDetailsSection extends PDESection implements IFormP createClient(getSection(), page.getManagedForm().getToolkit()); } + @Override public void cancelEdit() { fNameText.cancelEdit(); fVersionText.cancelEdit(); super.cancelEdit(); } + @Override public void commit(boolean onSave) { fNameText.commit(); fVersionText.commit(); super.commit(onSave); } + @Override public void createClient(Section section, FormToolkit toolkit) { section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); @@ -79,6 +82,7 @@ public class IncludedFeaturesDetailsSection extends PDESection implements IFormP fNameText = new FormEntry(container, toolkit, PDEUIMessages.SiteEditor_IncludedFeaturesDetailsSection_featureLabel, null, false); fNameText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void textValueChanged(FormEntry text) { if (fInput != null) try { @@ -92,6 +96,7 @@ public class IncludedFeaturesDetailsSection extends PDESection implements IFormP fVersionText = new FormEntry(container, toolkit, PDEUIMessages.FeatureEditor_SpecSection_version, null, false); fVersionText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void textValueChanged(FormEntry text) { if (fInput != null) try { @@ -109,6 +114,7 @@ public class IncludedFeaturesDetailsSection extends PDESection implements IFormP gd.colspan = 2; fOptionalButton.setLayoutData(gd); fOptionalButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { if (!fBlockNotification) { try { @@ -130,6 +136,7 @@ public class IncludedFeaturesDetailsSection extends PDESection implements IFormP gd.indent = 5; fSearchRootButton.setLayoutData(gd); fSearchRootButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { if (!fBlockNotification) { try { @@ -148,6 +155,7 @@ public class IncludedFeaturesDetailsSection extends PDESection implements IFormP gd.indent = 5; fSearchSelfButton.setLayoutData(gd); fSearchSelfButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { if (!fBlockNotification) { try { @@ -166,6 +174,7 @@ public class IncludedFeaturesDetailsSection extends PDESection implements IFormP gd.indent = 5; fSearchBothButton.setLayoutData(gd); fSearchBothButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { if (!fBlockNotification) { try { @@ -181,6 +190,7 @@ public class IncludedFeaturesDetailsSection extends PDESection implements IFormP section.setClient(container); } + @Override public void dispose() { IFeatureModel model = (IFeatureModel) getPage().getModel(); if (model != null) @@ -193,6 +203,7 @@ public class IncludedFeaturesDetailsSection extends PDESection implements IFormP * * @see org.eclipse.ui.forms.AbstractFormPart#initialize(org.eclipse.ui.forms.IManagedForm) */ + @Override public void initialize(IManagedForm form) { IFeatureModel model = (IFeatureModel) getPage().getModel(); if (model != null) @@ -200,10 +211,12 @@ public class IncludedFeaturesDetailsSection extends PDESection implements IFormP super.initialize(form); } + @Override public void modelChanged(IModelChangedEvent e) { markStale(); } + @Override public void refresh() { update(); super.refresh(); @@ -222,6 +235,7 @@ public class IncludedFeaturesDetailsSection extends PDESection implements IFormP update(); } + @Override public void setFocus() { if (fNameText != null) fNameText.getText().setFocus(); @@ -257,6 +271,7 @@ public class IncludedFeaturesDetailsSection extends PDESection implements IFormP fBlockNotification = false; } + @Override public boolean isEditable() { return getPage().getPDEEditor().getAggregateModel().isEditable(); } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/IncludedFeaturesPortabilitySection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/IncludedFeaturesPortabilitySection.java index bcfe504..b40cf99 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/IncludedFeaturesPortabilitySection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/IncludedFeaturesPortabilitySection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -30,7 +30,7 @@ import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.forms.*; import org.eclipse.ui.forms.widgets.*; -public class IncludedFeaturesPortabilitySection extends PDESection implements IFormPart, IPartSelectionListener { +public class IncludedFeaturesPortabilitySection extends PDESection implements IPartSelectionListener { public static Choice[] getArchChoices() { return getKnownChoices(Platform.knownOSArchValues()); } @@ -95,6 +95,7 @@ public class IncludedFeaturesPortabilitySection extends PDESection implements IF fCurrentInput.setArch(value); } + @Override public void cancelEdit() { fOsText.cancelEdit(); fWsText.cancelEdit(); @@ -103,6 +104,7 @@ public class IncludedFeaturesPortabilitySection extends PDESection implements IF super.cancelEdit(); } + @Override public boolean canPaste(Clipboard clipboard) { TransferData[] types = clipboard.getAvailableTypes(); Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()}; @@ -133,6 +135,7 @@ public class IncludedFeaturesPortabilitySection extends PDESection implements IF fArchText.setValue(null, true); } + @Override public void commit(boolean onSave) { fOsText.commit(); fWsText.commit(); @@ -141,6 +144,7 @@ public class IncludedFeaturesPortabilitySection extends PDESection implements IF super.commit(onSave); } + @Override public void createClient(Section section, FormToolkit toolkit) { section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); @@ -156,6 +160,7 @@ public class IncludedFeaturesPortabilitySection extends PDESection implements IF fOsText = new FormEntry(container, toolkit, PDEUIMessages.SiteEditor_PortabilitySection_os, editLabel, false); fOsText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void browseButtonSelected(FormEntry entry) { BusyIndicator.showWhile(fOsText.getText().getDisplay(), new Runnable() { public void run() { @@ -165,6 +170,7 @@ public class IncludedFeaturesPortabilitySection extends PDESection implements IF }); } + @Override public void textValueChanged(FormEntry text) { try { applyValue(IEnvironment.P_OS, text.getValue()); @@ -179,6 +185,7 @@ public class IncludedFeaturesPortabilitySection extends PDESection implements IF fWsText = new FormEntry(container, toolkit, PDEUIMessages.SiteEditor_PortabilitySection_ws, editLabel, false); fWsText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void browseButtonSelected(FormEntry entry) { BusyIndicator.showWhile(fWsText.getText().getDisplay(), new Runnable() { public void run() { @@ -188,6 +195,7 @@ public class IncludedFeaturesPortabilitySection extends PDESection implements IF }); } + @Override public void textValueChanged(FormEntry text) { try { applyValue(IEnvironment.P_WS, text.getValue()); @@ -203,6 +211,7 @@ public class IncludedFeaturesPortabilitySection extends PDESection implements IF fNlText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void browseButtonSelected(FormEntry entry) { BusyIndicator.showWhile(fNlText.getText().getDisplay(), new Runnable() { public void run() { @@ -212,6 +221,7 @@ public class IncludedFeaturesPortabilitySection extends PDESection implements IF }); } + @Override public void textValueChanged(FormEntry text) { try { applyValue(IEnvironment.P_NL, text.getValue()); @@ -226,6 +236,7 @@ public class IncludedFeaturesPortabilitySection extends PDESection implements IF fArchText = new FormEntry(container, toolkit, PDEUIMessages.SiteEditor_PortabilitySection_arch, editLabel, false); fArchText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void browseButtonSelected(FormEntry entry) { BusyIndicator.showWhile(fArchText.getText().getDisplay(), new Runnable() { public void run() { @@ -235,6 +246,7 @@ public class IncludedFeaturesPortabilitySection extends PDESection implements IF }); } + @Override public void textValueChanged(FormEntry text) { try { applyValue(IEnvironment.P_ARCH, text.getValue()); @@ -251,6 +263,7 @@ public class IncludedFeaturesPortabilitySection extends PDESection implements IF section.setClient(container); } + @Override public void dispose() { IFeatureModel model = (IFeatureModel) getPage().getModel(); if (model != null) @@ -263,6 +276,7 @@ public class IncludedFeaturesPortabilitySection extends PDESection implements IF * * @see org.eclipse.ui.forms.AbstractFormPart#initialize(org.eclipse.ui.forms.IManagedForm) */ + @Override public void initialize(IManagedForm form) { IFeatureModel model = (IFeatureModel) getPage().getModel(); if (model != null) @@ -275,6 +289,7 @@ public class IncludedFeaturesPortabilitySection extends PDESection implements IF gd.widthHint = 30; } + @Override public void modelChanged(IModelChangedEvent e) { markStale(); } @@ -298,6 +313,7 @@ public class IncludedFeaturesPortabilitySection extends PDESection implements IF } } + @Override public void refresh() { if (fCurrentInput == null) { clearFields(); @@ -329,6 +345,7 @@ public class IncludedFeaturesPortabilitySection extends PDESection implements IF refresh(); } + @Override public void setFocus() { if (fOsText != null) fOsText.getText().setFocus(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/PluginDetailsSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/PluginDetailsSection.java index 86db563..b23f444 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/PluginDetailsSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/feature/PluginDetailsSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -30,7 +30,7 @@ import org.eclipse.ui.forms.*; import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; -public class PluginDetailsSection extends PDESection implements IFormPart, IPartSelectionListener { +public class PluginDetailsSection extends PDESection implements IPartSelectionListener { protected IFeaturePlugin fInput; private FormEntry fNameText; @@ -56,6 +56,7 @@ public class PluginDetailsSection extends PDESection implements IFormPart, IPart createClient(getSection(), page.getManagedForm().getToolkit()); } + @Override public void cancelEdit() { fVersionText.cancelEdit(); fdownloadSizeText.cancelEdit(); @@ -63,6 +64,7 @@ public class PluginDetailsSection extends PDESection implements IFormPart, IPart super.cancelEdit(); } + @Override public void commit(boolean onSave) { fVersionText.commit(); fdownloadSizeText.commit(); @@ -70,6 +72,7 @@ public class PluginDetailsSection extends PDESection implements IFormPart, IPart super.commit(onSave); } + @Override public void createClient(Section section, FormToolkit toolkit) { section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); @@ -87,6 +90,7 @@ public class PluginDetailsSection extends PDESection implements IFormPart, IPart fVersionText = new FormEntry(container, toolkit, PDEUIMessages.FeatureEditor_SpecSection_version, null, false); fVersionText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void textValueChanged(FormEntry text) { if (fInput != null) try { @@ -102,6 +106,7 @@ public class PluginDetailsSection extends PDESection implements IFormPart, IPart fdownloadSizeText = new FormEntry(container, toolkit, PDEUIMessages.SiteEditor_PluginDetailsSection_downloadSize, null, false); fdownloadSizeText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void textValueChanged(FormEntry text) { if (fInput != null) try { @@ -117,6 +122,7 @@ public class PluginDetailsSection extends PDESection implements IFormPart, IPart fInstallSizeText = new FormEntry(container, toolkit, PDEUIMessages.SiteEditor_PluginDetailsSection_installSize, null, false); fInstallSizeText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void textValueChanged(FormEntry text) { if (fInput != null) try { @@ -134,6 +140,7 @@ public class PluginDetailsSection extends PDESection implements IFormPart, IPart gd.horizontalSpan = 2; fUnpackButton.setLayoutData(gd); fUnpackButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { try { if (!fBlockNotification) @@ -148,6 +155,7 @@ public class PluginDetailsSection extends PDESection implements IFormPart, IPart section.setClient(container); } + @Override public void dispose() { IFeatureModel model = (IFeatureModel) getPage().getModel(); if (model != null) @@ -160,6 +168,7 @@ public class PluginDetailsSection extends PDESection implements IFormPart, IPart * * @see org.eclipse.ui.forms.AbstractFormPart#initialize(org.eclipse.ui.forms.IManagedForm) */ + @Override public void initialize(IManagedForm form) { IFeatureModel model = (IFeatureModel) getPage().getModel(); if (model != null) @@ -172,10 +181,12 @@ public class PluginDetailsSection extends PDESection implements IFormPart, IPart gd.widthHint = 30; } + @Override public void modelChanged(IModelChangedEvent e) { markStale(); } + @Override public void refresh() { update(); super.refresh(); @@ -196,6 +207,7 @@ public class PluginDetailsSection extends PDESection implements IFormPart, IPart update(); } + @Override public void setFocus() { if (fdownloadSizeText != null) fdownloadSizeText.getText().setFocus(); @@ -227,6 +239,7 @@ public class PluginDetailsSection extends PDESection implements IFormPart, IPart fUnpackButton.setEnabled(editable); } + @Override public boolean isEditable() { return getPage().getPDEEditor().getAggregateModel().isEditable(); } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/DependencyManagementSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/DependencyManagementSection.java index dc5d52a..d4584f7 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/DependencyManagementSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/DependencyManagementSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,7 +23,8 @@ import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.*; import org.eclipse.jface.window.Window; -import org.eclipse.pde.core.*; +import org.eclipse.pde.core.IBaseModel; +import org.eclipse.pde.core.IModelChangedEvent; import org.eclipse.pde.core.build.*; import org.eclipse.pde.core.plugin.*; import org.eclipse.pde.internal.core.*; @@ -59,7 +60,7 @@ import org.eclipse.ui.forms.widgets.*; import org.eclipse.ui.part.FileEditorInput; import org.osgi.service.prefs.BackingStoreException; -public class DependencyManagementSection extends TableSection implements IModelChangedListener, IPluginModelListener, IPropertyChangeListener { +public class DependencyManagementSection extends TableSection implements IPluginModelListener, IPropertyChangeListener { private TableViewer fAdditionalTable; private Vector<String> fAdditionalBundles; @@ -122,11 +123,13 @@ public class DependencyManagementSection extends TableSection implements IModelC } } - class SecondaryTableLabelProvider extends SharedLabelProvider implements ITableLabelProvider { + class SecondaryTableLabelProvider extends SharedLabelProvider { + @Override public String getColumnText(Object obj, int index) { return obj.toString(); } + @Override public Image getColumnImage(Object obj, int index) { String pluginID = obj.toString(); IPluginModelBase model = PluginRegistry.findModel(pluginID); @@ -151,6 +154,7 @@ public class DependencyManagementSection extends TableSection implements IModelC } } + @Override protected void createClient(Section section, FormToolkit toolkit) { FormText text = toolkit.createFormText(section, true); text.setText(PDEUIMessages.SecondaryBundlesSection_desc, false, false); @@ -173,6 +177,7 @@ public class DependencyManagementSection extends TableSection implements IModelC resolveText.setText(PDEUIMessages.SecondaryBundlesSection_resolve, true, true); resolveText.setLayoutData(gd); resolveText.addHyperlinkListener(new HyperlinkAdapter() { + @Override public void linkActivated(HyperlinkEvent e) { doAddDependencies(); } @@ -189,6 +194,7 @@ public class DependencyManagementSection extends TableSection implements IModelC gd.horizontalIndent = 20; fRequireBundleButton.setLayoutData(gd); fRequireBundleButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { savePreferences(); } @@ -283,6 +289,7 @@ public class DependencyManagementSection extends TableSection implements IModelC } } + @Override protected void fillContextMenu(IMenuManager manager) { ISelection selection = fAdditionalTable.getSelection(); manager.add(fNewAction); @@ -296,6 +303,7 @@ public class DependencyManagementSection extends TableSection implements IModelC getPage().getPDEEditor().getContributor().contextMenuAboutToShow(manager); } + @Override public void refresh() { fAdditionalBundles = null; if (!fAdditionalTable.getControl().isDisposed()) @@ -303,6 +311,7 @@ public class DependencyManagementSection extends TableSection implements IModelC super.refresh(); } + @Override protected void buttonSelected(int index) { switch (index) { case ADD_INDEX : @@ -320,6 +329,7 @@ public class DependencyManagementSection extends TableSection implements IModelC } } + @Override protected void handleDoubleClick(IStructuredSelection sel) { handleOpen(sel); } @@ -358,18 +368,21 @@ public class DependencyManagementSection extends TableSection implements IModelC private void makeActions() { fNewAction = new Action(ADD) { + @Override public void run() { handleNew(); } }; fOpenAction = new Action(OPEN) { + @Override public void run() { handleOpen(fAdditionalTable.getSelection()); } }; fRemoveAction = new Action(REMOVE) { + @Override public void run() { handleRemove(); } @@ -449,6 +462,7 @@ public class DependencyManagementSection extends TableSection implements IModelC /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.TableSection#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection) */ + @Override protected void selectionChanged(IStructuredSelection sel) { // Update global selection getPage().getPDEEditor().setSelection(sel); @@ -463,6 +477,7 @@ public class DependencyManagementSection extends TableSection implements IModelC updateUpDownButtons(); } + @Override public void modelChanged(IModelChangedEvent event) { if (event.getChangeType() == IModelChangedEvent.WORLD_CHANGED) { markStale(); @@ -477,6 +492,7 @@ public class DependencyManagementSection extends TableSection implements IModelC /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.PDESection#doGlobalAction(java.lang.String) */ + @Override public boolean doGlobalAction(String actionId) { if (!isEditable()) { @@ -504,6 +520,7 @@ public class DependencyManagementSection extends TableSection implements IModelC /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#canPaste(java.lang.Object, java.lang.Object[]) */ + @Override protected boolean canPaste(Object targetObject, Object[] sourceObjects) { HashSet<String> secondaryDepSet = null; // Only String objects representing non-duplicate secondary @@ -559,6 +576,7 @@ public class DependencyManagementSection extends TableSection implements IModelC /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#doPaste(java.lang.Object, java.lang.Object[]) */ + @Override protected void doPaste(Object targetObject, Object[] sourceObjects) { // Get the build model IBuildModel buildModel = getBuildModel(true); @@ -599,6 +617,7 @@ public class DependencyManagementSection extends TableSection implements IModelC } } + @Override public void dispose() { IPluginModelBase model = (IPluginModelBase) getPage().getModel(); if (model != null) @@ -663,6 +682,7 @@ public class DependencyManagementSection extends TableSection implements IModelC } } + @Override protected boolean createCount() { return true; } @@ -670,6 +690,7 @@ public class DependencyManagementSection extends TableSection implements IModelC /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#isDragAndDropEnabled() */ + @Override protected boolean isDragAndDropEnabled() { return true; } @@ -677,6 +698,7 @@ public class DependencyManagementSection extends TableSection implements IModelC /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#canDragMove(java.lang.Object[]) */ + @Override public boolean canDragMove(Object[] sourceObjects) { if (validateDragMoveSanity(sourceObjects) == false) { return false; @@ -704,6 +726,7 @@ public class DependencyManagementSection extends TableSection implements IModelC /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#canDropMove(java.lang.Object, java.lang.Object[], int) */ + @Override public boolean canDropMove(Object targetObject, Object[] sourceObjects, int targetLocation) { // Sanity check if (validateDropMoveSanity(targetObject, sourceObjects) == false) { @@ -780,6 +803,7 @@ public class DependencyManagementSection extends TableSection implements IModelC /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#doDropMove(java.lang.Object, java.lang.Object[], int) */ + @Override public void doDropMove(Object targetObject, Object[] sourceObjects, int targetLocation) { // Sanity check if (validateDropMoveSanity(targetObject, sourceObjects) == false) { diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExportPackageSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExportPackageSection.java index 8511f62..ac0499a 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExportPackageSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExportPackageSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2012 IBM Corporation and others. + * Copyright (c) 2005, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -13,8 +13,6 @@ package org.eclipse.pde.internal.ui.editor.plugin; -import org.eclipse.jdt.core.IPackageFragment; - import java.util.*; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; @@ -27,7 +25,8 @@ import org.eclipse.jdt.ui.actions.ShowInPackageViewAction; import org.eclipse.jface.action.*; import org.eclipse.jface.viewers.*; import org.eclipse.jface.window.Window; -import org.eclipse.pde.core.*; +import org.eclipse.pde.core.IBaseModel; +import org.eclipse.pde.core.IModelChangedEvent; import org.eclipse.pde.core.plugin.IPluginModelBase; import org.eclipse.pde.internal.core.ICoreConstants; import org.eclipse.pde.internal.core.bundle.BundlePluginBase; @@ -53,7 +52,7 @@ import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; import org.osgi.framework.Constants; -public class ExportPackageSection extends TableSection implements IModelChangedListener { +public class ExportPackageSection extends TableSection { private static final int ADD_INDEX = 0; private static final int REMOVE_INDEX = 1; @@ -93,6 +92,7 @@ public class ExportPackageSection extends TableSection implements IModelChangedL * @see org.eclipse.pde.internal.ui.editor.PDESection#createClient(org.eclipse.ui.forms.widgets.Section, * org.eclipse.ui.forms.widgets.FormToolkit) */ + @Override protected void createClient(Section section, FormToolkit toolkit) { section.setText(PDEUIMessages.ExportPackageSection_title); if (isFragment()) @@ -107,6 +107,7 @@ public class ExportPackageSection extends TableSection implements IModelChangedL fPackageViewer.setContentProvider(new ExportPackageContentProvider()); fPackageViewer.setLabelProvider(PDEPlugin.getDefault().getLabelProvider()); fPackageViewer.setComparator(new ViewerComparator() { + @Override public int compare(Viewer viewer, Object e1, Object e2) { String s1 = e1.toString(); String s2 = e2.toString(); @@ -134,6 +135,7 @@ public class ExportPackageSection extends TableSection implements IModelChangedL updateButtons(); } + @Override public boolean doGlobalAction(String actionId) { if (!isEditable()) { @@ -157,6 +159,7 @@ public class ExportPackageSection extends TableSection implements IModelChangedL return false; } + @Override public void dispose() { IBundleModel model = getBundleModel(); if (model != null) @@ -167,6 +170,7 @@ public class ExportPackageSection extends TableSection implements IModelChangedL /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#canPaste(java.lang.Object, java.lang.Object[]) */ + @Override protected boolean canPaste(Object targetObject, Object[] sourceObjects) { HashMap<?, ?> currentPackageFragments = null; // Only export package objects that represent existing package @@ -287,6 +291,7 @@ public class ExportPackageSection extends TableSection implements IModelChangedL /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#doPaste() */ + @Override protected void doPaste(Object targetObject, Object[] sourceObjects) { // Get the model IBundleModel model = getBundleModel(); @@ -321,6 +326,7 @@ public class ExportPackageSection extends TableSection implements IModelChangedL } } + @Override protected void selectionChanged(IStructuredSelection sel) { getPage().getPDEEditor().setSelection(sel); updateButtons(); @@ -357,6 +363,7 @@ public class ExportPackageSection extends TableSection implements IModelChangedL return true; } + @Override protected void handleDoubleClick(IStructuredSelection selection) { handleGoToPackage(selection); } @@ -387,6 +394,7 @@ public class ExportPackageSection extends TableSection implements IModelChangedL } } + @Override protected void buttonSelected(int index) { switch (index) { case ADD_INDEX : @@ -497,6 +505,7 @@ public class ExportPackageSection extends TableSection implements IModelChangedL return buffer.toString(); } + @Override public void modelChanged(IModelChangedEvent event) { if (event.getChangeType() == IModelChangedEvent.WORLD_CHANGED) { fHeader = null; @@ -541,6 +550,7 @@ public class ExportPackageSection extends TableSection implements IModelChangedL } } + @Override public void refresh() { fPackageViewer.refresh(); super.refresh(); @@ -548,17 +558,20 @@ public class ExportPackageSection extends TableSection implements IModelChangedL private void makeActions() { fAddAction = new Action(PDEUIMessages.RequiresSection_add) { + @Override public void run() { handleAdd(); } }; fAddAction.setEnabled(isEditable()); fGoToAction = new Action(PDEUIMessages.ImportPackageSection_goToPackage) { + @Override public void run() { handleGoToPackage(fPackageViewer.getSelection()); } }; fRemoveAction = new Action(PDEUIMessages.RequiresSection_delete) { + @Override public void run() { handleRemove(); } @@ -566,12 +579,14 @@ public class ExportPackageSection extends TableSection implements IModelChangedL fRemoveAction.setEnabled(isEditable()); fPropertiesAction = new Action(PDEUIMessages.ExportPackageSection_propertyAction) { + @Override public void run() { handleOpenProperties(); } }; } + @Override protected void fillContextMenu(IMenuManager manager) { ISelection selection = fPackageViewer.getSelection(); manager.add(fAddAction); @@ -584,6 +599,7 @@ public class ExportPackageSection extends TableSection implements IModelChangedL getPage().getPDEEditor().getContributor().contextMenuAboutToShow(manager); if (singleSelection) manager.add(new Action(PDEUIMessages.ExportPackageSection_findReferences) { + @Override public void run() { doSearch(fPackageViewer.getSelection()); } @@ -640,6 +656,7 @@ public class ExportPackageSection extends TableSection implements IModelChangedL return (manifestVersion < 2) ? ICoreConstants.PROVIDE_PACKAGE : Constants.EXPORT_PACKAGE; } + @Override protected boolean createCount() { return true; } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java index 0d8242b..65b6dea 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ExtensionsSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,9 +12,6 @@ *******************************************************************************/ package org.eclipse.pde.internal.ui.editor.plugin; -import java.util.ArrayList; -import org.eclipse.core.runtime.IConfigurationElement; - import java.util.*; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.*; @@ -31,7 +28,6 @@ import org.eclipse.jface.viewers.*; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.osgi.util.NLS; import org.eclipse.pde.core.IModelChangedEvent; -import org.eclipse.pde.core.IModelChangedListener; import org.eclipse.pde.core.plugin.*; import org.eclipse.pde.internal.core.PDECore; import org.eclipse.pde.internal.core.ibundle.IBundlePluginModelBase; @@ -65,7 +61,7 @@ import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; import org.eclipse.ui.progress.WorkbenchJob; -public class ExtensionsSection extends TreeSection implements IModelChangedListener, IPropertyChangeListener { +public class ExtensionsSection extends TreeSection implements IPropertyChangeListener { private static final int REFRESHJOB_DELAY_TIME = 1200; // milliseconds to wait private static final int ACCELERATED_SCROLLING = 15; // lines to skip @@ -137,10 +133,12 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe } class ExtensionLabelProvider extends LabelProvider implements IFontProvider { + @Override public String getText(Object obj) { return resolveObjectName(obj); } + @Override public Image getImage(Object obj) { return resolveObjectImage(obj); } @@ -237,6 +235,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe return null; } + @Override public void createClient(Section section, FormToolkit toolkit) { initializeImages(); Composite container = createClientContainer(section, 2, toolkit); @@ -287,6 +286,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe }); // Add sort action to the tool bar fSortAction = new SortAction(fExtensionTree, PDEUIMessages.ExtensionsPage_sortAlpha, null, null, this) { + @Override public void run() { Object[] expanded = fFilteredTree.getViewer().getVisibleExpandedElements(); try { @@ -315,12 +315,14 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe section.setTextClient(toolbar); } + @Override protected void selectionChanged(IStructuredSelection selection) { getPage().getPDEEditor().setSelection(selection); updateButtons(selection); getTreePart().getButton(BUTTON_EDIT).setVisible(isSelectionEditable(selection)); } + @Override protected void buttonSelected(int index) { switch (index) { case BUTTON_ADD : @@ -344,6 +346,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe /* (non-Javadoc) * @see org.eclipse.ui.forms.AbstractFormPart#dispose() */ + @Override public void dispose() { // Explicitly call the dispose method on the extensions tree if (fFilteredTree != null) { @@ -359,6 +362,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.PDESection#doGlobalAction(java.lang.String) */ + @Override public boolean doGlobalAction(String actionId) { if (actionId.equals(ActionFactory.FIND.getId()) && fFilterRelatedAction != null) { fFilterRelatedAction.run(); @@ -391,6 +395,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe return false; } + @Override public boolean setFormInput(Object object) { if (object instanceof IPluginExtension || object instanceof IPluginElement) { fExtensionTree.setSelection(new StructuredSelection(object), true); @@ -399,6 +404,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe return false; } + @Override protected void fillContextMenu(IMenuManager manager) { ISelection selection = fExtensionTree.getSelection(); final IStructuredSelection ssel = (IStructuredSelection) selection; @@ -422,14 +428,17 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe } else if (ssel.size() > 1) { // Add delete action Action delAction = new Action() { + @Override public ImageDescriptor getImageDescriptor() { return PDEPluginImages.DESC_DELETE; } + @Override public ImageDescriptor getDisabledImageDescriptor() { return PDEPluginImages.DESC_REMOVE_ATT_DISABLED; } + @Override public void run() { handleDelete(); } @@ -447,10 +456,12 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe if (fFilteredTree.isFiltered()) { // Add action to clear the current filtering manager.add(new Action() { + @Override public String getText() { return PDEUIMessages.ShowAllExtensionsAction_label; } + @Override public void run() { Text filterText = fFilteredTree.getFilterControl(); setBypassFilterDelay(true); @@ -497,6 +508,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe manager.add(new Separator()); if (fullMenu) { Action deleteAction = new Action(PDEUIMessages.ExtensionsSection_Remove) { + @Override public void run() { try { IPluginObject parentsParent = parent.getParent(); @@ -511,10 +523,12 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe } } + @Override public ImageDescriptor getImageDescriptor() { return PDEPluginImages.DESC_DELETE; } + @Override public ImageDescriptor getDisabledImageDescriptor() { return PDEPluginImages.DESC_REMOVE_ATT_DISABLED; } @@ -629,6 +643,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe public void run() { ((ManifestEditor) getPage().getEditor()).ensurePluginContextPresence(); NewExtensionWizard wizard = new NewExtensionWizard(project, (IPluginModelBase) getPage().getModel(), (ManifestEditor) getPage().getPDEEditor()) { + @Override public boolean performFinish() { return super.performFinish(); } @@ -770,6 +785,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe fGenericElementImage = provider.get(PDEPluginImages.DESC_GENERIC_XML_OBJ); } + @Override public void refresh() { // The model changed but the editor is still open, we should try to retain expansion, selection will be retained on its own Object[] expanded = fExtensionTree.getExpandedElements(); @@ -832,6 +848,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe } } + @Override public void modelChanged(IModelChangedEvent event) { if (event.getChangeType() == IModelChangedEvent.WORLD_CHANGED) { markStale(); @@ -1039,6 +1056,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe return new String(); } + @Override public void setFocus() { if (fExtensionTree != null) fExtensionTree.getTree().setFocus(); @@ -1067,6 +1085,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe return output.toString(); } + @Override public boolean canCopy(ISelection selection) { // Partial fix for Bug 360079, enables Ctrl+C in filter text if plugin model is editable if (fFilteredTree.getFilterControl().isFocusControl() && !selection.isEmpty()) { @@ -1076,6 +1095,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe return super.canCopy(selection); } + @Override public boolean canPaste(Clipboard clipboard) { // Partial fix for Bug 360079, enables Ctrl+V in filter text if plugin model is editable if (fFilteredTree.getFilterControl().isFocusControl()) { @@ -1088,6 +1108,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#canPaste(java.lang.Object, java.lang.Object[]) */ + @Override protected boolean canPaste(Object targetObject, Object[] sourceObjects) { // Note: Multi-select in is enabled and this function can support // multiple source object but it needs to be investigated @@ -1234,6 +1255,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#doPaste(java.lang.Object, java.lang.Object[]) */ + @Override protected void doPaste(Object targetObject, Object[] sourceObjects) { // By default, fragment.xml does not exist until the first extension // or extension point is created. @@ -1395,20 +1417,24 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.TreeSection#createTreeViewer(org.eclipse.swt.widgets.Composite, int) */ + @Override protected TreeViewer createTreeViewer(Composite parent, int style) { fPatternFilter = new ExtensionsPatternFilter(); fFilteredTree = new FormFilteredTree(parent, style, fPatternFilter) { + @Override protected WorkbenchJob doCreateRefreshJob() { final WorkbenchJob job = super.doCreateRefreshJob(); job.addJobChangeListener(new JobChangeAdapter() { private ISelection selection; private boolean aboutToRunPassed = false; + @Override public void scheduled(IJobChangeEvent event) { ((ExtensionsPatternFilter) fFilteredTree.getPatternFilter()).clearMatchingLeafs(); selection = fExtensionTree.getSelection(); } + @Override public void aboutToRun(IJobChangeEvent event) { aboutToRunPassed = true; } @@ -1416,6 +1442,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe /* * Restores selection after tree refresh and expands tree up to matching leafs only */ + @Override public void done(IJobChangeEvent event) { if (aboutToRunPassed) { // restoring is only required if the job actually ran try { @@ -1438,6 +1465,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe return job; } + @Override protected long getRefreshJobDelay() { // Prolonged job delay time is required because of the attribute search being more costly in nature. // This can block input to the filter text severely. Thus it shouldn't happen when typing slowly. @@ -1447,12 +1475,14 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe return delay; } + @Override protected void clearText() { // bugfix: additional notification with textChanged() would cause a needless 2nd refresh job run // which in turn would have a longer delay time than the 1st run. setFilterText(""); //$NON-NLS-1$ } + @Override protected void textChanged() { String filterText = getFilterString(); if (filterText != null && filterText.length() == 0) { @@ -1481,6 +1511,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#isDragAndDropEnabled() */ + @Override protected boolean isDragAndDropEnabled() { return true; } @@ -1488,6 +1519,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#canDragMove(java.lang.Object[]) */ + @Override public boolean canDragMove(Object[] sourceObjects) { // Validate source objects if (validateDragMoveSanity(sourceObjects) == false) { @@ -1556,6 +1588,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#canDropMove(java.lang.Object, java.lang.Object[], int) */ + @Override public boolean canDropMove(Object targetObject, Object[] sourceObjects, int targetLocation) { // Sanity check if (validateDropMoveSanity(targetObject, sourceObjects) == false) { @@ -1771,6 +1804,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#doDragRemove(java.lang.Object[]) */ + @Override public void doDragRemove(Object[] sourceObjects) { // Validate source objects if (validateDragMoveSanity(sourceObjects) == false) { @@ -1810,6 +1844,7 @@ public class ExtensionsSection extends TreeSection implements IModelChangedListe /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#doDropMove(java.lang.Object, java.lang.Object[], int) */ + @Override public void doDropMove(Object targetObject, Object[] sourceObjects, int targetLocation) { // Sanity check if (validateDropMoveSanity(targetObject, sourceObjects) == false) { diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ImportPackageSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ImportPackageSection.java index 08a5ad6..0e48c34 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ImportPackageSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ImportPackageSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2012 IBM Corporation and others. + * Copyright (c) 2005, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,9 +10,6 @@ *******************************************************************************/ package org.eclipse.pde.internal.ui.editor.plugin; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.pde.core.target.NameVersionDescriptor; - import java.util.*; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; @@ -29,6 +26,7 @@ import org.eclipse.jface.window.Window; import org.eclipse.osgi.service.resolver.*; import org.eclipse.pde.core.*; import org.eclipse.pde.core.plugin.*; +import org.eclipse.pde.core.target.NameVersionDescriptor; import org.eclipse.pde.internal.core.*; import org.eclipse.pde.internal.core.bundle.BundlePluginBase; import org.eclipse.pde.internal.core.ibundle.*; @@ -58,7 +56,7 @@ import org.eclipse.ui.progress.UIJob; import org.osgi.framework.Constants; import org.osgi.framework.Version; -public class ImportPackageSection extends TableSection implements IModelChangedListener { +public class ImportPackageSection extends TableSection { private static final int ADD_INDEX = 0; private static final int REMOVE_INDEX = 1; @@ -73,10 +71,12 @@ public class ImportPackageSection extends TableSection implements IModelChangedL fUnderlying = underlying; } + @Override public String toString() { return getName(); } + @Override public boolean equals(Object obj) { if (obj instanceof ImportItemWrapper) { ImportItemWrapper item = (ImportItemWrapper) obj; @@ -85,6 +85,11 @@ public class ImportPackageSection extends TableSection implements IModelChangedL return false; } + @Override + public int hashCode() { + return getName().hashCode(); + } + public String getName() { if (fUnderlying instanceof ExportPackageDescription) return ((ExportPackageDescription) fUnderlying).getName(); @@ -126,10 +131,12 @@ public class ImportPackageSection extends TableSection implements IModelChangedL } class ImportPackageDialogLabelProvider extends LabelProvider { + @Override public Image getImage(Object element) { return JavaUI.getSharedImages().getImage(ISharedImages.IMG_OBJS_PACKAGE); } + @Override public String getText(Object element) { StringBuffer buffer = new StringBuffer(); ImportItemWrapper p = (ImportItemWrapper) element; @@ -170,6 +177,7 @@ public class ImportPackageSection extends TableSection implements IModelChangedL * @see org.eclipse.pde.internal.ui.editor.PDESection#createClient(org.eclipse.ui.forms.widgets.Section, * org.eclipse.ui.forms.widgets.FormToolkit) */ + @Override protected void createClient(Section section, FormToolkit toolkit) { section.setText(PDEUIMessages.ImportPackageSection_required); if (isFragment()) @@ -184,6 +192,7 @@ public class ImportPackageSection extends TableSection implements IModelChangedL fPackageViewer.setContentProvider(new ImportPackageContentProvider()); fPackageViewer.setLabelProvider(new PDELabelProvider() { + @Override public Image getObjectImage(PackageObject obj) { if (!(obj instanceof ImportPackageObject)) return super.getObjectImage(obj); @@ -196,6 +205,7 @@ public class ImportPackageSection extends TableSection implements IModelChangedL }); fPackageViewer.setComparator(new ViewerComparator() { + @Override public int compare(Viewer viewer, Object e1, Object e2) { String s1 = e1.toString(); String s2 = e2.toString(); @@ -218,6 +228,7 @@ public class ImportPackageSection extends TableSection implements IModelChangedL updateButtons(); } + @Override public boolean doGlobalAction(String actionId) { if (!isEditable()) { @@ -244,6 +255,7 @@ public class ImportPackageSection extends TableSection implements IModelChangedL /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#canPaste(java.lang.Object, java.lang.Object[]) */ + @Override protected boolean canPaste(Object targetObject, Object[] sourceObjects) { // Only non-duplicate import packages can be pasted for (int i = 0; i < sourceObjects.length; i++) { @@ -272,6 +284,7 @@ public class ImportPackageSection extends TableSection implements IModelChangedL return true; } + @Override public void dispose() { IBundleModel model = getBundleModel(); if (model != null) @@ -282,6 +295,7 @@ public class ImportPackageSection extends TableSection implements IModelChangedL /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#doPaste(java.lang.Object, java.lang.Object[]) */ + @Override protected void doPaste(Object targetObject, Object[] sourceObjects) { // Get the model IBundleModel model = getBundleModel(); @@ -320,6 +334,7 @@ public class ImportPackageSection extends TableSection implements IModelChangedL return Constants.IMPORT_PACKAGE; } + @Override protected void selectionChanged(IStructuredSelection sel) { getPage().getPDEEditor().setSelection(sel); updateButtons(); @@ -334,10 +349,12 @@ public class ImportPackageSection extends TableSection implements IModelChangedL tablePart.setButtonEnabled(PROPERTIES_INDEX, shouldEnableProperties(selected)); } + @Override protected void handleDoubleClick(IStructuredSelection selection) { handleGoToPackage(selection); } + @Override protected void buttonSelected(int index) { switch (index) { case ADD_INDEX : @@ -587,6 +604,7 @@ public class ImportPackageSection extends TableSection implements IModelChangedL return true; } + @Override public void modelChanged(final IModelChangedEvent event) { if (event.getChangeType() == IModelChangedEvent.WORLD_CHANGED) { fHeader = null; @@ -596,6 +614,7 @@ public class ImportPackageSection extends TableSection implements IModelChangedL // Model change may have come from a non UI thread such as the auto add dependencies operation. See bug 333533 UIJob job = new UIJob("Update package imports") { //$NON-NLS-1$ + @Override public IStatus runInUIThread(IProgressMonitor monitor) { if (Constants.IMPORT_PACKAGE.equals(event.getChangedProperty())) { refresh(); @@ -640,6 +659,7 @@ public class ImportPackageSection extends TableSection implements IModelChangedL job.schedule(); } + @Override public void refresh() { fPackageViewer.refresh(); super.refresh(); @@ -647,17 +667,20 @@ public class ImportPackageSection extends TableSection implements IModelChangedL private void makeActions() { fAddAction = new Action(PDEUIMessages.RequiresSection_add) { + @Override public void run() { handleAdd(); } }; fAddAction.setEnabled(isEditable()); fGoToAction = new Action(PDEUIMessages.ImportPackageSection_goToPackage) { + @Override public void run() { handleGoToPackage(fPackageViewer.getSelection()); } }; fRemoveAction = new Action(PDEUIMessages.RequiresSection_delete) { + @Override public void run() { handleRemove(); } @@ -665,12 +688,14 @@ public class ImportPackageSection extends TableSection implements IModelChangedL fRemoveAction.setEnabled(isEditable()); fPropertiesAction = new Action(PDEUIMessages.ImportPackageSection_propertyAction) { + @Override public void run() { handleOpenProperties(); } }; } + @Override protected void fillContextMenu(IMenuManager manager) { final ISelection selection = fPackageViewer.getSelection(); manager.add(fAddAction); @@ -686,6 +711,7 @@ public class ImportPackageSection extends TableSection implements IModelChangedL manager.add(new Separator()); if (singleSelection) { manager.add(new Action(PDEUIMessages.DependencyExtentSearchResultPage_referencesInPlugin) { + @Override public void run() { doReferenceSearch(selection); } @@ -802,6 +828,7 @@ public class ImportPackageSection extends TableSection implements IModelChangedL } } + @Override protected boolean createCount() { return true; } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/JarSelectionValidator.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/JarSelectionValidator.java index ed0d317..0d1841c 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/JarSelectionValidator.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/JarSelectionValidator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2012 IBM Corporation and others. + * Copyright (c) 2003, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,8 +21,7 @@ import org.eclipse.ui.dialogs.ISelectionStatusValidator; */ public class JarSelectionValidator implements ISelectionStatusValidator { - @SuppressWarnings("rawtypes") - private Class[] fAcceptedTypes; + private Class<?>[] fAcceptedTypes; private boolean fAllowMultipleSelection; /** @@ -30,8 +29,7 @@ public class JarSelectionValidator implements ISelectionStatusValidator { * @param allowMultipleSelection If set to <code>true</code>, the validator * allows multiple selection. */ - @SuppressWarnings("rawtypes") - public JarSelectionValidator(Class[] acceptedTypes, boolean allowMultipleSelection) { + public JarSelectionValidator(Class<?>[] acceptedTypes, boolean allowMultipleSelection) { Assert.isNotNull(acceptedTypes); fAcceptedTypes = acceptedTypes; fAllowMultipleSelection = allowMultipleSelection; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/LibrarySection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/LibrarySection.java index b8833c4..0747550 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/LibrarySection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/LibrarySection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -49,7 +49,7 @@ import org.eclipse.ui.model.WorkbenchContentProvider; import org.eclipse.ui.model.WorkbenchLabelProvider; import org.eclipse.ui.views.navigator.ResourceComparator; -public class LibrarySection extends TableSection implements IModelChangedListener, IBuildPropertiesConstants { +public class LibrarySection extends TableSection implements IBuildPropertiesConstants { private static final int NEW_INDEX = 0; private static final int ADD_INDEX = 1; @@ -68,6 +68,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene super(set); } + @Override public boolean select(Viewer viewer, Object parent, Object element) { if (element instanceof IFolder) return isPathValid(((IFolder) element).getProjectRelativePath()); @@ -79,11 +80,11 @@ public class LibrarySection extends TableSection implements IModelChangedListene class LibrarySelectionValidator extends JarSelectionValidator { - @SuppressWarnings("rawtypes") - public LibrarySelectionValidator(Class[] acceptedTypes, boolean allowMultipleSelection) { + public LibrarySelectionValidator(Class<?>[] acceptedTypes, boolean allowMultipleSelection) { super(acceptedTypes, allowMultipleSelection); } + @Override public boolean isValid(Object element) { return (element instanceof IFolder) ? true : super.isValid(element); } @@ -116,6 +117,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene return (BundleInputContext) manager.findContext(BundleInputContext.CONTEXT_ID); } + @Override public void createClient(Section section, FormToolkit toolkit) { section.setText(PDEUIMessages.ManifestEditor_LibrarySection_title); section.setDescription(getSectionDescription()); @@ -160,6 +162,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene private void makeActions() { fNewAction = new Action(PDEUIMessages.ManifestEditor_LibrarySection_newLibrary) { + @Override public void run() { handleNew(); } @@ -167,6 +170,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene fNewAction.setEnabled(isEditable()); fRenameAction = new Action(PDEUIMessages.EditableTablePart_renameAction) { + @Override public void run() { getRenameAction().run(); } @@ -174,6 +178,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene fRenameAction.setEnabled(isEditable()); fRemoveAction = new Action(PDEUIMessages.NewManifestEditor_LibrarySection_remove) { + @Override public void run() { handleRemove(); } @@ -181,12 +186,14 @@ public class LibrarySection extends TableSection implements IModelChangedListene fRemoveAction.setEnabled(isEditable()); } + @Override protected void selectionChanged(IStructuredSelection selection) { getPage().getPDEEditor().setSelection(selection); if (getPage().getModel().isEditable()) updateButtons(); } + @Override protected void buttonSelected(int index) { switch (index) { case NEW_INDEX : @@ -207,6 +214,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene } } + @Override public void dispose() { IPluginModelBase model = getModel(); if (model != null) @@ -217,6 +225,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.PDESection#doGlobalAction(java.lang.String) */ + @Override public boolean doGlobalAction(String actionId) { if (!isEditable()) { @@ -240,6 +249,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene return false; } + @Override public boolean setFormInput(Object object) { if (object instanceof IPluginLibrary) { fLibraryTable.setSelection(new StructuredSelection(object), true); @@ -248,6 +258,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene return false; } + @Override protected void fillContextMenu(IMenuManager manager) { manager.add(fNewAction); if (!fLibraryTable.getSelection().isEmpty()) { @@ -416,12 +427,14 @@ public class LibrarySection extends TableSection implements IModelChangedListene private void handleAdd() { final boolean[] updateClasspath = new boolean[] {true}; ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getPage().getSite().getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()) { + @Override protected Control createDialogArea(Composite parent) { Composite comp = (Composite) super.createDialogArea(parent); final Button button = new Button(comp, SWT.CHECK); button.setText(PDEUIMessages.LibrarySection_addDialogButton); button.setSelection(updateClasspath[0]); button.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { updateClasspath[0] = button.getSelection(); } @@ -431,8 +444,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene } }; - @SuppressWarnings("rawtypes") - Class[] acceptedClasses = new Class[] {IFile.class}; + Class<?>[] acceptedClasses = new Class[] {IFile.class}; dialog.setValidator(new LibrarySelectionValidator(acceptedClasses, true)); dialog.setTitle(PDEUIMessages.BuildEditor_ClasspathSection_jarsTitle); dialog.setMessage(PDEUIMessages.ClasspathSection_jarsMessage); @@ -573,6 +585,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene } } + @Override public void refresh() { if (fLibraryTable.getControl().isDisposed()) return; @@ -581,6 +594,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene super.refresh(); } + @Override public void modelChanged(IModelChangedEvent event) { if (event.getChangeType() == IModelChangedEvent.WORLD_CHANGED) { markStale(); @@ -602,6 +616,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene } } + @Override public void setFocus() { fLibraryTable.getTable().setFocus(); } @@ -609,6 +624,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#doPaste(java.lang.Object, java.lang.Object[]) */ + @Override protected void doPaste(Object targetObject, Object[] sourceObjects) { // Get the model IPluginModelBase model = getModel(); @@ -635,6 +651,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#canPaste(java.lang.Object, java.lang.Object[]) */ + @Override protected boolean canPaste(Object targetObject, Object[] sourceObjects) { HashSet<Path> librarySet = null; // Only source objects that are plugin libraries that have not already @@ -669,6 +686,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene return librarySet; } + @Override protected void entryModified(Object entry, String value) { try { IPluginModelBase model = getModel(); @@ -694,6 +712,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#isDragAndDropEnabled() */ + @Override protected boolean isDragAndDropEnabled() { return true; } @@ -701,6 +720,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#canDragMove(java.lang.Object[]) */ + @Override public boolean canDragMove(Object[] sourceObjects) { if (validateDragMoveSanity(sourceObjects) == false) { return false; @@ -729,6 +749,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#canDropMove(java.lang.Object, java.lang.Object[], int) */ + @Override public boolean canDropMove(Object targetObject, Object[] sourceObjects, int targetLocation) { // Sanity check if (validateDropMoveSanity(targetObject, sourceObjects) == false) { @@ -802,6 +823,7 @@ public class LibrarySection extends TableSection implements IModelChangedListene /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#doDropMove(java.lang.Object, java.lang.Object[], int) */ + @Override public void doDropMove(Object targetObject, Object[] sourceObjects, int targetLocation) { // Sanity check if (validateDropMoveSanity(targetObject, sourceObjects) == false) { diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/RequiresSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/RequiresSection.java index 65f5e66..f172ed1 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/RequiresSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/RequiresSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,7 +18,8 @@ import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.*; import org.eclipse.jface.window.Window; -import org.eclipse.pde.core.*; +import org.eclipse.pde.core.IModel; +import org.eclipse.pde.core.IModelChangedEvent; import org.eclipse.pde.core.plugin.*; import org.eclipse.pde.internal.core.*; import org.eclipse.pde.internal.core.bundle.BundlePluginBase; @@ -50,7 +51,7 @@ import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; import org.eclipse.ui.progress.UIJob; -public class RequiresSection extends TableSection implements IModelChangedListener, IPluginModelListener, IPropertyChangeListener { +public class RequiresSection extends TableSection implements IPluginModelListener, IPropertyChangeListener { private static final int ADD_INDEX = 0; private static final int REMOVE_INDEX = 1; @@ -88,6 +89,7 @@ public class RequiresSection extends TableSection implements IModelChangedListen resetImportInsertIndex(); } + @Override public void createClient(Section section, FormToolkit toolkit) { Composite container = createClientContainer(section, 2, toolkit); createViewerPartControl(container, SWT.MULTI, 2, toolkit); @@ -132,6 +134,7 @@ public class RequiresSection extends TableSection implements IModelChangedListen section.setTextClient(toolbar); } + @Override protected void selectionChanged(IStructuredSelection sel) { getPage().getPDEEditor().setSelection(sel); updateButtons(); @@ -165,10 +168,12 @@ public class RequiresSection extends TableSection implements IModelChangedListen tablePart.setButtonEnabled(DOWN_INDEX, canMove && hasSelection && isEditable() && table.getSelectionIndex() < table.getItemCount() - 1); } + @Override protected void handleDoubleClick(IStructuredSelection sel) { handleOpen(sel); } + @Override protected void buttonSelected(int index) { switch (index) { case ADD_INDEX : @@ -209,6 +214,7 @@ public class RequiresSection extends TableSection implements IModelChangedListen } } + @Override public void dispose() { IPluginModelBase model = (IPluginModelBase) getPage().getModel(); if (model != null) @@ -220,6 +226,7 @@ public class RequiresSection extends TableSection implements IModelChangedListen /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.PDESection#doGlobalAction(java.lang.String) */ + @Override public boolean doGlobalAction(String actionId) { if (!isEditable()) { @@ -246,6 +253,7 @@ public class RequiresSection extends TableSection implements IModelChangedListen /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#canPaste(java.lang.Object, java.lang.Object[]) */ + @Override protected boolean canPaste(Object targetObject, Object[] sourceObjects) { HashSet<?> existingImportsSet = null; // Only import objects that are not already existing imports can be @@ -272,6 +280,7 @@ public class RequiresSection extends TableSection implements IModelChangedListen /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#doPaste(java.lang.Object, java.lang.Object[]) */ + @Override protected void doPaste(Object targetObject, Object[] sourceObjects) { // Get the model IPluginModelBase model = getModel(); @@ -303,6 +312,7 @@ public class RequiresSection extends TableSection implements IModelChangedListen return (IPluginModelBase) getPage().getModel(); } + @Override public boolean setFormInput(Object object) { if (object instanceof IPluginImport) { ImportObject iobj = new ImportObject((IPluginImport) object); @@ -312,6 +322,7 @@ public class RequiresSection extends TableSection implements IModelChangedListen return false; } + @Override protected void fillContextMenu(IMenuManager manager) { ISelection selection = fImportViewer.getSelection(); manager.add(fAddAction); @@ -339,6 +350,7 @@ public class RequiresSection extends TableSection implements IModelChangedListen manager.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); } + @Override protected void registerPopupMenu(MenuManager popupMenuManager) { IEditorSite site = (IEditorSite) getPage().getSite(); site.registerContextMenu(site.getId() + ".requires", popupMenuManager, fViewerPart.getViewer(), false); //$NON-NLS-1$ @@ -506,22 +518,26 @@ public class RequiresSection extends TableSection implements IModelChangedListen private void makeActions() { fAddAction = new Action(PDEUIMessages.RequiresSection_add) { + @Override public void run() { handleAdd(); } }; fOpenAction = new Action(PDEUIMessages.RequiresSection_open) { + @Override public void run() { handleOpen(fImportViewer.getSelection()); } }; fRemoveAction = new Action(PDEUIMessages.RequiresSection_delete) { + @Override public void run() { handleRemove(); } }; if (isBundle()) { fPropertiesAction = new Action(PDEUIMessages.RequiresSection_properties) { + @Override public void run() { handleOpenProperties(); } @@ -529,12 +545,14 @@ public class RequiresSection extends TableSection implements IModelChangedListen } } + @Override public void refresh() { fImports = null; fImportViewer.refresh(); super.refresh(); } + @Override public void modelChanged(final IModelChangedEvent event) { if (event.getChangeType() == IModelChangedEvent.WORLD_CHANGED) { markStale(); @@ -543,6 +561,7 @@ public class RequiresSection extends TableSection implements IModelChangedListen // Model change may have come from a non UI thread such as the auto add dependencies operation. See bug 333533 UIJob job = new UIJob("Update required bundles") { //$NON-NLS-1$ + @Override public IStatus runInUIThread(IProgressMonitor monitor) { if (event.getChangedProperty() == IPluginBase.P_IMPORT_ORDER) { @@ -653,6 +672,7 @@ public class RequiresSection extends TableSection implements IModelChangedListen } } + @Override public void setFocus() { if (fImportViewer != null) fImportViewer.getTable().setFocus(); @@ -662,6 +682,7 @@ public class RequiresSection extends TableSection implements IModelChangedListen return getPage().getPDEEditor().getContextManager().findContext(BundleInputContext.CONTEXT_ID) != null; } + @Override protected boolean createCount() { return true; } @@ -675,6 +696,7 @@ public class RequiresSection extends TableSection implements IModelChangedListen /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#isDragAndDropEnabled() */ + @Override protected boolean isDragAndDropEnabled() { return true; } @@ -682,6 +704,7 @@ public class RequiresSection extends TableSection implements IModelChangedListen /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#canDragMove(java.lang.Object[]) */ + @Override public boolean canDragMove(Object[] sourceObjects) { if (validateDragMoveSanity(sourceObjects) == false) { return false; @@ -744,6 +767,7 @@ public class RequiresSection extends TableSection implements IModelChangedListen /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#canDropMove(java.lang.Object, java.lang.Object[], int) */ + @Override public boolean canDropMove(Object targetObject, Object[] sourceObjects, int targetLocation) { // Sanity check if (validateDropMoveSanity(targetObject, sourceObjects) == false) { @@ -787,6 +811,7 @@ public class RequiresSection extends TableSection implements IModelChangedListen /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.StructuredViewerSection#doDropMove(java.lang.Object, java.lang.Object[], int) */ + @Override public void doDropMove(Object targetObject, Object[] sourceObjects, int targetLocation) { // Sanity check if (validateDropMoveSanity(targetObject, sourceObjects) == false) { diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/rows/IdAttributeRow.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/rows/IdAttributeRow.java index a23d84b..94d2bbe 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/rows/IdAttributeRow.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/rows/IdAttributeRow.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 IBM Corporation and others. + * Copyright (c) 2008, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,6 +11,7 @@ package org.eclipse.pde.internal.ui.editor.plugin.rows; import java.util.Map; +import java.util.Map.Entry; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; @@ -34,14 +35,15 @@ public class IdAttributeRow extends ButtonAttributeRow { private class IdAttributeLabelProvider extends LabelProvider { + @Override public Image getImage(Object element) { return PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_GENERIC_XML_OBJ); } - @SuppressWarnings("rawtypes") + @Override public String getText(Object element) { if (element instanceof Map.Entry) { - Map.Entry entry = (Map.Entry) element; + Map.Entry<?, ?> entry = (Entry<?, ?>) element; String text = (String) entry.getKey(); if (entry.getValue() instanceof IConfigurationElement) { IConfigurationElement value = (IConfigurationElement) entry.getValue(); @@ -76,6 +78,7 @@ public class IdAttributeRow extends ButtonAttributeRow { super(part, att); } + @Override protected boolean isReferenceModel() { return !part.getPage().getModel().isEditable(); } @@ -83,6 +86,7 @@ public class IdAttributeRow extends ButtonAttributeRow { /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.plugin.rows.ButtonAttributeRow#browse() */ + @Override protected void browse() { ElementListSelectionDialog dialog = new ElementListSelectionDialog(PDEPlugin.getActiveWorkbenchShell(), new IdAttributeLabelProvider()); @@ -93,8 +97,7 @@ public class IdAttributeRow extends ButtonAttributeRow { dialog.setElements(attributeMap.entrySet().toArray()); dialog.setFilter("*"); //$NON-NLS-1$ if (dialog.open() == Window.OK) { - @SuppressWarnings("rawtypes") - Map.Entry entry = (Map.Entry) dialog.getFirstResult(); + Map.Entry<?, ?> entry = (Entry<?, ?>) dialog.getFirstResult(); text.setText(entry.getKey().toString()); } } @@ -102,6 +105,7 @@ public class IdAttributeRow extends ButtonAttributeRow { /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.plugin.rows.ReferenceAttributeRow#openReference() */ + @Override protected void openReference() { Map<String, IConfigurationElement> attributeMap = PDESchemaHelper.getValidAttributes(getAttribute()); String id = text.getText(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/schema/SchemaEditor.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/schema/SchemaEditor.java index 82141b8..16d51da 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/schema/SchemaEditor.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/schema/SchemaEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2011 IBM Corporation and others. + * Copyright (c) 2003, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -30,7 +30,6 @@ import org.eclipse.pde.internal.ui.editor.*; import org.eclipse.pde.internal.ui.editor.context.InputContext; import org.eclipse.pde.internal.ui.editor.context.InputContextManager; import org.eclipse.pde.internal.ui.search.ShowDescriptionAction; -import org.eclipse.swt.widgets.Display; import org.eclipse.ui.*; import org.eclipse.ui.ide.FileStoreEditorInput; import org.eclipse.ui.part.FileEditorInput; @@ -41,6 +40,7 @@ public class SchemaEditor extends MultiSourceEditor { /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.PDEFormEditor#getEditorID() */ + @Override protected String getEditorID() { return IPDEUIConstants.SCHEMA_EDITOR_ID; } @@ -48,6 +48,7 @@ public class SchemaEditor extends MultiSourceEditor { /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.PDEFormEditor#isSaveAsAllowed() */ + @Override public boolean isSaveAsAllowed() { return true; } @@ -55,10 +56,12 @@ public class SchemaEditor extends MultiSourceEditor { /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.PDEFormEditor#getContextIDForSaveAs() */ + @Override public String getContextIDForSaveAs() { return SchemaInputContext.CONTEXT_ID; } + @Override protected void createResourceContexts(InputContextManager manager, IFileEditorInput input) { IFile file = input.getFile(); IFileEditorInput in = new FileEditorInput(file); @@ -66,6 +69,7 @@ public class SchemaEditor extends MultiSourceEditor { manager.monitorFile(file); } + @Override protected InputContextManager createInputContextManager() { SchemaInputContextManager contextManager = new SchemaInputContextManager(this); //contextManager.setUndoManager(new SchemaUndoManager(this)); @@ -91,6 +95,7 @@ public class SchemaEditor extends MultiSourceEditor { return true; } + @Override public void editorContextAdded(InputContext context) { addSourcePage(context.getId()); } @@ -99,10 +104,12 @@ public class SchemaEditor extends MultiSourceEditor { close(false); } + @Override protected void createSystemFileContexts(InputContextManager manager, FileStoreEditorInput input) { manager.putContext(input, new SchemaInputContext(this, input, true)); } + @Override protected void createStorageContexts(InputContextManager manager, IStorageEditorInput input) { manager.putContext(input, new SchemaInputContext(this, input, true)); } @@ -116,6 +123,7 @@ public class SchemaEditor extends MultiSourceEditor { fPreviewAction.run(); } + @Override protected void addEditorPages() { try { addPage(new SchemaOverviewPage(this)); @@ -126,6 +134,7 @@ public class SchemaEditor extends MultiSourceEditor { addSourcePage(SchemaInputContext.CONTEXT_ID); } + @Override protected String computeInitialPageId() { String firstPageId = super.computeInitialPageId(); if (firstPageId == null) { @@ -137,10 +146,12 @@ public class SchemaEditor extends MultiSourceEditor { /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.neweditor.MultiSourceEditor#createXMLSourcePage(org.eclipse.pde.internal.ui.neweditor.PDEFormEditor, java.lang.String, java.lang.String) */ + @Override protected PDESourcePage createSourcePage(PDEFormEditor editor, String title, String name, String contextId) { return new SchemaSourcePage(editor, title, name); } + @Override protected ISortableContentOutlinePage createContentOutline() { return new SchemaFormOutlinePage(this); } @@ -148,6 +159,7 @@ public class SchemaEditor extends MultiSourceEditor { /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.PDEFormEditor#getInputContext(java.lang.Object) */ + @Override protected InputContext getInputContext(Object object) { InputContext context = null; if (object instanceof ISchemaObject) { @@ -164,7 +176,6 @@ public class SchemaEditor extends MultiSourceEditor { } catch (PartInitException e) { } } - Display.getDefault().beep(); return false; } @@ -176,14 +187,12 @@ public class SchemaEditor extends MultiSourceEditor { IFile file = project.getFile(path.removeFirstSegments(1)); return openSchema(file); } - Display.getDefault().beep(); return false; } public static boolean openSchema(File file) { // Ensure the file exists if ((file == null) || (file.exists() == false)) { - Display.getDefault().beep(); return false; } // Create the editor input @@ -203,12 +212,11 @@ public class SchemaEditor extends MultiSourceEditor { // Open the schema editor using the editor input part = PDEPlugin.getActivePage().openEditor(input, IPDEUIConstants.SCHEMA_EDITOR_ID); } catch (PartInitException e) { - Display.getDefault().beep(); + PDEPlugin.log(e); return false; } // Ensure the schema editor was opened properly if (part == null) { - Display.getDefault().beep(); return false; } return true; @@ -217,29 +225,34 @@ public class SchemaEditor extends MultiSourceEditor { public static boolean openSchema(File jarFile, String schemaJarFileEntry) { // Ensure the file exists if ((jarFile == null) || (jarFile.exists() == false)) { - Display.getDefault().beep(); return false; } // Open the jar archive - ZipFile zipFile; + ZipFile zipFile = null; try { zipFile = new ZipFile(jarFile); + // Ensure the schema file exists in the jar archive + if ((schemaJarFileEntry == null) || zipFile.getEntry(schemaJarFileEntry) == null) { + return false; + } + // Create the editor input + IStorage storage = new JarEntryFile(zipFile, schemaJarFileEntry); + IEditorInput input = new JarEntryEditorInput(storage); + return openEditor(input); } catch (ZipException e) { - Display.getDefault().beep(); - return false; + PDEPlugin.log(e); } catch (IOException e) { - Display.getDefault().beep(); - return false; - } - // Ensure the schema file exists in the jar archive - if ((schemaJarFileEntry == null) || zipFile.getEntry(schemaJarFileEntry) == null) { - Display.getDefault().beep(); - return false; + PDEPlugin.log(e); + } finally { + if (zipFile != null) { + try { + zipFile.close(); + } catch (IOException e) { + PDEPlugin.log(e); + } + } } - // Create the editor input - IStorage storage = new JarEntryFile(zipFile, schemaJarFileEntry); - IEditorInput input = new JarEntryEditorInput(storage); - return openEditor(input); + return false; } public static void openToElement(IPath path, ISchemaElement element) { @@ -252,6 +265,7 @@ public class SchemaEditor extends MultiSourceEditor { } } + @Override public boolean canCut(ISelection selection) { if (selection instanceof IStructuredSelection) { Object selected = ((IStructuredSelection) selection).getFirstElement(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/ArchiveSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/ArchiveSection.java index c523ece..95f64e5 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/ArchiveSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/ArchiveSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -48,6 +48,7 @@ public class ArchiveSection extends PDESection { private Button fRemoveButton; class FolderProvider extends WorkbenchContentProvider { + @Override public boolean hasChildren(Object element) { Object[] children = getChildren(element); for (int i = 0; i < children.length; i++) { @@ -99,6 +100,7 @@ public class ArchiveSection extends PDESection { * @see org.eclipse.update.ui.forms.internal.FormSection#createClient(org.eclipse.swt.widgets.Composite, * org.eclipse.update.ui.forms.internal.FormWidgetFactory) */ + @Override public void createClient(Section section, FormToolkit toolkit) { fModel = (ISiteModel) getPage().getModel(); fModel.addModelChangedListener(this); @@ -122,6 +124,7 @@ public class ArchiveSection extends PDESection { /* (non-Javadoc) * @see org.eclipse.ui.forms.AbstractFormPart#dispose() */ + @Override public void dispose() { fModel.removeModelChangedListener(this); super.dispose(); @@ -136,6 +139,7 @@ public class ArchiveSection extends PDESection { fAddButton = toolkit.createButton(container, PDEUIMessages.SiteEditor_add, SWT.PUSH); fAddButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fAddButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { showDialog(null); } @@ -144,6 +148,7 @@ public class ArchiveSection extends PDESection { fEditButton = toolkit.createButton(container, PDEUIMessages.SiteEditor_edit, SWT.PUSH); fEditButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fEditButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { IStructuredSelection ssel = (IStructuredSelection) fViewer.getSelection(); if (ssel != null && ssel.size() == 1) @@ -153,6 +158,7 @@ public class ArchiveSection extends PDESection { fRemoveButton = toolkit.createButton(container, PDEUIMessages.SiteEditor_remove, SWT.PUSH); fRemoveButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fRemoveButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { handleDelete(); } @@ -220,13 +226,13 @@ public class ArchiveSection extends PDESection { }); } + @SuppressWarnings("unchecked") private void handleDelete() { try { ISelection selection = fViewer.getSelection(); if (selection != null && selection instanceof IStructuredSelection) { IStructuredSelection ssel = (IStructuredSelection) selection; if (ssel.size() > 0) { - @SuppressWarnings("unchecked") ISiteArchive[] array = (ISiteArchive[]) ssel.toList().toArray(new ISiteArchive[ssel.size()]); ISite site = ((ISiteModel) getPage().getModel()).getSite(); site.removeArchives(array); @@ -241,6 +247,7 @@ public class ArchiveSection extends PDESection { * * @see org.eclipse.update.ui.forms.internal.FormSection#doGlobalAction(java.lang.String) */ + @Override public boolean doGlobalAction(String actionId) { if (actionId.equals(ActionFactory.DELETE.getId())) { BusyIndicator.showWhile(fTable.getDisplay(), new Runnable() { @@ -253,6 +260,7 @@ public class ArchiveSection extends PDESection { return false; } + @Override public void refresh() { fViewer.refresh(); super.refresh(); @@ -262,6 +270,7 @@ public class ArchiveSection extends PDESection { refresh(); } + @Override public void modelChanged(IModelChangedEvent e) { markStale(); } @@ -271,6 +280,7 @@ public class ArchiveSection extends PDESection { IMenuListener listener = new IMenuListener() { public void menuAboutToShow(IMenuManager mng) { Action removeAction = new Action(PDEUIMessages.SiteEditor_remove) { + @Override public void run() { doGlobalAction(ActionFactory.DELETE.getId()); } @@ -290,6 +300,7 @@ public class ArchiveSection extends PDESection { /* (non-Javadoc) * @see org.eclipse.ui.forms.AbstractFormPart#setFormInput(java.lang.Object) */ + @Override public boolean setFormInput(Object input) { if (input instanceof ISiteArchive) { fViewer.setSelection(new StructuredSelection(input), true); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/CategoryDetailsSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/CategoryDetailsSection.java index 93f1e3d..3e66a71 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/CategoryDetailsSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/CategoryDetailsSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,7 +29,7 @@ import org.eclipse.ui.forms.IPartSelectionListener; import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; -public class CategoryDetailsSection extends PDESection implements IFormPart, IPartSelectionListener { +public class CategoryDetailsSection extends PDESection implements IPartSelectionListener { private static final String PROPERTY_DESC = "desc"; //$NON-NLS-1$ @@ -95,6 +95,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa } } + @Override public void cancelEdit() { fNameText.cancelEdit(); fLabelText.cancelEdit(); @@ -102,6 +103,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa super.cancelEdit(); } + @Override public boolean canPaste(Clipboard clipboard) { TransferData[] types = clipboard.getAvailableTypes(); Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()}; @@ -129,6 +131,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa fDescriptionText.setValue(null, true); } + @Override public void commit(boolean onSave) { fNameText.commit(); fLabelText.commit(); @@ -137,6 +140,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa super.commit(onSave); } + @Override public void createClient(Section section, FormToolkit toolkit) { section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); @@ -149,6 +153,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa fNameText = new FormEntry(container, toolkit, PDEUIMessages.CategoryDetails_name, null, false); fNameText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void textValueChanged(FormEntry text) { try { if (text.getValue().length() <= 0 || alreadyExists(text.getValue())) { @@ -168,6 +173,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa fLabelText = new FormEntry(container, toolkit, PDEUIMessages.CategoryDetails_label, null, false); fLabelText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void textValueChanged(FormEntry text) { try { applyValue(PROPERTY_TYPE, text.getValue()); @@ -185,6 +191,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa fDescriptionText.getLabel().setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING)); fDescriptionText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void textValueChanged(FormEntry text) { try { applyValue(PROPERTY_DESC, text.getValue()); @@ -203,6 +210,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa model.addModelChangedListener(this); } + @Override public void dispose() { ISiteModel model = (ISiteModel) getPage().getModel(); if (model != null) @@ -215,6 +223,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa gd.widthHint = 30; } + @Override public void modelChanged(IModelChangedEvent e) { markStale(); } @@ -234,6 +243,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa } } + @Override public void refresh() { if (fCurrentCategoryDefinition == null) { clearFields(); @@ -259,6 +269,7 @@ public class CategoryDetailsSection extends PDESection implements IFormPart, IPa refresh(); } + @Override public void setFocus() { if (fNameText != null) fNameText.getText().setFocus(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/FeatureDetailsSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/FeatureDetailsSection.java index 71ef236..81e6876 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/FeatureDetailsSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/FeatureDetailsSection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -33,7 +33,7 @@ import org.eclipse.ui.forms.IPartSelectionListener; import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; -public class FeatureDetailsSection extends PDESection implements IFormPart, IPartSelectionListener { +public class FeatureDetailsSection extends PDESection implements IPartSelectionListener { private static final String PROPERTY_TYPE = "type"; //$NON-NLS-1$ @@ -71,11 +71,13 @@ public class FeatureDetailsSection extends PDESection implements IFormPart, IPar fCurrentSiteFeature.setType(value); } + @Override public void cancelEdit() { fUrlText.cancelEdit(); super.cancelEdit(); } + @Override public boolean canPaste(Clipboard clipboard) { TransferData[] types = clipboard.getAvailableTypes(); Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()}; @@ -98,6 +100,7 @@ public class FeatureDetailsSection extends PDESection implements IFormPart, IPar fPatchCheckBox.setSelection(false); } + @Override public void commit(boolean onSave) { try { applyIsPatch(fPatchCheckBox.getSelection()); @@ -108,6 +111,7 @@ public class FeatureDetailsSection extends PDESection implements IFormPart, IPar super.commit(onSave); } + @Override public void createClient(Section section, FormToolkit toolkit) { section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); @@ -120,6 +124,7 @@ public class FeatureDetailsSection extends PDESection implements IFormPart, IPar fUrlText = new FormEntry(container, toolkit, PDEUIMessages.FeatureDetailsSection_url, null, false); fUrlText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void textValueChanged(FormEntry text) { try { if (text.getValue().length() <= 0) { @@ -149,6 +154,7 @@ public class FeatureDetailsSection extends PDESection implements IFormPart, IPar private void createPatchButton(FormToolkit toolkit, Composite container) { fPatchCheckBox = toolkit.createButton(container, PDEUIMessages.FeatureDetailsSection_patch, SWT.CHECK); fPatchCheckBox.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { try { applyIsPatch(fPatchCheckBox.getSelection()); @@ -163,6 +169,7 @@ public class FeatureDetailsSection extends PDESection implements IFormPart, IPar fPatchCheckBox.setEnabled(isEditable()); } + @Override public void dispose() { ISiteModel model = (ISiteModel) getPage().getModel(); if (model != null) @@ -175,10 +182,12 @@ public class FeatureDetailsSection extends PDESection implements IFormPart, IPar gd.widthHint = 30; } + @Override public void modelChanged(IModelChangedEvent e) { markStale(); } + @Override public void refresh() { if (fCurrentSiteFeature == null) { clearFields(); @@ -204,6 +213,7 @@ public class FeatureDetailsSection extends PDESection implements IFormPart, IPar refresh(); } + @Override public void setFocus() { if (fUrlText != null) fUrlText.getText().setFocus(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/PortabilitySection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/PortabilitySection.java index f6d5d0b..a862ba9 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/PortabilitySection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/site/PortabilitySection.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,7 +35,7 @@ import org.eclipse.ui.forms.*; import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; -public class PortabilitySection extends PDESection implements IFormPart, IPartSelectionListener { +public class PortabilitySection extends PDESection implements IPartSelectionListener { public static Choice[] getArchChoices() { return getKnownChoices(Platform.knownOSArchValues()); } @@ -100,6 +100,7 @@ public class PortabilitySection extends PDESection implements IFormPart, IPartSe fCurrentSiteFeature.setArch(value); } + @Override public void cancelEdit() { fOsText.cancelEdit(); fWsText.cancelEdit(); @@ -108,6 +109,7 @@ public class PortabilitySection extends PDESection implements IFormPart, IPartSe super.cancelEdit(); } + @Override public boolean canPaste(Clipboard clipboard) { TransferData[] types = clipboard.getAvailableTypes(); Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()}; @@ -137,6 +139,7 @@ public class PortabilitySection extends PDESection implements IFormPart, IPartSe fArchText.setValue(null, true); } + @Override public void commit(boolean onSave) { fOsText.commit(); fWsText.commit(); @@ -146,6 +149,7 @@ public class PortabilitySection extends PDESection implements IFormPart, IPartSe super.commit(onSave); } + @Override public void createClient(Section section, FormToolkit toolkit) { section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); @@ -161,6 +165,7 @@ public class PortabilitySection extends PDESection implements IFormPart, IPartSe fOsText = new FormEntry(container, toolkit, PDEUIMessages.SiteEditor_PortabilitySection_os, editLabel, false); fOsText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void browseButtonSelected(FormEntry entry) { BusyIndicator.showWhile(fOsText.getText().getDisplay(), new Runnable() { public void run() { @@ -170,6 +175,7 @@ public class PortabilitySection extends PDESection implements IFormPart, IPartSe }); } + @Override public void textValueChanged(FormEntry text) { try { applyValue(IEnvironment.P_OS, text.getValue()); @@ -184,6 +190,7 @@ public class PortabilitySection extends PDESection implements IFormPart, IPartSe fWsText = new FormEntry(container, toolkit, PDEUIMessages.SiteEditor_PortabilitySection_ws, editLabel, false); fWsText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void browseButtonSelected(FormEntry entry) { BusyIndicator.showWhile(fWsText.getText().getDisplay(), new Runnable() { public void run() { @@ -193,6 +200,7 @@ public class PortabilitySection extends PDESection implements IFormPart, IPartSe }); } + @Override public void textValueChanged(FormEntry text) { try { applyValue(IEnvironment.P_WS, text.getValue()); @@ -208,6 +216,7 @@ public class PortabilitySection extends PDESection implements IFormPart, IPartSe fNlText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void browseButtonSelected(FormEntry entry) { BusyIndicator.showWhile(fNlText.getText().getDisplay(), new Runnable() { public void run() { @@ -217,6 +226,7 @@ public class PortabilitySection extends PDESection implements IFormPart, IPartSe }); } + @Override public void textValueChanged(FormEntry text) { try { applyValue(IEnvironment.P_NL, text.getValue()); @@ -231,6 +241,7 @@ public class PortabilitySection extends PDESection implements IFormPart, IPartSe fArchText = new FormEntry(container, toolkit, PDEUIMessages.SiteEditor_PortabilitySection_arch, editLabel, false); fArchText.setFormEntryListener(new FormEntryAdapter(this) { + @Override public void browseButtonSelected(FormEntry entry) { BusyIndicator.showWhile(fArchText.getText().getDisplay(), new Runnable() { public void run() { @@ -240,6 +251,7 @@ public class PortabilitySection extends PDESection implements IFormPart, IPartSe }); } + @Override public void textValueChanged(FormEntry text) { try { applyValue(IEnvironment.P_ARCH, text.getValue()); @@ -256,6 +268,7 @@ public class PortabilitySection extends PDESection implements IFormPart, IPartSe section.setClient(container); } + @Override public void dispose() { ISiteModel model = (ISiteModel) getPage().getModel(); if (model != null) @@ -268,6 +281,7 @@ public class PortabilitySection extends PDESection implements IFormPart, IPartSe * * @see org.eclipse.ui.forms.AbstractFormPart#initialize(org.eclipse.ui.forms.IManagedForm) */ + @Override public void initialize(IManagedForm form) { ISiteModel model = (ISiteModel) getPage().getModel(); if (model != null) @@ -280,6 +294,7 @@ public class PortabilitySection extends PDESection implements IFormPart, IPartSe gd.widthHint = 30; } + @Override public void modelChanged(IModelChangedEvent e) { markStale(); } @@ -303,6 +318,7 @@ public class PortabilitySection extends PDESection implements IFormPart, IPartSe } } + @Override public void refresh() { if (fCurrentSiteFeature == null) { clearFields(); @@ -329,6 +345,7 @@ public class PortabilitySection extends PDESection implements IFormPart, IPartSe refresh(); } + @Override public void setFocus() { if (fOsText != null) fOsText.getText().setFocus(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/text/PDEMarkerAnnotationModel.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/text/PDEMarkerAnnotationModel.java index aec8b1b..7ba15db 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/text/PDEMarkerAnnotationModel.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/text/PDEMarkerAnnotationModel.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. + * Copyright (c) 2005, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,13 +12,12 @@ package org.eclipse.pde.internal.ui.editor.text; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; -import org.eclipse.jface.text.quickassist.IQuickFixableAnnotation; import org.eclipse.ui.texteditor.MarkerAnnotation; import org.eclipse.ui.texteditor.ResourceMarkerAnnotationModel; public class PDEMarkerAnnotationModel extends ResourceMarkerAnnotationModel { - class PDEMarkerAnnotation extends MarkerAnnotation implements IQuickFixableAnnotation { + class PDEMarkerAnnotation extends MarkerAnnotation { boolean quickFixableState; boolean isQuickFixable; @@ -26,15 +25,18 @@ public class PDEMarkerAnnotationModel extends ResourceMarkerAnnotationModel { super(marker); } + @Override public void setQuickFixable(boolean state) { isQuickFixable = state; quickFixableState = true; } + @Override public boolean isQuickFixableStateSet() { return quickFixableState; } + @Override public boolean isQuickFixable() { return isQuickFixable; } @@ -45,6 +47,7 @@ public class PDEMarkerAnnotationModel extends ResourceMarkerAnnotationModel { super(resource); } + @Override protected MarkerAnnotation createMarkerAnnotation(IMarker marker) { return new PDEMarkerAnnotation(marker); } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/text/PDEQuickAssistAssistant.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/text/PDEQuickAssistAssistant.java index 87c576a..28e7f8c 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/text/PDEQuickAssistAssistant.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/text/PDEQuickAssistAssistant.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2012 IBM Corporation and others. + * Copyright (c) 2005, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -111,6 +111,7 @@ public class PDEQuickAssistAssistant extends QuickAssistAssistant { /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ + @Override public boolean equals(Object obj) { if (!(obj instanceof PDECompletionProposal)) { return false; @@ -119,6 +120,11 @@ public class PDEQuickAssistAssistant extends QuickAssistAssistant { return proposal.fPosition.equals(fPosition) && proposal.fResolution.equals(fResolution); } + @Override + public int hashCode() { + return fPosition.hashCode() + fResolution.hashCode(); + } + /* (non-Javadoc) * @see java.lang.Comparable#compareTo(java.lang.Object) */ @@ -263,6 +269,7 @@ public class PDEQuickAssistAssistant extends QuickAssistAssistant { fRemoveImage = PDEPluginImages.DESC_DELETE.createImage(); fRenameImage = PDEPluginImages.DESC_REFRESH.createImage(); setInformationControlCreator(new AbstractReusableInformationControlCreator() { + @Override public IInformationControl doCreateInformationControl(Shell parent) { return new DefaultInformationControl(parent, (IInformationPresenter) null); } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/FilteredCheckboxTree.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/FilteredCheckboxTree.java index 36092f8..a0a6ce8 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/FilteredCheckboxTree.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/launcher/FilteredCheckboxTree.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 IBM Corporation and others. + * Copyright (c) 2008, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,8 +11,6 @@ *******************************************************************************/ package org.eclipse.pde.internal.ui.launcher; -import org.eclipse.swt.widgets.TreeItem; - import java.util.*; import java.util.List; import org.eclipse.core.runtime.NullProgressMonitor; @@ -55,6 +53,7 @@ class FilteredCheckboxTree extends FilteredTree { * (non-Javadoc) * @see org.eclipse.ui.dialogs.FilteredTree#doCreateTreeViewer(org.eclipse.swt.widgets.Composite, int) */ + @Override protected TreeViewer doCreateTreeViewer(Composite parent, int style) { return new FilterableCheckboxTreeViewer(parent, style); } @@ -63,6 +62,7 @@ class FilteredCheckboxTree extends FilteredTree { * (non-Javadoc) * @see org.eclipse.ui.dialogs.FilteredTree#doCreateRefreshJob() */ + @Override protected WorkbenchJob doCreateRefreshJob() { // Since refresh job is private, we have to get a handle to it // when it is created, and store it locally. @@ -146,6 +146,7 @@ class FilteredCheckboxTree extends FilteredTree { /* The preRefresh Listeners */ List<PreRefreshNotifier> refreshingListeners = new ArrayList<PreRefreshNotifier>(); + @Override protected void unmapAllElements() { itemCache = new HashMap<Object, FilteredCheckboxTreeItem>(); super.unmapAllElements(); @@ -180,9 +181,9 @@ class FilteredCheckboxTree extends FilteredTree { * (non-Javadoc) * @see org.eclipse.jface.viewers.CheckboxTreeViewer#getChecked(java.lang.Object) */ + @Override public boolean getChecked(Object element) { Widget testFindItem = getViewer().testFindItem(element); - testFindItem = null; if (testFindItem == null) { if (itemCache.containsKey(element)) { FilteredCheckboxTreeItem item = itemCache.get(element); @@ -219,6 +220,7 @@ class FilteredCheckboxTree extends FilteredTree { * (non-Javadoc) * @see org.eclipse.jface.viewers.CheckboxTreeViewer#getCheckedElements() */ + @Override public Object[] getCheckedElements() { Iterator<FilteredCheckboxTreeItem> iterator = itemCache.values().iterator(); List<Object> checkedElements = new LinkedList<Object>(); @@ -242,6 +244,7 @@ class FilteredCheckboxTree extends FilteredTree { * (non-Javadoc) * @see org.eclipse.jface.viewers.CheckboxTreeViewer#setChecked(java.lang.Object, boolean) */ + @Override public boolean setChecked(Object element, boolean state) { if (itemCache.containsKey(element)) { FilteredCheckboxTreeItem item = itemCache.get(element); @@ -254,6 +257,7 @@ class FilteredCheckboxTree extends FilteredTree { * (non-Javadoc) * @see org.eclipse.jface.viewers.CheckboxTreeViewer#setCheckedElements(java.lang.Object[]) */ + @Override public void setCheckedElements(Object[] elements) { Set<Object> s = new HashSet<Object>(itemCache.keySet()); s.removeAll(new HashSet<Object>(Arrays.asList(elements))); @@ -277,6 +281,7 @@ class FilteredCheckboxTree extends FilteredTree { * (non-Javadoc) * @see org.eclipse.jface.viewers.CheckboxTreeViewer#setSubtreeChecked(java.lang.Object, boolean) */ + @Override public boolean setSubtreeChecked(Object element, boolean state) { String newState = state ? CHECKED : NONE; TreeItem item = (TreeItem) testFindItem(element); @@ -317,6 +322,7 @@ class FilteredCheckboxTree extends FilteredTree { * (non-Javadoc) * @see org.eclipse.jface.viewers.CheckboxTreeViewer#preservingSelection(java.lang.Runnable) */ + @Override protected void preservingSelection(Runnable updateCode) { super.preservingSelection(updateCode); @@ -332,6 +338,7 @@ class FilteredCheckboxTree extends FilteredTree { * (non-Javadoc) * @see org.eclipse.jface.viewers.AbstractTreeViewer#internalRefresh(java.lang.Object, boolean) */ + @Override protected void internalRefresh(Object element, boolean updateLabels) { String text = FilteredCheckboxTree.this.getFilterString(); boolean initial = initialText != null && initialText.equals(text); @@ -436,6 +443,7 @@ class FilteredCheckboxTree extends FilteredTree { } // end of FilterableCheckboxTreeViewer + @Override public void setEnabled(boolean enabled) { if ((filterText.getStyle() & SWT.ICON_CANCEL) == 0) { // filter uses FilteredTree new look, not native int filterColor = enabled ? SWT.COLOR_LIST_BACKGROUND : SWT.COLOR_WIDGET_BACKGROUND; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/nls/ExternalizeStringsWizardPage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/nls/ExternalizeStringsWizardPage.java index 789e478..024a48a 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/nls/ExternalizeStringsWizardPage.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/nls/ExternalizeStringsWizardPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2012 IBM Corporation and others. + * Copyright (c) 2005, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -59,7 +59,7 @@ public class ExternalizeStringsWizardPage extends UserInputWizardPage { TABLE_COLUMNS[KEY] = PDEUIMessages.ExternalizeStringsWizardPage_subKey; } - private class ModelChangeContentProvider implements ITreeContentProvider, IContentProvider { + private class ModelChangeContentProvider implements ITreeContentProvider { public Object[] getElements(Object parent) { return fModelChangeTable.getAllModelChanges().toArray(); @@ -154,6 +154,7 @@ public class ExternalizeStringsWizardPage extends UserInputWizardPage { setDescription(PDEUIMessages.ExternalizeStringsWizardPage_pageDescription); fModelChangeTable = changeTable; fErrorElementFilter = new ViewerFilter() { + @Override public boolean select(Viewer viewer, Object parentElement, Object element) { if (!(element instanceof ModelChangeElement)) return false; @@ -188,6 +189,7 @@ public class ExternalizeStringsWizardPage extends UserInputWizardPage { fManifestSetupParticipant = new ManifestDocumentSetupParticipant(); } + @Override public void dispose() { fColorManager.dispose(); super.dispose(); @@ -253,6 +255,7 @@ public class ExternalizeStringsWizardPage extends UserInputWizardPage { fSelectAll.setText(PDEUIMessages.ExternalizeStringsWizardPage_selectAllButton); fSelectAll.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fSelectAll.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { fInputViewer.setCheckedElements(fModelChangeTable.getAllModelChanges().toArray()); setPageComplete(hasCheckedElements()); @@ -262,6 +265,7 @@ public class ExternalizeStringsWizardPage extends UserInputWizardPage { fDeselectAll.setText(PDEUIMessages.ExternalizeStringsWizardPage_deselectAllButton); fDeselectAll.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fDeselectAll.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { fInputViewer.setCheckedElements(new Object[0]); setPageComplete(hasCheckedElements()); @@ -538,6 +542,7 @@ public class ExternalizeStringsWizardPage extends UserInputWizardPage { fDeselectAll.setEnabled(enabled); } + @Override public void setPageComplete(boolean complete) { super.setPageComplete(complete); // if the page is ready to be completed set the selection on the processor so it knows diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/nls/NLSFragmentGenerator.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/nls/NLSFragmentGenerator.java index 9985ba1..98ea366 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/nls/NLSFragmentGenerator.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/nls/NLSFragmentGenerator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 IBM Corporation and others. + * Copyright (c) 2008, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -332,28 +332,32 @@ public class NLSFragmentGenerator { //Case 1a: External plug-in is a jar file if (new File(installLocation).isFile()) { ZipFile zf = new ZipFile(installLocation); - for (Enumeration<?> e = zf.entries(); e.hasMoreElements();) { - worked(); + try { + for (Enumeration<?> e = zf.entries(); e.hasMoreElements();) { + worked(); - ZipEntry zfe = (ZipEntry) e.nextElement(); - String name = zfe.getName(); - - String[] segments = name.split(SLASH); - IPath path = Path.fromPortableString(join(SLASH, segments, 0, segments.length - 1)); - String resourceName = segments[segments.length - 1]; - String localizedResourceName = localeSpecificName(resourceName, locale); - if (propertiesFilter.include(name)) { - - createParents(fragmentProject, path); - IFile file = fragmentProject.getFile(path.append(localizedResourceName)); - InputStream is = zf.getInputStream(zfe); - file.create(is, false, getProgressMonitor()); - } else if (resourceFilter.include(name)) { - IPath target = localeResourceFolder.getFullPath().append(path).append(resourceName); - createParents(fragmentProject, target.removeLastSegments(1).removeFirstSegments(1)); - IFile file = fragmentProject.getFile(target.removeFirstSegments(1)); - file.create(zf.getInputStream(zfe), false, getProgressMonitor()); + ZipEntry zfe = (ZipEntry) e.nextElement(); + String name = zfe.getName(); + + String[] segments = name.split(SLASH); + IPath path = Path.fromPortableString(join(SLASH, segments, 0, segments.length - 1)); + String resourceName = segments[segments.length - 1]; + String localizedResourceName = localeSpecificName(resourceName, locale); + if (propertiesFilter.include(name)) { + + createParents(fragmentProject, path); + IFile file = fragmentProject.getFile(path.append(localizedResourceName)); + InputStream is = zf.getInputStream(zfe); + file.create(is, false, getProgressMonitor()); + } else if (resourceFilter.include(name)) { + IPath target = localeResourceFolder.getFullPath().append(path).append(resourceName); + createParents(fragmentProject, target.removeLastSegments(1).removeFirstSegments(1)); + IFile file = fragmentProject.getFile(target.removeFirstSegments(1)); + file.create(zf.getInputStream(zfe), false, getProgressMonitor()); + } } + } finally { + zf.close(); } } //Case 1b: External plug-in has a folder structure diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/properties/PluginDevelopmentPage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/properties/PluginDevelopmentPage.java index 3960662..06f9efe 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/properties/PluginDevelopmentPage.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/properties/PluginDevelopmentPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2009 IBM Corporation and others. + * Copyright (c) 2005, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -20,7 +20,6 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; -import org.eclipse.ui.IWorkbenchPropertyPage; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.PropertyPage; import org.osgi.service.prefs.BackingStoreException; @@ -29,7 +28,7 @@ import org.osgi.service.prefs.Preferences; /** * Top level PDE property page for projects. */ -public class PluginDevelopmentPage extends PropertyPage implements IWorkbenchPropertyPage { +public class PluginDevelopmentPage extends PropertyPage { private Button fExtensionButton; private Button fEquinoxButton; @@ -41,6 +40,7 @@ public class PluginDevelopmentPage extends PropertyPage implements IWorkbenchPro /* (non-Javadoc) * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) */ + @Override protected Control createContents(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout()); @@ -82,6 +82,7 @@ public class PluginDevelopmentPage extends PropertyPage implements IWorkbenchPro /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite) */ + @Override public void createControl(Composite parent) { super.createControl(parent); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.PLUGIN_DEVELOPMENT_PROPERTY_PAGE); @@ -90,6 +91,7 @@ public class PluginDevelopmentPage extends PropertyPage implements IWorkbenchPro /* (non-Javadoc) * @see org.eclipse.jface.preference.PreferencePage#performOk() */ + @Override public boolean performOk() { Preferences pref = getPreferences((IProject) getElement().getAdapter(IProject.class)); if (pref != null) { diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/PluginSearchPage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/PluginSearchPage.java index e050c72..ee488f1 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/PluginSearchPage.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/PluginSearchPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -41,6 +41,7 @@ public class PluginSearchPage extends DialogPage implements ISearchPage { public int workspaceScope; public IWorkingSet[] workingSets; + @Override public boolean equals(Object obj) { if (obj instanceof QueryData) { if (((QueryData) obj).text.equals(text)) @@ -49,6 +50,10 @@ public class PluginSearchPage extends DialogPage implements ISearchPage { return false; } + @Override + public int hashCode() { + return text.hashCode(); + } } private static ArrayList<QueryData> previousQueries = new ArrayList<QueryData>(); @@ -215,6 +220,7 @@ public class PluginSearchPage extends DialogPage implements ISearchPage { private void hookListeners() { searchForButtons[1].addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { boolean selected = searchForButtons[1].getSelection(); if (selected) { @@ -228,6 +234,7 @@ public class PluginSearchPage extends DialogPage implements ISearchPage { }); patternCombo.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { int index = previousQueries.size() - patternCombo.getSelectionIndex() - 1; if (previousQueries.size() > index) { @@ -296,6 +303,7 @@ public class PluginSearchPage extends DialogPage implements ISearchPage { this.container = container; } + @Override public void setVisible(boolean visible) { if (visible && patternCombo != null) { if (firstTime) { diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/dependencies/DependencyExtentSearchResult.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/dependencies/DependencyExtentSearchResult.java index 8d436fc..52a2fe0 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/dependencies/DependencyExtentSearchResult.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/dependencies/DependencyExtentSearchResult.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2012 IBM Corporation and others. + * Copyright (c) 2005, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.pde.internal.ui.search.dependencies; -import org.eclipse.search.ui.text.Match; - import java.util.HashSet; import java.util.Set; import org.eclipse.jdt.core.*; @@ -24,7 +22,7 @@ import org.eclipse.search.ui.text.*; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; -public class DependencyExtentSearchResult extends SearchResult implements IEditorMatchAdapter { +public class DependencyExtentSearchResult extends SearchResult { /** * @param query @@ -36,6 +34,7 @@ public class DependencyExtentSearchResult extends SearchResult implements IEdito /* (non-Javadoc) * @see org.eclipse.search.ui.text.AbstractTextSearchResult#getEditorMatchAdapter() */ + @Override public IEditorMatchAdapter getEditorMatchAdapter() { return this; } @@ -43,6 +42,7 @@ public class DependencyExtentSearchResult extends SearchResult implements IEdito /* (non-Javadoc) * @see org.eclipse.search.ui.text.AbstractTextSearchResult#getFileMatchAdapter() */ + @Override public IFileMatchAdapter getFileMatchAdapter() { return null; } @@ -50,6 +50,7 @@ public class DependencyExtentSearchResult extends SearchResult implements IEdito /* (non-Javadoc) * @see org.eclipse.search.ui.text.IEditorMatchAdapter#isShownInEditor(org.eclipse.search.ui.text.Match, org.eclipse.ui.IEditorPart) */ + @Override public boolean isShownInEditor(Match match, IEditorPart editor) { return true; } @@ -57,6 +58,7 @@ public class DependencyExtentSearchResult extends SearchResult implements IEdito /* (non-Javadoc) * @see org.eclipse.search.ui.text.IEditorMatchAdapter#computeContainedMatches(org.eclipse.search.ui.text.AbstractTextSearchResult, org.eclipse.ui.IEditorPart) */ + @Override public Match[] computeContainedMatches(AbstractTextSearchResult result, IEditorPart editor) { IEditorInput editorInput = editor.getEditorInput(); IJavaElement element = (IJavaElement) editorInput.getAdapter(IJavaElement.class); @@ -92,6 +94,7 @@ public class DependencyExtentSearchResult extends SearchResult implements IEdito /* (non-Javadoc) * @see org.eclipse.search.ui.ISearchResult#getLabel() */ + @Override public String getLabel() { int count = getMatchCount(); return fQuery.getLabel() + " - " + count + " " + (count == 1 ? PDEUIMessages.DependencyExtentSearchResult_dependency : PDEUIMessages.DependencyExtentSearchResult_dependencies); //$NON-NLS-1$ //$NON-NLS-2$ @@ -100,6 +103,7 @@ public class DependencyExtentSearchResult extends SearchResult implements IEdito /* (non-Javadoc) * @see org.eclipse.search.ui.ISearchResult#getTooltip() */ + @Override public String getTooltip() { return null; } @@ -107,6 +111,7 @@ public class DependencyExtentSearchResult extends SearchResult implements IEdito /* (non-Javadoc) * @see org.eclipse.search.ui.ISearchResult#getImageDescriptor() */ + @Override public ImageDescriptor getImageDescriptor() { return PDEPluginImages.DESC_PSEARCH_OBJ; } @@ -114,6 +119,7 @@ public class DependencyExtentSearchResult extends SearchResult implements IEdito /* (non-Javadoc) * @see org.eclipse.search.ui.ISearchResult#getQuery() */ + @Override public ISearchQuery getQuery() { return fQuery; } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/dialogs/TargetRepositorySearchHandler.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/dialogs/TargetRepositorySearchHandler.java index f5c3fdf..19bb028 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/dialogs/TargetRepositorySearchHandler.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/search/dialogs/TargetRepositorySearchHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2010, 2012 EclipseSource and others. All rights reserved. This +* Copyright (c) 2010, 2013 EclipseSource and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -33,7 +33,7 @@ import org.eclipse.ui.handlers.HandlerUtil; * * @since 3.6 */ -public class TargetRepositorySearchHandler extends AbstractHandler implements IHandler { +public class TargetRepositorySearchHandler extends AbstractHandler { public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/TemplateFileGenerator.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/TemplateFileGenerator.java index 404e725..85ed313 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/TemplateFileGenerator.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/util/TemplateFileGenerator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2012 IBM Corporation and others. + * Copyright (c) 2007, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -425,12 +425,13 @@ public class TemplateFileGenerator implements IVariableProvider { * Returns the folder with Java files in the target project. The default * implementation looks for source folders in the classpath of the target * folders and picks the first one encountered. Subclasses may override this - * behaviour. + * behavior. * * @param monitor * progress monitor to use * @return source folder that will be used to generate Java files or * <samp>null </samp> if none found. + * @throws CoreException */ protected IFolder getSourceFolder(IProgressMonitor monitor) throws CoreException { diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/imagebrowser/ActiveImageSourceProvider.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/imagebrowser/ActiveImageSourceProvider.java index ae49152..31a097b 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/imagebrowser/ActiveImageSourceProvider.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/imagebrowser/ActiveImageSourceProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 Christian Pontesegger and others. + * Copyright (c) 2012, 2013 Christian Pontesegger and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * Christian Pontesegger - initial API and implementation + * IBM Corporation - bug fixing *******************************************************************************/ package org.eclipse.pde.internal.ui.views.imagebrowser; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/imagebrowser/ImageBrowserView.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/imagebrowser/ImageBrowserView.java index ac8fe3e..0018688 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/imagebrowser/ImageBrowserView.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/imagebrowser/ImageBrowserView.java @@ -58,7 +58,7 @@ public class ImageBrowserView extends ViewPart implements IImageTarget { private List<Image> displayedImages = new ArrayList<Image>(); - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked"}) public ImageBrowserView() { // create default filters final IFilter<ImageElement> iconSize = new SizeFilter(16, SizeFilter.TYPE_EXACT, 16, SizeFilter.TYPE_EXACT); @@ -82,6 +82,7 @@ public class ImageBrowserView extends ViewPart implements IImageTarget { /* (non-Javadoc) * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) */ + @Override public void createPartControl(final Composite parent) { final Composite composite = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH, 0, 0); PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.IMAGE_BROWSER_VIEW); @@ -150,6 +151,7 @@ public class ImageBrowserView extends ViewPart implements IImageTarget { nextButton = SWTFactory.createPushButton(pageComp, PDEUIMessages.ImageBrowserView_ShowMore, null); nextButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(final SelectionEvent e) { scanImages(); } @@ -163,6 +165,7 @@ public class ImageBrowserView extends ViewPart implements IImageTarget { scrolledComposite.setExpandVertical(true); scrolledComposite.addControlListener(new ControlAdapter() { + @Override public void controlResized(final ControlEvent e) { Rectangle r = scrolledComposite.getClientArea(); scrolledComposite.setMinSize(imageComposite.computeSize(r.width, SWT.DEFAULT)); @@ -206,6 +209,7 @@ public class ImageBrowserView extends ViewPart implements IImageTarget { /* (non-Javadoc) * @see org.eclipse.ui.part.WorkbenchPart#setFocus() */ + @Override public void setFocus() { // Pressing enter when navigating the images calls this method, stealing focus if (sourceCombo.getSelection().isEmpty()) { @@ -339,6 +343,7 @@ public class ImageBrowserView extends ViewPart implements IImageTarget { } } + @Override public void focusGained(FocusEvent e) { // Scroll the focused control into view Control child = (Control) e.widget; diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/imagebrowser/SaveToWorkspace.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/imagebrowser/SaveToWorkspace.java index ee6b273..355c523 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/imagebrowser/SaveToWorkspace.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/imagebrowser/SaveToWorkspace.java @@ -7,6 +7,7 @@ * * Contributors: * Christian Pontesegger - initial API and implementation + * IBM Corporation - bug fixing *******************************************************************************/ package org.eclipse.pde.internal.ui.views.imagebrowser; @@ -36,14 +37,13 @@ import org.eclipse.ui.services.ISourceProviderService; * Handler for the image browser view's save to workspace command. * */ -public class SaveToWorkspace extends AbstractHandler implements IHandler { +public class SaveToWorkspace extends AbstractHandler { public Object execute(final ExecutionEvent event) throws ExecutionException { ISourceProviderService service = (ISourceProviderService) PlatformUI.getWorkbench().getService(ISourceProviderService.class); ISourceProvider provider = service.getSourceProvider(ActiveImageSourceProvider.ACTIVE_IMAGE); if (provider != null) { - @SuppressWarnings("rawtypes") - Map currentState = provider.getCurrentState(); + Map<?, ?> currentState = provider.getCurrentState(); Object data = currentState.get(ActiveImageSourceProvider.ACTIVE_IMAGE); if (data instanceof ImageElement) { diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/plugins/PluginsContentProvider.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/plugins/PluginsContentProvider.java index 2d507e6..98a1316 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/plugins/PluginsContentProvider.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/views/plugins/PluginsContentProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -23,7 +23,7 @@ import org.eclipse.pde.internal.ui.elements.DefaultContentProvider; import org.eclipse.ui.progress.DeferredTreeContentManager; import org.eclipse.ui.progress.IDeferredWorkbenchAdapter; -public class PluginsContentProvider extends DefaultContentProvider implements ITreeContentProvider, IStructuredContentProvider { +public class PluginsContentProvider extends DefaultContentProvider implements ITreeContentProvider { private PluginsView fView; private StandardJavaElementContentProvider fJavaProvider; @@ -37,6 +37,7 @@ public class PluginsContentProvider extends DefaultContentProvider implements IT fJavaProvider = new StandardJavaElementContentProvider(); } + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { if (newInput == null) { if (fManager != null) @@ -131,6 +132,7 @@ public class PluginsContentProvider extends DefaultContentProvider implements IT protected IJobChangeListener getCompletionJobListener() { return new JobChangeAdapter() { + @Override public void done(IJobChangeEvent event) { if (event.getResult().isOK()) fView.updateContentDescription(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/WizardListSelectionPage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/WizardListSelectionPage.java index db66b9b..b58a35a 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/WizardListSelectionPage.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/WizardListSelectionPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -25,7 +25,7 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; -public abstract class WizardListSelectionPage extends BaseWizardSelectionPage implements ISelectionChangedListener, IExecutableExtension { +public abstract class WizardListSelectionPage extends BaseWizardSelectionPage implements IExecutableExtension { protected TableViewer wizardSelectionViewer; protected ElementList wizardElements; private WizardSelectedAction doubleClickAction = new WizardSelectedAction(); @@ -35,6 +35,7 @@ public abstract class WizardListSelectionPage extends BaseWizardSelectionPage im super("wizardSelection"); //$NON-NLS-1$ } + @Override public void run() { selectionChanged(new SelectionChangedEvent(wizardSelectionViewer, wizardSelectionViewer.getSelection())); advanceToNextPage(); @@ -164,6 +165,7 @@ public abstract class WizardListSelectionPage extends BaseWizardSelectionPage im /* (non-Javadoc) * @see org.eclipse.jface.wizard.WizardSelectionPage#canFlipToNextPage() */ + @Override public boolean canFlipToNextPage() { IStructuredSelection ssel = (IStructuredSelection) wizardSelectionViewer.getSelection(); return ssel != null && !ssel.isEmpty(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/WizardTreeSelectionPage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/WizardTreeSelectionPage.java index 112920a..4acb647 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/WizardTreeSelectionPage.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/WizardTreeSelectionPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -20,7 +20,7 @@ import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; -public abstract class WizardTreeSelectionPage extends BaseWizardSelectionPage implements ISelectionChangedListener { +public abstract class WizardTreeSelectionPage extends BaseWizardSelectionPage { private TreeViewer categoryTreeViewer; private String baseCategory; protected TableViewer wizardSelectionViewer; @@ -155,6 +155,7 @@ public abstract class WizardTreeSelectionPage extends BaseWizardSelectionPage im handleWizardSelection(selectionEvent); } + @Override public void setSelectedNode(IWizardNode node) { super.setSelectedNode(node); } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/CrossPlatformExportPage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/CrossPlatformExportPage.java index 9b9a831..0062562 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/CrossPlatformExportPage.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/exports/CrossPlatformExportPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2012 IBM Corporation and others. + * Copyright (c) 2005, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -35,10 +35,12 @@ public class CrossPlatformExportPage extends AbstractExportWizardPage { String ws; String arch; + @Override public String toString() { return os + " (" + ws + "/" + arch + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } + @Override public boolean equals(Object obj) { if (obj instanceof Configuration) { Configuration config = (Configuration) obj; @@ -47,6 +49,11 @@ public class CrossPlatformExportPage extends AbstractExportWizardPage { return super.equals(obj); } + @Override + public int hashCode() { + return os.hashCode() + ws.hashCode() + arch.hashCode(); + } + } class ContentProvider extends DefaultContentProvider implements IStructuredContentProvider { @@ -60,11 +67,13 @@ public class CrossPlatformExportPage extends AbstractExportWizardPage { super(label, buttonLabels); } + @Override public void updateCounter(int count) { super.updateCounter(count); pageChanged(); } + @Override protected void buttonSelected(Button button, int index) { switch (index) { case 0 : @@ -139,6 +148,7 @@ public class CrossPlatformExportPage extends AbstractExportWizardPage { pageChanged(); } + @Override public void saveSettings(IDialogSettings settings) { Object[] objects = fPlatformPart.getSelection(); StringBuffer buffer = new StringBuffer(); @@ -186,6 +196,7 @@ public class CrossPlatformExportPage extends AbstractExportWizardPage { } } + @Override protected void pageChanged() { setPageComplete(fPlatformPart.getSelectionCount() > 0); } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportHelper.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportHelper.java index 57dc6dc..1e1967c 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportHelper.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportHelper.java @@ -21,7 +21,7 @@ import org.eclipse.ui.dialogs.IOverwriteQuery; import org.eclipse.ui.wizards.datatransfer.*; /** - * Helper class for the plugin import operation. Contains methods to assist in the copying and extracting + * Helper class for the plug-in import operation. Contains methods to assist in the copying and extracting * of jar a folder files. */ public class PluginImportHelper { @@ -221,8 +221,7 @@ public class PluginImportHelper { try { zipFile = new ZipFile(file); ZipFileStructureProvider provider = new ZipFileStructureProvider(zipFile); - @SuppressWarnings("rawtypes") - List children = provider.getChildren(provider.getRoot()); + List<?> children = provider.getChildren(provider.getRoot()); if (children != null && !children.isEmpty()) { for (int i = 0; i < children.size(); i++) { Object curr = children.get(i); @@ -251,8 +250,7 @@ public class PluginImportHelper { } public static void collectRequiredBundleFiles(IImportStructureProvider provider, Object element, ArrayList<Object> collected) { - @SuppressWarnings("rawtypes") - List children = provider.getChildren(element); + List<?> children = provider.getChildren(element); if (children != null && !children.isEmpty()) { for (int i = 0; i < children.size(); i++) { Object curr = children.get(i); @@ -281,8 +279,7 @@ public class PluginImportHelper { * @param collected map to collect a file list (maps destination folder to a list of files */ public static void collectBinaryFiles(IImportStructureProvider provider, Object element, Map<IPath, IPath> packageLocations, Map<IPath, List<Object>> collected) { - @SuppressWarnings("rawtypes") - List children = provider.getChildren(element); + List<?> children = provider.getChildren(element); if (children != null && !children.isEmpty()) { for (int i = 0; i < children.size(); i++) { Object curr = children.get(i); @@ -337,8 +334,7 @@ public class PluginImportHelper { * @param collected list of children that should be imported */ public static void collectNonJavaNonBuildFiles(IImportStructureProvider provider, Object element, ArrayList<Object> collected) { - @SuppressWarnings("rawtypes") - List children = provider.getChildren(element); + List<?> children = provider.getChildren(element); if (children != null && !children.isEmpty()) { for (int i = 0; i < children.size(); i++) { Object curr = children.get(i); @@ -368,8 +364,7 @@ public class PluginImportHelper { * @param collected collection for gathering file list */ public static void collectResources(IImportStructureProvider provider, Object element, ArrayList<Object> collected) { - @SuppressWarnings("rawtypes") - List children = provider.getChildren(element); + List<?> children = provider.getChildren(element); if (children != null && !children.isEmpty()) { for (int i = 0; i < children.size(); i++) { Object curr = children.get(i); @@ -392,8 +387,7 @@ public class PluginImportHelper { * @since 3.4 */ private static void collectResourcesFromFolder(ZipFileStructureProvider provider, Object element, IPath folderPath, ArrayList<Object> collected) { - @SuppressWarnings("rawtypes") - List children = provider.getChildren(element); + List<?> children = provider.getChildren(element); if (children != null && !children.isEmpty()) { for (int i = 0; i < children.size(); i++) { Object curr = children.get(i); @@ -420,8 +414,7 @@ public class PluginImportHelper { * @since 3.5 */ public static void collectResourcesFromFolder(IImportStructureProvider provider, Object element, IPath folderPath, ArrayList<Object> collected) { - @SuppressWarnings("rawtypes") - List children = provider.getChildren(element); + List<?> children = provider.getChildren(element); if (children != null && !children.isEmpty()) { for (int i = 0; i < children.size(); i++) { Object curr = children.get(i); @@ -446,8 +439,7 @@ public class PluginImportHelper { * @since 3.4 */ private static void collectJavaSourceFromRoot(ZipFileStructureProvider provider, List<IPath> ignoreFolders, ArrayList<Object> collected) { - @SuppressWarnings("rawtypes") - List children = provider.getChildren(provider.getRoot()); + List<?> children = provider.getChildren(provider.getRoot()); if (children != null && !children.isEmpty()) { for (int i = 0; i < children.size(); i++) { Object curr = children.get(i); @@ -489,8 +481,7 @@ public class PluginImportHelper { * @since 3.4 */ private static void collectJavaSource(ZipFileStructureProvider provider, Object element, List<IPath> ignoreFolders, ArrayList<Object> collected) { - @SuppressWarnings("rawtypes") - List children = provider.getChildren(element); + List<?> children = provider.getChildren(element); if (children != null && !children.isEmpty()) { for (int i = 0; i < children.size(); i++) { Object curr = children.get(i); @@ -523,8 +514,7 @@ public class PluginImportHelper { } private static boolean folderContainsFileExtension(IImportStructureProvider provider, Object element, String fileExtension) { - @SuppressWarnings("rawtypes") - List children = provider.getChildren(element); + List<?> children = provider.getChildren(element); if (children != null && !children.isEmpty()) { for (int i = 0; i < children.size(); i++) { Object curr = children.get(i); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportOperation.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportOperation.java index 90c5e82..ead7843 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportOperation.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/imports/PluginImportOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -153,6 +153,7 @@ public class PluginImportOperation extends WorkspaceJob { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.MessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite) */ + @Override protected Control createCustomArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); @@ -182,6 +183,7 @@ public class PluginImportOperation extends WorkspaceJob { /* (non-Javadoc) * @see org.eclipse.core.resources.WorkspaceJob#runInWorkspace(org.eclipse.core.runtime.IProgressMonitor) */ + @Override public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { try { @@ -220,6 +222,7 @@ public class PluginImportOperation extends WorkspaceJob { if (namesOfNotImportedProjects.size() > 0) { UIJob job = new UIJob(PDEUIMessages.PluginImportOperation_WarningDialogJob) { + @Override public IStatus runInUIThread(IProgressMonitor monitor) { String dialogMessage = namesOfNotImportedProjects.size() == 1 ? PDEUIMessages.PluginImportOperation_WarningDialogMessageSingular : PDEUIMessages.PluginImportOperation_WarningDialogMessagePlural; NotImportedProjectsWarningDialog dialog = new NotImportedProjectsWarningDialog(dialogMessage, namesOfNotImportedProjects); @@ -314,6 +317,7 @@ public class PluginImportOperation extends WorkspaceJob { UIJob job = new UIJob(PDEUIMessages.PluginImportOperation_OverwritePluginProjects) { + @Override public IStatus runInUIThread(IProgressMonitor monitor) { OverwriteProjectsSelectionDialog dialog = new OverwriteProjectsSelectionDialog(getDisplay().getActiveShell(), conflictingPlugins); dialog.setBlockOnOpen(true); @@ -744,10 +748,8 @@ public class PluginImportOperation extends WorkspaceJob { provider = FileSystemStructureProvider.INSTANCE; root = new File(model.getInstallLocation()); } - @SuppressWarnings("rawtypes") - List children = provider.getChildren(root); - for (@SuppressWarnings("rawtypes") - Iterator iterator = children.iterator(); iterator.hasNext();) { + List<?> children = provider.getChildren(root); + for (Iterator<?> iterator = children.iterator(); iterator.hasNext();) { String label = provider.getLabel(iterator.next()); if (label.equals(DEFAULT_SOURCE_DIR)) { return true; @@ -821,10 +823,12 @@ public class PluginImportOperation extends WorkspaceJob { */ private void runBuildJob() { Job buildJob = new Job(PDEUIMessages.CompilersConfigurationBlock_building) { + @Override public boolean belongsTo(Object family) { return ResourcesPlugin.FAMILY_AUTO_BUILD == family; } + @Override protected IStatus run(IProgressMonitor monitor) { try { PDEPlugin.getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/NewLibraryPluginCreationOperation.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/NewLibraryPluginCreationOperation.java index dcd10c5..d156b65 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/NewLibraryPluginCreationOperation.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/NewLibraryPluginCreationOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -92,6 +92,7 @@ public class NewLibraryPluginCreationOperation extends NewProjectCreationOperati removeExportRoot(bundle); } + @Override protected void adjustManifests(IProgressMonitor monitor, IProject project, IPluginBase base) throws CoreException { super.adjustManifests(monitor, project, base); int units = fData.doFindDependencies() ? 4 : 2; @@ -232,8 +233,9 @@ public class NewLibraryPluginCreationOperation extends NewProjectCreationOperati if (path == null) { path = cpe.getPath().toString(); } + JarFile jarFile = null; try { - JarFile jarFile = new JarFile(path); + jarFile = new JarFile(path); if (manifests.contains(jarFile.getManifest())) { if (refIndex < 0) { // allocate slot @@ -246,6 +248,14 @@ public class NewLibraryPluginCreationOperation extends NewProjectCreationOperati } } catch (IOException e) { PDEPlugin.log(e); + } finally { + if (jarFile != null) { + try { + jarFile.close(); + } catch (IOException e) { + PDEPlugin.log(e); + } + } } break; default : @@ -260,6 +270,7 @@ public class NewLibraryPluginCreationOperation extends NewProjectCreationOperati return null; } + @Override protected void createContents(IProgressMonitor monitor, IProject project) throws CoreException, JavaModelException, InvocationTargetException, InterruptedException { // copy jars String[] paths = fData.getLibraryPaths(); @@ -286,6 +297,7 @@ public class NewLibraryPluginCreationOperation extends NewProjectCreationOperati } } + @Override protected void fillBinIncludes(IProject project, IBuildEntry binEntry) throws CoreException { if (fData.hasBundleStructure()) binEntry.addToken(ICoreConstants.MANIFEST_FOLDER_NAME); @@ -320,6 +332,7 @@ public class NewLibraryPluginCreationOperation extends NewProjectCreationOperati } } + @Override protected IClasspathEntry[] getInternalClassPathEntries(IJavaProject project, IFieldData data) { String[] libraryPaths; if (fData.isUnzipLibraries()) { @@ -337,6 +350,7 @@ public class NewLibraryPluginCreationOperation extends NewProjectCreationOperati return entries; } + @Override protected int getNumberOfWorkUnits() { int numUnits = super.getNumberOfWorkUnits(); numUnits += fData.getLibraryPaths().length; @@ -380,6 +394,7 @@ public class NewLibraryPluginCreationOperation extends NewProjectCreationOperati } } + @Override protected void setPluginLibraries(WorkspacePluginModelBase model) throws CoreException { IPluginBase pluginBase = model.getPluginBase(); if (fData.isUnzipLibraries()) { @@ -399,6 +414,7 @@ public class NewLibraryPluginCreationOperation extends NewProjectCreationOperati } } + @Override protected void createSourceOutputBuildEntries(WorkspaceBuildModel model, IBuildModelFactory factory) throws CoreException { if (fData.isUnzipLibraries()) { // SOURCE.<LIBRARY_NAME> @@ -442,6 +458,7 @@ public class NewLibraryPluginCreationOperation extends NewProjectCreationOperati new AddNewBinaryDependenciesOperation(project, (IBundlePluginModelBase) model) { // Need to override this function to include every bundle in the // target platform as a possible dependency + @Override protected String[] findSecondaryBundles(IBundle bundle, Set<String> ignorePkgs) { IPluginModelBase[] bases = PluginRegistry.getActiveModels(); String[] ids = new String[bases.length]; @@ -459,6 +476,7 @@ public class NewLibraryPluginCreationOperation extends NewProjectCreationOperati // build.properties does not contain entry for '.'. // Therefore, the super.addProjectPackages will not find the // project packages(it includes only things in bin.includes) + @Override protected void addProjectPackages(IBundle bundle, Set<String> ignorePkgs) { if (!unzip) super.addProjectPackages(bundle, ignorePkgs); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/TemplateListSelectionPage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/TemplateListSelectionPage.java index 87a3252..07c8e1f 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/TemplateListSelectionPage.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/plugin/TemplateListSelectionPage.java @@ -13,7 +13,6 @@ package org.eclipse.pde.internal.ui.wizards.plugin; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IExecutableExtension; import org.eclipse.jface.viewers.*; import org.eclipse.jface.wizard.IWizardNode; import org.eclipse.pde.internal.ui.IHelpContextIds; @@ -30,12 +29,13 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.ui.PlatformUI; -public class TemplateListSelectionPage extends WizardListSelectionPage implements ISelectionChangedListener, IExecutableExtension { +public class TemplateListSelectionPage extends WizardListSelectionPage { private ContentPage fContentPage; private Button fUseTemplate; private String fInitialTemplateId; class WizardFilter extends ViewerFilter { + @Override public boolean select(Viewer viewer, Object parentElement, Object element) { PluginFieldData data = (PluginFieldData) fContentPage.getData(); boolean simple = data.isSimple(); @@ -91,11 +91,13 @@ public class TemplateListSelectionPage extends WizardListSelectionPage implement /* (non-Javadoc) * @see org.eclipse.pde.internal.ui.wizards.WizardListSelectionPage#createControl(org.eclipse.swt.widgets.Composite) */ + @Override public void createControl(Composite parent) { super.createControl(parent); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IHelpContextIds.NEW_PROJECT_CODE_GEN_PAGE); } + @Override public void createAbove(Composite container, int span) { fUseTemplate = new Button(container, SWT.CHECK); fUseTemplate.setText(PDEUIMessages.WizardListSelectionPage_label); @@ -103,6 +105,7 @@ public class TemplateListSelectionPage extends WizardListSelectionPage implement gd.horizontalSpan = span; fUseTemplate.setLayoutData(gd); fUseTemplate.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { wizardSelectionViewer.getControl().setEnabled(fUseTemplate.getSelection()); if (!fUseTemplate.getSelection()) @@ -114,6 +117,7 @@ public class TemplateListSelectionPage extends WizardListSelectionPage implement fUseTemplate.setSelection(true); } + @Override protected void initializeViewer() { wizardSelectionViewer.addFilter(new WizardFilter()); if (getInitialTemplateId() != null) @@ -133,8 +137,10 @@ public class TemplateListSelectionPage extends WizardListSelectionPage implement } } + @Override protected IWizardNode createWizardNode(WizardElement element) { return new WizardNode(this, element) { + @Override public IBasePluginWizard createWizard() throws CoreException { IPluginContentWizard wizard = (IPluginContentWizard) wizardElement.createExecutableExtension(); wizard.init(fContentPage.getData()); @@ -143,12 +149,14 @@ public class TemplateListSelectionPage extends WizardListSelectionPage implement }; } + @Override public IPluginContentWizard getSelectedWizard() { if (fUseTemplate.getSelection()) return super.getSelectedWizard(); return null; } + @Override public boolean isPageComplete() { PluginFieldData data = (PluginFieldData) fContentPage.getData(); boolean rcp = data.isRCPApplicationPlugin(); @@ -159,6 +167,7 @@ public class TemplateListSelectionPage extends WizardListSelectionPage implement /* (non-Javadoc) * @see org.eclipse.jface.wizard.WizardSelectionPage#canFlipToNextPage() */ + @Override public boolean canFlipToNextPage() { IStructuredSelection ssel = (IStructuredSelection) wizardSelectionViewer.getSelection(); return fUseTemplate.getSelection() && ssel != null && !ssel.isEmpty(); @@ -178,6 +187,7 @@ public class TemplateListSelectionPage extends WizardListSelectionPage implement fInitialTemplateId = initialTemplateId; } + @Override public void setVisible(boolean visible) { if (visible) { fContentPage.updateData(); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/product/BaseProductCreationOperation.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/product/BaseProductCreationOperation.java index 76e71d6..8e9141b 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/product/BaseProductCreationOperation.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/product/BaseProductCreationOperation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2012 IBM Corporation and others. + * Copyright (c) 2005, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -41,6 +41,7 @@ public class BaseProductCreationOperation extends WorkspaceModifyOperation { /* (non-Javadoc) * @see org.eclipse.ui.actions.WorkspaceModifyOperation#execute(org.eclipse.core.runtime.IProgressMonitor) */ + @Override protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { monitor.beginTask(PDEUIMessages.BaseProductCreationOperation_taskName, 2); createContent(); @@ -156,7 +157,6 @@ public class BaseProductCreationOperation extends WorkspaceModifyOperation { } } - @SuppressWarnings("cast") protected void addPlugins(IProductModelFactory factory, IProduct product, Map<IPluginModelBase, String> plugins) { IProductPlugin[] pplugins = new IProductPlugin[plugins.size()]; List<IPluginConfiguration> configurations = new ArrayList<IPluginConfiguration>(3); @@ -169,8 +169,8 @@ public class BaseProductCreationOperation extends WorkspaceModifyOperation { pplugin.setId(model.getPluginBase().getId()); pplugins[i] = pplugin; - // create plug-in configuration model - String sl = (String) plugins.get(model); + // create plug-in configuration model + String sl = plugins.get(model); if (!model.isFragmentModel() && !sl.equals("default:default")) { //$NON-NLS-1$ IPluginConfiguration configuration = factory.createPluginConfiguration(); configuration.setId(model.getPluginBase().getId()); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/templates/PreprocessorParser.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/templates/PreprocessorParser.java index 93c4795..1d7e30f 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/templates/PreprocessorParser.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/templates/PreprocessorParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -54,10 +54,12 @@ public class PreprocessorParser { this.value = value; } + @Override public Object getValue() { return value; } + @Override public String toString() { if (value != null) return "leaf[" + value.toString() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ @@ -76,6 +78,7 @@ public class PreprocessorParser { this.right = right; } + @Override public Object getValue() { boolean result = false; Object leftValue = left != null ? left.getValue() : Boolean.FALSE; @@ -118,6 +121,7 @@ public class PreprocessorParser { return result ? Boolean.TRUE : Boolean.FALSE; } + @Override public String toString() { String lstring = left != null ? left.toString() : "*"; //$NON-NLS-1$ String rstring = right != null ? right.toString() : "*"; //$NON-NLS-1$ @@ -142,9 +146,8 @@ public class PreprocessorParser { this.provider = provider; } - @SuppressWarnings("rawtypes") public static void main(String[] args) { - final Hashtable<String, Comparable> vars = new Hashtable<String, Comparable>(); + final Hashtable<String, Comparable<? extends Object>> vars = new Hashtable<String, Comparable<? extends Object>>(); vars.put("a", Boolean.FALSE); //$NON-NLS-1$ vars.put("b", "3"); //$NON-NLS-1$ //$NON-NLS-2$ vars.put("c", Boolean.TRUE); //$NON-NLS-1$ diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/tools/ConvertJarsAction.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/tools/ConvertJarsAction.java index 2bff5eb..a124071 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/tools/ConvertJarsAction.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/wizards/tools/ConvertJarsAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 IBM Corporation and others. + * Copyright (c) 2008, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,12 +11,11 @@ *******************************************************************************/ package org.eclipse.pde.internal.ui.wizards.tools; -import java.util.jar.Manifest; -import org.eclipse.core.resources.IProject; - import java.io.File; +import java.io.IOException; import java.util.*; import java.util.jar.JarFile; +import java.util.jar.Manifest; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.IPath; import org.eclipse.jdt.core.*; @@ -56,25 +55,34 @@ public class ConvertJarsAction implements IObjectActionDelegate { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); while (i.hasNext()) { IPackageFragmentRoot pfr = (IPackageFragmentRoot) i.next(); + JarFile file = null; try { projectSelection.add(pfr.getJavaProject().getProject()); IClasspathEntry rawClasspathEntry = pfr.getRawClasspathEntry(); IPath path = rawClasspathEntry.getPath(); IFile iFile = root.getFile(path); if (iFile.exists()) { - JarFile jFile = new JarFile(iFile.getLocation().toString()); - if (!filesMap.containsKey(jFile.getManifest())) { - filesMap.put(jFile.getManifest(), iFile); + file = new JarFile(iFile.getLocation().toString()); + if (!filesMap.containsKey(file.getManifest())) { + filesMap.put(file.getManifest(), iFile); } } else { String pathStr = path.toString(); - JarFile file = new JarFile(pathStr); + file = new JarFile(pathStr); if (!filesMap.containsKey(file.getManifest())) { filesMap.put(file.getManifest(), new File(file.getName())); } } } catch (Exception e) { PDEPlugin.logException(e); + } finally { + if (file != null) { + try { + file.close(); + } catch (IOException e) { + PDEPlugin.logException(e); + } + } } } NewLibraryPluginProjectWizard wizard = new NewLibraryPluginProjectWizard(filesMap.values(), projectSelection); diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/templates/PluginReference.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/templates/PluginReference.java index 2bbc25e..e8d5d54 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/templates/PluginReference.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/ui/templates/PluginReference.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. + * Copyright (c) 2007, 2013 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,12 +18,12 @@ import org.eclipse.pde.core.plugin.IPluginReference; /** * Implementation of the IPluginReference * <p> - * This class may be instantiated. This class is not intended to be subclassed by clients. + * This class may be instantiated. This class is not intended to be sub-classed by clients. * </p> * @see IPluginReference * @since 3.4 * - * @noextend This class is not intended to be subclassed by clients. + * @noextend This class is not intended to be sub-classed by clients. */ public class PluginReference implements IPluginReference { @@ -51,20 +51,25 @@ public class PluginReference implements IPluginReference { /* * @see IPluginReference#equals(Object) */ + @Override public boolean equals(Object object) { if (object instanceof IPluginReference) { IPluginReference source = (IPluginReference) object; if (id == null) return false; - if (id.equals(source.getId()) == false) - return false; - if (version == null && source.getVersion() == null) - return true; - return version.equals(source.getVersion()); + return id.equals(source.getId()) && ((version == null && source.getVersion() == null) || version.equals(source.getVersion())); } return false; } + @Override + public int hashCode() { + if (id != null) { + return id.hashCode() + (version == null ? 0 : version.hashCode()); + } + return super.hashCode(); + } + /* * @see IPluginReference#getMatch() */ |