org.eclipse.debug.core.model.ISourceLocator Java Examples

The following examples show how to use org.eclipse.debug.core.model.ISourceLocator. 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: GoDebugLaunchConfigurationDelegate.java    From goclipse with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected GdbLaunchDelegateExtension createGdbLaunchDelegate() {
	return new GdbLaunchDelegateExtension() {
		@Override
		protected GdbLaunch createGdbLaunch(ILaunchConfiguration configuration, String mode, ISourceLocator locator)
				throws CoreException {
			return doCreateGdbLaunch(configuration, mode, locator);
		}
		
		@Override
		protected LangDebugServicesExtensions createServicesExtensions(
				IDsfDebugServicesFactory parentServiceFactory) {
			return new GoDebugServicesExtensions(parentServiceFactory);
		};
	};
}
 
Example #2
Source File: RustDebugDelegate.java    From corrosion with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected ISourceLocator getSourceLocator(ILaunchConfiguration configuration, DsfSession session)
		throws CoreException {
	SourceLookupDirector locator = new SourceLookupDirector();
	String memento = configuration.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String) null);
	if (memento == null) {
		locator.initializeDefaults(configuration);
	} else {
		locator.initializeFromMemento(memento, configuration);
	}
	return locator;
}
 
Example #3
Source File: XtendFileHyperlink.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void linkActivated() {
  try {
    try {
      ILaunch _launch = this.getLaunch();
      ISourceLocator _sourceLocator = null;
      if (_launch!=null) {
        _sourceLocator=_launch.getSourceLocator();
      }
      final ISourceLocator l = _sourceLocator;
      boolean _matched = false;
      if (l instanceof AbstractSourceLookupDirector) {
        _matched=true;
        final Object result = ((AbstractSourceLookupDirector)l).getSourceElement(this.fileName);
        boolean _matched_1 = false;
        if (result instanceof IFile) {
          _matched_1=true;
          final IEditorPart editor = IDE.openEditor(this.workbench.getActiveWorkbenchWindow().getActivePage(), ((IFile)result));
          boolean _matched_2 = false;
          if (editor instanceof XtextEditor) {
            _matched_2=true;
            final IRegion region = ((XtextEditor)editor).getDocument().getLineInformation((this.lineNumber - 1));
            ((XtextEditor)editor).selectAndReveal(region.getOffset(), region.getLength());
          }
        }
      }
    } catch (final Throwable _t) {
      if (_t instanceof NumberFormatException) {
      } else {
        throw Exceptions.sneakyThrow(_t);
      }
    }
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
Example #4
Source File: XbaseLineBreakpoint.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
private IJavaProject computeJavaProject(IJavaStackFrame stackFrame) {
	ILaunch launch = stackFrame.getLaunch();
	if (launch == null) {
		return null;
	}
	ISourceLocator locator = launch.getSourceLocator();
	if (locator == null)
		return null;

	Object sourceElement = null;
	try {
		if (locator instanceof ISourceLookupDirector
				&& !stackFrame.isStatic()) {
			IJavaType thisType = stackFrame.getThis().getJavaType();
			if (thisType instanceof IJavaReferenceType) {
				String[] sourcePaths = ((IJavaReferenceType) thisType)
						.getSourcePaths(null);
				if (sourcePaths != null && sourcePaths.length > 0) {
					sourceElement = ((ISourceLookupDirector) locator)
							.getSourceElement(sourcePaths[0]);
				}
			}
		}
	} catch (DebugException e) {
		DebugPlugin.log(e);
	}
	if (sourceElement == null) {
		sourceElement = locator.getSourceElement(stackFrame);
	}
	
	sourceElement = Adapters.adapt(sourceElement, IJavaElement.class);
	
	if (sourceElement instanceof IJavaElement) {
		return ((IJavaElement) sourceElement).getJavaProject();
	} else if (sourceElement instanceof IResource) {
		IJavaProject project = JavaCore.create(((IResource) sourceElement)
				.getProject());
		if (project.exists()) {
			return project;
		}
	}
	return null;
}
 
Example #5
Source File: TestLaunch.java    From eclipse-extras with Eclipse Public License 1.0 4 votes vote down vote up
public TestLaunch( ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator ) {
  super( launchConfiguration, mode, locator );
}
 
Example #6
Source File: MockILaunch.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
public ISourceLocator getSourceLocator() {
  return null;
}
 
Example #7
Source File: MockILaunch.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 4 votes vote down vote up
public void setSourceLocator(ISourceLocator sourceLocator) {
}
 
Example #8
Source File: GdbLaunchDelegateExtension.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected ISourceLocator getSourceLocator(ILaunchConfiguration configuration, DsfSession session)
		throws CoreException {
	return super.getSourceLocator(configuration, session);
}
 
Example #9
Source File: AbstractLangDebugLaunchConfigurationDelegate.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected GdbLaunch createGdbLaunch(ILaunchConfiguration configuration, String mode,
		ISourceLocator locator) throws CoreException {
	return doCreateGdbLaunch(configuration, mode, locator);
}
 
Example #10
Source File: AbstractLangDebugLaunchConfigurationDelegate.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
protected abstract GdbLaunch doCreateGdbLaunch(ILaunchConfiguration configuration, String mode,
ISourceLocator locator);
 
Example #11
Source File: GoDebugLaunchConfigurationDelegate.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected GdbLaunch doCreateGdbLaunch(ILaunchConfiguration configuration, String mode, ISourceLocator locator) {
	return new GoGdbLaunch(configuration, mode, locator);
}
 
Example #12
Source File: GoGdbLaunch.java    From goclipse with Eclipse Public License 1.0 4 votes vote down vote up
protected GoGdbLaunch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator) {
	super(launchConfiguration, mode, locator);
}