Package org.eclipse.jface.text

Examples of org.eclipse.jface.text.Document


    final TextEdit editCode = codeFormatter.format(
        CodeFormatter.K_COMPILATION_UNIT
            | CodeFormatter.F_INCLUDE_COMMENTS, source, 0,
        source.length(), 0, System.getProperty("line.separator"));

    IDocument document = new Document(source);

    if (icu != null && document != null && editCode != null) {
      try {
        editCode.apply(document);
      } catch (MalformedTreeException e) {
        CrashReporter.reportException(e);
      } catch (BadLocationException e) {
        CrashReporter.reportException(e);
      }

      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);
View Full Code Here


    final TextEdit editCode = codeFormatter.format(
        CodeFormatter.K_COMPILATION_UNIT
            | CodeFormatter.F_INCLUDE_COMMENTS, source, 0,
        source.length(), 0, System.getProperty("line.separator"));

    IDocument document = new Document(source);

    if (icu != null && document != null && editCode != null) {
      try {
        editCode.apply(document);
      } catch (MalformedTreeException e) {
        e.printStackTrace();
      } catch (BadLocationException e) {
        e.printStackTrace();
      }

      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"
View Full Code Here

    final TextEdit editCode = codeFormatter.format(
        CodeFormatter.K_COMPILATION_UNIT
            | CodeFormatter.F_INCLUDE_COMMENTS, source, 0,
        source.length(), 0, System.getProperty("line.separator"));

    IDocument document = new Document(source);

    if (icu != null && document != null && editCode != null) {
      try {
        editCode.apply(document);
      } catch (MalformedTreeException e) {
        e.printStackTrace();
      } catch (BadLocationException e) {
        e.printStackTrace();
      }

      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"
View Full Code Here

            null);
        logger.debug("New type added successfully");
      }

      String source = icu.getSource();
      Document document = new Document(source);

      // computation of the text edits
      TextEdit edits = rewrite.rewriteAST(document, icu.getJavaProject()
          .getOptions(true));

      // computation of the new source code
      if (edits != null) {
        edits.apply(document);
      }

      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);
View Full Code Here

    tableviewer.setInput(items);
    pagebook.showPage(tableviewer.getControl());
  }

  private void showText(String text) {
    textviewer.setDocument(new Document(text));
    pagebook.showPage(textviewer.getControl());
  }
View Full Code Here

        sourceViewer.getControl().setLayoutData( new GridData( GridData.FILL_BOTH ) );
        configuration = new FilterSourceViewerConfiguration( parser, browserConnection );
        sourceViewer.configure( configuration );

        // set document
        IDocument document = new Document( filter );
        sourceViewer.setDocument( document );

        // preformat
        IRegion region = new Region( 0, sourceViewer.getDocument().getLength() );
        configuration.getContentFormatter( sourceViewer ).format( sourceViewer.getDocument(), region );
View Full Code Here

        ICompletionProposal[] oldProposals = computeCompletionProposals( position );
        IContentProposal[] proposals = new IContentProposal[oldProposals.length];
        for ( int i = 0; i < oldProposals.length; i++ )
        {
            final ICompletionProposal oldProposal = oldProposals[i];
            final Document document = new Document( contents );
            oldProposal.apply( document );

            proposals[i] = new IContentProposal()
            {
                public String getContent()
                {
                    return document.get();
                }


                public int getCursorPosition()
                {
View Full Code Here

        // set text font
        Font font = JFaceResources.getFont( JFaceResources.TEXT_FONT );
        schemaSourceViewer.getTextWidget().setFont( font );

        IDocument document = new Document();
        schemaSourceViewer.setDocument( document );

        // Initialization from the "input" attribute type
        fillInUiFields();
View Full Code Here

        // set text font
        Font font = JFaceResources.getFont( JFaceResources.TEXT_FONT );
        schemaSourceViewer.getTextWidget().setFont( font );

        IDocument document = new Document();
        schemaSourceViewer.setDocument( document );

        // Initialization from the "input" object class
        fillInUiFields();
View Full Code Here

        // set text font
        Font font = JFaceResources.getFont( JFaceResources.TEXT_FONT );
        schemaSourceViewer.getTextWidget().setFont( font );

        IDocument document = new Document();
        schemaSourceViewer.setDocument( document );

        // Initializes the UI from the schema
        fillInUiFields();
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.Document

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.