You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(7) |
Aug
|
Sep
(46) |
Oct
(102) |
Nov
(10) |
Dec
(21) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(1) |
Feb
(3) |
Mar
(14) |
Apr
(9) |
May
(12) |
Jun
(4) |
Jul
(40) |
Aug
(60) |
Sep
(38) |
Oct
(2) |
Nov
(1) |
Dec
(42) |
| 2008 |
Jan
(23) |
Feb
(29) |
Mar
(107) |
Apr
(27) |
May
(3) |
Jun
(1) |
Jul
(15) |
Aug
(7) |
Sep
(19) |
Oct
|
Nov
(2) |
Dec
|
| 2009 |
Jan
(36) |
Feb
(4) |
Mar
(2) |
Apr
(1) |
May
(1) |
Jun
(15) |
Jul
(30) |
Aug
(32) |
Sep
(11) |
Oct
(21) |
Nov
(12) |
Dec
(15) |
| 2010 |
Jan
(29) |
Feb
(9) |
Mar
(25) |
Apr
|
May
(7) |
Jun
(5) |
Jul
(21) |
Aug
(32) |
Sep
(10) |
Oct
(8) |
Nov
(29) |
Dec
(8) |
| 2011 |
Jan
(9) |
Feb
(35) |
Mar
(11) |
Apr
(4) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(3) |
Dec
(30) |
| 2012 |
Jan
(5) |
Feb
(7) |
Mar
(10) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <jrb...@us...> - 2011-02-22 16:55:13
|
Revision: 1227
http://cishell.svn.sourceforge.net/cishell/?rev=1227&view=rev
Author: jrbibers
Date: 2011-02-22 16:55:07 +0000 (Tue, 22 Feb 2011)
Log Message:
-----------
Switching CIShell build from Google Collections to Google Guava.
Modified Paths:
--------------
trunk/deployment/org.cishell.reference.database.feature/feature.xml
trunk/deployment/org.cishell.reference.feature/feature.xml
trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml
Modified: trunk/deployment/org.cishell.reference.database.feature/feature.xml
===================================================================
--- trunk/deployment/org.cishell.reference.database.feature/feature.xml 2011-02-22 16:15:08 UTC (rev 1226)
+++ trunk/deployment/org.cishell.reference.database.feature/feature.xml 2011-02-22 16:55:07 UTC (rev 1227)
@@ -103,7 +103,7 @@
unpack="false"/>
<plugin
- id="google_collections"
+ id="google_guava"
download-size="0"
install-size="0"
version="0.0.0"/>
Modified: trunk/deployment/org.cishell.reference.feature/feature.xml
===================================================================
--- trunk/deployment/org.cishell.reference.feature/feature.xml 2011-02-22 16:15:08 UTC (rev 1226)
+++ trunk/deployment/org.cishell.reference.feature/feature.xml 2011-02-22 16:55:07 UTC (rev 1227)
@@ -143,7 +143,7 @@
unpack="false"/>
<plugin
- id="google_collections"
+ id="google_guava"
download-size="0"
install-size="0"
version="0.0.0"/>
Modified: trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml
===================================================================
--- trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml 2011-02-22 16:15:08 UTC (rev 1226)
+++ trunk/deployment/org.cishell.reference.releng/build-files/fetchSvnAll.xml 2011-02-22 16:55:07 UTC (rev 1227)
@@ -219,8 +219,8 @@
</antcall>
<antcall target="svn.co">
<param name="target" value="plugins"/>
- <param name="element.id" value="google-collections"/>
- <param name="project.name" value="/libs/google-collections"/>
+ <param name="element.id" value="google-guava"/>
+ <param name="project.name" value="/libs/google-guava"/>
<param name="url" value="https://cishell.svn.sourceforge.net/svnroot/cishell/trunk"/>
</antcall>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jrb...@us...> - 2011-02-22 16:15:14
|
Revision: 1226
http://cishell.svn.sourceforge.net/cishell/?rev=1226&view=rev
Author: jrbibers
Date: 2011-02-22 16:15:08 +0000 (Tue, 22 Feb 2011)
Log Message:
-----------
Initial commit of Google Guava r08.
Added Paths:
-----------
trunk/libs/google-guava/.classpath
trunk/libs/google-guava/.project
trunk/libs/google-guava/.settings/
trunk/libs/google-guava/.settings/org.eclipse.jdt.core.prefs
trunk/libs/google-guava/.settings/org.eclipse.pde.core.prefs
trunk/libs/google-guava/META-INF/
trunk/libs/google-guava/META-INF/MANIFEST.MF
trunk/libs/google-guava/build.properties
trunk/libs/google-guava/guava-r08.jar
trunk/libs/google-guava/guava-src-r08.zip
Added: trunk/libs/google-guava/.classpath
===================================================================
--- trunk/libs/google-guava/.classpath (rev 0)
+++ trunk/libs/google-guava/.classpath 2011-02-22 16:15:08 UTC (rev 1226)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry exported="true" kind="lib" path="guava-r08.jar" sourcepath="guava-src-r08.zip">
+ <accessrules>
+ <accessrule kind="discouraged" pattern="com/google/common/base/internal/*"/>
+ </accessrules>
+ </classpathentry>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: trunk/libs/google-guava/.project
===================================================================
--- trunk/libs/google-guava/.project (rev 0)
+++ trunk/libs/google-guava/.project 2011-02-22 16:15:08 UTC (rev 1226)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>google-guava</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: trunk/libs/google-guava/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/libs/google-guava/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/libs/google-guava/.settings/org.eclipse.jdt.core.prefs 2011-02-22 16:15:08 UTC (rev 1226)
@@ -0,0 +1,8 @@
+#Mon Feb 21 16:17:44 EST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: trunk/libs/google-guava/.settings/org.eclipse.pde.core.prefs
===================================================================
--- trunk/libs/google-guava/.settings/org.eclipse.pde.core.prefs (rev 0)
+++ trunk/libs/google-guava/.settings/org.eclipse.pde.core.prefs 2011-02-22 16:15:08 UTC (rev 1226)
@@ -0,0 +1,5 @@
+#Mon Feb 21 16:17:44 EST 2011
+eclipse.preferences.version=1
+pluginProject.equinox=false
+pluginProject.extensions=false
+resolve.requirebundle=false
Added: trunk/libs/google-guava/META-INF/MANIFEST.MF
===================================================================
--- trunk/libs/google-guava/META-INF/MANIFEST.MF (rev 0)
+++ trunk/libs/google-guava/META-INF/MANIFEST.MF 2011-02-22 16:15:08 UTC (rev 1226)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: google-guava
+Bundle-SymbolicName: google-guava
+Bundle-Version: 0.8.0
+Bundle-ClassPath: guava-r08.jar
+Export-Package: com.google.common.annotations,
+ com.google.common.base,
+ com.google.common.base.internal,
+ com.google.common.collect,
+ com.google.common.io,
+ com.google.common.net,
+ com.google.common.primitives,
+ com.google.common.util.concurrent
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
Added: trunk/libs/google-guava/build.properties
===================================================================
--- trunk/libs/google-guava/build.properties (rev 0)
+++ trunk/libs/google-guava/build.properties 2011-02-22 16:15:08 UTC (rev 1226)
@@ -0,0 +1,2 @@
+bin.includes = META-INF/,\
+ guava-r08.jar
Added: trunk/libs/google-guava/guava-r08.jar
===================================================================
(Binary files differ)
Property changes on: trunk/libs/google-guava/guava-r08.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/libs/google-guava/guava-src-r08.zip
===================================================================
(Binary files differ)
Property changes on: trunk/libs/google-guava/guava-src-r08.zip
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jrb...@us...> - 2011-02-22 16:11:07
|
Revision: 1225
http://cishell.svn.sourceforge.net/cishell/?rev=1225&view=rev
Author: jrbibers
Date: 2011-02-22 16:11:01 +0000 (Tue, 22 Feb 2011)
Log Message:
-----------
Initial import of Google Guava r08.
Added Paths:
-----------
trunk/libs/google-guava/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-18 15:44:59
|
Revision: 1224
http://cishell.svn.sourceforge.net/cishell/?rev=1224&view=rev
Author: pataphil
Date: 2011-02-18 15:44:52 +0000 (Fri, 18 Feb 2011)
Log Message:
-----------
* Trying to fix the build.
Modified Paths:
--------------
trunk/core/org.cishell.reference/META-INF/MANIFEST.MF
trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java
Added Paths:
-----------
trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/AbstractDialog.java
Modified: trunk/core/org.cishell.reference/META-INF/MANIFEST.MF
===================================================================
--- trunk/core/org.cishell.reference/META-INF/MANIFEST.MF 2011-02-18 15:27:33 UTC (rev 1223)
+++ trunk/core/org.cishell.reference/META-INF/MANIFEST.MF 2011-02-18 15:44:52 UTC (rev 1224)
@@ -8,9 +8,6 @@
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.guibuilder.swt,
- org.cishell.reference.gui.guibuilder.swt.builder,
- org.cishell.reference.gui.guibuilder.swt.builder.components,
org.cishell.service.algorithminvocation,
org.cishell.service.conversion;version="1.0.0",
org.cishell.service.guibuilder;version="1.0.0",
Added: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/AbstractDialog.java
===================================================================
--- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/AbstractDialog.java (rev 0)
+++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/AbstractDialog.java 2011-02-18 15:44:52 UTC (rev 1224)
@@ -0,0 +1,490 @@
+/*
+ * InfoVis CyberInfrastructure: A Data-Code-Compute Resource for Research
+ * and Education in Information Visualization (http://iv.slis.indiana.edu/).
+ *
+ * Created on Feb 22, 2005 at Indiana University.
+ */
+package org.cishell.reference.app.service.fileloader;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.ShellAdapter;
+import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Dialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+
+/**
+ * This class provides a DialogBox structure that can be extended to create Dialogs for CIShell.
+ * This framework will enforce consistency in the look and feel of Dialogs in CIShell by providing a
+ * standard layout of description, content, and buttons[, along with a choice of icon images
+ * defined as constants in this class]. An optional details section allows the Dialog designer
+ * to provide additional information when the details button is pressed.
+ *
+ * @author Team IVC
+ */
+public abstract class AbstractDialog extends Dialog {
+ private static final int DETAILS_HEIGHT = 75;
+
+ public static Image INFORMATION;
+ public static Image WARNING;
+ public static Image ERROR;
+ public static Image QUESTION;
+ public static Image WORKING;
+
+ static {
+ Runnable runner = new Runnable() {
+ public void run() {
+ INFORMATION = Display.getDefault().getSystemImage(SWT.ICON_INFORMATION);
+ WARNING = Display.getDefault().getSystemImage(SWT.ICON_WARNING);
+ ERROR = Display.getDefault().getSystemImage(SWT.ICON_ERROR);
+ QUESTION = Display.getDefault().getSystemImage(SWT.ICON_QUESTION);
+ WORKING = Display.getDefault().getSystemImage(SWT.ICON_WORKING);
+ }};
+
+ if (Display.getDefault().getThread() == Thread.currentThread()) {
+ runner.run();
+ } else {
+ Display.getDefault().asyncExec(runner);
+ }
+ }
+
+
+ private String description = "";
+ private String detailsString = "";
+ private Text detailsText;
+ private Shell shell;
+ private Image image;
+ private boolean success;
+ private Composite header;
+ private Composite content;
+ private Composite buttons;
+ private Shell parent;
+
+ /**
+ * Creates a new AbstractDialog object.
+ *
+ * @param parent the parent Shell of this AbstractDialog
+ * @param title the title to put in the title bar of this AbstractDialog
+ * @param image the Image to display to the left of the description specified
+ * for this AbstractDialog. This will usually be one of:
+ * <ul>
+ * <li>AbstractDialog.WARNING</li>
+ * <li>AbstractDialog.INFORMATION</li>
+ * <li>AbstractDialog.ERROR</li>
+ * <li>AbstractDialog.WORKING</li>
+ * <li>AbstractDialog.QUESTION</li>
+ * </ul>
+ */
+ public AbstractDialog(Shell parent, String title, Image image) {
+ super(parent, 0);
+ setText(title);
+ this.image = image;
+ this.parent = parent;
+ init();
+ }
+
+ /**
+ * Closes this AbstractDialog.
+ *
+ * @param success true if the dialog was successful, false if it
+ * was cancelled by the user (or closed prematurely)
+ */
+ public void close(boolean success){
+ shell.dispose();
+ this.success = success;
+ }
+
+ /**
+ * Returns the shell used by this AbstractDialog
+ *
+ * @return the shell used by this AbstractDialog
+ */
+ public Shell getShell(){
+ return shell;
+ }
+
+ /**
+ * Initializes this AbstractDialog. This consists of resetting all of the
+ * customizable components like the content area, details pane, buttons,
+ * and description label, and readying the dialog to be refilled with
+ * new content.
+ */
+ public void init(){
+ if(shell != null)
+ shell.dispose();
+
+ shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE);
+
+ if (parent != null)
+ shell.setImage(parent.getImage());
+
+ shell.setText(getText());
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ shell.setLayout(layout);
+ }
+
+ /**
+ * Opens this AbstractDialog.
+ *
+ * @return true if this AbstractDialog was closed by clicking the 'x' in the upper right
+ * corner of the window, signifying a cancellation, false if the dialog is exited otherwise.
+ */
+ public boolean open() {
+ if (shell.getDisplay().getThread() == Thread.currentThread()) {
+ doOpen();
+ } else {
+ shell.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ doOpen();
+ }});
+ }
+
+ Display display = getParent().getDisplay();
+
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch()) {
+ display.sleep();
+ }
+ }
+
+ return success;
+ }
+
+ protected void doOpen() {
+ success = true;
+
+ setupHeader();
+ setupContent();
+ setupButtons();
+
+ shell.pack();
+ setLocation();
+ shell.open();
+ shell.addShellListener(new ShellAdapter(){
+ public void shellClosed(ShellEvent e) {
+ success = false;
+ }
+ });
+ }
+
+ /*
+ * centers the dialog on its parents shell
+ */
+ private void setLocation(){
+ Point parentLocation = parent.getLocation();
+ int parentWidth = parent.getSize().x;
+ int parentHeight = parent.getSize().y;
+ int shellWidth = shell.getSize().x;
+ int shellHeight = shell.getSize().y;
+
+ int x = parentLocation.x + (parentWidth - shellWidth)/2;
+ int y = parentLocation.y + (parentHeight - shellHeight)/2;
+ shell.setLocation(x, y);
+ }
+
+ /**
+ * Sets the Description of this AbstractDialog. This is the textField that is displayed in the
+ * top section of the Dialog window, giving information about the question that is being
+ * asked or the information that is being given.
+ *
+ * @param description the description for this AbstractDialog to use
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the details textField of this AbstractDialog. This is the textField that is displayed in the lower
+ * section of the Dialog window when the user presses the "Details >>" button. If this String
+ * is null or the empty string, the details button will be disabled.
+ *
+ * @param details DOCUMENT ME!
+ */
+ public void setDetails(String details) {
+ this.detailsString = details;
+ }
+
+ /**
+ * Creates the Buttons to use in this AbstractDialog based on the given parent. These are
+ * the buttons that show up at the bottom of the dialog for user input, such as a
+ * "Yes/No" group or "Continue/Cancel" or something like that. This does not encompass all
+ * Buttons created in the dialog (such as those created in the content section), just those
+ * to display at the bottom of the dialog.
+ *
+ * @param parent the parent to be used to create the Buttons for this AbstractDialog
+ */
+ public abstract void createDialogButtons(Composite parent);
+
+ /**
+ * Creates the content section of this AbstractDialog based on the given parent.
+ * This section is where all of the "guts" of the AbstractDialog go, specifying the controls
+ * that are needed to interact with the user and provide whatever questions or information
+ * are needed.
+ *
+ * @param parent the parent to be used to create the Buttosn for this AbstractDialog
+ *
+ * @return the Composite that is created to display the content of this AbstractDialog
+ */
+ public abstract Composite createContent(Composite parent);
+
+ /*
+ * Sets up the header section of the dialog. This section contains the image for the
+ * type of dialog it is, as well as the description label
+ */
+ private void setupHeader() {
+ header = new Composite(shell, SWT.NONE);
+ header.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ header.setLayout(layout);
+
+ Label canvas = new Label(header, SWT.NONE);
+ if (image != null) {
+ canvas.setImage(image);
+ }
+ GridData canvasData = new GridData();
+ canvasData.heightHint = image.getBounds().height;
+ canvas.setLayoutData(canvasData);
+
+ Label desc = new Label(header, SWT.WRAP);
+
+ if ((description != null) && !description.equals("")) {
+ desc.setText(description);
+ }
+ }
+
+ /*
+ * sets up the content section of the dialog, this calls the abstract method to
+ * create the content that must be implemented by all subclasses
+ */
+ private void setupContent() {
+ content = createContent(shell);
+
+ if (content != null) {
+ content.setLayoutData(new GridData(GridData.FILL_BOTH));
+ }
+ }
+
+ /*
+ * sets up the button section in the bottom of the dialog. These buttons
+ * are created in the abstract method createDialogButtons(parent). In addition to
+ * any created buttons, a "Details >>" button is added to allow the user to see any
+ * details that are available in the current Dialog.
+ */
+ private void setupButtons() {
+ buttons = new Composite(shell, SWT.NONE);
+ buttons.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END));
+
+ //there are two sections, all the user stuff to the left, and
+ //then the details button on the far right
+ //User Buttons Section
+ createDialogButtons(buttons);
+ Control[] controls = buttons.getChildren();
+ GridLayout buttonsLayout = new GridLayout();
+ buttonsLayout.numColumns = controls.length + 1;
+ buttonsLayout.makeColumnsEqualWidth = true;
+ buttons.setLayout(buttonsLayout);
+
+ //setup the grid data for each button for standard look
+ for (int i = 0; i < controls.length; i++) {
+ controls[i].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ }
+
+ //Details Button section
+ final Button details = new Button(buttons, SWT.PUSH);
+ details.setText("Details >>");
+ details.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ details.addSelectionListener(new SelectionAdapter() {
+ public synchronized void widgetSelected(SelectionEvent e) {
+ GridData data = (GridData) detailsText.getLayoutData();
+
+ if (detailsText.getVisible()) {
+ detailsText.setText("");
+ details.setText("Details >>");
+ data.heightHint = 0;
+ data.grabExcessHorizontalSpace = false;
+ data.grabExcessVerticalSpace = false;
+ } else {
+ detailsText.setText(detailsString);
+ details.setText("Details <<");
+ data.heightHint = DETAILS_HEIGHT;
+ data.grabExcessHorizontalSpace = true;
+ data.grabExcessVerticalSpace = true;
+ }
+
+ detailsText.setLayoutData(data);
+ detailsText.setVisible(!detailsText.getVisible());
+
+ shell.setSize(shell.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+ shell.layout();
+ }
+ });
+
+ setupDetails();
+ details.setEnabled(detailsString != null && !detailsString.equals(""));
+ }
+
+ /*
+ * creates the details textField box when the "Details >>" button is toggled
+ */
+ private void setupDetails() {
+ detailsText = new Text(shell, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
+ detailsText.setEditable(false);
+ detailsText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+
+ GridData data = new GridData(GridData.FILL_BOTH |
+ GridData.GRAB_VERTICAL | GridData.GRAB_HORIZONTAL);
+ data.widthHint = 400;
+
+ detailsText.setLayoutData(data);
+ detailsText.setVisible(false);
+ }
+
+ /**
+ * Open a standard error dialog with OK button
+ *
+ * @param parent the parent Shell of this dialog
+ * @param title the textField to display in the title bar of this dialog
+ * @param message the message to give in the dialog's body
+ * @param details the textField to put in the details pane to be visible when the
+ * "Details >>" button is pressed (can be null or empty, resulting
+ * in the "Details >>" button not being enabled)
+ * @return true if the dialog was exited by pressing the OK button, false
+ * if it was cancelled by pressing the 'x' in the title bar
+ */
+ public static boolean openError(Shell parent, String title, String message, String details){
+ return openOKDialog(parent, ERROR, title, message, details);
+ }
+
+ /**
+ * Open a standard information dialog with OK button
+ *
+ * @param parent the parent Shell of this dialog
+ * @param title the textField to display in the title bar of this dialog
+ * @param message the message to give in the dialog's body
+ * @param details the textField to put in the details pane to be visible when the
+ * "Details >>" button is pressed (can be null or empty, resulting
+ * in the "Details >>" button not being enabled) * @return true if the dialog was exited by pressing the OK button, false
+ * if it was cancelled by pressing the 'x' in the title bar
+ */
+ public static boolean openInformation(Shell parent, String title, String message, String details){
+ return openOKDialog(parent, INFORMATION, title, message, details);
+ }
+
+ /**
+ * Open a standard warning dialog with OK button
+ *
+ * @param parent the parent Shell of this dialog
+ * @param title the textField to display in the title bar of this dialog
+ * @param message the message to give in the dialog's body
+ * @param details the textField to put in the details pane to be visible when the
+ * "Details >>" button is pressed (can be null or empty, resulting
+ * in the "Details >>" button not being enabled) * @return true if the dialog was exited by pressing the OK button, false
+ * if it was cancelled by pressing the 'x' in the title bar
+ */
+ public static boolean openWarning(Shell parent, String title, String message, String details){
+ return openOKDialog(parent, WARNING, title, message, details);
+ }
+
+ /**
+ * Open a standard question dialog with Yes/No buttons
+ *
+ * @param parent the parent Shell of this dialog
+ * @param title the textField to display in the title bar of this dialog
+ * @param message the message to give in the dialog's body
+ * @param details the textField to put in the details pane to be visible when the
+ * "Details >>" button is pressed (can be null or empty, resulting
+ * in the "Details >>" button not being enabled) * @return true if the dialog was exited by pressing the OK button, false
+ * if it was cancelled by pressing the 'x' in the title bar or pressing the
+ * No button
+ */
+ public static boolean openQuestion(Shell parent, String title, String message, String details){
+ return openConfirmDenyDialog(parent, QUESTION, title, message, details, "Yes", "No");
+ }
+
+ /**
+ * Open a standard confirmation dialog with OK/Cancel buttons
+ *
+ * @param parent the parent Shell of this dialog
+ * @param title the textField to display in the title bar of this dialog
+ * @param message the message to give in the dialog's body
+ * @param details the textField to put in the details pane to be visible when the
+ * "Details >>" button is pressed (can be null or empty, resulting
+ * in the "Details >>" button not being enabled) * @return true if the dialog was exited by pressing the OK button, false
+ * if it was cancelled by pressing the 'x' in the title bar or pressing
+ * the Cancel button
+ */
+ public static boolean openConfirm(Shell parent, String title, String message, String details){
+ return openConfirmDenyDialog(parent, QUESTION, title, message, details, "OK", "Cancel");
+ }
+
+ /*
+ * helper to create OK dialogs: error, warning, information
+ */
+ private static boolean openOKDialog(Shell parent, Image image, String title, String message, String details){
+ AbstractDialog okDialog = new AbstractDialog(parent, title, image){
+ public void createDialogButtons(Composite parent) {
+ Button ok = new Button(parent, SWT.PUSH);
+ ok.setText("OK");
+ ok.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e) {
+ close(true);
+ }
+ });
+ }
+
+ public Composite createContent(Composite parent) {
+ return null;
+ }
+ };
+ okDialog.setDescription(message);
+ okDialog.setDetails(details);
+ return okDialog.open();
+ }
+
+ /*
+ * helper to create confirm/deny dialogs: question, confirmation
+ */
+ private static boolean openConfirmDenyDialog(Shell parent, Image image, String title, String message, String details, final String confirmLabel, final String denyLabel){
+ AbstractDialog dialog = new AbstractDialog(parent, title, image){
+ public void createDialogButtons(Composite parent) {
+ Button confirm = new Button(parent, SWT.PUSH);
+ if(confirmLabel != null)
+ confirm.setText(confirmLabel);
+ confirm.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e) {
+ close(true);
+ }
+ });
+ Button deny = new Button(parent, SWT.PUSH);
+ if(denyLabel != null)
+ deny.setText(denyLabel);
+ deny.addSelectionListener(new SelectionAdapter(){
+ public void widgetSelected(SelectionEvent e) {
+ close(false);
+ }
+ });
+ }
+
+ public Composite createContent(Composite parent) {
+ return null;
+ }
+ };
+ dialog.setDescription(message);
+ dialog.setDetails(details);
+ return dialog.open();
+ }
+}
Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java
===================================================================
--- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java 2011-02-18 15:27:33 UTC (rev 1223)
+++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java 2011-02-18 15:44:52 UTC (rev 1224)
@@ -3,7 +3,6 @@
import java.io.File;
import org.cishell.framework.algorithm.AlgorithmFactory;
-import org.cishell.reference.gui.guibuilder.swt.builder.AbstractDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-18 15:27:39
|
Revision: 1223
http://cishell.svn.sourceforge.net/cishell/?rev=1223&view=rev
Author: pataphil
Date: 2011-02-18 15:27:33 +0000 (Fri, 18 Feb 2011)
Log Message:
-----------
* Trying to fix the build.
Modified Paths:
--------------
trunk/testing/org.cishell.testing.convertertester.algorithm/META-INF/MANIFEST.MF
Modified: trunk/testing/org.cishell.testing.convertertester.algorithm/META-INF/MANIFEST.MF
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.algorithm/META-INF/MANIFEST.MF 2011-02-18 15:26:14 UTC (rev 1222)
+++ trunk/testing/org.cishell.testing.convertertester.algorithm/META-INF/MANIFEST.MF 2011-02-18 15:27:33 UTC (rev 1223)
@@ -10,7 +10,6 @@
org.cishell.framework.data;version="1.0.0",
org.cishell.reference.app.service.datamanager,
org.cishell.reference.app.service.scheduler,
- org.cishell.reference.gui.workspace.common,
org.cishell.reference.gui.datamanager,
org.cishell.reference.gui.guibuilder.swt,
org.cishell.reference.gui.scheduler,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-18 15:26:21
|
Revision: 1222
http://cishell.svn.sourceforge.net/cishell/?rev=1222&view=rev
Author: pataphil
Date: 2011-02-18 15:26:14 +0000 (Fri, 18 Feb 2011)
Log Message:
-----------
* Trying to fix the build.
Modified Paths:
--------------
trunk/core/org.cishell.reference/META-INF/MANIFEST.MF
trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java
Modified: trunk/core/org.cishell.reference/META-INF/MANIFEST.MF
===================================================================
--- trunk/core/org.cishell.reference/META-INF/MANIFEST.MF 2011-02-18 15:25:52 UTC (rev 1221)
+++ trunk/core/org.cishell.reference/META-INF/MANIFEST.MF 2011-02-18 15:26:14 UTC (rev 1222)
@@ -9,7 +9,8 @@
org.cishell.framework.algorithm;version="1.0.0",
org.cishell.framework.data;version="1.0.0",
org.cishell.reference.gui.guibuilder.swt,
- org.cishell.reference.gui.workspace.common,
+ org.cishell.reference.gui.guibuilder.swt.builder,
+ org.cishell.reference.gui.guibuilder.swt.builder.components,
org.cishell.service.algorithminvocation,
org.cishell.service.conversion;version="1.0.0",
org.cishell.service.guibuilder;version="1.0.0",
Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java
===================================================================
--- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java 2011-02-18 15:25:52 UTC (rev 1221)
+++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java 2011-02-18 15:26:14 UTC (rev 1222)
@@ -3,7 +3,7 @@
import java.io.File;
import org.cishell.framework.algorithm.AlgorithmFactory;
-import org.cishell.reference.gui.workspace.common.AbstractDialog;
+import org.cishell.reference.gui.guibuilder.swt.builder.AbstractDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-18 15:25:59
|
Revision: 1221
http://cishell.svn.sourceforge.net/cishell/?rev=1221&view=rev
Author: pataphil
Date: 2011-02-18 15:25:52 +0000 (Fri, 18 Feb 2011)
Log Message:
-----------
* Trying to fix the build.
Modified Paths:
--------------
trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/META-INF/MANIFEST.MF
trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF
trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveDataChooser.java
trunk/clients/gui/org.cishell.reference.gui.workspace/META-INF/MANIFEST.MF
Removed Paths:
-------------
trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/common/AbstractDialog.java
Modified: trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/META-INF/MANIFEST.MF
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/META-INF/MANIFEST.MF 2011-02-18 05:13:14 UTC (rev 1220)
+++ trunk/clients/gui/org.cishell.reference.gui.guibuilder.swt/META-INF/MANIFEST.MF 2011-02-18 15:25:52 UTC (rev 1221)
@@ -10,4 +10,6 @@
org.osgi.framework;version="1.3.0",
org.osgi.service.metatype;version="1.1.0"
Require-Bundle: org.eclipse.swt
-Export-Package: org.cishell.reference.gui.guibuilder.swt
+Export-Package: org.cishell.reference.gui.guibuilder.swt,
+ org.cishell.reference.gui.guibuilder.swt.builder,
+ org.cishell.reference.gui.guibuilder.swt.builder.components
Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF 2011-02-18 05:13:14 UTC (rev 1220)
+++ trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF 2011-02-18 15:25:52 UTC (rev 1221)
@@ -9,7 +9,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.workspace.common,
+ org.cishell.reference.gui.guibuilder.swt,
+ org.cishell.reference.gui.guibuilder.swt.builder,
+ org.cishell.reference.gui.guibuilder.swt.builder.components,
org.cishell.reference.service.conversion,
org.cishell.reference.service.metatype,
org.cishell.service.conversion;version="1.0.0",
Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveDataChooser.java
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveDataChooser.java 2011-02-18 05:13:14 UTC (rev 1220)
+++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveDataChooser.java 2011-02-18 15:25:52 UTC (rev 1221)
@@ -16,7 +16,7 @@
import org.cishell.framework.CIShellContext;
import org.cishell.framework.algorithm.AlgorithmProperty;
import org.cishell.framework.data.Data;
-import org.cishell.reference.gui.workspace.common.AbstractDialog;
+import org.cishell.reference.gui.guibuilder.swt.builder.AbstractDialog;
import org.cishell.service.conversion.Converter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
Modified: trunk/clients/gui/org.cishell.reference.gui.workspace/META-INF/MANIFEST.MF
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.workspace/META-INF/MANIFEST.MF 2011-02-18 05:13:14 UTC (rev 1220)
+++ trunk/clients/gui/org.cishell.reference.gui.workspace/META-INF/MANIFEST.MF 2011-02-18 15:25:52 UTC (rev 1221)
@@ -8,7 +8,6 @@
org.eclipse.core.runtime,
org.eclipse.update.ui
Eclipse-LazyStart: true
-Export-Package: org.cishell.reference.gui.workspace,
- org.cishell.reference.gui.workspace.common
+Export-Package: org.cishell.reference.gui.workspace
Import-Package: org.cishell.reference.gui.guibuilder.swt,
org.cishell.service.guibuilder
Deleted: trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/common/AbstractDialog.java
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/common/AbstractDialog.java 2011-02-18 05:13:14 UTC (rev 1220)
+++ trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/common/AbstractDialog.java 2011-02-18 15:25:52 UTC (rev 1221)
@@ -1,465 +0,0 @@
-/*
- * InfoVis CyberInfrastructure: A Data-Code-Compute Resource for Research
- * and Education in Information Visualization (http://iv.slis.indiana.edu/).
- *
- * Created on Feb 22, 2005 at Indiana University.
- */
-package org.cishell.reference.gui.workspace.common;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Dialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-
-/**
- * This class provides a DialogBox structure that can be extended to create Dialogs for CIShell.
- * This framework will enforce consistency in the look and feel of Dialogs in CIShell by providing a
- * standard layout of description, content, and buttons[, along with a choice of icon images
- * defined as constants in this class]. An optional details section allows the Dialog designer
- * to provide additional information when the details button is pressed.
- *
- * @author Team IVC
- */
-public abstract class AbstractDialog extends Dialog {
- public static final Image INFORMATION = Display.getCurrent().getSystemImage(SWT.ICON_INFORMATION);
- public static final Image WARNING = Display.getCurrent().getSystemImage(SWT.ICON_WARNING);
- public static final Image ERROR = Display.getCurrent().getSystemImage(SWT.ICON_ERROR);
- public static final Image QUESTION = Display.getCurrent().getSystemImage(SWT.ICON_QUESTION);
- public static final Image WORKING = Display.getCurrent().getSystemImage(SWT.ICON_WORKING);
-
-// private static final Image ivcIcon = IVCImageLoader.createImage("ivc.gif");
-
- //constants used in resizing of shell when details are shown/hidden
- private static final int DETAILS_HEIGHT = 75;
- private static final int SCROLLBAR_BUFFER = 47;
-
-
- private String description = "";
- private String detailsString = "";
- private Text detailsText;
- private Shell shell;
- private Image image;
- private boolean success;
- private Composite header;
- private Composite content;
- private Composite buttons;
- private Shell parent;
-
- /**
- * Creates a new AbstractDialog object.
- *
- * @param parent the parent Shell of this AbstractDialog
- * @param title the title to put in the title bar of this AbstractDialog
- * @param image the Image to display to the left of the description specified
- * for this AbstractDialog. This will usually be one of:
- * <ul>
- * <li>AbstractDialog.WARNING</li>
- * <li>AbstractDialog.INFORMATION</li>
- * <li>AbstractDialog.ERROR</li>
- * <li>AbstractDialog.WORKING</li>
- * <li>AbstractDialog.QUESTION</li>
- * </ul>
- */
- public AbstractDialog(Shell parent, String title, Image image) {
- super(parent, 0);
- setText(title);
- this.image = image;
- this.parent = parent;
- init();
- }
-
- /**
- * Closes this AbstractDialog.
- *
- * @param success true if the dialog was successful, false if it
- * was cancelled by the user (or closed prematurely)
- */
- public void close(boolean success){
- shell.dispose();
- this.success = success;
- }
-
- /**
- * Returns the shell used by this AbstractDialog
- *
- * @return the shell used by this AbstractDialog
- */
- public Shell getShell(){
- return shell;
- }
-
- /**
- * Initializes this AbstractDialog. This consists of resetting all of the
- * customizable components like the content area, details pane, buttons,
- * and description label, and readying the dialog to be refilled with
- * new content.
- */
- public void init(){
- if(shell != null)
- shell.dispose();
-
- shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
- shell.setText(getText());
-// shell.setImage(ivcIcon);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- shell.setLayout(layout);
- }
-
- /**
- * Opens this AbstractDialog.
- *
- * @return true if this AbstractDialog was closed by clicking the 'x' in the upper right
- * corner of the window, signifying a cancellation, false if the dialog is exited otherwise.
- */
- public boolean open() {
- success = true;
-
- setupHeader();
- setupContent();
- setupButtons();
-
- shell.pack();
- setLocation();
- shell.open();
- shell.addShellListener(new ShellAdapter(){
- public void shellClosed(ShellEvent e) {
- success = false;
- }
- });
- Display display = getParent().getDisplay();
-
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch()) {
- display.sleep();
- }
- }
-
- return success;
- }
-
- /*
- * centers the dialog on its parents shell
- */
- private void setLocation(){
- Point parentLocation = parent.getLocation();
- int parentWidth = parent.getSize().x;
- int parentHeight = parent.getSize().y;
- int shellWidth = shell.getSize().x;
- int shellHeight = shell.getSize().y;
-
- int x = parentLocation.x + (parentWidth - shellWidth)/2;
- int y = parentLocation.y + (parentHeight - shellHeight)/2;
- shell.setLocation(x, y);
-
- }
-
- /**
- * Sets the Description of this AbstractDialog. This is the text that is displayed in the
- * top section of the Dialog window, giving information about the question that is being
- * asked or the information that is being given.
- *
- * @param description the description for this AbstractDialog to use
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Sets the details text of this AbstractDialog. This is the text that is displayed in the lower
- * section of the Dialog window when the user presses the "Details >>" button. If this String
- * is null or the empty string, the details button will be disabled.
- *
- * @param details DOCUMENT ME!
- */
- public void setDetails(String details) {
- this.detailsString = details;
- }
-
- /**
- * Creates the Buttons to use in this AbstractDialog based on the given parent. These are
- * the buttons that show up at the bottom of the dialog for user input, such as a
- * "Yes/No" group or "Continue/Cancel" or something like that. This does not encompass all
- * Buttons created in the dialog (such as those created in the content section), just those
- * to display at the bottom of the dialog.
- *
- * @param parent the parent to be used to create the Buttons for this AbstractDialog
- */
- public abstract void createDialogButtons(Composite parent);
-
- /**
- * Creates the content section of this AbstractDialog based on the given parent.
- * This section is where all of the "guts" of the AbstractDialog go, specifying the controls
- * that are needed to interact with the user and provide whatever questions or information
- * are needed.
- *
- * @param parent the parent to be used to create the Buttosn for this AbstractDialog
- *
- * @return the Composite that is created to display the content of this AbstractDialog
- */
- public abstract Composite createContent(Composite parent);
-
- /*
- * Sets up the header section of the dialog. This section contains the image for the
- * type of dialog it is, as well as the description label
- */
- private void setupHeader() {
- header = new Composite(shell, SWT.NONE);
- header.setLayoutData(new GridData(GridData.FILL_BOTH));
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- header.setLayout(layout);
-
- Canvas canvas = new Canvas(header, SWT.NONE);
- if (image != null) {
- canvas.addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent e) {
- e.gc.drawImage(image, 0, 0);
- }
- });
- }
- GridData canvasData = new GridData();
- canvasData.heightHint = image.getBounds().height;
- canvas.setLayoutData(canvasData);
-
-
- Label desc = new Label(header, SWT.WRAP);
-
- if ((description != null) && !description.equals("")) {
- desc.setText(description);
- }
-
- GridData data = new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint = 300;
- desc.setLayoutData(data);
- }
-
- /*
- * sets up the content section of the dialog, this calls the abstract method to
- * create the content that must be implemented by all subclasses
- */
- private void setupContent() {
- content = createContent(shell);
-
- if (content != null) {
- content.setLayoutData(new GridData(GridData.FILL_BOTH));
- }
- }
-
- /*
- * sets up the button section in the bottom of the dialog. These buttons
- * are created in the abstract method createDialogButtons(parent). In addition to
- * any created buttons, a "Details >>" button is added to allow the user to see any
- * details that are available in the current Dialog.
- */
- private void setupButtons() {
- buttons = new Composite(shell, SWT.NONE);
- buttons.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END));
-
- //there are two sections, all the user stuff to the left, and
- //then the details button on the far right
- //User Buttons Section
- createDialogButtons(buttons);
- Control[] controls = buttons.getChildren();
- GridLayout buttonsLayout = new GridLayout();
- buttonsLayout.numColumns = controls.length + 1;
- buttonsLayout.makeColumnsEqualWidth = true;
- buttons.setLayout(buttonsLayout);
-
- //setup the grid data for each button for standard look
- for (int i = 0; i < controls.length; i++) {
- controls[i].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- }
-
- //Details Button section
- Button details = new Button(buttons, SWT.PUSH);
- details.setText("Details >>");
- details.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- details.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if ((detailsText == null) || detailsText.isDisposed()) {
- //show details section
- setupDetails();
- shell.pack();
- } else {
- //remove details section
- detailsText.dispose();
- shell.pack();
- }
- }
- });
- details.setEnabled((detailsString != null) &&
- !detailsString.equals(""));
- }
-
- /*
- * creates the details text box when the "Details >>" button is toggled
- */
- private void setupDetails() {
- int width = shell.getSize().x;
- detailsText = new Text(shell, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
- detailsText.setEditable(false);
- detailsText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
-
- GridData data = new GridData();
- data.grabExcessHorizontalSpace = false;
- data.grabExcessVerticalSpace = false;
- data.widthHint = width - SCROLLBAR_BUFFER;
- data.heightHint = DETAILS_HEIGHT;
- detailsText.setLayoutData(data);
- if(detailsString != null)
- detailsText.setText(detailsString);
- }
-
- /**
- * Open a standard error dialog with OK button
- *
- * @param parent the parent Shell of this dialog
- * @param title the text to display in the title bar of this dialog
- * @param message the message to give in the dialog's body
- * @param details the text to put in the details pane to be visible when the
- * "Details >>" button is pressed (can be null or empty, resulting
- * in the "Details >>" button not being enabled)
- * @return true if the dialog was exited by pressing the OK button, false
- * if it was cancelled by pressing the 'x' in the title bar
- */
- public static boolean openError(Shell parent, String title, String message, String details){
- return openOKDialog(parent, ERROR, title, message, details);
- }
-
- /**
- * Open a standard information dialog with OK button
- *
- * @param parent the parent Shell of this dialog
- * @param title the text to display in the title bar of this dialog
- * @param message the message to give in the dialog's body
- * @param details the text to put in the details pane to be visible when the
- * "Details >>" button is pressed (can be null or empty, resulting
- * in the "Details >>" button not being enabled) * @return true if the dialog was exited by pressing the OK button, false
- * if it was cancelled by pressing the 'x' in the title bar
- */
- public static boolean openInformation(Shell parent, String title, String message, String details){
- return openOKDialog(parent, INFORMATION, title, message, details);
- }
-
- /**
- * Open a standard warning dialog with OK button
- *
- * @param parent the parent Shell of this dialog
- * @param title the text to display in the title bar of this dialog
- * @param message the message to give in the dialog's body
- * @param details the text to put in the details pane to be visible when the
- * "Details >>" button is pressed (can be null or empty, resulting
- * in the "Details >>" button not being enabled) * @return true if the dialog was exited by pressing the OK button, false
- * if it was cancelled by pressing the 'x' in the title bar
- */
- public static boolean openWarning(Shell parent, String title, String message, String details){
- return openOKDialog(parent, WARNING, title, message, details);
- }
-
- /**
- * Open a standard question dialog with Yes/No buttons
- *
- * @param parent the parent Shell of this dialog
- * @param title the text to display in the title bar of this dialog
- * @param message the message to give in the dialog's body
- * @param details the text to put in the details pane to be visible when the
- * "Details >>" button is pressed (can be null or empty, resulting
- * in the "Details >>" button not being enabled) * @return true if the dialog was exited by pressing the OK button, false
- * if it was cancelled by pressing the 'x' in the title bar or pressing the
- * No button
- */
- public static boolean openQuestion(Shell parent, String title, String message, String details){
- return openConfirmDenyDialog(parent, QUESTION, title, message, details, "Yes", "No");
- }
-
- /**
- * Open a standard confirmation dialog with OK/Cancel buttons
- *
- * @param parent the parent Shell of this dialog
- * @param title the text to display in the title bar of this dialog
- * @param message the message to give in the dialog's body
- * @param details the text to put in the details pane to be visible when the
- * "Details >>" button is pressed (can be null or empty, resulting
- * in the "Details >>" button not being enabled) * @return true if the dialog was exited by pressing the OK button, false
- * if it was cancelled by pressing the 'x' in the title bar or pressing
- * the Cancel button
- */
- public static boolean openConfirm(Shell parent, String title, String message, String details){
- return openConfirmDenyDialog(parent, QUESTION, title, message, details, "OK", "Cancel");
- }
-
- /*
- * helper to create OK dialogs: error, warning, information
- */
- private static boolean openOKDialog(Shell parent, Image image, String title, String message, String details){
- AbstractDialog okDialog = new AbstractDialog(parent, title, image){
- public void createDialogButtons(Composite parent) {
- Button ok = new Button(parent, SWT.PUSH);
- ok.setText("OK");
- ok.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e) {
- close(true);
- }
- });
- }
-
- public Composite createContent(Composite parent) {
- return null;
- }
- };
- okDialog.setDescription(message);
- okDialog.setDetails(details);
- return okDialog.open();
- }
-
- /*
- * helper to create confirm/deny dialogs: question, confirmation
- */
- private static boolean openConfirmDenyDialog(Shell parent, Image image, String title, String message, String details, final String confirmLabel, final String denyLabel){
- AbstractDialog dialog = new AbstractDialog(parent, title, image){
- public void createDialogButtons(Composite parent) {
- Button confirm = new Button(parent, SWT.PUSH);
- if(confirmLabel != null)
- confirm.setText(confirmLabel);
- confirm.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e) {
- close(true);
- }
- });
- Button deny = new Button(parent, SWT.PUSH);
- if(denyLabel != null)
- deny.setText(denyLabel);
- deny.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e) {
- close(false);
- }
- });
- }
-
- public Composite createContent(Composite parent) {
- return null;
- }
- };
- dialog.setDescription(message);
- dialog.setDetails(details);
- return dialog.open();
- }
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-18 05:13:20
|
Revision: 1220
http://cishell.svn.sourceforge.net/cishell/?rev=1220&view=rev
Author: pataphil
Date: 2011-02-18 05:13:14 +0000 (Fri, 18 Feb 2011)
Log Message:
-----------
* Removed unused version of FileFormatSelector.
Removed Paths:
-------------
trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileFormatSelector.java
Deleted: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileFormatSelector.java
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileFormatSelector.java 2011-02-18 03:30:41 UTC (rev 1219)
+++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileFormatSelector.java 2011-02-18 05:13:14 UTC (rev 1220)
@@ -1,196 +0,0 @@
-/*
- * InfoVis CyberInfrastructure: A Data-Code-Compute Resource for Research
- * and Education in Information Visualization (http://iv.slis.indiana.edu/).
- *
- * Created on Jan 24, 2005 at Indiana University.
- */
-package org.cishell.reference.gui.persistence.load;
-
-import java.io.File;
-
-import org.cishell.framework.algorithm.AlgorithmFactory;
-import org.cishell.reference.gui.workspace.common.AbstractDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.List;
-import org.eclipse.swt.widgets.Shell;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-
-public class FileFormatSelector extends AbstractDialog {
- private BundleContext bundleContext;
- private AlgorithmFactory validator;
- private ServiceReference[] validatorReferences;
- private List validatorList;
-
-// private static final String[] DETAILS_ITEM_KEY =
-// {"format_name", "supported_file_extension", "format_description" };
-
- /*
- * Other possible keys could be restorable_model_name, restorable_model_description
- * */
-
-// private static final String[] DETAILS_ITEM_KEY_DISPLAY_VALUE =
-// {"Format name", "Supported file extension", "Format description"};
-
- /*
- * Other possible keys display values could be "Restorable model name",
- * "Restorable model description"
- */
-
- public FileFormatSelector(
- String title,
- Shell parent,
- BundleContext bundleContext,
- ServiceReference[] validatorReferences,
- File file) {
- super(parent, title, AbstractDialog.QUESTION);
- this.bundleContext = bundleContext;
- this.validatorReferences = validatorReferences;
-
- // Shall this part be moved out of the code?
- String descriptionFormat =
- "The file \'%s\' can be loaded using one or more of the following formats.%n" +
- "Please select the format you would like to try.";
- setDescription(String.format(descriptionFormat, file.getAbsolutePath()));
- setDetails(
- "This dialog allows the user to choose among all available " +
- "formats for loading the selected data model. Choose any of the formats " +
- "to continue loading the dataset.");
- }
-
- public AlgorithmFactory getValidator() {
- return this.validator;
- }
-
- private Composite initializeGUI(Composite parent) {
- Composite content = new Composite(parent, SWT.NONE);
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- content.setLayout(layout);
-
- Group validatorGroup = new Group(content, SWT.NONE);
- // Shall this label be moved out of the code?
- validatorGroup.setText("Load as...");
- validatorGroup.setLayout(new FillLayout());
- GridData validatorListGridData = new GridData(GridData.FILL_BOTH);
- validatorListGridData.widthHint = 200;
- validatorGroup.setLayoutData(validatorListGridData);
-
- this.validatorList = new List(validatorGroup, SWT.H_SCROLL |SWT.V_SCROLL | SWT.SINGLE);
- // initPersisterArray();
- initializePersisterList();
- this.validatorList.addMouseListener(new MouseAdapter() {
- public void mouseDoubleClick(MouseEvent mouseEvent) {
- List list = (List)mouseEvent.getSource();
- int selection = list.getSelectionIndex();
-
- if (selection != -1) {
- selectionMade(selection);
- }
- }
- });
-
- this.validatorList.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent selectionEvent) {
- List list = (List)selectionEvent.getSource();
- int selection = list.getSelectionIndex();
-
- if (selection != -1) {
- // updateDetailPane(validatorReferences[selection]);
- }
- }
- });
-
- validatorList.setSelection(0);
-
- return content;
- }
-
- private void initializePersisterList() {
- for (int ii = 0; ii < this.validatorReferences.length; ++ii) {
- String name = (String)this.validatorReferences[ii].getProperty("label");
-
- /*
- * If someone was sloppy enough to not provide a name, then use the name of the
- * class instead.
- */
- if (name == null || name.length() == 0) {
- name = this.validatorReferences[ii].getClass().getName();
- }
-
- this.validatorList.add(name);
- }
- }
-
- private void selectionMade(int selectedIndex) {
- this.validator =
- (AlgorithmFactory)this.bundleContext.getService(this.validatorReferences[selectedIndex]);
- close(true);
-// AlgorithmFactory validator =
-// (AlgorithmFactory)this.bundleContext.getService(this.persisterArray[selectedIndex]);
-// Data[] data = null;
-// boolean loadSuccess = false;
-//
-// try {
-// data =
-// new Data[] { new BasicData(this.selectedFile.getPath(), String.class.getName()) };
-// data = validator.createAlgorithm(data, null, this.ciShellContext).execute();
-// loadSuccess = true;
-// } catch (Throwable exception) {
-// this.logger.log(
-// LogService.LOG_ERROR, "Error occurred while executing selection", exception);
-// exception.printStackTrace();
-// loadSuccess = false;
-// }
-//
-// if ((data != null) && loadSuccess) {
-// this.logger.log(LogService.LOG_INFO, "Loaded: " + this.selectedFile.getPath());
-//
-// for (int ii = 0; ii < data.length; ii++) {
-// this.returnList.add(data[ii]);
-// }
-//
-// close(true);
-// } else {
-// this.logger.log(LogService.LOG_ERROR, "Unable to load with selected loader");
-// }
- }
-
- public void createDialogButtons(Composite parent) {
- Button select = new Button(parent, SWT.PUSH);
- select.setText("Select");
- select.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent selectionEvent) {
- int index = FileFormatSelector.this.validatorList.getSelectionIndex();
-
- if (index != -1) {
- selectionMade(index);
- }
- }
- });
- select.setFocus();
-
- Button cancel = new Button(parent, SWT.NONE);
- cancel.setText("Cancel");
- cancel.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent selectionEvent) {
- close(false);
- }
- });
- }
-
- public Composite createContent(Composite parent) {
- return initializeGUI(parent);
- }
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-18 03:30:47
|
Revision: 1219
http://cishell.svn.sourceforge.net/cishell/?rev=1219&view=rev
Author: pataphil
Date: 2011-02-18 03:30:41 +0000 (Fri, 18 Feb 2011)
Log Message:
-----------
* Added ZipUtilities.zipFilesWithNames()
Modified Paths:
--------------
trunk/core/org.cishell.utilities/src/org/cishell/utilities/ZipUtilities.java
Modified: trunk/core/org.cishell.utilities/src/org/cishell/utilities/ZipUtilities.java
===================================================================
--- trunk/core/org.cishell.utilities/src/org/cishell/utilities/ZipUtilities.java 2011-02-18 03:29:48 UTC (rev 1218)
+++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/ZipUtilities.java 2011-02-18 03:30:41 UTC (rev 1219)
@@ -23,7 +23,7 @@
throws ZipIOException {
try {
for (File file : files) {
- writeFileToZipFile(file, zipOut);
+ writeFileToZipFile(file, file.getName(), zipOut);
}
zipOut.close();
@@ -44,13 +44,38 @@
}
}
- public static void writeFileToZipFile(File file, ZipOutputStream zipOut)
+ public static void zipFilesWithNames(
+ Map<File, String> fileToZippedName, ZipOutputStream zipOut) throws ZipIOException {
+ try {
+ for (File file : fileToZippedName.keySet()) {
+ writeFileToZipFile(file, fileToZippedName.get(file), zipOut);
+ }
+
+ zipOut.close();
+ } catch (IOException e) {
+ throw new ZipIOException(e.getMessage(), e);
+ }
+ }
+
+ public static void zipFilesWithNames(
+ Map<File, String> fileToZippedName, File targetZipFile) throws ZipIOException {
+ try {
+ zipFilesWithNames(
+ fileToZippedName,
+ new ZipOutputStream(
+ new BufferedOutputStream(new FileOutputStream(targetZipFile))));
+ } catch (FileNotFoundException e) {
+ throw new ZipIOException(e.getMessage(), e);
+ }
+ }
+
+ public static void writeFileToZipFile(File file, String zippedName, ZipOutputStream zipOut)
throws ZipIOException {
try {
byte data[] = new byte[BUFFER_SIZE];
BufferedInputStream fileInput =
new BufferedInputStream(new FileInputStream(file), BUFFER_SIZE);
- ZipEntry entry = new ZipEntry(file.getName());
+ ZipEntry entry = new ZipEntry(zippedName);
zipOut.putNextEntry(entry);
int count;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-18 03:29:54
|
Revision: 1218
http://cishell.svn.sourceforge.net/cishell/?rev=1218&view=rev
Author: pataphil
Date: 2011-02-18 03:29:48 +0000 (Fri, 18 Feb 2011)
Log Message:
-----------
* Changed implementing classes of Converter to reflect calculateLossiness() addition.
* DataMangerServiceImpl now uses LinkedHashMaps (to preserve order).
Modified Paths:
--------------
trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/datamanager/DataManagerServiceImpl.java
trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java
trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/NullConverter.java
Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/datamanager/DataManagerServiceImpl.java
===================================================================
--- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/datamanager/DataManagerServiceImpl.java 2011-02-18 03:21:21 UTC (rev 1217)
+++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/datamanager/DataManagerServiceImpl.java 2011-02-18 03:29:48 UTC (rev 1218)
@@ -14,8 +14,8 @@
package org.cishell.reference.app.service.datamanager;
import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
@@ -26,12 +26,12 @@
public class DataManagerServiceImpl implements DataManagerService {
- private Map<Data, String> datumToLabel = new HashMap<Data, String>();
- private Map<String, Data> labelToDatum = new HashMap<String, Data>();
- private Map<String, Integer> labelToOccurrenceCount = new HashMap<String, Integer>();
- private Set<Data> data = new HashSet<Data>();
- private Set<Data> selectedData = new HashSet<Data>();
- private Set<DataManagerListener> listeners = new HashSet<DataManagerListener>();
+ private Map<Data, String> datumToLabel = new LinkedHashMap<Data, String>();
+ private Map<String, Data> labelToDatum = new LinkedHashMap<String, Data>();
+ private Map<String, Integer> labelToOccurrenceCount = new LinkedHashMap<String, Integer>();
+ private Set<Data> data = new LinkedHashSet<Data>();
+ private Set<Data> selectedData = new LinkedHashSet<Data>();
+ private Set<DataManagerListener> listeners = new LinkedHashSet<DataManagerListener>();
public void addData(Data datum) {
if (datum == null) {
Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java
===================================================================
--- trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java 2011-02-18 03:21:21 UTC (rev 1217)
+++ trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/ConverterImpl.java 2011-02-18 03:29:48 UTC (rev 1218)
@@ -168,19 +168,19 @@
return equal;
}
-
- /* The conversion chain (serviceReferences) is lossless
- * if and only if no conversion (ref) is lossy.
- */
- private String calculateLossiness(ServiceReference[] refs) {
- String lossiness = LOSSLESS;
- for (int i=0; i < refs.length; i++) {
- if (LOSSY.equals(refs[i].getProperty(CONVERSION))) {
- lossiness = LOSSY;
+
+ public String calculateLossiness() {
+ return calculateLossiness(getConverterChain());
+ }
+
+ private static String calculateLossiness(ServiceReference[] serviceReferences) {
+ for (ServiceReference serviceReference : serviceReferences) {
+ if (LOSSY.equals(serviceReference.getProperty(CONVERSION))) {
+ return LOSSY;
}
}
- return lossiness;
+ return LOSSLESS;
}
private class ConverterAlgorithm implements Algorithm {
@@ -287,7 +287,7 @@
return "Problem converting data from "
+ prettifyDataType(inType)
+ " to " + prettifyDataType(outType)
- + " (See the logger file for more details).:\n "
+ + " (See the log file for more details).:\n "
+ e.getMessage();
}
else {
@@ -297,7 +297,7 @@
+ " during the necessary intermediate conversion from "
+ prettifyDataType(preProblemType) + " to "
+ prettifyDataType(postProblemType)
- + " (See the logger file for more details):\n "
+ + " (See the log file for more details):\n "
+ e.getMessage();
}
}
Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/NullConverter.java
===================================================================
--- trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/NullConverter.java 2011-02-18 03:21:21 UTC (rev 1217)
+++ trunk/core/org.cishell.reference/src/org/cishell/reference/service/conversion/NullConverter.java 2011-02-18 03:29:48 UTC (rev 1218)
@@ -73,6 +73,10 @@
return props;
}
+ public String calculateLossiness() {
+ return getProperties().get(CONVERSION).toString();
+ }
+
public Algorithm createAlgorithm(Data[] dm, Dictionary parameters, CIShellContext context) {
return new ConverterAlgorithm(dm, parameters, context);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-18 03:21:27
|
Revision: 1217
http://cishell.svn.sourceforge.net/cishell/?rev=1217&view=rev
Author: pataphil
Date: 2011-02-18 03:21:21 +0000 (Fri, 18 Feb 2011)
Log Message:
-----------
* Improved Converter to have calculateLossiness method.
* Trying to fix the build (ServiceReferenceDelegate.java)
Modified Paths:
--------------
trunk/core/org.cishell.framework/META-INF/MANIFEST.MF
trunk/core/org.cishell.framework/src/org/cishell/framework/ServiceReferenceDelegate.java
trunk/core/org.cishell.framework/src/org/cishell/service/conversion/Converter.java
Modified: trunk/core/org.cishell.framework/META-INF/MANIFEST.MF
===================================================================
--- trunk/core/org.cishell.framework/META-INF/MANIFEST.MF 2011-02-18 03:20:04 UTC (rev 1216)
+++ trunk/core/org.cishell.framework/META-INF/MANIFEST.MF 2011-02-18 03:21:21 UTC (rev 1217)
@@ -5,8 +5,7 @@
Bundle-Version: 1.0.0
Bundle-Vendor: Cyberinfrastructure for Network Science Center
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Import-Package: org.eclipse.osgi.framework.internal.core,
- org.osgi.framework,
+Import-Package: org.osgi.framework,
org.osgi.service.log,
org.osgi.service.metatype,
org.osgi.service.prefs
Modified: trunk/core/org.cishell.framework/src/org/cishell/framework/ServiceReferenceDelegate.java
===================================================================
--- trunk/core/org.cishell.framework/src/org/cishell/framework/ServiceReferenceDelegate.java 2011-02-18 03:20:04 UTC (rev 1216)
+++ trunk/core/org.cishell.framework/src/org/cishell/framework/ServiceReferenceDelegate.java 2011-02-18 03:21:21 UTC (rev 1217)
@@ -1,86 +1,96 @@
-package org.cishell.framework;
+//package org.cishell.framework;
+//
+//import org.osgi.framework.ServiceReference;
+//
+//
+//public class ServiceReferenceDelegate {
+// public static ServiceReference createUniqueServiceReference(
+// ServiceReference originalServiceReference) {
+// originalServiceReference.getClass().
+// return null;
+// }
+//}
-import java.lang.reflect.Field;
-
-import org.eclipse.osgi.framework.internal.core.ServiceReferenceImpl;
-import org.eclipse.osgi.framework.internal.core.ServiceRegistrationImpl;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceReference;
-
-public class ServiceReferenceDelegate extends ServiceReferenceImpl {
- public static final String REGISTRATION_FIELD_NAME =
- "org.eclipse.osgi.framework.internal.core.ServiceReferenceImpl.registration";
-
- private static int nextUniqueID = 0;
-
- private ServiceReference actualServiceReference;
- private int uniqueID;
-
- public ServiceReferenceDelegate(ServiceReference actualServiceReference) {
- super(getServiceRegistration(actualServiceReference));
- this.actualServiceReference = actualServiceReference;
- this.uniqueID = nextUniqueID;
- nextUniqueID++;
-
- }
-
- public Object getProperty(String key) {
- return this.actualServiceReference.getProperty(key);
- }
-
- public String[] getPropertyKeys() {
- return this.actualServiceReference.getPropertyKeys();
- }
-
- public Bundle getBundle() {
- return this.actualServiceReference.getBundle();
- }
-
- public Bundle[] getUsingBundles() {
- return this.actualServiceReference.getUsingBundles();
- }
-
- public boolean isAssignableTo(Bundle bundle, String className) {
- return this.actualServiceReference.isAssignableTo(bundle, className);
- }
-
- @Override
- public int compareTo(Object reference) {
- if (reference instanceof ServiceReferenceDelegate) {
- ServiceReferenceDelegate otherDelegate = (ServiceReferenceDelegate) reference;
-
- return new Integer(this.uniqueID).compareTo(new Integer(otherDelegate.uniqueID));
- } else {
- return this.actualServiceReference.compareTo(reference);
- }
- }
-
- @Override
- public int hashCode() {
- return this.actualServiceReference.hashCode() + new Integer(this.uniqueID).hashCode();
- }
-
- // TODO: Totally, disginstingly hacky.
- private static ServiceRegistrationImpl getServiceRegistration(
- ServiceReference actualServiceReference) {
- try {
- Field[] fields = actualServiceReference.getClass().getDeclaredFields();
-
-// for (Field field : fields) {
-// System.err.println(field);
-// }
- Field registrationField = fields[0];
-// actualServiceReference.getClass().getField(REGISTRATION_FIELD_NAME);
- boolean isAccessible = registrationField.isAccessible();
- registrationField.setAccessible(true);
- Object serviceRegistration = registrationField.get(actualServiceReference);
- registrationField.setAccessible(isAccessible);
-
- return (ServiceRegistrationImpl) serviceRegistration;
- } catch (IllegalAccessException e) {
- throw new RuntimeException(e.getMessage(), e);
- } /* catch (NoSuchFieldException e) {
- throw new RuntimeException(e.getMessage(), e);
- } */
- }
-}
\ No newline at end of file
+//
+//import org.eclipse.osgi.framework.internal.core.ServiceReferenceImpl;
+//import org.eclipse.osgi.framework.internal.core.ServiceRegistrationImpl;
+//import org.osgi.framework.Bundle;
+//import org.osgi.framework.ServiceReference;
+//
+//public class ServiceReferenceDelegate extends ServiceReferenceImpl {
+// public static final String REGISTRATION_FIELD_NAME =
+// "org.eclipse.osgi.framework.internal.core.ServiceReferenceImpl.registration";
+//
+// private static int nextUniqueID = 0;
+//
+// private ServiceReference actualServiceReference;
+// private int uniqueID;
+//
+// public ServiceReferenceDelegate(ServiceReference actualServiceReference) {
+// super(getServiceRegistration(actualServiceReference));
+// this.actualServiceReference = actualServiceReference;
+// this.uniqueID = nextUniqueID;
+// nextUniqueID++;
+//
+// }
+//
+// public Object getProperty(String key) {
+// return this.actualServiceReference.getProperty(key);
+// }
+//
+// public String[] getPropertyKeys() {
+// return this.actualServiceReference.getPropertyKeys();
+// }
+//
+// public Bundle getBundle() {
+// return this.actualServiceReference.getBundle();
+// }
+//
+// public Bundle[] getUsingBundles() {
+// return this.actualServiceReference.getUsingBundles();
+// }
+//
+// public boolean isAssignableTo(Bundle bundle, String className) {
+// return this.actualServiceReference.isAssignableTo(bundle, className);
+// }
+//
+// @Override
+// public int compareTo(Object reference) {
+// if (reference instanceof ServiceReferenceDelegate) {
+// ServiceReferenceDelegate otherDelegate = (ServiceReferenceDelegate) reference;
+//
+// return new Integer(this.uniqueID).compareTo(new Integer(otherDelegate.uniqueID));
+// } else {
+// return this.actualServiceReference.compareTo(reference);
+// }
+// }
+//
+// @Override
+// public int hashCode() {
+// return this.actualServiceReference.hashCode() + new Integer(this.uniqueID).hashCode();
+// }
+//
+// // TODO: Totally, disginstingly hacky.
+// private static ServiceRegistrationImpl getServiceRegistration(
+// ServiceReference actualServiceReference) {
+// try {
+// Field[] fields = actualServiceReference.getClass().getDeclaredFields();
+//
+//// for (Field field : fields) {
+//// System.err.println(field);
+//// }
+// Field registrationField = fields[0];
+//// actualServiceReference.getClass().getField(REGISTRATION_FIELD_NAME);
+// boolean isAccessible = registrationField.isAccessible();
+// registrationField.setAccessible(true);
+// Object serviceRegistration = registrationField.get(actualServiceReference);
+// registrationField.setAccessible(isAccessible);
+//
+// return (ServiceRegistrationImpl) serviceRegistration;
+// } catch (IllegalAccessException e) {
+// throw new RuntimeException(e.getMessage(), e);
+// } /* catch (NoSuchFieldException e) {
+// throw new RuntimeException(e.getMessage(), e);
+// } */
+// }
+//}
\ No newline at end of file
Modified: trunk/core/org.cishell.framework/src/org/cishell/service/conversion/Converter.java
===================================================================
--- trunk/core/org.cishell.framework/src/org/cishell/service/conversion/Converter.java 2011-02-18 03:20:04 UTC (rev 1216)
+++ trunk/core/org.cishell.framework/src/org/cishell/service/conversion/Converter.java 2011-02-18 03:21:21 UTC (rev 1217)
@@ -65,4 +65,6 @@
* @throws ConversionException If the data conversion fails while converting
*/
public Data convert(Data data) throws ConversionException;
+
+ public String calculateLossiness();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-18 03:20:10
|
Revision: 1216
http://cishell.svn.sourceforge.net/cishell/?rev=1216&view=rev
Author: pataphil
Date: 2011-02-18 03:20:04 +0000 (Fri, 18 Feb 2011)
Log Message:
-----------
* Trying to fix the build.
Modified Paths:
--------------
trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java
Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java 2011-02-18 03:19:45 UTC (rev 1215)
+++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java 2011-02-18 03:20:04 UTC (rev 1216)
@@ -21,7 +21,6 @@
import org.cishell.app.service.datamanager.DataManagerService;
import org.cishell.app.service.scheduler.SchedulerService;
import org.cishell.framework.CIShellContext;
-import org.cishell.framework.ServiceReferenceDelegate;
import org.cishell.framework.algorithm.Algorithm;
import org.cishell.framework.algorithm.AlgorithmProperty;
import org.cishell.framework.data.Data;
@@ -74,8 +73,8 @@
public void run() {
try {
- ServiceReference uniqueServiceReference =
- new ServiceReferenceDelegate(this.serviceReference);
+ ServiceReference uniqueServiceReference = this.serviceReference;
+// new ServiceReferenceDelegate(this.serviceReference);
printAlgorithmInformation(uniqueServiceReference, this.ciShellContext);
Algorithm algorithm = new AlgorithmWrapper(
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-18 03:19:51
|
Revision: 1215
http://cishell.svn.sourceforge.net/cishell/?rev=1215&view=rev
Author: pataphil
Date: 2011-02-18 03:19:45 +0000 (Fri, 18 Feb 2011)
Log Message:
-----------
* Trying to fix the build.
Modified Paths:
--------------
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/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java 2011-02-17 20:40:14 UTC (rev 1214)
+++ trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java 2011-02-18 03:19:45 UTC (rev 1215)
@@ -30,7 +30,6 @@
import org.cishell.framework.CIShellContext;
import org.cishell.framework.CIShellContextDelegate;
import org.cishell.framework.LocalCIShellContext;
-import org.cishell.framework.ServiceReferenceDelegate;
import org.cishell.framework.algorithm.Algorithm;
import org.cishell.framework.algorithm.AlgorithmExecutionException;
import org.cishell.framework.algorithm.AlgorithmFactory;
@@ -236,8 +235,9 @@
/* TODO: Eventually use the AlgorithmInvocationService for this
* kind of stuff?
*/
- ServiceReference uniqueServiceReference = new ServiceReferenceDelegate(
- dataManagerServiceReference);
+ ServiceReference uniqueServiceReference = dataManagerServiceReference;
+// ServiceReference uniqueServiceReference = new ServiceReferenceDelegate(
+// dataManagerServiceReference);
CIShellContext ciShellContext = new CIShellContextDelegate(
uniqueServiceReference, new LocalCIShellContext(Activator.context));
LogService uniqueLogger =
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jrb...@us...> - 2011-02-17 20:40:22
|
Revision: 1214
http://cishell.svn.sourceforge.net/cishell/?rev=1214&view=rev
Author: jrbibers
Date: 2011-02-17 20:40:14 +0000 (Thu, 17 Feb 2011)
Log Message:
-----------
Updating package import to use new name from rev 1210.
Revision Links:
--------------
http://cishell.svn.sourceforge.net/cishell/?rev=1210&view=rev
Modified Paths:
--------------
trunk/testing/org.cishell.testing.convertertester.algorithm/META-INF/MANIFEST.MF
Modified: trunk/testing/org.cishell.testing.convertertester.algorithm/META-INF/MANIFEST.MF
===================================================================
--- trunk/testing/org.cishell.testing.convertertester.algorithm/META-INF/MANIFEST.MF 2011-02-16 19:54:37 UTC (rev 1213)
+++ trunk/testing/org.cishell.testing.convertertester.algorithm/META-INF/MANIFEST.MF 2011-02-17 20:40:14 UTC (rev 1214)
@@ -10,7 +10,7 @@
org.cishell.framework.data;version="1.0.0",
org.cishell.reference.app.service.datamanager,
org.cishell.reference.app.service.scheduler,
- org.cishell.reference.gui.common,
+ org.cishell.reference.gui.workspace.common,
org.cishell.reference.gui.datamanager,
org.cishell.reference.gui.guibuilder.swt,
org.cishell.reference.gui.scheduler,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-16 19:54:43
|
Revision: 1213
http://cishell.svn.sourceforge.net/cishell/?rev=1213&view=rev
Author: pataphil
Date: 2011-02-16 19:54:37 +0000 (Wed, 16 Feb 2011)
Log Message:
-----------
* Trying to fix the build.
Modified Paths:
--------------
trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF
Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF 2011-02-16 19:54:02 UTC (rev 1212)
+++ trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF 2011-02-16 19:54:37 UTC (rev 1213)
@@ -9,7 +9,7 @@
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.common,
+ org.cishell.reference.gui.workspace.common,
org.cishell.reference.service.conversion,
org.cishell.reference.service.metatype,
org.cishell.service.conversion;version="1.0.0",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-16 19:54:08
|
Revision: 1212
http://cishell.svn.sourceforge.net/cishell/?rev=1212&view=rev
Author: pataphil
Date: 2011-02-16 19:54:02 +0000 (Wed, 16 Feb 2011)
Log Message:
-----------
* Trying to fix the build.
Modified Paths:
--------------
trunk/core/org.cishell.reference/META-INF/MANIFEST.MF
Modified: trunk/core/org.cishell.reference/META-INF/MANIFEST.MF
===================================================================
--- trunk/core/org.cishell.reference/META-INF/MANIFEST.MF 2011-02-16 17:41:25 UTC (rev 1211)
+++ trunk/core/org.cishell.reference/META-INF/MANIFEST.MF 2011-02-16 19:54:02 UTC (rev 1212)
@@ -2,14 +2,14 @@
Bundle-Name: CIShell Reference Service Implementations
Bundle-SymbolicName: org.cishell.reference
Bundle-Version: 1.0.0
-Import-Package: org.cishell.app.service.datamanager;version="1.0.0",
+Import-Package: org.cishell.app.service.datamanager,
org.cishell.app.service.fileloader,
org.cishell.app.service.scheduler;version="1.0.0",
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.common,
org.cishell.reference.gui.guibuilder.swt,
+ org.cishell.reference.gui.workspace.common,
org.cishell.service.algorithminvocation,
org.cishell.service.conversion;version="1.0.0",
org.cishell.service.guibuilder;version="1.0.0",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-16 17:41:32
|
Revision: 1211
http://cishell.svn.sourceforge.net/cishell/?rev=1211&view=rev
Author: pataphil
Date: 2011-02-16 17:41:25 +0000 (Wed, 16 Feb 2011)
Log Message:
-----------
* Trying to fix the build.
Modified Paths:
--------------
trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveDataChooser.java
trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java
Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveDataChooser.java
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveDataChooser.java 2011-02-16 17:40:45 UTC (rev 1210)
+++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/save/SaveDataChooser.java 2011-02-16 17:41:25 UTC (rev 1211)
@@ -16,7 +16,7 @@
import org.cishell.framework.CIShellContext;
import org.cishell.framework.algorithm.AlgorithmProperty;
import org.cishell.framework.data.Data;
-import org.cishell.reference.gui.common.AbstractDialog;
+import org.cishell.reference.gui.workspace.common.AbstractDialog;
import org.cishell.service.conversion.Converter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java
===================================================================
--- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java 2011-02-16 17:40:45 UTC (rev 1210)
+++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileFormatSelector.java 2011-02-16 17:41:25 UTC (rev 1211)
@@ -3,7 +3,7 @@
import java.io.File;
import org.cishell.framework.algorithm.AlgorithmFactory;
-import org.cishell.reference.gui.common.AbstractDialog;
+import org.cishell.reference.gui.workspace.common.AbstractDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-16 17:40:52
|
Revision: 1210
http://cishell.svn.sourceforge.net/cishell/?rev=1210&view=rev
Author: pataphil
Date: 2011-02-16 17:40:45 +0000 (Wed, 16 Feb 2011)
Log Message:
-----------
* Trying to fix the build.
Modified Paths:
--------------
trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileFormatSelector.java
trunk/clients/gui/org.cishell.reference.gui.workspace/META-INF/MANIFEST.MF
trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/common/AbstractDialog.java
Added Paths:
-----------
trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/common/
Removed Paths:
-------------
trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/common/
Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileFormatSelector.java
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileFormatSelector.java 2011-02-16 16:36:46 UTC (rev 1209)
+++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileFormatSelector.java 2011-02-16 17:40:45 UTC (rev 1210)
@@ -9,7 +9,7 @@
import java.io.File;
import org.cishell.framework.algorithm.AlgorithmFactory;
-import org.cishell.reference.gui.common.AbstractDialog;
+import org.cishell.reference.gui.workspace.common.AbstractDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
Modified: trunk/clients/gui/org.cishell.reference.gui.workspace/META-INF/MANIFEST.MF
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.workspace/META-INF/MANIFEST.MF 2011-02-16 16:36:46 UTC (rev 1209)
+++ trunk/clients/gui/org.cishell.reference.gui.workspace/META-INF/MANIFEST.MF 2011-02-16 17:40:45 UTC (rev 1210)
@@ -8,7 +8,7 @@
org.eclipse.core.runtime,
org.eclipse.update.ui
Eclipse-LazyStart: true
-Export-Package: org.cishell.reference.gui.common,
- org.cishell.reference.gui.workspace
+Export-Package: org.cishell.reference.gui.workspace,
+ org.cishell.reference.gui.workspace.common
Import-Package: org.cishell.reference.gui.guibuilder.swt,
org.cishell.service.guibuilder
Property changes on: trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/common
___________________________________________________________________
Added: svn:mergeinfo
+
Modified: trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/common/AbstractDialog.java
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/common/AbstractDialog.java 2011-01-10 02:34:09 UTC (rev 1190)
+++ trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/common/AbstractDialog.java 2011-02-16 17:40:45 UTC (rev 1210)
@@ -4,7 +4,7 @@
*
* Created on Feb 22, 2005 at Indiana University.
*/
-package org.cishell.reference.gui.common;
+package org.cishell.reference.gui.workspace.common;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-16 16:36:53
|
Revision: 1209
http://cishell.svn.sourceforge.net/cishell/?rev=1209&view=rev
Author: pataphil
Date: 2011-02-16 16:36:46 +0000 (Wed, 16 Feb 2011)
Log Message:
-----------
* Trying to fix the build.
Modified Paths:
--------------
trunk/core/org.cishell.reference/META-INF/MANIFEST.MF
Modified: trunk/core/org.cishell.reference/META-INF/MANIFEST.MF
===================================================================
--- trunk/core/org.cishell.reference/META-INF/MANIFEST.MF 2011-02-14 14:33:29 UTC (rev 1208)
+++ trunk/core/org.cishell.reference/META-INF/MANIFEST.MF 2011-02-16 16:36:46 UTC (rev 1209)
@@ -9,6 +9,7 @@
org.cishell.framework.algorithm;version="1.0.0",
org.cishell.framework.data;version="1.0.0",
org.cishell.reference.gui.common,
+ org.cishell.reference.gui.guibuilder.swt,
org.cishell.service.algorithminvocation,
org.cishell.service.conversion;version="1.0.0",
org.cishell.service.guibuilder;version="1.0.0",
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-14 14:33:35
|
Revision: 1208
http://cishell.svn.sourceforge.net/cishell/?rev=1208&view=rev
Author: pataphil
Date: 2011-02-14 14:33:29 +0000 (Mon, 14 Feb 2011)
Log Message:
-----------
* Fixing the build?
Modified Paths:
--------------
trunk/core/org.cishell.reference/META-INF/MANIFEST.MF
Modified: trunk/core/org.cishell.reference/META-INF/MANIFEST.MF
===================================================================
--- trunk/core/org.cishell.reference/META-INF/MANIFEST.MF 2011-02-11 15:41:52 UTC (rev 1207)
+++ trunk/core/org.cishell.reference/META-INF/MANIFEST.MF 2011-02-14 14:33:29 UTC (rev 1208)
@@ -26,8 +26,8 @@
Require-Bundle: edu.uci.ics.jung,
org.eclipse.swt,
org.eclipse.ui,
- org.eclipse.core.runtime;bundle-version="3.4.0",
- org.eclipse.update.ui;bundle-version="3.2.100"
+ org.eclipse.core.runtime,
+ org.eclipse.update.ui
Service-Component: OSGI-INF/fileloader.xml
Bundle-RequiredExecutionEnvironment: J2SE-1.5
X-AutoStart: true
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-11 15:41:59
|
Revision: 1207
http://cishell.svn.sourceforge.net/cishell/?rev=1207&view=rev
Author: pataphil
Date: 2011-02-11 15:41:52 +0000 (Fri, 11 Feb 2011)
Log Message:
-----------
* Trying to fix the build.
Modified Paths:
--------------
trunk/core/org.cishell.reference/META-INF/MANIFEST.MF
Modified: trunk/core/org.cishell.reference/META-INF/MANIFEST.MF
===================================================================
--- trunk/core/org.cishell.reference/META-INF/MANIFEST.MF 2011-02-11 13:38:37 UTC (rev 1206)
+++ trunk/core/org.cishell.reference/META-INF/MANIFEST.MF 2011-02-11 15:41:52 UTC (rev 1207)
@@ -25,7 +25,9 @@
org.cishell.reference.service.metatype
Require-Bundle: edu.uci.ics.jung,
org.eclipse.swt,
- org.eclipse.ui
+ org.eclipse.ui,
+ org.eclipse.core.runtime;bundle-version="3.4.0",
+ org.eclipse.update.ui;bundle-version="3.2.100"
Service-Component: OSGI-INF/fileloader.xml
Bundle-RequiredExecutionEnvironment: J2SE-1.5
X-AutoStart: true
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-11 13:38:43
|
Revision: 1206
http://cishell.svn.sourceforge.net/cishell/?rev=1206&view=rev
Author: pataphil
Date: 2011-02-11 13:38:37 +0000 (Fri, 11 Feb 2011)
Log Message:
-----------
* Added CollectionUtilities.collectionEnumerationElements
* Added MapUtilities.mapKeyToIndices
* Added ZipIOException and ZipUtilities
* Not reviewed.
Modified Paths:
--------------
trunk/core/org.cishell.utilities/src/org/cishell/utilities/CollectionUtilities.java
trunk/core/org.cishell.utilities/src/org/cishell/utilities/MapUtilities.java
Added Paths:
-----------
trunk/core/org.cishell.utilities/src/org/cishell/utilities/ZipIOException.java
trunk/core/org.cishell.utilities/src/org/cishell/utilities/ZipUtilities.java
Modified: trunk/core/org.cishell.utilities/src/org/cishell/utilities/CollectionUtilities.java
===================================================================
--- trunk/core/org.cishell.utilities/src/org/cishell/utilities/CollectionUtilities.java 2011-02-11 13:37:40 UTC (rev 1205)
+++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/CollectionUtilities.java 2011-02-11 13:38:37 UTC (rev 1206)
@@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Dictionary;
+import java.util.Enumeration;
import java.util.Iterator;
public class CollectionUtilities {
@@ -31,4 +32,13 @@
public static<T> T get(Collection<T> values, int index) {
return (T) values.toArray()[index];
}
+
+ public static<T> Collection<T> collectionEnumerationElements(
+ Enumeration<T> source, Collection<T> target) {
+ while (source.hasMoreElements()) {
+ target.add(source.nextElement());
+ }
+
+ return target;
+ }
}
Modified: trunk/core/org.cishell.utilities/src/org/cishell/utilities/MapUtilities.java
===================================================================
--- trunk/core/org.cishell.utilities/src/org/cishell/utilities/MapUtilities.java 2011-02-11 13:37:40 UTC (rev 1205)
+++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/MapUtilities.java 2011-02-11 13:38:37 UTC (rev 1206)
@@ -64,6 +64,16 @@
return valuesByIndex;
}
+ public static<K> Map<K, Integer> mapKeyToIndices(List<K> keys) {
+ Map<K, Integer> indexByKeys = new HashMap<K, Integer>();
+
+ for (int ii = 0; ii < keys.size(); ii++) {
+ indexByKeys.put(keys.get(ii), ii);
+ }
+
+ return indexByKeys;
+ }
+
public static<K, V> void valuesByKeys(
Map<K, V> items, Collection<K> keys, Collection<V> target) {
for (K key : keys) {
Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/ZipIOException.java
===================================================================
--- trunk/core/org.cishell.utilities/src/org/cishell/utilities/ZipIOException.java (rev 0)
+++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/ZipIOException.java 2011-02-11 13:38:37 UTC (rev 1206)
@@ -0,0 +1,21 @@
+package org.cishell.utilities;
+
+public class ZipIOException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ public ZipIOException() {
+ super();
+ }
+
+ public ZipIOException(String arg0) {
+ super(arg0);
+ }
+
+ public ZipIOException(Throwable arg0) {
+ super(arg0);
+ }
+
+ public ZipIOException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+}
\ No newline at end of file
Added: trunk/core/org.cishell.utilities/src/org/cishell/utilities/ZipUtilities.java
===================================================================
--- trunk/core/org.cishell.utilities/src/org/cishell/utilities/ZipUtilities.java (rev 0)
+++ trunk/core/org.cishell.utilities/src/org/cishell/utilities/ZipUtilities.java 2011-02-11 13:38:37 UTC (rev 1206)
@@ -0,0 +1,143 @@
+package org.cishell.utilities;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipOutputStream;
+
+public class ZipUtilities {
+ static final int BUFFER_SIZE = 2048;
+
+ public static void zipFiles(Collection<File> files, ZipOutputStream zipOut)
+ throws ZipIOException {
+ try {
+ for (File file : files) {
+ writeFileToZipFile(file, zipOut);
+ }
+
+ zipOut.close();
+ } catch (IOException e) {
+ throw new ZipIOException(e.getMessage(), e);
+ }
+ }
+
+ public static void zipFiles(Collection<File> files, File targetZipFile)
+ throws ZipIOException {
+ try {
+ zipFiles(
+ files,
+ new ZipOutputStream(
+ new BufferedOutputStream(new FileOutputStream(targetZipFile))));
+ } catch (FileNotFoundException e) {
+ throw new ZipIOException(e.getMessage(), e);
+ }
+ }
+
+ public static void writeFileToZipFile(File file, ZipOutputStream zipOut)
+ throws ZipIOException {
+ try {
+ byte data[] = new byte[BUFFER_SIZE];
+ BufferedInputStream fileInput =
+ new BufferedInputStream(new FileInputStream(file), BUFFER_SIZE);
+ ZipEntry entry = new ZipEntry(file.getName());
+ zipOut.putNextEntry(entry);
+ int count;
+
+ while ((count = fileInput.read(data, 0, BUFFER_SIZE)) != -1) {
+ zipOut.write(data, 0, count);
+ }
+
+ fileInput.close();
+ } catch (FileNotFoundException e) {
+ throw new ZipIOException(e.getMessage(), e);
+ } catch (IOException e) {
+ throw new ZipIOException(e.getMessage(), e);
+ }
+ }
+
+ public static File readFileFromZipFile(ZipEntry entry, ZipFile zipFile) throws IOException {
+ long size = entry.getSize();
+
+ if (size > 0) {
+ BufferedInputStream reader = new BufferedInputStream(zipFile.getInputStream(entry));
+ String fileName = new File(entry.getName()).getName();
+ File outputFile =
+ FileUtilities.createTemporaryFileInDefaultTemporaryDirectory(fileName, "");
+ BufferedOutputStream output =
+ new BufferedOutputStream(new FileOutputStream(outputFile), BUFFER_SIZE);
+
+ byte readBytes[] = new byte[BUFFER_SIZE];
+ int readByteCount;
+
+ while ((readByteCount = reader.read(readBytes, 0, BUFFER_SIZE)) != -1) {
+ output.write(readBytes, 0, readByteCount);
+ }
+
+ output.close();
+
+ return outputFile;
+ } else {
+ return null;
+ }
+ }
+
+ public static Map<String, ZipEntry> mapFileNamesToEntries(
+ ZipFile zipFile, boolean includeDirectories) throws IOException {
+ Collection<ZipEntry> entries = collectEntries(zipFile);
+ Map<String, ZipEntry> fileNamesToEntries = new HashMap<String, ZipEntry>();
+
+ for (ZipEntry entry : entries) {
+ if (includeDirectories) {
+ if (entry.isDirectory()) {
+ fileNamesToEntries.put(entry.getName(), entry);
+ }
+ } else if (!entry.isDirectory()) {
+ fileNamesToEntries.put(entry.getName(), entry);
+ }
+ }
+
+ return fileNamesToEntries;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static Collection<ZipEntry> collectEntries(ZipFile zipFile) throws IOException {
+ Enumeration<ZipEntry> entries = (Enumeration<ZipEntry>) zipFile.entries();
+
+ return CollectionUtilities.collectionEnumerationElements(
+ entries, new ArrayList<ZipEntry>());
+ }
+
+ public static void main(String[] args) {
+ String filePath =
+ "C:\\Documents and Settings\\pataphil\\Desktop\\org.cishell.utility.swt.zip";
+
+ try {
+ ZipFile zipFile = new ZipFile(filePath);
+ Map<String, ZipEntry> entriesByName = mapFileNamesToEntries(zipFile, false);
+
+ int count = 0;
+ for (String key : entriesByName.keySet()) {
+ System.err.println(key + ": " + entriesByName.get(key));
+ count++;
+
+ if (count == 2) {
+ readFileFromZipFile(entriesByName.get(key), zipFile);
+ }
+ }
+ } catch (IOException e) {
+ System.err.println("Exception: " + e.getMessage());
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-11 13:37:47
|
Revision: 1205
http://cishell.svn.sourceforge.net/cishell/?rev=1205&view=rev
Author: pataphil
Date: 2011-02-11 13:37:40 +0000 (Fri, 11 Feb 2011)
Log Message:
-----------
* Highlighting text on the Console depending on what Data is selected on the Data Manager is in the works.
* Code cleanup.
* Not reviewed.
Modified Paths:
--------------
trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java
trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java
trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java
Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java 2011-02-11 13:37:21 UTC (rev 1204)
+++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java 2011-02-11 13:37:40 UTC (rev 1205)
@@ -21,6 +21,7 @@
import org.cishell.app.service.datamanager.DataManagerService;
import org.cishell.app.service.scheduler.SchedulerService;
import org.cishell.framework.CIShellContext;
+import org.cishell.framework.ServiceReferenceDelegate;
import org.cishell.framework.algorithm.Algorithm;
import org.cishell.framework.algorithm.AlgorithmProperty;
import org.cishell.framework.data.Data;
@@ -63,9 +64,9 @@
setText(label);
setToolTipText((String)serviceReference.getProperty(AlgorithmProperty.DESCRIPTION));
- DataManagerService dataManager = (DataManagerService)
- bundleContext.getService(bundleContext.getServiceReference(
- DataManagerService.class.getName()));
+ DataManagerService dataManager =
+ (DataManagerService) bundleContext.getService(bundleContext.getServiceReference(
+ DataManagerService.class.getName()));
dataManager.addDataManagerListener(this);
dataSelected(dataManager.getSelectedData());
@@ -73,10 +74,12 @@
public void run() {
try {
- printAlgorithmInformation(this.serviceReference, this.ciShellContext);
+ ServiceReference uniqueServiceReference =
+ new ServiceReferenceDelegate(this.serviceReference);
+ printAlgorithmInformation(uniqueServiceReference, this.ciShellContext);
Algorithm algorithm = new AlgorithmWrapper(
- this.serviceReference,
+ uniqueServiceReference,
this.bundleContext,
this.ciShellContext,
this.originalData,
@@ -84,43 +87,44 @@
this.converters);
SchedulerService scheduler = (SchedulerService) getService(SchedulerService.class);
- scheduler.schedule(algorithm, this.serviceReference);
+ scheduler.schedule(algorithm, uniqueServiceReference);
} catch (Throwable exception) {
// Just in case an uncaught exception occurs. Eclipse will swallow errors thrown here.
exception.printStackTrace();
}
}
- private void printAlgorithmInformation(ServiceReference ref, CIShellContext ciContext) {
+ private void printAlgorithmInformation(
+ ServiceReference serviceReference, CIShellContext ciContext) {
// Adjust to log the whole acknowledgement in one block.
LogService logger = (LogService) ciContext.getService(LogService.class.getName());
StringBuffer acknowledgement = new StringBuffer();
- String label = (String)ref.getProperty(LABEL);
+ String label = (String) serviceReference.getProperty(LABEL);
if (label != null) {
acknowledgement.append("..........\n" + label + " was selected.\n");
}
- String authors = (String)ref.getProperty(AUTHORS);
+ String authors = (String) serviceReference.getProperty(AUTHORS);
if (authors != null) {
acknowledgement.append("Author(s): " + authors + "\n");
}
- String implementers = (String)ref.getProperty(IMPLEMENTERS);
+ String implementers = (String) serviceReference.getProperty(IMPLEMENTERS);
if (implementers != null) {
acknowledgement.append("Implementer(s): " + implementers + "\n");
}
- String integrators = (String)ref.getProperty(INTEGRATORS);
+ String integrators = (String) serviceReference.getProperty(INTEGRATORS);
if (integrators != null) {
acknowledgement.append("Integrator(s): " + integrators + "\n");
}
- String reference = (String)ref.getProperty(REFERENCE);
- String reference_url = (String)ref.getProperty(REFERENCE_URL);
+ String reference = (String) serviceReference.getProperty(REFERENCE);
+ String reference_url = (String) serviceReference.getProperty(REFERENCE_URL);
if ((reference != null) && (reference_url != null)) {
acknowledgement.append(
@@ -129,14 +133,14 @@
acknowledgement.append("Reference: " + reference + "\n");
}
- String docu = (String)ref.getProperty(DOCUMENTATION_URL);
+ String documentationURL = (String) serviceReference.getProperty(DOCUMENTATION_URL);
- if (docu != null) {
- acknowledgement.append("Documentation: " + docu + "\n");
+ if (documentationURL != null) {
+ acknowledgement.append("Documentation: " + documentationURL + "\n");
}
if (acknowledgement.length() > 1) {
- logger.log(LogService.LOG_INFO, acknowledgement.toString());
+ logger.log(serviceReference, LogService.LOG_INFO, acknowledgement.toString());
}
}
Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2011-02-11 13:37:21 UTC (rev 1204)
+++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2011-02-11 13:37:40 UTC (rev 1205)
@@ -24,6 +24,7 @@
import org.cishell.app.service.datamanager.DataManagerService;
import org.cishell.framework.CIShellContext;
+import org.cishell.framework.CIShellContextDelegate;
import org.cishell.framework.algorithm.Algorithm;
import org.cishell.framework.algorithm.AlgorithmCanceledException;
import org.cishell.framework.algorithm.AlgorithmCreationCanceledException;
@@ -85,15 +86,15 @@
/**
* @see org.cishell.framework.algorithm.Algorithm#execute()
*/
- public Data[] execute() {
+ public Data[] execute() throws AlgorithmExecutionException {
try {
- AlgorithmFactory factory = getAlgorithmFactory(bundleContext, serviceReference);
+ AlgorithmFactory factory = getAlgorithmFactory(bundleContext, this.serviceReference);
if (factory == null) {
return null;
}
- String pid = (String) serviceReference.getProperty(Constants.SERVICE_PID);
+ String pid = (String) this.serviceReference.getProperty(Constants.SERVICE_PID);
// Convert input data to the correct format.
boolean conversionSuccessful = tryConvertingDataToRequiredFormat(data, converters);
@@ -109,7 +110,7 @@
}
// Create algorithm parameters.
- String metatypePID = getMetaTypeID(serviceReference);
+ String metatypePID = getMetaTypeID(this.serviceReference);
// TODO: Refactor this.
MetaTypeProvider provider = null;
@@ -122,11 +123,15 @@
"provided. (Reason: %s)";
String logMessage = String.format(
format,
- serviceReference.getProperty(AlgorithmProperty.LABEL),
+ this.serviceReference.getProperty(AlgorithmProperty.LABEL),
e.getMessage());
- log(LogService.LOG_WARNING, logMessage, e);
+ log(LogService.LOG_ERROR, logMessage, e);
return null;
+ } catch (Exception e) {
+ log(LogService.LOG_ERROR, e.getMessage(), e);
+
+ return null;
}
Dictionary<String, Object> parameters =
@@ -140,7 +145,11 @@
printParameters(metatypePID, provider, parameters);
// Create the algorithm.
- algorithm = createAlgorithm(factory, data, parameters, ciShellContext);
+ algorithm = createAlgorithm(
+ factory,
+ data,
+ parameters,
+ new CIShellContextDelegate(this.serviceReference, this.ciShellContext));
if (algorithm == null) {
return null;
@@ -151,9 +160,15 @@
// Execute the algorithm.
Data[] outData = tryExecutingAlgorithm(algorithm);
- if (outData == null)
+ if (outData == null) {
return null;
+ }
+ // TODO: Refactor this into a method?
+ for (Data datum : outData) {
+ datum.getMetadata().put(DataProperty.SERVICE_REFERENCE, this.serviceReference);
+ }
+
// Process and return the algorithm's output.
doParentage(outData);
outData = removeNullData(outData);
@@ -162,11 +177,11 @@
return outData;
}
catch (Exception e) {
- GUIBuilderService builder = (GUIBuilderService)ciShellContext.getService
- (GUIBuilderService.class.getName());
+ GUIBuilderService builder = (GUIBuilderService) this.ciShellContext.getService(
+ GUIBuilderService.class.getName());
String errorMessage = "An error occurred while preparing to run "
- + "the algorithm \"" + serviceReference.getProperty(AlgorithmProperty.LABEL)
+ + "the algorithm \"" + this.serviceReference.getProperty(AlgorithmProperty.LABEL)
+ ".\"";
builder.showError("Error!", errorMessage, e);
@@ -188,10 +203,10 @@
String details = "The algorithm's pid was \""
+ serviceReference.getProperty(Constants.SERVICE_PID)
+ "\" (potentially useful for debugging purposes).";
- GUIBuilderService builder =
- (GUIBuilderService) ciShellContext.getService(GUIBuilderService.class.getName());
+ GUIBuilderService builder = (GUIBuilderService) this.ciShellContext.getService(
+ GUIBuilderService.class.getName());
builder.showError("Error!", errorMessage, details);
- this.logger(LogService.LOG_ERROR, errorMessage);
+ this.log(LogService.LOG_ERROR, errorMessage);
}
return algorithmFactory;
@@ -203,7 +218,7 @@
Dictionary<String, Object> parameters,
CIShellContext ciContext) {
final String algorithmName =
- (String) serviceReference.getProperty(AlgorithmProperty.LABEL);
+ (String) this.serviceReference.getProperty(AlgorithmProperty.LABEL);
// TODO: Call on algorithm invocation service here.
try {
return factory.createAlgorithm(data, parameters, ciContext);
@@ -274,7 +289,7 @@
protected Data[] tryExecutingAlgorithm(Algorithm algorithm) {
Data[] outData = null;
final String algorithmName =
- (String) serviceReference.getProperty(AlgorithmProperty.LABEL);
+ (String) this.serviceReference.getProperty(AlgorithmProperty.LABEL);
try {
outData = algorithm.execute();
@@ -291,8 +306,8 @@
e.getMessage());
log(LogService.LOG_ERROR, logMessage, e);
} catch (RuntimeException e) {
- GUIBuilderService builder =
- (GUIBuilderService) ciShellContext.getService(GUIBuilderService.class.getName());
+ GUIBuilderService builder = (GUIBuilderService) this.ciShellContext.getService(
+ GUIBuilderService.class.getName());
String errorMessage = String.format(
"An unxpected error occurred while executing the algorithm \"%s\".",
algorithmName);
@@ -316,7 +331,7 @@
}
if (data[i] == null && i < (data.length - 1)) {
- logger(LogService.LOG_ERROR, "The converter: "
+ log(LogService.LOG_ERROR, "The converter: "
+ converters[i].getClass().getName()
+ " returned a null result where data was "
+ "expected when converting the data to give "
@@ -330,18 +345,17 @@
return true;
}
- protected boolean testDataValidityIfPossible(AlgorithmFactory factory,
- Data[] data) {
+ protected boolean testDataValidityIfPossible(AlgorithmFactory factory, Data[] data) {
if (factory instanceof DataValidator) {
String validation = ((DataValidator) factory).validate(data);
if (validation != null && validation.length() > 0) {
- String label = (String) serviceReference.getProperty(LABEL);
+ String label = (String) this.serviceReference.getProperty(LABEL);
if (label == null) {
label = "Algorithm";
}
- logger(LogService.LOG_ERROR,
+ log(LogService.LOG_ERROR,
"INVALID DATA: The data given to \"" + label
+ "\" is incompatible for this reason: " + validation);
return false;
@@ -369,7 +383,7 @@
MetaTypeService metaTypeService = (MetaTypeService)
Activator.getService(MetaTypeService.class.getName());
if (metaTypeService != null) {
- provider = metaTypeService.getMetaTypeInformation(serviceReference.getBundle());
+ provider = metaTypeService.getMetaTypeInformation(this.serviceReference.getBundle());
}
if ((factory instanceof ParameterMutator) && (provider != null)) {
@@ -397,7 +411,7 @@
}
if (provider != null) {
- provider = wrapProvider(serviceReference, provider);
+ provider = wrapProvider(this.serviceReference, provider);
}
return provider;
@@ -414,8 +428,8 @@
Dictionary<String, Object> parameters = new Hashtable<String, Object>();
if (provider != null) {
- GUIBuilderService builder =
- (GUIBuilderService) ciShellContext.getService(GUIBuilderService.class.getName());
+ GUIBuilderService builder = (GUIBuilderService) this.ciShellContext.getService(
+ GUIBuilderService.class.getName());
// TODO: Make builder.createGUIAndWait return a Dictionary<String, Object>.
parameters = builder.createGUIandWait(metatypePID, provider);
@@ -465,21 +479,22 @@
UserPrefsProperty.PUBLISH_PARAM_DEFAULT_PREFS_VALUE);
}
- protected void logger(int logLevel, String message) {
- LogService log =
- (LogService) ciShellContext.getService(LogService.class.getName());
- if (log != null) {
- log.log(logLevel, message);
+ protected void log(int logLevel, String message) {
+ LogService logger =
+ (LogService) this.ciShellContext.getService(LogService.class.getName());
+ if (logger != null) {
+ logger.log(this.serviceReference, logLevel, message);
} else {
System.out.println(message);
}
}
protected void log(int logLevel, String message, Throwable exception) {
- LogService log =
- (LogService) ciShellContext.getService(LogService.class.getName());
- if (log != null) {
- log.log(logLevel, message, exception);
+ LogService logger =
+ (LogService) this.ciShellContext.getService(LogService.class.getName());
+
+ if (logger != null) {
+ logger.log(this.serviceReference, logLevel, message, exception);
} else {
System.out.println(message);
exception.printStackTrace();
@@ -505,7 +520,7 @@
inputParams.append("\n" + key + ": " + value);
}
- logger.log(LogService.LOG_INFO, inputParams.toString());
+ logger.log(this.serviceReference, LogService.LOG_INFO, inputParams.toString());
}
}
@@ -562,7 +577,7 @@
}
// Check and act on parentage settings
- String parentage = (String) serviceReference.getProperty("parentage");
+ String parentage = (String) this.serviceReference.getProperty("parentage");
if (parentage != null) {
parentage = parentage.trim();
if (parentage.equalsIgnoreCase("default")) {
@@ -611,7 +626,7 @@
}
private void logNullOCDWarning(String pid, String metatype_pid) {
- this.logger(LogService.LOG_WARNING,
+ this.log(LogService.LOG_WARNING,
"Warning: could not get object class definition '" + metatype_pid
+ "' from the algorithm '" + pid + "'");
}
Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2011-02-11 13:37:21 UTC (rev 1204)
+++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2011-02-11 13:37:40 UTC (rev 1205)
@@ -139,7 +139,7 @@
this.actionsToMenuManagers = new HashMap<Action, IMenuManager>();
this.pidsToServiceReferences = new HashMap<String, ServiceReference>();
this.pidsToServiceReferencesCopy = new HashMap<String, ServiceReference>();
- this.logger = (LogService)this.ciShellContext.getService(LogService.class.getName());
+ this.logger = (LogService) this.ciShellContext.getService(LogService.class.getName());
/*
* The intention of this clearShortcuts was to programmatically clear all of the
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-11 13:37:28
|
Revision: 1204
http://cishell.svn.sourceforge.net/cishell/?rev=1204&view=rev
Author: pataphil
Date: 2011-02-11 13:37:21 +0000 (Fri, 11 Feb 2011)
Log Message:
-----------
* Highlighting text on the Console depending on what Data is selected on the Data Manager is in the works.
* Code cleanup.
* Not reviewed.
Modified Paths:
--------------
trunk/clients/gui/org.cishell.reference.gui.log/META-INF/MANIFEST.MF
trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/Activator.java
trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogView.java
Modified: trunk/clients/gui/org.cishell.reference.gui.log/META-INF/MANIFEST.MF
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.log/META-INF/MANIFEST.MF 2011-02-11 13:26:16 UTC (rev 1203)
+++ trunk/clients/gui/org.cishell.reference.gui.log/META-INF/MANIFEST.MF 2011-02-11 13:37:21 UTC (rev 1204)
@@ -8,5 +8,9 @@
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime
Eclipse-LazyStart: true
-Import-Package: org.cishell.utility.swt,
+Import-Package: com.google.common.collect,
+ org.cishell.app.service.datamanager;version="1.0.0",
+ org.cishell.framework;version="1.0.0",
+ org.cishell.framework.data;version="1.0.0",
+ org.cishell.utility.swt,
org.osgi.service.log;version="1.3.0"
Modified: trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/Activator.java
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/Activator.java 2011-02-11 13:26:16 UTC (rev 1203)
+++ trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/Activator.java 2011-02-11 13:37:21 UTC (rev 1204)
@@ -1,5 +1,6 @@
package org.cishell.reference.gui.log;
+import org.cishell.app.service.datamanager.DataManagerService;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
@@ -13,24 +14,29 @@
public static final String PLUGIN_ID = "org.cishell.reference.gui.log";
private static Activator plugin;
private static BundleContext context;
+ public static DataManagerService dataManager;
public Activator() {
plugin = this;
}
- public void start(BundleContext context) throws Exception {
- super.start(context);
- Activator.context = context;
+ public void start(BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ Activator.context = bundleContext;
LogListener fileLogListener = new LogToFile();
ServiceReference serviceReference =
- context.getServiceReference(LogReaderService.class.getName());
+ bundleContext.getServiceReference(LogReaderService.class.getName());
LogReaderService logReaderService =
- (LogReaderService) context.getService(serviceReference);
+ (LogReaderService) bundleContext.getService(serviceReference);
if (logReaderService != null) {
logReaderService.addLogListener(fileLogListener);
}
+
+ Activator.dataManager = (DataManagerService)
+ bundleContext.getService(bundleContext.getServiceReference(
+ DataManagerService.class.getName()));
}
public void stop(BundleContext bundleContext) throws Exception {
Modified: trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogView.java
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogView.java 2011-02-11 13:26:16 UTC (rev 1203)
+++ trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogView.java 2011-02-11 13:37:21 UTC (rev 1204)
@@ -18,16 +18,23 @@
import java.io.FileWriter;
import java.io.IOException;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
+import org.cishell.app.service.datamanager.DataManagerListener;
+import org.cishell.framework.data.Data;
+import org.cishell.framework.data.DataProperty;
import org.cishell.utility.swt.SWTUtilities;
import org.cishell.utility.swt.URLClickedListener;
import org.cishell.utility.swt.URLMouseCursorListener;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.dnd.Clipboard;
import org.eclipse.swt.dnd.TextTransfer;
@@ -50,7 +57,10 @@
import org.osgi.service.log.LogReaderService;
import org.osgi.service.log.LogService;
-public class LogView extends ViewPart implements LogListener {
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Multimap;
+
+public class LogView extends ViewPart implements DataManagerListener, LogListener {
public static final String CONFIGURATION_DIRECTORY = "configuration";
public static final String WELCOME_TEXT_FILE_NAME = "Welcome.properties";
public static final String GREETING_PROPERTY = "greeting";
@@ -60,7 +70,91 @@
public static final Color LOG_WARNING_COLOR = new Color(Display.getDefault(), 255, 127, 0);
public static final Color LOG_INFO_COLOR = getSystemColor(SWT.COLOR_BLACK);
public static final Color LOG_DEBUG_COLOR = new Color(Display.getDefault(), 150, 150, 150);
+ public static final Color UNHIGHLIGHED_BACKGROUND_COLOR =
+ new Color(Display.getDefault(), 255, 255, 255);
+ public static final Color HIGHLIGHTED_BACKGROUND_COLOR =
+ new Color(Display.getDefault(), 200, 200, 200);
+ public static final boolean HIGHLIGHT_TEXT = false;
+
+ private Multimap<ServiceReference, Bounds> boundsByServiceReference = HashMultimap.create();
+ private Collection<StyleRange> nonHighlightStyleRanges = new HashSet<StyleRange>();
+
+ // DataManagerListener
+
+ public void dataAdded(Data data, String label) {}
+ public void dataLabelChanged(Data data, String label) {}
+ public void dataRemoved(Data data) {}
+
+ public void dataSelected(final Data[] data) {
+ if (HIGHLIGHT_TEXT) {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+ public void run() {
+ LogView.this.textField.replaceStyleRanges(
+ 0, LogView.this.textField.getText().length(), new StyleRange[0]);
+ }
+ });
+
+ final Collection<StyleRange> highlights = new ArrayList<StyleRange>();
+
+ for (Data datum : data) {
+ Object serviceReferenceObject =
+ datum.getMetadata().get(DataProperty.SERVICE_REFERENCE);
+
+ if (serviceReferenceObject != null) {
+ ServiceReference serviceReference = (ServiceReference) serviceReferenceObject;
+
+ if (LogView.this.boundsByServiceReference.containsKey(serviceReference)) {
+ Collection<Bounds> highlightBounds =
+ LogView.this.boundsByServiceReference.get(serviceReference);
+
+ for (Bounds highlightBound : highlightBounds) {
+ StyleRange highlightStyle = new StyleRange();
+ highlightStyle.start = highlightBound.start;
+ highlightStyle.length = highlightBound.length;
+ highlightStyle.background = HIGHLIGHTED_BACKGROUND_COLOR;
+ highlights.add(highlightStyle);
+ }
+ }
+ }
+ }
+
+ final Collection<StyleRange> nonHighlightStyles = new ArrayList<StyleRange>();
+
+ for (StyleRange nonHighlightStyle : this.nonHighlightStyleRanges) {
+ StyleRange newStyle = nonHighlightStyle;
+
+ for (StyleRange highlightStyle : highlights) {
+ int start = nonHighlightStyle.start;
+
+ if ((start >= highlightStyle.start) &&
+ (start < (highlightStyle.start + highlightStyle.length))) {
+ newStyle = (StyleRange) newStyle.clone();
+ newStyle.background = HIGHLIGHTED_BACKGROUND_COLOR;
+ }
+ }
+
+ nonHighlightStyles.add(newStyle);
+ }
+
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+ public void run() {
+ try {
+ for (StyleRange style : highlights) {
+ LogView.this.textField.setStyleRange(style);
+ }
+
+ for (StyleRange style : nonHighlightStyles) {
+ LogView.this.textField.setStyleRange(style);
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ }
+ }
+
private static Color getSystemColor(final int swtColor) {
final Color[] color = new Color[1];
@@ -102,6 +196,9 @@
currentLevel = LogService.LOG_INFO;
}
*/
+ if (HIGHLIGHT_TEXT) {
+ Activator.dataManager.addDataManagerListener(this);
+ }
}
/**
@@ -212,18 +309,36 @@
try {
String message = entry.getMessage();
if (goodMessage(message)) {
- // Not all messages end w/ a new line, but they need to to print properly.
+ /* Not all messages length w/ a new line,
+ * but they need to to print properly.
+ */
if (!message.endsWith("\n")) {
message += "\n";
}
+
+ if (HIGHLIGHT_TEXT) {
+ ServiceReference serviceReference = entry.getServiceReference();
+
+ if (serviceReference != null) {
+ int currentTextLength = LogView.this.textField.getText().length();
+ Bounds highlightBounds =
+ new Bounds(currentTextLength, message.length());
+ LogView.this.boundsByServiceReference.put(
+ serviceReference, highlightBounds);
+ }
+ }
- SWTUtilities.appendStringWithURL(
+ Collection<StyleRange> styles = SWTUtilities.appendStringWithURL(
LogView.this.textField,
LogView.this.urlListener,
LogView.this.urlCursorListener,
message,
COLOR_MAPPING.get("" + entry.getLevel()),
- URL_COLOR);
+ URL_COLOR);
+
+ if (HIGHLIGHT_TEXT) {
+ LogView.this.nonHighlightStyleRanges.addAll(styles);
+ }
}
} catch (Throwable e) {
e.printStackTrace();
@@ -242,4 +357,14 @@
return true;
}
}
+
+ private static class Bounds {
+ public int start;
+ public int length;
+
+ public Bounds(int start, int end) {
+ this.start = start;
+ this.length = end;
+ }
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pat...@us...> - 2011-02-11 13:26:24
|
Revision: 1203
http://cishell.svn.sourceforge.net/cishell/?rev=1203&view=rev
Author: pataphil
Date: 2011-02-11 13:26:16 +0000 (Fri, 11 Feb 2011)
Log Message:
-----------
* Added loadFileOfType methods to FileLoaderService and implementation.
* Removed AlgorithmFactory2
* Potential redesign of AlgorithmInvocationService?
Modified Paths:
--------------
trunk/core/org.cishell.framework/META-INF/MANIFEST.MF
trunk/core/org.cishell.framework/src/org/cishell/app/service/fileloader/FileLoaderService.java
trunk/core/org.cishell.framework/src/org/cishell/service/algorithminvocation/AlgorithmInvocationService.java
trunk/core/org.cishell.reference/META-INF/MANIFEST.MF
trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/algorithminvocation/AlgorithmInvocationServiceImpl.java
trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/datamanager/DataManagerServiceImpl.java
trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileLoaderServiceImpl.java
trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/PrettyLabeler.java
trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/ValidatorSelectorRunnable.java
Added Paths:
-----------
trunk/core/org.cishell.framework/src/org/cishell/service/algorithminvocation/FakeAlgorithmInvocationService.java
trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/algorithminvocation/FakeAlgorithmInvocationServiceImpl.java
Removed Paths:
-------------
trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AlgorithmFactory2.java
Modified: trunk/core/org.cishell.framework/META-INF/MANIFEST.MF
===================================================================
--- trunk/core/org.cishell.framework/META-INF/MANIFEST.MF 2011-02-09 18:22:52 UTC (rev 1202)
+++ trunk/core/org.cishell.framework/META-INF/MANIFEST.MF 2011-02-11 13:26:16 UTC (rev 1203)
@@ -17,6 +17,7 @@
org.cishell.framework.algorithm;version="1.0.0",
org.cishell.framework.data;version="1.0.0",
org.cishell.framework.userprefs;version="1.0.0",
+ org.cishell.service.algorithminvocation,
org.cishell.service.conversion;version="1.0.0",
org.cishell.service.guibuilder;version="1.0.0"
Bundle-ActivationPolicy: lazy
Modified: trunk/core/org.cishell.framework/src/org/cishell/app/service/fileloader/FileLoaderService.java
===================================================================
--- trunk/core/org.cishell.framework/src/org/cishell/app/service/fileloader/FileLoaderService.java 2011-02-09 18:22:52 UTC (rev 1202)
+++ trunk/core/org.cishell.framework/src/org/cishell/app/service/fileloader/FileLoaderService.java 2011-02-11 13:26:16 UTC (rev 1203)
@@ -3,6 +3,7 @@
import java.io.File;
import org.cishell.framework.CIShellContext;
+import org.cishell.framework.algorithm.AlgorithmFactory;
import org.cishell.framework.algorithm.ProgressMonitor;
import org.cishell.framework.data.Data;
import org.osgi.framework.BundleContext;
@@ -29,4 +30,19 @@
LogService logger,
ProgressMonitor progressMonitor,
File file) throws FileLoadException;
+ public Data[] loadFileOfType(
+ BundleContext bundleContext,
+ CIShellContext ciShellContext,
+ LogService logger,
+ ProgressMonitor progressMonitor,
+ File file,
+ String fileExtension,
+ String mimeType) throws FileLoadException;
+ public Data[] loadFileOfType(
+ BundleContext bundleContext,
+ CIShellContext ciShellContext,
+ LogService logger,
+ ProgressMonitor progressMonitor,
+ File file,
+ AlgorithmFactory validator) throws FileLoadException;
}
\ No newline at end of file
Deleted: trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AlgorithmFactory2.java
===================================================================
--- trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AlgorithmFactory2.java 2011-02-09 18:22:52 UTC (rev 1202)
+++ trunk/core/org.cishell.framework/src/org/cishell/framework/algorithm/AlgorithmFactory2.java 2011-02-11 13:26:16 UTC (rev 1203)
@@ -1,7 +0,0 @@
-package org.cishell.framework.algorithm;
-
-import org.osgi.framework.ServiceReference;
-
-public interface AlgorithmFactory2 {
- public void setServiceReference(ServiceReference serviceReference);
-}
\ No newline at end of file
Modified: trunk/core/org.cishell.framework/src/org/cishell/service/algorithminvocation/AlgorithmInvocationService.java
===================================================================
--- trunk/core/org.cishell.framework/src/org/cishell/service/algorithminvocation/AlgorithmInvocationService.java 2011-02-09 18:22:52 UTC (rev 1202)
+++ trunk/core/org.cishell.framework/src/org/cishell/service/algorithminvocation/AlgorithmInvocationService.java 2011-02-11 13:26:16 UTC (rev 1203)
@@ -1,126 +1,20 @@
+package org.cishell.service.algorithminvocation;
-/* TODO: When we have time, we should talk about the design of the Algorithm Invocation Service (if
- * we even use that name in the end).
- * It's somewhat apparent that there is a use for this service, but exactly how it fits into
- * CIShell and all of the tools remains to be fully clarified.
- * This is all commented out for now because the design/use need discussion.
- */
+import java.util.Dictionary;
-//package org.cishell.service.algorithminvocation;
-//
-//import java.util.Dictionary;
-//
-//import org.cishell.framework.CIShellContext;
-//import org.cishell.framework.algorithm.Algorithm;
-//import org.cishell.framework.algorithm.AlgorithmCanceledException;
-//import org.cishell.framework.algorithm.AlgorithmCreationCanceledException;
-//import org.cishell.framework.algorithm.AlgorithmCreationFailedException;
-//import org.cishell.framework.algorithm.AlgorithmExecutionException;
-//import org.cishell.framework.algorithm.AlgorithmFactory;
-//import org.cishell.framework.data.Data;
-//
-///**
-// * Provides the caller with various ways of creating algorithms, executing them, and
-// * gathering/mutating parameters.
-// * When creating an algorithm (from a factory), if the factory implements ParameterMutator,
-// * mutateParameters() will be called on it.
-// * All methods can optionally operate on a new thread, which is determined by shouldUseNewThread.
-// */
-//public interface AlgorithmInvocationService {
-// /**
-// * Uses factory to create an algorithm, presenting the user with a GUI for parameters.
-// */
-// public Algorithm createAlgorithm(
-// final AlgorithmFactory factory,
-// final Data[] data,
-// final CIShellContext ciShellContext,
-// boolean shouldUseNewThread)
-// throws AlgorithmCreationCanceledException, AlgorithmCreationFailedException;
-//
-// /**
-// * Uses factory to create an algorithm, using parameters (instead of presenting the user with a
-// * GUI for them).
-// */
-// public Algorithm createAlgorithm(
-// final AlgorithmFactory factory,
-// final Data[] data,
-// final Dictionary<String, Object> parameters,
-// final CIShellContext ciShellContext,
-// boolean shouldUseNewThread)
-// throws AlgorithmCreationCanceledException, AlgorithmCreationFailedException;
-//
-// /**
-// * Invokes algorithm, returning the Data[] result of algorithm.execute().
-// * If logExceptionThrown is true, any exception thrown will be logged to the
-// * default LogService.
-// * If displayRuntimeException is true, the stack trace of any exception thrown will be
-// * displayed in an error message box.
-// */
-// public Data[] invokeAlgorithm(
-// final Algorithm algorithm,
-// final boolean logExceptionThrown,
-// final boolean displayRuntimeException,
-// boolean shouldUseNewThread)
-// throws AlgorithmCanceledException, AlgorithmExecutionException;
-//
-// /**
-// * Invokes algorithm, assuming sensible defaults for inline algorithm execution (that is,
-// * not explicitly invoked from a menu/etc.), and return the Data[] result of
-// * algorithm.execute().
-// * Most likely wraps invokeAlgorithm().
-// */
-// public Data[] simpleInvokeAlgorithm(final Algorithm algorithm, Thread thread)
-// throws AlgorithmCanceledException, AlgorithmExecutionException;
-//
-// /**
-// * Given factory, presents the user with a GUI for parameters to use for creating and executing
-// * an algorithm.
-// * Most likely wraps createAlgorithm() and invokeAlgorithm().
-// */
-// public Data[] createAndInvokeAlgorithm(
-// final AlgorithmFactory factory,
-// final Data[] data,
-// final CIShellContext ciShellContext,
-// final boolean logExceptionThrown,
-// final boolean displayRuntimeException,
-// boolean shouldUseNewThread) throws
-// AlgorithmCreationCanceledException,
-// AlgorithmCreationFailedException,
-// AlgorithmCanceledException,
-// AlgorithmExecutionException;
-//
-// /**
-// * Given factory, uses parameters to create and execute an algorithm.
-// * Most likely wraps createAlgorithm() and invokeAlgorithm().
-// */
-// public Data[] createAndInvokeAlgorithm(
-// final AlgorithmFactory factory,
-// final Data[] data,
-// final Dictionary<String, Object> parameters,
-// final CIShellContext ciShellContext,
-// final boolean logExceptionThrown,
-// final boolean displayRuntimeException,
-// boolean shouldUseNewThread) throws
-// AlgorithmCreationCanceledException,
-// AlgorithmCreationFailedException,
-// AlgorithmCanceledException,
-// AlgorithmExecutionException;
-//
-// /**
-// * Given factory, uses parameters to create and execute an algorithm.
-// * Sensible defaults for inline algorithm execution (that is, not explicitly invoked from a
-// * menu/etc.) are used.
-// * Returns the Data[] result of algorithm.execute().
-// * Most likely wraps createAlgorithm() and simpleInvokeAlgorithm().
-// */
-// public Data[] simpleCreateAndInvokeAlgorithm(
-// final AlgorithmFactory factory,
-// final Data[] data,
-// final Dictionary<String, Object> parameters,
-// CIShellContext ciShellContext,
-// boolean shouldUseNewThread) throws
-// AlgorithmCreationCanceledException,
-// AlgorithmCreationFailedException,
-// AlgorithmCanceledException,
-// AlgorithmExecutionException;
-//}
\ No newline at end of file
+import org.cishell.framework.CIShellContext;
+import org.cishell.framework.algorithm.AlgorithmExecutionException;
+import org.cishell.framework.data.Data;
+import org.osgi.framework.ServiceReference;
+
+public interface AlgorithmInvocationService {
+ public Data[] runAlgorithm(String pid, Data[] inputData) throws AlgorithmExecutionException;
+ public Data[] wrapAlgorithm(
+ String pid,
+ CIShellContext callerCIShellContext,
+ Data[] inputData,
+ Dictionary<String, Object> parameters) throws AlgorithmExecutionException;
+
+ public ServiceReference createUniqueServiceReference(ServiceReference actualServiceReference);
+ public CIShellContext createUniqueCIShellContext(ServiceReference uniqueServiceReference);
+}
\ No newline at end of file
Copied: trunk/core/org.cishell.framework/src/org/cishell/service/algorithminvocation/FakeAlgorithmInvocationService.java (from rev 1194, trunk/core/org.cishell.framework/src/org/cishell/service/algorithminvocation/AlgorithmInvocationService.java)
===================================================================
--- trunk/core/org.cishell.framework/src/org/cishell/service/algorithminvocation/FakeAlgorithmInvocationService.java (rev 0)
+++ trunk/core/org.cishell.framework/src/org/cishell/service/algorithminvocation/FakeAlgorithmInvocationService.java 2011-02-11 13:26:16 UTC (rev 1203)
@@ -0,0 +1,126 @@
+
+/* TODO: When we have time, we should talk about the design of the Algorithm Invocation Service (if
+ * we even use that name in the end).
+ * It's somewhat apparent that there is a use for this service, but exactly how it fits into
+ * CIShell and all of the tools remains to be fully clarified.
+ * This is all commented out for now because the design/use need discussion.
+ */
+
+package org.cishell.service.algorithminvocation;
+
+import java.util.Dictionary;
+
+import org.cishell.framework.CIShellContext;
+import org.cishell.framework.algorithm.Algorithm;
+import org.cishell.framework.algorithm.AlgorithmCanceledException;
+import org.cishell.framework.algorithm.AlgorithmCreationCanceledException;
+import org.cishell.framework.algorithm.AlgorithmCreationFailedException;
+import org.cishell.framework.algorithm.AlgorithmExecutionException;
+import org.cishell.framework.algorithm.AlgorithmFactory;
+import org.cishell.framework.data.Data;
+
+/**
+ * Provides the caller with various ways of creating algorithms, executing them, and
+ * gathering/mutating parameters.
+ * When creating an algorithm (from a factory), if the factory implements ParameterMutator,
+ * mutateParameters() will be called on it.
+ * All methods can optionally operate on a new thread, which is determined by shouldUseNewThread.
+ */
+public interface FakeAlgorithmInvocationService {
+ /**
+ * Uses factory to create an algorithm, presenting the user with a GUI for parameters.
+ */
+ public Algorithm createAlgorithm(
+ final AlgorithmFactory factory,
+ final Data[] data,
+ final CIShellContext ciShellContext,
+ boolean shouldUseNewThread)
+ throws AlgorithmCreationCanceledException, AlgorithmCreationFailedException;
+
+ /**
+ * Uses factory to create an algorithm, using parameters (instead of presenting the user with a
+ * GUI for them).
+ */
+ public Algorithm createAlgorithm(
+ final AlgorithmFactory factory,
+ final Data[] data,
+ final Dictionary<String, Object> parameters,
+ final CIShellContext ciShellContext,
+ boolean shouldUseNewThread)
+ throws AlgorithmCreationCanceledException, AlgorithmCreationFailedException;
+
+ /**
+ * Invokes algorithm, returning the Data[] result of algorithm.execute().
+ * If logExceptionThrown is true, any exception thrown will be logged to the
+ * default LogService.
+ * If displayRuntimeException is true, the stack trace of any exception thrown will be
+ * displayed in an error message box.
+ */
+ public Data[] invokeAlgorithm(
+ final Algorithm algorithm,
+ final boolean logExceptionThrown,
+ final boolean displayRuntimeException,
+ boolean shouldUseNewThread)
+ throws AlgorithmCanceledException, AlgorithmExecutionException;
+
+ /**
+ * Invokes algorithm, assuming sensible defaults for inline algorithm execution (that is,
+ * not explicitly invoked from a menu/etc.), and return the Data[] result of
+ * algorithm.execute().
+ * Most likely wraps invokeAlgorithm().
+ */
+ public Data[] simpleInvokeAlgorithm(final Algorithm algorithm, Thread thread)
+ throws AlgorithmCanceledException, AlgorithmExecutionException;
+
+ /**
+ * Given factory, presents the user with a GUI for parameters to use for creating and executing
+ * an algorithm.
+ * Most likely wraps createAlgorithm() and invokeAlgorithm().
+ */
+ public Data[] createAndInvokeAlgorithm(
+ final AlgorithmFactory factory,
+ final Data[] data,
+ final CIShellContext ciShellContext,
+ final boolean logExceptionThrown,
+ final boolean displayRuntimeException,
+ boolean shouldUseNewThread) throws
+ AlgorithmCreationCanceledException,
+ AlgorithmCreationFailedException,
+ AlgorithmCanceledException,
+ AlgorithmExecutionException;
+
+ /**
+ * Given factory, uses parameters to create and execute an algorithm.
+ * Most likely wraps createAlgorithm() and invokeAlgorithm().
+ */
+ public Data[] createAndInvokeAlgorithm(
+ final AlgorithmFactory factory,
+ final Data[] data,
+ final Dictionary<String, Object> parameters,
+ final CIShellContext ciShellContext,
+ final boolean logExceptionThrown,
+ final boolean displayRuntimeException,
+ boolean shouldUseNewThread) throws
+ AlgorithmCreationCanceledException,
+ AlgorithmCreationFailedException,
+ AlgorithmCanceledException,
+ AlgorithmExecutionException;
+
+ /**
+ * Given factory, uses parameters to create and execute an algorithm.
+ * Sensible defaults for inline algorithm execution (that is, not explicitly invoked from a
+ * menu/etc.) are used.
+ * Returns the Data[] result of algorithm.execute().
+ * Most likely wraps createAlgorithm() and simpleInvokeAlgorithm().
+ */
+ public Data[] simpleCreateAndInvokeAlgorithm(
+ final AlgorithmFactory factory,
+ final Data[] data,
+ final Dictionary<String, Object> parameters,
+ CIShellContext ciShellContext,
+ boolean shouldUseNewThread) throws
+ AlgorithmCreationCanceledException,
+ AlgorithmCreationFailedException,
+ AlgorithmCanceledException,
+ AlgorithmExecutionException;
+}
\ No newline at end of file
Property changes on: trunk/core/org.cishell.framework/src/org/cishell/service/algorithminvocation/FakeAlgorithmInvocationService.java
___________________________________________________________________
Added: svn:mergeinfo
+
Modified: trunk/core/org.cishell.reference/META-INF/MANIFEST.MF
===================================================================
--- trunk/core/org.cishell.reference/META-INF/MANIFEST.MF 2011-02-09 18:22:52 UTC (rev 1202)
+++ trunk/core/org.cishell.reference/META-INF/MANIFEST.MF 2011-02-11 13:26:16 UTC (rev 1203)
@@ -9,6 +9,7 @@
org.cishell.framework.algorithm;version="1.0.0",
org.cishell.framework.data;version="1.0.0",
org.cishell.reference.gui.common,
+ org.cishell.service.algorithminvocation,
org.cishell.service.conversion;version="1.0.0",
org.cishell.service.guibuilder;version="1.0.0",
org.osgi.framework,
Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/algorithminvocation/AlgorithmInvocationServiceImpl.java
===================================================================
--- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/algorithminvocation/AlgorithmInvocationServiceImpl.java 2011-02-09 18:22:52 UTC (rev 1202)
+++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/algorithminvocation/AlgorithmInvocationServiceImpl.java 2011-02-11 13:26:16 UTC (rev 1203)
@@ -1,85 +1,35 @@
-//package org.cishell.reference.app.service.algorithminvocation;
-//
-//import java.util.Dictionary;
-//import java.util.Hashtable;
-//
-//import org.cishell.framework.CIShellContext;
-//import org.cishell.framework.algorithm.Algorithm;
-//import org.cishell.framework.algorithm.AlgorithmCreationCanceledException;
-//import org.cishell.framework.algorithm.AlgorithmCreationFailedException;
-//import org.cishell.framework.algorithm.AlgorithmFactory;
-//import org.cishell.framework.data.Data;
-//import org.cishell.service.algorithminvocation.AlgorithmInvocationService;
-//import org.osgi.service.log.LogService;
-//
-//public class AlgorithmInvocationServiceImpl implements AlgorithmInvocationService {
-// private LogService logger;
-//
-// public AlgorithmInvocationServiceImpl(LogService logger) {
-// this.logger = logger;
-// }
-//
-// @SuppressWarnings("unchecked")
-// public Algorithm createAlgorithm(
-// final AlgorithmFactory factory,
-// final Data[] data,
-// final CIShellContext ciShellContext,
-// boolean shouldUseNewThread)
-// throws AlgorithmCreationCanceledException, AlgorithmCreationFailedException {
-// /* TODO: Refactor org.cishell.utilities into several plugins so there are no
-// * circular dependencies!
-// */
-//
-// final AlgorithmCreationCanceledException[] canceledException =
-// new AlgorithmCreationCanceledException[1];
-// final AlgorithmCreationFailedException[] failedException =
-// new AlgorithmCreationFailedException[1];
-// final Algorithm[] algorithm = new Algorithm[1];
-//
-// Runnable operator = new Runnable() {
-// public void run() {
-// /* TODO: Refactor algorithm creation code out of
-// * org.cishell.reference.gui.menumanager, and call it here.
-// */
-//
-// try {
-// // TODO: readFromMetadataFile
-// Dictionary<String, Object> parameters = new Hashtable<String, Object>();
-// // TODO: mutateParameters
-// Dictionary<String, Object> mutatedParameters = parameters;
-// // TODO: Invoke GUI builder service, getting user-entered parameters.
-// Dictionary<String, Object> userEnteredParameters = mutatedParameters;
-//
-// algorithm[0] =
-// factory.createAlgorithm(data, userEnteredParameters, ciShellContext);
-// } catch (AlgorithmCreationCanceledException e) {
-// canceledException[0] = e;
-// } catch (AlgorithmCreationFailedException e) {
-// failedException[0] = e;
-// }
-// }
-// };
-//
-// if (shouldUseNewThread) {
-// new Thread(operator).start();
-// } else {
-// operator.run();
-// }
-//
-// return algorithm[0];
-// }
-//
-// public Algorithm createAlgorithm(
-// final AlgorithmFactory factory,
-// final Data[] data,
-// final Dictionary<String, Object> parameters,
-// final CIShellContext ciShellContext,
-// boolean shouldUseNewThread)
-// throws AlgorithmCreationCanceledException, AlgorithmCreationFailedException {
-// final AlgorithmCreationCanceledException[] canceledException =
-// new AlgorithmCreationCanceledException[1];
-// final AlgorithmCreationFailedException[] failedException =
-// new AlgorithmCreationFailedException[1];
-//
-// }
-//}
\ No newline at end of file
+package org.cishell.reference.app.service.algorithminvocation;
+
+import java.util.Dictionary;
+
+import org.cishell.framework.CIShellContext;
+import org.cishell.framework.algorithm.AlgorithmExecutionException;
+import org.cishell.framework.data.Data;
+import org.cishell.service.algorithminvocation.AlgorithmInvocationService;
+import org.osgi.framework.ServiceReference;
+
+public class AlgorithmInvocationServiceImpl implements AlgorithmInvocationService {
+ public Data[] runAlgorithm(String pid, Data[] inputData) throws AlgorithmExecutionException {
+ // TODO: AlgorithmWrapper, etc.
+ return null;
+ }
+
+ public Data[] wrapAlgorithm(
+ String pid,
+ CIShellContext callerCIShellContext,
+ Data[] inputData,
+ Dictionary<String, Object> parameters) throws AlgorithmExecutionException {
+ // TODO: Get the algorithm, call it, etc.
+ return null;
+ }
+
+ public ServiceReference createUniqueServiceReference(ServiceReference actualServiceReference) {
+ // TODO
+ return null;
+ }
+
+ public CIShellContext createUniqueCIShellContext(ServiceReference uniqueServiceReference) {
+ // TODO:
+ return null;
+ }
+}
\ No newline at end of file
Copied: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/algorithminvocation/FakeAlgorithmInvocationServiceImpl.java (from rev 1191, trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/algorithminvocation/AlgorithmInvocationServiceImpl.java)
===================================================================
--- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/algorithminvocation/FakeAlgorithmInvocationServiceImpl.java (rev 0)
+++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/algorithminvocation/FakeAlgorithmInvocationServiceImpl.java 2011-02-11 13:26:16 UTC (rev 1203)
@@ -0,0 +1,86 @@
+package org.cishell.reference.app.service.algorithminvocation;
+//package org.cishell.reference.app.service.algorithminvocation;
+//
+//import java.util.Dictionary;
+//import java.util.Hashtable;
+//
+//import org.cishell.framework.CIShellContext;
+//import org.cishell.framework.algorithm.Algorithm;
+//import org.cishell.framework.algorithm.AlgorithmCreationCanceledException;
+//import org.cishell.framework.algorithm.AlgorithmCreationFailedException;
+//import org.cishell.framework.algorithm.AlgorithmFactory;
+//import org.cishell.framework.data.Data;
+//import org.cishell.service.algorithminvocation.FakeAlgorithmInvocationService;
+//import org.osgi.service.log.LogService;
+//
+//public class AlgorithmInvocationServiceImpl implements FakeAlgorithmInvocationService {
+// private LogService logger;
+//
+// public AlgorithmInvocationServiceImpl(LogService logger) {
+// this.logger = logger;
+// }
+//
+// @SuppressWarnings("unchecked")
+// public Algorithm createAlgorithm(
+// final AlgorithmFactory factory,
+// final Data[] data,
+// final CIShellContext ciShellContext,
+// boolean shouldUseNewThread)
+// throws AlgorithmCreationCanceledException, AlgorithmCreationFailedException {
+// /* TODO: Refactor org.cishell.utilities into several plugins so there are no
+// * circular dependencies!
+// */
+//
+// final AlgorithmCreationCanceledException[] canceledException =
+// new AlgorithmCreationCanceledException[1];
+// final AlgorithmCreationFailedException[] failedException =
+// new AlgorithmCreationFailedException[1];
+// final Algorithm[] algorithm = new Algorithm[1];
+//
+// Runnable operator = new Runnable() {
+// public void run() {
+// /* TODO: Refactor algorithm creation code out of
+// * org.cishell.reference.gui.menumanager, and call it here.
+// */
+//
+// try {
+// // TODO: readFromMetadataFile
+// Dictionary<String, Object> parameters = new Hashtable<String, Object>();
+// // TODO: mutateParameters
+// Dictionary<String, Object> mutatedParameters = parameters;
+// // TODO: Invoke GUI builder service, getting user-entered parameters.
+// Dictionary<String, Object> userEnteredParameters = mutatedParameters;
+//
+// algorithm[0] =
+// factory.createAlgorithm(data, userEnteredParameters, ciShellContext);
+// } catch (AlgorithmCreationCanceledException e) {
+// canceledException[0] = e;
+// } catch (AlgorithmCreationFailedException e) {
+// failedException[0] = e;
+// }
+// }
+// };
+//
+// if (shouldUseNewThread) {
+// new Thread(operator).start();
+// } else {
+// operator.run();
+// }
+//
+// return algorithm[0];
+// }
+//
+// public Algorithm createAlgorithm(
+// final AlgorithmFactory factory,
+// final Data[] data,
+// final Dictionary<String, Object> parameters,
+// final CIShellContext ciShellContext,
+// boolean shouldUseNewThread)
+// throws AlgorithmCreationCanceledException, AlgorithmCreationFailedException {
+// final AlgorithmCreationCanceledException[] canceledException =
+// new AlgorithmCreationCanceledException[1];
+// final AlgorithmCreationFailedException[] failedException =
+// new AlgorithmCreationFailedException[1];
+//
+// }
+//}
\ No newline at end of file
Property changes on: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/algorithminvocation/FakeAlgorithmInvocationServiceImpl.java
___________________________________________________________________
Added: svn:mergeinfo
+
Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/datamanager/DataManagerServiceImpl.java
===================================================================
--- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/datamanager/DataManagerServiceImpl.java 2011-02-09 18:22:52 UTC (rev 1202)
+++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/datamanager/DataManagerServiceImpl.java 2011-02-11 13:26:16 UTC (rev 1203)
@@ -16,7 +16,6 @@
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -27,85 +26,76 @@
public class DataManagerServiceImpl implements DataManagerService {
- private Map modelToLabelMap;
- private Map labelToModelMap;
- private Map labelToNumOccurrences;
- private Set models;
- private Set selectedModels;
-
- private Set listeners;
-
- /**
- * Creates a new BasicModelManager Object.
- */
- public DataManagerServiceImpl() {
- modelToLabelMap = new HashMap();
- labelToModelMap = new HashMap();
- labelToNumOccurrences = new HashMap();
- models = new HashSet();
- listeners = new HashSet();
- }
+ private Map<Data, String> datumToLabel = new HashMap<Data, String>();
+ private Map<String, Data> labelToDatum = new HashMap<String, Data>();
+ private Map<String, Integer> labelToOccurrenceCount = new HashMap<String, Integer>();
+ private Set<Data> data = new HashSet<Data>();
+ private Set<Data> selectedData = new HashSet<Data>();
+ private Set<DataManagerListener> listeners = new HashSet<DataManagerListener>();
- /**
- * @see edu.iu.iv.core.ModelManager#addData(java.lang.Object)
- */
- public void addData(Data model) {
- if(model == null){
+ public void addData(Data datum) {
+ if (datum == null) {
return;
}
- String label = (String)model.getMetadata().get(DataProperty.LABEL);
- String type = (String)model.getMetadata().get(DataProperty.TYPE);
+
+ String label = (String) datum.getMetadata().get(DataProperty.LABEL);
+ String type = (String) datum.getMetadata().get(DataProperty.TYPE);
- if(type == null){
+ if (type == null) {
type = DataProperty.OTHER_TYPE;
- model.getMetadata().put(DataProperty.TYPE, type);
+ datum.getMetadata().put(DataProperty.TYPE, type);
}
- //generate label if needed
- if(label == null || label.equals("")){
- StackTraceElement[] stack = new Throwable().getStackTrace();
-
- if (stack.length > 2) {
- String className = stack[2].getClassName();
- int lastDot = className.lastIndexOf(".");
-
- if (className.length() > lastDot) {
- lastDot++;
- className = className.substring(lastDot);
-
- if (className.endsWith("Algorithm")) {
- className = className.substring(0,className.lastIndexOf("Algorithm"));
- }
-
- if (className.endsWith("Factory")) {
- className = className.substring(0,className.lastIndexOf("Factory"));
- }
- }
- label = className;
- } else {
- label = "Unknown";
- }
-
- label = label + "." + type;
+ // Generate label if needed.
+ if ((label == null) || "".equals(label)) {
+ label = generateDefaultLabel(type);
}
- addModel(model, label);
-
- for (Iterator iter=listeners.iterator(); iter.hasNext();) {
- ((DataManagerListener) iter.next()).dataAdded(model, label);
+ addModel(datum, label);
+
+ for (DataManagerListener listener : this.listeners) {
+ listener.dataAdded(datum, label);
}
}
- private void addModel(Data model, String label) {
+ private void addModel(Data datum, String label) {
label = findUniqueLabel(label);
- model.getMetadata().put(DataProperty.LABEL, label);
- //set the model to be unsaved initially
- model.getMetadata().put(DataProperty.MODIFIED, new Boolean(true));
+ datum.getMetadata().put(DataProperty.LABEL, label);
+ // Set the model to be unsaved initially.
+ datum.getMetadata().put(DataProperty.MODIFIED, new Boolean(true));
- modelToLabelMap.put(model, label);
- labelToModelMap.put(label, model);
- models.add(model);
+ this.datumToLabel.put(datum, label);
+ this.labelToDatum.put(label, datum);
+ this.data.add(datum);
}
+
+ private String generateDefaultLabel(String dataType) {
+ String label;
+ StackTraceElement[] stack = new Throwable().getStackTrace();
+
+ if (stack.length > 2) {
+ String className = stack[2].getClassName();
+ int lastDot = className.lastIndexOf(".");
+
+ if (className.length() > lastDot) {
+ lastDot++;
+ className = className.substring(lastDot);
+
+ if (className.endsWith("Algorithm")) {
+ className = className.substring(0,className.lastIndexOf("Algorithm"));
+ }
+
+ if (className.endsWith("Factory")) {
+ className = className.substring(0,className.lastIndexOf("Factory"));
+ }
+ }
+ label = className;
+ } else {
+ label = "Unknown";
+ }
+
+ return String.format("%s.%s", label, dataType);
+ }
/**
* Ensures that the label is unique by comparing it to the labels
@@ -117,16 +107,17 @@
*/
private String findUniqueLabel(String label) {
- Integer numOccurences = (Integer) labelToNumOccurrences.get(label);
+ Integer occurenceCount = this.labelToOccurrenceCount.get(label);
- if (numOccurences == null) {
+ if (occurenceCount == null) {
//the label is unique
- labelToNumOccurrences.put(label, new Integer(1));
+ this.labelToOccurrenceCount.put(label, new Integer(1));
+
return label;
} else {
- //the label is not unique
- int numOccurrencesVal = numOccurences.intValue();
+ // The label is not unique.
+ int numOccurrencesVal = occurenceCount.intValue();
int newNumOccurrencesVal = numOccurrencesVal + 1;
@@ -146,8 +137,7 @@
/*
* remember how many occurrences of the original label we have.
*/
- labelToNumOccurrences.put(label,
- new Integer(newNumOccurrencesVal));
+ this.labelToOccurrenceCount.put(label, new Integer(newNumOccurrencesVal));
/*
* also, remember that we now have a new label which might be
@@ -159,7 +149,7 @@
* of whatever.xml). Maybe not the best way to do this, but
* it makes sense.
*/
- labelToNumOccurrences.put(newLabel, new Integer(1));
+ this.labelToOccurrenceCount.put(newLabel, new Integer(1));
return newLabel;
}
@@ -206,69 +196,65 @@
}
- public void removeData(Data model) {
- String label = getLabel(model);
+ public void removeData(Data datum) {
+ String label = getLabel(datum);
- labelToModelMap.remove(label);
- modelToLabelMap.remove(model);
- labelToNumOccurrences.remove(label);
- models.remove(model);
-
- for (Iterator iter=listeners.iterator(); iter.hasNext();) {
- ((DataManagerListener) iter.next()).dataRemoved(model);
+ this.labelToDatum.remove(label);
+ this.datumToLabel.remove(datum);
+ this.labelToOccurrenceCount.remove(label);
+ this.data.remove(datum);
+
+ for (DataManagerListener listener : this.listeners) {
+ listener.dataRemoved(datum);
}
}
public Data[] getSelectedData() {
- if (selectedModels == null) {
- selectedModels = new HashSet();
- }
-
- return (Data[]) selectedModels.toArray(new Data[]{});
+ return this.selectedData.toArray(new Data[0]);
}
- public void setSelectedData(Data[] inModels) {
- selectedModels = new HashSet(Arrays.asList(inModels));
+ public void setSelectedData(Data[] data) {
+ this.selectedData.clear();
+ this.selectedData.addAll(Arrays.asList(data));
- for (int i=0; i < inModels.length; i++) {
- if (!this.models.contains(inModels[i])) {
- addData(inModels[i]);
+ for (int ii = 0; ii < data.length; ii++) {
+ if (!this.data.contains(data[ii])) {
+ addData(data[ii]);
}
}
-
- for (Iterator iter=listeners.iterator(); iter.hasNext();) {
- ((DataManagerListener) iter.next()).dataSelected(inModels);
+
+ for (DataManagerListener listener : this.listeners) {
+ listener.dataSelected(data);
}
}
- private Data getModelForLabel(String label){
- return (Data)labelToModelMap.get(label);
+ private Data getModelForLabel(String label) {
+ return this.labelToDatum.get(label);
}
- public String getLabel(Data model){
- return (String)modelToLabelMap.get(model);
+ public String getLabel(Data datum) {
+ return this.datumToLabel.get(datum);
}
- public synchronized void setLabel(Data model, String label) {
- label = findUniqueLabel(label);
-
- modelToLabelMap.put(model, label);
- labelToModelMap.put(label, model);
-
- for (Iterator iter=listeners.iterator(); iter.hasNext();) {
- ((DataManagerListener) iter.next()).dataLabelChanged(model, label);
+ public synchronized void setLabel(Data datum, String label) {
+ String uniqueLabel = findUniqueLabel(label);
+ this.datumToLabel.put(datum, uniqueLabel);
+ this.labelToDatum.put(uniqueLabel, datum);
+
+ for (DataManagerListener listener : this.listeners) {
+ listener.dataLabelChanged(datum, label);
}
}
public Data[] getAllData() {
- return (Data[]) models.toArray(new Data[]{});
+ return this.data.toArray(new Data[0]);
}
public void addDataManagerListener(DataManagerListener listener) {
- listeners.add(listener);
+ this.listeners.add(listener);
}
public void removeDataManagerListener(DataManagerListener listener) {
- listeners.remove(listener);
+ this.listeners.remove(listener);
}
}
Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileLoaderServiceImpl.java
===================================================================
--- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileLoaderServiceImpl.java 2011-02-09 18:22:52 UTC (rev 1202)
+++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/FileLoaderServiceImpl.java 2011-02-11 13:26:16 UTC (rev 1203)
@@ -20,6 +20,8 @@
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
import org.osgi.service.cm.ConfigurationException;
import org.osgi.service.cm.ManagedService;
import org.osgi.service.log.LogService;
@@ -89,6 +91,62 @@
bundleContext, ciShellContext, logger, progressMonitor, new File[] { file });
}
+ public Data[] loadFileOfType(
+ BundleContext bundleContext,
+ CIShellContext ciShellContext,
+ LogService logger,
+ ProgressMonitor progressMonitor,
+ File file,
+ String fileExtension,
+ String mimeType) throws FileLoadException {
+ try {
+ String format =
+ "(& " +
+ "(type=validator)" +
+ "(| (in_data=file-ext:%1$s) (also_validates=%1$s))" +
+ "(out_data=%2$s))";
+ String validatorsQuery = String.format(format, fileExtension, mimeType);
+ ServiceReference[] supportingValidators = bundleContext.getAllServiceReferences(
+ AlgorithmFactory.class.getName(), validatorsQuery);
+
+ if (supportingValidators == null) {
+ throw new FileLoadException(String.format(
+ "The file %s cannot be loaded as type %s.", file.getName(), mimeType));
+ } else {
+ AlgorithmFactory validator =
+ (AlgorithmFactory) bundleContext.getService(supportingValidators[0]);
+
+ return loadFileOfType(
+ bundleContext, ciShellContext, logger, progressMonitor, file, validator);
+ }
+ } catch (InvalidSyntaxException e) {
+ e.printStackTrace();
+
+ throw new FileLoadException(e.getMessage(), e);
+ }
+ }
+
+ public Data[] loadFileOfType(
+ BundleContext bundleContext,
+ CIShellContext ciShellContext,
+ LogService logger,
+ ProgressMonitor progressMonitor,
+ File file,
+ AlgorithmFactory validator) throws FileLoadException {
+ try {
+ Data[] loadedFileData = loadFileInternal(
+ bundleContext, ciShellContext, logger, progressMonitor, file, validator);
+
+ for (FileLoadListener listener : this.listeners) {
+ listener.fileLoaded(file);
+ }
+
+ return loadedFileData;
+ } catch (AlgorithmExecutionException e) {
+ throw new FileLoadException(e.getMessage(), e);
+ }
+ }
+
public void updated(Dictionary preferences) throws ConfigurationException {
if (preferences != null) {
this.preferences = preferences;
@@ -123,15 +181,26 @@
for (File file : files) {
try {
- Data[] validatedFileData = validateFile(
+ AlgorithmFactory validator =
+ getValidatorFromUser(bundleContext, window, display, file);
+
+// Data[] validatedFileData = validateFile(
+// bundleContext,
+// ciShellContext,
+// logger,
+// progressMonitor,
+// window,
+// display,
+// file,
+// validator);
+// Data[] labeledFileData = labelFileData(file, validatedFileData);
+ Data[] labeledFileData = loadFileInternal(
bundleContext,
ciShellContext,
logger,
progressMonitor,
- window,
- display,
- file);
- Data[] labeledFileData = labelFileData(file, validatedFileData);
+ file,
+ validator);
for (Data data : labeledFileData) {
finalLabeledFileData.add(data);
@@ -152,6 +221,29 @@
}
}
+ private Data[] loadFileInternal(
+ BundleContext bundleContext,
+ CIShellContext ciShellContext,
+ LogService logger,
+ ProgressMonitor progressMonitor,
+ File file,
+ AlgorithmFactory validator) throws AlgorithmExecutionException, FileLoadException {
+ IWorkbenchWindow window = getFirstWorkbenchWindow();
+ Display display = PlatformUI.getWorkbench().getDisplay();
+ Data[] validatedFileData = validateFile(
+ bundleContext,
+ ciShellContext,
+ logger,
+ progressMonitor,
+ window,
+ display,
+ file,
+ validator);
+ Data[] labeledFileData = labelFileData(file, validatedFileData);
+
+ return labeledFileData;
+ }
+
private IWorkbenchWindow getFirstWorkbenchWindow() throws FileLoadException {
final IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
@@ -182,15 +274,18 @@
ProgressMonitor progressMonitor,
IWorkbenchWindow window,
Display display,
- File file) throws AlgorithmExecutionException {
- AlgorithmFactory validator = null;
- validator = getValidatorFromUser(bundleContext, window, display, file);
-
+ File file,
+ AlgorithmFactory validator) throws AlgorithmExecutionException {
if ((file == null) || (validator == null)) {
String logMessage = "File loading canceled";
logger.log(LogService.LOG_WARNING, logMessage);
} else {
try {
+ System.err.println("file: " + file);
+ System.err.println("validator: " + validator);
+ System.err.println("progressMonitor: " + progressMonitor);
+ System.err.println("ciShellContext: " + ciShellContext);
+ System.err.println("logger: " + logger);
return FileValidator.validateFile(
file, validator, progressMonitor, ciShellContext, logger);
} catch (AlgorithmExecutionException e) {
Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/PrettyLabeler.java
===================================================================
--- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/PrettyLabeler.java 2011-02-09 18:22:52 UTC (rev 1202)
+++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/PrettyLabeler.java 2011-02-11 13:26:16 UTC (rev 1203)
@@ -73,11 +73,17 @@
for (Data datum : data) {
Dictionary<String, Object> labeledDatumMetadata = datum.getMetadata();
- Data dataParent = getParent(labeledDatumMetadata);
- if (!possibleParents.contains(dataParent)) {
- labeledDatumMetadata.put(DataProperty.LABEL, prefix + absoluteFile.getName());
+ Object labelObject = labeledDatumMetadata.get(DataProperty.LABEL);
+
+ if ((labelObject == null) || ("".equals(labelObject.toString()))) {
+ Data dataParent = getParent(labeledDatumMetadata);
+
+ if (!possibleParents.contains(dataParent)) {
+ labeledDatumMetadata.put(DataProperty.LABEL, prefix + absoluteFile.getName());
+ }
+
+ possibleParents.add(datum);
}
- possibleParents.add(datum);
}
return data;
Modified: trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/ValidatorSelectorRunnable.java
===================================================================
--- trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/ValidatorSelectorRunnable.java 2011-02-09 18:22:52 UTC (rev 1202)
+++ trunk/core/org.cishell.reference/src/org/cishell/reference/app/service/fileloader/ValidatorSelectorRunnable.java 2011-02-11 13:26:16 UTC (rev 1203)
@@ -13,38 +13,40 @@
private BundleContext bundleContext;
private File file;
- private AlgorithmFactory validator;
+ private AlgorithmFactory chosenValidator;
public ValidatorSelectorRunnable(
IWorkbenchWindow window, BundleContext bundleContext, File file) {
this.window = window;
this.bundleContext = bundleContext;
this.file = file;
+
}
public AlgorithmFactory getValidator() {
- return this.validator;
+ return this.chosenValidator;
}
public void run() {
String fileExtension =
getFileExtension(this.file.getAbsolutePath()).toLowerCase().substring(1);
- ServiceReference[] supportingValidators = getSupportingValidators(fileExtension);
+ ServiceReference[] supportingValidators =
+ getSupportingValidators(this.bundleContext, fileExtension);
// If there are no supporting validators...
if (supportingValidators.length == 0) {
// Let the user choose from all the validators available.
- ServiceReference[] allValidators = getAllValidators();
+ ServiceReference[] allValidators = getAllValidators(this.bundleContext);
FileFormatSelector validatorSelector = new FileFormatSelector(
"Load", window.getShell(), this.bundleContext, allValidators, this.file);
validatorSelector.open();
- this.validator = validatorSelector.getValidator();
+ this.chosenValidator = validatorSelector.getValidator();
} else if (supportingValidators.length == 1) {
ServiceReference onlyPossibleValidator = supportingValidators[0];
- this.validator =
+ this.chosenValidator =
(AlgorithmFactory)this.bundleContext.getService(onlyPossibleValidator);
}
@@ -52,49 +54,50 @@
FileFormatSelector validatorSelector = new FileFormatSelector(
"Load", window.getShell(), this.bundleContext, supportingValidators, this.file);
validatorSelector.open();
- this.validator = validatorSelector.getValidator();
+ this.chosenValidator = validatorSelector.getValidator();
}
}
- private ServiceReference[] getSupportingValidators(String fileExtension) {
+ public static ServiceReference[] getAllValidators(BundleContext bundleContext) {
try {
- String validatorsQuery =
- "(& (type=validator)" +
- "(|" +
- "(in_data=file-ext:" + fileExtension + ")" +
- "(also_validates=" + fileExtension + ")" +
- "))";
-
- ServiceReference[] supportingValidators = this.bundleContext.getAllServiceReferences(
+ String validatorsQuery = "(&(type=validator)(in_data=file-ext:*))";
+ ServiceReference[] allValidators = bundleContext.getAllServiceReferences(
AlgorithmFactory.class.getName(), validatorsQuery);
- if (supportingValidators == null) {
+ if (allValidators == null) {
return new ServiceReference[0];
} else {
- return supportingValidators;
+ return allValidators;
}
} catch (InvalidSyntaxException e) {
e.printStackTrace();
- return new ServiceReference[]{};
+ return new ServiceReference[0];
}
}
- private ServiceReference[] getAllValidators() {
+ public static ServiceReference[] getSupportingValidators(
+ BundleContext bundleContext, String fileExtension) {
try {
- String validatorsQuery = "(&(type=validator)(in_data=file-ext:*))";
- ServiceReference[] allValidators = this.bundleContext.getAllServiceReferences(
+ String validatorsQuery =
+ "(& (type=validator)" +
+ "(|" +
+ "(in_data=file-ext:" + fileExtension + ")" +
+ "(also_validates=" + fileExtension + ")" +
+ "))";
+
+ ServiceReference[] supportingValidators = bundleContext.getAllServiceReferences(
AlgorithmFactory.class.getName(), validatorsQuery);
- if (allValidators == null) {
+ if (supportingValidators == null) {
return new ServiceReference[0];
} else {
- return allValidators;
+ return supportingValidators;
}
} catch (InvalidSyntaxException e) {
e.printStackTrace();
- return new ServiceReference[0];
+ return new ServiceReference[]{};
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|