當前位置: 首頁>>代碼示例>>Java>>正文


Java MessageDialog類代碼示例

本文整理匯總了Java中org.eclipse.jface.dialogs.MessageDialog的典型用法代碼示例。如果您正苦於以下問題:Java MessageDialog類的具體用法?Java MessageDialog怎麽用?Java MessageDialog使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MessageDialog類屬於org.eclipse.jface.dialogs包,在下文中一共展示了MessageDialog類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isUsernamePasswordOrHostEmpty

import org.eclipse.jface.dialogs.MessageDialog; //導入依賴的package包/類
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;
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:24,代碼來源:RunConfigDialog.java

示例2: create

import org.eclipse.jface.dialogs.MessageDialog; //導入依賴的package包/類
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 );
    }

}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:22,代碼來源:WriteConfirmDialog.java

示例3: execute

import org.eclipse.jface.dialogs.MessageDialog; //導入依賴的package包/類
@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;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:17,代碼來源:CountMarkersInFileHandler.java

示例4: performRelaunch

import org.eclipse.jface.dialogs.MessageDialog; //導入依賴的package包/類
/**
 * 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);
			}
		}
	}
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:23,代碼來源:TestResultsView.java

示例5: canAddSubjobToCanvas

import org.eclipse.jface.dialogs.MessageDialog; //導入依賴的package包/類
/**
 * 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;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:23,代碼來源:Container.java

示例6: pickDevice

import org.eclipse.jface.dialogs.MessageDialog; //導入依賴的package包/類
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();
  }
}
 
開發者ID:DroidTesting,項目名稱:android-uiautomatorviewer,代碼行數:18,代碼來源:ScreenshotAction.java

示例7: run

import org.eclipse.jface.dialogs.MessageDialog; //導入依賴的package包/類
/**
 * @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());
	}
}
 
開發者ID:occiware,項目名稱:OCCI-Studio,代碼行數:25,代碼來源:RegisterOCCIExtensionAction.java

示例8: exportTextFile

import org.eclipse.jface.dialogs.MessageDialog; //導入依賴的package包/類
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();
			}
		}
}
 
開發者ID:juanerasmoe,項目名稱:pmTrans,代碼行數:34,代碼來源:PmTrans.java

示例9: exportOperation

import org.eclipse.jface.dialogs.MessageDialog; //導入依賴的package包/類
/**
 * 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");
	}
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:25,代碼來源:ExternalOperationExpressionUtil.java

示例10: execute

import org.eclipse.jface.dialogs.MessageDialog; //導入依賴的package包/類
@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;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:18,代碼來源:CountMarkersInResourceHandler.java

示例11: compareSchemaFields

import org.eclipse.jface.dialogs.MessageDialog; //導入依賴的package包/類
/** 
 * @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;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:25,代碼來源:TransformWidget.java

示例12: generateTargetXMLInWorkspace

import org.eclipse.jface.dialogs.MessageDialog; //導入依賴的package包/類
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);
	}
	
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:20,代碼來源:ELTGraphicalEditor.java

示例13: importExpression

import org.eclipse.jface.dialogs.MessageDialog; //導入依賴的package包/類
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;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:21,代碼來源:FilterLogicExternalOperationExpressionUtil.java

示例14: run

import org.eclipse.jface.dialogs.MessageDialog; //導入依賴的package包/類
@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();
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:17,代碼來源:MyAbstractAction.java

示例15: removeNode

import org.eclipse.jface.dialogs.MessageDialog; //導入依賴的package包/類
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);
	}
}
 
開發者ID:eclipse,項目名稱:scanning,代碼行數:18,代碼來源:ControlTreeViewer.java


注:本文中的org.eclipse.jface.dialogs.MessageDialog類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。