Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/dsf
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-03-23 07:25:24 +0000
committerAlexander Kurtakov2017-03-23 07:25:24 +0000
commit93623a1a041348bd0ccec8b8d3682448d772705d (patch)
treefcb81e5003fc536bac2533d22dbdfe6000d5010a /dsf
parent4d47bff054d6878518127c3be7f0cb9a6f2e2455 (diff)
downloadorg.eclipse.cdt-93623a1a041348bd0ccec8b8d3682448d772705d.tar.gz
org.eclipse.cdt-93623a1a041348bd0ccec8b8d3682448d772705d.tar.xz
org.eclipse.cdt-93623a1a041348bd0ccec8b8d3682448d772705d.zip
Generify ListenerList.
Generified, some lamnda conversions and some non-javadoc removal. Change-Id: Ibf0493917ac3da7531de1ca591a9bfdc250ddf2a Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'dsf')
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java8
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblySelectionProvider.java27
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourceTagProvider.java7
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/contexts/DsfSuspendTrigger.java10
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/DefaultVMModelProxyStrategy.java4
5 files changed, 16 insertions, 40 deletions
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java
index 6f154c67a15..fd166fa323f 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2016 Wind River Systems and others.
+ * Copyright (c) 2007, 2017 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
@@ -251,7 +251,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
private MarkerAnnotationPreferences fAnnotationPreferences;
private IPreferenceStore fPreferenceStore;
private IOverviewRuler fOverviewRuler;
- private final ListenerList fRulerContextMenuListeners= new ListenerList(ListenerList.IDENTITY);
+ private final ListenerList<IMenuListener> fRulerContextMenuListeners= new ListenerList<>(ListenerList.IDENTITY);
private SourceViewerDecorationSupport fDecorationSupport;
private Font fFont;
private IVerticalRuler fVerticalRuler;
@@ -1234,8 +1234,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
addRulerContributionActions(manager);
manager.add(new Separator(ITextEditorActionConstants.GROUP_REST));
- for (Object listener : fRulerContextMenuListeners.getListeners())
- ((IMenuListener) listener).menuAboutToShow(manager);
+ for (IMenuListener listener : fRulerContextMenuListeners)
+ listener.menuAboutToShow(manager);
manager.add(new Separator(ITextEditorActionConstants.GROUP_EDIT));
manager.appendToGroup(ITextEditorActionConstants.GROUP_EDIT, fGlobalActions.get(ITextEditorActionConstants.COPY));
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblySelectionProvider.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblySelectionProvider.java
index ff40d044c7e..a5d629d8182 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblySelectionProvider.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblySelectionProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 Wind River Systems, Inc. and others.
+ * Copyright (c) 2009, 2017 Wind River Systems, Inc. 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
@@ -32,13 +32,8 @@ import org.eclipse.jface.viewers.StructuredSelection;
*/
class DisassemblySelectionProvider implements ISelectionProvider {
- private final ListenerList fListenerList = new ListenerList(ListenerList.IDENTITY);
- private final ISelectionChangedListener fListener = new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- fireSelectionChanged(event);
- }
- };
+ private final ListenerList<ISelectionChangedListener> fListenerList = new ListenerList<>(ListenerList.IDENTITY);
+ private final ISelectionChangedListener fListener = event -> fireSelectionChanged(event);
private final DisassemblyPart fPart;
DisassemblySelectionProvider(DisassemblyPart disassemblyPart) {
@@ -48,24 +43,16 @@ class DisassemblySelectionProvider implements ISelectionProvider {
private void fireSelectionChanged(SelectionChangedEvent event) {
SelectionChangedEvent newEvent = new SelectionChangedEvent(this, getSelection());
- Object[] listeners = fListenerList.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- ISelectionChangedListener listener = (ISelectionChangedListener) listeners[i];
+ for (ISelectionChangedListener listener : fListenerList) {
listener.selectionChanged(newEvent);
}
}
- /*
- * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
@Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
fListenerList.add(listener);
}
- /*
- * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection()
- */
@Override
public ISelection getSelection() {
final ISourceViewer textViewer= fPart.getTextViewer();
@@ -76,17 +63,11 @@ class DisassemblySelectionProvider implements ISelectionProvider {
return StructuredSelection.EMPTY;
}
- /*
- * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
- */
@Override
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
fListenerList.remove(listener);
}
- /*
- * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection)
- */
@Override
public void setSelection(ISelection selection) {
ISelectionProvider provider = fPart.getTextViewer().getSelectionProvider();
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourceTagProvider.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourceTagProvider.java
index 7ed1786dfec..d45a9cf3c97 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourceTagProvider.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/presentation/CSourceTagProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 Wind River Systems and others.
+ * Copyright (c) 2007, 2017 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
@@ -24,7 +24,7 @@ import org.eclipse.core.runtime.ListenerList;
*/
public class CSourceTagProvider implements ISourceTagProvider {
- private ListenerList fListenerList= new ListenerList(ListenerList.IDENTITY);
+ private ListenerList<ISourceTagListener> fListenerList= new ListenerList<>(ListenerList.IDENTITY);
private ITranslationUnit fUnit;
/**
@@ -89,9 +89,6 @@ public class CSourceTagProvider implements ISourceTagProvider {
}
}
- /*
- * @see org.eclipse.cdt.dsf.debug.internal.ui.disassembly.presentation.ISourceTagProvider#removeSourceTagListener(org.eclipse.cdt.dsf.debug.internal.ui.disassembly.presentation.ISourceTagListener)
- */
@Override
public void removeSourceTagListener(ISourceTagListener listener) {
fListenerList.remove(listener);
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/contexts/DsfSuspendTrigger.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/contexts/DsfSuspendTrigger.java
index 89fb7c88c4a..9365a70283c 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/contexts/DsfSuspendTrigger.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/ui/contexts/DsfSuspendTrigger.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 Wind River Systems and others.
+ * Copyright (c) 2008, 2017 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
@@ -58,7 +58,7 @@ public class DsfSuspendTrigger implements ISuspendTrigger {
private final DsfServicesTracker fServicesTracker;
@ThreadSafe
- private final ListenerList fListeners = new ListenerList();
+ private final ListenerList<ISuspendTriggerListener> fListeners = new ListenerList<>();
@ThreadSafe
public DsfSuspendTrigger(DsfSession session, ILaunch launch) {
@@ -192,8 +192,7 @@ public class DsfSuspendTrigger implements ISuspendTrigger {
*/
@ThreadSafe
protected void fireSuspended(final Object context) {
- final Object[] listeners = fListeners.getListeners();
- if (listeners.length != 0) {
+ if (!fListeners.isEmpty()) {
new Job("DSF Suspend Trigger Notify") { //$NON-NLS-1$
{
setSystem(true);
@@ -202,8 +201,7 @@ public class DsfSuspendTrigger implements ISuspendTrigger {
@Override
protected IStatus run(IProgressMonitor monitor) {
final MultiStatus status = new MultiStatus(DsfUIPlugin.PLUGIN_ID, 0, "DSF Suspend Trigger Notify Job Status", null); //$NON-NLS-1$
- for (int i = 0; i < listeners.length; i++) {
- final ISuspendTriggerListener listener = (ISuspendTriggerListener) listeners[i];
+ for (final ISuspendTriggerListener listener : fListeners) {
SafeRunner.run(new ISafeRunnable() {
@Override
public void run() throws Exception {
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/DefaultVMModelProxyStrategy.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/DefaultVMModelProxyStrategy.java
index df27b4bf4a7..ac7371e4aaf 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/DefaultVMModelProxyStrategy.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/ui/viewmodel/DefaultVMModelProxyStrategy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2016 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 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,7 +64,7 @@ public class DefaultVMModelProxyStrategy implements IVMModelProxy {
private IPresentationContext fContext;
private Viewer fViewer;
private boolean fDisposed = false;
- private ListenerList fListeners = new ListenerList();
+ private ListenerList<IModelChangedListener> fListeners = new ListenerList<>();
private IDoubleClickListener fDoubleClickListener;
private boolean fAllowRecursiveVMNodes = false;

Back to the top