zoukankan      html  css  js  c++  java
  • 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();

  • 相关阅读:
    alg--动态规划(dynamic planning)
    alg--分治法
    汇编-理解call,ret
    汇编--实验7
    leetCode笔记--binary tree
    leetCode笔记--(1)
    C#获取当前路径的方法如下
    VS2013 快捷键 与 RESHARPER 冲突
    使用Visual Studio 2013进行单元测试--初级篇
    VS 插件
  • 原文地址:https://www.cnblogs.com/liaomin416100569/p/9331424.html
Copyright © 2011-2022 走看看