Exemple #1
0
        /// <summary>
        /// Advices the perspective to make the given editor visible.
        /// </summary>
        /// <param name="editor">Editor instance</param>
        /// <param name="editorInput">Input for the editor</param>
        public virtual void ShowEditor(IEditor editor, IEditorInput editorInput)
        {
            if (editor == null)
            {
                return;
            }

            try {
                // Close active editor if there is any
                IEditor activeEditor = ActiveEditor;
                if (activeEditor != null)
                {
                    if (!CanCloseEditor(activeEditor))
                    {
                        return;
                    }
                }

                // Set up new editor
                editor.WidgetFactory = FactoryProvider.Instance.GetWidgetFactory();
                editor.SetEditorInput(editorInput);

                // Make editor visible
                OnShowEditor(editor);

                // Update internal state and dispatch events
                ActiveEditor = editor;
                PerspectiveEventManager.Dispatch(lstnr => lstnr.OnWorkbenchPartOpened(editor), OnDispatchWorkbenchEventException);
            } catch (Exception ex) {
                _log.Error($"Error on showing editor '{editor}' by perspective '{this}'.", ex);
            }
        }
Exemple #2
0
 private void ReportPortalRunner_PageCloseRequest(IEditorInput input)
 {
     if (this.ReportFormInput == input)
     {
         if (this.ReportViewControl != null)
         {
             (this.ReportEditorPart as NetEditor).PageCloseRequest -= new PageCloseRequestHandler(ReportPortalRunner_PageCloseRequest);
             if (this.ReportViewControl != null)
             {
                 //保存用户页面布局
                 this.ReportViewControl.SaveSaveReportUserState();
                 this.ReportViewControl.Release();
                 this.ReportViewControl.Dispose();
                 this.ReportViewControl = null;
             }
         }
     }
 }
Exemple #3
0
        /// <inheritdoc />
        public override void SetEditorInput(IEditorInput editorInput)
        {
            IEditorInput input = editorInput;

            string fileContent;

            using (BufferedStream bufferedStream = new BufferedStream(input.OpenRead())) {
                using (StreamReader streamReader = new StreamReader(bufferedStream)) {
                    fileContent = streamReader.ReadToEnd();
                }
            }

            EditorInput = input;
            EditorText  = fileContent;
            DispatchPropertyChanged(nameof(EditorText));
            EditorTabText = input.Name;
            IsDirty       = false;
        }
Exemple #4
0
        /// <inheritdoc />
        public virtual IEditor OpenEditor(IEditorInput editorInput)
        {
            if (editorInput == null)
            {
                return(null);
            }

            string fileExtension = editorInput.Name.Split('.').Last();

            if (string.IsNullOrWhiteSpace(fileExtension))
            {
                return(null);
            }

            IEditor editor = EditorRegistry.Instance.GetEditorForExtension(fileExtension);

            if (editor == null)
            {
                return(null);
            }

            ShowEditor(editor, editorInput);
            return(editor);
        }
Exemple #5
0
        public override Control CreatePartControl(IEditorPart part, IEditorInput input)
        {
            StringBuilder sb = new StringBuilder();

            try
            {
                this.ReportEditorPart = part;
                this.ReportFormInput  = input as ReportFormInput;
                sb.Append("CreatePartControl end 1");

                this.ParseStaticReportInfo();
                string reportId = this.GetObjectId();
                sb.Append("CreatePartControl end 2");

                object login          = this.ReportFormInput.GetU8Login();
                object rawFilter      = null;
                bool   isShowUI       = false;
                bool   isStaticReport = this.ReportFormInput.IsStaticReport();
                int    viewType       = 1;
                sb.Append("CreatePartControl end 3");
                if (!isStaticReport)
                {
                    rawFilter = this.ReportFormInput.GetRawFilter();
                    isShowUI  = this.ReportFormInput.IsShowUI();
                }
                else
                {
                    viewType = this.ReportFormInput.GetViewType();
                }
                sb.Append("CreatePartControl end 4");
                ClientReportContext context = new ClientReportContext(login);
                RemoteDataHelper    rdh     = new RemoteDataHelper();
                sb.Append("CreatePartControl end 5");
                context.ReportUIUserStateInfo = rdh.GetReportUserState(ClientReportContext.Login, reportId);
                sb.Append("CreatePartControl end 6");
                ClientReportContext.Port     = Cryptography.LoginInfo.ProtocolPort["RePt"].ToString();
                ClientReportContext.Protocal = Cryptography.LoginInfo.ProtocolPort["RePr"].ToString();
                sb.Append("CreatePartControl end 7");
                DefaultConfigs.RegChannel(ClientReportContext.Login.AppServer);
                sb.Append("CreatePartControl end 8");

                this.ReportViewControl = new ReportViewControl();
                this.ReportViewControl.CanShowReport       += new EventHandler(ReportViewControlShowReport);
                this.ReportViewControl.DoubleClick         += new EventHandler(ReportViewControlDoubleClick);
                this.ReportViewControl.CloseContainerEvent += new CloseContainerHandler(ReportViewControl_ReportFilterEvent);
                this.ReportViewControl.UpdataGroupandCrossesToolbarEvent += new RefreshToolbarHandler(ReportViewControl_pdataGroupsToolbarEvent);
                this.ReportViewControl.RefreshViewsToolbarEvent          += new RefreshToolbarHandler(ReportViewControl_RefreshViewsToolbarEvent);
                this.ReportViewControl.RefreshJoinQueryToolbarEvent      += new RefreshToolbarHandler(ReportViewControl_RefreshJoinQueryToolbarEvent);
                //
                // pengzhzh 2012-8-9
                //
                this.ReportViewControl.ModifyButtons += new System.Action(ButtonChangeModify);

                (this.ReportEditorPart as NetEditor).PageCloseRequest += new PageCloseRequestHandler(ReportPortalRunner_PageCloseRequest);
                sb.Append("CreatePartControl end 9");
                if (isStaticReport)
                {
                    this.ReportViewControl.Initialize(context, reportId, ReportStates.Static, (ReportType)viewType);
                }
                else
                {
                    this.ReportViewControl.Initialize(context, reportId, ReportStates.Browse, rawFilter, isShowUI);
                }

                this.ReportFormInput.Text = "Loading";
                sb.Append("CreatePartControl end 10");
                (this.ReportEditorPart as NetEditor).Refresh(this.ReportFormInput);

                return(this.ReportViewControl);
            }
            catch (CanceledException)
            {
                CloseContainer();
                return(null);
            }
            catch (Exception ex)
            {
                UFIDA.U8.UAP.Services.ReportExhibition.ReportViewControl.ShowInformationMessageBox(ex);

                UFIDA.U8.UAP.Services.ReportExhibition.ReportViewControl.ShowInformationMessageBox(ex.InnerException);
                System.Diagnostics.Trace.WriteLine("ReportPortalRunner.CreatePartControl Log:" + sb);
                CloseContainer();
                return(null);
            }
        }
Exemple #6
0
 /// <inheritdoc />
 public abstract void SetEditorInput(IEditorInput editorInput);