Package com.qspin.qtaste.ui.jedit

Examples of com.qspin.qtaste.ui.jedit.NonWrappingTextPane


                        String fileName = (String) table.getModel().getValueAt(rowIndex, TCResultsSelectionListeners.FILE_NAME);
                        int gotoLine = (Integer) table.getModel().getValueAt(rowIndex, TCResultsSelectionListeners.LINE);

                        // load the file into the tabbedPaned
                        File f = new File(fileName);
                        NonWrappingTextPane textPane = null;
                        if (f.exists() && f.canRead()) {
                            textPane = mTestCasePane.loadTestCaseSource(f, true, false);
                            //mTestCasepane.setTestCaseSourceURL(fileName);

                            //TestResult tr = (TestResult)tcReasonTable.getModel().getValueAt(rowIndex, TCResultsSelectionListeners.OBJECT);
                            //int gotoLine = tr.getFailedLineNumber();
                            mTestCasePane.tabbedPane.setSelectedIndex(TestCasePane.SOURCE_INDEX);
                            // now go to the given line
                            textPane.selectLine(gotoLine);
                        }
                    }
                }
            }
        }
View Full Code Here


        // rename necessary classes
        fn.setFile(newFile);
        testScriptFileName = fn.getFile().getCanonicalPath() + "/" + StaticConfiguration.TEST_SCRIPT_FILENAME;
              fn.getPythonTestScript().setTestScriptFile(new File(testScriptFileName));
              // rename the testscript name
              NonWrappingTextPane tcPane = testCasePane.getTcSourceTextPane();
              if (tcPane!=null)
              {
                tcPane.setFileName(testScriptFileName);
              }
              // rename the testdata name
              TestDataEditor tcDataPane = testCasePane.getTestDataPane();
              if (tcDataPane!=null)
              {
View Full Code Here

                }
                if (!isDocTabSelected()) {
                    return;
                }
                // generate doc if necessary
                NonWrappingTextPane tsPane = getTcSourceTextPane();
                if (tsPane != null) {
                    File tsFile = new File(tsPane.getFileName());
                    PythonTestScript pScript = new PythonTestScript(tsFile, getTestSuiteDirectory());
                    if (pScript.isDocSynchronized()) {
                        return;
                    }
                    // re-generate the doc
View Full Code Here

    public boolean checkScriptsSyntax() {
        // check the test scripts syntax
        // save and check syntax of the documents
        for (int i = 0; i < editorTabbedPane.getTabCount(); i++) {
            NonWrappingTextPane tabTextPane = getTextPane(i);
            if (tabTextPane != null) {
                if (tabTextPane.isModified()) {
                    tabTextPane.save();
                }
                // check only opened Python files
                if (tabTextPane.getFileName().endsWith(".py")) {
                  ScriptCheckSyntaxValidator scriptCheckSyntaxValidator =
                          new ScriptCheckSyntaxValidator(tabTextPane.getFileName(), tabTextPane.getText());
                  if (!scriptCheckSyntaxValidator.check()) {
                    return false;
                  }
                }
            }
View Full Code Here

            absolutePath = f.getAbsoluteFile().getCanonicalPath();
        } catch (IOException e) {
            logger.fatal("Cannot load testcase source", e);
            return null;
        }
        NonWrappingTextPane textPane = activateSourceIfAlreadyLoaded(absolutePath, isTestScript);
        if (!force & textPane != null) {
            return textPane;
        }
        if (f.exists() && f.canRead()) {
            StringBuffer contents = new StringBuffer();
            BufferedReader in = null;
            try {
                in = new BufferedReader(new FileReader(f));
                while (in.ready()) {
                    contents.append(in.readLine()).append("\n");
                }
                boolean newTab = textPane == null;
                if (textPane == null) {
                    textPane = new NonWrappingTextPane(isTestScript);
                }
                if (newTab) {
                    JScrollPane sp = new JScrollPane(textPane);
                    if (absolutePath.endsWith(".py")) {
                        textPane.init("text/python");
                    } else if (absolutePath.endsWith(".xml")) {
                        textPane.init("text/xml");
                    } else if (absolutePath.endsWith(".sh")) {
                        textPane.init("text/bash");
                    } else if (absolutePath.endsWith(".bat") || absolutePath.endsWith(".cmd")) {
                        textPane.init("text/dosbatch");
                    } else {
                        textPane.init("text/plain");
                    }
                    textPane.setFileName(absolutePath);

                    if (isTestScript) {
                        tcSourceTextPane = textPane;
                    }
                    textPane.setTestCasePane(this);

                    editorTabbedPane.addTab(f.getName(), null, sp, absolutePath);
                    editorTabbedPane.setSelectedIndex(editorTabbedPane.getTabCount() - 1);
                    textPane.addDocumentListener();
                    textPane.addPropertyChangeListener("isModified", new PropertyChangeListener() {

                        public void propertyChange(PropertyChangeEvent evt) {
                            if (evt.getNewValue().equals(true)) {
                                String currentTitle = editorTabbedPane.getTitleAt(editorTabbedPane.getSelectedIndex());
                                if (!currentTitle.contains("*")) {
                                    currentTitle += " *";
                                    editorTabbedPane.setTitleAt(editorTabbedPane.getSelectedIndex(), currentTitle);
                                }
                            } else {
                                String currentTitle = editorTabbedPane.getTitleAt(editorTabbedPane.getSelectedIndex());
                                if (currentTitle.contains(" *")) {
                                    currentTitle = currentTitle.replace(" *", "");
                                    editorTabbedPane.setTitleAt(editorTabbedPane.getSelectedIndex(), currentTitle);
                                }
                            }
                        }
                    });
                }
                setTestCaseSource(textPane, absolutePath, contents.toString(), isTestScript);
                textPane.setModified(false);
                textPane.clearUndos();

                if (absolutePath.endsWith(".py")) {
                    new DebuggerShortcuts(this)// TO MOVE TO NONWRAPPINGTEXTPANE
                }
                new GenericShortcuts(this); // TO MOVE TO NONWRAPPINGTEXTPANE
View Full Code Here

     * Close all tabs and ask user confirmation if a file is modified
     */
    public void closeAllTabs() {
        while (editorTabbedPane.getTabCount() > 0) {
            // check if the current tab must be saved
            NonWrappingTextPane currentPane = getTextPane(0);
            if (currentPane != null) {
                if (currentPane.isModified()) {

                    if (JOptionPane.showConfirmDialog(null, "Do you want to save your current modification in '" + currentPane.getFileName() + "?'",
                            "Save confirmation", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
                        currentPane.save();
                    }
                }
                // remove all breakpoints and listeners if any
                currentPane.removeAllBreakpoints();
                currentPane = null;
            }
            TestDataEditor currentDataPane = getTestDataPane(0);
            if (currentDataPane != null) {
                if (currentDataPane.isModified()) {
View Full Code Here

    /**
     * This method saves the current document only if the current pane is a textpane containing a python script
     */
    public void saveActiveDocument() {
        NonWrappingTextPane activeTextPane = getActiveTextPane();
        if (activeTextPane != null) {
            activeTextPane.save();
        }

    }
View Full Code Here

    }

    public int getTestScriptTabIndex() {
        for (int i = 0; i < editorTabbedPane.getTabCount(); i++) {
            NonWrappingTextPane tabTextPane = getTextPane(i);
            if (tabTextPane != null) {
                if (tabTextPane.isTestScript) {
                    return i;
                }
            }
View Full Code Here

    }

    public NonWrappingTextPane[] getVisibleTextPanes() {
        ArrayList<NonWrappingTextPane> textPanes = new ArrayList<NonWrappingTextPane>();
        for (int i = 0; i < editorTabbedPane.getTabCount(); i++) {
            NonWrappingTextPane tabTextPane = getTextPane(i);
            if (tabTextPane == null) {
                continue;
            }
            textPanes.add(tabTextPane);
View Full Code Here

        return array;
    }

    public int getTextPane(String fileName) {
        for (int i = 0; i < editorTabbedPane.getTabCount(); i++) {
            NonWrappingTextPane tabTextPane = getTextPane(i);
            if (tabTextPane == null) {
                continue;
            }
            if (tabTextPane.getFileName().equals(fileName)) {
                return i;
            }
        }
        return -1; // not found       
View Full Code Here

TOP

Related Classes of com.qspin.qtaste.ui.jedit.NonWrappingTextPane

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.