Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.ICompilationUnit.save()


     
      if(!compilationUnit.getSource().contains("import org.boco.seamwebappgen.annotations.SearchOnRelationship"))
        compilationUnit.createImport("org.boco.seamwebappgen.annotations.SearchOnRelationship", null, null);
     
     
      compilationUnit.save(null, true);
    }
    catch (JavaModelException e)
    {
      e.printStackTrace();
    }           
View Full Code Here


    ExecutionUtils.runLogUI(new RunnableEx() {
      public void run() throws Exception {
        workspaceRunnable.run(null);
      }
    });
    implUnit.save(null, true);
    implUnit.getBuffer().save(null, true);
  }

  /**
   * @return the {@link Type} that extends {@link Object}, even if given is primitive.
View Full Code Here

           
            type.createMethod(setter, null, false, null);
          }
        }
       
        compUnit.save(null, true);
      }
   
    } catch (JavaModelException e) {
      throw new ArchMapperException("Could not add an attribute to the class "+ qName+ ": " + e.getMessage(), e);
    }
View Full Code Here

        ICompilationUnit iCompUnit = (ICompilationUnit) JavaCore.create(handleID);
        String source = iCompUnit.getBuffer().getContents();
        String comment = "//TODO Not used: Method " + name + "\n";
        if (checkComment(iCompUnit, comment)) {
          iCompUnit.getBuffer().setContents(comment + source);
          iCompUnit.save(monitor, true);
        }

        taskMonitor.worked(1);
        if (taskMonitor.isCanceled()) {
          return false;
View Full Code Here

        ICompilationUnit iCompUnit = (ICompilationUnit) JavaCore.create(handleID);
        String source = iCompUnit.getBuffer().getContents();
        String comment = "//TODO Not used: Class variable " + name + "\n";
        if (checkComment(iCompUnit, comment)) {
          iCompUnit.getBuffer().setContents(comment + source);
          iCompUnit.save(monitor, true);
        }
        taskMonitor.worked(1);
        if (taskMonitor.isCanceled()) {
          return false;
        }
View Full Code Here

      // update the contents of the existing unit if fForce is true
      if (this.force) {
        IBuffer buffer = unit.getBuffer();
        if (buffer == null) return;
        buffer.setContents(this.source);
        unit.save(new NullProgressMonitor(), false);
        this.resultElements = new IJavaElement[] {unit};
        if (!Util.isExcluded(unit)
            && unit.getParent().exists()) {
          for (int i = 0; i < this.resultElements.length; i++) {
            delta.changed(this.resultElements[i], IJavaElementDelta.F_CONTENT);
View Full Code Here

          }
        }
      }
    }
    if (delta.getAffectedChildren().length > 0) {
      cu.save(getSubProgressMonitor(1), this.force);
      if (!cu.isWorkingCopy()) { // if unit is working copy, then save will have already fired the delta
        addDelta(delta);
        setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);
      }
    }
View Full Code Here

                {
                    final IPackageFragmentRoot src = src( jproj );
                    final IPackageFragment pkg = src.createPackageFragment( ( javaTypeName.pkg() == null ? "" : javaTypeName.pkg() ), true, null );
                    final ICompilationUnit cu = pkg.createCompilationUnit( javaTypeName.simple() + ".java", buf.toString(), true, null );
                   
                    cu.save( null, true );
                   
                    monitor.worked( 1 );
                   
                    final IEditorPart editor = JavaUI.openInEditor( cu );
                    final IWorkbenchPartSite site = editor.getSite();
View Full Code Here

          }
        }
      }
    }
    if (delta.getAffectedChildren().length > 0) {
      cu.save(getSubProgressMonitor(1), this.force);
      if (!cu.isWorkingCopy()) { // if unit is working copy, then save will have already fired the delta
        addDelta(delta);
        setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);
      }
    }
View Full Code Here

      JavaElementDelta delta = newJavaElementDelta();
      ICompilationUnit unit = getCompilationUnit();
      generateNewCompilationUnitAST(unit);
      if (this.creationOccurred) {
        //a change has really occurred
        unit.save(null, false);
        boolean isWorkingCopy = unit.isWorkingCopy();
        if (!isWorkingCopy)
          setAttribute(HAS_MODIFIED_RESOURCE_ATTR, TRUE);
        worked(1);
        this.resultElements = generateResultHandles();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.