org.eclipse.debug.core.ILaunch Java Examples

The following examples show how to use org.eclipse.debug.core.ILaunch. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LangLaunchConfigurationDelegate.java    From goclipse with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public final ILaunch getLaunch(ILaunchConfiguration configuration, String mode) throws CoreException {
	try {
		buildTargetSettings = getBuildTargetSettings(configuration);
		buildTarget = buildTargetSettings.getValidBuildTarget();
		processLauncher = getValidLaunchInfo(configuration, buildTargetSettings);
	} catch(CommonException ce) {
		throw EclipseCore.createCoreException(ce);
	}
	
	if(ILaunchManager.RUN_MODE.equals(mode)) {
		return getLaunchForRunMode(configuration, mode);
	}
	if(ILaunchManager.DEBUG_MODE.equals(mode)) {
		return getLaunchForDebugMode(configuration, mode);
	}
	throw abort_UnsupportedMode(mode);
}
 
Example #2
Source File: PyDebugTargetServer.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
public PyDebugTargetServer(ILaunch launch, IPath[] file, RemoteDebuggerServer debugger) {
    this.file = file;
    this.debugger = debugger;
    this.threads = new PyThread[0];
    this.launch = launch;

    if (launch != null) {
        for (IDebugTarget target : launch.getDebugTargets()) {
            if (target instanceof PyDebugTargetServer && target.isTerminated()) {
                launch.removeDebugTarget(target);
            }
        }
        launch.addDebugTarget(this);
    }

    debugger.addTarget(this);
    PyExceptionBreakPointManager.getInstance().addListener(this);
    PyPropertyTraceManager.getInstance().addListener(this);

    IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
    breakpointManager.addBreakpointListener(this);
    // we have to know when we get removed, so that we can shut off the debugger
    DebugPlugin.getDefault().getLaunchManager().addLaunchListener(this);
}
 
Example #3
Source File: GwtWtpPlugin.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
private void displayCodeServerUrlInDevMode(final ILaunch launch, String text) {
  if (!text.contains("http")) {
    return;
  }

  // Extract URL http://localhost:9876/
  String url = text.replaceAll(".*(http.*).*?", "$1").trim();
  if (url.matches(".*/")) {
    url = url.substring(0, url.length() - 1);
    launchUrls.add(url);
  }

  // Dev Mode View, add url
  LaunchConfiguration lc = WebAppDebugModel.getInstance().addOrReturnExistingLaunchConfiguration(launch, "", null);
  lc.setLaunchUrls(launchUrls);
}
 
Example #4
Source File: PydevIProcessFactory.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
public static String getEncodingFromFrame(PyStackFrame selectedFrame) {
    try {
        IDebugTarget adapter = selectedFrame.getAdapter(IDebugTarget.class);
        if (adapter == null) {
            return "UTF-8";
        }
        IProcess process = adapter.getProcess();
        if (process == null) {
            return "UTF-8";
        }
        ILaunch launch = process.getLaunch();
        if (launch == null) {
            Log.log("Unable to get launch for: " + process);
            return "UTF-8";
        }
        return getEncodingFromLaunch(launch);
    } catch (Exception e) {
        Log.log(e);
        return "UTF-8";
    }
}
 
Example #5
Source File: JUnitTestRunListenerTest.java    From eclipse-extras with Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void testLaunchTerminatedAfterSessionStarted() {
  ITestRunSession testRunSession = mockTestRunSession( OK, mockTestCaseElement() );
  testRunListener.sessionLaunched( testRunSession );
  testRunListener.sessionStarted( testRunSession );

  ILaunch launch = mockLaunch( testRunSession.getTestRunName() );
  fireLaunchTerminated( launch );

  InOrder order = inOrder( progressUI );
  order.verify( progressUI ).update( STARTING, SWT.LEFT, null, 0, 0 );
  order.verify( progressUI ).setToolTipText( testRunSession.getTestRunName() );
  order.verify( progressUI ).update( "0 / 1", SWT.CENTER, successColor(), 0, 1 );
  order.verify( progressUI ).setToolTipText( testRunSession.getTestRunName() );
  order.verifyNoMoreInteractions();
}
 
Example #6
Source File: RemoteEclipseApplication.java    From codewind-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void launchTerminated(ILaunch launch) {
	if (debugPFInfo != null && launch == debugPFInfo.launch) {
		// The user terminated the port forwarding
		IPreferenceStore prefs = CodewindCorePlugin.getDefault().getPreferenceStore();
		if (!prefs.getBoolean(NOTIFY_PORT_FORWARD_TERMINATED_PREFSKEY)) {
			Display.getDefault().asyncExec(() -> {
				MessageDialogWithToggle portForwardEndDialog = MessageDialogWithToggle.openInformation(Display.getDefault().getActiveShell(),
						Messages.PortForwardTerminateTitle,
						NLS.bind(Messages.PortForwardTerminateMsg, new String[] {name, connection.getName(), Integer.toString(debugPFInfo.remotePort)}),
						Messages.PortForwardTerminateToggleMsg, false, null, null);
				prefs.setValue(NOTIFY_PORT_FORWARD_TERMINATED_PREFSKEY, portForwardEndDialog.getToggleState());
			});
		}
		debugPFInfo = null;
		CoreUtil.updateApplication(this);
	} else if (launch == getLaunch()) {
		// Make sure the port forward process is terminated
		if (debugPFInfo != null) {
			debugPFInfo.terminate();
			debugPFInfo = null;
		}
		CoreUtil.updateApplication(this);
	}
}
 
Example #7
Source File: OtherUtil.java    From codewind-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
public static ILaunch startDiagnostics(String connectionName, String conid, boolean includeEclipseWorkspace, boolean includeProjectInfo, IProgressMonitor monitor) throws IOException, CoreException {
	List<String> options = new ArrayList<String>();
	options.add(CLIUtil.CON_ID_OPTION);
	options.add(conid);
	if (includeEclipseWorkspace) {
		options.add(ECLIPSE_WORKSPACE_OPTION);
		options.add(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString());
	}
	if (includeProjectInfo) {
		options.add(PROJECTS_OPTION);
	}
	List<String> command = CLIUtil.getCWCTLCommandList(null, DIAGNOSTICS_COLLECT_CMD, options.toArray(new String[options.size()]), null);
	
	ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
	ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(UtilityLaunchConfigDelegate.LAUNCH_CONFIG_ID);
	ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance((IContainer) null, connectionName);
	workingCopy.setAttribute(UtilityLaunchConfigDelegate.TITLE_ATTR, Messages.UtilGenDiagnosticsTitle);
	workingCopy.setAttribute(UtilityLaunchConfigDelegate.COMMAND_ATTR, command);
	ILaunchConfiguration launchConfig = workingCopy.doSave();
	return launchConfig.launch(ILaunchManager.RUN_MODE, monitor);
}
 
Example #8
Source File: LaunchConfiguration.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Create a new instance.
 * 
 * @param name The name of the launch configuration.
 * @param model The model associated with this launch configuration
 */
LaunchConfiguration(ILaunch launch, String name, WebAppDebugModel model) {
  id = model.getModelNodeNextId();
  this.launch = launch;
  this.name = name;
  this.model = model;

  // We're caching the type ID as
  // ModelLabelProvider.getLaunchConfigurationImage() may request it even
  // after the actual launch configuration has been deleted.
  String typeId = WebAppLaunchConfiguration.TYPE_ID;
  ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration();
  if (launchConfiguration != null) {
    try {
      typeId = launchConfiguration.getType().getIdentifier();
    } catch (CoreException e) {
      GWTPluginLog.logError(e,
          "Could not determine the launch configuration type");
    }
  }

  this.launchTypeId = typeId;
}
 
Example #9
Source File: SexecLaunchConfigurationDelegate.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected ISimulationEngine createExecutionContainer(final ILaunch launch, Statechart statechart) {
	try {

		Injector injector = getInjector(statechart, launch);
		IFile file = WorkspaceSynchronizer.getFile(statechart.eResource());
		injector.injectMembers(this);

		for (IOperationExecutor mockup : mockups) {
			if (mockup instanceof JavaOperationMockup) {
				IProject project = file.getProject();
				String classes = launch.getLaunchConfiguration().getAttribute(ISCTLaunchParameters.OPERATION_CLASS,
						"");
				String[] split = classes.split(",");
				((JavaOperationMockup) mockup).initOperationCallbacks(project, split);
			}
		}
		return factory.createExecutionContainer(statechart, launch);
	} catch (CoreException e) {
		e.printStackTrace();
		return null;
	}
}
 
Example #10
Source File: CodewindLaunchListener.java    From codewind-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void launchesTerminated(ILaunch[] launches) {
	for (ILaunch launch : launches) {
		ILaunchConfiguration config = launch.getLaunchConfiguration();
		try {
			if (config.hasAttribute(CodewindLaunchConfigDelegate.CONNECTION_ID_ATTR) && config.hasAttribute(CodewindLaunchConfigDelegate.PROJECT_ID_ATTR)) {
				CodewindConnection conn = CodewindConnectionManager.getConnectionById(config.getAttribute(CodewindLaunchConfigDelegate.CONNECTION_ID_ATTR, ""));
				CodewindApplication app = conn == null ? null : conn.getAppByID(config.getAttribute(CodewindLaunchConfigDelegate.PROJECT_ID_ATTR, ""));
				if (app != null) {
					app.launchTerminated(launch);
				}
			}
		} catch (CoreException e) {
			Logger.logError("An error occurred trying to look up the application for a launch configuration", e);
		}
	}
}
 
Example #11
Source File: InteractiveConsolePlugin.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Removes a launch from a pydev console and stops the related process (may be called from a thread).
 *
 * @param launch the launch to be removed
 */
public void removeConsoleLaunch(ILaunch launch) {
    boolean removed;
    synchronized (consoleLaunchesLock) {
        removed = consoleLaunches.remove(launch);
    }
    if (removed) {
        IProcess[] processes = launch.getProcesses();
        if (processes != null) {
            for (IProcess p : processes) {
                try {
                    p.terminate();
                } catch (Exception e) {
                    Log.log(e);
                }
            }
        }
    }
}
 
Example #12
Source File: SimulationView.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void run() {
	Display.getDefault().asyncExec(new Runnable() {

		@Override
		public void run() {
			IDebugTarget[] debugTargets = debugTarget.getLaunch().getDebugTargets();
			for (IDebugTarget current : debugTargets) {
				ILaunch launch = current.getLaunch();
				SCTDebugTarget target = (SCTDebugTarget) launch.getDebugTarget();
				try {
					target.getLaunch().terminate();
				} catch (CoreException e) {
					e.printStackTrace();
				}
			}
			ILaunchConfiguration launchConfiguration = debugTarget.getLaunch().getLaunchConfiguration();
			DebugUITools.launch(launchConfiguration, debugTarget.getLaunch().getLaunchMode());
		}
	});
}
 
Example #13
Source File: FlexMavenPackagedProjectStagingDelegateTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testWaitUntilLaunchTerminates_normalExit()
    throws DebugException, InterruptedException {
  IProcess process = mock(IProcess.class);
  when(process.getExitValue()).thenReturn(0);

  ILaunch launch = mock(ILaunch.class);
  when(launch.isTerminated()).thenReturn(true);
  when(launch.getProcesses()).thenReturn(new IProcess[] {process, process});

  boolean normalExit = FlexMavenPackagedProjectStagingDelegate.waitUntilLaunchTerminates(
      launch, new NullProgressMonitor());
  assertTrue(normalExit);
}
 
Example #14
Source File: OpenLaunchDialogHanderPDETest.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void testExecuteMultipleLaunchConfigs() throws CoreException {
  ILaunchConfiguration launchConfig1 = launchConfigRule.createPublicLaunchConfig().doSave();
  ILaunchConfiguration launchConfig2 = launchConfigRule.createPublicLaunchConfig().doSave();
  LaunchSelectionDialog dialog = mockLaunchSelectionDialog( launchConfig1, launchConfig2 );
  doReturn( dialog ).when( handler ).createDialog( any() );

  executeHandler();

  ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
  assertThat( launches ).extracting( "launchConfiguration" ).containsOnly( launchConfig1, launchConfig2 );
  assertThat( launches ).extracting( "launchMode" ).containsOnly( launchMode.getIdentifier() );
}
 
Example #15
Source File: DefaultSimulationEngineFactory.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
public ISimulationEngine createExecutionContainer(Statechart statechart, ILaunch launch) throws CoreException {
	ISimulationEngine controller = createController(statechart);
	injector.injectMembers(controller);

	// For restoring execution context
	String attribute = launch.getLaunchConfiguration().getAttribute(ISCTLaunchParameters.EXECUTION_CONTEXT, "");
	if (attribute != null && attribute.trim().length() > 0) {
		ExecutionContext context = restore(attribute, statechart);
		controller.setExecutionContext(context);
	}

	return controller;
}
 
Example #16
Source File: AbstractLangGdbAdapterFactory.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected <T> T createModelAdapter(Class<T> adapterType, ILaunch launch, DsfSession session) {
	if (IViewerInputProvider.class.equals(adapterType)) {
		return (T) createGdbViewModelAdapter(session, getSteppingController());
	}
	
	return super.createModelAdapter(adapterType, launch, session);
}
 
Example #17
Source File: DebuggerTestUtils.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Waits until a debug target is available in the passed launch
 * @return the debug target found
 */
public IDebugTarget waitForDebugTargetAvailable(final ILaunch launch) throws Throwable {
    waitForCondition(new ICallback() {

        @Override
        public Object call(Object args) throws Exception {
            return launch.getDebugTarget() != null;
        }
    }, "waitForDebugTargetAvailable");

    return launch.getDebugTarget();
}
 
Example #18
Source File: WatchExpressionAction.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private void createExpression(String variable) {
    IWatchExpression expression = DebugPlugin.getDefault().getExpressionManager().newWatchExpression(variable);

    DebugPlugin.getDefault().getExpressionManager().addExpression(expression);
    IAdaptable object = DebugUITools.getDebugContext();
    IDebugElement context = null;
    if (object instanceof IDebugElement) {
        context = (IDebugElement) object;
    } else if (object instanceof ILaunch) {
        context = ((ILaunch) object).getDebugTarget();
    }
    expression.setExpressionContext(context);
    showExpressionsView();
}
 
Example #19
Source File: SimulationSessionViewerFactory.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public String getText(Object element) {
	if (element instanceof ILaunch) {
		return ((ILaunch) element).getLaunchConfiguration().getName();
	}
	try {
		return ((SCTDebugTarget) element).getName();
	} catch (DebugException e) {
		e.printStackTrace();
	}
	return element.toString();
}
 
Example #20
Source File: LaunchHelperTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test(expected = CoreException.class)
public void failsIfAlreadyLaunched() throws CoreException {
  IModule module1 = appEngineStandardProject1.getModule();

  serverToReturn = mock(IServer.class);
  ILaunch launch = mock(ILaunch.class);
  when(serverToReturn.getServerState()).thenReturn(IServer.STATE_STARTED);
  when(serverToReturn.getLaunch()).thenReturn(launch);
  when(launch.getLaunchMode()).thenReturn(ILaunchManager.DEBUG_MODE);
  handler.launch(new IModule[] {module1}, ILaunchManager.DEBUG_MODE);
}
 
Example #21
Source File: XMLUtilsTest.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
public void testXmlUtils2() throws Exception {
    String payload = "<xml><thread id=\"pid25170_seq1\" stop_reason=\"111\">\n"
            + "<frame id=\"28191216\" name=\"<module>\" file=\"helloWorld.py\" line=\"6\"></frame><frame id=\"27818048\" name=\"run\" file=\"pydevd.py\" line=\"1355\">\"</frame>\n"
            + "<frame id=\"25798272\" name=\"<module>\" file=\"pydevd.py\" line=\"1738\"></frame></thread></xml>";
    AbstractDebugTarget target = new AbstractDebugTarget() {

        @Override
        public void launchRemoved(ILaunch launch) {
            throw new RuntimeException("not implemented");
        }

        @Override
        public IProcess getProcess() {
            throw new RuntimeException("not implemented");
        }

        @Override
        public boolean isTerminated() {
            throw new RuntimeException("not implemented");
        }

        @Override
        public boolean canTerminate() {
            throw new RuntimeException("not implemented");
        }

        @Override
        protected PyThread findThreadByID(String thread_id) {
            return new PyThread(this, "bar", "10");
        }
    };
    XMLUtils.XMLToStack(target, payload);
}
 
Example #22
Source File: TerminateLaunchesActionPDETest.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void testRun() throws Exception {
  ILaunch launch = runLaunchConfig();
  action.setSelection( new StructuredSelection( launch.getLaunchConfiguration() ) );

  action.run();
  waitForTerminateLaunchesJob();

  assertThat( launch.isTerminated() ).isTrue();
}
 
Example #23
Source File: SCTPerspectiveManager.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected boolean allTargetsTerminated() {
	ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
	for (ILaunch launch : launches) {
		for (IDebugTarget target : launch.getDebugTargets()) {
			if (!target.isTerminated())
				return false;
		}
	}
	return true;
}
 
Example #24
Source File: JUnitTestRunListenerTest.java    From eclipse-extras with Eclipse Public License 1.0 5 votes vote down vote up
private static ILaunch mockLaunch( String launchConfigName ) {
  ILaunch result = mock( ILaunch.class );
  ILaunchConfiguration launchConfig = mock( ILaunchConfiguration.class );
  when( launchConfig.getName() ).thenReturn( launchConfigName );
  when( result.getLaunchConfiguration() ).thenReturn( launchConfig );
  return result;
}
 
Example #25
Source File: PythonRunnerConfig.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
public PyUnitServer createPyUnitServer(PythonRunnerConfig config, ILaunch launch) throws IOException {
    if (this.pyUnitServer != null) {
        throw new AssertionError("PyUnitServer already created!");
    }
    this.pyUnitServer = new PyUnitServer(config, launch);
    return this.pyUnitServer;
}
 
Example #26
Source File: PythonConsoleLineTracker.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private void updateProjectAndWorkingDir() {
    if (updatedProjectAndWorkingDir) {
        return;
    }
    IProcess process = DebugUITools.getCurrentProcess();
    if (process != null) {
        ILaunch launch = process.getLaunch();
        if (launch != null) {
            updatedProjectAndWorkingDir = true;
            ILaunchConfiguration lc = launch.getLaunchConfiguration();
            initLaunchConfiguration(lc);
        }
    }
}
 
Example #27
Source File: DerbyServerUtils.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
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()+".");

}
 
Example #28
Source File: DataflowPipelineLaunchDelegateTest.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
@Test
public void testLaunchWithLaunchConfigurationWithIncompleteArgsThrowsIllegalArgumentException()
    throws CoreException {
  ILaunchConfiguration configuration = mockILaunchConfiguration();
  Map<String, String> incompleteRequiredArguments = ImmutableMap.of();
  when(
      configuration.getAttribute(
          PipelineConfigurationAttr.ALL_ARGUMENT_VALUES.toString(),
          ImmutableMap.<String, String>of())).thenReturn(incompleteRequiredArguments);

  Set<PipelineOptionsProperty> properties =
      ImmutableSet.of(requiredProperty("foo"), requiredProperty("bar-baz"));
  when(
      pipelineOptionsHierarchy.getRequiredOptionsByType(
          "com.google.cloud.dataflow.sdk.options.BlockingDataflowPipelineOptions"))
      .thenReturn(
          ImmutableMap.of(
              new PipelineOptionsType(
                  "MyOptions", Collections.<PipelineOptionsType>emptySet(), properties),
              properties));

  String mode = "run";
  ILaunch launch = mock(ILaunch.class);

  try {
    dataflowDelegate.launch(configuration, mode, launch, monitor);
    fail();
  } catch (IllegalArgumentException ex) {
    assertTrue(ex.getMessage().contains("Dataflow Pipeline Configuration is not valid"));
  }
}
 
Example #29
Source File: AbstractLaunchConfigurationDelegate.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
private void finishLaunchWithError(ILaunch launch) {
    try {
        launch.terminate();

        ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
        launchManager.removeLaunch(launch);
    } catch (Throwable x) {
        Log.log(x);
    }
}
 
Example #30
Source File: DerbyUtils.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
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);
	}