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
9adc4c4e
Commit
9adc4c4e
authored
Feb 03, 2014
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added possibility to insert horizontal separators to the configuration
dialogs, updated documentation
parent
35b57a4b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
17 deletions
+68
-17
XMLConfig.java
src/com/elphel/vdt/core/tools/config/xml/XMLConfig.java
+1
-0
Context.java
src/com/elphel/vdt/core/tools/contexts/Context.java
+5
-2
OptionsBlock.java
src/com/elphel/vdt/ui/options/OptionsBlock.java
+43
-4
Component.java
src/com/elphel/vdt/ui/options/component/Component.java
+13
-7
GeneralComponent.java
...com/elphel/vdt/ui/options/component/GeneralComponent.java
+6
-4
No files found.
src/com/elphel/vdt/core/tools/config/xml/XMLConfig.java
View file @
9adc4c4e
...
@@ -65,6 +65,7 @@ public class XMLConfig extends Config {
...
@@ -65,6 +65,7 @@ public class XMLConfig extends Config {
static
final
String
PARAMGROUP_NAME_ATTR
=
"name"
;
static
final
String
PARAMGROUP_NAME_ATTR
=
"name"
;
static
final
String
PARAMGROUP_LABEL_ATTR
=
"label"
;
static
final
String
PARAMGROUP_LABEL_ATTR
=
"label"
;
static
final
String
PARAMGROUP_VISIBLE_ATTR
=
"visible"
;
static
final
String
PARAMGROUP_VISIBLE_ATTR
=
"visible"
;
public
static
final
String
PARAMGROUP_SEPARATOR
=
"---"
;
static
final
String
PARAMETER_TAG
=
"parameter"
;
static
final
String
PARAMETER_TAG
=
"parameter"
;
...
...
src/com/elphel/vdt/core/tools/contexts/Context.java
View file @
9adc4c4e
...
@@ -28,6 +28,7 @@ import java.util.List;
...
@@ -28,6 +28,7 @@ import java.util.List;
import
com.elphel.vdt.core.tools.config.Config
;
import
com.elphel.vdt.core.tools.config.Config
;
import
com.elphel.vdt.core.tools.config.ConfigException
;
import
com.elphel.vdt.core.tools.config.ConfigException
;
import
com.elphel.vdt.core.tools.config.xml.XMLConfig
;
import
com.elphel.vdt.core.tools.params.*
;
import
com.elphel.vdt.core.tools.params.*
;
import
com.elphel.vdt.core.tools.params.recognizers.*
;
import
com.elphel.vdt.core.tools.params.recognizers.*
;
import
com.elphel.vdt.core.tools.params.types.ParamTypeString
;
import
com.elphel.vdt.core.tools.params.types.ParamTypeString
;
...
@@ -224,14 +225,14 @@ public abstract class Context {
...
@@ -224,14 +225,14 @@ public abstract class Context {
timeout
=
Integer
.
parseInt
(
sTimeout
);
timeout
=
Integer
.
parseInt
(
sTimeout
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
}
}
prompt
=
c
ommandLinesBlock
.
parseCntrl
(
prompt
);
// replace control character codes (\n,\t,\x)
prompt
=
C
ommandLinesBlock
.
parseCntrl
(
prompt
);
// replace control character codes (\n,\t,\x)
prompt
=
commandLinesBlock
.
applyMark
(
prompt
);
// remove mark sequence
prompt
=
commandLinesBlock
.
applyMark
(
prompt
);
// remove mark sequence
String
interrupt
=
commandLinesBlock
.
getInterrupt
();
String
interrupt
=
commandLinesBlock
.
getInterrupt
();
List
<
String
>
lines
=
commandLinesBlock
.
getLines
();
// [%Param_Shell_Options, echo BuildDir=%BuildDir ;, echo SimulationTopFile=%SimulationTopFile ;, echo SimulationTopModule=%SimulationTopModule ;, echo BuildDir=%BuildDir;, %Param_PreExe, %Param_Exe, %Param_TopModule, %TopModulesOther, %ModuleLibrary, %LegacyModel, %NoSpecify, %v, %SourceList, %ExtraFiles, %Filter_String]
List
<
String
>
lines
=
commandLinesBlock
.
getLines
();
// [%Param_Shell_Options, echo BuildDir=%BuildDir ;, echo SimulationTopFile=%SimulationTopFile ;, echo SimulationTopModule=%SimulationTopModule ;, echo BuildDir=%BuildDir;, %Param_PreExe, %Param_Exe, %Param_TopModule, %TopModulesOther, %ModuleLibrary, %LegacyModel, %NoSpecify, %v, %SourceList, %ExtraFiles, %Filter_String]
if
((
lines
.
size
()==
0
)
&&
commandLinesBlock
.
hadStrings
()){
if
((
lines
.
size
()==
0
)
&&
commandLinesBlock
.
hadStrings
()){
if
(
VerilogPlugin
.
getPreferenceBoolean
(
PreferenceStrings
.
DEBUG_LAUNCHING
))
if
(
VerilogPlugin
.
getPreferenceBoolean
(
PreferenceStrings
.
DEBUG_LAUNCHING
))
System
.
out
.
println
(
"Removing command lines block by false condition"
);
System
.
out
.
println
(
"Removing command lines block by false condition"
);
continue
;
// to enable conditionals for the command line blocks, still making possible to use emty blocks for no-arguments programs
continue
;
// to enable conditionals for the command line blocks, still making possible to use em
p
ty blocks for no-arguments programs
}
}
List
<
List
<
String
>>
commandSequence
=
new
ArrayList
<
List
<
String
>>();
List
<
List
<
String
>>
commandSequence
=
new
ArrayList
<
List
<
String
>>();
for
(
Iterator
<
String
>
lineIter
=
lines
.
iterator
();
lineIter
.
hasNext
();)
{
for
(
Iterator
<
String
>
lineIter
=
lines
.
iterator
();
lineIter
.
hasNext
();)
{
...
@@ -386,6 +387,8 @@ public abstract class Context {
...
@@ -386,6 +387,8 @@ public abstract class Context {
continue
;
continue
;
for
(
String
id
:
paramIDs
)
{
for
(
String
id
:
paramIDs
)
{
if
(
id
.
equals
(
XMLConfig
.
PARAMGROUP_SEPARATOR
))
// Will try to add separator to the dialog
continue
;
if
(
findParam
(
id
)
==
null
)
if
(
findParam
(
id
)
==
null
)
throw
new
ConfigException
(
"Parameter '"
+
id
+
throw
new
ConfigException
(
"Parameter '"
+
id
+
"' in context '"
+
name
+
"' in context '"
+
name
+
...
...
src/com/elphel/vdt/ui/options/OptionsBlock.java
View file @
9adc4c4e
...
@@ -33,6 +33,7 @@ import org.eclipse.swt.widgets.Group;
...
@@ -33,6 +33,7 @@ import org.eclipse.swt.widgets.Group;
import
org.eclipse.swt.widgets.TabFolder
;
import
org.eclipse.swt.widgets.TabFolder
;
import
org.eclipse.swt.widgets.TabItem
;
import
org.eclipse.swt.widgets.TabItem
;
import
com.elphel.vdt.core.tools.config.xml.XMLConfig
;
import
com.elphel.vdt.core.tools.contexts.Context
;
import
com.elphel.vdt.core.tools.contexts.Context
;
import
com.elphel.vdt.core.tools.params.ParamGroup
;
import
com.elphel.vdt.core.tools.params.ParamGroup
;
import
com.elphel.vdt.core.tools.params.Parameter
;
import
com.elphel.vdt.core.tools.params.Parameter
;
...
@@ -48,6 +49,7 @@ import com.elphel.vdt.ui.options.component.DirComponent;
...
@@ -48,6 +49,7 @@ import com.elphel.vdt.ui.options.component.DirComponent;
import
com.elphel.vdt.ui.options.component.DirListComponent
;
import
com.elphel.vdt.ui.options.component.DirListComponent
;
import
com.elphel.vdt.ui.options.component.FileComponent
;
import
com.elphel.vdt.ui.options.component.FileComponent
;
import
com.elphel.vdt.ui.options.component.FileListComponent
;
import
com.elphel.vdt.ui.options.component.FileListComponent
;
import
com.elphel.vdt.ui.options.component.LabelComponent
;
import
com.elphel.vdt.ui.options.component.NumberComponent
;
import
com.elphel.vdt.ui.options.component.NumberComponent
;
import
com.elphel.vdt.ui.options.component.StringListComponent
;
import
com.elphel.vdt.ui.options.component.StringListComponent
;
import
com.elphel.vdt.ui.options.component.TextComponent
;
import
com.elphel.vdt.ui.options.component.TextComponent
;
...
@@ -96,7 +98,8 @@ public class OptionsBlock {
...
@@ -96,7 +98,8 @@ public class OptionsBlock {
ParamGroup
paramGroups
[]
=
getParamGroups
();
ParamGroup
paramGroups
[]
=
getParamGroups
();
tabComposites
=
new
Composite
[
paramGroups
.
length
];
tabComposites
=
new
Composite
[
paramGroups
.
length
];
scrolledComposite
=
new
ScrolledComposite
[
paramGroups
.
length
];
scrolledComposite
=
new
ScrolledComposite
[
paramGroups
.
length
];
if
(
paramGroups
.
length
==
0
)
return
;
if
(
paramGroups
.
length
>
1
)
if
(
paramGroups
.
length
>
1
)
createTabFolder
(
parent
,
paramGroups
);
createTabFolder
(
parent
,
paramGroups
);
else
else
...
@@ -172,11 +175,21 @@ public class OptionsBlock {
...
@@ -172,11 +175,21 @@ public class OptionsBlock {
}
// createTabFolders()
}
// createTabFolders()
protected
Component
createComponent
(
Parameter
param
)
{
protected
Component
createComponent
(
Parameter
param
)
{
Component
component
=
null
;
ParamType
paramType
=
(
param
==
null
)?
null
:
param
.
getType
();
if
(
param
==
null
)
{
component
=
new
LabelComponent
(
param
);
}
else
if
(
paramType
instanceof
ParamTypeNumber
)
{
component
=
new
NumberComponent
(
param
);
/*
Component component = null;
Component component = null;
ParamType paramType = param.getType();
ParamType paramType = param.getType();
if (paramType instanceof ParamTypeNumber) {
if (paramType instanceof ParamTypeNumber) {
component
=
new
NumberComponent
(
param
);
component = new NumberComponent(param);
*/
}
else
if
(
paramType
instanceof
ParamTypeBool
)
{
}
else
if
(
paramType
instanceof
ParamTypeBool
)
{
component
=
new
BoolComponent
(
param
);
component
=
new
BoolComponent
(
param
);
}
else
if
(
paramType
instanceof
ParamTypeString
)
{
}
else
if
(
paramType
instanceof
ParamTypeString
)
{
...
@@ -194,8 +207,9 @@ public class OptionsBlock {
...
@@ -194,8 +207,9 @@ public class OptionsBlock {
}
else
{
}
else
{
System
.
out
.
println
(
"Param type "
+
param
.
getType
().
getName
()
+
" unknown (not implemented?)"
);
System
.
out
.
println
(
"Param type "
+
param
.
getType
().
getName
()
+
" unknown (not implemented?)"
);
}
}
if
(
param
!=
null
)
{
// Andrey
components
.
put
(
param
,
component
);
components
.
put
(
param
,
component
);
}
return
component
;
return
component
;
}
// createComponent()
}
// createComponent()
...
@@ -213,6 +227,30 @@ public class OptionsBlock {
...
@@ -213,6 +227,30 @@ public class OptionsBlock {
ParamGroup
paramGroup
=
paramGroups
[
i
];
ParamGroup
paramGroup
=
paramGroups
[
i
];
for
(
Iterator
<
String
>
pi
=
paramGroup
.
getParams
().
iterator
();
pi
.
hasNext
();)
{
for
(
Iterator
<
String
>
pi
=
paramGroup
.
getParams
().
iterator
();
pi
.
hasNext
();)
{
String
paramID
=
(
String
)
pi
.
next
();
Component
component
;
if
(
paramID
.
equals
(
XMLConfig
.
PARAMGROUP_SEPARATOR
)){
component
=
createComponent
(
null
);
// will create horizontal separator?
component
.
createControl
(
tabComposites
[
i
]);
continue
;
}
else
{
//
Parameter
param
=
context
.
findParam
(
paramID
);
if
(!
param
.
isVisible
())
continue
;
component
=
components
.
get
(
param
);
if
(
component
==
null
)
component
=
createComponent
(
param
);
if
(
component
==
null
)
continue
;
}
activeComponents
.
add
(
component
);
// component.setPreferenceStore(store);
component
.
createControl
(
tabComposites
[
i
]);
component
.
setChangeListener
(
changeListener
);
/*
String paramID = (String)pi.next();
String paramID = (String)pi.next();
Parameter param = context.findParam(paramID);
Parameter param = context.findParam(paramID);
...
@@ -229,6 +267,7 @@ public class OptionsBlock {
...
@@ -229,6 +267,7 @@ public class OptionsBlock {
// component.setPreferenceStore(store);
// component.setPreferenceStore(store);
component.createControl(tabComposites[i]);
component.createControl(tabComposites[i]);
component.setChangeListener(changeListener);
component.setChangeListener(changeListener);
*/
}
}
}
}
}
// addProperties()
}
// addProperties()
...
...
src/com/elphel/vdt/ui/options/component/Component.java
View file @
9adc4c4e
...
@@ -76,8 +76,10 @@ public abstract class Component {
...
@@ -76,8 +76,10 @@ public abstract class Component {
// System.out.println("-- Component.createControl: id= "+param.getID()+"; label= "+param.getLabel());
// System.out.println("-- Component.createControl: id= "+param.getID()+"; label= "+param.getLabel());
this
.
parent
=
parent
;
this
.
parent
=
parent
;
activated
=
false
;
activated
=
false
;
labelField
=
createLabel
(
parent
,
param
.
getLabel
());
if
(
param
!=
null
)
{
// Andrey - to add labels
labelField
.
setMenu
(
createPopupMenu
(
labelField
.
getShell
()));
labelField
=
createLabel
(
parent
,
param
.
getLabel
());
labelField
.
setMenu
(
createPopupMenu
(
labelField
.
getShell
()));
}
}
}
protected
void
endCreateControl
()
{
protected
void
endCreateControl
()
{
...
@@ -134,27 +136,31 @@ public abstract class Component {
...
@@ -134,27 +136,31 @@ public abstract class Component {
}
}
public
boolean
isEnable
()
{
public
boolean
isEnable
()
{
if
(
param
==
null
)
return
true
;
// label
return
!
param
.
isReadOnly
();
return
!
param
.
isReadOnly
();
}
}
public
void
setVisible
(
boolean
visible
)
{
public
void
setVisible
(
boolean
visible
)
{
labelField
.
setVisible
(
visible
);
if
(
labelField
!=
null
)
labelField
.
setVisible
(
visible
);
}
}
public
void
setEnabled
(
boolean
enabled
)
{
public
void
setEnabled
(
boolean
enabled
)
{
labelField
.
setEnabled
(
enabled
);
if
(
labelField
!=
null
)
labelField
.
setEnabled
(
enabled
);
}
}
protected
void
setDefault
(
boolean
defaulted
)
{
protected
void
setDefault
(
boolean
defaulted
)
{
// System.out.println("-- Component.setDefault: id= "+param.getID()+"; label= "+param.getLabel());
// System.out.println("-- Component.setDefault: id= "+param.getID()+"; label= "+param.getLabel());
isDefault
=
defaulted
;
isDefault
=
defaulted
;
labelField
.
setForeground
(
defaulted
?
colorForegroundDefault
if
(
labelField
!=
null
)
:
colorForeground
);
labelField
.
setForeground
(
defaulted
?
colorForegroundDefault
:
colorForeground
);
}
}
protected
void
selectionChanged
()
{
protected
void
selectionChanged
()
{
// System.out.println("-- Component.selectionChanged: id= "+param.getID()+"; label= "+param.getLabel());
// System.out.println("-- Component.selectionChanged: id= "+param.getID()+"; label= "+param.getLabel());
if
(
!
param
.
hasDependentParameters
(
))
if
(
(
param
==
null
)
||
(!
param
.
hasDependentParameters
()
))
return
;
return
;
if
(
changeNotifier
==
null
)
if
(
changeNotifier
==
null
)
...
...
src/com/elphel/vdt/ui/options/component/GeneralComponent.java
View file @
9adc4c4e
...
@@ -35,10 +35,12 @@ public abstract class GeneralComponent extends Component {
...
@@ -35,10 +35,12 @@ public abstract class GeneralComponent extends Component {
protected
Menu
popupMenu
;
protected
Menu
popupMenu
;
GeneralComponent
(
Parameter
param
)
{
GeneralComponent
(
Parameter
param
)
{
super
(
param
);
super
(
param
);
option
=
new
ParamBasedOption
(
param
);
if
(
param
!=
null
)
{
//Andrey
isDefault
=
option
.
isStoredDefault
();
option
=
new
ParamBasedOption
(
param
);
modifyListener
=
createModifyListener
();
isDefault
=
option
.
isStoredDefault
();
modifyListener
=
createModifyListener
();
}
}
}
protected
void
endCreateControl
()
{
protected
void
endCreateControl
()
{
...
...
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