本文整理汇总了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;
}
}
示例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 );
}
}
示例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;
}
示例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);
}
}
}
}
示例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;
}
示例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();
}
}
示例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());
}
}
示例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();
}
}
}
示例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");
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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();
}
示例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);
}
}