use of com.intellij.ide.IdeView in project android by JetBrains.
the class CreateTypedResourceFileAction method invokeDialog.
@NotNull
@Override
protected PsiElement[] invokeDialog(@NotNull Project project, @NotNull DataContext dataContext) {
final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
if (view != null) {
// If you're in the Android View, we want to ask you not just the filename but also let you
// create other resource folder configurations
AbstractProjectViewPane pane = ProjectView.getInstance(project).getCurrentProjectViewPane();
if (pane instanceof AndroidProjectViewPane) {
return CreateResourceFileAction.getInstance().invokeDialog(project, dataContext);
}
final PsiDirectory directory = view.getOrChooseDirectory();
if (directory != null) {
InputValidator validator = createValidator(project, directory);
Messages.showInputDialog(project, AndroidBundle.message("new.file.dialog.text"), AndroidBundle.message("new.typed.resource.dialog.title", myResourcePresentableName), Messages.getQuestionIcon(), "", validator);
}
}
return PsiElement.EMPTY_ARRAY;
}
use of com.intellij.ide.IdeView in project android by JetBrains.
the class CreateMultiRootResourceFileAction method invokeDialog.
@NotNull
@Override
protected PsiElement[] invokeDialog(@NotNull Project project, @NotNull DataContext dataContext) {
final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
if (view != null) {
// If you're in the Android View, we want to ask you not just the filename but also let you
// create other resource folder configurations
AbstractProjectViewPane pane = ProjectView.getInstance(project).getCurrentProjectViewPane();
if (pane instanceof AndroidProjectViewPane) {
return CreateResourceFileAction.getInstance().invokeDialog(project, dataContext);
}
final PsiDirectory directory = view.getOrChooseDirectory();
if (directory != null) {
InputValidator validator = createValidator(project, directory);
final AndroidFacet facet = AndroidFacet.getInstance(directory);
if (facet != null) {
final MyDialog dialog = new MyDialog(facet, validator);
dialog.show();
return PsiElement.EMPTY_ARRAY;
}
}
}
return PsiElement.EMPTY_ARRAY;
}
use of com.intellij.ide.IdeView in project intellij-plugins by JetBrains.
the class NewActionScriptClassAction method isAvailable.
private boolean isAvailable(DataContext dataContext) {
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
if (project == null || project.isDisposed() || view == null)
return false;
ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
for (PsiDirectory dir : view.getDirectories()) {
if (projectFileIndex.isInSourceContent(dir.getVirtualFile()) && DirectoryIndex.getInstance(dir.getProject()).getPackageName(dir.getVirtualFile()) != null) {
Module module = ModuleUtilCore.findModuleForPsiElement(dir);
if (module != null && isAvailableIn(module)) {
return true;
}
}
}
return false;
}
use of com.intellij.ide.IdeView in project intellij-plugins by JetBrains.
the class NewActionScriptClassAction method actionPerformed.
public void actionPerformed(final AnActionEvent e) {
final DataContext dataContext = e.getDataContext();
final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
if (view == null) {
return;
}
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
final PsiDirectory dir = view.getOrChooseDirectory();
if (dir == null || project == null)
return;
CommandProcessor.getInstance().executeCommand(project, () -> createAction(dir).execute(), getCommandName(), null);
}
use of com.intellij.ide.IdeView in project qi4j-sdk by Qi4j.
the class Qi4jCreateActionGroup method shouldActionGroupVisible.
private boolean shouldActionGroupVisible(AnActionEvent e) {
Module module = e.getData(LangDataKeys.MODULE);
if (module == null) {
return false;
}
// TODO: Enable this once Qi4jFacet can be automatically added/removed
// if( Qi4jFacet.getInstance( module ) == null )
// {
// return false;
// }
// Are we on IDE View and under project source folder?
Project project = e.getData(PlatformDataKeys.PROJECT);
IdeView view = e.getData(LangDataKeys.IDE_VIEW);
if (view != null && project != null) {
ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
PsiDirectory[] dirs = view.getDirectories();
for (PsiDirectory dir : dirs) {
if (projectFileIndex.isInSourceContent(dir.getVirtualFile()) && JavaDirectoryService.getInstance().getPackage(dir) != null) {
return true;
}
}
}
return false;
}
Aggregations