Java Code Examples for org.eclipse.swt.SWT#PRIMARY_MODAL

The following examples show how to use org.eclipse.swt.SWT#PRIMARY_MODAL . 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: ShowDetailDialog.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
protected void openWithWaitShell ( final Shell parentShell, final String detailViewId, final Map<String, String> parameters )
{

    final Shell waitShell = new Shell ( parentShell, SWT.PRIMARY_MODAL | SWT.BORDER );
    waitShell.setLayout ( new FillLayout () );
    final Label label = new Label ( waitShell, SWT.NONE );
    label.setText ( "Opening view…" );

    waitShell.pack ();
    waitShell.open ();

    // make sure the text is visible
    waitShell.getDisplay ().update ();

    try
    {
        open ( parentShell, detailViewId, parameters );
    }
    finally
    {
        // close the wait shell
        waitShell.close ();
    }

}
 
Example 2
Source File: ChoicesDialog.java    From SWET with MIT License 5 votes vote down vote up
private void checkStyle(int style) {
	if ((style & ~(SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL
			| SWT.MODELESS)) != 0) {
		throw new SWTException("Unsupported style");
	}
	if (Integer.bitCount(style) > 1) {
		throw new SWTException(
				"Unsupports only one of APPLICATION_MODAL, PRIMARY_MODAL, SYSTEM_MODAL or SWT.MODELESS");
	}
}
 
Example 3
Source File: ShellFactory.java    From BiglyBT with GNU General Public License v2.0 5 votes vote down vote up
static private int fixupStyle(int style) {
	if ((style & (SWT.APPLICATION_MODAL | SWT.SYSTEM_MODAL | SWT.PRIMARY_MODAL)) != 0
			&& Utils.anyShellHaveStyle(SWT.ON_TOP | SWT.TITLE)) {
		UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
		if (uiFunctions != null && uiFunctions.getMainShell() != null) {
			style |= SWT.ON_TOP;
		}
	}
	return style;
}
 
Example 4
Source File: SelectVisibleColumnDialog.java    From logbook with MIT License 5 votes vote down vote up
/**
 * Create contents of the dialog.
 */
private void createContents() {
    this.shell = new Shell(this.getParent(), SWT.SHELL_TRIM | SWT.PRIMARY_MODAL);
    this.shell.setSize(300, 275);
    this.shell.setText("列の表示非表示");
    this.shell.setLayout(new FillLayout(SWT.HORIZONTAL));

    // ヘッダー
    String[] header = Stream.of(this.table.getColumns()).map(c -> c.getText()).toArray(String[]::new);
    // カラム設定を取得
    boolean[] visibles = AppConfig.get().getVisibleColumnMap().get(this.clazz.getName());
    if ((visibles == null) || (visibles.length != header.length)) {
        visibles = new boolean[header.length];
        Arrays.fill(visibles, true);
        AppConfig.get().getVisibleColumnMap().put(this.clazz.getName(), visibles);
    }

    Tree tree = new Tree(this.shell, SWT.BORDER | SWT.CHECK);

    for (int i = 1; i < header.length; i++) {
        TreeItem column = new TreeItem(tree, SWT.CHECK);
        column.setText(header[i]);
        column.setChecked(visibles[i]);
        column.setExpanded(true);
    }
    this.shell.addShellListener(new TreeShellAdapter(tree, visibles));
}
 
Example 5
Source File: AbstractWizard.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Opens the wizard and return the result
 * 
 * @return the result
 */
public Object open( )
{
	//initialize the shell
	Shell shell = new Shell( PlatformUI.getWorkbench( )
			.getDisplay( )
			.getActiveShell( ), SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL );

	shell.setLayout( new GridLayout( ) );

	//initialize the composite
	Composite composite = new Composite( shell, SWT.NONE );
	composite.setLayoutData( new GridData( GridData.HORIZONTAL_ALIGN_CENTER ) );
	GridLayout layout = new GridLayout( );
	layout.numColumns = 2;
	composite.setLayout( layout );

	//create wizard dialog
	WizardDialog dialog = new WizardDialog( shell, wizard );
	dialog.create( );
	dialog.setFinishLabel( finishLabel );

	//initialize page
	initPage( wizard.getStartingPage( ) );

	if ( dialog.open( ) == WizardDialog.CANCEL )
	{//Cancel was pressed
		return null;
	}
	//Finish button was pressed
	return model;
}
 
Example 6
Source File: MessageModal.java    From Universal-FE-Randomizer with MIT License 4 votes vote down vote up
public MessageModal(Shell parent, String title, String message) {
	display = Display.getDefault();
	yuneImage = new Image(display, Main.class.getClassLoader().getResourceAsStream("YuneIcon_100x100.png"));
	
	dialogShell = new Shell(parent, SWT.PRIMARY_MODAL | SWT.DIALOG_TRIM);
	dialogShell.setText(title);
	dialogShell.setImage(yuneImage);
	
	dialogShell.addListener(SWT.CLOSE, new Listener() {

		@Override
		public void handleEvent(Event event) {
			event.doit = false;
		}
		
	});
	
	FormLayout mainLayout = new FormLayout();
	mainLayout.marginWidth = 5;
	mainLayout.marginHeight = 5;
	dialogShell.setLayout(mainLayout);
	
	imageLabel = new Label(dialogShell, SWT.NONE);
	imageLabel.setImage(yuneImage);
	
	FormData imageData = new FormData(100, 100);
	imageData.left = new FormAttachment(0, 10);
	imageData.top = new FormAttachment(0, 10);
	imageLabel.setLayoutData(imageData);
	
	contentGroup = new Composite(dialogShell, SWT.NONE);
	FormLayout contentLayout = new FormLayout();
	contentLayout.marginTop = 5;
	contentLayout.marginLeft = 5;
	contentLayout.marginBottom = 5;
	contentLayout.marginRight = 5;
	contentGroup.setLayout(contentLayout);
	
	titleLabel = new Label(contentGroup, SWT.LEFT);
	titleLabel.setText(title);
	FontData normalFont = titleLabel.getFont().getFontData()[0];
	Font boldFont = new Font(display, normalFont.getName(), normalFont.getHeight(), SWT.BOLD);
	titleLabel.setFont(boldFont);
	
	FormData titleData = new FormData();
	titleData.top = new FormAttachment(0, 0);
	titleData.left = new FormAttachment(0, 0);
	titleData.right = new FormAttachment(100, 0);
	titleLabel.setLayoutData(titleData);
	
	descriptionLabel = new Label(contentGroup, SWT.LEFT | SWT.WRAP);
	descriptionLabel.setText(message);
	
	FormData descriptionData = new FormData();
	descriptionData.left = new FormAttachment(titleLabel, 0, SWT.LEFT);
	descriptionData.right = new FormAttachment(titleLabel, 0, SWT.RIGHT);
	descriptionData.top = new FormAttachment(titleLabel, 10);
	descriptionData.bottom = new FormAttachment(100, -5);
	Point expectedSize = descriptionLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	descriptionData.width = Math.max(200, expectedSize.x);
	descriptionData.height = Math.max(60, expectedSize.y);
	descriptionLabel.setLayoutData(descriptionData);
	
	FormData groupData = new FormData();
	groupData.left = new FormAttachment(imageLabel, 10);
	groupData.top = new FormAttachment(imageLabel, 0, SWT.TOP);
	groupData.right = new FormAttachment(100, -10);
	contentGroup.setLayoutData(groupData);
	
	layoutSize();
	Rectangle parentBounds = parent.getBounds();
	Rectangle dialogBounds = dialogShell.getBounds();
	
	dialogShell.setLocation(parentBounds.x + (parentBounds.width - dialogBounds.width) / 2, parentBounds.y + (parentBounds.height - dialogBounds.height) / 2);
}
 
Example 7
Source File: ProgressModal.java    From Universal-FE-Randomizer with MIT License 4 votes vote down vote up
public ProgressModal(Shell parent, String title) {
	display = Display.getDefault();
	yuneImage = new Image(display, Main.class.getClassLoader().getResourceAsStream("YuneIcon_100x100.png"));
	
	dialogShell = new Shell(parent, SWT.PRIMARY_MODAL | SWT.DIALOG_TRIM);
	dialogShell.setText(title);
	dialogShell.setImage(yuneImage);
	
	progressBar = new ProgressBar(dialogShell, SWT.SMOOTH);
	
	FormLayout mainLayout = new FormLayout();
	mainLayout.marginWidth = 5;
	mainLayout.marginHeight = 5;
	dialogShell.setLayout(mainLayout);
	
	imageLabel = new Label(dialogShell, SWT.NONE);
	imageLabel.setImage(yuneImage);
	
	FormData imageData = new FormData(100, 100);
	imageData.left = new FormAttachment(0, 10);
	imageData.top = new FormAttachment(0, 10);
	imageData.bottom = new FormAttachment(100, -10);
	imageLabel.setLayoutData(imageData);
	
	FormData progressData = new FormData(300, 20);
	progressData.left = new FormAttachment(imageLabel, 10);
	progressData.bottom = new FormAttachment(imageLabel, -50, SWT.CENTER);
	progressData.right = new FormAttachment(100, -10);
	progressBar.setLayoutData(progressData);
	
	statusLabel = new Label(dialogShell, SWT.NONE);
	
	FormData statusData = new FormData();
	statusData.left = new FormAttachment(progressBar, 0, SWT.LEFT);
	statusData.top = new FormAttachment(progressBar, 5);
	statusData.right = new FormAttachment(100, -10);
	statusLabel.setLayoutData(statusData);
	
	dialogShell.layout();
	final Point newSize = dialogShell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
	dialogShell.setSize(newSize);
	
	Rectangle parentBounds = parent.getBounds();
	Rectangle dialogBounds = dialogShell.getBounds();
	
	dialogShell.setLocation(parentBounds.x + (parentBounds.width - dialogBounds.width) / 2, parentBounds.y + (parentBounds.height - dialogBounds.height) / 2);
}
 
Example 8
Source File: MainSWT.java    From Flashtool with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Open the window.
 */
public void open() {
	if (GlobalConfig.getProperty("gitauto")==null) GlobalConfig.setProperty("gitauto", "true");
	Display.setAppName("Flashtool");
	Display display = Display.getDefault();
	GlobalConfig.setProperty("clientheight", Integer.toString(display.getClientArea().height));
	GlobalConfig.setProperty("clientwidth", Integer.toString(display.getClientArea().width));
	GlobalConfig.setProperty("ydpi", Integer.toString(display.getDPI().y));
	GlobalConfig.setProperty("xdpi", Integer.toString(display.getDPI().x));
	createContents();
	guimode=true;
	shlSonyericsson.open();
	shlSonyericsson.layout();
	boolean folderexists = (new File(OS.getWorkDir()+File.separator+"firmwares").exists() || new File(OS.getWorkDir()+File.separator+"custom"+File.separator+"mydevices").exists());
	if (folderexists) {
		HomeSelector hs = new HomeSelector(shlSonyericsson,SWT.PRIMARY_MODAL | SWT.SHEET);
		String result = (String)hs.open(false);
		GlobalConfig.setProperty("user.flashtool", result);
		forceMove(OS.getWorkDir()+File.separator+"firmwares",OS.getFolderFirmwares());
		forceMove(OS.getWorkDir()+File.separator+"custom"+File.separator+"mydevices",OS.getFolderRegisteredDevices());
		new File(OS.getWorkDir()+File.separator+"firmwares").delete();
		new File(OS.getWorkDir()+File.separator+"custom"+File.separator+"mydevices").delete();
	}
	if (GlobalConfig.getProperty("gitauto").equals("true")) {
		WaitForDevicesSync sync = new WaitForDevicesSync(shlSonyericsson,SWT.PRIMARY_MODAL | SWT.SHEET);
		sync.open();
	}
	WidgetTask.setEnabled(mntmAdvanced,GlobalConfig.getProperty("devfeatures").equals("yes"));
	StatusListener phoneStatus = new StatusListener() {
		public void statusChanged(StatusEvent e) {
			if (!e.isDriverOk()) {
				logger.error("Drivers need to be installed for connected device.");
				logger.error("You can find them in the drivers folder of Flashtool.");
			}
			else {
				if (e.getNew().equals("adb_unauthorized")) {
					logger.info("Unauthorized device connected with USB debugging on");
					logger.info("Check the device to accept the authorization");
				}
				if (e.getNew().equals("adb")) {
					logger.info("Device connected with USB debugging on");
					logger.debug("Device connected, continuing with identification");
					doIdent();
				}
				if (e.getNew().equals("none")) {
					logger.info("Device disconnected");
					doDisableIdent();
				}
				if (e.getNew().equals("flash")) {
					logger.info("Device connected in flash mode");
					doDisableIdent();
				}
				if (e.getNew().equals("flash_obsolete")) {
					logger.error("Device connected in flash mode but driver is too old");
					doDisableIdent();
				}
				if (e.getNew().equals("fastboot")) {
					logger.info("Device connected in fastboot mode");
					doDisableIdent();
				}
				if (e.getNew().equals("normal")) {
					logger.info("Device connected with USB debugging off");
					logger.info("For 2011 devices line, be sure you are not in MTP mode");
					doDisableIdent();
				}
			}
		}
	};
	killAdbandFastboot();
	Devices.load();
	logger.info("Starting phone detection");
	DeviceChangedListener.starts(phoneStatus);
	//phoneWatchdog = new AdbPhoneThread();
	//phoneWatchdog.start();
	//phoneWatchdog.addStatusListener(phoneStatus);
	while (!shlSonyericsson.isDisposed()) {
		if (!display.readAndDispatch()) {
			display.sleep();
		}
	}
}
 
Example 9
Source File: MainSWT.java    From Flashtool with GNU General Public License v3.0 4 votes vote down vote up
public void doFastBoot() throws Exception {
	FastbootToolbox fbbox = new FastbootToolbox(shlSonyericsson,SWT.PRIMARY_MODAL | SWT.SHEET);
	fbbox.open();
}
 
Example 10
Source File: TreeDialogBar.java    From slr-toolkit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Create the dialog.
 * @param parent
 * @param style
 */
public TreeDialogBar(Shell parent, int style) {
	super(parent, SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL);
	setText("SWT Dialog");
}
 
Example 11
Source File: TreeDialogBubble.java    From slr-toolkit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Create the dialog.
 * @param parent
 * @param style
 */
public TreeDialogBubble(Shell parent, int style) {
	super(parent, SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL);
	setText("SWT Dialog");
}