Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vdt-plugin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
vdt-plugin
Commits
e24caf8d
Commit
e24caf8d
authored
Mar 01, 2014
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ADding access to the current tool from the generators, debugging
parent
c3b3f877
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
215 additions
and
136 deletions
+215
-136
VDTLaunchConfigurationDelegate.java
...el/vdt/core/launching/VDTLaunchConfigurationDelegate.java
+2
-0
Context.java
src/com/elphel/vdt/core/tools/contexts/Context.java
+8
-2
AbstractGenerator.java
...m/elphel/vdt/core/tools/generators/AbstractGenerator.java
+12
-3
BuildStampGenerator.java
...elphel/vdt/core/tools/generators/BuildStampGenerator.java
+4
-3
FilteredSourceListGenerator.java
...dt/core/tools/generators/FilteredSourceListGenerator.java
+24
-3
StateBaseGenerator.java
.../elphel/vdt/core/tools/generators/StateBaseGenerator.java
+5
-3
StateDirGenerator.java
...m/elphel/vdt/core/tools/generators/StateDirGenerator.java
+12
-3
StateFileGenerator.java
.../elphel/vdt/core/tools/generators/StateFileGenerator.java
+5
-3
ValueGenerator.java
src/com/elphel/vdt/core/tools/generators/ValueGenerator.java
+2
-1
FormatProcessor.java
src/com/elphel/vdt/core/tools/params/FormatProcessor.java
+27
-0
Parameter.java
src/com/elphel/vdt/core/tools/params/Parameter.java
+35
-18
Tool.java
src/com/elphel/vdt/core/tools/params/Tool.java
+9
-7
ToolSequence.java
src/com/elphel/vdt/core/tools/params/ToolSequence.java
+17
-3
StringComparison.java
...el/vdt/core/tools/params/conditions/StringComparison.java
+4
-3
DefaultListGeneratorRecognizer.java
...ls/params/recognizers/DefaultListGeneratorRecognizer.java
+19
-23
ParamRepeaterRecognizer.java
...ore/tools/params/recognizers/ParamRepeaterRecognizer.java
+1
-1
RepeaterRecognizer.java
...vdt/core/tools/params/recognizers/RepeaterRecognizer.java
+1
-1
SimpleGeneratorRecognizer.java
...e/tools/params/recognizers/SimpleGeneratorRecognizer.java
+23
-31
DesignFlowView.java
src/com/elphel/vdt/ui/views/DesignFlowView.java
+5
-28
No files found.
src/com/elphel/vdt/core/launching/VDTLaunchConfigurationDelegate.java
View file @
e24caf8d
...
@@ -153,6 +153,8 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg
...
@@ -153,6 +153,8 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg
,
IProgressMonitor
monitor
,
IProgressMonitor
monitor
)
throws
CoreException
)
throws
CoreException
{
{
if
(
VerilogPlugin
.
getPreferenceBoolean
(
PreferenceStrings
.
DEBUG_THREAD_CONFICT
))
System
.
out
.
println
(
"-=-=-=- launch: "
+
VDTLaunchUtil
.
getToolName
(
configuration
)+
" threadID="
+
Thread
.
currentThread
().
getId
());
try
{
try
{
doLaunch
(
configuration
,
mode
,
launch
,
monitor
);
doLaunch
(
configuration
,
mode
,
launch
,
monitor
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
src/com/elphel/vdt/core/tools/contexts/Context.java
View file @
e24caf8d
...
@@ -436,8 +436,10 @@ public abstract class Context {
...
@@ -436,8 +436,10 @@ public abstract class Context {
protected
List
<
String
>
buildCommandString
(
String
paramStringTemplate
,
FormatProcessor
topProcessor
)
protected
List
<
String
>
buildCommandString
(
String
paramStringTemplate
,
FormatProcessor
topProcessor
)
throws
ToolException
throws
ToolException
{
{
if
(
topProcessor
==
null
)
topProcessor
=
new
FormatProcessor
(
this
);
// or use "context"
else
topProcessor
.
setCurrentTool
(
this
);
// or use "context"
FormatProcessor
processor
=
new
FormatProcessor
(
new
Recognizer
[]
{
FormatProcessor
processor
=
new
FormatProcessor
(
new
Recognizer
[]
{
new
SimpleGeneratorRecognizer
(),
new
SimpleGeneratorRecognizer
(
topProcessor
),
new
RepeaterRecognizer
()
new
RepeaterRecognizer
()
// new ContextParamRecognizer(this),
// new ContextParamRecognizer(this),
// new ContextParamRepeaterRecognizer(this)
// new ContextParamRepeaterRecognizer(this)
...
@@ -451,12 +453,16 @@ public abstract class Context {
...
@@ -451,12 +453,16 @@ public abstract class Context {
throws
ToolException
throws
ToolException
{
{
if
(
stringTemplate
==
null
)
return
null
;
if
(
stringTemplate
==
null
)
return
null
;
if
(
topProcessor
==
null
)
topProcessor
=
new
FormatProcessor
(
this
);
// or use "context"
else
topProcessor
.
setCurrentTool
(
this
);
// or use "context"
Parameter
parName
=
findParam
(
stringTemplate
);
Parameter
parName
=
findParam
(
stringTemplate
);
if
(
parName
!=
null
){
if
(
parName
!=
null
){
return
parName
.
getValue
(
topProcessor
).
get
(
0
).
trim
();
// get parameter
return
parName
.
getValue
(
topProcessor
).
get
(
0
).
trim
();
// get parameter
}
}
FormatProcessor
processor
=
new
FormatProcessor
(
new
Recognizer
[]
{
FormatProcessor
processor
=
new
FormatProcessor
(
new
Recognizer
[]
{
new
SimpleGeneratorRecognizer
(),
new
SimpleGeneratorRecognizer
(
topProcessor
),
new
RepeaterRecognizer
()
new
RepeaterRecognizer
()
// new ContextParamRecognizer(this),
// new ContextParamRecognizer(this),
// new ContextParamRepeaterRecognizer(this)
// new ContextParamRepeaterRecognizer(this)
...
...
src/com/elphel/vdt/core/tools/generators/AbstractGenerator.java
View file @
e24caf8d
...
@@ -34,7 +34,7 @@ public abstract class AbstractGenerator {
...
@@ -34,7 +34,7 @@ public abstract class AbstractGenerator {
protected
String
separator
;
protected
String
separator
;
private
final
boolean
forcedMultiline
;
private
final
boolean
forcedMultiline
;
private
boolean
menuMode
=
false
;
// managing menu items, not running tool. Ignore Generator errors
private
boolean
menuMode
=
false
;
// managing menu items, not running tool. Ignore Generator errors
protected
Tool
tool0
;
// "tool" was already used in ToolParamRecognizer / Andrey
//
protected Tool tool0; // "tool" was already used in ToolParamRecognizer / Andrey
protected
FormatProcessor
topProcessor
;
// to protect from cycles in recursion, replacing static in FormatProcessor / Andrey
protected
FormatProcessor
topProcessor
;
// to protect from cycles in recursion, replacing static in FormatProcessor / Andrey
public
AbstractGenerator
(
FormatProcessor
processor
)
{
public
AbstractGenerator
(
FormatProcessor
processor
)
{
...
@@ -69,14 +69,23 @@ public abstract class AbstractGenerator {
...
@@ -69,14 +69,23 @@ public abstract class AbstractGenerator {
}
}
topProcessor
=
processor
;
topProcessor
=
processor
;
}
}
public
void
setTopProcessor
(
FormatProcessor
processor
){
topProcessor
=
processor
;
}
public
void
setMenuMode
(
boolean
menuMode
){
public
void
setMenuMode
(
boolean
menuMode
){
this
.
menuMode
=
menuMode
;
this
.
menuMode
=
menuMode
;
}
}
public
boolean
getMenuMode
(){
public
boolean
getMenuMode
(){
return
menuMode
;
return
menuMode
;
}
}
public
void
setTool
(
Tool
tool
){
// public void setTool(Tool tool){
this
.
tool0
=
tool
;
// this.tool0=tool;
// }
public
Tool
getCurrentTool
(){
if
(
topProcessor
==
null
)
return
null
;
return
topProcessor
.
getCurrentTool
();
}
}
protected
FormatProcessor
getTopProcessor
(){
return
topProcessor
;}
protected
FormatProcessor
getTopProcessor
(){
return
topProcessor
;}
...
...
src/com/elphel/vdt/core/tools/generators/BuildStampGenerator.java
View file @
e24caf8d
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
package
com
.
elphel
.
vdt
.
core
.
tools
.
generators
;
package
com
.
elphel
.
vdt
.
core
.
tools
.
generators
;
import
com.elphel.vdt.VDT
;
import
com.elphel.vdt.VDT
;
import
com.elphel.vdt.core.tools.params.FormatProcessor
;
import
com.elphel.vdt.ui.variables.SelectedResourceManager
;
import
com.elphel.vdt.ui.variables.SelectedResourceManager
;
public
class
BuildStampGenerator
extends
AbstractGenerator
{
public
class
BuildStampGenerator
extends
AbstractGenerator
{
...
@@ -26,16 +27,16 @@ public class BuildStampGenerator extends AbstractGenerator {
...
@@ -26,16 +27,16 @@ public class BuildStampGenerator extends AbstractGenerator {
return
NAME
;
return
NAME
;
}
}
public
BuildStampGenerator
()
public
BuildStampGenerator
(
FormatProcessor
topProcessor
)
{
{
super
(
null
);
// null for topFormatProcessor - this generator can not reference other parameters
super
(
topProcessor
);
// null for topFormatProcessor - this generator can not reference other parameters
}
}
protected
String
[]
getStringValues
()
{
protected
String
[]
getStringValues
()
{
// if ( return new String[] {(tool0!=null)?tool0.getStateFile(): ""};
// if ( return new String[] {(tool0!=null)?tool0.getStateFile(): ""};
// System.out.println("#### BuildStampGenerator(): tool0="+
// System.out.println("#### BuildStampGenerator(): tool0="+
//((tool0!=null)?(tool0.getName()+" state="+tool0.getState()+" mode="+tool0.getMode()):"null"));
//((tool0!=null)?(tool0.getName()+" state="+tool0.getState()+" mode="+tool0.getMode()):"null"));
String
stamp
=(
tool0
!=
null
)?
tool0
.
getTimeStamp
():
null
;
String
stamp
=(
getCurrentTool
()!=
null
)?
getCurrentTool
()
.
getTimeStamp
():
null
;
if
(
stamp
==
null
)
stamp
=
SelectedResourceManager
.
getDefault
().
getBuildStamp
();
if
(
stamp
==
null
)
stamp
=
SelectedResourceManager
.
getDefault
().
getBuildStamp
();
return
new
String
[]
{
stamp
};
return
new
String
[]
{
stamp
};
}
}
...
...
src/com/elphel/vdt/core/tools/generators/FilteredSourceListGenerator.java
View file @
e24caf8d
...
@@ -31,8 +31,12 @@ import org.eclipse.core.resources.IResource;
...
@@ -31,8 +31,12 @@ import org.eclipse.core.resources.IResource;
//import com.elphel.vdt.VDT;
//import com.elphel.vdt.VDT;
import
com.elphel.vdt.VerilogUtils
;
import
com.elphel.vdt.VerilogUtils
;
import
com.elphel.vdt.core.tools.params.FormatProcessor
;
import
com.elphel.vdt.core.tools.params.Tool
;
import
com.elphel.vdt.ui.MessageUI
;
import
com.elphel.vdt.ui.MessageUI
;
//import com.elphel.vdt.core.verilog.VerilogUtils;
//import com.elphel.vdt.core.verilog.VerilogUtils;
import
com.elphel.vdt.ui.variables.SelectedResourceManager
;
import
com.elphel.vdt.ui.variables.SelectedResourceManager
;
...
@@ -52,9 +56,10 @@ public class FilteredSourceListGenerator extends AbstractGenerator {
...
@@ -52,9 +56,10 @@ public class FilteredSourceListGenerator extends AbstractGenerator {
public
FilteredSourceListGenerator
(
String
prefix
,
public
FilteredSourceListGenerator
(
String
prefix
,
String
suffix
,
String
suffix
,
String
separator
)
String
separator
,
FormatProcessor
topProcessor
)
{
{
super
(
prefix
,
suffix
,
separator
,
null
);
// null for topFormatProcessor - this generator can not reference other parameters
super
(
prefix
,
suffix
,
separator
,
topProcessor
);
}
}
public
String
getName
()
{
public
String
getName
()
{
...
@@ -62,9 +67,25 @@ public class FilteredSourceListGenerator extends AbstractGenerator {
...
@@ -62,9 +67,25 @@ public class FilteredSourceListGenerator extends AbstractGenerator {
}
}
protected
String
[]
getStringValues
()
{
protected
String
[]
getStringValues
()
{
String
ignoreFilter
=
SelectedResourceManager
.
getDefault
().
getFilter
();
// old version
// System.out.println("FilteredSourceListGenerator(), tool0="+((tool0==null)?null:(tool0.getName()+tool0.getIgnoreFilter())));
// System.out.print("FilteredSourceListGenerator(): ");
if
(
topProcessor
!=
null
){
Tool
tool
=
topProcessor
.
getCurrentTool
();
// System.out.println(", tool="+tool+" tool name="+((tool!=null)?tool.getName():null));
if
(
tool
!=
null
)
{
ignoreFilter
=
tool
.
getIgnoreFilter
();
// System.out.println(" tool="+tool.getName()+", ignoreFilter="+ignoreFilter);
}
else
{
System
.
out
.
println
(
"FilteredSourceListGenerator(): topProcessor.getCurrentTool() is null"
);
}
}
else
{
System
.
out
.
println
(
"FilteredSourceListGenerator(): topProcessor is null"
);
}
String
[]
file_names
=
null
;
String
[]
file_names
=
null
;
IResource
resource
=
SelectedResourceManager
.
getDefault
().
getChosenVerilogFile
();
IResource
resource
=
SelectedResourceManager
.
getDefault
().
getChosenVerilogFile
();
String
ignoreFilter
=
SelectedResourceManager
.
getDefault
().
getFilter
();
Pattern
ignorePattern
=
null
;
Pattern
ignorePattern
=
null
;
if
(
ignoreFilter
!=
null
){
if
(
ignoreFilter
!=
null
){
try
{
try
{
...
...
src/com/elphel/vdt/core/tools/generators/StateBaseGenerator.java
View file @
e24caf8d
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
package
com
.
elphel
.
vdt
.
core
.
tools
.
generators
;
package
com
.
elphel
.
vdt
.
core
.
tools
.
generators
;
import
com.elphel.vdt.VDT
;
import
com.elphel.vdt.VDT
;
import
com.elphel.vdt.core.tools.params.FormatProcessor
;
import
com.elphel.vdt.ui.variables.SelectedResourceManager
;
import
com.elphel.vdt.ui.variables.SelectedResourceManager
;
...
@@ -27,9 +28,9 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager;
...
@@ -27,9 +28,9 @@ import com.elphel.vdt.ui.variables.SelectedResourceManager;
*/
*/
public
class
StateBaseGenerator
extends
AbstractGenerator
{
public
class
StateBaseGenerator
extends
AbstractGenerator
{
public
static
final
String
NAME
=
VDT
.
GENERATOR_ID_STATE_FILE
;
public
static
final
String
NAME
=
VDT
.
GENERATOR_ID_STATE_FILE
;
public
StateBaseGenerator
()
public
StateBaseGenerator
(
FormatProcessor
topProcessor
)
{
{
super
(
null
);
// null for topFormatProcessor - this generator can not reference other parameters
super
(
topProcessor
);
// null for topFormatProcessor - this generator can not reference other parameters
}
}
public
String
getName
()
{
public
String
getName
()
{
...
@@ -37,7 +38,8 @@ public class StateBaseGenerator extends AbstractGenerator {
...
@@ -37,7 +38,8 @@ public class StateBaseGenerator extends AbstractGenerator {
}
}
protected
String
[]
getStringValues
()
{
protected
String
[]
getStringValues
()
{
String
base
=(
tool0
!=
null
)?
tool0
.
getStateFile
():
""
;
// String base=(tool0!=null)?tool0.getStateFile(): "";
String
base
=(
getCurrentTool
()!=
null
)?
getCurrentTool
().
getStateFile
():
""
;
if
(
base
.
lastIndexOf
(
'.'
)>=
0
)
base
=
base
.
substring
(
0
,
base
.
lastIndexOf
(
'.'
));
if
(
base
.
lastIndexOf
(
'.'
)>=
0
)
base
=
base
.
substring
(
0
,
base
.
lastIndexOf
(
'.'
));
return
new
String
[]
{
base
};
return
new
String
[]
{
base
};
}
}
...
...
src/com/elphel/vdt/core/tools/generators/StateDirGenerator.java
View file @
e24caf8d
...
@@ -18,18 +18,27 @@
...
@@ -18,18 +18,27 @@
package
com
.
elphel
.
vdt
.
core
.
tools
.
generators
;
package
com
.
elphel
.
vdt
.
core
.
tools
.
generators
;
import
com.elphel.vdt.VDT
;
import
com.elphel.vdt.VDT
;
import
com.elphel.vdt.core.tools.params.FormatProcessor
;
import
com.elphel.vdt.ui.MessageUI
;
public
class
StateDirGenerator
extends
AbstractGenerator
{
public
class
StateDirGenerator
extends
AbstractGenerator
{
public
static
final
String
NAME
=
VDT
.
GENERATOR_ID_STATE_DIR
;
public
static
final
String
NAME
=
VDT
.
GENERATOR_ID_STATE_DIR
;
public
StateDirGenerator
()
public
StateDirGenerator
(
FormatProcessor
topProcessor
)
{
{
super
(
null
);
// null for topFormatProcessor - this generator can not reference other parameters
super
(
topProcessor
);
// null for topFormatProcessor - this generator can not reference other parameters
}
}
public
String
getName
()
{
public
String
getName
()
{
return
NAME
;
return
NAME
;
}
}
protected
String
[]
getStringValues
()
{
protected
String
[]
getStringValues
()
{
return
new
String
[]
{(
tool0
!=
null
)?
tool0
.
getStateDir
():
""
};
// return new String[] {(tool0!=null)?tool0.getStateDir(): ""};
String
stateDir
=(
getCurrentTool
()!=
null
)?
getCurrentTool
().
getStateDir
():
""
;
if
(
getCurrentTool
()==
null
){
MessageUI
.
error
(
"StateDirGenerator(): getCurrentTool()==null"
);
System
.
out
.
println
(
"StateDirGenerator(): getCurrentTool()==null"
);
}
return
new
String
[]
{
stateDir
};
}
}
}
}
src/com/elphel/vdt/core/tools/generators/StateFileGenerator.java
View file @
e24caf8d
...
@@ -18,13 +18,14 @@
...
@@ -18,13 +18,14 @@
package
com
.
elphel
.
vdt
.
core
.
tools
.
generators
;
package
com
.
elphel
.
vdt
.
core
.
tools
.
generators
;
import
com.elphel.vdt.VDT
;
import
com.elphel.vdt.VDT
;
import
com.elphel.vdt.core.tools.params.FormatProcessor
;
import
com.elphel.vdt.ui.variables.SelectedResourceManager
;
import
com.elphel.vdt.ui.variables.SelectedResourceManager
;
public
class
StateFileGenerator
extends
AbstractGenerator
{
public
class
StateFileGenerator
extends
AbstractGenerator
{
public
static
final
String
NAME
=
VDT
.
GENERATOR_ID_STATE_FILE
;
public
static
final
String
NAME
=
VDT
.
GENERATOR_ID_STATE_FILE
;
public
StateFileGenerator
()
public
StateFileGenerator
(
FormatProcessor
topProcessor
)
{
{
super
(
null
);
// null for topFormatProcessor - this generator can not reference other parameters
super
(
topProcessor
);
}
}
public
String
getName
()
{
public
String
getName
()
{
...
@@ -32,6 +33,7 @@ public class StateFileGenerator extends AbstractGenerator {
...
@@ -32,6 +33,7 @@ public class StateFileGenerator extends AbstractGenerator {
}
}
protected
String
[]
getStringValues
()
{
protected
String
[]
getStringValues
()
{
return
new
String
[]
{(
tool0
!=
null
)?
tool0
.
getStateFile
():
""
};
// return new String[] {(tool0!=null)?tool0.getStateFile(): ""};
return
new
String
[]
{(
getCurrentTool
()!=
null
)?
getCurrentTool
().
getStateFile
():
""
};
}
}
}
}
src/com/elphel/vdt/core/tools/generators/ValueGenerator.java
View file @
e24caf8d
...
@@ -51,7 +51,8 @@ public class ValueGenerator extends AbstractGenerator {
...
@@ -51,7 +51,8 @@ public class ValueGenerator extends AbstractGenerator {
public
String
[]
generate
()
{
public
String
[]
generate
()
{
if
(!
param
.
getType
().
isList
())
{
if
(!
param
.
getType
().
isList
())
{
List
<
String
>
rslt
=
param
.
getValue
(
topProcessor
);
// List<String> rslt=param.getValue(topProcessor);
List
<
String
>
rslt
=
new
ArrayList
<
String
>(
param
.
getValue
(
topProcessor
));
if
(
rslt
.
isEmpty
()){
if
(
rslt
.
isEmpty
()){
System
.
out
.
println
(
"BUG in ValueGenerator.java#generate: param.getValue() isEmpty for "
+
param
.
getID
());
System
.
out
.
println
(
"BUG in ValueGenerator.java#generate: param.getValue() isEmpty for "
+
param
.
getID
());
return
new
String
[]{
prefix
+
""
+
suffix
};
return
new
String
[]{
prefix
+
""
+
suffix
};
...
...
src/com/elphel/vdt/core/tools/params/FormatProcessor.java
View file @
e24caf8d
...
@@ -20,6 +20,7 @@ package com.elphel.vdt.core.tools.params;
...
@@ -20,6 +20,7 @@ package com.elphel.vdt.core.tools.params;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.CopyOnWriteArrayList
;
import
java.util.concurrent.CopyOnWriteArrayList
;
import
com.elphel.vdt.core.tools.contexts.Context
;
import
com.elphel.vdt.core.tools.generators.AbstractGenerator
;
import
com.elphel.vdt.core.tools.generators.AbstractGenerator
;
import
com.elphel.vdt.core.tools.params.recognizers.Recognizer
;
import
com.elphel.vdt.core.tools.params.recognizers.Recognizer
;
import
com.elphel.vdt.core.tools.params.recognizers.RecognizerResult
;
import
com.elphel.vdt.core.tools.params.recognizers.RecognizerResult
;
...
@@ -42,6 +43,7 @@ public class FormatProcessor {
...
@@ -42,6 +43,7 @@ public class FormatProcessor {
private
String
initialTemplate
;
private
String
initialTemplate
;
private
FormatProcessor
topProcessor
=
null
;
private
FormatProcessor
topProcessor
=
null
;
private
Tool
currentTool
;
//current tool - used for FilteredSourceListGenerator();
// private static int callCount = 0;
// private static int callCount = 0;
private
int
callCount
=
0
;
// only valid for topProcessor
private
int
callCount
=
0
;
// only valid for topProcessor
...
@@ -84,6 +86,31 @@ public class FormatProcessor {
...
@@ -84,6 +86,31 @@ public class FormatProcessor {
return
outputLines
;
return
outputLines
;
}
}
public
FormatProcessor
(
Context
context
){
this
(
null
,
null
);
setCurrentTool
(
context
);
//else if (context instanceof Tool)
}
public
Tool
getCurrentTool
(){
if
(!
topProcessor
.
equals
(
this
)){
System
.
out
.
println
(
"Warning: trying to get tool not from the topProcessor"
);
return
topProcessor
.
getCurrentTool
();
}
return
currentTool
;
}
public
void
setCurrentTool
(
Context
context
){
if
(
context
instanceof
Tool
)
{
if
(!
topProcessor
.
equals
(
this
)){
System
.
out
.
println
(
"Warning: trying to set tool not on the topProcessor"
);
topProcessor
.
setCurrentTool
(
context
);
return
;
}
currentTool
=(
Tool
)
context
;
}
}
private
List
<
String
>
processTemplate
(
String
template
)
private
List
<
String
>
processTemplate
(
String
template
)
throws
ToolException
throws
ToolException
...
...
src/com/elphel/vdt/core/tools/params/Parameter.java
View file @
e24caf8d
...
@@ -302,12 +302,15 @@ public class Parameter implements Cloneable, Updateable {
...
@@ -302,12 +302,15 @@ public class Parameter implements Cloneable, Updateable {
if
(
type
.
isList
())
if
(
type
.
isList
())
throw
new
ToolException
(
"Assigning a non-list value to list parameter"
);
throw
new
ToolException
(
"Assigning a non-list value to list parameter"
);
checkValue
(
value
);
currentValue
.
clear
();
currentValue
.
add
(
value
);
canonicalizeValue
(
currentValue
);
checkValue
(
value
);
// currentValue.clear();
// currentValue.add(value);
// canonicalizeValue(currentValue);
List
<
String
>
newValue
=
new
ArrayList
<
String
>();
newValue
.
add
(
value
);
canonicalizeValue
(
newValue
);
currentValue
=
newValue
;
}
}
public
void
setCurrentValue
(
List
<
String
>
value
)
throws
ToolException
{
public
void
setCurrentValue
(
List
<
String
>
value
)
throws
ToolException
{
...
@@ -318,11 +321,14 @@ public class Parameter implements Cloneable, Updateable {
...
@@ -318,11 +321,14 @@ public class Parameter implements Cloneable, Updateable {
if
(!
type
.
isList
())
if
(!
type
.
isList
())
throw
new
ToolException
(
"Assigning a list value to non-list parameter"
);
throw
new
ToolException
(
"Assigning a list value to non-list parameter"
);
checkValue
(
value
);
// checkValue(value);
// currentValue = new ArrayList<String>(value);
currentValue
=
new
ArrayList
<
String
>(
value
);
// canonicalizeValue(currentValue);
canonicalizeValue
(
currentValue
);
List
<
String
>
copyValue
=
new
ArrayList
<
String
>(
value
);
checkValue
(
copyValue
);
canonicalizeValue
(
copyValue
);
currentValue
=
copyValue
;
}
}
public
List
<
String
>
getCurrentValue
()
{
public
List
<
String
>
getCurrentValue
()
{
...
@@ -350,13 +356,14 @@ public class Parameter implements Cloneable, Updateable {
...
@@ -350,13 +356,14 @@ public class Parameter implements Cloneable, Updateable {
// }
// }
List
<
String
>
processedDefaultValue
=
null
;
List
<
String
>
processedDefaultValue
=
null
;
if
(
topProcessor
==
null
)
topProcessor
=
new
FormatProcessor
(
null
,
null
);
if
(
topProcessor
==
null
)
topProcessor
=
new
FormatProcessor
(
context
);
else
topProcessor
.
setCurrentTool
(
context
);
FormatProcessor
processor
=
new
FormatProcessor
(
new
Recognizer
[]
{
FormatProcessor
processor
=
new
FormatProcessor
(
new
Recognizer
[]
{
//new RepeaterRecognizer(),
//new RepeaterRecognizer(),
new
SimpleGeneratorRecognizer
(
menuMode
),
new
SimpleGeneratorRecognizer
(
menuMode
,
topProcessor
),
new
ContextParamListRecognizer
(
context
,
topProcessor
),
// Andrey: returning list as the source parameter
new
ContextParamListRecognizer
(
context
,
topProcessor
),
// Andrey: returning list as the source parameter
// new ContextParamRecognizer(context)
// new ContextParamRecognizer(context)
new
DefaultListGeneratorRecognizer
(
menuMode
)
new
DefaultListGeneratorRecognizer
(
menuMode
,
topProcessor
)
},
topProcessor
);
},
topProcessor
);
try
{
try
{
...
@@ -529,11 +536,12 @@ public class Parameter implements Cloneable, Updateable {
...
@@ -529,11 +536,12 @@ public class Parameter implements Cloneable, Updateable {
}
}
String
format
=
syntax
.
getFormat
();
String
format
=
syntax
.
getFormat
();
if
(
topProcessor
==
null
)
topProcessor
=
new
FormatProcessor
(
null
,
null
);
if
(
topProcessor
==
null
)
topProcessor
=
new
FormatProcessor
(
context
);
else
topProcessor
.
setCurrentTool
(
context
);
FormatProcessor
processor
=
new
FormatProcessor
(
new
Recognizer
[]
{
FormatProcessor
processor
=
new
FormatProcessor
(
new
Recognizer
[]
{
new
ParamFormatRecognizer
(
this
),
new
ParamFormatRecognizer
(
this
),
new
ParamRepeaterRecognizer
(
this
),
new
ParamRepeaterRecognizer
(
this
),
new
SimpleGeneratorRecognizer
(),
new
SimpleGeneratorRecognizer
(
topProcessor
),
new
RepeaterRecognizer
(),
new
RepeaterRecognizer
(),
},
topProcessor
);
},
topProcessor
);
...
@@ -634,10 +642,11 @@ public class Parameter implements Cloneable, Updateable {
...
@@ -634,10 +642,11 @@ public class Parameter implements Cloneable, Updateable {
//
//
private
String
getOmitValue
(
FormatProcessor
topProcessor
)
{
private
String
getOmitValue
(
FormatProcessor
topProcessor
)
{
if
(
topProcessor
==
null
)
topProcessor
=
new
FormatProcessor
(
null
,
null
);
if
(
topProcessor
==
null
)
topProcessor
=
new
FormatProcessor
(
context
);
else
topProcessor
.
setCurrentTool
(
context
);
FormatProcessor
processor
=
new
FormatProcessor
(
new
Recognizer
[]
{
FormatProcessor
processor
=
new
FormatProcessor
(
new
Recognizer
[]
{
new
ContextParamRecognizer
(
context
,
topProcessor
),
new
ContextParamRecognizer
(
context
,
topProcessor
),
new
SimpleGeneratorRecognizer
()
new
SimpleGeneratorRecognizer
(
topProcessor
)
},
false
,
topProcessor
);
},
false
,
topProcessor
);
String
resolvedOmitValue
=
ConditionUtils
.
resolveContextCondition
(
context
,
omitValue
,
topProcessor
);
String
resolvedOmitValue
=
ConditionUtils
.
resolveContextCondition
(
context
,
omitValue
,
topProcessor
);
...
@@ -669,8 +678,16 @@ public class Parameter implements Cloneable, Updateable {
...
@@ -669,8 +678,16 @@ public class Parameter implements Cloneable, Updateable {
}
}
private
void
canonicalizeValue
(
List
<
String
>
value
)
{
private
void
canonicalizeValue
(
List
<
String
>
value
)
{
for
(
int
i
=
0
;
i
<
value
.
size
();
i
++)
int
oldSize
=
value
.
size
();
for
(
int
i
=
0
;
i
<
value
.
size
();
i
++)
{
try
{
// just catching a BUG, normally not needed
value
.
set
(
i
,
type
.
canonicalizeValue
(
value
.
get
(
i
)));
value
.
set
(
i
,
type
.
canonicalizeValue
(
value
.
get
(
i
)));
}
catch
(
Exception
e
){
MessageUI
.
error
(
"Catching a bug in Parameter.jave, value.size="
+
value
.
size
()+
" oldSize="
+
oldSize
+
" threadID="
+
Thread
.
currentThread
().
getId
());
System
.
out
.
println
(
"Catching a bug, value.size="
+
value
.
size
()+
" oldSize="
+
oldSize
+
" threadID="
+
Thread
.
currentThread
().
getId
());
System
.
out
.
println
(
"value="
+
value
.
toString
());
}
}
}
}
private
void
checkBoolInitialValue
(
String
boolAttr
,
String
attrName
)
private
void
checkBoolInitialValue
(
String
boolAttr
,
String
attrName
)
...
...
src/com/elphel/vdt/core/tools/params/Tool.java
View file @
e24caf8d
...
@@ -1084,7 +1084,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
...
@@ -1084,7 +1084,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
public
String
[]
getExtensions
()
{
public
String
[]
getExtensions
()
{
if
(
extensions
==
null
)
if
(
extensions
==
null
)
return
null
;
return
null
;
FormatProcessor
topProcessor
=
new
FormatProcessor
(
null
,
null
);
FormatProcessor
topProcessor
=
new
FormatProcessor
(
this
);
FormatProcessor
processor
=
new
FormatProcessor
(
FormatProcessor
processor
=
new
FormatProcessor
(
new
Recognizer
[]
{
new
Recognizer
[]
{
new
ContextParamRecognizer
(
this
,
topProcessor
),
new
ContextParamRecognizer
(
this
,
topProcessor
),
...
@@ -1117,11 +1117,11 @@ public class Tool extends Context implements Cloneable, Inheritable {
...
@@ -1117,11 +1117,11 @@ public class Tool extends Context implements Cloneable, Inheritable {
// Can be two different processors for labels and resources
// Can be two different processors for labels and resources
//SimpleGeneratorRecognizer(true) may be not needed, as current file is already set here
//SimpleGeneratorRecognizer(true) may be not needed, as current file is already set here
FormatProcessor
topProcessor
=
new
FormatProcessor
(
null
,
null
);
FormatProcessor
topProcessor
=
new
FormatProcessor
(
this
);
FormatProcessor
processor
=
new
FormatProcessor
(
FormatProcessor
processor
=
new
FormatProcessor
(
new
Recognizer
[]
{
new
Recognizer
[]
{
new
ContextParamRecognizer
(
this
,
topProcessor
),
new
ContextParamRecognizer
(
this
,
topProcessor
),
new
SimpleGeneratorRecognizer
(
true
)
// in menuMode
new
SimpleGeneratorRecognizer
(
true
,
topProcessor
)
// in menuMode
// new SimpleGeneratorRecognizer(false) // in menuMode
// new SimpleGeneratorRecognizer(false) // in menuMode
},
topProcessor
);
// null for topFormatProcessor - this generator can not reference other parameters
},
topProcessor
);
// null for topFormatProcessor - this generator can not reference other parameters
...
@@ -1158,11 +1158,11 @@ public class Tool extends Context implements Cloneable, Inheritable {
...
@@ -1158,11 +1158,11 @@ public class Tool extends Context implements Cloneable, Inheritable {
// Should be called after getMenuActions to have updateContextOptions() already ran
// Should be called after getMenuActions to have updateContextOptions() already ran
public
String
getIgnoreFilter
(){
// calculate and get
public
String
getIgnoreFilter
(){
// calculate and get
if
(
ignoreFilter
==
null
)
return
null
;
if
(
ignoreFilter
==
null
)
return
null
;
FormatProcessor
topProcessor
=
new
FormatProcessor
(
null
,
null
);
FormatProcessor
topProcessor
=
new
FormatProcessor
(
this
);
FormatProcessor
processor
=
new
FormatProcessor
(
FormatProcessor
processor
=
new
FormatProcessor
(
new
Recognizer
[]
{
new
Recognizer
[]
{
new
ContextParamRecognizer
(
this
,
topProcessor
),
new
ContextParamRecognizer
(
this
,
topProcessor
),
new
SimpleGeneratorRecognizer
(
true
)
// in menuMode
new
SimpleGeneratorRecognizer
(
true
,
topProcessor
)
// in menuMode
// new SimpleGeneratorRecognizer(false) // in menuMode
// new SimpleGeneratorRecognizer(false) // in menuMode
},
topProcessor
);
// null for topFormatProcessor - this generator can not reference other parameters
},
topProcessor
);
// null for topFormatProcessor - this generator can not reference other parameters
List
<
String
>
results
=
null
;
List
<
String
>
results
=
null
;
...
@@ -1306,11 +1306,13 @@ public class Tool extends Context implements Cloneable, Inheritable {
...
@@ -1306,11 +1306,13 @@ public class Tool extends Context implements Cloneable, Inheritable {
protected
List
<
String
>
buildCommandString
(
String
paramStringTemplate
,
FormatProcessor
topProcessor
)
protected
List
<
String
>
buildCommandString
(
String
paramStringTemplate
,
FormatProcessor
topProcessor
)
throws
ToolException
throws
ToolException
{
{
if
(
topProcessor
==
null
)
topProcessor
=
new
FormatProcessor
(
null
,
null
);
if
(
topProcessor
==
null
)
topProcessor
=
new
FormatProcessor
(
this
);
else
topProcessor
.
setCurrentTool
(
this
);
FormatProcessor
processor
=
new
FormatProcessor
(
new
Recognizer
[]
{
FormatProcessor
processor
=
new
FormatProcessor
(
new
Recognizer
[]
{
new
ToolParamRecognizer
(
this
,
topProcessor
),
new
ToolParamRecognizer
(
this
,
topProcessor
),
// new SimpleGeneratorRecognizer(),
// new SimpleGeneratorRecognizer(),
new
SimpleGeneratorRecognizer
(
this
),
// new SimpleGeneratorRecognizer(this),
new
SimpleGeneratorRecognizer
(
topProcessor
),
new
RepeaterRecognizer
(),
new
RepeaterRecognizer
(),
new
ContextParamRecognizer
(
this
,
topProcessor
),
new
ContextParamRecognizer
(
this
,
topProcessor
),
new
ContextParamRepeaterRecognizer
(
this
)
new
ContextParamRepeaterRecognizer
(
this
)
...
...
src/com/elphel/vdt/core/tools/params/ToolSequence.java
View file @
e24caf8d
...
@@ -31,6 +31,7 @@ import com.elphel.vdt.Txt;
...
@@ -31,6 +31,7 @@ import com.elphel.vdt.Txt;
import
com.elphel.vdt.VDT
;
import
com.elphel.vdt.VDT
;
import
com.elphel.vdt.core.launching.LaunchCore
;
import
com.elphel.vdt.core.launching.LaunchCore
;
import
com.elphel.vdt.core.launching.ToolLogFile
;
import
com.elphel.vdt.core.launching.ToolLogFile
;
import
com.elphel.vdt.core.launching.VDTLaunchUtil
;
import
com.elphel.vdt.core.tools.ToolsCore
;
import
com.elphel.vdt.core.tools.ToolsCore
;
import
com.elphel.vdt.core.tools.params.Tool.TOOL_MODE
;
import
com.elphel.vdt.core.tools.params.Tool.TOOL_MODE
;
import
com.elphel.vdt.core.tools.params.Tool.TOOL_STATE
;
import
com.elphel.vdt.core.tools.params.Tool.TOOL_STATE
;
...
@@ -133,9 +134,11 @@ public class ToolSequence {
...
@@ -133,9 +134,11 @@ public class ToolSequence {
public
void
toolFinished
(
Tool
tool
){
public
void
toolFinished
(
Tool
tool
){
if
(
tool
!=
null
)
doToolFinished
(
tool
);
if
(
tool
!=
null
)
doToolFinished
(
tool
);
if
(
designFlowView
!=
null
){
if
(
designFlowView
!=
null
){
// System.out.print("1.designFlowView.updateLaunchAction() threadID="+Thread.currentThread().getId());
Display
.
getDefault
().
syncExec
(
new
Runnable
()
{
Display
.
getDefault
().
syncExec
(
new
Runnable
()
{
public
void
run
()
{
public
void
run
()
{
designFlowView
.
updateLaunchAction
();
// Run from Display thread to prevent "invalid thread access" when called from Runner
designFlowView
.
updateLaunchAction
();
// Run from Display thread to prevent "invalid thread access" when called from Runner
// System.out.println(" 2.designFlowView.updateLaunchAction() threadID="+Thread.currentThread().getId());
}
}
});
});
}
}
...
@@ -179,7 +182,7 @@ public class ToolSequence {
...
@@ -179,7 +182,7 @@ public class ToolSequence {
if
(
isStop
()){
if
(
isStop
()){
Tool
waitingTool
=
findWaitingTool
();
Tool
waitingTool
=
findWaitingTool
();
if
(
waitingTool
!=
null
){
if
(
waitingTool
!=
null
){
waitingTool
.
setState
(
TOOL_STATE
.
FAILURE
);
//
waitingTool.setState(TOOL_STATE.FAILURE);
DEBUG_PRINT
(
"doToolFinished("
+
tool
.
getName
()+
") "
+
tool
.
toString
()+
" state="
+
tool
.
getState
()+
" threadID="
+
Thread
.
currentThread
().
getId
());
DEBUG_PRINT
(
"doToolFinished("
+
tool
.
getName
()+
") "
+
tool
.
toString
()+
" state="
+
tool
.
getState
()+
" threadID="
+
Thread
.
currentThread
().
getId
());
waitingTool
.
setMode
(
TOOL_MODE
.
STOP
);
waitingTool
.
setMode
(
TOOL_MODE
.
STOP
);
}
}
...
@@ -275,7 +278,8 @@ public class ToolSequence {
...
@@ -275,7 +278,8 @@ public class ToolSequence {
twa
.
getIgnoreFilter
());
//ignoreFilter);
twa
.
getIgnoreFilter
());
//ignoreFilter);
tool
.
setMode
(
twa
.
getMode
())
;
//TOOL_MODE.RUN);
tool
.
setMode
(
twa
.
getMode
())
;
//TOOL_MODE.RUN);
tool
.
setChoice
(
twa
.
getChoice
());
tool
.
setChoice
(
twa
.
getChoice
());
if
(
VerilogPlugin
.
getPreferenceBoolean
(
PreferenceStrings
.
DEBUG_THREAD_CONFICT
))
System
.
out
.
println
(
">>>>>>>> launching: "
+
tool
.
getName
()+
" threadID="
+
Thread
.
currentThread
().
getId
());
LaunchCore
.
launch
(
tool
,
LaunchCore
.
launch
(
tool
,
SelectedResourceManager
.
getDefault
().
getSelectedProject
(),
SelectedResourceManager
.
getDefault
().
getSelectedProject
(),
twa
.
getFullPath
(),
twa
.
getFullPath
(),
...
@@ -289,6 +293,8 @@ public class ToolSequence {
...
@@ -289,6 +293,8 @@ public class ToolSequence {
// SelectedResourceManager.getDefault().updateActionChoice(fullPath, choice, ignoreFilter); // Andrey
// SelectedResourceManager.getDefault().updateActionChoice(fullPath, choice, ignoreFilter); // Andrey
// SelectedResourceManager.getDefault().setBuildStamp(); // Andrey
// SelectedResourceManager.getDefault().setBuildStamp(); // Andrey
// apply designFlowView to the tool itself
// apply designFlowView to the tool itself
if
(
VerilogPlugin
.
getPreferenceBoolean
(
PreferenceStrings
.
DEBUG_THREAD_CONFICT
))
System
.
out
.
println
(
">>>>>>>> launching 2: "
+
tool
.
getName
()+
" threadID="
+
Thread
.
currentThread
().
getId
());
LaunchCore
.
launch
(
tool
,
LaunchCore
.
launch
(
tool
,
SelectedResourceManager
.
getDefault
().
getSelectedProject
(),
SelectedResourceManager
.
getDefault
().
getSelectedProject
(),
SelectedResourceManager
.
getDefault
().
getChosenTarget
(),
SelectedResourceManager
.
getDefault
().
getChosenTarget
(),
...
@@ -534,6 +540,8 @@ public class ToolSequence {
...
@@ -534,6 +540,8 @@ public class ToolSequence {
System
.
out
.
println
(
"Failed to initiate continueRunningTools() for tool="
+
tool
.
getName
());
System
.
out
.
println
(
"Failed to initiate continueRunningTools() for tool="
+
tool
.
getName
());
}
}
}
else
{
}
else
{
if
(
VerilogPlugin
.
getPreferenceBoolean
(
PreferenceStrings
.
DEBUG_THREAD_CONFICT
))
System
.
out
.
println
(
">>>>>>>> launching 3: "
+
tool
.
getName
()+
" threadID="
+
Thread
.
currentThread
().
getId
());
LaunchCore
.
launch
(
tool
,
LaunchCore
.
launch
(
tool
,
SelectedResourceManager
.
getDefault
().
getSelectedProject
(),
SelectedResourceManager
.
getDefault
().
getSelectedProject
(),
fullPath
,
fullPath
,
...
@@ -557,6 +565,8 @@ public class ToolSequence {
...
@@ -557,6 +565,8 @@ public class ToolSequence {
tool
.
setChoice
(
0
);
tool
.
setChoice
(
0
);
SelectedResourceManager
.
getDefault
().
updateActionChoice
(
fullPath
,
0
,
null
);
// Andrey
SelectedResourceManager
.
getDefault
().
updateActionChoice
(
fullPath
,
0
,
null
);
// Andrey
SelectedResourceManager
.
getDefault
().
setBuildStamp
();
// OK - even for log? Or use old/selected one?
SelectedResourceManager
.
getDefault
().
setBuildStamp
();
// OK - even for log? Or use old/selected one?
if
(
VerilogPlugin
.
getPreferenceBoolean
(
PreferenceStrings
.
DEBUG_THREAD_CONFICT
))
System
.
out
.
println
(
">>>>>>>> launching 4: "
+
tool
.
getName
()+
" threadID="
+
Thread
.
currentThread
().
getId
());
// apply designFlowView to the tool itself
// apply designFlowView to the tool itself
LaunchCore
.
launch
(
tool
,
LaunchCore
.
launch
(
tool
,
SelectedResourceManager
.
getDefault
().
getSelectedProject
(),
SelectedResourceManager
.
getDefault
().
getSelectedProject
(),
...
@@ -614,6 +624,7 @@ public class ToolSequence {
...
@@ -614,6 +624,7 @@ public class ToolSequence {
return
;
return
;
}
}
tryAutoSave
(
toolsToSave
.
get
(
0
));
// launch autosave and trigger toolFinished() when done
tryAutoSave
(
toolsToSave
.
get
(
0
));
// launch autosave and trigger toolFinished() when done
releaseSave
();
}
}
}
}
public
void
releaseSave
(){
public
void
releaseSave
(){
...
@@ -629,6 +640,7 @@ public class ToolSequence {
...
@@ -629,6 +640,7 @@ public class ToolSequence {
return
saveOn
;
return
saveOn
;
}
}
public
boolean
isSaveEnabled
(){
public
boolean
isSaveEnabled
(){
// System.out.println("isSaveEnabled(): "+!getToolsToSave().isEmpty());
return
!
getToolsToSave
().
isEmpty
();
return
!
getToolsToSave
().
isEmpty
();
}
}
...
@@ -861,6 +873,8 @@ public class ToolSequence {
...
@@ -861,6 +873,8 @@ public class ToolSequence {
// apply designFlowView to the tool itself
// apply designFlowView to the tool itself
Display
.
getDefault
().
asyncExec
(
new
Runnable
()
{
Display
.
getDefault
().
asyncExec
(
new
Runnable
()
{
public
void
run
()
{
public
void
run
()
{
if
(
VerilogPlugin
.
getPreferenceBoolean
(
PreferenceStrings
.
DEBUG_THREAD_CONFICT
))
System
.
out
.
println
(
">>>>>>>> launching 5: "
+
fTool
.
getName
()+
" threadID="
+
Thread
.
currentThread
().
getId
());
try
{
try
{
LaunchCore
.
launch
(
fTool
,
LaunchCore
.
launch
(
fTool
,
fProject
,
fProject
,
...
@@ -881,7 +895,7 @@ public class ToolSequence {
...
@@ -881,7 +895,7 @@ public class ToolSequence {
DEBUG_PRINT
(
"Finished (auto)save tool "
+
tool
.
getName
()+
" for "
+
tool
.
getName
());
DEBUG_PRINT
(
"Finished (auto)save tool "
+
tool
.
getName
()+
" for "
+
tool
.
getName
());
if
(
isSave
())
{
// more to save?
if
(
isSave
())
{
// more to save?
List
<
Tool
>
toolsToSave
=
getToolsToSave
();
// find if there are any sessions in unsaved state - returns list (not yet processed)
List
<
Tool
>
toolsToSave
=
getToolsToSave
();
// find if there are any sessions in unsaved state - returns list (not yet processed)
if
((
toolsToSave
!=
null
)
&&
(
toolsToSave
.
size
()>=
0
)){
if
((
toolsToSave
!=
null
)
&&
!
toolsToSave
.
isEmpty
(
)){
if
(
toolsToSave
.
get
(
0
).
getSaveMaster
()!=
null
){
if
(
toolsToSave
.
get
(
0
).
getSaveMaster
()!=
null
){
System
.
out
.
println
(
"Seems to be a BUG that might cause infinite attempts to save while processing tool "
+
System
.
out
.
println
(
"Seems to be a BUG that might cause infinite attempts to save while processing tool "
+
tool
.
getName
()+
", first save tool "
+
toolsToSave
.
get
(
0
).
getName
()+
tool
.
getName
()+
", first save tool "
+
toolsToSave
.
get
(
0
).
getName
()+
...
...
src/com/elphel/vdt/core/tools/params/conditions/StringComparison.java
View file @
e24caf8d
...
@@ -31,7 +31,7 @@ import com.elphel.vdt.ui.MessageUI;
...
@@ -31,7 +31,7 @@ import com.elphel.vdt.ui.MessageUI;
public
class
StringComparison
extends
Comparison
{
public
class
StringComparison
extends
Comparison
{
private
Context
context
;
private
Context
context
;
private
String
left
,
right
;
private
String
left
,
right
;
private
FormatProcessor
topProcessor
;
//
private FormatProcessor topProcessor;
// constructor should not reference topProcessor (it is only used at startup)
// constructor should not reference topProcessor (it is only used at startup)
public
StringComparison
(
COMPARE_OP
op
,
String
left
,
String
right
)
{
public
StringComparison
(
COMPARE_OP
op
,
String
left
,
String
right
)
{
...
@@ -66,11 +66,12 @@ public class StringComparison extends Comparison {
...
@@ -66,11 +66,12 @@ public class StringComparison extends Comparison {
String
actualRight
=
right
;
String
actualRight
=
right
;
if
(
context
!=
null
)
{
if
(
context
!=
null
)
{
if
(
topProcessor
==
null
)
topProcessor
=
new
FormatProcessor
(
null
,
null
);
if
(
topProcessor
==
null
)
topProcessor
=
new
FormatProcessor
(
context
);
else
topProcessor
.
setCurrentTool
(
context
);
FormatProcessor
processor
=
FormatProcessor
processor
=
new
FormatProcessor
(
new
Recognizer
[]
{
new
FormatProcessor
(
new
Recognizer
[]
{
new
ContextParamRecognizer
(
context
,
topProcessor
),
new
ContextParamRecognizer
(
context
,
topProcessor
),
new
SimpleGeneratorRecognizer
()
new
SimpleGeneratorRecognizer
(
topProcessor
)
},
topProcessor
);
},
topProcessor
);
try
{
try
{
...
...
src/com/elphel/vdt/core/tools/params/recognizers/DefaultListGeneratorRecognizer.java
View file @
e24caf8d
...
@@ -26,35 +26,31 @@ import com.elphel.vdt.core.tools.params.Tool;
...
@@ -26,35 +26,31 @@ import com.elphel.vdt.core.tools.params.Tool;
public
class
DefaultListGeneratorRecognizer
implements
Recognizer
{
public
class
DefaultListGeneratorRecognizer
implements
Recognizer
{
private
static
final
String
CONTROL_SEQ
=
"%"
;
private
static
final
String
CONTROL_SEQ
=
"%"
;
private
static
final
int
CONTROL_SEQ_LEN
=
CONTROL_SEQ
.
length
();
private
static
final
int
CONTROL_SEQ_LEN
=
CONTROL_SEQ
.
length
();
private
AbstractGenerator
[]
generators
;
private
static
AbstractGenerator
[]
generators
=
new
AbstractGenerator
[]
{
// public DefaultListGeneratorRecognizer(boolean menuMode, Tool tool,FormatProcessor topProcessor){
new
SourceListGenerator
(
""
,
""
,
null
),
public
DefaultListGeneratorRecognizer
(
boolean
menuMode
,
FormatProcessor
topProcessor
){
new
FilteredSourceListGenerator
(
""
,
""
,
null
),
new
FileListGenerator
(
""
,
""
,
null
)
};
public
DefaultListGeneratorRecognizer
(){
super
();
}
public
DefaultListGeneratorRecognizer
(
boolean
menuMode
){
super
();
for
(
int
i
=
0
;
i
<
generators
.
length
;
i
++){
generators
[
i
].
setMenuMode
(
menuMode
);
}
}
public
DefaultListGeneratorRecognizer
(
boolean
menuMode
,
Tool
tool
){
super
();
super
();
AbstractGenerator
[]
generators
=
new
AbstractGenerator
[]{
new
SourceListGenerator
(
""
,
""
,
null
),
new
FilteredSourceListGenerator
(
""
,
""
,
null
,
topProcessor
),
new
FileListGenerator
(
""
,
""
,
null
)
};
this
.
generators
=
generators
;
for
(
int
i
=
0
;
i
<
generators
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
generators
.
length
;
i
++){
generators
[
i
].
setMenuMode
(
menuMode
);
generators
[
i
].
setMenuMode
(
menuMode
);
generators
[
i
].
setTool
(
tool
);
//
generators[i].setTool(tool);
}
}
}
}
public
DefaultListGeneratorRecognizer
(
Tool
tool
){
public
DefaultListGeneratorRecognizer
(
FormatProcessor
topProcessor
){
super
();
this
(
false
,
topProcessor
);
for
(
int
i
=
0
;
i
<
generators
.
length
;
i
++){
generators
[
i
].
setTool
(
tool
);
}
}
}
// public DefaultListGeneratorRecognizer(boolean menuMode,FormatProcessor topProcessor){
// this(menuMode,null,topProcessor);
// }
// public DefaultListGeneratorRecognizer(Tool tool, FormatProcessor topProcessor){
// public DefaultListGeneratorRecognizer(Tool tool, FormatProcessor topProcessor){
// this(false,tool,topProcessor);
// }
public
RecognizerResult
recognize
(
String
template
,
int
startPos
,
FormatProcessor
topProcessor
)
{
public
RecognizerResult
recognize
(
String
template
,
int
startPos
,
FormatProcessor
topProcessor
)
{
RecognizerResult
result
=
new
RecognizerResult
();
RecognizerResult
result
=
new
RecognizerResult
();
...
...
src/com/elphel/vdt/core/tools/params/recognizers/ParamRepeaterRecognizer.java
View file @
e24caf8d
...
@@ -60,7 +60,7 @@ public class ParamRepeaterRecognizer extends RepeaterRecognizer {
...
@@ -60,7 +60,7 @@ public class ParamRepeaterRecognizer extends RepeaterRecognizer {
return
new
ValueGenerator
(
param
,
repPrefix
,
repSuffix
,
separator
,
topProcessor
);
return
new
ValueGenerator
(
param
,
repPrefix
,
repSuffix
,
separator
,
topProcessor
);
/* Trying to put these here */
/* Trying to put these here */
if
(
genName
.
equals
(
FilteredSourceListGenerator
.
NAME
))
if
(
genName
.
equals
(
FilteredSourceListGenerator
.
NAME
))
return
new
FilteredSourceListGenerator
(
repPrefix
,
repSuffix
,
separator
);
return
new
FilteredSourceListGenerator
(
repPrefix
,
repSuffix
,
separator
,
topProcessor
);
else
if
(
genName
.
equals
(
SourceListGenerator
.
NAME
))
else
if
(
genName
.
equals
(
SourceListGenerator
.
NAME
))
return
new
SourceListGenerator
(
repPrefix
,
repSuffix
,
separator
);
return
new
SourceListGenerator
(
repPrefix
,
repSuffix
,
separator
);
else
if
(
genName
.
equals
(
FileListGenerator
.
NAME
))
else
if
(
genName
.
equals
(
FileListGenerator
.
NAME
))
...
...
src/com/elphel/vdt/core/tools/params/recognizers/RepeaterRecognizer.java
View file @
e24caf8d
...
@@ -105,7 +105,7 @@ public class RepeaterRecognizer implements Recognizer {
...
@@ -105,7 +105,7 @@ public class RepeaterRecognizer implements Recognizer {
FormatProcessor
topProcessor
)
FormatProcessor
topProcessor
)
{
{
System
.
out
.
println
(
"Ever get here? RepeaterRecognizer.java:findGenerator()"
);
// yes, sure
System
.
out
.
println
(
"Ever get here? RepeaterRecognizer.java:findGenerator()"
);
// yes, sure
AbstractGenerator
gen
=
new
FilteredSourceListGenerator
(
repPrefix
,
repSuffix
,
separator
);
AbstractGenerator
gen
=
new
FilteredSourceListGenerator
(
repPrefix
,
repSuffix
,
separator
,
topProcessor
);
if
(
genName
.
equals
(
gen
.
getName
()))
return
gen
;
if
(
genName
.
equals
(
gen
.
getName
()))
return
gen
;
gen
=
new
SourceListGenerator
(
repPrefix
,
repSuffix
,
separator
);
gen
=
new
SourceListGenerator
(
repPrefix
,
repSuffix
,
separator
);
if
(
genName
.
equals
(
gen
.
getName
()))
return
gen
;
if
(
genName
.
equals
(
gen
.
getName
()))
return
gen
;
...
...
src/com/elphel/vdt/core/tools/params/recognizers/SimpleGeneratorRecognizer.java
View file @
e24caf8d
...
@@ -27,44 +27,36 @@ public class SimpleGeneratorRecognizer implements Recognizer {
...
@@ -27,44 +27,36 @@ public class SimpleGeneratorRecognizer implements Recognizer {
private
static
final
String
CONTROL_SEQ
=
"%"
;
private
static
final
String
CONTROL_SEQ
=
"%"
;
private
static
final
int
CONTROL_SEQ_LEN
=
CONTROL_SEQ
.
length
();
private
static
final
int
CONTROL_SEQ_LEN
=
CONTROL_SEQ
.
length
();
private
static
AbstractGenerator
[]
generators
=
new
AbstractGenerator
[]
{
private
AbstractGenerator
[]
generators
;
new
OSNameGenerator
(),
new
ProjectNameGenerator
(),
new
ProjectPathGenerator
(),
new
TopModuleNameGenerator
(),
new
SelectedFileGenerator
(),
new
CurrentFileGenerator
(),
new
CurrentFileBaseGenerator
(),
new
ChosenActionGenerator
(),
new
BuildStampGenerator
(),
new
UserNameGenerator
(),
new
StateDirGenerator
(),
new
StateFileGenerator
(),
new
StateBaseGenerator
()
// new SourceListGenerator("","",""),
// new FilteredSourceListGenerator("","","")
};
public
SimpleGeneratorRecognizer
(){
public
SimpleGeneratorRecognizer
(
FormatProcessor
processor
){
super
();
}
public
SimpleGeneratorRecognizer
(
boolean
menuMode
){
super
();
super
();
AbstractGenerator
[]
templateGenerators
=
new
AbstractGenerator
[]
{
new
OSNameGenerator
(),
new
ProjectNameGenerator
(),
new
ProjectPathGenerator
(),
new
TopModuleNameGenerator
(),
new
SelectedFileGenerator
(),
new
CurrentFileGenerator
(),
new
CurrentFileBaseGenerator
(),
new
ChosenActionGenerator
(),
new
BuildStampGenerator
(
processor
),
new
UserNameGenerator
(),
new
StateDirGenerator
(
processor
),
new
StateFileGenerator
(
processor
),
new
StateBaseGenerator
(
processor
)
// new SourceListGenerator("","",""),
// new FilteredSourceListGenerator("","","")
};
generators
=
templateGenerators
;
for
(
int
i
=
0
;
i
<
generators
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
generators
.
length
;
i
++){
generators
[
i
].
set
MenuMode
(
menuMode
);
generators
[
i
].
set
TopProcessor
(
processor
);
}
}
}
}
public
SimpleGeneratorRecognizer
(
boolean
menuMode
,
Tool
tool
){
public
SimpleGeneratorRecognizer
(
boolean
menuMode
,
FormatProcessor
processor
){
super
(
);
this
(
processor
);
for
(
int
i
=
0
;
i
<
generators
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
generators
.
length
;
i
++){
generators
[
i
].
setMenuMode
(
menuMode
);
generators
[
i
].
setMenuMode
(
menuMode
);
generators
[
i
].
setTool
(
tool
);
}
}
public
SimpleGeneratorRecognizer
(
Tool
tool
){
super
();
for
(
int
i
=
0
;
i
<
generators
.
length
;
i
++){
generators
[
i
].
setTool
(
tool
);
}
}
}
}
public
RecognizerResult
recognize
(
String
template
,
int
startPos
,
FormatProcessor
topProcessor
)
{
public
RecognizerResult
recognize
(
String
template
,
int
startPos
,
FormatProcessor
topProcessor
)
{
...
...
src/com/elphel/vdt/ui/views/DesignFlowView.java
View file @
e24caf8d
...
@@ -397,6 +397,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
...
@@ -397,6 +397,7 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
toggleLinkedTools
.
setImageDescriptor
(
VDTPluginImages
.
DESC_TOOLS_LINKED
);
toggleLinkedTools
.
setImageDescriptor
(
VDTPluginImages
.
DESC_TOOLS_LINKED
);
}
}
toolSequence
.
setToolsDirtyFlag
(
false
);
//boolean update) - recalculate dirty flags
toolSequence
.
setToolsDirtyFlag
(
false
);
//boolean update) - recalculate dirty flags
fDesignFlowView
.
updateLaunchAction
();
}
}
};
};
toggleLinkedTools
.
setToolTipText
(
"Toggle tool dependency"
);
toggleLinkedTools
.
setToolTipText
(
"Toggle tool dependency"
);
...
@@ -412,6 +413,8 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
...
@@ -412,6 +413,8 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
toggleSaveTools
.
setToolTipText
(
"Save tool state"
);
toggleSaveTools
.
setToolTipText
(
"Save tool state"
);
toggleSaveTools
.
setImageDescriptor
(
VDTPluginImages
.
DESC_TOOLS_SAVE
);
toggleSaveTools
.
setImageDescriptor
(
VDTPluginImages
.
DESC_TOOLS_SAVE
);
//isSaveEnabled()
toggleStopTools
=
new
Action
(
"Stop tools"
,
Action
.
AS_CHECK_BOX
)
{
toggleStopTools
=
new
Action
(
"Stop tools"
,
Action
.
AS_CHECK_BOX
)
{
public
void
run
()
{
public
void
run
()
{
...
@@ -906,36 +909,10 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
...
@@ -906,36 +909,10 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
&&
(
selectedItem
.
getTool
()
!=
null
);
&&
(
selectedItem
.
getTool
()
!=
null
);
showPropertiesAction
.
setEnabled
(
enabled
);
showPropertiesAction
.
setEnabled
(
enabled
);
clearToolPropertiesAction
.
setEnabled
(
enabled
);
clearToolPropertiesAction
.
setEnabled
(
enabled
);
((
ViewLabelProvider
)
viewer
.
getLabelProvider
()).
fireChanged
();
/*
viewer.getTree().update();
toggleSaveTools
.
setEnabled
(
toolSequence
.
isSaveEnabled
());
viewer.refresh();
System.out.println("DesignFlowView: should update now");
// Display.update();
compositeParent.getDisplay().update();
String menuTitle=getMenuTitle();
if (menuTitle.endsWith("*")){
changeMenuTitle(menuTitle.substring(0,menuTitle.length()-1));
}else {
changeMenuTitle(menuTitle+"*");
}
// changeMenuTitle(menuTitle+"***");
compositeParent.redraw(); // widget is disposed
compositeParent.update();
// changeMenuTitle(menuTitle+"");
//Well you need to determine the row position range for the child rows you want to refresh and then fire a RowVisualChangeEvent.
// That should do the trick.
// System.out.println("count="+viewer.get)
Tree tree=viewer.getTree();
System.out.println("count="+tree.getItemCount());
TreeItem [] items=tree.getItems();
for (TreeItem ti:items){
System.out.println("--- "+ti.getText());
}
// ((BaseLabelProvider) viewer.getLabelProvider()).fireLabelProviderChanged(new LabelProviderChangedEvent( null));
((
ViewLabelProvider
)
viewer
.
getLabelProvider
()).
fireChanged
();
((
ViewLabelProvider
)
viewer
.
getLabelProvider
()).
fireChanged
();
*/
}
// updateLaunchAction()
}
// updateLaunchAction()
private
void
launchTool
(
private
void
launchTool
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment