Merge remote-tracking branch 'origin/master'

This commit is contained in:
Dmitry Trofimov
2014-03-17 17:39:06 +01:00
2 changed files with 26 additions and 8 deletions
@@ -24,6 +24,7 @@ import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.ThrowableComputable;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.encoding.EncodingRegistry;
import com.intellij.openapi.wm.ToolWindowManager;
@@ -72,10 +73,16 @@ public class CopyFilesOrDirectoriesHandler extends CopyHandlerDelegateBase {
if (defaultTargetDirectory == null) return;
}
if (defaultTargetDirectory == null) {
VirtualFile root = project.getBaseDir();
if (root == null) root = VfsUtil.getUserHomeDir();
if (root != null) defaultTargetDirectory = PsiManager.getInstance(project).findDirectory(root);
}
copyAsFiles(elements, defaultTargetDirectory, project);
}
public static void copyAsFiles(PsiElement[] elements, PsiDirectory defaultTargetDirectory, Project project) {
public static void copyAsFiles(PsiElement[] elements, @Nullable PsiDirectory defaultTargetDirectory, Project project) {
PsiDirectory targetDirectory = null;
String newName = null;
boolean openInEditor = true;
@@ -26,7 +26,6 @@ import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.pom.Navigatable;
@@ -120,6 +119,11 @@ public abstract class FinderRecursivePanel<T> extends JBSplitter implements Data
}
public void init() {
initWithoutUpdatePanel();
updatePanel();
}
private void initWithoutUpdatePanel() {
setFirstComponent(createLeftComponent());
setSecondComponent(createDefaultRightComponent());
@@ -129,8 +133,6 @@ public abstract class FinderRecursivePanel<T> extends JBSplitter implements Data
setDividerWidth(3);
setShowDividerIcon(false);
setShowDividerControls(true);
updatePanel();
}
/**
@@ -466,7 +468,7 @@ public abstract class FinderRecursivePanel<T> extends JBSplitter implements Data
myList.setSelectedValue(value, true);
// always recreate since instance might depend on this one's selected value
updateRightComponent(true);
createRightComponent(false);
}
@NotNull
@@ -485,6 +487,10 @@ public abstract class FinderRecursivePanel<T> extends JBSplitter implements Data
}
public void updatePanel() {
if (myUpdateSelectedPathModeActive.get()) {
return;
}
myList.setPaintBusy(true);
myMergingUpdateQueue.queue(new Update("update") {
@Override
@@ -550,14 +556,14 @@ public abstract class FinderRecursivePanel<T> extends JBSplitter implements Data
public void updateRightComponent(boolean force) {
if (force) {
createRightComponent();
createRightComponent(true);
}
else if (myChild instanceof FinderRecursivePanel) {
((FinderRecursivePanel)myChild).updatePanel();
}
}
private void createRightComponent() {
private void createRightComponent(boolean withUpdatePanel) {
T value = getSelectedValue();
if (value != null) {
if (myChild instanceof Disposable) {
@@ -565,7 +571,12 @@ public abstract class FinderRecursivePanel<T> extends JBSplitter implements Data
}
myChild = createRightComponent(value);
if (myChild instanceof FinderRecursivePanel) {
((FinderRecursivePanel)myChild).init();
final FinderRecursivePanel childPanel = (FinderRecursivePanel)myChild;
if (withUpdatePanel) {
childPanel.init();
} else {
childPanel.initWithoutUpdatePanel();
}
}
setSecondComponent(myChild);