use of com.intellij.openapi.vfs.WrappingVirtualFile in project intellij-community by JetBrains.
the class ProjectStructureSelectInTarget method canSelect.
@Override
public boolean canSelect(final SelectInContext context) {
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(context.getProject()).getFileIndex();
final VirtualFile file = context.getVirtualFile();
if (file instanceof WrappingVirtualFile) {
final Object o = ((WrappingVirtualFile) file).getWrappedObject(context.getProject());
return o instanceof Facet;
}
return fileIndex.isInContent(file) || fileIndex.isInLibraryClasses(file) || fileIndex.isInLibrarySource(file) || StdFileTypes.IDEA_MODULE.equals(file.getFileType()) && findModuleByModuleFile(context.getProject(), file) != null;
}
use of com.intellij.openapi.vfs.WrappingVirtualFile in project intellij-community by JetBrains.
the class ProjectStructureSelectInTarget method selectIn.
@Override
public void selectIn(final SelectInContext context, final boolean requestFocus) {
final Project project = context.getProject();
final VirtualFile file = context.getVirtualFile();
final Module module;
final Facet facet;
if (file instanceof WrappingVirtualFile) {
final Object o = ((WrappingVirtualFile) file).getWrappedObject(project);
facet = o instanceof Facet ? (Facet) o : null;
module = facet == null ? null : facet.getModule();
} else {
Module moduleByIml = file.getFileType().equals(StdFileTypes.IDEA_MODULE) ? findModuleByModuleFile(project, file) : null;
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
module = moduleByIml != null ? moduleByIml : fileIndex.getModuleForFile(file);
facet = fileIndex.isInSourceContent(file) ? null : findFacet(project, file);
}
if (module != null || facet != null) {
ApplicationManager.getApplication().invokeLater(() -> {
if (facet != null) {
ModulesConfigurator.showFacetSettingsDialog(facet, null);
} else {
ProjectSettingsService.getInstance(project).openModuleSettings(module);
}
});
return;
}
final OrderEntry orderEntry = LibraryUtil.findLibraryEntry(file, project);
if (orderEntry != null) {
ApplicationManager.getApplication().invokeLater(() -> ProjectSettingsService.getInstance(project).openLibraryOrSdkSettings(orderEntry));
}
}
Aggregations