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: <hu...@us...> - 2007-05-17 20:29:30
|
Revision: 404 http://svn.sourceforge.net/cishell/?rev=404&view=rev Author: huangb Date: 2007-05-17 13:29:22 -0700 (Thu, 17 May 2007) Log Message: ----------- Added Paths: ----------- tags/0.5.0/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-05-17 18:50:20
|
Revision: 403 http://svn.sourceforge.net/cishell/?rev=403&view=rev Author: huangb Date: 2007-05-17 11:50:19 -0700 (Thu, 17 May 2007) Log Message: ----------- Update the Bundle-Version to 0.5.0 Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.log/META-INF/MANIFEST.MF trunk/clients/gui/org.cishell.reference.gui.menumanager/META-INF/MANIFEST.MF trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF trunk/clients/gui/org.cishell.reference.gui.workspace/META-INF/MANIFEST.MF 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 2007-05-17 18:49:45 UTC (rev 402) +++ trunk/clients/gui/org.cishell.reference.gui.log/META-INF/MANIFEST.MF 2007-05-17 18:50:19 UTC (rev 403) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Log GUI Plug-in Bundle-SymbolicName: org.cishell.reference.gui.log;singleton:=true -Bundle-Version: 0.3.0 +Bundle-Version: 0.5.0 Bundle-Activator: org.cishell.reference.gui.log.Activator Bundle-Localization: plugin Require-Bundle: org.eclipse.ui, Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/META-INF/MANIFEST.MF =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/META-INF/MANIFEST.MF 2007-05-17 18:49:45 UTC (rev 402) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/META-INF/MANIFEST.MF 2007-05-17 18:50:19 UTC (rev 403) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Menu Manager Plug-in Bundle-SymbolicName: org.cishell.reference.gui.menumanager;singleton:=true -Bundle-Version: 0.4.0 +Bundle-Version: 0.5.0 Bundle-Activator: org.cishell.reference.gui.menumanager.Activator Bundle-Localization: plugin Require-Bundle: org.eclipse.ui, 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 2007-05-17 18:49:45 UTC (rev 402) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF 2007-05-17 18:50:19 UTC (rev 403) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Persistence Plug-in Bundle-SymbolicName: org.cishell.reference.gui.persistence;singleton:=true -Bundle-Version: 0.3.0 +Bundle-Version: 0.5.0 Bundle-ClassPath: . Bundle-Localization: plugin Import-Package: org.cishell.app.service.datamanager, 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 2007-05-17 18:49:45 UTC (rev 402) +++ trunk/clients/gui/org.cishell.reference.gui.workspace/META-INF/MANIFEST.MF 2007-05-17 18:50:19 UTC (rev 403) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: CIShell Reference GUI Workspace Plug-in Bundle-SymbolicName: org.cishell.reference.gui.workspace; singleton:=true -Bundle-Version: 0.3.0 +Bundle-Version: 0.5.0 Bundle-Activator: org.cishell.reference.gui.workspace.Activator Bundle-Localization: plugin Require-Bundle: org.eclipse.ui, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-05-17 18:49:51
|
Revision: 402 http://svn.sourceforge.net/cishell/?rev=402&view=rev Author: huangb Date: 2007-05-17 11:49:45 -0700 (Thu, 17 May 2007) Log Message: ----------- Update the Bundle-Version to 0.5.0 Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF Modified: trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF 2007-05-15 14:19:12 UTC (rev 401) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/META-INF/MANIFEST.MF 2007-05-17 18:49:45 UTC (rev 402) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Data Manager GUI Plug-in Bundle-SymbolicName: org.cishell.reference.gui.datamanager;singleton:=true -Bundle-Version: 0.3.0 +Bundle-Version: 0.5.0 Bundle-Activator: org.cishell.reference.gui.datamanager.Activator Bundle-Localization: plugin Require-Bundle: org.eclipse.ui, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 401 http://svn.sourceforge.net/cishell/?rev=401&view=rev Author: terkhorn Date: 2007-05-15 07:19:12 -0700 (Tue, 15 May 2007) Log Message: ----------- Changed name display of available viewers. Should show something like "Text Document" instead of "TXT" now... Also only useable, available programs are listed now Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWithFactory.java Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWithFactory.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWithFactory.java 2007-05-14 20:46:51 UTC (rev 400) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWithFactory.java 2007-05-15 14:19:12 UTC (rev 401) @@ -31,16 +31,11 @@ Program programDoc; Program programHtml; private MetaTypeProvider provider; -// private MetaTypeInformation originalProvider; // taken from PrefuseBetaAlgorithmFactory -// private String pid; // taken from PrefuseBetaAlgFactory protected void activate(ComponentContext ctxt) { //You may delete all references to metatype service if //your algorithm does not require parameters and return //null in the createParameters() method - //MetaTypeService mts = (MetaTypeService)ctxt.locateService("MTS"); - //provider = mts.getMetaTypeInformation(ctxt.getBundleContext().getBundle()); - // bruce says these should be commented out... } protected void deactivate(ComponentContext ctxt) { provider = null; @@ -50,41 +45,11 @@ return new FileViewWith(data, parameters, context); } - - private String[] createKeyArray() { - String[] keys = new String[1]; - keys[0] = "Viewer"; - /* - for(int ii = 1; ii <= schema.getColumnCount(); ii++) { - keys[ii] = schema.getColumnName(ii - 1); - System.out.println("keys["+ii+"] = " + schema.getColumnName(ii - 1) + "; "); - } - */ - - return keys; - } - public MetaTypeProvider createParameters(Data[] data) { - //ObjectClassDefinition oldDefinition = provider.getObjectClassDefinition(this.pid, null); - // read the API for creating on ObjectClassDefinition - // and create a basic one ... - // BasicObjectClassDefinition oldDefinition = new ObjectClassDefinition(); BasicObjectClassDefinition definition; - //try { - definition = new BasicObjectClassDefinition("fileViewWithDefinition", "Application viewer type", "Please choose an application viewer to read this file.\nThe application associated with the chosen extension will be called.", null); - //} catch (IOException e) { - //definition = new BasicObjectClassDefinition("fileViewWithDef", "fileViewWithName", "This is an OCD for fileViewWith", null); - //} - -// String[] dialogAttributesArray = createKeyArray(); - - - Display display; - - - display = PlatformUI.getWorkbench().getDisplay(); - + definition = new BasicObjectClassDefinition("fileViewWithDefinition", "Application viewer type", "Please choose an application viewer to read this file.", null); + Display.getDefault().syncExec(new Runnable() { public void run() { programTxt = Program.findProgram("txt"); @@ -98,28 +63,46 @@ Display.getDefault().syncExec(new Runnable() { public void run() { programHtml = Program.findProgram("htm"); + }}); System.err.println(definition.getID()); String[] defValStringArray = null; //doesn't actually work yet... - String[] myOptionLabels = new String[] {"TXT","DOC","HTML"}; - String[] myOptionValues = new String[] {"txt","doc","html"}; + //String[] myOptionLabels = new String[] {programTxt.getName(),programDoc.getName(),programHtml.getName()}; + //String[] myOptionValues = new String[] {"txt","doc","html"}; - if (programTxt == null) { - myOptionLabels[0] = ""; + int possiblePrograms = 0; + int counter = 0; + if (programTxt != null) { + possiblePrograms++; } - if (programDoc == null) { - myOptionLabels[1] = ""; + if (programDoc != null) { + possiblePrograms++; } - if (programHtml == null) { - myOptionLabels[2] = ""; + if (programHtml != null) { + possiblePrograms++; } - AttributeDefinition ad = new BasicAttributeDefinition("viewWith", "View file as", "Type of viewer", AttributeDefinition.STRING /*string*/, 0, defValStringArray/*String[] defaultValue*/, null /*validator*/, myOptionLabels, myOptionValues); - definition.addAttributeDefinition(ObjectClassDefinition.REQUIRED, ad); - AttributeDefinition[] definitions = definition.getAttributeDefinitions(ObjectClassDefinition.ALL); + String[] myOptionLabels = new String[possiblePrograms]; + String[] myOptionValues = new String[possiblePrograms]; + + if (programTxt != null) { + myOptionLabels[counter] = programTxt.getName(); + myOptionValues[counter++] = "txt"; + } + if (programDoc != null) { + myOptionLabels[counter] = programDoc.getName(); + myOptionValues[counter++] = "doc"; + } + if (programHtml != null) { + myOptionLabels[counter] = programHtml.getName(); + myOptionValues[counter++] = "html"; + } + + AttributeDefinition ad = new BasicAttributeDefinition("viewWith", "View file as", "Type of viewer", AttributeDefinition.STRING /*string*/, 0, defValStringArray/*String[] defaultValue*/, null /*validator*/, myOptionLabels, myOptionValues); + definition.addAttributeDefinition(ObjectClassDefinition.REQUIRED, ad); MetaTypeProvider provider = new BasicMetaTypeProvider(definition); return provider; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ter...@us...> - 2007-05-14 18:58:04
|
Revision: 399 http://svn.sourceforge.net/cishell/?rev=399&view=rev Author: terkhorn Date: 2007-05-14 11:57:45 -0700 (Mon, 14 May 2007) Log Message: ----------- Added VERY BASIC support for "View as..." option for files seen in the data manager window. Currently you can only use this option by selecting it from the "File" menu. You cannot right-click the file and select view as yet, but I will add that ASAP. Most changes are seen in org.cishell.reference.gui.persistence. Modified Paths: -------------- 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/view/FileView.java Added Paths: ----------- trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/viewwith.properties trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/viewwith.xml trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWith.java trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWithFactory.java trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/ViewWithDataChooser.java 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 2007-05-14 18:55:13 UTC (rev 398) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/META-INF/MANIFEST.MF 2007-05-14 18:57:45 UTC (rev 399) @@ -10,6 +10,7 @@ org.cishell.framework.algorithm, org.cishell.framework.data, org.cishell.reference.gui.common, + org.cishell.reference.service.metatype, org.cishell.service.conversion, org.cishell.service.guibuilder, org.osgi.framework;version="1.3.0", @@ -18,6 +19,6 @@ org.osgi.service.metatype;version="1.1.0", org.osgi.service.prefs;version="1.1.0" X-AutoStart: true -Service-Component: OSGI-INF/load.xml, OSGI-INF/save.xml, OSGI-INF/view.xml +Service-Component: OSGI-INF/load.xml, OSGI-INF/save.xml, OSGI-INF/view.xml, OSGI-INF/viewwith.xml Require-Bundle: org.eclipse.swt, org.eclipse.ui Added: trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/viewwith.properties =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/viewwith.properties (rev 0) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/viewwith.properties 2007-05-14 18:57:45 UTC (rev 399) @@ -0,0 +1,7 @@ +menu_path=File/additions +label=View with... +description=This algorithm does this and this... +in_data=java.lang.Object +out_data=null +service.pid=org.cishell.reference.gui.persistence.viewwith.FileViewWith +remoteable=true Added: trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/viewwith.xml =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/viewwith.xml (rev 0) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/OSGI-INF/viewwith.xml 2007-05-14 18:57:45 UTC (rev 399) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<component name="org.cishell.reference.gui.persistence.viewwith.FileViewWith.component" immediate="false"> + <implementation class="org.cishell.reference.gui.persistence.viewwith.FileViewWithFactory"/> + <properties entry="OSGI-INF/viewwith.properties"/> + <reference name="LOG" interface="org.osgi.service.log.LogService"/> + <reference name="MTS" interface="org.osgi.service.metatype.MetaTypeService"/> + + <service> + <provide interface= + "org.cishell.framework.algorithm.AlgorithmFactory"/> + </service> +</component> \ No newline at end of file Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/FileView.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/FileView.java 2007-05-14 18:55:13 UTC (rev 398) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/view/FileView.java 2007-05-14 18:57:45 UTC (rev 399) @@ -31,6 +31,7 @@ static GUIBuilderService guiBuilder; LogService logger; Program program; + // Program programTwo; File tempFile; public FileView(Data[] data, Dictionary parameters, CIShellContext context) { @@ -118,7 +119,19 @@ public void run() { program = Program.findProgram("txt"); }}); + /* + Display.getDefault().syncExec(new Runnable() { + public void run() { + programTwo = Program.findProgram("doc"); + }}); + if (programTwo == null) { + System.out.println("***\nYO!\nNo doc viewer\n"); + } else { + System.out.println("!!!\nHEY!\nDoc viewer found\n"); + + } + */ if (program == null) { guiBuilder.showError("No Text Viewer", "No valid text viewer for the .txt file. " + Added: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWith.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWith.java (rev 0) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWith.java 2007-05-14 18:57:45 UTC (rev 399) @@ -0,0 +1,222 @@ +package org.cishell.reference.gui.persistence.viewwith; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.channels.FileChannel; +import java.util.Dictionary; + +import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.data.Data; +import org.cishell.service.conversion.Converter; +import org.cishell.service.conversion.DataConversionService; +import org.cishell.service.guibuilder.GUIBuilderService; +import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.osgi.service.log.LogService; + +/* + * @author Felix Terkhorn (ter...@gm...), Weixia Huang (hu...@in...) + */ +public class FileViewWith implements Algorithm { + Data[] data; + Dictionary parameters; + CIShellContext context; + DataConversionService conversionManager; + static GUIBuilderService guiBuilder; + LogService logger; + Program program; + Program programTwo; + Program programThree; + File tempFile; + + public FileViewWith(Data[] data, Dictionary parameters, CIShellContext context) { + this.data = data; + this.parameters = parameters; + this.context = context; + + conversionManager = (DataConversionService) context.getService( + DataConversionService.class.getName()); + + logger = (LogService)context.getService(LogService.class.getName()); + guiBuilder = (GUIBuilderService)context.getService(GUIBuilderService.class.getName()); + + } + public File getTempFile(){ + File tempFile; + + String tempPath = System.getProperty("java.io.tmpdir"); + File tempDir = new File(tempPath+File.separator+"temp"); + if(!tempDir.exists()) + tempDir.mkdir(); + try{ + tempFile = File.createTempFile("xxx-Session-", ".txt", tempDir); + + }catch (IOException e){ + logger.log(LogService.LOG_ERROR, e.toString()); + tempFile = new File (tempPath+File.separator+"temp"+File.separator+"temp.txt"); + + } + return tempFile; + } + + public Data[] execute() { + boolean lastSaveSuccessful = false; + String format; + + String viewWith = (String) parameters.get("viewWith"); + + Display display; + IWorkbenchWindow[] windows; + final Shell parentShell; + + windows = PlatformUI.getWorkbench().getWorkbenchWindows(); + if (windows.length == 0){ + return null; + } + parentShell = windows[0].getShell(); + display = PlatformUI.getWorkbench().getDisplay(); + tempFile = getTempFile(); + + for (int i = 0; i < data.length; i++){ + Object theData = data[i].getData(); + format = data[i].getFormat(); + if (theData instanceof File || + format.startsWith("file:text/") || + format.startsWith("file-ext:")){ + copy((File)data[i].getData(), tempFile); + lastSaveSuccessful = true; + }else{ + final Converter[] converters = conversionManager.findConverters(data[i], "file-ext:*"); + + if (converters.length < 1) { + guiBuilder.showError("No Converters", + "No valid converters for data type: " + + data[i].getData().getClass().getName(), + "Please install a plugin that will save the data type to a file"); + } + else if (converters.length == 1){ + //If length=1, use the unique path to save it directly + //and bring the text editor. + Data newData = converters[0].convert(data[i]); + copy((File)newData.getData(), tempFile); + lastSaveSuccessful = true; + } + else { + if (!parentShell.isDisposed()) { + DataViewer dataViewer = new DataViewer(parentShell, data[i], converters); + display.syncExec(dataViewer); + lastSaveSuccessful = dataViewer.isSaved; + tempFile = dataViewer.theFile; + } + } + } + + + Display.getDefault().syncExec(new Runnable() { + public void run() { + program = Program.findProgram("txt"); + }}); + + Display.getDefault().syncExec(new Runnable() { + public void run() { + programTwo = Program.findProgram("doc"); + }}); + + Display.getDefault().syncExec(new Runnable() { + public void run() { + programThree = Program.findProgram("htm"); + }}); + + + if (program == null && programTwo == null && programThree == null) { + guiBuilder.showError("No Viewers for TXT, DOC, or HTM", + "No valid viewers for .txt, .doc, or .htm files. " + + "The file is located at: "+tempFile.getAbsolutePath(), + "Unable to open default text viewer. File is located at: "+ + tempFile.getAbsolutePath()); + } + else { + if (lastSaveSuccessful == true) { + if (viewWith.equals("txt")) { + Display.getDefault().syncExec(new Runnable() { + public void run() { + program.execute(tempFile.getAbsolutePath()); + }}); + } else if (viewWith.equals("doc")) { + Display.getDefault().syncExec(new Runnable() { + public void run() { + programTwo.execute(tempFile.getAbsolutePath()); + }}); + } else if (viewWith.equals("html")) { + Display.getDefault().syncExec(new Runnable() { + public void run() { + programThree.execute(tempFile.getAbsolutePath()); + }}); + } else { + // Try to run it with txt viewer... + Display.getDefault().syncExec(new Runnable() { + public void run() { + program.execute(tempFile.getAbsolutePath()); + }}); + } + } + } + + + + } + return null; + } + + public static boolean copy(File in, File out) { + try { + FileInputStream fis = new FileInputStream(in); + FileOutputStream fos = new FileOutputStream(out); + + FileChannel readableChannel = fis.getChannel(); + FileChannel writableChannel = fos.getChannel(); + + writableChannel.truncate(0); + writableChannel.transferFrom(readableChannel, 0, readableChannel.size()); + fis.close(); + fos.close(); + return true; + } + catch (IOException ioe) { + guiBuilder.showError("Copy Error", "IOException during copy", ioe.getMessage()); + return false; + } + } + + final class DataViewer implements Runnable { + Shell shell; + boolean isSaved; + Data theData; + File theFile = getTempFile(); + Converter[] theConverters; + + DataViewer (Shell parentShell, Data data, Converter[] converters){ + this.shell = parentShell; + this.theData = data; + this.theConverters = converters; + } + + public void run() { + // lots of persisters found, return the chooser + ViewWithDataChooser vdc = new ViewWithDataChooser("View as...", theFile, shell, + theData, theConverters, context); + vdc.open(); + isSaved = vdc.isSaved(); + } + } + + + + +} \ No newline at end of file Added: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWithFactory.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWithFactory.java (rev 0) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/FileViewWithFactory.java 2007-05-14 18:57:45 UTC (rev 399) @@ -0,0 +1,127 @@ +package org.cishell.reference.gui.persistence.viewwith; + +import java.io.IOException; +import java.util.Dictionary; + +import org.cishell.framework.CIShellContext; +import org.cishell.framework.algorithm.Algorithm; +import org.cishell.framework.algorithm.AlgorithmFactory; +import org.cishell.framework.data.Data; +import org.cishell.reference.service.metatype.BasicAttributeDefinition; +import org.cishell.reference.service.metatype.BasicMetaTypeProvider; +import org.cishell.reference.service.metatype.BasicObjectClassDefinition; +import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.osgi.service.component.ComponentContext; +import org.osgi.service.metatype.AttributeDefinition; +import org.osgi.service.metatype.MetaTypeInformation; +import org.osgi.service.metatype.MetaTypeProvider; +import org.osgi.service.metatype.MetaTypeService; +import org.osgi.service.metatype.ObjectClassDefinition; + + +// Felix: +// See edu.iu.nwb.visualization.prefuse.beta.common +// It implements AlgorithmFactory and adds dropbox boxes... +// You will need to do something similar, but much less complicated, here, I believe. + +public class FileViewWithFactory implements AlgorithmFactory { + Program programTxt; + Program programDoc; + Program programHtml; + private MetaTypeProvider provider; +// private MetaTypeInformation originalProvider; // taken from PrefuseBetaAlgorithmFactory +// private String pid; // taken from PrefuseBetaAlgFactory + + protected void activate(ComponentContext ctxt) { + //You may delete all references to metatype service if + //your algorithm does not require parameters and return + //null in the createParameters() method + //MetaTypeService mts = (MetaTypeService)ctxt.locateService("MTS"); + //provider = mts.getMetaTypeInformation(ctxt.getBundleContext().getBundle()); + // bruce says these should be commented out... + } + protected void deactivate(ComponentContext ctxt) { + provider = null; + } + + public Algorithm createAlgorithm(Data[] data, Dictionary parameters, CIShellContext context) { + return new FileViewWith(data, parameters, context); + } + + + private String[] createKeyArray() { + String[] keys = new String[1]; + keys[0] = "Viewer"; + /* + for(int ii = 1; ii <= schema.getColumnCount(); ii++) { + keys[ii] = schema.getColumnName(ii - 1); + System.out.println("keys["+ii+"] = " + schema.getColumnName(ii - 1) + "; "); + } + */ + + return keys; + } + + public MetaTypeProvider createParameters(Data[] data) { + //ObjectClassDefinition oldDefinition = provider.getObjectClassDefinition(this.pid, null); + // read the API for creating on ObjectClassDefinition + // and create a basic one ... + // BasicObjectClassDefinition oldDefinition = new ObjectClassDefinition(); + + BasicObjectClassDefinition definition; + //try { + definition = new BasicObjectClassDefinition("fileViewWithDefinition", "Application viewer type", "Please choose an application viewer to read this file.\nThe application associated with the chosen extension will be called.", null); + //} catch (IOException e) { + //definition = new BasicObjectClassDefinition("fileViewWithDef", "fileViewWithName", "This is an OCD for fileViewWith", null); + //} + +// String[] dialogAttributesArray = createKeyArray(); + + + Display display; + + + display = PlatformUI.getWorkbench().getDisplay(); + + Display.getDefault().syncExec(new Runnable() { + public void run() { + programTxt = Program.findProgram("txt"); + }}); + + Display.getDefault().syncExec(new Runnable() { + public void run() { + programDoc = Program.findProgram("doc"); + }}); + + Display.getDefault().syncExec(new Runnable() { + public void run() { + programHtml = Program.findProgram("htm"); + }}); + + System.err.println(definition.getID()); + + String[] defValStringArray = null; //doesn't actually work yet... + String[] myOptionLabels = new String[] {"TXT","DOC","HTML"}; + String[] myOptionValues = new String[] {"txt","doc","html"}; + + if (programTxt == null) { + myOptionLabels[0] = ""; + } + if (programDoc == null) { + myOptionLabels[1] = ""; + } + if (programHtml == null) { + myOptionLabels[2] = ""; + } + AttributeDefinition ad = new BasicAttributeDefinition("viewWith", "View file as", "Type of viewer", AttributeDefinition.STRING /*string*/, 0, defValStringArray/*String[] defaultValue*/, null /*validator*/, myOptionLabels, myOptionValues); + definition.addAttributeDefinition(ObjectClassDefinition.REQUIRED, ad); + + AttributeDefinition[] definitions = definition.getAttributeDefinitions(ObjectClassDefinition.ALL); + + + MetaTypeProvider provider = new BasicMetaTypeProvider(definition); + return provider; + } +} \ No newline at end of file Added: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/ViewWithDataChooser.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/ViewWithDataChooser.java (rev 0) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/viewwith/ViewWithDataChooser.java 2007-05-14 18:57:45 UTC (rev 399) @@ -0,0 +1,44 @@ +package org.cishell.reference.gui.persistence.viewwith; + +import java.io.File; + +import org.cishell.framework.CIShellContext; +import org.cishell.framework.data.Data; +import org.cishell.reference.gui.persistence.save.SaveDataChooser; +import org.cishell.service.conversion.Converter; + +import org.eclipse.swt.widgets.Shell; + +/* + * @author Felix Terkhorn (ter...@gm...) + * + */ +public class ViewWithDataChooser extends SaveDataChooser { + private File tempFile; + boolean isSaved = false; + Converter[] converters; + Data theData; + + public ViewWithDataChooser(String title, File tempFile, Shell parent, + Data data, Converter[] converters, CIShellContext context){ + super (data, parent, converters, title, context); + + this.tempFile = tempFile; + this.converters = converters; + this.theData = data; + } + + protected void selectionMade(int selectedIndex) { + getShell().setVisible(false); + final Converter converter = converterArray[selectedIndex]; + Data newData = converter.convert(theData); + isSaved = FileViewWith.copy((File)newData.getData(), tempFile); + close(true); + } + + public boolean isSaved(){ + return isSaved; + } + + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ter...@us...> - 2007-05-14 18:55:36
|
Revision: 398 http://svn.sourceforge.net/cishell/?rev=398&view=rev Author: terkhorn Date: 2007-05-14 11:55:13 -0700 (Mon, 14 May 2007) Log Message: ----------- Added support for the "View as.." method for viewing files. 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 2007-05-14 13:18:33 UTC (rev 397) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/AbstractDataManagerView.java 2007-05-14 18:55:13 UTC (rev 398) @@ -20,7 +20,6 @@ import java.util.Iterator; import java.util.Map; import java.util.Set; -import java.util.StringTokenizer; import org.cishell.app.service.datamanager.DataManagerListener; import org.cishell.app.service.datamanager.DataManagerService; @@ -41,7 +40,6 @@ import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.SelectionAdapter; @@ -92,11 +90,14 @@ private AlgorithmFactory saveFactory; private AlgorithmFactory viewFactory; + private AlgorithmFactory viewWithFactory; + private DiscardListener discardListener; private SaveListener saveListener; private ViewListener viewListener; + private ViewWithListener viewWithListener; public AbstractDataManagerView(String brandPluginID) { manager = Activator.getDataManagerService(); @@ -145,6 +146,12 @@ viewListener = new ViewListener(); viewItem.addListener(SWT.Selection, viewListener); + MenuItem viewWithItem = new MenuItem(menu, SWT.PUSH); + viewWithItem.setText("View as..."); + viewWithListener = new ViewWithListener(); + viewWithItem.addListener(SWT.Selection, viewWithListener); + + MenuItem renameItem = new MenuItem(menu, SWT.PUSH); renameItem.setText("Rename"); renameItem.addListener(SWT.Selection, new Listener() { @@ -308,6 +315,8 @@ "org.cishell.reference.gui.persistence.save.Save", model, 0); viewFactory = enableMenuItemCheck(viewFactory, "org.cishell.reference.gui.persistence.view.FileView", model, 1); + viewWithFactory = enableMenuItemCheck(viewWithFactory, + "org.cishell.reference.gui.persistence.viewwith.FileViewWith", model, 2); } private AlgorithmFactory enableMenuItemCheck( @@ -318,12 +327,13 @@ algorithmFactory = Activator.getService(service); if (algorithmFactory != null) { validSaveFactory = true; - } + } } else { validSaveFactory = true; } boolean enabled = false; + if (validSaveFactory) { Algorithm algorithm = algorithmFactory.createAlgorithm( new Data[] { model }, new Hashtable(), Activator @@ -419,17 +429,11 @@ */ private void updateText(String newLabel, TreeItem item) { updatingTreeItem = true; - /* - if (newLabel.contains(">")) { - System.out.println("We have a >\n"); - } - */ + if (newLabel.startsWith(">")) newLabel = newLabel.substring(1); - //System.out.println("The newLabel is "+newLabel); - // This isn't being picked up - //if (isValid(newLabel)) { + editor.getItem().setText(newLabel); DataGUIItem treeItem = (DataGUIItem) item.getData(); @@ -438,27 +442,10 @@ viewer.refresh(); newEditor.dispose(); - // removed Error checking below for "invalid data model names" at Russell's request - // Felix Terkhorn May 9 2007 - /*} else { - String message = "Invalid data model name. The following characters" - + " are not allowed:\n\n" - + "`~!@#$%^&*()+=[{]}\\|;:'\",<>/?"; - Activator.getLogService().log(LogService.LOG_WARNING, message); - handleInput(); - }*/ - + updatingTreeItem = false; } - // not valid chars: `~!@#$%^&*()+=[{]}\|;:'",<>/? - private boolean isValid(String label) { - StringTokenizer st = new StringTokenizer(" " + label + " ", - "`~!@#$%^&*()+=[{]}\\|;:'\",<>/?"); - - return st.countTokens() == 1; - } - /* * Listens for right-clicks on TreeItems and opens the context menu when * needed. @@ -504,6 +491,19 @@ } } + private class ViewWithListener implements Listener { + public void handleEvent(Event event) { + if (viewWithFactory != null) { + Data data[] = AbstractDataManagerView.this.manager + .getSelectedData(); + Algorithm algorithm = viewWithFactory + .createAlgorithm(data, new Hashtable(), Activator + .getCIShellContext()); + algorithm.execute(); + } + } + } + private class DiscardListener implements Listener { public void handleEvent(Event event) { TreeItem[] selection = AbstractDataManagerView.this.tree @@ -526,36 +526,7 @@ } } - /* - * Listens for double clicks or Enter presses on a TreeItem to cause that - * item to become editable to rename it. - */ - private class TreeItemEditorListener extends MouseAdapter implements - KeyListener { - //private TreeEditor editor; - public TreeItemEditorListener(TreeEditor editor) { - //this.editor = editor; - } - - public void keyReleased(KeyEvent e) { - if ((e.keyCode == SWT.CR) && !updatingTreeItem) { - handleInput(); - } - } - - public void mouseDoubleClick(MouseEvent e) { - handleInput(); - } - - public void keyPressed(KeyEvent e) { - } - - public void mouseDown(MouseEvent e) { - } - } - - private class DataModelSelectionProvider implements ISelectionProvider { private Set listeners = new HashSet(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tea...@us...> - 2007-05-14 13:18:43
|
Revision: 397 http://svn.sourceforge.net/cishell/?rev=397&view=rev Author: teakettle22 Date: 2007-05-14 06:18:33 -0700 (Mon, 14 May 2007) Log Message: ----------- The modified code for menu construction. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/ApplicationActionBarAdvisor.java Modified: trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/ApplicationActionBarAdvisor.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/ApplicationActionBarAdvisor.java 2007-05-10 20:23:36 UTC (rev 396) +++ trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/ApplicationActionBarAdvisor.java 2007-05-14 13:18:33 UTC (rev 397) @@ -1,7 +1,11 @@ package org.cishell.reference.gui.workspace; +import org.eclipse.jface.action.GroupMarker; import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; @@ -13,7 +17,7 @@ * the actions added to a workbench window. Each window will be populated with * new actions. */ -public class ApplicationActionBarAdvisor extends ActionBarAdvisor { +public class ApplicationActionBarAdvisor extends ActionBarAdvisor{ // Actions - important to allocate these only in makeActions, and then use // them in the fill methods. This ensures that the actions aren't recreated @@ -41,7 +45,42 @@ protected void fillMenuBar(IMenuManager menuBar) { CIShellApplication.setMenuManager(menuBar); - + /* + * If we don't create the File and the Help menus at initialization, they don't show up correctly. I create the file and the help + * menus and add them. Later the default_menu.xml file is parse and the additional menus are added in between + * the File and the Help menus. + * + * The File menu is created normally, as we modify it again in the MenuAdapter code. The Help menu is created as having + * three divisions, start, additions, and end. The File menu later adds these divisions so that additional packages will be added + * between the Test submenu and the Exit item. The Help menu adds additional packages before the configuration and update items. + * + * Modified by: Tim Kelley + * Date: May, 8-9, 2007 + * Additional Code found in: org.cishell.reference.gui.menumanager.MenuAdapter.java + */ + + + + MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE); //Create File menu as a normal Menu + menuBar.add(fileMenu); //add it to the MenuBar + MenuManager helpMenu = createMenu("&Help", IWorkbenchActionConstants.M_HELP); //Create the Help Menu with start, end, and additions as divisions + helpMenu.add(new Separator()); //Add a separator and then add the "About" MenuItem. + helpMenu.appendToGroup("end",aboutAction); + menuBar.add(new GroupMarker("start")); //Add divisions to the MenuBar so we can add + //additional menus to the MenuBar between File and Help menus //the File and Help menus. + menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + menuBar.add(new GroupMarker("end")); + + menuBar.add(helpMenu); //Add the Help menu after the divisions. } + + private MenuManager createMenu(String text, String id) { + MenuManager menu = new MenuManager(text, id); + menu.add(new GroupMarker("start")); + menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + menu.add(new GroupMarker("end")); + //System.out.println(IWorkbenchActionConstants.MB_ADDITIONS); + return menu; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tea...@us...> - 2007-05-10 20:10:33
|
Revision: 395 http://svn.sourceforge.net/cishell/?rev=395&view=rev Author: teakettle22 Date: 2007-05-10 13:10:30 -0700 (Thu, 10 May 2007) Log Message: ----------- Got rid of the ">" from the data tree viewer Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/DataTreeLabelProvider.java Modified: trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/DataTreeLabelProvider.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/DataTreeLabelProvider.java 2007-05-10 18:09:40 UTC (rev 394) +++ trunk/clients/gui/org.cishell.reference.gui.datamanager/src/org/cishell/reference/gui/datamanager/DataTreeLabelProvider.java 2007-05-10 20:10:30 UTC (rev 395) @@ -50,10 +50,10 @@ if (element instanceof DataGUIItem) { Data model = ((DataGUIItem) element).getModel(); String label = (String) model.getMetaData().get(DataProperty.LABEL); - Boolean modified = (Boolean)model.getMetaData().get(DataProperty.MODIFIED); - if(modified != null && modified.booleanValue()){ + // Boolean modified = (Boolean)model.getMetaData().get(DataProperty.MODIFIED); + /* if(modified != null && modified.booleanValue()){ label = ">" + label; - } + }*/ return label; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <tea...@us...> - 2007-05-10 18:09:43
|
Revision: 394 http://svn.sourceforge.net/cishell/?rev=394&view=rev Author: teakettle22 Date: 2007-05-10 11:09:40 -0700 (Thu, 10 May 2007) Log Message: ----------- Adjusted the menu managers so that the File and Help menus are initially created and added to the beginning and end respectively. All other menus are created in between 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/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 2007-05-09 14:30:55 UTC (rev 393) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java 2007-05-10 18:09:40 UTC (rev 394) @@ -22,15 +22,18 @@ import org.cishell.app.service.scheduler.SchedulerService; import org.cishell.framework.CIShellContext; import org.cishell.framework.algorithm.AlgorithmProperty; -//import org.cishell.framework.algorithm.DataValidator; import org.cishell.framework.data.Data; import org.cishell.service.conversion.Converter; import org.cishell.service.conversion.DataConversionService; import org.eclipse.jface.action.Action; import org.osgi.framework.BundleContext; -//import org.osgi.framework.Constants; import org.osgi.framework.ServiceReference; import org.osgi.service.log.LogService; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; public class AlgorithmAction extends Action implements AlgorithmProperty, DataManagerListener { @@ -248,4 +251,6 @@ public ServiceReference getServiceReference(){ return ref; } + + } \ No newline at end of file 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 2007-05-09 14:30:55 UTC (rev 393) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2007-05-10 18:09:40 UTC (rev 394) @@ -14,25 +14,17 @@ package org.cishell.reference.gui.menumanager.menu; //Java +import java.io.IOException; import java.util.HashMap; import java.util.Map; -import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -//CIShell import org.cishell.framework.CIShellContext; import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.algorithm.AlgorithmProperty; - -//Eclipse import org.eclipse.jface.action.Action; import org.eclipse.jface.action.GroupMarker; import org.eclipse.jface.action.IContributionItem; @@ -41,12 +33,10 @@ import org.eclipse.jface.action.Separator; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; - -//OSGi import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; import org.osgi.framework.InvalidSyntaxException; @@ -54,6 +44,12 @@ import org.osgi.framework.ServiceListener; import org.osgi.framework.ServiceReference; import org.osgi.service.log.LogService; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; /* @@ -170,36 +166,26 @@ } private void processTopMenu (Element topMenuNode){ - MenuManager topMenuBar; + MenuManager topMenuBar = null; - //First create and add topMenuBar to the menuBar - String topMenuName = topMenuNode.getAttribute(ATTR_NAME); - if (topMenuName.equalsIgnoreCase("file")){ - topMenuBar= new MenuManager("&File", IWorkbenchActionConstants.M_FILE); - } - else if (topMenuName.equalsIgnoreCase("help")){ - topMenuBar= new MenuManager("&Help", - IWorkbenchActionConstants.M_HELP); - //allow to append new top level menu before "Help" - menuBar.add(new GroupMarker(START_GROUP)); - menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); - menuBar.add(new GroupMarker(END_GROUP)); - - //allow to append new sub menu under "Help" and before "/Help/About" - topMenuBar.add(new GroupMarker(START_GROUP)); - topMenuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); - topMenuBar.add(new GroupMarker(END_GROUP)); - - IWorkbenchAction aboutAction = ActionFactory.ABOUT.create(window); - topMenuBar.add(new Separator()); - topMenuBar.add(aboutAction); - + + /* + * The File and Help menus are created in ApplicationActionBarAdvisor.java + * This function now parses the XML file and appends the new menus/menu items to the correct group + * We first check to see if the menu already exists in our MenuBar. If it does, we modify the already + * existing menu. If not, then we create a new Menu. + * + * Modified by: Tim Kelley + * Date: May 8-9, 2007 + * Additional code at: org.cishell.reference.gui.workspace.ApplicationActionBarAdvisor.java + */ + + String topMenuName = topMenuNode.getAttribute(ATTR_NAME); + if((topMenuBar = (MenuManager)menuBar.findUsingPath(topMenuName)) == null){ //Check to see if menu exists + topMenuBar= new MenuManager(topMenuName, topMenuName.toLowerCase()); //Create a new menu if it doesn't + menuBar.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, topMenuBar); } - else { - topMenuBar= new MenuManager(topMenuName, topMenuName.toLowerCase()); - } - menuBar.add(topMenuBar); //Second process submenu processSubMenu(topMenuNode, topMenuBar); } @@ -270,7 +256,7 @@ private void processAMenuNode(Element menuNode, MenuManager parentMenuBar ){ String menuName = menuNode.getAttribute(ATTR_NAME); String pid = menuNode.getAttribute(ATTR_PID); -// System.out.println(">>>pid="+pid); + //System.out.println(">>>pid="+pid); if (pid == null || pid.length()==0){ //check if the name is one of the preserved one //if so add the default action @@ -299,7 +285,7 @@ private void parseXmlFile(){ //get the factory DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - + dbf.setCoalescing(true); try { //Using factory get an instance of document builder DocumentBuilder db = dbf.newDocumentBuilder(); @@ -307,7 +293,8 @@ //parse using builder to get DOM representation of the XML file String fullpath=System.getProperty("osgi.configuration.area") + DEFAULT_MENU_FILE_NAME; // System.out.println(">>parse file: "+fullpath); - dom = db.parse(fullpath); + dom = db.parse(fullpath); + // printElementAttributes(dom); }catch(ParserConfigurationException pce) { pce.printStackTrace(); @@ -367,7 +354,7 @@ private void makeMenuItem(ServiceReference ref) { String path = (String)ref.getProperty(MENU_PATH); String[] items = (path == null) ? null : path.split("/"); - + IMenuManager menu = null; if (items != null && items.length > 1) { AlgorithmAction action = new AlgorithmAction(ref, bContext, ciContext); action.setId(getItemID(ref)); @@ -376,28 +363,35 @@ String group = items[items.length-1]; for (int i=0; i < items.length-1; i++) { - IMenuManager menu = targetMenu.findMenuUsingPath(items[i]); - + + menu = targetMenu.findMenuUsingPath(items[i]); + if (menu == null && items[i] != null) { menu = targetMenu.findMenuUsingPath(items[i].toLowerCase()); + } if (menu == null) { + menu = createMenu(items[i],items[i]); targetMenu.appendToGroup(ADDITIONS_GROUP, menu); } targetMenu = menu; + + } group = items[items.length-1]; IContributionItem groupItem = targetMenu.find(group); + if (groupItem == null) { groupItem = new GroupMarker(group); targetMenu.appendToGroup(ADDITIONS_GROUP, groupItem); } targetMenu.appendToGroup(group, action); + targetMenu.appendToGroup(group, new Separator()); algorithmToItemMap.put(getItemID(ref), action); itemToParentMap.put(action, targetMenu); @@ -489,4 +483,40 @@ private LogService getLog() { return (LogService) ciContext.getService(LogService.class.getName()); } + /* + * printElementAttributes takes in a xml document, gets the nodes, then prints the attributes. + * Copied from Java Tutorial on XML Parsing by Tim Kelley for debugging purposes. + */ + static void printElementAttributes(Document doc) + { + NodeList nl = doc.getElementsByTagName("*"); + Element e; + Node n; + NamedNodeMap nnm; + + String attrname; + String attrval; + int i, len; + + len = nl.getLength(); + + for (int j=0; j < len; j++) + { + e = (Element)nl.item(j); + System.err.println(e.getTagName() + ":"); + nnm = e.getAttributes(); + + if (nnm != null) + { + for (i=0; i<nnm.getLength(); i++) + { + n = nnm.item(i); + attrname = n.getNodeName(); + attrval = n.getNodeValue(); + System.err.print(" " + attrname + " = " + attrval); + } + } + System.err.println(); + } + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ter...@us...> - 2007-05-09 14:30:56
|
Revision: 393 http://svn.sourceforge.net/cishell/?rev=393&view=rev Author: terkhorn Date: 2007-05-09 07:30:55 -0700 (Wed, 09 May 2007) Log Message: ----------- Changed logger to call setUseParentHandlers(false). This will prevent logger output from being displayed to the stdout console and make life a tiny bit easier for our intrepid debuggers. Felix Terkhorn. (ter...@gm..., mas...@in...) Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogToFile.java Modified: trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogToFile.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogToFile.java 2007-05-09 13:49:22 UTC (rev 392) +++ trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogToFile.java 2007-05-09 14:30:55 UTC (rev 393) @@ -55,6 +55,7 @@ // Add to the desired logger logger = Logger.getLogger("edu.iu.iv.logger"); logger.addHandler(handler); + logger.setUseParentHandlers(false); // Edited by Felix Terkhorn. ter...@gm... May-9-2007 } } catch (IOException e) { e.printStackTrace(); @@ -86,10 +87,10 @@ } else { // if these don't match, set it to INFO // maybe not the best way to do this javaLogLevel = Level.INFO; - } + } // edited by Felix Terkhorn. ter...@gm... May-9-2007 if (goodMessage(message)){ - logger.log(javaLogLevel, message+"\n"); + logger.log(javaLogLevel, message+"\n"); // stdout printing happens here, despite having 1 handler only } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ter...@us...> - 2007-05-09 13:49:28
|
Revision: 392 http://svn.sourceforge.net/cishell/?rev=392&view=rev Author: terkhorn Date: 2007-05-09 06:49:22 -0700 (Wed, 09 May 2007) Log Message: ----------- Fixed logging so that osgi Error levels are correctly mapped to java.util.logging error levels. Correspondence between OSGI log levels and Java.util.logging log levels: // JAVA OSGI // ---- ---- // SEVERE=1000 LOG_ERROR=1 // WARNING=900 LOG_WARNING=2 // INFO=800 LOG_INFO=3 // FINEST=300 LOG_DEBUG=4 Presumably this should take care of all cases for OSGI error levels, but if an invalid OSGI error level is given (I.E., outside of the range 1,2,3,4), the message is logged as "INFO." Felix Terkhorn (ter...@gm...) Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogToFile.java Modified: trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogToFile.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogToFile.java 2007-05-08 19:34:29 UTC (rev 391) +++ trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogToFile.java 2007-05-09 13:49:22 UTC (rev 392) @@ -66,7 +66,7 @@ String message = entry.getMessage(); int osgiLogLevel = entry.getLevel(); Level javaLogLevel; - +/* // Correspondence between OSGI log levels and Java.util.logging log levels: // JAVA OSGI // ---- ---- @@ -74,7 +74,7 @@ // WARNING=900 LOG_WARNING=2 // INFO=800 LOG_INFO=3 // FINEST=300 LOG_DEBUG=4 - + */ if (osgiLogLevel == 1) { // OSGI level = LOG_ERROR javaLogLevel = Level.SEVERE; } else if (osgiLogLevel == 2) { // OSGI level = LOG_WARNING This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-05-02 16:44:59
|
Revision: 390 http://svn.sourceforge.net/cishell/?rev=390&view=rev Author: huangb Date: 2007-05-02 09:43:51 -0700 (Wed, 02 May 2007) Log Message: ----------- comment out some code to avoid generating duplicate error reports when the application fails to load a file. Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoad.java Modified: trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoad.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoad.java 2007-04-26 18:39:27 UTC (rev 389) +++ trunk/clients/gui/org.cishell.reference.gui.persistence/src/org/cishell/reference/gui/persistence/load/FileLoad.java 2007-05-02 16:43:51 UTC (rev 390) @@ -185,7 +185,14 @@ } } - if (serviceRefList != null){ + /* + * Bonnie: I commented out the following functions since when + * the application failed to load an nwb file, etc, the reader + * has report the error. It does not need this second error display. + * But maybe not all file readers will generate the error display if + * a failure occurs... + */ +/* if (serviceRefList != null){ if(serviceRefList.length >0 && !loadFileSuccess){ guiBuilder.showError("Can Not Load The File", "Sorry, it's very possible that you have a wrong file format," + @@ -196,8 +203,9 @@ "And send your requests or report the problem to "+ "cis...@li.... \n"+"Thank you."); } + } - +*/ }catch (Exception e){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-04-26 18:41:10
|
Revision: 389 http://svn.sourceforge.net/cishell/?rev=389&view=rev Author: huangb Date: 2007-04-26 11:39:27 -0700 (Thu, 26 Apr 2007) Log Message: ----------- clean up the code a bit Modified Paths: -------------- 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/MenuAdapter.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2007-04-26 18:37:26 UTC (rev 388) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2007-04-26 18:39:27 UTC (rev 389) @@ -16,7 +16,6 @@ //Java import java.util.HashMap; import java.util.Map; -import java.io.File; import java.io.IOException; import javax.xml.parsers.DocumentBuilder; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-04-26 18:38:12
|
Revision: 388 http://svn.sourceforge.net/cishell/?rev=388&view=rev Author: huangb Date: 2007-04-26 11:37:26 -0700 (Thu, 26 Apr 2007) Log Message: ----------- fix the file path problem, use osgi.configuration.area property Modified Paths: -------------- 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/MenuAdapter.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2007-04-26 15:26:41 UTC (rev 387) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2007-04-26 18:37:26 UTC (rev 388) @@ -77,7 +77,6 @@ private Map pidToServiceReferenceMap; private Map pidToServiceReferenceMapCopy; private Document dom; - private static File DirForDefaultMenuXMLFile; private static String DEFAULT_MENU_FILE_NAME = "default_menu.xml"; /* @@ -307,12 +306,9 @@ DocumentBuilder db = dbf.newDocumentBuilder(); //parse using builder to get DOM representation of the XML file - if (DirForDefaultMenuXMLFile == null) { - DirForDefaultMenuXMLFile = new File(System.getProperty("user.dir") + File.separator + "configuration"); - } - String fullpath=DirForDefaultMenuXMLFile.getPath()+File.separator+DEFAULT_MENU_FILE_NAME; + String fullpath=System.getProperty("osgi.configuration.area") + DEFAULT_MENU_FILE_NAME; // System.out.println(">>parse file: "+fullpath); - dom = db.parse(fullpath); + dom = db.parse(fullpath); }catch(ParserConfigurationException pce) { pce.printStackTrace(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-04-26 15:26:44
|
Revision: 387 http://svn.sourceforge.net/cishell/?rev=387&view=rev Author: huangb Date: 2007-04-26 08:26:41 -0700 (Thu, 26 Apr 2007) Log Message: ----------- avoid to use the createMenu method during initialization Modified Paths: -------------- 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/MenuAdapter.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2007-04-26 04:54:49 UTC (rev 386) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2007-04-26 15:26:41 UTC (rev 387) @@ -13,15 +13,27 @@ * ***************************************************************************/ package org.cishell.reference.gui.menumanager.menu; +//Java import java.util.HashMap; import java.util.Map; import java.io.File; import java.io.IOException; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +//CIShell import org.cishell.framework.CIShellContext; import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.algorithm.AlgorithmProperty; + +//Eclipse import org.eclipse.jface.action.Action; import org.eclipse.jface.action.GroupMarker; import org.eclipse.jface.action.IContributionItem; @@ -34,6 +46,8 @@ import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; + +//OSGi import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; import org.osgi.framework.InvalidSyntaxException; @@ -42,15 +56,7 @@ import org.osgi.framework.ServiceReference; import org.osgi.service.log.LogService; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - /* * Bonnie's comments: * weird, why implements AlgorithmProperty? It does not define any abstract interface. @@ -86,6 +92,7 @@ private static String PRESERVED_BREAK = "break"; private static String PRESERVED_EXIT = "Exit"; private static String PRESERVED_SERVICE_PID="service.pid"; + private static String PRESERVED = "preserved"; @@ -112,7 +119,7 @@ createMenuFromXML(); processLeftServiceBundles(); Display.getDefault().asyncExec(updateAction); - + // initializeMenu(); } catch (InvalidSyntaxException e) { getLog().log(LogService.LOG_ERROR, "Invalid Syntax", e); @@ -136,7 +143,7 @@ } else{ String pid = (String)refs[i].getProperty(PRESERVED_SERVICE_PID); - System.out.println("pid="+pid); +// System.out.println("pid="+pid); pidToServiceReferenceMap.put(pid.toLowerCase().trim(), refs[i]); pidToServiceReferenceMapCopy.put(pid.toLowerCase().trim(), refs[i]); } @@ -163,30 +170,38 @@ } } } + private void processTopMenu (Element topMenuNode){ - MenuManager topMenuBar; - + MenuManager topMenuBar; + //First create and add topMenuBar to the menuBar String topMenuName = topMenuNode.getAttribute(ATTR_NAME); - if (topMenuName.equalsIgnoreCase("file")) - topMenuBar= createMenu("&File", IWorkbenchActionConstants.M_FILE); + if (topMenuName.equalsIgnoreCase("file")){ + topMenuBar= new MenuManager("&File", IWorkbenchActionConstants.M_FILE); + } else if (topMenuName.equalsIgnoreCase("help")){ - topMenuBar= createMenu("&Help", + topMenuBar= new MenuManager("&Help", IWorkbenchActionConstants.M_HELP); - //allow to append new top leve menu before "Help" + //allow to append new top level menu before "Help" menuBar.add(new GroupMarker(START_GROUP)); menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); menuBar.add(new GroupMarker(END_GROUP)); + //allow to append new sub menu under "Help" and before "/Help/About" + topMenuBar.add(new GroupMarker(START_GROUP)); + topMenuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + topMenuBar.add(new GroupMarker(END_GROUP)); + IWorkbenchAction aboutAction = ActionFactory.ABOUT.create(window); topMenuBar.add(new Separator()); - topMenuBar.add(aboutAction); + topMenuBar.add(aboutAction); + } - else - topMenuBar= createMenu(topMenuName, topMenuName.toLowerCase()); + else { + topMenuBar= new MenuManager(topMenuName, topMenuName.toLowerCase()); + } - menuBar.add(topMenuBar); - + menuBar.add(topMenuBar); //Second process submenu processSubMenu(topMenuNode, topMenuBar); } @@ -207,7 +222,8 @@ continue; String menu_type = el.getAttribute(ATTR_TYPE); - if (menu_type == null || menu_type.length()==0){ + String pid=el.getAttribute(ATTR_PID); + if ((menu_type == null || menu_type.length()==0)&& pid !=null){ processAMenuNode(el, parentMenuBar); } else if (menu_type.equalsIgnoreCase(PRESERVED_GROUP)){ @@ -221,16 +237,17 @@ //such as double separators, a separator at the top or bottom parentMenuBar.add(new Separator()); } - else if (menu_type.equalsIgnoreCase("preserved")){ + else if (menu_type.equalsIgnoreCase(PRESERVED)){ String menuName = el.getAttribute(ATTR_NAME); if(menuName.equalsIgnoreCase(PRESERVED_EXIT) ){ - //allow to add more menu before "Exit" + //allow to add more menu before "File/Exit" if(parentMenuBar.getId().equalsIgnoreCase(IWorkbenchActionConstants.M_FILE)){ parentMenuBar.add(new GroupMarker(START_GROUP)); parentMenuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); parentMenuBar.add(new GroupMarker(END_GROUP)); } IWorkbenchAction exitAction = ActionFactory.QUIT.create(window); + parentMenuBar.add(new Separator()); parentMenuBar.add(exitAction); } } @@ -244,7 +261,9 @@ parentMenuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); parentMenuBar.add(new GroupMarker(END_GROUP)); } - } + + } + } /* @@ -315,11 +334,10 @@ ServiceReference ref= (ServiceReference) pidToServiceReferenceMap.get((String)keys[i]); makeMenuItem(ref); - } - - } - + } + } } + /* private void initializeMenu() throws InvalidSyntaxException{ ServiceReference[] refs = bContext.getAllServiceReferences( @@ -338,7 +356,7 @@ public void serviceChanged(ServiceEvent event) { switch (event.getType()) { case ServiceEvent.REGISTERED: - System.out.println(">>>receive ServiceEvent.Registered"); +// System.out.println(">>>receive ServiceEvent.Registered"); makeMenuItem(event.getServiceReference()); break; case ServiceEvent.UNREGISTERING: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-04-26 04:54:51
|
Revision: 386 http://svn.sourceforge.net/cishell/?rev=386&view=rev Author: huangb Date: 2007-04-25 21:54:49 -0700 (Wed, 25 Apr 2007) Log Message: ----------- Load the menu layout from default_menu.xml Modified Paths: -------------- 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/MenuAdapter.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2007-04-26 04:53:38 UTC (rev 385) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/MenuAdapter.java 2007-04-26 04:54:49 UTC (rev 386) @@ -15,7 +15,10 @@ import java.util.HashMap; import java.util.Map; +import java.io.File; +import java.io.IOException; + import org.cishell.framework.CIShellContext; import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.algorithm.AlgorithmProperty; @@ -24,8 +27,13 @@ import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; import org.osgi.framework.InvalidSyntaxException; @@ -34,7 +42,19 @@ import org.osgi.framework.ServiceReference; import org.osgi.service.log.LogService; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +/* + * Bonnie's comments: + * weird, why implements AlgorithmProperty? It does not define any abstract interface. + */ public class MenuAdapter implements AlgorithmProperty { private IMenuManager menuBar; private Shell shell; @@ -43,43 +63,282 @@ private Map algorithmToItemMap; private Map itemToParentMap; private ContextListener listener; + private IWorkbenchWindow window; + /* + * This map holds a pid as a key and the corresponding + * ServiceReference as a value. + */ + private Map pidToServiceReferenceMap; + private Map pidToServiceReferenceMapCopy; + private Document dom; + private static File DirForDefaultMenuXMLFile; + private static String DEFAULT_MENU_FILE_NAME = "default_menu.xml"; + + /* + * The following section specify the tags in the default_menu.xml + */ + private static String TAG_TOP_MENU = "top_menu"; + private static String TAG_MENU = "menu"; + private static String ATTR_TYPE = "type"; + private static String ATTR_NAME = "name"; + private static String ATTR_PID = "pid"; + private static String PRESERVED_GROUP = "group"; + private static String PRESERVED_BREAK = "break"; + private static String PRESERVED_EXIT = "Exit"; + private static String PRESERVED_SERVICE_PID="service.pid"; + + public MenuAdapter(IMenuManager menu, Shell shell, - BundleContext bContext,CIShellContext ciContext) { + BundleContext bContext,CIShellContext ciContext, + IWorkbenchWindow window) { this.menuBar = menu; this.shell = shell; this.bContext = bContext; this.ciContext = ciContext; + this.window = window; this.algorithmToItemMap = new HashMap(); this.itemToParentMap = new HashMap(); - + pidToServiceReferenceMap = new HashMap(); + pidToServiceReferenceMapCopy = new HashMap(); + String filter = "(" + Constants.OBJECTCLASS + "=" + AlgorithmFactory.class.getName() + ")"; try { listener = new ContextListener(); bContext.addServiceListener(listener, filter); - initializeMenu(); + preprocessServiceBundles(); + createMenuFromXML(); + processLeftServiceBundles(); + Display.getDefault().asyncExec(updateAction); + +// initializeMenu(); } catch (InvalidSyntaxException e) { getLog().log(LogService.LOG_ERROR, "Invalid Syntax", e); } } - private void initializeMenu() throws InvalidSyntaxException{ + /* + * This method scans all service bundles. If a bundle specifies + * menu_path, get service.pid of this bundle (key), let the service + * reference as the value, and put key/value pair + * to pidToServiceReferenceMap for further process. + */ + private void preprocessServiceBundles() throws InvalidSyntaxException{ ServiceReference[] refs = bContext.getAllServiceReferences( AlgorithmFactory.class.getName(), null); - - if (refs != null) { + if (refs != null){ + for (int i=0; i < refs.length; i++) { + String path = (String)refs[i].getProperty(MENU_PATH); + if (path == null){ + continue; + } + else{ + String pid = (String)refs[i].getProperty(PRESERVED_SERVICE_PID); + System.out.println("pid="+pid); + pidToServiceReferenceMap.put(pid.toLowerCase().trim(), refs[i]); + pidToServiceReferenceMapCopy.put(pid.toLowerCase().trim(), refs[i]); + } + } + } + + } + /* + * Parse default_menu.xml file. For each menu node, get the value of the attribut "pid" + * check if the pid exists in pidToServiceReferenceMap. If so, get the action and add to the parent menu + * If not, ignore this menu. At the end of each top menu or subgroup menu or before help menu, + * add "additions" so that new algorithms can be added on later + */ + private void createMenuFromXML() throws InvalidSyntaxException{ + parseXmlFile(); + //get the root elememt + Element docEle = dom.getDocumentElement(); + //get a nodelist of the top menu elements + NodeList topMenuList = docEle.getElementsByTagName(TAG_TOP_MENU); + if(topMenuList != null && topMenuList.getLength() > 0) { + for(int i = 0 ; i < topMenuList.getLength();i++) { + Element el = (Element)topMenuList.item(i); + processTopMenu(el); + } + } + } + private void processTopMenu (Element topMenuNode){ + MenuManager topMenuBar; + + //First create and add topMenuBar to the menuBar + String topMenuName = topMenuNode.getAttribute(ATTR_NAME); + if (topMenuName.equalsIgnoreCase("file")) + topMenuBar= createMenu("&File", IWorkbenchActionConstants.M_FILE); + else if (topMenuName.equalsIgnoreCase("help")){ + topMenuBar= createMenu("&Help", + IWorkbenchActionConstants.M_HELP); + //allow to append new top leve menu before "Help" + menuBar.add(new GroupMarker(START_GROUP)); + menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + menuBar.add(new GroupMarker(END_GROUP)); + + IWorkbenchAction aboutAction = ActionFactory.ABOUT.create(window); + topMenuBar.add(new Separator()); + topMenuBar.add(aboutAction); + } + else + topMenuBar= createMenu(topMenuName, topMenuName.toLowerCase()); + + menuBar.add(topMenuBar); + + //Second process submenu + processSubMenu(topMenuNode, topMenuBar); + } + + /* + * Recursively process sub menu and group menu + */ + private void processSubMenu (Element menuNode, MenuManager parentMenuBar){ + + NodeList subMenuList = menuNode.getElementsByTagName(TAG_MENU); + if(subMenuList != null && subMenuList.getLength() > 0) { + for(int i = 0 ; i < subMenuList.getLength();i++) { + Element el = (Element)subMenuList.item(i); + + //only process direct children nodes and + //drop all grand or grand of grand children nodes + if (!el.getParentNode().equals(menuNode)) + continue; + + String menu_type = el.getAttribute(ATTR_TYPE); + if (menu_type == null || menu_type.length()==0){ + processAMenuNode(el, parentMenuBar); + } + else if (menu_type.equalsIgnoreCase(PRESERVED_GROUP)){ + String groupName = el.getAttribute(ATTR_NAME); + MenuManager groupMenuBar = new MenuManager(groupName, groupName.toLowerCase()); + parentMenuBar.add(groupMenuBar); + processSubMenu(el, groupMenuBar); + } + else if (menu_type.equalsIgnoreCase(PRESERVED_BREAK)){ + //It seems that Framework automatially takes care of issues + //such as double separators, a separator at the top or bottom + parentMenuBar.add(new Separator()); + } + else if (menu_type.equalsIgnoreCase("preserved")){ + String menuName = el.getAttribute(ATTR_NAME); + if(menuName.equalsIgnoreCase(PRESERVED_EXIT) ){ + //allow to add more menu before "Exit" + if(parentMenuBar.getId().equalsIgnoreCase(IWorkbenchActionConstants.M_FILE)){ + parentMenuBar.add(new GroupMarker(START_GROUP)); + parentMenuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + parentMenuBar.add(new GroupMarker(END_GROUP)); + } + IWorkbenchAction exitAction = ActionFactory.QUIT.create(window); + parentMenuBar.add(exitAction); + } + } + } + //allow to append new submenu(s) at the bottom under each top menu + //except "File" and "Help" + if(!parentMenuBar.getId().equalsIgnoreCase(IWorkbenchActionConstants.M_FILE)&& + !parentMenuBar.getId().equalsIgnoreCase(IWorkbenchActionConstants.M_HELP)) + { + parentMenuBar.add(new GroupMarker(START_GROUP)); + parentMenuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + parentMenuBar.add(new GroupMarker(END_GROUP)); + } + } + } + + /* + * process a menu (algorithm) + */ + private void processAMenuNode(Element menuNode, MenuManager parentMenuBar ){ + String menuName = menuNode.getAttribute(ATTR_NAME); + String pid = menuNode.getAttribute(ATTR_PID); +// System.out.println(">>>pid="+pid); + if (pid == null || pid.length()==0){ + //check if the name is one of the preserved one + //if so add the default action + + } + else{ + //check if the pid has registered in pidToServiceReferenceMap + if (pidToServiceReferenceMapCopy.containsKey(pid.toLowerCase().trim())){ + ServiceReference ref = (ServiceReference) pidToServiceReferenceMapCopy. + get(pid.toLowerCase().trim()); + pidToServiceReferenceMap.remove(pid.toLowerCase().trim()); + AlgorithmAction action = new AlgorithmAction(ref, bContext, ciContext); + action.setId(getItemID(ref)); + action.setText(menuName); + parentMenuBar.add(action); + } + else{ + //otherwise log the error + getLog().log(LogService.LOG_WARNING, + "Can not find an algorithm package associated with Menu: " + +menuName+" and pid: " +pid+ ". Skip to show it on the menu."); + } + } + } + + private void parseXmlFile(){ + //get the factory + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + + try { + //Using factory get an instance of document builder + DocumentBuilder db = dbf.newDocumentBuilder(); + + //parse using builder to get DOM representation of the XML file + if (DirForDefaultMenuXMLFile == null) { + DirForDefaultMenuXMLFile = new File(System.getProperty("user.dir") + File.separator + "configuration"); + } + String fullpath=DirForDefaultMenuXMLFile.getPath()+File.separator+DEFAULT_MENU_FILE_NAME; +// System.out.println(">>parse file: "+fullpath); + dom = db.parse(fullpath); + + }catch(ParserConfigurationException pce) { + pce.printStackTrace(); + }catch(SAXException se) { + se.printStackTrace(); + }catch(IOException ioe) { + ioe.printStackTrace(); + } + } + + /* + * Handle some service bundles that have specified the menu_path and label + * but not specified in the default_menu.xml + */ + private void processLeftServiceBundles(){ + if (!pidToServiceReferenceMap.isEmpty()){ + Object[] keys = pidToServiceReferenceMap.keySet().toArray(); + for (int i=0; i<keys.length; i++){ + ServiceReference ref= (ServiceReference) + pidToServiceReferenceMap.get((String)keys[i]); + makeMenuItem(ref); + } + + } + + } +/* + private void initializeMenu() throws InvalidSyntaxException{ + ServiceReference[] refs = bContext.getAllServiceReferences( + AlgorithmFactory.class.getName(), null); + + if (refs != null) { for (int i=0; i < refs.length; i++) { makeMenuItem(refs[i]); } } - } + + } +*/ private class ContextListener implements ServiceListener { public void serviceChanged(ServiceEvent event) { switch (event.getType()) { case ServiceEvent.REGISTERED: + System.out.println(">>>receive ServiceEvent.Registered"); makeMenuItem(event.getServiceReference()); break; case ServiceEvent.UNREGISTERING: @@ -143,7 +402,7 @@ }; private String getItemID(ServiceReference ref) { - return ref.getProperty("PID:" + Constants.SERVICE_PID) + "-SID:" + + return ref.getProperty("PID:" + Constants.SERVICE_PID) + "-SID:" + ref.getProperty(Constants.SERVICE_ID); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-04-26 04:53:40
|
Revision: 385 http://svn.sourceforge.net/cishell/?rev=385&view=rev Author: huangb Date: 2007-04-25 21:53:38 -0700 (Wed, 25 Apr 2007) Log Message: ----------- Add a new constructor which allow to input the label/text of an AlgorithmAction 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 2007-04-26 04:50:11 UTC (rev 384) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java 2007-04-26 04:53:38 UTC (rev 385) @@ -55,8 +55,27 @@ dataManager.addDataManagerListener(this); dataSelected(dataManager.getSelectedData()); + } + public AlgorithmAction(String label, ServiceReference ref, BundleContext bContext, CIShellContext ciContext) { + this.ref = ref; + this.ciContext = ciContext; + this.bContext = bContext; + + setText(label); + setToolTipText((String)ref.getProperty(AlgorithmProperty.DESCRIPTION)); + + DataManagerService dataManager = (DataManagerService) + bContext.getService(bContext.getServiceReference( + DataManagerService.class.getName())); + + dataManager.addDataManagerListener(this); + dataSelected(dataManager.getSelectedData()); + } + + + public void run() { //hmm... should probably change this.. maybe use the scheduler... new Thread("Menu Item Runner") { @@ -225,4 +244,8 @@ public void dataAdded(Data data, String label) {} public void dataLabelChanged(Data data, String label) {} public void dataRemoved(Data data) {} + + public ServiceReference getServiceReference(){ + return ref; + } } \ 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: <hu...@us...> - 2007-04-26 04:50:15
|
Revision: 384 http://svn.sourceforge.net/cishell/?rev=384&view=rev Author: huangb Date: 2007-04-25 21:50:11 -0700 (Wed, 25 Apr 2007) Log Message: ----------- pass IWorkbenchWindow object to MenuAdapter Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/Activator.java Modified: trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/Activator.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/Activator.java 2007-04-26 04:47:41 UTC (rev 383) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/Activator.java 2007-04-26 04:50:11 UTC (rev 384) @@ -10,7 +10,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IStartup; import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PlatformUI; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; @@ -55,7 +54,7 @@ IMenuManager menuManager = CIShellApplication.getMenuManager(); CIShellContext ciContext = new LocalCIShellContext(context); - menuAdapter = new MenuAdapter(menuManager,shell,context,ciContext); + menuAdapter = new MenuAdapter(menuManager,shell,context,ciContext, windows[0]); try { //Fix to make swing based algorithms work on Macs This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 383 http://svn.sourceforge.net/cishell/?rev=383&view=rev Author: huangb Date: 2007-04-25 21:47:41 -0700 (Wed, 25 Apr 2007) Log Message: ----------- remove code that initializes the top level menus Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/ApplicationActionBarAdvisor.java Modified: trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/ApplicationActionBarAdvisor.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/ApplicationActionBarAdvisor.java 2007-04-04 22:54:11 UTC (rev 382) +++ trunk/clients/gui/org.cishell.reference.gui.workspace/src/org/cishell/reference/gui/workspace/ApplicationActionBarAdvisor.java 2007-04-26 04:47:41 UTC (rev 383) @@ -1,10 +1,7 @@ package org.cishell.reference.gui.workspace; -import org.eclipse.jface.action.GroupMarker; + import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.ui.IWorkbenchActionConstants; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; @@ -22,7 +19,7 @@ // them in the fill methods. This ensures that the actions aren't recreated // when fillActionBars is called with FILL_PROXY. private IWorkbenchAction exitAction; - private IWorkbenchAction aboutAction; + private IWorkbenchAction aboutAction; public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) { super(configurer); @@ -39,52 +36,12 @@ register(exitAction); aboutAction = ActionFactory.ABOUT.create(window); - register(aboutAction); + register(aboutAction); } protected void fillMenuBar(IMenuManager menuBar) { CIShellApplication.setMenuManager(menuBar); - - MenuManager fileMenu = createMenu("&File", - IWorkbenchActionConstants.M_FILE); - MenuManager helpMenu = createMenu("&Help", - IWorkbenchActionConstants.M_HELP); - menuBar.add(fileMenu); - - //Pre-adding menus so they show up in this order... - createAndAddMenu(menuBar, "Preprocessing", "preprocessing"); - createAndAddMenu(menuBar, "Modeling", "modeling"); - createAndAddMenu(menuBar, "Analysis", "analysis"); - createAndAddMenu(menuBar, "Visualization", "visualization"); - createAndAddMenu(menuBar, "Converters", "converters"); - createAndAddMenu(menuBar, "Toolkits", "toolkits"); - createAndAddMenu(menuBar, "Tools", "tools"); - - menuBar.add(new GroupMarker("start")); - menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); - menuBar.add(new GroupMarker("end")); - menuBar.add(helpMenu); - - //File menu items - fileMenu.add(exitAction); - - //Help menu items - helpMenu.add(new Separator()); - helpMenu.add(aboutAction); } - private void createAndAddMenu(IMenuManager menuBar, String text, String id) { - MenuManager menu = createMenu(text, id); - menuBar.add(menu); - } - - private MenuManager createMenu(String text, String id) { - MenuManager menu = new MenuManager(text, id); - menu.add(new GroupMarker("start")); - menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); - menu.add(new GroupMarker("end")); - - return menu; - } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Russell D. <rd...@in...> - 2007-04-04 23:01:58
|
And of course, by METADAT.XML I meant METADATA.XML . . . really, it was intentional, I swear. Russell On Apr 4, 2007, at 6:54 PM, fu...@us... wrote: > Revision: 382 > http://svn.sourceforge.net/cishell/?rev=382&view=rev > Author: fugu13 > Date: 2007-04-04 15:54:11 -0700 (Wed, 04 Apr 2007) > > Log Message: > ----------- > Added a space to the METADAT.XML template after the description > variable, > which I verified appears in the output. I tried doing this more > elegantly > in code, but Bruce is right, for some reason stuff just doesn't > seem to > work; it has something to do with the multiple levels of indirection > and redirection occurring with getValue, I think. > > Modified Paths: > -------------- > trunk/templates/org.cishell.templates.wizards/templates_3.0/ > java_algorithm/OSGI-INF/metatype/METADATA.XML > > Modified: trunk/templates/org.cishell.templates.wizards/ > templates_3.0/java_algorithm/OSGI-INF/metatype/METADATA.XML > =================================================================== > --- trunk/templates/org.cishell.templates.wizards/templates_3.0/ > java_algorithm/OSGI-INF/metatype/METADATA.XML 2007-03-15 21:39:40 > UTC (rev 381) > +++ trunk/templates/org.cishell.templates.wizards/templates_3.0/ > java_algorithm/OSGI-INF/metatype/METADATA.XML 2007-04-04 22:54:11 > UTC (rev 382) > @@ -1,7 +1,7 @@ > <?xml version="1.0" encoding="UTF-8"?> > <metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/ > metatype/v1.0.0"> > <OCD name="$algName$" id="$algFullClass$.OCD" > - description="$algDesc$"> > + description="$algDesc$ "> > $attributeDefinitions$ </OCD> > <Designate pid="$algFullClass$"> > <Object ocdref="$algFullClass$.OCD" /> > > > This was sent by the SourceForge.net collaborative development > platform, the world's largest Open Source development site. > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Cishell-svn mailing list > Cis...@li... > https://lists.sourceforge.net/lists/listinfo/cishell-svn |
From: <fu...@us...> - 2007-04-04 22:54:14
|
Revision: 382 http://svn.sourceforge.net/cishell/?rev=382&view=rev Author: fugu13 Date: 2007-04-04 15:54:11 -0700 (Wed, 04 Apr 2007) Log Message: ----------- Added a space to the METADAT.XML template after the description variable, which I verified appears in the output. I tried doing this more elegantly in code, but Bruce is right, for some reason stuff just doesn't seem to work; it has something to do with the multiple levels of indirection and redirection occurring with getValue, I think. Modified Paths: -------------- trunk/templates/org.cishell.templates.wizards/templates_3.0/java_algorithm/OSGI-INF/metatype/METADATA.XML Modified: trunk/templates/org.cishell.templates.wizards/templates_3.0/java_algorithm/OSGI-INF/metatype/METADATA.XML =================================================================== --- trunk/templates/org.cishell.templates.wizards/templates_3.0/java_algorithm/OSGI-INF/metatype/METADATA.XML 2007-03-15 21:39:40 UTC (rev 381) +++ trunk/templates/org.cishell.templates.wizards/templates_3.0/java_algorithm/OSGI-INF/metatype/METADATA.XML 2007-04-04 22:54:11 UTC (rev 382) @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <metatype:MetaData xmlns:metatype="http://www.osgi.org/xmlns/metatype/v1.0.0"> <OCD name="$algName$" id="$algFullClass$.OCD" - description="$algDesc$"> + description="$algDesc$ "> $attributeDefinitions$ </OCD> <Designate pid="$algFullClass$"> <Object ocdref="$algFullClass$.OCD" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-03-15 21:39:42
|
Revision: 381 http://svn.sourceforge.net/cishell/?rev=381&view=rev Author: huangb Date: 2007-03-15 14:39:40 -0700 (Thu, 15 Mar 2007) Log Message: ----------- Clean up code a bit Modified Paths: -------------- 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/LogToFile.java 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.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 2007-03-15 21:33:40 UTC (rev 380) +++ trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/Activator.java 2007-03-15 21:39:40 UTC (rev 381) @@ -3,10 +3,8 @@ import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; -import org.osgi.service.log.LogEntry; import org.osgi.service.log.LogListener; import org.osgi.service.log.LogReaderService; -import org.osgi.service.log.LogService; import org.osgi.framework.ServiceReference; /** Modified: trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogToFile.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogToFile.java 2007-03-15 21:33:40 UTC (rev 380) +++ trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogToFile.java 2007-03-15 21:39:40 UTC (rev 381) @@ -4,7 +4,6 @@ import org.osgi.service.log.LogEntry; import org.osgi.service.log.LogListener; -import org.osgi.service.log.LogService; import java.util.Calendar; import java.util.logging.FileHandler; @@ -14,7 +13,7 @@ import java.io.IOException; /** - * This is a basic implementation. It write log records to files + * This is a basic implementation. It writes log records to files * @author Weixia(Bonnie) Huang (hu...@in...) */ public class LogToFile implements LogListener { 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 2007-03-15 21:33:40 UTC (rev 380) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java 2007-03-15 21:39:40 UTC (rev 381) @@ -15,27 +15,22 @@ import java.util.ArrayList; import java.util.Arrays; -import java.util.Dictionary; -import java.util.Hashtable; import java.util.List; import org.cishell.app.service.datamanager.DataManagerListener; import org.cishell.app.service.datamanager.DataManagerService; import org.cishell.app.service.scheduler.SchedulerService; import org.cishell.framework.CIShellContext; -import org.cishell.framework.algorithm.AlgorithmFactory; import org.cishell.framework.algorithm.AlgorithmProperty; -import org.cishell.framework.algorithm.DataValidator; +//import org.cishell.framework.algorithm.DataValidator; import org.cishell.framework.data.Data; import org.cishell.service.conversion.Converter; import org.cishell.service.conversion.DataConversionService; -import org.cishell.service.guibuilder.GUIBuilderService; import org.eclipse.jface.action.Action; import org.osgi.framework.BundleContext; -import org.osgi.framework.Constants; +//import org.osgi.framework.Constants; import org.osgi.framework.ServiceReference; import org.osgi.service.log.LogService; -import org.osgi.service.metatype.MetaTypeProvider; public class AlgorithmAction extends Action implements AlgorithmProperty, DataManagerListener { @@ -182,7 +177,7 @@ //This method will be disabled until we can find a better solution //for extra validation beyond input/output checking - private boolean isValid() { +/* private boolean isValid() { String valid = null; String[] classes = (String[]) ref.getProperty(Constants.OBJECTCLASS); @@ -207,7 +202,7 @@ return valid == null || valid.length() == 0; } - +*/ private boolean isAsignableFrom(String type, Data datum) { Object data = datum.getData(); boolean assignable = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-03-15 21:33:42
|
Revision: 380 http://svn.sourceforge.net/cishell/?rev=380&view=rev Author: huangb Date: 2007-03-15 14:33:40 -0700 (Thu, 15 Mar 2007) Log Message: ----------- modify printParameters method -- adjust to log all input parameters in one block Modified Paths: -------------- trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 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 2007-03-15 21:32:35 UTC (rev 379) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmWrapper.java 2007-03-15 21:33:40 UTC (rev 380) @@ -147,17 +147,19 @@ if (logger != null) { if (!this.parameters.isEmpty()) { - logger.log(LogService.LOG_INFO, ""); - logger.log(LogService.LOG_INFO, "Input Parameters:"); + //adjust to log all input parameters in one block + StringBuffer inputParams = new StringBuffer("\n"+"Input Parameters:"); + for (Enumeration e = this.parameters.keys(); e .hasMoreElements();) { String key = (String) e.nextElement(); Object value = this.parameters.get(key); key = (String) idToLabelMap.get(key); + inputParams.append("\n"+key+": "+value); - logger.log(LogService.LOG_INFO, key+": "+value); } + logger.log(LogService.LOG_INFO, inputParams.toString()); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-03-15 21:32:38
|
Revision: 379 http://svn.sourceforge.net/cishell/?rev=379&view=rev Author: huangb Date: 2007-03-15 14:32:35 -0700 (Thu, 15 Mar 2007) Log Message: ----------- modify printAlgorithmInformation method --adjust to log the whole acknowledgement in one block 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 2007-03-15 21:30:57 UTC (rev 378) +++ trunk/clients/gui/org.cishell.reference.gui.menumanager/src/org/cishell/reference/gui/menumanager/menu/AlgorithmAction.java 2007-03-15 21:32:35 UTC (rev 379) @@ -93,32 +93,34 @@ } private void printAlgorithmInformation() { + //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"); if (label != null){ - logger.log(LogService.LOG_INFO, ".........."); - logger.log(LogService.LOG_INFO, label+" was selected."); + acknowledgement.append("..........\n"+ + label+" was selected.\n\n"); } String authors = (String)ref.getProperty("authors"); if (authors != null) - logger.log(LogService.LOG_INFO, "Author(s): "+authors); + acknowledgement.append("Author(s): "+authors+"\n"); String implementers = (String)ref.getProperty("implementers"); if (implementers != null) - logger.log(LogService.LOG_INFO, "Implementer(s): "+implementers); + acknowledgement.append("Implementer(s): "+implementers+"\n"); String integrators = (String)ref.getProperty("integrators"); if (integrators != null) - logger.log(LogService.LOG_INFO, "Integrator(s): "+integrators); + acknowledgement.append("Integrator(s): "+integrators+"\n"); String reference = (String)ref.getProperty("reference"); - String reference_url = (String)ref.getProperty("reference_url"); + String reference_url = (String)ref.getProperty("reference_url"); if (reference != null && reference_url != null ) - logger.log(LogService.LOG_INFO, "Reference: "+reference+ - " ("+reference_url+")"); + acknowledgement.append("Reference: "+reference+ + " ("+reference_url+")\n"); else if (reference != null && reference_url == null ) - logger.log(LogService.LOG_INFO, "Reference: "+reference); + acknowledgement.append("Reference: "+reference+"\n"); String docu = (String)ref.getProperty("docu"); if (docu != null) - logger.log(LogService.LOG_INFO, "Docu: "+docu); + acknowledgement.append("Docu: "+docu); + logger.log(LogService.LOG_INFO, acknowledgement.toString()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hu...@us...> - 2007-03-15 21:30:59
|
Revision: 378 http://svn.sourceforge.net/cishell/?rev=378&view=rev Author: huangb Date: 2007-03-15 14:30:57 -0700 (Thu, 15 Mar 2007) Log Message: ----------- exclude ")" from highlighted url. Modified Paths: -------------- 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/src/org/cishell/reference/gui/log/LogView.java =================================================================== --- trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogView.java 2007-03-15 21:28:27 UTC (rev 377) +++ trunk/clients/gui/org.cishell.reference.gui.log/src/org/cishell/reference/gui/log/LogView.java 2007-03-15 21:30:57 UTC (rev 378) @@ -228,7 +228,10 @@ if (index > -1) { String url = message.substring(index); - if (url.indexOf(" ") > -1) { + if (url.indexOf(") ") > -1) { + url = url.substring(0, url.indexOf(") ")); + } + else if (url.indexOf(" ") > -1) { url = url.substring(0, url.indexOf(" ")); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |