Clear Case first take: IDEA-65977 Clear Case plugin can not add/move to non existing directory + unversioned folders are detected and shown. todo: performance

This commit is contained in:
irengrig
2011-03-25 12:45:25 +03:00
parent 3693f25fd4
commit 7c9de3e79c
2 changed files with 9 additions and 10 deletions
@@ -56,14 +56,8 @@ public class VcsUtil {
private static final Logger LOG = Logger.getInstance("#com.intellij.vcsUtil.VcsUtil");
/**
* Call "fileDirty" in the read action.
*/
public static void markFileAsDirty(final Project project, final VirtualFile file) {
final VcsDirtyScopeManager mgr = VcsDirtyScopeManager.getInstance(project);
ApplicationManager.getApplication().runReadAction(new Runnable() {
public void run() { mgr.fileDirty(file); }
});
VcsDirtyScopeManager.getInstance(project).fileDirty(file);
}
public static void markFileAsDirty(final Project project, final FilePath path) {
@@ -45,7 +45,7 @@ public class ScheduleForAdditionAction extends AnAction implements DumbAware {
}
public void update(AnActionEvent e) {
final boolean enabled = e.getData(PlatformDataKeys.PROJECT) != null && (getUnversionedFiles(e) != null);
final boolean enabled = e.getData(PlatformDataKeys.PROJECT) != null && (thereAreUnversionedFiles(e));
e.getPresentation().setEnabled(enabled);
final String place = e.getPlace();
if (ActionPlaces.ACTION_PLACE_VCS_QUICK_LIST_POPUP_ACTION.equals(place) || ActionPlaces.CHANGES_VIEW_POPUP.equals(place) ) {
@@ -62,8 +62,13 @@ public class ScheduleForAdditionAction extends AnAction implements DumbAware {
changeListManager.addUnversionedFiles(changeListManager.getDefaultChangeList(), unversionedFiles);
}
protected boolean thereAreUnversionedFiles(final AnActionEvent e) {
final List<VirtualFile> unversionedFiles = getUnversionedFiles(e);
return unversionedFiles != null && !(unversionedFiles.isEmpty());
}
@Nullable
private static List<VirtualFile> getUnversionedFiles(final AnActionEvent e) {
protected List<VirtualFile> getUnversionedFiles(final AnActionEvent e) {
// first get from the ChangeListView
List<VirtualFile> unversionedFiles = e.getData(ChangesListView.UNVERSIONED_FILES_DATA_KEY);
if (unversionedFiles != null && !unversionedFiles.isEmpty()) {
@@ -88,4 +93,4 @@ public class ScheduleForAdditionAction extends AnAction implements DumbAware {
return unversionedFiles.isEmpty() ? null : unversionedFiles;
}
}
}