当前位置: 首页>>代码示例>>Java>>正文


Java DebugPlugin类代码示例

本文整理汇总了Java中org.eclipse.debug.core.DebugPlugin的典型用法代码示例。如果您正苦于以下问题:Java DebugPlugin类的具体用法?Java DebugPlugin怎么用?Java DebugPlugin使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DebugPlugin类属于org.eclipse.debug.core包,在下文中一共展示了DebugPlugin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: launchFile

import org.eclipse.debug.core.DebugPlugin; //导入依赖的package包/类
/**
 * Launch a file, using the file information, which means using default launch configurations.
 */
protected void launchFile(IFile originalFileToRun, String mode) {
	final String runnerId = getRunnerId();
	final String path = originalFileToRun.getFullPath().toOSString();
	final URI moduleToRun = URI.createPlatformResourceURI(path, true);

	final String implementationId = chooseImplHelper.chooseImplementationIfRequired(runnerId, moduleToRun);
	if (implementationId == ChooseImplementationHelper.CANCEL)
		return;

	RunConfiguration runConfig = runnerFrontEnd.createConfiguration(runnerId, implementationId, moduleToRun);

	ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
	ILaunchConfigurationType type = launchManager.getLaunchConfigurationType(getLaunchConfigTypeID());
	DebugUITools.launch(runConfigConverter.toLaunchConfiguration(type, runConfig), mode);
	// execution dispatched to proper delegate LaunchConfigurationDelegate
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:20,代码来源:AbstractRunnerLaunchShortcut.java

示例2: toLaunchConfiguration

import org.eclipse.debug.core.DebugPlugin; //导入依赖的package包/类
/**
 * Creates an {@link ILaunchConfiguration} containing the information of this instance, only available when run
 * within the Eclipse IDE. If an {@link ILaunchConfiguration} with the same name has been run before, the instance
 * from the launch manager is used. This is usually done in the {@code ILaunchShortcut}.
 *
 * @see #fromLaunchConfiguration(ILaunchConfiguration)
 */
public ILaunchConfiguration toLaunchConfiguration() throws CoreException {
	ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager()
			.getLaunchConfigurations(configurationType);
	boolean configurationHasChanged = false;
	for (ILaunchConfiguration config : configs) {
		if (configName.equals(config.getName())) {
			configurationHasChanged = hasConfigurationChanged(config);
			if (!configurationHasChanged) {
				return config;
			}
		}
	}

	IContainer container = null;
	ILaunchConfigurationWorkingCopy workingCopy = configurationType.newInstance(container, configName);

	workingCopy.setAttribute(XT_FILE_TO_RUN, xtFileToRun);
	workingCopy.setAttribute(WORKING_DIRECTORY, workingDirectory.getAbsolutePath());

	return workingCopy.doSave();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:29,代码来源:XpectRunConfiguration.java

示例3: toLaunchConfiguration

import org.eclipse.debug.core.DebugPlugin; //导入依赖的package包/类
/**
 * Converts a {@link TestConfiguration} to an {@link ILaunchConfiguration}. Will throw a {@link WrappedException} in
 * case of error.
 *
 * @see TestConfiguration#readPersistentValues()
 */
public ILaunchConfiguration toLaunchConfiguration(ILaunchConfigurationType type, TestConfiguration testConfig) {
	try {
		final ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager()
				.getLaunchConfigurations(type);

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

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

		workingCopy.setAttributes(testConfig.readPersistentValues());

		return workingCopy.doSave();
	} catch (Exception e) {
		throw new WrappedException("could not convert N4JS TestConfiguration to Eclipse ILaunchConfiguration", e);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:27,代码来源:TestConfigurationConverter.java

示例4: toLaunchConfiguration

import org.eclipse.debug.core.DebugPlugin; //导入依赖的package包/类
/**
 * 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);
	}
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:27,代码来源:RunConfigurationConverter.java

示例5: createEclipseExecutor

import org.eclipse.debug.core.DebugPlugin; //导入依赖的package包/类
/**
 * 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);
			}
		}
	};
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:24,代码来源:RunnerFrontEndUI.java

示例6: handleTerminatedReply

import org.eclipse.debug.core.DebugPlugin; //导入依赖的package包/类
/**
 * Handles the given {@link TerminatedReply}.
 * 
 * @param terminatedReply
 *            the {@link TerminatedReply}
 */
private void handleTerminatedReply(TerminatedReply terminatedReply) {
	final String threadName = terminatedReply.getThreadName();
	if (threadName == null) {
		// EMF model change
		factory.getModelUpdater().terminatedReply(getHost());
		// unregister as a breakpoint listener
		DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(this);
		// Eclipse change
		fireTerminateEvent();
	} else {
		// EMF model change
		Thread eThread = DebugTargetUtils.getThread(getHost(), threadName);
		factory.getModelUpdater().terminatedReply(eThread);
		// Eclipse change
		DSLThreadAdapter thread = factory.getThread(eThread);
		thread.fireTerminateEvent();
		// notify current instruction listeners
		StackFrame eFrame = eThread.getTopStackFrame();
		while (eFrame != null) {
			fireCurrentInstructionTerminatedEvent(eFrame);
			eFrame = eFrame.getParentFrame();
		}
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:31,代码来源:DSLDebugTargetAdapter.java

示例7: getBreakpoints

import org.eclipse.debug.core.DebugPlugin; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.debug.core.model.IThread#getBreakpoints()
 */
public IBreakpoint[] getBreakpoints() {
	final List<IBreakpoint> res = new ArrayList<IBreakpoint>();

	if (isSuspended()) {
		final URI instructionUri = EcoreUtil.getURI(getHost().getTopStackFrame().getCurrentInstruction());
		for (IBreakpoint breakpoint : DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(
				getModelIdentifier())) {
			if (breakpoint instanceof DSLBreakpoint
					&& (((DSLBreakpoint)breakpoint).getURI().equals(instructionUri))) {
				res.add(breakpoint);
			}
		}
	}

	return res.toArray(new IBreakpoint[res.size()]);
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:22,代码来源:DSLThreadAdapter.java

示例8: execute

import org.eclipse.debug.core.DebugPlugin; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.sirius.tools.api.ui.IExternalJavaAction#execute(java.util.Collection, java.util.Map)
 */
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
	final ILaunchConfigurationType launchConfigType = DebugPlugin.getDefault().getLaunchManager()
			.getLaunchConfigurationType(getLaunchConfigurationTypeID());
	Set<String> modes = new HashSet<String>();
	modes.add("debug");
	try {
		ILaunchDelegate[] delegates = launchConfigType.getDelegates(modes);
		if (delegates.length != 0
				&& delegates[0].getDelegate() instanceof AbstractDSLLaunchConfigurationDelegateUI) {
			AbstractDSLLaunchConfigurationDelegateUI delegate = (AbstractDSLLaunchConfigurationDelegateUI)delegates[0]
					.getDelegate();
			delegate.launch(delegate.getLaunchableResource(PlatformUI.getWorkbench()
					.getActiveWorkbenchWindow().getActivePage().getActiveEditor()),
					getFirstInstruction(selections), "debug");
		}
	} catch (CoreException e) {
		DebugSiriusIdeUiPlugin.getPlugin().getLog().log(
				new Status(IStatus.ERROR, DebugSiriusIdeUiPlugin.ID, e.getLocalizedMessage(), e));
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:26,代码来源:AbstractDebugAsAction.java

示例9: getBreakpoint

import org.eclipse.debug.core.DebugPlugin; //导入依赖的package包/类
/**
 * Gets the {@link DSLBreakpoint} for the given {@link EObject instruction}.
 * 
 * @param instruction
 *            the {@link EObject instruction}
 * @return the {@link DSLBreakpoint} for the given {@link EObject instruction} if nay, <code>null</code>
 *         otherwise
 */
protected DSLBreakpoint getBreakpoint(EObject instruction) {
	DSLBreakpoint res = null;

	IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager()
			.getBreakpoints(identifier);
	final URI instructionURI = EcoreUtil.getURI(instruction);
	for (IBreakpoint breakpoint : breakpoints) {
		if (breakpoint instanceof DSLBreakpoint && ((DSLBreakpoint)breakpoint).getURI() != null
				&& ((DSLBreakpoint)breakpoint).getURI().equals(instructionURI)) {
			res = (DSLBreakpoint)breakpoint;
			break;
		}
	}

	return res;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:25,代码来源:DSLToggleBreakpointsUtils.java

示例10: cleanWorkspace

import org.eclipse.debug.core.DebugPlugin; //导入依赖的package包/类
public static void cleanWorkspace() throws CoreException {
	IProject[] projects = getRoot().getProjects();
	deleteProjects(projects);
	IProject[] otherProjects = getRoot().getProjects(IContainer.INCLUDE_HIDDEN);
	deleteProjects(otherProjects);

	ILaunchConfigurationType configType = DebugPlugin.getDefault().getLaunchManager()
			.getLaunchConfigurationType(GW4ELaunchShortcut.GW4ELAUNCHCONFIGURATIONTYPE);
	ILaunchConfiguration[] configs = DebugPlugin.getDefault().getLaunchManager()
			.getLaunchConfigurations(configType);
	for (int i = 0; i < configs.length; i++) {
		ILaunchConfiguration config = configs[i];
		config.delete();
	}
	 
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:17,代码来源:GW4EProject.java

示例11: findConfig

import org.eclipse.debug.core.DebugPlugin; //导入依赖的package包/类
private ILaunchConfiguration findConfig() {
    if (cachedGenerated != null) {
        return cachedGenerated;
    }
    try {
        for (ILaunchConfiguration config : DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations(getType())) {
            if (config.getName().equals(generator.fullName(cfg))) {
                cachedGenerated = config;
                break;
            }
        }
    } catch (CoreException e) {
        LcDslInternalHelper.log(IStatus.WARNING, "cannot lookup launch configuration", e);
    }
    return cachedGenerated;
}
 
开发者ID:mduft,项目名称:lcdsl,代码行数:17,代码来源:LcDslLaunchObject.java

示例12: addLaunchCfg

import org.eclipse.debug.core.DebugPlugin; //导入依赖的package包/类
private void addLaunchCfg() {
	try {
		ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
		ILaunchConfigurationType type = manager
				.getLaunchConfigurationType("org.eclipse.pde.ui.RuntimeWorkbench");
		ILaunchConfiguration[] lcs = manager.getLaunchConfigurations(type);
		List<ILaunchConfiguration> configList = Arrays.asList(lcs);
		List<String> configs = configList.stream().map(config -> config.getName()).collect(Collectors.toList());
		ComboDialog dialog = new ComboDialog(getShell(), true);
		dialog.setTitle("Choose launch config");
		dialog.setInfoText("Choose Eclipse launch conguration to edit it's configuration settings");
		dialog.setAllowedValues(configs);
		if (dialog.open() == OK) {
			String selectedName = dialog.getValue();
			ILaunchConfiguration selectedConfig = configList.stream().filter(config -> selectedName.equals(config.getName())).findFirst().get();
			String configLocation = getConfigLocation(selectedConfig);
			valueAdded(new File(configLocation, ".settings").getAbsolutePath());
			buttonPressed(IDialogConstants.OK_ID);
		}
	} catch (CoreException e) {
		PrefEditorPlugin.log(e);
	}
}
 
开发者ID:32kda,项目名称:com.onpositive.prefeditor,代码行数:24,代码来源:FolderSelectionDialog.java

示例13: toggleLineBreakpoints

import org.eclipse.debug.core.DebugPlugin; //导入依赖的package包/类
@Override
public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
	ITextEditor textEditor = getEditor(part);
	if (textEditor != null) {
		IResource resource = textEditor.getEditorInput().getAdapter(IResource.class);
		ITextSelection textSelection = (ITextSelection) selection;
		int lineNumber = textSelection.getStartLine();
		IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager()
				.getBreakpoints(DSPPlugin.ID_DSP_DEBUG_MODEL);
		for (int i = 0; i < breakpoints.length; i++) {
			IBreakpoint breakpoint = breakpoints[i];
			if (breakpoint instanceof ILineBreakpoint && resource.equals(breakpoint.getMarker().getResource())) {
				if (((ILineBreakpoint) breakpoint).getLineNumber() == (lineNumber + 1)) {
					// remove
					breakpoint.delete();
					return;
				}
			}
		}
		// create line breakpoint (doc line numbers start at 0)
		DSPLineBreakpoint lineBreakpoint = new DSPLineBreakpoint(resource, lineNumber + 1);
		DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(lineBreakpoint);
	}
}
 
开发者ID:tracymiranda,项目名称:dsp4e,代码行数:25,代码来源:DSPBreakpointAdapter.java

示例14: constructLaunchCommand

import org.eclipse.debug.core.DebugPlugin; //导入依赖的package包/类
private static String[] constructLaunchCommand(Map<String, ? extends Argument> launchingOptions, String address) {
    final String javaHome = launchingOptions.get(DebugUtility.HOME).value();
    final String javaExec = launchingOptions.get(DebugUtility.EXEC).value();
    final String slash = System.getProperty("file.separator");
    boolean suspend = Boolean.valueOf(launchingOptions.get(DebugUtility.SUSPEND).value());
    final String javaOptions = launchingOptions.get(DebugUtility.OPTIONS).value();
    final String main = launchingOptions.get(DebugUtility.MAIN).value();

    StringBuilder execString = new StringBuilder();
    execString.append("\"" + javaHome + slash + "bin" + slash + javaExec + "\"");
    execString.append(" -Xdebug -Xnoagent -Djava.compiler=NONE");
    execString.append(" -Xrunjdwp:transport=dt_socket,address=" + address + ",server=n,suspend=" + (suspend ? "y" : "n"));
    if (javaOptions != null) {
        execString.append(" " + javaOptions);
    }
    execString.append(" " + main);

    return DebugPlugin.parseArguments(execString.toString());
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:20,代码来源:AdvancedLaunchingConnector.java

示例15: evaluate

import org.eclipse.debug.core.DebugPlugin; //导入依赖的package包/类
public void evaluate(String expression, InvocationResult listener) {
		IExpressionManager expressionManager = DebugPlugin.getDefault().getExpressionManager();
		StackFrameModel stackFrame = getTopFrame();
		IWatchExpressionDelegate delegate = expressionManager.newWatchExpressionDelegate(stackFrame.getStackFrame().getModelIdentifier());	
		delegate.evaluateExpression(expression, stackFrame.getStackFrame(), new IWatchExpressionListener() {
			public void watchEvaluationFinished(IWatchExpressionResult result) {
				listener.valueReturn(result.getValue());
//				setChanged();
//				notifyObservers(new Event<IStackFrameModel>(Event.Type.EVALUATION, getTopFrame()));
//				try {
//					evaluationNotify();
//				} catch (DebugException e) {
//					e.printStackTrace();
//				}
			}
		});
	}
 
开发者ID:andre-santos-pt,项目名称:pandionj,代码行数:18,代码来源:RuntimeModel.java


注:本文中的org.eclipse.debug.core.DebugPlugin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。