當前位置: 首頁>>代碼示例>>Java>>正文


Java PlatformPackageUtil.getDirectory方法代碼示例

本文整理匯總了Java中com.intellij.ide.util.PlatformPackageUtil.getDirectory方法的典型用法代碼示例。如果您正苦於以下問題:Java PlatformPackageUtil.getDirectory方法的具體用法?Java PlatformPackageUtil.getDirectory怎麽用?Java PlatformPackageUtil.getDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.ide.util.PlatformPackageUtil的用法示例。


在下文中一共展示了PlatformPackageUtil.getDirectory方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: 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.getDirectory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。