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

The following are top voted examples for showing how to use org.eclipse.jface.dialogs.MessageDialog. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: neoscada   File: WriteConfirmDialog.java   View source code 7 votes vote down vote up
public static boolean create ( final ViewContext context, final Shell shell )
{
    if ( !context.isWriteDialogRequired () )
    {
        return true;
    }

    if ( SessionManager.getDefault ().hasRole ( suppressConfirmDialogRole ) )
    {
        return true;
    }
    if ( shell == null )
    {
        return MessageDialog.openQuestion ( org.eclipse.scada.vi.details.swt.Activator.getDefault ().getWorkbench ().getActiveWorkbenchWindow ().getShell (), Messages.WriteConfirmDialog_sendData, Messages.WriteConfirmDialog_confirmOperation );
    }
    else
    {
        return MessageDialog.openQuestion ( shell, Messages.WriteConfirmDialog_sendData, Messages.WriteConfirmDialog_confirmOperation );
    }

}
 
Example 2
Project: Tarski   File: CountMarkersInFileHandler.java   View source code 7 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
  ISelection sel = Activator.getDefault().getWorkbench().getActiveWorkbenchWindow()
      .getSelectionService().getSelection();
  if (sel instanceof ITreeSelection) {
    ITreeSelection treeSel = (ITreeSelection) sel;
    if (treeSel.getFirstElement() instanceof IFile) {
      IFile file = (IFile) treeSel.getFirstElement();
      List<IMarker> markers = MarkerFactory.findMarkers(file);
      MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Marker Count", null,
          markers.size() + " marker(s)", MessageDialog.INFORMATION, new String[] {"OK"}, 0);
      dialog.open();
    }
  }
  return null;
}
 
Example 3
Project: Hydrograph   File: RunConfigDialog.java   View source code 6 votes vote down vote up
private boolean isUsernamePasswordOrHostEmpty() {
	Notification notification = new Notification();
	if (remoteMode) {
		if (StringUtils.isEmpty(txtEdgeNode.getText())){
			notification.addError(Messages.EMPTY_HOST_FIELD_MESSAGE);
		}
			
		if (StringUtils.isEmpty(txtUserName.getText())){
			notification.addError(Messages.EMPTY_USERNAME_FIELD_MESSAGE);
		}
		if(radioPassword.getSelection() && StringUtils.isEmpty(txtPassword.getText())){
			notification.addError(Messages.EMPTY_PASSWORD_FIELD_MESSAGE);
		}
	}
	
	if(notification.hasErrors()){
		MessageDialog.openError(Display.getDefault().getActiveShell(), Messages.EMPTY_FIELDS_MESSAGE_BOX_TITLE,
				notification.errorMessage());	
		return true;
	}else{
		return false;
	}
}
 
Example 4
Project: n4js   File: TestResultsView.java   View source code 6 votes vote down vote up
/**
 * Invoked when user performs {@link #actionRelaunch}.
 */
protected void performRelaunch() {
	if (null != currentRoot) {
		final TestSession session = from(registeredSessions).firstMatch(s -> s.root == currentRoot).orNull();
		if (null != session) {
			final TestConfiguration configurationToReRun = session.configuration;
			registeredSessions.remove(session);
			try {
				final TestConfiguration newConfiguration = testerFrontEnd.createConfiguration(configurationToReRun);
				testerFrontEndUI.runInUI(newConfiguration);
			} catch (Exception e) {
				String message = "Test class not found in the workspace.";
				if (!Strings.isNullOrEmpty(e.getMessage())) {
					message += " Reason: " + e.getMessage();
				}
				MessageDialog.openError(getShell(), "Cannot open editor", message);
			}
		}
	}
}
 
Example 5
Project: Hydrograph   File: Container.java   View source code 6 votes vote down vote up
/**
 * Checks if given subjob can be added to canvas.
 * 
 * @param ioSubjobComponentName
 *            the io subjob component name
 * @return true, if successful
 */
private boolean canAddSubjobToCanvas(String ioSubjobComponentName) {

	if (StringUtils.equalsIgnoreCase(Constants.INPUT_SUBJOB_COMPONENT_NAME, ioSubjobComponentName)
			|| StringUtils.equalsIgnoreCase(Constants.OUTPUT_SUBJOB, ioSubjobComponentName)) {
		for (Component component : components) {
			if (StringUtils.equalsIgnoreCase(ioSubjobComponentName, component.getComponentName())) {
				MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", ioSubjobComponentName
						+ " [" + component.getComponentLabel().getLabelContents() + "]"
						+ Constants.SUBJOB_ALREADY_PRESENT_IN_CANVAS);
				return false;
			}
		}
	}
	return true;
}
 
Example 6
Project: android-uiautomatorviewer   File: ScreenshotAction.java   View source code 6 votes vote down vote up
private IDevice pickDevice() {
  List<IDevice> devices = DebugBridge.getDevices();
  if (devices.size() == 0) {
    MessageDialog.openError(mViewer.getShell(),
        "Error obtaining Device Screenshot",
        "No Android devices were detected by adb.");
    return null;
  } else if (devices.size() == 1) {
    return devices.get(0);
  } else {
    DevicePickerDialog dlg = new DevicePickerDialog(mViewer.getShell(), devices);
    if (dlg.open() != Window.OK) {
      return null;
    }
    return dlg.getSelectedDevice();
  }
}
 
Example 7
Project: OCCI-Studio   File: RegisterOCCIExtensionAction.java   View source code 6 votes vote down vote up
/**
 * @see IActionDelegate#run(IAction)
 */
public void run(IAction action) {
	if (selection != null) {
		IFile selectedFile = (IFile) ((IStructuredSelection) selection)
				.getFirstElement();

		// Use a platform:/resource/ URI
		URI uri = URI.createPlatformResourceURI(selectedFile.getFullPath().toString(), true);

		ResourceSet rs = new ResourceSetImpl();
		Resource r = rs.getResource(uri, true);

		Extension extension = (Extension) r.getContents().get(0);
		OcciRegistry.getInstance().registerExtension(extension.getScheme(),
				uri.toString());
		closeOtherSessions(selectedFile.getProject());
		MessageDialog.openInformation(shell,
				Messages.RegisterExtensionAction_ExtRegistration,
				Messages.RegisterExtensionAction_RegisteredExtension
						+ extension.getScheme());
	}
}
 
Example 8
Project: pmTrans   File: PmTrans.java   View source code 6 votes vote down vote up
protected void exportTextFile() {
	boolean done = false;
	while (!done)
		if (!textEditor.isDisposed()) {
			FileDialog fd = new FileDialog(Display.getCurrent().getActiveShell(), SWT.SAVE);
			fd.setFilterNames(new String[] { "Plain text file (*.txt)", "All Files (*.*)" });
			fd.setFilterExtensions(new String[] { "*.txt", "*.*" });
			String lastPath = Config.getInstance().getString(Config.LAST_EXPORT_TRANSCRIPTION_PATH);
			if (lastPath != null && !lastPath.isEmpty())
				fd.setFileName(lastPath);
			String file = fd.open();
			try {
				if (file != null) {
					Config.getInstance().putValue(Config.LAST_EXPORT_TRANSCRIPTION_PATH, file);
					File destFile = new File(file);
					boolean overwrite = true;
					if (destFile.exists())
						overwrite = MessageDialog.openConfirm(shell, "Overwrite current file?",
								"Would you like to overwrite " + destFile.getName() + "?");
					if (overwrite) {
						textEditor.exportText(new File(file));
						done = true;
					}
				} else
					done = true;
			} catch (Exception e) {
				e.printStackTrace();
				MessageBox diag = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);
				diag.setMessage("Unable to export to file " + transcriptionFile.getPath());
				diag.open();
			}
		}
}
 
Example 9
Project: Hydrograph   File: ExternalOperationExpressionUtil.java   View source code 6 votes vote down vote up
/**
 * Exports UI-operation data to external file
 * 
 * @param file
 * @param mappingSheetRow
 * @param showErrorMessage
 * @param list
 * @throws ExternalTransformException
 */
public void exportOperation(File file, MappingSheetRow mappingSheetRow ,boolean showErrorMessage,List<GridRow> list) throws ExternalTransformException {
	if (file!=null) {
		try{
			Object object=convertUIOperationToJaxb(mappingSheetRow, list);
			marshal(ExternalOperations.class, file, object);
		} catch (Exception exception) {
			LOGGER.warn("Error ", exception);
			if(showErrorMessage){
				MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", "Failed to export output fields - \n"+exception.getMessage());
			}
			return;
		}
		MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Information", "Operation exported sucessfully");
	}
}
 
Example 10
Project: Tarski   File: CountMarkersInResourceHandler.java   View source code 6 votes vote down vote up
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
  ISelection selection = MarkerFactory.getSelection();
  if (selection instanceof ITreeSelection) {
    ITreeSelection treeSelection = (ITreeSelection) selection;
    if (treeSelection.getFirstElement() instanceof IOpenable
        || treeSelection.getFirstElement() instanceof IFile) {
      IResource resource =
          ((IAdaptable) treeSelection.getFirstElement()).getAdapter(IResource.class);
      List<IMarker> markers = MarkerFactory.findMarkers(resource);
      MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Marker Count", null,
          markers.size() + " marker(s)", MessageDialog.INFORMATION, new String[] {"OK"}, 0);
      dialog.open();
    }
  }
  return null;
}
 
Example 11
Project: Hydrograph   File: TransformWidget.java   View source code 6 votes vote down vote up
/** 
 * @param inputLinkSchema
 * @param currentCompSchema
 */
private boolean compareSchemaFields(List<GridRow> inputLinkSchema, List<GridRow> currentCompSchema){
	for(int index = 0; index < currentCompSchema.size() - 1; index++){
		for(GridRow gridRow : inputLinkSchema){
			if(StringUtils.equals(gridRow.getFieldName(), currentCompSchema.get(index).getFieldName())){
				if(!StringUtils.equals(gridRow.getDataTypeValue(), currentCompSchema.get(index).getDataTypeValue())){
					MessageDialog dialog = new MessageDialog(new Shell(),
							"Warning", null,"Output Schema is updated,Do you want to continue with changes?", MessageDialog.CONFIRM,
							new String[] {"Yes", "No"}, 0);
					int dialogResult =dialog.open();
					if(dialogResult == 0){
						return true;
					}else{
						return false;
					}
				}
			}
		}
	}
	return true;
}
 
Example 12
Project: Hydrograph   File: ELTGraphicalEditor.java   View source code 6 votes vote down vote up
private void generateTargetXMLInWorkspace(IFile ifile, Container container) {
	IFile outPutFile = ResourcesPlugin.getWorkspace().getRoot().getFile(ifile.getFullPath().removeFileExtension().addFileExtension("xml"));
	try {
		if(container!=null)
			ConverterUtil.INSTANCE.convertToXML(container, false, outPutFile,null);
		else
			ConverterUtil.INSTANCE.convertToXML(this.container, false, outPutFile,null);
	} catch (EngineException eexception) {
		logger.warn("Failed to create the engine xml", eexception);
		MessageDialog.openError(Display.getDefault().getActiveShell(), "Failed to create the engine xml", eexception.getMessage());
		//			
	}catch (InstantiationException|IllegalAccessException| InvocationTargetException| NoSuchMethodException exception) {
		logger.error("Failed to create the engine xml", exception);
		Status status = new Status(IStatus.ERROR, "hydrograph.ui.graph",
				"Failed to create Engine XML " + exception.getMessage());
		StatusManager.getManager().handle(status, StatusManager.SHOW);
	}
	
}
 
Example 13
Project: Hydrograph   File: FilterLogicExternalOperationExpressionUtil.java   View source code 6 votes vote down vote up
public ExpressionData importExpression(File file, ExpressionData expressionData,boolean showErrorMessage,
	 String componentName) {
	
	if (file!=null) {
		try (FileInputStream fileInputStream=new FileInputStream(file)){
			ExternalExpressions externalExpression = (ExternalExpressions) ExternalOperationExpressionUtil.INSTANCE.unmarshal(fileInputStream,ExternalExpressions.class);
			
			expressionData = convertToUIExpression(externalExpression.getExternalExpressions(),expressionData, componentName);
			if(showErrorMessage && expressionData!=null){
				MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Information", "Expression imported sucessfully");
			}
		} catch (Exception exception) {
			LOGGER.warn("Error ", exception);
			if(showErrorMessage){
				MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", "Failed to import expression - Invalid XML");
			}
		}
	}
	return expressionData;
}
 
Example 14
Project: convertigo-eclipse   File: MyAbstractAction.java   View source code 6 votes vote down vote up
@Override
public void run() {
	Display display = Display.getDefault();
	Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);		
	
	Shell shell = getParentShell();
	shell.setCursor(waitCursor);
	
	MessageDialog.openInformation(
		shell,
		"Convertigo Plug-in",
		"The choosen operation is not yet implemented : '"+ action.getId() + "'.");
	
	shell.setCursor(null);
	waitCursor.dispose();
}
 
Example 15
Project: scanning   File: ControlTreeViewer.java   View source code 6 votes vote down vote up
private void removeNode() {
	final INamedNode selectedNode = getSelection();
	ControlTree controlTree = getControlTree();
	INamedNode parent = controlTree.getNode(selectedNode.getParentName());
	if (selectedNode.getChildren()==null || selectedNode.getChildren().length<1) {
		controlTree.delete(selectedNode);
	} else {
		boolean ok = MessageDialog.openQuestion(content.getShell(), "Confirm Delete", "The item '"+selectedNode.getName()+"' is a group.\n\nAre you sure you would like to delete it?");
		if (ok) controlTree.delete(selectedNode);
	}
	viewer.refresh();
	if (parent.hasChildren()) {
		setSelection(parent.getChildren()[parent.getChildren().length-1]);
	} else {
	    setSelection(parent);
	}
}
 
Example 16
Project: scanning   File: DetectorView.java   View source code 6 votes vote down vote up
protected void refresh() {

		DeviceInformation<?> info = getSelection();

		boolean ok = MessageDialog.openQuestion(getViewSite().getShell(), "Confirm Refresh",
				                "This action will go to the devices and re-read their models.\n"+
				                "It will mean that if you have made local edits, they could be lost.\n\n"+
				                "Are you sure you want continue?\n\n"+
				                "(If not the 'Configure' action can be used to send your local edits to a device.)");
		if (!ok) return;

		if (info!=null) {
			try {
			    Collection<DeviceInformation<?>> devices = dservice.getDeviceInformationIncludingNonAlive();
				viewer.setInput(new Object());
			    for (DeviceInformation<?> di : devices) {
					if (di.getName()!=null && info.getName()!=null && di.getName().equals(info.getName())) {
						viewer.setSelection(new StructuredSelection(di));
						break;
					}
				}
			} catch (ScanningException se) {
				logger.error("Problem getting device information", se);
			}
		}
	}
 
Example 17
Project: scanning   File: ConsumerView.java   View source code 6 votes vote down vote up
private void restart() {

	    HeartbeatBean bean = getSelection();
	    if (bean==null) return;

	    boolean ok = MessageDialog.openConfirm(getSite().getShell(), "Confirm Retstart", "If you restart this consumer other people's running jobs may be lost.\n\n"
				                                                                      + "Are you sure that you want to continue?");
	    if (!ok) return;

	    final KillBean kbean = new KillBean();
	    kbean.setExitProcess(false);
		kbean.setMessage("Requesting a restart of "+bean.getConsumerName());
	    kbean.setConsumerId(bean.getConsumerId());
	    kbean.setRestart(true);
		send(bean, kbean);

		consumers.clear();
        viewer.refresh();
		try {
			Thread.sleep(2000);
		} catch (InterruptedException e) {
			logger.error("Refreshing consumers that we can process", e);
		}
        viewer.refresh();
	}
 
Example 18
Project: Tarski   File: DeleteAllHandler.java   View source code 6 votes vote down vote up
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  this.candidateToTypeChanging = new ArrayList<IMarker>();
  this.deleteMarkers();
  this.refresh();
  if (AlloyUtilities.isExists()) {
    this.candidateToTypeChanging = new ArrayList<IMarker>();
    this.deleteMarkers();
    this.refresh();
  } else {
    final MessageDialog infoDialog = new MessageDialog(MarkerActivator.getShell(),
        "System Information", null, "You dont have any registered alloy file to system.",
        MessageDialog.INFORMATION, new String[] {"OK"}, 0);
    infoDialog.open();
  }
  return null;
}
 
Example 19
Project: scanning   File: StatusQueueView.java   View source code 6 votes vote down vote up
/**
 * Pushes any previous run back into the UI
 */
protected void openSelection() {

	final StatusBean [] beans = getSelection();
	if (beans.length == 0) {
		MessageDialog.openInformation(getViewSite().getShell(), "Please select a run", "Please select a run to open.");
		return;
	}

	// TODO FIXME Change to IScanBuilderService not selections so that it works with e4.
	// We fire a special object into the selection mechanism with the data for this run.
	// It is then up to parts to respond to this selection and update their contents.
	// We call fireSelection as the openRequest isn't in the table. This sets the workb
	for (StatusBean bean : beans) {
		selectionProvider.fireSelection(new StructuredSelection(new OpenRequest(bean)));
	}
}
 
Example 20
Project: scanning   File: StatusQueueView.java   View source code 6 votes vote down vote up
private void rerun(StatusBean bean) {

		try {
			final DateFormat format = DateFormat.getDateTimeInstance();
			boolean ok = MessageDialog.openQuestion(getViewSite().getShell(), "Confirm resubmission "+bean.getName(),
					  "Are you sure you want to rerun "+bean.getName()+" submitted on "+format.format(new Date(bean.getSubmissionTime()))+"?");

			if (!ok) return;

			final StatusBean copy = bean.getClass().newInstance();
			copy.merge(bean);
			copy.setUniqueId(UUID.randomUUID().toString());
			copy.setMessage("Rerun of "+bean.getName());
			copy.setStatus(org.eclipse.scanning.api.event.status.Status.SUBMITTED);
			copy.setPercentComplete(0.0);
			copy.setSubmissionTime(System.currentTimeMillis());

			queueConnection.submit(copy, true);

			reconnect();

		} catch (Exception e) {
			ErrorDialog.openError(getViewSite().getShell(), "Cannot rerun "+bean.getName(), "Cannot rerun "+bean.getName()+"\n\nPlease contact your support representative.",
					new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage()));
		}
	}
 
Example 21
Project: Hydrograph   File: ExternalOperationExpressionUtil.java   View source code 6 votes vote down vote up
public void exportExpression(File file, MappingSheetRow mappingSheetRow ,boolean showErrorMessage,List<GridRow> schemaFieldList
		) throws ExternalTransformException {
	if (file!=null) {
		try{
			Object object=convertUIExpressionToJaxb(mappingSheetRow, schemaFieldList);
			marshal(ExternalExpressions.class, file, object);
		} catch (Exception exception) {
			LOGGER.warn("Error ", exception);
			if(showErrorMessage){
				MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", "Failed to export output fields - \n"+exception.getMessage());
			}
			return;
		}
		MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Information", "Expression exported sucessfully");
	}
}
 
Example 22
Project: Open_Source_ECOA_Toolset_AS5   File: ClearTargetAction.java   View source code 6 votes vote down vote up
@Override
public void run() {
	if (GenerationUtils.validate(containerName)) {
		Shell shell = Display.getDefault().getActiveShell();
		boolean confirm = MessageDialog.openQuestion(shell, "Confirm Create", "Existing Files will be cleared. Do you wish to continue?");
		if (confirm) {
			wsRoot = ResourcesPlugin.getWorkspace().getRoot();
			names = StringUtils.split(containerName, "/");
			wsRootRes = wsRoot.findMember(new Path("/" + names[0]));
			prj = wsRootRes.getProject();
			steps = prj.getFolder("target/Steps");
			File root = new File(steps.getLocation().toOSString());
			if (root.exists()) {
				GenerationUtils.clearCreatedFolders(root);
			}
			for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
				try {
					project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
				} catch (CoreException e) {
				}
			}
		}
	}
}
 
Example 23
Project: Hydrograph   File: ExternalOperationExpressionUtil.java   View source code 6 votes vote down vote up
/**
 * Exports UI-mapping data to external file
 * 
 * @param file
 * @param transformMapping
 * @param showErrorMessage
 * @param componentName
 * @throws ExternalTransformException
 */
public void exportOutputFields(File file, TransformMapping transformMapping ,boolean showErrorMessage,String componentName) throws ExternalTransformException {
	if (file!=null) {
		try{
			Object object=convertUiOutputFieldsToJaxb(transformMapping,componentName);
			marshal(ExternalMappings.class, file, object);
		} catch (Exception exception) {
			LOGGER.warn("Error ", exception);
			if(showErrorMessage){
				MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", "Failed to export output fields - \n"+exception.getMessage());
			}
			return;
		}
		MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Information", "Fields exported sucessfully");
	}
}
 
Example 24
Project: visuflow-plugin   File: ToggleJimpleBreakpointsTarget.java   View source code 5 votes vote down vote up
@Override
public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
	this.part = part;

	try {
		if(jimpleBreakpointExists()) {
			deleteJimpleBreakpoint();
		} else {
			createJimpleBreakpoint();
		}
	} catch (BadLocationException e) {
		logger.error("Couldn't place breakpoint", e);
		MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Breakpoint could not be placed", "Error in inserting breakpoint");
	}
}
 
Example 25
Project: n4js   File: ModuleSpecifierSelectionDialog.java   View source code 5 votes vote down vote up
/**
 * Creates all non-existing segments of the given path.
 *
 * @param path
 *            The path to create
 * @param parent
 *            The container in which the path should be created in
 * @param monitor
 *            A progress monitor. May be {@code null}
 *
 * @return The folder specified by the path
 */
private IContainer createFolderPath(IPath path, IContainer parent, IProgressMonitor monitor) {
	IContainer activeContainer = parent;

	if (null != monitor) {
		monitor.beginTask("Creating folders", path.segmentCount());
	}

	for (String segment : path.segments()) {
		IFolder folderToCreate = activeContainer.getFolder(new Path(segment));
		try {
			if (!folderToCreate.exists()) {
				createFolder(segment, activeContainer, monitor);
			}
			if (null != monitor) {
				monitor.worked(1);
			}
			activeContainer = folderToCreate;
		} catch (CoreException e) {
			LOGGER.error("Failed to create module folders.", e);
			MessageDialog.open(MessageDialog.ERROR, getShell(),
					FAILED_TO_CREATE_FOLDER_TITLE, String.format(FAILED_TO_CREATE_FOLDER_MESSAGE,
							folderToCreate.getFullPath().toString(), e.getMessage()),
					SWT.NONE);
			break;
		}
	}
	return activeContainer;
}
 
Example 26
Project: n4js   File: N4JSBuilderPreferencePage.java   View source code 5 votes vote down vote up
/**
 * This method has been copied and adapted from org.eclipse.xtext.ui.preferences.OptionsConfigurationBlock.
 */
@Override
protected boolean processChanges(IWorkbenchPreferenceContainer container) {
	boolean needsBuild = !getPreferenceChanges().isEmpty() | projectSpecificChanged;
	boolean doBuild = false;
	if (needsBuild) {
		int count = getRebuildCount();
		if (count > rebuildCount) {
			needsBuild = false;
			rebuildCount = count;
		}
	}
	if (needsBuild) {
		String[] strings = getFullBuildDialogStrings(project == null);
		if (strings != null) {
			MessageDialog dialog = new MessageDialog(this.getShell(), strings[0], null, strings[1],
					MessageDialog.QUESTION,
					new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
							IDialogConstants.CANCEL_LABEL },
					2);
			int res = dialog.open();
			if (res == 0) {
				doBuild = true;
			} else if (res != 1) {
				return false;
			}
		}
	}
	if (container != null) {
		if (doBuild) {
			incrementRebuildCount();
			container.registerUpdateJob(getBuildJob(getProject()));
		}
	} else {
		if (doBuild) {
			getBuildJob(getProject()).schedule();
		}
	}
	return true;
}
 
Example 27
Project: pgsqlblocks   File: ProcessesController.java   View source code 5 votes vote down vote up
@Override
public void dbProcessInfoViewCancelProcessToolItemClicked() {
    if (dbModelsView.getTableViewer().getStructuredSelection().getFirstElement() == null) {
        return;
    }
    DBController selectedController = (DBController) dbModelsView.getTableViewer().getStructuredSelection().getFirstElement();
    if (selectedProcess != null) {
        final int processPid = selectedProcess.getPid();
        if (settings.isConfirmRequired() && !MessageDialog.openQuestion(view.getShell(), resourceBundle.getString("confirm_action"),
                MessageFormat.format(resourceBundle.getString("cancel_process_confirm_message"), processPid))) {
            return;
        }
        try {
            boolean result = selectedController.cancelProcessWithPid(processPid);
            if (result) {
                LOG.info(MessageFormat.format(resourceBundle.getString("process_cancelled"), selectedController.getModel().getName(), processPid));
            } else {
                LOG.info(MessageFormat.format(resourceBundle.getString("process_not_cancelled"), selectedController.getModel().getName(), processPid));
            }
        } catch (SQLException exception) {
            LOG.error(selectedController.getModel().getName() + " " + exception.getMessage(), exception);
            LOG.info(MessageFormat.format(resourceBundle.getString("process_not_cancelled"), selectedController.getModel().getName(), processPid));
        } finally {
            selectedController.updateProcesses();
        }
    }
}
 
Example 28
Project: Tarski   File: MarkAllInWorkspaceHandler.java   View source code 5 votes vote down vote up
private void createMarkersWs() {
  ITextSelection textSelection = (ITextSelection) this.selection;
  if (MarkerFactory.findMarkerWithAbsolutePosition(this.file, textSelection.getOffset(),
      textSelection.getOffset() + textSelection.getLength()) != null) {
    MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Mark Information", null,
        "In these area, there is already a marker", MessageDialog.WARNING, new String[] {"OK"},
        0);
    dialog.open();
    return;
  } else {
    MarkAllInWsWizard markAllWsWizard = new MarkAllInWsWizard(textSelection, this.file);
    WizardDialog selectionDialog = new WizardDialog(MarkerActivator.getShell(), markAllWsWizard);
    selectionDialog.open();
  }
}
 
Example 29
Project: n4js   File: N4JSMarkerResolutionGenerator.java   View source code 5 votes vote down vote up
private void showError_MultiApplyNotSupported() {
	if (workbench == null)
		return;
	MessageDialog
			.openInformation(
					workbench.getActiveWorkbenchWindow().getShell(),
					"Cannot Apply To Multiple Issues",
					"Some quick fixes are hidden because they do not support being applied to multiple issues at once.");
}
 
Example 30
Project: time4sys   File: SrmEditor.java   View source code 5 votes vote down vote up
/**
 * Shows a dialog that asks if conflicting changes should be discarded.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected boolean handleDirtyConflict() {
	return
		MessageDialog.openQuestion
			(getSite().getShell(),
			 getString("_UI_FileConflict_label"),
			 getString("_WARN_FileConflict"));
}
 
Example 31
Project: Hydrograph   File: FilterLogicExternalOperationExpressionUtil.java   View source code 5 votes vote down vote up
public void exportExpression(File file, ExpressionData expressionData ,boolean showErrorMessage	) throws ExternalTransformException {
	if (file!=null) {
		try{
			Object object=convertUIExpressionToJaxb(expressionData);
			ExternalOperationExpressionUtil.INSTANCE.marshal(ExternalExpressions.class, file, object);
		} catch (Exception exception) {
			LOGGER.warn("Error ", exception);
			if(showErrorMessage){
				MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", "Failed to export expression - \n"+exception.getMessage());
			}
			return;
		}
		MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Information", "Expression exported sucessfully");
	}
}
 
Example 32
Project: Hydrograph   File: FilterLogicExternalOperationExpressionUtil.java   View source code 5 votes vote down vote up
public void exportOperation(File file, OperationClassData operationClassData ,boolean showErrorMessage) throws ExternalTransformException {
	if (file!=null) {
		try{
			Object object=convertUIOperationToJaxb(operationClassData);
			ExternalOperationExpressionUtil.INSTANCE.marshal(ExternalOperations.class, file, object);
		} catch (Exception exception) {
			LOGGER.warn("Error ", exception);
			if(showErrorMessage){
				MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", "Failed to export operation - \n"+exception.getMessage());
			}
			return;
		}
		MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Information", "Operation exported sucessfully");
	}
}
 
Example 33
Project: smarthome-cep-demonstrator   File: SmarthomeEditor.java   View source code 5 votes vote down vote up
/**
 * Shows a dialog that asks if conflicting changes should be discarded.
 * <!-- begin-user-doc -->
    * <!-- end-user-doc -->
 * @generated
 */
   protected boolean handleDirtyConflict() {
	return
		MessageDialog.openQuestion
			(getSite().getShell(),
			 getString("_UI_FileConflict_label"),
			 getString("_WARN_FileConflict"));
}
 
Example 34
Project: SimQRI   File: MetamodelEditor.java   View source code 5 votes vote down vote up
/**
 * Shows a dialog that asks if conflicting changes should be discarded.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected boolean handleDirtyConflict() {
	return
		MessageDialog.openQuestion
			(getSite().getShell(),
			 getString("_UI_FileConflict_label"),
			 getString("_WARN_FileConflict"));
}
 
Example 35
Project: Tarski   File: MarkerMapping.java   View source code 5 votes vote down vote up
private void run() {
  if (MarkerMapping.marker != null && MarkerMapping.marker.exists()) {
    chooseForAction(MarkerMapping.marker);
  } else {
    final MessageDialog dialog =
        new MessageDialog(MarkerActivator.getShell(), "There is no marker in this position", null,
            "Please select valid marker", MessageDialog.INFORMATION, new String[] {"OK"}, 0);
    dialog.open();
  }
}
 
Example 36
Project: gw4e.project   File: DialogManager.java   View source code 5 votes vote down vote up
/**
 * 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 37
Project: eclipse-jenkins-editor   File: JenkinsEditorMessageDialogSupport.java   View source code 5 votes vote down vote up
public void showError(String message) {
	EclipseUtil.safeAsyncExec(new Runnable() {

		@Override
		public void run() {
			Shell shell = getActiveWorkbenchShell();
			MessageDialog.openError(shell, JENKINS_EDITOR, message);
		}

	});

}
 
Example 38
Project: gemoc-studio-modeldebugging   File: TracingannotationsEditor.java   View source code 5 votes vote down vote up
/**
 * Shows a dialog that asks if conflicting changes should be discarded.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
protected boolean handleDirtyConflict() {
	return
		MessageDialog.openQuestion
			(getSite().getShell(),
			 getString("_UI_FileConflict_label"),
			 getString("_WARN_FileConflict"));
}
 
Example 39
Project: gemoc-studio-modeldebugging   File: AbstractSequentialGemocLauncher.java   View source code 5 votes vote down vote up
protected final void warn(final String message) {
	getMessagingSystem().warn(message, getPluginID());
	PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
		public void run() {
			MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
					"GEMOC Engine Launcher", message);
		}
	});
}
 
Example 40
Project: gemoc-studio   File: GemocPackageDiscovery.java   View source code 5 votes vote down vote up
private void errorDialog(final Shell shell, Exception e) {
	String message = "We can't connect to the discovery source: \n"
			+ CATALOG_URI
			+ "\n Make sure you're connected to internet and try again.";
	MessageDialog.openError(shell,
			"Can't connect to discovery source", message);
	throw new RuntimeException(e);
}