From: <bea...@us...> - 2006-09-19 17:48:15
|
Revision: 202 http://svn.sourceforge.net/cishell/?rev=202&view=rev Author: bearsfan Date: 2006-09-19 10:48:09 -0700 (Tue, 19 Sep 2006) Log Message: ----------- Direct conversion of the previous version of the data manager viewer required some external helper classes. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/Activator.java Removed Paths: ------------- trunk/clients/gui/org.cishell.reference.gui.datamanager/icons/ trunk/clients/gui/org.cishell.reference.gui.datamanager/plugin.xml trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/DataManagerView.java Modified: trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF 2006-09-19 14:02:36 UTC (rev 201) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF 2006-09-19 17:48:09 UTC (rev 202) @@ -8,3 +8,8 @@ Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime Eclipse-LazyStart: true +Import-Package: org.cishell.app.service.datamanager, + org.cishell.framework, + org.cishell.framework.data, + org.osgi.service.log;version="1.3.0" +Export-Package: org.cishell.reference.gui.datamanager Deleted: trunk/clients/gui/org.cishell.reference.gui.datamanager/plugin.xml =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.datamanager/plugin.xml 2006-09-19 14:02:36 UTC (rev 201) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/plugin.xml 2006-09-19 17:48:09 UTC (rev 202) @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.2"?> -<plugin> - <extension - point="org.eclipse.ui.views"> - <view - allowMultiple="false" - class="org.cishell.reference.gui.datamanager.DataManagerView" - icon="icons/datamanager_icon.gif" - id="org.cishell.reference.gui.datamanager.DataManagerView" - name="Data Manager"/> - </extension> -</plugin> Modified: trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/Activator.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/Activator.java 2006-09-19 14:02:36 UTC (rev 201) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/Activator.java 2006-09-19 17:48:09 UTC (rev 202) @@ -1,7 +1,9 @@ package org.cishell.reference.gui.datamanager; +import org.cishell.app.service.datamanager.DataManagerService; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; +import org.osgi.service.log.LogService; /** * The activator class controls the plug-in life cycle @@ -10,6 +12,7 @@ // The plug-in ID public static final String PLUGIN_ID = "org.cishell.reference.gui.datamanager"; + private static BundleContext context; // The shared instance private static Activator plugin; @@ -27,6 +30,8 @@ */ public void start(BundleContext context) throws Exception { super.start(context); + + Activator.context = context; } /* @@ -46,5 +51,18 @@ public static Activator getDefault() { return plugin; } - + + protected static DataManagerService getDataManagerService() { + DataManagerService manager = (DataManagerService) context.getService( + context.getServiceReference(DataManagerService.class.getName())); + + return manager; + } + + protected static LogService getLogService() { + LogService log = (LogService) context.getService( + context.getServiceReference(LogService.class.getName())); + + return log; + } } Deleted: trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/DataManagerView.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/DataManagerView.java 2006-09-19 14:02:36 UTC (rev 201) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/DataManagerView.java 2006-09-19 17:48:09 UTC (rev 202) @@ -1,41 +0,0 @@ -/* **************************************************************************** - * CIShell: Cyberinfrastructure Shell, An Algorithm Integration Framework. - * - * All rights reserved. This program and the accompanying materials are made - * available under the terms of the Apache License v2.0 which accompanies - * this distribution, and is available at: - * http://www.apache.org/licenses/LICENSE-2.0.html - * - * Created on Aug 21, 2006 at Indiana University. - * - * Contributors: - * Indiana University - - * ***************************************************************************/ -package org.cishell.reference.gui.datamanager; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.part.ViewPart; - -/** - * - * @author Bruce Herr (bh...@bh...) - */ -public class DataManagerView extends ViewPart { - - public DataManagerView() {} - - /** - * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) - */ - public void createPartControl(Composite parent) { - Label label = new Label(parent, SWT.NONE); - label.setText("Data Manager"); - } - - /** - * @see org.eclipse.ui.part.WorkbenchPart#setFocus() - */ - public void setFocus() {} -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bea...@us...> - 2006-10-13 17:22:23
|
Revision: 273 http://svn.sourceforge.net/cishell/?rev=273&view=rev Author: bearsfan Date: 2006-10-13 10:22:17 -0700 (Fri, 13 Oct 2006) Log Message: ----------- getsaveservice and checked for current UI thread Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/Activator.java Modified: trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF 2006-10-13 17:18:53 UTC (rev 272) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF 2006-10-13 17:22:17 UTC (rev 273) @@ -10,6 +10,7 @@ Eclipse-LazyStart: true Import-Package: org.cishell.app.service.datamanager, org.cishell.framework, + org.cishell.framework.algorithm, org.cishell.framework.data, org.osgi.service.log;version="1.3.0" Export-Package: org.cishell.reference.gui.datamanager Modified: trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java 2006-10-13 17:18:53 UTC (rev 272) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java 2006-10-13 17:22:17 UTC (rev 273) @@ -16,6 +16,7 @@ import java.util.Dictionary; import java.util.HashMap; import java.util.HashSet; +import java.util.Hashtable; import java.util.Iterator; import java.util.Map; import java.util.Set; @@ -23,6 +24,8 @@ import org.cishell.app.service.datamanager.DataManagerListener; import org.cishell.app.service.datamanager.DataManagerService; +import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.data.Data; import org.cishell.framework.data.DataProperty; import org.eclipse.jface.viewers.ISelection; @@ -84,9 +87,13 @@ private Menu menu; private Map dataToDataGUIItemMap; + + private AlgorithmFactory saveFactory; private DiscardListener discardListener; + private SaveListener saveListener; + public AbstractDataManagerView(String brandPluginID) { manager = Activator.getDataManagerService(); this.brandPluginID = brandPluginID; @@ -124,7 +131,14 @@ MenuItem saveItem = new MenuItem(menu, SWT.PUSH); saveItem.setText("Save"); - saveItem.setEnabled(false); + this.saveFactory = Activator.getSaveService(); + if (this.saveFactory != null) { + saveListener = new SaveListener(); + saveItem.addListener(SWT.Selection, saveListener); + } + else { + saveItem.setEnabled(false); + } MenuItem renameItem = new MenuItem(menu, SWT.PUSH); renameItem.setText("Rename"); @@ -191,7 +205,8 @@ // update the ModelManager with the new selection final Set selection = new HashSet(); selection.add(data); - Display.getDefault().syncExec(new Runnable() { + + guiRun(new Runnable() { public void run() { if (!tree.isDisposed()) { // update the TreeView @@ -206,6 +221,14 @@ } }); } + + private void guiRun(Runnable run) { + if (Thread.currentThread() == Display.getDefault().getThread()) { + run.run(); + } else { + Display.getDefault().syncExec(run); + } + } public void dataLabelChanged(Data data, String label) { if (data != null && label != null) { @@ -231,7 +254,7 @@ public void dataSelected(final Data[] data) { if (data != null) { //setFocus(); - Display.getDefault().syncExec(new Runnable() { + guiRun(new Runnable() { public void run() { Set itemSet = new HashSet(); for (int i = 0; i < data.length; ++i) { @@ -396,6 +419,20 @@ } } + + private class SaveListener implements Listener { + public void handleEvent(Event event) { + if (AbstractDataManagerView.this.saveFactory != null) { + TreeItem[] selection = AbstractDataManagerView.this.tree.getSelection(); + Data data = ((DataGUIItem)selection[0].getData()).getModel(); + Algorithm algorithm = AbstractDataManagerView.this.saveFactory.createAlgorithm(new Data[]{data}, + new Hashtable(), + Activator.getCIShellContext()); + algorithm.execute(); + } + } + } + private class DiscardListener implements Listener { public void handleEvent(Event event) { TreeItem[] selection = AbstractDataManagerView.this.tree Modified: trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/Activator.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/Activator.java 2006-10-13 17:18:53 UTC (rev 272) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/Activator.java 2006-10-13 17:22:17 UTC (rev 273) @@ -1,8 +1,14 @@ package org.cishell.reference.gui.datamanager; import org.cishell.app.service.datamanager.DataManagerService; +import org.cishell.framework.CIShellContext; +import org.cishell.framework.LocalCIShellContext; +import org.cishell.framework.algorithm.AlgorithmFactory; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; import org.osgi.service.log.LogService; /** @@ -65,4 +71,24 @@ return log; } + + protected static AlgorithmFactory getSaveService() { + ServiceReference[] refs; + try { + refs = context.getServiceReferences(AlgorithmFactory.class.getName(), + "(&("+Constants.SERVICE_PID+"=org.cishell.reference.gui.persistence.save.Save))"); + if (refs != null && refs.length > 0) { + return (AlgorithmFactory) context.getService(refs[0]); + } else { + return null; + } + } catch (InvalidSyntaxException e) { + e.printStackTrace(); + return null; + } + } + + protected static CIShellContext getCIShellContext() { + return new LocalCIShellContext(context); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2008-06-11 15:45:00
|
Revision: 779 http://cishell.svn.sourceforge.net/cishell/?rev=779&view=rev Author: mwlinnem Date: 2008-06-11 08:41:49 -0700 (Wed, 11 Jun 2008) Log Message: ----------- Changed error handling so more informative message is shown. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java Modified: trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF 2008-05-09 14:14:22 UTC (rev 778) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF 2008-06-11 15:41:49 UTC (rev 779) @@ -10,7 +10,9 @@ org.cishell.framework;version="1.0.0", org.cishell.framework.algorithm;version="1.0.0", org.cishell.framework.data;version="1.0.0", + org.cishell.reference.gui.datamanager, org.cishell.reference.gui.workspace, + org.cishell.service.guibuilder;version="1.0.0", org.osgi.service.log;version="1.3.0" Export-Package: org.cishell.reference.gui.datamanager Bundle-ActivationPolicy: lazy Modified: trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java 2008-05-09 14:14:22 UTC (rev 778) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java 2008-06-11 15:41:49 UTC (rev 779) @@ -502,14 +502,16 @@ }catch (AlgorithmExecutionException aee) { if (log != null) { log.log(LogService.LOG_ERROR, - "org.cishell.framework.algorithm.AlgorithmExecutionException", + aee.getMessage(), aee); + aee.printStackTrace(); } else { log = Activator.getLogService(); log.log(LogService.LOG_ERROR, "org.cishell.framework.algorithm.AlgorithmExecutionException", aee); + aee.printStackTrace(); } } } @@ -528,16 +530,17 @@ algorithm.execute(); }catch (AlgorithmExecutionException aee) { if (log != null) { - log.log(LogService.LOG_ERROR, - "org.cishell.framework.algorithm.AlgorithmExecutionException", + log.log(LogService.LOG_ERROR, + aee.getMessage(), aee); } else { log = Activator.getLogService(); - log.log(LogService.LOG_ERROR, - "org.cishell.framework.algorithm.AlgorithmExecutionException", + log.log(LogService.LOG_ERROR, + aee.getMessage(), aee); } + aee.printStackTrace(); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |