コード例 #1
0
  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());
  }
コード例 #2
0
 public boolean isEditable() {
   IDocumentProvider provider = getDocumentProvider();
   if (provider instanceof IDocumentProviderExtension) {
     IDocumentProviderExtension extension = (IDocumentProviderExtension) provider;
     return extension.isModifiable(getEditorInput());
   }
   return false;
 }
コード例 #3
0
  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) {
        Activator.log(e);
      }
    }
  }