fix dependencies on java in vs removed as reference
[scilab.git] / scilab / modules / xcos / src / java / org / scilab / modules / xcos / XcosTab.java
1 /*
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  * Copyright (C) 2010-2011 - DIGITEO - Clement DAVID
4  *
5  * This file must be used under the terms of the CeCILL.
6  * This source file is licensed as described in the file COPYING, which
7  * you should have received as part of this distribution.  The terms
8  * are also available at
9  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
10  *
11  */
12
13 package org.scilab.modules.xcos;
14
15 import java.beans.PropertyChangeEvent;
16 import java.beans.PropertyChangeListener;
17 import java.net.MalformedURLException;
18 import java.net.URL;
19 import java.util.List;
20 import java.util.ListIterator;
21 import java.util.UUID;
22
23 import javax.swing.JCheckBoxMenuItem;
24
25 import org.apache.commons.logging.LogFactory;
26 import org.scilab.modules.graph.actions.CopyAction;
27 import org.scilab.modules.graph.actions.CutAction;
28 import org.scilab.modules.graph.actions.DeleteAction;
29 import org.scilab.modules.graph.actions.InvertSelectionAction;
30 import org.scilab.modules.graph.actions.PasteAction;
31 import org.scilab.modules.graph.actions.RedoAction;
32 import org.scilab.modules.graph.actions.SelectAllAction;
33 import org.scilab.modules.graph.actions.UndoAction;
34 import org.scilab.modules.graph.actions.ZoomInAction;
35 import org.scilab.modules.graph.actions.ZoomOutAction;
36 import org.scilab.modules.graph.event.ArrowKeyListener;
37 import org.scilab.modules.gui.bridge.menu.SwingScilabMenu;
38 import org.scilab.modules.gui.bridge.tab.SwingScilabTab;
39 import org.scilab.modules.gui.checkboxmenuitem.CheckBoxMenuItem;
40 import org.scilab.modules.gui.menu.Menu;
41 import org.scilab.modules.gui.menu.ScilabMenu;
42 import org.scilab.modules.gui.menubar.MenuBar;
43 import org.scilab.modules.gui.menubar.ScilabMenuBar;
44 import org.scilab.modules.gui.menuitem.MenuItem;
45 import org.scilab.modules.gui.pushbutton.PushButton;
46 import org.scilab.modules.gui.tab.SimpleTab;
47 import org.scilab.modules.gui.tab.Tab;
48 import org.scilab.modules.gui.tabfactory.ScilabTabFactory;
49 import org.scilab.modules.gui.textbox.ScilabTextBox;
50 import org.scilab.modules.gui.textbox.TextBox;
51 import org.scilab.modules.gui.toolbar.ScilabToolBar;
52 import org.scilab.modules.gui.toolbar.ToolBar;
53 import org.scilab.modules.gui.utils.BarUpdater;
54 import org.scilab.modules.gui.utils.ClosingOperationsManager;
55 import org.scilab.modules.gui.utils.WindowsConfigurationManager;
56 import org.scilab.modules.gui.window.ScilabWindow;
57 import org.scilab.modules.gui.window.Window;
58 import org.scilab.modules.xcos.actions.AboutXcosAction;
59 import org.scilab.modules.xcos.actions.CloseAction;
60 import org.scilab.modules.xcos.actions.CompileAction;
61 import org.scilab.modules.xcos.actions.DebugLevelAction;
62 import org.scilab.modules.xcos.actions.DiagramBackgroundAction;
63 import org.scilab.modules.xcos.actions.ExportAction;
64 import org.scilab.modules.xcos.actions.FitDiagramToViewAction;
65 import org.scilab.modules.xcos.actions.InitModelicaAction;
66 import org.scilab.modules.xcos.actions.NewDiagramAction;
67 import org.scilab.modules.xcos.actions.NormalViewAction;
68 import org.scilab.modules.xcos.actions.OpenAction;
69 import org.scilab.modules.xcos.actions.PrintAction;
70 import org.scilab.modules.xcos.actions.QuitAction;
71 import org.scilab.modules.xcos.actions.RecentFileAction;
72 import org.scilab.modules.xcos.actions.SaveAction;
73 import org.scilab.modules.xcos.actions.SaveAsAction;
74 import org.scilab.modules.xcos.actions.SetContextAction;
75 import org.scilab.modules.xcos.actions.SetupAction;
76 import org.scilab.modules.xcos.actions.ShowHideShadowAction;
77 import org.scilab.modules.xcos.actions.StartAction;
78 import org.scilab.modules.xcos.actions.StopAction;
79 import org.scilab.modules.xcos.actions.ViewDiagramBrowserAction;
80 import org.scilab.modules.xcos.actions.ViewGridAction;
81 import org.scilab.modules.xcos.actions.ViewViewportAction;
82 import org.scilab.modules.xcos.actions.XcosDemonstrationsAction;
83 import org.scilab.modules.xcos.actions.XcosDocumentationAction;
84 import org.scilab.modules.xcos.block.actions.BlockDocumentationAction;
85 import org.scilab.modules.xcos.block.actions.BlockParametersAction;
86 import org.scilab.modules.xcos.block.actions.BorderColorAction;
87 import org.scilab.modules.xcos.block.actions.CodeGenerationAction;
88 import org.scilab.modules.xcos.block.actions.FilledColorAction;
89 import org.scilab.modules.xcos.block.actions.FlipAction;
90 import org.scilab.modules.xcos.block.actions.MirrorAction;
91 import org.scilab.modules.xcos.block.actions.RegionToSuperblockAction;
92 import org.scilab.modules.xcos.block.actions.RotateAction;
93 import org.scilab.modules.xcos.block.actions.ViewDetailsAction;
94 import org.scilab.modules.xcos.block.actions.alignement.AlignBlockActionBottom;
95 import org.scilab.modules.xcos.block.actions.alignement.AlignBlockActionCenter;
96 import org.scilab.modules.xcos.block.actions.alignement.AlignBlockActionLeft;
97 import org.scilab.modules.xcos.block.actions.alignement.AlignBlockActionMiddle;
98 import org.scilab.modules.xcos.block.actions.alignement.AlignBlockActionRight;
99 import org.scilab.modules.xcos.block.actions.alignement.AlignBlockActionTop;
100 import org.scilab.modules.xcos.configuration.ConfigurationManager;
101 import org.scilab.modules.xcos.configuration.model.DocumentType;
102 import org.scilab.modules.xcos.configuration.utils.ConfigurationConstants;
103 import org.scilab.modules.xcos.graph.XcosDiagram;
104 import org.scilab.modules.xcos.link.actions.StyleHorizontalAction;
105 import org.scilab.modules.xcos.link.actions.StyleStraightAction;
106 import org.scilab.modules.xcos.link.actions.StyleVerticalAction;
107 import org.scilab.modules.xcos.palette.actions.ViewPaletteBrowserAction;
108 import org.scilab.modules.xcos.palette.view.PaletteManagerView;
109 import org.scilab.modules.xcos.utils.XcosMessages;
110
111 /**
112  * Xcos tab operations
113  * 
114  * This class implement specific operation of an Xcos Tab.
115  */
116 // CSOFF: ClassFanOutComplexity
117 // CSOFF: ClassDataAbstractionCoupling
118 public class XcosTab extends SwingScilabTab implements Tab {
119     public static final String DEFAULT_WIN_UUID = "xcos-default-window";
120     public static final String DEFAULT_TAB_UUID = "xcos-default-tab";
121
122     /*
123      * Instance fields
124      */
125     private MenuBar menuBar;
126     private Menu fileMenu;
127     private Menu recentsMenu;
128     private Menu edit;
129     private Menu view;
130     private Menu simulate;
131     private Menu format;
132     private Menu alignMenu;
133     private Menu linkStyle;
134     private Menu tools;
135     private Menu help;
136
137     private JCheckBoxMenuItem viewport;
138
139     private PushButton openAction;
140     private PushButton saveAction;
141     private PushButton saveAsAction;
142     private PushButton printAction;
143     private PushButton newDiagramAction;
144     private PushButton deleteAction;
145     private PushButton undoAction;
146     private PushButton redoAction;
147     private PushButton fitDiagramToViewAction;
148     private PushButton startAction;
149     private PushButton stopAction;
150     private PushButton zoomInAction;
151     private PushButton zoomOutAction;
152     private PushButton xcosDemonstrationAction;
153     private PushButton xcosDocumentationAction;
154
155     private static class ClosingOperation
156             implements
157             org.scilab.modules.gui.utils.ClosingOperationsManager.ClosingOperation {
158         private final XcosDiagram graph;
159
160         public ClosingOperation(XcosDiagram graph) {
161             this.graph = graph;
162         }
163
164         @Override
165         public boolean canClose() {
166             return Xcos.getInstance().canClose(graph);
167         }
168
169         @Override
170         public void destroy() {
171             Xcos.getInstance().destroy(graph);
172             graph.setOpened(false);
173         }
174
175         @Override
176         public String askForClosing(final List<SwingScilabTab> list) {
177             return Xcos.getInstance().askForClosing(graph, list);
178         }
179
180         @Override
181         public void updateDependencies(List<SwingScilabTab> list,
182                 ListIterator<SwingScilabTab> it) {
183             final PaletteManagerView palette = PaletteManagerView.get();
184
185             /*
186              * if palette is not visible, then break
187              */
188             if (palette == null) {
189                 return;
190             }
191
192             /*
193              * If it already contains the palette, then break.
194              */
195             if (list.contains(palette)) {
196                 return;
197             }
198
199
200             final boolean wasLastOpened = Xcos.getInstance()
201                     .wasLastOpened(list);
202
203             /*
204              * Append the palette if all the xcos files will be closed
205              */
206             if (wasLastOpened) {
207                 it.add(palette);
208             }
209
210         }
211     }
212
213     private static class EndedRestoration implements
214             WindowsConfigurationManager.EndedRestoration {
215         private final XcosDiagram graph;
216
217         public EndedRestoration(XcosDiagram graph) {
218             this.graph = graph;
219         }
220
221         @Override
222         public void finish() {
223             graph.updateTabTitle();
224
225             ConfigurationManager.getInstance().removeFromRecentTabs(
226                     graph.getDiagramTab());
227         }
228     }
229
230     /**
231      * Default constructor
232      * 
233      * @param diagram
234      *            The associated diagram
235      */
236     private XcosTab(XcosDiagram graph, String uuid) {
237         super(XcosMessages.XCOS, uuid);
238
239         /** tab association */
240         graph.setDiagramTab(uuid);
241         setWindowIcon(Xcos.ICON.getImage());
242
243         initComponents(graph);
244
245         graph.getAsComponent().addKeyListener(new ArrowKeyListener());
246     }
247
248     /*
249      * Static API for Tabs
250      */
251
252     /**
253      * Get the tab for a graph.
254      * 
255      * @param graph
256      *            the graph
257      * @return the tab (can be null)
258      */
259     public static XcosTab get(XcosDiagram graph) {
260         final String uuid = graph.getDiagramTab();
261         if (uuid == null) {
262             return null;
263         }
264
265         return (XcosTab) ScilabTabFactory.getInstance().getFromCache(uuid);
266     }
267
268     /**
269      * Restore or create the viewport tab for the graph
270      * 
271      * @param graph
272      *            the graph
273      */
274     public static void restore(XcosDiagram graph) {
275         restore(graph, true);
276     }
277
278     /**
279      * Restore or create the tab for the graph
280      * 
281      * @param graph
282      *            the graph
283      * @param visible
284      *            should the tab should be visible
285      */
286     public static void restore(final XcosDiagram graph, final boolean visible) {
287         String uuid = graph.getDiagramTab();
288         if (uuid == null) {
289             uuid = UUID.randomUUID().toString();
290         }
291
292         final XcosTab tab = new XcosTab(graph, uuid);
293         ScilabTabFactory.getInstance().addToCache(tab);
294
295         Xcos.getInstance().addDiagram(graph.getSavedFile(), graph);
296         graph.setOpened(true);
297
298         if (visible) {
299             tab.createDefaultWindow().setVisible(true);
300
301             graph.updateTabTitle();
302             BarUpdater.updateBars(tab.getParentWindowId(), tab.getMenuBar(), tab.getToolBar(), tab.getInfoBar(), tab.getName(), tab.getWindowIcon());
303         }
304
305         ClosingOperationsManager.addDependencyWithRoot((SwingScilabTab) tab);
306         ClosingOperationsManager.registerClosingOperation((SwingScilabTab) tab,
307                 new ClosingOperation(graph));
308         WindowsConfigurationManager.registerEndedRestoration(
309                 (SwingScilabTab) tab, new EndedRestoration(graph));
310     }
311
312     /*
313      * Specific implementation
314      */
315
316     /**
317      * Instantiate all the subcomponents of this Tab.
318      * 
319      * @param diagram
320      *            the diagram
321      */
322     private void initComponents(final XcosDiagram diagram) {
323         /* Create the menu bar */
324         menuBar = createMenuBar(diagram);
325         setMenuBar(menuBar);
326
327         /* Create the toolbar */
328         final ToolBar toolBar = createToolBar(diagram);
329         setToolBar(toolBar);
330
331         // No SimpleTab.addMember(ScilabComponent ...) so perform a raw
332         // association.
333         setContentPane(diagram.getAsComponent());
334
335         /* Create the infoBar */
336         setInfoBar(ScilabTextBox.createTextBox());
337     }
338
339     /**
340      * Create the windows menu bar
341      * 
342      * @param diagram
343      *            the diagram
344      * @return the Xcos diagram menu bar
345      */
346     // CSOFF: JavaNCSS
347     private MenuBar createMenuBar(final XcosDiagram diagram) {
348
349         menuBar = ScilabMenuBar.createMenuBar();
350
351         /** FILE MENU */
352         fileMenu = ScilabMenu.createMenu();
353         fileMenu.setText(XcosMessages.FILE);
354         fileMenu.setMnemonic('F');
355
356         fileMenu.add(NewDiagramAction.createMenu(diagram));
357         fileMenu.add(OpenAction.createMenu(diagram));
358         fileMenu.addSeparator();
359         fileMenu.add(SaveAction.createMenu(diagram));
360         fileMenu.add(SaveAsAction.createMenu(diagram));
361         fileMenu.add(ExportAction.createMenu(diagram));
362
363         recentsMenu = createRecentMenu();
364
365         fileMenu.add(recentsMenu);
366
367         fileMenu.add(PrintAction.createMenu(diagram));
368         fileMenu.addSeparator();
369         fileMenu.add(CloseAction.createMenu(diagram));
370         fileMenu.addSeparator();
371         fileMenu.add(QuitAction.createMenu(diagram));
372
373         menuBar.add(fileMenu);
374
375         /** Edit menu */
376         edit = ScilabMenu.createMenu();
377         edit.setText(XcosMessages.EDIT);
378         edit.setMnemonic('E');
379         menuBar.add(edit);
380
381         edit.add(UndoAction.undoMenu(diagram));
382         edit.add(RedoAction.redoMenu(diagram));
383         edit.addSeparator();
384         edit.add(CutAction.cutMenu(diagram));
385         edit.add(CopyAction.copyMenu(diagram));
386         edit.add(PasteAction.pasteMenu(diagram));
387         edit.add(DeleteAction.createMenu(diagram));
388         edit.addSeparator();
389         edit.add(SelectAllAction.createMenu(diagram));
390         edit.add(InvertSelectionAction.createMenu(diagram));
391         edit.addSeparator();
392         edit.add(BlockParametersAction.createMenu(diagram));
393         edit.addSeparator();
394         edit.add(RegionToSuperblockAction.createMenu(diagram));
395
396         /** View menu */
397         view = ScilabMenu.createMenu();
398         view.setText(XcosMessages.VIEW);
399         view.setMnemonic('V');
400         menuBar.add(view);
401
402         view.add(ZoomInAction.zoominMenu(diagram));
403         view.add(ZoomOutAction.zoomoutMenu(diagram));
404         view.add(FitDiagramToViewAction.createMenu(diagram));
405         view.add(NormalViewAction.createMenu(diagram));
406         view.addSeparator();
407         view.add(ViewPaletteBrowserAction.createCheckBoxMenu(diagram));
408         view.add(ViewDiagramBrowserAction.createMenu(diagram));
409         final CheckBoxMenuItem menuItem = ViewViewportAction
410                 .createCheckBoxMenu(diagram);
411         viewport = (JCheckBoxMenuItem) menuItem.getAsSimpleCheckBoxMenuItem();
412         view.add(menuItem);
413         view.add(ViewDetailsAction.createMenu(diagram));
414
415         /** Simulation menu */
416         simulate = ScilabMenu.createMenu();
417         simulate.setText(XcosMessages.SIMULATION);
418         simulate.setMnemonic('S');
419         menuBar.add(simulate);
420
421         final MenuItem startMenu = StartAction.createMenu(diagram);
422         final MenuItem stopMenu = StopAction.createMenu(diagram);
423
424         simulate.add(SetupAction.createMenu(diagram));
425         simulate.add(DebugLevelAction.createMenu(diagram));
426         simulate.add(SetContextAction.createMenu(diagram));
427         simulate.add(CompileAction.createMenu(diagram));
428         simulate.add(InitModelicaAction.createMenu(diagram));
429         simulate.add(startMenu);
430         simulate.add(stopMenu);
431
432         /** Format menu */
433         format = ScilabMenu.createMenu();
434         format.setText(XcosMessages.FORMAT);
435         format.setMnemonic('O');
436         menuBar.add(format);
437
438         format.add(RotateAction.createMenu(diagram));
439         format.add(FlipAction.createMenu(diagram));
440         format.add(MirrorAction.createMenu(diagram));
441         format.add(ShowHideShadowAction.createMenu(diagram));
442
443         format.addSeparator();
444         alignMenu = ScilabMenu.createMenu();
445         alignMenu.setText(XcosMessages.ALIGN_BLOCKS);
446         alignMenu.add(AlignBlockActionLeft.createMenu(diagram));
447         alignMenu.add(AlignBlockActionCenter.createMenu(diagram));
448         alignMenu.add(AlignBlockActionRight.createMenu(diagram));
449         alignMenu.addSeparator();
450         alignMenu.add(AlignBlockActionTop.createMenu(diagram));
451         alignMenu.add(AlignBlockActionMiddle.createMenu(diagram));
452         alignMenu.add(AlignBlockActionBottom.createMenu(diagram));
453         format.add(alignMenu);
454         format.addSeparator();
455
456         format.add(BorderColorAction.createMenu(diagram));
457         format.add(FilledColorAction.createMenu(diagram));
458         format.addSeparator();
459
460         linkStyle = ScilabMenu.createMenu();
461         linkStyle.setText(XcosMessages.LINK_STYLE);
462         linkStyle.add(StyleHorizontalAction.createMenu(diagram));
463         linkStyle.add(StyleStraightAction.createMenu(diagram));
464         linkStyle.add(StyleVerticalAction.createMenu(diagram));
465         format.add(linkStyle);
466         format.addSeparator();
467
468         format.add(DiagramBackgroundAction.createMenu(diagram));
469         final CheckBoxMenuItem gridMenu = ViewGridAction
470                 .createCheckBoxMenu(diagram);
471         format.add(gridMenu);
472
473         /** Tools menu */
474         tools = ScilabMenu.createMenu();
475         tools.setText(XcosMessages.TOOLS);
476         tools.setMnemonic('T');
477         menuBar.add(tools);
478
479         tools.add(CodeGenerationAction.createMenu(diagram));
480
481         /** Help menu */
482         help = ScilabMenu.createMenu();
483         help.setText(XcosMessages.HELP);
484         help.setMnemonic('?');
485         menuBar.add(help);
486
487         help.add(XcosDocumentationAction.createMenu(diagram));
488         help.add(BlockDocumentationAction.createMenu(diagram));
489         help.addSeparator();
490         help.add(XcosDemonstrationsAction.createMenu(diagram));
491         help.addSeparator();
492         help.add(AboutXcosAction.createMenu(diagram));
493
494         return menuBar;
495     }
496
497     // CSON: JavaNCSS
498
499     /**
500      * Create the recent menu from the previously opened files
501      * 
502      * @return the recent menu
503      */
504     private Menu createRecentMenu() {
505         final Menu recent;
506
507         recent = ScilabMenu.createMenu();
508         recent.setText(XcosMessages.RECENT_FILES);
509
510         final ConfigurationManager manager = ConfigurationManager.getInstance();
511         final List<DocumentType> recentFiles = manager.getSettings()
512                 .getRecent();
513         for (int i = 0; i < recentFiles.size(); i++) {
514             URL url;
515             try {
516                 url = new URL(recentFiles.get(i).getUrl());
517             } catch (final MalformedURLException e) {
518                 LogFactory.getLog(XcosTab.class).error(e);
519                 break;
520             }
521             recent.add(RecentFileAction.createMenu(url));
522         }
523
524         ConfigurationManager.getInstance().addPropertyChangeListener(
525                 ConfigurationConstants.RECENT_FILES_CHANGED,
526                 new PropertyChangeListener() {
527                     @Override
528                     public void propertyChange(final PropertyChangeEvent evt) {
529                         assert evt.getPropertyName().equals(
530                                 ConfigurationConstants.RECENT_FILES_CHANGED);
531
532                         /*
533                          * We only handle menu creation there. Return when this
534                          * is not the case.
535                          */
536                         if (evt.getOldValue() != null) {
537                             return;
538                         }
539
540                         URL url;
541                         try {
542                             url = new URL(((DocumentType) evt.getNewValue())
543                                     .getUrl());
544                         } catch (final MalformedURLException e) {
545                             LogFactory.getLog(XcosTab.class).error(e);
546                             return;
547                         }
548
549                         ((SwingScilabMenu) recent.getAsSimpleMenu()).add(
550                                 (SwingScilabMenu) RecentFileAction.createMenu(
551                                         url).getAsSimpleMenu(), 0);
552                     }
553                 });
554
555         return recent;
556     }
557
558     /**
559      * Create the Tab toolbar
560      * 
561      * @param diagram
562      *            the associated diagram
563      * @return tool bar
564      */
565     private ToolBar createToolBar(final XcosDiagram diagram) {
566         final ToolBar toolBar = ScilabToolBar.createToolBar();
567
568         newDiagramAction = NewDiagramAction.createButton(diagram);
569         toolBar.add(newDiagramAction);
570
571         openAction = OpenAction.createButton(diagram);
572         toolBar.add(openAction);
573
574         toolBar.addSeparator();
575
576         saveAction = SaveAction.createButton(diagram);
577         toolBar.add(saveAction);
578         saveAsAction = SaveAsAction.createButton(diagram);
579         toolBar.add(saveAsAction);
580
581         toolBar.addSeparator();
582
583         printAction = PrintAction.createButton(diagram);
584         toolBar.add(printAction);
585
586         toolBar.addSeparator();
587
588         deleteAction = DeleteAction.createButton(diagram);
589         toolBar.add(deleteAction);
590
591         toolBar.addSeparator();
592
593         // UNDO / REDO
594         undoAction = UndoAction.undoButton(diagram);
595         redoAction = RedoAction.redoButton(diagram);
596         toolBar.add(undoAction);
597         toolBar.add(redoAction);
598
599         toolBar.addSeparator();
600
601         fitDiagramToViewAction = FitDiagramToViewAction.createButton(diagram);
602         toolBar.add(fitDiagramToViewAction);
603
604         toolBar.addSeparator();
605
606         // START / STOP
607         startAction = StartAction.createButton(diagram);
608         stopAction = StopAction.createButton(diagram);
609
610         toolBar.add(startAction);
611         toolBar.add(stopAction);
612
613         toolBar.addSeparator();
614
615         // ZOOMIN / ZOOMOUT
616         zoomInAction = ZoomInAction.zoominButton(diagram);
617         toolBar.add(zoomInAction);
618         zoomOutAction = ZoomOutAction.zoomoutButton(diagram);
619         toolBar.add(zoomOutAction);
620
621         toolBar.addSeparator();
622
623         xcosDemonstrationAction = XcosDemonstrationsAction
624                 .createButton(diagram);
625         toolBar.add(xcosDemonstrationAction);
626         xcosDocumentationAction = XcosDocumentationAction.createButton(diagram);
627         toolBar.add(xcosDocumentationAction);
628
629         return toolBar;
630     }
631
632     /**
633      * Check/uncheck the viewport check box menu item
634      * 
635      * @param status
636      *            the checked status
637      */
638     public void setViewportChecked(boolean status) {
639         viewport.setSelected(status);
640     }
641
642     /**
643      * Get the check/uncheck status of the check box menu item
644      * 
645      * @param status
646      *            the checked status
647      */
648     public boolean isViewportChecked() {
649         return viewport.isSelected();
650     }
651
652     private Window createDefaultWindow() {
653         final Window win;
654
655         final Window configuration = WindowsConfigurationManager.createWindow(
656                 DEFAULT_WIN_UUID, false);
657         if (configuration != null) {
658             win = configuration;
659         } else {
660             win = ScilabWindow.createWindow();
661         }
662
663         win.addTab(this);
664         return win;
665     }
666
667     /*
668      * Tab implementation
669      */
670
671     @Deprecated
672     @Override
673     public void addToolBar(ToolBar toolBarToAdd) {
674         setToolBar(toolBarToAdd);
675     }
676
677     @Deprecated
678     @Override
679     public void addMenuBar(MenuBar menuBarToAdd) {
680         setMenuBar(menuBarToAdd);
681     }
682
683     @Deprecated
684     @Override
685     public void addInfoBar(TextBox infoBarToAdd) {
686         setInfoBar(infoBarToAdd);
687     }
688
689     @Deprecated
690     @Override
691     public SimpleTab getAsSimpleTab() {
692         return this;
693     }
694
695     @Deprecated
696     @Override
697     public Window getParentWindow() {
698         return createDefaultWindow();
699     }
700 }
701
702 // CSON: ClassDataAbstractionCoupling
703 // CSON: ClassFanOutComplexity