下面列出了怎么用org.eclipse.jface.text.IDocumentExtension3的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
protected void openPresentation(final XtextEditor editor, final IJavaElement javaElement,
final EObject selectedElement) {
final ISourceViewer sourceViewer = editor.getInternalSourceViewer();
ITextRegion significantTextRegion = locationInFileProvider.getSignificantTextRegion(selectedElement);
InformationPresenter presenter = new HierarchyInformationPresenter(sourceViewer, javaElement, new Region(significantTextRegion.getOffset(),significantTextRegion.getLength()));
presenter.setDocumentPartitioning(IDocumentExtension3.DEFAULT_PARTITIONING);
presenter.setAnchor(AbstractInformationControlManager.ANCHOR_GLOBAL);
IInformationProvider provider = new JavaElementProvider(editor, false);
presenter.setInformationProvider(provider, IDocument.DEFAULT_CONTENT_TYPE);
presenter.setInformationProvider(provider, IJavaPartitions.JAVA_DOC);
presenter.setInformationProvider(provider, IJavaPartitions.JAVA_MULTI_LINE_COMMENT);
presenter.setInformationProvider(provider, IJavaPartitions.JAVA_SINGLE_LINE_COMMENT);
presenter.setInformationProvider(provider, IJavaPartitions.JAVA_STRING);
presenter.setInformationProvider(provider, IJavaPartitions.JAVA_CHARACTER);
presenter.setSizeConstraints(50, 20, true, false);
presenter.install(sourceViewer);
presenter.showInformation();
}
protected void openQuickHierarchy(ITextViewer textViewer, IJavaElement element, IRegion region) {
HierarchyInformationPresenter presenter = new HierarchyInformationPresenter((ISourceViewer) textViewer,
element, region);
presenter.setDocumentPartitioning(IDocumentExtension3.DEFAULT_PARTITIONING);
presenter.setAnchor(AbstractInformationControlManager.ANCHOR_GLOBAL);
IInformationProvider provider = new JavaElementProvider(null, false);
presenter.setInformationProvider(provider, IDocument.DEFAULT_CONTENT_TYPE);
presenter.setInformationProvider(provider, IJavaPartitions.JAVA_DOC);
presenter.setInformationProvider(provider, IJavaPartitions.JAVA_MULTI_LINE_COMMENT);
presenter.setInformationProvider(provider, IJavaPartitions.JAVA_SINGLE_LINE_COMMENT);
presenter.setInformationProvider(provider, IJavaPartitions.JAVA_STRING);
presenter.setInformationProvider(provider, IJavaPartitions.JAVA_CHARACTER);
presenter.setSizeConstraints(50, 20, true, false);
presenter.install(textViewer);
presenter.showInformation();
}
/**
* Should not add imports when pasting into a {@link XStringLiteral} or Comments (except of JavaDoc)
*
* @param document
* - {@link IDocument} to work with
* @param caretOffset
* - current caret offset
*/
protected boolean shouldAddImports(IDocument document, int caretOffset) {
if (caretOffset == 0) {
return true;
}
String typeRight = IDocument.DEFAULT_CONTENT_TYPE;
String typeLeft = IDocument.DEFAULT_CONTENT_TYPE;
try {
typeRight = TextUtilities.getContentType(document, IDocumentExtension3.DEFAULT_PARTITIONING, caretOffset,
false);
typeLeft = TextUtilities.getContentType(document, IDocumentExtension3.DEFAULT_PARTITIONING,
caretOffset > 0 ? caretOffset - 1 : caretOffset, false);
} catch (BadLocationException exception) {
// Should not happen
}
if (COMMENT_PARTITION.equals(typeRight) || STRING_LITERAL_PARTITION.equals(typeRight)
|| SL_COMMENT_PARTITION.equals(typeRight) || "__rich_string".equals(typeRight)) {
if (typeLeft.equals(typeRight))
return false;
}
return true;
}
@Override
protected IDocument createDocument(Object element) throws CoreException {
IDocument document = super.createDocument(element);
//IDocumentPartitioner partitioner = createDocumentPartitioner();
IDocumentPartitioner partitioner = new ImpexDocumentPartitioner();
if ((document instanceof IDocumentExtension3)) {
IDocumentExtension3 extension3 = (IDocumentExtension3) document;
extension3.setDocumentPartitioner(Activator.IMPEX_PARTITIONING, partitioner);
}
else {
document.setDocumentPartitioner(partitioner);
}
partitioner.connect(document);
return document;
}
/**
* Sets document's partitioner.
*
* @param document the document to be processed
* @param partitioningType the partitioning for which to set the partitioner
* @param partitioner the document's new partitioner
*
* @see org.eclipse.jface.text.IDocumentExtension3#setDocumentPartitioner(IDocument,String,IDocumentPartitioner)
* @see IDocumentPartitioningListener
*/
public static void setDocumentPartitioning( IDocument document
, String partitioningType
, IDocumentPartitioner partitioner )
{
// Setting the partitioner will trigger a partitionChanged listener that
// will attempt to use the partitioner to initialize the document's
// partitions. Therefore, need to connect first.
partitioner.connect(document);
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3= (IDocumentExtension3) document;
extension3.setDocumentPartitioner(partitioningType, partitioner);
} else {
document.setDocumentPartitioner(partitioner);
}
}
public boolean isWordStart(char c) {
if ('=' != c && ':' != c || fDocument == null)
return false;
try {
// check whether it is the first '=' in the logical line
int i=fOffset-2;
while (Character.isWhitespace(fDocument.getChar(i))) {
i--;
}
ITypedRegion partition= null;
if (fDocument instanceof IDocumentExtension3)
partition= ((IDocumentExtension3)fDocument).getPartition(IPropertiesFilePartitions.PROPERTIES_FILE_PARTITIONING, i, false);
return partition != null && IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType());
} catch (BadLocationException ex) {
return false;
} catch (BadPartitioningException e) {
return false;
}
}
@Override
protected void runInternal(ITextSelection selection, IDocumentExtension3 docExtension, Edit.EditFactory factory) throws BadLocationException, BadPartitioningException {
int selectionOffset= selection.getOffset();
int selectionEndOffset= selectionOffset + selection.getLength();
List<Edit> edits= new LinkedList<Edit>();
ITypedRegion partition= docExtension.getPartition(IJavaPartitions.JAVA_PARTITIONING, selectionOffset, false);
handleFirstPartition(partition, edits, factory, selectionOffset);
while (partition.getOffset() + partition.getLength() < selectionEndOffset) {
partition= handleInteriorPartition(partition, edits, factory, docExtension);
}
handleLastPartition(partition, edits, factory, selectionEndOffset);
executeEdits(edits);
}
@Override
public boolean isWordStart(char c) {
if ('=' != c && ':' != c || fDocument == null)
return false;
try {
// check whether it is the first '=' in the logical line
int i = fOffset - 2;
while (Character.isWhitespace(fDocument.getChar(i))) {
i--;
}
ITypedRegion partition = null;
if (fDocument instanceof IDocumentExtension3)
partition = ((IDocumentExtension3) fDocument)
.getPartition(IEditorConfigPartitions.EDITOR_CONFIG_PARTITIONING, i, false);
return partition != null && IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType());
} catch (BadLocationException ex) {
return false;
} catch (BadPartitioningException e) {
return false;
}
}
@Override
public boolean isWordStart(char c) {
if ('=' != c && ':' != c || fDocument == null)
return false;
try {
// check whether it is the first '=' in the logical line
int i = fOffset - 2;
while (Character.isWhitespace(fDocument.getChar(i))) {
i--;
}
ITypedRegion partition = null;
if (fDocument instanceof IDocumentExtension3)
partition = ((IDocumentExtension3) fDocument)
.getPartition(IEditorConfigPartitions.EDITOR_CONFIG_PARTITIONING, i, false);
return partition != null && IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType());
} catch (BadLocationException ex) {
return false;
} catch (BadPartitioningException e) {
return false;
}
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static String[] getAllDocumentContentTypes(IDocument document) throws BadPartitioningException {
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 ext = (IDocumentExtension3) document;
String[] partitionings = ext.getPartitionings();
Set contentTypes = new HashSet();
contentTypes.add(IDocument.DEFAULT_CONTENT_TYPE);
int len = partitionings.length;
for (int i = 0; i < len; i++) {
String[] legalContentTypes = ext.getLegalContentTypes(partitionings[i]);
int len2 = legalContentTypes.length;
for (int j = 0; j < len2; j++) {
contentTypes.add(legalContentTypes[j]);
}
contentTypes.addAll(Arrays.asList(legalContentTypes));
}
return (String[]) contentTypes.toArray(new String[contentTypes.size()]);
}
return document.getLegalContentTypes();
}
/**
* Checks if the partitioner is correctly set in the document.
* @return the partitioner that is set in the document
*/
public static IDocumentPartitioner checkPartitionScanner(IDocument document,
IGrammarVersionProvider grammarVersionProvider) {
if (document == null) {
return null;
}
IDocumentExtension3 docExtension = (IDocumentExtension3) document;
IDocumentPartitioner partitioner = docExtension.getDocumentPartitioner(IPythonPartitions.PYTHON_PARTITION_TYPE);
if (partitioner == null) {
addPartitionScanner(document, grammarVersionProvider);
//get it again for the next check
partitioner = docExtension.getDocumentPartitioner(IPythonPartitions.PYTHON_PARTITION_TYPE);
}
if (!(partitioner instanceof PyPartitioner)) {
Log.log("Partitioner should be subclass of PyPartitioner. It is " + partitioner.getClass());
}
return partitioner;
}
/**
* @see http://help.eclipse.org/help31/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/editors_documents.htm
* @see http://jroller.com/page/bobfoster - Saturday July 16, 2005
* @param document the document where we want to add the partitioner
* @return the added document partitioner (or null)
*/
public static IDocumentPartitioner addPartitionScanner(IDocument document,
IGrammarVersionProvider grammarVersionProvider) {
if (document != null) {
IDocumentExtension3 docExtension = (IDocumentExtension3) document;
IDocumentPartitioner curr = docExtension.getDocumentPartitioner(IPythonPartitions.PYTHON_PARTITION_TYPE);
if (curr == null) {
//set the new one
PyPartitioner partitioner = createPyPartitioner();
partitioner.connect(document);
docExtension.setDocumentPartitioner(IPythonPartitions.PYTHON_PARTITION_TYPE, partitioner);
return partitioner;
} else {
return curr;
}
}
return null;
}
protected AbstractDocumentScanner(IDocument document, String partitioning, String contentType) {
this.document = assertNotNull(document);
this.partitioning = partitioning;
this.source = document.get();
if(partitioning == null) {
this.contentType = IDocument.DEFAULT_CONTENT_TYPE;
this.documentExt3 = null;
this.partitioner = null;
} else {
Assert.isLegal(partitioning != null);
Assert.isLegal(contentType != null);
this.contentType = contentType;
this.documentExt3 = tryCast(document, IDocumentExtension3.class);
Assert.isLegal(documentExt3 != null, "document must support IDocumentExtension3");
this.partitioner = documentExt3.getDocumentPartitioner(partitioning);
Assert.isLegal(partitioner != null, "document must have a partitioner for " + partitioning);
}
}
@Override
protected int getLineStartPosition(final IDocument document, final String line, final int length,
final int offset) {
String type = IDocument.DEFAULT_CONTENT_TYPE;
try {
type = TextUtilities.getContentType(document, IDocumentExtension3.DEFAULT_PARTITIONING, offset, false);
} catch (BadLocationException exception) {
// Should not happen
}
int lineStartPosition = super.getLineStartPosition(document, line, length, offset);
if (tokenTypeToPartitionTypeMapperExtension.isMultiLineComment(type)
|| tokenTypeToPartitionTypeMapperExtension.isSingleLineComment(type)) {
try {
IRegion lineInformation = document.getLineInformationOfOffset(offset);
int offsetInLine = offset - lineInformation.getOffset();
return getCommentLineStartPosition(line, length, offsetInLine, lineStartPosition);
} catch(BadLocationException e) {
// Should not happen
}
}
if (type.equals(IDocument.DEFAULT_CONTENT_TYPE)) {
if (isStartOfSingleLineComment(line, length, lineStartPosition) && !isStartOfMultiLineComment(line, length, lineStartPosition)) {
return getTextStartPosition(line, length, lineStartPosition + 1);
}
}
return lineStartPosition;
}
public void setup(IDocument document) {
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3 = (IDocumentExtension3) document;
IDocumentPartitioner partitioner =
new FastPartitioner(new BibPartitionScanner(), BibPartitionScanner.BIB_PARTITION_TYPES);
extension3.setDocumentPartitioner(BibEditor.BIB_PARTITIONING, partitioner);
partitioner.connect(document);
}
}
public void setup(IDocument document) {
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3= (IDocumentExtension3) document;
IDocumentPartitioner partitioner =
new FastPartitioner(
new FastLaTeXPartitionScanner(),
FastLaTeXPartitionScanner.TEX_PARTITION_TYPES);
extension3.setDocumentPartitioner(TexEditor.TEX_PARTITIONING, partitioner);
partitioner.connect(document);
}
}
public void customizeDocumentCommand(IDocument document, DocumentCommand command) {
if (this.indent) {
if (itemSetted && autoItem && command.length == 0 && command.text != null
&& TextUtilities.endsWith(document.getLegalLineDelimiters(), command.text) != -1) {
dropItem(document, command);
} else if (command.length == 0 && command.text != null
&& TextUtilities.endsWith(document.getLegalLineDelimiters(), command.text) != -1) {
smartIndentAfterNewLine(document, command);
} else if ("}".equals(command.text)) {
smartIndentAfterBrace(document, command);
} else {
itemSetted = false;
}
}
if (TexAutoIndentStrategy.hardWrap && command.length == 0 && command.text != null) {
try {
final String contentType = ((IDocumentExtension3) document).getContentType(
TexEditor.TEX_PARTITIONING, command.offset, true);
// Do not wrap in verbatim partitions
if (!FastLaTeXPartitionScanner.TEX_VERBATIM.equals(contentType)) {
hlw.doWrapB(document, command, lineLength);
}
}
catch (Exception e) {
// If we cannot retrieve the current content type, do not break lines
}
}
}
/**
* Returns the partitioner for the given partitioning or <code>null</code> if
* no partitioner is registered.
*
* @param document the document to be processed
* @param partitioningType the partitioning for which to set the partitioner
* @return the partitioner for the given partitioning
*
* @see org.eclipse.jface.text.IDocumentExtension3#getDocumentPartitioner(IDocument,String)
*/
public static IDocumentPartitioner getPartitioner( IDocument document
, String partitioningType )
{
IDocumentPartitioner result = null;
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension = (IDocumentExtension3) document;
result = extension.getDocumentPartitioner(partitioningType);
} else if (document != null){
result = document.getDocumentPartitioner();
}
return result;
}
public void setup(IDocument document) {
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3= (IDocumentExtension3) document;
IDocumentPartitioner partitioner= new TLAFastPartitioner(TLAEditorActivator.getDefault().getTLAPartitionScanner(), TLAPartitionScanner.TLA_PARTITION_TYPES);
// Changed from FastPartitioner by LL on 12 Aug 2012
extension3.setDocumentPartitioner(TLAPartitionScanner.TLA_PARTITIONING, partitioner);
partitioner.connect(document);
}
}
public IStructuredDocument clone(IDocument original) {
IModelManager modelManager = StructuredModelManager.getModelManager();
String modelId = getModelId(original);
if (modelId == null) {
GWTPluginLog.logError("Could not get a model ID for the document to be formatted.");
return null;
}
/*
* The XML formatter requires a managed model (discovered by it crashing
* when given an unmanaged model.) Unfortunately, we cannot create a managed
* in-memory (i.e. non-file backed) model via IModelManager API (there is
* one method that may work, but it is deprecated.) Instead, we copy the
* existing model into a temp model with ID "temp".
*/
try {
IStructuredModel modelClone = modelManager.copyModelForEdit(modelId,
"structuredDocumentClonerModel" + nextId.getAndIncrement());
modelClone.setBaseLocation(getModelBaseLocation(original));
IStructuredDocument documentClone = modelClone.getStructuredDocument();
documentClone.set(original.get());
// Create and connect the partitioner to the document
IDocumentPartitioner tempPartitioner = documentPartitionerFactory.createDocumentPartitioner();
((IDocumentExtension3) documentClone).setDocumentPartitioner(
partitioning, tempPartitioner);
tempPartitioner.connect(documentClone);
// Save the cloned model so we can release it later
modelClones.put(documentClone, modelClone);
return documentClone;
} catch (ResourceInUse e1) {
GWTPluginLog.logError(e1,
"Could not copy the original model to be formatted.");
return null;
}
}
private boolean isUnclosedPair(char c, IDocument document, int offset) throws BadLocationException
{
// TODO Refactor and combine this copy-pasted code from PeerCharacterCloser
int beginning = 0;
// Don't check from very beginning of the document! Be smarter/quicker and check from beginning of
// partition if we can
if (document instanceof IDocumentExtension3)
{
try
{
IDocumentExtension3 ext = (IDocumentExtension3) document;
ITypedRegion region = ext.getPartition(IDocumentExtension3.DEFAULT_PARTITIONING, offset, false);
beginning = region.getOffset();
}
catch (BadPartitioningException e)
{
// ignore
}
}
// Now check leading source and see if we're an unclosed pair.
String previous = document.get(beginning, offset - beginning);
boolean open = false;
int index = -1;
while ((index = previous.indexOf(c, index + 1)) != -1)
{
open = !open;
}
return open;
}
/**
* Sets up the Java document partitioner for the given document for the given partitioning.
*
* @param document the document to be set up
* @param partitioning the document partitioning
* @since 3.0
*/
public void setupJavaDocumentPartitioner(IDocument document, String partitioning) {
IDocumentPartitioner partitioner= createDocumentPartitioner();
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3= (IDocumentExtension3) document;
extension3.setDocumentPartitioner(partitioning, partitioner);
} else {
document.setDocumentPartitioner(partitioner);
}
partitioner.connect(document);
}
/**
* @param document the document
* @see org.eclipse.core.filebuffers.IDocumentSetupParticipant#setup(org.eclipse.jface.text.IDocument)
*/
public static void setupDocument(IDocument document) {
IDocumentPartitioner partitioner= createDocumentPartitioner();
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3= (IDocumentExtension3) document;
extension3.setDocumentPartitioner(IPropertiesFilePartitions.PROPERTIES_FILE_PARTITIONING, partitioner);
} else {
document.setDocumentPartitioner(partitioner);
}
partitioner.connect(document);
}
@Override
protected void runInternal(ITextSelection selection, IDocumentExtension3 docExtension, Edit.EditFactory factory) throws BadPartitioningException, BadLocationException {
List<Edit> edits= new LinkedList<Edit>();
int tokenLength= getCommentStart().length();
int offset= selection.getOffset();
int endOffset= offset + selection.getLength();
ITypedRegion partition= docExtension.getPartition(IJavaPartitions.JAVA_PARTITIONING, offset, false);
int partOffset= partition.getOffset();
int partEndOffset= partOffset + partition.getLength();
while (partEndOffset < endOffset) {
if (partition.getType() == IJavaPartitions.JAVA_MULTI_LINE_COMMENT) {
edits.add(factory.createEdit(partOffset, tokenLength, "")); //$NON-NLS-1$
edits.add(factory.createEdit(partEndOffset - tokenLength, tokenLength, "")); //$NON-NLS-1$
}
partition= docExtension.getPartition(IJavaPartitions.JAVA_PARTITIONING, partEndOffset, false);
partOffset= partition.getOffset();
partEndOffset= partOffset + partition.getLength();
}
if (partition.getType() == IJavaPartitions.JAVA_MULTI_LINE_COMMENT) {
edits.add(factory.createEdit(partOffset, tokenLength, "")); //$NON-NLS-1$
edits.add(factory.createEdit(partEndOffset - tokenLength, tokenLength, "")); //$NON-NLS-1$
}
executeEdits(edits);
}
public static void setupDocument(IDocument document) {
IDocumentPartitioner partitioner = createDocumentPartitioner();
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3 = (IDocumentExtension3) document;
extension3.setDocumentPartitioner(IEditorConfigPartitions.EDITOR_CONFIG_PARTITIONING, partitioner);
} else {
document.setDocumentPartitioner(partitioner);
}
partitioner.connect(document);
}
public String getHoverInfo( ITextViewer textViewer, IRegion hoverRegion )
{
ScriptStackFrame frame = getFrame( );
if ( frame == null )
{
return null;
}
IDocument document = textViewer.getDocument( );
if ( document == null )
{
return null;
}
try
{
String str = TextUtilities.getContentType(document, IDocumentExtension3.DEFAULT_PARTITIONING, hoverRegion.getOffset( )+1, true);
String variableName = document.get( hoverRegion.getOffset( ),
hoverRegion.getLength( ) );
if (JSPartitionScanner.JS_KEYWORD.equals( str ) && !"this".equals( variableName )) //$NON-NLS-1$
{
return null;
}
ScriptValue var = ( (ScriptDebugTarget) frame.getDebugTarget( ) ).evaluate( frame,
variableName );
if ( var != null )
{
return getVariableText( var );
}
}
catch ( BadLocationException e )
{
return null;
}
return null;
}
/**
* @param document the document we want to get info on
* @param i the document offset we're interested in
* @return the content type at that position (according to IPythonPartitions)
*
* Uses the default if the partitioner is not set in the document (for testing purposes)
*/
public static String getContentType(IDocument document, int i) {
IDocumentExtension3 docExtension = (IDocumentExtension3) document;
IDocumentPartitionerExtension2 partitioner = (IDocumentPartitionerExtension2) docExtension
.getDocumentPartitioner(IPythonPartitions.PYTHON_PARTITION_TYPE);
if (partitioner != null) {
return partitioner.getContentType(i, true);
}
return getContentType(document.get(), i);
}
public void setupPartitioningIfNotSet(IDocument document) {
if(document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3 = (IDocumentExtension3) document;
String partitioning = TextSettings_Actual.PARTITIONING_ID;
if(extension3.getDocumentPartitioner(partitioning) == null) {
IDocumentPartitioner partitioner = createDocumentPartitioner();
partitioner.connect(document);
extension3.setDocumentPartitioner(partitioning, partitioner);
}
}
}
public static void setupDocumentPartitioner(IDocument document, String partitioning,
IDocumentPartitioner partitioner) {
assertNotNull(document);
assertNotNull(partitioning);
assertNotNull(partitioner);
partitioner.connect(document);
if (document instanceof IDocumentExtension3) {
IDocumentExtension3 extension3 = (IDocumentExtension3) document;
extension3.setDocumentPartitioner(partitioning, partitioner);
} else {
document.setDocumentPartitioner(partitioner);
}
}
public void run(IAction action) {
if (targetEditor == null) {
GWTPluginLog.logWarning("targetEditor is null");
return;
}
IEditorInput editorInput = targetEditor.getEditorInput();
IResource resource = (IResource) editorInput.getAdapter(IResource.class);
ITextEditor javaEditor = (ITextEditor) targetEditor;
ITextSelection sel = (ITextSelection) javaEditor.getSelectionProvider().getSelection();
IDocument document = javaEditor.getDocumentProvider().getDocument(
javaEditor.getEditorInput());
IDocumentExtension3 document3 = (IDocumentExtension3) document;
IDocumentPartitioner gwtPartitioner = document3.getDocumentPartitioner(GWTPartitions.GWT_PARTITIONING);
String[] partitionings = document3.getPartitionings();
String partitioning = (gwtPartitioner != null
? GWTPartitions.GWT_PARTITIONING : IJavaPartitions.JAVA_PARTITIONING);
ITypedRegion[] types;
try {
types = TextUtilities.computePartitioning(document, partitioning,
sel.getOffset(), sel.getLength(), false);
} catch (BadLocationException e) {
GWTPluginLog.logError(e);
return;
}
String msg = "File: " + resource.getName();
msg += "\nPartitionings: ";
for (String part : partitionings) {
msg += "\n" + part;
}
msg += "\n\nContent types: ";
for (ITypedRegion type : types) {
msg += "\n" + type.getType();
}
msg += "\n\nSelection range: (offset = " + sel.getOffset() + ", length = "
+ sel.getLength() + ")";
MessageDialog.openInformation(targetEditor.getSite().getShell(),
"Selection Info", msg);
}