@Override public IEditorInput getDocumentKey(Object element) { return wrappedAdapter.getDocumentKey(element); }
public IEditorInput getDocumentKey(Object element) { return wrappedAdapter.getDocumentKey(element); }
/** * Return the document key used to obtain a shared document. A <code>null</code> * is returned in the following cases: * <ol> * <li>This contributor does not have a shared document adapter.</li> * <li>This text merge viewer has a document partitioner but uses the default partitioning.</li> * <li>This text merge viewer does not use he default content provider.</li> * </ol> * @return the document key used to obtain a shared document or <code>null</code> */ private IEditorInput getDocumentKey() { if (fDocumentKey != null) return fDocumentKey; if (isUsingDefaultContentProvider() && fElement != null && canHaveSharedDocument()) { ISharedDocumentAdapter sda = Adapters.adapt(fElement, ISharedDocumentAdapter.class); if (sda != null) { return sda.getDocumentKey(fElement); } } return null; }
/** * Return the document key used to obtain a shared document. A <code>null</code> * is returned in the following cases: * <ol> * <li>This contributor does not have a shared document adapter.</li> * <li>This text merge viewer has a document partitioner but uses the default partitioning.</li> * <li>This text merge viewer does not use he default content provider.</li> * </ol> * @return the document key used to obtain a shared document or <code>null</code> */ private IEditorInput getDocumentKey() { if (fDocumentKey != null) return fDocumentKey; if (isUsingDefaultContentProvider() && fElement != null && canHaveSharedDocument()) { ISharedDocumentAdapter sda = (ISharedDocumentAdapter)Utilities.getAdapter(fElement, ISharedDocumentAdapter.class, true); if (sda != null) { return sda.getDocumentKey(fElement); } } return null; }
IEditorInput key = sda.getDocumentKey(input); if (key != null) { IDocumentProvider provider = SharedDocumentAdapter.getDocumentProvider(key);
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; }
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; }
IEditorInput key = sda.getDocumentKey(input); if (key != null) { IDocumentProvider provider = SharedDocumentAdapter.getDocumentProvider(key);
@SuppressWarnings("unchecked") @Override public <T> T getAdapter(Class<T> adapter) { if (adapter == IDocument.class) { if (document != null) return (T) document; if (fileElement instanceof LocalResourceTypedElement) { LocalResourceTypedElement lrte = (LocalResourceTypedElement) fileElement; if (lrte.isConnected()) { ISharedDocumentAdapter sda = Adapters.adapt(lrte, ISharedDocumentAdapter.class); if (sda != null) { IEditorInput input = sda.getDocumentKey(lrte); if (input != null) { IDocumentProvider provider = SharedDocumentAdapter.getDocumentProvider(input); if (provider != null) return (T) provider.getDocument(input); } } } } } if (adapter == IEditorInput.class) { if (fileElement instanceof LocalResourceTypedElement) { LocalResourceTypedElement lrte = (LocalResourceTypedElement) fileElement; return (T) new FileEditorInput((IFile)lrte.getResource()); } } return super.getAdapter(adapter); }
public Object getAdapter(Class adapter) { if (adapter == IDocument.class) { if (document != null) return document; if (fileElement instanceof LocalResourceTypedElement) { LocalResourceTypedElement lrte = (LocalResourceTypedElement) fileElement; if (lrte.isConnected()) { ISharedDocumentAdapter sda = (ISharedDocumentAdapter)Utils.getAdapter(lrte, ISharedDocumentAdapter.class); if (sda != null) { IEditorInput input = sda.getDocumentKey(lrte); if (input != null) { IDocumentProvider provider = SharedDocumentAdapter.getDocumentProvider(input); if (provider != null) return provider.getDocument(input); } } } } } if (adapter == IEditorInput.class) { if (fileElement instanceof LocalResourceTypedElement) { LocalResourceTypedElement lrte = (LocalResourceTypedElement) fileElement; return new FileEditorInput((IFile)lrte.getResource()); } } return super.getAdapter(adapter); }
private IStructureComparator internalCreateStructure(Object element, IProgressMonitor monitor) { final ISharedDocumentAdapter sda = SharedDocumentAdapterWrapper.getAdapter(element); if (sda != null) { final IEditorInput input = sda.getDocumentKey(element); if (input != null) { final IDocumentProvider provider = SharedDocumentAdapter.getDocumentProvider(input); if (provider != null) { try { sda.connect(provider, input); IDocument document = provider.getDocument(input); setupDocument(document); return createStructureComparator(element, document, wrapSharedDocumentAdapter(sda, element, document), monitor); } catch (CoreException e) { // Connection to the document provider failed. // Log and fall through to use simple structure CompareUIPlugin.log(e); } } } } return getStructure(element); }
private IStructureComparator internalCreateStructure(Object element, IProgressMonitor monitor) { final ISharedDocumentAdapter sda = SharedDocumentAdapterWrapper.getAdapter(element); if (sda != null) { final IEditorInput input = sda.getDocumentKey(element); if (input != null) { final IDocumentProvider provider = SharedDocumentAdapter.getDocumentProvider(input); if (provider != null) { try { sda.connect(provider, input); IDocument document = provider.getDocument(input); setupDocument(document); return createStructureComparator(element, document, wrapSharedDocumentAdapter(sda, element, document), monitor); } catch (CoreException e) { // Connection to the document provider failed. // Log and fall through to use simple structure CompareUIPlugin.log(e); } } } } return getStructure(element); }