Java Code Examples for org.eclipse.ui.IWorkbench#addWindowListener()

The following examples show how to use org.eclipse.ui.IWorkbench#addWindowListener() . 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: ExampleDropSupportRegistrar.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
private void registerExampleDropAdapter() {
	UIJob registerJob = new UIJob(Display.getDefault(), "Registering example drop adapter.") {
		{
			setPriority(Job.SHORT);
			setSystem(true);
		}

		@Override
		public IStatus runInUIThread(IProgressMonitor monitor) {
			IWorkbench workbench = PlatformUI.getWorkbench();
			workbench.addWindowListener(workbenchListener);
			IWorkbenchWindow[] workbenchWindows = workbench
					.getWorkbenchWindows();
			for (IWorkbenchWindow window : workbenchWindows) {
				workbenchListener.hookWindow(window);
			}
			return Status.OK_STATUS;
		}

	};
	registerJob.schedule();
}
 
Example 2
Source File: ScriptEvaluationContextManager.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Start
 */
public static void startup( )
{
	Runnable r = new Runnable( ) {

		public void run( )
		{
			if ( fgManager == null )
			{
				fgManager = new ScriptEvaluationContextManager( );
				IWorkbench workbench = PlatformUI.getWorkbench( );
				IWorkbenchWindow[] windows = workbench.getWorkbenchWindows( );
				for ( int i = 0; i < windows.length; i++ )
				{
					fgManager.windowOpened( windows[i] );
				}
				workbench.addWindowListener( fgManager );
				fgManager.fActiveWindow = workbench.getActiveWorkbenchWindow( );
			}
		}
	};
	DebugUI.getStandardDisplay( ).asyncExec( r );
}
 
Example 3
Source File: SelectedResourceManager.java    From texlipse with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Private constructor to use with the singleton.
 */
private SelectedResourceManager() {
    IWorkbench workbench = PlatformUI.getWorkbench();
    if (workbench != null) { //may be running headless
        workbench.addWindowListener(this);
        IWorkbenchWindow activeWindow = workbench.getActiveWorkbenchWindow();
        if (activeWindow != null) {
            windowActivated(activeWindow);
        }
    } 
}
 
Example 4
Source File: GdtPlugin.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Adds the new wizards to the current perspective displayed in the workbench's active window, if they've not been
 * added already. Adds listeners on the workbench so that the same is done for any new workbench windows that are
 * created.
 *
 * Note: This method can only be called once the workbench has been started.
 */
private void maybeAddNewWizardActionsToWorkbench() {
  IWorkbench workbench = Workbench.getInstance();
  if (workbench != null) {
    workbench.addWindowListener(windowListener);
    maybeAddNewWizardActionsToWindow(workbench.getActiveWorkbenchWindow());
  } else {
    // This should never happen; the workbench must be started by the time
    // this code is executed
  }
}
 
Example 5
Source File: KeybindingsManager.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private KeybindingsManager(IWorkbench workbench)
{
	this.workbench = workbench;
	state = new KeyBindingState(workbench);
	workbench.addWindowListener(windowListener);

	uniqueKeySequences = new HashSet<KeySequence>();
	uniqueKeySequencesPrefixes = new HashSet<KeySequence>();

	bundleManager = BundleManager.getInstance();
	bundleManager.addLoadCycleListener(this);
}
 
Example 6
Source File: AllInOneWorkbenchListener.java    From typescript.java with MIT License 4 votes vote down vote up
private void hookListeners(final IWorkbench workbench) {
	workbench.addWindowListener(this);
	for (IWorkbenchWindow window : workbench.getWorkbenchWindows()) {
		hookListeners(window);
	}
}
 
Example 7
Source File: EventManager.java    From scava with Eclipse Public License 2.0 3 votes vote down vote up
private void subscribeWindowListener() {
	IWorkbench workbench = PlatformUI.getWorkbench();

	WindowEventListener windowListener = new WindowEventListener();
	windowListener.windowOpened(workbench.getWorkbenchWindows()[0]);

	workbench.addWindowListener(windowListener);

}