Search in sources :

Example 1 with WorkspaceProvider

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;
}
Also used : WorkspaceInformation(org.gephi.project.api.WorkspaceInformation) WorkspaceProvider(org.gephi.project.api.WorkspaceProvider) ProjectInformation(org.gephi.project.api.ProjectInformation)

Example 2 with WorkspaceProvider

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);
    }
}
Also used : WorkspaceInformation(org.gephi.project.api.WorkspaceInformation) WorkspaceProvider(org.gephi.project.api.WorkspaceProvider) TabData(org.netbeans.swing.tabcontrol.TabData) ProjectController(org.gephi.project.api.ProjectController) Workspace(org.gephi.project.api.Workspace)

Aggregations

WorkspaceInformation (org.gephi.project.api.WorkspaceInformation)2 WorkspaceProvider (org.gephi.project.api.WorkspaceProvider)2 ProjectController (org.gephi.project.api.ProjectController)1 ProjectInformation (org.gephi.project.api.ProjectInformation)1 Workspace (org.gephi.project.api.Workspace)1 TabData (org.netbeans.swing.tabcontrol.TabData)1