From: lempinen Date: Mon, 2 Aug 2010 06:05:26 +0000 (+0000) Subject: Trend shows multiple variables X-Git-Tag: simantics-1.2.0~143 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=c9b1a9216cfbf7059515ee1dc75e6d999d4b7c4d;p=simantics%2Fsysdyn.git Trend shows multiple variables git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@16893 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java index 7aca1505..b48574fd 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/trend/TrendView.java @@ -84,9 +84,8 @@ public class TrendView extends ViewPart { return sets[series].times.length; } - @SuppressWarnings("unchecked") @Override - public Comparable getSeriesKey(int series) { + public Comparable getSeriesKey(int series) { SysdynDataSet sds = sets[series]; if(sds.result == null) return sds.name; @@ -138,28 +137,12 @@ public class TrendView extends ViewPart { return; if(selection instanceof IStructuredSelection) { Set ress = ISelectionUtils.filterSetSelection(selection, Resource.class); - Resource runtime = ISelectionUtils.getSinglePossibleKey(selection, SelectionHints.KEY_VARIABLE_RESOURCE, Resource.class); -// Object[] els = ((IStructuredSelection) selection).toArray(); -// Resource[] resources = new Resource[els.length]; -// for(int i=0;i datasets = new ArrayList(); for(Resource resource : resources) { SysdynDataSet set = load(g, resource, runtime); - if(set == null) return; + if(set == null) { + return; + } datasets.add(set); } @@ -201,28 +186,6 @@ public class TrendView extends ViewPart { }); } -// Runnable updater = new Runnable() { -// @Override -// public void run() { -// updateView(); -// } -// }; -// -// HashMap models = new HashMap(); -// protected SysdynModel getModel(ReadGraph g, Resource configuration) { -// synchronized(models) { -// SysdynModel model = models.get(configuration); -// if(model == null) { -// model = -// SysdynModelManager.getInstance(g.getSession()).getModel(g, configuration); -// // SimulationScheduler.start(model); Don't want this to operate simulation -// model.addResultListener(updater); -// models.put(configuration, model); -// } -// return model; -// } -// } - protected SysdynDataSet load(ReadGraph g, Resource element, Resource runtime) throws DatabaseException { Builtins b = g.getBuiltins(); @@ -255,50 +218,6 @@ public class TrendView extends ViewPart { } return null; -// graph.syncre -// -// -// String prefix = ""; -// Resource model = g.getResource((String)g.getPossibleRelatedValue(runtime, dr.HasModelURI)); -// Resource configuration = g.getPossibleObject(model, b.HasConfiguration); -// String rvi = g.getPossibleRelatedValue(runtime, dr.HasRVI); -// if(rvi.startsWith("/")) { -// rvi = rvi.substring(1); -// prefix = rvi.replace("/", ".") + "."; -// } -//// System.out.println("load results rvi='" + rvi + "' prefix='" + prefix + "'"); -// -// ModelingResources mr = ModelingResources.getInstance(g); -// Resource map = g.getPossibleObject(resource, mr.ElementToComponent); -// if(map != null) resource = map; -// -// if(g.isInstanceOf(resource, sr.Variable)) { -// Resource module = g.getPossibleObject(resource, b.PartOf); -//// while(!g.isInstanceOf(module, sr.Configuration)) { -//// module = g.getPossibleObject(module, b.PartOf); -//// } -// if(g.isInstanceOf(module, sr.Configuration)) { -// -// SysdynModel sm = getModel(g, configuration); -// if(model == null) -// return null; -// -// IElement element = sm.getElement(resource); -// if(element instanceof Variable) { -// Variable var = (Variable)element; -// -// Collection activeResults = sm.getActiveResults(g); -// ArrayList datasets = new ArrayList(); -// for(SysdynResult r : activeResults) { -// SysdynDataSet sdds = r.getDataSet(prefix + var.getName()); -// if(sdds != null) datasets.add(sdds); -// } -// return datasets; -// } -// -// } -// } -// return null; } @Override