import org.eclipse.swt.*; import org.eclipse.swt.widgets.*; public class SWTFileOpenSnippet { public static void main (String [] args) { Display display = new Display (); Shell shell = new Shell (display); // Don't show the shell. //shell.open (); FileDialog dialog = new FileDialog (shell, SWT.OPEN | SWT.MULTI); String [] filterNames = new String [] {"All Files (*)"}; String [] filterExtensions = new String [] {"*"}; String filterPath = "c:\\"; dialog.setFilterNames (filterNames); dialog.setFilterExtensions (filterExtensions); dialog.setFilterPath (filterPath); dialog.open(); System.out.println ("Selected files: "); String[] selectedFileNames = dialog.getFileNames(); for(String fileName : selectedFileNames) { System.out.println(" " + fileName); } shell.close(); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } }
sp.cancel(); shell.close(); });
@Override protected void tearDown() throws Exception { if (shell != null) { shell.close(); shell = null; groovyShell = null; } }
shell.close(); return null;
trayItem.addSelectionListener (new SelectionListener () { @Override public void widgetDefaultSelected (SelectionEvent aEvent) { widgetSelected (aEvent); } @Override public void widgetSelected (SelectionEvent aEvent) { if (mWindow.isVisible ()) { Shell wnd = mWindow; mWindow = new Shell (mDisplay); wnd.close (); } else { mWindow.setLocation (mDisplay.getCursorLocation ()); mWindow.open (); } } });
import org.eclipse.swt.*; import org.eclipse.swt.widgets.*; public class FileSelection { public static String getPath(){ String path =null; Display display = new Display (); Shell shell = new Shell (display); // Don't show the shell. //shell.open (); FileDialog dialog = new FileDialog (shell, SWT.OPEN | SWT.MULTI); path=dialog.open(); shell.close(); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); return path; } }
import org.eclipse.swt.*; import org.eclipse.swt.widgets.*; public class SWTFileOpenSnippet { public static void main (String [] args) { Display display = new Display (); Shell shell = new Shell (display); // Don't show the shell. //shell.open (); FileDialog dialog = new FileDialog (shell, SWT.OPEN | SWT.MULTI); String [] filterNames = new String [] {"All Files (*)"}; String [] filterExtensions = new String [] {"*"}; String filterPath = "c:\\"; dialog.setFilterNames (filterNames); dialog.setFilterExtensions (filterExtensions); dialog.setFilterPath (filterPath); dialog.open(); System.out.println ("Selected files: "); String[] selectedFileNames = dialog.getFileNames(); for(String fileName : selectedFileNames) { System.out.println(" " + fileName); } shell.close(); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } }
shell.add(new SimpleCommand(str3)).waitForFinish(); shell.close(); } catch (Exception e) { e.printStackTrace();
shell.add(new SimpleCommand(str3)).waitForFinish(); shell.close(); } catch (Exception e) { e.printStackTrace();
@Override public void run() { shell.close();
dialog.close ();
shell.close();
okButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { dialog.close();
popup.close();
public void completed(ProgressEvent event) { System.out.println(browser.getText()); shell.close();
gc.dispose(); s.close();
popup.close(); popup = null;
@Override public void handleEvent(Event event) { screenShell.close(); }}); screenShell.open();