Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2016-01-22 07:51:59 -0500
committerSarika Sinha2016-01-22 07:51:59 -0500
commitb11c99ce0d8d77c7d8f4d6a8c42acc95125a05e8 (patch)
treea69936f5c60f2ab82bc922a381764cf483aa80d8 /org.eclipse.debug.core
parenteb152262968725de3dc0014287f621169ba5ca5e (diff)
downloadeclipse.platform.debug-b11c99ce0d8d77c7d8f4d6a8c42acc95125a05e8.tar.gz
eclipse.platform.debug-b11c99ce0d8d77c7d8f4d6a8c42acc95125a05e8.tar.xz
eclipse.platform.debug-b11c99ce0d8d77c7d8f4d6a8c42acc95125a05e8.zip
Bug 486157 - Adapt to ListenerList changesI20160125-0400I20160124-2000
Diffstat (limited to 'org.eclipse.debug.core')
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java36
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java25
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java20
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java33
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java13
5 files changed, 52 insertions, 75 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
index 665ffc876..8ca4c9a77 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
@@ -358,12 +358,12 @@ public class DebugPlugin extends Plugin {
/**
* The collection of debug event listeners.
*/
- private ListenerList fEventListeners = new ListenerList();
+ private ListenerList<IDebugEventSetListener> fEventListeners = new ListenerList<>();
/**
* Event filters, or <code>null</code> if none.
*/
- private ListenerList fEventFilters = new ListenerList();
+ private ListenerList<IDebugEventFilter> fEventFilters = new ListenerList<>();
/**
* Whether this plug-in is in the process of shutting
@@ -920,16 +920,6 @@ public class DebugPlugin extends Plugin {
fShuttingDown = value;
}
- /**
- * Returns the collection of debug event listeners registered
- * with this plug-in.
- *
- * @return list of registered debug event listeners, instances
- * of <code>IDebugEventSetListeners</code>
- */
- private Object[] getEventListeners() {
- return fEventListeners.getListeners();
- }
/**
* Adds the given debug event filter to the registered
@@ -1173,27 +1163,25 @@ public class DebugPlugin extends Plugin {
*/
void dispatch(DebugEvent[] events) {
fEvents = events;
- Object[] filters = fEventFilters.getListeners();
- if (filters.length > 0) {
+ if (!fEventFilters.isEmpty()) {
fMode = NOTIFY_FILTERS;
- for (int i = 0; i < filters.length; i++) {
- fFilter = (IDebugEventFilter)filters[i];
- SafeRunner.run(this);
- if (fEvents == null || fEvents.length == 0) {
- return;
- }
+ }
+ for (IDebugEventFilter iDebugEventFilter : fEventFilters) {
+ fFilter = iDebugEventFilter;
+ SafeRunner.run(this);
+ if (fEvents == null || fEvents.length == 0) {
+ return;
}
}
fMode = NOTIFY_EVENTS;
- Object[] listeners= getEventListeners();
if (DebugOptions.DEBUG_EVENTS) {
for (int i = 0; i < fEvents.length; i++) {
DebugOptions.trace(fEvents[i].toString());
}
}
- for (int i= 0; i < listeners.length; i++) {
- fListener = (IDebugEventSetListener)listeners[i];
+ for (IDebugEventSetListener iDebugEventSetListener : fEventListeners) {
+ fListener = iDebugEventSetListener;
SafeRunner.run(this);
}
fEvents = null;
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
index b6cebf1be..b9875728f 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
@@ -131,12 +131,12 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
/**
* Collection of breakpoint listeners.
*/
- private ListenerList fBreakpointListeners= new ListenerList();
+ private ListenerList<IBreakpointListener> fBreakpointListeners= new ListenerList<>();
/**
* Collection of (plural) breakpoint listeners.
*/
- private ListenerList fBreakpointsListeners= new ListenerList();
+ private ListenerList<IBreakpointsListener> fBreakpointsListeners= new ListenerList<>();
/**
* Singleton resource delta visitor which handles marker
@@ -148,7 +148,7 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
* Collection of breakpoint manager listeners which are
* notified when this manager's state changes.
*/
- private ListenerList fBreakpointManagerListeners= new ListenerList();
+ private ListenerList<IBreakpointManagerListener> fBreakpointManagerListeners= new ListenerList<>();
/**
* Listens to POST_CHANGE notifications of breakpoint markers to detect when
@@ -1061,9 +1061,8 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
*/
public void notify(IBreakpoint[] breakpoints, IMarkerDelta[] deltas, int update) {
fType = update;
- Object[] copiedListeners= fBreakpointListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IBreakpointListener)copiedListeners[i];
+ for (IBreakpointListener iBreakpointListener : fBreakpointListeners) {
+ fListener = iBreakpointListener;
for (int j = 0; j < breakpoints.length; j++) {
fBreakpoint = breakpoints[j];
fDelta = deltas[j];
@@ -1131,10 +1130,9 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
fType = update;
fNotifierBreakpoints = breakpoints;
fDeltas = deltas;
- Object[] copiedListeners = fBreakpointsListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IBreakpointsListener)copiedListeners[i];
- SafeRunner.run(this);
+ for (IBreakpointsListener iBreakpointsListener : fBreakpointsListeners) {
+ fListener = iBreakpointsListener;
+ SafeRunner.run(this);
}
fDeltas = null;
fNotifierBreakpoints = null;
@@ -1227,9 +1225,8 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
*/
public void notify(boolean enabled) {
fManagerEnabled= enabled;
- Object[] copiedListeners = fBreakpointManagerListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IBreakpointManagerListener)copiedListeners[i];
+ for (IBreakpointManagerListener iBreakpointManagerListener : fBreakpointManagerListeners) {
+ fListener = iBreakpointManagerListener;
SafeRunner.run(this);
}
fListener = null;
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java
index 8df5726ba..927499070 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/ExpressionManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
@@ -61,12 +61,12 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
/**
* List of expression listeners
*/
- private ListenerList fListeners = null;
+ private ListenerList<IExpressionListener> fListeners = null;
/**
* List of expressions listeners (plural)
*/
- private ListenerList fExpressionsListeners = null;
+ private ListenerList<IExpressionsListener> fExpressionsListeners = null;
/**
* Mapping of debug model identifiers (String) to
@@ -467,7 +467,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
@Override
public void addExpressionListener(IExpressionListener listener) {
if (fListeners == null) {
- fListeners = new ListenerList();
+ fListeners = new ListenerList<>();
}
fListeners.add(listener);
}
@@ -540,7 +540,7 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
@Override
public void addExpressionListener(IExpressionsListener listener) {
if (fExpressionsListeners == null) {
- fExpressionsListeners = new ListenerList();
+ fExpressionsListeners = new ListenerList<>();
}
fExpressionsListeners.add(listener);
}
@@ -609,9 +609,8 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
public void notify(IExpression[] expressions, int update) {
if (fListeners != null) {
fType = update;
- Object[] copiedListeners= fListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IExpressionListener)copiedListeners[i];
+ for (IExpressionListener iExpressionListener : fListeners) {
+ fListener = iExpressionListener;
for (int j = 0; j < expressions.length; j++) {
fExpression = expressions[j];
SafeRunner.run(this);
@@ -697,9 +696,8 @@ public class ExpressionManager extends PlatformObject implements IExpressionMana
fNotifierExpressions = expressions;
fType = update;
fIndex = index;
- Object[] copiedListeners = fExpressionsListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IExpressionsListener)copiedListeners[i];
+ for (IExpressionsListener iExpressionsListener : fExpressionsListeners) {
+ fListener = iExpressionsListener;
SafeRunner.run(this);
}
}
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
index 4973e3f52..74a7638b3 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/LaunchManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
@@ -202,12 +202,9 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
public void notify(ILaunchConfiguration configuration, int update) {
fConfiguration = configuration;
fType = update;
- if (fLaunchConfigurationListeners.size() > 0) {
- Object[] listeners = fLaunchConfigurationListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- fListener = (ILaunchConfigurationListener)listeners[i];
- SafeRunner.run(this);
- }
+ for (ILaunchConfigurationListener iLaunchConfigurationListener : fLaunchConfigurationListeners) {
+ fListener = iLaunchConfigurationListener;
+ SafeRunner.run(this);
}
fConfiguration = null;
fListener = null;
@@ -264,9 +261,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
fNotifierLaunches = launches;
fType = update;
fRegistered = null;
- Object[] copiedListeners= fLaunchesListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (ILaunchesListener)copiedListeners[i];
+ for (ILaunchesListener iLaunchesListener : fLaunchesListeners) {
+ fListener = iLaunchesListener;
SafeRunner.run(this);
}
fNotifierLaunches = null;
@@ -432,9 +428,8 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
public void notify(ILaunch launch, int update) {
fLaunch = launch;
fType = update;
- Object[] copiedListeners= fListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (ILaunchListener)copiedListeners[i];
+ for (ILaunchListener iLaunchListener : fListeners) {
+ fListener = iLaunchListener;
SafeRunner.run(this);
}
fLaunch = null;
@@ -635,13 +630,13 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
/**
* Collection of listeners
*/
- private ListenerList fListeners = new ListenerList();
+ private ListenerList<ILaunchListener> fListeners = new ListenerList<>();
/**
* Collection of "plural" listeners.
* @since 2.1
*/
- private ListenerList fLaunchesListeners = new ListenerList();
+ private ListenerList<ILaunchesListener> fLaunchesListeners = new ListenerList<>();
/**
* Visitor used to process resource deltas,
@@ -666,7 +661,7 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
/**
* Launch configuration listeners
*/
- private ListenerList fLaunchConfigurationListeners = new ListenerList();
+ private ListenerList<ILaunchConfigurationListener> fLaunchConfigurationListeners = new ListenerList<>();
/**
* Table of source locator extensions. Keys
@@ -2365,9 +2360,9 @@ public class LaunchManager extends PlatformObject implements ILaunchManager, IRe
* Clears launch configuration types.
*/
public void shutdown() {
- fListeners = new ListenerList();
- fLaunchesListeners = new ListenerList();
- fLaunchConfigurationListeners = new ListenerList();
+ fListeners = new ListenerList<>();
+ fLaunchesListeners = new ListenerList<>();
+ fLaunchConfigurationListeners = new ListenerList<>();
ILaunch[] launches = getLaunches();
ILaunch launch = null;
for (int i= 0; i < launches.length; i++) {
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
index b16235d43..0b35caa54 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/OutputStreamMonitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 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
@@ -38,7 +38,7 @@ public class OutputStreamMonitor implements IFlushableStreamMonitor {
/**
* A collection of listeners
*/
- private ListenerList fListeners= new ListenerList();
+ private ListenerList<IStreamListener> fListeners = new ListenerList<>();
/**
* Whether content is being buffered
@@ -105,7 +105,7 @@ public class OutputStreamMonitor implements IFlushableStreamMonitor {
thread.join();
} catch (InterruptedException ie) {
}
- fListeners = new ListenerList();
+ fListeners = new ListenerList<>();
}
}
@@ -272,10 +272,9 @@ public class OutputStreamMonitor implements IFlushableStreamMonitor {
return;
}
fText = text;
- Object[] copiedListeners= fListeners.getListeners();
- for (int i= 0; i < copiedListeners.length; i++) {
- fListener = (IStreamListener) copiedListeners[i];
- SafeRunner.run(this);
+ for (IStreamListener iStreamListener : fListeners) {
+ fListener = iStreamListener;
+ SafeRunner.run(this);
}
fListener = null;
fText = null;

Back to the top