在插件项目中以编程方式打开Eclipse视图

时间:2015-11-20 10:17:34

标签: java plugins view eclipse-plugin

我想打开视图" Package Explorer"在特殊事件之后,在我的Eclipse插件应用程序中。

这就是我想要做的事情:

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("viewId");

但是,包浏览器视图的id是什么?

1 个答案:

答案 0 :(得分:2)

JDT Package Explorer的id为import java.util.regex.Matcher; import java.util.regex.Pattern; String input = "G01 G01-I006 G01-I006-I1 G01-I006-I1-R06 G01-I006-I1-R06-F001"; final Pattern pattern = Pattern.compile("([GIRF])([0-9]{1,4})-?"); Matcher m = pattern.matcher(input); while(m.find()) { System.out.println(m.group(1) + " " + m.group(2)); }

如果在视图中按 Alt + Shift + F1 ,则可以确定任何ID。例如你得到这个弹出窗口(如果你安装了PDE)。有关使用间谍的详细信息,请参阅Vogella's tutorials

enter image description here