0
我想在我的应用程序做一个按钮,让我在环境变量列表在我的系统 进入如下面的例子在文件系统获取环境变量在Java
b = new Button(dialog, SWT.PUSH);
b.setText("Browse file system");
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
DirectoryDialog fileDialog = new DirectoryDialog(parent);
fileDialog.setFilterPath(pathText.getText());
String file = fileDialog.open();
if (file != null) {
File workspace = ResourcesPlugin.getWorkspace().getRoot()
.getLocation().toFile().getAbsoluteFile();
String workspacePath = workspace.toString();
if (file.contains(workspacePath))
file = file.replace(workspacePath, "$WORKSPACE")
.replace("\\", "/");
pathText.setText(file);
}
super.widgetSelected(e);
}
});
任何人都可以进入帮助我?
感谢您的回复,但我有另一个问题,我尝试使用fonctio n: – ange