mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
"add existing iml file" opens file chooser at project root by default
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,6 +31,7 @@ import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
@@ -85,11 +86,22 @@ public class ImportImlMode extends WizardMode {
|
||||
myModulePathFieldPanel = null; //todo
|
||||
}
|
||||
|
||||
public JComponent getAdditionalSettings(WizardContext wizardContext) {
|
||||
public JComponent getAdditionalSettings(final WizardContext wizardContext) {
|
||||
JTextField tfModuleFilePath = new JTextField();
|
||||
final String productName = ApplicationNamesInfo.getInstance().getProductName();
|
||||
myModulePathFieldPanel = new TextFieldWithBrowseButton(tfModuleFilePath, new BrowseFilesListener(tfModuleFilePath, IdeBundle.message(
|
||||
"prompt.select.module.file.to.import", productName), null, new ModuleFileChooserDescriptor()));
|
||||
final String message = IdeBundle.message("prompt.select.module.file.to.import", productName);
|
||||
final BrowseFilesListener listener = new BrowseFilesListener(tfModuleFilePath, message, null, new ModuleFileChooserDescriptor()) {
|
||||
@Override
|
||||
protected VirtualFile getFileToSelect() {
|
||||
final VirtualFile fileToSelect = super.getFileToSelect();
|
||||
if (fileToSelect != null) {
|
||||
return fileToSelect;
|
||||
}
|
||||
final Project project = wizardContext.getProject();
|
||||
return project != null ? project.getBaseDir() : null;
|
||||
}
|
||||
};
|
||||
myModulePathFieldPanel = new TextFieldWithBrowseButton(tfModuleFilePath, listener);
|
||||
onChosen(false);
|
||||
return myModulePathFieldPanel;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user