private static void readMode(final Shell shell, final String mode) { if (mode != null) { if ("maximized".equals(mode)) { shell.setMaximized(true); } else if ("minimized".equals(mode)) { shell.setMinimized(true); } else { shell.setMinimized(false); shell.setMaximized(false); } } }
private Shell createShell(Display display) { final Shell shell = new Shell(display, SWT.NO_TRIM); shell.setMaximized(true); GridLayout shellLayout = new GridLayout(1, false); shellLayout.marginHeight = 0; shellLayout.marginWidth = 0; shell.setLayout(shellLayout); return shell; }
public void open(Shell shell) { if (shell.getParent() != null) { shell.setMaximized(true); shell.open(); return; } // shell.setMaximized(true); shell.setSize(800, 550); shell.open(); Display display = shell.getDisplay(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); System.exit(-1); }
/** This method initializes mainWindow */ public void createMainWindow() { resultWindow = new Shell(); resultWindow.setImage(new Image(Display.getCurrent(), "resources/MathWorldIcon.gif")); resultWindow.setText(title); resultWindow.setMaximized(false); resultWindow.setSize(new Point(394, 671)); resultWindow.setLayout(new FillLayout()); FormData formData2 = new FormData(); formData2.bottom = new FormAttachment(100, -5); formData2.left = new FormAttachment(30, 50); formData2.right = new FormAttachment(70, -50); FormData formData1 = new FormData(); formData1.bottom = new FormAttachment(100, -5); formData1.right = new FormAttachment(30, -50); formData1.left = new FormAttachment(0, 50); Text clusteringResultTextArea = new Text(resultWindow, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); clusteringResultTextArea.setText(printedClusteringResult); }
/** @throws java.lang.Exception */ @Override protected void setUp() throws Exception { fDsfExecutor = new DefaultDsfExecutor(); fDsfSession = DsfSession.startSession(fDsfExecutor, getClass().getName()); fDisplay = PlatformUI.getWorkbench().getDisplay(); fShell = new Shell(fDisplay /*, SWT.ON_TOP | SWT.SHELL_TRIM*/); fShell.setMaximized(true); fShell.setLayout(new FillLayout()); fViewer = createViewer(fDisplay, fShell); fModel = new TestModel(fDsfSession); initializeService(fModel); fDummyValuesService = new DummyFormattedValueService(fDsfSession); initializeService(fDummyValuesService); fViewerListener = new TestModelUpdatesListener(fViewer, true, false); fModel.setRoot(new TestElement(fModel, "root", new TestElement[0])); fModel.setElementChildren( TreePath.EMPTY, makeModelElements(fModel, getTestModelDepth(), "model")); fVMAdapter = new AbstractVMAdapter() { @Override protected IVMProvider createViewModelProvider(IPresentationContext context) { return fVMProvider; } }; fVMProvider = new TestModelCachingVMProvider(fVMAdapter, fViewer.getPresentationContext(), fDsfSession); fVMListener = new TestModelUpdatesListener(); fVMProvider.getNode().setVMUpdateListener(fVMListener); fVMProvider.getNode().getLabelProvider().addPropertiesUpdateListener(fViewerListener); fFormattedValuesListener = new FormattedValuesListener(fModel); fVMProvider.getNode().setFormattedValuesListener(fFormattedValuesListener); fModel.setTestModelListener(fFormattedValuesListener); fShell.open(); }
/** * helper to create view model and viewer * * @param vmOnly true to create view model only and do not create viewer */ void createViewer(boolean vmOnly) { if (vmOnly == false) { fDisplay = PlatformUI.getWorkbench().getDisplay(); fShell = new Shell(fDisplay /*, SWT.ON_TOP | SWT.SHELL_TRIM*/); fShell.setMaximized(true); fShell.setLayout(new FillLayout()); fViewer = createViewer(fDisplay, fShell); fViewerListener = new TestModelUpdatesListener(fViewer, true, false); } fVMProvider = new TestElementFormatVMProvider(fVMAdapter, fViewer.getPresentationContext(), fDsfSession); fVMListener = new TestModelUpdatesListener(); fVMProvider.getNode().setVMUpdateListener(fVMListener); fVMProvider.getNode().getLabelProvider().addPropertiesUpdateListener(fViewerListener); fVMProvider.getNode().setFormattedValuesListener(fFormattedValuesListener); if (vmOnly == false) { fShell.open(); } }
public Application() { display = new Display(); shell = new Shell(display); shell.setText("Pic's Tagger"); // registry loadPlacesFromRegistry(); FormLayout formLayout = new FormLayout(); formLayout.marginHeight = 2; formLayout.marginWidth = 2; shell.setLayout(formLayout); shell.setSize(1024, 768); shell.setMaximized(false); this.initUI(); shell.pack(); shell.open(); }
/** Creates and initializes the main window. */ public MainWindow( Shell shell, GUIConfig guiConfig, Composite feederArea, Composite controlsArea, Combo feederSelectionCombo, Button startStopButton, StartStopScanningAction startStopScanningAction, ResultTable resultTable, StatusBar statusBar, CommandsMenu resultsContextMenu, FeederGUIRegistry feederGUIRegistry, final StateMachine stateMachine, ToolsActions.Preferences preferencesListener, ToolsActions.ChooseFetchers chooseFetchersListsner) { this.shell = shell; this.guiConfig = guiConfig; this.statusBar = statusBar; initShell(shell); initFeederArea(feederArea, feederGUIRegistry); initControlsArea( controlsArea, feederSelectionCombo, startStopButton, startStopScanningAction, preferencesListener, chooseFetchersListsner); initTableAndStatusBar(resultTable, resultsContextMenu, statusBar); // after all controls are initialized, resize and open shell.setSize(guiConfig.getMainWindowSize()); shell.open(); if (guiConfig.isMainWindowMaximized) { shell.setMaximized(true); } if (guiConfig.isFirstRun) { Display.getCurrent() .asyncExec( new Runnable() { public void run() { GettingStartedDialog dialog = new GettingStartedDialog(); if (Platform.CRIPPLED_WINDOWS) dialog.prependText(Labels.getLabel("text.crippledWindowsInfo")); if (Platform.GNU_JAVA) dialog.prependText(Labels.getLabel("text.gnuJavaInfo")); MainWindow.this.shell.forceActive(); dialog.open(); MainWindow.this.guiConfig.isFirstRun = false; } }); } stateMachine.addTransitionListener(new EnablerDisabler()); Display.getCurrent() .asyncExec( new Runnable() { public void run() { // asynchronously run init handlers outside of the constructor stateMachine.init(); } }); }