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
b6bfc326
Commit
b6bfc326
authored
Jan 30, 2014
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
converted paths to project-relative when possible
parent
2e5900c7
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
95 additions
and
28 deletions
+95
-28
Parameter.java
src/com/elphel/vdt/core/tools/params/Parameter.java
+3
-3
ParamTypeString.java
...m/elphel/vdt/core/tools/params/types/ParamTypeString.java
+28
-0
FileListPromptDialog.java
src/com/elphel/vdt/ui/dialogs/FileListPromptDialog.java
+39
-16
ContextOptionsDialog.java
src/com/elphel/vdt/ui/options/ContextOptionsDialog.java
+5
-1
FileListComponent.java
...om/elphel/vdt/ui/options/component/FileListComponent.java
+17
-5
ListComponent.java
src/com/elphel/vdt/ui/options/component/ListComponent.java
+3
-3
No files found.
src/com/elphel/vdt/core/tools/params/Parameter.java
View file @
b6bfc326
...
@@ -433,9 +433,9 @@ public class Parameter implements Cloneable, Updateable {
...
@@ -433,9 +433,9 @@ public class Parameter implements Cloneable, Updateable {
if
(
defaultValue
==
null
)
{
if
(
defaultValue
==
null
)
{
defaultValue
=
param
.
defaultValue
;
defaultValue
=
param
.
defaultValue
;
if
(
id
.
equals
(
"SimulationTopFile"
)){
// Andrey
//
if (id.equals("SimulationTopFile")){ // Andrey
System
.
out
.
println
(
"Updating parameter SimulationTopFile, defaultValue="
+
defaultValue
);
//
System.out.println("Updating parameter SimulationTopFile, defaultValue="+defaultValue);
}
//
}
}
}
if
(
label
==
null
)
if
(
label
==
null
)
...
...
src/com/elphel/vdt/core/tools/params/types/ParamTypeString.java
View file @
b6bfc326
...
@@ -17,8 +17,13 @@
...
@@ -17,8 +17,13 @@
*******************************************************************************/
*******************************************************************************/
package
com
.
elphel
.
vdt
.
core
.
tools
.
params
.
types
;
package
com
.
elphel
.
vdt
.
core
.
tools
.
params
.
types
;
import
org.eclipse.core.resources.IProject
;
import
com.elphel.vdt.core.tools.config.ConfigException
;
import
com.elphel.vdt.core.tools.config.ConfigException
;
import
com.elphel.vdt.core.tools.params.ControlInterface
;
import
com.elphel.vdt.core.tools.params.ControlInterface
;
import
com.elphel.vdt.ui.variables.SelectedResourceManager
;
import
com.elphel.vdt.veditor.VerilogPlugin
;
import
com.elphel.vdt.veditor.preference.PreferenceStrings
;
public
class
ParamTypeString
extends
ParamType
{
public
class
ParamTypeString
extends
ParamType
{
...
@@ -137,7 +142,30 @@ public class ParamTypeString extends ParamType {
...
@@ -137,7 +142,30 @@ public class ParamTypeString extends ParamType {
}
}
}
}
public
String
tryProjectRelativePath
(
String
path
){
if
(
path
==
null
)
return
null
;
IProject
project
=
SelectedResourceManager
.
getDefault
().
getSelectedProject
();
if
(
project
==
null
)
return
path
;
String
projectPath
=
project
.
getLocation
().
toString
();
if
(
path
.
startsWith
(
projectPath
))
{
if
(
path
.
equals
(
projectPath
)){
System
.
out
.
println
(
"Path equals to project path = \""
+
path
+
"\", returning \".\""
);
return
"."
;
}
return
path
.
substring
(
projectPath
.
length
()+
1
);
}
return
path
;
}
public
String
canonicalizeValue
(
String
value
)
{
public
String
canonicalizeValue
(
String
value
)
{
// Try to convert file/dir parameters to project-relative
if
((
kind
==
KIND
.
FILE
)
||
(
kind
==
KIND
.
FILE
))
{
if
(
VerilogPlugin
.
getPreferenceBoolean
(
PreferenceStrings
.
DEBUG_OTHER
))
System
.
out
.
print
(
"Converting \""
+
value
+
"\"to "
);
value
=
tryProjectRelativePath
(
value
);
if
(
VerilogPlugin
.
getPreferenceBoolean
(
PreferenceStrings
.
DEBUG_OTHER
))
System
.
out
.
println
(
"\""
+
value
+
"\""
);
}
switch
(
caseSensitive
)
{
switch
(
caseSensitive
)
{
case
UPPERCASE:
case
UPPERCASE:
return
value
.
toUpperCase
();
return
value
.
toUpperCase
();
...
...
src/com/elphel/vdt/ui/dialogs/FileListPromptDialog.java
View file @
b6bfc326
...
@@ -17,9 +17,13 @@
...
@@ -17,9 +17,13 @@
*******************************************************************************/
*******************************************************************************/
package
com
.
elphel
.
vdt
.
ui
.
dialogs
;
package
com
.
elphel
.
vdt
.
ui
.
dialogs
;
import
org.eclipse.core.resources.IProject
;
import
org.eclipse.swt.widgets.FileDialog
;
import
org.eclipse.swt.widgets.FileDialog
;
import
org.eclipse.swt.widgets.Shell
;
import
org.eclipse.swt.widgets.Shell
;
import
com.elphel.vdt.ui.variables.SelectedResourceManager
;
/**
/**
* Dialog to promt list of files.
* Dialog to promt list of files.
*
*
...
@@ -27,15 +31,24 @@ import org.eclipse.swt.widgets.Shell;
...
@@ -27,15 +31,24 @@ import org.eclipse.swt.widgets.Shell;
* @author Lvov Konstantin
* @author Lvov Konstantin
*/
*/
public
class
FileListPromptDialog
extends
ListPromptDialog
{
public
class
FileListPromptDialog
extends
ListPromptDialog
{
/*
public FileListPromptDialog( final Shell parentShell, String title) {
public FileListPromptDialog( final Shell parentShell, String title) {
this
(
parentShell
,
title
,
null
);
this(parentShell, title, null
,null
);
}
}
public FileListPromptDialog( final Shell parentShell,
String title,
final String[] extensions
)
{
this(parentShell, title, extensions,null);
}
public
FileListPromptDialog
(
final
Shell
parentShell
*/
,
String
title
public
FileListPromptDialog
(
final
Shell
parentShell
,
,
final
String
[]
extensions
)
String
title
,
final
String
[]
extensions
,
final
String
projectPath
)
{
{
super
(
parentShell
super
(
parentShell
,
title
,
title
...
@@ -43,11 +56,21 @@ public class FileListPromptDialog extends ListPromptDialog {
...
@@ -43,11 +56,21 @@ public class FileListPromptDialog extends ListPromptDialog {
public
String
getNewValue
()
{
public
String
getNewValue
()
{
FileDialog
dialog
=
new
FileDialog
(
parentShell
);
FileDialog
dialog
=
new
FileDialog
(
parentShell
);
dialog
.
setFilterExtensions
(
extensions
);
dialog
.
setFilterExtensions
(
extensions
);
if
(
projectPath
!=
null
){
dialog
.
setFileName
(
projectPath
);
}
String
selectedFile
=
dialog
.
open
();
String
selectedFile
=
dialog
.
open
();
// try to convert to project-relative
if
((
selectedFile
!=
null
)
&&
selectedFile
.
startsWith
(
projectPath
))
{
if
(
selectedFile
.
equals
(
projectPath
)){
System
.
out
.
println
(
"FileListPromptDialog(): Path equals to project path = \""
+
selectedFile
+
"\", returning \".\""
);
return
"."
;
}
return
selectedFile
.
substring
(
projectPath
.
length
()+
1
);
}
return
selectedFile
;
return
selectedFile
;
}
}
}
}
);
);
}
}
}
// class FileListPromptDialog
}
// class FileListPromptDialog
src/com/elphel/vdt/ui/options/ContextOptionsDialog.java
View file @
b6bfc326
...
@@ -50,7 +50,11 @@ public class ContextOptionsDialog extends Dialog {
...
@@ -50,7 +50,11 @@ public class ContextOptionsDialog extends Dialog {
,
context
,
context
,
OptionsCore
.
getPreferenceStore
(
context
,
project
)
,
OptionsCore
.
getPreferenceStore
(
context
,
project
)
);
);
location
=
project
.
getLocation
().
toOSString
();
location
=
project
.
getLocation
().
toOSString
();
// project location
// System.out.println("ContextOptionsDialog: location was "+location);
// location = project.getProjectRelativePath().toOSString();
// System.out.println("ContextOptionsDialog: location changed to "+location);
}
}
public
ContextOptionsDialog
(
Shell
parent
,
Context
context
)
{
public
ContextOptionsDialog
(
Shell
parent
,
Context
context
)
{
...
...
src/com/elphel/vdt/ui/options/component/FileListComponent.java
View file @
b6bfc326
...
@@ -17,10 +17,13 @@
...
@@ -17,10 +17,13 @@
*******************************************************************************/
*******************************************************************************/
package
com
.
elphel
.
vdt
.
ui
.
options
.
component
;
package
com
.
elphel
.
vdt
.
ui
.
options
.
component
;
import
org.eclipse.core.resources.IProject
;
import
com.elphel.vdt.core.tools.params.Parameter
;
import
com.elphel.vdt.core.tools.params.Parameter
;
import
com.elphel.vdt.core.tools.params.types.ParamTypeString
;
import
com.elphel.vdt.core.tools.params.types.ParamTypeString
;
import
com.elphel.vdt.ui.dialogs.FileListPromptDialog
;
import
com.elphel.vdt.ui.dialogs.FileListPromptDialog
;
import
com.elphel.vdt.ui.dialogs.ListPromptDialog
;
import
com.elphel.vdt.ui.dialogs.ListPromptDialog
;
import
com.elphel.vdt.ui.variables.SelectedResourceManager
;
public
class
FileListComponent
extends
ListComponent
{
public
class
FileListComponent
extends
ListComponent
{
...
@@ -31,10 +34,19 @@ public class FileListComponent extends ListComponent {
...
@@ -31,10 +34,19 @@ public class FileListComponent extends ListComponent {
protected
ListPromptDialog
createDialog
()
{
protected
ListPromptDialog
createDialog
()
{
String
filemask
=
((
ParamTypeString
)
param
.
getType
()).
getFilemask
();
String
filemask
=
((
ParamTypeString
)
param
.
getType
()).
getFilemask
();
final
String
[]
extensions
=
(
filemask
!=
null
?
new
String
[]
{
filemask
}
:
null
);
final
String
[]
extensions
=
(
filemask
!=
null
?
new
String
[]
{
filemask
}
:
null
);
IProject
project
=
SelectedResourceManager
.
getDefault
().
getSelectedProject
();
String
projectPath
=
null
;
if
(
project
!=
null
)
{
projectPath
=
project
.
getLocation
().
toString
();
}
final
String
fProjectPath
=
projectPath
;
return
new
FileListPromptDialog
(
promptField
.
getVisibleNameField
().
getShell
()
,
"File list prompt"
return
new
FileListPromptDialog
(
promptField
.
getVisibleNameField
().
getShell
(),
,
extensions
);
"File list prompt"
,
extensions
,
fProjectPath
);
}
}
}
}
src/com/elphel/vdt/ui/options/component/ListComponent.java
View file @
b6bfc326
...
@@ -150,9 +150,9 @@ public abstract class ListComponent extends Component {
...
@@ -150,9 +150,9 @@ public abstract class ListComponent extends Component {
if
(
promptField
.
getPromptDialog
()
==
null
)
if
(
promptField
.
getPromptDialog
()
==
null
)
promptField
.
setPromptDialog
(
createDialog
());
promptField
.
setPromptDialog
(
createDialog
());
ListPromptDialog
dialog
=
promptField
.
getPromptDialog
();
ListPromptDialog
dialog
=
promptField
.
getPromptDialog
();
// clicked on edit list button
List
<
String
>
list
=
dialog
.
open
(
current
);
List
<
String
>
list
=
dialog
.
open
(
current
);
// opened list dialog, running
returnCode
=
dialog
.
getReturnCode
();
returnCode
=
dialog
.
getReturnCode
();
// canceled list
return
list
;
return
list
;
}
}
public
void
slectionChanged
()
{
public
void
slectionChanged
()
{
...
...
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