Compare commits
5 Commits
gclc-1.2.4
...
gclc-1.2.5
| Author | SHA1 | Date | |
|---|---|---|---|
| 70a71c06a7 | |||
| a0202de532 | |||
| caa00f2a61 | |||
| eed6f43aea | |||
| 59ab689a36 |
@@ -1,57 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright E. Bigeon (2015)
|
|
||||||
*
|
|
||||||
* emmanuel@bigeon.fr
|
|
||||||
*
|
|
||||||
* This software is a computer program whose purpose is to
|
|
||||||
* provide a swt window for console applications.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
* gclc-swt:fr.bigeon.gclc.swt.HistoryTextKeyListenerTest.java
|
|
||||||
* Created on: Jun 9, 2016
|
|
||||||
*/
|
|
||||||
package fr.bigeon.gclc.swt;
|
|
||||||
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* TODO
|
|
||||||
*
|
|
||||||
* @author Emmanuel Bigeon
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class HistoryTextKeyListenerTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void test() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>gclc</artifactId>
|
<artifactId>gclc</artifactId>
|
||||||
<version>1.2.4</version>
|
<version>1.2.5</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<url>http://www.bigeon.fr/emmanuel</url>
|
<url>http://www.bigeon.fr/emmanuel</url>
|
||||||
<properties>
|
<properties>
|
||||||
@@ -83,6 +83,6 @@
|
|||||||
<scm>
|
<scm>
|
||||||
|
|
||||||
<developerConnection>scm:git:gogs@git.code.bigeon.net:emmanuel/gclc.git</developerConnection>
|
<developerConnection>scm:git:gogs@git.code.bigeon.net:emmanuel/gclc.git</developerConnection>
|
||||||
<tag>gclc-1.2.4</tag>
|
<tag>gclc-1.2.5</tag>
|
||||||
</scm>
|
</scm>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -36,8 +36,8 @@
|
|||||||
* Created on: Aug 6, 2014 */
|
* Created on: Aug 6, 2014 */
|
||||||
package fr.bigeon.gclc.command;
|
package fr.bigeon.gclc.command;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.ArrayList;
|
||||||
import java.util.Set;
|
import java.util.List;
|
||||||
|
|
||||||
import fr.bigeon.gclc.exception.CommandRunException;
|
import fr.bigeon.gclc.exception.CommandRunException;
|
||||||
import fr.bigeon.gclc.exception.InvalidCommandName;
|
import fr.bigeon.gclc.exception.InvalidCommandName;
|
||||||
@@ -53,12 +53,12 @@ public class CommandProvider implements ICommandProvider {
|
|||||||
/** The space character */
|
/** The space character */
|
||||||
private static final String SPACE = " "; //$NON-NLS-1$
|
private static final String SPACE = " "; //$NON-NLS-1$
|
||||||
/** The commands map */
|
/** The commands map */
|
||||||
protected final Set<ICommand> commands;
|
protected final List<ICommand> commands;
|
||||||
|
|
||||||
/** Create a command provider */
|
/** Create a command provider */
|
||||||
public CommandProvider() {
|
public CommandProvider() {
|
||||||
super();
|
super();
|
||||||
commands = new HashSet<>();
|
commands = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@@ -70,6 +70,9 @@ public class CommandProvider implements ICommandProvider {
|
|||||||
if (name == null || name.startsWith(MINUS) || name.contains(SPACE)) {
|
if (name == null || name.startsWith(MINUS) || name.contains(SPACE)) {
|
||||||
throw new InvalidCommandName();
|
throw new InvalidCommandName();
|
||||||
}
|
}
|
||||||
|
if (commands.contains(value)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return commands.add(value);
|
return commands.add(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -113,8 +113,7 @@ public class ScriptExecution extends Command {
|
|||||||
e.getLocalizedMessage() + ")", //$NON-NLS-1$
|
e.getLocalizedMessage() + ")", //$NON-NLS-1$
|
||||||
e, this);
|
e, this);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new CommandRunException(
|
throw new CommandRunException("Unable to read script", //$NON-NLS-1$
|
||||||
"Unable to read script (" + e.getLocalizedMessage() + ")", //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
e, this);
|
e, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,6 +122,9 @@ public class SubedCommand implements ICommandProvider, ICommand {
|
|||||||
try {
|
try {
|
||||||
executeSub(args[0], Arrays.copyOfRange(args, 1, args.length));
|
executeSub(args[0], Arrays.copyOfRange(args, 1, args.length));
|
||||||
} catch (CommandRunException e) {
|
} catch (CommandRunException e) {
|
||||||
|
if (e.getSource() != null) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
throw new CommandRunException(CommandRunExceptionType.USAGE,
|
throw new CommandRunException(CommandRunExceptionType.USAGE,
|
||||||
e.getLocalizedMessage(), e, this);
|
e.getLocalizedMessage(), e, this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,8 +162,11 @@ public class CLIPrompter {
|
|||||||
public static <U, T> T promptChoice(ConsoleManager manager, List<U> choices,
|
public static <U, T> T promptChoice(ConsoleManager manager, List<U> choices,
|
||||||
Map<U, T> choicesMap, String message,
|
Map<U, T> choicesMap, String message,
|
||||||
String cancel) throws IOException {
|
String cancel) throws IOException {
|
||||||
return choicesMap.get(choices.get(
|
Integer res = promptChoice(manager, choices, message, cancel);
|
||||||
promptChoice(manager, choices, message, cancel).intValue()));
|
if (res == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return choicesMap.get(choices.get(res.intValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @param manager the manager
|
/** @param manager the manager
|
||||||
|
|||||||
Reference in New Issue
Block a user