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
c5781ccb
Commit
c5781ccb
authored
Jan 27, 2014
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Writing tool commands to console connected to external program
parent
a36916c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
16 deletions
+56
-16
VDTRunner.java
src/com/elphel/vdt/core/launching/VDTRunner.java
+56
-16
No files found.
src/com/elphel/vdt/core/launching/VDTRunner.java
View file @
c5781ccb
...
@@ -19,6 +19,7 @@ package com.elphel.vdt.core.launching;
...
@@ -19,6 +19,7 @@ package com.elphel.vdt.core.launching;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.text.DateFormat
;
import
java.text.DateFormat
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -26,19 +27,7 @@ import java.util.HashMap;
...
@@ -26,19 +27,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
org.eclipse.debug.internal.ui.views.console.ProcessConsole
;
//import org.eclipse.core.resources.IProject;
//import org.eclipse.core.resources.IProject;
//import org.eclipse.core.resources.ResourcesPlugin;
//import org.eclipse.core.resources.ResourcesPlugin;
import
org.eclipse.core.runtime.CoreException
;
import
org.eclipse.core.runtime.CoreException
;
...
@@ -58,6 +47,7 @@ import org.eclipse.debug.core.model.IProcess;
...
@@ -58,6 +47,7 @@ import org.eclipse.debug.core.model.IProcess;
//import org.eclipse.ui.console.IPatternMatchListener;
//import org.eclipse.ui.console.IPatternMatchListener;
//import org.eclipse.ui.console.MessageConsole;
//import org.eclipse.ui.console.MessageConsole;
import
org.eclipse.debug.core.model.IStreamsProxy
;
import
org.eclipse.debug.ui.DebugUITools
;
import
org.eclipse.debug.ui.DebugUITools
;
import
org.eclipse.jface.util.IPropertyChangeListener
;
import
org.eclipse.jface.util.IPropertyChangeListener
;
import
org.eclipse.jface.util.PropertyChangeEvent
;
import
org.eclipse.jface.util.PropertyChangeEvent
;
...
@@ -66,6 +56,8 @@ import org.eclipse.ui.console.IConsole;
...
@@ -66,6 +56,8 @@ import org.eclipse.ui.console.IConsole;
import
org.eclipse.ui.console.ConsolePlugin
;
import
org.eclipse.ui.console.ConsolePlugin
;
import
org.eclipse.ui.console.IConsoleManager
;
import
org.eclipse.ui.console.IConsoleManager
;
import
org.eclipse.ui.console.IOConsole
;
import
org.eclipse.ui.console.IOConsole
;
import
org.eclipse.ui.console.IOConsoleInputStream
;
import
org.eclipse.ui.console.IOConsoleOutputStream
;
import
com.elphel.vdt.Txt
;
import
com.elphel.vdt.Txt
;
import
com.elphel.vdt.core.tools.contexts.BuildParamsItem
;
import
com.elphel.vdt.core.tools.contexts.BuildParamsItem
;
...
@@ -81,6 +73,10 @@ import com.elphel.vdt.veditor.preference.PreferenceStrings;
...
@@ -81,6 +73,10 @@ import com.elphel.vdt.veditor.preference.PreferenceStrings;
//import com.elphel.vdt.core.Utils;
//import com.elphel.vdt.core.Utils;
import
org.eclipse.ui.console.IConsoleListener
;
import
org.eclipse.ui.console.IConsoleListener
;
...
@@ -164,11 +160,11 @@ public class VDTRunner {
...
@@ -164,11 +160,11 @@ public class VDTRunner {
toolArguments
.
addAll
(
arguments
);
toolArguments
.
addAll
(
arguments
);
// if (resources != null)
// if (resources != null)
// toolArguments.addAll(resources);
// toolArguments.addAll(resources);
runConfig
.
setToolArguments
((
String
[])
toolArguments
.
toArray
(
new
String
[
toolArguments
.
size
()]));
if
(
argumentsItemsArray
[
numItem
].
getConsoleName
()!=
null
){
if
(
argumentsItemsArray
[
numItem
].
getConsoleName
()!=
null
){
System
.
out
.
println
(
"VDTLaunchConfigurationDelegate.doLaunch: console commands not yet implemented for runner #"
+
numItem
);
runConsole
(
argumentsItemsArray
[
numItem
].
getConsoleName
(),
runConfig
,
launch
,
monitor
);
continue
;
continue
;
}
}
runConfig
.
setToolArguments
((
String
[])
toolArguments
.
toArray
(
new
String
[
toolArguments
.
size
()]));
// Launch the configuration - 1 unit of work
// Launch the configuration - 1 unit of work
// VDTRunner runner = VDTLaunchUtil.getRunner();
// VDTRunner runner = VDTLaunchUtil.getRunner();
...
@@ -180,7 +176,7 @@ public class VDTRunner {
...
@@ -180,7 +176,7 @@ public class VDTRunner {
// check for cancellation
// check for cancellation
if
(
monitor
.
isCanceled
()
||
(
process
==
null
))
{
if
(
monitor
.
isCanceled
()
||
(
process
==
null
))
{
removeConfiguration
(
consoleName
);
removeConfiguration
(
consoleName
);
return
;
return
;
}
}
if
(
numItem
<(
argumentsItemsArray
.
length
-
1
)){
// Not for the last
if
(
numItem
<(
argumentsItemsArray
.
length
-
1
)){
// Not for the last
...
@@ -232,6 +228,50 @@ public class VDTRunner {
...
@@ -232,6 +228,50 @@ public class VDTRunner {
}
}
monitor
.
done
();
monitor
.
done
();
}
}
public
IOConsole
runConsole
(
String
consolePrefix
,
VDTRunnerConfiguration
configuration
,
ILaunch
launch
,
IProgressMonitor
monitor
)
throws
CoreException
{
//TODO: Handle monitor
System
.
out
.
println
(
"VDTLaunchConfigurationDelegate.doLaunch: console ("
+
consolePrefix
+
") commands not yet implemented"
);
// Find console with name starting with consolePrefix
IConsoleManager
man
=
ConsolePlugin
.
getDefault
().
getConsoleManager
();
// debugging
IConsole
[]
consoles
=(
IConsole
[])
man
.
getConsoles
();
IOConsole
iCons
=
null
;
for
(
int
i
=
0
;
i
<
consoles
.
length
;
i
++){
if
(
consoles
[
i
].
getName
().
startsWith
(
consolePrefix
)){
iCons
=(
IOConsole
)
consoles
[
i
];
break
;
}
}
if
(
iCons
==
null
)
{
MessageUI
.
error
(
"Specified console: "
+
consolePrefix
+
" is not found"
);
return
null
;
}
// try to send
String
[]
arguments
=
configuration
.
getToolArguments
();
if
(
arguments
==
null
)
arguments
=
new
String
[
0
];
// IOConsoleInputStream inStream= iCons.getInputStream();
IOConsoleOutputStream
outStream
=
iCons
.
newOutputStream
();
IProcess
process
=((
ProcessConsole
)
iCons
).
getProcess
();
IStreamsProxy
iStreamProxy
=
process
.
getStreamsProxy
();
try
{
for
(
int
i
=
0
;
i
<
arguments
.
length
;
i
++){
// outStream.write(arguments[i]); // writes to console itself
iStreamProxy
.
write
(
arguments
[
i
]+
"\n"
);
}
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"Can not write to outStream of console "
+
iCons
.
getName
());
}
return
iCons
;
}
/* process.getStreamsProxy().getOutputStreamMonitor().addListener(new IStreamListener(){
/* process.getStreamsProxy().getOutputStreamMonitor().addListener(new IStreamListener(){
public void streamAppended (String text, IStreamMonitor monitor){
public void streamAppended (String text, IStreamMonitor monitor){
...
...
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