Java Code Examples for com.intellij.openapi.projectRoots.impl.SdkConfigurationUtil#createUniqueSdkName()
The following examples show how to use
com.intellij.openapi.projectRoots.impl.SdkConfigurationUtil#createUniqueSdkName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SdkListConfigurable.java From consulo with Apache License 2.0 | 6 votes |
@RequiredUIAccess @Override public void actionPerformed(final AnActionEvent e) { final Object o = getSelectedObject(); if (o instanceof SdkImpl) { final SdkImpl selected = (SdkImpl)o; String defaultNewName = SdkConfigurationUtil.createUniqueSdkName(selected.getName(), mySdksModel.getSdks()); final String newName = Messages.showInputDialog("Enter bundle name:", "Copy Bundle", null, defaultNewName, new NonEmptyInputValidator() { @Override public boolean checkInput(String inputString) { return super.checkInput(inputString) && mySdksModel.findSdk(inputString) == null; } }); if (newName == null) return; SdkImpl sdk = selected.clone(); sdk.setName(newName); sdk.setPredefined(false); mySdksModel.doAdd(sdk, sdk1 -> addSdkNode(sdk1, true)); } }
Example 2
Source File: SdkListConfigurable.java From consulo with Apache License 2.0 | 6 votes |
@RequiredUIAccess @Override public void actionPerformed(final AnActionEvent e) { final Object o = getSelectedObject(); if (o instanceof SdkImpl) { final SdkImpl selected = (SdkImpl)o; String defaultNewName = SdkConfigurationUtil.createUniqueSdkName(selected.getName(), mySdksModel.getSdks()); final String newName = Messages.showInputDialog("Enter bundle name:", "Copy Bundle", null, defaultNewName, new NonEmptyInputValidator() { @Override public boolean checkInput(String inputString) { return super.checkInput(inputString) && mySdksModel.findSdk(inputString) == null; } }); if (newName == null) return; SdkImpl sdk = selected.clone(); sdk.setName(newName); sdk.setPredefined(false); mySdksModel.doAdd(sdk, sdk1 -> addSdkNode(sdk1, true)); } }
Example 3
Source File: PredefinedBundlesLoader.java From consulo with Apache License 2.0 | 5 votes |
@Override @Nonnull public Sdk createSdkWithName(@Nonnull SdkType sdkType, @Nonnull String suggestName) { Sdk[] sdks = ArrayUtil.mergeArrayAndCollection(mySdkTable.getAllSdks(), myBundles, Sdk.ARRAY_FACTORY); String uniqueSdkName = SdkConfigurationUtil.createUniqueSdkName(suggestName + SdkConfigurationUtil.PREDEFINED_PREFIX, sdks); Sdk sdk = mySdkTable.createSdk(uniqueSdkName, sdkType); myBundles.add(sdk); return sdk; }