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

The following examples show how to use org.eclipse.swt.widgets.Shell#setMinimumSize() . 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: Notifier.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Creates a notification window
 *
 * @param image image. If <code>null</code>, a default image is used
 * @param title title, the title of the window
 * @param text text of the window
 * @param colors color set
 * @return the notification window as a shell object
 */
protected static Shell createNotificationWindow(final Image image, final String title, final String text, final NotifierColors colors) {
	final Shell shell = new Shell(Display.getDefault().getActiveShell(), SWT.NO_TRIM | SWT.NO_FOCUS | SWT.ON_TOP);
	shell.setLayout(new GridLayout(2, false));
	shell.setBackgroundMode(SWT.INHERIT_FORCE);

	createTitle(shell, title, colors);
	createImage(shell, image);
	createText(shell, text, colors);
	createBackground(shell, colors);
	createCloseAction(shell);

	shell.addListener(SWT.Dispose, event -> {
		colors.dispose();
	});

	shell.pack();
	shell.setMinimumSize(320, 100);
	return shell;
}
 
Example 2
Source File: TimeGraphFindDialog.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void create() {
    super.create();

    Shell shell = getShell();
    shell.addShellListener(fActivationListener);

    // fill in combo contents
    fFindField.removeModifyListener(fFindModifyListener);
    updateCombo(fFindField, fFindHistory);
    fFindField.addModifyListener(fFindModifyListener);

    // get find string
    initFindStringFromSelection();

    shell.setMinimumSize(shell.getSize());

    // set dialog position
    if (fDialogPositionInit != null) {
        shell.setBounds(fDialogPositionInit);
    }

    shell.setText(Messages.TimeGraphFindDialog_FindTitle);
}
 
Example 3
Source File: DialogWithToggle.java    From eclipse-explorer with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void configureShell(Shell newShell) {
    super.configureShell(newShell);
    newShell.setImage(getSWTImage(SWT.ICON_WARNING));
    newShell.setText(title);
    int width = newShell.getMonitor().getClientArea().width;
    // int height = newShell.getMonitor().getClientArea().height;
    int w = Math.min(600, width >> 1);
    // int h = Math.min(300, height >> 1);
    newShell.setMinimumSize(w, 0);
}
 
Example 4
Source File: DeployPreferencesDialog.java    From google-cloud-eclipse with Apache License 2.0 4 votes vote down vote up
private void handleLayoutChange() {
  Shell shell = getShell();
  shell.setMinimumSize(shell.getSize().x, 0);
  shell.pack();
  shell.setMinimumSize(shell.getSize());
}
 
Example 5
Source File: AddAnalysisDialog.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void create() {
    super.create();
    Shell shell = getShell();
    shell.setMinimumSize(shell.getSize());
}
 
Example 6
Source File: EditorTextWindow.java    From ldparteditor with MIT License 4 votes vote down vote up
/**
 * Run a fresh instance of this window
 */
public void run(DatFile fileToOpen, boolean closeASAP) {
    if (!isSeperateWindow()) {
        return;
    }
    Project.getOpenTextWindows().add(this);
    // Load the window state data
    this.editorTextWindowState = WorkbenchManager.getEditorTextWindowState();
    // Creating the window to get the shell
    this.create();
    final Shell sh = this.getShell();
    sh.setText(Version.getApplicationName() + " " + Version.getVersion()); //$NON-NLS-1$
    sh.setImage(ResourceManager.getImage("imgDuke2.png")); //$NON-NLS-1$
    sh.setMinimumSize(640, 480);
    sh.setBounds(this.editorTextWindowState.getWindowState().getSizeAndPosition());
    if (this.editorTextWindowState.getWindowState().isCentered()) {
        ShellHelper.centerShellOnPrimaryScreen(sh);
    }
    // Maximize has to be called asynchronously
    sh.getDisplay().asyncExec(new Runnable() {
        @Override
        public void run() {
            try {
                if (!sh.isDisposed()) {
                    sh.setMaximized(editorTextWindowState.getWindowState().isMaximized());
                    sh.forceActive();
                }
            } catch (SWTException consumed) {}
        }
    });
    // The window reference has to be added to the tab folder
    tabFolder[0].setWindow(editorTextWindow);
    // and the tab for the file has to be created.
    {
        CompositeTab tbtmnewItem = new CompositeTab(tabFolder[0], SWT.CLOSE);
        tbtmnewItem.setFolderAndWindow(tabFolder[0], editorTextWindow);
        tbtmnewItem.getState().setFileNameObj(fileToOpen);
        tbtmnewItem.parseForErrorAndHints();
        tabFolder[0].setSelection(tbtmnewItem);
    }

    // MARK All final listeners will be configured here..
    registerEvents();

    this.open();
    if (closeASAP) {
        closeTabWithDatfile(Project.getFileToEdit());
    }
}