• eclipse插件开发常用的选择器


    容器选择器(IFOlder,IPROJECT ,包等):


    ContainerSelectionDialog dialog = new ContainerSelectionDialog(
    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
    ResourcesPlugin.getWorkspace().getRoot(), false,
    "Select new file container");
    if (dialog.open() == ContainerSelectionDialog.OK) {
    Object[] result = dialog.getResult();
    if (result.length == 1) {
    org.eclipse.core.runtime.Path path = (org.eclipse.core.runtime.Path) result[0];
    srcPath = path.toString();
    System.out.println("=============" + srcPath);
    srcPath.endsWith("src");


    }
    }


    类选择器:

    SelectionDialog s = JavaUI.createTypeDialog(shell,
    null,
    project.getProject(),
    IJavaElementSearchConstants.CONSIDER_ALL_TYPES,
    true);
    if (s.open() == org.eclipse.jface.window.Window.OK) {
    SourceType type = (SourceType) s
    .getResult()[0];


    unit = (ICompilationUnit) type.getParent();
    LinkedList list = new LinkedList();
    getPackage(unit, list);
    pac = listToString(list);
    text1.setText(pac);
    }


    系统目录选择:

    DirectoryDialog dirDlg = new DirectoryDialog(shell);
    String dir = dirDlg.open();

    系统文件选择:

    FileDialog fd = new FileDialog(
    final String fileStr = fd.open();

  • 相关阅读:
    zznuoj 2173 春天的英雄梦
    zznuoj 2171: 春天的致富梦
    zznuoj 2169: 春天的打水梦
    zznuoj 2168 大家好 我是水题
    西安赛打铁队检讨书
    B-number HDU
    Bomb HDU
    CodeForces
    1140
    Frequent Subsets Problem
  • 原文地址:https://www.cnblogs.com/liaomin416100569/p/9331424.html
Copyright © 2020-2023  润新知