public void run() {
Progress.start(progressTicket);
Progress.setDisplayName(progressTicket, NbBundle.getMessage(LoadTask.class, "LoadTask.name"));
try {
ProjectImpl project = null;
ZipFile zip = null;
try {
zip = new ZipFile(file);
//Reader
gephiReader = new GephiReader();
//Project
ZipEntry entry = zip.getEntry("Project_xml");
if (entry != null) {
InputStream is = null;
try {
is = zip.getInputStream(entry);
project = readProject(is);
} finally {
if (is != null) {
is.close();
}
}
}
//Workspace Xml
if (project != null) {
for (Enumeration<? extends ZipEntry> e = zip.entries(); e.hasMoreElements();) {
entry = e.nextElement();
InputStream is = null;
String name = entry.getName();
if (name.matches("Workspace_[0-9]*_xml")) {
try {
is = zip.getInputStream(entry);
readWorkspace(is, project);
} finally {
if (is != null) {
is.close();
}
}
}
}
}
//Other Workspace data
if (project != null) {
for (Enumeration<? extends ZipEntry> e = zip.entries(); e.hasMoreElements();) {
entry = e.nextElement();
InputStream is = null;
String name = entry.getName();
if (name.matches("Workspace_[0-9]*_.*_bytes")) {
try {
is = zip.getInputStream(entry);
Matcher matcher = Pattern.compile("Workspace_([0-9]*)_(.*)_bytes").matcher(name);
matcher.find();
String workspaceId = matcher.group(1);
String providerId = matcher.group(2);
WorkspaceProviderImpl workspaceProvider = project.getLookup().lookup(WorkspaceProviderImpl.class);
Workspace workspace = workspaceProvider.getWorkspace(Integer.parseInt(workspaceId));
if (workspace != null) {
readWorkspaceBytes(is, workspace, providerId);
}
} finally {