org.eclipse.debug.core.DebugPlugin Java Examples

The following examples show how to use org.eclipse.debug.core.DebugPlugin. 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: IncrementalDotnetBuilder.java    From aCute with Eclipse Public License 2.0 6 votes vote down vote up
private void runDotnetSubCommand(String dotnetSubCommand, IProject project, IProgressMonitor monitor) throws CoreException {
	if (buildProcess != null && buildProcess.isAlive()) {
		buildProcess.destroyForcibly();
	}

	File projectFolder = project.getLocation().toFile();
	if (!projectFolder.exists() || !projectFolder.isDirectory()) {
		return;
	}
	try {
		String[] commandList = { AcutePlugin.getDotnetCommand(), dotnetSubCommand };
		buildProcess = DebugPlugin.exec(commandList, projectFolder);
		boolean isProcessDone = false;
		while (!isProcessDone) {
			if (monitor.isCanceled()) {
				buildProcess.destroyForcibly();
			}
			isProcessDone = buildProcess.waitFor(100, TimeUnit.MILLISECONDS);
		}
		project.refreshLocal(IResource.DEPTH_INFINITE, null);
	} catch (InterruptedException e) {
		throw new CoreException(new Status(IStatus.ERROR, AcutePlugin.PLUGIN_ID, e.getMessage(), e));
	}
}
 
Example #2
Source File: TLCModelFactory.java    From tlaplus with MIT License 6 votes vote down vote up
/**
 * @see Model#getByName(String)
 */
public static Model getByName(final String fullQualifiedModelName) {
	Assert.isNotNull(fullQualifiedModelName);
	Assert.isLegal(fullQualifiedModelName.contains(Model.SPEC_MODEL_DELIM), "Not a full-qualified model name.");
	
       final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
       final ILaunchConfigurationType launchConfigurationType = launchManager
               .getLaunchConfigurationType(TLCModelLaunchDelegate.LAUNCH_CONFIGURATION_TYPE);

	try {
		final ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(launchConfigurationType);
		for (int i = 0; i < launchConfigurations.length; i++) {
			// Can do equals here because of full qualified name.
			final ILaunchConfiguration launchConfiguration = launchConfigurations[i];
			if (fullQualifiedModelName.equals(launchConfiguration.getName())) {
				return launchConfiguration.getAdapter(Model.class);
			}
		}
	} catch (CoreException shouldNeverHappen) {
		shouldNeverHappen.printStackTrace();
	}
	
	return null;
}
 
Example #3
Source File: SimulationView.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
private void sessionViewerInputChanged(ILaunch changedLaunch) {
	ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
	List<ILaunch> activeLaunches = Lists.newArrayList();
	for (ILaunch iLaunch : launches) {
		if (!iLaunch.isTerminated()) {
			activeLaunches.add(iLaunch);
		}
	}
	Display.getDefault().asyncExec(() -> {
		try {
			simulationSessionViewer.removeSelectionChangedListener(selectionChangedListener);
			;
			simulationSessionViewer.setInput(activeLaunches.toArray());
			simulationSessionViewer.expandAll();
		} finally {
			simulationSessionViewer.addSelectionChangedListener(selectionChangedListener);
			if (changedLaunch != null)
				simulationSessionViewer.setSelection(new StructuredSelection(changedLaunch));
		}
	});
}
 
Example #4
Source File: FixedFatJarExportPage.java    From sarl with Apache License 2.0 6 votes vote down vote up
protected LaunchConfigurationElement[] getLaunchConfigurations() {
	ArrayList<ExistingLaunchConfigurationElement> result= new ArrayList<>();

	try {
		ILaunchManager manager= DebugPlugin.getDefault().getLaunchManager();
		ILaunchConfigurationType type= manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION);
		ILaunchConfiguration[] launchconfigs= manager.getLaunchConfigurations(type);

		for (int i= 0; i < launchconfigs.length; i++) {
			ILaunchConfiguration launchconfig= launchconfigs[i];
			if (!launchconfig.getAttribute(IDebugUIConstants.ATTR_PRIVATE, false)) {
				String projectName= launchconfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
				result.add(new ExistingLaunchConfigurationElement(launchconfig, projectName));
			}
		}
	} catch (CoreException e) {
		JavaPlugin.log(e);
	}

	return result.toArray(new LaunchConfigurationElement[result.size()]);
}
 
Example #5
Source File: AbstractExecutionFlowSimulationEngine.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void init() {
	try {
		ListBasedValidationIssueAcceptor acceptor = new ListBasedValidationIssueAcceptor();
		ExecutionFlow flow = sequencer.transform(statechart, acceptor);
		if (acceptor.getTraces(Severity.ERROR).size() > 0) {
			Status errorStatus = new Status(Status.ERROR, SimulationCoreActivator.PLUGIN_ID,
					ERROR_DURING_SIMULATION, acceptor.getTraces(Severity.ERROR).iterator().next().toString(), null);
			IStatusHandler statusHandler = DebugPlugin.getDefault().getStatusHandler(errorStatus);
			try {
				statusHandler.handleStatus(errorStatus, getDebugTarget());
			} catch (CoreException e) {
				e.printStackTrace();
			}
		}

		if (!context.isSnapshot()) {
			contextInitializer.initialize(context, flow);
		}
		interpreter.initialize(flow, context, useInternalEventQueue());
	} catch (Exception ex) {
		handleException(ex);
		throw new InitializationException(ex.getMessage());
	}
}
 
Example #6
Source File: CodewindCorePlugin.java    From codewind-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void start(BundleContext context) throws Exception {
	super.start(context);
	plugin = this;

	// Register our logger with the debug options service
	context.registerService(DebugOptionsListener.class, Logger.instance(), null);
	
	launchListener = new CodewindLaunchListener();
	DebugPlugin.getDefault().getLaunchManager().addLaunchListener(launchListener);
	
	// Set default preferences once, here
	getPreferenceStore().setDefault(InstallUtil.STOP_APP_CONTAINERS_PREFSKEY, InstallUtil.STOP_APP_CONTAINERS_DEFAULT);
	getPreferenceStore().setDefault(DEBUG_CONNECT_TIMEOUT_PREFSKEY, CodewindEclipseApplication.DEFAULT_DEBUG_CONNECT_TIMEOUT);
	getPreferenceStore().setDefault(CW_INSTALL_TIMEOUT, InstallUtil.INSTALL_TIMEOUT_DEFAULT);
	getPreferenceStore().setDefault(CW_UNINSTALL_TIMEOUT, InstallUtil.UNINSTALL_TIMEOUT_DEFAULT);
	getPreferenceStore().setDefault(CW_START_TIMEOUT, InstallUtil.START_TIMEOUT_DEFAULT);
	getPreferenceStore().setDefault(CW_STOP_TIMEOUT, InstallUtil.STOP_TIMEOUT_DEFAULT);
	getPreferenceStore().setDefault(AUTO_OPEN_OVERVIEW_PAGE, true);
	getPreferenceStore().setDefault(ENABLE_SUPPORT_FEATURES, false);
	getPreferenceStore().setDefault(USE_BUILTIN_NODEJS_DEBUG_PREFSKEY, true);
}
 
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: 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 #9
Source File: TLCModelFactory.java    From tlaplus with MIT License 6 votes vote down vote up
public static Model getBy(final IFile aFile) {
	Assert.isNotNull(aFile);
	
       final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
       final ILaunchConfigurationType launchConfigurationType = launchManager
               .getLaunchConfigurationType(TLCModelLaunchDelegate.LAUNCH_CONFIGURATION_TYPE);

	try {
		final ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(launchConfigurationType);
		for (int i = 0; i < launchConfigurations.length; i++) {
			final ILaunchConfiguration launchConfiguration = launchConfigurations[i];
			if (aFile.equals(launchConfiguration.getFile())) {
				return launchConfiguration.getAdapter(Model.class);
			}
		}
	} catch (CoreException shouldNeverHappen) {
		shouldNeverHappen.printStackTrace();
	}
	
	return null;
}
 
Example #10
Source File: LaunchShortcut.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
private ILaunchConfiguration createConfiguration(IProject iProject) {
	ILaunchConfiguration config = null;
	try {
	    XdsProjectConfiguration xdsProjectSettings = new XdsProjectConfiguration(iProject);
		
		ILaunchConfigurationType configType = getConfigurationType(LAUNCH_CONFIG_TYPE_ID);		
		ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, 
				DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(iProject.getName())); 
		wc.setAttribute(ILaunchConfigConst.ATTR_PROJECT_NAME, iProject.getName());
		wc.setAttribute(ILaunchConfigConst.ATTR_EXECUTABLE_PATH, xdsProjectSettings.getExePath());
           wc.setAttribute(ILaunchConfigConst.ATTR_PROGRAM_ARGUMENTS, StringUtils.EMPTY);
           wc.setAttribute(ILaunchConfigConst.ATTR_DEBUGGER_ARGUMENTS, StringUtils.EMPTY);
           wc.setAttribute(ILaunchConfigConst.ATTR_SIMULATOR_ARGUMENTS, StringUtils.EMPTY);
		if (TextEncoding.isCodepageSupported(EncodingUtils.DOS_ENCODING)) {
   			wc.setAttribute(DebugPlugin.ATTR_CONSOLE_ENCODING, EncodingUtils.DOS_ENCODING);
		} 
        
		wc.setMappedResources(new IResource[] {iProject});
		config = wc.doSave();		
	} catch (CoreException e) {
		MessageDialog.openError(getShell(), Messages.Common_Error, Messages.LaunchShortcut_CantCreateLaunchCfg + ": " + e); //$NON-NLS-1$
	}
	return config;
}
 
Example #11
Source File: AbstractSimulationEngine.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
protected void handleException(Throwable t) {
	if (t instanceof WrappedException) {
		t = ((WrappedException) t).getCause();
	}
	String statusMessage = t.getMessage() == null ? ERROR_MSG : t.getMessage();
	Status errorStatus = new Status(Status.ERROR, SimulationCoreActivator.PLUGIN_ID, ERROR_DURING_SIMULATION,
			statusMessage, t);
	SimulationCoreActivator.getDefault().getLog().log(errorStatus);
	IStatusHandler statusHandler = DebugPlugin.getDefault().getStatusHandler(errorStatus);
	try {
		statusHandler.handleStatus(errorStatus, getDebugTarget());
	} catch (CoreException e) {
		e.printStackTrace();
	} finally {
		terminate();
	}
}
 
Example #12
Source File: ToggleBreakpointAdapter.java    From typescript.java with MIT License 6 votes vote down vote up
IBreakpoint lineBreakpointExists(IResource resource, int linenumber) {
	IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(JavaScriptDebugModel.MODEL_ID);
	IJavaScriptLineBreakpoint breakpoint = null;
	for (int i = 0; i < breakpoints.length; i++) {
		if(breakpoints[i] instanceof IJavaScriptLineBreakpoint) {
			breakpoint = (IJavaScriptLineBreakpoint) breakpoints[i];
			try {
				if(IJavaScriptLineBreakpoint.MARKER_ID.equals(breakpoint.getMarker().getType()) &&
					resource.equals(breakpoint.getMarker().getResource()) &&
					linenumber == breakpoint.getLineNumber()) {
					return breakpoint;
				}
			} catch (CoreException e) {}
		}
	}
	return null;
}
 
Example #13
Source File: KubeUtil.java    From codewind-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Starts a separate port forward launch
 */
public static PortForwardInfo launchPortForward(CodewindApplication app, int localPort, int port) throws Exception {
	// Check the app (throws an exception if there is a problem)
	checkApp(app);

	// Get the command
	List<String> commandList = getPortForwardCommand(app, localPort, port);
	String title = NLS.bind(Messages.PortForwardTitle, localPort + ":" + port);

	ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
	ILaunchConfigurationType launchConfigurationType = launchManager.getLaunchConfigurationType(UtilityLaunchConfigDelegate.LAUNCH_CONFIG_ID);
	ILaunchConfigurationWorkingCopy workingCopy = launchConfigurationType.newInstance((IContainer) null, app.name);
	workingCopy.setAttribute(CodewindLaunchConfigDelegate.CONNECTION_ID_ATTR, app.connection.getConid());
	workingCopy.setAttribute(CodewindLaunchConfigDelegate.PROJECT_ID_ATTR, app.projectID);
	workingCopy.setAttribute(UtilityLaunchConfigDelegate.TITLE_ATTR, title);
	workingCopy.setAttribute(UtilityLaunchConfigDelegate.COMMAND_ATTR, commandList);
	CodewindLaunchConfigDelegate.setConfigAttributes(workingCopy, app);
	ILaunchConfiguration launchConfig = workingCopy.doSave();
	ILaunch launch = launchConfig.launch(ILaunchManager.RUN_MODE, new NullProgressMonitor());
	return new PortForwardInfo(localPort, port, launch);
}
 
Example #14
Source File: RustLaunchDelegateTools.java    From corrosion with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Finds or creates a new launch configuration that matches the given search
 * terms
 *
 * @param resource
 * @param launchConfigurationType
 * @return The matching launch configuration or a new launch configuration
 *         working copy or null if unable to make a new one
 */
public static ILaunchConfiguration getLaunchConfiguration(IResource resource, String launchConfigurationType) {
	ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
	ILaunchConfigurationType configType = launchManager.getLaunchConfigurationType(launchConfigurationType);
	try {
		ILaunchConfiguration[] launchConfigurations = launchManager.getLaunchConfigurations(configType);
		final String projectName = resource.getProject().getName();
		String launchConfigProjectAttribute;
		if (launchConfigurationType.equals(CORROSION_DEBUG_LAUNCH_CONFIG_TYPE)) {
			launchConfigProjectAttribute = ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME;
		} else {
			launchConfigProjectAttribute = RustLaunchDelegateTools.PROJECT_ATTRIBUTE;
		}
		for (ILaunchConfiguration iLaunchConfiguration : launchConfigurations) {
			if (iLaunchConfiguration.getAttribute(launchConfigProjectAttribute, "") //$NON-NLS-1$
					.equals(projectName)) {
				return iLaunchConfiguration;
			}
		}
		String configName = launchManager.generateLaunchConfigurationName(projectName);
		return configType.newInstance(null, configName);
	} catch (CoreException e) {
		CorrosionPlugin.logError(e);
	}
	return null;
}
 
Example #15
Source File: RunnerFrontEndUI.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns a new executor that will delegate execution to {@link DebugPlugin#exec(String[], File, String[])} for
 * execution within the Eclipse launch framework. This executor is intended for the UI case.
 *
 * @see RunnerFrontEnd#createDefaultExecutor()
 */
public IExecutor createEclipseExecutor() {
	return new IExecutor() {
		@Override
		public Process exec(String[] cmdLine, File workingDirectory, Map<String, String> envp)
				throws ExecutionException {

			String[] envpArray = envp.entrySet().stream()
					.map(pair -> pair.getKey() + "=" + pair.getValue())
					.toArray(String[]::new);
			try {
				return DebugPlugin.exec(cmdLine, workingDirectory, envpArray);
			} catch (CoreException e) {
				throw new ExecutionException(e);
			}
		}
	};
}
 
Example #16
Source File: RunConfigurationConverter.java    From n4js with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Converts a {@link RunConfiguration} to an {@link ILaunchConfiguration}. Will throw a {@link WrappedException} in
 * case of error.
 *
 * @see RunConfiguration#readPersistentValues()
 */
public ILaunchConfiguration toLaunchConfiguration(ILaunchConfigurationType type, RunConfiguration runConfig) {
	try {
		final ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager()
				.getLaunchConfigurations(type);

		for (ILaunchConfiguration config : configs) {
			if (equals(runConfig, config))
				return config;
		}

		final IContainer container = null;
		final ILaunchConfigurationWorkingCopy workingCopy = type.newInstance(container, runConfig.getName());

		workingCopy.setAttributes(runConfig.readPersistentValues());

		return workingCopy.doSave();
	} catch (Exception e) {
		throw new WrappedException("could not convert N4JS RunConfiguration to Eclipse ILaunchConfiguration", e);
	}
}
 
Example #17
Source File: VoiceXMLBrowserInputView.java    From JVoiceXML with GNU Lesser General Public License v2.1 6 votes vote down vote up
void fireInput(String text) {
    if (activeBrowser == null) {
        return;
    }
    VoiceXMLBrowserInput input = new VoiceXMLBrowserInput();
    input.setInputType(VoiceXMLBrowserInput.TYPE_VOICE);
    input.setInput(text);

    activeBrowser.getVoiceXMLBrowser().sendInput(input);
    final DebugEvent event[] = new DebugEvent[1];
    event[0] = new DebugEvent(this, DebugEvent.MODEL_SPECIFIC,
            IVoiceXMLBrowserConstants.EVENT_DIALOG_MESSAGE);

    final VoiceXMLDialogMessage utterance = new VoiceXMLDialogMessage(
            "User", text);
    event[0].setData(utterance);

    DebugPlugin.getDefault().fireDebugEventSet(event);
}
 
Example #18
Source File: LocalAppEngineServerLaunchConfigurationDelegate.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
/** Check for an updated {@code datastore-index-auto.xml} in the {@code default} module. */
private void checkUpdatedDatastoreIndex(ILaunchConfiguration configuration) {
  DatastoreIndexUpdateData update = DatastoreIndexUpdateData.detect(configuration, server);
  if (update == null) {
    return;
  }
  logger.fine("datastore-indexes-auto.xml found " + update.datastoreIndexesAutoXml);
  
  // punts to UI thread
  IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(promptStatus);
  if (prompter != null) {
    try {
      prompter.handleStatus(DatastoreIndexesUpdatedStatusHandler.DATASTORE_INDEXES_UPDATED,
          update);
    } catch (CoreException ex) {
      logger.log(Level.WARNING, "Unexpected failure", ex);
    }
  }
}
 
Example #19
Source File: CordovaCLI.java    From thym with Eclipse Public License 1.0 6 votes vote down vote up
protected ILaunchConfiguration getLaunchConfiguration(String label){
	ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
	ILaunchConfigurationType type = manager.getLaunchConfigurationType(IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE);
	try {
		ILaunchConfiguration cfg = type.newInstance(null, "cordova");
		ILaunchConfigurationWorkingCopy wc = cfg.getWorkingCopy();
		wc.setAttribute(IProcess.ATTR_PROCESS_LABEL, label);
		if(additionalEnvProps != null && !additionalEnvProps.isEmpty()){
			wc.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES,additionalEnvProps);
		}
		cfg = wc.doSave();
		return cfg;
	} catch (CoreException e) {
		e.printStackTrace();
	}
	return null;
}
 
Example #20
Source File: BuildUtils.java    From hybris-commerce-eclipse-plugin with Apache License 2.0 6 votes vote down vote up
/**
 * Creates an ant build configuration {@link ILaunchConfiguration}
 * 
 * @param configName
 *            name of the configuration to be created
 * @param targets
 *            ant targets to be called
 * @param buildPath
 *            path to build.xml file
 * @param projectName
 *            name of the projects
 * @return ant build configuration
 */
private static ILaunchConfiguration createAntBuildConfig(String configName, String targets, String buildPath,
		String projectName) throws CoreException {
	ILaunchConfiguration launchCfg;
	ILaunchConfigurationType type = DebugPlugin.getDefault().getLaunchManager()
			.getLaunchConfigurationType("org.eclipse.ant.AntLaunchConfigurationType");
	ILaunchConfigurationWorkingCopy config = null;
	config = type.newInstance(null, configName);
	config.setAttribute("org.eclipse.ui.externaltools.ATTR_ANT_TARGETS", targets);
	config.setAttribute("org.eclipse.ui.externaltools.ATTR_CAPTURE_OUTPUT", true);
	config.setAttribute("org.eclipse.ui.externaltools.ATTR_LOCATION", buildPath);
	config.setAttribute("org.eclipse.ui.externaltools.ATTR_SHOW_CONSOLE", true);
	config.setAttribute("org.eclipse.ui.externaltools.ATTR_ANT_PROPERTIES", Collections.<String, String>emptyMap());
	config.setAttribute("org.eclipse.ant.ui.DEFAULT_VM_INSTALL", true);
	config.setAttribute("org.eclipse.jdt.launching.MAIN_TYPE",
			"org.eclipse.ant.internal.launching.remote.InternalAntRunner");
	config.setAttribute("org.eclipse.jdt.launching.PROJECT_ATTR", projectName);
	config.setAttribute("org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER",
			"org.eclipse.ant.ui.AntClasspathProvider");
	config.setAttribute("process_factory_id", "org.eclipse.ant.ui.remoteAntProcessFactory");
	if (configName.equals(PLATFORM_BUILD_CONFIG) || configName.equals(PLATFORM_CLEAN_BUILD_CONFIG)) {
		config.setAttribute("org.eclipse.debug.core.ATTR_REFRESH_SCOPE", "${workspace}");
	}
	launchCfg = config.doSave();
	return launchCfg;
}
 
Example #21
Source File: NpmLaunchTab.java    From wildwebdeveloper with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
	String workingDirectory = pathOrEmpty(getSelectedProject());
	if (this.packageJSONFile != null) {
		workingDirectory = pathOrEmpty(this.packageJSONFile.getParentFile());
	} else if (defaultSelectedFile != null) {
		workingDirectory = pathOrEmpty(defaultSelectedFile.getParentFile());
	}

	String programPath = this.programPathText.getText();
	configuration.setAttribute(AbstractHTMLDebugDelegate.PROGRAM, programPath);
	configuration.setAttribute(AbstractHTMLDebugDelegate.ARGUMENTS, this.argumentsCombo.getText());
	configuration.setAttribute(AbstractHTMLDebugDelegate.CWD, workingDirectory);
	configuration.setAttribute(DebugPlugin.ATTR_WORKING_DIRECTORY, workingDirectory);
	configuration.setMappedResources(ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(new File(programPath).toURI()));
}
 
Example #22
Source File: DataRepositoryServerManager.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private void initializeDebugPreferences() {
    IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
    IEclipsePreferences prefNode = DefaultScope.INSTANCE.getNode(DebugPlugin.getUniqueIdentifier());
    prefNode.putBoolean(IInternalDebugCoreConstants.PREF_ENABLE_STATUS_HANDLERS, false);
    store.setValue(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT, false);
    store.setValue(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR, false);
}
 
Example #23
Source File: Model.java    From tlaplus with MIT License 5 votes vote down vote up
public boolean isRunning() {
	final ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
	final ILaunch[] launches = launchManager.getLaunches();
	for (int i = 0; i < launches.length; i++) {
		final ILaunch launch = launches[i];
		if (launch.getLaunchConfiguration() != null
				&& launch.getLaunchConfiguration().contentsEqual(this.launchConfig)) {
			if (!launch.isTerminated()) {
				return true;
			}
		}
	}
	return false;
}
 
Example #24
Source File: HybridProjectLaunchShortcut.java    From thym with Eclipse Public License 1.0 5 votes vote down vote up
private ILaunchConfigurationType getLaunchConfigurationType(){
	ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();
	String launchTypeID = getLaunchConfigurationTypeID();
	Assert.isNotNull(launchTypeID);
	ILaunchConfigurationType configType = lm.getLaunchConfigurationType(launchTypeID);
	return configType;
}
 
Example #25
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 #26
Source File: VoiceXMLBrowserProcess.java    From JVoiceXML with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void terminate() throws DebugException {
    if (running) {
        if (browser != null) {
            browser.stop();
        }
        running = false;
        DebugEvent[] eventSet = new DebugEvent[2];
        eventSet[0] = new DebugEvent(this, DebugEvent.TERMINATE);
        eventSet[1] = new DebugEvent(launch, DebugEvent.CHANGE);
        DebugPlugin.getDefault().fireDebugEventSet(eventSet);
    }
}
 
Example #27
Source File: TestRunConfiguration.java    From corrosion with Eclipse Public License 2.0 5 votes vote down vote up
private static ILaunchConfigurationWorkingCopy createLaunchConfiguration(IProject project) throws CoreException {
	ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
	ILaunchConfigurationType configType = launchManager
			.getLaunchConfigurationType("org.eclipse.corrosion.run.CargoRunDelegate");
	ILaunchConfigurationWorkingCopy wc = configType.newInstance(project, "launch");
	wc.setAttribute("PROJECT", project.getName());
	return wc;
}
 
Example #28
Source File: TestDebugConfiguration.java    From corrosion with Eclipse Public License 2.0 5 votes vote down vote up
@After
@Before
public void stopLaunchesAndCloseConsoles() throws DebugException {
	for (ILaunch launch : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
		launch.terminate();
	}
	IConsoleManager consoleManager = ConsolePlugin.getDefault().getConsoleManager();
	consoleManager.removeConsoles(consoleManager.getConsoles());
	IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
	for (IViewReference view : activePage.getViewReferences()) {
		if (IConsoleConstants.ID_CONSOLE_VIEW.equals(view.getId())) {
			activePage.hideView(view);
		}
	}
}
 
Example #29
Source File: RemoteLaunchConfigDelegate.java    From codewind-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public static void addDebugEventListener(final ILaunch launch) {
	// Add the debug listener
	DebugPlugin.getDefault().addDebugEventListener(new IDebugEventSetListener() {
		@Override
		public void handleDebugEvents(DebugEvent[] events) {
			for (DebugEvent event : events) {
				if (event.getKind() == DebugEvent.TERMINATE && event.getSource() instanceof IDebugTarget
						&& ((IDebugTarget) event.getSource()).getLaunch() == launch) {
					// Remove this listener
					DebugPlugin.getDefault().removeDebugEventListener(this);

					// Make sure the port forward is terminated
					Arrays.stream(launch.getProcesses()).filter(process -> !process.isTerminated()).forEach(process -> {
						try {
							process.terminate();
						} catch (DebugException e) {
							Logger.logError("An error occurred trying to terminate the process: " + process.getLabel(), e);
						}
					});

					// No need to process the rest of the events
					break;
				}
			}
		}
	});
}
 
Example #30
Source File: EvalExpressionAction.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * This hack just creates a Watch expression, gets result and removes the watch expression. 
 * This is simple, since the watch functionality is already there.
 * 
 * @see WatchExpressionAction#createExpression
 */
private void eval(final String expr) {
    final IWatchExpression expression = createWatchExpression(expr);

    final Shell shell = PydevDebugPlugin.getActiveWorkbenchWindow().getShell();
    Display display = PydevDebugPlugin.getDefault().getWorkbench().getDisplay();
    final Point point = display.getCursorLocation();

    Display.getDefault().asyncExec(new Runnable() {
        @Override
        public void run() {
            expression.evaluate();
            waitForExpressionEvaluation(expression);
            try {
                IValue value = expression.getValue();
                String result = null;
                if (value != null) {
                    result = expr + "\n" + value.getValueString();
                    DisplayPopup popup = new DisplayPopup(shell, point, result);
                    popup.open();
                }
            } catch (DebugException e) {
                DebugPlugin.log(e);
                return;
            } catch (Throwable t) {
                DebugPlugin.log(t);
            }
        }
    });
}