use of org.eclipse.jface.text.formatter.IContentFormatter in project linuxtools by eclipse.
the class GNUEditorConfiguration method getContentFormatter.
/**
* Set content formatter. For ChangeLog, it just wraps lines.
*/
@Override
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
ContentFormatter cf = new ContentFormatter();
// no partitions
cf.enablePartitionAwareFormatting(false);
ChangeLogFormattingStrategy cfs = new ChangeLogFormattingStrategy();
cf.setFormattingStrategy(cfs, IDocument.DEFAULT_CONTENT_TYPE);
return cf;
}
use of org.eclipse.jface.text.formatter.IContentFormatter in project webtools.sourceediting by eclipse.
the class StructuredTextViewerConfigurationXML method getContentFormatter.
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
IContentFormatter formatter = super.getContentFormatter(sourceViewer);
// generic one
if (!(formatter instanceof MultiPassContentFormatter))
formatter = new MultiPassContentFormatter(getConfiguredDocumentPartitioning(sourceViewer), IXMLPartitions.XML_DEFAULT);
((MultiPassContentFormatter) formatter).setMasterStrategy(new XMLFormattingStrategy());
return formatter;
}
use of org.eclipse.jface.text.formatter.IContentFormatter in project webtools.sourceediting by eclipse.
the class StructuredTextViewerConfiguration method getContentFormatter.
/**
* Returns the content formatter ready to be used with the given source
* viewer.
* <p>
* It is not recommended that clients override this method as it may
* become <code>final</code> in the future and replaced by an extensible
* framework.
* </p>
*
* @param sourceViewer
* the source viewer to be configured by this configuration
* @return a content formatter or <code>null</code> if formatting should
* not be supported
*/
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
// try to use the StructuredTextMultiPassContentFormatter so that it
// picks up any additional formatting strategies contributed via the
// editorConfiguration extension point
IContentFormatter formatter = null;
if (sourceViewer != null) {
IDocument document = sourceViewer.getDocument();
if (document instanceof IDocumentExtension3) {
String partitioning = getConfiguredDocumentPartitioning(sourceViewer);
IDocumentPartitioner partitioner = ((IDocumentExtension3) document).getDocumentPartitioner(partitioning);
if (partitioner instanceof StructuredTextPartitioner) {
String defaultPartitionType = ((StructuredTextPartitioner) partitioner).getDefaultPartitionType();
formatter = new StructuredTextMultiPassContentFormatter(partitioning, defaultPartitionType);
}
}
}
return formatter;
}
use of org.eclipse.jface.text.formatter.IContentFormatter in project dbeaver by serge-rider.
the class XMLSourceViewerConfiguration method getContentFormatter.
@Override
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
ContentFormatter formatter = new ContentFormatter();
formatter.setDocumentPartitioning(IDocument.DEFAULT_CONTENT_TYPE);
IFormattingStrategy formattingStrategy = new XMLFormattingStrategy();
formatter.setFormattingStrategy(formattingStrategy, IDocument.DEFAULT_CONTENT_TYPE);
formatter.enablePartitionAwareFormatting(false);
return formatter;
}
use of org.eclipse.jface.text.formatter.IContentFormatter in project dbeaver by serge-rider.
the class JSONSourceViewerConfiguration method getContentFormatter.
@Override
public IContentFormatter getContentFormatter(ISourceViewer sourceViewer) {
ContentFormatter formatter = new ContentFormatter();
formatter.setDocumentPartitioning(IDocument.DEFAULT_CONTENT_TYPE);
IFormattingStrategy formattingStrategy = new JSONFormattingStrategy(sourceViewer, this);
formatter.setFormattingStrategy(formattingStrategy, IDocument.DEFAULT_CONTENT_TYPE);
formatter.enablePartitionAwareFormatting(false);
return formatter;
}
Aggregations