mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 09:03:31 +07:00
Merge remote branch 'origin/master'
This commit is contained in:
+24
-25
@@ -50,6 +50,7 @@ import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.LibraryPro
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ModuleProjectStructureElement;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureDaemonAnalyzer;
|
||||
import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStructureElement;
|
||||
import com.intellij.openapi.ui.DialogBuilder;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.ui.NamedConfigurable;
|
||||
@@ -64,6 +65,7 @@ import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.ui.navigation.Place;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
@@ -783,27 +785,23 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple
|
||||
final NamedConfigurable namedConfigurable = getSelectedConfugurable();
|
||||
if (namedConfigurable instanceof ModuleConfigurable) {
|
||||
try {
|
||||
final ModuleEditor moduleEditor = ((ModuleConfigurable)namedConfigurable).getModuleEditor();
|
||||
final String modulePresentation = IdeBundle.message("project.new.wizard.module.identification");
|
||||
final NamePathComponent component = new NamePathComponent(IdeBundle.message("label.project.name"), IdeBundle.message(
|
||||
"label.component.file.location", StringUtil.capitalize(modulePresentation)), IdeBundle.message(
|
||||
"title.select.project.file.directory", modulePresentation), IdeBundle.message("description.select.project.file.directory",
|
||||
StringUtil.capitalize(modulePresentation)), true, false);
|
||||
final DialogWrapper copyModuleDialog = new DialogWrapper(myTree, false) {
|
||||
{
|
||||
setTitle(ProjectBundle.message("copy.module.dialog.title"));
|
||||
init();
|
||||
}
|
||||
final NamePathComponent component = new NamePathComponent(IdeBundle.message("label.module.name"), IdeBundle.message("label.component.file.location", StringUtil.capitalize(modulePresentation)), IdeBundle.message("title.select.project.file.directory", modulePresentation),
|
||||
IdeBundle.message("description.select.project.file.directory", StringUtil.capitalize(modulePresentation)), true,
|
||||
false);
|
||||
final Module originalModule = moduleEditor.getModule();
|
||||
if (originalModule != null) {
|
||||
component.setPath(PathUtil.getParentPath(originalModule.getModuleFilePath()));
|
||||
}
|
||||
|
||||
public JComponent getPreferredFocusedComponent() {
|
||||
return component.getNameComponent();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected JComponent createCenterPanel() {
|
||||
return component;
|
||||
}
|
||||
|
||||
protected void doOKAction() {
|
||||
final DialogBuilder dialogBuilder = new DialogBuilder(myTree);
|
||||
dialogBuilder.setTitle(ProjectBundle.message("copy.module.dialog.title"));
|
||||
dialogBuilder.setCenterPanel(component);
|
||||
dialogBuilder.setPreferedFocusComponent(component.getNameComponent());
|
||||
dialogBuilder.setOkOperation(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (component.getNameValue().length() == 0) {
|
||||
Messages.showErrorDialog(ProjectBundle.message("enter.module.copy.name.error.message"), CommonBundle.message("title.error"));
|
||||
return;
|
||||
@@ -815,16 +813,17 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple
|
||||
return;
|
||||
}
|
||||
if (!ProjectWizardUtil
|
||||
.createDirectoryIfNotExists(IdeBundle.message("directory.project.file.directory", modulePresentation), component.getPath(), true)) {
|
||||
.createDirectoryIfNotExists(IdeBundle.message("directory.project.file.directory", modulePresentation), component.getPath(),
|
||||
true)) {
|
||||
Messages.showErrorDialog(ProjectBundle.message("path.0.is.invalid.error.message", component.getPath()), CommonBundle.message("title.error"));
|
||||
return;
|
||||
}
|
||||
super.doOKAction();
|
||||
dialogBuilder.getDialogWrapper().close(DialogWrapper.OK_EXIT_CODE);
|
||||
}
|
||||
};
|
||||
copyModuleDialog.show();
|
||||
if (!copyModuleDialog.isOK()) return;
|
||||
final ModifiableRootModel rootModel = ((ModuleConfigurable)namedConfigurable).getModuleEditor().getModifiableRootModel();
|
||||
});
|
||||
if (dialogBuilder.show() != DialogWrapper.OK_EXIT_CODE) return;
|
||||
|
||||
final ModifiableRootModel rootModel = moduleEditor.getModifiableRootModel();
|
||||
final String path = component.getPath();
|
||||
final ModuleBuilder builder = new ModuleBuilder() {
|
||||
public void setupRootModel(final ModifiableRootModel modifiableRootModel) throws ConfigurationException {
|
||||
|
||||
@@ -85,6 +85,6 @@ public class JavaCommenter implements CodeDocumentationAwareCommenterEx {
|
||||
public boolean isDocumentationCommentText(final PsiElement element) {
|
||||
if (element == null) return false;
|
||||
final ASTNode node = element.getNode();
|
||||
return node != null && node.getElementType() == JavaDocTokenType.DOC_COMMENT_DATA;
|
||||
return node != null && (node.getElementType() == JavaDocTokenType.DOC_COMMENT_DATA || node.getElementType() == JavaDocTokenType.DOC_TAG_VALUE_TOKEN);
|
||||
}
|
||||
}
|
||||
|
||||
+8
-3
@@ -30,7 +30,6 @@ import com.intellij.openapi.ui.VerticalFlowLayout;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.wm.IdeFocusManager;
|
||||
import com.intellij.psi.PsiCodeFragment;
|
||||
@@ -47,7 +46,7 @@ import com.intellij.ui.treeStructure.Tree;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import com.intellij.util.ui.MacUIUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.table.JBListTable;
|
||||
import com.intellij.util.ui.table.JBTableRow;
|
||||
import com.intellij.util.ui.table.JBTableRowEditor;
|
||||
@@ -282,7 +281,13 @@ public abstract class ChangeSignatureDialogBase<P extends ParameterInfo, M exten
|
||||
tabbedPane.addTab(extraPanel.first, extraPanel.second);
|
||||
}
|
||||
main = new JPanel(new BorderLayout());
|
||||
main.add(tabbedPane.getComponent(), BorderLayout.CENTER);
|
||||
final JComponent tabs = tabbedPane.getComponent();
|
||||
main.add(tabs, BorderLayout.CENTER);
|
||||
//remove traversal policies
|
||||
for (JComponent c : UIUtil.findComponentsOfType(tabs, JComponent.class)) {
|
||||
c.setFocusCycleRoot(false);
|
||||
c.setFocusTraversalPolicy(null);
|
||||
}
|
||||
}
|
||||
final JPanel bottom = new JPanel(new BorderLayout());
|
||||
bottom.add(optionsPanel, BorderLayout.NORTH);
|
||||
|
||||
+4
-4
@@ -234,7 +234,7 @@ public class CopyFilesOrDirectoriesHandler implements CopyHandlerDelegate {
|
||||
if (elementToCopy instanceof PsiFile) {
|
||||
PsiFile file = (PsiFile)elementToCopy;
|
||||
String name = newName == null ? file.getName() : newName;
|
||||
if (checkFileExist(targetDirectory, choice, file, name)) return null;
|
||||
if (checkFileExist(targetDirectory, choice, file, name, "Copy")) return null;
|
||||
return targetDirectory.copyFileFrom(name, file);
|
||||
}
|
||||
else if (elementToCopy instanceof PsiDirectory) {
|
||||
@@ -267,12 +267,12 @@ public class CopyFilesOrDirectoriesHandler implements CopyHandlerDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean checkFileExist(PsiDirectory targetDirectory, int[] choice, PsiFile file, String name) {
|
||||
public static boolean checkFileExist(PsiDirectory targetDirectory, int[] choice, PsiFile file, String name, final String title) {
|
||||
final PsiFile existing = targetDirectory.findFile(name);
|
||||
if (existing!=null) {
|
||||
if (existing != null && !existing.equals(file)) {
|
||||
int selection = choice == null || choice[0] == -1 ? Messages.showDialog(
|
||||
String.format("File '%s' already exists in directory '%s'", name, targetDirectory.getVirtualFile().getPath()),
|
||||
"Copy",
|
||||
title,
|
||||
choice == null ? new String[]{"Overwrite", "Skip"}
|
||||
: new String[]{"Overwrite", "Skip", "Overwrite for all", "Skip for all"}, 0, Messages.getQuestionIcon())
|
||||
: choice[0];
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ public class MoveFilesOrDirectoriesUtil {
|
||||
final boolean fileExist = ApplicationManager.getApplication().runWriteAction(new Computable<Boolean>() {
|
||||
@Override
|
||||
public Boolean compute() {
|
||||
return CopyFilesOrDirectoriesHandler.checkFileExist(targetDirectory, choice, file, file.getName());
|
||||
return CopyFilesOrDirectoriesHandler.checkFileExist(targetDirectory, choice, file, file.getName(), "Move");
|
||||
}
|
||||
});
|
||||
if (fileExist) continue;
|
||||
|
||||
@@ -307,7 +307,7 @@ public class RenameProcessor extends BaseRefactoringProcessor {
|
||||
if (entry.getKey() instanceof PsiFile) {
|
||||
final PsiFile file = (PsiFile)entry.getKey();
|
||||
final PsiDirectory containingDirectory = file.getContainingDirectory();
|
||||
if (CopyFilesOrDirectoriesHandler.checkFileExist(containingDirectory, choice, file, entry.getValue())) {
|
||||
if (CopyFilesOrDirectoriesHandler.checkFileExist(containingDirectory, choice, file, entry.getValue(), "Rename")) {
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -56,11 +56,13 @@ public abstract class JBListTable extends JPanel {
|
||||
mainTable = new JBTable(model) {
|
||||
@Override
|
||||
protected void processKeyEvent(KeyEvent e) {
|
||||
if (e.isAltDown()) return;
|
||||
if (e.getKeyCode() == KeyEvent.VK_ENTER && e.getModifiers() == 0) {
|
||||
if (!isEditing() && e.getID() == KeyEvent.KEY_PRESSED) {
|
||||
editCellAt(getSelectedRow(), getSelectedColumn());
|
||||
}
|
||||
e.consume();
|
||||
return;
|
||||
}
|
||||
//todo[kb] JBTabsImpl breaks focus traversal policy. Need a workaround here
|
||||
else if (e.getKeyCode() == KeyEvent.VK_TAB) {
|
||||
@@ -73,10 +75,9 @@ public abstract class JBListTable extends JPanel {
|
||||
}
|
||||
}
|
||||
e.consume();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
super.processKeyEvent(e);
|
||||
}
|
||||
super.processKeyEvent(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+4
-3
@@ -34,7 +34,8 @@ public class XDebuggerHistoryManager {
|
||||
}
|
||||
|
||||
public void addRecentExpression(@NotNull @NonNls String id, @NotNull String expression) {
|
||||
if (expression.trim().length() == 0) return;
|
||||
final String trimmedExpression = expression.trim();
|
||||
if (trimmedExpression.length() == 0) return;
|
||||
|
||||
LinkedList<String> list = myRecentExpressions.get(id);
|
||||
if (list == null) {
|
||||
@@ -44,8 +45,8 @@ public class XDebuggerHistoryManager {
|
||||
if (list.size() == MAX_RECENT_EXPRESSIONS) {
|
||||
list.removeLast();
|
||||
}
|
||||
list.remove(expression);
|
||||
list.addFirst(expression);
|
||||
list.remove(trimmedExpression);
|
||||
list.addFirst(trimmedExpression);
|
||||
}
|
||||
|
||||
public List<String> getRecentExpressions(@NonNls String id) {
|
||||
|
||||
Reference in New Issue
Block a user