Skip to content

Commit

Permalink
Minor code reformatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrtannus committed Oct 31, 2018
1 parent 8741a23 commit ecd205b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
package org.cytoscape.cmdline.gui.internal;

import java.util.Properties;

import org.cytoscape.app.event.AppsFinishedStartingListener;
import org.cytoscape.application.CyShutdown;
import org.cytoscape.application.CyVersion;
import org.cytoscape.cmdline.CommandLineArgs;
import org.cytoscape.io.util.StreamUtil;
import org.cytoscape.property.CyProperty;
import org.cytoscape.service.util.AbstractCyActivator;
import org.cytoscape.service.util.CyServiceRegistrar;
import org.cytoscape.task.read.LoadNetworkFileTaskFactory;
import org.cytoscape.task.read.LoadNetworkURLTaskFactory;
import org.cytoscape.task.read.LoadVizmapFileTaskFactory;
import org.cytoscape.task.read.OpenSessionTaskFactory;
import org.osgi.framework.BundleContext;

/*
* #%L
* Cytoscape GUI Command Line Parser Impl (gui-cmdline-parser-impl)
* $Id:$
* $HeadURL:$
* %%
* Copyright (C) 2006 - 2013 The Cytoscape Consortium
* Copyright (C) 2006 - 2018 The Cytoscape Consortium
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
Expand All @@ -26,32 +40,15 @@
* #L%
*/

import java.util.Properties;

import org.cytoscape.application.CyShutdown;
import org.cytoscape.application.CyVersion;
import org.cytoscape.cmdline.CommandLineArgs;
import org.cytoscape.io.util.StreamUtil;
import org.cytoscape.property.CyProperty;
import org.cytoscape.service.util.AbstractCyActivator;
import org.cytoscape.service.util.CyServiceRegistrar;
import org.cytoscape.task.read.LoadNetworkFileTaskFactory;
import org.cytoscape.task.read.LoadNetworkURLTaskFactory;
import org.cytoscape.task.read.LoadVizmapFileTaskFactory;
import org.cytoscape.task.read.OpenSessionTaskFactory;
import org.cytoscape.work.TaskManager;
import org.osgi.framework.BundleContext;

public class CyActivator extends AbstractCyActivator {
public CyActivator() {
super();
}

@Override
@SuppressWarnings("unchecked")
public void start(BundleContext bc) {
CommandLineArgs args = getService(bc,CommandLineArgs.class);
CyVersion cyVersion = getService(bc,CyVersion.class);
CyShutdown cyShutdown = getService(bc,CyShutdown.class);
StreamUtil streamUtil = getService(bc,StreamUtil.class);
CommandLineArgs args = getService(bc, CommandLineArgs.class);
CyVersion cyVersion = getService(bc, CyVersion.class);
CyShutdown cyShutdown = getService(bc, CyShutdown.class);
StreamUtil streamUtil = getService(bc, StreamUtil.class);
OpenSessionTaskFactory loadSession = getService(bc, OpenSessionTaskFactory.class);
LoadNetworkFileTaskFactory networkFileLoader = getService(bc, LoadNetworkFileTaskFactory.class);
LoadNetworkURLTaskFactory networkURLLoader = getService(bc, LoadNetworkURLTaskFactory.class);
Expand All @@ -64,7 +61,7 @@ public void start(BundleContext bc) {
networkURLLoader, visualStylesLoader, registrar);
registerService(bc, sc, AppsFinishedStartingListener.class);

Parser p = new Parser(args.getArgs(), cyShutdown, cyVersion, sc,props.getProperties());
Parser p = new Parser(args.getArgs(), cyShutdown, cyVersion, sc, props.getProperties());
sc.start();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,19 @@ public void setVizMapProps(String[] args){
taskStart = true;
}

public void start() {
protected void start() {
// set the properties
// no need to do this in a task since it's so fast
//globalProps.putAll(localProps);

CyProperty<Properties> commandline = new SimpleCyProperty<>("commandline", localProps,
Properties.class, CyProperty.SavePolicy.DO_NOT_SAVE);
Properties cmdlnProps = new Properties();
cmdlnProps.setProperty("cyPropertyName","commandline.props");
cmdlnProps.setProperty("cyPropertyName", "commandline.props");
registrar.registerService(commandline, CyProperty.class, cmdlnProps);

// Only proceed if we've specified tasks for execution
// on the command line.
if ( !taskStart )
// Only proceed if we've specified tasks for execution on the command line.
if (!taskStart)
return;

// Since we've set command line args we presumably
Expand All @@ -246,7 +245,6 @@ public void start() {

if (sessionName != null) {
taskIteratorList.add(loadSession.createTaskIterator(sessionName));

} else {
for (File network : networkFiles)
taskIteratorList.add(networkFileLoader.createTaskIterator(network));
Expand All @@ -263,6 +261,5 @@ private class DummyTask extends AbstractTask{
public void run(TaskMonitor taskMonitor) throws Exception {
//DO nothing it is a dummy task just to initiate the iterator
}

}
}

0 comments on commit ecd205b

Please sign in to comment.