use of com.intellij.cvsSupport2.cvshandlers.CvsHandler in project intellij-community by JetBrains.
the class ImportAction method createCheckoutAction.
private AbstractAction createCheckoutAction(final boolean makeNewFilesReadOnly) {
return new AbstractAction(false) {
protected String getTitle(VcsContext context) {
return CvsBundle.message("operation.name.check.out.project");
}
protected CvsHandler getCvsHandler(CvsContext context) {
final Project project = context.getProject();
return CommandCvsHandler.createCheckoutHandler(myImportDetails.getCvsRoot(), new String[] { myImportDetails.getModuleName() }, myImportDetails.getBaseImportDirectory(), true, makeNewFilesReadOnly, project == null ? null : VcsConfiguration.getInstance(project).getCheckoutOption());
}
protected void onActionPerformed(CvsContext context, CvsTabbedWindow tabbedWindow, boolean successfully, CvsHandler handler) {
super.onActionPerformed(context, tabbedWindow, successfully, handler);
final Project project = context.getProject();
if (successfully) {
if (project != null) {
final VirtualFile importedRoot = CvsVfsUtil.findFileByIoFile(myImportDetails.getBaseImportDirectory());
updateDirectoryMappings(project, importedRoot);
}
}
}
/**
* Basically copied from GitInit/HgInit
*/
private void updateDirectoryMappings(Project project, VirtualFile mapRoot) {
if (project == null || project.isDefault()) {
return;
}
final VirtualFile projectBaseDir = project.getBaseDir();
if (projectBaseDir == null || !VfsUtil.isAncestor(projectBaseDir, mapRoot, false)) {
return;
}
mapRoot.refresh(false, false);
final String path = mapRoot.equals(projectBaseDir) ? "" : mapRoot.getPath();
ProjectLevelVcsManager manager = ProjectLevelVcsManager.getInstance(project);
manager.setDirectoryMappings(VcsUtil.addMapping(manager.getDirectoryMappings(), path, CvsVcs2.getInstance(project).getName()));
manager.updateActiveVcss();
}
};
}
use of com.intellij.cvsSupport2.cvshandlers.CvsHandler 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());
}
use of com.intellij.cvsSupport2.cvshandlers.CvsHandler 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);
}
use of com.intellij.cvsSupport2.cvshandlers.CvsHandler 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());
}
Aggregations