Examples of format()


Examples of org.crsh.text.ScreenBuffer.format()

          buffer.flush();
        }
      }));
      StringBuilder sb = new StringBuilder();
      try {
        buffer.format(Format.ANSI, sb);
      }
      catch (IOException e) {
        throw failure(e);
      }
      result.add(sb.toString());
View Full Code Here

Examples of org.eclipse.cdt.core.formatter.CodeFormatter.format()

      options.put(DefaultCodeFormatterConstants.FORMATTER_TRANSLATION_UNIT, tu);
      // Allow all comments to be indented.
      options.put(DefaultCodeFormatterConstants.FORMATTER_COMMENT_NEVER_INDENT_LINE_COMMENTS_ON_FIRST_COLUMN, DefaultCodeFormatterConstants.FALSE);
      final CodeFormatter formatter = ToolFactory.createCodeFormatter(options);
      code = document.get();
      TextEdit[] formatEdits = formatter.format(CodeFormatter.K_TRANSLATION_UNIT, code, regions, TextUtilities.getDefaultLineDelimiter(document));

      TextEdit combinedFormatEdit = new MultiTextEdit();
      for (final TextEdit formatEdit : formatEdits) {
        combinedFormatEdit = TextEditUtil.merge(combinedFormatEdit, formatEdit);
      }
View Full Code Here

Examples of org.eclipse.egit.ui.internal.commit.DiffStyleRangeFormatter.format()

    IDocument document = new Document();
    DiffStyleRangeFormatter diffFormatter = new DiffStyleRangeFormatter(
        document);
    diffFormatter.setContext(1);
    diffFormatter.setRepository(revision.getRepository());
    diffFormatter.format(interestingDiff, diff.getOldText(),
        diff.getNewText());

    diffText.setDocument(document);
    diffText.setFormatter(diffFormatter);
  }
View Full Code Here

Examples of org.eclipse.jdt.core.formatter.CodeFormatter.format()

        options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5);
        options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5);
        Document doc = new Document(m_compilationUnit.toString());
        CodeFormatter fmtr = ToolFactory.createCodeFormatter(options);
        String text = doc.get();
        TextEdit edits = fmtr.format(CodeFormatter.K_COMPILATION_UNIT, text, 0, text.length(), 0, null);
        File gendir = m_package.getGenerateDirectory();
        if (gendir != null) {
            try {
                File file = new File(gendir, m_name + ".java");
                FileWriter fwrit = new FileWriter(file);
View Full Code Here

Examples of org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format()

    newOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_OPENING_BRACE_IN_ARRAY_INITIALIZER, JavaCore.INSERT);
    newOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_AFTER_OPENING_BRACE_IN_ARRAY_INITIALIZER, JavaCore.INSERT);
    newOptions.put(DefaultCodeFormatterConstants.FORMATTER_INSERT_SPACE_BEFORE_CLOSING_BRACE_IN_ARRAY_INITIALIZER, JavaCore.INSERT);

    DefaultCodeFormatter defaultCodeFormatter = new DefaultCodeFormatter(newOptions);
    TextEdit textEdit = defaultCodeFormatter.format(org.eclipse.jdt.core.formatter.CodeFormatter.K_UNKNOWN, string, 0, string.length(), indentLevel, lineSeparator);
    if (positions != null && textEdit != null) {
      // update positions
      TextEdit[] edits = textEdit.getChildren();
      int textEditSize = edits.length;
      int editsIndex = 0;
View Full Code Here

Examples of org.eclipse.jface.bindings.TriggerSequence.format()

  }

  private String getLabelWithBinding(String id, String label, boolean forToolTip) {
    TriggerSequence binding = fBindingService.getBestActiveBindingFor(id);
    if (binding != null)
      return forToolTip ? (NLS.bind(Messages.CoolBarAdvisor_LABEL_KEY, label, binding.format())) : (NLS.bind(Messages.CoolBarAdvisor_LABEL_TAB_KEY, label, binding.format()));

    return label;
  }
}
View Full Code Here

Examples of org.eclipse.jface.bindings.keys.KeySequence.format()

      return null; // couldn't find a suitable key binding
    }

    return MessageFormat.format(Util.translateString(RESOURCE_BUNDLE,
        "openPreferencePage"), //$NON-NLS-1$
        new Object[] { keySequence.format() });
  }

  /**
   * Creates the content area for the key assistant. This creates a table and
   * places it inside the composite. The composite will contain a list of all
View Full Code Here

Examples of org.eclipse.jface.bindings.keys.KeyStroke.format()

        ControlDecoration decPattern = new ControlDecoration(txtName, SWT.LEFT | SWT.TOP, mainComposite);
        decPattern.setImage(assistDecor.getImage());
        if (assistKeyStroke == null) {
            decPattern.setDescriptionText("Content assist is available. Start typing to activate");
        } else {
            decPattern.setDescriptionText(MessageFormat.format("Content assist is available. Press {0} or start typing to activate", assistKeyStroke.format()));
        }
        decPattern.setShowHover(true);
        decPattern.setShowOnlyOnFocus(true);

        PkgPatternsProposalProvider proposalProvider = new PkgPatternsProposalProvider(new FormPartJavaSearchContext(this));
View Full Code Here

Examples of org.eclipse.jface.text.IDocumentExtension4.format()

          if (fContentFormatter instanceof IContentFormatterExtension) {
            IContentFormatterExtension extension = (IContentFormatterExtension) fContentFormatter;
            IFormattingContext context = new FormattingContext();
            context.setProperty(FormattingContextProperties.CONTEXT_DOCUMENT, Boolean.valueOf(formatDocument));
            context.setProperty(FormattingContextProperties.CONTEXT_REGION, region);
            extension.format(document, context);
          }
          else {
            fContentFormatter.format(document, region);
          }
        }
View Full Code Here

Examples of org.eclipse.jface.text.formatter.IContentFormatter.format()

      if (document != null) {
        Region region = new Region(0, document.getLength());
        IContentFormatter formatter = getFormatter();
        if (formatter != null)
          formatter.format(document, region);
      }

    } catch (Exception e) {
      PHPCorePlugin.log(e);
    } finally {
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.