本文整理匯總了Java中org.eclipse.debug.core.model.IProcess.setAttribute方法的典型用法代碼示例。如果您正苦於以下問題:Java IProcess.setAttribute方法的具體用法?Java IProcess.setAttribute怎麽用?Java IProcess.setAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.debug.core.model.IProcess
的用法示例。
在下文中一共展示了IProcess.setAttribute方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: startDerbyServer
import org.eclipse.debug.core.model.IProcess; //導入方法依賴的package包/類
public void startDerbyServer( IProject proj) throws CoreException {
String args = CommonNames.START_DERBY_SERVER;
String vmargs="";
DerbyProperties dprop=new DerbyProperties(proj);
//Starts the server as a Java app
args+=" -h "+dprop.getHost()+ " -p "+dprop.getPort();
//Set Derby System Home from the Derby Properties
if((dprop.getSystemHome()!=null)&& !(dprop.getSystemHome().equals(""))){
vmargs=CommonNames.D_SYSTEM_HOME+dprop.getSystemHome();
}
String procName="["+proj.getName()+"] - "+CommonNames.DERBY_SERVER+" "+CommonNames.START_DERBY_SERVER+" ("+dprop.getHost()+ ", "+dprop.getPort()+")";
ILaunch launch = DerbyUtils.launch(proj, procName ,
CommonNames.DERBY_SERVER_CLASS, args, vmargs, CommonNames.START_DERBY_SERVER);
IProcess ip=launch.getProcesses()[0];
//set a name to be seen in the Console list
ip.setAttribute(IProcess.ATTR_PROCESS_LABEL,procName);
// saves the mapping between (server) process and project
//servers.put(launch.getProcesses()[0], proj);
servers.put(ip, proj);
// register a listener to listen, when this process is finished
DebugPlugin.getDefault().addDebugEventListener(listener);
//Add resource listener
IWorkspace workspace = ResourcesPlugin.getWorkspace();
workspace.addResourceChangeListener(rlistener);
setRunning(proj, Boolean.TRUE);
Shell shell = new Shell();
MessageDialog.openInformation(
shell,
CommonNames.PLUGIN_NAME,
Messages.D_NS_ATTEMPT_STARTED+dprop.getPort()+".");
}
示例2: stopDerbyServer
import org.eclipse.debug.core.model.IProcess; //導入方法依賴的package包/類
public void stopDerbyServer( IProject proj) throws CoreException, ClassNotFoundException, SQLException {
String args = CommonNames.SHUTDOWN_DERBY_SERVER;
String vmargs="";
DerbyProperties dprop=new DerbyProperties(proj);
args+=" -h "+dprop.getHost()+ " -p "+dprop.getPort();
// Set Derby System Home from the Derby Properties
if((dprop.getSystemHome()!=null)&& !(dprop.getSystemHome().equals(""))){
vmargs=CommonNames.D_SYSTEM_HOME+dprop.getSystemHome();
}
String procName="["+proj.getName()+"] - "+CommonNames.DERBY_SERVER+" "+CommonNames.SHUTDOWN_DERBY_SERVER+" ("+dprop.getHost()+ ", "+dprop.getPort()+")";
// starts the server as a Java app
ILaunch launch = DerbyUtils.launch(proj, procName,
CommonNames.DERBY_SERVER_CLASS, args, vmargs,CommonNames.SHUTDOWN_DERBY_SERVER);
IProcess ip=launch.getProcesses()[0];
//set a name to be seen in the Console list
ip.setAttribute(IProcess.ATTR_PROCESS_LABEL,procName);
//update the objectState
setRunning(proj, Boolean.FALSE);
if(proj.isOpen()){
Shell shell = new Shell();
MessageDialog.openInformation(
shell,
CommonNames.PLUGIN_NAME,
Messages.D_NS_ATTEMPT_STOPPED+dprop.getPort()+"." );
}
}
示例3: runIJ
import org.eclipse.debug.core.model.IProcess; //導入方法依賴的package包/類
public static void runIJ(IFile currentScript, IProject currentProject) throws CoreException {
String launchType="";
String args="";
//the above some times throws wrong 'create=true|false' errors
String vmargs="";
DerbyProperties dprop=new DerbyProperties(currentProject);
if((dprop.getSystemHome()!=null)&& !(dprop.getSystemHome().equals(""))){
vmargs+=CommonNames.D_SYSTEM_HOME+dprop.getSystemHome();
}
if(currentScript!=null){
launchType=CommonNames.SQL_SCRIPT;
//Preferable to use the full String with quotes to take care of spaces
//in file names
args="\""+currentScript.getLocation().toOSString()+"\"";
}else{
launchType=CommonNames.IJ;
args="";
}
ILaunch launch=launch(currentProject,launchType,CommonNames.IJ_CLASS,args, vmargs, CommonNames.IJ);
IProcess ip=launch.getProcesses()[0];
String procName="["+currentProject.getName()+"] - "+CommonNames.IJ+" "+args;
ip.setAttribute(IProcess.ATTR_PROCESS_LABEL,procName);
}
示例4: runSysInfo
import org.eclipse.debug.core.model.IProcess; //導入方法依賴的package包/類
public static void runSysInfo(IProject currentProject) throws CoreException {
String args="";
ILaunch launch=launch(currentProject,CommonNames.SYSINFO,CommonNames.SYSINFO_CLASS,args, null, CommonNames.SYSINFO);
IProcess ip=launch.getProcesses()[0];
String procName="["+currentProject.getName()+"] - "+CommonNames.SYSINFO;
ip.setAttribute(IProcess.ATTR_PROCESS_LABEL,procName);
}
示例5: newEclipseProcessWithLabelUpdater
import org.eclipse.debug.core.model.IProcess; //導入方法依賴的package包/類
public IProcess newEclipseProcessWithLabelUpdater(ILaunch launch, Indexable<String> cmdLine, Process sp)
throws CoreException {
final String cmdLineLabel = renderCommandLineLabel(cmdLine);
final String processLabel = renderProcessLabel();
IProcess process = newEclipseProcess(launch, sp, processLabel);
process.setAttribute(IProcess.ATTR_CMDLINE, cmdLineLabel);
return process;
}
示例6: exec
import org.eclipse.debug.core.model.IProcess; //導入方法依賴的package包/類
/**
* @param program
* @param arguments
* @param workingDirectory
* @return created process
* @throws CoreException
*/
private IProcess exec(String[] arguments, IPath workingDirectory) throws CoreException
{
File workingDir = null;
if (workingDirectory != null)
{
workingDir = workingDirectory.toFile();
if (!workingDir.isDirectory())
{
workingDir = null;
}
}
// FIXME Make a launch configuration? Doing this low-level stuff by hand is error-prone...
Process p = DebugPlugin.exec(arguments, workingDir);
IProcess process = null;
if (p != null)
{
// Do a quick check to see if the execution immediately failed, meaning we probably have a busted command.
try
{
int exitValue = p.exitValue();
if (exitValue != 0)
{
throw new CoreException(ProcessUtil.processResult(p));
}
}
catch (IllegalThreadStateException e)
{
// ignore
}
fLaunch = new Launch(null, ILaunchManager.RUN_MODE, null);
fLaunch.setAttribute(DebugPlugin.ATTR_LAUNCH_TIMESTAMP, Long.toString(System.currentTimeMillis()));
getLaunchManager().addLaunch(fLaunch);
process = DebugPlugin.newProcess(fLaunch, p,
MessageFormat.format("{0} - {1}", getType().getName(), getName())); //$NON-NLS-1$
process.setAttribute(IProcess.ATTR_CMDLINE, renderCommandLine(arguments));
if (fLaunchListener == null)
{
fLaunchListener = new LaunchListener();
}
getLaunchManager().addLaunchListener(fLaunchListener);
}
return process;
}
示例7: run
import org.eclipse.debug.core.model.IProcess; //導入方法依賴的package包/類
/**
* @see org.eclipse.jdt.launching.IVMRunner#run(VMRunnerConfiguration, ILaunch, IProgressMonitor)
*/
public void run(VMRunnerConfiguration config, ILaunch launch, IProgressMonitor monitor) throws CoreException {
if (monitor == null) {
monitor = new NullProgressMonitor();
}
// check for cancellation
if (monitor.isCanceled()) {
return;
}
IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
subMonitor.beginTask(HyLauncherMessages.getString("HyVMRunner.Launching_virtual_machine..._1"), 2); //$NON-NLS-1$
subMonitor.subTask(HyLauncherMessages.getString("HyVMRunner.Constructing_command_line..._2")); //$NON-NLS-1$
File workingDir = getWorkingDir(config);
String location= getJDKLocation();
String program = constructProgramString(location, config);
List arguments= new ArrayList();
arguments.add(program);
addBootClassPathArguments(arguments, config);
String[] cp= config.getClassPath();
if (cp.length > 0) {
arguments.add("-classpath"); //$NON-NLS-1$
arguments.add(convertClassPath(cp));
}
String[] vmArgs= config.getVMArguments();
addArguments(vmArgs, arguments);
arguments.add(config.getClassToLaunch());
String[] programArgs= config.getProgramArguments();
addArguments(programArgs, arguments);
String[] cmdLine= new String[arguments.size()];
arguments.toArray(cmdLine);
String[] envp= config.getEnvironment();
// check for cancellation
if (monitor.isCanceled()) {
return;
}
subMonitor.worked(1);
subMonitor.subTask(HyLauncherMessages.getString("HyVMRunner.Starting_virtual_machine..._3")); //$NON-NLS-1$
Process p= exec(cmdLine, workingDir, envp);
if (p != null) {
// Log the current launch command to the platform log
logLaunchCmd(cmdLine, false);
if (HyLaunchingPlugin.getDefault().isDebugging()
&& (Platform
.getDebugOption(HyLaunchingPlugin.DEBUG_LAUNCHING)
.equalsIgnoreCase("true"))) { //$NON-NLS-1$
traceLaunchCmd(cmdLine, envp, false);
}
IProcess process= newProcess(launch, p, renderProcessLabel(cmdLine), getDefaultProcessMap());
process.setAttribute(IProcess.ATTR_CMDLINE, renderCommandLine(cmdLine));
}
subMonitor.worked(1);
subMonitor.done();
}
示例8: makeProcAttr
import org.eclipse.debug.core.model.IProcess; //導入方法依賴的package包/類
/**
* Makes (and sets) dLabPro process attributes.
*
* @param iProcess
* the process whose attributes shall be set (may be <code>null</code>)
* @param sKey
* the attribute's key, one of the <code>ATTR_PROCESS_XXX</code> or
* <code>IProcess.ATTR_XXX</code> constants
* @param iExe
* the executable file
* @param lsECmdl
* the arguments of the executable
* @param iScr
* the script file
* @param lsSCmdl
* the arguments of the script
* @return the attribute string
*/
private static String makeProcAttr(IProcess iProcess, String sKey, File iExe,
ArrayList<String> lsECmdl, File iScr, ArrayList<String> lsSCmdl)
{
String sValue = "";
if (sKey.equals(IProcess.ATTR_PROCESS_TYPE))
{
if (isDLabProExe(iExe)) sValue = PT_DLABPRO;
else if (isCgenExe(iExe)) sValue = PT_DLABPRO;
else sValue = iExe.getName();
}
else if (sKey.equals(IProcess.ATTR_PROCESS_LABEL))
{
sValue = iExe.getName();
if (lsECmdl.size()>0) sValue += " [...]";
if (iScr!=null ) sValue += " "+iScr.getName();
sValue += " "+LaunchUtil.joinCommandLine(lsSCmdl);
}
else if (sKey.equals(IProcess.ATTR_CMDLINE))
{
try
{
sValue = iExe.getCanonicalPath()+" ";
sValue += LaunchUtil.joinCommandLine(lsECmdl)+" ";
if (iScr!=null) sValue += iScr.getCanonicalPath()+" ";
sValue += LaunchUtil.joinCommandLine(lsSCmdl);
}
catch (IOException e)
{
e.printStackTrace();
return null;
}
}
else if (sKey.equals(ATTR_PROCESS_EXTTYPE))
{
sValue = iExe.getName().replace(".exe","");
if (iScr!=null) sValue+="."+iScr.getName();
}
if (iProcess!=null) iProcess.setAttribute(sKey,sValue);
return sValue;
}