Skip to content

Commit

Permalink
add stop build command
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Jul 9, 2012
1 parent 5a8b8fc commit 37a1d00
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
Expand Up @@ -204,6 +204,8 @@ well as menu structures (for main menu and popup menus).
<cmd refid="buildSourcePackage"/>
<cmd refid="buildBinaryPackage"/>
<separator/>
<cmd refid="stopBuild"/>
<separator/>
<cmd refid="buildToolsProjectSetup"/>
</menu>

Expand Down Expand Up @@ -1045,6 +1047,10 @@ well as menu structures (for main menu and popup menus).
menuLabel="_Check Package"
desc="R CMD check"/>

<cmd id="stopBuild"
menuLabel="Sto_p Build"
desc="Stop the current build"/>

<cmd id="buildToolsProjectSetup"
menuLabel="Configure Build _Tools..."
desc="Configure build tools"/>
Expand Down
Expand Up @@ -245,6 +245,7 @@
public abstract AppCommand buildSourcePackage();
public abstract AppCommand buildBinaryPackage();
public abstract AppCommand checkPackage();
public abstract AppCommand stopBuild();
public abstract AppCommand buildToolsProjectSetup();
public abstract AppCommand activateBuild();

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Expand Up @@ -65,15 +65,19 @@ public BuildPresenter(Display display,
sourceShim_ = sourceShim;
uiPrefs_ = uiPrefs;
eventBus_ = eventBus;

commands_ = commands;

eventBus.addHandler(BuildStartedEvent.TYPE,
new BuildStartedEvent.Handler()
{
@Override
public void onBuildStarted(BuildStartedEvent event)
{
commands.stopBuild().setEnabled(true);

view_.bringToFront();
view_.buildStarted();

}
});

Expand All @@ -93,6 +97,8 @@ public void onBuildOutput(BuildOutputEvent event)
@Override
public void onBuildCompleted(BuildCompletedEvent event)
{
commands.stopBuild().setEnabled(false);

view_.bringToFront();
view_.buildCompleted();
if (event.getRestartR())
Expand All @@ -105,7 +111,7 @@ public void onBuildCompleted(BuildCompletedEvent event)
@Override
public void onClick(ClickEvent event)
{
terminateBuild();
commands.stopBuild().execute();
}
});
}
Expand All @@ -116,6 +122,10 @@ public void initialize(BuildState buildState)
view_.showOutput(buildState.getOutput());
if (!buildState.isRunning())
view_.buildCompleted();
else
commands_.stopBuild().setEnabled(true);


}

public void initializeAfterRestart(BuildRestartContext context)
Expand Down Expand Up @@ -192,7 +202,7 @@ protected void onSuccess(Boolean response)
}
}

private void terminateBuild()
void onStopBuild()
{
server_.terminateBuild(new DelayedProgressRequestCallback<Boolean>(
"Terminating Build..."){
Expand Down Expand Up @@ -229,4 +239,5 @@ public void execute()
private final BuildServerOperations server_;
private final Display view_ ;
private final EventBus eventBus_;
private final Commands commands_;
}
Expand Up @@ -46,6 +46,8 @@ public abstract static class Shim extends DelayLoadTabShim<BuildPresenter, Build
@Handler
public abstract void onBuildBinaryPackage();
@Handler
public abstract void onStopBuild();
@Handler
public abstract void onCheckPackage();

abstract void initialize(BuildState buildState);
Expand All @@ -64,6 +66,9 @@ public BuildTab(final Shim shim,
session_ = session;
binder.bind(commands, shim);

// stop build always starts out disabled
commands.stopBuild().setEnabled(false);

eventBus.addHandler(SessionInitEvent.TYPE, new SessionInitHandler() {
public void onSessionInit(SessionInitEvent sie)
{
Expand Down

0 comments on commit 37a1d00

Please sign in to comment.