summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/XcosTab.java2
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/AbstractElement.java5
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/AnnotationElement.java29
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/BlockElement.java113
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/DiagramElement.java117
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/ImportAction.java113
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/ImportMdl.java54
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/InputPortElement.java37
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/LineElement.java22
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/Logger.java22
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/OutputPortElement.java40
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/SimulinkFormatException.java5
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/SimulinkParametrizedElement.java5
-rw-r--r--scilab/modules/xcos/src/java/org/scilab/modules/xcos/utils/XcosMessages.java1
14 files changed, 565 insertions, 0 deletions
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/XcosTab.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/XcosTab.java
index a0b018d..253ebbe 100644
--- a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/XcosTab.java
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/XcosTab.java
@@ -62,6 +62,7 @@ import org.scilab.modules.xcos.actions.DebugLevelAction;
62import org.scilab.modules.xcos.actions.DiagramBackgroundAction; 62import org.scilab.modules.xcos.actions.DiagramBackgroundAction;
63import org.scilab.modules.xcos.actions.ExportAction; 63import org.scilab.modules.xcos.actions.ExportAction;
64import org.scilab.modules.xcos.actions.FitDiagramToViewAction; 64import org.scilab.modules.xcos.actions.FitDiagramToViewAction;
65import org.scilab.modules.xcos.simulink.ImportAction;
65import org.scilab.modules.xcos.actions.InitModelicaAction; 66import org.scilab.modules.xcos.actions.InitModelicaAction;
66import org.scilab.modules.xcos.actions.NewDiagramAction; 67import org.scilab.modules.xcos.actions.NewDiagramAction;
67import org.scilab.modules.xcos.actions.NormalViewAction; 68import org.scilab.modules.xcos.actions.NormalViewAction;
@@ -326,6 +327,7 @@ public class XcosTab extends ScilabTab {
326 fileMenu.addSeparator(); 327 fileMenu.addSeparator();
327 fileMenu.add(SaveAction.createMenu(diagram)); 328 fileMenu.add(SaveAction.createMenu(diagram));
328 fileMenu.add(SaveAsAction.createMenu(diagram)); 329 fileMenu.add(SaveAsAction.createMenu(diagram));
330 fileMenu.add(ImportAction.createMenu(diagram));
329 fileMenu.add(ExportAction.createMenu(diagram)); 331 fileMenu.add(ExportAction.createMenu(diagram));
330 332
331 recentsMenu = ScilabMenu.createMenu(); 333 recentsMenu = ScilabMenu.createMenu();
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/AbstractElement.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/AbstractElement.java
new file mode 100644
index 0000000..a65e917
--- /dev/null
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/AbstractElement.java
@@ -0,0 +1,5 @@
1package org.scilab.modules.xcos.simulink;
2
3public class AbstractElement<T> {
4
5}
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/AnnotationElement.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/AnnotationElement.java
new file mode 100644
index 0000000..0924c4c
--- /dev/null
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/AnnotationElement.java
@@ -0,0 +1,29 @@
1package org.scilab.modules.xcos.simulink;
2
3import java.io.IOException;
4
5import org.apache.commons.logging.LogFactory;
6import org.scilab.modules.xcos.block.TextBlock;
7
8import edu.tum.cs.simulink.model.SimulinkAnnotation;
9import edu.tum.cs.simulink.model.SimulinkBlock;
10
11public class AnnotationElement extends AbstractElement<TextBlock>{
12
13 public boolean canDecode(SimulinkAnnotation data) {
14 // TODO Auto-generated method stub
15 return true;
16 }
17
18 public Object decode(SimulinkAnnotation from, Object object) {
19 // TODO Auto-generated method stub
20 try {
21 Logger.toFile("From " + from.getName() + ":");
22 Logger.toFile(from.getParameterNames().toString());
23 } catch(IOException e1) {
24 LogFactory.getLog(BlockElement.class).error(e1);
25 }
26 return null;
27 }
28
29}
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/BlockElement.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/BlockElement.java
new file mode 100644
index 0000000..6695246
--- /dev/null
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/BlockElement.java
@@ -0,0 +1,113 @@
1package org.scilab.modules.xcos.simulink;
2
3import java.io.IOException;
4import java.util.HashMap;
5import java.util.Map;
6
7import org.apache.commons.logging.LogFactory;
8import org.scilab.modules.xcos.block.BasicBlock;
9import org.scilab.modules.xcos.block.BlockFactory;
10import org.scilab.modules.xcos.simulink.InputPortElement;
11import org.scilab.modules.xcos.simulink.OutputPortElement;
12
13import com.mxgraph.model.mxCell;
14
15import edu.tum.cs.commons.collections.UnmodifiableIterator;
16import edu.tum.cs.simulink.model.SimulinkBlock;
17import edu.tum.cs.simulink.model.SimulinkInPort;
18import edu.tum.cs.simulink.model.SimulinkOutPort;
19
20public class BlockElement extends AbstractElement<BasicBlock> {
21 private SimulinkBlock base;
22 /** Map from index to blocks */
23 private final Map<Integer, BasicBlock> blocks;
24 /**
25 * Default constructor
26 */
27 public BlockElement() {
28 blocks = new HashMap<Integer, BasicBlock>();
29 }
30
31 /*
32 * here there will be some neccessery functions, checking if import is possible etc.
33 */
34
35 public BasicBlock decode(SimulinkBlock from, BasicBlock into) {
36 BasicBlock block = into;
37 base = from;
38 if (block == null) {
39 block = BlockFactory.createBlock(from.getId());
40 }
41
42 try {
43 Logger.toFile("From " + base.getName() + ":");
44 Logger.toFile(base.getParameterNames().toString());
45 } catch(IOException e1) {
46 LogFactory.getLog(BlockElement.class).error(e1);
47 }
48 /*
49 * TODO: SimulinkBlock decoding, parameters etc.
50 */
51 decodeParams(block);
52
53 return block;
54 }
55
56 private void decodeParams(BasicBlock block) {
57 // TODO Auto-generated method stub
58
59 /*
60 * Allocate and setup ports
61 */
62 OutputPortElement outElement = new OutputPortElement(base);
63 UnmodifiableIterator<SimulinkOutPort> portOutIter = base.getOutPorts().iterator();
64 while(portOutIter.hasNext()) {
65 //block.addPort(
66 outElement.decode(portOutIter.next(), null);
67 }
68
69 InputPortElement inElement = new InputPortElement(base);
70 UnmodifiableIterator<SimulinkInPort> portInIter = base.getInPorts().iterator();
71 while(portInIter.hasNext()) {
72 //block.addPort(
73 inElement.decode(portInIter.next(), null);
74 }
75
76 decodeSubBlocks(block);
77 }
78
79 private void decodeSubBlocks(BasicBlock block) {
80 /*
81 * TODO: remember about getting subsystems to work (below)
82 * add also everything about ports and lines to subsystems
83 */
84 double minimalYaxisValue = 0.0;
85 int i=0;
86
87 UnmodifiableIterator<SimulinkBlock> blockIter = base.getSubBlocks().iterator();
88 while(blockIter.hasNext()) {
89 SimulinkBlock data = blockIter.next();
90 Object cell = null;
91
92 if (this.canDecode(data)) {
93 BasicBlock subBlock = this.decode(data, null);
94 blocks.put(i, subBlock);
95 cell = subBlock;
96
97 minimalYaxisValue = Math.min(minimalYaxisValue, ((mxCell) cell).getGeometry().getY());
98 }
99
100 if (cell != null) {
101 // FIXME: How to create subsystem in existing block?
102 block.getParentDiagram().addCell(cell); //not that way for sure
103 }
104 i++;
105 }
106
107 }
108
109 public boolean canDecode(SimulinkBlock data) {
110 // TODO Auto-generated method stub
111 return true;
112 }
113}
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/DiagramElement.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/DiagramElement.java
new file mode 100644
index 0000000..5bbf554
--- /dev/null
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/DiagramElement.java
@@ -0,0 +1,117 @@
1package org.scilab.modules.xcos.simulink;
2
3import java.io.IOException;
4import java.util.HashMap;
5import java.util.Map;
6
7import org.apache.commons.logging.LogFactory;
8import org.scilab.modules.xcos.block.BasicBlock;
9import org.scilab.modules.xcos.graph.XcosDiagram;
10import org.scilab.modules.xcos.link.BasicLink;
11import org.scilab.modules.xcos.simulink.BlockElement;
12import org.scilab.modules.xcos.simulink.AnnotationElement;
13import com.mxgraph.model.mxCell;
14
15import edu.tum.cs.commons.collections.UnmodifiableIterator;
16import edu.tum.cs.simulink.model.SimulinkAnnotation;
17import edu.tum.cs.simulink.model.SimulinkBlock;
18import edu.tum.cs.simulink.model.SimulinkModel;
19
20public class DiagramElement extends AbstractElement<XcosDiagram> {
21
22 private SimulinkModel base;
23
24 /** Map from index to blocks */
25 private final Map<Integer, BasicBlock> blocks;
26 /**
27 * Default constructor
28 */
29 public DiagramElement() {
30 blocks = new HashMap<Integer, BasicBlock>();
31 }
32
33 public XcosDiagram decode(SimulinkModel from, XcosDiagram into)
34 throws SimulinkFormatException {
35 base = from;
36 XcosDiagram diag = into;
37 if (diag == null) {
38 diag = new XcosDiagram();
39 }
40
41 diag.getModel().beginUpdate();
42 decodeDiagram(diag);
43 diag.getModel().endUpdate();
44
45 return diag;
46 }
47
48 public void decodeDiagram(XcosDiagram diag) throws SimulinkFormatException {
49 // fill all diagram parameters
50 try {
51 Logger.toFile("From " + base.getName() + ":");
52 Logger.toFile(base.getParameterNames().toString());
53 } catch(IOException e1) {
54 LogFactory.getLog(BlockElement.class).error(e1);
55 }
56 decodeObjs(diag);
57 }
58
59 public void decodeObjs(XcosDiagram diag) throws SimulinkFormatException {
60 final BlockElement blockElement = new BlockElement();
61 final AnnotationElement annotationElement = new AnnotationElement();
62 //final LinkElement linkElement = new LinkElement(blocks);
63
64 double minimalYaxisValue = 0.0;
65 int i = 0;
66 //recursively get to all blocks, links and ports
67 /*
68 * Decode blocks
69 */
70 UnmodifiableIterator<SimulinkBlock> blockIter = base.getSubBlocks().iterator();
71 while(blockIter.hasNext()) {
72 SimulinkBlock data = blockIter.next();
73 Object cell = null;
74
75 if (blockElement.canDecode(data)) {
76 BasicBlock block = blockElement.decode(data, null);
77 blocks.put(i, block);
78 cell = block;
79
80 minimalYaxisValue = Math.min(minimalYaxisValue, ((mxCell) cell).getGeometry().getY());
81 }
82
83 if (cell != null) {
84 diag.addCell(cell);
85 }
86 i++;
87 }
88 /*
89 * Decode Annotations
90 */
91 i=0;
92 UnmodifiableIterator<SimulinkAnnotation> annotationIter = base.getAnnotations().iterator();
93 while(annotationIter.hasNext()) {
94 SimulinkAnnotation data = annotationIter.next();
95 Object cell = null;
96
97 if (annotationElement.canDecode(data)) {
98 cell = annotationElement.decode(data, null);
99
100 minimalYaxisValue = Math.min(minimalYaxisValue, ((mxCell) cell).getGeometry().getY());
101 }
102
103 if (cell != null) {
104 diag.addCell(cell);
105 }
106 i++;
107 }
108 /*
109 * Decode Links
110 * TODO: This should be done differently then in io.scicos
111 * there are inLines and outLines for each structure
112 * just like ports.
113 */
114
115 }
116}
117
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/ImportAction.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/ImportAction.java
new file mode 100644
index 0000000..e77d6ea
--- /dev/null
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/ImportAction.java
@@ -0,0 +1,113 @@
1/*
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2009 - DIGITEO - Vincent COUVERT
4 * Copyright (C) 2010 - DIGITEO - Clément DAVID
5 *
6 * This file must be used under the terms of the CeCILL.
7 * This source file is licensed as described in the file COPYING, which
8 * you should have received as part of this distribution. The terms
9 * are also available at
10 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
11 *
12 */
13
14package org.scilab.modules.xcos.simulink;
15
16import java.awt.Toolkit;
17import java.awt.event.ActionEvent;
18import java.awt.event.KeyEvent;
19import java.io.IOException;
20import java.util.Set;
21import java.util.TreeSet;
22
23import org.apache.commons.logging.LogFactory;
24import org.scilab.modules.graph.ScilabGraph;
25import org.scilab.modules.graph.actions.base.DefaultAction;
26import org.scilab.modules.gui.bridge.filechooser.SwingScilabFileChooser;
27import org.scilab.modules.gui.filechooser.FileChooser;
28import org.scilab.modules.gui.filechooser.ScilabFileChooser;
29import org.scilab.modules.gui.menuitem.MenuItem;
30import org.scilab.modules.xcos.utils.XcosMessages;
31
32import edu.tum.cs.simulink.builder.SimulinkModelBuildingException;
33
34//import edu.tum.cs.simulink.builder.SimulinkModelBuildingException;
35
36// FIXME: A lot to changes in this file, as it is only
37// changed ExportAction
38
39/**
40 * Diagram import action management
41 */
42public final class ImportAction extends DefaultAction {
43 /** Name of the action */
44 public static final String NAME = XcosMessages.IMPORT;
45 /** Icon name of the action */
46 public static final String SMALL_ICON = "";
47 /** Mnemonic key of the action */
48 public static final int MNEMONIC_KEY = KeyEvent.VK_L;
49 /** Accelerator key for the action */
50 public static final int ACCELERATOR_KEY = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
51
52 /**
53 * Constructor
54 * @param scilabGraph associated Scilab Graph
55 */
56 public ImportAction(ScilabGraph scilabGraph) {
57 super(scilabGraph);
58 }
59
60 /**
61 * Create export menu
62 * @param scilabGraph associated Scilab Graph
63 * @return the menu
64 */
65 public static MenuItem createMenu(ScilabGraph scilabGraph) {
66 return createMenu(scilabGraph, ImportAction.class);
67 }
68
69 /**
70 * Action !!!
71 * @param e parameter
72 * @see org.scilab.modules.graph.actions.base.DefaultAction#actionPerformed(java.awt.event.ActionEvent)
73 */
74 @Override
75 public void actionPerformed(ActionEvent e) {
76
77 String filename = null;
78
79 FileChooser fc = ScilabFileChooser.createFileChooser();
80
81 // The mask and mask description ordered collection
82 Set<String> mask = new TreeSet<String>();
83 Set<String> maskDesc = new TreeSet<String>();
84
85 /* FIXME : is .mdl the only possible extension ? */
86 mask.add(".mdl");
87
88 maskDesc.add("Simulink model");
89
90 // Adds filter that accepts all supported image formats
91 //fc.addChoosableFileFilter(new DefaultFileFilter.ImageFileFilter(mxResources.get("allImages")));
92
93 ((SwingScilabFileChooser) fc.getAsSimpleFileChooser()).addMask(mask.toArray(new String[mask.size()]) ,
94 maskDesc.toArray(new String[maskDesc.size()]));
95 fc.setTitle(XcosMessages.IMPORT);
96 fc.displayAndWait();
97
98 if (fc.getSelection() == null || fc.getSelection().length == 0 || fc.getSelection()[0].equals("")) {
99 return;
100 }
101
102 filename = fc.getSelection()[0];
103
104 try {
105 ImportMdl.fromFile(filename);
106 } catch (IOException e1) {
107 LogFactory.getLog(ImportAction.class).error(e1);
108 } catch (SimulinkModelBuildingException e2) {
109 LogFactory.getLog(ImportAction.class).error(e2);
110 }
111 }
112}
113
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/ImportMdl.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/ImportMdl.java
new file mode 100644
index 0000000..7a5584d
--- /dev/null
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/ImportMdl.java
@@ -0,0 +1,54 @@
1package org.scilab.modules.xcos.simulink;
2
3import java.io.File;
4import java.io.IOException;
5import java.util.Iterator;
6
7import edu.tum.cs.commons.collections.UnmodifiableIterator;
8import edu.tum.cs.commons.logging.SimpleLogger;
9import edu.tum.cs.simulink.builder.SimulinkModelBuilder;
10import edu.tum.cs.simulink.builder.SimulinkModelBuildingException;
11import edu.tum.cs.simulink.model.SimulinkBlock;
12import edu.tum.cs.simulink.model.SimulinkInPort;
13import edu.tum.cs.simulink.model.SimulinkLine;
14import edu.tum.cs.simulink.model.SimulinkModel;
15import edu.tum.cs.simulink.model.SimulinkOutPort;
16
17import org.apache.commons.logging.LogFactory;
18import org.scilab.modules.xcos.graph.XcosDiagram;
19import org.scilab.modules.xcos.simulink.Logger;
20import org.scilab.modules.xcos.simulink.DiagramElement;
21
22public class ImportMdl {
23 /**
24 * fromFile is a function that reads .mdl file, and logs all the model, blocks
25 * lines, ports parameters to file. This function gonna change, as Simulink import
26 * evolves.
27 * @param filename .mdl filename that we want to import
28 * @throws IOException
29 * @throws SimulinkModelBuildingException
30 */
31 public static void fromFile(String filename) throws IOException,SimulinkModelBuildingException {
32 SimulinkModelBuilder builder = new SimulinkModelBuilder(new File(
33 filename), new SimpleLogger());
34 SimulinkModel model = builder.buildModel();
35 DiagramElement diagram = new DiagramElement();
36 try {
37 XcosDiagram into = diagram.decode(model, null);
38 } catch(SimulinkFormatException e1) {
39 LogFactory.getLog(ImportMdl.class).error(e1);
40 Logger.toFile("EE: diagram.decode exception");
41 }
42 }
43 /**
44 *
45 * @param block
46 * block or model that will be added to Xcos Schema
47 */
48 public static void readSimulinkBlock(SimulinkBlock block) {
49 UnmodifiableIterator<SimulinkBlock> blockIter = block.getSubBlocks().iterator();
50 while(blockIter.hasNext()) {
51 readSimulinkBlock(blockIter.next());
52 }
53 }
54}
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/InputPortElement.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/InputPortElement.java
new file mode 100644
index 0000000..764cf6c
--- /dev/null
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/InputPortElement.java
@@ -0,0 +1,37 @@
1package org.scilab.modules.xcos.simulink;
2
3import java.io.IOException;
4import java.util.Iterator;
5
6import org.apache.commons.logging.LogFactory;
7import org.scilab.modules.xcos.port.BasicPort;
8
9import edu.tum.cs.simulink.model.SimulinkBlock;
10import edu.tum.cs.simulink.model.SimulinkInPort;
11import edu.tum.cs.simulink.model.SimulinkLine;
12
13public class InputPortElement {
14
15 public InputPortElement(SimulinkBlock base) {
16 // TODO Auto-generated constructor stub
17 }
18
19 public BasicPort decode(SimulinkInPort simulinkInPort, Object object) {
20 // TODO Auto-generated method stub
21 try {
22 Logger.toFile("InPort: " + simulinkInPort.toString());
23 //Logger.toFile(simulinkOutPort.getParameterNames().toString());
24 } catch(IOException e1) {
25 LogFactory.getLog(BlockElement.class).error(e1);
26 }
27
28 /*
29 * Set in line
30 */
31
32 LineElement lineElement = new LineElement();
33 lineElement.decode(simulinkInPort.getLine());
34
35 return null;
36 }
37}
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/LineElement.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/LineElement.java
new file mode 100644
index 0000000..db78ca4
--- /dev/null
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/LineElement.java
@@ -0,0 +1,22 @@
1package org.scilab.modules.xcos.simulink;
2
3import java.io.IOException;
4
5import org.apache.commons.logging.LogFactory;
6import org.scilab.modules.xcos.link.BasicLink;
7
8import edu.tum.cs.simulink.model.SimulinkLine;
9
10public class LineElement extends AbstractElement<BasicLink>{
11
12 public void decode(SimulinkLine simulinkLine) {
13 // TODO Auto-generated method stub
14 try {
15 Logger.toFile("Line: " + simulinkLine.toString());
16 //Logger.toFile(simulinkOutPort.getParameterNames().toString());
17 } catch(IOException e1) {
18 LogFactory.getLog(BlockElement.class).error(e1);
19 }
20 }
21
22}
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/Logger.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/Logger.java
new file mode 100644
index 0000000..7d5c0cf
--- /dev/null
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/Logger.java
@@ -0,0 +1,22 @@
1package org.scilab.modules.xcos.simulink;
2
3import java.io.*;
4
5import org.scilab.modules.jvm.utils.ScilabConstants;
6
7public class Logger {
8 public static void toFile(String logs) throws IOException {
9 // FIXME: just for xendo purposes
10 final String homePath = ScilabConstants.SCIHOME.toString();
11 PrintWriter outputStream = null;
12 try {
13 boolean append = true;
14 outputStream = new PrintWriter(new FileWriter(new File(homePath + '/' + "simimplogs"), append));
15 outputStream.println(logs);
16 } finally {
17 if (outputStream != null) {
18 outputStream.close();
19 }
20 }
21 }
22}
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/OutputPortElement.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/OutputPortElement.java
new file mode 100644
index 0000000..16700df
--- /dev/null
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/OutputPortElement.java
@@ -0,0 +1,40 @@
1package org.scilab.modules.xcos.simulink;
2
3import java.io.IOException;
4import java.util.Iterator;
5
6import org.apache.commons.logging.LogFactory;
7import org.scilab.modules.xcos.port.BasicPort;
8
9import edu.tum.cs.simulink.model.SimulinkBlock;
10import edu.tum.cs.simulink.model.SimulinkLine;
11import edu.tum.cs.simulink.model.SimulinkOutPort;
12
13public class OutputPortElement {
14
15 public OutputPortElement(SimulinkBlock base) {
16 // TODO Auto-generated constructor stub
17 }
18
19 public BasicPort decode(SimulinkOutPort simulinkOutPort, Object object) {
20 // TODO Auto-generated method stub
21 try {
22 Logger.toFile("OutPort: " + simulinkOutPort.toString());
23 //Logger.toFile(simulinkOutPort.getParameterNames().toString());
24 } catch(IOException e1) {
25 LogFactory.getLog(BlockElement.class).error(e1);
26 }
27
28 /*
29 * Set out lines
30 */
31 LineElement lineElement = new LineElement();
32 Iterator<SimulinkLine> lineOutIter = simulinkOutPort.getLines().iterator();
33 while(lineOutIter.hasNext()) {
34 lineElement.decode(lineOutIter.next());
35 }
36
37 return null;
38 }
39
40}
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/SimulinkFormatException.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/SimulinkFormatException.java
new file mode 100644
index 0000000..3adafea
--- /dev/null
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/SimulinkFormatException.java
@@ -0,0 +1,5 @@
1package org.scilab.modules.xcos.simulink;
2
3public class SimulinkFormatException extends Exception {
4
5}
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/SimulinkParametrizedElement.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/SimulinkParametrizedElement.java
new file mode 100644
index 0000000..0d8c9f1
--- /dev/null
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/simulink/SimulinkParametrizedElement.java
@@ -0,0 +1,5 @@
1package org.scilab.modules.xcos.simulink;
2
3public class SimulinkParametrizedElement {
4
5}
diff --git a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/utils/XcosMessages.java b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/utils/XcosMessages.java
index ccc0d7c..e3a3d94 100644
--- a/scilab/modules/xcos/src/java/org/scilab/modules/xcos/utils/XcosMessages.java
+++ b/scilab/modules/xcos/src/java/org/scilab/modules/xcos/utils/XcosMessages.java
@@ -41,6 +41,7 @@ public final class XcosMessages {
41 public static final String OPEN = Messages.gettext("Open") + DOTS; 41 public static final String OPEN = Messages.gettext("Open") + DOTS;
42 public static final String SAVE = Messages.gettext("Save"); 42 public static final String SAVE = Messages.gettext("Save");
43 public static final String SAVE_AS = Messages.gettext("Save as") + DOTS; 43 public static final String SAVE_AS = Messages.gettext("Save as") + DOTS;
44 public static final String IMPORT = Messages.gettext("Import") + DOTS;
44 public static final String EXPORT = Messages.gettext("Export") + DOTS; 45 public static final String EXPORT = Messages.gettext("Export") + DOTS;
45 public static final String SAVE_AS_INTERFACE_FUNCTION = Messages.gettext("Save as interface function") + DOTS; 46 public static final String SAVE_AS_INTERFACE_FUNCTION = Messages.gettext("Save as interface function") + DOTS;
46 public static final String PRINT = Messages.gettext("Print") + DOTS; 47 public static final String PRINT = Messages.gettext("Print") + DOTS;