本文整理汇总了Java中com.intellij.ide.projectView.impl.nodes.NamedLibraryElementNode类的典型用法代码示例。如果您正苦于以下问题:Java NamedLibraryElementNode类的具体用法?Java NamedLibraryElementNode怎么用?Java NamedLibraryElementNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NamedLibraryElementNode类属于com.intellij.ide.projectView.impl.nodes包,在下文中一共展示了NamedLibraryElementNode类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPythonSdk
import com.intellij.ide.projectView.impl.nodes.NamedLibraryElementNode; //导入依赖的package包/类
@Nullable
private static Sdk getPythonSdk(@NotNull AbstractTreeNode node) {
if (node instanceof NamedLibraryElementNode) {
final NamedLibraryElement value = ((NamedLibraryElementNode)node).getValue();
if (value != null) {
final LibraryOrSdkOrderEntry entry = value.getOrderEntry();
if (entry instanceof JdkOrderEntry) {
final Sdk sdk = ((JdkOrderEntry)entry).getJdk();
final SdkTypeId type = sdk.getSdkType();
if (type instanceof PythonSdkType) {
return sdk;
}
}
}
}
return null;
}
示例2: findLibrary
import com.intellij.ide.projectView.impl.nodes.NamedLibraryElementNode; //导入依赖的package包/类
@Nullable
private static Library findLibrary(@NotNull AnActionEvent e) {
if (isAndroidStudio()) {
Project project = e.getProject();
if (project != null) {
NamedLibraryElementNode node = findLibraryNode(e.getDataContext());
if (node != null) {
String libraryName = node.getName();
if (isNotEmpty(libraryName)) {
LibraryTable libraryTable = ProjectLibraryTable.getInstance(project);
return libraryTable.getLibraryByName(libraryName);
}
}
}
}
return null;
}
示例3: findLibraryNode
import com.intellij.ide.projectView.impl.nodes.NamedLibraryElementNode; //导入依赖的package包/类
@Nullable
private static NamedLibraryElementNode findLibraryNode(@NotNull DataContext dataContext) {
Navigatable[] navigatables = NAVIGATABLE_ARRAY.getData(dataContext);
if (navigatables != null && navigatables.length == 1) {
Navigatable navigatable = navigatables[0];
if (navigatable instanceof NamedLibraryElementNode) {
return (NamedLibraryElementNode)navigatable;
}
}
return null;
}
示例4: isJdk
import com.intellij.ide.projectView.impl.nodes.NamedLibraryElementNode; //导入依赖的package包/类
public boolean isJdk() {
if (myNode instanceof NamedLibraryElementNode) {
NamedLibraryElement value = ((NamedLibraryElementNode)myNode).getValue();
assertNotNull(value);
LibraryOrSdkOrderEntry orderEntry = value.getOrderEntry();
if (orderEntry instanceof JdkOrderEntry) {
Sdk sdk = ((JdkOrderEntry)orderEntry).getJdk();
return sdk.getSdkType() instanceof JavaSdk;
}
}
return false;
}
示例5: findLibraryForAction
import com.intellij.ide.projectView.impl.nodes.NamedLibraryElementNode; //导入依赖的package包/类
@Nullable
public static Library findLibraryForAction(@NotNull AnActionEvent e) {
Project project = e.getProject();
if (project != null) {
NamedLibraryElementNode node = findLibraryNode(e.getDataContext());
if (node != null) {
String libraryName = node.getName();
if (StringUtil.isNotEmpty(libraryName)) {
LibraryTable libraryTable = ProjectLibraryTable.getInstance(project);
return libraryTable.getLibraryByName(libraryName);
}
}
}
return null;
}
示例6: findLibraryNode
import com.intellij.ide.projectView.impl.nodes.NamedLibraryElementNode; //导入依赖的package包/类
@Nullable
private static NamedLibraryElementNode findLibraryNode(@NotNull DataContext dataContext) {
Navigatable[] navigatables = CommonDataKeys.NAVIGATABLE_ARRAY.getData(dataContext);
if (navigatables != null && navigatables.length == 1) {
Navigatable navigatable = navigatables[0];
if (navigatable instanceof NamedLibraryElementNode) {
return (NamedLibraryElementNode) navigatable;
}
}
return null;
}
示例7: modify
import com.intellij.ide.projectView.impl.nodes.NamedLibraryElementNode; //导入依赖的package包/类
@NotNull
@Override
public Collection<AbstractTreeNode> modify(@NotNull AbstractTreeNode parent, @NotNull Collection<AbstractTreeNode> children, ViewSettings settings) {
final Project project = parent.getProject();
if (parent instanceof NamedLibraryElementNode) {
List<AbstractTreeNode> newChildren = new ArrayList<AbstractTreeNode>();
for (final AbstractTreeNode child : children) {
if (child instanceof PsiDirectoryNode) {
newChildren.add(new PsiDirectoryNode(project, ((PsiDirectoryNode)child).getValue(), ((PsiDirectoryNode)child).getSettings()){
@Override
protected void updateImpl(PresentationData data) {
super.updateImpl(data);
final VirtualFile file = ((PsiDirectoryNode)child).getVirtualFile();
if (file != null) {
final VirtualFile fileParent = file.getParent();
if (fileParent != null)
data.setPresentableText(fileParent.getName());
}
data.setLocationString("");
}
});
}
else {
newChildren.add(child);
}
}
return newChildren;
}
return children;
}