Ejemplo n.º 1
0
  private void savePubspecFile(IContainer container) {
    IResource resource = container.findMember(DartCore.PUBSPEC_FILE_NAME);
    if (resource != null) {
      IEditorPart editor = EditorUtility.isOpenInEditor(resource);
      if (editor != null && editor.isDirty()) {
        if (MessageDialog.openQuestion(
            getShell(),
            NLS.bind(ActionMessages.RunPubAction_commandText, command),
            ActionMessages.RunPubAction_savePubspecMessage)) {

          editor.doSave(new NullProgressMonitor());
        }
      }
    }
  }
 @Override
 public void run(IMarker marker) {
   try {
     IEditorPart part = EditorUtility.isOpenInEditor(unit);
     if (part == null) {
       part = DartUI.openInEditor(unit, true, false);
       if (part instanceof ITextEditor) {
         ((ITextEditor) part).selectAndReveal(offset, length);
       }
     }
     if (part != null) {
       IEditorInput input = part.getEditorInput();
       IDocument doc = getDocumentProvider().getDocument(input);
       proposal.apply(doc);
     }
   } catch (CoreException e) {
     DartToolsPlugin.log(e);
   }
 }