consulo.roots.ui.configuration.SdkComboBox Java Examples

The following examples show how to use consulo.roots.ui.configuration.SdkComboBox. 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: BaseInternalCompilerProvider.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Override
public void insertCustomSdkItems(@Nullable DotNetSimpleModuleExtension extension, @Nonnull SdkComboBox comboBox)
{
	if(extension == null)
	{
		return;
	}

	if(extension.getId().equals(getExtensionId()))
	{
		Sdk sdk = extension.getSdk();
		if(sdk == null)
		{
			return;
		}

		VirtualFile homeDirectory = sdk.getHomeDirectory();
		if(homeDirectory == null)
		{
			return;
		}

		VirtualFile child = homeDirectory.findChild(CSharpCompilerUtil.COMPILER_NAME);
		if(child != null)
		{
			comboBox.insertCustomSdkItem(CSharpModuleExtension.INTERNAL_SDK_KEY, "<internal>", getIcon());
		}
	}
}
 
Example #2
Source File: CSharpCompilerProvider.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
public void insertCustomSdkItems(@Nullable DotNetSimpleModuleExtension extension, @Nonnull SdkComboBox comboBox)
{
}
 
Example #3
Source File: CSharpSetupStep.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
public CSharpSetupStep(CSharpNewModuleContext context)
{
	super(context);

	JPanel panel = new JPanel(new VerticalFlowLayout());

	myTargetComboBox = new ComboBox<>(DotNetTarget.values());
	myTargetComboBox.setRenderer(new ColoredListCellRenderer<DotNetTarget>()
	{
		@Override
		protected void customizeCellRenderer(@Nonnull JList<? extends DotNetTarget> jList, DotNetTarget target, int i, boolean b, boolean b1)
		{
			append(target.getDescription());
		}
	});
	myTargetComboBox.addItemListener(e -> {
		if(e.getStateChange() == ItemEvent.SELECTED)
		{
			context.setTarget((DotNetTarget) myTargetComboBox.getSelectedItem());
		}
	});

	panel.add(myTargetComponent = LabeledComponent.create(myTargetComboBox, "Target"));

	List<String> validSdkTypes = new SmartList<>();
	for(Map.Entry<String, String[]> entry : CSharpNewModuleBuilder.ourExtensionMapping.entrySet())
	{
		// need check C# extension
		ModuleExtensionProviderEP providerEP = ModuleExtensionProviders.findProvider(entry.getValue()[1]);
		if(providerEP == null)
		{
			continue;
		}
		validSdkTypes.add(entry.getKey());
	}

	myComboBox = new SdkComboBox(SdkTable.getInstance(), sdkTypeId -> validSdkTypes.contains(sdkTypeId.getName()), false);
	myComboBox.addItemListener(e -> {
		if(e.getStateChange() == ItemEvent.SELECTED)
		{
			context.setSdk(myComboBox.getSelectedSdk());
		}
	});
	context.setSdk(myComboBox.getSelectedSdk());

	panel.add(LabeledComponent.create(myComboBox, ".NET SDK"));

	myAdditionalContentPanel.add(panel, BorderLayout.NORTH);
}