diff options
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/ui')
64 files changed, 1097 insertions, 511 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractBreakpointOrganizerDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractBreakpointOrganizerDelegate.java index 8c1b2ad45..913984ff8 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractBreakpointOrganizerDelegate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractBreakpointOrganizerDelegate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 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,14 +35,16 @@ public abstract class AbstractBreakpointOrganizerDelegate implements IBreakpoint /* (non-Javadoc) * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#addBreakpoint(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.runtime.IAdaptable) */ - public void addBreakpoint(IBreakpoint breakpoint, IAdaptable category) { + @Override + public void addBreakpoint(IBreakpoint breakpoint, IAdaptable category) { // do noting, not supported by default } /* (non-Javadoc) * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) */ - public void addPropertyChangeListener(IPropertyChangeListener listener) { + @Override + public void addPropertyChangeListener(IPropertyChangeListener listener) { fListeners.add(listener); } @@ -53,7 +55,8 @@ public abstract class AbstractBreakpointOrganizerDelegate implements IBreakpoint * * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#canAdd(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.runtime.IAdaptable) */ - public boolean canAdd(IBreakpoint breakpoint, IAdaptable category) { + @Override + public boolean canAdd(IBreakpoint breakpoint, IAdaptable category) { return category instanceof OtherBreakpointCategory; } @@ -64,28 +67,32 @@ public abstract class AbstractBreakpointOrganizerDelegate implements IBreakpoint * * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#canRemove(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.runtime.IAdaptable) */ - public boolean canRemove(IBreakpoint breakpoint, IAdaptable category) { + @Override + public boolean canRemove(IBreakpoint breakpoint, IAdaptable category) { return category instanceof OtherBreakpointCategory; } /* (non-Javadoc) * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#dispose() */ - public void dispose() { + @Override + public void dispose() { fListeners = new ListenerList(); } /* (non-Javadoc) * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#removeBreakpoint(org.eclipse.debug.core.model.IBreakpoint, org.eclipse.core.runtime.IAdaptable) */ - public void removeBreakpoint(IBreakpoint breakpoint, IAdaptable category) { + @Override + public void removeBreakpoint(IBreakpoint breakpoint, IAdaptable category) { // do nothing, not supported by default } /* (non-Javadoc) * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) */ - public void removePropertyChangeListener(IPropertyChangeListener listener) { + @Override + public void removePropertyChangeListener(IPropertyChangeListener listener) { fListeners.remove(listener); } @@ -103,10 +110,12 @@ public abstract class AbstractBreakpointOrganizerDelegate implements IBreakpoint for (int i = 0; i < listeners.length; i++) { final IPropertyChangeListener listener = (IPropertyChangeListener) listeners[i]; ISafeRunnable runnable = new ISafeRunnable() { - public void handleException(Throwable exception) { + @Override + public void handleException(Throwable exception) { DebugUIPlugin.log(exception); } - public void run() throws Exception { + @Override + public void run() throws Exception { listener.propertyChange(event); } }; @@ -117,7 +126,8 @@ public abstract class AbstractBreakpointOrganizerDelegate implements IBreakpoint /* (non-Javadoc) * @see org.eclipse.debug.ui.IBreakpointOrganizerDelegate#getCategories() */ - public IAdaptable[] getCategories() { + @Override + public IAdaptable[] getCategories() { return null; } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java index efc12b3cf..92a41dd97 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractDebugView.java @@ -12,9 +12,9 @@ package org.eclipse.debug.ui; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -113,19 +113,19 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi * Map of actions. Keys are strings, values * are <code>IAction</code>. */ - private Map fActionMap = null; + private Map<String, IAction> fActionMap = null; /** * Map of actions. Keys are strings, values * are <code>IAction</code>. */ - private List fUpdateables = null; + private List<IUpdate> fUpdateables = null; /** * The collection of menu managers that are * relevant for this view. */ - private List fContextMenuManagers; + private List<IMenuManager> fContextMenuManagers; /** * The memento that was used to persist the state of this view. @@ -151,9 +151,9 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi */ private String fEarlyMessage= null; - private static Set fgGlobalActionIds; + private static Set<String> fgGlobalActionIds; static { - fgGlobalActionIds = new HashSet(); + fgGlobalActionIds = new HashSet<String>(); fgGlobalActionIds.add(SELECT_ALL_ACTION); fgGlobalActionIds.add(COPY_ACTION); fgGlobalActionIds.add(CUT_ACTION); @@ -173,6 +173,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi * * @see org.eclipse.ui.IPartListener2#partVisible(IWorkbenchPartReference) */ + @Override public void partVisible(IWorkbenchPartReference ref) { IWorkbenchPart part= ref.getPart(false); if (part == AbstractDebugView.this) { @@ -183,6 +184,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi /** * @see org.eclipse.ui.IPartListener2#partHidden(IWorkbenchPartReference) */ + @Override public void partHidden(IWorkbenchPartReference ref) { IWorkbenchPart part= ref.getPart(false); if (part == AbstractDebugView.this) { @@ -193,36 +195,42 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi /** * @see org.eclipse.ui.IPartListener2#partActivated(IWorkbenchPartReference) */ + @Override public void partActivated(IWorkbenchPartReference ref) { } /** * @see org.eclipse.ui.IPartListener2#partBroughtToTop(IWorkbenchPartReference) */ + @Override public void partBroughtToTop(IWorkbenchPartReference ref) { } /** * @see org.eclipse.ui.IPartListener2#partClosed(IWorkbenchPartReference) */ + @Override public void partClosed(IWorkbenchPartReference ref) { } /** * @see org.eclipse.ui.IPartListener2#partDeactivated(IWorkbenchPartReference) */ + @Override public void partDeactivated(IWorkbenchPartReference ref) { } /** * @see org.eclipse.ui.IPartListener2#partOpened(IWorkbenchPartReference) */ + @Override public void partOpened(IWorkbenchPartReference ref) { } /** * @see org.eclipse.ui.IPartListener2#partInputChanged(IWorkbenchPartReference) */ + @Override public void partInputChanged(IWorkbenchPartReference ref){ } @@ -232,8 +240,8 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi * Constructs a new debug view. */ public AbstractDebugView() { - fActionMap = new HashMap(5); - fUpdateables= new ArrayList(3); + fActionMap = new HashMap<String, IAction>(5); + fUpdateables = new ArrayList<IUpdate>(3); } /** @@ -244,6 +252,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) * @see IDebugView */ + @Override public Object getAdapter(Class adapter) { if (adapter == IDebugView.class) { return this; @@ -268,6 +277,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi /** * @see IPage#createControl(Composite) */ + @Override public void createControl(Composite parent) { Viewer viewer = createViewer(parent); setViewer(viewer); @@ -276,6 +286,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi /** * @see IPage#getControl() */ + @Override public Control getControl() { return getDefaultControl(); } @@ -283,6 +294,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi /** * @see IPage#setFocus() */ + @Override public void setFocus() { Viewer viewer= getViewer(); if (viewer != null) { @@ -316,6 +328,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi * @see AbstractDebugView#getHelpContextId() * @see AbstractDebugView#fillContextMenu(IMenuManager) */ + @Override public void createPartControl(Composite parent) { registerPartListener(); super.createPartControl(parent); @@ -331,6 +344,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi } if (viewer != null) { getViewer().getControl().addKeyListener(new KeyAdapter() { + @Override public void keyPressed(KeyEvent e) { handleKeyPressed(e); } @@ -355,6 +369,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi * * @see PageBookView#createDefaultPage(PageBook) */ + @Override protected IPage createDefaultPage(PageBook book) { ViewerPage page = new ViewerPage(); page.createControl(book); @@ -391,6 +406,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi /** * @see IWorkbenchPart#dispose() */ + @Override public void dispose() { saveAllCheckedActionStates(); deregisterPartListener(); @@ -466,6 +482,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi /** * @see IDebugView#getViewer() */ + @Override public Viewer getViewer() { return fViewer; } @@ -501,6 +518,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi /** * @see IDebugView#getPresentation(String) */ + @Override public IDebugModelPresentation getPresentation(String id) { if (getViewer() instanceof StructuredViewer) { IBaseLabelProvider lp = ((StructuredViewer)getViewer()).getLabelProvider(); @@ -533,6 +551,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi MenuManager menuMgr= new MenuManager("#PopUp"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { + @Override public void menuAboutToShow(IMenuManager mgr) { fillContextMenu(mgr); } @@ -552,6 +571,8 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi * * @deprecated @see AbstractDebugView.getContextMenuManagers() */ + @Deprecated + @Override public IMenuManager getContextMenuManager() { if (fContextMenuManagers != null) { fContextMenuManagers.get(fContextMenuManagers.size() - 1); @@ -565,7 +586,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi * @return the context menu managers relevant to this view * @since 2.1 */ - public List getContextMenuManagers() { + public List<IMenuManager> getContextMenuManagers() { return fContextMenuManagers; } @@ -598,6 +619,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi // This is done in a runnable to be run after this view's pane // is created Runnable r = new Runnable() { + @Override public void run() { if (!isAvailable()) { return; @@ -644,6 +666,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi /** * @see IViewPart#init(IViewSite, IMemento) */ + @Override public void init(IViewSite site, IMemento memento) throws PartInitException { super.init(site, memento); //store the memento to be used when this view is created. @@ -673,6 +696,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi /** * @see IDebugView#setAction(String, IAction) */ + @Override public void setAction(String actionID, IAction action) { if (action == null) { Object removedAction= fActionMap.remove(actionID); @@ -680,7 +704,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi } else { fActionMap.put(actionID, action); if (action instanceof IUpdate) { - fUpdateables.add(action); + fUpdateables.add((IUpdate) action); } } if (fgGlobalActionIds.contains(actionID)) { @@ -692,17 +716,17 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi /** * @see IDebugView#getAction(String) */ + @Override public IAction getAction(String actionID) { - return (IAction) fActionMap.get(actionID); + return fActionMap.get(actionID); } /** * Updates all the registered updatables. */ public void updateObjects() { - Iterator actions = fUpdateables.iterator(); - while (actions.hasNext()) { - ((IUpdate)actions.next()).update(); + for (IUpdate update : fUpdateables) { + update.update(); } } @@ -728,6 +752,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi * * @see IDoubleClickListener#doubleClick(DoubleClickEvent) */ + @Override public void doubleClick(DoubleClickEvent event) { IAction action = getAction(DOUBLE_CLICK_ACTION); if (action != null && !event.getSelection().isEmpty() && action.isEnabled()) { @@ -808,6 +833,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi /** * @see PageBookView#isImportant(IWorkbenchPart) */ + @Override protected boolean isImportant(IWorkbenchPart part) { return false; } @@ -815,6 +841,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi /** * @see PageBookView#doCreatePage(IWorkbenchPart) */ + @Override protected PageRec doCreatePage(IWorkbenchPart part) { return null; } @@ -822,12 +849,14 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi /** * @see PageBookView#doDestroyPage(org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.part.PageBookView.PageRec) */ + @Override protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) { } /** * @see PageBookView#getBootstrapPart() */ + @Override protected IWorkbenchPart getBootstrapPart() { return null; } @@ -908,6 +937,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi /** * @see IDebugView#add(IUpdate) */ + @Override public void add(IUpdate updatable) { if (!fUpdateables.contains(updatable)) { fUpdateables.add(updatable); @@ -917,6 +947,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi /** * @see IDebugView#remove(IUpdate) */ + @Override public void remove(IUpdate updatable) { fUpdateables.remove(updatable); } @@ -929,7 +960,7 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi */ public void addContextMenuManager(IMenuManager contextMenuManager) { if (fContextMenuManagers == null) { - fContextMenuManagers= new ArrayList(); + fContextMenuManagers = new ArrayList<IMenuManager>(); } fContextMenuManagers.add(contextMenuManager); } @@ -993,14 +1024,14 @@ public abstract class AbstractDebugView extends PageBookView implements IDebugVi * presentation in this view associated with the given debug model * @since 3.0 */ - public Map getPresentationAttributes(String modelId) { + public Map<String, Object> getPresentationAttributes(String modelId) { IDebugModelPresentation presentation = getPresentation(modelId); if (presentation instanceof DelegatingModelPresentation) { return ((DelegatingModelPresentation)presentation).getAttributeMap(); } else if (presentation instanceof LazyModelPresentation) { return ((LazyModelPresentation)presentation).getAttributeMap(); } - return new HashMap(); + return Collections.EMPTY_MAP; } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTab.java index dd4e4456c..e2dbb3a50 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTab.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTab.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 @@ -118,6 +118,7 @@ public abstract class AbstractLaunchConfigurationTab implements ILaunchConfigura /** * @see ILaunchConfigurationTab#getControl() */ + @Override public Control getControl() { return fControl; } @@ -134,6 +135,7 @@ public abstract class AbstractLaunchConfigurationTab implements ILaunchConfigura /** * @see ILaunchConfigurationTab#getErrorMessage() */ + @Override public String getErrorMessage() { return fErrorMessage; } @@ -142,6 +144,7 @@ public abstract class AbstractLaunchConfigurationTab implements ILaunchConfigura * @see ILaunchConfigurationTab2#getWarningMessage() * @since 3.9 */ + @Override public String getWarningMessage() { return fWarningMessage; } @@ -149,6 +152,7 @@ public abstract class AbstractLaunchConfigurationTab implements ILaunchConfigura /** * @see ILaunchConfigurationTab#getMessage() */ + @Override public String getMessage() { return fMessage; } @@ -162,12 +166,15 @@ public abstract class AbstractLaunchConfigurationTab implements ILaunchConfigura * than the launch dialog, this method cannot be relied upon for launching * functionality. */ + @Deprecated + @Override public void launched(ILaunch launch) { } /** * @see ILaunchConfigurationTab#setLaunchConfigurationDialog(ILaunchConfigurationDialog) */ + @Override public void setLaunchConfigurationDialog(ILaunchConfigurationDialog dialog) { fLaunchConfigurationDialog = dialog; } @@ -214,6 +221,7 @@ public abstract class AbstractLaunchConfigurationTab implements ILaunchConfigura * * @see ILaunchConfigurationTab#dispose() */ + @Override public void dispose() { } @@ -273,6 +281,7 @@ public abstract class AbstractLaunchConfigurationTab implements ILaunchConfigura /** * @see ILaunchConfigurationTab#canSave() */ + @Override public boolean canSave() { return true; } @@ -280,6 +289,7 @@ public abstract class AbstractLaunchConfigurationTab implements ILaunchConfigura /** * @see ILaunchConfigurationTab#isValid(ILaunchConfiguration) */ + @Override public boolean isValid(ILaunchConfiguration launchConfig) { return true; } @@ -310,6 +320,7 @@ public abstract class AbstractLaunchConfigurationTab implements ILaunchConfigura /** * @see ILaunchConfigurationTab#getImage() */ + @Override public Image getImage() { return null; } @@ -395,6 +406,7 @@ public abstract class AbstractLaunchConfigurationTab implements ILaunchConfigura * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) * @since 3.0 */ + @Override public void activated(ILaunchConfigurationWorkingCopy workingCopy) { initializeFrom(workingCopy); } @@ -415,6 +427,7 @@ public abstract class AbstractLaunchConfigurationTab implements ILaunchConfigura * @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) * @since 3.0 */ + @Override public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { performApply(workingCopy); } @@ -452,12 +465,14 @@ public abstract class AbstractLaunchConfigurationTab implements ILaunchConfigura */ protected Job createUpdateJob() { return new WorkbenchJob(getControl().getDisplay(), "Update LCD") { //$NON-NLS-1$ + @Override public IStatus runInUIThread(IProgressMonitor monitor) { if (!getControl().isDisposed()) { updateLaunchConfigurationDialog(); } return Status.OK_STATUS; } + @Override public boolean shouldRun() { return !getControl().isDisposed(); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTabGroup.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTabGroup.java index d1e873e1d..970ac29dc 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTabGroup.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/AbstractLaunchConfigurationTabGroup.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 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 @@ -36,6 +36,7 @@ public abstract class AbstractLaunchConfigurationTabGroup implements ILaunchConf /** * @see ILaunchConfigurationTabGroup#getTabs() */ + @Override public ILaunchConfigurationTab[] getTabs() { return fTabs; } @@ -54,6 +55,7 @@ public abstract class AbstractLaunchConfigurationTabGroup implements ILaunchConf * * @see ILaunchConfigurationTabGroup#dispose() */ + @Override public void dispose() { ILaunchConfigurationTab[] tabs = getTabs(); if (tabs != null) { @@ -68,6 +70,7 @@ public abstract class AbstractLaunchConfigurationTabGroup implements ILaunchConf * * @see ILaunchConfigurationTabGroup#setDefaults(ILaunchConfigurationWorkingCopy) */ + @Override public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { ILaunchConfigurationTab[] tabs = getTabs(); for (int i = 0; i < tabs.length; i++) { @@ -80,6 +83,7 @@ public abstract class AbstractLaunchConfigurationTabGroup implements ILaunchConf * * @see ILaunchConfigurationTabGroup#initializeFrom(ILaunchConfiguration) */ + @Override public void initializeFrom(ILaunchConfiguration configuration) { ILaunchConfigurationTab[] tabs = getTabs(); for (int i = 0; i < tabs.length; i++) { @@ -92,6 +96,7 @@ public abstract class AbstractLaunchConfigurationTabGroup implements ILaunchConf * * @see ILaunchConfigurationTabGroup#performApply(ILaunchConfigurationWorkingCopy) */ + @Override public void performApply(ILaunchConfigurationWorkingCopy configuration) { ILaunchConfigurationTab[] tabs = getTabs(); for (int i = 0; i < tabs.length; i++) { @@ -108,6 +113,8 @@ public abstract class AbstractLaunchConfigurationTabGroup implements ILaunchConf * than the launch dialog, this method cannot be relied upon for launching * functionality. */ + @Deprecated + @Override public void launched(ILaunch launch) { ILaunchConfigurationTab[] tabs = getTabs(); for (int i = 0; i < tabs.length; i++) { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/BreakpointTypeCategory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/BreakpointTypeCategory.java index 1ce0c4672..9fcb97e15 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/BreakpointTypeCategory.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/BreakpointTypeCategory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 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 @@ -64,6 +64,7 @@ public class BreakpointTypeCategory extends PlatformObject implements IBreakpoin /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ + @Override public boolean equals(Object object) { if (object instanceof BreakpointTypeCategory) { BreakpointTypeCategory type = (BreakpointTypeCategory) object; @@ -75,6 +76,7 @@ public class BreakpointTypeCategory extends PlatformObject implements IBreakpoin /* (non-Javadoc) * @see java.lang.Object#hashCode() */ + @Override public int hashCode() { return getName().hashCode(); } @@ -82,6 +84,7 @@ public class BreakpointTypeCategory extends PlatformObject implements IBreakpoin /* (non-Javadoc) * @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object) */ + @Override public Object[] getChildren(Object o) { return null; } @@ -89,6 +92,7 @@ public class BreakpointTypeCategory extends PlatformObject implements IBreakpoin /* (non-Javadoc) * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object) */ + @Override public ImageDescriptor getImageDescriptor(Object object) { return fImageDescriptor; } @@ -96,6 +100,7 @@ public class BreakpointTypeCategory extends PlatformObject implements IBreakpoin /* (non-Javadoc) * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object) */ + @Override public String getLabel(Object o) { return getName(); } @@ -103,10 +108,12 @@ public class BreakpointTypeCategory extends PlatformObject implements IBreakpoin /* (non-Javadoc) * @see org.eclipse.ui.model.IWorkbenchAdapter#getParent(java.lang.Object) */ + @Override public Object getParent(Object o) { return null; } + @Override public String toString() { return fName; } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java index a74e76b11..fdac516a5 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/CommonTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 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 @@ -15,7 +15,6 @@ import java.nio.charset.Charset; import java.nio.charset.IllegalCharsetNameException; import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; @@ -141,6 +140,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab { * Modify listener that simply updates the owning launch configuration dialog. */ private ModifyListener fBasicModifyListener = new ModifyListener() { + @Override public void modifyText(ModifyEvent evt) { scheduleUpdateJob(); } @@ -157,6 +157,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) */ + @Override public void createControl(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); setControl(comp); @@ -202,6 +203,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab { fFavoritesTable.setContentProvider(new FavoritesContentProvider()); fFavoritesTable.setLabelProvider(new FavoritesLabelProvider()); fFavoritesTable.addCheckStateListener(new ICheckStateListener() { + @Override public void checkStateChanged(CheckStateChangedEvent event) { updateLaunchConfigurationDialog(); } @@ -222,12 +224,14 @@ public class CommonTab extends AbstractLaunchConfigurationTab { fLocalRadioButton.setLayoutData(gd); fSharedRadioButton = createRadioButton(comp, LaunchConfigurationsMessages.CommonTab_S_hared_4); fSharedRadioButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent evt) { handleSharedRadioButtonSelected(); } }); fSharedLocationText = SWTFactory.createSingleText(comp, 1); fSharedLocationText.getAccessible().addAccessibleListener(new AccessibleAdapter() { + @Override public void getName(AccessibleEvent e) { e.result = LaunchConfigurationsMessages.CommonTab_S_hared_4; } @@ -235,6 +239,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab { fSharedLocationText.addModifyListener(fBasicModifyListener); fSharedLocationButton = createPushButton(comp, LaunchConfigurationsMessages.CommonTab__Browse_6, null); fSharedLocationButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent evt) { handleSharedLocationButtonSelected(); } @@ -259,7 +264,8 @@ public class CommonTab extends AbstractLaunchConfigurationTab { gd.horizontalSpan = 5; fConsoleOutput.setLayoutData(gd); fConsoleOutput.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { + @Override + public void widgetSelected(SelectionEvent e) { updateLaunchConfigurationDialog(); } }); @@ -267,14 +273,16 @@ public class CommonTab extends AbstractLaunchConfigurationTab { fFileOutput = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_6); fFileOutput.setLayoutData(new GridData(SWT.BEGINNING, SWT.NORMAL, false, false)); fFileOutput.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { + @Override + public void widgetSelected(SelectionEvent e) { enableOuputCaptureWidgets(fFileOutput.getSelection()); updateLaunchConfigurationDialog(); } }); fFileText = SWTFactory.createSingleText(comp, 4); fFileText.getAccessible().addAccessibleListener(new AccessibleAdapter() { - public void getName(AccessibleEvent e) { + @Override + public void getName(AccessibleEvent e) { e.result = LaunchConfigurationsMessages.CommonTab_6; } }); @@ -286,7 +294,8 @@ public class CommonTab extends AbstractLaunchConfigurationTab { ld.marginWidth = 0; fWorkspaceBrowse = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_12, null); fWorkspaceBrowse.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { + @Override + public void widgetSelected(SelectionEvent e) { ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider()); dialog.setTitle(LaunchConfigurationsMessages.CommonTab_13); dialog.setMessage(LaunchConfigurationsMessages.CommonTab_14); @@ -305,7 +314,8 @@ public class CommonTab extends AbstractLaunchConfigurationTab { }); fFileBrowse = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_7, null); fFileBrowse.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { + @Override + public void widgetSelected(SelectionEvent e) { String filePath = fFileText.getText(); FileDialog dialog = new FileDialog(getShell(), SWT.SAVE); filePath = dialog.open(); @@ -316,7 +326,8 @@ public class CommonTab extends AbstractLaunchConfigurationTab { }); fVariables = createPushButton(bcomp, LaunchConfigurationsMessages.CommonTab_9, null); fVariables.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e) { + @Override + public void widgetSelected(SelectionEvent e) { StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell()); dialog.open(); String variable = dialog.getVariableExpression(); @@ -324,14 +335,16 @@ public class CommonTab extends AbstractLaunchConfigurationTab { fFileText.insert(variable); } } - public void widgetDefaultSelected(SelectionEvent e) {} + @Override + public void widgetDefaultSelected(SelectionEvent e) {} }); fAppend = createCheckButton(comp, LaunchConfigurationsMessages.CommonTab_11); gd = new GridData(SWT.LEFT, SWT.TOP, true, false); gd.horizontalSpan = 4; fAppend.setLayoutData(gd); fAppend.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { + @Override + public void widgetSelected(SelectionEvent e) { updateLaunchConfigurationDialog(); } }); @@ -394,19 +407,21 @@ public class CommonTab extends AbstractLaunchConfigurationTab { fEncodingCombo = new Combo(group, SWT.NONE); fEncodingCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fEncodingCombo.setFont(parent.getFont()); - List allEncodings = IDEEncoding.getIDEEncodings(); - String[] encodingArray = (String[]) allEncodings.toArray(new String[0]); + List<String> allEncodings = IDEEncoding.getIDEEncodings(); + String[] encodingArray = allEncodings.toArray(new String[0]); fEncodingCombo.setItems(encodingArray); if (encodingArray.length > 0) { fEncodingCombo.select(0); } fEncodingCombo.getAccessible().addAccessibleListener(new AccessibleAdapter() { - public void getName(AccessibleEvent e) { + @Override + public void getName(AccessibleEvent e) { e.result = LaunchConfigurationsMessages.CommonTab_3; } }); SelectionListener listener = new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { + @Override + public void widgetSelected(SelectionEvent e) { if(e.getSource() instanceof Button) { Button button = (Button)e.getSource(); if(button.getSelection()) { @@ -428,6 +443,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab { * * @see org.eclipse.swt.events.KeyListener#keyReleased(org.eclipse.swt.events.KeyEvent) */ + @Override public void keyReleased(KeyEvent e) { scheduleUpdateJob(); } @@ -464,6 +480,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab { fLaunchInBackgroundButton.setLayoutData(data); fLaunchInBackgroundButton.setFont(parent.getFont()); fLaunchInBackgroundButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { updateLaunchConfigurationDialog(); } @@ -547,6 +564,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) */ + @Override public void initializeFrom(ILaunchConfiguration configuration) { boolean isShared = !configuration.isLocal(); fSharedRadioButton.setSelection(isShared); @@ -615,7 +633,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab { } catch (CoreException e) { } String defaultEncoding = getDefaultEncoding(configuration); - fDefaultEncodingButton.setText(MessageFormat.format(LaunchConfigurationsMessages.CommonTab_2, new String[]{defaultEncoding})); + fDefaultEncodingButton.setText(MessageFormat.format(LaunchConfigurationsMessages.CommonTab_2, new Object[] { defaultEncoding })); fDefaultEncodingButton.pack(); if (encoding != null) { fAltEncodingButton.setSelection(true); @@ -649,11 +667,12 @@ public class CommonTab extends AbstractLaunchConfigurationTab { * Updates the favorites selections from the local configuration * @param config the local configuration */ + @SuppressWarnings("deprecation") private void updateFavoritesFromConfig(ILaunchConfiguration config) { fFavoritesTable.setInput(config); fFavoritesTable.setCheckedElements(new Object[]{}); try { - List groups = config.getAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, new ArrayList()); + List<String> groups = config.getAttribute(IDebugUIConstants.ATTR_FAVORITE_GROUPS, new ArrayList<String>()); if (groups.isEmpty()) { // check old attributes for backwards compatible if (config.getAttribute(IDebugUIConstants.ATTR_DEBUG_FAVORITE, false)) { @@ -664,10 +683,8 @@ public class CommonTab extends AbstractLaunchConfigurationTab { } } if (!groups.isEmpty()) { - List list = new ArrayList(); - Iterator iterator = groups.iterator(); - while (iterator.hasNext()) { - String id = (String)iterator.next(); + List<LaunchGroupExtension> list = new ArrayList<LaunchGroupExtension>(); + for (String id : groups) { LaunchGroupExtension extension = getLaunchConfigurationManager().getLaunchGroup(id); if (extension != null) { list.add(extension); @@ -716,6 +733,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab { * and will be missing for older configurations. * @param config the configuration to update */ + @SuppressWarnings("deprecation") private void updateConfigFromFavorites(ILaunchConfigurationWorkingCopy config) { try { Object[] checked = fFavoritesTable.getCheckedElements(); @@ -723,7 +741,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab { boolean run = config.getAttribute(IDebugUIConstants.ATTR_RUN_FAVORITE, false); if (debug || run) { // old attributes - List groups = new ArrayList(); + List<LaunchGroupExtension> groups = new ArrayList<LaunchGroupExtension>(); int num = 0; if (debug) { groups.add(getLaunchConfigurationManager().getLaunchGroup(IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP)); @@ -749,11 +767,11 @@ public class CommonTab extends AbstractLaunchConfigurationTab { } config.setAttribute(IDebugUIConstants.ATTR_DEBUG_FAVORITE, (String)null); config.setAttribute(IDebugUIConstants.ATTR_RUN_FAVORITE, (String)null); - List groups = null; + List<String> groups = null; for (int i = 0; i < checked.length; i++) { LaunchGroupExtension group = (LaunchGroupExtension)checked[i]; if (groups == null) { - groups = new ArrayList(); + groups = new ArrayList<String>(); } groups.add(group.getIdentifier()); } @@ -774,6 +792,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration) */ + @Override public boolean isValid(ILaunchConfiguration config) { setMessage(null); setErrorMessage(null); @@ -834,6 +853,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void setDefaults(ILaunchConfigurationWorkingCopy config) { config.setContainer(null); setAttribute(IDebugUIConstants.ATTR_LAUNCH_IN_BACKGROUND, config, true, true); @@ -842,6 +862,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void performApply(ILaunchConfigurationWorkingCopy configuration) { updateConfigFromLocalShared(configuration); updateConfigFromFavorites(configuration); @@ -881,6 +902,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() */ + @Override public String getName() { return LaunchConfigurationsMessages.CommonTab__Common_15; } @@ -890,6 +912,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab { * * @since 3.3 */ + @Override public String getId() { return "org.eclipse.debug.ui.commonTab"; //$NON-NLS-1$ } @@ -897,6 +920,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#canSave() */ + @Override public boolean canSave() { return validateLocalShared(); } @@ -904,6 +928,7 @@ public class CommonTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage() */ + @Override public Image getImage() { return DebugUITools.getImage(IInternalDebugUIConstants.IMG_OBJS_COMMON_TAB); } @@ -911,11 +936,13 @@ public class CommonTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void activated(ILaunchConfigurationWorkingCopy workingCopy) {} /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) {} /** @@ -923,9 +950,10 @@ public class CommonTab extends AbstractLaunchConfigurationTab { */ class FavoritesContentProvider implements IStructuredContentProvider { + @Override public Object[] getElements(Object inputElement) { ILaunchGroup[] groups = DebugUITools.getLaunchGroups(); - List possibleGroups = new ArrayList(); + List<ILaunchGroup> possibleGroups = new ArrayList<ILaunchGroup>(); ILaunchConfiguration configuration = (ILaunchConfiguration)inputElement; for (int i = 0; i < groups.length; i++) { ILaunchGroup extension = groups[i]; @@ -937,8 +965,10 @@ public class CommonTab extends AbstractLaunchConfigurationTab { return possibleGroups.toArray(); } + @Override public void dispose() {} + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {} } @@ -949,10 +979,11 @@ public class CommonTab extends AbstractLaunchConfigurationTab { */ class FavoritesLabelProvider implements ITableLabelProvider { - private Map fImages = new HashMap(); + private Map<Object, Image> fImages = new HashMap<Object, Image>(); + @Override public Image getColumnImage(Object element, int columnIndex) { - Image image = (Image)fImages.get(element); + Image image = fImages.get(element); if (image == null) { ImageDescriptor descriptor = ((LaunchGroupExtension)element).getImageDescriptor(); if (descriptor != null) { @@ -963,23 +994,26 @@ public class CommonTab extends AbstractLaunchConfigurationTab { return image; } + @Override public String getColumnText(Object element, int columnIndex) { String label = ((LaunchGroupExtension)element).getLabel(); return DebugUIPlugin.removeAccelerators(label); } + @Override public void addListener(ILabelProviderListener listener) {} + @Override public void dispose() { - Iterator images = fImages.values().iterator(); - while (images.hasNext()) { - Image image = (Image)images.next(); + for (Image image : fImages.values()) { image.dispose(); } } + @Override public boolean isLabelProperty(Object element, String property) {return false;} + @Override public void removeListener(ILabelProviderListener listener) {} } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugElementWorkbenchAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugElementWorkbenchAdapter.java index fed8d2b4c..6de7015f5 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugElementWorkbenchAdapter.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugElementWorkbenchAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 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 @@ -31,40 +31,46 @@ import org.eclipse.ui.model.IWorkbenchAdapter2; * {@link IWorkbenchAdapter}. Custom content is currently supported * by a provisional internal viewer framework. */ +@Deprecated public abstract class DebugElementWorkbenchAdapter implements IWorkbenchAdapter, IWorkbenchAdapter2 { /* (non-Javadoc) * @see org.eclipse.ui.model.IWorkbenchAdapter#getImageDescriptor(java.lang.Object) */ - public ImageDescriptor getImageDescriptor(Object object) { + @Override + public ImageDescriptor getImageDescriptor(Object object) { return DebugElementHelper.getImageDescriptor(object); } /* (non-Javadoc) * @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object) */ - public String getLabel(Object o) { + @Override + public String getLabel(Object o) { return DebugElementHelper.getLabel(o); } /* (non-Javadoc) * @see org.eclipse.ui.model.IWorkbenchAdapter2#getForeground(java.lang.Object) */ - public RGB getForeground(Object element) { + @Override + public RGB getForeground(Object element) { return DebugElementHelper.getForeground(element); } /* (non-Javadoc) * @see org.eclipse.ui.model.IWorkbenchAdapter2#getBackground(java.lang.Object) */ - public RGB getBackground(Object element) { + @Override + public RGB getBackground(Object element) { return DebugElementHelper.getBackground(element); } /* (non-Javadoc) * @see org.eclipse.ui.model.IWorkbenchAdapter2#getFont(java.lang.Object) */ - public FontData getFont(Object element) { + @Override + public FontData getFont(Object element) { return DebugElementHelper.getFont(element); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java index 442eb0da2..5d3709a4c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2010 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.debug.ui; -import com.ibm.icu.text.MessageFormat; - import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; @@ -31,6 +29,8 @@ import org.eclipse.ui.handlers.IHandlerActivation; import org.eclipse.ui.handlers.IHandlerService; import org.eclipse.ui.keys.IBindingService; +import com.ibm.icu.text.MessageFormat; + /** * A <code>PopupDialog</code> that is automatically positioned relative * to a specified anchor point. The popup can be dismissed in the same @@ -85,7 +85,8 @@ public abstract class DebugPopup extends PopupDialog { String infoText = null; if (formattedBinding != null) { - infoText = MessageFormat.format(DebugUIViewsMessages.InspectPopupDialog_1, new String[] { formattedBinding, getActionText()}); + infoText = MessageFormat.format(DebugUIViewsMessages.InspectPopupDialog_1, new Object[] { + formattedBinding, getActionText() }); } return infoText; } @@ -138,7 +139,8 @@ public abstract class DebugPopup extends PopupDialog { * (non-Javadoc) * @see org.eclipse.jface.dialogs.PopupDialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ - protected abstract Control createDialogArea(Composite parent); + @Override + protected abstract Control createDialogArea(Composite parent); /** @@ -152,7 +154,8 @@ public abstract class DebugPopup extends PopupDialog { * <code>getInitialSize</code>. * @return the initial location of the shell */ - protected Point getInitialLocation(Point initialSize) { + @Override + protected Point getInitialLocation(Point initialSize) { if (fAnchor == null) { return super.getInitialLocation(initialSize); } @@ -171,7 +174,8 @@ public abstract class DebugPopup extends PopupDialog { * (non-Javadoc) * @see org.eclipse.jface.dialogs.PopupDialog#getDialogSettings() */ - protected IDialogSettings getDialogSettings() { + @Override + protected IDialogSettings getDialogSettings() { IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings(); return settings; } @@ -180,12 +184,14 @@ public abstract class DebugPopup extends PopupDialog { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.PopupDialog#open() */ - public int open() { + @Override + public int open() { IWorkbench workbench = PlatformUI.getWorkbench(); String commandId = getCommandId(); if (commandId != null) { IHandler fCloseHandler = new AbstractHandler() { - public Object execute(ExecutionEvent event) throws ExecutionException { + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { persist(); close(); return null; @@ -197,8 +203,9 @@ public abstract class DebugPopup extends PopupDialog { } String infoText = getInfoText(); - if (infoText != null) - setInfoText(infoText); + if (infoText != null) { + setInfoText(infoText); + } return super.open(); } @@ -206,9 +213,11 @@ public abstract class DebugPopup extends PopupDialog { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.PopupDialog#close() */ - public boolean close() { - if (fActivation != null) - fHandlerService.deactivateHandler(fActivation); + @Override + public boolean close() { + if (fActivation != null) { + fHandlerService.deactivateHandler(fActivation); + } return super.close(); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java index 5c1b10395..ab92b7437 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.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 @@ -286,11 +286,13 @@ public class DebugUITools { IMarker[] markers= new IMarker[breakpoints.length]; int markerCount; for (markerCount= 0; markerCount < breakpoints.length; markerCount++) { - if (!breakpoints[markerCount].isRegistered()) + if (!breakpoints[markerCount].isRegistered()) { break; + } markers[markerCount]= breakpoints[markerCount].getMarker(); - if (markers[markerCount] == null) + if (markers[markerCount] == null) { break; + } } // We only offer undo support if all breakpoints are registered and have associated markers @@ -300,15 +302,18 @@ public class DebugUITools { if (allowUndo) { - for (int i= 0; i < markers.length; i++) + for (int i= 0; i < markers.length; i++) { markers[i].setAttribute(DebugPlugin.ATTR_BREAKPOINT_IS_DELETED, true); + } IAdaptable context= null; if (shell != null) { context= new IAdaptable() { + @Override public Object getAdapter(Class adapter) { - if (adapter == Shell.class) + if (adapter == Shell.class) { return shell; + } return null; } }; @@ -506,6 +511,7 @@ public class DebugUITools { * to specify the launch group that the dialog should be opened on. This method will open * on the launch group with the specified mode and a <code>null</code> category */ + @Deprecated public static int openLaunchConfigurationDialog(Shell shell, IStructuredSelection selection, String mode) { ILaunchGroup[] groups = getLaunchGroups(); for (int i = 0; i < groups.length; i++) { @@ -585,6 +591,7 @@ public class DebugUITools { /** * @see java.lang.Runnable#run() */ + @Override public void run() { LaunchConfigurationsDialog dialog = (LaunchConfigurationsDialog) LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog(); if (dialog != null) { @@ -711,6 +718,7 @@ public class DebugUITools { * @deprecated Saving has been moved to the launch delegate <code>LaunchConfigurationDelegate</code> to allow for scoped saving * of resources that are only involved in the current launch, no longer the entire workspace */ + @Deprecated public static boolean saveAndBuildBeforeLaunch() { return DebugUIPlugin.saveAndBuild(); } @@ -732,6 +740,7 @@ public class DebugUITools { * @deprecated Saving has been moved to the launch delegate <code>LaunchConfigurationDelegate</code> to allow for scoped saving * of resources that are only involved in the current launch, no longer the entire workspace */ + @Deprecated public static boolean saveBeforeLaunch() { return DebugUIPlugin.preLaunchSave(); } @@ -811,7 +820,7 @@ public class DebugUITools { * * @since 3.3 */ - public static String getLaunchPerspective(ILaunchConfigurationType type, ILaunchDelegate delegate, Set modes) { + public static String getLaunchPerspective(ILaunchConfigurationType type, ILaunchDelegate delegate, Set<String> modes) { return DebugUIPlugin.getDefault().getPerspectiveManager().getLaunchPerspective(type, modes, delegate); } @@ -849,7 +858,7 @@ public class DebugUITools { * * @since 3.3 */ - public static void setLaunchPerspective(ILaunchConfigurationType type, ILaunchDelegate delegate, Set modes, String perspectiveid) { + public static void setLaunchPerspective(ILaunchConfigurationType type, ILaunchDelegate delegate, Set<String> modes, String perspectiveid) { DebugUIPlugin.getDefault().getPerspectiveManager().setLaunchPerspective(type, modes, delegate, perspectiveid); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DeferredDebugElementWorkbenchAdapter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DeferredDebugElementWorkbenchAdapter.java index c3083bf8b..393cdfab6 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DeferredDebugElementWorkbenchAdapter.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DeferredDebugElementWorkbenchAdapter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 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,6 +30,7 @@ import org.eclipse.ui.progress.IElementCollector; * {@link IDeferredWorkbenchAdapter}. Deferred custom content is currently supported * by a provisional internal viewer framework. */ +@Deprecated public abstract class DeferredDebugElementWorkbenchAdapter extends DebugElementWorkbenchAdapter implements IDeferredWorkbenchAdapter { /** @@ -40,20 +41,23 @@ public abstract class DeferredDebugElementWorkbenchAdapter extends DebugElementW /* (non-Javadoc) * @see org.eclipse.ui.progress.IDeferredWorkbenchAdapter#isContainer() */ - public boolean isContainer() { + @Override + public boolean isContainer() { return true; } /* (non-Javadoc) * @see org.eclipse.ui.progress.IDeferredWorkbenchAdapter#getRule(java.lang.Object) */ - public ISchedulingRule getRule(Object object) { + @Override + public ISchedulingRule getRule(Object object) { return null; } /* (non-Javadoc) * @see org.eclipse.ui.progress.IDeferredWorkbenchAdapter#fetchDeferredChildren(java.lang.Object, org.eclipse.ui.progress.IElementCollector, org.eclipse.core.runtime.IProgressMonitor) */ + @Override public void fetchDeferredChildren(Object object, IElementCollector collector, IProgressMonitor monitor) { if (monitor.isCanceled()) { return; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java index eb748fa2b..6f312f47c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/EnvironmentTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 Keith Seitz and others. + * Copyright (c) 2000, 2013 Keith Seitz 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,6 +16,7 @@ import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; import java.util.Map; +import java.util.Map.Entry; import java.util.TreeMap; import org.eclipse.core.runtime.CoreException; @@ -108,12 +109,13 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { * Content provider for the environment table */ protected class EnvironmentVariableContentProvider implements IStructuredContentProvider { + @Override public Object[] getElements(Object inputElement) { EnvironmentVariable[] elements = new EnvironmentVariable[0]; ILaunchConfiguration config = (ILaunchConfiguration) inputElement; - Map m; + Map<String, String> m; try { - m = config.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map) null); + m = config.getAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map<String, String>) null); } catch (CoreException e) { DebugUIPlugin.log(new Status(IStatus.ERROR, DebugUIPlugin.getUniqueIdentifier(), IStatus.ERROR, "Error reading configuration", e)); //$NON-NLS-1$ return elements; @@ -123,13 +125,15 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { String[] varNames = new String[m.size()]; m.keySet().toArray(varNames); for (int i = 0; i < m.size(); i++) { - elements[i] = new EnvironmentVariable(varNames[i], (String) m.get(varNames[i])); + elements[i] = new EnvironmentVariable(varNames[i], m.get(varNames[i])); } } return elements; } + @Override public void dispose() { } + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { if (newInput == null){ return; @@ -140,6 +144,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { return; } tableViewer.setComparator(new ViewerComparator() { + @Override public int compare(Viewer iviewer, Object e1, Object e2) { if (e1 == null) { return -1; @@ -158,6 +163,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { * Label provider for the environment table */ public class EnvironmentVariableLabelProvider extends LabelProvider implements ITableLabelProvider { + @Override public String getColumnText(Object element, int columnIndex) { String result = null; if (element != null) { @@ -169,10 +175,13 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { case 1: // value result = var.getValue(); break; + default: + break; } } return result; } + @Override public Image getColumnImage(Object element, int columnIndex) { if (columnIndex == 0) { return DebugPluginImages.getImage(IDebugUIConstants.IMG_OBJS_ENV_VAR); @@ -191,6 +200,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) */ + @Override public void createControl(Composite parent) { // Create main composite Composite mainComposite = SWTFactory.createComposite(parent, 2, 1, GridData.FILL_HORIZONTAL); @@ -214,6 +224,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { Composite comp = SWTFactory.createComposite(parent, 1, 2, GridData.FILL_HORIZONTAL); appendEnvironment= createRadioButton(comp, LaunchConfigurationsMessages.EnvironmentTab_16); appendEnvironment.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { updateLaunchConfigurationDialog(); } @@ -254,11 +265,13 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { environmentTable.setLabelProvider(new EnvironmentVariableLabelProvider()); environmentTable.setColumnProperties(new String[] {P_VARIABLE, P_VALUE}); environmentTable.addSelectionChangedListener(new ISelectionChangedListener() { + @Override public void selectionChanged(SelectionChangedEvent event) { handleTableSelectionChanged(event); } }); environmentTable.addDoubleClickListener(new IDoubleClickListener() { + @Override public void doubleClick(DoubleClickEvent event) { if (!environmentTable.getSelection().isEmpty()) { handleEnvEditButtonSelected(); @@ -273,6 +286,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { final Table tref = table; final Composite comp = tableComposite; tableComposite.addControlListener(new ControlAdapter() { + @Override public void controlResized(ControlEvent e) { Rectangle area = comp.getClientArea(); Point size = tref.computeSize(SWT.DEFAULT, SWT.DEFAULT); @@ -317,18 +331,21 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { // Create buttons envAddButton = createPushButton(buttonComposite, LaunchConfigurationsMessages.EnvironmentTab_New_4, null); envAddButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent event) { handleEnvAddButtonSelected(); } }); envSelectButton = createPushButton(buttonComposite, LaunchConfigurationsMessages.EnvironmentTab_18, null); envSelectButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent event) { handleEnvSelectButtonSelected(); } }); envEditButton = createPushButton(buttonComposite, LaunchConfigurationsMessages.EnvironmentTab_Edit_5, null); envEditButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent event) { handleEnvEditButtonSelected(); } @@ -336,6 +353,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { envEditButton.setEnabled(false); envRemoveButton = createPushButton(buttonComposite, LaunchConfigurationsMessages.EnvironmentTab_Remove_6, null); envRemoveButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent event) { handleEnvRemoveButtonSelected(); } @@ -377,7 +395,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { for (int i = 0; i < items.length; i++) { EnvironmentVariable existingVariable = (EnvironmentVariable) items[i].getData(); if (existingVariable.getName().equals(name)) { - boolean overWrite= MessageDialog.openQuestion(getShell(), LaunchConfigurationsMessages.EnvironmentTab_12, MessageFormat.format(LaunchConfigurationsMessages.EnvironmentTab_13, new String[] {name})); // + boolean overWrite = MessageDialog.openQuestion(getShell(), LaunchConfigurationsMessages.EnvironmentTab_12, MessageFormat.format(LaunchConfigurationsMessages.EnvironmentTab_13, new Object[] { name })); // if (!overWrite) { return false; } @@ -396,7 +414,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { */ private void handleEnvSelectButtonSelected() { //get Environment Variables from the OS - Map envVariables = getNativeEnvironment(); + Map<String, EnvironmentVariable> envVariables = getNativeEnvironment(); //get Environment Variables from the table TableItem[] items = environmentTable.getTable().getItems(); @@ -424,13 +442,11 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { * Gets native environment variable from the LaunchManager. Creates EnvironmentVariable objects. * @return Map of name - EnvironmentVariable pairs based on native environment. */ - private Map getNativeEnvironment() { - Map stringVars = DebugPlugin.getDefault().getLaunchManager().getNativeEnvironmentCasePreserved(); - HashMap vars = new HashMap(); - for (Iterator i = stringVars.keySet().iterator(); i.hasNext(); ) { - String key = (String) i.next(); - String value = (String) stringVars.get(key); - vars.put(key, new EnvironmentVariable(key, value)); + private Map<String, EnvironmentVariable> getNativeEnvironment() { + Map<String, String> stringVars = DebugPlugin.getDefault().getLaunchManager().getNativeEnvironmentCasePreserved(); + HashMap<String, EnvironmentVariable> vars = new HashMap<String, EnvironmentVariable>(); + for (Entry<String, String> entry : stringVars.entrySet()) { + vars.put(entry.getKey(), new EnvironmentVariable(entry.getKey(), entry.getValue())); } return vars; } @@ -476,12 +492,15 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { */ private void handleEnvRemoveButtonSelected() { IStructuredSelection sel = (IStructuredSelection) environmentTable.getSelection(); - environmentTable.getControl().setRedraw(false); - for (Iterator i = sel.iterator(); i.hasNext(); ) { - EnvironmentVariable var = (EnvironmentVariable) i.next(); - environmentTable.remove(var); + try { + environmentTable.getControl().setRedraw(false); + for (Iterator<?> i = sel.iterator(); i.hasNext();) { + EnvironmentVariable var = (EnvironmentVariable) i.next(); + environmentTable.remove(var); + } + } finally { + environmentTable.getControl().setRedraw(true); } - environmentTable.getControl().setRedraw(true); updateAppendReplace(); updateLaunchConfigurationDialog(); } @@ -497,6 +516,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { configuration.removeAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES); } @@ -504,6 +524,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) */ + @Override public void initializeFrom(ILaunchConfiguration configuration) { boolean append= true; try { @@ -526,18 +547,18 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { * Stores the environment in the given configuration * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void performApply(ILaunchConfigurationWorkingCopy configuration) { // Convert the table's items into a Map so that this can be saved in the // configuration's attributes. TableItem[] items = environmentTable.getTable().getItems(); - Map map = new HashMap(items.length); - for (int i = 0; i < items.length; i++) - { + Map<String, String> map = new HashMap<String, String>(items.length); + for (int i = 0; i < items.length; i++) { EnvironmentVariable var = (EnvironmentVariable) items[i].getData(); map.put(var.getName(), var.getValue()); } if (map.size() == 0) { - configuration.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map) null); + configuration.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, (Map<String, String>) null); } else { configuration.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, map); } @@ -566,6 +587,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() */ + @Override public String getName() { return LaunchConfigurationsMessages.EnvironmentTab_Environment_7; } @@ -575,6 +597,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { * * @since 3.3 */ + @Override public String getId() { return "org.eclipse.debug.ui.environmentTab"; //$NON-NLS-1$ } @@ -582,6 +605,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage() */ + @Override public Image getImage() { return DebugPluginImages.getImage(IDebugUIConstants.IMG_OBJS_ENVIRONMENT); } @@ -589,6 +613,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void activated(ILaunchConfigurationWorkingCopy workingCopy) { // do nothing when activated } @@ -596,6 +621,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { // do nothing when deactivated } @@ -617,6 +643,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getDialogSettingsId() */ + @Override protected String getDialogSettingsId() { return IDebugUIConstants.PLUGIN_ID + ".ENVIRONMENT_TAB.NATIVE_ENVIROMENT_DIALOG"; //$NON-NLS-1$ } @@ -624,6 +651,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getHelpContextId() */ + @Override protected String getHelpContextId() { return IDebugHelpContextIds.SELECT_NATIVE_ENVIRONMENT_DIALOG; } @@ -631,6 +659,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getViewerInput() */ + @Override protected Object getViewerInput() { return fInput; } @@ -638,6 +667,7 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getViewerLabel() */ + @Override protected String getViewerLabel() { return LaunchConfigurationsMessages.EnvironmentTab_19; } @@ -645,22 +675,30 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getLabelProvider() */ + @Override protected IBaseLabelProvider getLabelProvider() { return new ILabelProvider() { + @Override public Image getImage(Object element) { return DebugPluginImages.getImage(IDebugUIConstants.IMG_OBJS_ENVIRONMENT); } + @Override public String getText(Object element) { EnvironmentVariable var = (EnvironmentVariable) element; - return MessageFormat.format(LaunchConfigurationsMessages.EnvironmentTab_7, new String[] {var.getName(), var.getValue()}); + return MessageFormat.format(LaunchConfigurationsMessages.EnvironmentTab_7, new Object[] { + var.getName(), var.getValue() }); } + @Override public void addListener(ILabelProviderListener listener) { } + @Override public void dispose() { } + @Override public boolean isLabelProperty(Object element, String property) { return false; } + @Override public void removeListener(ILabelProviderListener listener) { } }; @@ -669,31 +707,36 @@ public class EnvironmentTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.launchConfigurations.AbstractDebugSelectionDialog#getContentProvider() */ + @Override protected IContentProvider getContentProvider() { return new IStructuredContentProvider() { + @Override public Object[] getElements(Object inputElement) { EnvironmentVariable[] elements = null; if (inputElement instanceof HashMap) { - Comparator comparator = new Comparator() { + Comparator<Object> comparator = new Comparator<Object>() { + @Override public int compare(Object o1, Object o2) { - String s1 = (String)o1; - String s2 = (String)o2; + String s1 = (String) o1; + String s2 = (String) o2; return s1.compareTo(s2); } }; - TreeMap envVars = new TreeMap(comparator); - envVars.putAll((Map)inputElement); + TreeMap<Object, Object> envVars = new TreeMap<Object, Object>(comparator); + envVars.putAll((Map<?, ?>) inputElement); elements = new EnvironmentVariable[envVars.size()]; int index = 0; - for (Iterator iterator = envVars.keySet().iterator(); iterator.hasNext(); index++) { + for (Iterator<Object> iterator = envVars.keySet().iterator(); iterator.hasNext(); index++) { Object key = iterator.next(); elements[index] = (EnvironmentVariable) envVars.get(key); } } return elements; } + @Override public void dispose() { } + @Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { } }; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugModelPresentation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugModelPresentation.java index cdcbc3c5f..3477185c4 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugModelPresentation.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugModelPresentation.java @@ -111,6 +111,7 @@ public interface IDebugModelPresentation extends ILabelProvider, ISourcePresenta * image should be used * @see ILabelProvider */ + @Override public Image getImage(Object element); /** * Returns a label for the element, or <code>null</code> if a default @@ -121,6 +122,7 @@ public interface IDebugModelPresentation extends ILabelProvider, ISourcePresenta * label should be used * @see ILabelProvider */ + @Override public String getText(Object element); /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java index 6dff487e1..59913787e 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugUIConstants.java @@ -194,6 +194,7 @@ public interface IDebugUIConstants { * @since 2.0 * @deprecated no longer used */ + @Deprecated public static final String PREF_SHOW_TYPE_NAMES = PLUGIN_ID + ".show_type_names"; //$NON-NLS-1$ /** @@ -204,6 +205,7 @@ public interface IDebugUIConstants { * @since 2.0 * @deprecated no longer used */ + @Deprecated public static final String PREF_SHOW_DETAIL_PANE = PLUGIN_ID + ".show_detail_pane"; //$NON-NLS-1$ /** @@ -289,6 +291,7 @@ public interface IDebugUIConstants { * @deprecated Use org.eclipse.ui.console.IConsoleConstants.ID_CONSOLE_VIEW * @since 3.0 */ + @Deprecated public static final String ID_CONSOLE_VIEW= "org.eclipse.debug.ui.ConsoleView"; //$NON-NLS-1$ // Console stream identifiers @@ -337,6 +340,7 @@ public interface IDebugUIConstants { /** Clear action image identifier. * @deprecated use the platform shared image for clear - {@link ISharedImages#IMG_ETOOL_CLEAR}*/ + @Deprecated public static final String IMG_LCL_CLEAR= "IMG_LCL_CLEAR"; //$NON-NLS-1$ /** Display variable type names action image identifier. */ @@ -854,6 +858,7 @@ public interface IDebugUIConstants { * @deprecated Since 3.0, this launch configuration attribute is no longer supported. * Use <code>DebugUITools.setLaunchPerspective(ILaunchConfigurationType type, String mode, String perspective)</code>. */ + @Deprecated public static final String ATTR_TARGET_RUN_PERSPECTIVE = PLUGIN_ID + ".target_run_perspective"; //$NON-NLS-1$ /** @@ -867,6 +872,7 @@ public interface IDebugUIConstants { * @deprecated Since 3.0, this launch configuration attribute is no longer supported. * Use <code>DebugUITools.setLaunchPerspective(ILaunchConfigurationType type, String mode, String perspective)</code>. */ + @Deprecated public static final String ATTR_TARGET_DEBUG_PERSPECTIVE = PLUGIN_ID + ".target_debug_perspective"; //$NON-NLS-1$ /** @@ -896,6 +902,7 @@ public interface IDebugUIConstants { * @since 2.0 * @deprecated use <code>ATTR_FAVORITE_GROUPS</code> instead */ + @Deprecated public static final String ATTR_DEBUG_FAVORITE = PLUGIN_ID + ".debugFavorite"; //$NON-NLS-1$ /** @@ -906,6 +913,7 @@ public interface IDebugUIConstants { * @since 2.0 * @deprecated use <code>ATTR_FAVORITE_GROUPS</code> instead */ + @Deprecated public static final String ATTR_RUN_FAVORITE = PLUGIN_ID + ".runFavorite"; //$NON-NLS-1$ /** @@ -941,6 +949,7 @@ public interface IDebugUIConstants { * @since 3.1 * @deprecated in 3.3 Please use DebugPlugin.ATTR_CONSOLE_ENCODING instead. */ + @Deprecated public static final String ATTR_CONSOLE_ENCODING = DebugPlugin.ATTR_CONSOLE_ENCODING; /** @@ -986,6 +995,7 @@ public interface IDebugUIConstants { * @deprecated The Debug Action Groups extension point no longer exists. Product * vendors should use Activities instead. */ + @Deprecated public static final String EXTENSION_POINT_DEBUG_ACTION_GROUPS= "debugActionGroups"; //$NON-NLS-1$ /** @@ -1074,7 +1084,8 @@ public interface IDebugUIConstants { * @since 3.1 * @deprecated As of release 3.4, replaced by {@link #EXTENSION_POINT_MEMORY_RENDERINGS} */ - public static final String EXTENSION_POINT_MEMORY_RENDERIGNS = "memoryRenderings"; //$NON-NLS-1$ + @Deprecated + public static final String EXTENSION_POINT_MEMORY_RENDERIGNS = "memoryRenderings"; //$NON-NLS-1$ /** * Memory renderings extension point identifier (value diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugView.java index da04b4d78..d6e6b6b45 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDebugView.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 @@ -173,5 +173,6 @@ public interface IDebugView extends IViewPart { * @return the context menu manager for this view, or <code>null</code> if none * @deprecated See AbstractDebugView#getContextMenuManagers() */ + @Deprecated public IMenuManager getContextMenuManager(); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPaneFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPaneFactory.java index 2dbfdfbdd..c92e41e32 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPaneFactory.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/IDetailPaneFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2007 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 @@ -45,7 +45,7 @@ public interface IDetailPaneFactory { * @param selection The current selection * @return Set of String IDs for possible detail pane types, possibly empty */ - public Set getDetailPaneTypes(IStructuredSelection selection); + public Set<String> getDetailPaneTypes(IStructuredSelection selection); /** * Returns the identifier of the default detail pane type to use for the given diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationDialog.java index e279452ee..8505b0344 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 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,6 +35,7 @@ public interface ILaunchConfigurationDialog extends IRunnableContext { * @deprecated the launch dialog no longer supports launching without * opening - this constant will never be returned by the dialog */ + @Deprecated public static final int LAUNCHED_BEFORE_OPENING = 2; /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationTab.java index e7256f5bc..e13d55995 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationTab.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 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 @@ -201,6 +201,7 @@ public interface ILaunchConfigurationTab { * than the launch dialog, this method cannot be relied upon for launching * functionality. */ + @Deprecated public void launched(ILaunch launch); /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationTabGroup.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationTabGroup.java index 1f4f117a2..340629abe 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationTabGroup.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/ILaunchConfigurationTabGroup.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 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 interface ILaunchConfigurationTabGroup { * than the launch dialog, this method cannot be relied upon for launching * functionality. */ + @Deprecated public void launched(ILaunch launch); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java index c0c71c341..0531e322f 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java @@ -94,7 +94,8 @@ public class InspectPopupDialog extends DebugPopup { /* (non-Javadoc) * @see org.eclipse.debug.ui.DebugPopup#createDialogArea(org.eclipse.swt.widgets.Composite) */ - protected Control createDialogArea(Composite parent) { + @Override + protected Control createDialogArea(Composite parent) { Composite composite = new Composite(parent, parent.getStyle()); GridLayout layout = new GridLayout(); composite.setLayout(layout); @@ -125,10 +126,12 @@ public class InspectPopupDialog extends DebugPopup { fTree = fViewer.getTree(); fTree.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e) { + @Override + public void widgetSelected(SelectionEvent e) { fDetailPane.display((IStructuredSelection)fViewer.getSelection()); } - public void widgetDefaultSelected(SelectionEvent e) {} + @Override + public void widgetDefaultSelected(SelectionEvent e) {} }); initSashWeights(); @@ -147,12 +150,16 @@ public class InspectPopupDialog extends DebugPopup { TreeRoot treeRoot = new TreeRoot(); // add update listener to auto-select and display details of root expression fViewer.addViewerUpdateListener(new IViewerUpdateListener() { + @Override public void viewerUpdatesComplete() { } + @Override public void viewerUpdatesBegin() { } + @Override public void updateStarted(IViewerUpdate update) { } + @Override public void updateComplete(IViewerUpdate update) { if (update instanceof IChildrenUpdate) { TreeSelection selection = new TreeSelection(new TreePath(new Object[]{fExpression})); @@ -191,7 +198,8 @@ public class InspectPopupDialog extends DebugPopup { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.PopupDialog#saveDialogBounds(org.eclipse.swt.widgets.Shell) */ - protected void saveDialogBounds(Shell shell) { + @Override + protected void saveDialogBounds(Shell shell) { super.saveDialogBounds(shell); if (fSashForm != null && !fSashForm.isDisposed()){ int[] weights = fSashForm.getWeights(); @@ -219,12 +227,14 @@ public class InspectPopupDialog extends DebugPopup { /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.viewers.model.provisional.elements.ElementContentProvider#getChildCount(java.lang.Object, org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext) */ + @Override protected int getChildCount(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException { return 1; } /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.viewers.model.provisional.elements.ElementContentProvider#getChildren(java.lang.Object, int, int, org.eclipse.debug.internal.ui.viewers.provisional.IPresentationContext) */ + @Override protected Object[] getChildren(Object parent, int index, int length, IPresentationContext context, IViewerUpdate monitor) throws CoreException { return new Object[] { fExpression }; } @@ -232,6 +242,7 @@ public class InspectPopupDialog extends DebugPopup { /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.viewers.model.provisional.elements.ElementContentProvider#supportsContextId(java.lang.String) */ + @Override protected boolean supportsContextId(String id) { return true; } @@ -261,7 +272,8 @@ public class InspectPopupDialog extends DebugPopup { /* (non-Javadoc) * @see org.eclipse.debug.ui.DebugPopup#close() */ - public boolean close() { + @Override + public boolean close() { if (!wasPersisted()) { fExpression.dispose(); } @@ -273,14 +285,16 @@ public class InspectPopupDialog extends DebugPopup { /* (non-Javadoc) * @see org.eclipse.debug.ui.DebugPopup#getActionText() */ - protected String getActionText() { + @Override + protected String getActionText() { return DebugUIViewsMessages.InspectPopupDialog_0; } /* (non-Javadoc) * @see org.eclipse.debug.ui.DebugPopup#persist() */ - protected void persist() { + @Override + protected void persist() { super.persist(); DebugPlugin.getDefault().getExpressionManager().addExpression(fExpression); @@ -300,7 +314,8 @@ public class InspectPopupDialog extends DebugPopup { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.PopupDialog#getInitialSize() */ - protected Point getInitialSize() { + @Override + protected Point getInitialSize() { Point initialSize = super.getInitialSize(); initialSize.x = Math.max(initialSize.x, MIN_WIDTH); initialSize.y = Math.max(initialSize.y, MIN_HEIGHT); @@ -310,8 +325,9 @@ public class InspectPopupDialog extends DebugPopup { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.PopupDialog#getBackgroundColorExclusions() */ - protected List getBackgroundColorExclusions() { - List list = super.getBackgroundColorExclusions(); + @Override + protected List<Control> getBackgroundColorExclusions() { + List<Control> list = super.getBackgroundColorExclusions(); list.add(fSashForm); return list; } @@ -325,6 +341,7 @@ public class InspectPopupDialog extends DebugPopup { /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.views.variables.details.IDetailPaneContainer#getCurrentPaneID() */ + @Override public String getCurrentPaneID() { return fDetailPane.getCurrentPaneID(); } @@ -332,6 +349,7 @@ public class InspectPopupDialog extends DebugPopup { /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.views.variables.details.IDetailPaneContainer#getCurrentSelection() */ + @Override public IStructuredSelection getCurrentSelection() { return (IStructuredSelection)fViewer.getSelection(); } @@ -339,6 +357,7 @@ public class InspectPopupDialog extends DebugPopup { /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.views.variables.details.IDetailPaneContainer#refreshDetailPaneContents() */ + @Override public void refreshDetailPaneContents() { fDetailPane.display(getCurrentSelection()); } @@ -346,6 +365,7 @@ public class InspectPopupDialog extends DebugPopup { /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.views.variables.details.IDetailPaneContainer#getParentComposite() */ + @Override public Composite getParentComposite() { return fDetailPaneComposite; } @@ -353,6 +373,7 @@ public class InspectPopupDialog extends DebugPopup { /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.views.variables.details.IDetailPaneContainer#getWorkbenchPartSite() */ + @Override public IWorkbenchPartSite getWorkbenchPartSite() { return null; } @@ -360,6 +381,7 @@ public class InspectPopupDialog extends DebugPopup { /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.views.variables.details.IDetailPaneContainer#paneChanged(java.lang.String) */ + @Override public void paneChanged(String newPaneID) { if (newPaneID.equals(DefaultDetailPane.ID)){ Display display = getShell().getDisplay(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/RefreshTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/RefreshTab.java index a816dc8f2..3f7c9bff8 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/RefreshTab.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/RefreshTab.java @@ -99,6 +99,7 @@ public class RefreshTab extends AbstractLaunchConfigurationTab { /** * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) */ + @Override public void createControl(Composite parent) { Composite mainComposite = new Composite(parent, SWT.NONE); setControl(mainComposite); @@ -112,6 +113,7 @@ public class RefreshTab extends AbstractLaunchConfigurationTab { fRefreshButton = createCheckButton(mainComposite, StringSubstitutionMessages.RefreshTab_31); fRefreshButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { updateEnabledState(); updateLaunchConfigurationDialog(); @@ -129,6 +131,7 @@ public class RefreshTab extends AbstractLaunchConfigurationTab { fGroup.setLayoutData(gd); SelectionAdapter adapter = new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { if (((Button)e.getSource()).getSelection()) { updateEnabledState(); @@ -171,6 +174,7 @@ public class RefreshTab extends AbstractLaunchConfigurationTab { gd = (GridData)fSelectButton.getLayoutData(); gd.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END; fSelectButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { selectResources(); } @@ -212,6 +216,7 @@ public class RefreshTab extends AbstractLaunchConfigurationTab { data.horizontalSpan = 2; fRecursiveButton.setLayoutData(data); fRecursiveButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { updateLaunchConfigurationDialog(); } @@ -221,12 +226,14 @@ public class RefreshTab extends AbstractLaunchConfigurationTab { /** * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { } /** * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) */ + @Override public void initializeFrom(ILaunchConfiguration configuration) { updateRefresh(configuration); updateRecursive(configuration); @@ -307,6 +314,7 @@ public class RefreshTab extends AbstractLaunchConfigurationTab { /** * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void performApply(ILaunchConfigurationWorkingCopy configuration) { if (fRefreshButton.getSelection()) { String scope = generateScopeMemento(); @@ -347,6 +355,7 @@ public class RefreshTab extends AbstractLaunchConfigurationTab { /** * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() */ + @Override public String getName() { return StringSubstitutionMessages.RefreshTab_6; } @@ -372,10 +381,12 @@ public class RefreshTab extends AbstractLaunchConfigurationTab { /** * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage() */ + @Override public Image getImage() { return DebugPluginImages.getImage(IInternalDebugUIConstants.IMG_OBJS_REFRESH_TAB); } + @Override public boolean isValid(ILaunchConfiguration launchConfig) { setErrorMessage(null); setMessage(null); @@ -477,6 +488,7 @@ public class RefreshTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void activated(ILaunchConfigurationWorkingCopy workingCopy) { // do nothing on activation } @@ -484,6 +496,7 @@ public class RefreshTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { // do nothing on deactivation } @@ -493,6 +506,7 @@ public class RefreshTab extends AbstractLaunchConfigurationTab { * * @since 3.5 */ + @Override public String getId() { return "org.eclipse.debug.ui.refreshTab"; //$NON-NLS-1$ } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java index 1065f1769..6cb8e7aab 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/StringVariableSelectionDialog.java @@ -22,10 +22,10 @@ import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.IDebugHelpContextIds; import org.eclipse.debug.internal.ui.SWTFactory; import org.eclipse.debug.internal.ui.preferences.StringVariablePreferencePage; -import org.eclipse.debug.ui.stringsubstitution.IArgumentSelector; import org.eclipse.debug.internal.ui.stringsubstitution.StringSubstitutionMessages; import org.eclipse.debug.internal.ui.stringsubstitution.StringVariableLabelProvider; import org.eclipse.debug.internal.ui.stringsubstitution.StringVariablePresentationManager; +import org.eclipse.debug.ui.stringsubstitution.IArgumentSelector; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.preference.IPreferenceNode; import org.eclipse.jface.preference.PreferenceDialog; @@ -87,7 +87,7 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog { } //no filtering by default - private ArrayList fFilters = new ArrayList(); + private ArrayList<VariableFilter> fFilters = new ArrayList<VariableFilter>(); //when filtering is on, do not show all by default private boolean fShowAllSelected = false; @@ -160,9 +160,11 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog { private void updateElements() { final Display display = DebugUIPlugin.getStandardDisplay(); BusyIndicator.showWhile(display, new Runnable() { + @Override public void run() { final IStringVariable[] elements = VariablesPlugin.getDefault().getStringVariableManager().getVariables(); display.asyncExec(new Runnable() { + @Override public void run() { setListElements(elements); } @@ -181,15 +183,16 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog { } } + @Override protected void setListElements(Object[] elements) { - ArrayList filtered = new ArrayList(); + ArrayList<Object> filtered = new ArrayList<Object>(); filtered.addAll(Arrays.asList(elements)); if(!fFilters.isEmpty() && !fShowAllSelected) { for (int i = 0; i < elements.length; i++) { if(elements[i] instanceof IDynamicVariable) { boolean bFiltered = false; for (int j = 0; (j < fFilters.size()) && !bFiltered; j++) { - VariableFilter filter = (VariableFilter)fFilters.get(j); + VariableFilter filter = fFilters.get(j); if(filter.isFiltered((IDynamicVariable)elements[i])) { filtered.remove(elements[i]); bFiltered = true; @@ -204,6 +207,7 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.Dialog#createContents(org.eclipse.swt.widgets.Composite) */ + @Override protected Control createContents(Composite parent) { Control ctrl = super.createContents(parent); PlatformUI.getWorkbench().getHelpSystem().setHelp(ctrl, IDebugHelpContextIds.VARIABLE_SELECTION_DIALOG); @@ -213,6 +217,7 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ + @Override protected Control createDialogArea(Composite parent) { Control control = super.createDialogArea(parent); createArgumentArea((Composite)control); @@ -235,7 +240,7 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog { for (int i = 0;(i < elements.length) && !bNeedShowAll; i++) { if(elements[i] instanceof IDynamicVariable) { for (int j = 0; (j < fFilters.size()) && !bNeedShowAll; j++) { - VariableFilter filter = (VariableFilter)fFilters.get(j); + VariableFilter filter = fFilters.get(j); if(filter.isFiltered((IDynamicVariable)elements[i])) { bNeedShowAll = true; } @@ -248,6 +253,7 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog { updateDescription(); fShowAllButton = SWTFactory.createCheckButton(btnContainer, StringSubstitutionMessages.StringVariableSelectionDialog_9, null, fShowAllSelected, 1); fShowAllButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { fShowAllSelected = fShowAllButton.getSelection(); updateDescription(); @@ -262,6 +268,7 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog { Button editButton = SWTFactory.createPushButton(btnContainer, StringSubstitutionMessages.StringVariableSelectionDialog_0, null, GridData.HORIZONTAL_ALIGN_END); editButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { editVariables(); } @@ -277,6 +284,7 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog { fArgumentButton = SWTFactory.createPushButton(args, StringSubstitutionMessages.StringVariableSelectionDialog_7, null); fArgumentButton.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { configureArgument(); } @@ -299,12 +307,14 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog { protected void editVariables() { final Display display = DebugUIPlugin.getStandardDisplay(); BusyIndicator.showWhile(display, new Runnable() { + @Override public void run() { // show the preference page in a new dialog rather than using the utility method to re-use a // preference page, in case this dialog is being opened from a preference page if (showVariablesPage()) { final IStringVariable[] elements = VariablesPlugin.getDefault().getStringVariableManager().getVariables(); display.asyncExec(new Runnable() { + @Override public void run() { setListElements(elements); } @@ -328,6 +338,7 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog { final PreferenceDialog dialog = new PreferenceDialog(DebugUIPlugin.getShell(), manager); final boolean [] result = new boolean[] { false }; BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), new Runnable() { + @Override public void run() { dialog.create(); dialog.setMessage(targetNode.getLabelText()); @@ -355,6 +366,7 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog { * * @see org.eclipse.ui.dialogs.AbstractElementListSelectionDialog#handleSelectionChanged() */ + @Override protected void handleSelectionChanged() { super.handleSelectionChanged(); Object[] objects = getSelectedElements(); @@ -381,6 +393,7 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.Dialog#okPressed() */ + @Override protected void okPressed() { fArgumentValue = fArgumentText.getText().trim(); super.okPressed(); @@ -398,7 +411,8 @@ public class StringVariableSelectionDialog extends ElementListSelectionDialog { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.Dialog#getDialogBoundsSettings() */ - protected IDialogSettings getDialogBoundsSettings() { + @Override + protected IDialogSettings getDialogBoundsSettings() { IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings(); IDialogSettings section = settings.getSection(getDialogSettingsSectionName()); if (section == null) { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/WorkingDirectoryBlock.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/WorkingDirectoryBlock.java index 7eb6c942d..6ec72b8de 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/WorkingDirectoryBlock.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/WorkingDirectoryBlock.java @@ -74,9 +74,11 @@ public abstract class WorkingDirectoryBlock extends AbstractLaunchConfigurationT * A listener to update for text changes and widget selection */ private class WidgetListener extends SelectionAdapter implements ModifyListener { + @Override public void modifyText(ModifyEvent e) { scheduleUpdateJob(); } + @Override public void widgetSelected(SelectionEvent e) { Object source= e.getSource(); if (source == fWorkspaceButton) { @@ -142,6 +144,7 @@ public abstract class WorkingDirectoryBlock extends AbstractLaunchConfigurationT /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) */ + @Override public final void createControl(Composite parent) { Font font = parent.getFont(); Group group = SWTFactory.createGroup(parent, DebugUIMessages.WorkingDirectoryBlock_12, 2, 1, GridData.FILL_HORIZONTAL); @@ -315,6 +318,7 @@ public abstract class WorkingDirectoryBlock extends AbstractLaunchConfigurationT /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core.ILaunchConfiguration) */ + @Override public boolean isValid(ILaunchConfiguration config) { setErrorMessage(null); setMessage(null); @@ -353,6 +357,7 @@ public abstract class WorkingDirectoryBlock extends AbstractLaunchConfigurationT * * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void setDefaults(ILaunchConfigurationWorkingCopy config) { config.setAttribute(workingDirectoryAttribteName, (String)null); } @@ -360,6 +365,7 @@ public abstract class WorkingDirectoryBlock extends AbstractLaunchConfigurationT /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) */ + @Override public void initializeFrom(ILaunchConfiguration configuration) { setLaunchConfiguration(configuration); try { @@ -377,6 +383,7 @@ public abstract class WorkingDirectoryBlock extends AbstractLaunchConfigurationT /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void performApply(ILaunchConfigurationWorkingCopy configuration) { if(fUseDefaultDirButton.getSelection()) { configuration.setAttribute(workingDirectoryAttribteName, (String)null); @@ -389,6 +396,7 @@ public abstract class WorkingDirectoryBlock extends AbstractLaunchConfigurationT /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() */ + @Override public String getName() { return DebugUIMessages.WorkingDirectoryBlock_Working_Directory_8; } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java index ae21582b3..4ec985181 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 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 @@ -106,9 +106,11 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I * @since 3.3 */ private ILaunchLabelChangedListener fLabelListener = new ILaunchLabelChangedListener() { + @Override public ILaunchGroup getLaunchGroup() { return fLaunchGroup; } + @Override public void labelChanged() { updateTooltip(); } @@ -215,7 +217,8 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I } else { label= ActionMessages.AbstractLaunchHistoryAction_4; } - return MessageFormat.format(ActionMessages.AbstractLaunchHistoryAction_0, new String[] {label, launchName}); + return MessageFormat.format(ActionMessages.AbstractLaunchHistoryAction_0, new Object[] { + label, launchName }); } /** @@ -225,7 +228,7 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I * @return the string for the tool tip */ private String getToolTip() { - String launchName = getLaunchingResourceManager().getLaunchLabel(fLaunchGroup); + String launchName = DebugUIPlugin.getDefault().getLaunchingResourceManager().getLaunchLabel(fLaunchGroup); if(launchName == null) { return DebugUIPlugin.removeAccelerators(internalGetHistory().getLaunchGroup().getLabel()); } @@ -241,16 +244,18 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I label = ActionMessages.AbstractLaunchHistoryAction_4; } if(IInternalDebugCoreConstants.EMPTY_STRING.equals(launchName)) { - return MessageFormat.format(ActionMessages.AbstractLaunchHistoryAction_5, new String[] {label}); + return MessageFormat.format(ActionMessages.AbstractLaunchHistoryAction_5, new Object[] { label }); } else { - return MessageFormat.format(ActionMessages.AbstractLaunchHistoryAction_0, new String[] {label, launchName}); + return MessageFormat.format(ActionMessages.AbstractLaunchHistoryAction_0, new Object[] { + label, launchName }); } } /** * @see ILaunchHistoryChangedListener#launchHistoryChanged() */ + @Override public void launchHistoryChanged() { fRecreateMenu = true; } @@ -258,10 +263,11 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I /** * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() */ + @Override public void dispose() { setMenu(null); getLaunchConfigurationManager().removeLaunchHistoryListener(this); - getLaunchingResourceManager().removeLaunchLabelChangedListener(fLabelListener); + DebugUIPlugin.getDefault().getLaunchingResourceManager().removeLaunchLabelChangedListener(fLabelListener); } /** @@ -277,6 +283,7 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I /** * @see org.eclipse.ui.IWorkbenchWindowPulldownDelegate#getMenu(org.eclipse.swt.widgets.Control) */ + @Override public Menu getMenu(Control parent) { setMenu(new Menu(parent)); fillMenu(fMenu); @@ -287,6 +294,7 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I /* (non-Javadoc) * @see org.eclipse.ui.IWorkbenchWindowPulldownDelegate2#getMenu(org.eclipse.swt.widgets.Menu) */ + @Override public Menu getMenu(Menu parent) { setMenu(new Menu(parent)); fillMenu(fMenu); @@ -301,6 +309,7 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I // Add listener to re-populate the menu each time // it is shown because of dynamic history list fMenu.addMenuListener(new MenuAdapter() { + @Override public void menuShown(MenuEvent e) { if (fRecreateMenu) { Menu m = (Menu)e.widget; @@ -378,6 +387,7 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I /** * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ + @Override public void run(IAction action) { // do nothing - this is just a menu } @@ -386,6 +396,7 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event) * @since 3.6 */ + @Override public void runWithEvent(IAction action, Event event) { if(((event.stateMask & SWT.MOD1) > 0) && (event.type != SWT.KeyDown)) { ILaunchConfiguration configuration = null; @@ -395,7 +406,7 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I } else { configuration = getLaunchConfigurationManager().getFilteredLastLaunch(groupid); } - ArrayList configs = new ArrayList(1); + ArrayList<ILaunchConfiguration> configs = new ArrayList<ILaunchConfiguration>(1); if (configuration != null){ configs.add(configuration); } @@ -418,21 +429,16 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I private ILaunchConfiguration resolveContextConfiguration() { SelectedResourceManager srm = SelectedResourceManager.getDefault(); IStructuredSelection selection = srm.getCurrentSelection(); - List shortcuts = null; + List<LaunchShortcutExtension> shortcuts = null; IResource resource = srm.getSelectedResource(); - shortcuts = getLaunchingResourceManager().getShortcutsForSelection( - selection, - getMode()); + LaunchingResourceManager lrm = DebugUIPlugin.getDefault().getLaunchingResourceManager(); + shortcuts = lrm.getShortcutsForSelection(selection, getMode()); if(resource == null) { - resource = getLaunchingResourceManager().getLaunchableResource(shortcuts, selection); + resource = lrm.getLaunchableResource(shortcuts, selection); } - List configs = getLaunchingResourceManager().getParticipatingLaunchConfigurations( - selection, - resource, - shortcuts, - getMode()); + List<ILaunchConfiguration> configs = lrm.getParticipatingLaunchConfigurations(selection, resource, shortcuts, getMode()); if(configs.size() == 1) { - return (ILaunchConfiguration) configs.get(0); + return configs.get(0); } else if(configs.size() > 1) { // launch most recently launched config ILaunchConfiguration config = getLaunchConfigurationManager().getMRUConfiguration(configs, fLaunchGroup, resource); @@ -455,7 +461,7 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I } return null; } else if(shortcuts.size() == 1) { - LaunchShortcutExtension ext = (LaunchShortcutExtension) shortcuts.get(0); + LaunchShortcutExtension ext = shortcuts.get(0); return createConfigurationFromTypes(ext.getAssociatedConfigurationTypes()); } return getLaunchConfigurationManager().getFilteredLastLaunch(getLaunchGroupIdentifier()); @@ -467,7 +473,7 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I * @return a new {@link ILaunchConfiguration} * @since 3.6 */ - private ILaunchConfiguration createConfigurationFromTypes(Set types) { + private ILaunchConfiguration createConfigurationFromTypes(Set<String> types) { //context launching always takes the first type, so we do that here as well if(types != null && types.size() > 0) { try { @@ -486,6 +492,7 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction) * @since 3.6 */ + @Override public void init(IAction action) { // do nothing by default } @@ -493,6 +500,7 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I /** * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) */ + @Override public void selectionChanged(IAction action, ISelection selection){ if (fAction == null) { initialize(action); @@ -502,9 +510,10 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I /** * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow) */ + @Override public void init(IWorkbenchWindow window) { if (this instanceof AbstractLaunchToolbarAction) { - getLaunchingResourceManager().addLaunchLabelUpdateListener(fLabelListener); + DebugUIPlugin.getDefault().getLaunchingResourceManager().addLaunchLabelUpdateListener(fLabelListener); } } @@ -516,6 +525,7 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I * for clients of the debug platform. Instead, use <code>getHistory()</code>, * <code>getFavorites()</code>, and <code>getLastLaunch()</code>. */ + @Deprecated protected LaunchHistory getLaunchHistory() { return getLaunchConfigurationManager().getLaunchHistory(getLaunchGroupIdentifier()); } @@ -577,15 +587,6 @@ public abstract class AbstractLaunchHistoryAction implements IActionDelegate2, I } /** - * Returns the <code>ContextualLaunchingResourceManager</code> - * - * @return <code>ContextualLaunchingResourceManager</code> - */ - private LaunchingResourceManager getLaunchingResourceManager() { - return DebugUIPlugin.getDefault().getLaunchingResourceManager(); - } - - /** * Returns the identifier of the launch group this action is associated * with. * diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchToolbarAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchToolbarAction.java index 78a5a0508..aed6e70ae 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchToolbarAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchToolbarAction.java @@ -49,6 +49,7 @@ public class AbstractLaunchToolbarAction extends AbstractLaunchHistoryAction { * * @param menu the menu to fill */ + @Override protected void fillMenu(Menu menu) { super.fillMenu(menu); // Separator between history and common actions @@ -74,6 +75,7 @@ public class AbstractLaunchToolbarAction extends AbstractLaunchHistoryAction { * * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ + @Override public void run(IAction action) { //always ignore external tools during context launching if(LaunchingResourceManager.isContextLaunchEnabled(getLaunchGroupIdentifier())) { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java index a8a447d3b..bd3ef6b95 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AddMemoryRenderingActionDelegate.java @@ -81,6 +81,7 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct fRenderingType = renderingType; } + @Override public void runWithEvent(Event event) { if (fActionDelegate != null) { @@ -96,17 +97,21 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct private class AddMemoryRenderingMenuCreator implements IMenuCreator { + @Override public void dispose() { } + @Override public Menu getMenu(Control parent) { return null; } + @Override public Menu getMenu(Menu parent) { Menu menu = new Menu(parent); menu.addMenuListener(new MenuAdapter() { + @Override public void menuShown(MenuEvent e) { Menu m = (Menu)e.widget; MenuItem[] items = m.getItems(); @@ -145,6 +150,7 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct updateAction(fAction, fCurrentSelection); } + @Override public void debugContextChanged(DebugContextEvent event) { contextActivated(event.getContext()); } @@ -202,6 +208,7 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct /* (non-Javadoc) * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) */ + @Override public void init(IViewPart view) { bindPart(view); } @@ -209,6 +216,7 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ + @Override public void run(IAction action) { // do nothing } @@ -216,6 +224,7 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) */ + @Override public void selectionChanged(IAction action, ISelection selection) { fCurrentSelection = selection; @@ -271,6 +280,7 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct /* (non-Javadoc) * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart) */ + @Override public void setActiveEditor(IAction action, IEditorPart targetEditor) { bindPart(targetEditor); @@ -283,6 +293,7 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct /* (non-Javadoc) * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart) */ + @Override public void setActivePart(IAction action, IWorkbenchPart targetPart) { bindPart(targetPart); @@ -295,6 +306,7 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction) */ + @Override public void init(IAction action) { if (action != null) { bindAction(action); @@ -309,6 +321,7 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate2#dispose() */ + @Override public void dispose() { // remove as debug context listener fAction = null; @@ -323,6 +336,7 @@ public class AddMemoryRenderingActionDelegate extends Action implements IViewAct /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event) */ + @Override public void runWithEvent(IAction action, Event event) { // do nothing } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/BreakpointTypesContribution.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/BreakpointTypesContribution.java index b744b40d4..b11185ad2 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/BreakpointTypesContribution.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/BreakpointTypesContribution.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 Wind River Systems and others. + * Copyright (c) 2012, 2013 Wind River Systems 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,11 +7,11 @@ * * Contributors: * Wind River Systems - initial API and implementation + * IBM Corporation - bug fixing *******************************************************************************/ package org.eclipse.debug.ui.actions; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import java.util.Set; @@ -68,15 +68,17 @@ import org.eclipse.ui.services.IServiceLocator; public class BreakpointTypesContribution extends CompoundContributionItem implements IWorkbenchContribution { private class SelectTargetAction extends Action { - private final Set fPossibleIDs; + private final Set<String> fPossibleIDs; private final String fID; - SelectTargetAction(String name, Set possibleIDs, String ID) { + + SelectTargetAction(String name, Set<String> possibleIDs, String ID) { super(name, AS_RADIO_BUTTON); fID = ID; fPossibleIDs = possibleIDs; } - public void run() { + @Override + public void run() { if (isChecked()) { // Note: setPreferredTarget is not declared on the // IToggleBreakpontsTargetManager interface. @@ -89,12 +91,14 @@ public class BreakpointTypesContribution extends CompoundContributionItem implem private static IContributionItem[] NO_BREAKPOINT_TYPES_CONTRIBUTION_ITEMS = new IContributionItem[] { new ContributionItem() { + @Override public void fill(Menu menu, int index) { MenuItem item = new MenuItem(menu, SWT.NONE); item.setEnabled(false); item.setText(Messages.BreakpointTypesContribution_0); } + @Override public boolean isEnabled() { return false; } @@ -104,7 +108,8 @@ public class BreakpointTypesContribution extends CompoundContributionItem implem /* (non-Javadoc) * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems() */ - protected IContributionItem[] getContributionItems() { + @Override + protected IContributionItem[] getContributionItems() { IWorkbenchPart part = null; ISelection selection = null; @@ -125,12 +130,11 @@ public class BreakpointTypesContribution extends CompoundContributionItem implem // Get breakpoint toggle target IDs. IToggleBreakpointsTargetManager manager = DebugUITools.getToggleBreakpointsTargetManager(); - Set enabledIDs = manager.getEnabledToggleBreakpointsTargetIDs(part, selection); + Set<String> enabledIDs = manager.getEnabledToggleBreakpointsTargetIDs(part, selection); String preferredId = manager.getPreferredToggleBreakpointsTargetID(part, selection); - List actions = new ArrayList(enabledIDs.size()); - for (Iterator i = enabledIDs.iterator(); i.hasNext();) { - String id = (String) i.next(); + List<Action> actions = new ArrayList<Action>(enabledIDs.size()); + for (String id : enabledIDs) { Action action = new SelectTargetAction(manager.getToggleBreakpointsTargetName(id), enabledIDs, id); if (id.equals(preferredId)) { action.setChecked(true); @@ -144,7 +148,7 @@ public class BreakpointTypesContribution extends CompoundContributionItem implem IContributionItem[] items = new IContributionItem[enabledIDs.size()]; for (int i = 0; i < actions.size(); i++) { - items[i] = new ActionContributionItem((Action) actions.get(i)); + items[i] = new ActionContributionItem(actions.get(i)); } return items; } @@ -152,7 +156,8 @@ public class BreakpointTypesContribution extends CompoundContributionItem implem /* (non-Javadoc) * @see org.eclipse.ui.menus.IWorkbenchContribution#initialize(org.eclipse.ui.services.IServiceLocator) */ - public void initialize(IServiceLocator serviceLocator) { + @Override + public void initialize(IServiceLocator serviceLocator) { fServiceLocator = serviceLocator; } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java index 429248693..61f658dba 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.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 @@ -15,7 +15,6 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.Set; import org.eclipse.core.expressions.Expression; import org.eclipse.core.expressions.IEvaluationContext; @@ -71,7 +70,7 @@ public abstract class ContextualLaunchAction implements IObjectActionDelegate, I // default launch group for this mode (null category) private ILaunchGroup fGroup = null; // map of launch groups by (non-null) categories, for this mode - private Map fGroupsByCategory = null; + private Map<String, ILaunchGroup> fGroupsByCategory = null; // whether to re-fill the menu (reset on selection change) private boolean fFillMenu = true; @@ -83,7 +82,7 @@ public abstract class ContextualLaunchAction implements IObjectActionDelegate, I public ContextualLaunchAction(String mode) { fMode = mode; ILaunchGroup[] groups = DebugUITools.getLaunchGroups(); - fGroupsByCategory = new HashMap(3); + fGroupsByCategory = new HashMap<String, ILaunchGroup>(3); for (int i = 0; i < groups.length; i++) { ILaunchGroup group = groups[i]; if (group.getMode().equals(mode)) { @@ -99,18 +98,21 @@ public abstract class ContextualLaunchAction implements IObjectActionDelegate, I /* * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart) */ + @Override public void setActivePart(IAction action, IWorkbenchPart targetPart) { // We don't have a need for the active part. } /* (non-Javadoc) * @see org.eclipse.jface.action.IMenuCreator#dispose() */ + @Override public void dispose() { // nothing to do } /* (non-Javadoc) * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Control) */ + @Override public Menu getMenu(Control parent) { // never called return null; @@ -118,6 +120,7 @@ public abstract class ContextualLaunchAction implements IObjectActionDelegate, I /* (non-Javadoc) * @see org.eclipse.jface.action.IMenuCreator#getMenu(org.eclipse.swt.widgets.Menu) */ + @Override public Menu getMenu(Menu parent) { //Create the new menu. The menu will get filled when it is about to be shown. see fillMenu(Menu). Menu menu = new Menu(parent); @@ -127,6 +130,7 @@ public abstract class ContextualLaunchAction implements IObjectActionDelegate, I * doesn't dispose pull-down ActionContribution items for each popup menu. */ menu.addMenuListener(new MenuAdapter() { + @Override public void menuShown(MenuEvent e) { if (fFillMenu) { Menu m = (Menu)e.widget; @@ -145,6 +149,7 @@ public abstract class ContextualLaunchAction implements IObjectActionDelegate, I /* * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ + @Override public void run(IAction action) { // Never called because we become a menu. } @@ -152,6 +157,7 @@ public abstract class ContextualLaunchAction implements IObjectActionDelegate, I /* * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) */ + @Override public void selectionChanged(IAction action, ISelection selection) { // if the selection is an IResource, save it and enable our action if (selection instanceof IStructuredSelection) { @@ -195,16 +201,7 @@ public abstract class ContextualLaunchAction implements IObjectActionDelegate, I } catch (CoreException ce) {} } - - List allShortCuts = getLaunchConfigurationManager().getLaunchShortcuts(); - Iterator iter = allShortCuts.iterator(); - List filteredShortCuts = new ArrayList(10); - - //create a context - List selection = ss.toList(); - //in 3.4 we are correctly passing the IEditorPart and ISelection, so we have to perform - //some sneekyness to make sure the IEditorInput is passed to the eval expressions - //for backwards compatibility + List<Object> selection = ss.toList(); Object o = ss.getFirstElement(); if(o instanceof IEditorPart) { selection.set(0, ((IEditorPart)o).getEditorInput()); @@ -212,8 +209,11 @@ public abstract class ContextualLaunchAction implements IObjectActionDelegate, I IEvaluationContext context = DebugUIPlugin.createEvaluationContext(selection); context.setAllowPluginActivation(true); context.addVariable("selection", selection); //$NON-NLS-1$ + List<LaunchShortcutExtension> allShortCuts = getLaunchConfigurationManager().getLaunchShortcuts(); + List<LaunchShortcutExtension> filteredShortCuts = new ArrayList<LaunchShortcutExtension>(); + Iterator<LaunchShortcutExtension> iter = allShortCuts.iterator(); while (iter.hasNext()) { - LaunchShortcutExtension ext = (LaunchShortcutExtension) iter.next(); + LaunchShortcutExtension ext = iter.next(); try { if (!WorkbenchActivityHelper.filterItem(ext) && isApplicable(ext, context)) { filteredShortCuts.add(ext); @@ -225,19 +225,14 @@ public abstract class ContextualLaunchAction implements IObjectActionDelegate, I iter.remove(); } } - iter = filteredShortCuts.iterator(); //we need a separator iff the shared config entry has been added and there are following shortcuts if(menu.getItemCount() > 0 && filteredShortCuts.size() > 0) { new MenuItem(menu, SWT.SEPARATOR); } - List categories = new ArrayList(); - while (iter.hasNext()) { - LaunchShortcutExtension ext = (LaunchShortcutExtension) iter.next(); - Set modes = ext.getModes(); // supported launch modes - Iterator modeIter = modes.iterator(); - while (modeIter.hasNext()) { - String mode = (String) modeIter.next(); + List<String> categories = new ArrayList<String>(); + for(LaunchShortcutExtension ext : filteredShortCuts) { + for(String mode : ext.getModes()) { if (mode.equals(fMode)) { String category = ext.getCategory(); // NOTE: category can be null @@ -259,13 +254,10 @@ public abstract class ContextualLaunchAction implements IObjectActionDelegate, I item.fill(menu, -1); } else { boolean addedSep = false; - iter = categories.iterator(); - while (iter.hasNext()) { - // NOTE: category can be null - String category = (String) iter.next(); + for (String category : categories) { ILaunchGroup group = fGroup; if (category != null) { - group = (ILaunchGroup) fGroupsByCategory.get(category); + group = fGroupsByCategory.get(category); } if (group != null) { if (accelerator > 1 && !addedSep) { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugAction.java index 3423222e1..163b2cbd8 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugAction.java @@ -33,6 +33,7 @@ public final class DebugAction extends ExecutionAction { /** * @see ExecutionAction#getMode() */ + @Override protected String getMode() { return ILaunchManager.DEBUG_MODE; } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandAction.java index e69e1829d..33267b8b1 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2011 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 @@ -80,7 +80,8 @@ public abstract class DebugCommandAction extends Action implements IDebugContext private IAction fAction; private IEnabledTarget fEnabledTarget = new IEnabledTarget() { - public void setEnabled(boolean enabled) { + @Override + public void setEnabled(boolean enabled) { DebugCommandAction.this.setEnabled(enabled); } }; @@ -91,8 +92,9 @@ public abstract class DebugCommandAction extends Action implements IDebugContext public DebugCommandAction() { super(); String helpContextId = getHelpContextId(); - if (helpContextId != null) - PlatformUI.getWorkbench().getHelpSystem().setHelp(this, helpContextId); + if (helpContextId != null) { + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, helpContextId); + } setEnabled(false); } @@ -118,7 +120,8 @@ public abstract class DebugCommandAction extends Action implements IDebugContext return fUpdateService.executeCommand( getCommandType(), targets, new ICommandParticipant() { - public void requestDone(org.eclipse.debug.core.IRequest request) { + @Override + public void requestDone(org.eclipse.debug.core.IRequest request) { DebugCommandAction.this.postExecute(request, targets); } }); @@ -145,19 +148,21 @@ public abstract class DebugCommandAction extends Action implements IDebugContext * * @see org.eclipse.debug.core.commands.IDebugCommandHandler */ - abstract protected Class getCommandType(); + abstract protected Class<?> getCommandType(); /** * @see org.eclipse.debug.ui.contexts.IDebugContextListener#debugContextChanged(org.eclipse.debug.ui.contexts.DebugContextEvent) */ - public void debugContextChanged(DebugContextEvent event) { + @Override + public void debugContextChanged(DebugContextEvent event) { fUpdateService.postUpdateCommand(getCommandType(), fEnabledTarget); } /** * @see org.eclipse.jface.action.Action#setEnabled(boolean) */ - public void setEnabled(boolean enabled) { + @Override + public void setEnabled(boolean enabled) { synchronized (this) { if (!fInitialized) { fInitialized = true; @@ -240,7 +245,8 @@ public abstract class DebugCommandAction extends Action implements IDebugContext * (non-Javadoc) * @see org.eclipse.jface.action.Action#run() */ - public void run() { + @Override + public void run() { synchronized (this) { if (!fInitialized) { try { @@ -263,7 +269,8 @@ public abstract class DebugCommandAction extends Action implements IDebugContext * (non-Javadoc) * @see org.eclipse.jface.action.Action#runWithEvent(org.eclipse.swt.widgets.Event) */ - public void runWithEvent(Event event) { + @Override + public void runWithEvent(Event event) { run(); } @@ -302,37 +309,43 @@ public abstract class DebugCommandAction extends Action implements IDebugContext * (non-Javadoc) * @see org.eclipse.jface.action.Action#getId() */ - public abstract String getId(); + @Override + public abstract String getId(); /* * (non-Javadoc) * @see org.eclipse.jface.action.Action#getText() */ - public abstract String getText(); + @Override + public abstract String getText(); /* * (non-Javadoc) * @see org.eclipse.jface.action.Action#getToolTipText() */ - public abstract String getToolTipText(); + @Override + public abstract String getToolTipText(); /* * (non-Javadoc) * @see org.eclipse.jface.action.Action#getDisabledImageDescriptor() */ - public abstract ImageDescriptor getDisabledImageDescriptor(); + @Override + public abstract ImageDescriptor getDisabledImageDescriptor(); /* * (non-Javadoc) * @see org.eclipse.jface.action.Action#getHoverImageDescriptor() */ - public abstract ImageDescriptor getHoverImageDescriptor(); + @Override + public abstract ImageDescriptor getHoverImageDescriptor(); /* * (non-Javadoc) * @see org.eclipse.jface.action.Action#getImageDescriptor() */ - public abstract ImageDescriptor getImageDescriptor(); + @Override + public abstract ImageDescriptor getImageDescriptor(); /** * Returns the workbench proxy associated with this action or <code>null</code> diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandHandler.java index c209730f9..9cc8c4c25 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandHandler.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/DebugCommandHandler.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2011 IBM Corporation and others. + * Copyright (c) 2006, 2013 Wind River Systems 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,11 +7,11 @@ * * Contributors: * Wind River Systems - initial API and implementation + * IBM Corporation - bug fixing *******************************************************************************/ package org.eclipse.debug.ui.actions; -import java.util.Iterator; import java.util.Map; import java.util.WeakHashMap; @@ -77,7 +77,8 @@ public abstract class DebugCommandHandler extends AbstractHandler { getContextService(fWindow).addDebugContextListener(this); } - public void setEnabled(boolean enabled) { + @Override + public void setEnabled(boolean enabled) { boolean oldEnabled = fEnabled; fEnabled = enabled; if (fEnabled != oldEnabled && fCurrentEnabledTarget == this) { @@ -85,7 +86,8 @@ public abstract class DebugCommandHandler extends AbstractHandler { } } - public void debugContextChanged(DebugContextEvent event) { + @Override + public void debugContextChanged(DebugContextEvent event) { DebugCommandService.getService(fWindow).postUpdateCommand(getCommandType(), this); } @@ -108,21 +110,25 @@ public abstract class DebugCommandHandler extends AbstractHandler { */ private IWindowListener fWindowListener = new IWindowListener() { - public void windowOpened(IWorkbenchWindow w) { + @Override + public void windowOpened(IWorkbenchWindow w) { } - public void windowDeactivated(IWorkbenchWindow w) { + @Override + public void windowDeactivated(IWorkbenchWindow w) { } - public void windowClosed(IWorkbenchWindow w) { - EnabledTarget enabledTarget = (EnabledTarget)fEnabledTargetsMap.get(w); + @Override + public void windowClosed(IWorkbenchWindow w) { + EnabledTarget enabledTarget = fEnabledTargetsMap.get(w); if (enabledTarget != null) { enabledTarget.dispose(); } } - public void windowActivated(IWorkbenchWindow w) { - fCurrentEnabledTarget = (EnabledTarget)fEnabledTargetsMap.get(w); + @Override + public void windowActivated(IWorkbenchWindow w) { + fCurrentEnabledTarget = fEnabledTargetsMap.get(w); fireHandlerChanged(new HandlerEvent(DebugCommandHandler.this, true, false)); } }; @@ -130,7 +136,7 @@ public abstract class DebugCommandHandler extends AbstractHandler { /** * Map of enabled targets keyed by workbench window. */ - private Map fEnabledTargetsMap = new WeakHashMap(); + private Map<IWorkbenchWindow, EnabledTarget> fEnabledTargetsMap = new WeakHashMap<IWorkbenchWindow, EnabledTarget>(); /** * The current enabled target, based on the active @@ -149,7 +155,8 @@ public abstract class DebugCommandHandler extends AbstractHandler { /* (non-Javadoc) * @see org.eclipse.core.commands.AbstractHandler#setEnabled(java.lang.Object) */ - public void setEnabled(Object evaluationContext) { + @Override + public void setEnabled(Object evaluationContext) { // This method is called with the current evaluation context // just prior to the isEnabled() being called. Check the active // window and update the current enabled target based on it @@ -169,7 +176,8 @@ public abstract class DebugCommandHandler extends AbstractHandler { /* (non-Javadoc) * @see org.eclipse.core.commands.AbstractHandler#isEnabled() */ - public boolean isEnabled() { + @Override + public boolean isEnabled() { if (fCurrentEnabledTarget == null) { return false; } @@ -177,7 +185,7 @@ public abstract class DebugCommandHandler extends AbstractHandler { } private EnabledTarget getEnabledTarget(IWorkbenchWindow window) { - EnabledTarget target = (EnabledTarget)fEnabledTargetsMap.get(window); + EnabledTarget target = fEnabledTargetsMap.get(window); if (target == null) { target = new EnabledTarget(window); fEnabledTargetsMap.put(window, target); @@ -188,7 +196,8 @@ public abstract class DebugCommandHandler extends AbstractHandler { /* (non-Javadoc) * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) */ - public Object execute(ExecutionEvent event) throws ExecutionException { + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); if (window == null) { throw new ExecutionException("No active workbench window."); //$NON-NLS-1$ @@ -222,7 +231,8 @@ public abstract class DebugCommandHandler extends AbstractHandler { return service.executeCommand( getCommandType(), targets, new ICommandParticipant() { - public void requestDone(org.eclipse.debug.core.IRequest request) { + @Override + public void requestDone(org.eclipse.debug.core.IRequest request) { DebugCommandHandler.this.postExecute(request, targets); } }); @@ -249,7 +259,7 @@ public abstract class DebugCommandHandler extends AbstractHandler { * * @see org.eclipse.debug.core.commands.IDebugCommandHandler */ - abstract protected Class getCommandType(); + abstract protected Class<?> getCommandType(); /** @@ -266,10 +276,10 @@ public abstract class DebugCommandHandler extends AbstractHandler { /** * Clean up when removing */ - public void dispose() { - PlatformUI.getWorkbench().removeWindowListener(fWindowListener); - for (Iterator itr = fEnabledTargetsMap.values().iterator(); itr.hasNext();) { - EnabledTarget target = (EnabledTarget)itr.next(); + @Override + public void dispose() { + PlatformUI.getWorkbench().removeWindowListener(fWindowListener); + for(EnabledTarget target : fEnabledTargetsMap.values()) { if (!target.isDisposed()) { target.dispose(); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ExportBreakpointsOperation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ExportBreakpointsOperation.java index 3cbd7d829..46a64f53a 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ExportBreakpointsOperation.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ExportBreakpointsOperation.java @@ -17,6 +17,7 @@ import java.io.OutputStreamWriter; import java.io.StringWriter; import java.io.Writer; import java.lang.reflect.InvocationTargetException; +import java.util.Map.Entry; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; @@ -83,6 +84,7 @@ public class ExportBreakpointsOperation implements IRunnableWithProgress { /* (non-Javadoc) * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor) */ + @Override public void run(IProgressMonitor monitor) throws InvocationTargetException { SubMonitor localmonitor = SubMonitor.convert(monitor, ImportExportMessages.ExportOperation_0, fBreakpoints.length); XMLMemento memento = XMLMemento.createWriteRoot(IImportExportConstants.IE_NODE_BREAKPOINTS); @@ -114,9 +116,9 @@ public class ExportBreakpointsOperation implements IRunnableWithProgress { root.putString(IImportExportConstants.CHARSTART, (val != null) ? val.toString() : null); String value = null; boolean wsattrib = false; - for(java.util.Iterator iter = marker.getAttributes().keySet().iterator(); iter.hasNext();) { - String iterval = iter.next().toString(); - value = marker.getAttribute(iterval).toString(); + for (Entry<String, Object> entry : marker.getAttributes().entrySet()) { + String iterval = entry.getKey(); + value = entry.getValue().toString(); if(!iterval.equals(IMarker.LINE_NUMBER)) { child = root.createChild(IImportExportConstants.IE_NODE_ATTRIB); if(iterval.equals(IInternalDebugUIConstants.WORKING_SET_NAME)) { @@ -145,8 +147,7 @@ public class ExportBreakpointsOperation implements IRunnableWithProgress { } catch (CoreException e) { throw new InvocationTargetException(e); } catch (IOException e) { - throw new InvocationTargetException(e, - MessageFormat.format("There was a problem writing file: {0}", new String[] {fFileName})); //$NON-NLS-1$ + throw new InvocationTargetException(e, MessageFormat.format("There was a problem writing file: {0}", new Object[] { fFileName })); //$NON-NLS-1$ } finally { localmonitor.done(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetFactory.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetFactory.java index a12ca764e..61025767b 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetFactory.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 Wind River Systems 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 @@ -73,7 +73,7 @@ public interface IToggleBreakpointsTargetFactory { * @return Set of <code>String</code> IDs for possible toggle breakpoint * targets, possibly empty */ - public Set getToggleTargets(IWorkbenchPart part, ISelection selection); + public Set<String> getToggleTargets(IWorkbenchPart part, ISelection selection); /** * Returns the identifier of the default toggle breakpoints target to use diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetManager.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetManager.java index fb8e69af6..f768c2880 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetManager.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/IToggleBreakpointsTargetManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 Wind River Systems and others. + * Copyright (c) 2012, 2013 Wind River Systems 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: * Wind River Systems - initial API and implementation + * IBM Corporation - bug fixing *******************************************************************************/ package org.eclipse.debug.ui.actions; @@ -47,7 +48,7 @@ public interface IToggleBreakpointsTargetManager { * @param selection active selection in part * @return Set of toggle target IDs or an empty set */ - public Set getEnabledToggleBreakpointsTargetIDs(IWorkbenchPart part, ISelection selection); + public Set<String> getEnabledToggleBreakpointsTargetIDs(IWorkbenchPart part, ISelection selection); /** * Returns the ID of the calculated preferred toggle breakpoints target for the diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ImportBreakpointsOperation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ImportBreakpointsOperation.java index 5e94b9d18..06b25b443 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ImportBreakpointsOperation.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ImportBreakpointsOperation.java @@ -23,30 +23,18 @@ import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; - -import com.ibm.icu.text.MessageFormat; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubMonitor; +import java.util.Map.Entry; import org.eclipse.core.resources.IMarker; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; - -import org.eclipse.jface.operation.IRunnableWithProgress; - -import org.eclipse.ui.IMemento; -import org.eclipse.ui.IWorkingSet; -import org.eclipse.ui.IWorkingSetManager; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.XMLMemento; - +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.SubMonitor; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.IBreakpointImportParticipant; @@ -54,8 +42,15 @@ import org.eclipse.debug.internal.core.BreakpointManager; import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; import org.eclipse.debug.internal.ui.importexport.breakpoints.IImportExportConstants; import org.eclipse.debug.internal.ui.importexport.breakpoints.ImportExportMessages; - import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.ui.IMemento; +import org.eclipse.ui.IWorkingSet; +import org.eclipse.ui.IWorkingSetManager; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.XMLMemento; + +import com.ibm.icu.text.MessageFormat; /** * Imports breakpoints from a file or string buffer into the workspace. @@ -73,7 +68,7 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress { private boolean fCreateWorkingSets = false; - private ArrayList fAdded = new ArrayList(); + private ArrayList<IBreakpoint> fAdded = new ArrayList<IBreakpoint>(); private String fCurrentWorkingSetProperty = null; @@ -162,6 +157,7 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress { /* (non-Javadoc) * @see org.eclipse.core.resources.IWorkspaceRunnable#run(org.eclipse.core.runtime.IProgressMonitor) */ + @Override public void run(final IProgressMonitor monitor) throws InvocationTargetException { SubMonitor localmonitor = SubMonitor.convert(monitor, ImportExportMessages.ImportOperation_0, 1); Reader reader = null; @@ -175,7 +171,7 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress { IMemento[] nodes = memento.getChildren(IImportExportConstants.IE_NODE_BREAKPOINT); IWorkspaceRoot workspace = ResourcesPlugin.getWorkspace().getRoot(); localmonitor.setWorkRemaining(nodes.length); - Map attributes = null; + Map<String, Object> attributes = null; IBreakpointImportParticipant[] participants = null; for(int i = 0; i < nodes.length; i++) { if(localmonitor.isCanceled()) { @@ -218,20 +214,20 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress { localmonitor.worked(1); } if(fAdded.size() > 0 && fImportBreakpoints) { - fManager.addBreakpoints((IBreakpoint[])fAdded.toArray(new IBreakpoint[fAdded.size()])); + fManager.addBreakpoints(fAdded.toArray(new IBreakpoint[fAdded.size()])); } } catch(FileNotFoundException e) { throw new InvocationTargetException(e, - MessageFormat.format("Breakpoint import file not found: {0}", new String[]{fFileName})); //$NON-NLS-1$ + MessageFormat.format("Breakpoint import file not found: {0}", new Object[] { fFileName })); //$NON-NLS-1$ } catch (UnsupportedEncodingException e) { throw new InvocationTargetException(e, - MessageFormat.format("The import file was written in non-UTF-8 encoding.", new String[]{fFileName})); //$NON-NLS-1$ + MessageFormat.format("The import file was written in non-UTF-8 encoding.", new Object[] { fFileName })); //$NON-NLS-1$ } catch(CoreException ce) { throw new InvocationTargetException(ce, - MessageFormat.format("There was a problem importing breakpoints from: {0}", new String[] {fFileName})); //$NON-NLS-1$ + MessageFormat.format("There was a problem importing breakpoints from: {0}", new Object[] { fFileName })); //$NON-NLS-1$ } finally { localmonitor.done(); @@ -253,7 +249,7 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress { * @return the marker for an existing breakpoint or <code>null</code> if one could not be located * @since 3.5 */ - protected IMarker findExistingMarker(Map attributes, IBreakpointImportParticipant[] participants) { + protected IMarker findExistingMarker(Map<String, Object> attributes, IBreakpointImportParticipant[] participants) { IBreakpoint[] bps = fManager.getBreakpoints(); for(int i = 0; i < bps.length; i++) { for(int j = 0; j < participants.length; j++) { @@ -280,8 +276,8 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress { * @return a new map of all of the breakpoint attributes from the given memento. * @since 3.5 */ - protected Map collectBreakpointProperties(IMemento memento) { - HashMap map = new HashMap(); + protected Map<String, Object> collectBreakpointProperties(IMemento memento) { + HashMap<String, Object> map = new HashMap<String, Object>(); //collect attributes from the 'breakpoint' node map.put(IImportExportConstants.IE_BP_ENABLED, memento.getBoolean(IImportExportConstants.IE_BP_ENABLED)); @@ -310,7 +306,7 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress { * @param memento the memento to read a name / value attribute from * @param map the map to add the read attribute to */ - private void readAttribute(IMemento memento, Map map) { + private void readAttribute(IMemento memento, Map<String, Object> map) { String name = memento.getString(IImportExportConstants.IE_NODE_NAME), value = memento.getString(IImportExportConstants.IE_NODE_VALUE); if (value != null && name != null) { @@ -339,14 +335,12 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress { * @param participants the list of participants used to verify the restored breakpoint * @since 3.5 */ - protected void restoreBreakpoint(IMarker marker, final Map attributes, IBreakpointImportParticipant[] participants) { - String key = null; - for(Iterator iter = attributes.keySet().iterator(); iter.hasNext();) { - key = (String) iter.next(); + protected void restoreBreakpoint(IMarker marker, final Map<String, Object> attributes, IBreakpointImportParticipant[] participants) { + for (Entry<String, Object> entry : attributes.entrySet()) { try { - marker.setAttribute(key, attributes.get(key)); + marker.setAttribute(entry.getKey(), entry.getValue()); + } catch (CoreException ce) { } - catch(CoreException ce) {} } IBreakpoint breakpoint = null; try { @@ -386,14 +380,13 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress { */ private void updateWorkingSets(String[] wsnames, IBreakpoint breakpoint) { IWorkingSetManager mgr = PlatformUI.getWorkbench().getWorkingSetManager(); - IWorkingSet set = null; - ArrayList sets = new ArrayList(); + ArrayList<IWorkingSet> sets = new ArrayList<IWorkingSet>(); collectContainingWorkingsets(breakpoint, sets); for (int i = 0; i < wsnames.length; i++) { if("".equals(wsnames[i])) { //$NON-NLS-1$ continue; } - set = mgr.getWorkingSet(wsnames[i]); + IWorkingSet set = mgr.getWorkingSet(wsnames[i]); if(set == null) { //create working set set = mgr.createWorkingSet(wsnames[i], new IAdaptable[] {}); @@ -409,12 +402,11 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress { } sets.remove(set); } - ArrayList items = null; - for(Iterator iter = sets.iterator(); iter.hasNext();) { - set = (IWorkingSet) iter.next(); - items = new ArrayList(Arrays.asList(set.getElements())); + ArrayList<IAdaptable> items = null; + for (IWorkingSet set : sets) { + items = new ArrayList<IAdaptable>(Arrays.asList(set.getElements())); if(items.remove(breakpoint)) { - set.setElements((IAdaptable[]) items.toArray(new IAdaptable[items.size()])); + set.setElements(items.toArray(new IAdaptable[items.size()])); } } } @@ -427,7 +419,7 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress { * @param collector the list to collect containing working sets in * @since 3.5 */ - private void collectContainingWorkingsets(IBreakpoint breakpoint, List collector) { + private void collectContainingWorkingsets(IBreakpoint breakpoint, List<IWorkingSet> collector) { IWorkingSetManager mgr = PlatformUI.getWorkbench().getWorkingSetManager(); IWorkingSet[] sets = mgr.getWorkingSets(); for (int i = 0; i < sets.length; i++) { @@ -462,6 +454,6 @@ public class ImportBreakpointsOperation implements IRunnableWithProgress { * @since 3.5 */ public IBreakpoint[] getImportedBreakpoints() { - return (IBreakpoint[])fAdded.toArray(new IBreakpoint[fAdded.size()]); + return fAdded.toArray(new IBreakpoint[fAdded.size()]); } } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAction.java index 220f6addf..ccbfff59f 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 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,7 +12,6 @@ package org.eclipse.debug.ui.actions; import java.util.ArrayList; -import java.util.Iterator; import java.util.Set; import org.eclipse.core.runtime.CoreException; @@ -21,6 +20,8 @@ import org.eclipse.debug.core.ILaunchConfigurationType; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.IDebugHelpContextIds; import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; +import org.eclipse.debug.internal.ui.actions.ActionMessages; +import org.eclipse.debug.internal.ui.launchConfigurations.LaunchHistory; import org.eclipse.debug.ui.DebugUITools; import org.eclipse.debug.ui.ILaunchGroup; import org.eclipse.jface.action.Action; @@ -31,8 +32,6 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Event; import org.eclipse.ui.PlatformUI; -import org.eclipse.debug.internal.ui.actions.ActionMessages; -import org.eclipse.debug.internal.ui.launchConfigurations.LaunchHistory; import com.ibm.icu.text.MessageFormat; @@ -76,6 +75,7 @@ public class LaunchAction extends Action { /** * @see org.eclipse.jface.action.IAction#run() */ + @Override public void run() { DebugUITools.launch(fConfiguration, fMode); } @@ -86,6 +86,7 @@ public class LaunchAction extends Action { * * @see org.eclipse.jface.action.IAction#runWithEvent(org.eclipse.swt.widgets.Event) */ + @Override public void runWithEvent(Event event) { if ((event.stateMask & SWT.MOD1) > 0 && (event.stateMask & SWT.MOD2) > 0){ ILaunchGroup[] groups = getAllGroupsForConfiguration(fConfiguration); @@ -95,7 +96,7 @@ public class LaunchAction extends Action { if(store.getBoolean(IInternalDebugUIConstants.PREF_REMOVE_FROM_LAUNCH_HISTORY)) { MessageDialogWithToggle mdwt = MessageDialogWithToggle.openYesNoQuestion(DebugUIPlugin.getShell(), ActionMessages.LaunchAction_0, - MessageFormat.format(ActionMessages.LaunchAction_1, new String[] {fConfiguration.getName()}), + MessageFormat.format(ActionMessages.LaunchAction_1, new Object[] { fConfiguration.getName() }), ActionMessages.LaunchAction_2, false, null, @@ -140,7 +141,7 @@ public class LaunchAction extends Action { if(history != null) { history.removeFromHistory(fConfiguration); } else { - DebugUIPlugin.logErrorMessage(MessageFormat.format("Unable to remove configuration [{0}] from launch history. The launch history for mode [{1}] does not exist.", new String[] {config.getName(), groups[i].getMode()})); //$NON-NLS-1$ + DebugUIPlugin.logErrorMessage(MessageFormat.format("Unable to remove configuration [{0}] from launch history. The launch history for mode [{1}] does not exist.", new Object[] { config.getName(), groups[i].getMode() })); //$NON-NLS-1$ } } } @@ -153,15 +154,13 @@ public class LaunchAction extends Action { * @since 3.4 */ private ILaunchGroup[] getAllGroupsForConfiguration(ILaunchConfiguration config) { - ArrayList list = new ArrayList(); + ArrayList<ILaunchGroup> list = new ArrayList<ILaunchGroup>(); try { ILaunchConfigurationType type = config.getType(); - Set modes = type.getSupportedModeCombinations(); + Set<Set<String>> modes = type.getSupportedModeCombinations(); String mode = null; ILaunchGroup group = null; - Set modesets = null; - for(Iterator iter = modes.iterator(); iter.hasNext();) { - modesets = (Set) iter.next(); + for (Set<String> modesets : modes) { if(modesets.size() == 1) { mode = (String) modesets.toArray()[0]; group = DebugUITools.getLaunchGroup(config, mode); @@ -172,7 +171,6 @@ public class LaunchAction extends Action { } } catch(CoreException ce) {} - return (ILaunchGroup[]) list.toArray(new ILaunchGroup[list.size()]); + return list.toArray(new ILaunchGroup[list.size()]); } - } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAsAction.java index 12a9f09bf..5f563daea 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAsAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchAsAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 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 @@ -11,7 +11,6 @@ package org.eclipse.debug.ui.actions; -import java.util.Iterator; import java.util.List; import org.eclipse.debug.core.DebugPlugin; @@ -50,6 +49,7 @@ import org.eclipse.ui.activities.WorkbenchActivityHelper; * menus. Use <code>LaunchShorcutsAction</code> instead. * @noextend This class is not intended to be subclassed by clients. */ +@Deprecated public class LaunchAsAction extends Action implements IMenuCreator, IWorkbenchWindowPulldownDelegate2 { /** @@ -93,6 +93,7 @@ public class LaunchAsAction extends Action implements IMenuCreator, IWorkbenchWi /** * @see IAction#run() */ + @Override public void run() { //do nothing, this action just creates a cascading menu. } @@ -114,6 +115,7 @@ public class LaunchAsAction extends Action implements IMenuCreator, IWorkbenchWi /** * @see IMenuCreator#dispose() */ + @Override public void dispose() { if (getCreatedMenu() != null) { getCreatedMenu().dispose(); @@ -123,6 +125,7 @@ public class LaunchAsAction extends Action implements IMenuCreator, IWorkbenchWi /** * @see IMenuCreator#getMenu(Control) */ + @Override public Menu getMenu(Control parent) { return null; } @@ -130,6 +133,7 @@ public class LaunchAsAction extends Action implements IMenuCreator, IWorkbenchWi /** * @see IMenuCreator#getMenu(Menu) */ + @Override public Menu getMenu(Menu parent) { if (getCreatedMenu() != null) { getCreatedMenu().dispose(); @@ -142,7 +146,7 @@ public class LaunchAsAction extends Action implements IMenuCreator, IWorkbenchWi private void fillMenu() { //Retrieve the current perspective and the registered shortcuts - List shortcuts = null; + List<LaunchShortcutExtension> shortcuts = null; String activePerspID = getActivePerspectiveID(); if (activePerspID != null) { shortcuts = getLaunchConfigurationManager().getLaunchShortcuts(activePerspID, getCategory()); @@ -155,11 +159,8 @@ public class LaunchAsAction extends Action implements IMenuCreator, IWorkbenchWi } int menuCount = 1; - - Iterator iter = shortcuts.iterator(); String mode = getMode(); - while (iter.hasNext()) { - LaunchShortcutExtension ext = (LaunchShortcutExtension) iter.next(); + for (LaunchShortcutExtension ext : shortcuts) { if (ext.getModes().contains(mode) && !WorkbenchActivityHelper.filterItem(ext)) { populateMenu(mode, ext, getCreatedMenu(), menuCount); menuCount++; @@ -174,6 +175,7 @@ public class LaunchAsAction extends Action implements IMenuCreator, IWorkbenchWi // Add listener to re-populate the menu each time // it is shown to reflect changes in selection or active perspective fCreatedMenu.addMenuListener(new MenuAdapter() { + @Override public void menuShown(MenuEvent e) { Menu m = (Menu)e.widget; MenuItem[] items = m.getItems(); @@ -262,6 +264,7 @@ public class LaunchAsAction extends Action implements IMenuCreator, IWorkbenchWi /** * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow) */ + @Override public void init(IWorkbenchWindow window) { // if (window instanceof WorkbenchWindow) { // fKeyBindingService= ((WorkbenchWindow)window).getKeyBindingService(); @@ -271,6 +274,7 @@ public class LaunchAsAction extends Action implements IMenuCreator, IWorkbenchWi /** * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ + @Override public void run(IAction action) { // do nothing - this is just a menu } @@ -278,6 +282,7 @@ public class LaunchAsAction extends Action implements IMenuCreator, IWorkbenchWi /** * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) */ + @Override public void selectionChanged(IAction action, ISelection selection) { if (fAction == null) { initialize(action); @@ -302,10 +307,8 @@ public class LaunchAsAction extends Action implements IMenuCreator, IWorkbenchWi * the mode of this action */ private boolean existsShortcutsForMode() { - List shortcuts = getLaunchConfigurationManager().getLaunchShortcuts(getCategory()); - Iterator iter = shortcuts.iterator(); - while (iter.hasNext()) { - LaunchShortcutExtension ext = (LaunchShortcutExtension) iter.next(); + List<LaunchShortcutExtension> shortcuts = getLaunchConfigurationManager().getLaunchShortcuts(getCategory()); + for (LaunchShortcutExtension ext : shortcuts) { if (ext.getModes().contains(getMode())) { return true; } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchShortcutsAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchShortcutsAction.java index b30159f4d..b184ebee9 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchShortcutsAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/LaunchShortcutsAction.java @@ -14,7 +14,6 @@ package org.eclipse.debug.ui.actions; import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import java.util.Set; import org.eclipse.core.expressions.Expression; import org.eclipse.core.expressions.IEvaluationContext; @@ -46,6 +45,7 @@ import org.eclipse.swt.events.MenuEvent; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2; @@ -100,6 +100,7 @@ public class LaunchShortcutsAction extends Action implements IMenuCreator, IWork /** * @see IAction#run() */ + @Override public void run() { //do nothing, this action just creates a cascading menu. } @@ -107,6 +108,7 @@ public class LaunchShortcutsAction extends Action implements IMenuCreator, IWork /** * @see IMenuCreator#dispose() */ + @Override public void dispose() { if (fCreatedMenu != null) { fCreatedMenu.dispose(); @@ -116,6 +118,7 @@ public class LaunchShortcutsAction extends Action implements IMenuCreator, IWork /** * @see IMenuCreator#getMenu(Control) */ + @Override public Menu getMenu(Control parent) { return null; } @@ -123,6 +126,7 @@ public class LaunchShortcutsAction extends Action implements IMenuCreator, IWork /** * @see IMenuCreator#getMenu(Menu) */ + @Override public Menu getMenu(Menu parent) { if (fCreatedMenu != null) { fCreatedMenu.dispose(); @@ -138,7 +142,7 @@ public class LaunchShortcutsAction extends Action implements IMenuCreator, IWork private IEvaluationContext createContext() { IStructuredSelection ss = SelectedResourceManager.getDefault().getCurrentSelection(); Object o = ss.getFirstElement(); - List list = new ArrayList(0); + List<IEditorInput> list = new ArrayList<IEditorInput>(0); if(o instanceof IEditorPart) { list.add(((IEditorPart)o).getEditorInput()); } @@ -157,11 +161,11 @@ public class LaunchShortcutsAction extends Action implements IMenuCreator, IWork private void fillMenu() { IEvaluationContext context = createContext(); int accelerator = 1; - List allShortCuts = getLaunchConfigurationManager().getLaunchShortcuts(fGroup.getCategory()); - Iterator iter = allShortCuts.iterator(); - List filteredShortCuts = new ArrayList(10); + List<LaunchShortcutExtension> allShortCuts = getLaunchConfigurationManager().getLaunchShortcuts(fGroup.getCategory()); + Iterator<LaunchShortcutExtension> iter = allShortCuts.iterator(); + List<LaunchShortcutExtension> filteredShortCuts = new ArrayList<LaunchShortcutExtension>(10); while (iter.hasNext()) { - LaunchShortcutExtension ext = (LaunchShortcutExtension) iter.next(); + LaunchShortcutExtension ext = iter.next(); try { if (!WorkbenchActivityHelper.filterItem(ext) && isApplicable(ext, context)) { filteredShortCuts.add(ext); @@ -187,13 +191,8 @@ public class LaunchShortcutsAction extends Action implements IMenuCreator, IWork } catch(CoreException ce) {DebugUIPlugin.log(ce);} //second add the launch shortcuts if any - iter = filteredShortCuts.iterator(); - while (iter.hasNext()) { - LaunchShortcutExtension ext = (LaunchShortcutExtension) iter.next(); - Set modes = ext.getModes(); // supported launch modes - Iterator modeIter = modes.iterator(); - while (modeIter.hasNext()) { - String modee = (String) modeIter.next(); + for (LaunchShortcutExtension ext : filteredShortCuts) { + for (String modee : ext.getModes()) { if (modee.equals(mode)) { populateMenuItem(modee, ext, fCreatedMenu, accelerator++); } @@ -215,7 +214,7 @@ public class LaunchShortcutsAction extends Action implements IMenuCreator, IWork * @since 3.3 */ private Object getSelection(IEvaluationContext context) { - List list = (List) context.getVariable("selection"); //$NON-NLS-1$ + List<?> list = (List<?>) context.getVariable("selection"); //$NON-NLS-1$ return (list.isEmpty() ? null : list.get(0)); } @@ -269,6 +268,7 @@ public class LaunchShortcutsAction extends Action implements IMenuCreator, IWork // Add listener to re-populate the menu each time // it is shown to reflect changes in selection or active perspective fCreatedMenu.addMenuListener(new MenuAdapter() { + @Override public void menuShown(MenuEvent e) { Menu m = (Menu)e.widget; MenuItem[] items = m.getItems(); @@ -301,11 +301,13 @@ public class LaunchShortcutsAction extends Action implements IMenuCreator, IWork /** * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow) */ + @Override public void init(IWorkbenchWindow window) {} /** * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ + @Override public void run(IAction action) { // do nothing - this is just a menu } @@ -313,6 +315,7 @@ public class LaunchShortcutsAction extends Action implements IMenuCreator, IWork /** * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) */ + @Override public void selectionChanged(IAction action, ISelection selection) { if (!fInitialized) { action.setEnabled(existsConfigTypesForMode()); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/OpenLaunchDialogAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/OpenLaunchDialogAction.java index 7f97c39cb..649542dfe 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/OpenLaunchDialogAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/OpenLaunchDialogAction.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 @@ -60,7 +60,7 @@ public class OpenLaunchDialogAction extends Action implements IActionDelegate2, ILaunchGroup group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(fIdentifier); if(group != null) { String lbl = group.getLabel(); - String actionLabel = MessageFormat.format(ActionMessages.OpenLaunchDialogAction_1, new String[] {lbl}); + String actionLabel = MessageFormat.format(ActionMessages.OpenLaunchDialogAction_1, new Object[] { lbl }); setText(DebugUIPlugin.adjustDBCSAccelerator(actionLabel)); } PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugHelpContextIds.OPEN_LAUNCH_CONFIGURATION_ACTION); @@ -69,6 +69,7 @@ public class OpenLaunchDialogAction extends Action implements IActionDelegate2, /** * @see org.eclipse.jface.action.IAction#run() */ + @Override public void run() { LaunchHistory history = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchHistory(fIdentifier); ILaunchConfiguration configuration = history.getRecentLaunch(); @@ -85,6 +86,7 @@ public class OpenLaunchDialogAction extends Action implements IActionDelegate2, /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event) */ + @Override public void runWithEvent(IAction action, Event event) { run(); } @@ -92,6 +94,7 @@ public class OpenLaunchDialogAction extends Action implements IActionDelegate2, /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ + @Override public void run(IAction action) { run(); } @@ -99,11 +102,13 @@ public class OpenLaunchDialogAction extends Action implements IActionDelegate2, /** * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() */ + @Override public void dispose() {} /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction) */ + @Override public void init(IAction action) { if(action != null) { action.setEnabled(existsConfigTypesForMode()); @@ -131,11 +136,13 @@ public class OpenLaunchDialogAction extends Action implements IActionDelegate2, /* (non-Javadoc) * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow) */ + @Override public void init(IWorkbenchWindow window) {} /** * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) */ + @Override public void selectionChanged(IAction action, ISelection selection) {} /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RelaunchLastAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RelaunchLastAction.java index 42df05e34..b58ccae6f 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RelaunchLastAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RelaunchLastAction.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
@@ -59,6 +59,7 @@ public abstract class RelaunchLastAction implements IWorkbenchWindowActionDelega /* (non-Javadoc)
* @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent)
*/
+ @Override
public void preferenceChange(PreferenceChangeEvent event) {
if(event.getKey().equals(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH)) {
initialize(fAction);
@@ -73,6 +74,7 @@ public abstract class RelaunchLastAction implements IWorkbenchWindowActionDelega /* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
*/
+ @Override
public void dispose(){
IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(DebugUIPlugin.getUniqueIdentifier());
if(prefs != null) {
@@ -83,6 +85,7 @@ public abstract class RelaunchLastAction implements IWorkbenchWindowActionDelega /* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
*/
+ @Override
public void init(IWorkbenchWindow window){
fWorkbenchWindow = window;
IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(DebugUIPlugin.getUniqueIdentifier());
@@ -94,6 +97,7 @@ public abstract class RelaunchLastAction implements IWorkbenchWindowActionDelega /* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
*/
+ @Override
public void run(IAction action){
if(LaunchingResourceManager.isContextLaunchEnabled()) {
ILaunchGroup group = DebugUIPlugin.getDefault().getLaunchConfigurationManager().getLaunchGroup(getLaunchGroupId());
@@ -108,7 +112,8 @@ public abstract class RelaunchLastAction implements IWorkbenchWindowActionDelega } else {
String configName = configuration.getName();
String title = ActionMessages.RelaunchLastAction_Cannot_relaunch_1;
- String message = MessageFormat.format(ActionMessages.RelaunchLastAction_Cannot_relaunch___0___because_it_does_not_support__2__mode_2, new String[] {configName, getMode()});
+ String message = MessageFormat.format(ActionMessages.RelaunchLastAction_Cannot_relaunch___0___because_it_does_not_support__2__mode_2, new Object[] {
+ configName, getMode() });
MessageDialog.openError(getShell(), title, message);
}
} else {
@@ -136,6 +141,7 @@ public abstract class RelaunchLastAction implements IWorkbenchWindowActionDelega /* (non-Javadoc)
* @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
*/
+ @Override
public void selectionChanged(IAction action, ISelection selection){
if (fAction == null) {
initialize(action);
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointAction.java index 6612a9e8f..c48abc8d4 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointAction.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 @@ -20,6 +20,7 @@ import org.eclipse.jface.action.Action; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.Position; +import org.eclipse.jface.text.source.Annotation; import org.eclipse.jface.text.source.IAnnotationModel; import org.eclipse.jface.text.source.IVerticalRulerInfo; import org.eclipse.ui.texteditor.ITextEditor; @@ -59,11 +60,11 @@ public abstract class RulerBreakpointAction extends Action { IAnnotationModel annotationModel = fEditor.getDocumentProvider().getAnnotationModel(fEditor.getEditorInput()); IDocument document = fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput()); if (annotationModel != null) { - Iterator iterator = annotationModel.getAnnotationIterator(); + Iterator<Annotation> iterator = annotationModel.getAnnotationIterator(); while (iterator.hasNext()) { - Object object = iterator.next(); - if (object instanceof SimpleMarkerAnnotation) { - SimpleMarkerAnnotation markerAnnotation = (SimpleMarkerAnnotation) object; + Annotation annot = iterator.next(); + if (annot instanceof SimpleMarkerAnnotation) { + SimpleMarkerAnnotation markerAnnotation = (SimpleMarkerAnnotation) annot; IMarker marker = markerAnnotation.getMarker(); try { if (marker.isSubtypeOf(IBreakpoint.BREAKPOINT_MARKER)) { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java index eda0b060d..b09b9fdbf 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerBreakpointTypesActionDelegate.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 @@ -8,10 +8,9 @@ * Contributors: * IBM Corporation - initial API and implementation * Wind River Systems - adapted action to use for breakpoint types -******************************************************************************/ + ******************************************************************************/ package org.eclipse.debug.ui.actions; -import java.util.Iterator; import java.util.Set; import org.eclipse.debug.internal.ui.actions.ToggleBreakpointsTargetManager; @@ -75,6 +74,7 @@ import org.eclipse.ui.texteditor.ITextEditorExtension; * * @deprecated Should use BreakpointTypesContribution instead. */ +@Deprecated public class RulerBreakpointTypesActionDelegate implements IEditorActionDelegate, IMenuListener, IMenuCreator { private ITextEditor fEditor = null; private IAction fCallerAction = null; @@ -87,15 +87,17 @@ public class RulerBreakpointTypesActionDelegate implements IEditorActionDelegate private Menu fMenu; private class SelectTargetAction extends Action { - private final Set fPossibleIDs; + private final Set<String> fPossibleIDs; private final String fID; - SelectTargetAction(String name, Set possibleIDs, String ID) { + + SelectTargetAction(String name, Set<String> possibleIDs, String ID) { super(name, AS_RADIO_BUTTON); fID = ID; fPossibleIDs = possibleIDs; } - public void run() { + @Override + public void run() { if (isChecked()) { ToggleBreakpointsTargetManager.getDefault().setPreferredTarget(fPossibleIDs, fID); } @@ -103,18 +105,21 @@ public class RulerBreakpointTypesActionDelegate implements IEditorActionDelegate } - public void selectionChanged(IAction action, ISelection selection) { + @Override + public void selectionChanged(IAction action, ISelection selection) { // In the editor we're not using the selection. } - public void run(IAction action) { + @Override + public void run(IAction action) { // Do nothing, this is a pull-down menu. } /* (non-Javadoc) * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart) */ - public void setActiveEditor(IAction callerAction, IEditorPart targetEditor) { + @Override + public void setActiveEditor(IAction callerAction, IEditorPart targetEditor) { // Clean up old editor data. if (fCallerAction != null) { fCallerAction.setMenuCreator(null); @@ -140,7 +145,8 @@ public class RulerBreakpointTypesActionDelegate implements IEditorActionDelegate } - public void dispose() { + @Override + public void dispose() { if (fCallerAction != null) { fCallerAction.setMenuCreator(null); } @@ -150,7 +156,8 @@ public class RulerBreakpointTypesActionDelegate implements IEditorActionDelegate fRulerInfo = null; } - public void menuAboutToShow(IMenuManager manager) { + @Override + public void menuAboutToShow(IMenuManager manager) { fSelection = StructuredSelection.EMPTY; if (fEditor != null && fRulerInfo != null) { @@ -166,7 +173,7 @@ public class RulerBreakpointTypesActionDelegate implements IEditorActionDelegate } } ToggleBreakpointsTargetManager toggleTargetManager = ToggleBreakpointsTargetManager.getDefault(); - Set enabledIDs = toggleTargetManager.getEnabledToggleBreakpointsTargetIDs(fEditor, fSelection); + Set<String> enabledIDs = toggleTargetManager.getEnabledToggleBreakpointsTargetIDs(fEditor, fSelection); fCallerAction.setEnabled(enabledIDs.size() > 0); } else { fCallerAction.setEnabled(false); @@ -186,14 +193,16 @@ public class RulerBreakpointTypesActionDelegate implements IEditorActionDelegate fMenu = menu; } - public Menu getMenu(Menu parent) { + @Override + public Menu getMenu(Menu parent) { setMenu(new Menu(parent)); fillMenu(fMenu); initMenu(); return fMenu; } - public Menu getMenu(Control parent) { + @Override + public Menu getMenu(Control parent) { setMenu(new Menu(parent)); fillMenu(fMenu); initMenu(); @@ -207,17 +216,13 @@ public class RulerBreakpointTypesActionDelegate implements IEditorActionDelegate */ private void fillMenu(Menu menu) { ToggleBreakpointsTargetManager manager = ToggleBreakpointsTargetManager.getDefault(); - Set enabledIDs = manager.getEnabledToggleBreakpointsTargetIDs(fEditor, fSelection); + Set<String> enabledIDs = manager.getEnabledToggleBreakpointsTargetIDs(fEditor, fSelection); String preferredId = manager.getPreferredToggleBreakpointsTargetID(fEditor, fSelection); - - for (Iterator itr = enabledIDs.iterator(); itr.hasNext();) { - String id = (String)itr.next(); + for (String id : enabledIDs) { SelectTargetAction action= new SelectTargetAction(manager.getToggleBreakpointsTargetName(id), enabledIDs, id); - if (id.equals(preferredId)){ action.setChecked(true); } - ActionContributionItem item= new ActionContributionItem(action); item.fill(menu, -1); } @@ -230,7 +235,8 @@ public class RulerBreakpointTypesActionDelegate implements IEditorActionDelegate // Add listener to re-populate the menu each time // it is shown because of dynamic history list fMenu.addMenuListener(new MenuAdapter() { - public void menuShown(MenuEvent e) { + @Override + public void menuShown(MenuEvent e) { Menu m = (Menu)e.widget; MenuItem[] items = m.getItems(); for (int i=0; i < items.length; i++) { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerEnableDisableBreakpointActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerEnableDisableBreakpointActionDelegate.java index 0b17e2a89..b41960f02 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerEnableDisableBreakpointActionDelegate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerEnableDisableBreakpointActionDelegate.java @@ -48,6 +48,7 @@ public class RulerEnableDisableBreakpointActionDelegate extends AbstractRulerAct /* (non-Javadoc) * @see org.eclipse.ui.texteditor.AbstractRulerActionDelegate#createAction(org.eclipse.ui.texteditor.ITextEditor, org.eclipse.jface.text.source.IVerticalRulerInfo) */ + @Override protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) { return new RulerEnableDisableBreakpointAction(editor, rulerInfo); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerToggleBreakpointActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerToggleBreakpointActionDelegate.java index ff93f5af1..fba8e40ce 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerToggleBreakpointActionDelegate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RulerToggleBreakpointActionDelegate.java @@ -79,6 +79,7 @@ public class RulerToggleBreakpointActionDelegate extends AbstractRulerActionDele /* (non-Javadoc) * @see org.eclipse.ui.texteditor.AbstractRulerActionDelegate#createAction(org.eclipse.ui.texteditor.ITextEditor, org.eclipse.jface.text.source.IVerticalRulerInfo) */ + @Override protected IAction createAction(ITextEditor editor, IVerticalRulerInfo rulerInfo) { fDelegate = new ToggleBreakpointAction(editor, null, rulerInfo); return fDelegate; @@ -87,6 +88,7 @@ public class RulerToggleBreakpointActionDelegate extends AbstractRulerActionDele /* (non-Javadoc) * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart) */ + @Override public void setActiveEditor(IAction callerAction, IEditorPart targetEditor) { if (fEditor != null) { if (fDelegate != null) { @@ -101,12 +103,14 @@ public class RulerToggleBreakpointActionDelegate extends AbstractRulerActionDele /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction) */ + @Override public void init(IAction action) { } /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate2#dispose() */ + @Override public void dispose() { if (fDelegate != null) { fDelegate.dispose(); @@ -118,6 +122,7 @@ public class RulerToggleBreakpointActionDelegate extends AbstractRulerActionDele /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event) */ + @Override public void runWithEvent(IAction action, Event event) { if(fDelegate != null) { fDelegate.runWithEvent(event); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunAction.java index 32145272f..ed3a12692 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunAction.java @@ -34,6 +34,7 @@ public final class RunAction extends ExecutionAction { /** * @see ExecutionAction#getMode() */ + @Override protected String getMode() { return ILaunchManager.RUN_MODE; } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java index e7513285b..d735d34c4 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineActionDelegate.java @@ -76,6 +76,7 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe update(); } + @Override public void debugContextChanged(DebugContextEvent event) { contextActivated(event.getContext()); } @@ -85,6 +86,7 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe /*(non-Javadoc) * @see org.eclipse.ui.IActionDelegate2#dispose() */ + @Override public void dispose() { DebugUITools.getDebugContextManager().getContextService(fActivePart.getSite().getWorkbenchWindow()).removeDebugContextListener(fContextListener); fActivePart = null; @@ -94,6 +96,7 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ + @Override public void run(IAction action) { if (fPartTarget != null && fTargetElement != null) { try { @@ -106,6 +109,7 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) */ + @Override public void selectionChanged(IAction action, ISelection selection) { this.fAction = action; update(); @@ -119,6 +123,7 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe return; } Runnable r = new Runnable() { + @Override public void run() { boolean enabled = false; if (fPartTarget != null && fTargetElement != null) { @@ -140,6 +145,7 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate2#init(org.eclipse.jface.action.IAction) */ + @Override public void init(IAction action) { this.fAction = action; if (action != null) { @@ -151,12 +157,14 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe /* (non-Javadoc) * @see org.eclipse.ui.IActionDelegate2#runWithEvent(org.eclipse.jface.action.IAction, org.eclipse.swt.widgets.Event) */ + @Override public void runWithEvent(IAction action, Event event) { run(action); } /* (non-Javadoc) * @see org.eclipse.ui.IEditorActionDelegate#setActiveEditor(org.eclipse.jface.action.IAction, org.eclipse.ui.IEditorPart) */ + @Override public void setActiveEditor(IAction action, IEditorPart targetEditor) { init(action); bindTo(targetEditor); @@ -165,6 +173,7 @@ public class RunToLineActionDelegate implements IEditorActionDelegate, IActionDe /* (non-Javadoc) * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart) */ + @Override public void init(IViewPart view) { bindTo(view); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java index d0d5dd1e4..4db1b058c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/RunToLineHandler.java @@ -65,7 +65,8 @@ public class RunToLineHandler implements IDebugEventSetListener, IBreakpointMana /* (non-Javadoc) * @see org.eclipse.debug.core.IDebugEventSetListener#handleDebugEvents(org.eclipse.debug.core.DebugEvent[]) */ - public void handleDebugEvents(DebugEvent[] events) { + @Override + public void handleDebugEvents(DebugEvent[] events) { for (int i = 0; i < events.length; i++) { DebugEvent event= events[i]; Object source= event.getSource(); @@ -91,7 +92,8 @@ public class RunToLineHandler implements IDebugEventSetListener, IBreakpointMana /* (non-Javadoc) * @see org.eclipse.debug.core.IBreakpointManagerListener#breakpointManagerEnablementChanged(boolean) */ - public void breakpointManagerEnablementChanged(boolean enabled) { + @Override + public void breakpointManagerEnablementChanged(boolean enabled) { // if the user changes the breakpoint manager enablement, don't restore it fAutoSkip = false; } @@ -123,7 +125,8 @@ public class RunToLineHandler implements IDebugEventSetListener, IBreakpointMana /* (non-Javadoc) * @see org.eclipse.core.resources.IWorkspaceRunnable#run(org.eclipse.core.runtime.IProgressMonitor) */ - public void run(IProgressMonitor monitor) throws CoreException { + @Override + public void run(IProgressMonitor monitor) throws CoreException { getDebugPlugin().addDebugEventListener(this); IBreakpointManager breakpointManager = getBreakpointManager(); fAutoSkip = DebugUITools.getPreferenceStore().getBoolean(IDebugUIConstants.PREF_SKIP_BREAKPOINTS_DURING_RUN_TO_LINE) && breakpointManager.isEnabled(); @@ -132,7 +135,8 @@ public class RunToLineHandler implements IDebugEventSetListener, IBreakpointMana breakpointManager.addBreakpointManagerListener(this); } Job job = new Job(ActionMessages.RunToLineHandler_0) { - protected IStatus run(IProgressMonitor jobMonitor) { + @Override + protected IStatus run(IProgressMonitor jobMonitor) { if (!jobMonitor.isCanceled()) { fTarget.breakpointAdded(fBreakpoint); try { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleBreakpointAction.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleBreakpointAction.java index 0a0aadd0e..8a4c9c8a6 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleBreakpointAction.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleBreakpointAction.java @@ -50,7 +50,8 @@ public class ToggleBreakpointAction extends Action implements IUpdate { private IDocument fDocument; private IVerticalRulerInfo fRulerInfo; private IToggleBreakpointsTargetManagerListener fListener = new IToggleBreakpointsTargetManagerListener() { - public void preferredTargetsChanged() { + @Override + public void preferredTargetsChanged() { update(); } }; @@ -78,6 +79,7 @@ public class ToggleBreakpointAction extends Action implements IUpdate { * (non-Javadoc) * @see org.eclipse.jface.action.IAction#run() */ + @Override public void run() { doIt(null); } @@ -85,6 +87,7 @@ public class ToggleBreakpointAction extends Action implements IUpdate { /* (non-Javadoc) * @see org.eclipse.jface.action.Action#runWithEvent(org.eclipse.swt.widgets.Event) */ + @Override public void runWithEvent(Event event) { doIt(event); } @@ -186,6 +189,7 @@ public class ToggleBreakpointAction extends Action implements IUpdate { /* (non-Javadoc) * @see org.eclipse.ui.texteditor.IUpdate#update() */ + @Override public void update() { IDocument document= getDocument(); if (document != null) { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleMethodBreakpointActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleMethodBreakpointActionDelegate.java index 4b3db6ff7..aeed58b01 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleMethodBreakpointActionDelegate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleMethodBreakpointActionDelegate.java @@ -31,6 +31,7 @@ public class ToggleMethodBreakpointActionDelegate extends ToggleBreakpointObject /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.actions.ToggleBreakpointObjectActionDelegate#performAction(org.eclipse.debug.internal.ui.actions.IToggleBreakpointsTarget, org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) */ + @Override protected void performAction(IToggleBreakpointsTarget target, IWorkbenchPart part, ISelection selection) throws CoreException { target.toggleMethodBreakpoints(part, selection); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleWatchpointActionDelegate.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleWatchpointActionDelegate.java index c5ebd55ec..ac1bdd8a3 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleWatchpointActionDelegate.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ToggleWatchpointActionDelegate.java @@ -31,6 +31,7 @@ public class ToggleWatchpointActionDelegate extends ToggleBreakpointObjectAction /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.actions.ToggleBreakpointObjectActionDelegate#performAction(org.eclipse.debug.internal.ui.actions.IToggleBreakpointsTarget, org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection) */ + @Override protected void performAction(IToggleBreakpointsTarget target, IWorkbenchPart part, ISelection selection) throws CoreException { target.toggleWatchpoints(part, selection); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/ConsoleColorProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/ConsoleColorProvider.java index 27ca96d60..62b9b5e13 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/ConsoleColorProvider.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/ConsoleColorProvider.java @@ -34,6 +34,7 @@ public class ConsoleColorProvider implements IConsoleColorProvider { /* (non-Javadoc) * @see org.eclipse.debug.ui.console.IConsoleColorProvider#connect(org.eclipse.debug.core.model.IProcess, org.eclipse.debug.ui.console.IConsole) */ + @Override public void connect(IProcess process, IConsole console) { fProcess = process; fConsole = console; @@ -46,6 +47,7 @@ public class ConsoleColorProvider implements IConsoleColorProvider { /* (non-Javadoc) * @see org.eclipse.debug.ui.console.IConsoleColorProvider#disconnect() */ + @Override public void disconnect() { fConsole = null; fProcess = null; @@ -54,6 +56,7 @@ public class ConsoleColorProvider implements IConsoleColorProvider { /* (non-Javadoc) * @see org.eclipse.debug.ui.console.IConsoleColorProvider#isReadOnly() */ + @Override public boolean isReadOnly() { return fProcess == null || fProcess.isTerminated(); } @@ -61,6 +64,7 @@ public class ConsoleColorProvider implements IConsoleColorProvider { /* (non-Javadoc) * @see org.eclipse.debug.ui.console.IConsoleColorProvider#getColor(java.lang.String) */ + @Override public Color getColor(String streamIdentifer) { if (IDebugUIConstants.ID_STANDARD_OUTPUT_STREAM.equals(streamIdentifer)) { return DebugUIPlugin.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_SYS_OUT_COLOR); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java index 5bf3cc8a9..aa3d73139 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/FileLink.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 @@ -41,6 +41,7 @@ import org.eclipse.ui.texteditor.ITextEditor; * @since 2.1 * @noextend This class is not intended to be subclassed by clients. */ +@SuppressWarnings("deprecation") public class FileLink implements IConsoleHyperlink { private IFile fFile; @@ -72,6 +73,7 @@ public class FileLink implements IConsoleHyperlink { /* (non-Javadoc) * @see org.eclipse.debug.ui.console.IConsoleHyperlink#linkActivated() */ + @Override public void linkActivated() { IWorkbenchWindow window = DebugUIPlugin.getActiveWorkbenchWindow(); if (window != null) { @@ -123,12 +125,14 @@ public class FileLink implements IConsoleHyperlink { /* (non-Javadoc) * @see org.eclipse.debug.ui.console.IConsoleHyperlink#linkEntered() */ + @Override public void linkEntered() { } /* (non-Javadoc) * @see org.eclipse.debug.ui.console.IConsoleHyperlink#linkExited() */ + @Override public void linkExited() { } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/IConsole.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/IConsole.java index 522de7e7d..55f46ec24 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/IConsole.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/IConsole.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 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 @@ -64,6 +64,7 @@ public interface IConsole { * @param length the length of the associated hyperlink text * @deprecated replaced with addLink(IHyperlink link, int offset, int length) */ + @Deprecated public void addLink(IConsoleHyperlink link, int offset, int length); /** @@ -91,6 +92,7 @@ public interface IConsole { * @return region of text associated with the hyperlink, or <code>null</code> * @deprecated replaced with getRegion(IHyperlink link) instead */ + @Deprecated public IRegion getRegion(IConsoleHyperlink link); /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/IConsoleHyperlink.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/IConsoleHyperlink.java index b735fac78..bf7ccf74c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/IConsoleHyperlink.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/console/IConsoleHyperlink.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2005 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 @@ -19,10 +19,13 @@ import org.eclipse.ui.console.IHyperlink; * Clients may implement this interface. * </p> * <p> - * Since 3.1, this interface now extends {@link org.eclipse.ui.console.IHyperlink}. + * Since 3.1, this interface now extends + * {@link org.eclipse.ui.console.IHyperlink}. * </p> + * * @since 2.1 * @deprecated replaced by org.eclipse.ui.console.IHyperlink */ +@Deprecated public interface IConsoleHyperlink extends IHyperlink { } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/AbstractDebugContextProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/AbstractDebugContextProvider.java index ec983e352..15c18d638 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/AbstractDebugContextProvider.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/contexts/AbstractDebugContextProvider.java @@ -47,6 +47,7 @@ public abstract class AbstractDebugContextProvider implements IDebugContextProvi /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextProvider#addDebugContextEventListener(org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextEventListener) */ + @Override public void addDebugContextListener(IDebugContextListener listener) { fListeners.add(listener); } @@ -54,6 +55,7 @@ public abstract class AbstractDebugContextProvider implements IDebugContextProvi /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextProvider#getPart() */ + @Override public IWorkbenchPart getPart() { return fPart; } @@ -61,6 +63,7 @@ public abstract class AbstractDebugContextProvider implements IDebugContextProvi /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextProvider#removeDebugContextEventListener(org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextEventListener) */ + @Override public void removeDebugContextListener(IDebugContextListener listener) { fListeners.remove(listener); } @@ -75,9 +78,11 @@ public abstract class AbstractDebugContextProvider implements IDebugContextProvi for (int i = 0; i < listeners.length; i++) { final IDebugContextListener listener = (IDebugContextListener) listeners[i]; SafeRunner.run(new ISafeRunnable() { + @Override public void run() throws Exception { listener.debugContextChanged(event); } + @Override public void handleException(Throwable exception) { DebugUIPlugin.log(exception); } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java index a6227f6bf..cb4f4823d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRendering.java @@ -73,6 +73,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements setSystem(true); } + @Override protected IStatus run(IProgressMonitor monitor) { fRunnable.run(); return Status.OK_STATUS; @@ -100,6 +101,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRendering#init(org.eclipse.debug.ui.memory.IMemoryRenderingSite, org.eclipse.debug.core.model.IMemoryBlock) */ + @Override public void init(IMemoryRenderingContainer container, IMemoryBlock block) { fContainer = container; fMemoryBlock = block; @@ -110,12 +112,14 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRendering#dispose() */ + @Override public void dispose() { // disconnect from memory block when rendering is disposed if (fMemoryBlock instanceof IMemoryBlockExtension) { Runnable runnable = new Runnable(){ + @Override public void run() { ((IMemoryBlockExtension)fMemoryBlock).disconnect(AbstractMemoryRendering.this); }}; @@ -137,6 +141,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRendering#activated() */ + @Override public void activated() { if (fContainer.getMemoryRenderingSite().getSynchronizationService() != null) fContainer.getMemoryRenderingSite().getSynchronizationService().setSynchronizationProvider(this); @@ -145,6 +150,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRendering#deactivated() */ + @Override public void deactivated() { // do nothing when deactivated // we do not want to set the sync provider from rendering site @@ -156,12 +162,14 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRendering#becomesVisible() */ + @Override public void becomesVisible() { fVisible = true; if (fMemoryBlock instanceof IMemoryBlockExtension) { Runnable runnable = new Runnable(){ + @Override public void run() { ((IMemoryBlockExtension)fMemoryBlock).connect(AbstractMemoryRendering.this); }}; @@ -172,11 +180,13 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRendering#becomesHidden() */ + @Override public void becomesHidden() { fVisible = false; if (fMemoryBlock instanceof IMemoryBlockExtension) { Runnable runnable = new Runnable(){ + @Override public void run() { ((IMemoryBlockExtension)fMemoryBlock).disconnect(AbstractMemoryRendering.this); }}; @@ -187,6 +197,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRendering#getMemoryBlock() */ + @Override public IMemoryBlock getMemoryBlock() { return fMemoryBlock; } @@ -194,6 +205,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRendering#getRenderingId() */ + @Override public String getRenderingId() { return fRenderingId; @@ -202,6 +214,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRendering#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) */ + @Override public void addPropertyChangeListener(IPropertyChangeListener listener) { if (fPropertyListeners == null) @@ -213,6 +226,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRendering#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) */ + @Override public void removePropertyChangeListener(IPropertyChangeListener listener) { if (fPropertyListeners == null) @@ -223,6 +237,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRendering#getImage() */ + @Override public Image getImage() { return decorateImage(null); } @@ -243,6 +258,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRendering#getLabel() */ + @Override public String getLabel() { if (fMemoryBlock == null) @@ -341,6 +357,7 @@ public abstract class AbstractMemoryRendering extends PlatformObject implements ISelectionProvider selProvider = site.getSite().getSelectionProvider(); fMenuListener = new IMenuListener() { + @Override public void menuAboutToShow(IMenuManager manager) { manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); }}; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRenderingBindingsProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRenderingBindingsProvider.java index 7c1c50675..aaec45a6d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRenderingBindingsProvider.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractMemoryRenderingBindingsProvider.java @@ -31,6 +31,7 @@ public abstract class AbstractMemoryRenderingBindingsProvider implements IMemory /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRenderingBindingsProvider#addListener(org.eclipse.debug.ui.memory.IMemoryRenderingBindingsListener) */ + @Override public void addListener(IMemoryRenderingBindingsListener listener) { if (fListeners == null) { fListeners = new ListenerList(); @@ -40,6 +41,7 @@ public abstract class AbstractMemoryRenderingBindingsProvider implements IMemory /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRenderingBindingsProvider#removeListener(org.eclipse.debug.ui.memory.IMemoryRenderingBindingsListener) */ + @Override public void removeListener(IMemoryRenderingBindingsListener listener) { if (fListeners != null) { fListeners.remove(listener); @@ -60,9 +62,11 @@ public abstract class AbstractMemoryRenderingBindingsProvider implements IMemory if (listeners[i] instanceof IMemoryRenderingBindingsListener) { final IMemoryRenderingBindingsListener listener = (IMemoryRenderingBindingsListener)listeners[i]; ISafeRunnable runnable = new ISafeRunnable () { + @Override public void handleException(Throwable exception) { DebugUIPlugin.log(exception); } + @Override public void run() throws Exception { listener.memoryRenderingBindingsChanged(); }}; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java index b46a29be9..2db7b143b 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTableRendering.java @@ -268,6 +268,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering * * @see org.eclipse.jface.action.IAction#run() */ + @Override public void run() { fIsShowAddressColumn = !fIsShowAddressColumn; resizeColumnsToPreferredSize(); @@ -296,6 +297,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugUIConstants.PLUGIN_ID + ".NextPageAction_context"); //$NON-NLS-1$ } + @Override public void run() { BigInteger address = fContentInput.getLoadAddress(); address = address.add(BigInteger.valueOf(getPageSizeInUnits())); @@ -312,6 +314,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IDebugUIConstants.PLUGIN_ID + ".PrevPageAction_context"); //$NON-NLS-1$ } + @Override public void run() { BigInteger address = fContentInput.getLoadAddress(); address = address.subtract(BigInteger.valueOf(getPageSizeInUnits())); @@ -331,6 +334,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering /* (non-Javadoc) * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) */ + @Override public void propertyChange(PropertyChangeEvent event) { // if memory view table font has changed if (event.getProperty().equals(IInternalDebugUIConstants.FONT_NAME)) @@ -365,12 +369,14 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering } // do not handle event if the rendering is displaying an error - if (isDisplayingError()) + if (isDisplayingError()) { return; + } // do not handle property change event if the rendering is not visible - if (!isVisible()) + if (!isVisible()) { return; + } if (event.getProperty().equals(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM)) { handleDyanicLoadChanged(); @@ -396,18 +402,21 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering return; } - if (evtSrc == this) + if (evtSrc == this) { return; + } - if (!(evtSrc instanceof IMemoryRendering)) + if (!(evtSrc instanceof IMemoryRendering)) { return; + } IMemoryRendering rendering = (IMemoryRendering)evtSrc; IMemoryBlock memoryBlock = rendering.getMemoryBlock(); // do not handle event from renderings displaying other memory blocks - if (memoryBlock != getMemoryBlock()) + if (memoryBlock != getMemoryBlock()) { return; + } String propertyName = event.getProperty(); Object value = event.getNewValue(); @@ -428,8 +437,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering { if (needMoreLines()) { - if (isDynamicLoad()) + if (isDynamicLoad()) { reloadTable(getTopVisibleAddress(), false); + } } topVisibleAddressChanged((BigInteger)value, false); } @@ -453,8 +463,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering else { BigInteger pageStart = (BigInteger)getSynchronizedProperty(IInternalDebugUIConstants.PROPERTY_PAGE_START_ADDRESS); - if (pageStart == null) + if (pageStart == null) { pageStart = fTopRowAddress; + } handlePageStartAddressChanged(pageStart); } } @@ -496,14 +507,16 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering // continue to handle event if caller decides to force the rendering // to move to the top visible address even when the rendering // is not visible - if (!isVisible() && !force) + if (!isVisible() && !force) { return; + } // do not handle event if the base address of the memory // block has changed, wait for debug event to update to // new location - if (isBaseAddressChanged()) + if (isBaseAddressChanged()) { return; + } if (!address.equals(fTopRowAddress)) { @@ -532,10 +545,11 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering setTopIndex(table, index); } - if (isAddressVisible(fSelectedAddress)) + if (isAddressVisible(fSelectedAddress)) { fTableCursor.setVisible(true); - else + } else { fTableCursor.setVisible(false); + } } @@ -547,8 +561,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering Object evtLockClient = new Object(); try { - if (!fEvtHandleLock.acquireLock(evtLockClient)) + if (!fEvtHandleLock.acquireLock(evtLockClient)) { return; + } if (!isAddressOutOfRange(address)) { @@ -572,18 +587,20 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering } else { - if (isDynamicLoad() && getBufferThreshold(BUFFER_START) > 0) + if (isDynamicLoad() && getBufferThreshold(BUFFER_START) > 0) { reloadTable(address, false); - else + } else { setTopIndex(table, index); + } } } else if ((numInBuffer-(index+getNumberOfVisibleLines())) <= getBufferThreshold(BUFFER_END)) { - if (!isAtBottomLimit() && isDynamicLoad() && getBufferThreshold(BUFFER_END) > 0) + if (!isAtBottomLimit() && isDynamicLoad() && getBufferThreshold(BUFFER_END) > 0) { reloadTable(address, false); - else + } else { setTopIndex(table, index); + } } } } @@ -593,11 +610,12 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering reloadTable(address, false); } - if (isAddressVisible(fSelectedAddress)) + if (isAddressVisible(fSelectedAddress)) { fTableCursor.setVisible(true); - else + } else { fTableCursor.setVisible(false); } + } finally { fEvtHandleLock.releaseLock(evtLockClient); @@ -612,17 +630,19 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering // do not handle event if the base address of the memory // block has changed, wait for debug event to update to // new location - if (isBaseAddressChanged()) + if (isBaseAddressChanged()) { return; + } try { // do not handle event if the event is out of range and the // rendering is in non-dynamic-load mode, otherwise, will // cause rendering to continue to scroll when it shouldn't - if (isDynamicLoad()) + if (isDynamicLoad()) { goToAddress(value); - else if (!isAddressOutOfRange(value)) + } else if (!isAddressOutOfRange(value)) { goToAddress(value); + } } catch (DebugException e) { // do nothing } @@ -631,23 +651,28 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering private void handlePageStartAddressChanged(BigInteger address) { // do not handle if in dynamic mode - if (isDynamicLoad()) + if (isDynamicLoad()) { return; + } - if (fContentInput == null) + if (fContentInput == null) { return; + } - if (!(getMemoryBlock() instanceof IMemoryBlockExtension)) + if (!(getMemoryBlock() instanceof IMemoryBlockExtension)) { return; + } // do not handle event if the base address of the memory // block has changed, wait for debug event to update to // new location - if (isBaseAddressChanged()) + if (isBaseAddressChanged()) { return; + } - if(fContentProvider.getBufferTopAddress().equals(address)) + if(fContentProvider.getBufferTopAddress().equals(address)) { return; + } BigInteger start = fContentInput.getStartAddress(); BigInteger end = fContentInput.getEndAddress(); @@ -655,8 +680,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering // smaller than start address, load at start address if (address.compareTo(start) < 0) { - if (isAtTopLimit()) + if (isAtTopLimit()) { return; + } address = start; } @@ -664,8 +690,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering // bigger than end address, no need to load, already at top if (address.compareTo(end) > 0) { - if (isAtBottomLimit()) + if (isAtBottomLimit()) { return; + } address = end.subtract(BigInteger.valueOf(getPageSizeInUnits())); } @@ -696,6 +723,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRendering#createControl(org.eclipse.swt.widgets.Composite) */ + @Override public Control createControl(Composite parent) { fPageBook = new PageBook(parent, SWT.NONE); @@ -719,10 +747,11 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering fTableViewer= new TableViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.HIDE_SELECTION | SWT.BORDER); TableRenderingLabelProvider labelProvider; - if (hasCustomizedDecorations()) + if (hasCustomizedDecorations()) { labelProvider = new TableRenderingLabelProviderEx(this); - else + } else { labelProvider = new TableRenderingLabelProvider(this); + } fTableViewer.setLabelProvider(labelProvider); @@ -743,8 +772,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering // set up addressable size and figure out number of bytes required per line fAddressableSize = -1; try { - if (getMemoryBlock() instanceof IMemoryBlockExtension) + if (getMemoryBlock() instanceof IMemoryBlockExtension) { fAddressableSize = ((IMemoryBlockExtension)getMemoryBlock()).getAddressableSize(); + } } catch (DebugException e1) { // log error and default to 1 fAddressableSize = 1; @@ -752,8 +782,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering return; } - if (getAddressableSize() < 1) + if (getAddressableSize() < 1) { fAddressableSize = 1; + } // set up initial format setupInitialFormat(); @@ -774,6 +805,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering { // add listener to reload when we know the number of lines to load fTableViewer.getTable().addPaintListener(new PaintListener() { + @Override public void paintControl(PaintEvent e) { fTableViewer.getTable().removePaintListener(this); fContentInput.setNumLines(getNumberOfVisibleLines()); @@ -818,6 +850,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering // set up table cursor createCursor(fTableViewer.getTable(), fSelectedAddress); fTableViewer.getTable().addMouseListener(new MouseAdapter() { + @Override public void mouseDown(MouseEvent e) { handleTableMouseEvent(e); }}); @@ -828,6 +861,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering createPopupMenu(fTableCursor); fMenuListener = new IMenuListener() { + @Override public void menuAboutToShow(IMenuManager manager) { fillContextMenu(manager); manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); @@ -863,6 +897,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering JFaceResources.getFontRegistry().addListener(this); fScrollbarSelectionListener = new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent event) { handleScrollBarSelection(); @@ -1007,8 +1042,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering if (elmt != null) { - if (elmt.supportsProperty(this, IDebugPreferenceConstants.PREF_COL_SIZE_BY_MODEL)) + if (elmt.supportsProperty(this, IDebugPreferenceConstants.PREF_COL_SIZE_BY_MODEL)) { defaultColSize = getDefaultFromPersistableElement(IDebugPreferenceConstants.PREF_COL_SIZE_BY_MODEL); + } } if (defaultColSize <= 0) @@ -1017,8 +1053,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering defaultColSize = getDefaultColumnSizeByModel(getMemoryBlock().getModelIdentifier()); } - if (defaultColSize > 0) + if (defaultColSize > 0) { columnSize = defaultColSize * getAddressableSize(); + } } return columnSize; } @@ -1052,12 +1089,14 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering } } - if (defaultRowSize <= 0) + if (defaultRowSize <= 0) { // no synchronized property, ask preference store by id defaultRowSize = getDefaultRowSizeByModel(getMemoryBlock().getModelIdentifier()); + } - if (defaultRowSize > 0) + if (defaultRowSize > 0) { bytePerLine = defaultRowSize * getAddressableSize(); + } } return bytePerLine; } @@ -1107,6 +1146,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering fTableCursor.setVisible(true); fCursorKeyAdapter = new KeyAdapter() { + @Override public void keyPressed(KeyEvent e) { handleCursorKeyPressed(e); @@ -1115,6 +1155,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering fTableCursor.addKeyListener(fCursorKeyAdapter); fCursorTraverseListener = new TraverseListener() { + @Override public void keyTraversed(TraverseEvent e) { handleCursorTraverseEvt(e); }}; @@ -1122,6 +1163,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering fTableCursor.addTraverseListener(fCursorTraverseListener); fCursorMouseListener = new MouseAdapter() { + @Override public void mouseDown(MouseEvent e) { handleCursorMouseEvent(e); }}; @@ -1130,9 +1172,11 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering // cursor may be disposed before disposed is called // remove listeners whenever the cursor is disposed fTableCursor.addDisposeListener(new DisposeListener() { + @Override public void widgetDisposed(DisposeEvent e) { - if (fTableCursor == null) + if (fTableCursor == null) { return; + } fTableCursor.removeTraverseListener(fCursorTraverseListener); fTableCursor.removeKeyListener(fCursorKeyAdapter); fTableCursor.removeMouseListener(fCursorMouseListener); @@ -1140,10 +1184,12 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering }}); fCursorSelectionListener = new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent e) { - if (!fEvtHandleLock.acquireLock(this)) + if (!fEvtHandleLock.acquireLock(this)) { return; + } handleCursorMoved(); @@ -1161,8 +1207,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering private void handleCursorTraverseEvt(TraverseEvent e){ - if (fTableCursor.getRow() == null) + if (fTableCursor.getRow() == null) { return; + } Table table = (Table)fTableCursor.getParent(); int row = table.indexOf(fTableCursor.getRow()); @@ -1191,8 +1238,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering } Object evtLockClient = new Object(); - if (!fEvtHandleLock.acquireLock(evtLockClient)) + if (!fEvtHandleLock.acquireLock(evtLockClient)) { return; + } handleCursorMoved(); @@ -1206,8 +1254,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering */ private void handleCursorMoved() { - if (fIsDisposed) + if (fIsDisposed) { return; + } BigInteger selectedAddress = getSelectedAddressFromCursor(fTableCursor); @@ -1220,8 +1269,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering // now check to see if the cursor is approaching buffer limit TableItem item = fTableCursor.getRow(); - if (item == null) + if (item == null) { return; + } if (getMemoryBlock() instanceof IMemoryBlockExtension) { @@ -1296,8 +1346,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering } private BigInteger getAddressFromTableItem(TableItem row, int col) { - if (row == null) + if (row == null) { return null; + } // get row address String temp = ((TableRenderingLine)row.getData()).getAddress(); @@ -1326,12 +1377,14 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering */ private boolean setCursorAtAddress(BigInteger address) { - if (fContentProvider.getBufferTopAddress() == null) + if (fContentProvider.getBufferTopAddress() == null) { return false; + } // selected address is out of range, simply return false - if (address.compareTo(fContentProvider.getBufferTopAddress()) < 0) + if (address.compareTo(fContentProvider.getBufferTopAddress()) < 0) { return false; + } // calculate selected row address int addressableUnit = getAddressableUnitPerLine(); @@ -1353,8 +1406,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering int colAddressableUnit = getAddressableUnitPerColumn(); int col = ((offset.intValue()/colAddressableUnit)+1); - if (col == 0) + if (col == 0) { col = 1; + } fTableCursor.setSelection(row, col); @@ -1370,6 +1424,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering * @return true if format is successful, false, otherwise * */ + @Override public boolean format(int bytesPerLine, int columnSize) { @@ -1398,17 +1453,20 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering fColumnSize = columnSize; Object evtLockClient = new Object(); - if (!fEvtHandleLock.acquireLock(evtLockClient)) + if (!fEvtHandleLock.acquireLock(evtLockClient)) { return false; + } // if the tab is already created and is being reformatted if (fIsCreated) { - if (fTableViewer == null) + if (fTableViewer == null) { return false; + } - if (fTableViewer.getTable() == null) + if (fTableViewer.getTable() == null) { return false; + } // clean up old columns TableColumn[] oldColumns = fTableViewer.getTable().getColumns(); @@ -1441,8 +1499,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering } // check that column labels are not null - if (columnLabels == null) + if (columnLabels == null) { columnLabels = new String[0]; + } for (int i=0;i<byteColumns.length; i++) { @@ -1520,12 +1579,14 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering // for Linux GTK, this must happen after table viewer is refreshed int i = findAddressIndex(fTopRowAddress); - if (i >= 0) + if (i >= 0) { setTopIndex(fTableViewer.getTable(), i); + } - if (isAddressVisible(selectedAddress)) + if (isAddressVisible(selectedAddress)) { // after refresh, make sure the cursor is at the correct position - setCursorAtAddress(selectedAddress); + setCursorAtAddress(selectedAddress); + } } fEvtHandleLock.releaseLock(evtLockClient); @@ -1572,8 +1633,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering styleText = fTextViewer.getTextWidget(); - if (styleText != null) + if (styleText != null) { styleText.setText(DebugUIMessages.AbstractTableRendering_3 + e.getMessage()); + } fPageBook.showPage(fTextViewer.getControl()); // clear content cache if we need to display error @@ -1593,6 +1655,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRendering#getControl() */ + @Override public Control getControl() { return fPageBook; } @@ -1602,6 +1665,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering * * @return the addressable size of this rendering's memory block in bytes */ + @Override public int getAddressableSize() { return fAddressableSize; } @@ -1610,8 +1674,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering { IMemoryRenderingSynchronizationService syncService = getMemoryRenderingContainer().getMemoryRenderingSite().getSynchronizationService(); - if (syncService == null) + if (syncService == null) { return null; + } return syncService.getProperty(getMemoryBlock(), propertyId); } @@ -1623,8 +1688,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering */ private int getNumberOfVisibleLines() { - if(fTableViewer == null) + if(fTableViewer == null) { return -1; + } Table table = fTableViewer.getTable(); int height = fTableViewer.getTable().getSize().y; @@ -1677,8 +1743,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering { IMemoryRenderingSynchronizationService syncService = getMemoryRenderingContainer().getMemoryRenderingSite().getSynchronizationService(); - if (syncService == null) + if (syncService == null) { return; + } syncService.addPropertyChangeListener(this, null); @@ -1686,8 +1753,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering // do not update sync property in this case if (!isDisplayingError()) { - if (syncService.getSynchronizationProvider() == null) + if (syncService.getSynchronizationProvider() == null) { syncService.setSynchronizationProvider(this); + } // check if there is already synchronization info available Object selectedAddress =getSynchronizedProperty( AbstractTableRendering.PROPERTY_SELECTED_ADDRESS); @@ -1698,8 +1766,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering if (!isDynamicLoad()) { Object pageStartAddress = getSynchronizedProperty(IInternalDebugUIConstants.PROPERTY_PAGE_START_ADDRESS); - if (pageStartAddress == null) + if (pageStartAddress == null) { updateSyncPageStartAddress(); + } } // if info is available, some other view tab has already been @@ -1733,8 +1802,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering BigInteger pageStart = (BigInteger)getSynchronizedProperty(IInternalDebugUIConstants.PROPERTY_PAGE_START_ADDRESS); if (pageStart != null && fContentInput != null && fContentInput.getLoadAddress() != null) { - if (!fContentInput.getLoadAddress().equals(pageStart)) + if (!fContentInput.getLoadAddress().equals(pageStart)) { handlePageStartAddressChanged(pageStart); + } } else if (pageStart != null) { @@ -1781,6 +1851,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering /** * Resize column to the preferred size. */ + @Override public void resizeColumnsToPreferredSize() { // pack columns Table table = fTableViewer.getTable(); @@ -1802,8 +1873,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering */ private void updateSyncSelectedAddress() { - if (!fIsCreated) + if (!fIsCreated) { return; + } PropertyChangeEvent event = new PropertyChangeEvent(this, AbstractTableRendering.PROPERTY_SELECTED_ADDRESS, null, fSelectedAddress); firePropertyChangedEvent(event); } @@ -1813,8 +1885,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering */ private void updateSyncColSize() { - if (!fIsCreated) + if (!fIsCreated) { return; + } PropertyChangeEvent event = new PropertyChangeEvent(this, AbstractTableRendering.PROPERTY_COL_SIZE, null, new Integer(fColumnSize)); firePropertyChangedEvent(event); @@ -1825,8 +1898,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering */ private void updateSyncRowSize() { - if (!fIsCreated) + if (!fIsCreated) { return; + } PropertyChangeEvent event = new PropertyChangeEvent(this, AbstractTableRendering.PROPERTY_ROW_SIZE, null, new Integer(fBytePerLine)); firePropertyChangedEvent(event); @@ -1837,8 +1911,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering */ private void updateSyncTopAddress() { - if (!fIsCreated) + if (!fIsCreated) { return; + } PropertyChangeEvent event = new PropertyChangeEvent(this, AbstractTableRendering.PROPERTY_TOP_ADDRESS, null, fTopRowAddress); firePropertyChangedEvent(event); @@ -1846,11 +1921,13 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering private void updateSyncPageStartAddress() { - if (!fIsCreated) + if (!fIsCreated) { return; + } - if (isBaseAddressChanged()) + if (isBaseAddressChanged()) { return; + } BigInteger pageStart; if (isDynamicLoad()) @@ -1910,6 +1987,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering * * @return number of addressable units per row */ + @Override public int getAddressableUnitPerLine() { return fBytePerLine / getAddressableSize(); } @@ -1919,6 +1997,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering * * @return number of addressable units per column */ + @Override public int getAddressableUnitPerColumn() { return fColumnSize / getAddressableSize(); } @@ -1928,6 +2007,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering * * @return the number of bytes displayed in a single column cell */ + @Override public int getBytesPerColumn() { return fColumnSize; @@ -1938,6 +2018,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering * * @return the number of bytes displayed in a row */ + @Override public int getBytesPerLine() { return fBytePerLine; @@ -1946,6 +2027,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering /** * Updates labels of this rendering. */ + @Override public void updateLabels() { // update tab labels @@ -1964,9 +2046,11 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering * * @return label of this rendering */ + @Override public String getLabel() { - if (fLabel == null) + if (fLabel == null) { fLabel = buildLabel(true); + } return fLabel; } @@ -1996,7 +2080,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering } if (label.startsWith("&")) //$NON-NLS-1$ + { label = "&" + label; //$NON-NLS-1$ + } try { if (showAddress && ((IMemoryBlockExtension)getMemoryBlock()).getBigBaseAddress() != null) @@ -2017,7 +2103,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering String preName = DebugUITools.getMemoryRenderingManager().getRenderingType(getRenderingId()).getLabel(); if (preName != null) + { label += " <" + preName + ">"; //$NON-NLS-1$ //$NON-NLS-2$ + } return decorateLabel(label); } @@ -2033,8 +2121,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering } // check that column labels returned are not null - if (columnLabels == null) + if (columnLabels == null) { columnLabels = new String[0]; + } int numByteColumns = fBytePerLine/fColumnSize; @@ -2071,6 +2160,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering * Refresh the table viewer with the current top visible address. * Update labels in the memory rendering. */ + @Override public void refresh() { // refresh at start address of this memory block @@ -2112,10 +2202,11 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering else { // reload at top of table - if (isDynamicLoad()) + if (isDynamicLoad()) { address = getTopVisibleAddress(); - else + } else { address = fContentInput.getLoadAddress(); + } reloadTable(address, true); } } catch (DebugException e) { @@ -2132,18 +2223,20 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering synchronized private void reloadTable(BigInteger topAddress, boolean updateDelta){ - if (fTableViewer == null) + if (fTableViewer == null) { return; + } try { Table table = (Table)fTableViewer.getControl(); TableRenderingContentInput input; - if (isDynamicLoad()) + if (isDynamicLoad()) { input = new TableRenderingContentInput(this, fPreBuffer, fPostBuffer, topAddress, getNumberOfVisibleLines(), updateDelta, null); - else + } else { input = new TableRenderingContentInput(this, fContentInput.getPreBuffer(), fContentInput.getPostBuffer(), topAddress, fPageSize, updateDelta, null); + } fContentInput = input; fTableViewer.setInput(fContentInput); @@ -2161,8 +2254,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering } // cursor needs to be refreshed after reload - if (isAddressVisible(fSelectedAddress)) + if (isAddressVisible(fSelectedAddress)) { setCursorAtAddress(fSelectedAddress); + } } else { @@ -2184,8 +2278,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering private BigInteger getTopVisibleAddress() { - if (fTableViewer == null) + if (fTableViewer == null) { return BigInteger.valueOf(0); + } Table table = fTableViewer.getTable(); int topIndex = getTopVisibleIndex(table); @@ -2276,20 +2371,24 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRendering#dispose() */ + @Override public void dispose() { try { // prevent rendering from being disposed again - if (fIsDisposed) + if (fIsDisposed) { return; + } fIsDisposed = true; - if (fContentProvider != null) + if (fContentProvider != null) { fContentProvider.dispose(); + } ScrollBar scroll = ((Table)fTableViewer.getControl()).getVerticalBar(); - if (scroll != null && !scroll.isDisposed()) + if (scroll != null && !scroll.isDisposed()) { scroll.removeSelectionListener(fScrollbarSelectionListener); + } if (!fTableCursor.isDisposed()) { @@ -2315,8 +2414,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering // remove the view tab from the synchronizer IMemoryRenderingSynchronizationService syncService = getMemoryRenderingContainer().getMemoryRenderingSite().getSynchronizationService(); - if (syncService != null) + if (syncService != null) { syncService.removePropertyChangeListener(this); + } DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this); @@ -2371,12 +2471,14 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering * @param address address to position cursor at * @throws DebugException if an exception occurs */ + @Override public void goToAddress(BigInteger address) throws DebugException { Object evtLockClient = new Object(); try { - if (!fEvtHandleLock.acquireLock(evtLockClient)) + if (!fEvtHandleLock.acquireLock(evtLockClient)) { return; + } // if address is within the range, highlight if (!isAddressOutOfRange(address)) @@ -2468,8 +2570,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering { // if view tab is not yet created // cursor should always be visible - if (!fIsCreated) + if (!fIsCreated) { return true; + } BigInteger topVisible = getTopVisibleAddress(); int addressableUnit = getAddressableUnitPerLine(); @@ -2513,8 +2616,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering Object evtLockClient = new Object(); try { - if (fIsDisposed) + if (fIsDisposed) { return; + } BigInteger address = getTopVisibleAddress(); @@ -2524,8 +2628,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering updateSyncTopAddress(); } - if (!fEvtHandleLock.acquireLock(evtLockClient)) + if (!fEvtHandleLock.acquireLock(evtLockClient)) { return; + } if (getMemoryBlock() instanceof IMemoryBlockExtension) { @@ -2551,8 +2656,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering else if (getBufferThreshold(BUFFER_END) != 0 && (numInBuffer-(index+getNumberOfVisibleLines())) <= getBufferThreshold(BUFFER_END)) { - if (!isAtBottomLimit() && getBufferThreshold(BUFFER_END) > 0) + if (!isAtBottomLimit() && getBufferThreshold(BUFFER_END) > 0) { reloadTable(address, false); + } } } else @@ -2562,10 +2668,11 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering } } - if (isAddressVisible(fSelectedAddress)) + if (isAddressVisible(fSelectedAddress)) { fTableCursor.setVisible(true); - else + } else { fTableCursor.setVisible(false); + } } } finally @@ -2583,8 +2690,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering BigInteger startBufferAddress = fContentProvider.getBufferTopAddress(); startBufferAddress = MemoryViewUtil.alignToBoundary(startBufferAddress, getAddressableUnitPerLine()); - if (startAddress.compareTo(startBufferAddress) == 0) + if (startAddress.compareTo(startBufferAddress) == 0) { return true; + } return false; } @@ -2597,8 +2705,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering BigInteger endBufferAddress = fContentProvider.getBufferEndAddress(); endBufferAddress = MemoryViewUtil.alignToBoundary(endBufferAddress, getAddressableUnitPerLine()); - if (endAddress.compareTo(endBufferAddress) == 0) + if (endAddress.compareTo(endBufferAddress) == 0) { return true; + } return false; } @@ -2611,8 +2720,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering TableItem firstItem = table.getItem(0); TableItem lastItem = table.getItem(table.getItemCount()-1); - if (firstItem == null || lastItem == null) + if (firstItem == null || lastItem == null) { return true; + } TableRenderingLine first = (TableRenderingLine)firstItem.getData(); TableRenderingLine last = (TableRenderingLine) lastItem.getData(); @@ -2640,16 +2750,18 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering BigInteger numTopLine = topVisibleAddress.subtract(startAddress).divide(BigInteger.valueOf(addressableUnit)); if (numTopLine.compareTo(BigInteger.valueOf(getBufferThreshold(BUFFER_START))) <= 0 && (startAddress.compareTo(BigInteger.valueOf(0)) != 0)) { - if (!isAtTopLimit() && getBufferThreshold(BUFFER_START) > 0) + if (!isAtTopLimit() && getBufferThreshold(BUFFER_START) > 0) { return true; + } } // if there are only 3 lines left at the bottom, refresh BigInteger numBottomLine = lastAddress.subtract(lastVisibleAddrss).divide(BigInteger.valueOf(addressableUnit)); if (numBottomLine.compareTo(BigInteger.valueOf(getBufferThreshold(BUFFER_END))) <= 0) { - if (!isAtBottomLimit() && getBufferThreshold(BUFFER_END) > 0) + if (!isAtBottomLimit() && getBufferThreshold(BUFFER_END) > 0) { return true; + } } return false; @@ -2681,8 +2793,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering } // if column position cannot be determined, return - if (colNum < 1) + if (colNum < 1) { return; + } // handle user mouse click onto table // move cursor to new position @@ -2706,10 +2819,12 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering */ private void columnSizeChanged(final int newColumnSize) { // ignore event if view tab is disabled - if (!isVisible()) + if (!isVisible()) { return; + } Display.getDefault().asyncExec(new Runnable() { + @Override public void run() { format(getBytesPerLine(), newColumnSize); } @@ -2722,17 +2837,20 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering private void rowSizeChanged(final int newRowSize) { // ignore event if view tab is disabled - if (!isVisible()) + if (!isVisible()) { return; + } int bytesPerLine = newRowSize; int col = getBytesPerColumn(); - if (bytesPerLine < getBytesPerColumn()) + if (bytesPerLine < getBytesPerColumn()) { col = bytesPerLine; + } final int columnSize = col; final int rowSize = bytesPerLine; Display.getDefault().asyncExec(new Runnable() { + @Override public void run() { format(rowSize, columnSize); } @@ -2743,8 +2861,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering if (e.button == 1) { int col = fTableCursor.getColumn(); - if (col > 0 && col <= (getNumCol())) + if (col > 0 && col <= (getNumCol())) { activateCellEditor(null); + } } } @@ -2758,8 +2877,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering int col = fTableCursor.getColumn(); int row = findAddressIndex(fSelectedAddress); - if (row < 0) + if (row < 0) { return; + } // do not allow user to edit address column if (col == 0 || col > getNumCol()) { @@ -2790,8 +2910,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering boolean canEdit = cellModifier.canModify(element, (String)property); ((TableRenderingCellModifier)cellModifier).setEditActionInvoked(false); - if (!canEdit) + if (!canEdit) { return; + } // activate based on current cursor position TextCellEditor selectedEditor = (TextCellEditor)fTableViewer.getCellEditors()[col]; @@ -2844,6 +2965,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering */ private void addListeners(Text text) { fEditorFocusListener = new FocusAdapter() { + @Override public void focusLost(FocusEvent e) { handleTableEditorFocusLost(e); @@ -2852,6 +2974,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering text.addFocusListener(fEditorFocusListener); fEditorKeyListener = new KeyAdapter() { + @Override public void keyPressed(KeyEvent e) { handleKeyEventInEditor(e); } @@ -2875,6 +2998,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering Display.getDefault().syncExec(new Runnable() { + @Override public void run() { try @@ -2913,6 +3037,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering final KeyEvent e = event; Display.getDefault().asyncExec(new Runnable() { + @Override public void run() { Text text = (Text)e.getSource(); @@ -2926,8 +3051,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering case SWT.ARROW_UP : // move text editor box up one row - if (row-1 < 0) + if (row-1 < 0) { return; + } // modify value for current cell modifyValue(row, col, text.getText()); @@ -2946,8 +3072,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering // move text editor box down one row - if (row+1 >= fTableViewer.getTable().getItemCount()) + if (row+1 >= fTableViewer.getTable().getItemCount()) { return; + } // modify value for current cell modifyValue(row, col, text.getText()); @@ -3081,6 +3208,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRendering#becomesHidden() */ + @Override public void becomesHidden() { if (isVisible() == false) @@ -3107,6 +3235,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IMemoryRendering#becomesVisible() */ + @Override public void becomesVisible() { // do not do anything if already visible @@ -3120,11 +3249,12 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering super.becomesVisible(); boolean value = DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IDebugPreferenceConstants.PREF_DYNAMIC_LOAD_MEM); - if (value != isDynamicLoad()) + if (value != isDynamicLoad()) { // this call will cause a reload handleDyanicLoadChanged(); - else + } else { refresh(); + } synchronize(); updateRenderingLabel(true); @@ -3138,6 +3268,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering * * @deprecated use <code>resetRendering</code> to reset this rendering. */ + @Deprecated public void reset() { try { @@ -3176,6 +3307,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering * * @return the currently selected address in this rendering */ + @Override public BigInteger getSelectedAddress() { return fSelectedAddress; } @@ -3185,10 +3317,12 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering * * @return the currently selected content in this rendering */ + @Override public String getSelectedAsString() { - if (isAddressOutOfRange(fSelectedAddress)) + if (isAddressOutOfRange(fSelectedAddress)) { return IInternalDebugCoreConstants.EMPTY_STRING; + } int col = fTableCursor.getColumn(); TableItem rowItem = fTableCursor.getRow(); @@ -3216,10 +3350,12 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering * @return the currently selected content in array of MemoryByte. * Returns an empty array if the selected address is out of buffered range. */ + @Override public MemoryByte[] getSelectedAsBytes() { - if (isAddressOutOfRange(fSelectedAddress)) + if (isAddressOutOfRange(fSelectedAddress)) { return new MemoryByte[0]; + } int col = fTableCursor.getColumn(); TableItem rowItem = fTableCursor.getRow(); @@ -3231,8 +3367,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering } Object data = rowItem.getData(); - if (data == null || !(data instanceof TableRenderingLine)) + if (data == null || !(data instanceof TableRenderingLine)) { return new MemoryByte[0]; + } TableRenderingLine line = (TableRenderingLine)data; int offset = (col-1)*(getAddressableUnitPerColumn()*getAddressableSize()); @@ -3255,6 +3392,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering * @return the number of characters a byte will convert to * or -1 if unknown */ + @Override public int getNumCharsPerByte() { return -1; @@ -3288,37 +3426,46 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering /* (non-Javadoc) * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) */ + @Override public Object getAdapter(Class adapter) { - if (adapter == IColorProvider.class) + if (adapter == IColorProvider.class) { return getColorProviderAdapter(); + } - if (adapter == ILabelProvider.class) + if (adapter == ILabelProvider.class) { return getLabelProviderAdapter(); + } - if (adapter == IFontProvider.class) + if (adapter == IFontProvider.class) { return getFontProviderAdapter(); + } - if (adapter == IMemoryBlockTablePresentation.class) + if (adapter == IMemoryBlockTablePresentation.class) { return getTablePresentationAdapter(); + } if (adapter == IWorkbenchAdapter.class) { // needed workbench adapter to fill the title of property page if (fWorkbenchAdapter == null) { fWorkbenchAdapter = new IWorkbenchAdapter() { + @Override public Object[] getChildren(Object o) { return new Object[0]; } + @Override public ImageDescriptor getImageDescriptor(Object object) { return null; } + @Override public String getLabel(Object o) { return AbstractTableRendering.this.getLabel(); } + @Override public Object getParent(Object o) { return null; } @@ -3330,6 +3477,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering if (adapter == IMemoryBlockConnection.class) { if (fConnection == null) { fConnection = new IMemoryBlockConnection() { + @Override public void update() { try { fContentProvider.takeContentSnapshot(); @@ -3346,13 +3494,14 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering fContentInput.setLoadAddress(address); } fContentProvider.loadContentForExtendedMemoryBlock(); - } - else + } else { fContentProvider.loadContentForSimpleMemoryBlock(); + } // update UI asynchronously Display display = DebugUIPlugin.getDefault().getWorkbench().getDisplay(); display.asyncExec(new Runnable() { + @Override public void run() { updateLabels(); @@ -3375,8 +3524,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering fTableCursor.setVisible(false); } - if (!isDynamicLoad()) + if (!isDynamicLoad()) { updateSyncPageStartAddress(); + } updateSyncTopAddress(); } @@ -3397,8 +3547,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering { if (getFontProviderAdapter() == null && getColorProviderAdapter() == null && - getLabelProviderAdapter() == null) + getLabelProviderAdapter() == null) { return false; + } return true; } @@ -3411,8 +3562,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering BigInteger baseAddress = ((IMemoryBlockExtension)mb).getBigBaseAddress(); if (baseAddress != null) { - if (!baseAddress.equals(fContentInput.getContentBaseAddress())) + if (!baseAddress.equals(fContentInput.getContentBaseAddress())) { return true; + } } } } catch (DebugException e1) { @@ -3529,23 +3681,28 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering private TableItem fTooltipItem = null; private int fCol = -1; + @Override public void mouseExit(MouseEvent e){ - if (!fToolTipShell.isDisposed()) + if (!fToolTipShell.isDisposed()) { fToolTipShell.setVisible(false); + } fTooltipItem = null; } + @Override public void mouseHover(MouseEvent e){ Point hoverPoint = new Point(e.x, e.y); Control control = null; - if (e.widget instanceof Control) + if (e.widget instanceof Control) { control = (Control)e.widget; + } - if (control == null) + if (control == null) { return; + } hoverPoint = control.toDisplay(hoverPoint); TableItem item = getItem(hoverPoint); @@ -3599,8 +3756,9 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering start = fTableViewer.getTable().toDisplay(start); Point end = new Point(start.x + items[i].getBounds(0).width, start.y + items[i].getBounds(0).height); - if (start.y < point.y && point.y < end.y) + if (start.y < point.y && point.y < end.y) { return items[i]; + } } return null; } @@ -3652,6 +3810,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.IResettableMemoryRendering#resetRendering() */ + @Override public void resetRendering() throws DebugException { resetToBaseAddress(); } @@ -3686,14 +3845,16 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering String str = getToolTipText(address, bytes); - if (str != null) + if (str != null) { ((Label) toolTipControl).setText(str); + } } else { String str = getToolTipText(address, new MemoryByte[] {}); - if (str != null) + if (str != null) { ((Label) toolTipControl).setText(str); + } } } } @@ -3767,13 +3928,15 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering { if (startOrEnd == BUFFER_START) { - if (BUFFER_THRESHOLD > fPreBuffer) + if (BUFFER_THRESHOLD > fPreBuffer) { return fPreBuffer; + } return BUFFER_THRESHOLD; } - if (BUFFER_THRESHOLD > fPostBuffer) + if (BUFFER_THRESHOLD > fPostBuffer) { return fPostBuffer; + } return BUFFER_THRESHOLD; } @@ -3791,6 +3954,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering * Returns a string to pad the cell if the memory cannot be converted * successfully. */ + @Override abstract public String getString(String renderingTypeId, BigInteger address, MemoryByte[] data); /** @@ -3807,6 +3971,7 @@ public abstract class AbstractTableRendering extends AbstractBaseTableRendering * @param newValue the string to be converted to bytes * @return the bytes converted from a string */ + @Override abstract public byte[] getBytes(String renderingTypeId, BigInteger address, MemoryByte[] currentValues, String newValue); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTextRendering.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTextRendering.java index 97c7fbb70..fc5758bd8 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTextRendering.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/memory/AbstractTextRendering.java @@ -84,6 +84,7 @@ abstract public class AbstractTextRendering extends AbstractTableRendering { /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.AbstractTableRendering#getString(java.lang.String, java.math.BigInteger, org.eclipse.debug.core.model.MemoryByte[]) */ + @Override public String getString(String dataType, BigInteger address, MemoryByte[] data) { try { String paddedStr = DebugUIPlugin.getDefault().getPreferenceStore().getString(IDebugUIConstants.PREF_PADDED_STR); @@ -127,6 +128,7 @@ abstract public class AbstractTextRendering extends AbstractTableRendering { /* (non-Javadoc) * @see org.eclipse.debug.ui.memory.AbstractTableRendering#getBytes(java.lang.String, java.math.BigInteger, org.eclipse.debug.core.model.MemoryByte[], java.lang.String) */ + @Override public byte[] getBytes(String dataType, BigInteger address, MemoryByte[] currentValues, String data) { try { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/AbstractSourceContainerBrowser.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/AbstractSourceContainerBrowser.java index 6a7a19fc6..2473d0717 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/AbstractSourceContainerBrowser.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/AbstractSourceContainerBrowser.java @@ -26,6 +26,7 @@ public class AbstractSourceContainerBrowser implements ISourceContainerBrowser { /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.sourcelookup.ISourceContainerBrowser#addSourceContainers(org.eclipse.swt.widgets.Shell, org.eclipse.debug.core.sourcelookup.ISourceLookupDirector) */ + @Override public ISourceContainer[] addSourceContainers(Shell shell, ISourceLookupDirector director) { return new ISourceContainer[0]; } @@ -36,12 +37,14 @@ public class AbstractSourceContainerBrowser implements ISourceContainerBrowser { * * @see org.eclipse.debug.internal.ui.sourcelookup.ISourceContainerBrowser#canAddSourceContainers(org.eclipse.debug.core.sourcelookup.ISourceLookupDirector) */ + @Override public boolean canAddSourceContainers(ISourceLookupDirector director) { return true; } /* (non-Javadoc) * @see org.eclipse.debug.internal.ui.sourcelookup.ISourceContainerBrowser#editSourceContainers(org.eclipse.swt.widgets.Shell, org.eclipse.debug.core.sourcelookup.ISourceLookupDirector, org.eclipse.debug.core.sourcelookup.ISourceContainer[]) */ + @Override public ISourceContainer[] editSourceContainers(Shell shell, ISourceLookupDirector director, ISourceContainer[] containers) { return new ISourceContainer[0]; } @@ -52,6 +55,7 @@ public class AbstractSourceContainerBrowser implements ISourceContainerBrowser { * * @see org.eclipse.debug.internal.ui.sourcelookup.ISourceContainerBrowser#canEditSourceContainers(org.eclipse.debug.core.sourcelookup.ISourceLookupDirector, org.eclipse.debug.core.sourcelookup.ISourceContainer[]) */ + @Override public boolean canEditSourceContainers(ISourceLookupDirector director, ISourceContainer[] containers) { return false; } diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java index 5eb24d2fb..36ef02631 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditor.java @@ -75,18 +75,21 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE /* (non-Javadoc) * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor) */ + @Override public void doSave(IProgressMonitor monitor) { } /* (non-Javadoc) * @see org.eclipse.ui.part.EditorPart#doSaveAs() */ + @Override public void doSaveAs() { } /* (non-Javadoc) * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput) */ + @Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { setSite(site); setInput(input); @@ -96,6 +99,7 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE /* (non-Javadoc) * @see org.eclipse.ui.part.EditorPart#isDirty() */ + @Override public boolean isDirty() { return false; } @@ -103,6 +107,7 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE /* (non-Javadoc) * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed() */ + @Override public boolean isSaveAsAllowed() { return false; } @@ -110,6 +115,7 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE /* (non-Javadoc) * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) */ + @Override public void createPartControl(Composite parent) { GridLayout topLayout = new GridLayout(); GridData data = new GridData(); @@ -150,6 +156,7 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE button.setLayoutData(data); button.setText(SourceLookupUIMessages.addSourceLocation_addButton2); button.addSelectionListener(new SelectionAdapter() { + @Override public void widgetSelected(SelectionEvent evt) { editSourceLookupPath(); } @@ -199,6 +206,7 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE /* (non-Javadoc) * @see org.eclipse.ui.part.WorkbenchPart#setFocus() */ + @Override public void setFocus() { if (fText != null) { fText.setFocus(); @@ -208,6 +216,7 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE /* (non-Javadoc) * @see org.eclipse.ui.part.EditorPart#setInput(org.eclipse.ui.IEditorInput) */ + @Override public void setInput(IEditorInput input) { super.setInput(input); setPartName(input.getName()); @@ -234,6 +243,7 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE { final IEditorPart editor = this; DebugUIPlugin.getStandardDisplay().syncExec(new Runnable() { + @Override public void run() { IWorkbenchWindow activeWorkbenchWindow = DebugUIPlugin.getActiveWorkbenchWindow(); if (activeWorkbenchWindow != null) { @@ -252,6 +262,7 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE * * @see org.eclipse.ui.IWorkbenchPart#dispose() */ + @Override public void dispose() { if (fLaunchesListener != null) DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(fLaunchesListener); @@ -282,6 +293,7 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE protected void initialize() { fLaunchesListener = new ILaunchesListener2() { + @Override public void launchesTerminated(ILaunch[] launches) { Object artifact = getArtifact(); if (artifact instanceof IDebugElement) { @@ -296,13 +308,16 @@ public class CommonSourceNotFoundEditor extends EditorPart implements IReusableE } } + @Override public void launchesRemoved(ILaunch[] launches) { launchesTerminated(launches); } + @Override public void launchesAdded(ILaunch[] launches) { } + @Override public void launchesChanged(ILaunch[] launches) { }}; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditorInput.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditorInput.java index 1dc8eed64..4529315d2 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditorInput.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/CommonSourceNotFoundEditorInput.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2007 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 @@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.debug.ui.sourcelookup; -import com.ibm.icu.text.MessageFormat; - import org.eclipse.core.runtime.PlatformObject; import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupUIMessages; @@ -21,6 +19,8 @@ import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IPersistableElement; +import com.ibm.icu.text.MessageFormat; + /** * Editor input for the <code>CommonSourceNotFoundEditor</code>. The editor * input can be created on an artifact that has a source association. @@ -61,6 +61,7 @@ public class CommonSourceNotFoundEditorInput extends PlatformObject implements I /* (non-Javadoc) * @see org.eclipse.ui.IEditorInput#exists() */ + @Override public boolean exists() { return false; } @@ -68,6 +69,7 @@ public class CommonSourceNotFoundEditorInput extends PlatformObject implements I /* (non-Javadoc) * @see org.eclipse.ui.IEditorInput#getImageDescriptor() */ + @Override public ImageDescriptor getImageDescriptor() { return DebugUITools.getDefaultImageDescriptor(fArtifact); } @@ -75,6 +77,7 @@ public class CommonSourceNotFoundEditorInput extends PlatformObject implements I /* (non-Javadoc) * @see org.eclipse.ui.IEditorInput#getName() */ + @Override public String getName() { return fLabel; } @@ -82,6 +85,7 @@ public class CommonSourceNotFoundEditorInput extends PlatformObject implements I /* (non-Javadoc) * @see org.eclipse.ui.IEditorInput#getPersistable() */ + @Override public IPersistableElement getPersistable() { return null; } @@ -89,8 +93,9 @@ public class CommonSourceNotFoundEditorInput extends PlatformObject implements I /* (non-Javadoc) * @see org.eclipse.ui.IEditorInput#getToolTipText() */ + @Override public String getToolTipText() { - return MessageFormat.format(SourceLookupUIMessages.addSourceLocation_editorMessage, new String[] { fLabel }); + return MessageFormat.format(SourceLookupUIMessages.addSourceLocation_editorMessage, new Object[] { fLabel }); } /** diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupDialog.java index 7aa5cc772..4cc9f57b8 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupDialog.java @@ -65,6 +65,7 @@ public class SourceLookupDialog extends TitleAreaDialog { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ + @Override protected Control createDialogArea(Composite parent) { // create a composite with standard margins and spacing setTitle(SourceLookupUIMessages.manageSourceDialog_description); @@ -101,6 +102,7 @@ public class SourceLookupDialog extends TitleAreaDialog { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.Dialog#okPressed() */ + @Override protected void okPressed() { ILaunchConfiguration config = fDirector.getLaunchConfiguration(); ILaunchConfigurationWorkingCopy copy = null; @@ -118,6 +120,7 @@ public class SourceLookupDialog extends TitleAreaDialog { /* (non-Javadoc) * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) */ + @Override protected void configureShell(Shell shell) { super.configureShell(shell); shell.setText(SourceLookupUIMessages.manageSourceDialog_title); @@ -126,6 +129,7 @@ public class SourceLookupDialog extends TitleAreaDialog { /* (non-Javadoc) * @see org.eclipse.jface.window.Window#close() */ + @Override public boolean close() { fPanel.dispose(); return super.close(); @@ -135,7 +139,8 @@ public class SourceLookupDialog extends TitleAreaDialog { * @see org.eclipse.jface.dialogs.Dialog#getDialogBoundsSettings() * @since 3.2 */ - protected IDialogSettings getDialogBoundsSettings() { + @Override + protected IDialogSettings getDialogBoundsSettings() { IDialogSettings settings = DebugUIPlugin.getDefault().getDialogSettings(); IDialogSettings section = settings.getSection(getClass().getName()); if (section == null) { diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupTab.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupTab.java index 26cb0af2a..af2f4edd6 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupTab.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/SourceLookupTab.java @@ -56,6 +56,7 @@ public class SourceLookupTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite) */ + @Override public void createControl(Composite parent) { Composite comp = new Composite(parent, SWT.NONE); setControl(comp); @@ -80,6 +81,7 @@ public class SourceLookupTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { } @@ -87,6 +89,7 @@ public class SourceLookupTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) */ + @Override public void initializeFrom(ILaunchConfiguration configuration) { fSourceLookupPanel.initializeFrom(configuration); } @@ -94,6 +97,7 @@ public class SourceLookupTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void performApply(ILaunchConfigurationWorkingCopy configuration) { fSourceLookupPanel.performApply(configuration); } @@ -101,6 +105,7 @@ public class SourceLookupTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getId() */ + @Override public String getId() { return "org.eclipse.debug.ui.sourceLookupTab"; //$NON-NLS-1$ } @@ -108,6 +113,7 @@ public class SourceLookupTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() */ + @Override public String getName() { return SourceLookupUIMessages.sourceTab_tabTitle; } @@ -115,6 +121,7 @@ public class SourceLookupTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage() */ + @Override public Image getImage() { return DebugPluginImages.getImage(IInternalDebugUIConstants.IMG_SRC_LOOKUP_TAB); } @@ -122,6 +129,7 @@ public class SourceLookupTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy) */ + @Override public void activated(ILaunchConfigurationWorkingCopy workingCopy) { fSourceLookupPanel.activated(workingCopy); } @@ -129,6 +137,7 @@ public class SourceLookupTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose() */ + @Override public void dispose() { if (fSourceLookupPanel != null) { if (fSourceLookupPanel.getDirector() != null) { @@ -143,6 +152,7 @@ public class SourceLookupTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getErrorMessage() */ + @Override public String getErrorMessage() { if (fSourceLookupPanel != null) { return fSourceLookupPanel.getErrorMessage(); @@ -152,6 +162,7 @@ public class SourceLookupTab extends AbstractLaunchConfigurationTab { /* (non-Javadoc) * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getMessage() */ + @Override public String getMessage() { if (fSourceLookupPanel != null) { return fSourceLookupPanel.getMessage(); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/WorkingSetSourceContainer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/WorkingSetSourceContainer.java index 5f8d0f05f..62ada047d 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/WorkingSetSourceContainer.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/sourcelookup/WorkingSetSourceContainer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2008 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 @@ -11,6 +11,7 @@ package org.eclipse.debug.ui.sourcelookup; import java.util.ArrayList; + import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; @@ -53,6 +54,7 @@ public class WorkingSetSourceContainer extends CompositeSourceContainer{ /* (non-Javadoc) * @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getName() */ + @Override public String getName() { return fWorkingSet.getName(); } @@ -60,6 +62,7 @@ public class WorkingSetSourceContainer extends CompositeSourceContainer{ /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ + @Override public boolean equals(Object obj) { if (obj != null && obj instanceof WorkingSetSourceContainer) { return ((WorkingSetSourceContainer)obj).fWorkingSet.equals(fWorkingSet); @@ -67,6 +70,7 @@ public class WorkingSetSourceContainer extends CompositeSourceContainer{ return false; } + @Override public int hashCode() { return fWorkingSet.hashCode(); } @@ -74,6 +78,7 @@ public class WorkingSetSourceContainer extends CompositeSourceContainer{ /* (non-Javadoc) * @see org.eclipse.debug.core.sourcelookup.ISourceContainer#getType() */ + @Override public ISourceContainerType getType() { return getSourceContainerType(TYPE_ID); } @@ -81,13 +86,15 @@ public class WorkingSetSourceContainer extends CompositeSourceContainer{ /* (non-Javadoc) * @see org.eclipse.debug.core.sourcelookup.containers.CompositeSourceContainer#createSourceContainers() */ + @Override protected ISourceContainer[] createSourceContainers() throws CoreException { IAdaptable[] elements = fWorkingSet.getElements(); - if(elements == null) + if(elements == null) { return new ISourceContainer[0]; + } - ArrayList locationList = new ArrayList(); + ArrayList<ISourceContainer> locationList = new ArrayList<ISourceContainer>(); for (int i = 0; i < elements.length; i++) { IResource resource = (IResource) elements[i].getAdapter(IResource.class); @@ -100,10 +107,11 @@ public class WorkingSetSourceContainer extends CompositeSourceContainer{ locationList.add(new ProjectSourceContainer((IProject)resource, true)); break; //if the element corresponds to an IFile, do nothing + default: + break; } } } - return (ISourceContainer[])locationList.toArray(new ISourceContainer[locationList.size()]); + return locationList.toArray(new ISourceContainer[locationList.size()]); } - } |