org.openide.cookies.EditorCookie.saveDocument()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(132)

本文整理了Java中org.openide.cookies.EditorCookie.saveDocument()方法的一些代码示例,展示了EditorCookie.saveDocument()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EditorCookie.saveDocument()方法的具体详情如下:
包路径:org.openide.cookies.EditorCookie
类名称:EditorCookie
方法名:saveDocument

EditorCookie.saveDocument介绍

[英]Save the document. This is done in the current thread.
[中]保存文档。这是在当前线程中完成的。

代码示例

代码示例来源:origin: stackoverflow.com

FileObject f = ...
DataObject data = DataObject.find(f);
EditorCookie cookie = data.getLookup().lookup(EditorCookie.class);
cookie.saveDocument();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project

public boolean save() throws IOException {
  if (editorCookie == null) {
    return false;
  }
  if (editorCookie.isModified()) {
    editorCookie.saveDocument();
    return true;
  }
  return false;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-core

public void saveDocument() throws java.io.IOException {
  currentEditorCookie().saveDocument();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-navigation

/**
 * Saves file.
 *
 * @param fo - file object
 */
private static void saveFileAndMarkAsReadOnly(FileObject fo) {
  try {
    DataObject dob = DataObject.find(fo);
    EditorCookie ec = dob.getLookup().lookup(EditorCookie.class);
    ec.saveDocument();
    ReadOnlySupport ro = dob.getLookup().lookup(ReadOnlySupport.class);
    if (ro != null) {
      ro.setReadOnly(true);
    }
  } catch (DataObjectNotFoundException e) {
    //do nothing, memory file already deleted
  } catch (FileStateInvalidException e) {
    //do nothing, memory file already deleted
  } catch (IOException ex) {
    Exceptions.printStackTrace(ex);
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-debugger-common2

/**
 * Force the editor to save the given filename.
 */
public static boolean saveFile(String fileName, NativeDebugger debugger) {
  FileObject fo = findFileObject(fileName, debugger);
  DataObject dao = dataObjectFor(fo);
  if (dao == null)
    return false;
  EditorCookie ec = dao.getCookie(EditorCookie.class);
  if (ec == null)
    return false;
  try {
  ec.saveDocument();
} catch (java.io.IOException ex) {
  return false;
}
return true;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf

} finally {
  reformat.unlock();
  ec.saveDocument();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-html-custom

editorCookie.saveDocument();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf

} finally {
  reformat.unlock();
  ec.saveDocument();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf

Exceptions.printStackTrace(ex);
} finally {
  ec.saveDocument();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-editor-global-format

ec.saveDocument();
} catch (UserQuestionException uqe) {
  uqe.confirmed();

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-apisupport-wizards

DataObject.find(fo).getLookup().lookup(EditorCookie.class).saveDocument();
} catch (IOException e) {
  Util.err.notify(ErrorManager.INFORMATIONAL, e);

相关文章