类org.eclipse.ui.statushandlers.StatusManager源码实例Demo

下面列出了怎么用org.eclipse.ui.statushandlers.StatusManager的API类实例代码及写法,或者点击链接到github查看源代码。

/**
 * Checks if another instance of MergeProcessor is running.
 * 
 * @return {@code true} if no other instance of MergeProcessor is running
 */
private boolean checkSingleInstance() {
	if (lockFileIfSingleInstance()) {
		// acquired lock for lock file
		CommandLineArgsUtil.parseCommandLineArgs();

		IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
		preferenceStore.addPropertyChangeListener(ApplicationWorkbenchAdvisor::handlePropertyChange);
		try {
			Logger.getLogger("").addHandler(new LogFileHandler());
		} catch (SecurityException | IOException e) {
			LogUtil.throwing(e);
		}
		Logger.getLogger("").setLevel(Configuration.getLogLevel());
		return true;
	} else {
		LOGGER.severe(Messages.ApplicationWorkbenchAdvisor_AnotherInstance_Message);
		StatusManager.getManager().handle(
				ValidationStatus.error(Messages.ApplicationWorkbenchAdvisor_AnotherInstance_Message),
				StatusManager.BLOCK | StatusManager.SHOW);
		getWorkbenchConfigurer().emergencyClose();
		return false;
	}
}
 
源代码2 项目: neoscada   文件: Helper.java
public static Collection<KeyProviderFactory> createFactories ()
{
    final Collection<KeyProviderFactory> result = new LinkedList<KeyProviderFactory> ();

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_KEY_PROVIDER_FACTORY ) )
    {
        if ( !ELE_FACTORY.equals ( ele.getName () ) )
        {
            continue;
        }

        try
        {
            result.add ( (KeyProviderFactory)ele.createExecutableExtension ( ATTR_CLASS ) );
        }
        catch ( final CoreException e )
        {
            StatusManager.getManager ().handle ( e, Activator.PLUGIN_ID );
        }
    }

    return result;
}
 
源代码3 项目: neoscada   文件: PreviewPage.java
@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 );
        }
    }
}
 
源代码4 项目: neoscada   文件: AbstractChartView.java
@Override
public void run ()
{
    try
    {
        final IViewPart viewPart = getViewSite ().getWorkbenchWindow ().getActivePage ().showView ( ChartConfiguratorView.VIEW_ID );
        if ( viewPart instanceof ChartConfiguratorView )
        {
            ( (ChartConfiguratorView)viewPart ).setChartConfiguration ( getConfiguration () );
        }
    }
    catch ( final PartInitException e )
    {
        StatusManager.getManager ().handle ( e.getStatus (), StatusManager.BLOCK );
    }
}
 
private StyleGenerator create ( final IConfigurationElement ele )
{
    if ( ele == null )
    {
        return null;
    }

    try
    {
        final Object o = ele.createExecutableExtension ( Messages.PreferenceSelectorStyleGenerator_2 );
        if ( o instanceof StyleGenerator )
        {
            return (StyleGenerator)o;
        }
        logger.warn ( "Class referenced in 'generatorClass' did not implement {}", StyleGenerator.class ); //$NON-NLS-1$
        return null;
    }
    catch ( final CoreException e )
    {
        StatusManager.getManager ().handle ( e, Activator.PLUGIN_ID );
        return null;
    }
}
 
源代码6 项目: neoscada   文件: DetailsPart.java
private void createButton ( final Composite parent )
{
    this.wrapper = new Composite ( parent, SWT.NONE );
    final GridLayout layout = new GridLayout ( 1, true );
    layout.marginHeight = layout.marginWidth = 0;
    this.wrapper.setLayout ( layout );

    this.startButton = new Button ( this.wrapper, SWT.PUSH );
    this.startButton.setLayoutData ( new GridData ( SWT.CENTER, SWT.CENTER, true, true ) );
    this.startButton.setText ( Messages.DetailsPart_startButton_label );
    this.startButton.addSelectionListener ( new SelectionAdapter () {
        @Override
        public void widgetSelected ( final SelectionEvent e )
        {
            try
            {
                start ();
            }
            catch ( final Exception ex )
            {
                logger.error ( "Failed to start chart", ex ); //$NON-NLS-1$
                StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, ex ), StatusManager.BLOCK );
            }
        }
    } );
}
 
源代码7 项目: neoscada   文件: EventHistorySearchDialog.java
protected List<FilterTab> getFilterTabs ()
{
    final List<FilterTab> result = new LinkedList<FilterTab> ();

    result.add ( new QueryByExampleTab () );
    result.add ( new FreeFormTab () );

    for ( final IConfigurationElement ele : Platform.getExtensionRegistry ().getConfigurationElementsFor ( EXTP_FILTER_TAB ) )
    {
        if ( !"filterTab".equals ( ele.getName () ) )
        {
            continue;
        }

        try
        {
            result.add ( (FilterTab)ele.createExecutableExtension ( "class" ) );
        }
        catch ( final CoreException e )
        {
            StatusManager.getManager ().handle ( e.getStatus () );
        }
    }

    return result;
}
 
源代码8 项目: neoscada   文件: FactoryImpl.java
public FactoryImpl ()
{
    this.prefs = Preferences.userNodeForPackage ( FactoryImpl.class ).node ( "files" );

    try
    {
        for ( final String child : this.prefs.childrenNames () )
        {
            final Preferences childNode = this.prefs.node ( child );
            final String fileName = childNode.get ( "file", null );
            if ( fileName != null )
            {
                this.files.add ( fileName );
            }
        }
    }
    catch ( final BackingStoreException e )
    {
        StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ) );
    }
}
 
源代码9 项目: neoscada   文件: FactoryImpl.java
@Override
public void init ( final Realm realm )
{
    this.realm = realm;
    this.list = new WritableList ();

    for ( final String name : this.names )
    {
        try
        {
            this.list.add ( new SunMSCAPIProvider ( this.realm, name ) );
        }
        catch ( final Exception e )
        {
            StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ) );
        }
    }
}
 
源代码10 项目: neoscada   文件: ExportEventsWizard.java
@Override
public boolean performFinish ()
{
    try
    {
        getContainer ().run ( true, true, new IRunnableWithProgress () {

            public void run ( final IProgressMonitor monitor ) throws InvocationTargetException, InterruptedException
            {
                doExport ( monitor );
            }
        } );
        return true;
    }
    catch ( final Exception e )
    {
        StatusManager.getManager ().handle ( new Status ( IStatus.ERROR, Activator.PLUGIN_ID, Messages.ExportWizard_ErrorMessage, e ) );
        return false;
    }
}
 
源代码11 项目: neoscada   文件: SymbolController.java
protected void executeTimeTrigger ( final ScriptExecutor script )
{
    logger.trace ( "Schedule time trigger: {}", this.nameHierarchy );
    try
    {
        Display.getDefault ().asyncExec ( new Runnable () {
            @Override
            public void run ()
            {
                handleTimeTrigger ( script );
            };
        } );
    }
    catch ( final Exception e )
    {
        StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ) );
    }
}
 
源代码12 项目: neoscada   文件: SymbolController.java
protected void handleTimeTrigger ( final ScriptExecutor script )
{
    logger.trace ( "Running time trigger: {}", this.nameHierarchy );
    try
    {
        if ( script != null )
        {
            script.execute ( this.scriptContext );
        }
    }
    catch ( final Exception e )
    {
        StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ), StatusManager.LOG );
        errorLog ( "Failed to run update", e );
    }
}
 
源代码13 项目: neoscada   文件: SymbolController.java
/**
 * Trigger the controller to update the data from the registration manager
 * <p>
 * This method can be called from any thread and must synchronized to the UI
 * </p>
 */
@Override
public void triggerDataUpdate ()
{
    try
    {
        Display.getDefault ().asyncExec ( new Runnable () {
            @Override
            public void run ()
            {
                handleDataUpdate ();
            };
        } );
    }
    catch ( final Exception e )
    {
        StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ) );
    }
}
 
源代码14 项目: neoscada   文件: SymbolController.java
private void runUpdate ( final boolean ignoreParents )
{
    logger.debug ( "Running update: {}", this.nameHierarchy );
    try
    {
        if ( this.onUpdate != null )
        {
            this.onUpdate.execute ( this.scriptContext );
        }
    }
    catch ( final Exception e )
    {
        StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ), StatusManager.LOG );
        errorLog ( "Failed to run update", e );
    }
    notifySummaryListeners ();

    // propagate update
    if ( !ignoreParents && this.parentController != null )
    {
        this.parentController.runUpdate ( false );
    }
}
 
源代码15 项目: neoscada   文件: SymbolController.java
public void execute ( final ScriptExecutor scriptExecutor, final Map<String, Object> scriptObjects ) throws Exception
{
    if ( scriptExecutor == null )
    {
        return;
    }

    try
    {
        scriptExecutor.execute ( this.scriptContext, scriptObjects );
    }
    catch ( final Exception e )
    {
        StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ), StatusManager.LOG );
        throw new InvocationTargetException ( e );
    }
}
 
源代码16 项目: elexis-3-core   文件: OpenStickerPreferencePage.java
@Override
public Object execute(ExecutionEvent event) throws ExecutionException{
	ICommandService commandService =
		(ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
	
	Command cmd = commandService.getCommand("org.eclipse.ui.window.preferences");
	try {
		HashMap<String, String> hm = new HashMap<String, String>();
		hm.put("preferencePageId", "ch.elexis.prefs.sticker");
		ExecutionEvent ev = new ExecutionEvent(cmd, hm, null, null);
		cmd.executeWithChecks(ev);
	} catch (Exception exception) {
		Status status =
			new Status(IStatus.WARNING, Activator.PLUGIN_ID,
				"Error opening sticker preference page");
		StatusManager.getManager().handle(status, StatusManager.SHOW);
	}
	return null;
}
 
源代码17 项目: neoscada   文件: FigureController.java
private void fireScriptEvent ( final ScriptExecutor script, final Object event, final String eventName )
{
    this.controller.debugLog ( String.format ( "%s: %s", eventName, event ) ); //$NON-NLS-1$

    final Map<String, Object> scriptObjects = new LinkedHashMap<String, Object> ( 1 );
    scriptObjects.put ( "event", event ); //$NON-NLS-1$
    try
    {
        this.controller.execute ( script, scriptObjects );
    }
    catch ( final Exception e )
    {
        this.controller.errorLog ( "Failed to handle event: " + eventName, e ); //$NON-NLS-1$
        if ( !Boolean.getBoolean ( "org.eclipse.scada.vi.ui.draw2d.suppressErrors" ) ) //$NON-NLS-1$
        {
            StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, "Failed to handle event", e ), StatusManager.SHOW );
        }
    }
}
 
源代码18 项目: neoscada   文件: ShowDetailDialog.java
@SuppressWarnings ( "unchecked" )
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    final String detailViewId = event.getParameter ( "org.eclipse.scada.vi.details.showDetailDialog.id" );
    final Map<String, String> parameters = (Map<String, String>)event.getObjectParameterForExecution ( "org.eclipse.scada.vi.details.showDetailDialog.parameters" );

    try
    {
        if ( this.useWaitShell )
        {
            openWithWaitShell ( getShell (), detailViewId, parameters );
        }
        else
        {
            open ( getShell (), detailViewId, parameters );
        }
    }
    catch ( final Exception e )
    {
        StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, "Failed to open detail view", e ), StatusManager.SHOW );
    }

    return null;
}
 
源代码19 项目: neoscada   文件: ProjectBuilder.java
protected void validateAll ( final IProject project, final ComposedAdapterFactory adapterFactory, final Set<String> extensions, final IProgressMonitor monitor )
{
    logger.debug ( "Validating all resources of {}", project );

    try
    {
        project.accept ( new IResourceVisitor () {

            @Override
            public boolean visit ( final IResource resource ) throws CoreException
            {
                return handleResource ( null, resource, adapterFactory, extensions, monitor );
            }
        } );
    }
    catch ( final CoreException e )
    {
        StatusManager.getManager ().handle ( e.getStatus () );
    }
}
 
源代码20 项目: neoscada   文件: AbstractServerHandler.java
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    final MultiStatus ms = new MultiStatus ( HivesPlugin.PLUGIN_ID, 0, getLabel (), null );

    for ( final ServerLifecycle server : SelectionHelper.iterable ( getSelection (), ServerLifecycle.class ) )
    {
        try
        {
            process ( server );
        }
        catch ( final CoreException e )
        {
            ms.add ( e.getStatus () );
        }
    }
    if ( !ms.isOK () )
    {
        StatusManager.getManager ().handle ( ms, StatusManager.SHOW );
    }
    return null;
}
 
源代码21 项目: neoscada   文件: ServerDescriptorImpl.java
public void dispose ()
{
    try
    {
        stop ();
    }
    catch ( final CoreException e )
    {
        StatusManager.getManager ().handle ( e.getStatus () );
    }

    for ( final ServerEndpointImpl endpoint : this.endpointImpls )
    {
        endpoint.dispose ();
    }
    this.endpointImpls.clear ();

    if ( !this.endpoints.isDisposed () )
    {
        this.endpoints.clear ();
        this.endpoints.dispose ();
    }
}
 
源代码22 项目: neoscada   文件: StartExporter.java
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    for ( final IFile file : SelectionHelper.iterable ( getSelection (), IFile.class ) )
    {
        try
        {
            HivesPlugin.getDefault ().getServerHost ().startServer ( file );
            getActivePage ().showView ( "org.eclipse.scada.da.server.ui.ServersView" ); //$NON-NLS-1$
        }
        catch ( final Exception e )
        {
            logger.warn ( "Failed to start file: " + file, e ); //$NON-NLS-1$
            StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ), StatusManager.BLOCK );
        }
    }
    return null;
}
 
源代码23 项目: neoscada   文件: ShowComponentSpy.java
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    final Component component = SelectionHelper.first ( getSelection (), Component.class );
    if ( component == null )
    {
        return null;
    }

    try
    {
        final IObservableSet input = Helper.createObversableInput ( DisplayRealm.getRealm ( getShell ().getDisplay () ), component );
        new ComponentOutputDialog ( getShell (), input ).open ();
    }
    catch ( final Exception e )
    {
        StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, "Failed to generate component output", e ), StatusManager.BLOCK );
        throw new ExecutionException ( "Failed to generate component output", e );
    }

    return null;
}
 
源代码24 项目: Pydev   文件: GlobalsTwoPanelElementSelector2.java
@Override
protected void storeDialog(IDialogSettings settings) {
    super.storeDialog(settings);

    XMLMemento memento = XMLMemento.createWriteRoot("workingSet"); //$NON-NLS-1$
    workingSetFilterActionGroup.saveState(memento);
    workingSetFilterActionGroup.dispose();
    StringWriter writer = new StringWriter();
    try {
        memento.save(writer);
        settings.put(WORKINGS_SET_SETTINGS, writer.getBuffer().toString());
    } catch (IOException e) {
        StatusManager.getManager().handle(
                new Status(IStatus.ERROR, AnalysisPlugin.getPluginID(), IStatus.ERROR, "", e)); //$NON-NLS-1$
        // don't do anything. Simply don't store the settings
    }
}
 
源代码25 项目: tlaplus   文件: FilteredItemsSelectionDialog.java
/**
 * Stores dialog settings.
 *
 * @param settings
 *            settings used to store dialog
 */
protected void storeDialog(IDialogSettings settings) {
	settings.put(SHOW_STATUS_LINE, toggleStatusLineAction.isChecked());

	XMLMemento memento = XMLMemento.createWriteRoot(HISTORY_SETTINGS);
	this.contentProvider.saveHistory(memento);
	StringWriter writer = new StringWriter();
	try {
		memento.save(writer);
		settings.put(HISTORY_SETTINGS, writer.getBuffer().toString());
	} catch (IOException e) {
		// Simply don't store the settings
		StatusManager
				.getManager()
				.handle(
						new Status(
								IStatus.ERROR,
								PlatformUI.PLUGIN_ID,
								IStatus.ERROR,
								WorkbenchMessages.FilteredItemsSelectionDialog_storeError,
								e));
	}
}
 
源代码26 项目: translationstudio8   文件: KeyController2.java
private static BindingManager loadModelBackend(IServiceLocator locator) {
	IBindingService bindingService = (IBindingService) locator.getService(IBindingService.class);
	BindingManager bindingManager = new BindingManager(new ContextManager(), new CommandManager());
	final Scheme[] definedSchemes = bindingService.getDefinedSchemes();
	try {
		Scheme modelActiveScheme = null;
		for (int i = 0; i < definedSchemes.length; i++) {
			final Scheme scheme = definedSchemes[i];
			final Scheme copy = bindingManager.getScheme(scheme.getId());
			copy.define(scheme.getName(), scheme.getDescription(), scheme.getParentId());
			if (definedSchemes[i] == bindingService.getActiveScheme()) {
				modelActiveScheme = copy;
			}
		}
		bindingManager.setActiveScheme(modelActiveScheme);
	} catch (final NotDefinedException e) {
		StatusManager.getManager()
				.handle(new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
						"Keys page found an undefined scheme", e)); //$NON-NLS-1$
	}
	bindingManager.setLocale(bindingService.getLocale());
	bindingManager.setPlatform(bindingService.getPlatform());
	bindingManager.setBindings(bindingService.getBindings());
	return bindingManager;
}
 
源代码27 项目: elexis-3-core   文件: ExternalContributions.java
private static void instantiate(){
	IConfigurationElement[] config =
		Platform.getExtensionRegistry().getConfigurationElementsFor(
			Activator.PLUGIN_ID + ".ExternalMaintenance");
	if (config.length == 0)
		return;
	for (IConfigurationElement e : config) {
		try {
			Object o = e.createExecutableExtension("MaintenanceCode");
			if (o instanceof ExternalMaintenance) {
				ext.add((ExternalMaintenance) o);
			}
		} catch (CoreException e1) {
			Status status =
				new Status(IStatus.WARNING, Activator.PLUGIN_ID, e1.getLocalizedMessage());
			StatusManager.getManager().handle(status, StatusManager.SHOW);
		}
		
	}
	
}
 
源代码28 项目: tmxeditor8   文件: KeyController2.java
private static BindingManager loadModelBackend(IServiceLocator locator) {
	IBindingService bindingService = (IBindingService) locator.getService(IBindingService.class);
	BindingManager bindingManager = new BindingManager(new ContextManager(), new CommandManager());
	final Scheme[] definedSchemes = bindingService.getDefinedSchemes();
	try {
		Scheme modelActiveScheme = null;
		for (int i = 0; i < definedSchemes.length; i++) {
			final Scheme scheme = definedSchemes[i];
			final Scheme copy = bindingManager.getScheme(scheme.getId());
			copy.define(scheme.getName(), scheme.getDescription(), scheme.getParentId());
			if (definedSchemes[i] == bindingService.getActiveScheme()) {
				modelActiveScheme = copy;
			}
		}
		bindingManager.setActiveScheme(modelActiveScheme);
	} catch (final NotDefinedException e) {
		StatusManager.getManager()
				.handle(new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
						"Keys page found an undefined scheme", e)); //$NON-NLS-1$
	}
	bindingManager.setLocale(bindingService.getLocale());
	bindingManager.setPlatform(bindingService.getPlatform());
	bindingManager.setBindings(bindingService.getBindings());
	return bindingManager;
}
 
源代码29 项目: tmxeditor8   文件: KeyController2.java
private static BindingManager loadModelBackend(IServiceLocator locator) {
	IBindingService bindingService = (IBindingService) locator.getService(IBindingService.class);
	BindingManager bindingManager = new BindingManager(new ContextManager(), new CommandManager());
	final Scheme[] definedSchemes = bindingService.getDefinedSchemes();
	try {
		Scheme modelActiveScheme = null;
		for (int i = 0; i < definedSchemes.length; i++) {
			final Scheme scheme = definedSchemes[i];
			final Scheme copy = bindingManager.getScheme(scheme.getId());
			copy.define(scheme.getName(), scheme.getDescription(), scheme.getParentId());
			if (definedSchemes[i] == bindingService.getActiveScheme()) {
				modelActiveScheme = copy;
			}
		}
		bindingManager.setActiveScheme(modelActiveScheme);
	} catch (final NotDefinedException e) {
		StatusManager.getManager()
				.handle(new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH,
						"Keys page found an undefined scheme", e)); //$NON-NLS-1$
	}
	bindingManager.setLocale(bindingService.getLocale());
	bindingManager.setPlatform(bindingService.getPlatform());
	bindingManager.setBindings(bindingService.getBindings());
	return bindingManager;
}
 
源代码30 项目: tmxeditor8   文件: UpdatePolicy.java
@Override
public boolean continueWorkingWithOperation(ProfileChangeOperation operation, Shell shell) {

	Assert.isTrue(operation.getResolutionResult() != null);
	IStatus status = operation.getResolutionResult();
	// user cancelled
	if (status.getSeverity() == IStatus.CANCEL)
		return false;

	// Special case those statuses where we would never want to open a wizard
	if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
		MessageDialog.openInformation(shell, P2UpdateUtil.CHECK_UPDATE_JOB_NAME, P2UpdateUtil.UPDATE_PROMPT_INFO_NO_UPDATE);
		return false;
	}

	// there is no plan, so we can't continue. Report any reason found
	if (operation.getProvisioningPlan() == null && !status.isOK()) {
		StatusManager.getManager().handle(status, StatusManager.LOG | StatusManager.SHOW);
		return false;
	}

	// Allow the wizard to open otherwise.
	return true;
}
 
 类所在包
 类方法
 同包方法