本文整理汇总了Java中com.intellij.ide.projectView.impl.nodes.NamedLibraryElement类的典型用法代码示例。如果您正苦于以下问题:Java NamedLibraryElement类的具体用法?Java NamedLibraryElement怎么用?Java NamedLibraryElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NamedLibraryElement类属于com.intellij.ide.projectView.impl.nodes包,在下文中一共展示了NamedLibraryElement类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPythonSdk
import com.intellij.ide.projectView.impl.nodes.NamedLibraryElement; //导入依赖的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: getLocation
import com.intellij.ide.projectView.impl.nodes.NamedLibraryElement; //导入依赖的package包/类
public static String getLocation(final AbstractTreeNode element, final Project project) {
Object nodeElement = element.getValue();
if (nodeElement instanceof SmartPsiElementPointer) {
nodeElement = ((SmartPsiElementPointer)nodeElement).getElement();
}
if (nodeElement instanceof PsiElement) {
if (nodeElement instanceof PsiDirectory) {
return ((PsiDirectory)nodeElement).getVirtualFile().getPresentableUrl();
}
if (nodeElement instanceof PsiFile) {
final PsiFile containingFile = (PsiFile)nodeElement;
final VirtualFile virtualFile = containingFile.getVirtualFile();
return virtualFile != null ? virtualFile.getPresentableUrl() : "";
}
}
if (nodeElement instanceof LibraryGroupElement) {
return ((LibraryGroupElement)nodeElement).getModule().getName();
}
if (nodeElement instanceof NamedLibraryElement) {
final NamedLibraryElement namedLibraryElement = ((NamedLibraryElement)nodeElement);
final Module module = namedLibraryElement.getModule();
return (module != null ? module.getName() : "") + ":" + namedLibraryElement.getOrderEntry().getPresentableName();
}
final FavoriteNodeProvider[] nodeProviders = Extensions.getExtensions(FavoriteNodeProvider.EP_NAME, project);
for (FavoriteNodeProvider provider : nodeProviders) {
String location = provider.getElementLocation(nodeElement);
if (location != null) return location;
}
return null;
}
示例3: createPath
import com.intellij.ide.projectView.impl.nodes.NamedLibraryElement; //导入依赖的package包/类
@Override
public Object[] createPath(Project project) {
final Module module = moduleName != null ? ModuleManager.getInstance(project).findModuleByName(moduleName) : null;
if (module == null) return null;
for (OrderEntry orderEntry : ModuleRootManager.getInstance(module).getOrderEntries()) {
if (orderEntry instanceof LibraryOrderEntry || orderEntry instanceof JdkOrderEntry && orderEntry.getPresentableName().equals(url)) {
return new Object[]{new NamedLibraryElement(module, (LibraryOrSdkOrderEntry)orderEntry)};
}
}
return null;
}
示例4: createUrlByElement
import com.intellij.ide.projectView.impl.nodes.NamedLibraryElement; //导入依赖的package包/类
@Override
public AbstractUrl createUrlByElement(Object element) {
if (element instanceof NamedLibraryElement) {
NamedLibraryElement libraryElement = (NamedLibraryElement)element;
Module context = libraryElement.getModule();
return new NamedLibraryUrl(libraryElement.getOrderEntry().getPresentableName(), context != null ? context.getName() : null);
}
return null;
}
示例5: isJdk
import com.intellij.ide.projectView.impl.nodes.NamedLibraryElement; //导入依赖的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;
}
示例6: createPath
import com.intellij.ide.projectView.impl.nodes.NamedLibraryElement; //导入依赖的package包/类
@Override
public Object[] createPath(Project project) {
final Module module = moduleName != null ? ModuleManager.getInstance(project).findModuleByName(moduleName) : null;
if (module == null) return null;
for (OrderEntry orderEntry : ModuleRootManager.getInstance(module).getOrderEntries()) {
if (orderEntry instanceof LibraryOrderEntry || orderEntry instanceof ModuleExtensionWithSdkOrderEntry && orderEntry.getPresentableName().equals(url)) {
return new Object[]{new NamedLibraryElement(module, orderEntry)};
}
}
return null;
}
示例7: getDataImpl
import com.intellij.ide.projectView.impl.nodes.NamedLibraryElement; //导入依赖的package包/类
public final Object getDataImpl(final String dataId) {
if (myBuilder == null) return null;
final Object selectedValue = getSelectedValue();
if (CommonDataKeys.PSI_ELEMENT.is(dataId)) {
final PsiElement selectedElement = getSelectedElement();
return selectedElement != null && selectedElement.isValid() ? selectedElement : null;
}
if (LangDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) {
return filterInvalidElements(getSelectedElements());
}
if (LangDataKeys.PASTE_TARGET_PSI_ELEMENT.is(dataId)) {
final AbstractTreeNode parentNode = myBuilder.getParentNode();
final Object element = parentNode != null ? parentNode.getValue() : null;
return element instanceof PsiElement && ((PsiElement)element).isValid() ? element : null;
}
if (CommonDataKeys.NAVIGATABLE_ARRAY.is(dataId)) {
return getNavigatables();
}
if (PlatformDataKeys.COPY_PROVIDER.is(dataId)) {
return myCopyPasteDelegator != null ? myCopyPasteDelegator.getCopyProvider() : null;
}
if (PlatformDataKeys.CUT_PROVIDER.is(dataId)) {
return myCopyPasteDelegator != null ? myCopyPasteDelegator.getCutProvider() : null;
}
if (PlatformDataKeys.PASTE_PROVIDER.is(dataId)) {
return myCopyPasteDelegator != null ? myCopyPasteDelegator.getPasteProvider() : null;
}
if (LangDataKeys.IDE_VIEW.is(dataId)) {
return myIdeView;
}
if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) {
return myDeleteElementProvider;
}
if (LangDataKeys.MODULE.is(dataId)) {
return selectedValue instanceof Module ? selectedValue : null;
}
if (ModuleGroup.ARRAY_DATA_KEY.is(dataId)) {
return selectedValue instanceof ModuleGroup ? new ModuleGroup[]{(ModuleGroup)selectedValue} : null;
}
if (LibraryGroupElement.ARRAY_DATA_KEY.is(dataId)) {
return selectedValue instanceof LibraryGroupElement ? new LibraryGroupElement[]{(LibraryGroupElement)selectedValue} : null;
}
if (NamedLibraryElement.ARRAY_DATA_KEY.is(dataId)) {
return selectedValue instanceof NamedLibraryElement ? new NamedLibraryElement[]{(NamedLibraryElement)selectedValue} : null;
}
if (myProjectTreeStructure != null) {
return myProjectTreeStructure.getDataFromProviders(getSelectedNodes(), dataId);
}
return null;
}
示例8: getDataImpl
import com.intellij.ide.projectView.impl.nodes.NamedLibraryElement; //导入依赖的package包/类
public final Object getDataImpl(final String dataId) {
if (myBuilder == null) return null;
final Object selectedValue = getSelectedValue();
if (LangDataKeys.PSI_ELEMENT.is(dataId)) {
final PsiElement selectedElement = getSelectedElement();
return selectedElement != null && selectedElement.isValid() ? selectedElement : null;
}
if (LangDataKeys.PSI_ELEMENT_ARRAY.is(dataId)) {
return filterInvalidElements(getSelectedElements());
}
if (LangDataKeys.PASTE_TARGET_PSI_ELEMENT.is(dataId)) {
final AbstractTreeNode parentNode = myBuilder.getParentNode();
final Object element = parentNode != null ? parentNode.getValue() : null;
return element instanceof PsiElement && ((PsiElement)element).isValid() ? element : null;
}
if (PlatformDataKeys.NAVIGATABLE_ARRAY.is(dataId)) {
return getNavigatables();
}
if (PlatformDataKeys.COPY_PROVIDER.is(dataId)) {
return myCopyPasteDelegator != null ? myCopyPasteDelegator.getCopyProvider() : null;
}
if (PlatformDataKeys.CUT_PROVIDER.is(dataId)) {
return myCopyPasteDelegator != null ? myCopyPasteDelegator.getCutProvider() : null;
}
if (PlatformDataKeys.PASTE_PROVIDER.is(dataId)) {
return myCopyPasteDelegator != null ? myCopyPasteDelegator.getPasteProvider() : null;
}
if (LangDataKeys.IDE_VIEW.is(dataId)) {
return myIdeView;
}
if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER.is(dataId)) {
return myDeleteElementProvider;
}
if (LangDataKeys.MODULE.is(dataId)) {
return selectedValue instanceof Module ? selectedValue : null;
}
if (ModuleGroup.ARRAY_DATA_KEY.is(dataId)) {
return selectedValue instanceof ModuleGroup ? new ModuleGroup[]{(ModuleGroup)selectedValue} : null;
}
if (LibraryGroupElement.ARRAY_DATA_KEY.is(dataId)) {
return selectedValue instanceof LibraryGroupElement ? new LibraryGroupElement[]{(LibraryGroupElement)selectedValue} : null;
}
if (NamedLibraryElement.ARRAY_DATA_KEY.is(dataId)) {
return selectedValue instanceof NamedLibraryElement ? new NamedLibraryElement[]{(NamedLibraryElement)selectedValue} : null;
}
if (myProjectTreeStructure != null) {
return myProjectTreeStructure.getDataFromProviders(getSelectedNodes(), dataId);
}
return null;
}
示例9: getDataImpl
import com.intellij.ide.projectView.impl.nodes.NamedLibraryElement; //导入依赖的package包/类
public final Object getDataImpl(final Key<?> dataId) {
if (myBuilder == null) return null;
final Object selectedValue = getSelectedValue();
if (LangDataKeys.PSI_ELEMENT == dataId) {
final PsiElement selectedElement = getSelectedElement();
return selectedElement != null && selectedElement.isValid() ? selectedElement : null;
}
if (LangDataKeys.PSI_ELEMENT_ARRAY == dataId) {
return filterInvalidElements(getSelectedElements());
}
if (LangDataKeys.PASTE_TARGET_PSI_ELEMENT == dataId) {
final AbstractTreeNode parentNode = myBuilder.getParentNode();
final Object element = parentNode != null ? parentNode.getValue() : null;
return element instanceof PsiElement && ((PsiElement)element).isValid() ? element : null;
}
if (PlatformDataKeys.NAVIGATABLE_ARRAY == dataId) {
return getNavigatables();
}
if (PlatformDataKeys.COPY_PROVIDER == dataId) {
return myCopyPasteDelegator != null ? myCopyPasteDelegator.getCopyProvider() : null;
}
if (PlatformDataKeys.CUT_PROVIDER == dataId) {
return myCopyPasteDelegator != null ? myCopyPasteDelegator.getCutProvider() : null;
}
if (PlatformDataKeys.PASTE_PROVIDER == dataId) {
return myCopyPasteDelegator != null ? myCopyPasteDelegator.getPasteProvider() : null;
}
if (LangDataKeys.IDE_VIEW == dataId) {
return myIdeView;
}
if (PlatformDataKeys.DELETE_ELEMENT_PROVIDER == dataId) {
return myDeleteElementProvider;
}
if (LangDataKeys.MODULE == dataId) {
return selectedValue instanceof Module ? selectedValue : null;
}
if (ModuleGroup.ARRAY_DATA_KEY == dataId) {
return selectedValue instanceof ModuleGroup ? new ModuleGroup[]{(ModuleGroup)selectedValue} : null;
}
if (LibraryGroupElement.ARRAY_DATA_KEY == dataId) {
return selectedValue instanceof LibraryGroupElement ? new LibraryGroupElement[]{(LibraryGroupElement)selectedValue} : null;
}
if (NamedLibraryElement.ARRAY_DATA_KEY == dataId) {
return selectedValue instanceof NamedLibraryElement ? new NamedLibraryElement[]{(NamedLibraryElement)selectedValue} : null;
}
if (myProjectTreeStructure != null) {
return myProjectTreeStructure.getDataFromProviders(getSelectedNodes(), dataId);
}
return null;
}