Search in sources :

Example 1 with IdeaGateway

use of com.intellij.history.integration.IdeaGateway in project intellij-community by JetBrains.

the class LocalHistoryAction method update.

@Override
public void update(@NotNull AnActionEvent e) {
    Presentation p = e.getPresentation();
    if (e.getProject() == null) {
        p.setEnabledAndVisible(false);
    } else {
        p.setVisible(true);
        p.setText(getText(e), true);
        LocalHistoryFacade vcs = getVcs();
        IdeaGateway gateway = getGateway();
        p.setEnabled(vcs != null && gateway != null && isEnabled(vcs, gateway, e));
    }
}
Also used : IdeaGateway(com.intellij.history.integration.IdeaGateway) LocalHistoryFacade(com.intellij.history.core.LocalHistoryFacade) Presentation(com.intellij.openapi.actionSystem.Presentation)

Example 2 with IdeaGateway

use of com.intellij.history.integration.IdeaGateway in project intellij-community by JetBrains.

the class SelectionReverterTest method testAskingForReadOnlyStatusClearingOnlyForTheSpecifiedFile.

public void testAskingForReadOnlyStatusClearingOnlyForTheSpecifiedFile() throws Exception {
    createChildData(myRoot, "foo1.txt");
    setBinaryContent(f, "one".getBytes());
    createChildData(myRoot, "foo2.txt");
    setBinaryContent(f, "two".getBytes());
    createChildData(myRoot, "foo3.txt");
    final List<VirtualFile> files = new ArrayList<>();
    myGateway = new IdeaGateway() {

        @Override
        public boolean ensureFilesAreWritable(@NotNull Project p, @NotNull List<VirtualFile> ff) {
            files.addAll(ff);
            return true;
        }
    };
    List<String> errors = checkCanRevertToPreviousRevision();
    assertTrue(errors.isEmpty());
    assertEquals(1, files.size());
    assertEquals(f, files.get(0));
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) Project(com.intellij.openapi.project.Project) IdeaGateway(com.intellij.history.integration.IdeaGateway) ArrayList(java.util.ArrayList)

Aggregations

IdeaGateway (com.intellij.history.integration.IdeaGateway)2 LocalHistoryFacade (com.intellij.history.core.LocalHistoryFacade)1 Presentation (com.intellij.openapi.actionSystem.Presentation)1 Project (com.intellij.openapi.project.Project)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1 ArrayList (java.util.ArrayList)1