當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。