diff --git a/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCell.java b/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCell.java index b6f18a604..e3a9c6969 100644 --- a/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCell.java +++ b/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCell.java @@ -239,5 +239,9 @@ public class ContributedLibraryTableCell { return description; } - + public void setButtonsVisible(boolean enabled) { + installButton.setEnabled(enabled); + buttonsPanel.setVisible(enabled); + inactiveButtonsPanel.setVisible(!enabled); + } } diff --git a/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellEditor.java b/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellEditor.java index b2f00c423..b199be910 100644 --- a/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellEditor.java +++ b/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellEditor.java @@ -141,9 +141,7 @@ public class ContributedLibraryTableCellEditor extends InstallerTableCell { @Override public void setEnabled(boolean enabled) { - editorCell.installButton.setEnabled(enabled); - editorCell.buttonsPanel.setVisible(enabled); - editorCell.inactiveButtonsPanel.setVisible(!enabled); + editorCell.setButtonsVisible(enabled); } public void setStatus(String status) { diff --git a/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellRenderer.java b/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellRenderer.java index 5fae977de..785467584 100644 --- a/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellRenderer.java +++ b/app/src/cc/arduino/contributions/libraries/ui/ContributedLibraryTableCellRenderer.java @@ -44,10 +44,7 @@ public class ContributedLibraryTableCellRenderer implements TableCellRenderer { int column) { ContributedLibraryTableCell cell = new ContributedLibraryTableCell(); - cell.installButton.setEnabled(false); - cell.buttonsPanel.setVisible(false); - cell.inactiveButtonsPanel.setVisible(true); - + cell.setButtonsVisible(false); cell.update(table, value, isSelected, row, false); if (row % 2 == 0) { diff --git a/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCell.java b/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCell.java index 00dd772e9..4ab7c2a5f 100644 --- a/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCell.java +++ b/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCell.java @@ -278,4 +278,11 @@ public class ContributedPlatformTableCell { return description; } + public void setButtonsVisible(boolean enabled) { + installButton.setEnabled(enabled); + removeButton.setEnabled(enabled); + buttonsPanel.setVisible(enabled); + inactiveButtonsPanel.setVisible(!enabled); + } + } diff --git a/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellEditor.java b/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellEditor.java index 047399806..b5b2f8f5c 100644 --- a/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellEditor.java +++ b/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellEditor.java @@ -138,10 +138,7 @@ public class ContributedPlatformTableCellEditor extends InstallerTableCell { @Override public void setEnabled(boolean enabled) { - editorCell.installButton.setEnabled(enabled); - editorCell.removeButton.setEnabled(enabled); - editorCell.buttonsPanel.setVisible(enabled); - editorCell.inactiveButtonsPanel.setVisible(!enabled); + editorCell.setButtonsVisible(enabled); } public void setStatus(String status) { diff --git a/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellRenderer.java b/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellRenderer.java index 85339adfe..23585dab0 100644 --- a/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellRenderer.java +++ b/app/src/cc/arduino/contributions/packages/ui/ContributedPlatformTableCellRenderer.java @@ -43,10 +43,7 @@ public class ContributedPlatformTableCellRenderer implements TableCellRenderer { boolean hasFocus, int row, int column) { ContributedPlatformTableCell cell = new ContributedPlatformTableCell(); - cell.installButton.setEnabled(false); - cell.removeButton.setEnabled(false); - cell.buttonsPanel.setVisible(false); - cell.inactiveButtonsPanel.setVisible(true); + cell.setButtonsVisible(false); cell.update(table, value, isSelected, row, false); if (row % 2 == 0) {