本文整理汇总了Java中com.intellij.openapi.util.Trinity.getFirst方法的典型用法代码示例。如果您正苦于以下问题:Java Trinity.getFirst方法的具体用法?Java Trinity.getFirst怎么用?Java Trinity.getFirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.openapi.util.Trinity
的用法示例。
在下文中一共展示了Trinity.getFirst方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareRenaming
import com.intellij.openapi.util.Trinity; //导入方法依赖的package包/类
public void prepareRenaming(PsiElement element, String newName, Map<PsiElement, String> allRenames) {
final AntDomElement antElement = convertToAntDomElement(element);
String propName = null;
if (antElement instanceof AntDomProperty) {
propName = ((AntDomProperty)antElement).getName().getStringValue();
}
else if (antElement instanceof AntDomAntCallParam) {
propName = ((AntDomAntCallParam)antElement).getName().getStringValue();
}
if (propName != null) {
final AntDomProject contextProject = antElement.getContextAntProject();
final List<PsiElement> additional = AntCallParamsFinder.resolve(contextProject, propName);
for (PsiElement psiElement : additional) {
allRenames.put(psiElement, newName);
}
if (antElement instanceof AntDomAntCallParam) {
final Trinity<PsiElement, Collection<String>, PropertiesProvider> result = PropertyResolver.resolve(contextProject, propName, null);
if (result.getFirst() != null) {
allRenames.put(result.getFirst(), newName);
}
}
}
}
示例2: resolve
import com.intellij.openapi.util.Trinity; //导入方法依赖的package包/类
@NotNull
public ResolveResult[] resolve(@NotNull AntDomPropertyReference antDomPropertyReference, boolean incompleteCode) {
final List<ResolveResult> result = new ArrayList<ResolveResult>();
final AntDomProject project = antDomPropertyReference.myInvocationContextElement.getParentOfType(AntDomProject.class, true);
if (project != null) {
final AntDomProject contextAntProject = project.getContextAntProject();
final String propertyName = antDomPropertyReference.getCanonicalText();
final Trinity<PsiElement,Collection<String>,PropertiesProvider> resolved =
PropertyResolver.resolve(contextAntProject, propertyName, antDomPropertyReference.myInvocationContextElement);
final PsiElement mainDeclaration = resolved.getFirst();
if (mainDeclaration != null) {
result.add(new MyResolveResult(mainDeclaration, resolved.getThird()));
}
final List<PsiElement> antCallParams = AntCallParamsFinder.resolve(project, propertyName);
for (PsiElement param : antCallParams) {
result.add(new MyResolveResult(param, null));
}
}
return ContainerUtil.toArray(result, new ResolveResult[result.size()]);
}
示例3: packageFile
import com.intellij.openapi.util.Trinity; //导入方法依赖的package包/类
public static void packageFile(@NotNull VirtualFile file, @NotNull Project project, final Artifact[] artifacts,
final boolean packIntoArchives) throws IOException {
LOG.debug("Start packaging file: " + file.getPath());
final Collection<Trinity<Artifact, PackagingElementPath, String>> items = ArtifactUtil.findContainingArtifactsWithOutputPaths(file, project, artifacts);
File ioFile = VfsUtilCore.virtualToIoFile(file);
for (Trinity<Artifact, PackagingElementPath, String> item : items) {
final Artifact artifact = item.getFirst();
final String outputPath = artifact.getOutputPath();
if (!StringUtil.isEmpty(outputPath)) {
PackageFileWorker worker = new PackageFileWorker(ioFile, item.getThird(), packIntoArchives);
LOG.debug(" package to " + outputPath);
worker.packageFile(outputPath, item.getSecond().getParents());
}
}
}