Package org.eclipse.core.resources

Examples of org.eclipse.core.resources.IWorkspaceRunnable


    protected void createMarker(final IResource res,
                                final String message,
                                final int lineNumber) {
        try {
            IWorkspaceRunnable r = new IWorkspaceRunnable() {
                public void run(IProgressMonitor monitor) throws CoreException {
                    IMarker marker = res
                            .createMarker( IDroolsModelMarker.DROOLS_MODEL_PROBLEM_MARKER );
                    marker.setAttribute( IMarker.MESSAGE,
                                         message );
View Full Code Here


    private void createMarker(final IResource res,
                              final String message,
                              final int lineNumber) {
        try {
            IWorkspaceRunnable r = new IWorkspaceRunnable() {
                public void run(IProgressMonitor monitor) throws CoreException {
                    IMarker marker = res.createMarker( IDroolsModelMarker.DROOLS_MODEL_PROBLEM_MARKER );
                    marker.setAttribute( IMarker.MESSAGE,
                                         message );
                    marker.setAttribute( IMarker.SEVERITY,
View Full Code Here

 
  @After
  public void tearDown() throws Exception {
    // Should undo all wizard actions
    DeeCore.getWorkspaceModelManager().syncPendingUpdates(); // ensure DUB process finished
    ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
      @Override
      public void run(IProgressMonitor monitor) throws CoreException {
        IProject project = EclipseUtils.getWorkspaceRoot().getProject(NEWPROJNAME);
        if(project.exists()) {
          project.delete(true, monitor);
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  protected IProject[] build(final int kind, Map args, IProgressMonitor monitor)
  throws CoreException {
   
    ResourcesPlugin.getWorkspace().run( new IWorkspaceRunnable() {
      public void run(IProgressMonitor monitor) throws CoreException {
        validateJson(kind, monitor);
      }
    }, monitor);
   
View Full Code Here

    } catch (InterruptedException ie) {
      // continue, we should still run rest of initialization
    }
   
    try {
      EclipseUtils.getWorkspace().run(new IWorkspaceRunnable() {
        @Override
        public void run(IProgressMonitor monitor) {
          EclipseUtils.getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE);
          initializeProjectsInfo(monitor);
        }
View Full Code Here

  }
 
  @Override
  public void run() {
    try {
      ResourceUtils.getWorkspace().run(new IWorkspaceRunnable() {
       
        @Override
        public void run(IProgressMonitor monitor) throws CoreException {
          if(project.exists() == false) {
            return;
View Full Code Here

      throw LangCore.createCoreException("dub returned non-zero status: " + exitValue, null);
    }
   
    final DubBundleDescription bundleDesc = DubHelper.parseDubDescribe(bundlePath, processHelper);
   
    EclipseUtils.getWorkspace().run(new IWorkspaceRunnable() {
      @Override
      public void run(IProgressMonitor monitor) throws CoreException {
        if(project.exists() == false) {
          return;
        }
View Full Code Here

      final IWorkspace workspace = ResourcesPlugin.getWorkspace();
      final Jg jg = new Jg();
      final TypeDescription[] types = mergedTypeSystemDescription.getTypes();
      final String outputDirectory = getPrimarySourceFolder().getLocation().toOSString();
      final String inputFile = file.getLocation().toOSString(); // path to descriptor file
      IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
        public void run(IProgressMonitor progressMonitor) {
          try {
            jg.mainForCde(new MergerImpl(), new JCasGenProgressMonitor(progressMonitor),
                    jCasGenThrower, inputFile, outputDirectory, types, (CASImpl) getCurrentView());
          } catch (IOException e) {
View Full Code Here

  }

  @Override
  public void buildComplete(boolean isOk) {
    if (isOk){
      IWorkspaceRunnable myRunnable =
        new IWorkspaceRunnable() {
          public void run(IProgressMonitor monitor) throws CoreException {
            FileOutputStream fos = null;
            ObjectOutputStream out = null;
            try {
              // use serialization to write the mapping tree to disk
              IWorkspace workspace = ResourcesPlugin.getWorkspace()
              IProject project = workspace.getRoot().getProject(projectName);
              IFolder folder =  project.getFolder(outputDirectory);             
              if (!folder.exists())
                folder.create(true, true, monitor);
              IFile file = folder.getFile("jbprocess.bin");
             
              fos = new FileOutputStream(file.getRawLocation().toFile());
              out = new ObjectOutputStream(fos);
              out.writeObject(root);
              out.close();
              file.refreshLocal(IResource.DEPTH_ONE, monitor);
             
            } catch(Exception e){
              System.out.println(e.getMessage());
              e.printStackTrace();
            } finally {
               try { if (out != null) out.close(); } catch (Exception e){}
            }
          }         
      };
      try {
        myRunnable.run(null);
      } catch (CoreException e){
        System.out.println(e.getMessage());
        e.printStackTrace();
      }
    }
View Full Code Here

  @Override
  public void buildStart(String project, String directory) {
    projectName = project;
    outputDirectory = directory;
    IWorkspaceRunnable myRunnable =
      new IWorkspaceRunnable() {
        public void run(IProgressMonitor monitor) throws CoreException
          IWorkspace workspace = ResourcesPlugin.getWorkspace()
          IProject project = workspace.getRoot().getProject(projectName);
          IFolder folder =  project.getFolder(outputDirectory);
          if (!folder.exists())
            folder.create(true, true, monitor);
          IFile file = folder.getFile("jbprocess.bin");
          if (file.exists())
            file.delete(true, monitor);               
        }         
    };
    try {
      myRunnable.run(null);
    } catch (CoreException e){
      System.out.println(e.getMessage());
      e.printStackTrace();
    }
   
View Full Code Here

TOP

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

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.