Exemple #1
0
        private void ActivatePlugin()
        {
            DocumentType documentTypeHtml =
                new DocumentType(Constants.DOCUMENT_TYPE_HTML);

            DocumentType documentTypeHtm =
                new DocumentType(Constants.DOCUMENT_TYPE_HTM);

            DocumentType documentTypeCss =
                new DocumentType(Constants.DOCUMENT_TYPE_CSS);

            DocumentManager documentManager =
                DocumentManager.GetInstance();

            documentManager.RegisterDocumentLanguage(
                documentTypeHtml, Constants.SCINTILLA_LANGUAGE_HTML);

            documentManager.RegisterDocumentLanguage(
                documentTypeHtm, Constants.SCINTILLA_LANGUAGE_HTML);

            documentManager.RegisterDocumentLanguage(
                documentTypeCss, Constants.SCINTILLA_LANGUAGE_CSS);

            ApplicationManager applicationManager =
                ApplicationManager.GetInstance();

            OpenDocumentHandler openHandler =
                applicationManager.GetOpenDocumentHandler(
                    QuickSharp.TextEditor.Constants.DOCUMENT_TYPE_TXT);

            if (openHandler != null)
            {
                applicationManager.RegisterOpenDocumentHandler(
                    documentTypeHtml, openHandler);

                applicationManager.RegisterOpenDocumentHandler(
                    documentTypeHtm, openHandler);

                applicationManager.RegisterOpenDocumentHandler(
                    documentTypeCss, openHandler);
            }

            /*
             * Add to the non-source tools list (create if necessary).
             */

            ApplicationStorage appStore = ApplicationStorage.GetInstance();

            List <String> nonToolSourceTypes = appStore.Get(
                Constants.APP_STORE_KEY_NON_TOOL_SOURCE_TYPES,
                typeof(List <String>)) as List <String>;

            if (nonToolSourceTypes != null)
            {
                nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_HTML);
                nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_HTM);
                nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_CSS);
            }
        }
Exemple #2
0
        private void ActivatePlugin()
        {
            /*
             * Define the document handling.
             */

            _documentType = new DocumentType(Constants.DOCUMENT_TYPE_VB);

            DocumentManager.GetInstance().RegisterDocumentLanguage(
                _documentType, Constants.SCINTILLA_LANGUAGE_VB);

            ApplicationManager applicationManager =
                ApplicationManager.GetInstance();

            OpenDocumentHandler openHandler =
                applicationManager.GetOpenDocumentHandler(
                    QuickSharp.TextEditor.Constants.DOCUMENT_TYPE_TXT);

            if (openHandler != null)
            {
                applicationManager.RegisterOpenDocumentHandler(
                    _documentType, openHandler);
            }

            /*
             * Define the build tools.
             */

            _buildToolManager = BuildToolManager.GetInstance();

            _buildToolManager.RegisterBuildCommand(
                _documentType,
                QuickSharp.BuildTools.Constants.ACTION_COMPILE,
                CompileBuildCommand);

            _buildToolManager.RegisterBuildCommand(
                _documentType,
                QuickSharp.BuildTools.Constants.ACTION_RUN,
                RunBuildCommand);

            _buildToolManager.RegisterLineParser(
                Resources.MicrosoftVBLineParser,
                _documentType,
                QuickSharp.BuildTools.Constants.ACTION_COMPILE,
                new VBNetOutputLineParser());

            if (_buildToolManager.BuildTools.GetToolCount(
                    _documentType) == 0)
            {
                CreateDefaultTools();
            }

            _buildToolManager.UpdateTools(_documentType);
            _buildToolManager.BuildTools.SortTools();
        }
        /// <summary>
        /// Registers an open document handler for a document type provided as a string.
        /// A handler will be rejected if a handler has already been registered for the document type.
        /// </summary>
        /// <param name="documentType">The document type to be opened by the handler.</param>
        /// <param name="handler">The handler used to open documents of the registered type.</param>
        /// <returns>True if the handler was registered successfully.</returns>
        public bool RegisterOpenDocumentHandler(
            string documentType, OpenDocumentHandler handler)
        {
            if (_openDocumentHandlers.ContainsKey(documentType))
            {
                return(false);
            }

            _openDocumentHandlers[documentType] = handler;

            return(true);
        }
Exemple #4
0
        /// <summary>
        /// Constructor
        /// </summary>
        public SordListView()
        {
            this.ColumnHeaderName.Text          = EloixClientUI.Properties.Resources.Name;
            this.ColumnHeaderXDate.Text         = EloixClientUI.Properties.Resources.DocumentDate;
            this.ColumnHeaderIDate.Text         = EloixClientUI.Properties.Resources.FilingDate;
            this.ColumnHeaderOwner.Text         = EloixClientUI.Properties.Resources.Onwer;
            this.ColumnHeaderMaskName.Text      = EloixClientUI.Properties.Resources.DocMask;
            this.ColumnHeaderVersion.Text       = EloixClientUI.Properties.Resources.Version;
            this.ColumnHeaderFileSize.Text      = EloixClientUI.Properties.Resources.Size;
            this.ColumnHeaderFileSize.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
            this.ColumnHeaderVersionDate.Text   = EloixClientUI.Properties.Resources.CreateDate;
            this.ColumnHeaderVersionUser.Text   = EloixClientUI.Properties.Resources.CreateBy;
            this.ColumnHeaderArcPath.Text       = EloixClientUI.Properties.Resources.ArcPath;
            this.ColumnHeaderLockId.Text        = EloixClientUI.Properties.Resources.LockId;
            this.ColumnHeaderLockName.Text      = EloixClientUI.Properties.Resources.LockName;


            this.ColumnHeaderName.Name        = "Name";
            this.ColumnHeaderXDate.Name       = "XDate";
            this.ColumnHeaderIDate.Name       = "IDate";
            this.ColumnHeaderOwner.Name       = "Owner";
            this.ColumnHeaderMaskName.Name    = "MaskName";
            this.ColumnHeaderVersion.Name     = "Version";
            this.ColumnHeaderFileSize.Name    = "FileSize";
            this.ColumnHeaderVersionDate.Name = "VersionDate";
            this.ColumnHeaderVersionUser.Name = "VersionUser";
            this.ColumnHeaderArcPath.Name     = "ArcPath";
            this.ColumnHeaderLockId.Name      = "LockId";
            this.ColumnHeaderLockName.Name    = "LockName";

            // some columns should be displayed in design mode
            base.Columns.Add(ColumnHeaderName);
            base.Columns.Add(ColumnHeaderXDate);
            base.Columns.Add(ColumnHeaderIDate);
            base.Columns.Add(ColumnHeaderMaskName);
            base.Columns.Add(ColumnHeaderVersion);
            base.Columns.Add(ColumnHeaderFileSize);
            base.Columns.Add(ColumnHeaderOwner);
            base.Columns.Add(ColumnHeaderVersionDate);
            base.Columns.Add(ColumnHeaderVersionUser);
            base.Columns.Add(ColumnHeaderArcPath);
            base.Columns.Add(ColumnHeaderLockName);

            openDocumentHandler = new OpenDocumentHandler();
        }
Exemple #5
0
        /// <summary>
        /// Constructor
        /// </summary>
        public TaskListView()
        {
            this.ColumnHeaderTaskType.Text = EloixClientUI.Properties.Resources.TaskType;
            this.ColumnHeaderPriority.Text = EloixClientUI.Properties.Resources.Priority;
            this.ColumnHeaderName.Text     = EloixClientUI.Properties.Resources.Name;
            this.ColumnHeaderOwner.Text    = EloixClientUI.Properties.Resources.Onwer;
            this.ColumnHeaderDate.Text     = EloixClientUI.Properties.Resources.TaskDate;
            this.ColumnHeaderMemo.Text     = EloixClientUI.Properties.Resources.TaskMemo;

            // some columns should be displayed in design mode
            base.Columns.Add(ColumnHeaderName);
            base.Columns.Add(ColumnHeaderPriority);
            base.Columns.Add(ColumnHeaderTaskType);
            base.Columns.Add(ColumnHeaderDate);
            base.Columns.Add(ColumnHeaderOwner);
            base.Columns.Add(ColumnHeaderMemo);

            openDocumentHandler = new OpenDocumentHandler();
        }
        /// <summary>
        /// Unregisters the handler registered for a document type specified as a
        /// string.
        /// </summary>
        /// <param name="documentType">The document type.</param>
        /// <returns>The open document handler or null if the document type is invalid or
        /// no handler exists for the type.</returns>
        public OpenDocumentHandler RemoveOpenDocumentHandler(
            string documentType)
        {
            if (String.IsNullOrEmpty(documentType))
            {
                return(null);
            }

            if (!_openDocumentHandlers.ContainsKey(documentType))
            {
                return(null);
            }

            OpenDocumentHandler handler =
                _openDocumentHandlers[documentType];

            _openDocumentHandlers.Remove(documentType);

            return(handler);
        }
Exemple #7
0
        /// <summary>
        /// Loads a document from the specified path. This performs several steps in the following
        /// order. The path is converted to a DocumentType. Next, each of the registered
        /// document preload handlers is called, if any return false the load is cancelled.
        /// The document type is used to retrieve the open document handler registered for that
        /// type and the handler is used to open the document.
        /// If no handler is available the document is (otionally) passed to the Windows shell
        /// to be opened externally. If this fails the unknown document handler is
        /// retrieved and used to open the document. If this is not available
        /// an optional message is shown and the load fails.
        /// </summary>
        /// <param name="path">The path of the document.</param>
        /// <returns>The loaded document.</returns>
        public IDockContent LoadDocument(string path)
        {
            ClientProfile profile = _applicationManager.ClientProfile;

            /*
             * Look for readonly flag - path will end with '?'. This is really
             * only for the benefit of the document serialisation which needs
             * to be able to restore a readonly file from the save document
             * configuration.
             */

            bool readOnly = false;

            if (path.EndsWith("?"))
            {
                readOnly = true;
                path     = path.TrimEnd('?');
            }

            DocumentType documentType = new DocumentType(path);

            /*
             * Document PreLoad Handlers
             *
             * The idea here is to allow applications to create a chain
             * of filters each being responsible for performing some
             * action on a particular document type. Each handler
             * should immediately return true if it's not interested
             * in the document type passed. The chain will end when the
             * first handler returns false and the document load will be
             * cancelled. Since there is no guarantee of the order in
             * which the handlers are called (registration order will
             * depend on plugin load order which can vary) there should
             * be only one handler for a particular type unless they are
             * completely independent.
             */

            foreach (DocumentPreLoadHandler d in
                     _applicationManager.DocumentPreLoadHandlers)
            {
                if (!d(documentType))
                {
                    return(null);
                }
            }

            OpenDocumentHandler handler =
                _applicationManager.GetOpenDocumentHandler(documentType);

            if (handler == null && _allowShellOpen)
            {
                try
                {
                    FileTools.ShellOpenFile(path);
                    return(null);
                }
                catch
                {
                    /*
                     * Suppress error - if the load fails the document
                     * gets passed to the unknown document handler.
                     */
                }
            }

            if (handler == null)
            {
                handler = _applicationManager.UnknownDocumentHandler;
            }

            if (handler == null)
            {
                if (_showNoHandlerMessage)
                {
                    MessageBox.Show(
                        Resources.NoHandlerMessage,
                        Resources.NoHandlerTitle,
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                }

                return(null);
            }
            else
            {
                return(handler(path, readOnly));
            }
        }
        /*
         * Registration.
         */

        /// <summary>
        /// Registers an open document handler for a document type provided as a DocumentType object.
        /// A handler will be rejected if a handler has already been registered for the document type.
        /// </summary>
        /// <param name="documentType">The document type to be opened by the handler.</param>
        /// <param name="handler">The handler used to open documents of the registered type.</param>
        /// <returns>True if the handler was registered successfully.</returns>
        public bool RegisterOpenDocumentHandler(
            DocumentType documentType, OpenDocumentHandler handler)
        {
            return(RegisterOpenDocumentHandler(
                       documentType.ToString(), handler));
        }
Exemple #9
0
        private void ActivatePlugin()
        {
            /*
             * Register the document types.
             */

            DocumentManager documentManager =
                DocumentManager.GetInstance();

            documentManager.RegisterDocumentLanguage(
                Constants.DOCUMENT_TYPE_ASAX,
                Constants.SCINTILLA_LANGUAGE_ASPX);

            documentManager.RegisterDocumentLanguage(
                Constants.DOCUMENT_TYPE_ASCX,
                Constants.SCINTILLA_LANGUAGE_ASPX);

            documentManager.RegisterDocumentLanguage(
                Constants.DOCUMENT_TYPE_ASHX,
                Constants.SCINTILLA_LANGUAGE_CS);

            documentManager.RegisterDocumentLanguage(
                Constants.DOCUMENT_TYPE_ASMX,
                Constants.SCINTILLA_LANGUAGE_CS);

            documentManager.RegisterDocumentLanguage(
                Constants.DOCUMENT_TYPE_ASPX,
                Constants.SCINTILLA_LANGUAGE_ASPX);

            documentManager.RegisterDocumentLanguage(
                Constants.DOCUMENT_TYPE_MASTER,
                Constants.SCINTILLA_LANGUAGE_ASPX);

            documentManager.RegisterDocumentLanguage(
                Constants.DOCUMENT_TYPE_CONFIG,
                Constants.SCINTILLA_LANGUAGE_XML);

            documentManager.RegisterDocumentLanguage(
                Constants.DOCUMENT_TYPE_SITEMAP,
                Constants.SCINTILLA_LANGUAGE_XML);

            /*
             * Define the document handlers.
             */

            ApplicationManager applicationManager =
                ApplicationManager.GetInstance();

            OpenDocumentHandler openHandler =
                applicationManager.GetOpenDocumentHandler(
                    QuickSharp.TextEditor.Constants.DOCUMENT_TYPE_TXT);

            if (openHandler != null)
            {
                applicationManager.RegisterOpenDocumentHandler(
                    Constants.DOCUMENT_TYPE_ASAX, openHandler);

                applicationManager.RegisterOpenDocumentHandler(
                    Constants.DOCUMENT_TYPE_ASCX, openHandler);

                applicationManager.RegisterOpenDocumentHandler(
                    Constants.DOCUMENT_TYPE_ASHX, openHandler);

                applicationManager.RegisterOpenDocumentHandler(
                    Constants.DOCUMENT_TYPE_ASMX, openHandler);

                applicationManager.RegisterOpenDocumentHandler(
                    Constants.DOCUMENT_TYPE_ASPX, openHandler);

                applicationManager.RegisterOpenDocumentHandler(
                    Constants.DOCUMENT_TYPE_MASTER, openHandler);

                applicationManager.RegisterOpenDocumentHandler(
                    Constants.DOCUMENT_TYPE_CONFIG, openHandler);

                applicationManager.RegisterOpenDocumentHandler(
                    Constants.DOCUMENT_TYPE_SITEMAP, openHandler);
            }

            /*
             * We don't have any build tools but we want ASP.NET files
             * recognised as source files. Register with the
             * non-tool source files list in the application store.
             */

            ApplicationStorage appStore = ApplicationStorage.GetInstance();

            /*
             * We have no dependency on the BuildTools plugin so we
             * can't assume the non-tool source list has been created.
             * Use the Get method to create the list if it doesn't exist.
             */

            List <String> nonToolSourceTypes = appStore.Get(
                Constants.APP_STORE_KEY_NON_TOOL_SOURCE_TYPES,
                typeof(List <String>)) as List <String>;

            if (nonToolSourceTypes != null)
            {
                nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_ASAX);
                nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_ASCX);
                nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_ASHX);
                nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_ASMX);
                nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_ASPX);
                nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_CONFIG);
                nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_MASTER);
                nonToolSourceTypes.Add(Constants.DOCUMENT_TYPE_SITEMAP);
            }
        }