本文整理汇总了Java中org.eclipse.jface.dialogs.MessageDialog.openError方法的典型用法代码示例。如果您正苦于以下问题:Java MessageDialog.openError方法的具体用法?Java MessageDialog.openError怎么用?Java MessageDialog.openError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.dialogs.MessageDialog
的用法示例。
在下文中一共展示了MessageDialog.openError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
}
示例2: generateTargetXMLInLocalFileSystem
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
private void generateTargetXMLInLocalFileSystem(IFileStore fileStore, Container container) {
try {
if(container!=null)
ConverterUtil.INSTANCE.convertToXML(container, false, null,fileStore);
else
ConverterUtil.INSTANCE.convertToXML(this.container, false,null,fileStore);
} 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);
}
}
示例3: handleButtonOKWidgetSelected
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
/**
*
*/
private void handleButtonOKWidgetSelected() {
String username = fTextUsername.getText();
String password = fTextPassword.getText();
// Aunthentication is successful if a user provides any username and
// any password
if ((username.length() > 0) &&
(password.length() > 0)) {
fAuthenticated = true;
} else {
MessageDialog.openError(
getSplash(),
"Authentication Failed", //NON-NLS-1
"A username and password must be specified to login."); //NON-NLS-1
}
}
示例4: 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;
}
}
示例5: setInput
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
@Override
public void setInput(IEditorInput input) {
if(input instanceof FileStoreEditorInput){
MessageBox messageBox=new MessageBox(Display.getCurrent().getActiveShell(),SWT.ICON_WARNING);
messageBox.setText(Messages.WARNING);
messageBox.setMessage(Messages.JOB_OPENED_FROM_OUTSIDE_WORKSPACE_WARNING);
messageBox.open();
}
try {
GenrateContainerData genrateContainerData = new GenrateContainerData();
genrateContainerData.setEditorInput(input, this);
if(StringUtils.equals(this.getJobName()+Messages.JOBEXTENSION, input.getName()) || StringUtils.equals(this.getJobName(), Messages.ELT_GRAPHICAL_EDITOR)){
container = genrateContainerData.getContainerData();
}else{
this.setPartName(input.getName());
}
super.setInput(input);
} catch (CoreException | IOException ce) {
logger.error("Exception while setting input", ce);
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().dispose();
MessageDialog.openError(new Shell(), "Error", "Exception occured while opening the graph -\n"+ce.getMessage());
}
}
示例6: importOperation
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
/**
* Imports UI-operation data from external operation file
*
* @param file
* @param mappingSheetRow
* @param showErrorMessage
* @param transformMapping
* @param componentName
* @return
* @throws ExternalTransformException
*/
public MappingSheetRow importOperation(File file, MappingSheetRow mappingSheetRow ,boolean showErrorMessage,
TransformMapping transformMapping, String componentName) throws ExternalTransformException {
if (file!=null) {
try (FileInputStream fileInputStream=new FileInputStream(file)){
ExternalOperations externalOperation=(ExternalOperations) unmarshal(fileInputStream,ExternalOperations.class);
mappingSheetRow=convertToUIOperation(mappingSheetRow, externalOperation.getExternalOperations(),transformMapping, componentName);
if(mappingSheetRow!=null && showErrorMessage){
MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Information", "Operation imported sucessfully");
}
} catch (Exception exception) {
LOGGER.warn("Error ", exception);
if(showErrorMessage){
MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", "Failed to import operation - Invalid XML");
}
}
}
return mappingSheetRow;
}
示例7: validateXML
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
private boolean validateXML(InputStream xml, InputStream xsd){
try
{
SchemaFactory factory =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
javax.xml.validation.Schema schema = factory.newSchema(new StreamSource(xsd));
Validator validator = schema.newValidator();
validator.validate(new StreamSource(xml));
return true;
}
catch( SAXException| IOException ex)
{
MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", Messages.IMPORT_XML_FORMAT_ERROR + "-\n" + ex.getMessage());
logger.error(Messages.IMPORT_XML_FORMAT_ERROR);
return false;
}
}
示例8: loadBuildProperties
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
private void loadBuildProperties() {
String buildPropFilePath = buildPropFilePath();
IPath bldPropPath = new Path(buildPropFilePath);
IFile iFile = ResourcesPlugin.getWorkspace().getRoot().getFile(bldPropPath);
try {
InputStream reader = iFile.getContents();
buildProps.load(reader);
} catch (CoreException | IOException e) {
MessageDialog.openError(Display.getDefault().getActiveShell(), "Error",
"Exception occurred while loading build properties from file -\n" + e.getMessage());
}
Enumeration<?> propertyNames = buildProps.propertyNames();
populateTextBoxes(propertyNames);
}
示例9: setComparison
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
/**
* Like {@link #setComparison()}, but a custom progress monitor can be provided (may be <code>null</code> if no
* progress monitor should be used).
*/
public void setComparison(IProgressMonitor monitor) {
if (monitor != null) {
monitor.beginTask("Building comparison for API / implementation projects in workspace ...",
IProgressMonitor.UNKNOWN);
monitor.worked(1);
}
final List<String> errorMessages = new ArrayList<>();
if (monitor != null) {
monitor.subTask("Comparing projects in workspace ...");
monitor.worked(1);
}
final ProjectComparison newComparison = projectCompareTreeHelper.createComparison(true, errorMessages);
if (errorMessages.isEmpty()) {
// if there is exactly one implementation, then focus on that; otherwise do not focus on an
// implementation (i.e. show all implementations side-by-side)
final String newFocusImplId;
if (newComparison != null && newComparison.getImplCount() == 1)
newFocusImplId = newComparison.getImplId(0);
else
newFocusImplId = null;
setComparison(newComparison, newFocusImplId, monitor);
} else {
setComparison(null, null, null);
MessageDialog.openError(
getTree().getShell(),
"Setup Invalid",
"The API / implementation setup is invalid:\n" + Joiner.on('\n').join(errorMessages));
}
if (monitor != null)
monitor.done();
}
示例10: runApplications
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
private void runApplications(final String userKey, final boolean keepLogged, final Path jsonPath) {
ApplicationsSWT applications = new ApplicationsSWT(null, userKey, keepLogged, ProjectUtils.getCloudLinkConfig(cloudLinkFile), allowDisableApply);
Credentials credentials = applications.getCredentials();
applications.open();
if (credentials.getCredentials() != null) {
utils.setCloudLinkIdeKey(credentials.getIdeKey());
Path finalJsonPath = jsonPath;
if (jsonPath.toFile().isDirectory()) {
finalJsonPath = Paths.get(jsonPath.toFile().toString(), ProjectUtils.CLOUDLINK_CONFIG_FILE);
}
String cloudLinkText = credentials.getCredentials();
try {
Files.write(finalJsonPath, cloudLinkText.getBytes(StandardCharsets.UTF_8));
cloudLinkFile.refreshLocal(IResource.DEPTH_ONE, null);
} catch (IOException | CoreException ex) {
MessageDialog.openError(new Shell(), "Error", "Error writing json file: " + ex);
ex.printStackTrace();
}
}
if (credentials.getUserKey() == null) {
utils.removeCloudLinkUserKey();
return;
}
if (credentials.getCredentials() != null && runnable != null) {
runnable.run();
}
}
示例11: executeCommand
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
private void executeCommand(String command) {
ZooKeeperServer server = getModel().getData();
String result = null;
if (command.equals(ZooKeeperServer.COMMAND_DUMP)) {
result = server.dump();
}
else if (command.equals(ZooKeeperServer.COMMAND_GET_TRACE_MASK)) {
result = server.getTraceMask();
}
else if (command.equals(ZooKeeperServer.COMMAND_RUOK)) {
result = server.ruok();
}
else if (command.equals(ZooKeeperServer.COMMAND_STAT)) {
result = server.stat();
}
else {
MessageDialog.openError(getSite().getShell(), "Bad command", "Command '" + command + "' not supported.");
return;
}
if (result == null) {
result = "<Command '" + command + "' returned no result>";
}
new CommandResultDialog(command, result).open();
}
示例12: doStore
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
@Override
protected void doStore() {
if (!character.getText().equals("[space]")
&& character.getText().length() > 1) {
MessageDialog
.openError(
Display.getCurrent().getActiveShell(),
"Error",
"The key "
+ character.getText()
+ " is not supported as a shortcut. Please use another one.");
doLoadDefault();
return;
}
String c = character.getText().equals("[space]") ? " " : character
.getText();
IPreferenceStore ps = getPreferenceStore();
updateAccelerators();
accelerators = accelerators.replace(ps.getString(keyConst), "");
if (accelerators.contains(c)) {
MessageDialog
.openError(
Display.getCurrent().getActiveShell(),
"Error",
"The key "
+ c
+ " is already used as a shortcut. Please use another one.");
doLoad();
updateAccelerators();
return;
}
ps.setValue(keyConst, c);
}
示例13: connectAndValidateUserNamePasswordAndHost
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
private boolean connectAndValidateUserNamePasswordAndHost() {
Message message = SCPUtility.INSTANCE.validateCredentials(host, username, password);
if (message.getMessageType() != MessageType.SUCCESS) {
MessageDialog.openError(Display.getDefault().getActiveShell(), Messages.CREDENTIAL_VALIDATION_MESSAGEBOX_TITLE,
message.getMessage());
return false;
}else{
return true;
}
}
示例14: exportExpression
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
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");
}
}
示例15: widgetSelected
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
public void widgetSelected(SelectionEvent e) {
String url = urlText.getText();
String username = usernameText.getText();
String password = passwordText.getText();
String testResult = testConnection(url, username, password);
if (testResult == null) {
MessageDialog.openInformation(getShell(), "提示", "测试连接成功!");
} else {
MessageDialog.openError(getShell(), "错误", "测试连接失败!\n" + testResult);
}
}