/** * Starts a job which reads the contents of the directory in the background. * * @param rootNode * @return the created and already scheduled job */ @Nonnull public Job createAndScheduleImportInitialConfiguration( @Nonnull final IAlarmSubtreeNode rootNode) { LOG.debug("Start import initial configuration."); // $NON-NLS-1$ final IWorkbenchSiteProgressService progressService = (IWorkbenchSiteProgressService) getSite().getAdapter(IWorkbenchSiteProgressService.class); final Job importInitialConfigJob = JobFactory.createImportInitialConfigJob(this, rootNode); // This means updates will be queued for later application. _alarmListener.startUpdateProcessing(); // The directory is read in the background. Until then, set the viewer's // input to a placeholder object. _viewer.setInput(new Object[] {new PendingUpdateAdapter()}); // Start the directory reader job. progressService.schedule(importInitialConfigJob, 0, true); return importInitialConfigJob; }
/** Starts the connection. */ private void createAndScheduleConnectionJob() { LOG.debug("Starting connection."); // $NON-NLS-1$ final IWorkbenchSiteProgressService progressService = (IWorkbenchSiteProgressService) getSite().getAdapter(IWorkbenchSiteProgressService.class); final ConnectionJob connectionJob = JobFactory.createConnectionJob(this); // Gain access to the connection connectionJob.addJobChangeListener( new JobChangeAdapter() { @SuppressWarnings("synthetic-access") @Override public void done(@Nullable final IJobChangeEvent event) { _connection = connectionJob.getConnection(); } }); progressService.schedule(connectionJob, 0, true); }
/** * Creates the actions offered by this view. * * @param iWorkbenchPartSite * @param alarmListener * @param viewer * @param currentAlarmFilter * <p>CHECKSTYLE OFF: MethodLength (this method properly encapsulates all view actions) */ private void createActions( @Nonnull final IAlarmSubtreeNode rootNode, @Nonnull final TreeViewer viewer, @Nonnull final AlarmMessageListener alarmListener, @Nonnull final IWorkbenchPartSite site, @Nonnull final ViewerFilter currentAlarmFilter, @Nonnull final Queue<ITreeModificationItem> modificationItems) { _reloadAction = AlarmTreeViewActionFactory.createReloadAction( JobFactory.createImportInitialConfigJob(this, rootNode), site, alarmListener, viewer, modificationItems); _remoteReloadAction = AlarmTreeViewActionFactory.createRemoteReloadAction(_myMessageArea); _saveInLdapAction = AlarmTreeViewActionFactory.createSaveInLdapAction( rootNode, site, viewer, modificationItems); _importXmlFileAction = AlarmTreeViewActionFactory.createImportXmlFileAction( JobFactory.createImportXmlFileJob(this, rootNode), site, alarmListener, viewer); _exportXmlFileAction = AlarmTreeViewActionFactory.createExportXmlFileAction(site, rootNode); _acknowledgeAction = AlarmTreeViewActionFactory.createAcknowledgeAction(viewer); _runCssAlarmDisplayAction = AlarmTreeViewActionFactory.createCssAlarmDisplayAction(viewer); _runCssDisplayAction = AlarmTreeViewActionFactory.createRunCssDisplayAction(viewer); _openCssStripChartAction = AlarmTreeViewActionFactory.createCssStripChartAction(site, viewer); _showHelpGuidanceAction = AlarmTreeViewActionFactory.createShowHelpGuidanceAction(site, viewer); _showHelpPageAction = AlarmTreeViewActionFactory.createShowHelpPageAction(viewer); _createRecordAction = AlarmTreeViewActionFactory.createCreateRecordAction(site, viewer, this, modificationItems); _createComponentAction = AlarmTreeViewActionFactory.createCreateComponentAction(site, viewer, modificationItems); _renameAction = AlarmTreeViewActionFactory.createRenameAction(site, viewer, modificationItems); _deleteNodeAction = AlarmTreeViewActionFactory.createDeleteNodeAction(site, viewer, modificationItems); _showPropertyViewAction = AlarmTreeViewActionFactory.createShowPropertyViewAction(site); _showMessageAreaAction = AlarmTreeViewActionFactory.createShowMessageAreaAction(_myMessageArea); _toggleFilterAction = AlarmTreeViewActionFactory.createToggleFilterAction(this, viewer, currentAlarmFilter); _saveAsXmlFileAction = AlarmTreeViewActionFactory.createSaveAsXmlFileAction(site, viewer); _retrieveInitialStateAction = AlarmTreeViewActionFactory.createRetrieveInitialStateAction( site, JobFactory.createRetrieveInitialStateJob(this, rootNode), viewer); }