From 7c73e74fa2f15c4e3f50b4c1140548ad0b6973d5 Mon Sep 17 00:00:00 2001 From: Samuel Gratzl Date: Thu, 4 Jul 2013 14:12:53 +0200 Subject: [PATCH] move loading data right after the splash initialization + use SubMonitors for the parser,... --- .../caleydo/core/internal/Application.java | 35 +++++++++++++++---- .../internal/ApplicationWorkbenchAdvisor.java | 24 +------------ .../core/io/parser/ascii/GroupingParser.java | 18 +++++----- .../core/io/parser/ascii/IDMappingParser.java | 10 +++--- .../io/parser/ascii/TabularDataParser.java | 11 +++--- .../caleydo/core/manager/GeneralManager.java | 33 +++++++++-------- .../core/serialize/ProjectManager.java | 19 ++++++---- .../core/startup/IStartupProcedure.java | 15 ++------ .../core/startup/ImportStartupProcedure.java | 13 ++++--- .../startup/InteractiveSplashHandler.java | 8 ++++- .../startup/LoadProjectStartupProcedure.java | 17 ++++----- .../internal/GenericGUIStartupProcedure.java | 6 ++-- .../internal/GeneticGUIStartupProcedure.java | 6 ++-- .../pathway/manager/PathwayManager.java | 2 -- .../external/AExternalScoreParser.java | 25 ++++++++----- 15 files changed, 124 insertions(+), 118 deletions(-) diff --git a/org.caleydo.core/src/org/caleydo/core/internal/Application.java b/org.caleydo.core/src/org/caleydo/core/internal/Application.java index 3cb01bbcf8..cbcc2932c7 100644 --- a/org.caleydo.core/src/org/caleydo/core/internal/Application.java +++ b/org.caleydo.core/src/org/caleydo/core/internal/Application.java @@ -27,6 +27,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; import org.kohsuke.args4j.ClassParser; import org.kohsuke.args4j.CmdLineException; import org.kohsuke.args4j.CmdLineParser; @@ -35,12 +36,19 @@ * This class controls all aspects of the application's execution */ public class Application implements IApplication { + private static Application instance; + public static Application get() { + return instance; + } + + private IStartupProcedure startup; @Override public Object start(IApplicationContext context) throws Exception { final Logger log = Logger.create(Application.class); try { + instance = this; log.info("Starting Caleydo"); dumpEnvironment(log); @@ -59,7 +67,7 @@ public Object start(IApplicationContext context) throws Exception { // create a select the startup pro Display display = PlatformUI.createDisplay(); - IStartupProcedure startup = selectStartupProcedure(startups, display); + startup = selectStartupProcedure(startups, display); if (startup == null) return EXIT_OK; // unstartable startups = null; // cleanup @@ -69,12 +77,7 @@ public Object start(IApplicationContext context) throws Exception { return EXIT_OK; } - ApplicationWorkbenchAdvisor advisor = new ApplicationWorkbenchAdvisor(startup); - - // cleanup - startup = null; - - int returnCode = PlatformUI.createAndRunWorkbench(display, advisor); + int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); log.info("Bye bye!"); @@ -86,9 +89,12 @@ public Object start(IApplicationContext context) throws Exception { } catch (Exception e) { log.error("Caught exception, crashing.", e); throw e; + } finally { + instance = null; } } + /** * @param startups * @param display @@ -194,4 +200,19 @@ public void run() { } }); } + + + public void runStartup() { + assert startup != null; + startup.run(); + } + + /** + * @param windowConfigurer + */ + public void postWorkbenchOpen(IWorkbenchWindowConfigurer windowConfigurer) { + startup.postWorkbenchOpen(windowConfigurer); + windowConfigurer.getWindow().getShell().setMaximized(true); + startup = null; + } } diff --git a/org.caleydo.core/src/org/caleydo/core/internal/ApplicationWorkbenchAdvisor.java b/org.caleydo.core/src/org/caleydo/core/internal/ApplicationWorkbenchAdvisor.java index f5ddc39b38..e5041ac698 100644 --- a/org.caleydo.core/src/org/caleydo/core/internal/ApplicationWorkbenchAdvisor.java +++ b/org.caleydo.core/src/org/caleydo/core/internal/ApplicationWorkbenchAdvisor.java @@ -11,7 +11,6 @@ import org.caleydo.core.gui.perspective.GenomePerspective; import org.caleydo.core.manager.GeneralManager; import org.caleydo.core.serialize.ProjectManager; -import org.caleydo.core.startup.IStartupProcedure; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.MenuManager; @@ -23,27 +22,9 @@ import org.eclipse.ui.application.WorkbenchAdvisor; import org.eclipse.ui.application.WorkbenchWindowAdvisor; -import com.google.common.base.Function; - public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { - private IStartupProcedure startup; - - public ApplicationWorkbenchAdvisor(IStartupProcedure startup) { - this.startup = startup; - } @Override public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(final IWorkbenchWindowConfigurer configurer) { - // Init the core because the workbench must already be initialized for - // the XML startup progress bar - - configurer.setTitle("Caleydo - unsaved project"); - startup.run(new Function() { - @Override - public Void apply(String data) { - configurer.setTitle(data); - return null; - } - }); return new ApplicationWorkbenchWindowAdvisor(configurer); } @@ -148,10 +129,7 @@ public void postWindowOpen() { removeNonCaleydoMenuEntries(getWindowConfigurer()); - startup.postWorkbenchOpen(); - startup = null; // cleanup not used any longer - - getWindowConfigurer().getWindow().getShell().setMaximized(true); + Application.get().postWorkbenchOpen(getWindowConfigurer()); } } } diff --git a/org.caleydo.core/src/org/caleydo/core/io/parser/ascii/GroupingParser.java b/org.caleydo.core/src/org/caleydo/core/io/parser/ascii/GroupingParser.java index fff89b551f..b1ca53a466 100644 --- a/org.caleydo.core/src/org/caleydo/core/io/parser/ascii/GroupingParser.java +++ b/org.caleydo.core/src/org/caleydo/core/io/parser/ascii/GroupingParser.java @@ -22,6 +22,7 @@ import org.caleydo.core.util.logging.Logger; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubMonitor; /** * Parses a delimited text file which contains information on groupings of ids. Creates @@ -46,9 +47,8 @@ public GroupingParser(GroupingParseSpecification groupingSpecifications, IDType @Override protected void parseFile(BufferedReader reader) throws IOException { - - GeneralManager.get().updateProgressLabel("Loading groupings for " + targetIDType); - float progressBarFactor = 100f / numberOfLinesInFile; + SubMonitor monitor = GeneralManager.get().createSubProgressMonitor(); + monitor.beginTask("Loading groupings for " + targetIDType, numberOfLinesInFile + 20); IDSpecification idSpecification = groupingSpecifications.getRowIDSpecification(); IDType sourceIDType = IDType.getIDType(idSpecification.getIdType()); @@ -68,6 +68,7 @@ else if (sourceIDType.getIdTypeParsingRules() != null) if (groupingSpecifications.getDataSourcePath() == null) { Logger.log(new Status(IStatus.INFO, this.toString(), "No path for grouping specified")); + monitor.done(); return; } try { @@ -145,7 +146,9 @@ else if (sourceIDType.getIdTypeParsingRules() != null) } if (line == null) break; - + lineCounter++; + if (lineCounter % 100 == 0) + monitor.worked(100); // read ID String[] columns = line.split(groupingSpecifications.getDelimiter()); String originalID = columns[groupingSpecifications.getColumnOfRowIds()]; @@ -176,12 +179,9 @@ else if (sourceIDType.getIdTypeParsingRules() != null) group.add(mappedID); groupListCounter++; } - lineCounter++; - if (lineCounter % 100 == 0) { - GeneralManager.get().updateProgress((int) (progressBarFactor * lineCounter)); - } } + monitor.setWorkRemaining(20); // Create the initialization data perspectiveInitializationDatas = new ArrayList(); @@ -217,6 +217,8 @@ else if (sourceIDType.getIdTypeParsingRules() != null) } catch (IOException ioException) { throw new IllegalStateException("Could not read file: " + groupingSpecifications.getDataSourcePath()); + } finally { + monitor.done(); } } diff --git a/org.caleydo.core/src/org/caleydo/core/io/parser/ascii/IDMappingParser.java b/org.caleydo.core/src/org/caleydo/core/io/parser/ascii/IDMappingParser.java index 1497335608..4374a2862c 100644 --- a/org.caleydo.core/src/org/caleydo/core/io/parser/ascii/IDMappingParser.java +++ b/org.caleydo.core/src/org/caleydo/core/io/parser/ascii/IDMappingParser.java @@ -18,6 +18,7 @@ import org.caleydo.core.util.logging.Logger; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubMonitor; /** *

@@ -116,14 +117,12 @@ public final void setTokenSeperator(final String tokenSeparator) { @Override protected void parseFile(BufferedReader reader) throws IOException { - - GeneralManager.get().updateProgressLabel("Loading ID mapping for " + mappingType); + SubMonitor monitor = GeneralManager.get().createSubProgressMonitor(); String line; int lineCounter = 0; calculateNumberOfLinesInFile(); - - float progressBarFactor = 100f / numberOfLinesInFile; + monitor.beginTask("Loading ID mapping for " + mappingType, numberOfLinesInFile); while ((line = reader.readLine()) != null && lineCounter <= stopParsingAtLine) { /** @@ -167,9 +166,10 @@ protected void parseFile(BufferedReader reader) throws IOException { // Update progress bar only on each 100th line if (lineCounter % 100 == 0) { - GeneralManager.get().updateProgress((int) (progressBarFactor * lineCounter)); + monitor.worked(100); } lineCounter++; } + monitor.done(); } } diff --git a/org.caleydo.core/src/org/caleydo/core/io/parser/ascii/TabularDataParser.java b/org.caleydo.core/src/org/caleydo/core/io/parser/ascii/TabularDataParser.java index 2c6f38cd3d..adc217daa6 100644 --- a/org.caleydo.core/src/org/caleydo/core/io/parser/ascii/TabularDataParser.java +++ b/org.caleydo.core/src/org/caleydo/core/io/parser/ascii/TabularDataParser.java @@ -38,6 +38,7 @@ import org.caleydo.core.util.logging.Logger; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubMonitor; /** *

@@ -113,7 +114,6 @@ private void initializTables() { } } - calculateNumberOfLinesInFile(); int numberOfDataLines = numberOfLinesInFile - dataSetDescription.getNumberOfHeaderLines(); // prepare for id setting of column IDs @@ -241,15 +241,15 @@ else if (sourceColumnIDType.getIdTypeParsingRules() != null) @Override protected void parseFile(BufferedReader reader) throws IOException { + SubMonitor monitor = GeneralManager.get().createSubProgressMonitor(); + monitor.beginTask("Loading data for: " + dataSetDescription.getDataSetName(), calculateNumberOfLinesInFile()); initializTables(); // Init progress bar - GeneralManager.get().updateProgressLabel("Loading data for: " + dataSetDescription.getDataSetName()); - float progressBarFactor = 100f / numberOfLinesInFile; - for (int countHeaderLines = 0; countHeaderLines < dataSetDescription.getNumberOfHeaderLines(); countHeaderLines++) { reader.readLine(); } + monitor.worked(dataSetDescription.getNumberOfHeaderLines()); List parsingPattern = dataSetDescription.getOrCreateParsingPattern(); @@ -361,7 +361,7 @@ else if (toIDType.getIdTypeParsingRules() != null) } if (lineCounter % 100 == 0) { - GeneralManager.get().updateProgress((int) (progressBarFactor * lineCounter)); + monitor.worked(100); } lineCounter++; } @@ -369,6 +369,7 @@ else if (toIDType.getIdTypeParsingRules() != null) if (parsingErrorOccured) { Logger.log(new Status(IStatus.ERROR, this.toString(), numberParsingErrorMessage)); } + monitor.done(); } @Override diff --git a/org.caleydo.core/src/org/caleydo/core/manager/GeneralManager.java b/org.caleydo.core/src/org/caleydo/core/manager/GeneralManager.java index 7dba5cc980..c761109b56 100644 --- a/org.caleydo.core/src/org/caleydo/core/manager/GeneralManager.java +++ b/org.caleydo.core/src/org/caleydo/core/manager/GeneralManager.java @@ -25,7 +25,9 @@ import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtensionRegistry; import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.SubMonitor; /** * General manager that contains all module managers. @@ -77,7 +79,7 @@ public class GeneralManager { /** * Progress monitor of the splash. Only valid during startup. **/ - private IProgressMonitor splashProgressMonitor; + private SubMonitor progressMonitor; private ViewManager viewManager; private EventPublisher eventPublisher; @@ -90,6 +92,7 @@ public class GeneralManager { private Logger logger = Logger.create(GeneralManager.class); + public void init() { eventPublisher = EventPublisher.INSTANCE; viewManager = ViewManager.get(); @@ -211,22 +214,22 @@ public static boolean canLoadDataCreatedFor(String caleydoVersion) { } public void setSplashProgressMonitor(IProgressMonitor splashProgressMonitor) { - this.splashProgressMonitor = splashProgressMonitor; + this.progressMonitor = SubMonitor.convert(splashProgressMonitor, "Loading Caleydo", 1500); } - public void updateProgress(int percentage) { - if (splashProgressMonitor == null) { - logger.info("Progress update:" + percentage); - } else { - splashProgressMonitor.worked(percentage); - } - } + public SubMonitor createSubProgressMonitor() { + if (progressMonitor == null) + return SubMonitor.convert(new NullProgressMonitor() { + @Override + public void setTaskName(String name) { + logger.info("progress, set task: " + name); + } - public void updateProgressLabel(String message) { - if (splashProgressMonitor == null) { - logger.info("Progress update:" + message); - } else { - splashProgressMonitor.setTaskName(message); - } + @Override + public void beginTask(String name, int totalWork) { + logger.info("begin task: " + name + " (" + totalWork + ")"); + } + }); + return progressMonitor.newChild(100, SubMonitor.SUPPRESS_SUBTASK); } } diff --git a/org.caleydo.core/src/org/caleydo/core/serialize/ProjectManager.java b/org.caleydo.core/src/org/caleydo/core/serialize/ProjectManager.java index c5db5209b8..9591d02280 100644 --- a/org.caleydo.core/src/org/caleydo/core/serialize/ProjectManager.java +++ b/org.caleydo.core/src/org/caleydo/core/serialize/ProjectManager.java @@ -41,6 +41,7 @@ import org.caleydo.core.util.system.FileOperations; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.SubMonitor; import org.eclipse.core.runtime.jobs.IJobManager; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.operation.IRunnableWithProgress; @@ -178,6 +179,8 @@ private static SerializationData loadData(String dirName) throws IOException, JA .getResource(dirName + ProjectManager.DATA_DOMAIN_FILE)); SerializationData serializationData = new SerializationData(); + SubMonitor monitor = GeneralManager.get().createSubProgressMonitor(); + monitor.beginTask("Loading Data", dataDomainList.getDataDomains().size() * 10); for (ADataDomain dataDomain : dataDomainList.getDataDomains()) { DataSetDescription dataSetDescription = dataDomain.getDataSetDescription(); @@ -209,14 +212,14 @@ private static SerializationData loadData(String dirName) throws IOException, JA HashMap recordPerspectives = new HashMap(); - GeneralManager.get().updateProgressLabel("Loading groupings for: " + dataDomain.getLabel()); Set recordPerspectiveIDs = ((ATableBasedDataDomain) dataDomain).getRecordPerspectiveIDs(); Set dimensionPerspectiveIDs = ((ATableBasedDataDomain) dataDomain).getDimensionPerspectiveIDs(); int nrPerspectives = recordPerspectiveIDs.size() + dimensionPerspectiveIDs.size(); - float progressBarFactor = 100f / nrPerspectives; - int perspectiveCount = 0; + SubMonitor dataDomainMonitor = monitor.newChild(10, SubMonitor.SUPPRESS_SUBTASK); + dataDomainMonitor.beginTask("Loading groupings for: " + dataDomain.getLabel(), nrPerspectives); + for (String recordPerspectiveID : recordPerspectiveIDs) { Perspective recordPerspective = (Perspective) unmarshaller.unmarshal(GeneralManager.get() @@ -230,8 +233,7 @@ private static SerializationData loadData(String dirName) throws IOException, JA if (tree != null) recordPerspective.setTree(tree); - GeneralManager.get().updateProgress((int) (progressBarFactor * perspectiveCount)); - perspectiveCount++; + dataDomainMonitor.worked(1); } dataInitializationData.setRecordPerspectiveMap(recordPerspectives); @@ -249,15 +251,18 @@ private static SerializationData loadData(String dirName) throws IOException, JA ClusterTree tree = loadTree(extendedDirName + dimensionPerspectiveID + "_tree.xml", ((ATableBasedDataDomain) dataDomain).getDimensionIDType()); dimensionPerspective.setTree(tree); - GeneralManager.get().updateProgress((int) (progressBarFactor * perspectiveCount)); - perspectiveCount++; + dataDomainMonitor.worked(1); } dataInitializationData.setDimensionPerspectiveMap(dimensionPerspectives); serializationData.addDataDomainSerializationData(dataInitializationData); + dataDomainMonitor.done(); + + } else { + monitor.worked(10); } } diff --git a/org.caleydo.core/src/org/caleydo/core/startup/IStartupProcedure.java b/org.caleydo.core/src/org/caleydo/core/startup/IStartupProcedure.java index b0ef6a7717..6317100a27 100644 --- a/org.caleydo.core/src/org/caleydo/core/startup/IStartupProcedure.java +++ b/org.caleydo.core/src/org/caleydo/core/startup/IStartupProcedure.java @@ -5,14 +5,14 @@ ******************************************************************************/ package org.caleydo.core.startup; -import com.google.common.base.Function; +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; /** * * @author Samuel Gratzl * */ -public interface IStartupProcedure { +public interface IStartupProcedure extends Runnable { /** * Initialization stuff that has to be done before the workbench opens @@ -20,17 +20,8 @@ public interface IStartupProcedure { */ boolean preWorkbenchOpen(); - /** - * the actual work of this startup procedure - * - * @param setTitle - * callback for setting the window title - * @return whether the procedure was successful - */ - boolean run(Function setTitle); - /** * Initialization stuff that has to be done after the workbench opened (e.g., making a specific view activate) **/ - void postWorkbenchOpen(); + void postWorkbenchOpen(IWorkbenchWindowConfigurer configurer); } diff --git a/org.caleydo.core/src/org/caleydo/core/startup/ImportStartupProcedure.java b/org.caleydo.core/src/org/caleydo/core/startup/ImportStartupProcedure.java index df1ac23907..1bc460031d 100644 --- a/org.caleydo.core/src/org/caleydo/core/startup/ImportStartupProcedure.java +++ b/org.caleydo.core/src/org/caleydo/core/startup/ImportStartupProcedure.java @@ -8,16 +8,14 @@ import org.caleydo.core.gui.util.HelpButtonWizardDialog; import org.caleydo.core.io.gui.dataimport.wizard.DataImportWizard; import org.caleydo.core.serialize.ProjectManager; -import org.eclipse.jface.window.Window; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; - -import com.google.common.base.Function; +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; /** * Startup procedure for project wizard. - * + * * @author Alexander Lex * @author Marc Streit */ @@ -34,13 +32,14 @@ public boolean preWorkbenchOpen() { } @Override - public boolean run(Function setTitle) { + public void run() { DataImportWizard dataImportWizard = createDataImportWizard(); HelpButtonWizardDialog dialog = new HelpButtonWizardDialog(Display.getCurrent().getActiveShell(), dataImportWizard); - return Window.OK == dialog.open(); + dialog.open(); + return; } protected DataImportWizard createDataImportWizard() { @@ -48,7 +47,7 @@ protected DataImportWizard createDataImportWizard() { } @Override - public void postWorkbenchOpen() { + public void postWorkbenchOpen(IWorkbenchWindowConfigurer configurer) { // Make DVI visible if available try { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() diff --git a/org.caleydo.core/src/org/caleydo/core/startup/InteractiveSplashHandler.java b/org.caleydo.core/src/org/caleydo/core/startup/InteractiveSplashHandler.java index 68d9735d58..42487a2639 100644 --- a/org.caleydo.core/src/org/caleydo/core/startup/InteractiveSplashHandler.java +++ b/org.caleydo.core/src/org/caleydo/core/startup/InteractiveSplashHandler.java @@ -5,7 +5,9 @@ ******************************************************************************/ package org.caleydo.core.startup; +import org.caleydo.core.internal.Application; import org.caleydo.core.manager.GeneralManager; +import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.Rectangle; @@ -34,7 +36,11 @@ public void init(Shell splash) { // public the progress monitor - GeneralManager.get().setSplashProgressMonitor(this.getBundleProgressMonitor()); + IProgressMonitor monitor = this.getBundleProgressMonitor(); + monitor.beginTask("Loading Caleydo...", 100); + GeneralManager.get().setSplashProgressMonitor(monitor); + + Application.get().runStartup(); } } \ No newline at end of file diff --git a/org.caleydo.core/src/org/caleydo/core/startup/LoadProjectStartupProcedure.java b/org.caleydo.core/src/org/caleydo/core/startup/LoadProjectStartupProcedure.java index 7894efe477..018d1d1662 100644 --- a/org.caleydo.core/src/org/caleydo/core/startup/LoadProjectStartupProcedure.java +++ b/org.caleydo.core/src/org/caleydo/core/startup/LoadProjectStartupProcedure.java @@ -27,8 +27,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.jface.dialogs.MessageDialog; - -import com.google.common.base.Function; +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; public class LoadProjectStartupProcedure implements IStartupProcedure { /** @@ -69,7 +68,11 @@ public boolean preWorkbenchOpen() { } @Override - public void postWorkbenchOpen() { + public void postWorkbenchOpen(IWorkbenchWindowConfigurer configurer) { + if (packedProjectLocation != null) { + String normalized = this.packedProjectLocation.replace(File.separatorChar, '/'); + configurer.setTitle("Caleydo - " + normalized.substring(normalized.lastIndexOf('/') + 1)); + } } private static void deserializeData(SerializationData serializationDataList) { @@ -106,7 +109,7 @@ private static void deserializeData(SerializationData serializationDataList) { } @Override - public boolean run(Function setTitle) { + public void run() { SerializationData serializationDataList; // not calling super.init() on purpose @@ -115,12 +118,6 @@ public boolean run(Function setTitle) { serializationDataList = ProjectManager.loadProjectData(unpackedProjectLocation); - if (packedProjectLocation != null) { - String normalized = this.packedProjectLocation.replace(File.separatorChar, '/'); - setTitle.apply("Caleydo - " + normalized.substring(normalized.lastIndexOf('/') + 1)); - } - deserializeData(serializationDataList); - return true; } } diff --git a/org.caleydo.datadomain.generic/src/org/caleydo/datadomain/generic/internal/GenericGUIStartupProcedure.java b/org.caleydo.datadomain.generic/src/org/caleydo/datadomain/generic/internal/GenericGUIStartupProcedure.java index 8edafb39e1..37e96c899d 100644 --- a/org.caleydo.datadomain.generic/src/org/caleydo/datadomain/generic/internal/GenericGUIStartupProcedure.java +++ b/org.caleydo.datadomain.generic/src/org/caleydo/datadomain/generic/internal/GenericGUIStartupProcedure.java @@ -8,8 +8,6 @@ import org.caleydo.core.data.datadomain.DataDomainManager; import org.caleydo.core.startup.ImportStartupProcedure; -import com.google.common.base.Function; - /** * Startup procedure for project wizard. * @@ -18,8 +16,8 @@ public class GenericGUIStartupProcedure extends ImportStartupProcedure { @Override - public boolean run(Function setTitle) { + public void run() { DataDomainManager.get().initalizeDataDomain("org.caleydo.datadomain.generic"); - return super.run(setTitle); + super.run(); } } diff --git a/org.caleydo.datadomain.genetic/src/org/caleydo/datadomain/genetic/internal/GeneticGUIStartupProcedure.java b/org.caleydo.datadomain.genetic/src/org/caleydo/datadomain/genetic/internal/GeneticGUIStartupProcedure.java index dd34046d20..db7b949aae 100644 --- a/org.caleydo.datadomain.genetic/src/org/caleydo/datadomain/genetic/internal/GeneticGUIStartupProcedure.java +++ b/org.caleydo.datadomain.genetic/src/org/caleydo/datadomain/genetic/internal/GeneticGUIStartupProcedure.java @@ -14,8 +14,6 @@ import org.caleydo.datadomain.genetic.Activator; import org.caleydo.datadomain.genetic.Organism; -import com.google.common.base.Function; - /** * Startup procedure for project wizard. * @@ -35,10 +33,10 @@ public GeneticGUIStartupProcedure(Organism organism, boolean loadSampleData) { } @Override - public boolean run(Function setTitle) { + public void run() { Activator.setOrganism(organism); DataDomainManager.get().initalizeDataDomain("org.caleydo.datadomain.genetic"); - return super.run(setTitle); + super.run(); } diff --git a/org.caleydo.datadomain.pathway/src/org/caleydo/datadomain/pathway/manager/PathwayManager.java b/org.caleydo.datadomain.pathway/src/org/caleydo/datadomain/pathway/manager/PathwayManager.java index 2f2a2f85cf..6912fe7f89 100644 --- a/org.caleydo.datadomain.pathway/src/org/caleydo/datadomain/pathway/manager/PathwayManager.java +++ b/org.caleydo.datadomain.pathway/src/org/caleydo/datadomain/pathway/manager/PathwayManager.java @@ -314,8 +314,6 @@ public void loadPathwaysByType(PathwayDatabase pathwayDatabase) { } else { throw new IllegalStateException("Cannot load pathways from organism " + organism); } - - generalManager.updateProgressLabel("Loading KEGG Pathways..."); } pathwayResourceLoader = PathwayManager.get().getPathwayResourceLoader(pathwayDatabase.getType()); diff --git a/org.caleydo.view.tourguide/src/org/caleydo/view/tourguide/internal/external/AExternalScoreParser.java b/org.caleydo.view.tourguide/src/org/caleydo/view/tourguide/internal/external/AExternalScoreParser.java index 04369216c7..8653ea5935 100644 --- a/org.caleydo.view.tourguide/src/org/caleydo/view/tourguide/internal/external/AExternalScoreParser.java +++ b/org.caleydo.view.tourguide/src/org/caleydo/view/tourguide/internal/external/AExternalScoreParser.java @@ -20,6 +20,7 @@ import org.caleydo.core.util.execution.SafeCallable; import org.caleydo.core.util.logging.Logger; import org.caleydo.view.tourguide.api.score.ISerializeableScore; +import org.eclipse.core.runtime.SubMonitor; abstract class AExternalScoreParser extends ATextParser implements SafeCallable> { @@ -44,25 +45,29 @@ public AExternalScoreParser(T spec) { @Override protected void parseFile(BufferedReader reader) throws IOException { - GeneralManager.get().updateProgressLabel("Loading ranking"); + SubMonitor monitor = GeneralManager.get().createSubProgressMonitor(); + monitor.beginTask("Loading Ranking", this.calculateNumberOfLinesInFile() + 10); if (spec.getDataSourcePath() == null) { log.info("No path for ranking specified"); + monitor.done(); return; } if (spec.isRankParsing()) - parseRank(reader); + parseRank(reader, monitor); else - parseScore(reader); + parseScore(reader, monitor); + monitor.done(); } /** * @param reader + * @param monitor * @throws IOException */ - private void parseScore(BufferedReader reader) throws IOException { + private void parseScore(BufferedReader reader, SubMonitor monitor) throws IOException { final List columnsToRead = spec.getColumns(); List labels = new ArrayList<>(); @@ -81,6 +86,7 @@ private void parseScore(BufferedReader reader) throws IOException { labels.add(columns[col]); skipLines(reader, spec.getNumberOfHeaderLines() - 1 - spec.getRowOfColumnIDs()); } + monitor.worked(spec.getNumberOfHeaderLines()); // parse data @@ -93,6 +99,7 @@ private void parseScore(BufferedReader reader) throws IOException { while ((line = reader.readLine()) != null) { // read ID String[] columns = line.split(spec.getDelimiter()); + monitor.worked(1); K mappedID = extractID(columns[spec.getColumnOfRowIds()]); if (mappedID == null) @@ -109,7 +116,7 @@ private void parseScore(BufferedReader reader) throws IOException { scores[i].put(mappedID, s); } } - + monitor.setWorkRemaining(10); for (int i = 0; i < scores.length; ++i) { Map s = scores[i]; if (s.isEmpty()) @@ -148,11 +155,12 @@ else if (v > max) /** * @param reader + * @param monitor * @throws IOException */ - private void parseRank(BufferedReader reader) throws IOException { + private void parseRank(BufferedReader reader, SubMonitor monitor) throws IOException { skipLines(reader, spec.getNumberOfHeaderLines()); - + monitor.worked(spec.getNumberOfHeaderLines()); List ranks = new ArrayList<>(this.numberOfLinesInFile < 0 ? 100 : this.numberOfLinesInFile); String line; @@ -161,6 +169,7 @@ private void parseRank(BufferedReader reader) throws IOException { String[] columns = line.split(spec.getDelimiter()); K mappedID = extractID(columns[spec.getColumnOfRowIds()]); + monitor.worked(1); if (mappedID == null) continue; // read data @@ -170,7 +179,7 @@ private void parseRank(BufferedReader reader) throws IOException { if (ranks.isEmpty()) return; - + monitor.setWorkRemaining(10); float delta; if (spec.isNormalizeScores()) { // convert to score delta = -1.f / (ranks.size() - 1);