Skip to content

Commit dc81aff

Browse files
committed
Some changes before merge with modgraph branch.
1 parent 0d97293 commit dc81aff

File tree

93 files changed

+1017
-47
lines changed

Some content is hidden

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

93 files changed

+1017
-47
lines changed

.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>svn-coloane</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.m2e.core.maven2Builder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding/<project>=UTF-8

.settings/org.eclipse.m2e.core.prefs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1

apis/.project

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>apis-parent</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.m2e.core.maven2Builder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
16+
</natures>
17+
</projectDescription>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding/<project>=UTF-8
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1

apis/alligator/src/fr/lip6/move/coloane/api/alligator/RunService.java

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import org.cosyverif.alligator.service.Parameter;
4343
import org.cosyverif.alligator.service.parameter.FileParameter;
4444
import org.cosyverif.alligator.service.parameter.ModelParameter;
45+
import org.cosyverif.alligator.service.parameter.ModelSetParameter;
4546
import org.cosyverif.alligator.util.ParameterConversion;
4647
import org.eclipse.core.resources.IFile;
4748
import org.eclipse.core.runtime.IProgressMonitor;
@@ -141,7 +142,7 @@ public RunService(ServiceDescription service, Connection alligatorConnection) {
141142
for (Parameter<?> parameter : service.parameters()) {
142143
if (parameter.isInput()) {
143144
if (parameter instanceof ModelParameter) {
144-
IFile file = wizard.fileFor(parameter);
145+
IFile file = wizard.filesFor(parameter)[0];
145146
ModelParameter p = ModelParameter.of(parameter);
146147
ExportToGrML exporter = new ExportToGrML();
147148
LOGGER.info("Converting file '" + file + "' to GrML...");
@@ -150,9 +151,23 @@ public RunService(ServiceDescription service, Connection alligatorConnection) {
150151
temp.deleteOnExit();
151152
exporter.export(graph, temp.getAbsolutePath(), new NullProgressMonitor());
152153
p.setModelFromFile(temp);
154+
} else if (parameter instanceof ModelSetParameter) {
155+
IFile[] files = wizard.filesFor(parameter);
156+
ModelSetParameter p = ModelSetParameter.of(parameter);
157+
ExportToGrML exporter = new ExportToGrML();
158+
File[] converted = new File[files.length];
159+
for (int i = 0; i < files.length; ++i) {
160+
LOGGER.info("Converting file '" + files[i] + "' to GrML...");
161+
IGraph graph = ModelLoader.loadGraphFromXML(files[i]);
162+
File temp = File.createTempFile("coloane-exporter", ".grml");
163+
temp.deleteOnExit();
164+
exporter.export(graph, temp.getAbsolutePath(), new NullProgressMonitor());
165+
converted[i] = temp;
166+
}
167+
p.setModelsFromFiles(converted);
153168
} else if (parameter instanceof FileParameter && ((FileParameter) parameter).getContentType()
154169
.equalsIgnoreCase("lola")) {
155-
IFile file = wizard.fileFor(parameter);
170+
IFile file = wizard.filesFor(parameter)[0];
156171
FileParameter p = FileParameter.of(parameter);
157172
if (file.getFileExtension()
158173
.equalsIgnoreCase("lola")) {
@@ -168,7 +183,7 @@ public RunService(ServiceDescription service, Connection alligatorConnection) {
168183
}
169184
} else if (parameter instanceof FileParameter && ((FileParameter) parameter).getContentType()
170185
.equalsIgnoreCase("cami")) {
171-
IFile file = wizard.fileFor(parameter);
186+
IFile file = wizard.filesFor(parameter)[0];
172187
FileParameter p = FileParameter.of(parameter);
173188
if (file.getFileExtension()
174189
.equalsIgnoreCase("cami")) {
@@ -183,7 +198,7 @@ public RunService(ServiceDescription service, Connection alligatorConnection) {
183198
p.setFile(temp);
184199
}
185200
} else if (parameter instanceof FileParameter) {
186-
IFile file = wizard.fileFor(parameter);
201+
IFile file = wizard.filesFor(parameter)[0];
187202
FileParameter p = FileParameter.of(parameter);
188203
p.setFile(getFile(file));
189204
}

apis/alligator/src/fr/lip6/move/coloane/api/alligator/dialog/InputFileDialog.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ public InputFileDialog(FileParameter parameter) {
2020

2121
@Override
2222
protected
23-
boolean keepResource(IResource resource) {
23+
boolean
24+
keepResource(IResource resource) {
2425
if (parameter.getContentType()
2526
.equalsIgnoreCase("cami")) {
2627
return (resource instanceof IFile) && (resource.getFileExtension()
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
* Copyright (c) 2006-2010 MoVe - Laboratoire d'Informatique de Paris 6 (LIP6). All rights reserved. This program and the
3+
* accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this
4+
* distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: Jean-Baptiste VORON (LIP6) -
5+
* Project Head / Initial contributor Clément DÉMOULINS (LIP6) - Project Manager Official contacts: [email protected]
6+
* http://coloane.lip6.fr
7+
*/
8+
package fr.lip6.move.coloane.api.alligator.dialog;
9+
10+
import fr.lip6.move.coloane.core.ui.files.ModelLoader;
11+
import fr.lip6.move.coloane.extensions.exporttogrml.Activator;
12+
import fr.lip6.move.coloane.interfaces.formalism.IFormalism;
13+
14+
import java.net.URL;
15+
import java.util.Arrays;
16+
17+
import org.cosyverif.alligator.service.parameter.ModelParameter;
18+
import org.cosyverif.alligator.service.parameter.ModelSetParameter;
19+
import org.eclipse.core.resources.IFile;
20+
import org.eclipse.core.resources.IResource;
21+
import org.eclipse.core.runtime.IConfigurationElement;
22+
import org.eclipse.core.runtime.Platform;
23+
24+
public final class InputModelSetDialog
25+
extends InputResourceDialog<ModelSetParameter> {
26+
27+
public InputModelSetDialog(ModelSetParameter parameter) {
28+
super(parameter);
29+
}
30+
31+
@Override
32+
protected
33+
boolean
34+
keepResource(IResource resource) {
35+
if (resource instanceof IFile && resource.getName()
36+
.endsWith("model")) {
37+
if (parameter.getFormalisms() == null) {
38+
return true;
39+
}
40+
IFormalism formalism = ModelLoader.loadFormalismFromXML((IFile) resource);
41+
System.out.println("Formalism: " + Arrays.toString(parameter.getFormalisms()));
42+
System.out.println("Id: " + formalism.getId());
43+
System.out.println("Name: " + formalism.getName());
44+
if (formalism == null) {
45+
return false;
46+
}
47+
for (IConfigurationElement contribution : Arrays.asList(Platform.getExtensionRegistry()
48+
.getConfigurationElementsFor(Activator.EXTENSION_POINT_ID))) {
49+
String id = contribution.getAttribute(Activator.NAME_EXTENSION);
50+
String fml = contribution.getAttribute(Activator.FMLURL_EXTENSION);
51+
System.out.println(" id: " + id);
52+
System.out.println(" url: " + fml);
53+
for (URL f : parameter.getFormalisms()) {
54+
if (fml.equals(f.toString()) && formalism.getId()
55+
.equals(id)) {
56+
return true;
57+
}
58+
}
59+
}
60+
}
61+
return false;
62+
}
63+
64+
@Override
65+
public
66+
String errorMessage() {
67+
String result;
68+
if (checkboxTreeViewer.getCheckedElements().length >= 1) {
69+
result = null;
70+
error.setText("");
71+
} else {
72+
result = "At leas one resource must be selected.";
73+
error.setText(result);
74+
}
75+
return result;
76+
}
77+
78+
}

0 commit comments

Comments
 (0)