Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.WorkspaceJob


    } catch (InterruptedException e) {
      return new Status(IStatus.ERROR, OverlayPluginActivator.PLUGIN_ID, NLS.bind(Messages.UnpackArchiveJob_Unpacking_Interrupted, archive.getName()) , e);
    }
   
    //will run in scheduling rule of parent of unpackfolder, so should be run in a different job
    new WorkspaceJob(NLS.bind(Messages.UnpackArchiveJob_Refreshing, unpackFolder.getLocation().toString())) {

      @Override
      public IStatus runInWorkspace(final IProgressMonitor monitor) throws CoreException
      {
        if (!monitor.isCanceled()) {
View Full Code Here


    if(facades.isEmpty())
      return;
   
    final IProjectConfigurationManager configurationManager = MavenPlugin.getProjectConfigurationManager();

    WorkspaceJob job = new WorkspaceJob(Messages.MavenWtpPreferencePage_Updating_Maven_Projects_Job) {
 
      @Override
  public IStatus runInWorkspace(IProgressMonitor monitor) {
        try {
          SubMonitor progress = SubMonitor.convert(monitor, Messages.MavenWtpPreferencePage_Updating_Maven_Projects_Monitor, 100);
          SubMonitor subProgress = SubMonitor.convert(progress.newChild(5), facades.size() * 100);
          //projectManager.sortProjects(facades, progress.newChild(5));
          for(IMavenProjectFacade facade : facades) {
            if(progress.isCanceled()) {
              throw new OperationCanceledException();
            }
            IProject project = facade.getProject();
            subProgress.subTask(NLS.bind(Messages.MavenWtpPreferencePage_Updating_Configuration_For_Project, project.getName()));

            configurationManager.updateProjectConfiguration(project, subProgress);
          }

        } catch(CoreException ex) {
          return ex.getStatus();
        }
        return Status.OK_STATUS;
      }
    };
    job.setRule(configurationManager.getRule());
    job.schedule();
  }
View Full Code Here

  private void updateProjectConfiguration(IProject project) {
    // TODO: remove this reflection if we ever set a minimum requirement of M2E 1.1
    try {
      Class<?> jobClass;
      Constructor<?> constr;
      WorkspaceJob job = null;
      try {
        // M2E 1.1 and greater
        jobClass = Class.forName("org.eclipse.m2e.core.ui.internal.UpdateMavenProjectJob");
        constr = jobClass.getConstructor(IProject[].class);
        job = (WorkspaceJob) constr.newInstance((Object) new IProject[] { project });
      } catch (ClassNotFoundException e) {
        // M2E 1.0
        jobClass = Class.forName("org.eclipse.m2e.core.ui.internal.UpdateConfigurationJob");
        constr = jobClass.getConstructor(IProject[].class, boolean.class, boolean.class);
        job = (WorkspaceJob) constr.newInstance(
            new IProject[] { project }, MavenPlugin.getMavenConfiguration().isOffline(), false);
      }
      if (job != null) {
        job.schedule();
      }
    }
    catch (Throwable e) {
      RooCoreActivator.log(new Status(IStatus.ERROR, RooUiActivator.PLUGIN_ID,
          "Unable to update Maven project configuration", e));
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.