Commit 6884ee1e authored by Ludovic Apvrille's avatar Ludovic Apvrille

Update on cli help

parent 00c7fccd
......@@ -77,7 +77,7 @@ public class Action extends Command {
private final static String NAVIGATE_LEFT_PANEL = "navigate-left-panel";
private final static String GENERIC = "generic";
public Action() {
......@@ -364,22 +364,6 @@ public class Action extends Command {
}
};
// Navigation
Command navigateLeftPanel = new Command() {
public String getCommand() { return NAVIGATE_LEFT_PANEL; }
public String getShortCommand() { return "nlf"; }
public String getDescription() { return "Select the edition panel on the left"; }
public String executeCommand(String command, Interpreter interpreter) {
if (!interpreter.isTToolStarted()) {
return Interpreter.TTOOL_NOT_STARTED;
}
interpreter.mgui.selectPanelOnTheLeft();
return null;
}
};
Command movePanelToTheLeftPanel = new Command() {
public String getCommand() { return NAVIGATE_PANEL_TO_LEFT; }
public String getShortCommand() { return "nptf"; }
......@@ -396,21 +380,7 @@ public class Action extends Command {
}
};
Command generic = new Command() {
public String getCommand() { return GENERIC; }
public String getShortCommand() { return "g"; }
public String getDescription() { return "Apply a generic function of TTool"; }
public String executeCommand(String command, Interpreter interpreter) {
if (!interpreter.isTToolStarted()) {
return Interpreter.TTOOL_NOT_STARTED;
}
ActionPerformer.actionPerformed(interpreter.mgui, null, command.trim(), null);
return null;
}
};
Command generic = new Generic();
addAndSortSubcommand(start);
......@@ -422,9 +392,7 @@ public class Action extends Command {
addAndSortSubcommand(diplodocusOneTraceSimulation);
addAndSortSubcommand(diplodocusGenerateTML);
addAndSortSubcommand(diplodocusUPPAAL);
addAndSortSubcommand(navigateLeftPanel);
addAndSortSubcommand(movePanelToTheLeftPanel);
addAndSortSubcommand(generic);
}
......
......@@ -63,8 +63,8 @@ public class Command implements CommandInterface {
}
public String getCommand() {
return "default";
}
public String getShortCommand() {
return getCommand();
}
......@@ -117,6 +117,7 @@ public class Command implements CommandInterface {
return "";
}
public String getHelp(int level) {
String dec = getLevelString(level);
/*String h = "";
......@@ -139,6 +140,8 @@ public class Command implements CommandInterface {
return b.toString();
}
public String getLevelString(int level) {
String ret = "";
while(level > 0) {
......@@ -174,9 +177,6 @@ public class Command implements CommandInterface {
}
public void addAndSortSubcommand(Command c) {
/*if (subcommands.size() == 0) {
subcommands.add(c);
}*/
int index = 0;
for (Command cmd: subcommands) {
......@@ -188,4 +188,24 @@ public class Command implements CommandInterface {
subcommands.add(index, c);
}
public Command getSubCommandByName(String cmd) {
String comm = cmd;
int index = cmd.indexOf(" ");
if (index > 0) {
comm = cmd.substring(0, index);
}
for (Command c: subcommands) {
if ((c.getShortCommand().compareTo(cmd) == 0) || (c.getCommand().compareTo(cmd) == 0)) {
if (index == -1) {
return c;
}
return c.getSubCommandByName(cmd.substring(index+1, cmd.length()).trim());
}
}
return null;
}
}
/* Copyright or (C) or Copr. GET / ENST, Telecom-Paris, Ludovic Apvrille
*
* ludovic.apvrille AT enst.fr
*
* This software is a computer program whose purpose is to allow the
* edition of TURTLE analysis, design and deployment diagrams, to
* allow the generation of RT-LOTOS or Java code from this diagram,
* and at last to allow the analysis of formal validation traces
* obtained from external tools, e.g. RTL from LAAS-CNRS and CADP
* from INRIA Rhone-Alpes.
*
* This software is governed by the CeCILL license under French law and
* abiding by the rules of distribution of free software. You can use,
* modify and/ or redistribute the software under the terms of the CeCILL
* license as circulated by CEA, CNRS and INRIA at the following URL
* "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
* liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL license and that you accept its terms.
*/
package cli;
import common.ConfigurationTTool;
import common.SpecConfigTTool;
import launcher.RTLLauncher;
import myutil.FileUtils;
import myutil.PluginManager;
import myutil.TraceManager;
import tmltranslator.*;
import tmltranslator.dsez3engine.InputInstance;
import tmltranslator.dsez3engine.OptimizationModel;
import tmltranslator.dsez3engine.OptimizationResult;
import ui.ActionPerformer;
import ui.MainGUI;
import ui.TGComponent;
import ui.TURTLEPanel;
import ui.util.IconManager;
import java.io.File;
import java.util.BitSet;
import java.util.*;
/**
* Class Generic
* Creation: 12/04/2019
* Version 2.0 12/04/2019
*
* @author Ludovic APVRILLE
*/
public class Generic extends Command {
private final static String GENERIC = "generic";
public Generic() {
}
public String getCommand() { return GENERIC; }
public String getShortCommand() { return "g"; }
public String getDescription() { return "Apply a generic function of TTool"; }
public String executeCommand(String command, Interpreter interpreter) {
if (!interpreter.isTToolStarted()) {
return Interpreter.TTOOL_NOT_STARTED;
}
ActionPerformer.actionPerformed(interpreter.mgui, null, command.trim(), null);
return null;
}
public void fillSubCommands() {
}
}
......@@ -101,7 +101,7 @@ public class Help extends Command {
}
Command c = interpreter.getCommandByName(command);
Command c = interpreter.getSubCommandByName(command);
if (c == null) {
return Interpreter.BAD_COMMAND_NAME;
......@@ -109,6 +109,7 @@ public class Help extends Command {
interpreter.print(c.getHelp(1));
return null;
}
......@@ -116,4 +117,6 @@ public class Help extends Command {
public void fillSubCommands() {
}
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment