Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new button to refresh all known tasks via repair action #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 @@ -9,8 +9,9 @@

package com.google.eclipse.mechanic.plugin.ui;

import com.google.eclipse.mechanic.Task;
import java.util.Collection;

import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.CellLabelProvider;
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
Expand All @@ -28,7 +29,9 @@
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.ui.dialogs.ListDialog;

import java.util.Collection;
import com.google.eclipse.mechanic.MechanicService;
import com.google.eclipse.mechanic.Task;
import com.google.eclipse.mechanic.plugin.core.MechanicLog;

/**
* Allows the user to pick a single Task from a list of Tasks.
Expand Down Expand Up @@ -105,6 +108,24 @@ public String getColumnText(Task item, int columnIndex) {
}
}

@Override
protected void createButtonsForButtonBar(final Composite parent) {
createButton(parent, IDialogConstants.PROCEED_ID, "Repair all tasks", true);
super.createButtonsForButtonBar(parent);
}

@Override
protected void buttonPressed(final int buttonId) {
super.buttonPressed(buttonId);
if (buttonId == IDialogConstants.PROCEED_ID) {
MechanicLog.getDefault().logInfo("Repairing all tasks");
for (final Task task : MechanicService.getInstance().getAllKnownTasks()) {
task.getRepairAction().run();
}
okPressed();
}
}

/**
* Serializes Tasks for use in user facing dialogs.
*/
Expand Down