/** * @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); } }
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); } }; }
/** * @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; } }
/** * @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]); } } }
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()); } } }
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); }
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()); }
@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); } }
/** * 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); } }
/** * 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(); }
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); }
/** * @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(); }
/** * 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(); }
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(); } } } } } } } } }); }
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); } }
public CodesSelectionComposite(Composite parent, int style){ super(parent, style); currentSelection = new ArrayList<>(); selectionChangedListeners = new ListenerList<>(); createContent(); }
private ElexisEventDispatcher(){ super(ElexisEventDispatcher.class.getName()); setSystem(true); setUser(false); setPriority(Job.SHORT); listeners = new ListenerList<ElexisEventListener>(); dispatchers = new HashMap<Class<?>, IElexisEventDispatcher>(); eventQueue = new PriorityQueue<ElexisEvent>(50); eventCopy = new ArrayList<ElexisEvent>(50); elexisUIContext = new ElexisContext(); }
public SimpleSelectionProvider() { selectionChangedListeners = new ListenerList(); }
public PreferenceManager() { preferences = new Preferences(); preferencesChangeListeners = new ListenerList<>(); initialize(); }
/** * Creates a new monitor. */ public TurnusMonitor() { contents = ""; list = new ListenerList(); }
private WorkspaceTracker() { fListeners = new ListenerList(); }
/** * Initialize the listeners list. */ private void init() { listeners = new ListenerList(); }
public ProblemMarkerManager() { fListeners = new ListenerList(); fResourcesWithMarkerChanges = new HashSet<IResource>(); fResourcesWithAnnotationChanges = new HashSet<IResource>(); }
public static ListenerList getTileListeners() { return _tileListeners; }
private WorkspaceTracker() { fListeners= new ListenerList(); }
public GlobalAnnotationModelListener() { fListenerList= new ListenerList(ListenerList.IDENTITY); }
/** * Create a new SimpleSelectionProvider */ public SimpleSelectionProvider() { fSelectionChangedListeners= new ListenerList(); }
public ProblemMarkerManager() { fListeners= new ListenerList(); fResourcesWithMarkerChanges= new HashSet<IResource>(); fResourcesWithAnnotationChanges= new HashSet<IResource>(); }