-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WizardID is now UICommandID and must be specified for each UICommand …
…instance.
- Loading branch information
1 parent
8952e2b
commit 16fbf4c
Showing
21 changed files
with
442 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
aesh/src/main/java/org/jboss/forge/aesh/commands/ExitCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright 2012 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.jboss.forge.aesh.commands; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.jboss.aesh.console.Console; | ||
import org.jboss.forge.aesh.ShellContext; | ||
import org.jboss.forge.ui.Result; | ||
import org.jboss.forge.ui.UICommand; | ||
import org.jboss.forge.ui.UICommandID; | ||
import org.jboss.forge.ui.UIContext; | ||
import org.jboss.forge.ui.UIInput; | ||
import org.jboss.forge.ui.UIValidationContext; | ||
import org.jboss.forge.ui.base.SimpleUICommandID; | ||
|
||
/** | ||
* @author <a href="mailto:stale.pedersen@jboss.org">Ståle W. Pedersen</a> | ||
*/ | ||
public class ExitCommand implements UICommand | ||
{ | ||
private Console console; | ||
|
||
@Inject | ||
private UIInput<String> exit; | ||
|
||
@Inject | ||
private UIInput<String> quit; | ||
|
||
public ExitCommand(Console console) | ||
{ | ||
setConsole(console); | ||
} | ||
|
||
@Override | ||
public UICommandID getId() | ||
{ | ||
return new SimpleUICommandID("exit", "Exit the shell"); | ||
} | ||
|
||
private void setConsole(Console console) | ||
{ | ||
this.console = console; | ||
} | ||
|
||
@Override | ||
public void initializeUI(UIContext context) throws Exception | ||
{ | ||
exit.setLabel("exit"); | ||
exit.setRequired(true); | ||
context.getUIBuilder().add(exit); | ||
|
||
quit.setLabel("quit"); | ||
quit.setRequired(true); | ||
context.getUIBuilder().add(quit); | ||
|
||
if (context instanceof ShellContext) | ||
{ | ||
((ShellContext) context).setStandalone(false); | ||
} | ||
} | ||
|
||
@Override | ||
public void validate(UIValidationContext context) | ||
{ | ||
} | ||
|
||
@Override | ||
public Result execute(UIContext context) throws Exception | ||
{ | ||
console.stop(); | ||
return Result.success(""); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
aesh/src/main/java/org/jboss/forge/aesh/commands/QuitCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Copyright 2012 Red Hat, Inc. and/or its affiliates. | ||
* | ||
* Licensed under the Eclipse Public License version 1.0, available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.jboss.forge.aesh.commands; | ||
|
||
import org.jboss.aesh.console.Console; | ||
import org.jboss.forge.ui.UICommandID; | ||
import org.jboss.forge.ui.base.SimpleUICommandID; | ||
|
||
/** | ||
* @author <a href="mailto:stale.pedersen@jboss.org">Ståle W. Pedersen</a> | ||
*/ | ||
public class QuitCommand extends ExitCommand | ||
{ | ||
public QuitCommand(Console console) | ||
{ | ||
super(console); | ||
} | ||
|
||
@Override | ||
public UICommandID getId() | ||
{ | ||
return new SimpleUICommandID("quit", "Exit the shell"); | ||
} | ||
} |
Oops, something went wrong.