Java 类org.eclipse.debug.core.sourcelookup.ISourceLookupDirector 实例源码

项目:gerrit-tools    文件:BranchOperationUI.java   
private ILaunchConfiguration getRunningLaunchConfiguration() {
    Set<IProject> projects = new HashSet<IProject>(
            Arrays.asList(ProjectUtil.getProjects(repository)));

    ILaunchManager launchManager = DebugPlugin.getDefault()
            .getLaunchManager();
    ILaunch[] launches = launchManager.getLaunches();
    for (ILaunch launch : launches) {
        if (launch.isTerminated())
            continue;
        ISourceLocator locator = launch.getSourceLocator();
        if (locator instanceof ISourceLookupDirector) {
            ISourceLookupDirector director = (ISourceLookupDirector) locator;
            ISourceContainer[] containers = director.getSourceContainers();
            if (isAnyProjectInSourceContainers(containers, projects))
                return launch.getLaunchConfiguration();
        }
    }
    return null;
}
项目:chromedevtools    文件:ChromiumRemoteTab.java   
private ISourceLookupDirector read(ILaunchConfiguration config) throws CoreException {
  String memento = config.getAttribute(
      ILaunchConfiguration.ATTR_SOURCE_LOCATOR_MEMENTO, (String)null);
  if (memento == null) {
    return null;
  }
  String type = config.getAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, (String)null);
  if (type == null) {
    type = config.getType().getSourceLocatorId();
  }
  ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
  ISourceLocator locator = launchManager.newSourceLocator(type);
  if (locator instanceof IPersistableSourceLocator2 == false) {
    return null;
  }
  ISourceLookupDirector director = (ISourceLookupDirector) locator;
  director.initializeFromMemento(memento, config);
  return director;
}
项目:goclipse    文件:LangSourceLookupDirector.java   
protected ISourceLookupDirector getSourceLookupDirector() {
    ISourceLookupDirector commonSourceLookupDirector = new AbstractSourceLookupDirector() {
        @Override
        public void initializeParticipants() {
        }
    };

    ArrayList2<ISourceContainer> containers = new ArrayList2<>();
    containers.add(new LangAbsolutePathSourceContainer());
    containers.add(new ProgramRelativePathSourceContainer());

    customizeDefaultSourceContainers(containers);
    commonSourceLookupDirector.setSourceContainers(containers.toArray(ISourceContainer.class));

    return commonSourceLookupDirector;
}
项目:cft    文件:CloudFoundryDebugDelegate.java   
protected void setSourceLocator(ILaunch launch) throws CoreException {
    ILaunchConfiguration configuration = launch.getLaunchConfiguration();
    if (configuration != null && launch.getSourceLocator() == null) {
        ISourceLookupDirector sourceLocator = new JavaSourceLookupDirector();
        ISourcePathComputer locator = getLaunchManager().getSourcePathComputer(SOURCE_LOCATOR);
        if (locator != null) {
            sourceLocator.setSourcePathComputer(locator); 
            sourceLocator.initializeDefaults(configuration);
            launch.setSourceLocator(sourceLocator);
        }
    }
}
项目:m2e.sourcelookup    文件:MyMvnSourceContainerBrowser.java   
private static List<IJavaProject> getPossibleAdditions0(final ISourceLookupDirector director) {
  final List<IProject> mavenProjects = new ArrayList<IProject>();
  for (final IMavenProjectFacade mavenProject : MavenPlugin.getMavenProjectRegistry().getProjects()) {
    mavenProjects.add(mavenProject.getProject());
  }

  final List<IJavaProject> javaProjects = new ArrayList<IJavaProject>();
  final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
  try {
    for (final IJavaProject javaProject : JavaCore.create(root).getJavaProjects()) {
      if (mavenProjects.contains(javaProject.getProject())) {
        javaProjects.add(javaProject);
      }
    }
  } catch (final JavaModelException e) {
    final IStatus status = new Status(IStatus.ERROR, SourceLookupPlugin.getInstance().getBundle().getSymbolicName(),
        "Can't retrieve Java projects.", e);
    SourceLookupPlugin.getInstance().getLog().log(status);
  }

  for (final ISourceContainer container : director.getSourceContainers()) {
    if (container.getType().getId().equals(MyMvnSourceContainerTypeDelegate.TYPE_ID)) {
      javaProjects.remove(((MyMvnSourceContainer) container).getJavaProject());
    }
  }

  return javaProjects;
}
项目:chromedevtools    文件:SourceNameMapperContainerPresentation.java   
public ISourceContainer[] editSourceContainers(Shell shell, ISourceLookupDirector director,
    ISourceContainer[] containers) {
  final SourceNameMapperContainer originalContainer = (SourceNameMapperContainer) containers[0];
  SourceNameMapperContainerDialog.PresetFieldValues params =
      new SourceNameMapperContainerDialog.PresetFieldValues() {
    public ISourceContainer getContainer() {
      return originalContainer.getTargetContainer();
    }
    public String getPrefix() {
      return originalContainer.getPrefix();
    }
  };

  return openDialog(shell, director, params);
}
项目:chromedevtools    文件:SourceNameMapperContainerPresentation.java   
private ISourceContainer[] openDialog(Shell shell, ISourceLookupDirector director,
    SourceNameMapperContainerDialog.PresetFieldValues params) {
  SourceNameMapperContainerDialog dialog =
      new SourceNameMapperContainerDialog(shell, director, params);
  dialog.open();
  SourceNameMapperContainerDialog.Result dialogResult = dialog.getResult();
  if (dialogResult == null) {
    return new ISourceContainer[0];
  }
  ISourceContainer result = new SourceNameMapperContainer(dialogResult.getResultPrefix(),
      dialogResult.getResultContainer());
  return new ISourceContainer[] { result };
}
项目:chromedevtools    文件:SourceNameMapperContainerDialog.java   
public SourceNameMapperContainerDialog(Shell shell, ISourceLookupDirector director,
  PresetFieldValues initialParams) {
  super(shell);
  setShellStyle(getShellStyle() | SWT.RESIZE);
  this.director = director;
  this.initialParams = initialParams;
}
项目:teavm    文件:TeaVMSourceLookupParticipant.java   
@Override
public void sourceContainersChanged(ISourceLookupDirector director) {
    delegateContainers.clear();
    ISourceContainer[] containers = director.getSourceContainers();
    for (int i = 0; i < containers.length; i++) {
        ISourceContainer container = containers[i];
        if (container.getType().getId().equals(ArchiveSourceContainer.TYPE_ID)) {
            IFile file = ((ArchiveSourceContainer)container).getFile();
            IProject project = file.getProject();
            IJavaProject javaProject = JavaCore.create(project);
            if (javaProject.exists()) {
                try {
                    IPackageFragmentRoot[] roots = javaProject.getPackageFragmentRoots();
                    for (int j = 0; j < roots.length; j++) {
                        IPackageFragmentRoot root = roots[j];
                        if (file.equals(root.getUnderlyingResource())) {
                            delegateContainers.put(container, new PackageFragmentRootSourceContainer(root));
                        } else {
                            IPath path = root.getSourceAttachmentPath();
                            if (path != null) {
                                if (file.getFullPath().equals(path)) {
                                    delegateContainers.put(container, new PackageFragmentRootSourceContainer(root));
                                }
                            }
                        }
                    }
                } catch (JavaModelException e) {
                }
            }
        }
    }
}
项目:m2e.sourcelookup    文件:MyMvnSourceContainerBrowser.java   
@Override
public boolean canAddSourceContainers(final ISourceLookupDirector director) {
  return !getPossibleAdditions0(director).isEmpty();
}
项目:chromedevtools    文件:VProjectSourceContainer.java   
public void init(ISourceLookupDirector director) {
  if (director instanceof ChromiumSourceDirector) {
    chromiumSourceDirector = (ChromiumSourceDirector) director;
  }
}
项目:chromedevtools    文件:ReverseSourceLookup.java   
public ReverseSourceLookup(ISourceLookupDirector sourceDirector) {
  this.sourceDirector = sourceDirector;
}
项目:chromedevtools    文件:SourceNameMapperContainer.java   
public void init(ISourceLookupDirector director) {
}
项目:chromedevtools    文件:SourceNameMapperContainerPresentation.java   
public ISourceContainer[] addSourceContainers(Shell shell, ISourceLookupDirector director) {
  return openDialog(shell, director, null);
}
项目:chromedevtools    文件:SourceNameMapperContainerPresentation.java   
public boolean canAddSourceContainers(ISourceLookupDirector director) {
  return true;
}
项目:chromedevtools    文件:SourceNameMapperContainerPresentation.java   
public boolean canEditSourceContainers(ISourceLookupDirector director,
    ISourceContainer[] containers) {
  return containers.length == 1;
}