use of org.jetbrains.plugins.groovy.mvc.MvcFramework in project intellij-community by JetBrains.
the class GriffonDefaultImportContributor method appendImplicitlyImportedPackages.
@NotNull
@Override
public List<String> appendImplicitlyImportedPackages(@NotNull GroovyFile file) {
Module module = ModuleUtilCore.findModuleForPsiElement(file);
MvcFramework framework = MvcFramework.getInstance(module);
if (framework instanceof GriffonFramework) {
ArrayList<String> result = new ArrayList<>();
result.add("griffon.core");
result.add("griffon.util");
VirtualFile griffonApp = framework.findAppDirectory(file);
if (griffonApp != null) {
VirtualFile models = griffonApp.findChild("models");
VirtualFile views = griffonApp.findChild("views");
VirtualFile vFile = file.getOriginalFile().getVirtualFile();
assert vFile != null;
assert module != null;
if (models != null && VfsUtilCore.isAncestor(models, vFile, true)) {
result.addAll(getDefaultImports(module).first);
} else if (views != null && VfsUtilCore.isAncestor(views, vFile, true)) {
result.addAll(getDefaultImports(module).second);
}
}
return result;
}
return Collections.emptyList();
}
use of org.jetbrains.plugins.groovy.mvc.MvcFramework in project intellij-community by JetBrains.
the class MvcProjectViewSelectInTarget method selectIn.
@Override
public void selectIn(SelectInContext context, final boolean requestFocus) {
final Project project = context.getProject();
final VirtualFile file = context.getVirtualFile();
final MvcFramework framework = MvcFramework.getInstance(ModuleUtilCore.findModuleForFile(file, project));
if (framework == null) {
return;
}
final Runnable select = () -> {
final MvcProjectViewPane view = MvcProjectViewPane.getView(project, framework);
if (view != null) {
view.selectFile(file, requestFocus);
}
};
if (requestFocus) {
ToolWindowManager.getInstance(project).getToolWindow(MvcToolWindowDescriptor.getToolWindowId(framework)).activate(select, false);
} else {
select.run();
}
}
use of org.jetbrains.plugins.groovy.mvc.MvcFramework in project intellij-community by JetBrains.
the class MvcProjectViewSelectInTarget method canSelect.
@Override
public boolean canSelect(SelectInContext context) {
final Project project = context.getProject();
final VirtualFile file = context.getVirtualFile();
final MvcFramework framework = MvcFramework.getInstance(ModuleUtilCore.findModuleForFile(file, project));
if (framework == null) {
return false;
}
return MvcProjectViewPane.canSelectFile(project, framework, file);
}
use of org.jetbrains.plugins.groovy.mvc.MvcFramework in project intellij-community by JetBrains.
the class MvcTargetDialogCompletionUtils method getAllTargetNamesInternal.
public static Set<String> getAllTargetNamesInternal(@NotNull Module module) {
final Set<String> result = new HashSet<>();
MvcFramework.addAvailableSystemScripts(result, module);
MvcFramework framework = MvcFramework.getInstance(module);
if (framework != null) {
final VirtualFile root = framework.findAppRoot(module);
if (root != null) {
MvcFramework.addAvailableScripts(result, root);
}
for (VirtualFile pluginRoot : framework.getAllPluginRoots(module, false)) {
MvcFramework.addAvailableScripts(result, pluginRoot);
}
}
collectScriptsFromUserHome(result);
return result;
}
Aggregations