当前位置: 首页>>代码示例>>Java>>正文


Java EditorPartPresenter.isDirty方法代码示例

本文整理汇总了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);
}
 
开发者ID:eclipse,项目名称:che,代码行数:18,代码来源:SaveAllAction.java

示例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);
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:FileWatcher.java

示例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);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:29,代码来源:SaveAllAction.java

示例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;
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:EditorAgentImpl.java

示例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);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:EditorContentSynchronizerImpl.java


注:本文中的org.eclipse.che.ide.api.editor.EditorPartPresenter.isDirty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。