Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java10
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionPainter.java8
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionSelectionProvider.java11
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java8
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java22
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java10
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java74
-rw-r--r--org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java11
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java8
-rw-r--r--org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ChainedPreferenceStore.java10
-rw-r--r--org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/CompoundEditExitStrategy.java9
11 files changed, 72 insertions, 109 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java
index 9b5f5bfc3..a20c9c5e6 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/html/BrowserInformationControl.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
@@ -159,7 +159,7 @@ public class BrowserInformationControl extends AbstractInformationControl implem
* The listeners to be notified when the input changed.
* @since 3.4
*/
- private ListenerList/*<IInputChangedListener>*/fInputChangeListeners= new ListenerList(ListenerList.IDENTITY);
+ private ListenerList<IInputChangedListener> fInputChangeListeners= new ListenerList<>(ListenerList.IDENTITY);
/**
* The symbolic name of the font used for size computations, or <code>null</code> to use dialog font.
@@ -319,9 +319,9 @@ public class BrowserInformationControl extends AbstractInformationControl implem
fCompleted= false;
fBrowser.setText(content);
- Object[] listeners= fInputChangeListeners.getListeners();
- for (int i= 0; i < listeners.length; i++)
- ((IInputChangedListener)listeners[i]).inputChanged(fInput);
+ for (IInputChangedListener listener : fInputChangeListeners) {
+ listener.inputChanged(fInput);
+ }
}
@Override
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionPainter.java
index 91d5e026d..b95be75bb 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionPainter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionPainter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2015 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -504,7 +504,7 @@ public final class RevisionPainter {
* The list of revision listeners.
* @since 3.3.
*/
- private final ListenerList fRevisionListeners= new ListenerList(ListenerList.IDENTITY);
+ private final ListenerList<IRevisionListener> fRevisionListeners= new ListenerList<>(ListenerList.IDENTITY);
/* The context - column and viewer we are connected to. */
@@ -1536,9 +1536,7 @@ public final class RevisionPainter {
return;
RevisionEvent event= new RevisionEvent(fRevisionInfo);
- Object[] listeners= fRevisionListeners.getListeners();
- for (int i= 0; i < listeners.length; i++) {
- IRevisionListener listener= (IRevisionListener) listeners[i];
+ for (IRevisionListener listener : fRevisionListeners) {
listener.revisionInformationChanged(event);
}
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionSelectionProvider.java b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionSelectionProvider.java
index 6108f8511..f4a5850e4 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionSelectionProvider.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/internal/text/revisions/RevisionSelectionProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -68,7 +68,8 @@ public final class RevisionSelectionProvider implements ISelectionProvider {
}
private final RevisionPainter fPainter;
- private final ListenerList fListeners= new ListenerList();
+
+ private final ListenerList<ISelectionChangedListener> fListeners= new ListenerList<>();
/**
* The text viewer once we are installed, <code>null</code> if not installed.
@@ -185,9 +186,9 @@ public final class RevisionSelectionProvider implements ISelectionProvider {
ISelection selection= getSelection();
SelectionChangedEvent event= new SelectionChangedEvent(this, selection);
- Object[] listeners= fListeners.getListeners();
- for (int i= 0; i < listeners.length; i++)
- ((ISelectionChangedListener) listeners[i]).selectionChanged(event);
+ for (ISelectionChangedListener listener : fListeners) {
+ listener.selectionChanged(event);
+ }
} finally {
fIgnoreEvents= false;
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java
index 68c0e1d56..5a94a0ba0 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 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
@@ -101,7 +101,7 @@ public abstract class AbstractInformationControl implements IInformationControl,
/** Listener for shell activation and deactivation. */
private Listener fShellListener;
/** All focus listeners registered to this information control. */
- private final ListenerList fFocusListeners= new ListenerList(ListenerList.IDENTITY);
+ private final ListenerList<FocusListener> fFocusListeners= new ListenerList<>(ListenerList.IDENTITY);
/** Size constraints, x is the maxWidth and y is the maxHeight, or <code>null</code> if not set. */
private Point fSizeConstraints;
@@ -670,9 +670,7 @@ public abstract class AbstractInformationControl implements IInformationControl,
@Override
public void handleEvent(Event event) {
- Object[] listeners= fFocusListeners.getListeners();
- for (int i= 0; i < listeners.length; i++) {
- FocusListener focusListener= (FocusListener)listeners[i];
+ for (FocusListener focusListener : fFocusListeners) {
if (event.type == SWT.Activate) {
focusListener.focusGained(new FocusEvent(event));
} else {
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java
index 10bcb002c..89c1e73af 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/ContentAssistant.java
@@ -982,7 +982,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
*
* @since 3.2
*/
- private ListenerList fCompletionListeners= new ListenerList(ListenerList.IDENTITY);
+ private ListenerList<ICompletionListener> fCompletionListeners= new ListenerList<>(ListenerList.IDENTITY);
/**
* The message to display at the bottom of the proposal popup.
*
@@ -2369,9 +2369,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
if (fContentAssistSubjectControlAdapter != null && !isProposalPopupActive()) {
IContentAssistProcessor processor= getProcessor(fContentAssistSubjectControlAdapter, fContentAssistSubjectControlAdapter.getSelectedRange().x);
ContentAssistEvent event= new ContentAssistEvent(this, processor, isAutoActivated);
- Object[] listeners= fCompletionListeners.getListeners();
- for (int i= 0; i < listeners.length; i++) {
- ICompletionListener listener= (ICompletionListener)listeners[i];
+ for (ICompletionListener listener : fCompletionListeners) {
listener.assistSessionStarted(event);
}
}
@@ -2386,9 +2384,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
if (fContentAssistSubjectControlAdapter != null) {
IContentAssistProcessor processor= getProcessor(fContentAssistSubjectControlAdapter, fContentAssistSubjectControlAdapter.getSelectedRange().x);
ContentAssistEvent event= new ContentAssistEvent(this, processor);
- Object[] listeners= fCompletionListeners.getListeners();
- for (int i= 0; i < listeners.length; i++) {
- ICompletionListener listener= (ICompletionListener)listeners[i];
+ for (ICompletionListener listener : fCompletionListeners) {
if (listener instanceof ICompletionListenerExtension)
((ICompletionListenerExtension)listener).assistSessionRestarted(event);
}
@@ -2404,9 +2400,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
if (fContentAssistSubjectControlAdapter != null) {
IContentAssistProcessor processor= getProcessor(fContentAssistSubjectControlAdapter, fContentAssistSubjectControlAdapter.getSelectedRange().x);
ContentAssistEvent event= new ContentAssistEvent(this, processor);
- Object[] listeners= fCompletionListeners.getListeners();
- for (int i= 0; i < listeners.length; i++) {
- ICompletionListener listener= (ICompletionListener)listeners[i];
+ for (ICompletionListener listener : fCompletionListeners) {
listener.assistSessionEnded(event);
}
}
@@ -2498,9 +2492,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
* @since 3.2
*/
void fireSelectionEvent(ICompletionProposal proposal, boolean smartToggle) {
- Object[] listeners= fCompletionListeners.getListeners();
- for (int i= 0; i < listeners.length; i++) {
- ICompletionListener listener= (ICompletionListener)listeners[i];
+ for (ICompletionListener listener : fCompletionListeners) {
listener.selectionChanged(proposal, smartToggle);
}
}
@@ -2512,9 +2504,7 @@ public class ContentAssistant implements IContentAssistant, IContentAssistantExt
* @since 3.8
*/
void fireAppliedEvent(ICompletionProposal proposal) {
- Object[] listeners= fCompletionListeners.getListeners();
- for (int i= 0; i < listeners.length; i++) {
- ICompletionListener listener= (ICompletionListener)listeners[i];
+ for (ICompletionListener listener : fCompletionListeners) {
if (listener instanceof ICompletionListenerExtension2)
((ICompletionListenerExtension2)listener).applied(proposal);
}
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java
index bde9ccc08..08e541244 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/SearchDialog.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
@@ -149,7 +149,7 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
private boolean fLastEnableState;
private Button fCustomizeButton;
private Button fReplaceButton;
- private ListenerList fPageChangeListeners;
+ private ListenerList<IPageChangedListener> fPageChangeListeners;
private final IWorkbenchWindow fWorkbenchWindow;
private final ISelection fCurrentSelection;
@@ -848,7 +848,7 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
@Override
public void addPageChangedListener(IPageChangedListener listener) {
if (fPageChangeListeners == null) {
- fPageChangeListeners= new ListenerList();
+ fPageChangeListeners= new ListenerList<>();
}
fPageChangeListeners.add(listener);
}
@@ -862,9 +862,7 @@ public class SearchDialog extends ExtendedDialogWindow implements ISearchPageCon
if (fPageChangeListeners != null && !fPageChangeListeners.isEmpty()) {
// Fires the page change event
final PageChangedEvent event= new PageChangedEvent(this, getSelectedPage());
- Object[] listeners= fPageChangeListeners.getListeners();
- for (int i= 0; i < listeners.length; ++i) {
- final IPageChangedListener l= (IPageChangedListener) listeners[i];
+ for (IPageChangedListener l : fPageChangeListeners) {
SafeRunner.run(new SafeRunnable() {
@Override
public void run() {
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java b/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java
index 2b1bd31b9..45e6e9ccc 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/AbstractDocument.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
@@ -12,8 +12,8 @@
package org.eclipse.jface.text;
-import java.util.AbstractList;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -92,11 +92,11 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
/** The document's line tracker */
private ILineTracker fTracker;
/** The registered document listeners */
- private ListenerList fDocumentListeners;
+ private ListenerList<IDocumentListener> fDocumentListeners;
/** The registered pre-notified document listeners */
- private ListenerList fPrenotifiedDocumentListeners;
+ private ListenerList<IDocumentListener> fPrenotifiedDocumentListeners;
/** The registered document partitioning listeners */
- private ListenerList fDocumentPartitioningListeners;
+ private ListenerList<IDocumentPartitioningListener> fDocumentPartitioningListeners;
/** All positions managed by the document ordered by their start positions. */
private Map<String, List<Position>> fPositions;
/**
@@ -211,21 +211,11 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
return fTracker;
}
- private static <T> List<T> asList(Object[] listeners) {
- // Workaround for Bug 483340: ListenerList should be parameterized
- // Use Arrays.asList(..) once that bug is fixed.
- return new AbstractList<T>() {
- @SuppressWarnings("unchecked")
- @Override
- public T get(int index) {
- return (T) listeners[index];
- }
-
- @Override
- public int size() {
- return listeners.length;
- }
- };
+ private static <T> List<T> asList(ListenerList<T> listenerList) {
+ List<?> list= Arrays.asList(listenerList.getListeners());
+ @SuppressWarnings("unchecked")
+ List<T> castList= (List<T>) list;
+ return castList;
}
@@ -235,7 +225,7 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
* @return the document's document listeners
*/
protected List<IDocumentListener> getDocumentListeners() {
- return asList(fDocumentListeners.getListeners());
+ return asList(fDocumentListeners);
}
/**
@@ -244,7 +234,7 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
* @return the document's partitioning listeners
*/
protected List<IDocumentPartitioningListener> getDocumentPartitioningListeners() {
- return asList(fDocumentPartitioningListeners.getListeners());
+ return asList(fDocumentPartitioningListeners);
}
/**
@@ -300,9 +290,9 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
fPositions= new HashMap<>();
fEndPositions= new HashMap<>();
fPositionUpdaters= new ArrayList<>();
- fDocumentListeners= new ListenerList(ListenerList.IDENTITY);
- fPrenotifiedDocumentListeners= new ListenerList(ListenerList.IDENTITY);
- fDocumentPartitioningListeners= new ListenerList(ListenerList.IDENTITY);
+ fDocumentListeners= new ListenerList<>(ListenerList.IDENTITY);
+ fPrenotifiedDocumentListeners= new ListenerList<>(ListenerList.IDENTITY);
+ fDocumentPartitioningListeners= new ListenerList<>(ListenerList.IDENTITY);
fDocumentRewriteSessionListeners= new ArrayList<>();
addPositionCategory(DEFAULT_CATEGORY);
@@ -544,9 +534,9 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
if (fDocumentPartitioningListeners == null)
return;
- Object[] listeners= fDocumentPartitioningListeners.getListeners();
- for (int i= 0; i < listeners.length; i++)
- ((IDocumentPartitioningListener)listeners[i]).documentPartitioningChanged(this);
+ for (IDocumentPartitioningListener listener : fDocumentPartitioningListeners) {
+ listener.documentPartitioningChanged(this);
+ }
}
/**
@@ -566,9 +556,7 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
if (fDocumentPartitioningListeners == null)
return;
- Object[] listeners= fDocumentPartitioningListeners.getListeners();
- for (int i= 0; i < listeners.length; i++) {
- IDocumentPartitioningListener l= (IDocumentPartitioningListener)listeners[i];
+ for (IDocumentPartitioningListener l : fDocumentPartitioningListeners) {
try {
if (l instanceof IDocumentPartitioningListenerExtension)
((IDocumentPartitioningListenerExtension)l).documentPartitioningChanged(this, region);
@@ -593,9 +581,7 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
if (fDocumentPartitioningListeners == null)
return;
- Object[] listeners= fDocumentPartitioningListeners.getListeners();
- for (int i= 0; i < listeners.length; i++) {
- IDocumentPartitioningListener l= (IDocumentPartitioningListener)listeners[i];
+ for (IDocumentPartitioningListener l : fDocumentPartitioningListeners) {
try {
if (l instanceof IDocumentPartitioningListenerExtension2) {
IDocumentPartitioningListenerExtension2 extension2= (IDocumentPartitioningListenerExtension2)l;
@@ -641,19 +627,17 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
}
}
- Object[] listeners= fPrenotifiedDocumentListeners.getListeners();
- for (int i= 0; i < listeners.length; i++) {
+ for (IDocumentListener listener : fPrenotifiedDocumentListeners) {
try {
- ((IDocumentListener)listeners[i]).documentAboutToBeChanged(event);
+ listener.documentAboutToBeChanged(event);
} catch (Exception ex) {
log(ex);
}
}
- listeners= fDocumentListeners.getListeners();
- for (int i= 0; i < listeners.length; i++) {
+ for (IDocumentListener listener : fDocumentListeners) {
try {
- ((IDocumentListener)listeners[i]).documentAboutToBeChanged(event);
+ listener.documentAboutToBeChanged(event);
} catch (Exception ex) {
log(ex);
}
@@ -746,19 +730,17 @@ public abstract class AbstractDocument implements IDocument, IDocumentExtension,
if (p != null && !p.isEmpty())
fireDocumentPartitioningChanged(p);
- Object[] listeners= fPrenotifiedDocumentListeners.getListeners();
- for (int i= 0; i < listeners.length; i++) {
+ for (IDocumentListener listener : fPrenotifiedDocumentListeners) {
try {
- ((IDocumentListener)listeners[i]).documentChanged(event);
+ listener.documentChanged(event);
} catch (Exception ex) {
log(ex);
}
}
- listeners= fDocumentListeners.getListeners();
- for (int i= 0; i < listeners.length; i++) {
+ for (IDocumentListener listener : fDocumentListeners) {
try {
- ((IDocumentListener)listeners[i]).documentChanged(event);
+ listener.documentChanged(event);
} catch (Exception ex) {
log(ex);
}
diff --git a/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java b/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java
index 4ead31215..aef594799 100644
--- a/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java
+++ b/org.eclipse.text/src/org/eclipse/text/undo/DocumentUndoManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2015 IBM Corporation and others.
+ * Copyright (c) 2006, 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
@@ -735,7 +735,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
private boolean fOverwriting= false;
/** The registered document listeners. */
- private ListenerList fDocumentUndoListeners;
+ private ListenerList<IDocumentUndoListener> fDocumentUndoListeners;
/** The list of clients connected. */
private List<Object> fConnected;
@@ -753,7 +753,7 @@ public class DocumentUndoManager implements IDocumentUndoManager {
fHistory= OperationHistoryFactory.getOperationHistory();
fUndoContext= new ObjectUndoContext(fDocument);
fConnected= new ArrayList<>();
- fDocumentUndoListeners= new ListenerList(ListenerList.IDENTITY);
+ fDocumentUndoListeners= new ListenerList<>(ListenerList.IDENTITY);
}
@Override
@@ -873,9 +873,8 @@ public class DocumentUndoManager implements IDocumentUndoManager {
void fireDocumentUndo(int offset, String text, String preservedText, Object source, int eventType, boolean isCompound) {
eventType= isCompound ? eventType | DocumentUndoEvent.COMPOUND : eventType;
DocumentUndoEvent event= new DocumentUndoEvent(fDocument, offset, text, preservedText, eventType, source);
- Object[] listeners= fDocumentUndoListeners.getListeners();
- for (int i= 0; i < listeners.length; i++) {
- ((IDocumentUndoListener)listeners[i]).documentUndoNotification(event);
+ for (IDocumentUndoListener listener : fDocumentUndoListeners) {
+ listener.documentUndoNotification(event);
}
}
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java
index 8f3b8cf84..b44c54bbd 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/SelectResourcesBlock.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
@@ -88,7 +88,7 @@ class SelectResourcesBlock implements ICheckStateListener, ISelectionChangedList
private Collection<Object> whiteCheckedTreeItems= new HashSet<>();
- private ListenerList listeners= new ListenerList(ListenerList.IDENTITY);
+ private ListenerList<ICheckStateListener> listeners= new ListenerList<>(ListenerList.IDENTITY);
private ITreeContentProvider treeContentProvider;
@@ -564,9 +564,7 @@ class SelectResourcesBlock implements ICheckStateListener, ISelectionChangedList
* @param event the event
*/
private void notifyCheckStateChangeListeners(final CheckStateChangedEvent event) {
- Object[] array= listeners.getListeners();
- for (int i= 0; i < array.length; i++) {
- final ICheckStateListener l= (ICheckStateListener) array[i];
+ for (ICheckStateListener l : listeners) {
SafeRunner.run(new SafeRunnable() {
@Override
public void run() {
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ChainedPreferenceStore.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ChainedPreferenceStore.java
index 6705e52f0..7f4e30cd2 100644
--- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ChainedPreferenceStore.java
+++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/ChainedPreferenceStore.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 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 ChainedPreferenceStore implements IPreferenceStore {
private IPreferenceStore[] fPreferenceStores;
/** Listeners on this chained preference store. */
- private ListenerList fClientListeners= new ListenerList(ListenerList.IDENTITY);
+ private ListenerList<IPropertyChangeListener> fClientListeners= new ListenerList<>(ListenerList.IDENTITY);
/** Listeners on the child preference stores. */
private List<PropertyChangeListener> fChildListeners= new ArrayList<>();
@@ -149,9 +149,9 @@ public class ChainedPreferenceStore implements IPreferenceStore {
* @param event the property change event
*/
private void firePropertyChangeEvent(PropertyChangeEvent event) {
- Object[] listeners= fClientListeners.getListeners();
- for (int i= 0; i < listeners.length; i++)
- ((IPropertyChangeListener) listeners[i]).propertyChange(event);
+ for (IPropertyChangeListener listener : fClientListeners) {
+ listener.propertyChange(event);
+ }
}
@Override
diff --git a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/CompoundEditExitStrategy.java b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/CompoundEditExitStrategy.java
index 942cdbb57..2de35502b 100644
--- a/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/CompoundEditExitStrategy.java
+++ b/org.eclipse.ui.workbench.texteditor/src/org/eclipse/ui/internal/texteditor/CompoundEditExitStrategy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -113,7 +113,8 @@ public final class CompoundEditExitStrategy {
private final String[] fCommandIds;
private final EventListener fEventListener= new EventListener();
- private final ListenerList fListenerList= new ListenerList(ListenerList.IDENTITY);
+
+ private final ListenerList<ICompoundEditListener> fListenerList= new ListenerList<>(ListenerList.IDENTITY);
private ITextViewer fViewer;
private StyledText fWidgetEventSource;
@@ -207,9 +208,7 @@ public final class CompoundEditExitStrategy {
private void fireEndCompoundEdit() {
disarm();
- Object[] listeners= fListenerList.getListeners();
- for (int i= 0; i < listeners.length; i++) {
- ICompoundEditListener listener= (ICompoundEditListener) listeners[i];
+ for (ICompoundEditListener listener : fListenerList) {
try {
listener.endCompoundEdit();
} catch (Exception e) {

Back to the top