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


Java IBreakpoint类代码示例

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


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

示例1: setMarkerAttibutes

import org.eclipse.debug.core.model.IBreakpoint; //导入依赖的package包/类
/**
 * Sets attributes for the given {@link IMarker}.
 * 
 * @param marker
 *            the {@link IMarker}
 * @param resource
 *            the {@link IFile} containing the mode
 * @param instruction
 *            the {@link EObject} representing the instruction
 * @param persistent
 *            should be persisted
 * @throws CoreException
 *             if attributes can't be set
 */
protected void setMarkerAttibutes(final IMarker marker, IFile resource, EObject instruction,
		boolean persistent) throws CoreException {
	final IItemLabelProvider provider = (IItemLabelProvider)ADAPTER_FACTORY.adapt(instruction,
			IItemLabelProvider.class);
	marker.setAttribute(IBreakpoint.ENABLED, true);
	marker.setAttribute(IBreakpoint.PERSISTED, persistent);
	marker.setAttribute(IBreakpoint.ID, getModelIdentifier());
	marker.setAttribute(EValidator.URI_ATTRIBUTE, EcoreUtil.getURI(instruction).toString());
	final String instructionText = provider.getText(instruction);
	marker.setAttribute(IMarker.MESSAGE, "DSL Breakpoint: " + resource.getFullPath() + " ["
			+ instructionText + "]");
	try {
		marker.setAttribute(IMAGE_ATTRIBUTE, toAttribute(provider.getImage(instruction)));
	} catch (IOException e) {
		Activator.getDefault().error(e);
	}
	marker.setAttribute(TEXT_ATTRIBUTE, instructionText);
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:33,代码来源:DSLBreakpoint.java

示例2: breakpointChanged

import org.eclipse.debug.core.model.IBreakpoint; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.debug.core.IBreakpointListener#breakpointChanged(org.eclipse.debug.core.model.IBreakpoint,
 *      org.eclipse.core.resources.IMarkerDelta)
 */
public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
	if (supportsBreakpoint(breakpoint)) {
		try {
			final URI uri = ((DSLBreakpoint)breakpoint).getURI();
			final IMarker marker = breakpoint.getMarker();
			for (Entry<String, Object> entry : delta.getAttributes().entrySet()) {
				final Object markerValue = marker.getAttribute(entry.getKey());
				final Object deltaValue = entry.getValue();
				if ((markerValue != null && !markerValue.equals(deltaValue)) || (deltaValue != null
						&& !deltaValue.equals(markerValue))) {
					if (delta.getKind() == IResourceDelta.ADDED) {
						factory.getDebugger().handleEvent(new ChangeBreakPointRequest(uri, entry.getKey(),
								(Serializable)deltaValue));
					} else {
						factory.getDebugger().handleEvent(new ChangeBreakPointRequest(uri, entry.getKey(),
								(Serializable)markerValue));
					}
				}
			}
		} catch (CoreException e) {
			Activator.getDefault().error(e);
		}
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:31,代码来源:DSLDebugTargetAdapter.java

示例3: getBreakpoints

import org.eclipse.debug.core.model.IBreakpoint; //导入依赖的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

示例4: getBreakpoint

import org.eclipse.debug.core.model.IBreakpoint; //导入依赖的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

示例5: fireLabelProviderChanged

import org.eclipse.debug.core.model.IBreakpoint; //导入依赖的package包/类
/**
 * Fires {@link LabelProviderChangedEvent} for the given {@link DSLBreakpoint}.
 * 
 * @param breakpoint
 *            the {@link DSLBreakpoint}
 */
protected void fireLabelProviderChanged(IBreakpoint breakpoint) {
	if (resourceSet != null) {
		final Object instruction = getElement(resourceSet, (DSLBreakpoint)breakpoint);
		if (instruction != null) {
			final LabelProviderChangedEvent event = new LabelProviderChangedEvent(this, instruction);
			Display.getDefault().asyncExec(new Runnable() {

				/**
				 * {@inheritDoc}
				 * 
				 * @see java.lang.Runnable#run()
				 */
				public void run() {
					fireLabelProviderChanged(event);
				}
			});
		}
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:26,代码来源:DSLLabelDecorator.java

示例6: breakpointManagerEnablementChanged

import org.eclipse.debug.core.model.IBreakpoint; //导入依赖的package包/类
/**
 * When the breakpoint manager disables, remove all registered breakpoints
 * requests from the VM. When it enables, reinstall them.
 */
@Override
public void breakpointManagerEnablementChanged(boolean enabled) {
	try {
		IBreakpoint[] breakpoints = getBreakpointManager().getBreakpoints(getModelIdentifier());
		for (IBreakpoint breakpoint : breakpoints) {
			if (supportsBreakpoint(breakpoint)) {
				if (enabled) {
					addBreakpointToMap(breakpoint);
				} else {
					deleteBreakpointFromMap(breakpoint);
				}
			}
		}
		sendBreakpoints();
	} catch (CoreException e) {
		// TODO
		e.printStackTrace();
	}
}
 
开发者ID:tracymiranda,项目名称:dsp4e,代码行数:24,代码来源:DSPDebugTarget.java

示例7: addBreakpointToMap

import org.eclipse.debug.core.model.IBreakpoint; //导入依赖的package包/类
private void addBreakpointToMap(IBreakpoint breakpoint) throws CoreException {
	Assert.isTrue(supportsBreakpoint(breakpoint) && breakpoint instanceof ILineBreakpoint);
	if (breakpoint instanceof ILineBreakpoint) {
		ILineBreakpoint lineBreakpoint = (ILineBreakpoint) breakpoint;
		IResource resource = lineBreakpoint.getMarker().getResource();
		IPath location = resource.getLocation();
		String path = location.toOSString();
		String name = location.lastSegment();
		int lineNumber = lineBreakpoint.getLineNumber();

		Source source = new Source().setName(name).setPath(path);

		List<SourceBreakpoint> sourceBreakpoints = targetBreakpoints.computeIfAbsent(source,
				s -> new ArrayList<>());
		sourceBreakpoints.add(new SourceBreakpoint().setLine(lineNumber));
	}
}
 
开发者ID:tracymiranda,项目名称:dsp4e,代码行数:18,代码来源:DSPDebugTarget.java

示例8: deleteBreakpointFromMap

import org.eclipse.debug.core.model.IBreakpoint; //导入依赖的package包/类
private void deleteBreakpointFromMap(IBreakpoint breakpoint) throws CoreException {
	Assert.isTrue(supportsBreakpoint(breakpoint) && breakpoint instanceof ILineBreakpoint);
	if (breakpoint instanceof ILineBreakpoint) {
		ILineBreakpoint lineBreakpoint = (ILineBreakpoint) breakpoint;
		IResource resource = lineBreakpoint.getMarker().getResource();
		IPath location = resource.getLocation();
		String path = location.toOSString();
		String name = location.lastSegment();
		int lineNumber = lineBreakpoint.getLineNumber();
		for (Entry<Source, List<SourceBreakpoint>> entry : targetBreakpoints.entrySet()) {
			Source source = entry.getKey();
			if (Objects.equals(name, source.name) && Objects.equals(path, source.path)) {
				List<SourceBreakpoint> bps = entry.getValue();
				for (Iterator<SourceBreakpoint> iterator = bps.iterator(); iterator.hasNext();) {
					SourceBreakpoint sourceBreakpoint = (SourceBreakpoint) iterator.next();
					if (Objects.equals(lineNumber, sourceBreakpoint.line)) {
						iterator.remove();
					}
				}
			}
		}
	}
}
 
开发者ID:tracymiranda,项目名称:dsp4e,代码行数:24,代码来源:DSPDebugTarget.java

示例9: toggleLineBreakpoints

import org.eclipse.debug.core.model.IBreakpoint; //导入依赖的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

示例10: createJimpleMarker

import org.eclipse.debug.core.model.IBreakpoint; //导入依赖的package包/类
private IMarker createJimpleMarker(IMarker marker) throws CoreException {
	String project = (String) marker.getAttribute("Jimple.project");
	String file = (String) marker.getAttribute("Jimple.file");
	IFile jimpleFile = getFile(project, file);

	IMarker jimpleMarker = null;
	IMarker[] markers = jimpleFile.findMarkers(IBreakpoint.BREAKPOINT_MARKER, true, IResource.DEPTH_INFINITE);
	if(markers != null) {
		List<IMarker> jimpleBreakpoints = filterJimpleChildBreakpoints(Arrays.asList(markers));
		if(!jimpleBreakpoints.isEmpty()) {
			jimpleMarker = jimpleBreakpoints.get(0);
		} else {
			jimpleMarker = jimpleFile.createMarker(IBreakpoint.BREAKPOINT_MARKER);
		}
	} else {
		jimpleMarker = jimpleFile.createMarker(IBreakpoint.BREAKPOINT_MARKER);
	}

	jimpleMarker.setAttribute(IMarker.LINE_NUMBER, marker.getAttribute("Jimple." + IMarker.LINE_NUMBER));
	jimpleMarker.setAttribute("Jimple.unit.charStart", marker.getAttribute("Jimple.unit.charStart"));
	jimpleMarker.setAttribute("Jimple.unit.charEnd", marker.getAttribute("Jimple.unit.charEnd"));
	jimpleMarker.setAttribute("Jimple.unit.fqn", marker.getAttribute("Jimple.unit.fqn"));
	jimpleMarker.setAttribute("Jimple.project", marker.getAttribute("Jimple.project"));
	jimpleMarker.setAttribute("Jimple.file", marker.getAttribute("Jimple.file"));
	return jimpleMarker;
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:27,代码来源:JimpleBreakpointManager.java

示例11: addBreakpoint

import org.eclipse.debug.core.model.IBreakpoint; //导入依赖的package包/类
void addBreakpoint(IResource resource, IDocument document, int linenumber) throws CoreException {
	IBreakpoint bp = lineBreakpointExists(resource, linenumber);
	if(bp != null) {
		DebugPlugin.getDefault().getBreakpointManager().removeBreakpoint(bp, true);
	}
	int charstart = -1, charend = -1;
	try {
		IRegion line = document.getLineInformation(linenumber - 1);
		charstart = line.getOffset();
		charend = charstart + line.getLength();
	}
	catch (BadLocationException ble) {}
	HashMap<String, String> attributes = new HashMap<String, String>();
	attributes.put(IJavaScriptBreakpoint.TYPE_NAME, null);
	attributes.put(IJavaScriptBreakpoint.SCRIPT_PATH, resource.getFullPath().makeAbsolute().toString());
	attributes.put(IJavaScriptBreakpoint.ELEMENT_HANDLE, null);
	JavaScriptDebugModel.createLineBreakpoint(resource, linenumber, charstart, charend, attributes, true);
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:19,代码来源:ToggleBreakpointAdapter.java

示例12: lineBreakpointExists

import org.eclipse.debug.core.model.IBreakpoint; //导入依赖的package包/类
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;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:18,代码来源:ToggleBreakpointAdapter.java

示例13: findEclipseLineBreakpoint

import org.eclipse.debug.core.model.IBreakpoint; //导入依赖的package包/类
private MontoLineBreakpoint findEclipseLineBreakpoint(Breakpoint breakpoint) {
  if (breakpoint != null) {
    IBreakpoint[] eclipseBreakpoints =
        DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(Activator.PLUGIN_ID);

    for (IBreakpoint eclipseBreakpoint : eclipseBreakpoints) {
      if (eclipseBreakpoint instanceof MontoLineBreakpoint) {
        MontoLineBreakpoint eclipseMontoBreakpoint = (MontoLineBreakpoint) eclipseBreakpoint;
        try {
          if (eclipseMontoBreakpoint.getSource().equals(breakpoint.getSource())
              && eclipseMontoBreakpoint.getLineNumber() == breakpoint.getLineNumber()) {
            return eclipseMontoBreakpoint;
          }
        } catch (DebugException ignored) {
        }
      }
    }
  }
  return null;
}
 
开发者ID:monto-editor,项目名称:monto-eclipse,代码行数:21,代码来源:MontoDebugTarget.java

示例14: breakpointRemoved

import org.eclipse.debug.core.model.IBreakpoint; //导入依赖的package包/类
@Override
public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) {
	if (this.isTerminated()) {
		return;
	}
	try {
		if (breakpoint instanceof BfWatchpoint) {
			BfWatchpoint wp = (BfWatchpoint) breakpoint;
			this.process.getInterpreter().removeWatchpoint(wp);
		}
		BfBreakpoint bp = this.getValidBreakpoint(breakpoint);
		if (bp == null) {
			return;
		}
		int location = bp.getCharStart();
		this.process.getInterpreter().removeBreakpoint(location);
		this.removeInstalledBreakpoint(bp);
	}
	catch (CoreException ex) {
		DbgActivator.getDefault().logError("Breakpoint could not be added", ex);
	}
}
 
开发者ID:RichardBirenheide,项目名称:brainfuck,代码行数:23,代码来源:BfDebugTarget.java

示例15: ChromiumLineBreakpoint

import org.eclipse.debug.core.model.IBreakpoint; //导入依赖的package包/类
/**
 * Constructs a line breakpoint on the given resource at the given line number
 * (line number is 1-based).
 *
 * @param resource file on which to set the breakpoint
 * @param lineNumber 1-based line number of the breakpoint
 * @throws CoreException if unable to create the breakpoint
 */
public ChromiumLineBreakpoint(final IResource resource, final int lineNumber,
    final String modelId) throws CoreException {
  IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
    public void run(IProgressMonitor monitor) throws CoreException {
      IMarker marker = resource.createMarker(ChromiumDebugPlugin.BP_MARKER);
      setMarker(marker);
      marker.setAttribute(IBreakpoint.ENABLED, Boolean.TRUE);
      marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
      marker.setAttribute(IBreakpoint.ID, modelId);
      marker.setAttribute(IMarker.MESSAGE, NLS.bind(
          Messages.JsLineBreakpoint_MessageMarkerFormat, resource.getName(), lineNumber));
    }
  };
  run(getMarkerRule(resource), runnable);
}
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:24,代码来源:ChromiumLineBreakpoint.java


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