Skip to content

Commit e1ed15e

Browse files
Roberts temp (#11)
* inclusion of testplug in insilico, based on JSBML feature * testing integration * name change of plugin in building; rollback of JSBML plugin files * changed specifications * changed loading priority of testplug * changed project name from testplug to 'sbmlsheets' * moved core functionality to '.core'; added Spreadsheet class; added functionality to read csv and tsv as Spreadsheets Co-authored-by: RobertDeibel <[email protected]>
1 parent 23dac33 commit e1ed15e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+4507
-4
lines changed

bundles/.project

+5
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
<arguments>
1111
</arguments>
1212
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.pde.ds.core.builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
1318
</buildSpec>
1419
<natures>
1520
<nature>org.eclipse.m2e.core.maven2Nature</nature>
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>org.insilico.core</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.pde.ManifestBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.pde.SchemaBuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>org.eclipse.pde.ds.core.builder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
<buildCommand>
29+
<name>org.eclipse.m2e.core.maven2Builder</name>
30+
<arguments>
31+
</arguments>
32+
</buildCommand>
33+
</buildSpec>
34+
<natures>
35+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
36+
<nature>org.eclipse.jdt.core.javanature</nature>
37+
<nature>org.eclipse.pde.PluginNature</nature>
38+
</natures>
39+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<application:Application xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:application="http://www.eclipse.org/ui/2010/UIModel/application" xmi:id="_fa6nYRS-Eeii2_x8mUNL6A" elementId="org.insilico.core.application" bindingContexts="_fa6nYBS-Eeii2_x8mUNL6A">
3+
<handlers xmi:id="_R7ZhYEIoEeiFffabvctJGg" elementId="org.insilico.core.handler.project.create" contributionURI="bundleclass://org.insilico.core/org.insilico.core.handlers.CreateProjectHandler" command="_c9r4MEIqEeiFffabvctJGg"/>
4+
<handlers xmi:id="_eV0ssGEfEeiFLKNi0Omi7w" elementId="org.insilico.core.handler.file.move" command="_QvxJcGGdEeiFLKNi0Omi7w"/>
5+
<handlers xmi:id="_fhrkMHIoEei4d7vMJ5D9CA" elementId="org.insilico.core.handler.0" contributionURI="bundleclass://org.insilico.core/org.insilico.core.handlers.CreateEmptyFileHandler" command="_iNWgQHIoEei4d7vMJ5D9CA"/>
6+
<rootContext xmi:id="_fa6nYBS-Eeii2_x8mUNL6A" elementId="org.eclipse.ui.contexts.dialogAndWindow" name="In Dialog and Windows">
7+
<children xmi:id="_fa6nYhS-Eeii2_x8mUNL6A" elementId="org.eclipse.ui.contexts.window" name="In Windows"/>
8+
<children xmi:id="_fa6nYxS-Eeii2_x8mUNL6A" elementId="org.eclipse.ui.contexts.dialog" name="In Dialogs"/>
9+
</rootContext>
10+
<commands xmi:id="_c9r4MEIqEeiFffabvctJGg" elementId="org.insilico.core.command.project.create" commandName="Create Project" description="Creates a new project." category="_ru_TgGGeEeiFLKNi0Omi7w">
11+
<parameters xmi:id="_iSpKsEIqEeiFffabvctJGg" elementId="org.insilico.core.parameter.location" name="Project Location" optional="false"/>
12+
<parameters xmi:id="_sk4kgEO0EeiWeNpI5yJV_g" elementId="org.insilico.core.parameter.name" name="Project Name"/>
13+
</commands>
14+
<commands xmi:id="_QvxJcGGdEeiFLKNi0Omi7w" elementId="org.insilico.core.command.file.move" commandName="Move..." description="Move the selected item" category="_rhqeoGGdEeiFLKNi0Omi7w"/>
15+
<commands xmi:id="_iNWgQHIoEei4d7vMJ5D9CA" elementId="org.insilico.core.command.createemptyfile" commandName="Create Empty File" description="Creates a empty file." category="_rhqeoGGdEeiFLKNi0Omi7w">
16+
<parameters xmi:id="_UGCq4HJ2Eei4d7vMJ5D9CA" elementId="org.insilico.core.parameter.parent" name="Parent Project" optional="false"/>
17+
<parameters xmi:id="_XuzhUHJ2Eei4d7vMJ5D9CA" elementId="org.insilico.core.parameter.location" name="File Location" optional="false"/>
18+
<parameters xmi:id="_a6YFcHJ2Eei4d7vMJ5D9CA" elementId="org.insilico.core.parameter.progressmonitor" name="Progress Monitor"/>
19+
</commands>
20+
<addons xmi:id="_fa6nZBS-Eeii2_x8mUNL6A" elementId="org.eclipse.e4.core.commands.service" contributionURI="bundleclass://org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"/>
21+
<addons xmi:id="_fa6nZRS-Eeii2_x8mUNL6A" elementId="org.eclipse.e4.ui.contexts.service" contributionURI="bundleclass://org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"/>
22+
<addons xmi:id="_fa6nZhS-Eeii2_x8mUNL6A" elementId="org.eclipse.fx.ui.keybindings.e4.service" contributionURI="bundleclass://org.eclipse.fx.ui.keybindings.e4/org.eclipse.fx.ui.keybindings.e4.BindingServiceAddon"/>
23+
<addons xmi:id="_fa6nZxS-Eeii2_x8mUNL6A" elementId="org.eclipse.e4.ui.workbench.commands.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon"/>
24+
<addons xmi:id="_fa6naBS-Eeii2_x8mUNL6A" elementId="org.eclipse.e4.ui.workbench.contexts.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon"/>
25+
<addons xmi:id="_fa6naRS-Eeii2_x8mUNL6A" elementId="org.eclipse.fx.ui.keybindings.e4.model" contributionURI="bundleclass://org.eclipse.fx.ui.keybindings.e4/org.eclipse.fx.ui.keybindings.e4.BindingProcessingAddon"/>
26+
<addons xmi:id="_fa6nahS-Eeii2_x8mUNL6A" elementId="org.eclipse.e4.ui.workbench.addons.HandlerProcessingAddon" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.HandlerProcessingAddon"/>
27+
<categories xmi:id="_rhqeoGGdEeiFLKNi0Omi7w" elementId="org.insilico.core.category.file" name="File"/>
28+
<categories xmi:id="_vV3wEGGdEeiFLKNi0Omi7w" elementId="org.insilico.core.category.edit" name="Edit"/>
29+
<categories xmi:id="_x5KMMGGdEeiFLKNi0Omi7w" elementId="org.insilico.core.category.window" name="Window"/>
30+
<categories xmi:id="_12PFwGGdEeiFLKNi0Omi7w" elementId="org.insilico.core.category.help" name="Help"/>
31+
<categories xmi:id="_4mNTAGGdEeiFLKNi0Omi7w" elementId="org.insilico.core.category.navigation" name="Navigation"/>
32+
<categories xmi:id="_ru_TgGGeEeiFLKNi0Omi7w" elementId="org.insilico.core.category.project" name="Project"/>
33+
</application:Application>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Manifest-Version: 1.0
2+
Bundle-ManifestVersion: 2
3+
Bundle-Name: Core Application
4+
Bundle-SymbolicName: org.insilico.core;singleton:=true
5+
Bundle-Version: 1.0.0.qualifier
6+
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
7+
Bundle-Vendor: Draeger Lab
8+
Export-Package: org.insilico.core;uses:="org.eclipse.fx.ui.services.startup,org.eclipse.fx.ui.workbench.fx,org.eclipse.fx.core.app",
9+
org.insilico.core.handlers
10+
Bundle-ActivationPolicy: lazy
11+
Import-Package: javax.inject;version="1.0.0"
12+
Require-Bundle: org.eclipse.core.resources;bundle-version="3.11.1",
13+
org.eclipse.core.commands;bundle-version="3.8.0",
14+
org.eclipse.e4.core.commands;bundle-version="0.11.100",
15+
org.eclipse.core.runtime;bundle-version="3.12.0",
16+
org.eclipse.e4.core.contexts,
17+
org.eclipse.e4.core.di,
18+
org.eclipse.e4.core.services,
19+
org.eclipse.e4.ui.workbench,
20+
org.eclipse.e4.ui.model.workbench,
21+
org.eclipse.fx.ui.workbench.fx,
22+
org.eclipse.fx.ui.workbench.base;bundle-version="3.0.0",
23+
org.eclipse.fx.core;bundle-version="3.0.0",
24+
org.eclipse.core.databinding;bundle-version="1.6.0"
25+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
bin.includes = .,\
2+
META-INF/,\
3+
plugin.xml,\
4+
Application.e4xmi
5+
source.. = src/
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<?eclipse version="3.0"?>
3+
<plugin>
4+
<extension
5+
id="product"
6+
name="InSilico Core"
7+
point="org.eclipse.core.runtime.products">
8+
<product
9+
application="org.insilico.core.launcher"
10+
name="InSilico">
11+
<property
12+
name="appName"
13+
value="InSilico">
14+
</property>
15+
<property
16+
name="applicationXMI"
17+
value="org.insilico.core/Application.e4xmi">
18+
</property>
19+
<property
20+
name="cssTheme"
21+
value="org.insilico.ui.themes.light">
22+
</property>
23+
</product>
24+
</extension>
25+
<extension
26+
id="launcher"
27+
name="InSilico Core Launcher"
28+
point="org.eclipse.core.runtime.applications">
29+
<application
30+
cardinality="singleton-global"
31+
thread="main"
32+
visible="true">
33+
<run
34+
class="org.insilico.core.Main">
35+
</run>
36+
</application>
37+
</extension>
38+
</plugin>

bundles/org.insilico.core/bin/pom.xml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
4+
<parent>
5+
<groupId>org.insilico</groupId>
6+
<artifactId>org.insilico.bundles</artifactId>
7+
<version>1.0.0-SNAPSHOT</version>
8+
<relativePath>../</relativePath>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
<artifactId>org.insilico.core</artifactId>
12+
<packaging>eclipse-plugin</packaging>
13+
<name>Core Application</name>
14+
15+
<build>
16+
<sourceDirectory>src</sourceDirectory>
17+
18+
<resources>
19+
<resource>
20+
<directory>.</directory>
21+
<includes>
22+
<include>META-INF/</include>
23+
</includes>
24+
</resource>
25+
</resources>
26+
27+
<plugins>
28+
<plugin>
29+
<groupId>org.eclipse.tycho</groupId>
30+
<artifactId>tycho-source-plugin</artifactId>
31+
<version>${tycho.version}</version>
32+
</plugin>
33+
</plugins>
34+
</build>
35+
</project>

bundles/org.insilico.jsbml.core/.project

+6
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,14 @@
2525
<arguments>
2626
</arguments>
2727
</buildCommand>
28+
<buildCommand>
29+
<name>org.eclipse.m2e.core.maven2Builder</name>
30+
<arguments>
31+
</arguments>
32+
</buildCommand>
2833
</buildSpec>
2934
<natures>
35+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
3036
<nature>org.eclipse.pde.PluginNature</nature>
3137
<nature>org.eclipse.jdt.core.javanature</nature>
3238
</natures>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package org.insilico.jsbml.core;
2+
3+
public class CSVUtils {
4+
5+
6+
public static final boolean isCSVFile(String uri) {
7+
return uri.endsWith("csv");
8+
}
9+
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package org.insilico.jsbml.core.services.provider;
2+
3+
import static org.eclipse.fx.code.editor.Constants.DOCUMENT_URL;
4+
5+
import java.net.URI;
6+
import java.util.Map;
7+
import java.util.WeakHashMap;
8+
9+
import org.eclipse.core.runtime.URIUtil;
10+
import org.eclipse.e4.core.contexts.ContextFunction;
11+
import org.eclipse.e4.core.contexts.IContextFunction;
12+
import org.eclipse.e4.core.contexts.IEclipseContext;
13+
import org.eclipse.e4.core.di.IInjector;
14+
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
15+
import org.insilico.jsbml.core.CSVUtils;
16+
import org.osgi.service.component.annotations.Component;
17+
import javax.swing.text.PlainDocument;
18+
19+
20+
21+
/**
22+
* The {@link SBMLDocumentLoader} provides a {@link SBMLDocument} via dependency injection if the
23+
* current document is a sbml file.
24+
*
25+
* In oder to use this {@link IContextFunction} the context must store the location of a sbml file
26+
* with the key {@link org.eclipse.fx.code.editor.Constants#DOCUMENT_URL}. This context function
27+
* will only compute values for the contextKey
28+
* {@link org.insilico.jsbml.core.Constants#KEY_SBML_DOCUMENT}
29+
*
30+
* @author roman
31+
*
32+
*/
33+
@SuppressWarnings("restriction")
34+
@Component(service = IContextFunction.class,
35+
property = {"service.context.key=javax.swing.text.PlainDocument"})
36+
public class CSVDocumentLoader extends ContextFunction {
37+
// Stores weak reference to already loaded documents.
38+
Map<String, PlainDocument> cache = new WeakHashMap<>();
39+
40+
@Override
41+
public Object compute(IEclipseContext context, String contextKey) {
42+
System.out.println("Compute...");
43+
Object urlVal = context.get(DOCUMENT_URL);
44+
45+
if (urlVal == null) {
46+
Object partVal = context.get(MPart.class);
47+
if (partVal != null && partVal instanceof MPart) {
48+
MPart part = (MPart) partVal;
49+
urlVal = part.getPersistedState().get(DOCUMENT_URL);
50+
context.set(DOCUMENT_URL, urlVal);
51+
}
52+
}
53+
54+
// Check if a input file exists
55+
if (urlVal != null && urlVal instanceof String) {
56+
String urlString = (String) urlVal;
57+
urlString = urlString.replace("%20", " ");
58+
// Check cache
59+
PlainDocument doc = cache.get(urlString);
60+
61+
if (doc == null) {
62+
// Check if the document is a sbml file.
63+
if (!CSVUtils.isCSVFile(urlString)) {
64+
System.out.println("Not a csv file");
65+
return IInjector.NOT_A_VALUE;
66+
}
67+
68+
// Load if needed
69+
try {
70+
System.out.println("Try to read CSV file");
71+
//URI url = URIUtil.fromString(urlString);
72+
//doc = JSBML.readSBMLFromFile(url.getPath());
73+
// doc = SBMLReader.read(new File(url));
74+
//cache.put(urlString, doc);
75+
}
76+
catch (Exception e) {
77+
// Not a sbml file?
78+
e.printStackTrace();
79+
System.out.println("Reading failed");
80+
return IInjector.NOT_A_VALUE;
81+
}
82+
}
83+
84+
return doc;
85+
}
86+
87+
System.out.println("No doc selected");
88+
return IInjector.NOT_A_VALUE;
89+
}
90+
91+
}
92+

bundles/org.insilico.jsbml.core/src/org/insilico/jsbml/core/services/provider/SBMLDocumentLoader.java

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public class SBMLDocumentLoader extends ContextFunction {
4141
@Override
4242
public Object compute(IEclipseContext context, String contextKey) {
4343
System.out.println("Compute...");
44+
System.out.println(contextKey);
4445
Object urlVal = context.get(DOCUMENT_URL);
4546

4647
if (urlVal == null) {
@@ -87,4 +88,5 @@ public Object compute(IEclipseContext context, String contextKey) {
8788
System.out.println("No doc selected");
8889
return IInjector.NOT_A_VALUE;
8990
}
91+
9092
}

bundles/org.insilico.jsbml.core/src/org/insilico/jsbml/core/services/provider/SBMLEditorProvider.java

+1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ public boolean test(String t) {
2323
public String getBundleClassURI(String uri) {
2424
return "bundleclass://org.insilico.jsbml.core/" + DocumentTreeView.class.getName();
2525
}
26+
2627
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/bin/
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>org.insilico.sbmlsheets</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.pde.ManifestBuilder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.pde.SchemaBuilder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
<buildCommand>
24+
<name>org.eclipse.pde.ds.core.builder</name>
25+
<arguments>
26+
</arguments>
27+
</buildCommand>
28+
<buildCommand>
29+
<name>org.eclipse.m2e.core.maven2Builder</name>
30+
<arguments>
31+
</arguments>
32+
</buildCommand>
33+
</buildSpec>
34+
<natures>
35+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
36+
<nature>org.eclipse.pde.PluginNature</nature>
37+
<nature>org.eclipse.jdt.core.javanature</nature>
38+
</natures>
39+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Manifest-Version: 1.0
2+
Bundle-ManifestVersion: 2
3+
Bundle-Name: SBMLsheets
4+
Bundle-SymbolicName: org.insilico.sbmlsheets
5+
Bundle-Version: 1.0.0.qualifier
6+
Require-Bundle: org.eclipse.core.runtime,
7+
org.eclipse.fx.ui.services;bundle-version="3.0.0",
8+
org.eclipse.fx.code.editor;bundle-version="3.0.0",
9+
org.sbml.jsbml.core;bundle-version="1.3.1",
10+
org.eclipse.fx.code.editor.fx.e4;bundle-version="3.0.0",
11+
org.eclipse.e4.core.contexts;bundle-version="1.5.0",
12+
org.eclipse.e4.core.di;bundle-version="1.6.1",
13+
org.eclipse.e4.ui.model.workbench;bundle-version="1.2.0"
14+
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
15+
Bundle-ActivationPolicy: lazy
16+
Service-Component: OSGI-INF/services/org.insilico.sbmlsheets.services.provider.SBMLEditorProvider.xml,
17+
OSGI-INF/services/org.insilico.sbmlsheets.services.provider.SBMLIconProvider.xml,
18+
OSGI-INF/services/org.insilico.sbmlsheets.services.provider.SBMLDocumentLoader.xml,
19+
OSGI-INF/services/org.insilico.sbmlsheets.services.provider.SpreadsheetEditorProvider.xml,
20+
OSGI-INF/services/org.insilico.sbmlsheets.services.provider.SpreadsheetDocumentLoader.xml
21+
Export-Package: org.insilico.sbmlsheets.core,
22+
org.insilico.sbmlsheets.editor,
23+
org.insilico.sbmlsheets.services,
24+
org.insilico.sbmlsheets.services.provider

0 commit comments

Comments
 (0)