Search in sources :

Example 21 with CvsContext

use of com.intellij.cvsSupport2.actions.cvsContext.CvsContext in project intellij-community by JetBrains.

the class ToggleOfflineAction method isSelected.

public boolean isSelected(AnActionEvent e) {
    CvsContext cvsContext = CvsContextWrapper.createInstance(e);
    if (!cvsContext.cvsIsActive())
        return false;
    VirtualFile root = cvsContext.getSelectedFile();
    if (root == null)
        return false;
    final VirtualFile firstDirInChain = root.isDirectory() ? root : root.getParent();
    if (firstDirInChain == null)
        return false;
    CvsConnectionSettings settings = CvsEntriesManager.getInstance().getCvsConnectionSettingsFor(firstDirInChain);
    if (settings == null)
        return false;
    return settings.isOffline();
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) CvsContext(com.intellij.cvsSupport2.actions.cvsContext.CvsContext) CvsConnectionSettings(com.intellij.cvsSupport2.connections.CvsConnectionSettings)

Example 22 with CvsContext

use of com.intellij.cvsSupport2.actions.cvsContext.CvsContext in project intellij-community by JetBrains.

the class ToggleOfflineAction method update.

@Override
public void update(final AnActionEvent e) {
    super.update(e);
    CvsContext cvsContext = CvsContextWrapper.createInstance(e);
    final VirtualFile[] files = cvsContext.getSelectedFiles();
    e.getPresentation().setVisible(files != null && files.length > 0 && cvsContext.cvsIsActive());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) CvsContext(com.intellij.cvsSupport2.actions.cvsContext.CvsContext)

Example 23 with CvsContext

use of com.intellij.cvsSupport2.actions.cvsContext.CvsContext in project intellij-community by JetBrains.

the class CheckoutFileAction method getCvsHandler.

protected CvsHandler getCvsHandler(CvsContext context) {
    if (myModifiedFiles != null) {
        if (!myModifiedFiles.isEmpty()) {
            if (!new ReplaceFileConfirmationDialog(context.getProject(), CvsBundle.getCheckoutOperationName()).requestConfirmation(myModifiedFiles)) {
                return CvsHandler.NULL;
            }
        }
    }
    myModifiedFiles = null;
    Project project = context.getProject();
    FilePath[] filesArray = context.getSelectedFilePaths();
    List<FilePath> files = Arrays.asList(filesArray);
    if (CvsVcs2.getInstance(project).getCheckoutOptions().getValue() || OptionsDialog.shiftIsPressed(context.getModifiers())) {
        CheckoutFileDialog checkoutFileDialog = new CheckoutFileDialog(project, files);
        if (!checkoutFileDialog.showAndGet()) {
            return CvsHandler.NULL;
        }
    }
    return CommandCvsHandler.createCheckoutFileHandler(filesArray, CvsConfiguration.getInstance(project), VcsConfiguration.getInstance(project).getCheckoutOption());
}
Also used : ReplaceFileConfirmationDialog(com.intellij.openapi.vcs.ui.ReplaceFileConfirmationDialog) FilePath(com.intellij.openapi.vcs.FilePath) Project(com.intellij.openapi.project.Project) CheckoutFileDialog(com.intellij.cvsSupport2.cvsoperations.cvsCheckOut.ui.CheckoutFileDialog)

Example 24 with CvsContext

use of com.intellij.cvsSupport2.actions.cvsContext.CvsContext in project intellij-community by JetBrains.

the class CreateTagAction method getCvsHandler.

protected CvsHandler getCvsHandler(CvsContext context) {
    final FilePath[] selectedFiles = context.getSelectedFilePaths();
    final Project project = context.getProject();
    final CreateTagDialog dialog = new CreateTagDialog(selectedFiles, project, true);
    if (!dialog.showAndGet()) {
        return CvsHandler.NULL;
    }
    final boolean makeNewFilesReadOnly = CvsConfiguration.getInstance(project).MAKE_NEW_FILES_READONLY;
    return CommandCvsHandler.createTagHandler(selectedFiles, dialog.getTagName(), dialog.switchToThisBranch(), dialog.getOverrideExisting(), makeNewFilesReadOnly, project);
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) Project(com.intellij.openapi.project.Project) CreateTagDialog(com.intellij.cvsSupport2.cvsoperations.cvsTagOrBranch.ui.CreateTagDialog)

Example 25 with CvsContext

use of com.intellij.cvsSupport2.actions.cvsContext.CvsContext in project intellij-community by JetBrains.

the class DeleteTagAction method getCvsHandler.

protected CvsHandler getCvsHandler(CvsContext context) {
    final FilePath[] selectedFiles = context.getSelectedFilePaths();
    final DeleteTagDialog deleteTagDialog = new DeleteTagDialog(selectedFiles, context.getProject());
    if (!deleteTagDialog.showAndGet()) {
        return CvsHandler.NULL;
    }
    return CommandCvsHandler.createRemoveTagAction(selectedFiles, deleteTagDialog.getTagName());
}
Also used : FilePath(com.intellij.openapi.vcs.FilePath) DeleteTagDialog(com.intellij.cvsSupport2.cvsoperations.cvsTagOrBranch.ui.DeleteTagDialog)

Aggregations

CvsContext (com.intellij.cvsSupport2.actions.cvsContext.CvsContext)10 VirtualFile (com.intellij.openapi.vfs.VirtualFile)10 Project (com.intellij.openapi.project.Project)9 FilePath (com.intellij.openapi.vcs.FilePath)5 CommandCvsHandler (com.intellij.cvsSupport2.cvshandlers.CommandCvsHandler)3 CvsHandler (com.intellij.cvsSupport2.cvshandlers.CvsHandler)3 CvsTabbedWindow (com.intellij.cvsSupport2.ui.CvsTabbedWindow)3 Presentation (com.intellij.openapi.actionSystem.Presentation)3 UpdateSettingsOnCvsConfiguration (com.intellij.cvsSupport2.actions.update.UpdateSettingsOnCvsConfiguration)2 CvsConfiguration (com.intellij.cvsSupport2.config.CvsConfiguration)2 SelectCvsConfigurationDialog (com.intellij.cvsSupport2.config.ui.SelectCvsConfigurationDialog)2 CvsConnectionSettings (com.intellij.cvsSupport2.connections.CvsConnectionSettings)2 CreateTagDialog (com.intellij.cvsSupport2.cvsoperations.cvsTagOrBranch.ui.CreateTagDialog)2 WatchOperation (com.intellij.cvsSupport2.cvsoperations.cvsWatch.WatchOperation)2 VcsContext (com.intellij.openapi.vcs.actions.VcsContext)2 File (java.io.File)2 CvsBundle (com.intellij.CvsBundle)1 CvsContextAdapter (com.intellij.cvsSupport2.actions.cvsContext.CvsContextAdapter)1 CvsLightweightFile (com.intellij.cvsSupport2.actions.cvsContext.CvsLightweightFile)1 CvsEntriesManager (com.intellij.cvsSupport2.application.CvsEntriesManager)1