Skip to content

Commit

Permalink
(#325) Changed the way icons are loaded
Browse files Browse the repository at this point in the history
This is probably due to the change in UI on the intellij-side.
It seems the builtin add/remove icons were removed and replaced by new
ones. These needed a different kind of "loading".
  • Loading branch information
nils-a committed Aug 26, 2023
1 parent a578189 commit e23d7e5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<icon value="general/add.png"/>
<maximumSize width="30" height="30"/>
<minimumSize width="30" height="30"/>
<preferredSize width="30" height="30"/>
Expand All @@ -99,7 +98,6 @@
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<icon value="general/remove.png"/>
<label value=""/>
<maximumSize width="30" height="30"/>
<minimumSize width="30" height="30"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.cakebuild.settings;

import icons.CakeIcons;
import net.cakebuild.shared.ui.RegexCellEditor;

import javax.swing.JButton;
Expand Down Expand Up @@ -45,6 +46,7 @@ public CakeRunnerSettingsEditor() {
regexCellEditor.setOnValidationError(s -> { setValidationError(s); return null; });
regexCellEditor.setOnValidationSuccess(() -> { setValidationError(null); return null; });
overrides.getColumnModel().getColumn(0).setCellEditor(regexCellEditor);
addButton.setIcon(CakeIcons.GeneralAdd);
addButton.addActionListener(e -> {
model.addRow(new Object[]{"",""});
int row = model.getRowCount()-1;
Expand All @@ -54,6 +56,7 @@ public CakeRunnerSettingsEditor() {
Component textEdit = overrides.prepareEditor(editor, row, 0);
textEdit.requestFocus();
});
removeButton.setIcon(CakeIcons.GeneralRemove);
removeButton.setEnabled(false);
removeButton.addActionListener(e -> {
int row = overrides.getSelectedRow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<icon value="general/add.png"/>
<maximumSize width="30" height="30"/>
<minimumSize width="30" height="30"/>
<opaque value="true"/>
Expand All @@ -43,7 +42,6 @@
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<icon value="general/remove.png"/>
<label value=""/>
<maximumSize width="30" height="30"/>
<minimumSize width="30" height="30"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package net.cakebuild.settings.controls;

import icons.CakeIcons;

import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellEditor;
Expand Down Expand Up @@ -34,6 +36,7 @@ public SimpleAddEditControl(String[] headers, Supplier<String[]> newItemGenerato
int row = table.getSelectedRow();
removeItem.setEnabled(row >= 0);
});
addItem.setIcon(CakeIcons.GeneralAdd);
addItem.addActionListener(e -> {
model.addRow(newItemGenerator.get());
int row = model.getRowCount()-1;
Expand All @@ -43,6 +46,7 @@ public SimpleAddEditControl(String[] headers, Supplier<String[]> newItemGenerato
Component textEdit = table.prepareEditor(editor, row, 0);
textEdit.requestFocus();
});
removeItem.setIcon(CakeIcons.GeneralRemove);
removeItem.setEnabled(false);
removeItem.addActionListener(e -> {
int row = table.getSelectedRow();
Expand Down
6 changes: 6 additions & 0 deletions src/rider/src/main/kotlin/icons/CakeIcons.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@ object CakeIcons {

@JvmField
val CakeTestProjectTemplate = IconLoader.getIcon("/icons/CakeTestProject.svg", CakeIcons.javaClass)

@JvmField
val GeneralAdd = IconLoader.getIcon("/general/add.svg", CakeIcons.javaClass)

@JvmField
val GeneralRemove = IconLoader.getIcon("/general/remove.svg", CakeIcons.javaClass)
}
2 changes: 1 addition & 1 deletion src/rider/src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<projectConfigurable parentId="build" instance="net.cakebuild.settings.CakeGeneralSettingsConfigurable"
id="net.cakebuild.settings.cake" displayName="Cake" nonDefaultProject="false" />
<projectConfigurable parentId="net.cakebuild.settings.cake" instance="net.cakebuild.settings.CakeSearchPathSettingsConfigurable"
id="net.cakebuild.settings.cake.runner.paths" displayName="Search paths" nonDefaultProject="false" />
id="net.cakebuild.settings.cake.runner.paths" displayName="Search Paths" nonDefaultProject="false" />
<projectConfigurable parentId="net.cakebuild.settings.cake" instance="net.cakebuild.settings.CakeRunnerSettingsConfigurable"
id="net.cakebuild.settings.cake.runner" displayName="Runner" nonDefaultProject="false" />
<projectService serviceImplementation="net.cakebuild.settings.CakeSettings" />
Expand Down

0 comments on commit e23d7e5

Please sign in to comment.