use of org.gephi.project.api.WorkspaceProvider in project gephi by gephi.
the class DataTableTopComponent method prepareTableExportFileName.
private String prepareTableExportFileName() {
String fileName = null;
ProjectInformation projectInfo = pc.getCurrentProject().getLookup().lookup(ProjectInformation.class);
if (projectInfo.hasFile()) {
fileName = removeFileNameExtension(projectInfo.getFileName());
}
WorkspaceProvider wp = pc.getCurrentProject().getLookup().lookup(WorkspaceProvider.class);
if (wp.getWorkspaces().length > 1 || fileName == null) {
if (fileName != null) {
fileName += " - ";
} else {
fileName = "";
}
WorkspaceInformation workspaceInfo = pc.getCurrentWorkspace().getLookup().lookup(WorkspaceInformation.class);
if (workspaceInfo.hasSource()) {
fileName += removeFileNameExtension(workspaceInfo.getSource());
} else {
fileName += workspaceInfo.getName();
}
}
return fileName;
}
use of org.gephi.project.api.WorkspaceProvider in project gephi by gephi.
the class WorkspacePanel method refreshModel.
private synchronized void refreshModel() {
ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
if (pc.getCurrentProject() != null) {
WorkspaceProvider workspaceProvider = pc.getCurrentProject().getLookup().lookup(WorkspaceProvider.class);
Workspace[] workspaces = workspaceProvider.getWorkspaces();
if (workspaces.length > 0) {
for (Workspace workspace : workspaces) {
int index = tabDataModel.size();
WorkspaceInformation workspaceInformation = workspace.getLookup().lookup(WorkspaceInformation.class);
tabDataModel.addTab(index, new TabData(new WorkspaceComponent(workspace), null, workspaceInformation.getName(), workspaceInformation.getSource()));
if (workspaceProvider.getCurrentWorkspace() == workspace) {
tabbedContainer.getSelectionModel().setSelectedIndex(index);
workspace.getLookup().lookup(WorkspaceInformation.class).addChangeListener(this);
}
}
return;
}
}
// Clear
tabbedContainer.getSelectionModel().clearSelection();
if (tabDataModel.size() > 0) {
tabDataModel.removeTabs(0, tabDataModel.size() - 1);
}
}
Aggregations