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
dbb68380
Commit
dbb68380
authored
Jan 21, 2014
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added icon support for tool launch actions
parent
f091be45
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
82 additions
and
10 deletions
+82
-10
XMLConfig.java
src/com/elphel/vdt/core/tools/config/xml/XMLConfig.java
+7
-2
Tool.java
src/com/elphel/vdt/core/tools/params/Tool.java
+32
-1
RunFor.java
src/com/elphel/vdt/core/tools/params/types/RunFor.java
+8
-2
ToolUI.java
src/com/elphel/vdt/ui/tools/ToolUI.java
+25
-1
DesignFlowView.java
src/com/elphel/vdt/ui/views/DesignFlowView.java
+8
-2
IVerilog.xml
tools/Verilog/IVerilog.xml
+2
-2
No files found.
src/com/elphel/vdt/core/tools/config/xml/XMLConfig.java
View file @
dbb68380
...
...
@@ -33,6 +33,7 @@ import com.elphel.vdt.core.tools.config.*;
import
com.elphel.vdt.core.tools.contexts.*
;
import
com.elphel.vdt.core.tools.menu.*
;
import
com.elphel.vdt.ui.MessageUI
;
import
com.elphel.vdt.ui.VDTPluginImages
;
import
com.elphel.vdt.veditor.VerilogPlugin
;
import
com.elphel.vdt.veditor.preference.PreferenceStrings
;
...
...
@@ -106,6 +107,8 @@ public class XMLConfig extends Config {
static
final
String
CONTEXT_TOOL_ACTION_RESOURCE
=
"resource"
;
static
final
String
CONTEXT_TOOL_ACTION_CHECK_EXTENSION
=
"check-extension"
;
static
final
String
CONTEXT_TOOL_ACTION_CHECK_EXISTENCE
=
"check-existence"
;
static
final
String
CONTEXT_TOOL_ACTION_ICON
=
"icon"
;
static
final
String
CONTEXT_TOOL_DFLT_ACTION_LABEL
=
"Run for"
;
static
final
String
CONTEXT_TOOL_DFLT_ACTION_RESOURCE
=
"%%CurrentFile"
;
...
...
@@ -976,7 +979,8 @@ public class XMLConfig extends Config {
CONTEXT_TOOL_DFLT_ACTION_LABEL
,
CONTEXT_TOOL_DFLT_ACTION_RESOURCE
,
getBoolAttrValue
(
CONTEXT_TOOL_DFLT_ACTION_CHECK_EXTENSION
),
getBoolAttrValue
(
CONTEXT_TOOL_DFLT_ACTION_CHECK_EXISTENCE
)));
getBoolAttrValue
(
CONTEXT_TOOL_DFLT_ACTION_CHECK_EXISTENCE
),
null
));
}
else
{
if
(
runForNodesList
.
size
()
>
1
)
...
...
@@ -995,6 +999,7 @@ public class XMLConfig extends Config {
String
label
=
getAttributeValue
(
node
,
CONTEXT_TOOL_ACTION_LABEL
);
if
(
label
==
null
)
label
=
CONTEXT_TOOL_DFLT_ACTION_LABEL
;
String
icon
=
getAttributeValue
(
node
,
CONTEXT_TOOL_ACTION_ICON
);
String
resource
=
getAttributeValue
(
node
,
CONTEXT_TOOL_ACTION_RESOURCE
);
if
((
resource
==
null
)
||
(
resource
.
length
()==
0
))
{
// resource= CONTEXT_TOOL_DFLT_ACTION_RESOURCE;
...
...
@@ -1013,7 +1018,7 @@ public class XMLConfig extends Config {
checkBoolAttr
(
checkExistenceAttr
,
CONTEXT_TOOL_ACTION_CHECK_EXISTENCE
);
checkExistence
=
getBoolAttrValue
(
checkExistenceAttr
);
}
runForList
.
add
(
new
RunFor
(
label
,
resource
,
checkExtension
,
checkExistence
));
runForList
.
add
(
new
RunFor
(
label
,
resource
,
checkExtension
,
checkExistence
,
icon
));
}
}
return
runForList
;
...
...
src/com/elphel/vdt/core/tools/params/Tool.java
View file @
dbb68380
...
...
@@ -22,6 +22,7 @@ import java.io.*;
import
org.eclipse.core.resources.IProject
;
import
com.elphel.vdt.VDT
;
import
com.elphel.vdt.core.options.OptionsCore
;
import
com.elphel.vdt.core.tools.*
;
import
com.elphel.vdt.core.tools.contexts.*
;
...
...
@@ -29,9 +30,13 @@ import com.elphel.vdt.core.tools.config.*;
import
com.elphel.vdt.core.tools.params.conditions.ConditionUtils
;
import
com.elphel.vdt.core.tools.params.recognizers.*
;
import
com.elphel.vdt.core.tools.params.types.RunFor
;
import
com.elphel.vdt.ui.VDTPluginImages
;
public
class
Tool
extends
Context
implements
Cloneable
,
Inheritable
{
private
static
final
String
ICON_ID_PREFIX
=
VDT
.
ID_VDT
+
".Tool.Image."
;
private
static
final
String
ICON_ID_ACTION
=
".action."
;
private
String
baseToolName
;
private
String
parentPackageName
;
private
String
parentProjectName
;
...
...
@@ -56,6 +61,8 @@ public class Tool extends Context implements Cloneable, Inheritable {
private
boolean
isShell
=
false
;
/* Tool is a shell, preserve first argument, merge all others */
private
String
projectPath
=
null
;
private
boolean
initialized
=
false
;
private
String
[]
imageKeysActions
=
null
;
public
Tool
(
String
name
,
String
controlInterfaceName
,
String
label
,
...
...
@@ -98,6 +105,29 @@ public class Tool extends Context implements Cloneable, Inheritable {
this
.
choice
=
0
;
}
public
void
initIcons
(
boolean
force
)
{
if
(!
force
&&
(
imageKeysActions
!=
null
))
return
;
if
(
runfor
!=
null
){
String
image
;
imageKeysActions
=
new
String
[
runfor
.
size
()];
for
(
int
i
=
0
;
i
<
imageKeysActions
.
length
;
i
++){
imageKeysActions
[
i
]=
null
;
image
=
runfor
.
get
(
i
).
getIconName
();
if
(
image
!=
null
)
{
imageKeysActions
[
i
]
=
ICON_ID_PREFIX
+
(
new
File
(
getExeName
())).
getName
()+
ICON_ID_ACTION
+
i
;
VDTPluginImages
.
addImage
(
image
,
imageKeysActions
[
i
],
null
/*tool.getLaunchType()*/
);
}
}
}
}
// ToolUI()
public
String
getImageKey
(
int
actionIndex
)
{
if
(
imageKeysActions
==
null
)
return
null
;
return
imageKeysActions
[
actionIndex
];
}
public
List
<
RunFor
>
getRunFor
(){
return
runfor
;
}
...
...
@@ -277,7 +307,8 @@ public class Tool extends Context implements Cloneable, Inheritable {
labels
.
get
(
0
),
resource
,
runfor
.
get
(
i
).
getCheckExtension
(),
runfor
.
get
(
i
).
getCheckExistence
());
runfor
.
get
(
i
).
getCheckExistence
(),
runfor
.
get
(
i
).
getIconName
());
}
return
actualActions
;
}
...
...
src/com/elphel/vdt/core/tools/params/types/RunFor.java
View file @
dbb68380
...
...
@@ -23,11 +23,13 @@ public class RunFor implements Cloneable{
public
String
resource
;
public
boolean
checkExtension
;
public
boolean
checkExistence
;
public
RunFor
(
String
label
,
String
resource
,
boolean
checkExtension
,
boolean
checkExistence
){
public
String
iconName
;
public
RunFor
(
String
label
,
String
resource
,
boolean
checkExtension
,
boolean
checkExistence
,
String
iconName
){
this
.
label
=
label
;
this
.
resource
=
resource
;
this
.
checkExtension
=
checkExtension
;
this
.
checkExistence
=
checkExistence
;
this
.
iconName
=
iconName
;
}
public
RunFor
(
RunFor
runFor
){
...
...
@@ -35,7 +37,8 @@ public class RunFor implements Cloneable{
runFor
.
label
,
runFor
.
resource
,
runFor
.
checkExtension
,
runFor
.
checkExistence
);
runFor
.
checkExistence
,
runFor
.
iconName
);
}
public
String
getLabel
(){
...
...
@@ -44,6 +47,9 @@ public class RunFor implements Cloneable{
public
String
getResource
(){
return
resource
;
}
public
String
getIconName
(){
return
iconName
;
}
public
boolean
getCheckExtension
(){
return
checkExtension
;
...
...
src/com/elphel/vdt/ui/tools/ToolUI.java
View file @
dbb68380
...
...
@@ -28,6 +28,7 @@ import org.eclipse.debug.ui.ILaunchConfigurationTab;
import
com.elphel.vdt.VDT
;
import
com.elphel.vdt.core.tools.config.Config
;
import
com.elphel.vdt.core.tools.params.Tool
;
import
com.elphel.vdt.core.tools.params.types.RunFor
;
import
com.elphel.vdt.ui.VDTPluginImages
;
/**
...
...
@@ -40,11 +41,12 @@ import com.elphel.vdt.ui.VDTPluginImages;
public
class
ToolUI
{
private
static
final
String
ICON_ID_PREFIX
=
VDT
.
ID_VDT
+
".Tool.Image."
;
// private static final String ICON_ID_ACTION = ".action.";
private
Tool
tool
;
private
Config
config
;
private
String
imageKey
=
null
;
// private String [] imageKeysActions = null;
public
ToolUI
(
Config
config
,
Tool
tool
)
{
this
.
tool
=
tool
;
this
.
config
=
config
;
...
...
@@ -53,6 +55,21 @@ public class ToolUI {
imageKey
=
ICON_ID_PREFIX
+
(
new
File
(
tool
.
getExeName
())).
getName
();
VDTPluginImages
.
addImage
(
image
,
imageKey
,
null
/*tool.getLaunchType()*/
);
}
/*
List<RunFor> runFor=tool.getRunFor();
if (runFor!=null){
imageKeysActions=new String [runFor.size()];
for (int i=0;i<imageKeysActions.length;i++){
imageKeysActions[i]=null;
image = runFor.get(i).getIconName();
if (image != null) {
imageKeysActions[i] = ICON_ID_PREFIX + (new File(tool.getExeName())).getName()+ICON_ID_ACTION+i;
VDTPluginImages.addImage(image, imageKeysActions[i], null);
}
}
}
*/
}
// ToolUI()
public
ILaunchConfigurationTab
[]
getLaunchConfigurationTabs
()
{
...
...
@@ -111,4 +128,11 @@ public class ToolUI {
public
String
getImageKey
()
{
return
imageKey
;
}
/*
public String getImageKey(int actionIndex) {
if (imageKeysActions==null) return null;
return imageKeysActions[actionIndex];
}
*/
}
// class ToolUI
src/com/elphel/vdt/ui/views/DesignFlowView.java
View file @
dbb68380
...
...
@@ -483,10 +483,12 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
// Selected item should be not null, but resource - may be
// RunFor[] getMenuActions()
RunFor
[]
runFor
=
null
;
Tool
tool
=
null
;
if
(
selectedItem
!=
null
){
Tool
tool
=
selectedItem
.
getTool
();
tool
=
selectedItem
.
getTool
();
if
(
tool
!=
null
){
runFor
=
tool
.
getMenuActions
(
project
);
tool
.
initIcons
(
false
);
// if not done before - add icons list for actions
if
(
VerilogPlugin
.
getPreferenceBoolean
(
PreferenceStrings
.
DEBUG_OTHER
))
{
System
.
out
.
println
(
"Got Runfor["
+((
runFor
!=
null
)?
runFor
.
length
:
"null"
)+
"]"
);
if
(
runFor
!=
null
){
...
...
@@ -559,7 +561,11 @@ public class DesignFlowView extends ViewPart implements ISelectionListener {
launchActions
[
i
].
setToolTipText
(
i
+
": "
+
runFor
[
i
].
getLabel
()+
" "
+
shortName
);
launchActions
[
i
].
setText
(
runFor
[
i
].
getLabel
()+
" "
+
shortName
);
launchActions
[
i
].
setEnabled
(
enabled
);
launchActions
[
i
].
setImageDescriptor
(
VDTPluginImages
.
DESC_RUN_TOOL
);
String
actionIconKey
=
tool
.
getImageKey
(
i
);
if
((
actionIconKey
!=
null
)
&&
(
VDTPluginImages
.
getImageDescriptor
(
actionIconKey
)!=
null
))
launchActions
[
i
].
setImageDescriptor
(
VDTPluginImages
.
getImageDescriptor
(
actionIconKey
));
else
launchActions
[
i
].
setImageDescriptor
(
VDTPluginImages
.
DESC_RUN_TOOL
);
}
IToolBarManager
toolbarManager
=
getViewSite
().
getActionBars
().
getToolBarManager
();
toolbarManager
.
removeAll
();
...
...
tools/Verilog/IVerilog.xml
View file @
dbb68380
...
...
@@ -175,9 +175,9 @@
</extensions-list>
<action-menu>
<action
label=
"Simulate"
resource=
"%SimulationTopFile"
check-extension=
"false"
check-existence=
"true"
/>
<action
label=
"Simulate"
resource=
"%SimulationTopFile"
check-extension=
"false"
check-existence=
"true"
icon=
"iverilog.ico"
/>
<action
label=
"Simulate for"
resource=
"%%SelectedFile"
check-extension=
"true"
check-existence=
"true"
/>
<action
label=
"Empty"
resource=
""
/>
<action
label=
"Empty"
resource=
""
icon=
"sample.gif"
/>
<action
label=
"Just try for"
resource=
"%%OS"
/>
</action-menu>
...
...
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