Java 类org.eclipse.ui.texteditor.IDocumentProviderExtension 实例源码

项目:ermasterr    文件:TestEditor.java   
private void initializeSourceViewer(final IEditorInput input) {

        final IDocumentProvider documentProvider = getDocumentProvider();
        final IAnnotationModel model = documentProvider.getAnnotationModel(input);
        final IDocument document = documentProvider.getDocument(input);

        if (document != null) {
            fSourceViewer.setDocument(document, model);
            fSourceViewer.setEditable(isEditable());
            fSourceViewer.showAnnotations(model != null);
        }

        if (fElementStateListener instanceof IElementStateListenerExtension) {
            boolean isStateValidated = false;
            if (documentProvider instanceof IDocumentProviderExtension)
                isStateValidated = ((IDocumentProviderExtension) documentProvider).isStateValidated(input);

            final IElementStateListenerExtension extension = (IElementStateListenerExtension) fElementStateListener;
            extension.elementStateValidationChanged(input, isStateValidated);
        }

    }
项目:ermasterr    文件:TestEditor.java   
protected void updateState(final IEditorInput input) {
    final IDocumentProvider provider = getDocumentProvider();
    if (provider instanceof IDocumentProviderExtension) {
        final IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;
        try {

            extension.updateStateCache(input);

            if (fSourceViewer != null)
                fSourceViewer.setEditable(isEditable());

        } catch (final CoreException e) {
            ERDiagramActivator.log(e);
        }
    }
}
项目:ermaster-k    文件:TestEditor.java   
private void initializeSourceViewer(IEditorInput input) {

        IDocumentProvider documentProvider = getDocumentProvider();
        IAnnotationModel model = documentProvider.getAnnotationModel(input);
        IDocument document = documentProvider.getDocument(input);

        if (document != null) {
            fSourceViewer.setDocument(document, model);
            fSourceViewer.setEditable(isEditable());
            fSourceViewer.showAnnotations(model != null);
        }

        if (fElementStateListener instanceof IElementStateListenerExtension) {
            boolean isStateValidated = false;
            if (documentProvider instanceof IDocumentProviderExtension)
                isStateValidated = ((IDocumentProviderExtension) documentProvider)
                        .isStateValidated(input);

            IElementStateListenerExtension extension = (IElementStateListenerExtension) fElementStateListener;
            extension.elementStateValidationChanged(input, isStateValidated);
        }

    }
项目:ermaster-k    文件:TestEditor.java   
protected void updateState(IEditorInput input) {
    IDocumentProvider provider = getDocumentProvider();
    if (provider instanceof IDocumentProviderExtension) {
        IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;
        try {

            extension.updateStateCache(input);

            if (fSourceViewer != null)
                fSourceViewer.setEditable(isEditable());

        } catch (CoreException e) {
            ERDiagramActivator.log(e);
        }
    }
}
项目:ermaster-nhit    文件:TestEditor.java   
private void initializeSourceViewer(IEditorInput input) {

        IDocumentProvider documentProvider = getDocumentProvider();
        IAnnotationModel model = documentProvider.getAnnotationModel(input);
        IDocument document = documentProvider.getDocument(input);

        if (document != null) {
            fSourceViewer.setDocument(document, model);
            fSourceViewer.setEditable(isEditable());
            fSourceViewer.showAnnotations(model != null);
        }

        if (fElementStateListener instanceof IElementStateListenerExtension) {
            boolean isStateValidated = false;
            if (documentProvider instanceof IDocumentProviderExtension)
                isStateValidated = ((IDocumentProviderExtension) documentProvider)
                        .isStateValidated(input);

            IElementStateListenerExtension extension = (IElementStateListenerExtension) fElementStateListener;
            extension.elementStateValidationChanged(input, isStateValidated);
        }

    }
项目:ermaster-nhit    文件:TestEditor.java   
protected void updateState(IEditorInput input) {
    IDocumentProvider provider = getDocumentProvider();
    if (provider instanceof IDocumentProviderExtension) {
        IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;
        try {

            extension.updateStateCache(input);

            if (fSourceViewer != null)
                fSourceViewer.setEditable(isEditable());

        } catch (CoreException e) {
            ERDiagramActivator.log(e);
        }
    }
}
项目:ermasterr    文件:TestEditor.java   
public boolean isEditable() {
    final IDocumentProvider provider = getDocumentProvider();
    if (provider instanceof IDocumentProviderExtension) {
        final IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;
        return extension.isModifiable(getEditorInput());
    }
    return false;
}
项目:ermasterr    文件:TestEditor.java   
protected void validateState(final IEditorInput input) {

        final IDocumentProvider provider = getDocumentProvider();
        if (!(provider instanceof IDocumentProviderExtension))
            return;

        final IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;

        try {

            extension.validateState(input, getSite().getShell());

        } catch (final CoreException x) {
            final IStatus status = x.getStatus();
            if (status == null || status.getSeverity() != IStatus.CANCEL) {
                final Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
                final ILog log = Platform.getLog(bundle);
                log.log(x.getStatus());

                final Shell shell = getSite().getShell();
                final String title = "EditorMessages.Editor_error_validateEdit_title";
                final String msg = "EditorMessages.Editor_error_validateEdit_message";
                ErrorDialog.openError(shell, title, msg, x.getStatus());
            }
            return;
        }

        if (fSourceViewer != null)
            fSourceViewer.setEditable(isEditable());

    }
项目:ermaster-k    文件:TestEditor.java   
public boolean isEditable() {
    IDocumentProvider provider = getDocumentProvider();
    if (provider instanceof IDocumentProviderExtension) {
        IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;
        return extension.isModifiable(getEditorInput());
    }
    return false;
}
项目:ermaster-k    文件:TestEditor.java   
protected void validateState(IEditorInput input) {

        IDocumentProvider provider = getDocumentProvider();
        if (!(provider instanceof IDocumentProviderExtension))
            return;

        IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;

        try {

            extension.validateState(input, getSite().getShell());

        } catch (CoreException x) {
            IStatus status = x.getStatus();
            if (status == null || status.getSeverity() != IStatus.CANCEL) {
                Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
                ILog log = Platform.getLog(bundle);
                log.log(x.getStatus());

                Shell shell = getSite().getShell();
                String title = "EditorMessages.Editor_error_validateEdit_title";
                String msg = "EditorMessages.Editor_error_validateEdit_message";
                ErrorDialog.openError(shell, title, msg, x.getStatus());
            }
            return;
        }

        if (fSourceViewer != null)
            fSourceViewer.setEditable(isEditable());

    }
项目:ermaster-nhit    文件:TestEditor.java   
public boolean isEditable() {
    IDocumentProvider provider = getDocumentProvider();
    if (provider instanceof IDocumentProviderExtension) {
        IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;
        return extension.isModifiable(getEditorInput());
    }
    return false;
}
项目:ermaster-nhit    文件:TestEditor.java   
protected void validateState(IEditorInput input) {

        IDocumentProvider provider = getDocumentProvider();
        if (!(provider instanceof IDocumentProviderExtension))
            return;

        IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;

        try {

            extension.validateState(input, getSite().getShell());

        } catch (CoreException x) {
            IStatus status = x.getStatus();
            if (status == null || status.getSeverity() != IStatus.CANCEL) {
                Bundle bundle = Platform.getBundle(PlatformUI.PLUGIN_ID);
                ILog log = Platform.getLog(bundle);
                log.log(x.getStatus());

                Shell shell = getSite().getShell();
                String title = "EditorMessages.Editor_error_validateEdit_title";
                String msg = "EditorMessages.Editor_error_validateEdit_message";
                ErrorDialog.openError(shell, title, msg, x.getStatus());
            }
            return;
        }

        if (fSourceViewer != null)
            fSourceViewer.setEditable(isEditable());

    }
项目:APICloud-Studio    文件:AbstractFoldingEditor.java   
/**
 * This code auto-refreshes files that are out of synch when we first open them. This is a bit of a hack that looks
 * to see if it seems we're out of sync and the file isn't open yet. If it is already open, we call super so it pops
 * a dialog asking if you want to update the file contents.
 */
@Override
protected void handleEditorInputChanged()
{
    final IDocumentProvider provider = getDocumentProvider();
    if (provider == null)
    {
        // fix for http://dev.eclipse.org/bugs/show_bug.cgi?id=15066
        close(false);
        return;
    }

    final IEditorInput input = getEditorInput();
    boolean wasActivated = true;
    try
    {
        Field f = AbstractTextEditor.class.getDeclaredField("fHasBeenActivated"); //$NON-NLS-1$
        f.setAccessible(true);
        wasActivated = (Boolean) f.get(this);
    }
    catch (Exception e1)
    {
        // ignore
    }
    if (!wasActivated && !provider.isDeleted(input))
    {
        try
        {
            if (provider instanceof IDocumentProviderExtension)
            {
                IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;
                extension.synchronize(input);
            }
            else
            {
                doSetInput(input);
            }
            return;
        }
        catch (Exception e)
        {
            // ignore
        }
    }
    super.handleEditorInputChanged();
}