本文整理汇总了Java中org.eclipse.che.ide.api.editor.EditorPartPresenter.isDirty方法的典型用法代码示例。如果您正苦于以下问题:Java EditorPartPresenter.isDirty方法的具体用法?Java EditorPartPresenter.isDirty怎么用?Java EditorPartPresenter.isDirty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.che.ide.api.editor.EditorPartPresenter
的用法示例。
在下文中一共展示了EditorPartPresenter.isDirty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateProjectAction
import org.eclipse.che.ide.api.editor.EditorPartPresenter; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public void updateProjectAction(ActionEvent e) {
boolean hasDirtyEditor = false;
for (EditorPartPresenter editor : editorAgent.getOpenedEditors()) {
if (editor instanceof EditorWithAutoSave) {
if (((EditorWithAutoSave) editor).isAutoSaveEnabled()) {
continue;
}
}
if (editor.isDirty()) {
hasDirtyEditor = true;
break;
}
}
e.getPresentation().setEnabledAndVisible(hasDirtyEditor);
}
示例2: editorOpened
import org.eclipse.che.ide.api.editor.EditorPartPresenter; //导入方法依赖的package包/类
public void editorOpened(final EditorPartPresenter editor) {
final PropertyListener propertyListener =
new PropertyListener() {
@Override
public void propertyChanged(PartPresenter source, int propId) {
if (propId == EditorPartPresenter.PROP_DIRTY) {
if (!editor.isDirty()) {
reparseAllOpenedFiles();
// remove just saved editor
editor2reconcile.remove(editor);
}
}
}
};
editor.addPropertyListener(propertyListener);
}
示例3: save
import org.eclipse.che.ide.api.editor.EditorPartPresenter; //导入方法依赖的package包/类
private void save(final List<EditorPartPresenter> editors) {
if (editors.isEmpty()) {
return;
}
final EditorPartPresenter editorPartPresenter = editors.get(0);
if (editorPartPresenter.isDirty()) {
editorPartPresenter.doSave(
new AsyncCallback<EditorInput>() {
@Override
public void onFailure(Throwable caught) {
Log.error(SaveAllAction.class, caught);
// try to save other files
editors.remove(editorPartPresenter);
save(editors);
}
@Override
public void onSuccess(EditorInput result) {
editors.remove(editorPartPresenter);
save(editors);
}
});
} else {
editors.remove(editorPartPresenter);
save(editors);
}
}
示例4: getDirtyEditors
import org.eclipse.che.ide.api.editor.EditorPartPresenter; //导入方法依赖的package包/类
@Override
public List<EditorPartPresenter> getDirtyEditors() {
List<EditorPartPresenter> dirtyEditors = new ArrayList<>();
for (EditorPartPresenter partPresenter : openedEditors) {
if (partPresenter.isDirty()) {
dirtyEditors.add(partPresenter);
}
}
return dirtyEditors;
}
示例5: onEditorDirtyStateChanged
import org.eclipse.che.ide.api.editor.EditorPartPresenter; //导入方法依赖的package包/类
@Override
public void onEditorDirtyStateChanged(EditorDirtyStateChangedEvent event) {
EditorPartPresenter changedEditor = event.getEditor();
if (changedEditor == null || changedEditor.isDirty()) {
// we sync 'dirty' state of editors only for case when content of an active editor IS SAVED
return;
}
Path changedEditorPath = changedEditor.getEditorInput().getFile().getLocation();
if (editorGroups.containsKey(changedEditorPath)) {
editorGroups.get(changedEditorPath).onEditorDirtyStateChanged(changedEditor);
}
}