Commit a36916c7 authored by Andrey Filippov's avatar Andrey Filippov

Adding possibility to runs several sequential external tools waiting for

completion, preparing to communicate with external server.
parent 0c056d60
/com /com
/BuildParamsItem.class
...@@ -266,7 +266,7 @@ public class LaunchCore { ...@@ -266,7 +266,7 @@ public class LaunchCore {
if (!saveAllEditors(true)) { if (!saveAllEditors(true)) {
return; return;
} }
System.out.println("launchInBackground, JOB_NAME="+JOB_NAME);
Job job = new Job(JOB_NAME) { Job job = new Job(JOB_NAME) {
public IStatus run(final IProgressMonitor monitor) { public IStatus run(final IProgressMonitor monitor) {
try { try {
...@@ -293,6 +293,7 @@ public class LaunchCore { ...@@ -293,6 +293,7 @@ public class LaunchCore {
if (!saveAllEditors(true)) { if (!saveAllEditors(true)) {
return; return;
} }
System.out.println("launchInForeground, JOB_NAME="+JOB_NAME);
IRunnableWithProgress runnable = new IRunnableWithProgress() { IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException { public void run(IProgressMonitor monitor) throws InvocationTargetException {
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
package com.elphel.vdt.core.launching; package com.elphel.vdt.core.launching;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
...@@ -49,6 +48,8 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg ...@@ -49,6 +48,8 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg
) throws CoreException ) throws CoreException
{ {
VDTRunner runner = VDTLaunchUtil.getRunner();
if (monitor == null) { if (monitor == null) {
monitor = new NullProgressMonitor(); monitor = new NullProgressMonitor();
} }
...@@ -71,21 +72,14 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg ...@@ -71,21 +72,14 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg
// resolve working directory // resolve working directory
runConfig.setWorkingDirectory(VDTLaunchUtil.getWorkingDirectory(configuration)); runConfig.setWorkingDirectory(VDTLaunchUtil.getWorkingDirectory(configuration));
runConfig.setProjectPath(VDTLaunchUtil.getProjectPath(configuration)); runConfig.setProjectPath(VDTLaunchUtil.getProjectPath(configuration));
runConfig.setConfiguration(configuration); // to be resumed
runConfig.setLaunch(launch); // to be resumed
runConfig.setMonitor(monitor); // to be resumed
// done the half of creating arguments phase // done the half of creating arguments phase
monitor.worked(1); monitor.worked(1);
// resolve arguments
List<String> arguments = VDTLaunchUtil.getArguments(configuration);
// get tool is a shell
boolean isShell=VDTLaunchUtil.getIsShell(configuration);
// get patterns for Error parser
String patternErrors= VDTLaunchUtil.getPatternErrors(configuration);
String patternWarnings=VDTLaunchUtil.getPatternWarnings(configuration);
String patternInfo= VDTLaunchUtil.getPatternInfo(configuration);
// check for cancellation // check for cancellation
if (monitor.isCanceled()) { if (monitor.isCanceled()) {
return; return;
...@@ -93,8 +87,6 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg ...@@ -93,8 +87,6 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg
// done the creating arguments phase // done the creating arguments phase
monitor.worked(2); monitor.worked(2);
// resolve resources
// List<String> resources = VDTLaunchUtil.getResources(configuration);
// check for cancellation // check for cancellation
if (monitor.isCanceled()) { if (monitor.isCanceled()) {
...@@ -104,33 +96,21 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg ...@@ -104,33 +96,21 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg
monitor.worked(3); monitor.worked(3);
// resolve arguments // resolve arguments
List<String> toolArguments = new ArrayList<String>();
if (arguments != null)
toolArguments.addAll(arguments);
// if (resources != null)
// toolArguments.addAll(resources);
runConfig.setToolArguments((String[])toolArguments.toArray(new String[toolArguments.size()]));
runConfig.setIsShell(isShell);
runConfig.setPatternErrors(patternErrors);
runConfig.setToolName(VDTLaunchUtil.getToolName(configuration));
runConfig.setPatternWarnings(patternWarnings);
runConfig.setPatternInfo(patternInfo);
runConfig.setToolProjectPath(VDTLaunchUtil.getToolProjectPath(configuration));
List<String> controlFiles = VDTLaunchUtil.getControlFiles(configuration); runConfig.setIsShell(VDTLaunchUtil.getIsShell(configuration));
runConfig.setPatternErrors(VDTLaunchUtil.getPatternErrors(configuration));
runConfig.setControlFiles((String[])controlFiles.toArray(new String[controlFiles.size()])); runConfig.setToolName(VDTLaunchUtil.getToolName(configuration));
runConfig.setPatternWarnings(VDTLaunchUtil.getPatternWarnings(configuration));
// Launch the configuration - 1 unit of work runConfig.setPatternInfo(VDTLaunchUtil.getPatternInfo(configuration));
VDTRunner runner = VDTLaunchUtil.getRunner(); runConfig.setToolProjectPath(VDTLaunchUtil.getToolProjectPath(configuration));
runner.run(runConfig, launch, monitor); runConfig.setBuildStep(0);
List<String> controlFiles = VDTLaunchUtil.getControlFiles(configuration);
// check for cancellation runConfig.setControlFiles((String[])controlFiles.toArray(new String[controlFiles.size()]));
if (monitor.isCanceled()) {
return; String consoleName=VDTRunner.renderProcessLabel(runConfig.getToolName());
} runner.saveUnfinished(consoleName, runConfig );
monitor.done(); runner.resumeLaunch(consoleName);
return;
} }
public void launch( ILaunchConfiguration configuration public void launch( ILaunchConfiguration configuration
...@@ -149,4 +129,5 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg ...@@ -149,4 +129,5 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg
} }
} }
} // class VDTLaunchConfigurationDelegate } // class VDTLaunchConfigurationDelegate
...@@ -43,6 +43,7 @@ import com.elphel.vdt.VerilogUtils; ...@@ -43,6 +43,7 @@ import com.elphel.vdt.VerilogUtils;
// import com.elphel.vdt.VDTPlugin; // import com.elphel.vdt.VDTPlugin;
import com.elphel.vdt.veditor.VerilogPlugin; import com.elphel.vdt.veditor.VerilogPlugin;
import com.elphel.vdt.core.tools.ToolsCore; import com.elphel.vdt.core.tools.ToolsCore;
import com.elphel.vdt.core.tools.contexts.BuildParamsItem;
import com.elphel.vdt.core.tools.params.Parameter; import com.elphel.vdt.core.tools.params.Parameter;
import com.elphel.vdt.core.tools.params.Tool; import com.elphel.vdt.core.tools.params.Tool;
import com.elphel.vdt.core.tools.params.ToolException; import com.elphel.vdt.core.tools.params.ToolException;
...@@ -63,8 +64,12 @@ public class VDTLaunchUtil { ...@@ -63,8 +64,12 @@ public class VDTLaunchUtil {
* Returns the VDT runner. * Returns the VDT runner.
*/ */
public static VDTRunner getRunner() { public static VDTRunner getRunner() {
if (toolRunner == null) if (toolRunner == null) {
System.out.println ("Created new VDTRunner()");
toolRunner = new VDTRunner(); toolRunner = new VDTRunner();
} else {
System.out.println ("Reused old VDTRunner()");
}
return toolRunner; return toolRunner;
} }
...@@ -122,7 +127,8 @@ public class VDTLaunchUtil { ...@@ -122,7 +127,8 @@ public class VDTLaunchUtil {
* @throws CoreException if unable to retrieve the associated launch * @throws CoreException if unable to retrieve the associated launch
* configuration attribute, or if unable to resolve any variables * configuration attribute, or if unable to resolve any variables
*/ */
public static List<String> getArguments(ILaunchConfiguration configuration) throws CoreException { // public static List<String> getArguments(ILaunchConfiguration configuration) throws CoreException {
public static BuildParamsItem[] getArguments(ILaunchConfiguration configuration) throws CoreException {
Tool tool = obtainTool(configuration); Tool tool = obtainTool(configuration);
for (Iterator i = tool.getParams().iterator(); i.hasNext(); ) { for (Iterator i = tool.getParams().iterator(); i.hasNext(); ) {
...@@ -147,13 +153,19 @@ public class VDTLaunchUtil { ...@@ -147,13 +153,19 @@ public class VDTLaunchUtil {
try { try {
String location = getWorkingDirectory(configuration); String location = getWorkingDirectory(configuration);
tool.setWorkingDirectory(location); tool.setWorkingDirectory(location);
/*
String[] paramArray = tool.buildParams(); String[] paramArray = tool.buildParams();
System.out.println("Andrey: called tool.buildParams() here (from VDTLaunchUtils.java");
List<String> arguments = new ArrayList<String>(paramArray.length); List<String> arguments = new ArrayList<String>(paramArray.length);
for(int i = 0; i < paramArray.length; i++) { for(int i = 0; i < paramArray.length; i++) {
arguments.add(paramArray[i]); arguments.add(paramArray[i]);
} }
return arguments; return arguments;
*/
BuildParamsItem[] paramItemsArray = tool.buildParams();
System.out.println("Andrey: called tool.buildParams() here (from VDTLaunchUtils.java");
return paramItemsArray;
} catch(ToolException e) { } catch(ToolException e) {
MessageUI.error("Error occured during tool launch: " + e.getMessage(), e); MessageUI.error("Error occured during tool launch: " + e.getMessage(), e);
} }
......
...@@ -17,6 +17,10 @@ ...@@ -17,6 +17,10 @@
*******************************************************************************/ *******************************************************************************/
package com.elphel.vdt.core.launching; package com.elphel.vdt.core.launching;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import com.elphel.vdt.Txt; import com.elphel.vdt.Txt;
...@@ -45,6 +49,10 @@ public class VDTRunnerConfiguration { ...@@ -45,6 +49,10 @@ public class VDTRunnerConfiguration {
private String toolErrors; private String toolErrors;
private String toolWarnings; private String toolWarnings;
private String toolInfo; private String toolInfo;
private int buildStep;
private ILaunchConfiguration configuration;
private ILaunch launch;
private IProgressMonitor monitor;
private static final String[] empty= new String[0]; private static final String[] empty= new String[0];
...@@ -63,6 +71,26 @@ public class VDTRunnerConfiguration { ...@@ -63,6 +71,26 @@ public class VDTRunnerConfiguration {
this.toolToLaunch = toolToLaunch; this.toolToLaunch = toolToLaunch;
} }
public void setConfiguration(ILaunchConfiguration configuration){
this.configuration=configuration;
}
public ILaunchConfiguration getConfiguration(){
return configuration;
}
public void setLaunch(ILaunch launch){
this.launch=launch;
}
public ILaunch getLaunch(){
return launch;
}
public void setMonitor(IProgressMonitor monitor){
this.monitor=monitor;
}
public IProgressMonitor getMonitor(){
return monitor;
}
/** /**
* Returns the name of the class to launch. * Returns the name of the class to launch.
* *
...@@ -87,10 +115,22 @@ public class VDTRunnerConfiguration { ...@@ -87,10 +115,22 @@ public class VDTRunnerConfiguration {
* *
* @param args the list of arguments * @param args the list of arguments
*/ */
public void setToolArguments(String[] args) { public void setToolArguments(String[] args) {
toolArgs= args; toolArgs= args;
} }
public void setBuildStep(int buildStep){
this.buildStep=buildStep;
}
public int getBuildStep(){
return buildStep;
}
public void setIsShell(boolean isShell) { public void setIsShell(boolean isShell) {
this.isShell= isShell; this.isShell= isShell;
} }
......
...@@ -27,6 +27,7 @@ import com.elphel.vdt.core.tools.params.CommandLinesBlock; ...@@ -27,6 +27,7 @@ import com.elphel.vdt.core.tools.params.CommandLinesBlock;
import com.elphel.vdt.core.tools.params.conditions.Condition; import com.elphel.vdt.core.tools.params.conditions.Condition;
import com.elphel.vdt.core.tools.params.conditions.ConditionalStringsList; import com.elphel.vdt.core.tools.params.conditions.ConditionalStringsList;
import com.elphel.vdt.core.tools.params.conditions.NamedConditionalStringsList; import com.elphel.vdt.core.tools.params.conditions.NamedConditionalStringsList;
import com.elphel.vdt.core.tools.params.types.ParamTypeString;
public class CommandLinesNodeReader extends AbstractConditionNodeReader { public class CommandLinesNodeReader extends AbstractConditionNodeReader {
List<CommandLinesBlock> commandLinesBlocks = new ArrayList<CommandLinesBlock>(); List<CommandLinesBlock> commandLinesBlocks = new ArrayList<CommandLinesBlock>();
...@@ -69,7 +70,8 @@ public class CommandLinesNodeReader extends AbstractConditionNodeReader { ...@@ -69,7 +70,8 @@ public class CommandLinesNodeReader extends AbstractConditionNodeReader {
return new CommandLinesBlock(context.getName(), return new CommandLinesBlock(context.getName(),
name, name,
dest, dest,
ParamTypeString.KIND.FILE, //Andrey - doesn't know "kind" here yet - TODO: change to attr
sep, sep,
lines, lines,
deleteLines, deleteLines,
......
/*******************************************************************************
* Copyright (c) 2014 Elphel, Inc.
* This file is a part of Eclipse/VDT plug-in.
* Eclipse/VDT plug-in is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Eclipse/VDT plug-in is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
package com.elphel.vdt.core.tools.contexts;
import java.util.List;
public class BuildParamsItem implements Cloneable{
private String [] params;
private String consoleName; // null for external tools running in a new console
public BuildParamsItem (
String [] params,
String consoleName) {
this.consoleName=consoleName;
this.params=params; // no need to clone?
}
public BuildParamsItem (BuildParamsItem item){
this (
item.params,
item.consoleName);
}
public BuildParamsItem clone () {
return new BuildParamsItem(this);
}
public String [] getParams(){
return params;
}
public List<String> getParamsAsList(){
List<String> arguments = new java.util.ArrayList<String>(params.length);
for(int i = 0; i < params.length; i++) {
arguments.add(params[i]);
}
return arguments;
}
/*
String[] paramArray = tool.buildParams();
System.out.println("Andrey: called tool.buildParams() here (from VDTLaunchUtils.java");
List<String> arguments = new ArrayList<String>(paramArray.length);
for(int i = 0; i < paramArray.length; i++) {
arguments.add(paramArray[i]);
}
return arguments;
*/
public String getConsoleName(){
return consoleName;
}
}
...@@ -190,8 +190,11 @@ public abstract class Context { ...@@ -190,8 +190,11 @@ public abstract class Context {
// which need to be put into a control file, and puts them to that file // which need to be put into a control file, and puts them to that file
// all other needed params are built into command line array // all other needed params are built into command line array
// that array is then returned // that array is then returned
public String[] buildParams() throws ToolException { // public String[] buildParams() throws ToolException {
List<String> commandLineParams = new ArrayList<String>(); public BuildParamsItem[] buildParams() throws ToolException {
List<BuildParamsItem> buildParamItems = new ArrayList<BuildParamsItem>();
// List<String> commandLineParams = new ArrayList<String>();
Iterator<CommandLinesBlock> commandLinesBlockIter = commandLinesBlocks.iterator(); // command lines block is empty (yes, there is nothing in project output) Iterator<CommandLinesBlock> commandLinesBlockIter = commandLinesBlocks.iterator(); // command lines block is empty (yes, there is nothing in project output)
createdControlFiles.clear(); createdControlFiles.clear();
...@@ -202,44 +205,62 @@ public abstract class Context { ...@@ -202,44 +205,62 @@ public abstract class Context {
if(!commandLinesBlock.isEnabled()) if(!commandLinesBlock.isEnabled())
continue; continue;
String paramName = commandLinesBlock.getDestination(); String paramName = commandLinesBlock.getDestination(); // Andrey debugging: null?
boolean isConsoleName=commandLinesBlock.isConsoleKind();
String sep = commandLinesBlock.getSeparator(); String sep = commandLinesBlock.getSeparator();
List<String> lines = commandLinesBlock.getLines(); // [%Param_Shell_Options, echo BuildDir=%BuildDir ;, echo SimulationTopFile=%SimulationTopFile ;, echo SimulationTopModule=%SimulationTopModule ;, echo BuildDir=%BuildDir;, %Param_PreExe, %Param_Exe, %Param_TopModule, %TopModulesOther, %ModuleLibrary, %LegacyModel, %NoSpecify, %v, %SourceList, %ExtraFiles, %Filter_String] List<String> lines = commandLinesBlock.getLines(); // [%Param_Shell_Options, echo BuildDir=%BuildDir ;, echo SimulationTopFile=%SimulationTopFile ;, echo SimulationTopModule=%SimulationTopModule ;, echo BuildDir=%BuildDir;, %Param_PreExe, %Param_Exe, %Param_TopModule, %TopModulesOther, %ModuleLibrary, %LegacyModel, %NoSpecify, %v, %SourceList, %ExtraFiles, %Filter_String]
List<List<String>> commandSequence = new ArrayList<List<String>>(); List<List<String>> commandSequence = new ArrayList<List<String>>();
for(Iterator<String> lineIter = lines.iterator(); lineIter.hasNext();) { for(Iterator<String> lineIter = lines.iterator(); lineIter.hasNext();) {
String line = (String)lineIter.next(); String line = (String)lineIter.next();
commandSequence.add(buildCommandString(line)); commandSequence.add(buildCommandString(line));
} }
// Here - already resolved to empty // Here - already resolved to empty
List<String> commandLineParams = new ArrayList<String>();
if(paramName != null) { if(paramName != null) {
Parameter commandFileParam = findParam(paramName); Parameter commandFileParam = findParam(paramName);
String controlFileName = commandFileParam != null? String controlFileName = commandFileParam != null?
commandFileParam.getValue().get(0).trim() : null; commandFileParam.getValue().get(0).trim() : null;
if (isConsoleName) {
if(workingDirectory != null) // System.out.println("TODO: Enable console command generation here");
controlFileName = workingDirectory + File.separator + controlFileName; printStringsToConsoleLine(commandLineParams, commandSequence);
buildParamItems.add(
// check param type first new BuildParamsItem (
if(!(commandFileParam.getType() instanceof ParamTypeString)) (String[])commandLineParams.toArray(new String[commandLineParams.size()]),
throw new ToolException("Parameter '" + commandFileParam.getID() + controlFileName) // find console beginning with this name, send commands there
"' specified in the description of context '" + name + );
"' must be of type '" + ParamTypeString.NAME + "'"); } else {
if(workingDirectory != null)
// write strings to control file controlFileName = workingDirectory + File.separator + controlFileName;
boolean controlFileExists = controlFileExists(controlFileName);
// check param type first
printStringsToFile(controlFileName, controlFileExists, commandSequence, sep); if(!(commandFileParam.getType() instanceof ParamTypeString))
throw new ToolException("Parameter '" + commandFileParam.getID() +
if(!controlFileExists) "' specified in the description of context '" + name +
createdControlFiles.add(controlFileName); "' must be of type '" + ParamTypeString.NAME + "'");
// write strings to control file
boolean controlFileExists = controlFileExists(controlFileName);
printStringsToFile(controlFileName, controlFileExists, commandSequence, sep);
if(!controlFileExists)
createdControlFiles.add(controlFileName);
}
} else { } else {
printStringsToCommandLine(commandLineParams, commandSequence); // TODO: will need multiple command lines // Andrey
printStringsToCommandLine(commandLineParams, commandSequence);
buildParamItems.add(
new BuildParamsItem (
(String[])commandLineParams.toArray(new String[commandLineParams.size()]),
null) // external tool in a new console
);
} }
} }
// return (String[])commandLineParams.toArray(new String[commandLineParams.size()]);
return (String[])commandLineParams.toArray(new String[commandLineParams.size()]); return (BuildParamsItem[])buildParamItems.toArray(new BuildParamsItem[buildParamItems.size()]);
} }
protected List<String> buildCommandString(String paramStringTemplate) protected List<String> buildCommandString(String paramStringTemplate)
...@@ -416,6 +437,25 @@ public abstract class Context { ...@@ -416,6 +437,25 @@ public abstract class Context {
} }
} }
} }
// Andrey: now is the same as command line, but will change to allow last element be prompt
private void printStringsToConsoleLine(List<String> commandLineParams,
List<List<String>> commandSequence)
throws ToolException
{
for(Iterator<List<String>> li = commandSequence.iterator(); li.hasNext();) {
List<String> strList = (List<String>)li.next();
if(strList.size() > 0) {
for(Iterator<String> si = strList.iterator(); si.hasNext();) {
String s = ((String)si.next()).trim();
if(!s.equals(""))
commandLineParams.add(s);
}
}
}
}
private void checkNotInitialized() throws ConfigException { private void checkNotInitialized() throws ConfigException {
if(initialized) if(initialized)
......
...@@ -65,6 +65,10 @@ public abstract class ContextWithoutCommandLine extends Context { ...@@ -65,6 +65,10 @@ public abstract class ContextWithoutCommandLine extends Context {
"' cannot contain command line, but destination of its '" + "' cannot contain command line, but destination of its '" +
block.getName() + block.getName() +
"' command block is not specified"); "' command block is not specified");
if(!block.isFileKind())
throw new ConfigException("Context '" + name +
"' cannot contain commands for console "+
destination);
} }
} }
} }
......
...@@ -25,6 +25,7 @@ import com.elphel.vdt.core.tools.config.Config; ...@@ -25,6 +25,7 @@ import com.elphel.vdt.core.tools.config.Config;
import com.elphel.vdt.core.tools.config.ConfigException; import com.elphel.vdt.core.tools.config.ConfigException;
import com.elphel.vdt.core.tools.params.conditions.*; import com.elphel.vdt.core.tools.params.conditions.*;
import com.elphel.vdt.core.tools.params.types.ParamTypeString; import com.elphel.vdt.core.tools.params.types.ParamTypeString;
import com.elphel.vdt.core.tools.params.types.ParamTypeString.KIND;
public class CommandLinesBlock extends UpdateableStringsContainer public class CommandLinesBlock extends UpdateableStringsContainer
implements Cloneable implements Cloneable
...@@ -33,10 +34,12 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -33,10 +34,12 @@ public class CommandLinesBlock extends UpdateableStringsContainer
private String name; private String name;
private String destination; private String destination;
private String separator; private String separator;
private KIND kind; //command file name or console name
public CommandLinesBlock(String contextName, public CommandLinesBlock(String contextName,
String name, String name,
String destination, String destination,
KIND kind,
String sep, String sep,
ConditionalStringsList lines, ConditionalStringsList lines,
ConditionalStringsList deleteLines, ConditionalStringsList deleteLines,
...@@ -47,6 +50,7 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -47,6 +50,7 @@ public class CommandLinesBlock extends UpdateableStringsContainer
this.contextName = contextName; this.contextName = contextName;
this.name = name; this.name = name;
this.destination = destination; this.destination = destination;
this.kind=kind;
this.separator = sep; this.separator = sep;
if(separator != null) { if(separator != null) {
...@@ -59,6 +63,7 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -59,6 +63,7 @@ public class CommandLinesBlock extends UpdateableStringsContainer
this(block.contextName, this(block.contextName,
block.name, block.name,
block.destination, block.destination,
block.kind,
block.separator, block.separator,
block.strings != null? block.strings != null?
(ConditionalStringsList)block.strings.clone() : null, (ConditionalStringsList)block.strings.clone() : null,
...@@ -89,12 +94,19 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -89,12 +94,19 @@ public class CommandLinesBlock extends UpdateableStringsContainer
"' used for command line of context '" + context.getName() + "' used for command line of context '" + context.getName() +
"' must be of type '" + ParamTypeString.NAME + "' must be of type '" + ParamTypeString.NAME +
"'"); "'");
} else if(((ParamTypeString)param.getType()).getKind() != ParamTypeString.KIND.FILE) { } else {
throw new ConfigException("Destination parameter '" + destination + kind=((ParamTypeString)param.getType()).getKind();
"' of type '" + ParamTypeString.NAME + if(kind != ParamTypeString.KIND.FILE) {
"' used for command line of context '" + context.getName() + if(((ParamTypeString)param.getType()).getKind() != ParamTypeString.KIND.TEXT) { // Andrey - adding console name option
"' must be of kind '" + ParamTypeString.KIND_FILE_ID + throw new ConfigException("Destination parameter '" + destination +
"'"); "' of type '" + ParamTypeString.NAME +
"' used for command line of context '" + context.getName() +
"' must be of kind '" + ParamTypeString.KIND_FILE_ID +
"' or '" + ParamTypeString.KIND_TEXT_ID +
"'");
}
System.out.println("Got string text kind for command block (for console name)");
}
} }
} }
} }
...@@ -110,7 +122,19 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -110,7 +122,19 @@ public class CommandLinesBlock extends UpdateableStringsContainer
public String getDestination() { public String getDestination() {
return destination; return destination;
} }
public KIND getKind() {
return kind;
}
public boolean isFileKind() {
return kind == ParamTypeString.KIND.FILE;
}
public boolean isConsoleKind() {
return kind == ParamTypeString.KIND.TEXT;
}
public List<String> getLines() { public List<String> getLines() {
return ConditionUtils.resolveConditionStrings(strings); return ConditionUtils.resolveConditionStrings(strings);
} }
......
...@@ -374,6 +374,12 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -374,6 +374,12 @@ public class Tool extends Context implements Cloneable, Inheritable {
} }
public Parameter findParam(String paramID) { public Parameter findParam(String paramID) {
// System.out.println("findParam("+paramID+")");
// if (paramID==null){
// System.out.println("findParam(null!!!)");
// return null;
// }
Parameter param = super.findParam(paramID); //Andrey: happily finds ProjectContext parameter, thinks it is tool context Parameter param = super.findParam(paramID); //Andrey: happily finds ProjectContext parameter, thinks it is tool context
/* /*
* Andrey: Added isChild property to the Property, and still left static inheritance at XML parsing time. Then, during parameter * Andrey: Added isChild property to the Property, and still left static inheritance at XML parsing time. Then, during parameter
...@@ -411,7 +417,8 @@ public class Tool extends Context implements Cloneable, Inheritable { ...@@ -411,7 +417,8 @@ public class Tool extends Context implements Cloneable, Inheritable {
return baseTool; return baseTool;
} }
public String[] buildParams() throws ToolException { // public String[] buildParams() throws ToolException {
public BuildParamsItem[] buildParams() throws ToolException {
if(parentPackage != null) if(parentPackage != null)
parentPackage.buildParams(); parentPackage.buildParams();
......
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2006 Elphel, Inc and Excelsior, LLC. * Copyright (c) 2014 Elphel, Inc.
* This file is a part of Eclipse/VDT plug-in. * This file is a part of Eclipse/VDT plug-in.
* Eclipse/VDT plug-in is free software; you can redistribute it and/or modify * Eclipse/VDT plug-in is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the * it under the terms of the GNU General Public License as published by
* Free Software Foundation; either version 2 of the License, or (at your option) * the Free Software Foundation, either version 3 of the License, or
* any later version. * (at your option) any later version.
* *
* Eclipse/VDT plug-in is distributed in the hope that it will be useful, but * Eclipse/VDT plug-in is distributed in the hope that it will be useful,
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * but WITHOUT ANY WARRANTY; without even the implied warranty of
* FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* See the GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License along * You should have received a copy of the GNU General Public License
* with Eclipse VDT plug-in; if not, write to the Free Software * along with this program. If not, see <http://www.gnu.org/licenses/>.
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*******************************************************************************/ *******************************************************************************/
package com.elphel.vdt.core.tools.params.types; package com.elphel.vdt.core.tools.params.types;
......
...@@ -251,7 +251,12 @@ public class SelectedResourceManager implements IWindowListener, ISelectionListe ...@@ -251,7 +251,12 @@ public class SelectedResourceManager implements IWindowListener, ISelectionListe
IProject project=getSelectedProject(); IProject project=getSelectedProject();
if (project==null) return; if (project==null) return;
IPath path = new Path(fChosenTarget); IPath path = new Path(fChosenTarget);
IFile file = (path==null)?null:project.getFile(path); IFile file=null;
try {
file = (path==null)?null:project.getFile(path);
} catch (IllegalArgumentException e) {
// Path must include project and resource name: /x353
}
if ((file != null) && (VerilogUtils.isHhdlFile(file))) if ((file != null) && (VerilogUtils.isHhdlFile(file)))
fChosenVerilogFile=file; fChosenVerilogFile=file;
else if (fChosenVerilogFile==null) else if (fChosenVerilogFile==null)
......
...@@ -40,6 +40,15 @@ ...@@ -40,6 +40,15 @@
icon="gtkwave.ico" icon="gtkwave.ico"
call="iverilog"/> call="iverilog"/>
</menu> </menu>
<menuitem name="RemotePython"
label="Run remote Python session"
icon="python.png"
call="RemotePython"/>
<menuitem name="RemotePythonCommand"
label="Send a command to the remote Python session"
icon="my_tool.gif"
call="RemotePythonCommand"/>
<menu name="XDS" <menu name="XDS"
label="Demo XDS Tools" label="Demo XDS Tools"
......
<?xml version="1.0" encoding="UTF-8"?>
<vdt-project>
<interface name="RemoteInterface" extends="project_interface">
</interface>
<tool name = "RemotePython"
project = "FPGA_project"
label = "RemotePython"
shell = "/bin/bash"
interface = "RemoteInterface"
description = "Launching remote Python in console"
errors = "(.*):([0-9]+): [a-z ]*error: (.*)"
warnings = "(.*):([0-9]+): warning: (.*)"
info = "(.*):([0-9]+): info: (.*)"> <!--does not actually exist -->
<extensions-list>
<extension mask="v"/>
<extension mask="tf"/>
</extensions-list>
<action-menu>
<action label="Remote Python" resource="" icon="python.png" />
</action-menu>
<parameter id = "RemoteHost"
label = "Remote Host IP"
type = "String"
format = "CopyValue"
default = "192.168.0.66"
readonly = "false"
visible = "true"/>
<parameter id = "RemoteUser"
label = "Remote user name"
type = "String"
format = "CopyValue"
default = ""
readonly = "false"
visible = "true"/>
<parameter id = "PreSSH"
label = "pre-ssh shell parameters"
type = "String"
format = "CopyValue"
default = ""
readonly = "false"
visible = "true"/>
<parameter id = "ShellSwitches"
label = "Shell switches"
type = "String"
format = "CopyValue"
default = "-c"
readonly = "false"
visible = "true"/>
<parameter id = "SSHSwitches"
label = "Remote ssh switches"
type = "String"
format = "CopyValue"
default = ""
readonly = "false"
visible = "true"/>
<parameter id = "RemoteCommand"
label = "Remote ssh command"
type = "String"
format = "CopyValue"
default = "python -i -u"
readonly = "false"
visible = "true"/>
<parameter id = "SSHExtra"
label = "ssh extra parameters"
type = "String"
format = "CopyValue"
default = ""
readonly = "false"
visible = "true"/>
<input>
<group name="General">
"RemoteHost"
"RemoteUser"
"ShellSwitches"
"PreSSH"
"SSHSwitches"
"RemoteCommand"
"SSHExtra"
</group>
</input>
<output>
<line name="command_line">
"%ShellSwitches"
"%PreSSH"
"ssh"
"-l"
"%RemoteUser"
"%RemoteHost"
"%SSHSwitches"
"'"
"%RemoteCommand"
"'"
"%SSHExtra"
</line>
</output>
</tool>
<tool name = "RemotePythonCommand"
project = "FPGA_project"
label = "RemotePythonCommand"
shell = "/bin/bash"
interface = "RemoteInterface"
description = "Sending command to a ermote Python session"
errors = "(.*):([0-9]+): [a-z ]*error: (.*)"
warnings = "(.*):([0-9]+): warning: (.*)"
info = "(.*):([0-9]+): info: (.*)"> <!--does not actually exist -->
<extensions-list>
<extension mask="v"/>
<extension mask="tf"/>
</extensions-list>
<action-menu>
<action label="Remote Python Command" resource="" icon="python.png" />
</action-menu>
<parameter id = "RemoteCommand"
label = "Remote Command to send"
type = "String"
format = "CopyValue"
default = "print &quot;Hello, World!&quot;"
readonly = "false"
visible = "true"/>
<parameter id="python_console_name" default="RemotePython"
type="String" format="CopyValue" visible="false" />
<input>
<group name="General">
"RemoteCommand"
</group>
</input>
<output>
<line name="command_line">
"-c"
"echo 'Nothing to do, sleepiing 15' ;"
"sleep 15 ;"
"echo 'Nothing to do, awakening' ;"
</line>
<line name="console_line" dest="python_console_name" sep="\n">
"%RemoteCommand"
</line>
<line name="command_line">
"-c"
"echo 'Nothing to do second time, sleeping 25' ;"
"sleep 25 ;"
"echo 'Nothing to do again, awakening after sleep 25' ;"
</line>
</output>
</tool>
</vdt-project>
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