Package org.eclipse.jdt.core

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


        buf.save(null, false);

      imports.create(needsSave, new SubProgressMonitor(monitor, 1));
      removeUnusedImports(cu, needsSave);
      if (needsCommit)
        cu.commitWorkingCopy(false, new SubProgressMonitor(monitor, 1));
    } finally {
      if (createdWorkingCopy != null) {
        createdWorkingCopy.discardWorkingCopy();
      }
      monitor.done();
View Full Code Here


                }
            }
            fCreatedType = createdType;

            if (needsSave) {
                cu.commitWorkingCopy(true, new SubProgressMonitor(monitor, 1));
            } else {
                monitor.worked(1);
            }

        } finally {
View Full Code Here

                }
            }
            fCreatedType = createdType;

            if (needsSave) {
                cu.commitWorkingCopy(true, new SubProgressMonitor(monitorInternal, 1));
            } else {
                monitorInternal.worked(1);
            }

        } finally {
View Full Code Here

        if (success) {
          TextEdit edit = imports.rewriteImports(monitor);
          JavaUtil.applyEdit(copy, edit, true, monitor);
        }
        if (copy.isWorkingCopy()) {
          copy.commitWorkingCopy(true, monitor);
          copy.discardWorkingCopy();
        }
        IWorkbenchPartSite site = getEditorSite();
        if (site != null) {
          OrganizeImportsAction action = new OrganizeImportsAction(site);
View Full Code Here

      try {
        icu.becomeWorkingCopy(null);
        icu.getBuffer().setContents(document.get());
        icu.reconcile(ICompilationUnit.NO_AST, false, null, null);
        icu.commitWorkingCopy(true, null);
        icu.discardWorkingCopy();
      } catch (JavaModelException e) {
        CrashReporter.reportException(e);
        logger.debug("Reconcile operation on ICompilationUnit failed.\r\n"
            + e.getLocalizedMessage());
View Full Code Here

      try {
        icu.becomeWorkingCopy(null);
        icu.getBuffer().setContents(document.get());
        icu.reconcile(ICompilationUnit.NO_AST, false, null, null);
        icu.commitWorkingCopy(true, null);
        icu.discardWorkingCopy();
      } catch (JavaModelException e) {
        logger.debug("Reconcile operation on ICompilationUnit failed.\r\n"
            + e.getLocalizedMessage());
      }
View Full Code Here

      try {
        icu.becomeWorkingCopy(null);
        icu.getBuffer().setContents(document.get());
        icu.reconcile(ICompilationUnit.NO_AST, false, null, null);
        icu.commitWorkingCopy(true, null);
        icu.discardWorkingCopy();
      } catch (JavaModelException e) {
        logger.debug("Reconcile operation on ICompilationUnit failed.\r\n"
            + e.getLocalizedMessage());
      }
View Full Code Here

                    PreferenceConstants.P_FORMAT_ON_INSERT)) {
              FormatAllAction format = new FormatAllAction(editor
                  .getEditorSite());
              format.runOnMultiple(new ICompilationUnit[] { icu2 });
            }
            icu2.commitWorkingCopy(true, monitor);
          } catch (Exception e) {
            logger.debug(e.toString());
            CrashReporter.reportException(e);
          }
        }
View Full Code Here

    // update of the compilation unit
    cpu.getBuffer().setContents(
        astRoot.getTypeRoot().findPrimaryType().getCompilationUnit()
            .getSource());
    cpu.reconcile(ICompilationUnit.NO_AST, false, null, null);
    cpu.commitWorkingCopy(false, null);
  }

  /**
   * Inserts a TypeDeclaration into the target ICompilationUnit
   *
 
View Full Code Here

      String newSource = document.get();

      // update of the compilation unit
      icu.getBuffer().setContents(newSource);
      icu.reconcile(ICompilationUnit.NO_AST, false, null, null);
      icu.commitWorkingCopy(false, null);
      icu.discardWorkingCopy();
    } catch (Exception e) {
      CrashReporter.reportException(e);
      logger.debug("Could not insert result: " + e.toString());
    }
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.