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


Java ISourceContainer类代码示例

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


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

示例1: findSourceElement

import org.eclipse.debug.core.sourcelookup.ISourceContainer; //导入依赖的package包/类
/**
 * Given a source name info, search the associated source file or class file from the source container list.
 *
 * @param sourcePath
 *                  the target source name (e.g. com\microsoft\java\debug\xxx.java).
 * @param containers
 *                  the source container list.
 * @return the associated source file or class file.
 */
public static Object findSourceElement(String sourcePath, ISourceContainer[] containers) {
    if (containers == null) {
        return null;
    }
    for (ISourceContainer container : containers) {
        try {
            Object[] objects = container.findSourceElements(sourcePath);
            if (objects.length > 0 && (objects[0] instanceof IResource || objects[0] instanceof IClassFile)) {
                return objects[0];
            }
        } catch (CoreException e) {
            // do nothing.
        }
    }
    return null;
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:26,代码来源:JdtUtils.java

示例2: findProject

import org.eclipse.debug.core.sourcelookup.ISourceContainer; //导入依赖的package包/类
/**
 * Given a stack frame, find the target project that the associated source file belongs to.
 *
 * @param stackFrame
 *                  the stack frame.
 * @param containers
 *                  the source container list.
 * @return the context project.
 */
public static IProject findProject(StackFrame stackFrame, ISourceContainer[] containers) {
    Location location = stackFrame.location();
    try {
        Object sourceElement = findSourceElement(location.sourcePath(), containers);
        if (sourceElement instanceof IResource) {
            return ((IResource) sourceElement).getProject();
        } else if (sourceElement instanceof IClassFile) {
            IJavaProject javaProject = ((IClassFile) sourceElement).getJavaProject();
            if (javaProject != null) {
                return javaProject.getProject();
            }
        }
    } catch (AbsentInformationException e) {
        // When the compiled .class file doesn't contain debug source information, return null.
    }
    return null;
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:27,代码来源:JdtUtils.java

示例3: computeSourceContainers

import org.eclipse.debug.core.sourcelookup.ISourceContainer; //导入依赖的package包/类
public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor)
		throws CoreException {
	List<IRuntimeClasspathEntry> entries = new ArrayList<IRuntimeClasspathEntry>();

	IRuntimeClasspathEntry jreEntry = JavaRuntime.computeJREEntry(configuration);
	if (jreEntry != null) {
		entries.add(jreEntry);
	}

	String projectName = configuration.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
	
	if (projectName == null) {
		return null;
	}

	for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
		IJavaProject javaProject = JavaCore.create(project);
		if (javaProject != null && javaProject.isOpen() && ("".equals(projectName) || projectName.equals(javaProject.getElementName()))) { //$NON-NLS-1$
			entries.add(JavaRuntime.newDefaultProjectClasspathEntry(javaProject));
		}
	}

	IRuntimeClasspathEntry[] resolved = JavaRuntime.resolveSourceLookupPath( //
			entries.toArray(new IRuntimeClasspathEntry[entries.size()]), configuration);
	return JavaRuntime.getSourceContainers(resolved);
}
 
开发者ID:eclipse,项目名称:cft,代码行数:27,代码来源:CloudFoundryDebugSourceLocator.java

示例4: fromJavaRuntimeResolver

import org.eclipse.debug.core.sourcelookup.ISourceContainer; //导入依赖的package包/类
private ISourceContainer[] fromJavaRuntimeResolver() throws CoreException {
  for (final IClasspathEntry cpe : jp.getRawClasspath()) {
    if (IClasspathEntry.CPE_CONTAINER == cpe.getEntryKind() && //
        IClasspathManager.CONTAINER_ID.equals(cpe.getPath().toString())) {
      final IRuntimeClasspathEntry newRuntimeContainerClasspathEntry = JavaRuntime.newRuntimeContainerClasspathEntry(cpe.getPath(),
          IRuntimeClasspathEntry.USER_CLASSES, jp);

      final IRuntimeClasspathEntry[] resolveRuntimeClasspathEntry = JavaRuntime.resolveRuntimeClasspathEntry(
          newRuntimeContainerClasspathEntry, jp);

      // there is only one maven2 classpath container in a project return
      return JavaRuntime.getSourceContainers(resolveRuntimeClasspathEntry);
    }
  }

  return new ISourceContainer[] {};
}
 
开发者ID:bjmi,项目名称:m2e.sourcelookup,代码行数:18,代码来源:MyMvnSourceContainer.java

示例5: fromMavenSourcePathProvider

import org.eclipse.debug.core.sourcelookup.ISourceContainer; //导入依赖的package包/类
private ISourceContainer[] fromMavenSourcePathProvider() throws CoreException {

    final IRuntimeClasspathEntry mavenEntry = JavaRuntime.newRuntimeContainerClasspathEntry(new Path(IClasspathManager.CONTAINER_ID),
        IRuntimeClasspathEntry.USER_CLASSES);

    final ILaunchConfiguration launchConfiguration = getDirector().getLaunchConfiguration();
    // final ILaunchConfigurationWorkingCopy wc = launchConfiguration.getWorkingCopy();
    // wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, getProjectName());
    // final ILaunchConfiguration doSave = wc.doSave();
    final ILaunchConfiguration javaProjectLaunchConfiguration = new JavaProjectLaunchConfiguration(launchConfiguration, this);

    final IRuntimeClasspathEntry[] resolved = mavenRuntimeClasspathProvider.resolveClasspath(new IRuntimeClasspathEntry[] {
      mavenEntry
    }, javaProjectLaunchConfiguration);

    // final IRuntimeClasspathEntry[] entries = JavaRuntime.computeUnresolvedSourceLookupPath(doSave);
    // final IRuntimeClasspathEntry[] resolved = JavaRuntime.resolveSourceLookupPath(entries, doSave);

    return JavaRuntime.getSourceContainers(resolved);
  }
 
开发者ID:bjmi,项目名称:m2e.sourcelookup,代码行数:21,代码来源:MyMvnSourceContainer.java

示例6: getRunningLaunchConfiguration

import org.eclipse.debug.core.sourcelookup.ISourceContainer; //导入依赖的package包/类
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;
}
 
开发者ID:Genuitec,项目名称:gerrit-tools,代码行数:21,代码来源:BranchOperationUI.java

示例7: isAnyProjectInSourceContainers

import org.eclipse.debug.core.sourcelookup.ISourceContainer; //导入依赖的package包/类
private boolean isAnyProjectInSourceContainers(
		ISourceContainer[] containers, Set<IProject> projects) {
	for (ISourceContainer container : containers) {
		if (container instanceof ProjectSourceContainer) {
			ProjectSourceContainer projectContainer = (ProjectSourceContainer) container;
			if (projects.contains(projectContainer.getProject()))
				return true;
		}
		try {
			boolean found = isAnyProjectInSourceContainers(
					container.getSourceContainers(), projects);
			if (found)
				return true;
		} catch (CoreException e) {
			// Ignore the child source containers, continue search
		}
	}
	return false;
}
 
开发者ID:Genuitec,项目名称:gerrit-tools,代码行数:20,代码来源:BranchOperationUI.java

示例8: findSourceElements

import org.eclipse.debug.core.sourcelookup.ISourceContainer; //导入依赖的package包/类
@Override
Object[] findSourceElements(Object object, LookupParticipant.SuperClassAccess superClass)
    throws CoreException {
  ArrayList<Object> result = new ArrayList<Object>();
  JavascriptVmEmbedder vmEmbedder =
      superClass.getChromiumSourceDirector().javascriptVmEmbedder;
  ScriptNameManipulator.FilePath scriptName =
      getParsedScriptFileName(object, vmEmbedder.getScriptNameManipulator());
  if (scriptName != null) {
    for (ISourceContainer container : superClass.getSourceContainers()) {
      try {
        findSourceElements(container, object, scriptName, result);
      } catch (CoreException e) {
        ChromiumDebugPlugin.log(e);
        continue;
      }
      // If one container returned one file -- that's a single uncompromised result.
      IFile oneFile = getSimpleResult(result);
      if (oneFile != null) {
        return new Object[] { oneFile };
      }
    }
  }
  return result.toArray();
}
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:26,代码来源:ChromiumSourceDirector.java

示例9: tryForContainer

import org.eclipse.debug.core.sourcelookup.ISourceContainer; //导入依赖的package包/类
private VmResourceId tryForContainer(IFile sourceFile, ISourceContainer container)
    throws CoreException {
  if (container.isComposite() && isSupportedCompositeContainer(container)) {
    ISourceContainer[] subContainers = container.getSourceContainers();
    for (ISourceContainer subContainer : subContainers) {
      VmResourceId res = tryForContainer(sourceFile, subContainer);
      if (res != null) {
        return res;
      }
    }
    return null;
  } else if (container instanceof VProjectSourceContainer) {
    VProjectSourceContainer projectSourceContainer = (VProjectSourceContainer) container;
    return projectSourceContainer.findScriptId(sourceFile);
  } else {
    String name = tryForNonVirtualContainer(sourceFile, container);
    if (name == null) {
      return null;
    }
    return new VmResourceId(name, null);
  }
}
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:23,代码来源:ReverseSourceLookup.java

示例10: createSourceContainer

import org.eclipse.debug.core.sourcelookup.ISourceContainer; //导入依赖的package包/类
public ISourceContainer createSourceContainer(String memento) throws CoreException {
  MementoFormat.Parser parser = new MementoFormat.Parser(memento);
  String prefix;
  String typeId;
  String subContainerMemento;
  try {
    prefix = parser.nextComponent();
    typeId = parser.nextComponent();
    subContainerMemento = parser.nextComponent();
  } catch (MementoFormat.ParserException e) {
    throw new CoreException(new Status(IStatus.ERROR,
        ChromiumDebugPlugin.PLUGIN_ID, "Failed to parse memento", e)); //$NON-NLS-1$
  }
  ISourceContainerType subContainerType =
      DebugPlugin.getDefault().getLaunchManager().getSourceContainerType(typeId);
  ISourceContainer subContainer = subContainerType.createSourceContainer(subContainerMemento);
  return new SourceNameMapperContainer(prefix, subContainer);
}
 
开发者ID:jbosstools,项目名称:chromedevtools,代码行数:19,代码来源:SourceNameMapperContainer.java

示例11: getSourcePathComputer

import org.eclipse.debug.core.sourcelookup.ISourceContainer; //导入依赖的package包/类
@Override
public ISourcePathComputer getSourcePathComputer() {
	ISourcePathComputer sourcePathComputer = super.getSourcePathComputer();
	if(sourcePathComputer != null) {
		return sourcePathComputer;
	}
	
	return new ISourcePathComputer() {
		
		LangSourcePathComputer langSourcePathComputer = new LangSourcePathComputer();
		
		@Override
		public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor)
				throws CoreException {
			return langSourcePathComputer.computeSourceContainers(configuration, monitor);
		}
		
		@Override
		public String getId() {
			return LangDebug.LANG_SOURCE_LOOKUP_DIRECTOR;
		}
	};
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:24,代码来源:LangSourceLookupDirector.java

示例12: computeSourceContainers

import org.eclipse.debug.core.sourcelookup.ISourceContainer; //导入依赖的package包/类
@Override
public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor)
		throws CoreException {
	ISourceContainer[] common = getSourceLookupDirector().getSourceContainers();
	ISourceContainer[] containers = new ISourceContainer[common.length];
	
	for (int i = 0; i < common.length; i++) {
		ISourceContainer container = common[i];
		ISourceContainerType type = container.getType();
		// Clone the container to make sure that the original can be safely disposed.

		if(container instanceof AbsolutePathSourceContainer) {
			// LANG: Ensure our modifications are propagated.
			container = new LangAbsolutePathSourceContainer();
		} else {
			container = type.createSourceContainer(type.getMemento(container));
		}
		containers[i] = container;
	}
	return containers;
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:22,代码来源:LangSourceLookupDirector.java

示例13: getSourceLookupDirector

import org.eclipse.debug.core.sourcelookup.ISourceContainer; //导入依赖的package包/类
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;
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:17,代码来源:LangSourceLookupDirector.java

示例14: getSourceContainers

import org.eclipse.debug.core.sourcelookup.ISourceContainer; //导入依赖的package包/类
/**
 * Compute the possible source containers that the specified project could be associated with.
 * <p>
 * If the project name is specified, it will put the source containers parsed from the specified project's
 * classpath entries in the front of the result, then the other projects at the same workspace.
 * </p>
 * <p>
 * Otherwise, just loop every projects at the current workspace and combine the parsed source containers directly.
 * </p>
 * @param projectName
 *                  the project name.
 * @return the possible source container list.
 */
public static ISourceContainer[] getSourceContainers(String projectName) {
    Set<ISourceContainer> containers = new LinkedHashSet<>();
    List<IProject> projects = new ArrayList<>();

    // If the project name is specified, firstly compute the source containers from the specified project's
    // classpath entries so that they can be placed in the front of the result.
    IProject targetProject = JdtUtils.getProject(projectName);
    if (targetProject != null) {
        projects.add(targetProject);
    }

    List<IProject> workspaceProjects = Arrays.asList(ResourcesPlugin.getWorkspace().getRoot().getProjects());
    projects.addAll(workspaceProjects);

    Set<IRuntimeClasspathEntry> calculated = new LinkedHashSet<>();

    projects.stream().distinct().map(project -> JdtUtils.getJavaProject(project))
        .filter(javaProject -> javaProject != null && javaProject.exists())
        .forEach(javaProject -> {
            // Add source containers associated with the project's runtime classpath entries.
            containers.addAll(Arrays.asList(getSourceContainers(javaProject, calculated)));
            // Add source containers associated with the project's source folders.
            containers.add(new JavaProjectSourceContainer(javaProject));
        });

    return containers.toArray(new ISourceContainer[0]);
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:41,代码来源:JdtUtils.java

示例15: getSourceContainers

import org.eclipse.debug.core.sourcelookup.ISourceContainer; //导入依赖的package包/类
private synchronized ISourceContainer[] getSourceContainers() {
    if (sourceContainers == null) {
        sourceContainers = JdtUtils.getSourceContainers((String) options.get(Constants.PROJECTNAME));
    }

    return sourceContainers;
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:8,代码来源:JdtSourceLookUpProvider.java


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