Java Code Examples for com.intellij.openapi.projectRoots.Sdk#getName()

The following examples show how to use com.intellij.openapi.projectRoots.Sdk#getName() . 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: DuneFacetEditor.java    From reasonml-idea-plugin with MIT License 5 votes vote down vote up
@Override
public boolean isModified() {
    Sdk odk = f_sdkSelect.getSelectedJdk();
    String odkName = odk == null ? "" : odk.getName();
    String confOdkName = m_configuration.sdkName == null ? "" : m_configuration.sdkName;
    return m_configuration.inheritProjectSdk != f_inheritProjectSDKCheck.isSelected()
            || !odkName.equals(confOdkName);
}
 
Example 2
Source File: DuneFacetEditor.java    From reasonml-idea-plugin with MIT License 5 votes vote down vote up
@Override
public void apply() throws ConfigurationException {
    super.apply();
    m_configuration.inheritProjectSdk = f_inheritProjectSDKCheck.isSelected();
    Sdk odk = f_sdkSelect.getSelectedJdk();
    m_configuration.sdkName = odk == null ? null : odk.getName();

    // @TODO see https://github.com/reasonml-editor/reasonml-idea-plugin/issues/243
    // show tool window if dune is now configured
    // should use a listener instead as this doesn't trigger when the facet is removed
    ORToolWindowManager toolWindowManager = ORToolWindowManager.getInstance(m_editorContext.getProject());
    ApplicationManager.getApplication().invokeLater(toolWindowManager::showHideToolWindows);
}
 
Example 3
Source File: OrderEntryAppearanceServiceImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public CellAppearanceEx forSdk(@Nullable final Sdk jdk, final boolean isInComboBox, final boolean selected, final boolean showVersion) {
  if (jdk == null) {
    return SimpleTextCellAppearance.invalid(ProjectBundle.message("unknown.sdk"), AllIcons.Toolbar.Unknown);
  }

  String name = jdk.getName();
  CompositeAppearance appearance = new CompositeAppearance();
  SdkType sdkType = (SdkType)jdk.getSdkType();
  appearance.setIcon(SdkUtil.getIcon(jdk));
  SimpleTextAttributes attributes = getTextAttributes(sdkType.sdkHasValidPath(jdk), selected);
  CompositeAppearance.DequeEnd ending = appearance.getEnding();
  ending.addText(name, attributes);

  if (showVersion) {
    String versionString = jdk.getVersionString();
    if (versionString != null && !versionString.equals(name)) {
      SimpleTextAttributes textAttributes = isInComboBox && !selected ? SimpleTextAttributes.SYNTHETIC_ATTRIBUTES :
                                            SystemInfo.isMac && selected ? new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, 
                                                                                                    Color.WHITE): SimpleTextAttributes.GRAY_ATTRIBUTES;
      ending.addComment(versionString, textAttributes);
    }
  }

  return ending.getAppearance();
}
 
Example 4
Source File: AlternativeJREPanel.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
public AlternativeJREPanel() {
    myCbEnabled = new JBCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox"));

    myFieldWithHistory = new TextFieldWithHistory();
    myFieldWithHistory.setHistorySize(-1);
    final List<String> foundJDKs = new ArrayList<>();
    final Sdk[] allJDKs = ProjectJdkTable.getInstance().getAllJdks();

    String javaHomeOfCurrentProcess = System.getProperty("java.home");
    if (javaHomeOfCurrentProcess != null && !javaHomeOfCurrentProcess.isEmpty()) {
        foundJDKs.add(javaHomeOfCurrentProcess);
    }

    for (Sdk sdk : allJDKs) {
        String name = sdk.getName();
        if (!foundJDKs.contains(name)) {
            foundJDKs.add(name);
        }
    }

    for (Sdk jdk : allJDKs) {
        String homePath = jdk.getHomePath();

        if (!SystemInfo.isMac) {
            final File jre = new File(jdk.getHomePath(), "jre");
            if (jre.isDirectory()) {
                homePath = jre.getPath();
            }
        }

        if (!foundJDKs.contains(homePath)) {
            foundJDKs.add(homePath);
        }
    }

    myFieldWithHistory.setHistory(foundJDKs);
    myPathField = new ComponentWithBrowseButton<>(myFieldWithHistory, null);
    myPathField.addBrowseFolderListener(ExecutionBundle.message("run.configuration.select.alternate.jre.label"),
            ExecutionBundle.message("run.configuration.select.jre.dir.label"),
            null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
            TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);

    setLayout(new MigLayout("ins 0, gap 10, fill, flowx"));
    add(myCbEnabled, "shrinkx");
    add(myPathField, "growx, pushx");

    InsertPathAction.addTo(myFieldWithHistory.getTextEditor());

    myCbEnabled.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            enabledChanged();
        }
    });
    enabledChanged();

    setAnchor(myCbEnabled);

    updateUI();
}
 
Example 5
Source File: BundleBox.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
public String getBundleName() {
  Sdk bundle = getBundle();
  return bundle != null ? bundle.getName() : null;
}