Skip to content

Commit

Permalink
make use of StatusReporter service
Browse files Browse the repository at this point in the history
  • Loading branch information
bokowski committed Mar 12, 2010
1 parent f2d5b28 commit 5011c53
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;

import org.eclipse.e4.core.services.StatusReporter;
import org.eclipse.e4.core.services.annotations.PostConstruct;
import org.eclipse.e4.core.services.annotations.UIEventHandler;
import org.eclipse.e4.ui.services.IStylingEngine;
Expand All @@ -36,6 +38,7 @@ public class ControlView {
@Inject ContestPlatform platform;
@Inject IStylingEngine stylingEngine;
@Inject @Named("preference-PLAYER_KEY") String playerKey;
@Inject Provider<StatusReporter> statusReporter;

@PostConstruct public void init() {
outerParent.setLayout(new GridLayout());
Expand All @@ -50,7 +53,7 @@ public class ControlView {
createButton("forward", 20, 20, 500);
createSpacer(2);

createButton("hardleft", 20, -20, 500);
createButton("hardleft", -20, -20, 500);
createButton("left", 5, -5, 500);
createSpacer(1);
createButton("right", -5, 5, 500);
Expand All @@ -66,7 +69,6 @@ public class ControlView {

setButtonsEnabled(false);
parent.setLayout(new GridLayout(5, true));
// GridLayoutFactory.fillDefaults().numColumns(5).generateLayout(parent);
}

private void createSpacer(int count) {
Expand All @@ -85,8 +87,8 @@ public void widgetSelected(SelectionEvent e) {
platform.setRobotWheelVelocity(leftMotor, rightMotor, playerKey);
Thread.sleep(duration);
platform.setRobotWheelVelocity(0, 0, playerKey);
} catch (Exception e1) {
e1.printStackTrace();
} catch (Exception ex) {
statusReporter.get().show(StatusReporter.ERROR, "Could not perform the selected rover command", ex);
}
}
});
Expand Down

0 comments on commit 5011c53

Please sign in to comment.