public void readData(final Widget widget) { // HttpServletRequest request = ContextProvider.getRequest(); // String parameter = request.getParameter( "JSON" ); // if( parameter != null ) { // System.out.println( "#### BEGIN ####"); // System.out.println( parameter ); // System.out.println( "#### END ####"); // } Shell shell = (Shell) widget; // [if] Preserve the menu bounds before setting the new shell bounds. preserveMenuBounds(shell); // Important: Order matters, readMode() before readBounds() readBounds(shell); if (WidgetLCAUtil.wasEventSent(shell, JSConst.EVENT_SHELL_CLOSED)) { shell.close(); } processActiveShell(shell); processActivate(shell); ControlLCAUtil.processMouseEvents(shell); ControlLCAUtil.processKeyEvents(shell); ControlLCAUtil.processMenuDetect(shell); WidgetLCAUtil.processHelp(shell); }
protected void guardar() { try { validar(); Concepto c; if (concepto == null) c = new Concepto(); else c = concepto; c.setConcepto(txConcepto.getText()); c.setCosto(rubros.get(cbRubro.getSelectionIndex())); // Guardar el concepto contable.guardarConcepto(c); result = c; shlEditarConcepto.close(); } catch (Exception e) { // TODO Capturar la excepción de duplicado y enviarlo en un mensaje // adecuado MessageBox mb = new MessageBox(shlEditarConcepto, SWT.ICON_WARNING); mb.setMessage(e.getMessage()); mb.open(); } }
/** OK Button click event */ private void onClickOK() { Grid g = gridViewer.getGrid(); if (g.getSelectionIndex() == -1) { MessageDialog.openInformation(shell, "데이터 선택 필요", "선택된 데이터가 없습니다. \n\n목록에서 선택 후 작업하세요."); return; } else { if (listData != null && listData.length > g.getSelectionIndex()) { TsWgtInfDTO vo = listData[g.getSelectionIndex()]; WeighSecondDialog dialog = new WeighSecondDialog(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); shell.close(); Object answer = dialog.open(vo); if (answer != null) { HomeView hv = (HomeView) PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getActivePage() .findView(HomeView.ID); hv.refreshData(); } } } }
/** Close tooltip immediatedly without animation. */ public void close() { if (_shell != null) { _shell.close(); _shell = null; } }
/** Auto-generated event handler method */ protected void enterMouseDown(MouseEvent evt) { identifier = identifierTxt.getText(); version = versionTxt.getText(); isAbstract = isAbstractBtn.getSelection(); isLocal = isLocalBtn.getSelection(); state = true; dialogShell.close(); }
public void close() { // 从池中删除对splash窗口的引用 // ObjectPool.INSTANCE.removeObject(GlobalServiceId.Splash_Win); // container.loadMovie(0, ""); if (shell != null) { container.dispose(); shell.close(); } }
/* (non-Javadoc) * @see view.ServerView#stopRunning() */ public void stopRunning() { MessageBox popMsg = new MessageBox(shell, SWT.ICON_INFORMATION); popMsg.setText("info!"); popMsg.setMessage("A successful exit"); popMsg.open(); shell.close(); display.close(); }
private void createLoadingBar() { new ProgressMonitorDialog(parent); Shell shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); shell.setText("Report Loading"); shell.addDisposeListener( new org.eclipse.swt.events.DisposeListener() { @Override public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e) { if (thread.isAlive()) { thread.interrupt(); reportFinished = true; } } }); Label label = new Label(shell, SWT.NONE); label.setSize(new Point(260, 20)); label.setLocation(20, 30); label.setText("Please wait while the report loads."); label.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8)); label.setAlignment(SWT.CENTER); Label timelabel = new Label(shell, SWT.NONE); timelabel.setSize(new Point(260, 20)); timelabel.setLocation(20, 50); // timelabel.setText("(approx " + timeEst + ")"); timelabel.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8)); timelabel.setAlignment(SWT.CENTER); ProgressBar progressBar = new ProgressBar(shell, SWT.HORIZONTAL | SWT.INDETERMINATE); progressBar.setSize(new Point(200, 20)); progressBar.setLocation(50, 80); Button button = new Button(shell, SWT.NONE); button.setSize(new Point(100, 30)); button.setLocation(100, 120); button.setText("Cancel"); button.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8)); button.setAlignment(SWT.CENTER); button.addSelectionListener( new org.eclipse.swt.events.SelectionAdapter() { @Override public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) { if ((thread != null) && thread.isAlive()) { thread.interrupt(); reportFinished = true; } } }); shell.setSize(new Point(300, 200)); LayoutUtils.centerGUI(shell); shell.open(); while (!reportFinished) { if (!parent.getDisplay().readAndDispatch()) { parent.getDisplay().sleep(); } } if (!shell.isDisposed()) { shell.close(); } }
/* (non-Javadoc) * @see org.eclipse.swt.events.KeyListener#keyPressed(org.eclipse.swt.events.KeyEvent) */ public void keyPressed(KeyEvent e) { if (e.character == SWT.CR) { identifier = identifierTxt.getText(); version = versionTxt.getText(); isAbstract = isAbstractBtn.getSelection(); isLocal = isLocalBtn.getSelection(); state = true; dialogShell.close(); } }
public void test_changedLorg_eclipse_swt_browser_ProgressEvent() { Display display = Display.getCurrent(); Shell shell = new Shell(display); Browser browser = new Browser(shell, SWT.NONE); browser.addProgressListener( new ProgressListener() { public void changed(ProgressEvent event) {} public void completed(ProgressEvent event) {} }); shell.close(); }
@Test public void test_changedLorg_eclipse_swt_browser_LocationEvent() { Display display = Display.getCurrent(); Shell shell = new Shell(display); Browser browser = new Browser(shell, SWT.NONE); browser.addLocationListener( new LocationListener() { public void changed(LocationEvent event) {} public void changing(LocationEvent event) {} }); shell.close(); }
/** * helper to destory view model and viewer * * @param vmOnly true to destory view model only and do not destroy viewer */ void destroyViewer(boolean vmOnly) { fVMProvider.getNode().setFormattedValuesListener(null); fVMProvider.getNode().getLabelProvider().removePropertiesUpdateListener(fViewerListener); fVMProvider.getNode().setVMUpdateListener(null); fVMListener.dispose(); if (vmOnly == false) { fViewerListener.dispose(); fViewer.getPresentationContext().dispose(); // Close the shell fShell.close(); while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch()) fDisplay.sleep(); } }
@Test @UI public void inputIsDisposedOnContentChange() throws Exception { Shell s = new Shell(); TreeViewer v = new TreeViewer(s); ITreeContentProvider cp = createFixture(); v.setContentProvider(cp); WritableList input = WritableList.withElementType(String.class); v.setInput(input); v.setInput(null); assertTrue(input.isDisposed()); s.close(); }
private void requestDescription(String newDesc) { File file = new File(targetLocation.getPath() + "/" + descriptionFileName); if (file.exists()) { file.delete(); } try { FileWriter fw = new FileWriter(targetLocation.getPath() + "/" + descriptionFileName); BufferedWriter bw = new BufferedWriter(fw); bw.write(newDesc); bw.close(); fw.close(); } catch (IOException e) { } descriptionSetter.afterDescriptionCreated(); dialog.close(); }
@Override public void widgetSelected(SelectionEvent e) { exitApplicationWhenWindowCloses = false; int selectedHostIndexInTable = hostTable.getSelectionIndex(); try { app.openRemoteTerminalWindow(app.hostManager.get(selectedHostIndexInTable)); } catch (Exception ex) { MessageBox dialog = new MessageBox(connectToHostShell, SWT.ICON_ERROR | SWT.OK); dialog.setText("My info"); dialog.setMessage("Failed to connect because " + ex.toString()); } connectToHostShell.close(); connectToHostShell.dispose(); }
public void stop() { // FIXME Without this call the test-suite fails cleanUp(); if (theApp != null) { for (MWindow window : theApp.getChildren()) { if (window.getWidget() != null) { removeGui(window); } } } else if (testShell != null && !testShell.isDisposed()) { Object model = testShell.getData(AbstractPartRenderer.OWNING_ME); if (model instanceof MUIElement) { removeGui((MUIElement) model); } else { testShell.close(); } } }
/* * main method for testing only */ public static void main(String[] args) { Shell myShell = new Shell(Display.getCurrent(), SWT.CLOSE | SWT.RESIZE); myShell.setLayout(new FormLayout()); GroupPanel gp = new GroupPanelForTemporalEventAnchor(myShell, SWT.None); gp.setLayoutData(FormDataMaker.makeFullFormData()); myShell.setSize(550, 200); myShell.open(); while (!myShell.isDisposed()) { if (!Display.getCurrent().readAndDispatch()) Display.getCurrent().sleep(); } if (!myShell.isDisposed()) { myShell.close(); myShell.dispose(); } }
/** This method embed a button in a table cell */ public Image getImage(Object element) { Shell shell = new Shell(viewer.getControl().getShell(), SWT.NO_TRIM); Button button = new Button(shell, SWT.PUSH); button.setImage(image); button.setBounds(0, 0, BUTTON_WIDTH, BUTTON_HEIGHT); Point bsize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT); button.setSize(bsize); shell.setSize(bsize); shell.open(); GC gc = new GC(button); Image i = new Image(viewer.getControl().getShell().getDisplay(), bsize.x, bsize.y); gc.copyArea(i, 0, 0); gc.dispose(); shell.close(); return i; }
/** * When any <code>ProgressReporterPanel</code> in this window is disposed re-layout the controls * and window appropriately */ public void widgetDisposed(DisposeEvent e) { if (e.widget instanceof ProgressReporterPanel) { ProgressReporterPanel panel = (ProgressReporterPanel) e.widget; removeReporter(panel.pReporter); panel.removeTwistieListener(this); /* * Must let the GridLayout manager know that this control should be ignored */ ((GridData) panel.getLayoutData()).exclude = true; panel.setVisible(false); /* * If it's the last reporter then close the shell itself since it will be just empty */ if (pReporters.length == 0) { if ((style & AUTO_CLOSE) != 0) { if (null != shell && false == shell.isDisposed()) { shell.close(); } } else { createEmptyPanel(); } } else { /* * Formats the last panel; specifying this panel as the panelToIgnore * because at this point in the code this panel has not been removed * from the window yet */ formatLastPanel(panel); } if (null != shell && false == shell.isDisposed()) { shell.layout(true, true); } } }
/** @throws java.lang.Exception */ @Override protected void tearDown() throws Exception { fVMProvider.getNode().setFormattedValuesListener(null); fModel.setTestModelListener(null); fVMProvider.getNode().getLabelProvider().removePropertiesUpdateListener(fViewerListener); fVMProvider.getNode().setVMUpdateListener(null); fVMAdapter.dispose(); fVMListener.dispose(); fViewerListener.dispose(); shutdownService(fDummyValuesService); shutdownService(fModel); fViewer.getPresentationContext().dispose(); // Close the shell and exit. fShell.close(); while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch()) fDisplay.sleep(); DsfSession.endSession(fDsfSession); fDsfExecutor.shutdown(); }
public static void main(String[] args) { Display display = new Display(); final Shell shell = new Shell(display); shell.setText("Text Editor"); Menu bar = new Menu(shell, SWT.BAR); shell.setMenuBar(bar); MenuItem fileItem = new MenuItem(bar, SWT.CASCADE); fileItem.setText("&File"); Menu fileMenu = new Menu(shell, SWT.DROP_DOWN); fileItem.setMenu(fileMenu); MenuItem saveItem = new MenuItem(fileMenu, SWT.PUSH); saveItem.setText("&Save\tCtrl+S"); saveItem.setAccelerator(SWT.MOD1 + 'S'); saveItem.addListener(SWT.Selection, e -> shell.setModified(false)); MenuItem exitItem = new MenuItem(fileMenu, SWT.PUSH); exitItem.setText("Exit"); exitItem.addListener(SWT.Selection, e -> shell.close()); Text text = new Text(shell, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); text.addListener(SWT.Modify, e -> shell.setModified(true)); shell.addListener( SWT.Close, e -> { if (shell.getModified()) { MessageBox box = new MessageBox(shell, SWT.PRIMARY_MODAL | SWT.OK | SWT.CANCEL); box.setText(shell.getText()); box.setMessage("You have unsaved changes, do you want to exit?"); e.doit = box.open() == SWT.OK; } }); shell.setLayout(new FillLayout()); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
public void close() { shell.close(); }
protected void cancelPressed() { result = SWT.CANCEL; shell.close(); }
protected void okPressed() { result = SWT.OK; shell.close(); }
protected void buttonPressed(int buttonId) { resultCode = buttonId; fShell.close(); }
void menuFileExit() { shell.close(); }
/** Auto-generated event handler method */ protected void cancelMouseDown(MouseEvent evt) { dialogShell.close(); }
@Override public void close() { if (resultWindow != null && resultWindow.isVisible()) resultWindow.close(); }
public static void main(String[] args) { Shell myShell = new Shell(Display.getCurrent(), SWT.CLOSE | SWT.RESIZE); myShell.setLayout(new FormLayout()); final SlideDeck sd = new SlideDeck(myShell, SWT.NONE); DefaultSlideWithTransitionControls comp1 = new DefaultSlideWithTransitionControls(sd, SWT.NONE); comp1.setLayout(new FormLayout()); sd.addNewSlide(comp1); comp1.setBackground(Colors.GOLDENROD); Button button1 = new Button(comp1, SWT.PUSH); button1.setText("Button 1"); button1.setLayoutData( FormDataMaker.makeFormData(0, 130, (Integer) null, 0, 0, 130, (Integer) null, 0)); DefaultSlideWithTransitionControls comp2 = new DefaultSlideWithTransitionControls(sd, SWT.NONE); comp2.setLayout(new FormLayout()); sd.addNewSlide(comp2); comp2.setBackground(Colors.DARK_RED); Button button2 = new Button(comp2, SWT.PUSH); button2.setText("Button 2"); button2.setLayoutData( FormDataMaker.makeFormData(0, 80, (Integer) null, 0, 0, 80, (Integer) null, 0)); Composite buttonComp = new Composite(myShell, SWT.NONE); buttonComp.setLayout(new FormLayout()); buttonComp.setBackground(Colors.BLACK); Button nextButton = new Button(buttonComp, SWT.PUSH); nextButton.setText("Next"); nextButton.setLayoutData( FormDataMaker.makeFormData((Integer) null, 0, 100, 0, 50, 10, (Integer) null, 0)); Button prevButton = new Button(buttonComp, SWT.PUSH); prevButton.setText("Prev"); prevButton.setLayoutData( FormDataMaker.makeFormData((Integer) null, 0, 100, 0, (Integer) null, 0, 50, -10)); buttonComp.setLayoutData(FormDataMaker.makeFormData((Integer) null, 100, 0, 100)); sd.setLayoutData(FormDataMaker.makeFormData(0, buttonComp, 0, 100)); Composite comp3 = sd.makeNewSlide(); comp3.setBackground(Colors.INDIGO); nextButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { sd.slideNext(); } }); prevButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { sd.slidePrevious(); } }); myShell.setSize(300, 300); myShell.open(); while (!myShell.isDisposed()) { if (!Display.getCurrent().readAndDispatch()) Display.getCurrent().sleep(); } if (!myShell.isDisposed()) { myShell.close(); myShell.dispose(); } }
@After public void tearDown() { shell.close(); display.dispose(); }