当前位置: 首页>>代码示例>>Java>>正文


Java IContentFormatter类代码示例

本文整理汇总了Java中org.eclipse.jface.text.formatter.IContentFormatter的典型用法代码示例。如果您正苦于以下问题:Java IContentFormatter类的具体用法?Java IContentFormatter怎么用?Java IContentFormatter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IContentFormatter类属于org.eclipse.jface.text.formatter包,在下文中一共展示了IContentFormatter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getContentFormatter

import org.eclipse.jface.text.formatter.IContentFormatter; //导入依赖的package包/类
public IContentFormatter getContentFormatter( ISourceViewer sourceViewer){
    ContentFormatter formatter = new ContentFormatter();
    XMLFormattingStrategy formattingStrategy = new XMLFormattingStrategy();
    DefaultFormattingStrategy defaultStrategy = new DefaultFormattingStrategy();
    TextFormattingStrategy textStrategy = new TextFormattingStrategy();
    DocTypeFormattingStrategy doctypeStrategy = new DocTypeFormattingStrategy();
    PIFormattingStrategy piStrategy = new PIFormattingStrategy();
    formatter.setFormattingStrategy(defaultStrategy,
            IDocument.DEFAULT_CONTENT_TYPE);
    formatter.setFormattingStrategy(textStrategy,
            XMLPartitionScanner.XML_TEXT);
    formatter.setFormattingStrategy(doctypeStrategy,
            XMLPartitionScanner.XML_DOCTYPE);
    formatter.setFormattingStrategy(piStrategy, XMLPartitionScanner.XML_PI);
    formatter.setFormattingStrategy(textStrategy,
            XMLPartitionScanner.XML_CDATA);
    formatter.setFormattingStrategy(formattingStrategy,
            XMLPartitionScanner.XML_START_TAG);
    formatter.setFormattingStrategy(formattingStrategy,
            XMLPartitionScanner.XML_END_TAG);
    
    return formatter;
}
 
开发者ID:nextinterfaces,项目名称:http4e,代码行数:24,代码来源:XMLConfiguration.java

示例2: getContentFormatter

import org.eclipse.jface.text.formatter.IContentFormatter; //导入依赖的package包/类
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
	ContentFormatter formatter = new ContentFormatter();
	XMLFormattingStrategy formattingStrategy = new XMLFormattingStrategy();
	DefaultFormattingStrategy defaultStrategy = new DefaultFormattingStrategy();
	TextFormattingStrategy textStrategy = new TextFormattingStrategy();
	DocTypeFormattingStrategy doctypeStrategy = new DocTypeFormattingStrategy();
	PIFormattingStrategy piStrategy = new PIFormattingStrategy();
	formatter.setFormattingStrategy(defaultStrategy, IDocument.DEFAULT_CONTENT_TYPE);
	formatter.setFormattingStrategy(textStrategy, XMLPartitionScanner.XML_TEXT);
	formatter.setFormattingStrategy(doctypeStrategy, XMLPartitionScanner.XML_DOCTYPE);
	formatter.setFormattingStrategy(piStrategy, XMLPartitionScanner.XML_PI);
	formatter.setFormattingStrategy(textStrategy, XMLPartitionScanner.XML_CDATA);
	formatter.setFormattingStrategy(formattingStrategy, XMLPartitionScanner.XML_START_TAG);
	formatter.setFormattingStrategy(formattingStrategy, XMLPartitionScanner.XML_END_TAG);

	return formatter;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:18,代码来源:XMLConfiguration.java

示例3: getContentFormatter

import org.eclipse.jface.text.formatter.IContentFormatter; //导入依赖的package包/类
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
	MultiPassContentFormatter formatter = new MultiPassContentFormatter(
			getConfiguredDocumentPartitioning(sourceViewer),
			IDocument.DEFAULT_CONTENT_TYPE);

	formatter.setMasterStrategy(new NCLDocumentFormattingStrategy());
	return formatter;
}
 
开发者ID:ncleclipse,项目名称:ncl30-eclipse,代码行数:9,代码来源:NCLConfiguration.java

示例4: getContentFormatter

import org.eclipse.jface.text.formatter.IContentFormatter; //导入依赖的package包/类
@Override
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
	if (fConfigureFormatter)
		return super.getContentFormatter(sourceViewer);
	else
		return null;
}
 
开发者ID:grosenberg,项目名称:fluentmark,代码行数:8,代码来源:FluentMkSimpleSourceViewerConfiguration.java

示例5: createFormatter

import org.eclipse.jface.text.formatter.IContentFormatter; //导入依赖的package包/类
public static IContentFormatter createFormatter(String partitioning) {
  /*
   * Ideally, we would have no master strategy and two slave strategies, one
   * for XML and one for CSS. The problem is, XMLFormattingStrategy won't work
   * properly since some paired opening and closing tags are spread across
   * different partitions (for example, the <ui:style> tag since the CSS
   * partition will be between the opening and closing tag.)
   */
  IndependentMultiPassContentFormatter formatter = new IndependentMultiPassContentFormatter(
      partitioning, IXMLPartitions.XML_DEFAULT, new StructuredDocumentCloner(
          partitioning, UIBINDER_XML_PARTITIONER_FACTORY));
  formatter.setMasterStrategy(new XMLFormattingStrategy());
  formatter.setSlaveStrategy2(new InlinedCssFormattingStrategy(),
      ICSSPartitions.STYLE);

  /*
   * If the <ui:style> contains a '%' (for example, in something like
   * "width: 50%;"), the XML following the <ui:style> tag will not be
   * formatted. For the '%', the region type is UNDEFINED, and there is no
   * corresponding DOM node. Before formatting, the
   * DefaultXMLPartitionFormatter ensures the current region matches the
   * current DOM node's first region, and since there is no DOM node for the
   * UNDEFINED region, the formatting abruptly stops. To workaround this
   * issue, we replace the CSS with whitespace when the master formatter runs.
   */
  formatter.setReplaceSlavePartitionsDuringMasterFormat(true);

  formatter.setCheckForNonwhitespaceChanges(true);

  return formatter;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:32,代码来源:UiBinderFormatter.java

示例6: getContentFormatter

import org.eclipse.jface.text.formatter.IContentFormatter; //导入依赖的package包/类
@Override
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
  IndependentMultiPassContentFormatter formatter = new IndependentMultiPassContentFormatter(
      getConfiguredDocumentPartitioning(sourceViewer),
      IDocument.DEFAULT_CONTENT_TYPE, JAVA_DOCUMENT_CLONER);
  formatter.setMasterStrategy(new JavaFormattingStrategy());
  formatter.setSlaveStrategy2(new JsniFormattingStrategy(),
      GWTPartitions.JSNI_METHOD);
  return formatter;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:11,代码来源:GWTSourceViewerConfiguration.java

示例7: doFormatPreview

import org.eclipse.jface.text.formatter.IContentFormatter; //导入依赖的package包/类
@Override
protected void doFormatPreview() {
       if (fPreviewText == null) {
           fPreviewDocument.set(""); //$NON-NLS-1$
           return;
       }
       fPreviewDocument.set(fPreviewText);

	fSourceViewer.setRedraw(false);
	final IFormattingContext context = new JavaFormattingContext();
	try {
		final IContentFormatter formatter =	fViewerConfiguration.getContentFormatter(fSourceViewer);
		if (formatter instanceof IContentFormatterExtension) {
			final IContentFormatterExtension extension = (IContentFormatterExtension) formatter;
			context.setProperty(FormattingContextProperties.CONTEXT_PREFERENCES, fWorkingValues);
			context.setProperty(FormattingContextProperties.CONTEXT_DOCUMENT, Boolean.valueOf(true));
			extension.format(fPreviewDocument, context);
		} else
			formatter.format(fPreviewDocument, new Region(0, fPreviewDocument.getLength()));
	} catch (Exception e) {
		final IStatus status= new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IJavaStatusConstants.INTERNAL_ERROR,
			FormatterMessages.JavaPreview_formatter_exception, e);
		JavaPlugin.log(status);
	} finally {
	    context.dispose();
	    fSourceViewer.setRedraw(true);
	}
   }
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:29,代码来源:CompilationUnitPreview.java

示例8: getContentFormatter

import org.eclipse.jface.text.formatter.IContentFormatter; //导入依赖的package包/类
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
  ContentFormatter formatter = new ContentFormatter();
  ExampleFormattingStrategy formattingStrategy = new ExampleFormattingStrategy(editor);
  formatter.setFormattingStrategy(formattingStrategy, IDocument.DEFAULT_CONTENT_TYPE);

  return formatter;
}
 
开发者ID:joereddington,项目名称:EclipseEditorPluginExample,代码行数:8,代码来源:ExampleSourceViewerConfig.java

示例9: getContentFormatter

import org.eclipse.jface.text.formatter.IContentFormatter; //导入依赖的package包/类
@Override
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
  if (configureFormatter)
    return super.getContentFormatter(sourceViewer);
  else
    return null;
}
 
开发者ID:chromium,项目名称:eclipse-gn,代码行数:8,代码来源:SimpleGnSourceViewerConfiguration.java

示例10: getContentFormatter

import org.eclipse.jface.text.formatter.IContentFormatter; //导入依赖的package包/类
@Override
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
	IEditorInput input = getEditor().getEditorInput();
	return input != null ? new TypeScriptContentFormatter(EditorUtils.getResource(input)) : null;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:6,代码来源:TypeScriptSourceViewerConfiguration.java

示例11: getContentFormatter

import org.eclipse.jface.text.formatter.IContentFormatter; //导入依赖的package包/类
@Override
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
	return null;
}
 
开发者ID:cplutte,项目名称:bts,代码行数:5,代码来源:ReadOnlySourceViewerConfiguration.java

示例12: getContentFormatter

import org.eclipse.jface.text.formatter.IContentFormatter; //导入依赖的package包/类
@Override
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
	if (contentFormatterFactory != null)
		return contentFormatterFactory.createConfiguredFormatter(this, sourceViewer);
	return super.getContentFormatter(sourceViewer);
}
 
开发者ID:cplutte,项目名称:bts,代码行数:7,代码来源:XtextSourceViewerConfiguration.java

示例13: createConfiguredFormatter

import org.eclipse.jface.text.formatter.IContentFormatter; //导入依赖的package包/类
public IContentFormatter createConfiguredFormatter(
		SourceViewerConfiguration configuration, ISourceViewer sourceViewer) {
	return new ContentFormatter();
}
 
开发者ID:cplutte,项目名称:bts,代码行数:5,代码来源:ContentFormatterFactory.java

示例14: getContentFormatter

import org.eclipse.jface.text.formatter.IContentFormatter; //导入依赖的package包/类
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
  return null;
}
 
开发者ID:JuliaComputing,项目名称:JuliaDT,代码行数:4,代码来源:JuliaSourceViewerConfiguration.java

示例15: getContentFormatter

import org.eclipse.jface.text.formatter.IContentFormatter; //导入依赖的package包/类
@Override
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
  return UiBinderFormatter.createFormatter(getConfiguredDocumentPartitioning(sourceViewer));
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:5,代码来源:UiBinderXmlSourceViewerConfiguration.java


注:本文中的org.eclipse.jface.text.formatter.IContentFormatter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。