protected final void createContents() {
        shell = new Shell();
        shell.setMinimumSize(new Point(500, 390));
        shell.setSize(826, 550);
        shell.setText("APVS async modeling project");
        shell.setLayout(new FillLayout(SWT.HORIZONTAL));

        shell.addControlListener(new ControlListener() {
            public void controlResized(final ControlEvent e) {
                updateTimeDiagramsWindowPosition();
                bar.redraw();
            }

            public void controlMoved(final ControlEvent e) {
                updateTimeDiagramsWindowPosition();
                bar.redraw();
            }

            private void updateTimeDiagramsWindowPosition() {
//                if (timeDiagramsWindow != null) {
//                    int xCoord = getRightUpperCornerPosition().x + UIConstants.SPACE_BETWEEN_WINDOWS;
//                    int yCoord = getRightUpperCornerPosition().y;
//                    timeDiagramsWindow.setPosition(xCoord, yCoord);
//                }
            }
        });

        Menu menu = new Menu(shell, SWT.BAR);
        shell.setMenuBar(menu);

        MenuItem menuItemFile = new MenuItem(menu, SWT.CASCADE);
        menuItemFile.setText("File");

        Menu menu_1 = new Menu(menuItemFile);
        menuItemFile.setMenu(menu_1);

        MenuItem mntmOpen_1 = new MenuItem(menu_1, SWT.CASCADE);
        mntmOpen_1.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/blue-folder--arrow.png"));
        mntmOpen_1.setText("Open");

        Menu menu_4 = new Menu(mntmOpen_1);
        mntmOpen_1.setMenu(menu_4);
       
        MenuItem openLibraryFileMenuItem = new MenuItem(menu_4, SWT.NONE);
        openLibraryFileMenuItem.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/book--arrow.png"));
        openLibraryFileMenuItem.setText("Open Library file...");

        final MenuItem openDiscreteModelMenuItem = new MenuItem(menu_4, SWT.NONE);
        openDiscreteModelMenuItem.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/book--arrow.png"));
        openDiscreteModelMenuItem.setEnabled(false);
        openDiscreteModelMenuItem.setText("Open Discrete Model file...");

        final MenuItem openSignalsFileMenuItem = new MenuItem(menu_4, SWT.NONE);
        openSignalsFileMenuItem.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/Script.gif"));
        openSignalsFileMenuItem.setEnabled(false);
        openSignalsFileMenuItem.setText("Open Signals file...");
      
        openLibraryFileMenuItem.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent e) {
                loadLibrary();
                openDiscreteModelMenuItem.setEnabled(true);
                openSignalsFileMenuItem.setEnabled(true);
            }
        });

        openDiscreteModelMenuItem.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent e) {
                loadScheme();
            }
        });
        
        openSignalsFileMenuItem.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent e) {
                loadSignals();
            }
        });    
        
        MenuItem mntmSave = new MenuItem(menu_1, SWT.CASCADE);
        mntmSave.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/Save.gif"));
        mntmSave.setText("Save");

        Menu menu_5 = new Menu(mntmSave);
        mntmSave.setMenu(menu_5);

        mntmSaveModelingResults = new MenuItem(menu_5, SWT.NONE);
        mntmSaveModelingResults.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/application-share.png"));
        mntmSaveModelingResults.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                String fileToResultsSavingPath = dlgResultsSaving.open();
                if(fileToResultsSavingPath != null) {
                    try { 
                        FileWriter fr = new FileWriter(new File(fileToResultsSavingPath));
                        fr.write(modelingResultsText.getText() + "\n");
                        fr.close();                        
                    } catch (IOException ex){
                        
                    }
                    status(Messages.RESULTS_SAVED);
                } else {
                    status(Messages.RESULTS_NOT_SAVED);
                }
            }
        });
        mntmSaveModelingResults.setText("Save modeling results...");

        MenuItem mntmClose = new MenuItem(menu_1, SWT.NONE);
        mntmClose.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/cross-script.png"));
        mntmClose.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent e) {
                shell.close();
            }
        });
        mntmClose.setText("Exit");

        MenuItem menuItemModeling = new MenuItem(menu, SWT.CASCADE);
        menuItemModeling.setText("Modeling");

        Menu menu_3 = new Menu(menuItemModeling);
        menuItemModeling.setMenu(menu_3);

        initResetMenuItem = new MenuItem(menu_3, SWT.NONE);
        initResetMenuItem.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/Home.gif"));
        initResetMenuItem.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                initReset();
            }
        });
        initResetMenuItem.setText("Init/Reset");

        gotoTimeMenuItem = new MenuItem(menu_3, SWT.NONE);
        gotoTimeMenuItem.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/History.gif"));
        gotoTimeMenuItem.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                gotoTime();
            }
        });
        gotoTimeMenuItem.setText("Goto time...");

        stepFwdMenuItem = new MenuItem(menu_3, SWT.NONE);
        stepFwdMenuItem.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/Forward.gif"));
        stepFwdMenuItem.setText("Step Forward");

        stepBwdMenuItem = new MenuItem(menu_3, SWT.NONE);
        stepBwdMenuItem.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/Back.gif"));
        stepBwdMenuItem.setText("Step Backward");
        
        MenuItem mntmNewSubmenu = new MenuItem(menu, SWT.CASCADE);
        mntmNewSubmenu.setText("View");
        
        Menu menu_6 = new Menu(mntmNewSubmenu);
        mntmNewSubmenu.setMenu(menu_6);
        
        MenuItem mntmTimeDiagrams = new MenuItem(menu_6, SWT.NONE);
        mntmTimeDiagrams.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/Stock graph.gif"));
        mntmTimeDiagrams.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                toggleTimeDiagrams();
            }
        });
        mntmTimeDiagrams.setText("Time Diagrams");

        MenuItem menuItemAbout = new MenuItem(menu, SWT.CASCADE);
        menuItemAbout.setText("About");

        Menu menu_2 = new Menu(menuItemAbout);
        menuItemAbout.setMenu(menu_2);

        MenuItem mntmNewItem = new MenuItem(menu_2, SWT.NONE);
        mntmNewItem.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/Bubble.gif"));
        mntmNewItem.setText("Program");
        mntmNewItem.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent e) {
                showMessage(AboutProgram.Text, "Information");
            }
        });

        MenuItem mntmTeam = new MenuItem(menu_2, SWT.NONE);
        mntmTeam.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/About.gif"));
        mntmTeam.setText("Team");
        mntmTeam.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(final SelectionEvent e) {
                showMessage(AboutTeam.Text, "Information");
            }
        });

        TabFolder mainWindowTabFolder = new TabFolder(shell, SWT.NONE);

        TabItem MainWindowTab = new TabItem(mainWindowTabFolder, SWT.NONE);
        MainWindowTab.setText("Modeling");

        Composite mainComposite = new Composite(mainWindowTabFolder, SWT.NONE);
        MainWindowTab.setControl(mainComposite);
        mainComposite.setLayout(new BorderLayout(0, 0));

        statusPanel = new Text(mainComposite, SWT.BORDER);
        statusPanel.setToolTipText("See \"log\" for more details");
        statusPanel.setEditable(false);
        statusPanel.setText("Status panel");
        statusPanel.setLayoutData(BorderLayout.SOUTH);

        Composite ControlButtonsComposite = new Composite(mainComposite,
                SWT.BORDER);
        ControlButtonsComposite.setLayoutData(BorderLayout.NORTH);
        ControlButtonsComposite.setLayout(new FillLayout(SWT.HORIZONTAL));

        initResetBtn = new Button(ControlButtonsComposite, SWT.NONE);
        initResetBtn.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/Home.gif"));
        initResetBtn.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                initReset();
            }
        });
        initResetBtn.setText("Init/Reset");

        stepFwdBtn = new Button(ControlButtonsComposite, SWT.NONE);
        stepFwdBtn.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/Forward.gif"));
        stepFwdBtn.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                stepForward();
            }
        });
        stepFwdBtn.setText("Step Forward");

        stepBwdBtn = new Button(ControlButtonsComposite, SWT.NONE);
        stepBwdBtn.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/Back.gif"));
        stepBwdBtn.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                stepBackward();
            }
        });
        stepBwdBtn.setText("Step Backward");

        gotoTimeBtn = new Button(ControlButtonsComposite, SWT.NONE);
        gotoTimeBtn.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/History.gif"));
        gotoTimeBtn.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {                
                gotoTime();
            }
        });
        gotoTimeBtn.setText("Goto time...");
        
        btnFullRun = new Button(ControlButtonsComposite, SWT.NONE);
        btnFullRun.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                gotoTime(Long.MAX_VALUE);
            }
        });
        btnFullRun.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/Play.gif"));
        btnFullRun.setEnabled(false);
        btnFullRun.setText("Full Run");

        timeDiagramsBtn = new Button(ControlButtonsComposite, SWT.NONE);
        timeDiagramsBtn.setImage(SWTResourceManager.getImage(MainWindow.class, "/icons/Stock graph.gif"));
        timeDiagramsBtn.setText("Time diagrams...");
        
        Label lblModelingTime = new Label(ControlButtonsComposite, SWT.NONE);
        lblModelingTime.setEnabled(false);
        lblModelingTime.setAlignment(SWT.CENTER);
        lblModelingTime.setText("Modeling Time:");
        
        modelingTimeText = new Text(ControlButtonsComposite, SWT.BORDER);
        modelingTimeText.setEditable(false);
        modelingTimeText.setToolTipText(Messages.TOOLTIP_MODELING_TIME);
        timeDiagramsBtn.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                toggleTimeDiagrams();
            }
        });

        SashForm sashForm = new SashForm(mainComposite, SWT.NONE);
        sashForm.setLayoutData(BorderLayout.CENTER);

        Composite elementsComposite = new Composite(sashForm, SWT.BORDER);
        elementsComposite.setLayout(new BorderLayout(0, 0));
        
        Group grpElementTypes = new Group(elementsComposite, SWT.NONE);
        grpElementTypes.setText("Available element types:");
        grpElementTypes.setLayoutData(BorderLayout.CENTER);
        grpElementTypes.setLayout(new FillLayout(SWT.HORIZONTAL));
        
        bar = new ExpandBar(grpElementTypes, SWT.BORDER | SWT.V_SCROLL);                
        bar.setSpacing(5);

        Composite modelingStateComposite = new Composite(sashForm, SWT.BORDER);
        modelingStateComposite.setLayout(new GridLayout(3, false));
        
        Group grpActiveElementsList = new Group(modelingStateComposite, SWT.NONE);
        grpActiveElementsList.setToolTipText(Messages.TOOLTIP_ACTIVE_ELEMENTS_TABLE);
        GridData gd_grpActiveElementsList = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
        gd_grpActiveElementsList.widthHint = 81;
        gd_grpActiveElementsList.heightHint = 375;
        grpActiveElementsList.setLayoutData(gd_grpActiveElementsList);
        grpActiveElementsList.setText("Active elements");
        grpActiveElementsList.setLayout(new FillLayout(SWT.HORIZONTAL));
        
        tableActiveElements = new Table(grpActiveElementsList, SWT.BORDER | SWT.FULL_SELECTION | SWT.FILL);
        tableActiveElements.setToolTipText(Messages.TOOLTIP_ACTIVE_ELEMENTS_TABLE);
        tableActiveElements.setLinesVisible(true);
        tableActiveElements.setHeaderVisible(true);
        
        TableColumn tblclmnNewColumn = new TableColumn(tableActiveElements, SWT.CENTER);
        tblclmnNewColumn.setWidth(76);
        tblclmnNewColumn.setText("Element num");
        
        Group grpActionsTable = new Group(modelingStateComposite, SWT.NONE);
        grpActionsTable.setText("Events");
        grpActionsTable.setToolTipText(Messages.TOOLTIP_EVENTS_TABLE);
        GridData gd_grpActionsTable = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
        gd_grpActionsTable.heightHint = 375;
        gd_grpActionsTable.widthHint = 302;
        grpActionsTable.setLayoutData(gd_grpActionsTable);
        grpActionsTable.setLayout(new FillLayout(SWT.HORIZONTAL));
                
        tableEvents = new Table(grpActionsTable, SWT.BORDER | SWT.FULL_SELECTION);
        tableEvents.setToolTipText(Messages.TOOLTIP_EVENTS_TABLE);
        tableEvents.setLinesVisible(true);
        tableEvents.setHeaderVisible(true);
        
        TableColumn tblclmnTime = new TableColumn(tableEvents, SWT.CENTER);
        tblclmnTime.setWidth(89);
        tblclmnTime.setText("Time");
        
        TableColumn tblclmnElement = new TableColumn(tableEvents, SWT.CENTER);
        tblclmnElement.setWidth(82);
        tblclmnElement.setText("Element");
        
        TableColumn tblclmnContact = new TableColumn(tableEvents, SWT.CENTER);
        tblclmnContact.setWidth(82);
        tblclmnContact.setText("Contact");
        
        TableColumn tblclmnState = new TableColumn(tableEvents, SWT.CENTER);
        tblclmnState.setWidth(82);
        tblclmnState.setText("New state");
        
        TableColumn tblclmnFrom = new TableColumn(tableEvents, SWT.CENTER);
        tblclmnFrom.setWidth(82);
        tblclmnFrom.setText("Created at");
        
        Group grpSignalsMatrix = new Group(modelingStateComposite, SWT.NONE);
        grpSignalsMatrix.setToolTipText(Messages.TOOLTIP_SIGNALS_MATRIX);
        GridData gd_grpSignalsMatrix = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
        gd_grpSignalsMatrix.heightHint = 375;
        gd_grpSignalsMatrix.widthHint = 112;
        grpSignalsMatrix.setLayoutData(gd_grpSignalsMatrix);
        grpSignalsMatrix.setText("Signals");
        grpSignalsMatrix.setLayout(new FillLayout(SWT.HORIZONTAL));
                        
        tableSignals = new Table(grpSignalsMatrix, SWT.BORDER | SWT.FULL_SELECTION);
        tableSignals.setToolTipText(Messages.TOOLTIP_SIGNALS_MATRIX);
        tableSignals.setLinesVisible(true);
        tableSignals.setHeaderVisible(true);       
        
        TableColumn tblclmnCurcuit = new TableColumn(tableSignals, SWT.CENTER);
        tblclmnCurcuit.setWidth(63);
        tblclmnCurcuit.setText("Contact");
        
        TableColumn tblclmnSignal = new TableColumn(tableSignals, SWT.CENTER);
        tblclmnSignal.setWidth(57);
        tblclmnSignal.setText("Signal");        
        
        sashForm.setWeights(new int[] { 1, 4 });
        
        tabLibraryEditor = new TabItem(mainWindowTabFolder, SWT.NONE);
        tabLibraryEditor.setText("Library Editor");
        
        le_composite = new Composite(mainWindowTabFolder, SWT.NONE);
        tabLibraryEditor.setControl(le_composite);
        le_composite.setLayout(new BorderLayout(0, 0));
        
        le_view = new Text(le_composite, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
        le_view.setEditable(false);
        le_view.setLayoutData(BorderLayout.CENTER);
        
        Composite composite_3 = new Composite(le_composite, SWT.NONE);
        composite_3.setLayoutData(BorderLayout.NORTH);
        composite_3.setLayout(new GridLayout(2, false));
        
        btnSaveLibrary = new Button(composite_3, SWT.NONE);
        btnSaveLibrary.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                saveLibrary();
            }
        });
        btnSaveLibrary.setText("Save Library");
        
        btnReloadLibrary = new Button(composite_3, SWT.NONE);
        btnReloadLibrary.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                loadLibrary();
                openDiscreteModelMenuItem.setEnabled(true);
                openSignalsFileMenuItem.setEnabled(true);
            }
        });
        btnReloadLibrary.setText("Reload Library");
        
        tabSchemeEditor = new TabItem(mainWindowTabFolder, SWT.NONE);
        tabSchemeEditor.setText("Scheme Editor");
        
        ce_composite = new Composite(mainWindowTabFolder, SWT.NONE);
        tabSchemeEditor.setControl(ce_composite);
        ce_composite.setLayout(new BorderLayout(0, 0));
        
        Composite composite_2 = new Composite(ce_composite, SWT.NONE);
        composite_2.setLayoutData(BorderLayout.NORTH);
        composite_2.setLayout(new GridLayout(2, false));
        
        ce_save = new Button(composite_2, SWT.NONE);
        ce_save.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                saveScheme();
            }
        });
        ce_save.setText("Save Scheme");
        
        ce_load = new Button(composite_2, SWT.NONE);
        ce_load.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                loadScheme();
            }
        });
        ce_load.setText("Reload Scheme");
        
        Composite composite_6 = new Composite(ce_composite, SWT.NONE);
        composite_6.setLayoutData(BorderLayout.CENTER);
        composite_6.setLayout(new FillLayout(SWT.HORIZONTAL));
        
        SashForm sashForm_1 = new SashForm(composite_6, SWT.NONE);
        
        ScrolledComposite scrolledComposite_1 = new ScrolledComposite(sashForm_1, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
        scrolledComposite_1.setExpandHorizontal(true);
        scrolledComposite_1.setExpandVertical(true);
        
        Composite composite_7 = new Composite(scrolledComposite_1, SWT.NONE);
        composite_7.setLayout(new GridLayout(1, false));
        
        Group ce_elem_grp = new Group(composite_7, SWT.NONE);
        ce_elem_grp.setLayout(new GridLayout(2, false));
        ce_elem_grp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        ce_elem_grp.setText("Add elements");
        
        ce_element = new Combo(ce_elem_grp, SWT.NONE);
        ce_element.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
        ce_element.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                String elementName = ce_element.getItem(ce_element.getSelectionIndex());
                String elementType = scheme.getElements().get(elementName);
                ce_type.select(ce_type.indexOf(elementType));
            }
        });
        ce_element.addVerifyListener(new VerifyListener() {
            public void verifyText(VerifyEvent evt) {
                if((ce_element.getText() + evt.text).matches("[A-Za-z][A-Za-z0-9_]*")) evt.doit = true;
                else evt.doit = false;
            }
        });
        
        ce_type = new Combo(ce_elem_grp, SWT.READ_ONLY);
        ce_type.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
        ce_type.setToolTipText("Specify element name");
        
        ce_elem_add = new Button(ce_elem_grp, SWT.NONE);
        ce_elem_add.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1));
        ce_elem_add.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                schemeEditorAddElement();
            }
        });
        ce_elem_add.setToolTipText("Adds new element of selected type with a specified name or changes type of existing element");
        ce_elem_add.setText("Add");
        
        ce_elem_del = new Button(ce_elem_grp, SWT.NONE);
        ce_elem_del.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true, 1, 1));
        ce_elem_del.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                schemeEditorDelElement();
            }
        });
        ce_elem_del.setToolTipText("Deletes element with specified name");
        ce_elem_del.setText("Delete");
        
        Group ce_circ_grp = new Group(composite_7, SWT.NONE);
        ce_circ_grp.setLayout(new GridLayout(2, false));
        ce_circ_grp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        ce_circ_grp.setText("Add circuit");
        
        ce_circuit = new Combo(ce_circ_grp, SWT.NONE);
        ce_circuit.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
        
        ce_source = new Combo(ce_circ_grp, SWT.READ_ONLY);
        ce_source.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
        ce_source.setToolTipText("Specify source contact name");
        
        ce_circ_add = new Button(ce_circ_grp, SWT.NONE);
        ce_circ_add.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1));
        ce_circ_add.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                schemeEditorAddCircuit();
            }
        });
        ce_circ_add.setToolTipText("Adds new circuit with a specified name or replaces existing circuit");
        ce_circ_add.setText("Add");
        
        ce_circ_del = new Button(ce_circ_grp, SWT.NONE);
        ce_circ_del.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true, 1, 1));
        ce_circ_del.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                schemeEditorDelCircuit();
            }
        });
        ce_circ_del.setToolTipText("Deletes circuit with specified name");
        ce_circ_del.setText("Delete");
        
        Group ce_cont_grp = new Group(composite_7, SWT.NONE);
        ce_cont_grp.setLayout(new GridLayout(2, false));
        ce_cont_grp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        ce_cont_grp.setText("Add contact");
        
        ce_circuit2 = new Combo(ce_cont_grp, SWT.READ_ONLY);
        ce_circuit2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
        ce_circuit2.setToolTipText("Specify circuit name");
        
        ce_drain = new Combo(ce_cont_grp, SWT.READ_ONLY);
        ce_drain.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
        ce_drain.setToolTipText("Specify destination contact name");
        
        ce_cont_add = new Button(ce_cont_grp, SWT.NONE);
        ce_cont_add.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true, 1, 1));
        ce_cont_add.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                schemeEditorAddContact();
            }
        });
        ce_cont_add.setToolTipText("Adds new contact to selected circuit");
        ce_cont_add.setText("Add");
        
        ce_cont_del = new Button(ce_cont_grp, SWT.NONE);
        ce_cont_del.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, true, true, 1, 1));
        ce_cont_del.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                schemeEditorDelContact();
            }
        });
        ce_cont_del.setToolTipText("Deletes specified contact from specified circuit");
        ce_cont_del.setText("Delete");
        
        Group ce_input_grp = new Group(composite_7, SWT.NONE);
        ce_input_grp.setLayout(new GridLayout(2, false));
        ce_input_grp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
        ce_input_grp.setText("Add input");
        
        ce_input = new Combo(ce_input_grp, SWT.NONE);
        ce_input.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
        ce_input.addVerifyListener(new VerifyListener() {
            public void verifyText(VerifyEvent evt) {
                if((ce_input.getText() + evt.text).matches("[A-Za-z][A-Za-z0-9_]*")) evt.doit = true;
                else evt.doit = false;
            }
        });
        ce_input.setToolTipText("Specify input name");
        
        ce_input_add = new Button(ce_input_grp, SWT.NONE);
        ce_input_add.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, false, 1, 1));
        ce_input_add.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                schemeEditorAddInput();
            }
        });
        ce_input_add.setToolTipText("Adds new input to scheme");
        ce_input_add.setText("Add");
        
        ce_input_del = new Button(ce_input_grp, SWT.NONE);
        ce_input_del.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                schemeEditorDelInput();
            }
        });
        ce_input_del.setToolTipText("Deletes specified input");
        ce_input_del.setText("Delete");
        
        Group ce_output_grp = new Group(composite_7, SWT.NONE);
        ce_output_grp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
        ce_output_grp.setText("Add output");
        ce_output_grp.setLayout(new GridLayout(2, false));
        
        ce_output = new Combo(ce_output_grp, SWT.NONE);
        ce_output.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
        ce_output.addVerifyListener(new VerifyListener() {
            public void verifyText(VerifyEvent evt) {
                if((ce_output.getText() + evt.text).matches("[A-Za-z][A-Za-z0-9_]*")) evt.doit = true;
                else evt.doit = false;
            }
        });
        ce_output.setToolTipText("Specify output name");
        
        ce_output_add = new Button(ce_output_grp, SWT.NONE);
        ce_output_add.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                schemeEditorAddOutput();
            }
        });
        ce_output_add.setToolTipText("Adds new output to scheme");
        ce_output_add.setText("Add");
        
        ce_output_del = new Button(ce_output_grp, SWT.NONE);
        ce_output_del.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                schemeEditorDelOutput();
            }
        });
        ce_output_del.setToolTipText("Deletes specified output");
        ce_output_del.setText("Delete");
        scrolledComposite_1.setContent(composite_7);
        scrolledComposite_1.setMinSize(composite_7.computeSize(SWT.DEFAULT, SWT.DEFAULT));
        
        ce_view = new Text(sashForm_1, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI);
        ce_view.setEditable(false);
        sashForm_1.setWeights(new int[] {1, 1});

        tabSignalsEditor = new TabItem(mainWindowTabFolder, SWT.NONE);
        tabSignalsEditor.setText("Signals Editor");

        se_composite = new Composite(mainWindowTabFolder, SWT.NONE);
        tabSignalsEditor.setControl(se_composite);
        se_composite.setLayout(new BorderLayout(0, 0));
        
        Composite composite_5 = new Composite(se_composite, SWT.NONE);
        composite_5.setLayoutData(BorderLayout.NORTH);
        composite_5.setLayout(new GridLayout(2, false));
        
        se_save = new Button(composite_5, SWT.NONE);
        se_save.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                saveSignals();
            }
        });
        se_save.setText("Save Signals");
        
        se_load = new Button(composite_5, SWT.NONE);
        se_load.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                loadSignals();
            }
        });
        se_load.setText("Reload Signals");
        
        Composite composite_8 = new Composite(se_composite, SWT.NONE);
        composite_8.setLayoutData(BorderLayout.CENTER);
        
        se_view = new Text(composite_8, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI);
        se_view.setEnabled(true);
        se_view.setEditable(false);
        
        se_signal = new Combo(composite_8, SWT.READ_ONLY);
        se_signal.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                signalEditorSelectionChanged();
            }
        });
        
        se_add = new Button(composite_8, SWT.NONE);
        se_add.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                signalEditorAddSignal();
            }
        });
        se_add.setText("Add signal");
        
        se_del = new Button(composite_8, SWT.NONE);
        se_del.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                signalEditorDelSignal();
            }
        });
        se_del.setText("Delete signal");
        
        se_time = new Text(composite_8, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
        
        se_state = new Text(composite_8, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
        GroupLayout gl_composite_8 = new GroupLayout(composite_8);
        gl_composite_8.setHorizontalGroup(
            gl_composite_8.createParallelGroup(GroupLayout.LEADING)
                .add(gl_composite_8.createSequentialGroup()
                    .add(10)
                    .add(gl_composite_8.createParallelGroup(GroupLayout.LEADING)
                        .add(se_signal, GroupLayout.PREFERRED_SIZE, 237, GroupLayout.PREFERRED_SIZE)
                        .add(se_time, GroupLayout.PREFERRED_SIZE, 237, GroupLayout.PREFERRED_SIZE)
                        .add(se_state, GroupLayout.PREFERRED_SIZE, 237, GroupLayout.PREFERRED_SIZE)
                        .add(gl_composite_8.createSequentialGroup()
                            .add(se_add, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE)
                            .add(6)
                            .add(se_del, GroupLayout.PREFERRED_SIZE, 75, GroupLayout.PREFERRED_SIZE)))
                    .add(6)
                    .add(se_view, GroupLayout.PREFERRED_SIZE, 513, GroupLayout.PREFERRED_SIZE))
        );
        gl_composite_8.setVerticalGroup(
            gl_composite_8.createParallelGroup(GroupLayout.LEADING)
                .add(gl_composite_8.createSequentialGroup()
                    .add(10)
                    .add(se_signal, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                    .add(8)
                    .add(se_time, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE)
                    .add(6)
                    .add(se_state, GroupLayout.PREFERRED_SIZE, 150, GroupLayout.PREFERRED_SIZE)
                    .add(6)
                    .add(gl_composite_8.createParallelGroup(GroupLayout.LEADING)
                        .add(se_add, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)
                        .add(se_del, GroupLayout.PREFERRED_SIZE, 25, GroupLayout.PREFERRED_SIZE)))
                .add(se_view, GroupLayout.PREFERRED_SIZE, 429, GroupLayout.PREFERRED_SIZE)
        );
        composite_8.setLayout(gl_composite_8);
        
        TabItem LogTab = new TabItem(mainWindowTabFolder, SWT.NONE);
        LogTab.setText("Logs and results");

        Composite logComposite = new Composite(mainWindowTabFolder, SWT.NONE);
        LogTab.setControl(logComposite);
        logComposite.setLayout(new BorderLayout(0, 0));

        TabFolder logTabFolder = new TabFolder(logComposite, SWT.BOTTOM);
        logTabFolder.setLayoutData(BorderLayout.CENTER);

        TabItem modelingResultsTab = new TabItem(logTabFolder, SWT.NONE);
        modelingResultsTab.setText("Modeling results");

        Composite modelingResultsComposite = new Composite(logTabFolder, SWT.NONE);
        modelingResultsTab.setControl(modelingResultsComposite);
        modelingResultsComposite.setLayout(new FillLayout(SWT.HORIZONTAL));

        modelingResultsText = new Text(modelingResultsComposite, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
        modelingResultsText.setEditable(false);

        TabItem warningsTab = new TabItem(logTabFolder, SWT.NONE);
        warningsTab.setText("Warnings");

        Composite warningsComposite = new Composite(logTabFolder, SWT.NONE);
        warningsTab.setControl(warningsComposite);
        warningsComposite.setLayout(new FillLayout(SWT.HORIZONTAL));

        warningText = new Text(warningsComposite, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
        warningText.setEditable(false);

        TabItem errorsTab = new TabItem(logTabFolder, SWT.NONE);
        errorsTab.setText("Errors");

        Composite errorsComposite = new Composite(logTabFolder, SWT.NONE);
        errorsTab.setControl(errorsComposite);
        errorsComposite.setLayout(new FillLayout(SWT.HORIZONTAL));

        errorsText = new Text(errorsComposite, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
        errorsText.setEditable(false);
        
        TabItem logsTab = new TabItem(logTabFolder, SWT.NONE);
        logsTab.setText("Logs");
        
        Composite fullLogComposite = new Composite(logTabFolder, SWT.NONE);
        logsTab.setControl(fullLogComposite);
        fullLogComposite.setLayout(new FillLayout(SWT.HORIZONTAL));
        
        fullLogText = new Text(fullLogComposite, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
        fullLogText.setEditable(false);
              
        sashForm_1.setWeights(new int[] { 1, 3 });
        
        setControlsAndMenusEnabled(false);
        schemeEditorSetEnabled(false);
        signalEditorSetEnabled(false);
    }