org.eclipse.ui.statushandlers.StatusManager Java Examples
The following examples show how to use
org.eclipse.ui.statushandlers.StatusManager.
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
Source File: SymbolController.java From neoscada with Eclipse Public License 1.0 | 6 votes |
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 ); } }
Example #2
Source File: EventHistorySearchDialog.java From neoscada with Eclipse Public License 1.0 | 6 votes |
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; }
Example #3
Source File: FactoryImpl.java From neoscada with Eclipse Public License 1.0 | 6 votes |
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 ) ); } }
Example #4
Source File: DetailsPart.java From neoscada with Eclipse Public License 1.0 | 6 votes |
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 ); } } } ); }
Example #5
Source File: PreferenceSelectorStyleGenerator.java From neoscada with Eclipse Public License 1.0 | 6 votes |
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; } }
Example #6
Source File: Helper.java From neoscada with Eclipse Public License 1.0 | 6 votes |
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; }
Example #7
Source File: PreviewPage.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@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 ); } } }
Example #8
Source File: AbstractChartView.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@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 ); } }
Example #9
Source File: ApplicationWorkbenchAdvisor.java From MergeProcessor with Apache License 2.0 | 6 votes |
/** * 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; } }
Example #10
Source File: FactoryImpl.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@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 ) ); } } }
Example #11
Source File: ExportEventsWizard.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@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; } }
Example #12
Source File: SymbolController.java From neoscada with Eclipse Public License 1.0 | 6 votes |
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 ) ); } }
Example #13
Source File: SymbolController.java From neoscada with Eclipse Public License 1.0 | 6 votes |
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 ); } }
Example #14
Source File: SymbolController.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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 ) ); } }
Example #15
Source File: SymbolController.java From neoscada with Eclipse Public License 1.0 | 6 votes |
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 ); } }
Example #16
Source File: ProjectBuilder.java From neoscada with Eclipse Public License 1.0 | 6 votes |
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 () ); } }
Example #17
Source File: OpenStickerPreferencePage.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
@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; }
Example #18
Source File: FigureController.java From neoscada with Eclipse Public License 1.0 | 6 votes |
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 ); } } }
Example #19
Source File: ShowDetailDialog.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@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; }
Example #20
Source File: AbstractServerHandler.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@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; }
Example #21
Source File: ServerDescriptorImpl.java From neoscada with Eclipse Public License 1.0 | 6 votes |
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 (); } }
Example #22
Source File: StartExporter.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@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; }
Example #23
Source File: ShowComponentSpy.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@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; }
Example #24
Source File: GlobalsTwoPanelElementSelector2.java From Pydev with Eclipse Public License 1.0 | 6 votes |
@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 } }
Example #25
Source File: FilteredItemsSelectionDialog.java From tlaplus with MIT License | 6 votes |
/** * 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)); } }
Example #26
Source File: KeyController2.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
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; }
Example #27
Source File: ExternalContributions.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
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); } } }
Example #28
Source File: KeyController2.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
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; }
Example #29
Source File: KeyController2.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
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; }
Example #30
Source File: UpdatePolicy.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
@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; }