List of usage examples for org.eclipse.jface.dialogs MessageDialog ERROR
int ERROR
To view the source code for org.eclipse.jface.dialogs MessageDialog ERROR.
Click Source Link
From source file:org.eclipse.oomph.setup.internal.installer.InstallerDialog.java
License:Open Source License
@Override public void create() { super.create(); final Shell shell = getShell(); shell.addTraverseListener(new TraverseListener() { public void keyTraversed(TraverseEvent e) { if (e.detail == SWT.TRAVERSE_ESCAPE) { shell.close();/*w w w . ja v a2 s.c o m*/ e.detail = SWT.TRAVERSE_NONE; e.doit = false; } } }); shell.getDisplay().asyncExec(new Runnable() { public void run() { final Installer installer = getInstaller(); installer.getIndexLoader().awaitIndexLoad(); final Runnable checkIndex = this; shell.getDisplay().asyncExec(new Runnable() { public void run() { UIPlugin.openRecorderIfEnabled(); SetupInstallerPlugin.runTests(); if (installer.getCatalogManager().getIndex() == null) { int answer = new MessageDialog(shell, "Network Problem", null, "The catalog could not be loaded. Please ensure that you have network access and, if needed, have configured your network proxy.", MessageDialog.ERROR, new String[] { "Retry", "Configure Network Proxy...", "Exit" }, 0).open(); switch (answer) { case 0: installer.reloadIndex(); shell.getDisplay().asyncExec(checkIndex); return; case 1: new NetworkConnectionsDialog(getShell()).open(); installer.reloadIndex(); shell.getDisplay().asyncExec(checkIndex); return; default: close(); return; } } } }); } }); }
From source file:org.eclipse.oomph.ui.ErrorDialog.java
License:Open Source License
protected ErrorDialog(String title, Throwable throwable, int defaultButtonID, int detailsButtonID, String... dialogButtonLabels) { super(null, title, null, "Internal error:" + StringUtil.NL + getMessage(throwable), MessageDialog.ERROR, dialogButtonLabels, defaultButtonID); this.throwable = throwable; this.detailsButtonID = detailsButtonID; setShellStyle(SWT.SHELL_TRIM | SWT.BORDER | SWT.APPLICATION_MODAL); }
From source file:org.eclipse.pde.internal.ui.launcher.LauncherUtilsStatusHandler.java
License:Open Source License
private static void generateErrorDialog(final String title, final String message, final ILaunchConfiguration launchConfig, final String mode) { getDisplay().syncExec(new Runnable() { public void run() { Shell parentShell = getActiveShell(); MessageDialog dialog = new MessageDialog(parentShell, title, null, message, MessageDialog.ERROR, new String[] { PDEUIMessages.LauncherUtils_edit, IDialogConstants.OK_LABEL }, 1); int res = dialog.open(); if (res == 0) { IStructuredSelection selection = new StructuredSelection(launchConfig); ILaunchGroup group = DebugUITools.getLaunchGroup(launchConfig, mode); String groupIdentifier = group == null ? IDebugUIConstants.ID_RUN_LAUNCH_GROUP : group.getIdentifier(); IStatus status = new Status(IStatus.OK, PDELaunchingPlugin.getPluginId(), LauncherUtils.SELECT_WORKSPACE_FIELD, "", null); //$NON-NLS-1$ DebugUITools.openLaunchConfigurationDialogOnGroup(parentShell, selection, groupIdentifier, status);/* w ww .ja va 2 s .c o m*/ } } }); }
From source file:org.eclipse.pde.internal.ui.launcher.LaunchTerminationStatusHandler.java
License:Open Source License
private void handleOtherReasonsFoundInLog(final ILaunch launch) { Display.getDefault().asyncExec(new Runnable() { public void run() { try { File log = LaunchListener.getMostRecentLogFile(launch.getLaunchConfiguration()); if (log != null && log.exists()) { MessageDialog dialog = new MessageDialog(PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.Launcher_error_title, null, // accept the default window icon PDEUIMessages.Launcher_error_code13, MessageDialog.ERROR, new String[] { PDEUIMessages.Launcher_error_displayInLogView, PDEUIMessages.Launcher_error_displayInSystemEditor, IDialogConstants.NO_LABEL }, OPEN_IN_ERROR_LOG_VIEW); int dialog_value = dialog.open(); if (dialog_value == OPEN_IN_ERROR_LOG_VIEW) { IWorkbenchPage page = PDEPlugin.getActivePage(); if (page != null) { LogView errlog = (LogView) page.showView("org.eclipse.pde.runtime.LogView"); //$NON-NLS-1$ errlog.handleImportPath(log.getAbsolutePath()); errlog.sortByDateDescending(); }/*from w ww.j a v a2 s . c o m*/ } else if (dialog_value == OPEN_IN_SYSTEM_EDITOR) { openInEditor(log); } } } catch (CoreException e) { } } }); }
From source file:org.eclipse.php.internal.server.ui.launching.zend.DefaultDebugServerConnectionTest.java
License:Open Source License
protected void showCustomErrorDialog(final String message) { fShell.getDisplay().asyncExec(new Runnable() { public void run() { DefaultServerTestMessageDialog dialog = new DefaultServerTestMessageDialog(fShell, PHPServerUIMessages.getString("DefaultDebugServerConnectionTest_testDebugServer"), null, // accept //$NON-NLS-1$ message, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0); dialog.open();//from w w w.j a v a2 s .c o m } }); }
From source file:org.eclipse.php.internal.ui.preferences.PHPCoreOptionsConfigurationBlock.java
License:Open Source License
protected boolean checkChanges(IScopeContext currContext) { if (fProject != null) { final Key versionKey = getPHPCoreKey(Keys.PHP_VERSION); // synch the php facets version if needed String newVersion = versionKey.getStoredValue(currContext, fManager); if (newVersion == null) { newVersion = getValue(versionKey); }// w w w . j a v a2 s.c o m final IStatus status = PHPFacets.setFacetedVersion(fProject, PHPVersion.byAlias(newVersion)); if (!status.isOK()) { MessageDialog dialog = new MessageDialog(getShell(), PreferencesMessages.PHPCoreOptionsConfigurationBlock_SettingVersionFailed_Title, null, status.getMessage(), MessageDialog.ERROR, new String[] { IDialogConstants.CANCEL_LABEL }, 0); dialog.open(); } return status.isOK(); } return super.checkChanges(currContext); }
From source file:org.eclipse.php.internal.ui.wizards.types.NewPHPTypeWizard.java
License:Open Source License
public IFolder createNewFolder(IPath newFolderPath) { IFolder newFolder = null;/*from ww w . j a v a 2s .co m*/ final IFolder newFolderHandle = createFolderHandle(newFolderPath); final boolean createVirtualFolder = false; IRunnableWithProgress op = monitor -> { AbstractOperation op1; op1 = new CreateFolderOperation(newFolderHandle, null, createVirtualFolder, null, IDEWorkbenchMessages.WizardNewFolderCreationPage_title); try { // see bug // https://bugs.eclipse.org/bugs/show_bug.cgi?id=219901 // directly execute the operation so that the undo state is // not preserved. Making this undoable can result in // accidental // folder (and file) deletions. op1.execute(monitor, WorkspaceUndoUtil.getUIInfoAdapter(getShell())); } catch (final ExecutionException e) { getContainer().getShell().getDisplay().syncExec(() -> { if (e.getCause() instanceof CoreException) { ErrorDialog.openError(getContainer().getShell(), // Was // Utilities.getFocusShell() IDEWorkbenchMessages.WizardNewFolderCreationPage_errorTitle, null, // no // special // message ((CoreException) e.getCause()).getStatus()); } else { IDEWorkbenchPlugin.log(getClass(), "createNewFolder()", e.getCause()); //$NON-NLS-1$ MessageDialog.openError(getContainer().getShell(), IDEWorkbenchMessages.WizardNewFolderCreationPage_internalErrorTitle, NLS.bind(IDEWorkbenchMessages.WizardNewFolder_internalError, e.getCause().getMessage())); } }); } }; try { getContainer().run(true, true, op); } catch (InterruptedException e) { return null; } catch (InvocationTargetException e) { // ExecutionExceptions are handled above, but unexpected runtime // exceptions and errors may still occur. IDEWorkbenchPlugin.log(getClass(), "createNewFolder()", e.getTargetException()); //$NON-NLS-1$ MessageDialog.open(MessageDialog.ERROR, getContainer().getShell(), IDEWorkbenchMessages.WizardNewFolderCreationPage_internalErrorTitle, NLS.bind(IDEWorkbenchMessages.WizardNewFolder_internalError, e.getTargetException().getMessage()), SWT.SHEET); return null; } return newFolder; }
From source file:org.eclipse.ptp.internal.rdt.sync.ui.handlers.CommonMissingConnectionHandler.java
License:Open Source License
@Override public void handle(final IRemoteServices remoteServices, final String connectionName) { RDTSyncUIPlugin.getStandardDisplay().syncExec(new Runnable() { @Override//w ww . j av a2 s. c om public void run() { // Avoid flooding the display with missing connection dialogs if (System.currentTimeMillis() - lastMissingConnectiontDialogTimeStamp <= timeBetweenDialogs) { return; } lastMissingConnectiontDialogTimeStamp = System.currentTimeMillis(); String[] buttonLabels = new String[2]; buttonLabels[0] = IDialogConstants.OK_LABEL; buttonLabels[1] = Messages.CommonMissingConnectionHandler_6; String newline = System.getProperty("line.separator"); //$NON-NLS-1$ MessageDialog dialog = new MessageDialog(null, Messages.CommonMissingConnectionHandler_0, null, Messages.CommonMissingConnectionHandler_1 + connectionName + Messages.CommonMissingConnectionHandler_2 + newline + newline + Messages.CommonMissingConnectionHandler_3 + newline + Messages.CommonMissingConnectionHandler_4 + newline + Messages.CommonMissingConnectionHandler_5, MessageDialog.ERROR, buttonLabels, 0); int buttonPressed = dialog.open(); if (buttonPressed == 1) { IRemoteUIConnectionManager connectionManager = RemoteUIServices .getRemoteUIServices(remoteServices).getUIConnectionManager(); if (connectionManager != null) { IRemoteUIConnectionWizard wizard = connectionManager.getConnectionWizard(dialog.getShell()); wizard.setConnectionName(RemoteConnectionWidget.DEFAULT_CONNECTION_NAME); IRemoteConnectionWorkingCopy wc = wizard.open(); wc.save(); } } } }); }
From source file:org.eclipse.ptp.internal.rdt.sync.ui.handlers.CommonSyncExceptionHandler.java
License:Open Source License
@Override public void handle(final IProject project, final CoreException e) { RDTSyncUIPlugin.log(e);//from ww w . jav a2s . c o m if (!alwaysShowDialog && !SyncManager.getShowErrors(project)) { return; } String message; String endOfLineChar = System.getProperty("line.separator"); //$NON-NLS-1$ message = Messages.CommonSyncExceptionHandler_0 + project.getName() + ":" + endOfLineChar + endOfLineChar; //$NON-NLS-1$ if (e.getMessage() != null) { message = message + e.getMessage(); } final String finalMessage = message; Display errorDisplay = RDTSyncUIPlugin.getStandardDisplay(); errorDisplay.syncExec(new Runnable() { @Override public void run() { String[] buttonLabels; if (e instanceof RemoteSyncMergeConflictException) { // Avoid flooding the display with merge conflict dialogs. if (System.currentTimeMillis() - lastMergeConflictDialogTimeStamp <= timeBetweenMergeConflicts) { return; } lastMergeConflictDialogTimeStamp = System.currentTimeMillis(); buttonLabels = new String[2]; buttonLabels[0] = IDialogConstants.OK_LABEL; buttonLabels[1] = Messages.CommonSyncExceptionHandler_1; // Custom button } else { buttonLabels = new String[1]; buttonLabels[0] = IDialogConstants.OK_LABEL; } MessageDialog dialog; if (showErrorMessageToggle) { dialog = new MessageDialogWithToggle(null, Messages.CommonSyncExceptionHandler_2, null, finalMessage, MessageDialog.ERROR, buttonLabels, 0, Messages.CommonSyncExceptionHandler_3, !SyncManager.getShowErrors(project)); } else { dialog = new MessageDialog(null, Messages.CommonSyncExceptionHandler_4, null, finalMessage, MessageDialog.ERROR, buttonLabels, 0); } int buttonPressed = dialog.open(); if (showErrorMessageToggle) { if (((MessageDialogWithToggle) dialog).getToggleState()) { SyncManager.setShowErrors(project, false); } else { SyncManager.setShowErrors(project, true); } } // See bug #236617 concerning custom button ids. if ((showErrorMessageToggle && IDialogConstants.INTERNAL_ID - buttonPressed == 0) || (!showErrorMessageToggle && buttonPressed == 1)) { try { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .showView(SYNC_MERGE_FILE_VIEW, null, IWorkbenchPage.VIEW_VISIBLE); SyncMergeFileTableViewer viewer = SyncMergeFileTableViewer.getActiveInstance(); if (viewer != null) { viewer.update(project); } } catch (CoreException e) { throw new RuntimeException(e); } } }; }); }
From source file:org.eclipse.qvt.declarative.editor.ui.commands.PageChangeDialog.java
License:Open Source License
public PageChangeDialog(Shell shell, String newTitle, String oldTitle, String fileName, String reasonNotToDeactivate, boolean canUpdate, boolean canRevert) { super(shell, "Update " + fileName + " Resource", null, null, reasonNotToDeactivate != null ? MessageDialog.ERROR : MessageDialog.QUESTION, buttonLabels, reasonNotToDeactivate != null ? RESUME_BUTTON : UPDATE_BUTTON); this.canRevert = canRevert; this.canUpdate = canUpdate; StringBuffer s = new StringBuffer(); if (reasonNotToDeactivate != null) s.append(reasonNotToDeactivate + "\n"); else/*from w w w. ja v a 2 s . com*/ s.append("'" + oldTitle + "' page has been modified.\n"); s.append("\n Update - accept changes to '" + oldTitle + "' page"); // if (!canAbort) // s.append("\n - start editing '" + newTitle + "' page"); // else { s.append("\n - reconcile and edit '" + newTitle + "' page"); s.append("\n\n Revert - discard changes to '" + oldTitle + "' page"); s.append("\n - revert to editing '" + newTitle + "' page"); // } s.append("\n\n Resume - continue editing '" + oldTitle + "' page"); message = s.toString(); }