private ITypedElement getParent(char type) { Object input= getInput(); if (input instanceof IDiffElement) { IDiffContainer parent= ((IDiffElement) input).getParent(); return Utilities.getLeg(type, parent); } return null; }
private ITypedElement getParent(char type) { Object input= getInput(); if (input instanceof IDiffElement) { IDiffContainer parent= ((IDiffElement)input).getParent(); return Utilities.getLeg(type, parent); } return null; }
private IDocument getElementDocument(char type, Object element) { if (element instanceof IDocument) { return (IDocument) element; } ITypedElement te= Utilities.getLeg(type, element); // First check the contributors for the document IDocument document = null; switch (type) { case ANCESTOR_CONTRIBUTOR: document = getDocument(te, fAncestorContributor); break; case LEFT_CONTRIBUTOR: document = getDocument(te, fLeftContributor); break; case RIGHT_CONTRIBUTOR: document = getDocument(te, fRightContributor); break; default: break; } if (document != null) return document; // The document is not associated with the input of the viewer so try to find the document return Utilities.getDocument(type, element, isUsingDefaultContentProvider(), canHaveSharedDocument()); }
public static IDocument getDocument(char type, Object element, boolean isUsingDefaultContentProvider, boolean canHaveSharedDocument) { ITypedElement te= getLeg(type, element); if (te == null) return null; if (te instanceof IDocument) return (IDocument) te; if (te instanceof IDocumentRange) return ((IDocumentRange) te).getDocument(); if (isUsingDefaultContentProvider && canHaveSharedDocument) { ISharedDocumentAdapter sda = Adapters.adapt(te, ISharedDocumentAdapter.class); if (sda != null) { IEditorInput input= sda.getDocumentKey(te); if (input != null) { IDocumentProvider provider = SharedDocumentAdapter.getDocumentProvider(input); if (provider != null) return provider.getDocument(input); } } } if (te instanceof IStreamContentAccessor) return DocumentManager.get(te); return null; }
private IDocument getElementDocument(char type, Object element) { if (element instanceof IDocument) { return (IDocument) element; } ITypedElement te= Utilities.getLeg(type, element); // First check the contributors for the document IDocument document = null; switch (type) { case ANCESTOR_CONTRIBUTOR: document = getDocument(te, fAncestorContributor); break; case LEFT_CONTRIBUTOR: document = getDocument(te, fLeftContributor); break; case RIGHT_CONTRIBUTOR: document = getDocument(te, fRightContributor); break; } if (document != null) return document; // The document is not associated with the input of the viewer so try to find the document return Utilities.getDocument(type, element, isUsingDefaultContentProvider(), canHaveSharedDocument()); }
public static IDocument getDocument(char type, Object element, boolean isUsingDefaultContentProvider, boolean canHaveSharedDocument) { ITypedElement te= getLeg(type, element); if (te == null) return null; if (te instanceof IDocument) return (IDocument) te; if (te instanceof IDocumentRange) return ((IDocumentRange) te).getDocument(); if (te instanceof IStreamContentAccessor) return DocumentManager.get(te); if (isUsingDefaultContentProvider && canHaveSharedDocument) { ISharedDocumentAdapter sda = (ISharedDocumentAdapter)Utilities.getAdapter(te, ISharedDocumentAdapter.class, true); if (sda != null) { IEditorInput input = sda.getDocumentKey(element); if (input != null) { IDocumentProvider provider = SharedDocumentAdapter.getDocumentProvider(input); if (provider != null) return provider.getDocument(input); } } } return null; }