Java Code Examples for org.eclipse.swt.widgets.Shell#isVisible()

The following examples show how to use org.eclipse.swt.widgets.Shell#isVisible() . 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: UIExitUtilsSWT.java    From BiglyBT with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @return
 */
public static boolean canClose(GlobalManager globalManager,
		boolean bForRestart) {
	if (skipCloseCheck) {
		return true;
	}

	Shell mainShell = UIFunctionsManagerSWT.getUIFunctionsSWT().getMainShell();
	if (mainShell != null
			&& (!mainShell.isVisible() || mainShell.getMinimized())
			&& COConfigurationManager.getBooleanParameter("Password enabled")) {

		if (!PasswordWindow.showPasswordWindow(Display.getCurrent())) {
			return false;
		}
	}


	if (COConfigurationManager.getBooleanParameter("confirmationOnExit")) {
		if (!getExitConfirmation(bForRestart)) {
			return false;
		}
	}

	for ( canCloseListener listener: listeners ){

		if ( !listener.canClose()){

			return( false );
		}
	}

	return true;
}
 
Example 2
Source File: XbaseInformationControl.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void setVisible(boolean visible) {
	Shell shell = getShell();
	if (shell.isVisible() == visible)
		return;

	if (!visible) {
		super.setVisible(false);
		setInput(null);
		return;
	}

	/*
	 * The Browser widget flickers when made visible while it is not completely loaded.
	 * The fix is to delay the call to setVisible until either loading is completed
	 * (see ProgressListener in constructor), or a timeout has been reached.
	 */
	final Display display = shell.getDisplay();

	// Make sure the display wakes from sleep after timeout:
	display.timerExec(100, new Runnable() {
		@Override
		public void run() {
			fCompleted = true;
		}
	});

	while (!fCompleted) {
		// Drive the event loop to process the events required to load the browser widget's contents:
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}

	shell = getShell();
	if (shell == null || shell.isDisposed())
		return;

	/*
	 * Avoids flickering when replacing hovers, especially on Vista in ON_CLICK mode.
	 * Causes flickering on GTK. Carbon does not care.
	 */
	if ("win32".equals(SWT.getPlatform())) //$NON-NLS-1$
		shell.moveAbove(null);

	super.setVisible(true);
}
 
Example 3
Source File: CustomBrowserInformationControl.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public void setVisible(boolean visible)
{
	Shell shell = getShell();
	if (shell.isVisible() == visible)
		return;

	if (!visible)
	{
		super.setVisible(false);
		setInput(null);
		return;
	}

	/*
	 * The Browser widget flickers when made visible while it is not completely loaded. The fix is to delay the call
	 * to setVisible until either loading is completed (see ProgressListener in constructor), or a timeout has been
	 * reached.
	 */
	final Display display = shell.getDisplay();

	// Make sure the display wakes from sleep after timeout:
	display.timerExec(100, new Runnable()
	{
		public void run()
		{
			fCompleted = true;
		}
	});

	while (!fCompleted)
	{
		// Drive the event loop to process the events required to load the browser widget's contents:
		if (!display.readAndDispatch())
		{
			display.sleep();
		}
	}

	shell = getShell();
	if (shell == null || shell.isDisposed())
		return;

	/*
	 * Avoids flickering when replacing hovers, especially on Vista in ON_CLICK mode. Causes flickering on GTK.
	 * Carbon does not care.
	 */
	if ("win32".equals(SWT.getPlatform())) //$NON-NLS-1$
		shell.moveAbove(null);

	super.setVisible(true);
}