当前位置: 首页>>代码示例>>Java>>正文


Java ErrorDialog类代码示例

本文整理汇总了Java中org.eclipse.jface.dialogs.ErrorDialog的典型用法代码示例。如果您正苦于以下问题:Java ErrorDialog类的具体用法?Java ErrorDialog怎么用?Java ErrorDialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ErrorDialog类属于org.eclipse.jface.dialogs包,在下文中一共展示了ErrorDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: showErrorDialogWithStackTrace

import org.eclipse.jface.dialogs.ErrorDialog; //导入依赖的package包/类
/**
 * Shows JFace ErrorDialog but improved by constructing full stack trace in detail area.
 *
 * @return true if OK was pressed
 */
public static boolean showErrorDialogWithStackTrace(String msg, Throwable throwable) {

	// Temporary holder of child statuses
	List<Status> childStatuses = new ArrayList<>();

	for (StackTraceElement stackTraceElement : throwable.getStackTrace()) {
		childStatuses.add(new Status(IStatus.ERROR, "N4js-plugin-id", stackTraceElement.toString()));
	}

	MultiStatus ms = new MultiStatus("N4js-plugin-id", IStatus.ERROR,
			childStatuses.toArray(new Status[] {}), // convert to array of statuses
			throwable.getLocalizedMessage(), throwable);

	final AtomicBoolean result = new AtomicBoolean(true);
	Display.getDefault()
			.syncExec(
					() -> result.set(
							ErrorDialog.openError(null, "Error occurred while organizing ", msg, ms) == Window.OK));

	return result.get();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:27,代码来源:ErrorDialogWithStackTraceUtil.java

示例2: notifyError

import org.eclipse.jface.dialogs.ErrorDialog; //导入依赖的package包/类
/**
 * Notify error using message box (thread safe).
 * @param message The message to display
 * @param error The error that occurred
 */
public void notifyError ( final String message, final Throwable error )
{
    final Display display = getWorkbench ().getDisplay ();

    if ( !display.isDisposed () )
    {
        display.asyncExec ( new Runnable () {

            @Override
            public void run ()
            {
                final Shell shell = getWorkbench ().getActiveWorkbenchWindow ().getShell ();
                logger.debug ( "Shell disposed: {}", shell.isDisposed () );
                if ( !shell.isDisposed () )
                {
                    final IStatus status = new OperationStatus ( IStatus.ERROR, PLUGIN_ID, 0, message + ":" + error.getMessage (), error );
                    ErrorDialog.openError ( shell, null, message, status );
                }
            }
        } );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:28,代码来源:Activator.java

示例3: setVisible

import org.eclipse.jface.dialogs.ErrorDialog; //导入依赖的package包/类
@Override
public void setVisible ( final boolean visible )
{
    super.setVisible ( visible );
    if ( visible )
    {
        try
        {
            getContainer ().run ( false, false, new IRunnableWithProgress () {

                @Override
                public void run ( final IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException
                {
                    setMergeResult ( PreviewPage.this.mergeController.merge ( wrap ( monitor ) ) );
                }
            } );
        }
        catch ( final Exception e )
        {
            final Status status = new Status ( IStatus.ERROR, Activator.PLUGIN_ID, Messages.PreviewPage_StatusErrorFailedToMerge, e );
            StatusManager.getManager ().handle ( status );
            ErrorDialog.openError ( getShell (), Messages.PreviewPage_TitleErrorFailedToMerge, Messages.PreviewPage_MessageErrorFailedToMerge, status );
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:26,代码来源:PreviewPage.java

示例4: showError

import org.eclipse.jface.dialogs.ErrorDialog; //导入依赖的package包/类
private void showError ( final IStatus status )
{
    if ( !status.matches ( IStatus.ERROR ) )
    {
        return;
    }

    final Display display = PlatformUI.getWorkbench ().getDisplay ();
    if ( !display.isDisposed () )
    {
        display.asyncExec ( new Runnable () {

            @Override
            public void run ()
            {
                if ( !display.isDisposed () )
                {
                    ErrorDialog.openError ( PlatformUI.getWorkbench ().getActiveWorkbenchWindow ().getShell (), "Connection error", "Connection failed", status, IStatus.ERROR );
                }
            }
        } );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:24,代码来源:ConnectionManager.java

示例5: handleRemove

import org.eclipse.jface.dialogs.ErrorDialog; //导入依赖的package包/类
protected void handleRemove ()
{
    final MultiStatus ms = new MultiStatus ( Activator.PLUGIN_ID, 0, "Removing key providers", null );

    for ( final KeyProvider provider : this.selectedProviders )
    {
        try
        {
            this.factory.remove ( provider );
        }
        catch ( final Exception e )
        {
            ms.add ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ) );
        }
    }
    if ( !ms.isOK () )
    {
        ErrorDialog.openError ( getShell (), "Error", null, ms );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:21,代码来源:PreferencePage.java

示例6: handleAdd

import org.eclipse.jface.dialogs.ErrorDialog; //导入依赖的package包/类
protected void handleAdd ()
{
    final FileDialog dlg = new FileDialog ( getShell (), SWT.OPEN );
    final String result = dlg.open ();
    if ( result != null )
    {
        try
        {
            this.factory.addFile ( result );
        }
        catch ( final Exception e )
        {
            ErrorDialog.openError ( getShell (), "Error", "Failed to add file", StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ) );
        }
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:PreferencePage.java

示例7: createPlot

import org.eclipse.jface.dialogs.ErrorDialog; //导入依赖的package包/类
private void createPlot(AxisConfiguration conf) {

		if (conf==null) return;
		IDataset image = null;
		if (conf.getMicroscopeImage()!=null && !"".equals(conf.getMicroscopeImage())) {
			try {
			    image = ServiceHolder.getLoaderService().getDataset(conf.getMicroscopeImage(), null);
			} catch (Exception ne) {
				final File file = new File(conf.getMicroscopeImage());
				ErrorDialog.openError(site.getShell(), "Problem Reading '"+file.getName()+"'",
						"There was a problem reading '"+file.getName()+"'\n\n"
								+ "Please contact our support representative.", new Status(IStatus.ERROR, Activator.PLUGIN_ID, ne.getMessage(), ne));
				logger.error("Cannot read file!", ne);
			}
		}
		if (image==null && conf.isRandomNoise()) {
			image = Random.rand(4096, 3012);
		}
		if (image==null) {
			system.getSelectedXAxis().setRange(conf.getFastAxisStart(), conf.getFastAxisEnd());
			system.getSelectedYAxis().setRange(conf.getSlowAxisStart(), conf.getSlowAxisEnd());
			return;
		}
		createTrace(conf, image);
	}
 
开发者ID:eclipse,项目名称:scanning,代码行数:26,代码来源:PlottingController.java

示例8: save

import org.eclipse.jface.dialogs.ErrorDialog; //导入依赖的package包/类
/**
 * Stash using appropriate messages to the user.
 * @param models
 * @param shell
 */
@Override
public void save(Object object) {
	try {

		if (file.exists()) {
			boolean ok = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Confirm Overwrite", "Are you sure that you would like to overwrite '"+file.getName()+"'?");
			if (!ok) return;
		}

		stash(object);

	} catch (Exception e) {
		ErrorDialog.openError(Display.getCurrent().getActiveShell(), "Error Saving Information", "An exception occurred while writing the "+getStashName()+" to file.",
				              new Status(IStatus.ERROR, "org.eclipse.scanning.device.ui", e.getMessage()));
	    logger.error("Error Saving Information", e);
	}
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:23,代码来源:Stashing.java

示例9: openQueueMonitor

import org.eclipse.jface.dialogs.ErrorDialog; //导入依赖的package包/类
public static void openQueueMonitor(Class<? extends StatusBean> beanClass,
		                           final String queueName,
		                           final String topicName,
		                           final String submissionQueueName,
		                           String partName) throws PartInitException, UnsupportedEncodingException {

	String bundle = FrameworkUtil.getBundle(beanClass).getSymbolicName();
	String bean   = beanClass.getName();
	String sqn    = queueName;
	String stn    = topicName;
	String submit = submissionQueueName;

	String queueViewId = QueueViews.createSecondaryId(CommandConstants.getScanningBrokerUri(), bundle,bean, sqn, stn, submit);
	if (partName!=null) queueViewId = queueViewId+"partName="+partName;
	try {
		PageUtil.getPage().showView(QueueViews.getQueueViewID(), queueViewId, IWorkbenchPage.VIEW_ACTIVATE);
	} catch (PartInitException e) {
		ErrorDialog.openError(Display.getDefault().getActiveShell(), "Cannot open view", "Cannot open view "+queueViewId,
				new Status(Status.ERROR, "org.eclipse.scanning.event.ui", e.getMessage()));
		throw e;
	}
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:23,代码来源:ViewUtil.java

示例10: openQueueMonitor

import org.eclipse.jface.dialogs.ErrorDialog; //导入依赖的package包/类
private void openQueueMonitor() throws UnsupportedEncodingException {

		final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
		String bundle = store.getString(BUNDLE);
		String bean   = store.getString(BEAN);
		String sqn    = store.getString(STATUS_QUEUE);
		String stn    = store.getString(STATUS_TOPIC);
		String submit = store.getString(SUBMIT_QUEUE);
		String part   = store.getString(PART_NAME);

		String queueViewId = QueueViews.createSecondaryId(bundle,bean, sqn, stn, submit);
		queueViewId = queueViewId+"partName="+part;
		try {
			Util.getPage().showView(StatusQueueView.ID, queueViewId, IWorkbenchPage.VIEW_VISIBLE);
		} catch (PartInitException e) {
			ErrorDialog.openError(Display.getDefault().getActiveShell(), "Cannot open view", "Cannot open view "+queueViewId,
					new Status(Status.ERROR, "org.eclipse.scanning.event.ui", e.getMessage()));
			logger.error("Cannot open view", e);
		}
	}
 
开发者ID:eclipse,项目名称:scanning,代码行数:21,代码来源:StatusQueueLaunchView.java

示例11: togglePausedConsumer

import org.eclipse.jface.dialogs.ErrorDialog; //导入依赖的package包/类
protected void togglePausedConsumer(IAction pauseConsumer) {

		// The button can get out of sync if two clients are used.
		final boolean currentState = queueConnection.isQueuePaused(getSubmissionQueueName());
		try {
			pauseConsumer.setChecked(!currentState); // We are toggling it.

			IPublisher<PauseBean> pauser = service.createPublisher(getUri(), IEventService.CMD_TOPIC);
			pauser.setStatusSetName(IEventService.CMD_SET); // The set that other clients may check
			pauser.setStatusSetAddRequired(true);

			PauseBean pbean = new PauseBean();
			pbean.setQueueName(getSubmissionQueueName()); // The queue we are pausing
			pbean.setPause(pauseConsumer.isChecked());
			pauser.broadcast(pbean);

		} catch (Exception e) {
			ErrorDialog.openError(getViewSite().getShell(), "Cannot pause queue "+getSubmissionQueueName(), "Cannot pause queue "+getSubmissionQueueName()+"\n\nPlease contact your support representative.",
					new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage()));
		}
		pauseConsumer.setChecked(queueConnection.isQueuePaused(getSubmissionQueueName()));
	}
 
开发者ID:eclipse,项目名称:scanning,代码行数:23,代码来源:StatusQueueView.java

示例12: getResultsHandlers

import org.eclipse.jface.dialogs.ErrorDialog; //导入依赖的package包/类
private List<IResultHandler> getResultsHandlers() {
	if (resultsHandlers == null) {
		final IConfigurationElement[] configElements = Platform.getExtensionRegistry()
				.getConfigurationElementsFor(RESULTS_HANDLER_EXTENSION_POINT_ID);
		final List<IResultHandler> handlers = new ArrayList<>(configElements.length + 1);
		for (IConfigurationElement configElement : configElements) {
			try {
				final IResultHandler handler = (IResultHandler) configElement.createExecutableExtension("class");
				handler.init(service, createConsumerConfiguration());
				handlers.add(handler);
			} catch (Exception e) {
				ErrorDialog.openError(getSite().getShell(), "Internal Error",
						"Could not create results handler for class " + configElement.getAttribute("class") +
						".\n\nPlease contact your support representative.",
						new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage()));
			}
		}
		handlers.add(new DefaultResultsHandler());
		resultsHandlers = handlers;
	}
	return resultsHandlers;
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:23,代码来源:StatusQueueView.java

示例13: openResults

import org.eclipse.jface.dialogs.ErrorDialog; //导入依赖的package包/类
/**
 * You can override this method to provide custom opening of
 * results if required.
 *
 * @param bean
 */
protected void openResults(StatusBean bean) {

	if (bean == null) return;

	for (IResultHandler handler : getResultsHandlers()) {
		if (handler.isHandled(bean)) {
			try {
				boolean ok = handler.open(bean);
				if (ok) return;
			} catch (Exception e) {
				ErrorDialog.openError(getSite().getShell(), "Internal Error", handler.getErrorMessage(null),
						new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage()));
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:23,代码来源:StatusQueueView.java

示例14: rerun

import org.eclipse.jface.dialogs.ErrorDialog; //导入依赖的package包/类
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()));
		}
	}
 
开发者ID:eclipse,项目名称:scanning,代码行数:27,代码来源:StatusQueueView.java

示例15: mouseUp

import org.eclipse.jface.dialogs.ErrorDialog; //导入依赖的package包/类
@Override
public void mouseUp(MouseEvent e) {
	if (e.getSource() instanceof Button) {
		Button sel = (Button) e.getSource();
		if (sel.getText().equalsIgnoreCase("Save")) {
			try {
				String tempText = util.processAdd(isEdit, editName, comp, type, editor.getDocumentProvider().getDocument(getEditorInput()).get());
				editor.getDocumentProvider().getDocument(getEditorInput()).set(tempText);
				createPage1();
				setActivePage(1);
			} catch (JAXBException ex) {
				ErrorDialog.openError(getSite().getShell(), "Error removing item", null, new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, "Error removing item", null));
			}
		}
	}
}
 
开发者ID:dstl,项目名称:Open_Source_ECOA_Toolset_AS5,代码行数:17,代码来源:TypesEditor.java


注:本文中的org.eclipse.jface.dialogs.ErrorDialog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。