Search in sources :

Example 1 with PerlSdkTable

use of com.intellij.openapi.projectRoots.impl.PerlSdkTable in project Perl5-IDEA by Camelcade.

the class Perl5SdkConfigurable method renameSdk.

private void renameSdk(AnActionEvent e) {
    Sdk selectedSdk = getSelectedSdk();
    if (selectedSdk == null) {
        return;
    }
    PerlSdkTable perlSdkTable = PerlSdkTable.getInstance();
    Messages.showInputDialog(myPanel.getSdkComboBox(), PerlBundle.message("perl.rename.sdk.text"), PerlBundle.message("perl.rename.sdk.title"), PerlIcons.PERL_LANGUAGE_ICON, selectedSdk.getName(), new InputValidator() {

        @Override
        public boolean checkInput(String inputString) {
            if (StringUtil.isEmpty(inputString)) {
                return false;
            }
            Sdk perlSdk = perlSdkTable.findJdk(inputString);
            return perlSdk == null || perlSdk.equals(selectedSdk);
        }

        @Override
        public boolean canClose(String inputString) {
            if (StringUtil.equals(selectedSdk.getName(), inputString)) {
                return true;
            }
            SdkModificator modificator = selectedSdk.getSdkModificator();
            modificator.setName(inputString);
            assert modificator instanceof Sdk;
            perlSdkTable.updateJdk(selectedSdk, (Sdk) modificator);
            myPanel.getSdkComboBox().repaint();
            return true;
        }
    });
}
Also used : InputValidator(com.intellij.openapi.ui.InputValidator) PerlSdkTable(com.intellij.openapi.projectRoots.impl.PerlSdkTable) Sdk(com.intellij.openapi.projectRoots.Sdk) SdkModificator(com.intellij.openapi.projectRoots.SdkModificator)

Aggregations

Sdk (com.intellij.openapi.projectRoots.Sdk)1 SdkModificator (com.intellij.openapi.projectRoots.SdkModificator)1 PerlSdkTable (com.intellij.openapi.projectRoots.impl.PerlSdkTable)1 InputValidator (com.intellij.openapi.ui.InputValidator)1