Skip to content

Commit

Permalink
JBIDE-18173: Remove button instance variables and enableButtons() method
Browse files Browse the repository at this point in the history
  • Loading branch information
koentsje committed Sep 5, 2014
1 parent 979dd41 commit 603aba7
Showing 1 changed file with 0 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ public class ForgeInstallationsPreferencePage extends PreferencePage implements
private final int DEFAULT_COLUMN_WIDTH = 350/3 +1;

private CheckboxTableViewer runtimesTableViewer ;
private Button removeButton;
private Button editButton;
private ArrayList<ForgeRuntime> runtimes = null;
private ForgeRuntime defaultRuntime = null;
private boolean refreshNeeded = false;
Expand All @@ -59,7 +57,6 @@ protected Control createContents(Composite parent) {
createVerticalSpacer(parent);
createPageBody(parent);
initializeForgeInstallations();
enableButtons();
return parent;
}

Expand Down Expand Up @@ -89,11 +86,6 @@ private void createRuntimesTableViewer(Table table) {
runtimesTableViewer = new CheckboxTableViewer(table);
runtimesTableViewer.setLabelProvider(new ForgeInstallationLabelProvider());
runtimesTableViewer.setContentProvider(ArrayContentProvider.getInstance());
runtimesTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent evt) {
enableButtons();
}
});
runtimesTableViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(final CheckStateChangedEvent event) {
if (runtimesTableViewer.getCheckedElements().length == 0) {
Expand Down Expand Up @@ -189,23 +181,6 @@ private void refreshForgeInstallations() {
runtimesTableViewer.refresh();
}

private void enableButtons() {
Object selectedObject = null;
IStructuredSelection selection = (IStructuredSelection) runtimesTableViewer.getSelection();
if (selection != null) {
selectedObject = selection.getFirstElement();
}
if (selectedObject == null
|| (selectedObject instanceof ForgeRuntime
&& ForgeRuntimeType.EMBEDDED.equals(((ForgeRuntime)selectedObject).getType()))) {
removeButton.setEnabled(false);
editButton.setEnabled(false);
} else {
removeButton.setEnabled(selectedObject != runtimesTableViewer.getCheckedElements()[0]);
editButton.setEnabled(true);
}
}

public boolean performOk() {
if (refreshNeeded) {
final boolean[] canceled = new boolean[] {false};
Expand Down

0 comments on commit 603aba7

Please sign in to comment.