com.intellij.openapi.projectRoots.SdkModel Java Examples

The following examples show how to use com.intellij.openapi.projectRoots.SdkModel. 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: SdkComboBox.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Deprecated
@DeprecationInfo(value = "Use #setSetupButton() without 'moduleJdkSetup' parameter", until = "1.0")
public void setSetupButton(final JButton setUpButton,
                           @Nullable final Project project,
                           final SdkModel sdksModel,
                           final SdkComboBoxItem firstItem,
                           @Nullable final Condition<Sdk> additionalSetup,
                           final boolean moduleJdkSetup) {
  setSetupButton(setUpButton, project, sdksModel, firstItem, additionalSetup);
}
 
Example #2
Source File: SdkComboBox.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Deprecated
@DeprecationInfo(value = "Use #setSetupButton() without 'actionGroupTitle' parameter", until = "1.0")
public void setSetupButton(final JButton setUpButton,
                           @Nullable final Project project,
                           final SdkModel sdksModel,
                           final SdkComboBoxItem firstItem,
                           @Nullable final Condition<Sdk> additionalSetup,
                           final String actionGroupTitle) {
  setSetupButton(setUpButton, project, sdksModel, firstItem, additionalSetup);
}
 
Example #3
Source File: SdkComboBox.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void setSetupButton(@Nonnull final JButton setUpButton,
                           @Nullable final Project project,
                           @Nonnull final SdkModel sdksModel,
                           @Nullable final SdkComboBoxItem firstItem,
                           @Nullable final Condition<Sdk> additionalSetup) {
  setUpButton.addActionListener(new ActionListener() {
    @Override
    @RequiredUIAccess
    public void actionPerformed(ActionEvent e) {
      DefaultActionGroup group = new DefaultActionGroup();
      ((DefaultSdksModel)sdksModel).createAddActions(group, SdkComboBox.this, new Consumer<Sdk>() {
        @Override
        public void consume(final Sdk sdk) {
          if (project != null) {
            final SdkListConfigurable configurable = SdkListConfigurable.getInstance(project);
            configurable.addSdkNode(sdk, false);
          }
          reloadModel(new SdkComboBoxItem(sdk), project);
          setSelectedSdk(sdk); //restore selection
          if (additionalSetup != null) {
            if (additionalSetup.value(sdk)) { //leave old selection
              setSelectedSdk(firstItem.getSdk());
            }
          }
        }
      }, myCreationFilter);
      final DataContext dataContext = DataManager.getInstance().getDataContext(SdkComboBox.this);
      if (group.getChildrenCount() > 1) {
        JBPopupFactory.getInstance().createActionGroupPopup(ProjectBundle.message("set.up.jdk.title"), group, dataContext,
                                                            JBPopupFactory.ActionSelectionAid.MNEMONICS, false)
                .showUnderneathOf(setUpButton);
      }
      else {
        final AnActionEvent event = new AnActionEvent(null, dataContext, ActionPlaces.UNKNOWN, new Presentation(""),
                                                      ActionManager.getInstance(), 0);
        group.getChildren(event)[0].actionPerformed(event);
      }
    }
  });
}
 
Example #4
Source File: BundleBoxBuilder.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static SdkModel effectiveModel(@Nullable SdkModel sdkModel) {
  if (sdkModel == null) {
    ShowSdksSettingsUtil sdksSettingsUtil = (ShowSdksSettingsUtil)ShowSettingsUtil.getInstance();

    return sdksSettingsUtil.getSdksModel();
  }
  else {
    return sdkModel;
  }
}
 
Example #5
Source File: SdkConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
public SdkConfigurable(@Nonnull final SdkImpl sdk,
                       final SdkModel sdksModel,
                       final Runnable updateTree,
                       @Nonnull History history,
                       Project project) {
  super(!sdk.isPredefined(), updateTree);
  mySdk = sdk;
  mySdkEditor = createSdkEditor(sdksModel, history, mySdk);
  final StructureConfigurableContext context = ModuleStructureConfigurable.getInstance(project).getContext();
  myProjectStructureElement = new SdkProjectStructureElement(context, mySdk);
}
 
Example #6
Source File: OCamlSdkType.java    From reasonml-idea-plugin with MIT License 4 votes vote down vote up
@Nullable
@Override
public AdditionalDataConfigurable createAdditionalDataConfigurable(@NotNull SdkModel sdkModel, @NotNull SdkModificator sdkModificator) {
    return new OCamlAdditionalDataConfigurable();
}
 
Example #7
Source File: SdkEditor.java    From consulo with Apache License 2.0 4 votes vote down vote up
public SdkEditor(@Nonnull SdkModel sdkModel, @Nonnull History history, @Nonnull SdkImpl sdk) {
  super(sdkModel, sdk);
  myHistory = history;
}
 
Example #8
Source File: BundleBox.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public static BundleBoxBuilder builder(@Nonnull SdkModel sdkModel, @Nonnull Disposable uiDisposable) {
  return BundleBoxBuilder.create(sdkModel, uiDisposable);
}
 
Example #9
Source File: BundleBoxBuilder.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public static BundleBoxBuilder create(@Nullable SdkModel sdkModel, @Nullable Disposable uiDisposable) {
  return new BundleBoxBuilder(sdkModel, uiDisposable);
}
 
Example #10
Source File: BundleBoxBuilder.java    From consulo with Apache License 2.0 4 votes vote down vote up
private BundleBoxBuilder(@Nullable SdkModel sdkModel, @Nullable Disposable uiDisposable) {
  mySdkModel = sdkModel;
  myUIDisposable = uiDisposable;
}
 
Example #11
Source File: SdkConfigurable.java    From consulo with Apache License 2.0 4 votes vote down vote up
public SdkConfigurable(@Nonnull final SdkImpl sdk, final SdkModel sdksModel, final Runnable updateTree, @Nonnull History history, boolean noContext) {
  super(!sdk.isPredefined(), updateTree);
  mySdk = sdk;
  mySdkEditor = createSdkEditor(sdksModel, history, mySdk);
  myProjectStructureElement = new SdkProjectStructureElement(null, sdk);
}
 
Example #12
Source File: SdkConfigurable.java    From consulo with Apache License 2.0 4 votes vote down vote up
protected BaseSdkEditor createSdkEditor(SdkModel sdksModel, History history, SdkImpl projectJdk) {
  return new SdkEditor(sdksModel, history, projectJdk);
}
 
Example #13
Source File: UIRootConfigurationAccessor.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
@Nullable
public Sdk getSdk(final Sdk sdk, final String sdkName) {
  final SdkModel model = ProjectStructureConfigurable.getInstance(myProject).getSdkConfigurable().getSdksModel();
  return sdkName != null ? model.findSdk(sdkName) : sdk;
}