use of com.intellij.facet.impl.ui.libraries.LibraryOptionsPanel in project intellij-community by JetBrains.
the class GroovySdkWizardStepBase method getPanel.
protected LibraryOptionsPanel getPanel() {
if (myPanel == null) {
final GroovyLibraryDescription libraryDescription = myFramework == null ? new GroovyLibraryDescription() : myFramework.createLibraryDescription();
final String baseDirPath = myBasePath != null ? FileUtil.toSystemIndependentName(myBasePath) : "";
myPanel = new LibraryOptionsPanel(libraryDescription, baseDirPath, FrameworkLibraryVersionFilter.ALL, myLibrariesContainer, false);
Disposer.register(myDisposable, myPanel);
}
return myPanel;
}
use of com.intellij.facet.impl.ui.libraries.LibraryOptionsPanel in project kotlin by JetBrains.
the class KotlinModuleSettingStep method isLibrarySelected.
private Boolean isLibrarySelected() {
try {
// TODO: Get rid of this hack
LibraryOptionsPanel panel = getLibraryPanel();
Class<LibraryOptionsPanel> panelClass = LibraryOptionsPanel.class;
Field modelField = ArraysKt.singleOrNull(panelClass.getDeclaredFields(), new Function1<Field, Boolean>() {
@Override
public Boolean invoke(Field field) {
return RadioButtonEnumModel.class.isAssignableFrom(field.getType());
}
});
if (modelField == null) {
LOG.error("There must be exactly one field of type RadioButtonEnumModel: " + Arrays.toString(panelClass.getDeclaredFields()));
return false;
}
modelField.setAccessible(true);
RadioButtonEnumModel enumModel = (RadioButtonEnumModel) modelField.get(panel);
int ordinal = enumModel.getSelected().ordinal();
if (ordinal == 0) {
Field libComboboxField = ArraysKt.singleOrNull(panelClass.getDeclaredFields(), new Function1<Field, Boolean>() {
@Override
public Boolean invoke(Field field) {
return JComboBox.class.isAssignableFrom(field.getType());
}
});
if (libComboboxField == null) {
LOG.error("There must be exactly one field of type JComboBox: " + Arrays.toString(panelClass.getDeclaredFields()));
return false;
}
libComboboxField.setAccessible(true);
JComboBox combobox = (JComboBox) libComboboxField.get(panel);
return combobox.getSelectedItem() != null;
}
return ordinal != 2;
} catch (Exception e) {
LOG.warn("Error in reflection", e);
}
return null;
}
use of com.intellij.facet.impl.ui.libraries.LibraryOptionsPanel in project kotlin by JetBrains.
the class KotlinModuleSettingStep method getLibraryPanel.
protected LibraryOptionsPanel getLibraryPanel() {
if (libraryOptionsPanel == null) {
String baseDirPath = basePath != null ? FileUtil.toSystemIndependentName(basePath) : "";
libraryOptionsPanel = new LibraryOptionsPanel(customLibraryDescription, baseDirPath, FrameworkLibraryVersionFilter.ALL, librariesContainer, false);
}
return libraryOptionsPanel;
}
Aggregations