/**
* Open the file dialog for the direct opening of a file. If a file is returned,
* expand the directory tree accordingly.
*/
public void openFileDirectly() {
FileDialog fileDialog = new FileDialog(this.shell, SWT.OPEN);
String[] extensions = {"*.class", "*.jar", "*.war", "*.ear"};
String[] names = {"Class file (*.class)", "Jar archive (*.jar)", "War archive (*.war)", "Ear archive (*.ear)"};
fileDialog.setFilterExtensions(extensions);
fileDialog.setFilterNames(names);
String path = fileDialog.open();
if (path != null) {
// First of all replace double backslashes against slashes.
path = path.replace("\\\\", "\\");
// different handling of class and jar files
if (JarFileEntry.isArchive(path) || (path.length() > 6 && path.substring(path.length() - 6).equals(".class")))
{
// Browse through the directory tree.
browseTroughTheDirectoryTree(path, null);
} else {
StaticGuiSupport.showMessageBox(FileSelectionComposite.this.shell, "Information", "This file cannot be processed.", SWT.OK | SWT.ICON_WARNING);
}
}
}
FileSelectionComposite.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:tap17-muggl-javaee
作者:
评论列表
文章目录