Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.updateSettings.impl.pluginsAdvertisement.PluginsAdvertiser;
import com.intellij.platform.ProjectTemplate;
import com.microsoft.azure.hdinsight.projects.HDInsightExternalSystem;
import com.microsoft.azure.hdinsight.projects.HDInsightModuleBuilder;
import com.microsoft.azure.hdinsight.projects.HDInsightProjectTemplate;
import com.microsoft.azure.hdinsight.projects.HDInsightTemplatesType;
import com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager;
import com.microsoft.intellij.ui.AccessibleListCellRenderer;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
Expand All @@ -39,10 +41,20 @@ public class HDInsightProjectTypeStep extends ModuleWizardStep implements Dispos

public HDInsightProjectTypeStep(HDInsightModuleBuilder moduleBuilder) {
this.moduleBuilder = moduleBuilder;
this.scalaPluginInstalled = PluginManager.getPlugin(PluginId.findId(SCALA_PLUGIN_ID)) != null;
this.scalaPluginInstalled = PluginManagerCore.getPlugin(PluginId.findId(SCALA_PLUGIN_ID)) != null;

this.templateList.addListSelectionListener(e -> onTemplateSelected());
this.templateList.setTemplates(moduleBuilder.getTemplates(), false);

var templateListView = this.templateList.getList();
templateListView.setCellRenderer(new AccessibleListCellRenderer<>() {
@NotNull
@Override
public String getText(ProjectTemplate template) {
return template.getName();
}
});

checkScalaPlugin();

this.externalSystemsLabel.setText("Build tool:");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/

package com.microsoft.intellij.ui

import com.intellij.ui.SimpleListCellRenderer
import com.intellij.util.ui.JBUI
import javax.swing.JList

abstract class AccessibleListCellRenderer<T>() : SimpleListCellRenderer<T>() {
override fun customize(list: JList<out T>, value: T, index: Int, selected: Boolean, hasFocus: Boolean) {
text = getText(value)

if (selected) {
background = JBUI.CurrentTheme.List.Selection.background(hasFocus)
foreground = JBUI.CurrentTheme.List.Selection.foreground(hasFocus)
}
}

abstract fun getText(value: T): String
}