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 @@ -21,7 +21,7 @@
import consulo.project.Project;
import consulo.ui.CheckBox;
import consulo.ui.Component;
import consulo.ui.ComponentItemRender;
import consulo.ui.ComponentItemRenderer;
import consulo.ui.PseudoComponent;
import consulo.ui.Table;
import consulo.ui.TableItemEditor;
Expand Down Expand Up @@ -76,36 +76,38 @@ public UnifiedClassFilterEditor(Project project, com.intellij.java.language.util
myTable.setShowHeader(false);
myTable.addColumn(LocalizeValue.empty(), row -> row.myFilter.isEnabled())
.setWidth(40)
.setRender(ComponentItemRender.reusable(
.setRenderer(ComponentItemRenderer.reusable(
() -> CheckBox.create(LocalizeValue.empty()),
(checkBox, item) -> checkBox.setValue(Boolean.TRUE.equals(item.getValue()))
))
.setEditor(new TableItemEditor<>() {
@RequiredUIAccess
@Override
@RequiredUIAccess
public ValueComponent<Boolean> createComponent(FilterRow row) {
return CheckBox.create(LocalizeValue.empty(), row.myFilter.isEnabled());
}

@RequiredUIAccess
@Override
@RequiredUIAccess
public void commit(FilterRow row, @Nullable Boolean value) {
row.myFilter.setEnabled(Boolean.TRUE.equals(value));
myModel.update(row);
}
});
myTable.addColumn(LocalizeValue.empty(), row -> row.myFilter.getPattern())
.setRender((presentation, value, row) ->
presentation.append(StringUtil.notNullize(value.getValue()), row.myFilter.isEnabled() ? TextAttribute.REGULAR : TextAttribute.GRAYED))
.setRenderer((presentation, value, row) -> presentation.append(
StringUtil.notNullize(value.getValue()),
row.myFilter.isEnabled() ? TextAttribute.REGULAR : TextAttribute.GRAYED
))
.setEditor(new TableItemEditor<>() {
@RequiredUIAccess
@Override
@RequiredUIAccess
public ValueComponent<String> createComponent(FilterRow row) {
return TextBox.create(row.myFilter.getPattern());
}

@RequiredUIAccess
@Override
@RequiredUIAccess
public void commit(FilterRow row, @Nullable String value) {
row.myFilter.setPattern(StringUtil.notNullize(value).trim());
myModel.update(row);
Expand Down Expand Up @@ -139,7 +141,12 @@ protected void doAdd(AnActionEvent e) {
.disableAction(DownMoveAction.class);

if (!myProject.isDefault() && !myProject.getApplication().isUnifiedApplication()) {
builder.addExtraAction(DumbAwareAction.create(getAddButtonText(), LocalizeValue.empty(), getAddButtonIcon(), e -> addClassFilter()));
builder.addExtraAction(DumbAwareAction.create(
getAddButtonText(),
LocalizeValue.empty(),
getAddButtonIcon(),
e -> addClassFilter()
));
if (addPatternButtonVisible()) {
builder.addExtraAction(DumbAwareAction.create(
getAddPatternButtonText(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public UnifiedConfigurationModuleSelector(Project project, LocalizeValue emptySe
super(project);
myModel = FlatDataModel.of(List.of(ModuleItem.NONE));
myComboBox = ComboBox.create(myModel);
myComboBox.setRender((presentation, item) -> {
myComboBox.setRenderer((presentation, item) -> {
ModuleItem moduleItem = item.getValue();
Module module = moduleItem == null ? null : moduleItem.module();
if (module == null) {
Expand All @@ -74,7 +74,7 @@ public Component getComponent() {
return myComboBox;
}

public Disposable addValueListener(Consumer<@Nullable Module> listener) {
public Disposable addValueListener(@RequiredUIAccess Consumer<@Nullable Module> listener) {
return myComboBox.addValueListener(event -> {
ModuleItem item = event.getValue();
listener.accept(item == null ? null : item.module());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public Component getComponent() {
return myBundleBox.getSelectedBundleName();
}

@RequiredUIAccess
public boolean isAlternativeJreSelected() {
return !(myBundleBox.getComponent().getValue() instanceof BundleBox.NullBundleBoxItem);
}
Expand All @@ -57,7 +58,8 @@ public void setByName(@Nullable String name) {
myBundleBox.setSelectedBundle(StringUtil.nullize(name, true));
}

public Disposable addValueListener(Runnable listener) {
@RequiredUIAccess
public Disposable addValueListener(@RequiredUIAccess Runnable listener) {
return myBundleBox.getComponent().addValueListener(event -> listener.run());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public UnifiedShortenCommandLineModeCombo(
myModuleSelector = moduleSelector;
myModel = FlatDataModel.of(List.of());
myComboBox = ComboBox.create(myModel);
myComboBox.setRender((presentation, renderItem) -> {
myComboBox.setRenderer((presentation, renderItem) -> {
Item item = renderItem.getValue();
if (item == null) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package consulo.java.impl.module.extension.ui;

import com.intellij.java.compiler.impl.javaCompiler.TargetOptionsComponent;
Expand Down Expand Up @@ -66,7 +65,7 @@

/**
* @author VISTALL
* @since 15.03.2015
* @since 2015-03-15
*/
public final class JavaModuleExtensionPanel {
private JavaModuleExtensionPanel() {
Expand Down Expand Up @@ -217,7 +216,7 @@ private static ComboBox<Object> createLanguageLevelBox(JavaMutableModuleExtensio
}

ComboBox<Object> languageLevelBox = ComboBox.create(items);
languageLevelBox.setRender((presentation, item) -> {
languageLevelBox.setRenderer((presentation, item) -> {
Object value = item.getValue();
if (value == ObjectUtil.NULL) {
presentation.append(TargetOptionsComponent.COMPILER_DEFAULT, TextAttribute.GRAYED);
Expand Down Expand Up @@ -249,7 +248,7 @@ else if (value instanceof LanguageLevel languageLevel) {
inheritableLanguageLevel.set(null, languageLevel.getName());
}
else if (value == ObjectUtil.NULL) {
inheritableLanguageLevel.set((String) null, (String) null);
inheritableLanguageLevel.set((String) null, null);
}
else if (value != null) {
inheritableLanguageLevel.set(value.toString(), null);
Expand Down
Loading