本文整理汇总了Java中org.eclipse.core.runtime.ListenerList类的典型用法代码示例。如果您正苦于以下问题:Java ListenerList类的具体用法?Java ListenerList怎么用?Java ListenerList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ListenerList类属于org.eclipse.core.runtime包,在下文中一共展示了ListenerList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SelectionProviderMediator
import org.eclipse.core.runtime.ListenerList; //导入依赖的package包/类
/**
* @param viewers All viewers that can provide a selection
* @param viewerInFocus the viewer currently in focus or <code>null</code>
*/
public SelectionProviderMediator(StructuredViewer[] viewers, StructuredViewer viewerInFocus) {
Assert.isNotNull(viewers);
fViewers= viewers;
InternalListener listener= new InternalListener();
fSelectionChangedListeners= new ListenerList();
fPostSelectionChangedListeners= new ListenerList();
fViewerInFocus= viewerInFocus;
for (int i= 0; i < fViewers.length; i++) {
StructuredViewer viewer= fViewers[i];
viewer.addSelectionChangedListener(listener);
viewer.addPostSelectionChangedListener(new InternalPostSelectionListener());
Control control= viewer.getControl();
control.addFocusListener(listener);
}
}
示例2: PartListenerGroup
import org.eclipse.core.runtime.ListenerList; //导入依赖的package包/类
public PartListenerGroup(ITextEditor editorPart) {
fPart= editorPart;
fCurrentJob= null;
fAstListeners= new ListenerList(ListenerList.IDENTITY);
fSelectionListener= new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection= event.getSelection();
if (selection instanceof ITextSelection) {
fireSelectionChanged((ITextSelection) selection);
}
}
};
fPostSelectionListener= new ISelectionListener() {
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if (part == fPart && selection instanceof ITextSelection)
firePostSelectionChanged((ITextSelection) selection);
}
};
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:SelectionListenerWithASTManager.java
示例3: addPropertyChangeListener
import org.eclipse.core.runtime.ListenerList; //导入依赖的package包/类
/**
* @see org.eclipse.jface.action.ExternalActionManager.ICallback#addPropertyChangeListener(String,
* IPropertyChangeListener)
*/
public final void addPropertyChangeListener(final String commandId,
final IPropertyChangeListener listener) {
Object existing = registeredListeners.get(commandId);
if (existing instanceof ListenerList) {
((ListenerList) existing).add(listener);
} else if (existing != null) {
ListenerList listeners = new ListenerList(ListenerList.IDENTITY);
listeners.add(existing);
listeners.add(listener);
registeredListeners.put(commandId, listeners);
} else {
registeredListeners.put(commandId, listener);
}
if (!bindingManagerListenerAttached) {
bindingManager.addBindingManagerListener(this);
bindingManagerListenerAttached = true;
}
}
示例4: removePropertyChangeListener
import org.eclipse.core.runtime.ListenerList; //导入依赖的package包/类
/**
* @see org.eclipse.jface.action.ExternalActionManager.ICallback#removePropertyChangeListener(String,
* IPropertyChangeListener)
*/
public final void removePropertyChangeListener(final String commandId,
final IPropertyChangeListener listener) {
Object existing = registeredListeners.get(commandId);
if (existing == listener) {
registeredListeners.remove(commandId);
if (registeredListeners.isEmpty()) {
bindingManager.removeBindingManagerListener(this);
bindingManagerListenerAttached = false;
}
} else if (existing instanceof ListenerList) {
ListenerList existingList = (ListenerList) existing;
existingList.remove(listener);
if (existingList.size() == 1) {
registeredListeners.put(commandId,
existingList.getListeners()[0]);
}
}
}
示例5: fireSelectionChanged
import org.eclipse.core.runtime.ListenerList; //导入依赖的package包/类
private void fireSelectionChanged(ListenerList list, ISelection selection)
{
SelectionChangedEvent event = new SelectionChangedEvent(delegate, selection);
Object[] listeners = list.getListeners();
for (int i = 0; i < listeners.length; i++)
{
try
{
ISelectionChangedListener listener = (ISelectionChangedListener) listeners[i];
listener.selectionChanged(event);
}
catch (Exception e)
{
Logger.getLogger(ProjectEditorSelectionService.class.getName()).log(Level.WARNING, "Exception fireing selection changed: "+e.getMessage());
}
}
}
示例6: PathsProvider
import org.eclipse.core.runtime.ListenerList; //导入依赖的package包/类
protected PathsProvider(TableViewer viewer, FindbugsPropertyPage propertyPage) {
this.propertyPage = propertyPage;
this.paths = new ArrayList<IPathElement>();
this.viewer = viewer;
if(viewer instanceof CheckboxTableViewer) {
CheckboxTableViewer tv = (CheckboxTableViewer) viewer;
// tv.setCheckStateProvider(this);
tv.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
boolean checked = event.getChecked();
IPathElement element = (IPathElement) event.getElement();
element.setEnabled(checked);
handleContendChanged();
}
});
}
this.control = viewer.getTable();
listeners = new ListenerList();
viewer.setContentProvider(this);
}
示例7: ScriptConsole
import org.eclipse.core.runtime.ListenerList; //导入依赖的package包/类
public ScriptConsole(String consoleName, String consoleType, IScriptConsoleInterpreter interpreterArg) {
super(consoleName, consoleType, null, true);
this.interpreter = interpreterArg;
this.consoleListeners = new ListenerList(ListenerList.IDENTITY);
this.prompt = createConsolePrompt();
this.history = new ScriptConsoleHistory();
this.session = new ScriptConsoleSession();
addListener(this.session);
partitioner = new ScriptConsolePartitioner();
getDocument().setDocumentPartitioner(partitioner);
partitioner.connect(getDocument());
}
示例8: addListener
import org.eclipse.core.runtime.ListenerList; //导入依赖的package包/类
@Override
public void addListener(ILabelProviderListener listener) {
if (fListeners == null) {
fListeners= new ListenerList<>();
}
fListeners.add(listener);
if (fProblemChangedListener == null) {
fProblemChangedListener= new IProblemChangedListener() {
@Override
public void problemsChanged(IResource[] changedResources, boolean isMarkerChange,
boolean calledFromDisplayThread) {
fireProblemsChanged(changedResources, isMarkerChange);
}
};
LangUIPlugin.getDefault().getProblemMarkerManager().addListener(fProblemChangedListener);
}
}
示例9: fireSelectionChanged
import org.eclipse.core.runtime.ListenerList; //导入依赖的package包/类
/**
* Fires the {@link ISelection} change to the given list of {@link ISelectionChangedListener}.
*
* @param list
* the list of {@link ISelectionChangedListener}
* @param selection
* the {@link ISelection}
*/
private void fireSelectionChanged(@SuppressWarnings("rawtypes") ListenerList list, ISelection selection) {
SelectionChangedEvent event = new SelectionChangedEvent(delegate, selection);
Object[] listeners = list.getListeners();
for (int i = 0; i < listeners.length; i++) {
ISelectionChangedListener listener = (ISelectionChangedListener)listeners[i];
listener.selectionChanged(event);
}
}
示例10: ProfileManager
import org.eclipse.core.runtime.ListenerList; //导入依赖的package包/类
/**
* Create and initialize a new profile manager.
*
* @param profiles
* Initial custom profiles (List of type <code>CustomProfile</code>)
* @param profileVersioner
*/
private ProfileManager()
{
List<IProfile> profiles = new ArrayList<IProfile>();
List<IProfile> builtInProfiles = getBuiltInProfiles();
if (builtInProfiles != null && builtInProfiles.size() > 0)
{
profiles.addAll(builtInProfiles);
}
else
{
IdeLog.logError(FormatterPlugin.getDefault(), NLS.bind(
FormatterMessages.AbstractFormatterSelectionBlock_noBuiltInProfiles, APTANA_CODE_FORMATTER_ID),
IDebugScopes.DEBUG);
}
profiles.addAll(getCustomProfiles());
fProfiles = new HashMap<String, IProfile>();
fSelected = new HashMap<IProject, IProfile>();
fProfilesByName = new ArrayList<IProfile>();
for (final IProfile profile : profiles)
{
fProfiles.put(profile.getID(), profile);
fProfilesByName.add(profile);
}
Collections.sort(fProfilesByName);
if (!fProfilesByName.isEmpty())
{
String storedActiveProfile = getActiveProfileKey().getStoredValue(EclipseUtil.instanceScope());
IProfile workspaceSelectedProfile = fProfiles.get(storedActiveProfile);
if (workspaceSelectedProfile == null)
{
workspaceSelectedProfile = fProfilesByName.get(0);
}
fSelected.put(null, workspaceSelectedProfile);
}
listeners = new ListenerList();
}
示例11: addListenersToWorkingSetManagers
import org.eclipse.core.runtime.ListenerList; //导入依赖的package包/类
private void addListenersToWorkingSetManagers() {
fListeners= new ListenerList(ListenerList.IDENTITY);
fWorkingSetManagerListener= new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
workingSetManagerChanged(event);
}
};
PlatformUI.getWorkbench().getWorkingSetManager().addPropertyChangeListener(fWorkingSetManagerListener);
fLocalWorkingSetManager.addPropertyChangeListener(fWorkingSetManagerListener);
}
示例12: getListeners
import org.eclipse.core.runtime.ListenerList; //导入依赖的package包/类
/**
* @return the listeners attached to this event manager.
* The listeners currently attached; may be empty, but never
* null.
*
*/
protected final Object[] getListeners() {
final ListenerList list = listenerList;
if (list == null) {
return new Object[0];
}
return list.getListeners();
}
示例13: getListeners
import org.eclipse.core.runtime.ListenerList; //导入依赖的package包/类
/**
* Returns the listeners attached to this event manager.
*
* @return The listeners currently attached; may be empty, but never
* <code>null</code>
*/
protected final Object[] getListeners() {
final ListenerList list = listenerList;
if (list == null) {
return EMPTY_ARRAY;
}
return list.getListeners();
}
示例14: refreshThePropertyView
import org.eclipse.core.runtime.ListenerList; //导入依赖的package包/类
private void refreshThePropertyView(final EObject theStereotypeApplication) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
for (final Adapter adapter : theStereotypeApplication.eAdapters()) {
if (isInnerType(adapter, StereotypeApplicationObservableList.class)) {
final ListenerList[] listenerLists = get(ListenerList[].class,
get(StereotypeApplicationObservableList.class, adapter));
if (listenerLists != null) {
for (final ListenerList listenerList : listenerLists) {
for (final Object listener : listenerList.getListeners()) {
if (isInnerType(listener, StereotypeApplication.class)) {
final AppliedStereotypeCompositeWithView composite = get(
AppliedStereotypeCompositeWithView.class,
get(StereotypeApplication.class, listener));
if (composite != null) {
composite.refreshTreeViewer();
}
}
}
}
}
}
}
}
});
}
示例15: fireSelectionChanged
import org.eclipse.core.runtime.ListenerList; //导入依赖的package包/类
private void fireSelectionChanged(ListenerList list, ISelection selection){
SelectionChangedEvent event = new SelectionChangedEvent(delegate, selection);
Object[] listeners = list.getListeners();
for (int i = 0; i < listeners.length; i++) {
ISelectionChangedListener listener = (ISelectionChangedListener) listeners[i];
listener.selectionChanged(event);
}
}