@SuppressWarnings ( "unchecked" ) public void performSave ( final IProgressMonitor monitor ) { // provide a copy so that it can be accessed outside the realm final UpdateJob updateJob = update ( new HashMap<String, String> ( this.dataMap ), null ); updateJob.setProgressGroup ( monitor, 2 ); updateJob.addJobChangeListener ( new JobChangeAdapter () { @Override public void done ( final IJobChangeEvent event ) { performLoad ( monitor ); } } ); updateJob.schedule (); }
/** * @param name */ public ReattachProjectBundleSourcesJob() { super("Collecting plugin projects"); addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { if (event.getResult().isOK() && pluginContainerEntries != null && pluginContainerEntries.length > 0) { // System.err.println("Reattaching bundle sources for " + // pluginContainerEntries.length + " plugin containers entries"); AbstractSourceDownloadJob sourceAttacherJob = new AbstractSourceDownloadJob( "Attaching project bundle sources", new CachedSourceLocator()) { }; sourceAttacherJob.queue(pluginContainerEntries); sourceAttacherJob.schedule(); } } }); }
@Override public void done(final IJobChangeEvent event) { final IStatus result = event.getResult(); ProjectManagerRepositoryJob testJob; final ProjectManagerRepositoryJob job = (ProjectManagerRepositoryJob) event.getJob(); final WorkspaceKey workspaceKey = new WorkspaceKey(job.getCachedWorkspace()); synchronized (connectionLock) { testJob = workspaceJobMap.remove(workspaceKey); if (testJob == null) { log.warn("Could not locate running repository connection job in connection manager."); //$NON-NLS-1$ } else if (!testJob.equals(job)) { log.warn("Multiple repository connection jobs running for same connection key."); //$NON-NLS-1$ } else if (result.isOK()) { log.debug("Project Manager connected project with repository"); //$NON-NLS-1$ } } }
@Override public void done(final IJobChangeEvent event) { final IStatus result = event.getResult(); final ProjectManagerConnectionJob job = (ProjectManagerConnectionJob) event.getJob(); final URI connectionURI = job.getServerURI(); synchronized (connectionLock) { /* * Sanity check: make sure our connection job exists. If not, * connections may have been invalidated underneath us. */ final ProjectManagerConnectionJob testJob = serverConnectionJobMap.remove(connectionURI); if (testJob == null) { log.warn("Could not locate running server connection job in connection manager."); //$NON-NLS-1$ } else if (!testJob.equals(job)) { log.warn("Multiple server connection jobs running for same connection key."); //$NON-NLS-1$ } else if (result.isOK()) { serverManager.getOrCreateServer(job.getConnection()); } } }
public synchronized static AutoShareJob getAutoShareJob() { if (autoShareJob == null) { autoShareJob = new AutoShareJob(); autoShareJob.addJobChangeListener(new JobChangeAdapter() { public void done(IJobChangeEvent event) { // Reschedule the job if it has unprocessed projects if (!autoShareJob.isQueueEmpty()) { autoShareJob.schedule(); } } }); autoShareJob.setSystem(true); autoShareJob.setPriority(Job.SHORT); // Must run with the workspace rule to ensure that projects added while we're running // can be shared autoShareJob.setRule(ResourcesPlugin.getWorkspace().getRoot()); } return autoShareJob; }
public void setJob(DeployJob newJob) { DeployJob oldJob = job; job = newJob; firePropertyChange(this, PROPERTY_JOB, oldJob, newJob); job.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { @Override public void run() { setName(Messages.getString("job.terminated.template", getName())); } }); } }); }
public static void runContainerResolverJob(IJavaProject javaProject) { IEclipseContext context = EclipseContextFactory.getServiceContext( FrameworkUtil.getBundle(BuildPath.class).getBundleContext()); final IEclipseContext childContext = context.createChild(LibraryClasspathContainerResolverJob.class.getName()); childContext.set(IJavaProject.class, javaProject); Job job = ContextInjectionFactory.make(LibraryClasspathContainerResolverJob.class, childContext); job.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { childContext.dispose(); } }); job.schedule(); }
@Test public void testIgnoreInnerPomChanges() throws Exception { IProject project = importMavenProject("archetyped"); assertEquals("The inner pom should not have been imported", 2, WorkspaceHelper.getAllProjects().size()); IFile innerPom = project.getFile("src/main/resources/archetype-resources/pom.xml"); preferences.setUpdateBuildConfigurationStatus(FeatureStatus.automatic); boolean[] updateTriggered = new boolean[1]; IJobChangeListener listener = new JobChangeAdapter() { @Override public void scheduled(IJobChangeEvent event) { if (event.getJob().getName().contains("Update project")) { updateTriggered[0] = true; } } }; try { Job.getJobManager().addJobChangeListener(listener); projectsManager.fileChanged(innerPom.getRawLocationURI().toString(), CHANGE_TYPE.CHANGED); waitForBackgroundJobs(); assertFalse("Update project should not have been triggered", updateTriggered[0]); } finally { Job.getJobManager().removeJobChangeListener(listener); } }
public void done(IJobChangeEvent event) { String jobName = event.getJob().getName(); String status = null; if (event.getResult().isOK()) { status = "Done"; } else { // analyze the cause switch (event.getResult().getSeverity()) { case IStatus.CANCEL: status = "Cancelled"; break; case IStatus.ERROR: status = "Error"; break; default: status = "Unknown"; break; } } TLCActivator.logDebug("Job '" + jobName + "' terminated with status: { " + status + " }"); }
public void done(IJobChangeEvent event) { if (Status.OK_STATUS.equals(event.getResult())) { Display.getDefault().asyncExec(new Runnable() { public void run() { createCompleteMessageDialog(); } }); } else { Display.getDefault().asyncExec(new Runnable() { public void run() { MessageDialog.openWarning(getShell(), UMLMessage.MESSAGE_DIALOG_TITLE, UMLMessage.MESSAGE_FAIL_DOCUMENT_CREATION); } }); } }
private JobChangeAdapter getSiteDownloadJobChangeListener( final File tempFile, final UpdateSiteToken token) { return new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { IStatus result = event.getResult(); if (result != null && result.isOK()) { Element rootElement = getRootElement(tempFile); if (rootElement != null) { List<UpdateInfo> updates = updateCheckersMap.get(token).checkForUpdates(rootElement); assert (updates != null); if (!updates.isEmpty()) { updateList.addAll(updates); } } } // Signal the parent on completion of the download. siteXmlDownloadJobsCountDownLatch.countDown(); } }; }
private void initPreferencesStore() { IScopeContext projectScope = new ProjectScope(project); preferences = projectScope.getNode(FileSyncPlugin.PLUGIN_ID); buildPathMap(preferences); preferences.addPreferenceChangeListener(this); preferences.addNodeChangeListener(this); IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager(); manager.addValueVariableListener(this); jobChangeAdapter = new JobChangeAdapter(){ @Override public void done(IJobChangeEvent event) { // XXX dirty trick to re-evaluate dynamic egit variables on branch change if(!event.getJob().getClass().getName().contains("org.eclipse.egit.ui.internal.branch.BranchOperationUI")){ return; } rebuildPathMap(); } }; Job.getJobManager().addJobChangeListener(jobChangeAdapter); ResourcesPlugin.getWorkspace().addResourceChangeListener(this); }
public void upgradeProject(final File path) { UpgradeJob job = new UpgradeJob("upgrade", path); job.setUser(true); job.schedule(); job.getState(); job.addJobChangeListener(new JobChangeAdapter() { public void done(IJobChangeEvent event) { if (event.getResult().isOK()) Display.getDefault().asyncExec(new Runnable() { public void run() { MessageDialog.openInformation(null, "upgrade is over", "SVN升级完毕,请重新操作!"); } }); } }); }
@Override protected WorkbenchJob doCreateRefreshJob() { WorkbenchJob job = super.doCreateRefreshJob(); job.addJobChangeListener(new JobChangeAdapter() { @SuppressWarnings("deprecation") @Override public void done(IJobChangeEvent event) { if (event.getResult() != null && event.getResult().isOK() && !getViewer().getTree().isDisposed()) { Set<String> joinChecked = new HashSet(getSelectedValues()); for(String i : getPartialValues()) { getViewer().setGrayed(i, true); joinChecked.add(i); } getViewer().setCheckedElements(joinChecked.toArray()); } } }); return job; }
/** * When the TreeViewer is refreshed, the template plans are re-loaded. Do this in a Job. * @param viewer the TreeViewer being refreshed */ protected synchronized void loadTemplatePlans() { if (loadJobInProgress) { return; } final Job load = new TemplatePlanLoadingJob("Loading Template Plan", treeViewer); load.addJobChangeListener(new JobChangeAdapter() { /** * When the Job is done, if it was successful clear the Job's name. * @param event contains the Job's results, indicating whether successful */ @Override public void done(IJobChangeEvent event) { loadJobInProgress = false; if (event.getResult().isOK()) load.setName(""); } }); load.schedule(); loadJobInProgress = true; }
@Override public void done(IJobChangeEvent event) { if (event.getJob().getName().equals("VagrantManager")) { Display.getDefault().syncExec(new Runnable() { public void run() { engine.getStatusModel().setVagrantRunning(true); } }); } else if (event.getJob().getName().equals("SshManager")) { Display.getDefault().syncExec(new Runnable() { public void run() { engine.getStatusModel().setSshRunning(true); } }); } }
protected WorkbenchJob doCreateRefreshJob() { WorkbenchJob filterJob = super.doCreateRefreshJob(); filterJob.addJobChangeListener(new JobChangeAdapter() { public void done(IJobChangeEvent event) { if (event.getResult().isOK()) { getDisplay().asyncExec(new Runnable() { public void run() { if (checkboxViewer.getTree().isDisposed()) return; checkboxViewer.restoreLeafCheckState(); } }); } } }); return filterJob; }
@Override public void done(IJobChangeEvent event) { for (IRefactoringJobCallback callback : RefactoringJobCallbacksManager.INSTANCE.getRegisteredCallbacks()) { try { if (callback != null) { callback.execute(this.impactedCompilationUnit); } } catch (Exception e) { Activator .getDefault() .getLog() .log(new Status(IStatus.WARNING, Activator.PLUGIN_ID, RefactoringWizardMessages.ERROR_EXECUTING_CALLBACK.value(), e)); } } }
public void submit(PdfRequest request) { // if There is no running job - Start it // Else add to the Queue synchronized (PdfScheduler.class) { if (runningJob == null) { runningJob = new PdfJob("PDF Something", request); runningJob.addJobChangeListener(new JobChangeAdapter() { public void done(IJobChangeEvent event) { runningJob = null; } }); AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { runningJob.schedule(); return null; } }); } } }
public void start() { synchronized (PdfScheduler.class) { if (runningJob == null) { runningJob = new PdfJob("PDF Something", null); runningJob.addJobChangeListener(new JobChangeAdapter() { public void done(IJobChangeEvent event) { runningJob = null; } }); AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { runningJob.schedule(); return null; } }); } } }
public static void start() { synchronized (JobScheduler.class) { if (runningJob == null) { runningJob = new DemoJob("XPages Demo Database"); runningJob.addJobChangeListener(new JobChangeAdapter() { public void done(IJobChangeEvent event) { runningJob = null; } }); AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { runningJob.schedule(); return null; } }); } } }
@Override public void done(IJobChangeEvent event) { if (event.getResult().isOK()) writer.println("BUILD JOB STATUS: SUCCESS"); else { writer.println("BUILD JOB STATUS: FAIL"); writer.println(event.getResult().getMessage() + event.getResult().getCode()); if (event.getResult().getException() != null) { writer.println(event.getResult().getException().getMessage()); } } super.done(event); }
/** * Convenience method to add running jobs that will be automatically * cancelled silently if the plug-in is shutting down and they are still * running. * * @param jobId * the job id of the job * @param job * the job to add */ public static void addRunningJob(final long jobId, DynamicSpotterRunJob job) { // automatically remove the job when it's done job.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { synchronized (jobMonitor) { runningJobs.remove(jobId); } } }); synchronized (jobMonitor) { runningJobs.put(jobId, job); } }
private void activateTerminateHandler(final IProgressMonitor monitor, final WorkspaceJob job) { final IHandlerService handlerService = (IHandlerService) window .getService(IHandlerService.class); window.getShell().getDisplay().syncExec(new Runnable() { @Override public void run() { final IHandlerActivation activation = handlerService.activateHandler(TERMINATE_ID, new TerminateHandler(monitor)); job.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { window.getShell().getDisplay().syncExec(new Runnable() { @Override public void run() { handlerService.deactivateHandler(activation); } }); } }); } }); }
protected void updateWorkspaceProjectToRevisionOfTheBuild(final Build from, final Build to) { UpdateToBuildRevisionAllWorspaceProjectsJob updateJob = new UpdateToBuildRevisionAllWorspaceProjectsJob(from, to); updateJob.setUser(true); updateJob.schedule(); updateJob.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent ignore) { if (!SDKActivator.isSDKStyle()) { to.save(); return; } Display.getDefault().asyncExec(new Runnable() { public void run() { boolean nonSDK = MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), "Do you work NON-SDK style?", "Do you want to mark build (" + to + ") as current build. This option is handy when you work NON-SDK style, otherwise say no"); //$NON-NLS-1$ if (nonSDK) { to.save(); } } }); System.out.println("Revisions of workspace where updated to build: " + to); } }); }
/** * the command has been executed, so extract extract the needed information from the application context. */ protected void doExecute(final ExecutionEvent executionEvent) { Job sdkUpdateJob = new DeleteSDKBundlesJob(JOB_NAME); sdkUpdateJob.setUser(true); sdkUpdateJob.schedule(); sdkUpdateJob.addJobChangeListener(new JobChangeAdapter() { @Override public void done(final IJobChangeEvent event) { final IStatus resultStatus = event.getJob().getResult(); Display.getDefault().asyncExec(new Runnable() { public void run() { if (resultStatus.isOK()) { MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Delete binary duplicates in SDK-BUNDLES folder", resultStatus.getMessage()); } else { MessageDialog.openError(Display.getCurrent().getActiveShell(), "Delete binary duplicates in SDK-BUNDLES folder", resultStatus.getMessage()); } } }); } }); }
private void initExecutionBE(final XPageAgentEntry agentEntry, FacesContext fc) { try { final XPageAgentJob jbCurrent = buildAgentClass(agentEntry, fc); agentEntry.runScheduled(); m_RunningJobs.put(jbCurrent.getJobID(), jbCurrent); jbCurrent.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { m_RunningJobs.remove(jbCurrent.getJobID()); agentEntry.endSchedules(); } }); AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { jbCurrent.schedule(1000); return null; } }); } catch (Exception e) { m_Logger.log(Level.SEVERE, "Error during initExcecutionBE: ", e); } }
public void done(IJobChangeEvent event) { // allow other threads to update this UI thread // http://www.eclipse.org/swt/faq.php#uithread UiDesk.getDisplay().syncExec(new Runnable() { public void run() { AbstractChartComposite.this.clean(); // check if the creator has an empty dataset if (AbstractChartComposite.this.creator.isDatasetEmpty()) { AbstractChartComposite.this.setEmptyMessage(); } else { // displa the chart else AbstractChartComposite.this.chartComposite = new ChartComposite(AbstractChartComposite.this, SWT.NONE, AbstractChartComposite.this.initializeChart()); AbstractChartComposite.this.chartComposite.setLayoutData(AbstractChartComposite.this.layoutData); } AbstractChartComposite.this.layout(); } }); }
public void execute() { BuildClass build = new BuildClass("GFBundle task"); build.setUser(true); build.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { super.done(event); if (event.getResult().isOK()) { File resource = new File(project.getRawLocationURI().getPath().concat("/build/distributions/gfBundle.zip")); if (resource.exists()) { Properties gradleProperties = getGradleProperties(); if (gradleProperties != null) { try { final String cloudLinkIdeKey = utils.getCloudLinkIdeKey(); UploadFunction.upload(cloudLinkIdeKey, gradleProperties.getProperty("gfName"), gradleProperties.getProperty("gfEntrypoint"), resource); } catch (IOException e) { e.printStackTrace(); } } } } } }); build.schedule(); }
public void refresh () { final LoadFactoryJob job = this.factoryInput.createLoadJob (); job.addJobChangeListener ( new JobChangeAdapter () { @Override public void done ( final IJobChangeEvent event ) { FactoryEditor.this.handleSetResult ( job.getFactory (), FactoryEditor.this.factoryInput.getConnectionUri () ); } } ); job.schedule (); }
private void insertEntry ( final String value ) { final Job job = this.factoryInput.createCreateJob ( value ); job.addJobChangeListener ( new JobChangeAdapter () { @Override public void done ( final IJobChangeEvent event ) { refresh (); } } ); job.schedule (); }
public void performLoad ( final IProgressMonitor monitor ) { final LoadJob job = load (); job.addJobChangeListener ( new JobChangeAdapter () { @Override public void done ( final IJobChangeEvent event ) { handleSetResult ( job.getConfiguration () ); } } ); job.setProgressGroup ( monitor, 2 ); job.schedule (); }
public void diff() { Log.log(Log.LOG_INFO, "Started DB update"); //$NON-NLS-1$ if (warnCheckedElements() < 1 || !OpenProjectUtils.checkVersionAndWarn(proj.getProject(), parent.getShell(), true)) { return; } IEclipsePreferences pref = proj.getPrefs(); final Differ differ = new Differ(dbRemote.getDbObject(), dbProject.getDbObject(), diffTree.getRevertedCopy(), false, pref.get(PROJ_PREF.TIMEZONE, ApgdiffConsts.UTC)); differ.setAdditionalDepciesSource(manualDepciesSource); differ.setAdditionalDepciesTarget(manualDepciesTarget); Job job = differ.getDifferJob(); job.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { Log.log(Log.LOG_INFO, "Differ job finished with status " + //$NON-NLS-1$ event.getResult().getSeverity()); if (event.getResult().isOK()) { UiSync.exec(parent, () -> { if (!parent.isDisposed()) { try { showEditor(differ); } catch (PartInitException ex) { ExceptionNotifier.notifyDefault( Messages.ProjectEditorDiffer_error_opening_script_editor, ex); } } }); } } }); job.setUser(true); job.schedule(); }
/** * Returns a listener that will close the dialog when the job completes. * * @return IJobChangeListener */ private IJobChangeListener createCloseListener() { return new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { // first of all, make sure this listener is removed event.getJob().removeJobChangeListener(this); if (!PlatformUI.isWorkbenchRunning()) { return; } // nothing to do if the dialog is already closed if (getShell() == null) { return; } Job closeJob = new UIJob( ProgressMessages.ProgressMonitorFocusJobDialog_CLoseDialogJob) { @Override public IStatus runInUIThread(IProgressMonitor monitor) { Shell currentShell = getShell(); if (currentShell == null || currentShell.isDisposed()) { return Status.CANCEL_STATUS; } finishedRun(); return Status.OK_STATUS; } }; closeJob.setSystem(true); closeJob.schedule(); } }; }
private void runPipelineOnCorpus( final EPipeline pipeline, final Iterable<ESingleLanguageCorpus> corpusList, boolean useCache) { for(final ESingleLanguageCorpus corpus:corpusList) { Path preprocessedCorpusPath = getCachePath(corpus, pipeline.getTaggerConfigName(), pipeline.getMaxNumTermsMemory()); if(useCache && preprocessedCorpusPath.toFile().isFile()) runPipelineOnPreprocessedCorpus(pipeline, corpus, IndexedCorpusIO.fromJson(preprocessedCorpusPath)); else { Job preprocessCorpusJob = getPrepareCorpusJob(pipeline, corpus); preprocessCorpusJob.addJobChangeListener(new JobChangeAdapter(){ @Override public void done(IJobChangeEvent event) { if(event.getResult().isOK()) { runPipelineOnPreprocessedCorpus( pipeline, corpus, IndexedCorpusIO.fromJson(preprocessedCorpusPath)); } event.getJob().removeJobChangeListener(this); } }); preprocessCorpusJob.schedule(); eventBroker.post(TermSuiteEvents.JOB_STARTED, preprocessCorpusJob.getName()); } } }
@Override public void done(IJobChangeEvent event) { // This seems to double up a logged message with the job manager. if (!event.getResult().isOK()) { MechanicLog.getDefault().log(event.getResult()); } }
@Override public void done(final IJobChangeEvent event) { final TeamExplorerNavigationItemConfig item = (TeamExplorerNavigationItemConfig) event.getJob().getProperty(NAVITEM_CONFIG_DATA_NAME); refreshView(item); }
private void launchDeployJob(IProject project, Credential credential) throws IOException, CoreException { AnalyticsPingManager.getInstance().sendPing(AnalyticsEvents.APP_ENGINE_DEPLOY, analyticsDeployEventMetadataKey); IPath workDirectory = createWorkDirectory(); DeployPreferences deployPreferences = getDeployPreferences(project); DeployConsole messageConsole = MessageConsoleUtilities.createConsole(getConsoleName(deployPreferences.getProjectId()), new DeployConsole.Factory()); IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager(); consoleManager.showConsoleView(messageConsole); ConsoleColorProvider colorProvider = new ConsoleColorProvider(); MessageConsoleStream outputStream = messageConsole.newMessageStream(); MessageConsoleStream errorStream = messageConsole.newMessageStream(); outputStream.setActivateOnWrite(true); errorStream.setActivateOnWrite(true); outputStream.setColor(colorProvider.getColor(IDebugUIConstants.ID_STANDARD_OUTPUT_STREAM)); errorStream.setColor(colorProvider.getColor(IDebugUIConstants.ID_STANDARD_ERROR_STREAM)); StagingDelegate stagingDelegate = getStagingDelegate(project); DeployJob deploy = new DeployJob(deployPreferences, credential, workDirectory, outputStream, errorStream, stagingDelegate); messageConsole.setJob(deploy); deploy.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { if (event.getResult().isOK()) { AnalyticsPingManager.getInstance().sendPing(AnalyticsEvents.APP_ENGINE_DEPLOY_SUCCESS, analyticsDeployEventMetadataKey); } launchCleanupJob(); } }); deploy.schedule(); }