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


Java PlatformPackageUtil类代码示例

本文整理汇总了Java中com.intellij.ide.util.PlatformPackageUtil的典型用法代码示例。如果您正苦于以下问题:Java PlatformPackageUtil类的具体用法?Java PlatformPackageUtil怎么用?Java PlatformPackageUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: doCloneFile

import com.intellij.ide.util.PlatformPackageUtil; //导入依赖的package包/类
public static void doCloneFile(PsiElement element) {
  PsiDirectory targetDirectory;
  if (element instanceof PsiDirectory) {
    targetDirectory = ((PsiDirectory)element).getParentDirectory();
  }
  else {
    targetDirectory = PlatformPackageUtil.getDirectory(element);
  }
  targetDirectory = tryNotNullizeDirectory(element.getProject(), targetDirectory);
  if (targetDirectory == null) return;

  PsiElement[] elements = {element};
  CopyFilesOrDirectoriesDialog dialog = new CopyFilesOrDirectoriesDialog(elements, null, element.getProject(), true);
  if (dialog.showAndGet()) {
    String newName = dialog.getNewName();
    copyImpl(elements, newName, targetDirectory, true, true);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:CopyFilesOrDirectoriesHandler.java

示例2: doCopy

import com.intellij.ide.util.PlatformPackageUtil; //导入依赖的package包/类
@Override
@RequiredReadAction
public void doCopy(final PsiElement[] elements, PsiDirectory defaultTargetDirectory)
{
	CSharpTypeDeclaration typeDeclaration = (CSharpTypeDeclaration) elements[0];

	if(defaultTargetDirectory == null)
	{
		defaultTargetDirectory = PlatformPackageUtil.getDirectory(typeDeclaration.getContainingFile());
	}

	Project project = defaultTargetDirectory != null ? defaultTargetDirectory.getProject() : typeDeclaration.getProject();
	if(defaultTargetDirectory != null)
	{
		defaultTargetDirectory = CopyFilesOrDirectoriesHandler.resolveDirectory(defaultTargetDirectory);
		if(defaultTargetDirectory == null)
		{
			return;
		}
	}

	defaultTargetDirectory = tryNotNullizeDirectory(project, defaultTargetDirectory);

	doCopy(typeDeclaration, defaultTargetDirectory, project);
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:26,代码来源:CSharpCopyClassHandlerDelegate.java

示例3: doClone

import com.intellij.ide.util.PlatformPackageUtil; //导入依赖的package包/类
@Override
@RequiredReadAction
public void doClone(PsiElement element)
{
	PsiDirectory targetDirectory;
	if(element instanceof PsiDirectory)
	{
		targetDirectory = ((PsiDirectory) element).getParentDirectory();
	}
	else
	{
		targetDirectory = PlatformPackageUtil.getDirectory(element);
	}
	targetDirectory = tryNotNullizeDirectory(element.getProject(), targetDirectory);
	if(targetDirectory == null)
	{
		return;
	}

	CopyFilesOrDirectoriesDialog dialog = new CopyFilesOrDirectoriesDialog(new PsiElement[]{element.getContainingFile()}, null, element.getProject(), true);
	if(dialog.showAndGet())
	{
		String newName = dialog.getNewName();
		doCopy((CSharpTypeDeclaration) element, newName, targetDirectory, true, true);
	}
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:27,代码来源:CSharpCopyClassHandlerDelegate.java

示例4: doCloneFile

import com.intellij.ide.util.PlatformPackageUtil; //导入依赖的package包/类
public static void doCloneFile(PsiElement element) {
  PsiDirectory targetDirectory;
  if (element instanceof PsiDirectory) {
    targetDirectory = ((PsiDirectory)element).getParentDirectory();
  }
  else {
    targetDirectory = PlatformPackageUtil.getDirectory(element);
  }
  targetDirectory = tryNotNullizeDirectory(element.getProject(), targetDirectory);
  if (targetDirectory == null) return;

  PsiElement[] elements = {element};
  VirtualFile file = ((PsiFileSystemItem)element).getVirtualFile();
  CopyFilesOrDirectoriesDialog dialog = new CopyFilesOrDirectoriesDialog(elements, null, element.getProject(), true);
  if (dialog.showAndGet()) {
    String newName = dialog.getNewName();
    copyImpl(new VirtualFile[] {file}, newName, targetDirectory, true, true);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:CopyFilesOrDirectoriesHandler.java

示例5: actionPerformed

import com.intellij.ide.util.PlatformPackageUtil; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final DataContext dataContext = e.getDataContext();
  final Project project = CommonDataKeys.PROJECT.getData(dataContext);
  final VirtualFile virtualFile = CommonDataKeys.VIRTUAL_FILE.getData(dataContext);
  @SuppressWarnings({"ConstantConditions"}) final PsiElement element = PsiManager.getInstance(project).findFile(virtualFile);
  if(element==null) return;
  CopyHandler.doCopy(new PsiElement[] {element.getContainingFile()}, PlatformPackageUtil.getDirectory(element));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:SaveAsAction.java

示例6: getCommonParentDirectory

import com.intellij.ide.util.PlatformPackageUtil; //导入依赖的package包/类
@Nullable
private static PsiDirectory getCommonParentDirectory(PsiElement[] elements){
  PsiDirectory result = null;

  for (PsiElement element : elements) {
    PsiDirectory directory;

    if (element instanceof PsiDirectory) {
      directory = (PsiDirectory)element;
      directory = directory.getParentDirectory();
    }
    else if (element instanceof PsiFile) {
      directory = PlatformPackageUtil.getDirectory(element);
    }
    else {
      throw new IllegalArgumentException("unexpected element " + element);
    }

    if (directory == null) continue;

    if (result == null) {
      result = directory;
    }
    else {
      if (PsiTreeUtil.isAncestor(directory, result, true)) {
        result = directory;
      }
    }
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:CopyFilesOrDirectoriesHandler.java


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