Java Code Examples for org.eclipse.jface.dialogs.MessageDialog.ERROR

The following are Jave code examples for showing how to use ERROR of the org.eclipse.jface.dialogs.MessageDialog class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: gw4e.project   File: GW4ELaunchShortcut.java   Source Code and License Vote up 5 votes
private void launch(Object[] elements, String mode) {
	try {
		IJavaElement[] ijes = null;
		List<IJavaElement> jes =  new ArrayList<IJavaElement>();
		for (int i = 0; i < elements.length; i++) {
			Object selected= elements[i];
			if (selected instanceof IJavaElement) {
				IJavaElement element= (IJavaElement) selected;
				switch (element.getElementType()) {
					case IJavaElement.COMPILATION_UNIT:
						jes.add(element);
						break;
				}
			}
		
		}
		ijes = new IJavaElement[jes.size()];
		jes.toArray(ijes);
		ILaunchConfigurationWorkingCopy wc = buildLaunchConfiguration(ijes);
		if (wc==null) return;
		ILaunchConfiguration config= findExistingORCreateLaunchConfiguration(wc, mode);
		DebugUITools.launch(config, mode);
	} catch (Exception e) {
		ResourceManager.logException(e);
		MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), "GW4E Launcher", (Image)null, "Unable to launch. See error in Error view.", MessageDialog.ERROR, new String[] { "Close" }, 0);
		dialog.open();
	}
}
 
Example 2
Project: gw4e.project   File: GW4ELaunchShortcut.java   Source Code and License Vote up 5 votes
protected ILaunchConfigurationWorkingCopy buildLaunchConfiguration(IJavaElement[]  elements) throws CoreException {
	IJavaElement mainElement = null;
	for (int i = 0; i < elements.length; i++) {
		IJavaElement element = elements [i];
		if (JDTManager.hasStartableGraphWalkerAnnotation(element)) {
			mainElement = element;
			break;
		}
	}

	if (mainElement==null) {
	   MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), "GW4E Launcher", (Image)null, MessageUtil.getString("nostartvalueinannotation"), MessageDialog.ERROR, new String[] { "Close" }, 0);
	   dialog.open();
	   return null;
	}
	 
	ILaunchConfigurationType configType= DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(GW4ELAUNCHCONFIGURATIONTYPE);
	ILaunchConfigurationWorkingCopy wc= configType.newInstance(null, DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(mainElement.getElementName()));
	wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, elements[0].getJavaProject().getElementName());
	
	String mainElementName = elementToJavaClassName (mainElement);
	StringBuffer sb = new StringBuffer (mainElementName).append(";");
	String[] classnames = elementToJavaClassName(elements);
	for (int i = 0; i < classnames.length; i++) {
		if (classnames[i].equals(mainElementName)) continue;
		sb.append(classnames[i]).append(";");
	}
	wc.setAttribute(LaunchingConstant.CONFIG_TEST_CLASSES,sb.toString());
	return wc;
}
 
Example 3
Project: gw4e.project   File: DialogManager.java   Source Code and License Vote up 5 votes
/**
 * Display an error message in a Dialog
 * 
 * @param message
 */
public static void displayErrorMessage(String title, String message) {
	MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(),
			title, null, message,
			MessageDialog.ERROR, new String[] { MessageUtil.getString("close") }, 0);
	int result = dialog.open();
	dialog.close();
}
 
Example 4
Project: Hydrograph   File: HiveFieldDialogHelper.java   Source Code and License Vote up 5 votes
/**
 * 
 * Message dialog to be displayed if compare_fields() method returns false. 
 * 
 */
public int Message_Dialog()
{
	
	
		MessageDialog dialog = new MessageDialog(Display.getCurrent().getActiveShell(), "Rearrange Fields", null,
		    Messages.HIVE_PARTI_SEQ_ERROR, MessageDialog.ERROR, new String[] { "Rearrange Schema",
		  "Rearrange Partition Fields" }, 0);
		int result = dialog.open();
		return result;
}
 
Example 5
Project: Tarski   File: Activator.java   Source Code and License Vote up 4 votes
public static MessageDialog errorDialogOK(String title, String message) {
  return new MessageDialog(getShell(), title, null, message, MessageDialog.ERROR, 0, "Yes", "No");
}
 
Example 6
Project: Tarski   File: Activator.java   Source Code and License Vote up 4 votes
public static MessageDialog errorDialogYESNO(String title, String message) {
  return new MessageDialog(getShell(), title, null, message, MessageDialog.ERROR, 0, "Yes", "No");
}