当前位置: 首页>>代码示例>>Java>>正文


Java IdeView.getOrChooseDirectory方法代码示例

本文整理汇总了Java中com.intellij.ide.IdeView.getOrChooseDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java IdeView.getOrChooseDirectory方法的具体用法?Java IdeView.getOrChooseDirectory怎么用?Java IdeView.getOrChooseDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ide.IdeView的用法示例。


在下文中一共展示了IdeView.getOrChooseDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isAvailable

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
@Override
protected boolean isAvailable(DataContext dataContext) {
    IdeView view = (IdeView) LangDataKeys.IDE_VIEW.getData(dataContext);

    if (view == null) {
        return false;
    }

    PsiDirectory dir = view.getOrChooseDirectory();

    if (dir == null) {
        return false;
    }

    return this.classTypeMatchesDir(dir);
}
 
开发者ID:project-a,项目名称:idea-php-spryker-plugin,代码行数:17,代码来源:AbstractClassTypeAction.java

示例2: actionPerformed

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
@Override
public final void actionPerformed(final AnActionEvent e) {
  final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
  if (view == null) {
    return;
  }

  final Project project = e.getProject();

  final PsiDirectory dir = view.getOrChooseDirectory();
  if (dir == null) return;
  final PsiElement[] createdElements = invokeDialog(project, dir);

  for (PsiElement createdElement : createdElements) {
    view.selectElement(createdElement);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:CreateElementActionBase.java

示例3: invokeDialog

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
@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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:CreateTypedResourceFileAction.java

示例4: actionPerformed

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
@Override
public void actionPerformed(@NotNull AnActionEvent anActionEvent) {
    final DataContext dataContext = anActionEvent.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;
    }
    CreateFileDialog createFileDialog = new CreateFileDialog(project, dir);
    createFileDialog.show();
}
 
开发者ID:asebak,项目名称:ui5-intellij-plugin,代码行数:19,代码来源:UI5CreateFileAction.java

示例5: actionPerformed

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
@Override
public final 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 = PlatformDataKeys.PROJECT.getData(dataContext);

  final PsiDirectory dir = view.getOrChooseDirectory();
  if (dir == null) return;
  final PsiElement[] createdElements = invokeDialog(project, dir);

  for (PsiElement createdElement : createdElements) {
    view.selectElement(createdElement);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:CreateElementActionBase.java

示例6: actionPerformed

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
@RequiredDispatchThread
@Override
public final void actionPerformed(@Nonnull final AnActionEvent e) {
  final IdeView view = e.getData(LangDataKeys.IDE_VIEW);
  if (view == null) {
    return;
  }

  final Project project = e.getProject();

  final PsiDirectory dir = view.getOrChooseDirectory();
  if (dir == null) return;
  final PsiElement[] createdElements = invokeDialog(project, dir);

  for (PsiElement createdElement : createdElements) {
    view.selectElement(createdElement);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:CreateElementActionBase.java

示例7: update

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
@Override
public void update( AnActionEvent e )
{
  super.update( e );

  boolean enabled;
  final DataContext dataContext = e.getDataContext();

  final IdeView view = LangDataKeys.IDE_VIEW.getData( dataContext );
  if( view == null )
  {
    enabled = false;
  }
  else
  {
    final Project project = PlatformDataKeys.PROJECT.getData( dataContext );

    final PsiDirectory dir = view.getOrChooseDirectory();
    if( dir == null || project == null )
    {
      enabled = false;
    }
    else
    {
      PsiPackage pkg = JavaDirectoryService.getInstance().getPackage( dir );
      ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance( project).getFileIndex();
      enabled = pkg != null && projectFileIndex.isUnderSourceRootOfType( dir.getVirtualFile(), JavaModuleSourceRootTypes.SOURCES );
    }
  }
  e.getPresentation().setEnabled( enabled );
}
 
开发者ID:manifold-systems,项目名称:manifold-ij,代码行数:32,代码来源:CreateExtensionMethodsClassAction.java

示例8: isAvailable

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
@Override
protected boolean isAvailable(DataContext dataContext) {
    IdeView view = (IdeView) LangDataKeys.IDE_VIEW.getData(dataContext);

    if (view == null) {
        return false;
    }

    PsiDirectory dir = view.getOrChooseDirectory();

    if (dir == null) {
        return false;
    }

    if (!dir.getName().equals(this.getApplicationName())) {
        return false;
    }

    PsiDirectory projectDir = dir.getParent();

    if (projectDir == null) {
        return false;
    }

    PsiDirectory srcDir = projectDir.getParent();

    return srcDir != null && srcDir.getName().equals("src");
}
 
开发者ID:project-a,项目名称:idea-php-spryker-plugin,代码行数:29,代码来源:AbstractBundleAction.java

示例9: actionPerformed

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
    List<PsiClass> modulesClasses = extractDagger2ModulesPsiClasses(e);
    SelectModulesDialog dg = new SelectModulesDialog(e.getProject(), modulesClasses);

    if (!dg.showAndGet()) {
        return;
    }

    List<PsiClass> componentModules = new ArrayList<>();
    List<TypeInfo> typeInfos = dg.getTypeInfos();
    for (TypeInfo typeInfo : typeInfos) {
        if (typeInfo.isChecked()) {
            PsiClass typeObject = typeInfo.getTypeObject();
            componentModules.add(typeObject);
        }
    }

    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;

    PsiClass createdComponentClass = (PsiClass) doCreate(dir, dg.getComponentName(), project, componentModules);
}
 
开发者ID:phajduk,项目名称:dagger2-intellij-plugin,代码行数:33,代码来源:GenerateComponentAction.java

示例10: isAvailable

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
@Override
protected boolean isAvailable(@NotNull final DataContext dataContext) {
    final Project project = PlatformDataKeys.PROJECT.getData(dataContext);
    if (project == null) {
      return false;
    }

    if (DumbService.getInstance(project).isDumb() && !isDumbAware()) {
      return false;
    }

    final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
    if (view == null || view.getDirectories().length == 0) {
      return false;
    }

    final PsiDirectory dir = view.getOrChooseDirectory();
    if (dir == null) {
        return false;
    }

    final VirtualFile virtualDir = dir.getVirtualFile();

    final Module module = ModuleUtil.findModuleForFile(virtualDir, project);
    //noinspection SimplifiableIfStatement
    if (!OCamlModuleUtil.isOCamlModule(module)) {
        return false;
    }

    return ModuleRootManager.getInstance(module).getFileIndex().isInSourceContent(virtualDir);
}
 
开发者ID:traff,项目名称:intellij-ocaml,代码行数:32,代码来源:BaseCreateOCamlFileAction.java

示例11: isAvailable

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
@Override
@RequiredDispatchThread
protected boolean isAvailable(DataContext dataContext)
{
	Module module = findModule(dataContext);
	if(module != null)
	{
		DotNetModuleExtension extension = ModuleUtilCore.getExtension(module, DotNetModuleExtension.class);
		if(extension != null && extension.isAllowSourceRoots())
		{
			final IdeView view = dataContext.getData(LangDataKeys.IDE_VIEW);
			if(view == null)
			{
				return false;
			}

			PsiDirectory orChooseDirectory = view.getOrChooseDirectory();
			if(orChooseDirectory == null)
			{
				return false;
			}
			PsiPackage aPackage = PsiPackageManager.getInstance(module.getProject()).findPackage(orChooseDirectory, DotNetModuleExtension.class);

			if(aPackage == null)
			{
				return false;
			}
		}
	}
	return module != null && ModuleUtilCore.getExtension(module, CSharpSimpleModuleExtension.class) != null;
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:32,代码来源:CSharpCreateFileAction.java

示例12: findModule

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
@RequiredReadAction
private static Module findModule(DataContext dataContext)
{
	Project project = dataContext.getData(CommonDataKeys.PROJECT);
	if(project == null)
	{
		return null;
	}
	final IdeView view = dataContext.getData(LangDataKeys.IDE_VIEW);
	if(view == null)
	{
		return null;
	}

	final PsiDirectory orChooseDirectory = view.getOrChooseDirectory();
	if(orChooseDirectory == null)
	{
		return null;
	}

	Module resolve = CSharpCreateFromTemplateHandler.findModuleByPsiDirectory(orChooseDirectory);
	if(resolve != null)
	{
		return resolve;
	}
	return dataContext.getData(LangDataKeys.MODULE);
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:28,代码来源:CSharpCreateFileAction.java

示例13: actionPerformed

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final DataContext dataContext = e.getDataContext();

  final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
  if (view == null) {
    return;
  }

  final Module module = LangDataKeys.MODULE.getData(dataContext);

  if (module == null) {
    return;
  }

  AndroidFacet facet = AndroidFacet.getInstance(module);
  if (facet == null) {
    return;
  }

  // If you're invoking the Asset Studio by right clicking in the Android Project view on a drawable or
  // mipmap folder for example, the IDE will ask you to pick a specific folder from one of the many
  // actual folders packed into the single resource directory.
  //
  // However, in this case we don't need those folders; we just want the corresponding source set, so
  // asking the user to choose between "drawable-mdpi" and "drawable-hdpi" isn't helpful.
  final PsiDirectory dir;
  AbstractProjectViewPane pane = ProjectView.getInstance(module.getProject()).getCurrentProjectViewPane();
  if (pane instanceof AndroidProjectViewPane) {
    PsiDirectory[] directories = view.getDirectories();
    if (directories.length == 0) {
      return;
    }
    dir = directories[0];
  } else {
    dir = view.getOrChooseDirectory();
  }
  if (dir == null) {
    return;
  }

  Project project = CommonDataKeys.PROJECT.getData(dataContext);
  VirtualFile targetFile = CommonDataKeys.VIRTUAL_FILE.getData(dataContext);

  showWizardAndCreateAsset(project, module, targetFile);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:47,代码来源:AndroidAssetStudioAction.java

示例14: actionPerformed

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
@Override
public void actionPerformed(@NotNull final AnActionEvent event) {
  final DataContext dataContext = event.getDataContext();

  final IdeView view = LangDataKeys.IDE_VIEW.getData(dataContext);
  if(view == null) {
    return;
  }

  final Project project = event.getProject();
  if(project == null) {
    return;
  }

  final DefracFacet facet = getFacet(event);
  final DefracConfigOracle config = facet.getConfigOracle();
  if(config == null) {
    return;
  }

  final PsiDirectory dir = view.getOrChooseDirectory();
  if(dir == null) {
    return;
  }

  final MultiPlatformCreateDialog<T> dialog =
      MultiPlatformCreateDialog.create(
          event.getProject(),
          ImmutableSet.copyOf(config.getTargets()),
          createGeneric(),
          createAndroid(), createIOS(),
          createJVM(), createWeb());

  updateDialog(project, facet, event, dialog);

  final MultiPlatformCreateDialog.Result<T> result = dialog.getResult(project, dir);

  if(result != null && result.generic != null) {
    view.selectElement(result.generic);
  }
}
 
开发者ID:defrac,项目名称:defrac-plugin-intellij,代码行数:42,代码来源:MultiPlatformCreateAction.java

示例15: actionPerformed

import com.intellij.ide.IdeView; //导入方法依赖的package包/类
/**
 * Creates new Gitignore file if it does not exist or uses an existing one and opens {@link GeneratorDialog}.
 *
 * @param e action event
 */
@Override
public void actionPerformed(AnActionEvent e) {
    final Project project = e.getRequiredData(CommonDataKeys.PROJECT);
    final IdeView view = e.getRequiredData(LangDataKeys.IDE_VIEW);

    VirtualFile fixedDirectory = fileType.getIgnoreLanguage().getFixedDirectory(project);
    PsiDirectory directory;

    if (fixedDirectory != null) {
        directory = PsiManager.getInstance(project).findDirectory(fixedDirectory);
    } else {
        directory = view.getOrChooseDirectory();
    }

    if (directory == null) {
        return;
    }

    GeneratorDialog dialog;
    String filename = fileType.getIgnoreLanguage().getFilename();
    PsiFile file = directory.findFile(filename);
    VirtualFile virtualFile = file == null ? directory.getVirtualFile().findChild(filename) : file.getVirtualFile();

    if (file == null && virtualFile == null) {
        CreateFileCommandAction action = new CreateFileCommandAction(project, directory, fileType);
        dialog = new GeneratorDialog(project, action);
    } else {
        Notifications.Bus.notify(new Notification(
                fileType.getLanguageName(),
                IgnoreBundle.message("action.newFile.exists", fileType.getLanguageName()),
                IgnoreBundle.message("action.newFile.exists.in", virtualFile.getPath()),
                NotificationType.INFORMATION
        ), project);

        if (file == null) {
            file = Utils.getPsiFile(project, virtualFile);
        }

        dialog = new GeneratorDialog(project, file);
    }

    dialog.show();
    file = dialog.getFile();

    if (file != null) {
        Utils.openFile(project, file);
    }
}
 
开发者ID:hsz,项目名称:idea-gitignore,代码行数:54,代码来源:NewFileAction.java


注:本文中的com.intellij.ide.IdeView.getOrChooseDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。