Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.WorkspaceJob


        return;
      }
    }

    final IContainer root = ResourcesPlugin.getWorkspace().getRoot();
    Job job = new WorkspaceJob(IDEWorkbenchMessages.Workspace_refreshing) {
      public IStatus runInWorkspace(IProgressMonitor monitor)
          throws CoreException {
        root.refreshLocal(IResource.DEPTH_INFINITE, monitor);
        return Status.OK_STATUS;
      }
    };
    job.setRule(root);
    job.schedule();
  }
View Full Code Here


    @Override
    public void initialize(IPath containerPath, final IJavaProject project) throws CoreException {
        final ArrayList<String> errors = new ArrayList<String>();
        calculateAndUpdateClasspathEntries(project, errors);

        WorkspaceJob replaceMarkersJob = new WorkspaceJob("Update bnd classpath markers") {
            @Override
            public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
                replaceClasspathProblemMarkers(project.getProject(), errors);
                return Status.OK_STATUS;
            }
        };
        replaceMarkersJob.setRule(project.getProject());
        replaceMarkersJob.schedule();
    }
View Full Code Here

    @Override
    public void initialize(IPath containerPath, final IJavaProject project) throws CoreException {
        final ArrayList<String> errors = new ArrayList<String>();
        calculateAndUpdateClasspathEntries(project, errors);

        WorkspaceJob replaceMarkersJob = new WorkspaceJob("Update bnd classpath markers") {
            @Override
            public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
                replaceClasspathProblemMarkers(project.getProject(), errors);
                return Status.OK_STATUS;
            }
        };
        replaceMarkersJob.setRule(project.getProject());
        replaceMarkersJob.schedule();
    }
View Full Code Here

        addPage(fileSelectionPage);
    }

    @Override
    public boolean performFinish() {
        WorkspaceJob job = new WorkspaceJob("Adding files to repository") {
            @Override
            public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
                return performFinishAddFiles(monitor);
            }
        };
        job.schedule();
        return true;
    }
View Full Code Here

    void doReload() {
        IFormPage page = (IFormPage) getManagedForm().getContainer();
        final IFile file = ResourceUtil.getFile(page.getEditorInput());
        if (file != null && file.exists()) {
            WorkspaceJob job = new WorkspaceJob("Reload Plugins") {
                @Override
                public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
                    file.touch(monitor);
                    return Status.OK_STATUS;
                }
            };
            job.setUser(true);
            job.schedule();
        }
    }
View Full Code Here

        node.put(ProjectPreferencesConstants.PROJECT_EXTERNAL_MODULES,
                info.getExternalModulesFile());

        // this might be called from a resource change event, so the workspace is locked
        // for modification; we do it asynchronously
        WorkspaceJob job = new WorkspaceJob("erlide") {
            @Override
            public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
                try {
                    node.flush();
                } catch (final BackingStoreException e) {
                    // projects may be read-only
                    ErlLogger
                            .warn("Could not set project configuration, is project read-only? "
                                    + e.getMessage());
                }
                return Status.OK_STATUS;
            }
        };
        job.schedule();

    }
View Full Code Here

        final ISelection selection = HandlerUtil.getCurrentSelection(event);
        final Set<IErlModule> modules = collectModulesFromSelection(selection);
        final Set<IErlProject> projects = collectProjectsFromModules(modules);

        // build
        final WorkspaceJob buildJob = new BuildOperation("Building projects", projects);
        buildJob.setUser(true);
        buildJob.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule());
        buildJob.schedule();

        // run dialyzer
        final Job job = new DialyzeOperation("Running Dialyzer", modules, projects);
        final ISchedulingRule rule = createRuleForModules(modules);
        job.setRule(rule);
View Full Code Here

          JavaProject javaProject = (JavaProject)delta.getElement();
          projectsToTouch[i] = javaProject.getProject();
        }
        if (projectsToTouch.length > 0) {
          if (asynchronous){
            WorkspaceJob touchJob = new WorkspaceJob(Messages.updating_external_archives_jobName) {
             
              public IStatus runInWorkspace(IProgressMonitor progressMonitor) throws CoreException {
                try {
                  if (progressMonitor != null)
                    progressMonitor.beginTask("", projectsToTouch.length); //$NON-NLS-1$
                  touchProjects(projectsToTouch, progressMonitor);
                }
                finally {
                  if (progressMonitor != null)
                    progressMonitor.done();
                }
                return Status.OK_STATUS;
              }
             
              public boolean belongsTo(Object family) {
                return ResourcesPlugin.FAMILY_MANUAL_REFRESH == family;
              }
            };
            touchJob.schedule();
          }
          else {
            // touch the projects to force them to be recompiled while taking the workspace lock
            //   so that there is no concurrency with the Java builder
            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=96575
View Full Code Here

    store();
    fireListeners(server, SERVER_REMOVED);
  }

  public synchronized void addServer(final AbstractHadoopCluster server) {
    WorkspaceJob job= new WorkspaceJob("Adding Hadoop Server") {
      @Override
      public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
        if(server.isAvailable()){
          servers.put(server.getLocationName(), server);
          store();
          fireListeners(server, SERVER_ADDED);
        }
      return org.eclipse.core.runtime.Status.OK_STATUS;
    }};
   
    job.setPriority(Job.LONG);
    job.setRule(ResourcesPlugin.getWorkspace().getRoot());
    job.setUser(true);
    job.schedule();
  }
View Full Code Here

   *            the original location name (might have changed)
   * @param server
   *            the location
   */
  public synchronized void updateServer(final String originalName, final AbstractHadoopCluster server) {
    WorkspaceJob job= new WorkspaceJob("Updating  Hadoop Server") {
      @Override
      public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
        // Update the map if the location name has changed
        if (!server.getLocationName().equals(originalName) && server.isAvailable()) {
          servers.remove(originalName);
          servers.put(server.getLocationName(), server);
          store();
          fireListeners(server, SERVER_STATE_CHANGED);
        }
       
        return org.eclipse.core.runtime.Status.OK_STATUS;
      }};
   
    job.setPriority(Job.LONG);
    job.setUser(true);
    job.schedule();
  }
View Full Code Here

TOP

Related Classes of org.eclipse.core.resources.WorkspaceJob

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.