List of usage examples for org.eclipse.jface.dialogs Dialog open
public int open()
From source file:org.nightlabs.eclipse.ui.fckeditor.test.FileListAction.java
License:Open Source License
@Override public void run(IAction action) { try {/* w ww . j a v a 2 s.co m*/ Dialog dialog = new FileListDialog(window.getShell(), TestUtil.getFiles(), new ImageProvider(window.getShell().getDisplay())); dialog.open(); } catch (Exception e) { e.printStackTrace(); MessageDialog.openError(window.getShell(), "Error", e.toString()); } }
From source file:org.nuxeo.ide.sdk.server.ui.SDKPreferencePage.java
License:Open Source License
public void downloadSDK() { SDKTableWidget sdkWidget = (SDKTableWidget) form.getWidget("sdks"); Shell shell = sdkWidget.getControl().getParent().getShell(); String text = "Would you like to open the Nuxeo SDK download page in you web browser ?\n\nFrom there, you can download the latest SDK and extract it to the location of your choice. Register it to eclipse with the \"Add\" button.\n"; Dialog dialog = new MessageDialog(shell, "Download SDK", null, text, MessageDialog.QUESTION, new String[] { "open browser", "cancel" }, 0); dialog.open(); if (dialog.getReturnCode() != Dialog.OK) { return;//from ww w. j a v a 2s . c o m } Program.launch("http://doc.nuxeo.com/x/b4KE"); }
From source file:org.osate.analysis.resource.management.actions.Binpack.java
License:Open Source License
public void showResults(final SystemOperationMode som, final SystemInstance root, final AssignmentResult result) { final Map threadsToProc = getThreadBindings(result.problem.hardwareGraph); final String propText = getBindingText(threadsToProc); boolean done = false; while (!done) { final Dialog d = new PackingSuccessfulDialog(getShell(), som, root.getSystemImplementation().getName(), threadsToProc, result.problem.hardwareGraph, propText); final ShowDialog sd = new ShowDialog() { public void run() { this.result = d.open(); }//from w ww .j a v a 2s.co m }; Display.getDefault().syncExec(sd); if (sd.result == PackingSuccessfulDialog.INSTANCE_ID) { setInstanceModelBindings(root, threadsToProc); } // XXX: Don't set properties in the declarative model any more? // else if (button == PackingSuccessfulDialog.DECLARATIVE_ID) { // setDeclarativeBindings(root, threadsToProc); // } else { done = true; } } }
From source file:org.pentaho.di.ui.job.entries.trans.JobEntryTransDialog.java
License:Apache License
protected void ok() { if (Utils.isEmpty(wName.getText())) { final Dialog dialog = new SimpleMessageDialog(shell, BaseMessages.getString(PKG, "System.StepJobEntryNameMissing.Title"), BaseMessages.getString(PKG, "System.JobEntryNameMissing.Msg"), MessageDialog.ERROR); dialog.open(); return;/* w w w. ja va 2 s.c o m*/ } jobEntry.setName(wName.getText()); try { getInfo(jobEntry); } catch (KettleException e) { // suppress exceptions at this time - we will let the runtime report on any errors } jobEntry.setChanged(); dispose(); }
From source file:org.pentaho.di.ui.spoon.Spoon.java
License:Apache License
public void openFile(String filename, boolean importfile) { // Open the XML and see what's in there. // We expect a single <transformation> or <job> root at this time... // does the file exist? If not, show an error dialog boolean fileExists = false; try {/*w ww. j ava2 s .c o m*/ final FileObject file = KettleVFS.getFileObject(filename); fileExists = file.exists(); } catch (final KettleFileException | FileSystemException e) { // nothing to do, null fileObject will be handled below } if (StringUtils.isBlank(filename) || !fileExists) { final Dialog dlg = new SimpleMessageDialog(shell, BaseMessages.getString(PKG, "Spoon.Dialog.MissingRecentFile.Title"), BaseMessages.getString(PKG, "Spoon.Dialog.MissingRecentFile.Message", getFileType(filename).toLowerCase()), MessageDialog.ERROR, BaseMessages.getString(PKG, "System.Button.Close"), MISSING_RECENT_DLG_WIDTH, SimpleMessageDialog.BUTTON_WIDTH); dlg.open(); return; } boolean loaded = false; FileListener listener = null; Node root = null; // match by extension first int idx = filename.lastIndexOf('.'); if (idx != -1) { for (FileListener li : fileListeners) { if (li.accepts(filename)) { listener = li; break; } } } // Attempt to find a root XML node name. Fails gracefully for non-XML file // types. try { Document document = XMLHandler.loadXMLFile(filename); root = document.getDocumentElement(); } catch (KettleXMLException e) { if (log.isDetailed()) { log.logDetailed(BaseMessages.getString(PKG, "Spoon.File.Xml.Parse.Error")); } } // otherwise try by looking at the root node if we were able to parse file // as XML if (listener == null && root != null) { for (FileListener li : fileListeners) { if (li.acceptsXml(root.getNodeName())) { listener = li; break; } } } // You got to have a file name! // if (!Utils.isEmpty(filename)) { if (listener != null) { try { loaded = listener.open(root, filename, importfile); } catch (KettleMissingPluginsException e) { log.logError(e.getMessage(), e); } } if (!loaded) { // Give error back hideSplash(); MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR); mb.setMessage(BaseMessages.getString(PKG, "Spoon.UnknownFileType.Message", filename)); mb.setText(BaseMessages.getString(PKG, "Spoon.UnknownFileType.Title")); mb.open(); } else { applyVariables(); // set variables in the newly loaded // transformation(s) and job(s). } } }
From source file:org.pentaho.di.ui.spoon.Spoon.java
License:Apache License
private void loadLastUsedFile(LastUsedFile lastUsedFile, String repositoryName, boolean trackIt, boolean isStartup) throws KettleException { boolean useRepository = repositoryName != null; // Perhaps we need to connect to the repository? ///*from w ww. j av a 2s . co m*/ if (lastUsedFile.isSourceRepository()) { if (!Utils.isEmpty(lastUsedFile.getRepositoryName())) { if (useRepository && !lastUsedFile.getRepositoryName().equalsIgnoreCase(repositoryName)) { // We just asked... useRepository = false; } } } if (useRepository && lastUsedFile.isSourceRepository()) { if (rep != null) { // load from this repository... if (rep.getName().equalsIgnoreCase(lastUsedFile.getRepositoryName())) { RepositoryDirectoryInterface rdi = rep.findDirectory(lastUsedFile.getDirectory()); if (rdi != null) { // does the file exist in the repo? final RepositoryObjectType fileType = lastUsedFile.isJob() ? RepositoryObjectType.JOB : RepositoryObjectType.TRANSFORMATION; if (!rep.exists(lastUsedFile.getFilename(), rdi, fileType)) { // open an warning dialog only if this file was explicitly selected to be opened; on startup, simply skip // opening this file if (isStartup) { if (log.isDetailed()) { log.logDetailed(BaseMessages.getString(PKG, "Spoon.log.openingMissingFile")); } } else { final Dialog dlg = new SimpleMessageDialog(shell, BaseMessages.getString(PKG, "Spoon.Dialog.MissingRecentFile.Title"), BaseMessages.getString(PKG, "Spoon.Dialog.MissingRecentFile.Message", lastUsedFile.getLongFileType().toLowerCase()), MessageDialog.ERROR, BaseMessages.getString(PKG, "System.Button.Close"), MISSING_RECENT_DLG_WIDTH, SimpleMessageDialog.BUTTON_WIDTH); dlg.open(); } } else { // Are we loading a transformation or a job? if (lastUsedFile.isTransformation()) { if (log.isDetailed()) { // "Auto loading transformation ["+lastfiles[0]+"] from repository directory ["+lastdirs[0]+"]" log.logDetailed( BaseMessages.getString(PKG, "Spoon.Log.AutoLoadingTransformation", lastUsedFile.getFilename(), lastUsedFile.getDirectory())); } TransLoadProgressDialog tlpd = new TransLoadProgressDialog(shell, rep, lastUsedFile.getFilename(), rdi, null); TransMeta transMeta = tlpd.open(); if (transMeta != null) { if (trackIt) { props.addLastFile(LastUsedFile.FILE_TYPE_TRANSFORMATION, lastUsedFile.getFilename(), rdi.getPath(), true, rep.getName(), getUsername(), null); } // transMeta.setFilename(lastUsedFile.getFilename()); transMeta.clearChanged(); addTransGraph(transMeta); refreshTree(); } } else if (lastUsedFile.isJob()) { JobLoadProgressDialog progressDialog = new JobLoadProgressDialog(shell, rep, lastUsedFile.getFilename(), rdi, null); JobMeta jobMeta = progressDialog.open(); if (jobMeta != null) { if (trackIt) { props.addLastFile(LastUsedFile.FILE_TYPE_JOB, lastUsedFile.getFilename(), rdi.getPath(), true, rep.getName(), getUsername(), null); } jobMeta.clearChanged(); addJobGraph(jobMeta); } } refreshTree(); } } } } } // open files stored locally, not in the repository if (!lastUsedFile.isSourceRepository() && !Utils.isEmpty(lastUsedFile.getFilename())) { if (lastUsedFile.isTransformation()) { openFile(lastUsedFile.getFilename(), rep != null); } if (lastUsedFile.isJob()) { openFile(lastUsedFile.getFilename(), false); } refreshTree(); } }
From source file:org.pentaho.di.ui.trans.step.common.GetFieldsSampleDataDialog.java
License:Apache License
protected void handleOk(final int samples) { if (samples >= 0) { String message = parentDialog.loadFields(parentDialog.getPopulatedMeta(), samples, reloadAllFields); if (wCheckbox != null && wCheckbox.getSelection()) { if (StringUtils.isNotBlank(message)) { final EnterTextDialog etd = new EnterTextDialog(parentDialog.getShell(), BaseMessages.getString(PKG, "System.GetFields.ScanResults.DialogTitle"), BaseMessages.getString(PKG, "System.GetFields.ScanResults.DialogMessage"), message, true);/*from w ww .j a va2s. co m*/ etd.setReadOnly(); etd.setModal(); etd.open(); } else { final Dialog errorDlg = new SimpleMessageDialog(parentDialog.getShell(), BaseMessages.getString(PKG, "System.Dialog.Error.Title"), BaseMessages.getString(PKG, "System.GetFields.ScanResults.Error.Message"), MessageDialog.ERROR); errorDlg.open(); } } } }
From source file:org.rdkit.knime.wizards.RDKitNodesWizardsPage.java
License:Open Source License
/** * Shows the help dialog window.// w ww . ja va2 s. c om */ public void showHelp() { // Copy help files to temp directory URL fileUrlTemp = null; try { fileUrlTemp = makeHelpFilesAvailable(); } catch (IOException exc) { // Ignored - handled later } final Shell parentShell = getShell(); if (fileUrlTemp != null) { final URL fileUrl = fileUrlTemp; Dialog dialog = new Dialog(parentShell) { @Override protected Control createDialogArea(final Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); Browser browser = new Browser(composite, SWT.BORDER | SWT.FILL); browser.setUrl(fileUrl.toString()); GridData data = new GridData(GridData.FILL_BOTH); browser.setLayoutData(data); return composite; } @Override protected void createButtonsForButtonBar(final Composite parent) { // create OK button createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); } @Override protected Point getInitialSize() { return new Point(700, 700); } @Override protected Point getInitialLocation(final Point initialSize) { Dimension dimScreen = Toolkit.getDefaultToolkit().getScreenSize(); return new Point(dimScreen.width / 2 - initialSize.x / 2, dimScreen.height / 2 - initialSize.y / 2); } @Override protected void configureShell(final Shell newShell) { super.configureShell(newShell); newShell.setText("RDKit Node Types"); } }; dialog.setBlockOnOpen(true); dialog.open(); // Blocks } else { MessageBox msgBox = new MessageBox(parentShell, SWT.ICON_ERROR | SWT.OK); msgBox.setText("Error"); msgBox.setMessage("Sorry. The help file is not available."); msgBox.open(); } }
From source file:org.rubypeople.rdt.internal.debug.ui.preferences.EvaluationExpressionsPreferencePage.java
License:Common Public License
private void add() { EvaluationExpression evalExpression = new EvaluationExpression("", "", "", false); String title = RdtDebugUiMessages.EditEvaluationExpressionDialog_add; Dialog dialog = new EditEvaluationExpressionDialog(getShell(), title, evalExpression); if (dialog.open() == Window.OK) { fModel.addExpression(evalExpression); fTableViewer.refresh();/*from www.j ava 2 s . co m*/ fTableViewer.setSelection(new StructuredSelection(evalExpression)); } }
From source file:org.rubypeople.rdt.internal.debug.ui.preferences.EvaluationExpressionsPreferencePage.java
License:Common Public License
private void edit(EvaluationExpression evalExpression) { String title = RdtDebugUiMessages.EditEvaluationExpressionDialog_edit; Dialog dialog = new EditEvaluationExpressionDialog(getShell(), title, evalExpression); if (dialog.open() == Window.OK) { fTableViewer.refresh();/*w w w.j a v a2 s . co m*/ } }