Search in sources :

Example 1 with JavaBreakpointConditionEditor

use of org.eclipse.jdt.debug.ui.breakpoints.JavaBreakpointConditionEditor in project xtext-eclipse by eclipse.

the class ConditionPage method createTypeSpecificEditors.

@Override
protected void createTypeSpecificEditors(Composite parent) {
    try {
        IJavaBreakpoint breakpoint = getBreakpoint();
        IMarker marker = breakpoint.getMarker();
        Object sourceUri = marker.getAttribute(StratumBreakpointAdapterFactory.ORG_ECLIPSE_XTEXT_XBASE_SOURCE_URI);
        if (sourceUri != null) {
            setTitle("Condition");
            final JavaBreakpointConditionEditor editor = new JavaBreakpointConditionEditor();
            editor.createControl(parent);
            editor.addPropertyListener(new IPropertyListener() {

                @Override
                public void propertyChanged(Object source, int propId) {
                    IStatus status = editor.getStatus();
                    if (status.isOK()) {
                        if (fPrevMessage != null) {
                            removeErrorMessage(fPrevMessage);
                            fPrevMessage = null;
                        }
                    } else {
                        fPrevMessage = status.getMessage();
                        addErrorMessage(fPrevMessage);
                    }
                }
            });
            URI uri = URI.createURI(String.valueOf(sourceUri));
            JavaBreakPointProvider breakPointProvider = registry.getResourceServiceProvider(uri).get(JavaBreakPointProvider.class);
            editor.setInput(breakPointProvider.getBreakpointWithJavaLocation((IJavaStratumLineBreakpoint) breakpoint));
            // set this editor only if it was correctly initialized
            this.editor = editor;
        }
    } catch (CoreException e) {
        setErrorMessage(e.getMessage());
    }
}
Also used : IJavaStratumLineBreakpoint(org.eclipse.jdt.debug.core.IJavaStratumLineBreakpoint) IJavaBreakpoint(org.eclipse.jdt.debug.core.IJavaBreakpoint) IStatus(org.eclipse.core.runtime.IStatus) CoreException(org.eclipse.core.runtime.CoreException) JavaBreakpointConditionEditor(org.eclipse.jdt.debug.ui.breakpoints.JavaBreakpointConditionEditor) IMarker(org.eclipse.core.resources.IMarker) URI(org.eclipse.emf.common.util.URI) IPropertyListener(org.eclipse.ui.IPropertyListener) IJavaStratumLineBreakpoint(org.eclipse.jdt.debug.core.IJavaStratumLineBreakpoint) IJavaBreakpoint(org.eclipse.jdt.debug.core.IJavaBreakpoint)

Aggregations

IMarker (org.eclipse.core.resources.IMarker)1 CoreException (org.eclipse.core.runtime.CoreException)1 IStatus (org.eclipse.core.runtime.IStatus)1 URI (org.eclipse.emf.common.util.URI)1 IJavaBreakpoint (org.eclipse.jdt.debug.core.IJavaBreakpoint)1 IJavaStratumLineBreakpoint (org.eclipse.jdt.debug.core.IJavaStratumLineBreakpoint)1 JavaBreakpointConditionEditor (org.eclipse.jdt.debug.ui.breakpoints.JavaBreakpointConditionEditor)1 IPropertyListener (org.eclipse.ui.IPropertyListener)1