Bug 486158 - Adapt to ListenerList changes
Change-Id: I3b94e945f4f280834a332e70061b5762aab1152d
diff --git a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntStreamMonitor.java b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntStreamMonitor.java
index a2301e4..6e2b19f 100644
--- a/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntStreamMonitor.java
+++ b/ant/org.eclipse.ant.launching/src/org/eclipse/ant/internal/launching/launchConfigurations/AntStreamMonitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 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
@@ -20,7 +20,7 @@
public class AntStreamMonitor implements IFlushableStreamMonitor {
private StringBuffer fContents = new StringBuffer();
- private ListenerList fListeners = new ListenerList(1);
+ private ListenerList<IStreamListener> fListeners = new ListenerList<>(1);
private boolean fBuffered = true;
/**
@@ -56,10 +56,8 @@
if (isBuffered()) {
fContents.append(message);
}
- Object[] listeners = fListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- IStreamListener listener = (IStreamListener) listeners[i];
- listener.streamAppended(message, this);
+ for (IStreamListener iStreamListener : fListeners) {
+ iStreamListener.streamAppended(message, this);
}
}
diff --git a/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/outline/AntEditorContentOutlinePage.java b/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/outline/AntEditorContentOutlinePage.java
index 91fad53..4813e74 100644
--- a/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/outline/AntEditorContentOutlinePage.java
+++ b/ant/org.eclipse.ant.ui/Ant Editor/org/eclipse/ant/internal/ui/editor/outline/AntEditorContentOutlinePage.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2015 GEBIT Gesellschaft fuer EDV-Beratung
+ * Copyright (c) 2002, 2016 GEBIT Gesellschaft fuer EDV-Beratung
* und Informatik-Technologien mbH,
* Berlin, Duesseldorf, Frankfurt (Germany) and others.
* All rights reserved. This program and the accompanying materials
@@ -83,7 +83,7 @@
private IAntModelListener fListener;
private IAntModel fModel;
private AntModelCore fCore;
- private ListenerList fPostSelectionChangedListeners = new ListenerList();
+ private ListenerList<ISelectionChangedListener> fPostSelectionChangedListeners = new ListenerList<>();
private boolean fIsModelEmpty = true;
private boolean fFilterInternalTargets;
private boolean fFilterImportedElements;
@@ -427,9 +427,8 @@
SelectionChangedEvent event = new SelectionChangedEvent(this, selection);
// fire the event
- Object[] listeners = fPostSelectionChangedListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((ISelectionChangedListener) listeners[i]).selectionChanged(event);
+ for (ISelectionChangedListener iSelectionChangedListener : fPostSelectionChangedListeners) {
+ iSelectionChangedListener.selectionChanged(event);
}
}