mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
Generify ListenerList.
Generified, some lamnda conversions and some non-javadoc removal. Change-Id: Ibf0493917ac3da7531de1ca591a9bfdc250ddf2a Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
parent
4d47bff054
commit
93623a1a04
17 changed files with 78 additions and 172 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2016 QNX Software Systems and others.
|
||||
* Copyright (c) 2000, 2017 QNX Software 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
|
||||
|
@ -83,7 +83,7 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
|||
* Reconciling listeners.
|
||||
* @since 3.0
|
||||
*/
|
||||
private ListenerList fReconcilingListeners= new ListenerList(ListenerList.IDENTITY);
|
||||
private ListenerList<IReconcilingParticipant> fReconcilingListeners= new ListenerList<>(ListenerList.IDENTITY);
|
||||
|
||||
|
||||
MakefileSourceConfiguration getMakefileSourceConfiguration() {
|
||||
|
@ -361,9 +361,8 @@ public class MakefileEditor extends TextEditor implements ISelectionChangedListe
|
|||
@Override
|
||||
public void reconciled() {
|
||||
// Notify listeners
|
||||
Object[] listeners = fReconcilingListeners.getListeners();
|
||||
for (Object listener : listeners) {
|
||||
((IReconcilingParticipant)listener).reconciled();
|
||||
for (IReconcilingParticipant listener : fReconcilingListeners) {
|
||||
listener.reconciled();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2014 QNX Software Systems and others.
|
||||
* Copyright (c) 2005, 2017 QNX Software 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
|
||||
|
@ -68,7 +68,7 @@ public class LanguageManager {
|
|||
private boolean fIsFullyCached;
|
||||
private HashMap<String, ILanguageDescriptor> fIdToLanguageDescriptorCache;//= new HashMap();
|
||||
private HashMap<String, List<ILanguageDescriptor>> fContentTypeToDescriptorListCache;
|
||||
private ListenerList fLanguageChangeListeners = new ListenerList(ListenerList.IDENTITY);
|
||||
private ListenerList<ILanguageMappingChangeListener> fLanguageChangeListeners = new ListenerList<>(ListenerList.IDENTITY);
|
||||
private WorkspaceLanguageConfiguration fWorkspaceMappings;
|
||||
|
||||
public static LanguageManager getInstance() {
|
||||
|
@ -615,10 +615,7 @@ public class LanguageManager {
|
|||
* @param event the ILanguageMappingsChange event to be broadcast.
|
||||
*/
|
||||
public void notifyLanguageChangeListeners(ILanguageMappingChangeEvent event) {
|
||||
Object[] listeners = fLanguageChangeListeners.getListeners();
|
||||
|
||||
for (Object obj : listeners) {
|
||||
ILanguageMappingChangeListener listener = (ILanguageMappingChangeListener) obj;
|
||||
for (ILanguageMappingChangeListener listener : fLanguageChangeListeners) {
|
||||
listener.handleLanguageMappingChangeEvent(event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009, 2013 Andrew Gvozdev and others.
|
||||
* Copyright (c) 2009, 2017 Andrew Gvozdev 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
|
||||
|
@ -109,7 +109,7 @@ public class LanguageSettingsProvidersSerializer {
|
|||
/** Cache of workspace providers wrappers */
|
||||
private static Map<String, ILanguageSettingsProvider> globalWorkspaceProviders = new HashMap<String, ILanguageSettingsProvider>();
|
||||
|
||||
private static ListenerList fLanguageSettingsChangeListeners = new ListenerList(ListenerList.IDENTITY);
|
||||
private static ListenerList<ILanguageSettingsChangeListener> fLanguageSettingsChangeListeners = new ListenerList<>(ListenerList.IDENTITY);
|
||||
private static ILock serializingLock = Job.getJobManager().newLock();
|
||||
private static ILock serializingLockWsp = Job.getJobManager().newLock();
|
||||
|
||||
|
@ -1407,8 +1407,8 @@ public class LanguageSettingsProvidersSerializer {
|
|||
* @param event - the {@link ILanguageSettingsChangeEvent} event to be broadcast.
|
||||
*/
|
||||
private static void notifyLanguageSettingsChangeListeners(ILanguageSettingsChangeEvent event) {
|
||||
for (Object listener : fLanguageSettingsChangeListeners.getListeners()) {
|
||||
((ILanguageSettingsChangeListener) listener).handleEvent(event);
|
||||
for (ILanguageSettingsChangeListener listener : fLanguageSettingsChangeListeners) {
|
||||
listener.handleEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2008 Intel Corporation and others.
|
||||
* Copyright (c) 2007, 2017 Intel 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
|
||||
|
@ -16,12 +16,12 @@ import org.eclipse.core.runtime.ListenerList;
|
|||
|
||||
public abstract class CExternalSettingContainerFactoryWithListener extends
|
||||
CExternalSettingContainerFactory {
|
||||
private ListenerList fListenerList;
|
||||
private ListenerList<ICExternalSettingsListener> fListenerList;
|
||||
|
||||
@Override
|
||||
public void addListener(ICExternalSettingsListener listener){
|
||||
if(fListenerList == null)
|
||||
fListenerList = new ListenerList();
|
||||
fListenerList = new ListenerList<>();
|
||||
|
||||
fListenerList.add(listener);
|
||||
}
|
||||
|
@ -43,9 +43,8 @@ public abstract class CExternalSettingContainerFactoryWithListener extends
|
|||
|
||||
CExternalSettingChangeEvent event = new CExternalSettingChangeEvent(infos);
|
||||
|
||||
Object[] listeners = fListenerList.getListeners();
|
||||
for(int i = 0; i < listeners.length; i++){
|
||||
((ICExternalSettingsListener)listeners[i]).settingsChanged(project, cfgId, event);
|
||||
for(ICExternalSettingsListener listener : fListenerList){
|
||||
listener.settingsChanged(project, cfgId, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2009, 2013 Broadcom Corporation and others.
|
||||
* Copyright (c) 2009, 2017 Broadcom 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
|
||||
|
@ -74,7 +74,7 @@ public class PrefsStorableEnvironment extends StorableEnvironment {
|
|||
private boolean fAppendChanged = false;
|
||||
private boolean fAppendContributedChanged = false;
|
||||
|
||||
private static ListenerList fEnvironmentChangeListeners = new ListenerList(ListenerList.IDENTITY);
|
||||
private static ListenerList<IEnvironmentChangeListener> fEnvironmentChangeListeners = new ListenerList<>(ListenerList.IDENTITY);
|
||||
|
||||
/** A listener for changes in the backing store */
|
||||
private static class PrefListener implements IPreferenceChangeListener, INodeChangeListener {
|
||||
|
@ -573,8 +573,8 @@ public class PrefsStorableEnvironment extends StorableEnvironment {
|
|||
* @param event - the {@link IEnvironmentChangeEvent} event to be broadcast.
|
||||
*/
|
||||
private static void notifyLanguageSettingsChangeListeners(IEnvironmentChangeEvent event) {
|
||||
for (Object listener : fEnvironmentChangeListeners.getListeners()) {
|
||||
((IEnvironmentChangeListener) listener).handleEvent(event);
|
||||
for (IEnvironmentChangeListener listener : fEnvironmentChangeListeners) {
|
||||
listener.handleEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2002, 2011 QNX Software Systems and others.
|
||||
* Copyright (c) 2002, 2017 QNX Software 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
|
||||
|
@ -67,7 +67,7 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang
|
|||
private static final String BUILD_CONSOLE_NODE = "buildConsole"; //$NON-NLS-1$
|
||||
private static final String PROJECT_LOG_EXT = ".build.log"; //$NON-NLS-1$
|
||||
|
||||
private ListenerList listeners = new ListenerList();
|
||||
private ListenerList<IBuildConsoleListener> listeners = new ListenerList<>();
|
||||
/** UI console object in which per-project consoles are shown */
|
||||
private BuildConsole fConsole;
|
||||
private Map<IProject, BuildConsolePartitioner> fConsoleMap = new HashMap<IProject, BuildConsolePartitioner>();
|
||||
|
@ -126,10 +126,8 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang
|
|||
* show the console, and notify listeners
|
||||
*/
|
||||
protected void startConsoleActivity(IProject project) {
|
||||
Object[] list = listeners.getListeners();
|
||||
if (list.length > 0) {
|
||||
for (Object element : list) {
|
||||
IBuildConsoleListener listener = (IBuildConsoleListener)element;
|
||||
if (!listeners.isEmpty()) {
|
||||
for (IBuildConsoleListener listener: listeners) {
|
||||
ConsoleEvent event = new ConsoleEvent(BuildConsoleManager.this, project, IBuildConsoleEvent.CONSOLE_START);
|
||||
listener.consoleChange(event);
|
||||
}
|
||||
|
@ -196,10 +194,8 @@ public class BuildConsoleManager implements IBuildConsoleManager, IResourceChang
|
|||
IDocumentPartitioner partioner = fConsoleMap.remove(resource);
|
||||
if (partioner != null) {
|
||||
partioner.disconnect();
|
||||
Object[] list = listeners.getListeners();
|
||||
if (list.length > 0) {
|
||||
for (Object element : list) {
|
||||
IBuildConsoleListener listener = (IBuildConsoleListener)element;
|
||||
if (!listeners.isEmpty()) {
|
||||
for (IBuildConsoleListener listener : listeners) {
|
||||
ConsoleEvent consoleEvent = new ConsoleEvent(this, (IProject)resource, IBuildConsoleEvent.CONSOLE_CLOSE);
|
||||
listener.consoleChange(consoleEvent);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2004, 2016 TimeSys Corporation and others.
|
||||
* Copyright (c) 2004, 2017 TimeSys 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,11 +30,9 @@ import org.eclipse.jface.layout.PixelConverter;
|
|||
import org.eclipse.jface.viewers.ColumnWeightData;
|
||||
import org.eclipse.jface.viewers.ILabelProvider;
|
||||
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.ITableLabelProvider;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.TableLayout;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
|
@ -47,8 +45,6 @@ import org.eclipse.swt.layout.GridLayout;
|
|||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.TableColumn;
|
||||
|
||||
|
@ -112,7 +108,7 @@ public class CFileTypesPreferenceBlock {
|
|||
}
|
||||
|
||||
private class AssocLabelProvider implements ILabelProvider, ITableLabelProvider {
|
||||
private ListenerList listeners = new ListenerList();
|
||||
private ListenerList<ILabelProviderListener> listeners = new ListenerList<>();
|
||||
|
||||
@Override
|
||||
public Image getColumnImage(Object element, int columnIndex) {
|
||||
|
@ -261,12 +257,7 @@ public class CFileTypesPreferenceBlock {
|
|||
gridData.widthHint = SWTUtil.getButtonWidthHint(fBtnNew);
|
||||
fBtnNew.setLayoutData(gridData);
|
||||
|
||||
fBtnNew.addListener(SWT.Selection, new Listener() {
|
||||
@Override
|
||||
public void handleEvent(Event e) {
|
||||
handleAdd();
|
||||
}
|
||||
});
|
||||
fBtnNew.addListener(SWT.Selection, e -> handleAdd());
|
||||
|
||||
// Remove button
|
||||
|
||||
|
@ -277,12 +268,7 @@ public class CFileTypesPreferenceBlock {
|
|||
gridData.widthHint = SWTUtil.getButtonWidthHint(fBtnRemove);
|
||||
fBtnRemove.setLayoutData(gridData);
|
||||
|
||||
fBtnRemove.addListener(SWT.Selection, new Listener() {
|
||||
@Override
|
||||
public void handleEvent(Event e) {
|
||||
handleRemove();
|
||||
}
|
||||
});
|
||||
fBtnRemove.addListener(SWT.Selection, e -> handleRemove());
|
||||
|
||||
// Hook up the viewer
|
||||
|
||||
|
@ -293,12 +279,7 @@ public class CFileTypesPreferenceBlock {
|
|||
fAssocViewer.setLabelProvider(new AssocLabelProvider());
|
||||
fAssocViewer.setInput(getCFileTypeAssociations());
|
||||
|
||||
fAssocViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
handleSelectionChanged();
|
||||
}
|
||||
});
|
||||
fAssocViewer.addSelectionChangedListener(event -> handleSelectionChanged());
|
||||
|
||||
handleSelectionChanged();
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2005, 2012 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
|
||||
|
@ -95,15 +95,12 @@ public class ProblemMarkerManager implements IResourceChangeListener, IAnnotatio
|
|||
}
|
||||
}
|
||||
|
||||
ListenerList fListeners;
|
||||
ListenerList<IProblemChangedListener> fListeners;
|
||||
|
||||
public ProblemMarkerManager() {
|
||||
fListeners = new ListenerList();
|
||||
fListeners = new ListenerList<>();
|
||||
}
|
||||
|
||||
/*
|
||||
* @see IResourceChangeListener#resourceChanged
|
||||
*/
|
||||
@Override
|
||||
public void resourceChanged(IResourceChangeEvent event) {
|
||||
HashSet<IResource> changedElements = new HashSet<IResource>();
|
||||
|
@ -123,21 +120,11 @@ public class ProblemMarkerManager implements IResourceChangeListener, IAnnotatio
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see IAnnotationModelListener#modelChanged(IAnnotationModel)
|
||||
*/
|
||||
@Override
|
||||
public void modelChanged(IAnnotationModel model) {
|
||||
// no action
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see IAnnotationModelListenerExtension#modelChanged(AnnotationModelEvent)
|
||||
*/
|
||||
@Override
|
||||
public void modelChanged(AnnotationModelEvent event) {
|
||||
if (event instanceof TranslationUnitAnnotationModelEvent) {
|
||||
|
@ -178,15 +165,9 @@ public class ProblemMarkerManager implements IResourceChangeListener, IAnnotatio
|
|||
private void fireChanges(final IResource[] changes, final boolean markerChanged) {
|
||||
Display display = SWTUtil.getStandardDisplay();
|
||||
if (display != null && !display.isDisposed()) {
|
||||
display.asyncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Object[] listeners = fListeners.getListeners();
|
||||
for (Object listener : listeners) {
|
||||
IProblemChangedListener curr = (IProblemChangedListener)listener;
|
||||
curr.problemsChanged(changes, markerChanged);
|
||||
}
|
||||
display.asyncExec(() -> {
|
||||
for (IProblemChangedListener curr : fListeners) {
|
||||
curr.problemsChanged(changes, markerChanged);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2012 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2006, 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
|
||||
|
@ -31,13 +31,13 @@ import org.eclipse.jface.viewers.StructuredSelection;
|
|||
public class AdaptingSelectionProvider implements ISelectionProvider, ISelectionChangedListener {
|
||||
|
||||
private Class<?> fTargetType;
|
||||
private ListenerList fListenerList;
|
||||
private ListenerList<ISelectionChangedListener> fListenerList;
|
||||
private ISelectionProvider fProvider;
|
||||
|
||||
public AdaptingSelectionProvider(Class<?> targetType, ISelectionProvider provider) {
|
||||
fProvider= provider;
|
||||
fTargetType= targetType;
|
||||
fListenerList= new ListenerList();
|
||||
fListenerList= new ListenerList<>();
|
||||
}
|
||||
|
||||
private ISelection convertSelection(ISelection selection) {
|
||||
|
@ -96,9 +96,7 @@ public class AdaptingSelectionProvider implements ISelectionProvider, ISelection
|
|||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
SelectionChangedEvent event2= new SelectionChangedEvent(this, convertSelection(event.getSelection()));
|
||||
Object[] listeners= fListenerList.getListeners();
|
||||
for (Object listener : listeners) {
|
||||
ISelectionChangedListener l= (ISelectionChangedListener) listener;
|
||||
for (ISelectionChangedListener l : fListenerList) {
|
||||
l.selectionChanged(event2);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2013 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 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
|
||||
|
@ -118,7 +118,7 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
|||
private boolean fUseNewRegistry;
|
||||
private IProblemChangedListener fProblemChangedListener;
|
||||
|
||||
private ListenerList fListeners;
|
||||
private ListenerList<ILabelProviderListener> fListeners;
|
||||
private Map<MarkersCacheKey, IMarker[]> fMarkersCache = new HashMap<MarkersCacheKey, IMarker[]>();
|
||||
|
||||
/**
|
||||
|
@ -290,16 +290,11 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
|||
@Override
|
||||
public void addListener(ILabelProviderListener listener) {
|
||||
if (fListeners == null) {
|
||||
fListeners= new ListenerList();
|
||||
fListeners= new ListenerList<>();
|
||||
}
|
||||
fListeners.add(listener);
|
||||
if (fProblemChangedListener == null) {
|
||||
fProblemChangedListener= new IProblemChangedListener() {
|
||||
@Override
|
||||
public void problemsChanged(IResource[] changedResources, boolean isMarkerChange) {
|
||||
fireProblemsChanged(changedResources, isMarkerChange);
|
||||
}
|
||||
};
|
||||
fProblemChangedListener= (changedResources, isMarkerChange) -> fireProblemsChanged(changedResources, isMarkerChange);
|
||||
CUIPlugin.getDefault().getProblemMarkerManager().addListener(fProblemChangedListener);
|
||||
}
|
||||
}
|
||||
|
@ -319,9 +314,8 @@ public class ProblemsLabelDecorator implements ILabelDecorator, ILightweightLabe
|
|||
fMarkersCache.clear();
|
||||
if (fListeners != null && !fListeners.isEmpty()) {
|
||||
LabelProviderChangedEvent event= new ProblemsLabelChangedEvent(this, changedResources, isMarkerChange);
|
||||
Object[] listeners= fListeners.getListeners();
|
||||
for (Object listener : listeners) {
|
||||
((ILabelProviderListener) listener).labelProviderChanged(event);
|
||||
for (ILabelProviderListener listener : fListeners) {
|
||||
listener.labelProviderChanged(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2012 IBM Corporation and others.
|
||||
* Copyright (c) 2000, 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
|
||||
|
@ -25,9 +25,7 @@ import org.eclipse.jface.text.ITextSelection;
|
|||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.ui.ISelectionListener;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.texteditor.ITextEditor;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
|
@ -60,7 +58,7 @@ public class SelectionListenerWithASTManager {
|
|||
private ISelectionListener fPostSelectionListener;
|
||||
private ISelectionChangedListener fSelectionListener;
|
||||
private Job fCurrentJob;
|
||||
private ListenerList fAstListeners;
|
||||
private ListenerList<ISelectionListenerWithAST> fAstListeners;
|
||||
/** Rule to make sure only one job is running at a time */
|
||||
private final ILock fJobLock= Job.getJobManager().newLock();
|
||||
private ISelectionValidator fValidator;
|
||||
|
@ -68,24 +66,18 @@ public class SelectionListenerWithASTManager {
|
|||
public PartListenerGroup(ITextEditor editorPart) {
|
||||
fPart= editorPart;
|
||||
fCurrentJob= null;
|
||||
fAstListeners= new ListenerList(ListenerList.IDENTITY);
|
||||
fAstListeners= new ListenerList<>(ListenerList.IDENTITY);
|
||||
|
||||
fSelectionListener= new ISelectionChangedListener() {
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
ISelection selection= event.getSelection();
|
||||
if (selection instanceof ITextSelection) {
|
||||
fireSelectionChanged((ITextSelection) selection);
|
||||
}
|
||||
fSelectionListener= event -> {
|
||||
ISelection selection= event.getSelection();
|
||||
if (selection instanceof ITextSelection) {
|
||||
fireSelectionChanged((ITextSelection) selection);
|
||||
}
|
||||
};
|
||||
|
||||
fPostSelectionListener= new ISelectionListener() {
|
||||
@Override
|
||||
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
|
||||
if (part == fPart && selection instanceof ITextSelection)
|
||||
firePostSelectionChanged((ITextSelection) selection);
|
||||
}
|
||||
fPostSelectionListener= (part, selection) -> {
|
||||
if (part == fPart && selection instanceof ITextSelection)
|
||||
firePostSelectionChanged((ITextSelection) selection);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007, 2012 Wind River Systems, Inc. and others.
|
||||
* Copyright (c) 2007, 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
|
||||
|
@ -31,15 +31,10 @@ public class SelectionProviderMediator implements ISelectionProvider {
|
|||
private ISelectionChangedListener fSelectionChangedListener;
|
||||
private FocusListener fFocusListener;
|
||||
|
||||
private ListenerList fListenerList= new ListenerList();
|
||||
private ListenerList<ISelectionChangedListener> fListenerList= new ListenerList<>();
|
||||
|
||||
public SelectionProviderMediator() {
|
||||
fSelectionChangedListener= new ISelectionChangedListener() {
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
onSelectionChanged(event);
|
||||
}
|
||||
};
|
||||
fSelectionChangedListener= event -> onSelectionChanged(event);
|
||||
fFocusListener = new FocusListener() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
|
@ -62,12 +57,10 @@ public class SelectionProviderMediator implements ISelectionProvider {
|
|||
}
|
||||
|
||||
final protected void fireSelectionChanged() {
|
||||
Object[] listeners= fListenerList.getListeners();
|
||||
if (listeners.length > 0) {
|
||||
if (!fListenerList.isEmpty()) {
|
||||
SelectionChangedEvent event= new SelectionChangedEvent(this, getSelection());
|
||||
|
||||
for (int i = 0; i < listeners.length; i++) {
|
||||
ISelectionChangedListener listener= (ISelectionChangedListener) listeners[i];
|
||||
for (ISelectionChangedListener listener : fListenerList) {
|
||||
listener.selectionChanged(event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue