[英]Is there a Eclipse plugin for a File Browser Dialog button?
I have searched the web for quite a while now, and have not come across a simple solution for making a button, which opens a file browsing dialog in an Eclipse program. 我已经在网上搜索了很长一段时间,还没有遇到制作按钮的简单解决方案,该按钮可以在Eclipse程序中打开文件浏览对话框。 I am using WindowBuilder at the moment, and it seems odd to me, that one has to do so much to add a simple "Browse..." button to their GUI.
我现在正在使用WindowBuilder,这对我来说似乎很奇怪,必须做很多事情才能在其GUI中添加一个简单的“浏览...”按钮。
I hope someone can help me on this matter, thanks! 希望有人能在这件事上帮助我,谢谢!
I use this code: 我使用以下代码:
private Button browse;
browse = new Button(outerGroup, SWT.PUSH);
browse.setText("Browse ...");
browse.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false,1,0));
browse.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
DirectoryDialog dialog = new DirectoryDialog(shell, SWT.NULL);
String path = dialog.open();
if (path != null) {
//do stuff with path
}
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.