Java Code Examples for org.eclipse.jface.dialogs.MessageDialog#openError()

The following examples show how to use org.eclipse.jface.dialogs.MessageDialog#openError() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public void run(IMarker marker) {
  IProject project = marker.getResource().getProject();

  IJavaProject javaProject = JavaCore.create(project);
  assert (JavaProjectUtilities.isJavaProjectNonNullAndExists(javaProject));

  try {
    WebAppUtilities.verifyHasManagedWarOut(project);

    WebAppUtilities.setOutputLocationToWebInfClasses(javaProject, null);
  } catch (CoreException e) {
    CorePluginLog.logError(e);
    MessageDialog.openError(
        CorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(),
        "Error While Modifying Output Directory",
        "Unable to set output directory to <WAR>/WEB-INF/classes. See the Error Log for more details.");
    return;
  }
}
 
Example 2
private void open(KeyReference keyReference) {
	if (keyReference == null)
		return;

	try {
		IEditorPart part= keyReference.element != null ? EditorUtility.openInEditor(keyReference.element, true) : EditorUtility.openInEditor(keyReference.resource, true);
		if (part != null)
			EditorUtility.revealInEditor(part, keyReference.offset, keyReference.length);
	} catch (PartInitException x) {

		String message= null;

		IWorkbenchAdapter wbAdapter= (IWorkbenchAdapter)((IAdaptable)keyReference).getAdapter(IWorkbenchAdapter.class);
		if (wbAdapter != null)
			message= Messages.format(PropertiesFileEditorMessages.OpenAction_error_messageArgs,
					new String[] { wbAdapter.getLabel(keyReference), x.getLocalizedMessage() } );

		if (message == null)
			message= Messages.format(PropertiesFileEditorMessages.OpenAction_error_message, x.getLocalizedMessage());

		MessageDialog.openError(fShell,
			PropertiesFileEditorMessages.OpenAction_error_messageProblems,
			message);
	}
}
 
Example 3
@Override
public void run() {
	Shell shell= getShell();
	IWorkingSetManager manager= PlatformUI.getWorkbench().getWorkingSetManager();
	IWorkingSet workingSet= fActionGroup.getWorkingSet();
	if (workingSet == null || workingSet.isAggregateWorkingSet()) {
		setEnabled(false);
		return;
	}
	IWorkingSetEditWizard wizard= manager.createWorkingSetEditWizard(workingSet);
	if (wizard == null) {
		String title= WorkingSetMessages.EditWorkingSetAction_error_nowizard_title;
		String message= WorkingSetMessages.EditWorkingSetAction_error_nowizard_message;
		MessageDialog.openError(shell, title, message);
		return;
	}
	WizardDialog dialog= new WizardDialog(shell, wizard);
 	dialog.create();
	if (dialog.open() == Window.OK)
		fActionGroup.setWorkingSet(wizard.getSelection(), true);
}
 
Example 4
private void displayDeploymentResult(Shell activeShell, IRunnableWithStatus operation) {
    IStatus status = operation.getStatus();
    if (status.isOK()) {
        MessageDialog.openInformation(activeShell, Messages.deployDoneTitle, status.getMessage());
    } else {
        MessageDialog.openError(activeShell, Messages.deployFailedTitle, status.getMessage());
    }
}
 
Example 5
Source Project: hadoop-gpu   File: DFSFolder.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void downloadToLocalDirectory(IProgressMonitor monitor, File dir) {
  if (!dir.exists())
    dir.mkdirs();

  if (!dir.isDirectory()) {
    MessageDialog.openError(null, "Download to local file system",
        "Invalid directory location: \"" + dir + "\"");
    return;
  }

  File dfsPath = new File(this.getPath().toString());
  File destination = new File(dir, dfsPath.getName());

  if (!destination.exists()) {
    if (!destination.mkdir()) {
      MessageDialog.openError(null, "Download to local directory",
          "Unable to create directory " + destination.getAbsolutePath());
      return;
    }
  }

  // Download all DfsPath children
  for (Object childObj : getChildren()) {
    if (childObj instanceof DFSPath) {
      ((DFSPath) childObj).downloadToLocalDirectory(monitor, destination);
      monitor.worked(1);
    }
  }
}
 
Example 6
/**
 * 添加或者取消疑问
 * @param selectedRowIds
 * @param state
 *            ;
 */
public void changIsQuestionState(List<String> selectedRowIds, String state) {
	IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory();
	try {
		operationHistory.execute(new NeedsReviewOperation("need-review", xliffEditor.getTable(), selectedRowIds,
				xliffEditor.getXLFHandler(), state), null, null);
	} catch (ExecutionException e) {
		LOGGER.error("", e);
		MessageDialog.openError(xliffEditor.getSite().getShell(),
				Messages.getString("utils.NattableUtil.msgTitle2"), e.getMessage());
		e.printStackTrace();
	}
}
 
Example 7
/**
 * Prompts to shutdown studio and if user accepts, then Studio is shutdown immediately.
 * 
 * @param title
 * @param message
 * @param productId
 */
public static void closeStudio(String title, String message, String productId)
{
	MessageDialog.openError(UIUtils.getActiveShell(), title, message);
	// not to use EclipseUtil.isStandalone() directly since it checks the existance of Aptana Studio RCP instead
	// TODO fix EclipseUtil.isStandalone() to maybe read from a preference key on what plugin id to check.
	if (EclipseUtil.getPluginVersion(productId) != null && !EclipseUtil.isTesting())
	{
		PlatformUI.getWorkbench().close();
	}
}
 
Example 8
public void importConfig() {
	boolean config = MessageDialog.openConfirm(getShell(),
			Messages.getString("Websearch.WebSearcPreferencePage.tipTitle"),
			Messages.getString("Websearch.WebSearcPreferencePage.importConfig"));
	if (!config) {
		return;
	}
	FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
	dialog.setFilterExtensions(new String[] { "*.xml" });
	dialog.open();
	String filterPath = dialog.getFilterPath();
	if (null == filterPath || filterPath.isEmpty()) {
		return;
	}
	String fileName = dialog.getFileName();
	if (fileName == null) {
		return;
	}
	String filePath = filterPath + File.separator + fileName;
	List<SearchEntry> importSearchConfig = WebSearchPreferencStore.getIns().importSearchConfig(filePath);
	if (null == importSearchConfig || importSearchConfig.isEmpty()) {
		MessageDialog.openError(getShell(), Messages.getString("Websearch.WebSearcPreferencePage.errorTitle"),
				Messages.getString("Websearch.WebSearcPreferencePage.importError"));
		return;
	} else {
		cache = importSearchConfig;
		refreshTable(cache);
		setDirty(true);
	}

}
 
Example 9
Source Project: gef   File: TagCloud.java    License: Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Does a full relayout of all displayed elements.
 * 
 * @param monitor
 * @return the number of words that could be placed
 */
public int layoutCloud(IProgressMonitor monitor, boolean recalc) {
	checkWidget();
	resetLayout();
	if (selectionLayerImage != null) {
		selectionLayerImage.dispose();
		selectionLayerImage = null;
	}
	regionOffset = new Point(0, 0);
	if (textLayerImage != null)
		textLayerImage.dispose();
	int placedWords = 0;
	try {
		if (recalc) {
			calcExtents(monitor);
		}
		placedWords = layoutWords(wordsToUse, monitor);
	} catch (Exception e) {
		MessageDialog.openError(getShell(), "Exception while layouting data",
				"An exception occurred while layouting: " + e.getMessage());
		e.printStackTrace();
	}
	// zoomFit();
	redraw();
	updateScrollbars();
	return placedWords;
}
 
Example 10
@Override
protected void okPressed() {

    if (fSessionsCombo.getSelectionIndex() < 0) {
        MessageDialog.openError(getShell(),
              Messages.TraceControl_EnableEventsDialogTitle,
              Messages.TraceControl_EnableEventsNoSessionError);
        return;
    }

    fSessionIndex = fSessionsCombo.getSelectionIndex();

    // if no channel is available or no channel is selected use default channel indicated by fChannel=null
    fChannel = null;
    if ((fChannels != null) && (fChannelsCombo.getSelectionIndex() >= 0)) {
        fChannel = fChannels[fChannelsCombo.getSelectionIndex()];
    }

    // initialize filter with null
    fFilterExpression = null;
    if (fSessions[0].isEventFilteringSupported(fDomain)) {
        String tempFilter = fFilterText.getText();

        if(!tempFilter.trim().isEmpty()) {
            fFilterExpression = tempFilter;
        }
    }

    super.okPressed();
}
 
Example 11
Source Project: Rel   File: DbConnection.java    License: Apache License 2.0 5 votes vote down vote up
public Value evaluate(String query) {
	try {
		Value result = connection.evaluate(query).awaitResult(QUERY_WAIT_MILLISECONDS);
		if (result instanceof Error) {
			MessageDialog.openError(Display.getDefault().getActiveShell(), "Error", result.toString());
			return new NullTuples();
		}
		return result;
	} catch (IOException e) {
		e.printStackTrace();
		return new NullTuples();
	}
}
 
Example 12
private void openReadErrorDialog(Exception e) {
	String title= PreferencesMessages.CodeTemplateBlock_error_read_title;

	String message= e.getLocalizedMessage();
	if (message != null)
		message= Messages.format(PreferencesMessages.CodeTemplateBlock_error_parse_message, message);
	else
		message= PreferencesMessages.CodeTemplateBlock_error_read_message;
	MessageDialog.openError(getShell(), title, message);
}
 
Example 13
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    try {
        final FileDialog fileDialog = new FileDialog(Display.getDefault().getActiveShell(), SWT.OPEN);
        fileDialog.setFilterExtensions(new String[] { "*.zip" });
        fileDialog.setText(getDialogTitle());
        final String fileName = fileDialog.open();
        if (fileName != null) {
            final IProgressService service = PlatformUI.getWorkbench().getProgressService();
            final ImportConnectorArchiveOperation importOp = newImportOperation();
            importOp.setFile(new File(fileName));
            service.run(true, false, importOp);
            final IStatus status = importOp.getStatus();
            switch (status.getSeverity()) {
                case IStatus.OK:
                    MessageDialog.openInformation(Display.getDefault().getActiveShell(), getImportSuccessTitle(), getImportSuccessMessage());
                    break;
                case IStatus.WARNING:
                    MessageDialog.openWarning(Display.getDefault().getActiveShell(), getImportSuccessTitle(), status.getMessage());
                    break;
                case IStatus.ERROR:
                    MessageDialog.openError(Display.getDefault().getActiveShell(), getFailedImportTitle(),
                            Messages.bind(getFailedImportMessage(), status.getMessage()));
                    break;
                default:
                    break;
            }
        }
        return null;
    } catch (final Exception ex) {
        throw new ExecutionException(ex.getMessage(), ex);
    }
}
 
Example 14
@Override
protected void okPressed() {
	if (deleteLangCode.size() == tgtlangList.size()) {
		MessageDialog.openError(getShell(), Messages.getString("ui.all.dialog.error"),
				Messages.getString("te.ui.deleteLangHandler.error.deleteAllTgtMsg"));
		return;
	}
	setReturnCode(OK);
	close();
}
 
Example 15
Source Project: olca-app   File: Dialog.java    License: Mozilla Public License 2.0 4 votes vote down vote up
public static void showError(Shell shell, String error) {
	MessageDialog.openError(shell, M.Error, error);
}
 
Example 16
protected void selectMultiValues( Combo combo )
{
	String[] retValue = null;

	try
	{
		List selectValueList = getSelectValueList( );
		if ( selectValueList == null || selectValueList.size( ) == 0 )
		{
			MessageDialog.openInformation( null,
					Messages.getString( "SelectValueDialog.selectValue" ), //$NON-NLS-1$
					Messages.getString( "SelectValueDialog.messages.info.selectVauleUnavailable" ) ); //$NON-NLS-1$
		}
		else
		{
			SelectValueDialog dialog = new SelectValueDialog( PlatformUI.getWorkbench( )
					.getDisplay( )
					.getActiveShell( ),
					Messages.getString( "ExpressionValueCellEditor.title" ) ); //$NON-NLS-1$
			dialog.setSelectedValueList( selectValueList );
			dialog.setMultipleSelection( true );

			if ( dialog.open( ) == IDialogConstants.OK_ID )
			{
				retValue = dialog.getSelectedExprValues( );
			}
		}
	}
	catch ( Exception ex )
	{
		MessageDialog.openError( null,
				Messages.getString( "SelectValueDialog.selectValue" ), //$NON-NLS-1$
				Messages.getString( "SelectValueDialog.messages.error.selectVauleUnavailable" ) //$NON-NLS-1$
						+ "\n" //$NON-NLS-1$
						+ ex.getMessage( ) );
	}

	if ( retValue != null )
	{
		addBtn.setEnabled( false );

		if ( retValue.length == 1 )
		{
			combo.setText( DEUtil.resolveNull( retValue[0] ) );
		}
		else if ( retValue.length > 1 )
		{
			combo.setText( "" ); //$NON-NLS-1$
		}

		boolean change = false;
		for ( int i = 0; i < retValue.length; i++ )
		{
			Expression expression = new Expression( retValue[i],
					ExpressionButtonUtil.getExpression( combo ).getType( ) );
			if ( valueList.indexOf( expression ) < 0 )
			{
				valueList.add( expression );
				change = true;
			}
		}
		if ( change )
		{
			tableViewer.refresh( );
			updateButtons( );
			combo.setFocus( );
		}
	}
}
 
Example 17
private void openErrorDialog(String errorDetail) {
	MessageDialog.openError(JavaPlugin.getActiveWorkbenchShell(), JarPackagerMessages.OpenJarPackageWizardDelegate_error_openJarPackager_title,
			JarPackagerMessages.OpenJarPackageWizardDelegate_error_openJarPackager_message + errorDetail);
}
 
Example 18
private void openWriteErrorDialog() {
	String title= PreferencesMessages.CodeTemplateBlock_error_write_title;
	String message= PreferencesMessages.CodeTemplateBlock_error_write_message;
	MessageDialog.openError(getShell(), title, message);
}
 
Example 19
public void autoQA(String rowId, StringBuffer resultSB, boolean isAddToDb){
	iFile = root.getFileForLocation(Path.fromOSString(RowIdUtil.getFileNameByRowId(rowId)));
	//先通过rowId获取品质检查所需要的数据
	Map<String, String> tuMap = handler.getAutoQAFilteredTUText(rowId, filterMap);
	if (tuMap.size() == 0){
		return;
	}
	tuMap.put("iFileFullPath", iFile.getFullPath().toOSString());
	String source_lan = tuMap.get("source_lan");
	String target_lan = tuMap.get("target_lan");
	String langPair = source_lan + "->" + target_lan;
	tuMap.put("langPair", langPair);
	String lineNumber = "" + (handler.getRowIndex(rowId) + 1);
	tuMap.put("lineNumber", lineNumber);
	tuMap.put("rowId", rowId);
	
	if ("".equals(tuMap.get("tarContent")) || tuMap.get("tarContent") == null ) {	//正常情况下应有四个值
		return;
	}
	
	resultSB.append(MessageFormat.format(
			Messages.getString("qa.AutomaticQATrigger.tip1"),
			new Object[] {
					lineNumber,
					isAddToDb ? Messages.getString("qa.AutomaticQATrigger.name1") : Messages
							.getString("qa.AutomaticQATrigger.name2") }));
	// 品质检查项的总数
	QARealization realization = null;
	boolean hasError = false;
	IProgressMonitor monitor = new NullProgressMonitor();
	for (int i = 0; i < model.getBatchQAItemIdList().size(); i++) {
		final String qaItemId = model.getBatchQAItemIdList().get(i);
		realization = getClassInstance(qaItemId, qaResult);
		// 若没有该项检查的实例,提示出错
		if (realization == null) {
			MessageDialog.openError(model.getShell(),
				Messages.getString("qa.AutomaticQATrigger.name3"),
				MessageFormat.format(Messages.getString("qa.AutomaticQATrigger.tip2"),
				new Object[] { model.getQaItemId_Name_Class().get(qaItemId).get(QAConstant.QA_ITEM_NAME) }));
		}
		
		// 开始进行该项文件的该项检查
		String result = realization.startQA(model, monitor, iFile, xmlHandler, tuMap);
		if (monitor.isCanceled()) {
			isCancel = true;
			return;
		}
		// 未配置术语库, 
		if (result == null) {
			model.getBatchQAItemIdList().remove(qaItemId);
			i --;
		}
		if (result != null && !"".equals(result)) {
			hasError = true;
			result = model.getQaItemId_Name_Class().get(result).get(QAConstant.QA_ITEM_NAME);
			resultSB.append("\t" + result).append(Messages.getString("qa.AutomaticQATrigger.tip3")).append("\n");
		}
	}
	// 这一步很重要,将数据传送至结果视图
	qaResult.sendDataToViewer(tuMap.get("rowId"));
	if (!hasError) {
		resultSB.delete(0, resultSB.length());
	}
	monitor.done();
	return;
}
 
Example 20
private boolean testFileType(String path) {
		int type = 0;

		type = testUncelan(path);
		if (type == -2) {
			return false;
		}
		if (type == -1) {
			type = testHsproof(path);
			if (type == -2) {
				return false;
			}
		}
		
		if (type == -1) {
			MessageDialog.openError(getShell(), Messages.getString("all.dialog.error"),
					MessageFormat.format(Messages.getString("ImportDocxDialog.label.external.error"), path));
			docxPathTxt.setText("");
			txtImportType.setText("");
			getButton(IDialogConstants.OK_ID).setEnabled(false);
			return false;
		} else {
			if (type == ExportExternal.EXPORT_HSPROOF) {
				txtImportType.setText(Messages.getString("ExportDocxDialog.lable.exporttype.hsproof"));
			} else if (type == ExportExternal.EXPORT_SDLXLIFF) {
				txtImportType.setText(Messages.getString("ExportDocxDialog.lable.exporttype.sdlxliff"));
			} else if (type == ExportExternal.EXPORT_SDLUNCLEAN) {
				txtImportType.setText(Messages.getString("ExportDocxDialog.lable.exporttype.unclean"));
			}
			config.setImportType(type);
			getButton(IDialogConstants.OK_ID).setEnabled(true);
			return true;
		}
	}