本文整理匯總了Java中com.intellij.openapi.editor.Document.isWritable方法的典型用法代碼示例。如果您正苦於以下問題:Java Document.isWritable方法的具體用法?Java Document.isWritable怎麽用?Java Document.isWritable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.editor.Document
的用法示例。
在下文中一共展示了Document.isWritable方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateDocumentHook
import com.intellij.openapi.editor.Document; //導入方法依賴的package包/類
@Override
protected void updateDocumentHook(Document document, Project project, String lang, String key, String value, TranslationTableModel model) {
if (!document.isWritable()) {
return;
}
YAMLFile yamlFile = (YAMLFile) PsiDocumentManager.getInstance(project).getPsiFile(document);
if (yamlFile != null) {
try {
for (String eachLang : languages) {
String value0;
String key0;
if (eachLang.equalsIgnoreCase(lang)) {
key0 = lang + "." + key;
value0 = value;
} else {
key0 = eachLang + "." + key;
value0 = "";
}
YAMLKeyValue yamlKeyValue = yamlUtil.createI18nRecord(yamlFile, key0, value0);
model.addElement(eachLang, yamlKeyValue, key);
}
PsiDocumentManager.getInstance(project).commitDocument(document);
} catch (IncorrectOperationException e) {
}
}
}
示例2: updateDocumentHook
import com.intellij.openapi.editor.Document; //導入方法依賴的package包/類
@Override
protected void updateDocumentHook(Document document, Project project, String lang, String key, String value, TranslationTableModel model) {
if (!document.isWritable()) {
return;
}
PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(document);
if (psiFile != null) {
YAMLKeyValue yamlKeyValue = yamlUtil.createI18nRecord((YAMLFile) psiFile, key, value);
model.addElement(lang, yamlKeyValue, key);
PsiDocumentManager.getInstance(project).commitDocument(document);
}
}