Class CodeAssistFactory


  • @PublicAPI
    public class CodeAssistFactory
    extends Object
    Manages the creation of Chemical Terms related components, such as the Code Assist text field, toolbars, favorite and macro handling components, and validation response component.
    • Field Detail

      • PROPERTY_KEY_FACTORY_INSTANCE

        public static final String PROPERTY_KEY_FACTORY_INSTANCE
        property key for factory instances
        See Also:
        Constant Field Values
    • Method Detail

      • createChemicalTermsTextPane

        public static JTextPane createChemicalTermsTextPane()
        Creates a JTextPane instance with code assist capabilities.
        Default toolbar configuration will be used for toolbars.
        Available function list will be shown when typing ctrl-space.
        Default help text will be shown in empty textpane. Molecule context will be used.
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(chemaxon.marvin.util.codeassist.CodeAssistDataProvider.Context context)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Default toolbar configuration will be used for toolbars.
        Available function list will be shown when typing ctrl-space.
        Default help text will be shown in empty textpane.
        Parameters:
        context - is the data provider context
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        public static JTextPane createChemicalTermsTextPane​(boolean helpText)
        Creates a JTextPane instance with code assist capabilities.
        Default toolbar configuration will be used for toolbars.
        Available function list will be shown when typing ctrl-space.
        Parameters:
        helpText - flags if default help text is shown in empty textpane
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(boolean helpText,
                                                            chemaxon.marvin.util.codeassist.CodeAssistDataProvider.Context context)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Default toolbar configuration will be used for toolbars.
        Available function list will be shown when typing ctrl-space.
        Parameters:
        helpText - flags if default help text is shown in empty textpane
        context - is the data provider context
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(boolean helpText,
                                                            boolean autoPopup)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Default toolbar configuration will be used for toolbars.
        Parameters:
        helpText - flags if default help text is shown in empty textpane
        autoPopup - indicates available function list pops up on any keypress
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(boolean helpText,
                                                            boolean autoPopup,
                                                            boolean expertMode)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Default toolbar configuration will be used for toolbars.
        Parameters:
        helpText - flags if default help text is shown in empty textpane
        autoPopup - indicates available function list pops up on any keypress
        expertMode - when true, code assist is in expert mode, showing more detailed informations like arguments
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(boolean helpText,
                                                            boolean autoPopup,
                                                            chemaxon.marvin.util.codeassist.CodeAssistDataProvider.Context context)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Default toolbar configuration will be used for toolbars.
        Parameters:
        helpText - flags if default help text is shown in empty textpane
        autoPopup - indicates available function list pops up on any keypress
        context - is the data provider context
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(String prefix)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Default toolbar configuration will be used for toolbars.
        Available function list will be shown when typing ctrl-space.
        Default help text will be shown in empty textpane.
        Parameters:
        prefix - is the code assist invoke prefix
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(String prefix,
                                                            chemaxon.marvin.util.codeassist.CodeAssistDataProvider.Context context)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Default toolbar configuration will be used for toolbars.
        Available function list will be shown when typing ctrl-space.
        Default help text will be shown in empty textpane.
        Parameters:
        prefix - is the code assist invoke prefix
        context - is the data provider context
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(String prefix,
                                                            boolean helpText)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Default toolbar configuration will be used for toolbars.
        Available function list will be shown when typing ctrl-space
        Parameters:
        prefix - is the code assist invoke prefix
        helpText - flags if default help text is shown in empty textpane
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(String prefix,
                                                            boolean helpText,
                                                            chemaxon.marvin.util.codeassist.CodeAssistDataProvider.Context context)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Default toolbar configuration will be used for toolbars.
        Available function list will be shown when typing ctrl-space
        Parameters:
        prefix - is the code assist invoke prefix
        helpText - flags if default help text is shown in empty textpane
        context - is the data provider context
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(String prefix,
                                                            boolean helpText,
                                                            boolean autoPopup)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Default toolbar configuration will be used for toolbars.
        Parameters:
        prefix - is the code assist invoke prefix
        helpText - flags if default help text is shown in empty textpane
        autoPopup - indicates available function list pops up on any keypress
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(String prefix,
                                                            boolean helpText,
                                                            boolean autoPopup,
                                                            boolean expertMode)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Default toolbar configuration will be used for toolbars.
        Parameters:
        prefix - is the code assist invoke prefix
        helpText - flags if default help text is shown in empty textpane
        autoPopup - indicates available function list pops up on any keypress
        expertMode - when true, code assist is in expert mode, showing more detailed informations like arguments
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(String prefix,
                                                            boolean helpText,
                                                            boolean autoPopup,
                                                            chemaxon.marvin.util.codeassist.CodeAssistDataProvider.Context context)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Default toolbar configuration will be used for toolbars.
        Parameters:
        prefix - is the code assist invoke prefix
        helpText - flags if default help text is shown in empty textpane
        autoPopup - indicates available function list pops up on any keypress
        context - is the data provider context
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(String prefix,
                                                            String helpText)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Default toolbar configuration will be used for toolbars.
        Available function list will be shown when typing ctrl-space
        Parameters:
        prefix - is the code assist invoke prefix
        helpText - is the text displayed in empty textpane
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(String prefix,
                                                            String helpText,
                                                            boolean autoPopup)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Default toolbar configuration will be used for toolbars.
        Parameters:
        prefix - is the code assist invoke prefix
        helpText - is the text displayed in empty textpane
        autoPopup - indicates available function list pops up on any keypress
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(String prefix,
                                                            String helpText,
                                                            boolean autoPopup,
                                                            boolean expertMode)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Default toolbar configuration will be used for toolbars.
        Parameters:
        prefix - is the code assist invoke prefix
        helpText - is the text displayed in empty textpane
        autoPopup - indicates available function list pops up on any keypress
        expertMode - when true, code assist is in expert mode, showing more detailed informations like arguments
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(String prefix,
                                                            String helpText,
                                                            boolean autoPopup,
                                                            chemaxon.marvin.util.codeassist.CodeAssistDataProvider.Context context)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Default toolbar configuration will be used for toolbars.
        Parameters:
        prefix - is the code assist invoke prefix
        helpText - is the text displayed in empty textpane
        autoPopup - indicates available function list pops up on any keypress
        context - is the data provider context
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(String prefix,
                                                            String helpText,
                                                            boolean autoPopup,
                                                            String toolbarConfigPath)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Parameters:
        prefix - is the code assist invoke prefix
        helpText - is the text displayed in empty textpane
        autoPopup - available function list pops up on any keypress
        toolbarConfigPath - path to toolbars configuration xml
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(String prefix,
                                                            String helpText,
                                                            boolean autoPopup,
                                                            String toolbarConfigPath,
                                                            boolean expertMode)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Parameters:
        prefix - is the code assist invoke prefix
        helpText - is the text displayed in empty textpane
        autoPopup - available function list pops up on any keypress
        toolbarConfigPath - path to toolbars configuration xml
        expertMode - when true, code assist is in expert mode, showing more detailed informations like arguments
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(String prefix,
                                                            String helpText,
                                                            boolean autoPopup,
                                                            String toolbarConfigPath,
                                                            chemaxon.marvin.util.codeassist.CodeAssistDataProvider.Context context)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Parameters:
        prefix - is the code assist invoke prefix
        helpText - is the text displayed in empty textpane
        autoPopup - available function list pops up on any keypress
        toolbarConfigPath - path to toolbars configuration xml
        context - is the data provider context
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        @Deprecated
        public static JTextPane createChemicalTermsTextPane​(String prefix,
                                                            String helpText,
                                                            boolean autoPopup,
                                                            String toolbarConfigPath,
                                                            boolean expertMode,
                                                            chemaxon.marvin.util.codeassist.CodeAssistDataProvider.Context context)
        Deprecated.
        use createChemicalTermsTextPane(CodeAssistConfiguration) Creates a JTextPane instance with code assist capabilities.
        Parameters:
        prefix - is the code assist invoke prefix
        helpText - is the text displayed in empty textpane
        autoPopup - available function list pops up on any keypress
        toolbarConfigPath - path to toolbars configuration xml
        expertMode - when true, code assist is in expert mode, showing more detailed informations like arguments
        context - is the data provider context
        Returns:
        JTextPane instance with code assist capabilities.
      • createChemicalTermsTextPane

        protected static JTextPane createChemicalTermsTextPane​(String prefix,
                                                               String helpText,
                                                               boolean autoPopup,
                                                               String toolbarConfigPath,
                                                               boolean expertMode,
                                                               chemaxon.marvin.util.codeassist.CodeAssistDataProvider.Context context,
                                                               boolean addServices)
        Creates a JTextPane instance with code assist capabilities.
        Parameters:
        prefix - is the code assist invoke prefix
        helpText - is the text displayed in empty textpane
        autoPopup - available function list pops up on any keypress
        toolbarConfigPath - path to toolbars configuration xml
        expertMode - when true, code assist is in expert mode, showing more detailed informations like arguments
        context - is the data provider context
        addServices - if true services are added to the completion list
        Returns:
        JTextPane instance with code assist capabilities.
        Since:
        5.6
      • getToolBar

        public static JToolBar getToolBar​(JTextPane textPane)
        Returns the default toolbar for textPane instance NOTE: textPane have to be created with this factory
        Parameters:
        textPane - is the textPane requesting toolbar for
        Returns:
        the default toolbar for textPane instance
      • getOperatorToolBar

        public static JToolBar getOperatorToolBar​(JTextPane textPane)
        Returns the operator toolbar for textPane instance NOTE: textPane have to be created with this factory
        Parameters:
        textPane - is the textPane requesting toolbar for
        Returns:
        the default toolbar for textPane instance
      • getCusromToolBar

        public static JToolBar getCusromToolBar​(JTextPane textPane,
                                                String toolbarID)
        Returns a custom toolbar for textPane instance NOTE: textPane have to be created with this factory
        Parameters:
        textPane - is the textPane requesting toolbar for
        toolbarID - is the id of the custom toolbar defined in menu configuration xml
        Returns:
        the custom toolbar for textPane instance
      • getValidationResultLabel

        public static JLabel getValidationResultLabel​(JTextPane textPane,
                                                      chemaxon.marvin.util.codeassist.CodeAssistDataProvider.Context context)
        Returns a JLabel instance, dinamically showing validation result of textPane NOTE: textPane have to be created with this factory
        Parameters:
        textPane - is the textPane requesting validation label for
        context - is the context used for validating
        Returns:
        a JLabel instance
      • getFavoritesComboBox

        public JComboBox getFavoritesComboBox()
        Creates and returns the favorites combo instance
        Returns:
        the favorites combo instance
      • showManageFavoritesDialog

        public void showManageFavoritesDialog()
        Shows the modal favourite manager dialog
      • showManageMacrosDialog

        public void showManageMacrosDialog()
        Shows the modal macro manager dialog
      • showInsertFunctionDialog

        public void showInsertFunctionDialog()
        Shows the modal insert function dialog
      • saveAsMacro

        public void saveAsMacro()
        Shows the modal macro manager dialog, setting current selection as new macro
      • insertText

        public void insertText​(String text)
        Inserts the given string to textPane at caret position. Whitespaces will be added when necessary
        Parameters:
        text - is the text to be inserted
      • reloadCodeCompletionData

        public static void reloadCodeCompletionData()
        Forces all CodeAssist instances created with this factory to reload the code completion data.
        Since:
        5.10