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
f88dd96e
Commit
f88dd96e
authored
Jan 21, 2014
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented multiple-choice launch actions
parent
216443b3
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
383 additions
and
130 deletions
+383
-130
VDT.java
src/com/elphel/vdt/VDT.java
+1
-0
VerilogUtils.java
src/com/elphel/vdt/VerilogUtils.java
+2
-2
ParamBasedOption.java
src/com/elphel/vdt/core/options/ParamBasedOption.java
+7
-1
XMLConfig.java
src/com/elphel/vdt/core/tools/config/xml/XMLConfig.java
+18
-17
AbstractGenerator.java
...m/elphel/vdt/core/tools/generators/AbstractGenerator.java
+5
-2
CurrentFileBaseGenerator.java
...l/vdt/core/tools/generators/CurrentFileBaseGenerator.java
+11
-6
CurrentFileGenerator.java
...lphel/vdt/core/tools/generators/CurrentFileGenerator.java
+7
-6
SourceListGenerator.java
...elphel/vdt/core/tools/generators/SourceListGenerator.java
+3
-2
TopModuleNameGenerator.java
...hel/vdt/core/tools/generators/TopModuleNameGenerator.java
+2
-1
TopModulesNameGenerator.java
...el/vdt/core/tools/generators/TopModulesNameGenerator.java
+2
-1
Parameter.java
src/com/elphel/vdt/core/tools/params/Parameter.java
+19
-11
Tool.java
src/com/elphel/vdt/core/tools/params/Tool.java
+32
-3
SimpleGeneratorRecognizer.java
...e/tools/params/recognizers/SimpleGeneratorRecognizer.java
+3
-2
RunFor.java
src/com/elphel/vdt/core/tools/params/types/RunFor.java
+1
-0
SelectedResourceManager.java
src/com/elphel/vdt/ui/variables/SelectedResourceManager.java
+50
-2
VerilogResolver.java
src/com/elphel/vdt/ui/variables/VerilogResolver.java
+2
-1
DesignFlowView.java
src/com/elphel/vdt/ui/views/DesignFlowView.java
+161
-50
DesignMenuModel.java
src/com/elphel/vdt/ui/views/DesignMenuModel.java
+22
-3
IVerilog.xml
tools/Verilog/IVerilog.xml
+35
-20
No files found.
src/com/elphel/vdt/VDT.java
View file @
f88dd96e
...
...
@@ -145,5 +145,6 @@ public class VDT {
public
static
final
String
GENERATOR_ID_CURRENT_FILE
=
"CurrentFile"
;
public
static
final
String
GENERATOR_ID_SELECTED_FILE
=
"SelectedFile"
;
public
static
final
String
GENERATOR_ID_CURRENT_BASE
=
"CurrentFileBase"
;
public
static
final
String
GENERATOR_ID_CHOSEN_ACTION
=
"ChosenActionIndex"
;
public
static
final
String
GENERATOR_ID_OS_NAME
=
"OS"
;
}
// class VDT
src/com/elphel/vdt/VerilogUtils.java
View file @
f88dd96e
...
...
@@ -100,8 +100,8 @@ public class VerilogUtils {
* Returns the top module(s) for given verilog file.
*/
public
static
String
[]
getTopModuleNames
(
IFile
file
)
{
OutlineElement
[]
outlineElements
=
getTopModulesVeditor
(
file
);
public
static
String
[]
getTopModuleNames
(
IFile
file
)
{
//L/x353/data/vdt/workspace_11-runtime/x353/x353_1.tf
OutlineElement
[]
outlineElements
=
getTopModulesVeditor
(
file
);
// empty inside
if
(
outlineElements
==
null
)
return
null
;
String
[]
list
=
new
String
[
outlineElements
.
length
];
for
(
int
i
=
0
;
i
<
list
.
length
;
i
++)
{
...
...
src/com/elphel/vdt/core/options/ParamBasedOption.java
View file @
f88dd96e
...
...
@@ -73,7 +73,13 @@ public class ParamBasedOption extends Option {
}
public
String
doLoadDefault
()
{
String
value
=
param
.
getDefaultValue
().
get
(
0
);
String
value
=
param
.
getDefaultValue
(
true
).
get
(
0
);
// Andrey: ignore faults in TopModuleName generator
doClear
();
return
value
;
}
public
String
doLoadDefault
(
boolean
menuMode
)
{
String
value
=
param
.
getDefaultValue
(
menuMode
).
get
(
0
);
doClear
();
return
value
;
}
...
...
src/com/elphel/vdt/core/tools/config/xml/XMLConfig.java
View file @
f88dd96e
...
...
@@ -990,28 +990,29 @@ public class XMLConfig extends Config {
for
(
Iterator
<
Node
>
n
=
runForNodes
.
iterator
();
n
.
hasNext
();)
{
Node
node
=
(
Node
)
n
.
next
();
boolean
checkExtension
=
false
;
// for empty resource field - do not check file or extensions
boolean
checkExistence
=
false
;
String
label
=
getAttributeValue
(
node
,
CONTEXT_TOOL_ACTION_LABEL
);
if
(
label
==
null
)
label
=
CONTEXT_TOOL_DFLT_ACTION_LABEL
;
String
resource
=
getAttributeValue
(
node
,
CONTEXT_TOOL_ACTION_RESOURCE
);
if
(
resource
==
null
)
resource
=
CONTEXT_TOOL_DFLT_ACTION_RESOURCE
;
String
checkExtensionAttr
=
getAttributeValue
(
node
,
CONTEXT_TOOL_ACTION_CHECK_EXTENSION
);
if
(
checkExtensionAttr
==
null
){
checkExtensionAttr
=
CONTEXT_TOOL_DFLT_ACTION_CHECK_EXTENSION
;
}
checkBoolAttr
(
checkExtensionAttr
,
CONTEXT_TOOL_ACTION_CHECK_EXTENSION
);
boolean
checkExtension
=
getBoolAttrValue
(
checkExtensionAttr
);
String
checkExistenceAttr
=
getAttributeValue
(
node
,
CONTEXT_TOOL_ACTION_CHECK_EXISTENCE
);
if
(
checkExistenceAttr
==
null
){
checkExistenceAttr
=
CONTEXT_TOOL_DFLT_ACTION_CHECK_EXISTENCE
;
if
((
resource
==
null
)
||
(
resource
.
length
()==
0
))
{
// resource= CONTEXT_TOOL_DFLT_ACTION_RESOURCE;
resource
=
""
;
}
else
{
String
checkExtensionAttr
=
getAttributeValue
(
node
,
CONTEXT_TOOL_ACTION_CHECK_EXTENSION
);
if
(
checkExtensionAttr
==
null
){
checkExtensionAttr
=
CONTEXT_TOOL_DFLT_ACTION_CHECK_EXTENSION
;
}
checkBoolAttr
(
checkExtensionAttr
,
CONTEXT_TOOL_ACTION_CHECK_EXTENSION
);
checkExtension
=
getBoolAttrValue
(
checkExtensionAttr
);
String
checkExistenceAttr
=
getAttributeValue
(
node
,
CONTEXT_TOOL_ACTION_CHECK_EXISTENCE
);
if
(
checkExistenceAttr
==
null
){
checkExistenceAttr
=
CONTEXT_TOOL_DFLT_ACTION_CHECK_EXISTENCE
;
}
checkBoolAttr
(
checkExistenceAttr
,
CONTEXT_TOOL_ACTION_CHECK_EXISTENCE
);
checkExistence
=
getBoolAttrValue
(
checkExistenceAttr
);
}
checkBoolAttr
(
checkExistenceAttr
,
CONTEXT_TOOL_ACTION_CHECK_EXISTENCE
);
boolean
checkExistence
=
getBoolAttrValue
(
checkExistenceAttr
);
runForList
.
add
(
new
RunFor
(
label
,
resource
,
checkExtension
,
checkExistence
));
}
}
...
...
src/com/elphel/vdt/core/tools/generators/AbstractGenerator.java
View file @
f88dd96e
...
...
@@ -31,7 +31,7 @@ public abstract class AbstractGenerator {
protected
final
String
prefix
,
suffix
;
protected
String
separator
;
private
final
boolean
forcedMultiline
;
private
boolean
menuMode
=
false
;
// managing menu items, not running tool
private
boolean
menuMode
=
false
;
// managing menu items, not running tool
. Ignore Generator errors
public
AbstractGenerator
()
{
this
(
false
);
...
...
@@ -119,8 +119,11 @@ public abstract class AbstractGenerator {
return
output
;
}
protected
void
fault
(
String
message
)
{
protected
String
fault
(
String
message
)
{
if
(
menuMode
)
return
""
;
MessageUI
.
error
(
"Generator '"
+
getName
()
+
"' fault: "
+
message
);
return
null
;
}
protected
abstract
String
[]
getStringValues
();
...
...
src/com/elphel/vdt/core/tools/generators/CurrentFileBaseGenerator.java
View file @
f88dd96e
...
...
@@ -17,8 +17,9 @@
*******************************************************************************/
package
com
.
elphel
.
vdt
.
core
.
tools
.
generators
;
import
org.eclipse.core.resources.IFile
;
import
org.eclipse.core.resources.IResource
;
//import org.eclipse.core.resources.IFile;
//import org.eclipse.core.resources.IResource;
//import org.eclipse.ui.IPageLayout;
import
com.elphel.vdt.VDT
;
import
com.elphel.vdt.ui.variables.SelectedResourceManager
;
...
...
@@ -31,13 +32,17 @@ public class CurrentFileBaseGenerator extends AbstractGenerator {
}
protected
String
[]
getStringValues
()
{
IResource
resource
=
SelectedResourceManager
.
getDefault
().
getSelectedResource
();
if
((
resource
!=
null
)
&&
(
resource
.
getType
()
==
IResource
.
FILE
))
{
String
fullName
=((
IFile
)
resource
).
getLocation
().
toOSString
();
// IResource resource = SelectedResourceManager.getDefault().getSelectedResource();
String
fullName
=
SelectedResourceManager
.
getDefault
().
getChosenTarget
();
// if((resource != null) && (resource.getType() == IResource.FILE)) {
// String fullName=((IFile)resource).getLocation().toOSString();
if
(
fullName
!=
null
){
int
dot
=
fullName
.
lastIndexOf
(
'.'
);
return
new
String
[]
{
(
dot
<
0
)
?
fullName
:
fullName
.
substring
(
0
,
dot
)
};
}
return
new
String
[]
{
""
};
}
}
src/com/elphel/vdt/core/tools/generators/CurrentFileGenerator.java
View file @
f88dd96e
...
...
@@ -44,12 +44,13 @@ public class CurrentFileGenerator extends AbstractGenerator {
*/
protected
String
[]
getStringValues
()
{
IResource
resource
;
if
(
getMenuMode
())
resource
=
SelectedResourceManager
.
getDefault
().
getViewSelectedResource
(
IPageLayout
.
ID_RES_NAV
);
else
resource
=
SelectedResourceManager
.
getDefault
().
getSelectedResource
();
if
((
resource
!=
null
)
&&
(
resource
.
getType
()
==
IResource
.
FILE
))
return
new
String
[]
{
((
IFile
)
resource
).
getLocation
().
toOSString
()
};
if
(
getMenuMode
())
{
resource
=
SelectedResourceManager
.
getDefault
().
getViewSelectedResource
(
IPageLayout
.
ID_RES_NAV
);
if
((
resource
!=
null
)
&&
(
resource
.
getType
()
==
IResource
.
FILE
))
return
new
String
[]
{
((
IFile
)
resource
).
getLocation
().
toOSString
()
};
}
else
{
return
new
String
[]
{
SelectedResourceManager
.
getDefault
().
getChosenTarget
()};
}
return
new
String
[]
{
""
};
}
}
src/com/elphel/vdt/core/tools/generators/SourceListGenerator.java
View file @
f88dd96e
...
...
@@ -52,9 +52,10 @@ public class SourceListGenerator extends AbstractGenerator {
protected
String
[]
getStringValues
()
{
String
[]
file_names
=
null
;
IResource
resource
=
SelectedResourceManager
.
getDefault
().
getSelectedVerilogFile
();
// IResource resource = SelectedResourceManager.getDefault().getSelectedVerilogFile();
IResource
resource
=
SelectedResourceManager
.
getDefault
().
getChosenVerilogFile
();
if
(
resource
!=
null
&&
resource
.
getType
()
==
IResource
.
FILE
)
{
IFile
[]
files
=
VerilogUtils
.
getDependencies
((
IFile
)
resource
);
IFile
[]
files
=
VerilogUtils
.
getDependencies
((
IFile
)
resource
);
// returned just the same x353_1.tf
file_names
=
new
String
[
files
.
length
];
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++)
file_names
[
i
]
=
files
[
i
].
getProjectRelativePath
().
toOSString
();
//.getName();
...
...
src/com/elphel/vdt/core/tools/generators/TopModuleNameGenerator.java
View file @
f88dd96e
...
...
@@ -37,7 +37,8 @@ public class TopModuleNameGenerator extends AbstractGenerator {
return
NAME
;
}
protected
String
[]
getStringValues
()
{
IResource
resource
=
SelectedResourceManager
.
getDefault
().
getSelectedVerilogFile
();
// IResource resource = SelectedResourceManager.getDefault().getSelectedVerilogFile();
IResource
resource
=
SelectedResourceManager
.
getDefault
().
getChosenVerilogFile
();
if
((
resource
!=
null
)
&&
(
resource
.
getType
()
==
IResource
.
FILE
))
{
String
[]
outlineElementsNames
=
VerilogUtils
.
getTopModuleNames
((
IFile
)
resource
);
if
((
outlineElementsNames
!=
null
)
&&
(
outlineElementsNames
.
length
>
0
))
return
new
String
[]
{
outlineElementsNames
[
0
]};
...
...
src/com/elphel/vdt/core/tools/generators/TopModulesNameGenerator.java
View file @
f88dd96e
...
...
@@ -45,7 +45,8 @@ public class TopModulesNameGenerator extends AbstractGenerator {
return
NAME
;
}
protected
String
[]
getStringValues
()
{
IResource
resource
=
SelectedResourceManager
.
getDefault
().
getSelectedVerilogFile
();
// IResource resource = SelectedResourceManager.getDefault().getSelectedVerilogFile();
IResource
resource
=
SelectedResourceManager
.
getDefault
().
getChosenVerilogFile
();
if
((
resource
!=
null
)
&&
(
resource
.
getType
()
==
IResource
.
FILE
))
{
String
[]
outlineElementsNames
=
VerilogUtils
.
getTopModuleNames
((
IFile
)
resource
);
if
((
outlineElementsNames
!=
null
)
&&
(
outlineElementsNames
.
length
>
0
))
return
outlineElementsNames
;
...
...
src/com/elphel/vdt/core/tools/params/Parameter.java
View file @
f88dd96e
...
...
@@ -122,9 +122,11 @@ public class Parameter implements Cloneable, Updateable {
this
.
relevant
=
relevant
;
this
.
hasDependentParameters
=
false
;
this
.
sourceXML
=
sourceXML
;
/*
if (id.equals("SimulationTopFile")){ // Andrey
System.out.println("Creating parameter SimulationTopFile, defaultValue="+defaultValue);
}
*/
}
protected
Parameter
(
Parameter
param
)
{
this
(
param
.
id
,
...
...
@@ -167,10 +169,11 @@ public class Parameter implements Cloneable, Updateable {
this.context = context;
*/
/*
if (id.equals("SimulationTopFile")){ // Andrey
System.out.println("Initializing parameter SimulationTopFile, defaultValue="+defaultValue);
}
*/
// Andrey: replacing with
if
(
this
.
context
==
context
)
{
...
...
@@ -312,9 +315,9 @@ public class Parameter implements Cloneable, Updateable {
//
public
void
setCurrentValue
(
String
value
)
throws
ToolException
{
if
(
id
.
equals
(
"SimulationTopFile"
)){
// Andrey
System
.
out
.
println
(
"setCurrentValue() SimulationTopFile, value="
+
value
);
}
//
if (id.equals("SimulationTopFile")){ // Andrey
//
System.out.println("setCurrentValue() SimulationTopFile, value="+value);
//
}
if
(
type
.
isList
())
throw
new
ToolException
(
"Assigning a non-list value to list parameter"
);
...
...
@@ -328,9 +331,9 @@ public class Parameter implements Cloneable, Updateable {
}
public
void
setCurrentValue
(
List
<
String
>
value
)
throws
ToolException
{
if
(
id
.
equals
(
"SimulationTopFile"
)){
// Andrey
System
.
out
.
println
(
"setCurrentValue() SimulationTopFile a list value"
);
}
//
if (id.equals("SimulationTopFile")){ // Andrey
//
System.out.println("setCurrentValue() SimulationTopFile a list value");
//
}
if
(!
type
.
isList
())
throw
new
ToolException
(
"Assigning a list value to non-list parameter"
);
...
...
@@ -352,8 +355,11 @@ public class Parameter implements Cloneable, Updateable {
return
currentValue
;
}
public
List
<
String
>
getDefaultValue
()
{
return
getDefaultValue
(
false
);
}
public
List
<
String
>
getDefaultValue
(
boolean
menuMode
)
{
String
resolvedDefaultValue
=
ConditionUtils
.
resolveContextCondition
(
context
,
defaultValue
);
String
errmsg
=
"Parameter '"
+
id
+
"' of context '"
+
context
.
getName
()
+
...
...
@@ -363,7 +369,7 @@ public class Parameter implements Cloneable, Updateable {
FormatProcessor
processor
=
new
FormatProcessor
(
new
Recognizer
[]
{
//new RepeaterRecognizer(),
new
SimpleGeneratorRecognizer
(),
new
SimpleGeneratorRecognizer
(
menuMode
),
new
ContextParamRecognizer
(
context
)
});
...
...
@@ -386,10 +392,11 @@ public class Parameter implements Cloneable, Updateable {
// returns current value if it is set
// otherwise returns default value
public
List
<
String
>
getValue
()
{
/*
if (id.equals("SimulationTopFile")){ // Andrey
System.out.println("getValue() SimulationTopFile");
}
*/
if
(!
currentValue
.
isEmpty
())
return
currentValue
;
...
...
@@ -399,10 +406,11 @@ public class Parameter implements Cloneable, Updateable {
// returns external form of the current value unless it equals null;
// otherwise returns external form of the default value
public
List
<
String
>
getExternalValueForm
()
{
/*
if (id.equals("SimulationTopFile")){ // Andrey
System.out.println("getExternalValueForm() SimulationTopFile");
}
*/
List
<
String
>
externalFormValue
=
new
ArrayList
<
String
>();
for
(
Iterator
<
String
>
i
=
getValue
().
iterator
();
i
.
hasNext
();)
{
...
...
src/com/elphel/vdt/core/tools/params/Tool.java
View file @
f88dd96e
...
...
@@ -44,6 +44,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
private
List
<
String
>
extensions
;
private
List
<
RunFor
>
runfor
;
private
int
choice
;
// selected variant for runfor
private
Tool
baseTool
;
...
...
@@ -94,11 +95,19 @@ public class Tool extends Context implements Cloneable, Inheritable {
this
.
toolErrors
=
toolErrors
;
this
.
toolWarnings
=
toolWarnings
;
this
.
toolInfo
=
toolInfo
;
this
.
choice
=
0
;
}
public
List
<
RunFor
>
getRunFor
(){
return
runfor
;
}
public
int
getChoice
(){
return
choice
;
}
public
void
setChoice
(
int
choice
){
this
.
choice
=
choice
;
}
public
void
init
(
Config
config
)
throws
ConfigException
{
if
(
initialized
)
...
...
@@ -231,7 +240,7 @@ public class Tool extends Context implements Cloneable, Inheritable {
public
RunFor
[]
getMenuActions
(
IProject
project
)
{
if
(
runfor
==
null
)
return
null
;
updateContextOptions
(
project
);
// Fill in parameters
updateContextOptions
(
project
);
// Fill in parameters - it parses here too - at least some parameters? (not in menu mode)
// Can be two different processors for labels and resources
//SimpleGeneratorRecognizer(true) may be not needed, as current file is already set here
...
...
@@ -277,27 +286,46 @@ public class Tool extends Context implements Cloneable, Inheritable {
PackageContext
packageContext
=
getParentPackage
();
if
(
packageContext
!=
null
)
{
OptionsCore
.
doLoadContextOptions
(
packageContext
);
/*
try {
packageContext.buildParams();
} catch (ToolException e) { // Do nothing here
System.out.println("updateContextOptions ToolException for Package Context="+e.getMessage());
} catch (NullPointerException e) { // Do nothing here Or make it "finally" to ignore all parameters parsing here?
System.out.println("updateContextOptions NullPointerException for Package Context="+e.getMessage());
} finally {
System.out.println("updateContextOptions for Package Context - other error");
}
*/
}
Context
context
=
getParentProject
();
if
(
context
!=
null
)
{
OptionsCore
.
doLoadContextOptions
(
context
,
project
);
/*
try {
context.buildParams();
}
catch
(
ToolException
e
)
{
// Do nothing here
} catch (ToolException e) { // Do nothing here
Or make it "finally" to ignore all parameters parsing here?
System.out.println("updateContextOptions ToolException for Project Context="+e.getMessage());
} catch (NullPointerException e) { // Do nothing here Or make it "finally" to ignore all parameters parsing here?
System.out.println("updateContextOptions NullPointerException for Project Context="+e.getMessage());
} finally {
System.out.println("updateContextOptions for Project Context - other error");
}
*/
}
//NullPointerException
OptionsCore
.
doLoadContextOptions
(
this
,
project
);
/*
try {
buildParams();
} catch (ToolException e) { // Do nothing here
System.out.println("updateContextOptions ToolException for Tool Context="+e.getMessage());
} catch (NullPointerException e) { // Do nothing here Or make it "finally" to ignore all parameters parsing here?
System.out.println("updateContextOptions NullPointerException for Tool Context="+e.getMessage());
} finally {
System.out.println("updateContextOptions for Tool Context - other error");
}
*/
}
...
...
@@ -321,10 +349,11 @@ public class Tool extends Context implements Cloneable, Inheritable {
* processing that inheritance is ignored
*/
// if(param != null) // Was before the change described above
/*
if ((param != null) &&(param.getID().equals("SimulationTopFile"))){ // Andrey
System.out.println("Initializing parameter SimulationTopFile, isChild="+param.getIsChild());
}
*/
if
((
param
!=
null
)
&&
!
param
.
getIsChild
())
return
param
;
...
...
src/com/elphel/vdt/core/tools/params/recognizers/SimpleGeneratorRecognizer.java
View file @
f88dd96e
...
...
@@ -30,9 +30,10 @@ public class SimpleGeneratorRecognizer implements Recognizer {
new
ProjectNameGenerator
(),
new
ProjectPathGenerator
(),
new
TopModuleNameGenerator
(),
new
SelectedFileGenerator
(),
new
CurrentFileGenerator
(),
// new ViewSelectedFil
eGenerator(),
new
C
urrentFileBase
Generator
()
new
CurrentFileBas
eGenerator
(),
new
C
hosenAction
Generator
()
};
public
SimpleGeneratorRecognizer
(){
...
...
src/com/elphel/vdt/core/tools/params/types/RunFor.java
View file @
f88dd96e
...
...
@@ -44,6 +44,7 @@ public class RunFor implements Cloneable{
public
String
getResource
(){
return
resource
;
}
public
boolean
getCheckExtension
(){
return
checkExtension
;
}
...
...
src/com/elphel/vdt/ui/variables/SelectedResourceManager.java
View file @
f88dd96e
...
...
@@ -21,10 +21,14 @@ import java.util.Stack;
import
com.elphel.vdt.VerilogUtils
;
import
org.eclipse.core.resources.IContainer
;
import
org.eclipse.core.resources.IFile
;
import
org.eclipse.core.resources.IProject
;
import
org.eclipse.core.resources.IResource
;
import
org.eclipse.core.resources.ResourcesPlugin
;
import
org.eclipse.core.runtime.IAdaptable
;
import
org.eclipse.core.runtime.IPath
;
import
org.eclipse.core.runtime.Path
;
import
org.eclipse.jface.text.ITextSelection
;
import
org.eclipse.jface.viewers.ISelection
;
import
org.eclipse.jface.viewers.IStructuredSelection
;
...
...
@@ -58,6 +62,10 @@ public class SelectedResourceManager implements IWindowListener, ISelectionListe
private
ITextSelection
fSelectedText
=
null
;
private
Stack
<
IWorkbenchWindow
>
fWindowStack
=
new
Stack
<
IWorkbenchWindow
>();
//Andrey
private
String
fChosenTarget
=
null
;
// full path of the chosen (for action) resource or any string. Used to calculate CurrentFile, verilog file, ...
private
IResource
fChosenVerilogFile
=
null
;
// to keep fSelectedVerilogFile
private
int
fChosenAction
=
0
;
// Chosen variant of running the tool
private
SelectedResourceManager
()
{
IWorkbench
workbench
=
PlatformUI
.
getWorkbench
();
...
...
@@ -204,6 +212,7 @@ public class SelectedResourceManager implements IWindowListener, ISelectionListe
* @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
*/
public
void
selectionChanged
(
IWorkbenchPart
part
,
ISelection
selection
)
{
// System.out.println("SelectedResourceManager.selectionChanged()");
IWorkbenchWindow
window
=
part
.
getSite
().
getWorkbenchWindow
();
if
(
fWindowStack
.
isEmpty
()
||
!
fWindowStack
.
peek
().
equals
(
window
))
{
// selection is not in the active window
...
...
@@ -212,15 +221,54 @@ public class SelectedResourceManager implements IWindowListener, ISelectionListe
IResource
selectedResource
=
getSelectedResource
(
part
,
selection
);
if
(
selectedResource
!=
null
)
{
fSelectedResource
=
selectedResource
;
if
((
selectedResource
.
getType
()==
IResource
.
FILE
)
&&
(
VerilogUtils
.
isHhdlFile
((
IFile
)
fSelectedResource
)))
// if (selectedResource.getName().endsWith(".v"))
// System.out.println("SelectedResourceManager.selectionChanged(): fSelectedResource changed to "+fSelectedResource.getName());
if
((
selectedResource
.
getType
()==
IResource
.
FILE
)
&&
(
VerilogUtils
.
isHhdlFile
((
IFile
)
fSelectedResource
))){
fSelectedVerilogFile
=
selectedResource
;
/* Maybe same will work for vhdl too? */
// System.out.println("SelectedResourceManager.selectionChanged(): fSelectedVerilogFile changed to "+fSelectedVerilogFile.getName());
}
}
if
(
selection
instanceof
ITextSelection
)
{
fSelectedText
=
(
ITextSelection
)
selection
;
}
}
// selectionChanged()
//TODO: Make them project-relative
public
String
tryRelativePath
(
String
path
){
if
(
path
==
null
)
return
null
;
if
(
getSelectedProject
()==
null
)
return
path
;
IProject
project
=
getSelectedProject
();
if
(
path
.
startsWith
(
project
.
getLocation
().
toString
()))
return
path
.
substring
(
project
.
getLocation
().
toString
().
length
()+
1
);
return
path
;
}
public
void
updateActionChoice
(
String
chosenTarget
,
int
choice
){
fChosenAction
=
choice
;
fChosenTarget
=
tryRelativePath
(
chosenTarget
);
IProject
project
=
getSelectedProject
();
if
(
project
==
null
)
return
;
IPath
path
=
new
Path
(
fChosenTarget
);
IFile
file
=
(
path
==
null
)?
null
:
project
.
getFile
(
path
);
if
((
file
!=
null
)
&&
(
VerilogUtils
.
isHhdlFile
(
file
)))
fChosenVerilogFile
=
file
;
else
if
(
fChosenVerilogFile
==
null
)
fChosenVerilogFile
=
fSelectedVerilogFile
;
}
public
String
getChosenTarget
()
{
return
fChosenTarget
;
}
public
IResource
getChosenVerilogFile
()
{
return
(
fChosenVerilogFile
!=
null
)?
fChosenVerilogFile:
fSelectedVerilogFile
;
}
public
int
getChosenAction
()
{
return
fChosenAction
;
}
/**
...
...
src/com/elphel/vdt/ui/variables/VerilogResolver.java
View file @
f88dd96e
...
...
@@ -88,7 +88,8 @@ public class VerilogResolver implements IDynamicVariableResolver {
* @throws CoreException if there is no selection
*/
protected
IResource
getSelectedResource
(
IDynamicVariable
variable
)
throws
CoreException
{
IResource
resource
=
SelectedResourceManager
.
getDefault
().
getSelectedVerilogFile
();
// IResource resource = SelectedResourceManager.getDefault().getSelectedVerilogFile();
IResource
resource
=
SelectedResourceManager
.
getDefault
().
getChosenVerilogFile
();
if
(
resource
==
null
)
{
abort
(
Txt
.
s
(
"Error.Variable.Verilog.NoSelection"
,
new
String
[]{
getReferenceExpression
(
variable
,
null
)}),
null
);
}
...
...
src/com/elphel/vdt/ui/views/DesignFlowView.java
View file @
f88dd96e
This diff is collapsed.
Click to expand it.
src/com/elphel/vdt/ui/views/DesignMenuModel.java
View file @
f88dd96e
...
...
@@ -81,6 +81,9 @@ public class DesignMenuModel {
public
boolean
isEnabled
(
IResource
resource
)
{
return
false
;
}
public
boolean
isEnabled
(
String
path
)
{
return
false
;
}
public
Object
getParent
()
{
return
parent
;
...
...
@@ -138,7 +141,6 @@ public class DesignMenuModel {
String
extensions
[]
=
tool
.
getExtensions
();
if
(
extensions
==
null
)
return
true
;
String
resourceExt
=
resource
.
getFileExtension
();
if
(
resourceExt
==
null
)
return
false
;
...
...
@@ -148,8 +150,25 @@ public class DesignMenuModel {
return
true
;
}
return
false
;
}
// isEnabled()
}
// isEnabled(IResource)
public
boolean
isEnabled
(
String
path
)
{
if
(
path
==
null
)
return
false
;
String
extensions
[]
=
tool
.
getExtensions
();
if
(
extensions
==
null
)
return
true
;
int
index
=
path
.
indexOf
(
"."
);
if
(
index
<
0
)
return
false
;
String
resourceExt
=
path
.
substring
(
index
+
1
);
for
(
int
i
=
0
;
i
<
extensions
.
length
;
i
++)
{
if
(
resourceExt
.
equalsIgnoreCase
(
extensions
[
i
]))
return
true
;
}
return
false
;
}
// isEnabled(String)
public
Tool
getTool
()
{
return
tool
;
}
...
...
tools/Verilog/IVerilog.xml
View file @
f88dd96e
...
...
@@ -55,28 +55,21 @@
<!-- Actually used -->
<syntax
name =
"JustValueSyntax"
format =
"%%ParamValue"
></syntax>
<syntax
name =
"TopModuleSyntax"
format =
"-s%%TopModule"
/>
<syntax
name =
"TopModulesOtherSyntax"
format =
"%(-s%%ParamValue%| %)"
/>
<syntax
name =
"ModuleLibrarySyntax"
format =
"%(-y%%ParamValue%| %)"
/>
<syntax
name =
"SourceListSyntax"
format =
"%(%%SourceList%| %)"
/>
<!-- Actually used -->
<syntax
name=
"JustValueSyntax"
format=
"%%ParamValue"
></syntax>
<syntax
name=
"TopModuleSyntax"
format=
"-s%%TopModule"
/>
<syntax
name=
"TopModulesOtherSyntax"
format=
"%(-s%%ParamValue%| %)"
/>
<syntax
name=
"ModuleLibrarySyntax"
format=
"%(-y%%ParamValue%| %)"
/>
<syntax
name=
"SourceListSyntax"
format=
"%(%%SourceList%| %)"
/>
<syntax
name=
"ExtraFilesSyntax"
format=
"%(%%ParamValue%| %)"
/>
<syntax
name=
"exeFileSyntax"
format=
"%%ParamValue"
/>
<syntax
name=
"SwitchSyntax"
format=
"-%%ParamName"
/>
<syntax
name =
"ExtraFilesSyntax"
format =
"%(%%ParamValue%| %)"
/>
<syntax
name =
"exeFileSyntax"
format =
"%%ParamValue"
/>
<syntax
name =
"SwitchSyntax"
format =
"-%%ParamName"
/>
<syntax
name=
"DbgCurrentFileSyntax"
format=
"echo "%%CurrentFile" ;"
/>
<syntax
name=
"DbgChosenActionIndexSyntax"
format=
"echo "index=%%ChosenActionIndex" ;"
/>
ChosenActionIndex
<!-- typedef -->
...
...
@@ -178,7 +171,7 @@
<action-menu>
<action
label=
"Simulate"
resource=
"%SimulationTopFile"
check-extension=
"false"
check-existence=
"true"
/>
<action
label=
"Simulate for"
resource=
"%%
CurrentFile"
check-extension
=
"true"
/>
<action
label=
"Simulate for"
resource=
"%%
SelectedFile"
check-extension=
"true"
check-existence
=
"true"
/>
<action
label=
"Empty"
resource=
""
/>
<action
label=
"Just try for"
resource=
"%%OS"
/>
</action-menu>
...
...
@@ -293,6 +286,25 @@
default =
"2>&1 | tee iverilog.log | grep --line-buffered -E 'error|warning' | grep --line-buffered -v "(null):0""
readonly =
"false"
visible =
"true"
/>
<parameter
id =
"DbgCurrentFile"
label =
"DbgCurrentFile"
type =
"StringType"
format =
"DbgCurrentFileSyntax"
default =
""
readonly =
"false"
visible =
"true"
/>
<parameter
id =
"ChosenActionIndex"
label =
"ChosenActionIndex"
type =
"StringType"
format =
"DbgChosenActionIndexSyntax"
default =
""
readonly =
"false"
visible =
"true"
/>
<!-- intentional error below - duplicate -->
<parameter
id =
"BuildDir"
label =
"project build directory"
...
...
@@ -325,7 +337,10 @@
<output>
<line
name=
"command_line"
sep=
" "
>
"%Param_Shell_Options"
"%DbgCurrentFile"
"%ChosenActionIndex"
"echo BuildDir=%BuildDir ;"
"echo CurrentFile=%%CurrentFile ;"
"echo SimulationTopFile=%SimulationTopFile ;"
"echo SimulationTopModule=%SimulationTopModule ;"
"%Param_PreExe"
...
...
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