use of org.eclipse.jface.dialogs.MessageDialog in project nebula.widgets.nattable by eclipse.
the class CrossValidationDialogErrorHandling method showWarningDialog.
@Override
protected void showWarningDialog(String dialogMessage, String dialogTitle) {
if (!isWarningDialogActive()) {
if (dialogMessage != null) {
MessageDialog warningDialog = new MessageDialog(Display.getCurrent().getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.WARNING, new String[] { getChangeButtonLabel(), getDiscardButtonLabel(), "Commit" }, 0);
// if discard was selected close the editor
int returnCode = warningDialog.open();
if (returnCode == 1) {
this.editor.close();
} else if (returnCode == 2) {
this.editor.commit(MoveDirectionEnum.NONE, true, true);
}
}
}
}
use of org.eclipse.jface.dialogs.MessageDialog in project webtools.sourceediting by eclipse.
the class JAXPJavaLaunchConfigurationDelegate method preLaunchCheck.
@Override
public boolean preLaunchCheck(ILaunchConfiguration configuration, String mode, IProgressMonitor monitor) throws CoreException {
this.launchHelper = new LaunchHelper(configuration);
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
// TODO don't like having UI code in the launching plugin...where
// else can it go?
final IProcessorInstall install = getProcessorInstall(configuration, ILaunchManager.RUN_MODE);
if (install.getDebugger() == null) {
final boolean[] result = new boolean[] { false };
// open a dialog for choosing a different install that does have
// an associated debugger
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
public void run() {
String debuggingInstallId = JAXPLaunchingPlugin.getDefault().getPluginPreferences().getString(JAXPLaunchConfigurationConstants.ATTR_DEFAULT_DEBUGGING_INSTALL_ID);
IProcessorInstall processor = JAXPRuntime.getProcessor(debuggingInstallId);
IWorkbenchWindow dw = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
String title = Messages.XSLTLaunchConfigurationDelegate_0;
String message = Messages.XSLTLaunchConfigurationDelegate_1 + install.getName() + Messages.XSLTLaunchConfigurationDelegate_2 + Messages.XSLTLaunchConfigurationDelegate_3 + processor.getName() + Messages.XSLTLaunchConfigurationDelegate_4;
MessageDialog dialog = new MessageDialog(dw.getShell(), title, null, message, MessageDialog.QUESTION, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, // yes
0);
// is
// the
// default
result[0] = dialog.open() == 0;
}
});
return result[0];
} else {
String debuggerTF = install.getDebugger().getTransformerFactory();
String installTF = launchHelper.getTransformerFactory() == null ? null : launchHelper.getTransformerFactory().getFactoryClass();
if (!debuggerTF.equals(installTF)) {
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
public void run() {
IWorkbenchWindow dw = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
String title = Messages.JAXPJavaLaunchConfigurationDelegate_0;
String message = install.getName() + Messages.JAXPJavaLaunchConfigurationDelegate_1 + launchHelper.getTransformerFactory().getName() + Messages.JAXPJavaLaunchConfigurationDelegate_2 + Messages.JAXPJavaLaunchConfigurationDelegate_3 + launchHelper.getTransformerFactory().getName() + Messages.JAXPJavaLaunchConfigurationDelegate_4;
MessageDialog dialog = new MessageDialog(dw.getShell(), title, null, message, MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, // yes is the default
0);
dialog.open();
}
});
}
}
}
return super.preLaunchCheck(configuration, mode, monitor);
}
use of org.eclipse.jface.dialogs.MessageDialog in project webtools.servertools by eclipse.
the class ServerEditor method checkAndCloseEditorOnDeletedServer.
void checkAndCloseEditorOnDeletedServer() {
// check for deleted files
if (resourceDeleted) {
String title = Messages.editorResourceDeleteTitle;
String message = null;
if (server != null)
message = NLS.bind(Messages.editorResourceDeleteServerMessage, server.getName());
String[] labels = new String[] { Messages.editorResourceDeleteSave, IDialogConstants.CLOSE_LABEL };
MessageDialog dialog = new MessageDialog(getEditorSite().getShell(), title, null, message, MessageDialog.INFORMATION, labels, 0);
if (dialog.open() == 0)
doSave(new NullProgressMonitor());
else
closeEditor();
}
resourceDeleted = false;
}
use of org.eclipse.jface.dialogs.MessageDialog in project epp.mpc by eclipse.
the class MarketplaceWizard method notifyNonInstallableItems.
protected void notifyNonInstallableItems(final List<CatalogItem> noninstallableItems) {
MessageDialog dialog = new MessageDialog(getShell(), Messages.MarketplaceWizard_UnableToInstallSolutions, null, Messages.MarketplaceWizard_IncompatibleSolutionsMessage, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL }, 0) {
@Override
protected Control createCustomArea(Composite parent) {
parent.setLayout(new GridLayout());
TableViewer tableViewer = new TableViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
tableViewer.setLabelProvider(createLabelProvider());
tableViewer.setContentProvider(createContentProvider());
tableViewer.setInput(noninstallableItems);
Control tableControl = tableViewer.getControl();
GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).hint(SWT.DEFAULT, Math.max(40, Math.min(120, tableControl.computeSize(SWT.DEFAULT, SWT.DEFAULT).y))).applyTo(tableControl);
return tableControl;
}
private LabelProvider createLabelProvider() {
return new LabelProvider() {
@Override
public String getText(Object element) {
// we could show that with an IStyledLabelProvider behind the name
return ((CatalogItem) element).getName();
}
@Override
public Image getImage(Object element) {
return MarketplaceClientUiPlugin.getInstance().getImageRegistry().get(MarketplaceClientUiPlugin.IU_ICON_ERROR);
}
};
}
private IStructuredContentProvider createContentProvider() {
return new IStructuredContentProvider() {
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
public void dispose() {
}
public Object[] getElements(Object inputElement) {
return ((List<?>) inputElement).toArray();
}
};
}
};
dialog.open();
}
use of org.eclipse.jface.dialogs.MessageDialog in project liferay-ide by liferay.
the class BuildLangHandler method checkLanguageFileEncoding.
protected boolean checkLanguageFileEncoding(IFile langFile) throws CoreException {
IProgressMonitor monitor = new NullProgressMonitor();
try {
langFile.refreshLocal(IResource.DEPTH_INFINITE, monitor);
} catch (Exception e) {
PortletUIPlugin.logError(e);
}
String charset = langFile.getCharset(true);
if (!"UTF-8".equals(charset)) {
String dialogMessage = NLS.bind(Msgs.languageFileCharacterSet, charset);
Display display = UIUtil.getActiveShell().getDisplay();
MessageDialog dialog = new MessageDialog(UIUtil.getActiveShell(), Msgs.incompatibleCharacterSet, display.getSystemImage(SWT.ICON_WARNING), dialogMessage, MessageDialog.WARNING, new String[] { Msgs.yes, Msgs.no, Msgs.cancel }, 0);
int retval = dialog.open();
if (retval == 0) {
langFile.setCharset("UTF-8", monitor);
String question = NLS.bind(Msgs.forcedEditFile, langFile.getName());
if (MessageDialog.openQuestion(UIUtil.getActiveShell(), Msgs.previewFile, question)) {
IWorkbench workbench = PlatformUI.getWorkbench();
IDE.openEditor(workbench.getActiveWorkbenchWindow().getActivePage(), langFile);
}
return false;
} else if (retval == 2) {
return false;
}
}
return true;
}
Aggregations