|
Last change
on this file since b918031 was b918031, checked in by Frederik Heber <heber@…>, 16 years ago |
|
new query class EmptyQuery for showing text messages.
Signed-off-by: Frederik Heber <heber@…>
|
-
Property mode
set to
100644
|
|
File size:
1.5 KB
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | * HelpAction.cpp
|
|---|
| 3 | *
|
|---|
| 4 | * Created on: May 8, 2010
|
|---|
| 5 | * Author: heber
|
|---|
| 6 | */
|
|---|
| 7 |
|
|---|
| 8 | #include "Actions/CmdAction/HelpAction.hpp"
|
|---|
| 9 | #include "CommandLineParser.hpp"
|
|---|
| 10 |
|
|---|
| 11 | #include <iostream>
|
|---|
| 12 | #include <string>
|
|---|
| 13 |
|
|---|
| 14 | using namespace std;
|
|---|
| 15 |
|
|---|
| 16 | #include "UIElements/UIFactory.hpp"
|
|---|
| 17 | #include "UIElements/Dialog.hpp"
|
|---|
| 18 |
|
|---|
| 19 | const char CommandLineHelpAction::NAME[] = "help";
|
|---|
| 20 |
|
|---|
| 21 | CommandLineHelpAction::CommandLineHelpAction() :
|
|---|
| 22 | Action(NAME)
|
|---|
| 23 | {}
|
|---|
| 24 |
|
|---|
| 25 | CommandLineHelpAction::~CommandLineHelpAction()
|
|---|
| 26 | {}
|
|---|
| 27 |
|
|---|
| 28 | Action::state_ptr CommandLineHelpAction::performCall() {
|
|---|
| 29 | ostringstream usage;
|
|---|
| 30 | Dialog *dialog = UIFactory::getInstance().makeDialog();
|
|---|
| 31 |
|
|---|
| 32 | usage << CommandLineParser::getInstance().visible << endl;
|
|---|
| 33 | dialog->queryEmpty(NAME, usage.str());
|
|---|
| 34 |
|
|---|
| 35 | if(dialog->display()) {
|
|---|
| 36 | delete dialog;
|
|---|
| 37 | return Action::success;
|
|---|
| 38 | } else {
|
|---|
| 39 | delete dialog;
|
|---|
| 40 | return Action::failure;
|
|---|
| 41 | }
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | Action::state_ptr CommandLineHelpAction::performUndo(Action::state_ptr _state) {
|
|---|
| 45 | // ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
|
|---|
| 46 |
|
|---|
| 47 | return Action::failure;
|
|---|
| 48 | // string newName = state->mol->getName();
|
|---|
| 49 | // state->mol->setName(state->lastName);
|
|---|
| 50 | //
|
|---|
| 51 | // return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | Action::state_ptr CommandLineHelpAction::performRedo(Action::state_ptr _state){
|
|---|
| 55 | return Action::failure;
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | bool CommandLineHelpAction::canUndo() {
|
|---|
| 59 | return false;
|
|---|
| 60 | }
|
|---|
| 61 |
|
|---|
| 62 | bool CommandLineHelpAction::shouldUndo() {
|
|---|
| 63 | return false;
|
|---|
| 64 | }
|
|---|
| 65 |
|
|---|
| 66 | const string CommandLineHelpAction::getName() {
|
|---|
| 67 | return NAME;
|
|---|
| 68 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.