fixes according code review

This commit is contained in:
Ekaterina Tuzova
2014-02-20 12:09:19 +04:00
parent ed0dc5c030
commit 7de9df14ab
4 changed files with 7 additions and 8 deletions
@@ -38,7 +38,6 @@ import com.intellij.openapi.ui.ComboBox;
import com.intellij.openapi.ui.FixedSizeButton;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.CollectionComboBoxModel;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.util.NullableConsumer;
import com.intellij.webcore.packaging.PackagesNotificationPanel;
import com.jetbrains.python.packaging.ui.PyInstalledPackagesPanel;
@@ -130,7 +129,7 @@ public class PyActiveSdkConfigurable implements UnnamedConfigurable {
.show(myProject, myProjectSdksModel.getSdks(),
myModule == null ? new PythonSdkDetailsDialog(myProject, myDetailsCallback) :
new PythonSdkDetailsDialog(myModule, myDetailsCallback), myMainPanel,
RelativePoint.fromScreen(myDetailsButton.getLocationOnScreen()), true,
myDetailsButton.getLocationOnScreen(), true,
new NullableConsumer<Sdk>() {
@Override
public void consume(Sdk sdk) {
@@ -246,7 +246,7 @@ public class PythonSdkDetailsDialog extends DialogWrapper {
private void addSdk(AnActionButton button) {
PythonSdkDetailsStep
.show(myProject, myProjectSdksModel.getSdks(), this, myMainPanel, button.getPreferredPopupPoint(), false, new NullableConsumer<Sdk>() {
.show(myProject, myProjectSdksModel.getSdks(), this, myMainPanel, button.getPreferredPopupPoint().getScreenPoint(), false, new NullableConsumer<Sdk>() {
@Override
public void consume(Sdk sdk) {
addCreatedSdk(sdk, false);
@@ -28,7 +28,6 @@ import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.popup.*;
import com.intellij.openapi.ui.popup.util.BaseListPopupStep;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.util.NullableConsumer;
import com.jetbrains.python.remote.PythonRemoteInterpreterManager;
import com.jetbrains.python.sdk.flavors.PythonSdkFlavor;
@@ -55,13 +54,13 @@ public class PythonSdkDetailsStep extends BaseListPopupStep<String> {
public static void show(final Project project,
final Sdk[] existingSdks,
DialogWrapper moreDialog,
JComponent ownerComponent, final RelativePoint popupPoint,
JComponent ownerComponent, final Point popupPoint,
final boolean showMore,
final NullableConsumer<Sdk> callback) {
myMore = moreDialog;
final ListPopupStep sdkHomesStep = new PythonSdkDetailsStep(project, ownerComponent, existingSdks, showMore, callback);
final ListPopup popup = JBPopupFactory.getInstance().createListPopup(sdkHomesStep);
popup.showInScreenCoordinates(ownerComponent, popupPoint.getPoint());
popup.showInScreenCoordinates(ownerComponent, popupPoint);
}
public PythonSdkDetailsStep(Project project,
@@ -53,7 +53,6 @@ import com.intellij.psi.PsiElement;
import com.intellij.reference.SoftReference;
import com.intellij.remotesdk.RemoteSdkData;
import com.intellij.remotesdk.RemoteSdkDataHolder;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Consumer;
import com.intellij.util.NullableConsumer;
@@ -280,8 +279,10 @@ public class PythonSdkType extends SdkType {
public void showCustomCreateUI(SdkModel sdkModel, final JComponent parentComponent, final Consumer<Sdk> sdkCreatedCallback) {
Project project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext(parentComponent));
final Point point = parentComponent.getMousePosition();
SwingUtilities.convertPointToScreen(point, parentComponent);
PythonSdkDetailsStep
.show(project, sdkModel.getSdks(), null, parentComponent, RelativePoint.getCenterOf(parentComponent), true, new NullableConsumer<Sdk>() {
.show(project, sdkModel.getSdks(), null, parentComponent, point, false, new NullableConsumer<Sdk>() {
@Override
public void consume(@Nullable Sdk sdk) {
if (sdk != null) {