org.eclipse.core.runtime.ListenerList Java Examples

The following examples show how to use org.eclipse.core.runtime.ListenerList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PathsProvider.java    From spotbugs with GNU Lesser General Public License v2.1 6 votes vote down vote up
protected PathsProvider(TableViewer viewer, FindbugsPropertyPage propertyPage) {
    this.propertyPage = propertyPage;
    this.paths = new ArrayList<>();
    this.viewer = viewer;
    if (viewer instanceof CheckboxTableViewer) {
        CheckboxTableViewer tv = (CheckboxTableViewer) viewer;
        tv.setCheckStateProvider(this);
        tv.addCheckStateListener(new ICheckStateListener() {
            @Override
            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);
}
 
Example #2
Source File: HistogramDataModel.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Copy constructor.
 *
 * @param other
 *            A model to copy.
 */
public HistogramDataModel(HistogramDataModel other) {
    fNbBuckets = other.fNbBuckets;
    fBuckets = new HistogramBucket[fNbBuckets];
    for (int i = 0; i < fNbBuckets; i++) {
        fBuckets[i] = new HistogramBucket(other.fBuckets[i]);
    }
    fLostEventsBuckets = Arrays.copyOf(other.fLostEventsBuckets, fNbBuckets);
    fBucketDuration = Math.max(other.fBucketDuration, 1);
    fNbEvents = other.fNbEvents;
    fLastBucket = other.fLastBucket;
    fFirstBucketTime = other.fFirstBucketTime;
    fFirstEventTime = other.fFirstEventTime;
    fEndTime = other.fEndTime;
    fSelectionBegin = other.fSelectionBegin;
    fSelectionEnd = other.fSelectionEnd;
    fTimeLimit = other.fTimeLimit;
    fModelListeners = new ListenerList<>();
    for (IHistogramModelListener listener : other.fModelListeners) {
        fModelListeners.add(listener);
    }
}
 
Example #3
Source File: ProblemsLabelDecorator.java    From goclipse with Eclipse Public License 1.0 6 votes vote down vote up
@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);
	}
}
 
Example #4
Source File: ScriptConsole.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
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());
}
 
Example #5
Source File: ICEMeshPage.java    From ice with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * The constructor
 * 
 * @param editor
 *            The FormEditor for which the page should be constructed.
 * @param id
 *            The id of the page.
 * @param title
 *            The title of the page.
 */
public ICEMeshPage(FormEditor editor, String id, String title) {

	// Just call ICEFormPage's constructor
	super(editor, id, title);

	// Create the list of actions (these go in the ToolBar and the
	// rightClickMenu).
	actions = new ArrayList<ActionTree>();

	// Initialize the Menu- and ToolBarManagers.
	actionToolBarManager = new ToolBarManager();
	actionMenuManager = new MenuManager();

	// Initialize the collection of selection listeners
	listeners = new ListenerList();

	return;
}
 
Example #6
Source File: SelectionListenerWithASTManager.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
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);
		}
	};
}
 
Example #7
Source File: SelectionProviderMediator.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @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);
	}
}
 
Example #8
Source File: ElexisEventDispatcher.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
private ElexisEventDispatcher(){
	listeners = new ListenerList<ElexisEventListener>();
	eventQueue = new PriorityQueue<ElexisEvent>(50);
	eventCopy = new ArrayList<ElexisEvent>(50);
	
	elexisUIContext = new ElexisContext();
	
	service = Executors.newSingleThreadScheduledExecutor();
}
 
Example #9
Source File: CodesSelectionComposite.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public CodesSelectionComposite(Composite parent, int style){
	super(parent, style);
	currentSelection = new ArrayList<>();
	selectionChangedListeners = new ListenerList<>();
	
	createContent();
}
 
Example #10
Source File: DelegatingSelectionProvider.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
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);
	}
}
 
Example #11
Source File: DocumentsFilterBarComposite.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
public DocumentsFilterBarComposite(Composite parent, int style, List<FilterCategory> filters){
	super(parent, style);
	currentSelection = null;
	selectionChangedListeners = new ListenerList<>();
	this.filters = filters;
	createContent();
}
 
Example #12
Source File: InMemoryEclipsePreferences.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void addPreferenceChangeListener(IPreferenceChangeListener listener) {
    if (preferenceChangeListeners == null) {
        preferenceChangeListeners = new ListenerList<>();
    }
    preferenceChangeListeners.add(listener);

}
 
Example #13
Source File: WorkingSetModel.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
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);
}
 
Example #14
Source File: ProfileManager.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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();
}
 
Example #15
Source File: HistogramDataModel.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Constructor with non-default number of buckets.
 *
 * @param startTime
 *            the histogram start time
 * @param nbBuckets
 *            A number of buckets.
 */
public HistogramDataModel(long startTime, int nbBuckets) {
    fFirstBucketTime = fFirstEventTime = fEndTime = startTime;
    fNbBuckets = nbBuckets;
    fBuckets = new HistogramBucket[nbBuckets];
    fLostEventsBuckets = new long[nbBuckets];
    fModelListeners = new ListenerList<>();
    clear();
}
 
Example #16
Source File: OutputStreamMonitor.java    From xds-ide with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Causes the monitor to close all
 * communications between it and the
 * underlying stream by waiting for the thread to terminate.
 */
protected void close() {
	if (fThread != null) {
		Thread thread= fThread;
		fThread= null;
		try {
			thread.join();
		} catch (InterruptedException ie) {
		}
		fListeners = new ListenerList();
	}
}
 
Example #17
Source File: ProblemMarkerManager.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public ProblemMarkerManager() {
	fListeners= new ListenerList();
	fResourcesWithMarkerChanges= new HashSet<IResource>();
	fResourcesWithAnnotationChanges= new HashSet<IResource>();
}
 
Example #18
Source File: SimpleSelectionProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Create a new SimpleSelectionProvider
 */
public SimpleSelectionProvider() {
	fSelectionChangedListeners= new ListenerList();
}
 
Example #19
Source File: PackageViewerWrapper.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public PackageViewerWrapper() {
	fListenerList= new ListenerList(ListenerList.IDENTITY);
	fPostSelectionChangedListenerList= new ListenerList(ListenerList.IDENTITY);
	fSelectionChangedListenerList= new ListenerList(ListenerList.IDENTITY);
}
 
Example #20
Source File: CompilationUnitDocumentProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public GlobalAnnotationModelListener() {
	fListenerList= new ListenerList(ListenerList.IDENTITY);
}
 
Example #21
Source File: AvailableCordovaEnginesSection.java    From thym with Eclipse Public License 1.0 4 votes vote down vote up
public AvailableCordovaEnginesSection() {
	this.selectionListeners = new ListenerList<ISelectionChangedListener>();
	this.engineChangeListeners = new ListenerList<EngineListChangeListener>();
	this.formToolkit = null;
}
 
Example #22
Source File: WorkspaceTracker.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private WorkspaceTracker() {
	fListeners= new ListenerList();
}
 
Example #23
Source File: ProblemMarkerManager.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public ProblemMarkerManager()
{
	fListeners = new ListenerList();
	fResourcesWithMarkerChanges = new HashSet<IResource>();
	fResourcesWithAnnotationChanges = new HashSet<IResource>();
}
 
Example #24
Source File: ProblemMarkerManager.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Singleton
 */
protected ProblemMarkerManager() {
    fListeners = new ListenerList();
    fResourcesWithMarkerChanges = new HashSet<IResource>();
    fResourcesWithAnnotationChanges = new HashSet<IResource>();
}
 
Example #25
Source File: CListViewer.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Initialize the listeners list.
 */
private void init()
{
	listeners = new ListenerList();
}
 
Example #26
Source File: ProblemMarkerManager.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
public ProblemMarkerManager() {
	fListeners= new ListenerList<>();
	fResourcesWithMarkerChanges= new HashSet<IResource>();
	fResourcesWithAnnotationChanges= new HashSet<IResource>();
}
 
Example #27
Source File: PreferenceManager.java    From eclipse.jdt.ls with Eclipse Public License 2.0 4 votes vote down vote up
public PreferenceManager() {
	preferences = new Preferences();
	preferencesChangeListeners = new ListenerList<>();
	eclipsePrefs = InstanceScope.INSTANCE.getNode(IConstants.PLUGIN_ID);
	initialize();
}
 
Example #28
Source File: WorkspaceTracker.java    From eclipse.jdt.ls with Eclipse Public License 2.0 4 votes vote down vote up
private WorkspaceTracker() {
	fListeners = new ListenerList<>();
}