コード例 #1
13
        public MainViewContent(string fileName, IWorkbenchWindow workbenchWindow)
        {
            codeEditor = new CodeEditor();

            textEditor = new TextEditor();
            textEditor.FontFamily = new FontFamily("Consolas");

            textEditor.TextArea.TextEntering += TextAreaOnTextEntering;
            textEditor.TextArea.TextEntered += TextAreaOnTextEntered;
            textEditor.ShowLineNumbers = true;

            var ctrlSpace = new RoutedCommand();
            ctrlSpace.InputGestures.Add(new KeyGesture(Key.Space, ModifierKeys.Control));
            var cb = new CommandBinding(ctrlSpace, OnCtrlSpaceCommand);
            // this.CommandBindings.Add(cb);

            adapter = new SharpSnippetTextEditorAdapter(textEditor);
            this.WorkbenchWindow = workbenchWindow;
            textEditor.TextArea.TextView.Services.AddService(typeof (ITextEditor), adapter);
            LoadFile(fileName);

            iconBarManager = new IconBarManager();
            textEditor.TextArea.LeftMargins.Insert(0, new IconBarMargin(iconBarManager));

            var textMarkerService = new TextMarkerService(textEditor.Document);
            textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
            textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
            textEditor.TextArea.TextView.Services.AddService(typeof (ITextMarkerService), textMarkerService);
            textEditor.TextArea.TextView.Services.AddService(typeof (IBookmarkMargin), iconBarManager);
        }
コード例 #2
0
		public static void SaveFileAs(IWorkbenchWindow window)
		{
			using (SaveFileDialog fdiag = new SaveFileDialog()) {
				fdiag.OverwritePrompt = true;
				fdiag.AddExtension    = true;
				
			 	fdiag.Filter          = String.Join("|", (string[])(AddInTree.GetTreeNode("/SharpDevelop/Workbench/FileFilter").BuildChildItems(null)).ToArray(typeof(string)));
				
				string[] fileFilters  = (string[])(AddInTree.GetTreeNode("/SharpDevelop/Workbench/FileFilter").BuildChildItems(null)).ToArray(typeof(string));
				fdiag.Filter          = String.Join("|", fileFilters);
				for (int i = 0; i < fileFilters.Length; ++i) {
					if (fileFilters[i].IndexOf(Path.GetExtension(window.ViewContent.FileName == null ? window.ViewContent.UntitledName : window.ViewContent.FileName)) >= 0) {
						fdiag.FilterIndex = i + 1;
						break;
					}
				}
				
				if (fdiag.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) {
					string fileName = fdiag.FileName;
					// currently useless, because the fdiag.FileName can't
					// handle wildcard extensions :(
					if (Path.GetExtension(fileName).StartsWith("?") || Path.GetExtension(fileName) == "*") {
						fileName = Path.ChangeExtension(fileName, "");
					}
					
					window.ViewContent.Save(fileName);
					
					MessageService.ShowMessage(fileName, "${res:ICSharpCode.SharpDevelop.Commands.SaveFile.FileSaved}");
				}
			}
		}
コード例 #3
0
		public MainViewContent(string fileName, SharpSnippetCompilerControl snippetControl, IWorkbenchWindow workbenchWindow)
		{
			file = new SnippetFile(fileName);
			this.snippetControl = snippetControl;
			this.textEditor = snippetControl.TextEditor;
			this.workbenchWindow = workbenchWindow;
		}
コード例 #4
0
		public static void AttachSubWindows (IWorkbenchWindow workbenchWindow)
		{
			foreach (DisplayBindingCodon codon in displayBindings) {
				IAttachableDisplayBinding binding = codon.DisplayBinding as IAttachableDisplayBinding;
				if (binding != null && binding.CanAttachTo (workbenchWindow.ViewContent)) 
					workbenchWindow.AttachViewContent (binding.CreateViewContent (workbenchWindow.ViewContent));
			}
		}
コード例 #5
0
ファイル: Document.cs プロジェクト: xuchuansheng/GenXSource
		internal static Document FromWindow(IWorkbenchWindow window)
		{
			if (window != null && window.ViewContent is IEditable) {
				return new Document(window, ((IEditable)window.ViewContent));
			} else {
				return null;
			}
		}
コード例 #6
0
 public void AttachSubWindows(IWorkbenchWindow workbenchWindow)
 {
     foreach (DisplayBindingCodon binding in bindings) {
         if (binding.SecondaryDisplayBinding != null && binding.SecondaryDisplayBinding.CanAttachTo(workbenchWindow.ViewContent)) {
             workbenchWindow.AttachSecondaryViewContent(binding.SecondaryDisplayBinding.CreateSecondaryViewContent(workbenchWindow.ViewContent));
         }
     }
 }
コード例 #7
0
//		IWorkbenchWindow workbenchWindow;
//		RegexToolkitWidget regexWidget;

		public ElementHelpWidget (IWorkbenchWindow workbenchWindow, RegexToolkitWidget regexWidget)
		{
//			this.workbenchWindow = workbenchWindow;
//			this.regexWidget = regexWidget;
			this.Build ();
			
			elementsStore = new Gtk.TreeStore (typeof(string), typeof(string), typeof(string), typeof(string));
			this.elementsTreeview.Model = this.elementsStore;
			this.elementsTreeview.HeadersVisible = false;
			this.elementsTreeview.Selection.Mode = SelectionMode.Browse;
			
			var col = new TreeViewColumn ();
			this.elementsTreeview.AppendColumn (col);
			var pix = new CellRendererPixbuf ();
			var cellRendText = new CellRendererText ();
			
			col.PackStart (pix, false);
			col.AddAttribute (pix, "stock_id", 0);
			col.PackStart (cellRendText, false);
			
			col.AddAttribute (cellRendText, "text", 1);
			
			var cellRendText2 = new CellRendererText ();
			col.PackStart (cellRendText2, true);
			col.SetCellDataFunc (cellRendText2, ElementDescriptionFunc);
			
			
//			this.elementsTreeview.Selection.Changed += delegate {
//				ShowTooltipForSelectedEntry ();
//			};
//			this.elementsTreeview.MotionNotifyEvent += HandleMotionNotifyEvent;
			
			this.elementsTreeview.RowActivated += delegate (object sender, RowActivatedArgs e) {
				Gtk.TreeIter iter;
				if (elementsStore.GetIter (out iter, e.Path)) {
					string text = elementsStore.GetValue (iter, 3) as string;
					if (!System.String.IsNullOrEmpty (text)) {
						regexWidget.InsertText (text);
						workbenchWindow.SwitchView (0);
					}
				}
			};
			this.LeaveNotifyEvent += delegate {
				this.HideTooltipWindow ();
			};
			FillElementsBox ();
			Show ();
		}
コード例 #8
0
        void OnWorkbenchActiveViewContentChanged(object sender, EventArgs e)
        {
            // update ActiveViewContent
            IWorkbenchWindow window = this.ActiveWorkbenchWindow;

            if (window != null)
            {
                this.ActiveViewContent = window.ActiveViewContent;
            }
            else
            {
                this.ActiveViewContent = null;
            }

            this.ActiveContent = layout.ActiveContent;
        }
コード例 #9
0
        static object[] GetWorkbench()
        {
            IWorkbenchWindow activeWorkbenchWindow = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;

            if (activeWorkbenchWindow == null)
            {
                return(null);
            }
            IBaseViewContent activeViewContent = activeWorkbenchWindow.ActiveViewContent;

            if (activeViewContent == null)
            {
                return(null);
            }
            return(new object[] { activeViewContent, activeWorkbenchWindow.ViewContent });
        }
コード例 #10
0
 public Document(IWorkbenchWindow window)
 {
     Counters.OpenDocuments++;
     LastTimeActive = DateTime.Now;
     this.window    = window;
     window.Closed += OnClosed;
     window.ActiveViewContentChanged += OnActiveViewContentChanged;
     if (IdeApp.Workspace != null)
     {
         IdeApp.Workspace.ItemRemovedFromSolution += OnEntryRemoved;
     }
     if (window.ViewContent.Project != null)
     {
         window.ViewContent.Project.Modified += HandleProjectModified;
     }
 }
コード例 #11
0
        static ICSharpCode.TextEditor.Document.IDocument GetDocument(IClass c)
        {
            IWorkbenchWindow win = FileService.OpenFile(c.CompilationUnit.FileName);

            if (win == null)
            {
                return(null);
            }
            ITextEditorControlProvider tecp = win.ViewContent as ITextEditorControlProvider;

            if (tecp == null)
            {
                return(null);
            }
            return(tecp.TextEditorControl.Document);
        }
コード例 #12
0
ファイル: FormsCommand.cs プロジェクト: prid77/TickZoomPublic
        public override void Run()
        {
            IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;

            if (window == null)
            {
                return;
            }

            ReportDesignerView formDesigner = AbstractFormsDesignerCommand.ReportDesigner;

            if (formDesigner != null)
            {
                formDesigner.ShowSourceCode();
            }
        }
コード例 #13
0
 public void CloseAllViews()
 {
     try
     {
         List <IViewContent> fullList = new List <IViewContent>(workbenchContentCollection);
         foreach (IViewContent content in fullList)
         {
             IWorkbenchWindow window = content.WorkbenchWindow;
             window.CloseWindow(false);
         }
         workbenchContentCollection.Clear();
     }
     finally
     {
     }
 }
コード例 #14
0
        public override void Run()
        {
            IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;

            if (window == null)
            {
                return;
            }

            FormsDesignerViewContent formDesigner = FormDesigner;

            if (formDesigner != null)
            {
                formDesigner.ShowSourceCode();
            }
        }
コード例 #15
0
ファイル: Document.cs プロジェクト: leculver/monodevelop
        internal async Task InitializeWindow(IWorkbenchWindow window)
        {
            this.window     = window;
            window.Document = this;

            view = await controller.GetDocumentView();

            view.IsRoot = true;
            window.SetRootView(view.CreateShellView(window));

            LastTimeActive              = DateTime.Now;
            this.window.CloseRequested += Window_CloseRequested;

            SubscribeControllerEvents();
            DocumentRegistry.Add(this);
        }
コード例 #16
0
 public override void Run()
 {
     if (IsEnabled)
     {
         if (Owner is ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.SharpDevelopTextAreaControl)
         {
             ((ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.SharpDevelopTextAreaControl)Owner).ActiveTextAreaControl.TextArea.ClipboardHandler.Paste(null, null);
             return;
         }
         IWorkbenchWindow  window   = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
         IClipboardHandler editable = window != null ? window.ActiveViewContent as IClipboardHandler : null;
         if (editable != null)
         {
             editable.Paste();
         }
     }
 }
コード例 #17
0
        void WorkbenchWindowChanged(object sender, EventArgs e)
        {
            IHasPropertyContainer c = WorkbenchSingleton.Workbench.ActiveContent as IHasPropertyContainer;

            if (c == null)
            {
                IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
                if (window != null)
                {
                    c = window.ActiveViewContent as IHasPropertyContainer;
                }
            }
            if (c != null)
            {
                SetActiveContainer(c.PropertyContainer);
            }
        }
コード例 #18
0
ファイル: SearchCommands.cs プロジェクト: carlhuth/GenXSource
        public override void Run()
        {
            IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;

            if (window != null)
            {
                ITextEditorControlProvider textEditorControlProvider = window.ActiveViewContent as ITextEditorControlProvider;
                if (textEditorControlProvider != null)
                {
                    if (incrementalSearch != null)
                    {
                        incrementalSearch.Dispose();
                    }
                    incrementalSearch = new IncrementalSearch(textEditorControlProvider.TextEditorControl, Forwards);
                }
            }
        }
コード例 #19
0
ファイル: WpfWorkbench.cs プロジェクト: giszzt/GeoSOS
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);
            //by hanz
            if (!e.Cancel)
            {
                //if (Project.ProjectService.IsBuilding)
                //{
                //    MessageService.ShowMessage(StringParser.Parse("${res:MainWindow.CannotCloseWithBuildInProgressMessage}"));
                //    e.Cancel = true;
                //    return;
                //}

                //if (!Project.ProjectService.IsClosingCanceled())
                //{
                // save preferences
                //Project.ProjectService.SaveSolutionPreferences();

                while (WorkbenchSingleton.Workbench.WorkbenchWindowCollection.Count > 0)
                {
                    IWorkbenchWindow window = WorkbenchSingleton.Workbench.WorkbenchWindowCollection[0];
                    if (!window.CloseWindow(false))
                    {
                        e.Cancel = true;
                        return;
                    }
                }

                //Project.ProjectService.CloseSolution();
                //ParserService.StopParserThread();

                restoreBoundsBeforeClosing = this.RestoreBounds;

                this.WorkbenchLayout = null;

                foreach (PadDescriptor padDescriptor in this.PadContentCollection)
                {
                    padDescriptor.Dispose();
                }
                //}
                //else
                //{
                //    e.Cancel = true;
                //}
            }
        }
コード例 #20
0
ファイル: PropertyPad.cs プロジェクト: tany12/CommonLibrary
        private void WorkbenchWindowChanged(object sender, EventArgs e)
        {
            IHasPropertyContainer activeContent = WorkbenchSingleton.Workbench.ActiveContent as IHasPropertyContainer;

            if (activeContent == null)
            {
                IWorkbenchWindow activeWorkbenchWindow = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
                if (activeWorkbenchWindow != null)
                {
                    activeContent = activeWorkbenchWindow.ActiveViewContent as IHasPropertyContainer;
                }
            }
            if (activeContent != null)
            {
                this.SetActiveContainer(activeContent.PropertyContainer);
            }
        }
コード例 #21
0
ファイル: Workbench.cs プロジェクト: poke/monodevelop
        void OnWindowClosing(object sender, WorkbenchWindowEventArgs args)
        {
            IWorkbenchWindow window = (IWorkbenchWindow)sender;

            if (!args.Forced && window.ViewContent != null && window.ViewContent.IsDirty)
            {
                AlertButton result = MessageService.GenericAlert(Stock.Warning,
                                                                 GettextCatalog.GetString("Save the changes to document '{0}' before closing?", window.ViewContent.IsUntitled ? window.ViewContent.UntitledName : System.IO.Path.GetFileName(window.ViewContent.ContentName)),
                                                                 GettextCatalog.GetString("If you don't save, all changes will be permanently lost."),
                                                                 AlertButton.CloseWithoutSave, AlertButton.Cancel, window.ViewContent.IsUntitled ? AlertButton.SaveAs : AlertButton.Save);
                if (result == AlertButton.Save || result == AlertButton.SaveAs)
                {
                    if (window.ViewContent.ContentName == null)
                    {
                        FindDocument(window).Save();
                        args.Cancel = window.ViewContent.IsDirty;
                    }
                    else
                    {
                        try {
                            if (window.ViewContent.IsFile)
                            {
                                window.ViewContent.Save(window.ViewContent.ContentName);
                            }
                            else
                            {
                                window.ViewContent.Save();
                            }
                        }
                        catch (Exception ex) {
                            args.Cancel = true;
                            MessageService.ShowException(ex, GettextCatalog.GetString("The document could not be saved."));
                        }
                    }
                }
                else
                {
                    args.Cancel = result != AlertButton.CloseWithoutSave;
                    if (!args.Cancel)
                    {
                        window.ViewContent.DiscardChanges();
                    }
                }
            }
        }
コード例 #22
0
ファイル: WpfWorkbench.cs プロジェクト: Amichai/SharpDevelop
        void OnActiveWindowChanged(object sender, EventArgs e)
        {
            if (closeAll)
            {
                return;
            }

            if (workbenchLayout != null)
            {
                this.ActiveContent         = workbenchLayout.ActiveContent;
                this.ActiveWorkbenchWindow = workbenchLayout.ActiveWorkbenchWindow;
            }
            else
            {
                this.ActiveContent         = null;
                this.ActiveWorkbenchWindow = null;
            }
        }
コード例 #23
0
        public override void Run()
        {
            if (Owner is ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.SharpDevelopTextAreaControl)
            {
                ((ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.SharpDevelopTextAreaControl)Owner).ActiveTextAreaControl.TextArea.ClipboardHandler.Delete(null, null);
                return;
            }

            IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;

            if (window != null && window.ViewContent is IClipboardHandler)
            {
                if (((IClipboardHandler)window.ViewContent) != null)
                {
                    ((IClipboardHandler)window.ViewContent).Delete();
                }
            }
        }
コード例 #24
0
        public override void Run()
        {
            IWorkbenchWindow window      = Owner as IWorkbenchWindow;
            IViewContent     lastContent = null;

            for (int i = 0; i < WorkbenchSingleton.Workbench.ViewContentCollection.Count;)
            {
                IViewContent content = WorkbenchSingleton.Workbench.ViewContentCollection[i];
                if (content.WorkbenchWindow != window && content != lastContent)
                {
                    content.WorkbenchWindow.CloseWindow(false);
                    lastContent = content;
                }
                else
                {
                    ++i;
                }
            }
        }
コード例 #25
0
 private bool IsStateOk(IWorkbenchWindow window)
 {
     if ((window == null) || (window.ViewContent == null))
     {
         return false;
     }
     bool flag = false;
     if (this.windowState != WindowState.None)
     {
         if ((this.windowState & WindowState.Dirty) > WindowState.None)
         {
             flag |= window.ViewContent.IsDirty;
         }
         if ((this.windowState & WindowState.Untitled) > WindowState.None)
         {
             flag |= window.ViewContent.IsUntitled;
         }
         if ((this.windowState & WindowState.ViewOnly) > WindowState.None)
         {
             flag |= window.ViewContent.IsViewOnly;
         }
     }
     else
     {
         flag = true;
     }
     if (this.nowindowState != WindowState.None)
     {
         if ((this.nowindowState & WindowState.Dirty) > WindowState.None)
         {
             flag &= !window.ViewContent.IsDirty;
         }
         if ((this.nowindowState & WindowState.Untitled) > WindowState.None)
         {
             flag &= !window.ViewContent.IsUntitled;
         }
         if ((this.nowindowState & WindowState.ViewOnly) > WindowState.None)
         {
             flag &= !window.ViewContent.IsViewOnly;
         }
     }
     return flag;
 }
コード例 #26
0
        public override void Run()
        {
            IWorkbenchWindow     window       = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
            IContextHelpProvider helpProvider = window != null ? window.ActiveViewContent as IContextHelpProvider : null;

            foreach (PadDescriptor descriptor in WorkbenchSingleton.Workbench.PadContentCollection)
            {
                if (descriptor.HasFocus && descriptor.PadContent is IContextHelpProvider)
                {
                    ((IContextHelpProvider)descriptor.PadContent).ShowHelp();
                    return;
                }
            }

            if (helpProvider != null)
            {
                helpProvider.ShowHelp();
            }
        }
コード例 #27
0
        public override void Run()
        {
            IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;

            if (window == null || !(window.ViewContent is ITextEditorControlProvider))
            {
                return;
            }
            TextEditorControl textEditorControl = ((ITextEditorControlProvider)window.ViewContent).TextEditorControl;

            ParseInformation parseInformation;

            if (window.ViewContent.IsUntitled)
            {
                parseInformation = ParserService.ParseFile(textEditorControl.FileName, textEditorControl.Document.TextContent);
            }
            else
            {
                parseInformation = ParserService.GetParseInformation(textEditorControl.FileName);
            }

            if (parseInformation == null)
            {
                return;
            }

            ICompilationUnit cu = parseInformation.MostRecentCompilationUnit as ICompilationUnit;

            if (cu == null)
            {
                return;
            }
            IClass currentClass = GetCurrentClass(textEditorControl, cu, textEditorControl.FileName);

            if (currentClass != null)
            {
                ArrayList categories = new ArrayList();
                ArrayList generators = AddInTree.BuildItems("/AddIns/DefaultTextEditor/CodeGenerator", this, true);
                using (CodeGenerationForm form = new CodeGenerationForm(textEditorControl, (CodeGeneratorBase[])generators.ToArray(typeof(CodeGeneratorBase)), currentClass)) {
                    form.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm);
                }
            }
        }
コード例 #28
0
ファイル: HtmlViewPane.cs プロジェクト: prid77/TickZoomPublic
        void WebBrowserStatusTextChanged(object sender, EventArgs e)
        {
            IWorkbenchWindow workbench = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;

            if (workbench == null)
            {
                return;
            }
            BrowserPane browser = workbench.ActiveViewContent as BrowserPane;

            if (browser == null)
            {
                return;
            }
            if (browser.HtmlViewPane == this)
            {
                StatusBarService.SetMessage(webBrowser.StatusText);
            }
        }
コード例 #29
0
ファイル: Document.cs プロジェクト: yunjongha/monodevelop
 public Document(IWorkbenchWindow window)
 {
     Counters.OpenDocuments++;
     LastTimeActive = DateTime.Now;
     this.window    = window;
     window.Closed += OnClosed;
     window.ActiveViewContentChanged += OnActiveViewContentChanged;
     if (IdeApp.Workspace != null)
     {
         IdeApp.Workspace.ItemRemovedFromSolution += OnEntryRemoved;
     }
     if (window.ViewContent.Project != null)
     {
         window.ViewContent.Project.Modified += HandleProjectModified;
     }
     window.ViewsChanged += HandleViewsChanged;
     window.ViewContent.ContentNameChanged += ReloadAnalysisDocumentHandler;
     MonoDevelopWorkspace.LoadingFinished  += ReloadAnalysisDocumentHandler;
 }
コード例 #30
0
ファイル: ToolCommands.cs プロジェクト: carlhuth/GenXSource
        public override void Run()
        {
            IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;

            if (window == null || !(window.ViewContent is ITextEditorControlProvider))
            {
                return;
            }

            TextEditorControl textEditor = ((ITextEditorControlProvider)window.ViewContent).TextEditorControl;

            if (textEditor == null)
            {
                return;
            }

            string newGuid = Guid.NewGuid().ToString().ToUpperInvariant();

            textEditor.ActiveTextAreaControl.TextArea.InsertString(newGuid);
        }
コード例 #31
0
        public static void AttachViewContents(Document document, VersionControlItem item)
        {
            IWorkbenchWindow window = document.Window;

            if (window.SubViewContents.Any(sub => sub is ComparisonView))
            {
                return;
            }

            VersionControlDocumentInfo info = new VersionControlDocumentInfo(document, item);

            ComparisonView comparisonView = new ComparisonView(info);

            window.AttachViewContent(comparisonView);
            window.AttachViewContent(new PatchView(comparisonView, info));
            window.AttachViewContent(new BlameView(info));
            window.AttachViewContent(new LogView(info));

            info.Start();
        }
コード例 #32
0
ファイル: MainWindow.cs プロジェクト: yuluos/CocoStudio2.0.6
 public void CloseAllViews()
 {
     try
     {
         this.closeAll = true;
         foreach (IBaseViewContent baseViewContent in new List <IViewContent>((IEnumerable <IViewContent>) this.viewContentCollection))
         {
             IWorkbenchWindow workbenchWindow = baseViewContent.WorkbenchWindow;
             if (workbenchWindow != null)
             {
                 workbenchWindow.CloseWindow(true);
             }
         }
     }
     finally
     {
         this.closeAll = false;
         this.OnActiveWindowChanged((object)null, (EventArgs)null);
     }
 }
コード例 #33
0
        public override void Run()
        {
            AbstractProjectBrowserTreeNode node = ProjectBrowserPad.Instance.ProjectBrowserControl.SelectedNode;
            ISolutionFolderNode            solutionFolderNode = node as ISolutionFolderNode;

            if (node != null)
            {
                using (NewProjectDialog npdlg = new NewProjectDialog(false)) {
                    npdlg.InitialProjectLocationDirectory = GetInitialDirectorySuggestion(solutionFolderNode);

                    // show the dialog to request project type and name
                    if (npdlg.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK)
                    {
                        if (npdlg.NewProjectLocation.Length == 0)
                        {
                            MessageService.ShowError("No project has been created, there is nothing to add.");
                            return;
                        }
                        AddExitingProjectToSolution.AddProject(solutionFolderNode, npdlg.NewProjectLocation);
                        ProjectService.SaveSolution();

                        if (SDLite.UpdateInfo.ExpandNewProjectByDefaut)
                        {
                            IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;

                            if (window != null && window.ActiveViewContent != null)
                            {
                                ProjectBrowserPad.Instance.ProjectBrowserControl.SelectFile(window.ActiveViewContent.PrimaryFileName);
                            }

                            node = ProjectBrowserPad.Instance.ProjectBrowserControl.SelectedNode;

                            if (node is ProjectNode)
                            {
                                node.Expand();
                            }
                        }
                    }
                }
            }
        }
コード例 #34
0
		public MainViewContent(string fileName, IWorkbenchWindow workbenchWindow)
		{
			this.textEditor = new TextEditor();
			this.textEditor.FontFamily = new FontFamily("Consolas");
			this.adapter = new SharpSnippetTextEditorAdapter(textEditor);
			this.workbenchWindow = workbenchWindow;
			textEditor.TextArea.TextView.Services.AddService(typeof(ITextEditor), adapter);
			this.LoadFile(fileName);
			
			iconBarManager = new IconBarManager();
			this.textEditor.TextArea.LeftMargins.Insert(0, new IconBarMargin(iconBarManager));
			
			var textMarkerService = new TextMarkerService(textEditor.Document);
			textEditor.TextArea.TextView.BackgroundRenderers.Add(textMarkerService);
			textEditor.TextArea.TextView.LineTransformers.Add(textMarkerService);
			textEditor.TextArea.TextView.Services.AddService(typeof(ITextMarkerService), textMarkerService);
			textEditor.TextArea.TextView.Services.AddService(typeof(IBookmarkMargin), iconBarManager);
			
			BookmarkManager.Added += BookmarkManager_Added;
			BookmarkManager.Removed += BookmarkManager_Removed;
		}
コード例 #35
0
 public void CloseAllViews()
 {
     try
     {
         _closeAll = true;
         List <IViewContent> fullList = new List <IViewContent>(_workbenchContentCollection);
         foreach (IViewContent content in fullList)
         {
             IWorkbenchWindow window = content.WorkbenchWindow;
             window.CloseWindow(false);
         }
     }
     finally
     {
         _closeAll = false;
         if (!_closeAll && ActiveWorkbenchWindowChanged != null)
         {
             ActiveWorkbenchWindowChanged(this, EventArgs.Empty);
         }
     }
 }
コード例 #36
0
        internal Document WrapDocument(IWorkbenchWindow window)
        {
            if (window == null)
            {
                return(null);
            }
            Document doc = FindDocument(window);

            if (doc != null)
            {
                return(doc);
            }
            doc             = new Document(window);
            window.Closing += OnWindowClosing;
            window.Closed  += OnWindowClosed;
            documents.Add(doc);

            doc.OnDocumentAttached();
            OnDocumentOpened(new DocumentEventArgs(doc));
            return(doc);
        }
コード例 #37
0
        public ToolStripItem[] BuildSubmenu(Codon codon, object owner)
        {
            int windowCount = WorkbenchSingleton.Workbench.WorkbenchWindowCollection.Count;

            if (windowCount == 0)
            {
                return(new ToolStripItem[] { });
            }
            ToolStripItem[] items = new ToolStripItem[windowCount + 1];
            items[0] = new MenuSeparator(null, null);
            for (int i = 0; i < windowCount; ++i)
            {
                IWorkbenchWindow window = WorkbenchSingleton.Workbench.WorkbenchWindowCollection[i];
                MenuCheckBox     item   = new MyMenuItem(window);
                item.Tag         = window;
                item.Checked     = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow == window;
                item.Description = "Activate this window";
                items[i + 1]     = item;
            }
            return(items);
        }
コード例 #38
0
ファイル: Document.cs プロジェクト: leculver/monodevelop
        internal void Dispose()
        {
            DocumentRegistry.Remove(this);
            callbackRegistration?.Dispose();
            var workspace = Runtime.PeekService <RootWorkspace> ();

            if (workspace != null)
            {
                workspace.ItemRemovedFromSolution -= OnEntryRemoved;
            }

            UnsubscribeControllerEvents();
            window.SetRootView(null);
            view.IsRoot = false;
            view.Dispose();              // This will also dispose the controller

            window = null;

            contentCallbackRegistry           = null;
            contentActiveViewCallbackRegistry = null;
        }
コード例 #39
0
        public override bool StorePanelContents()
        {
            ((Properties)CustomizationObject).Set("TabsToSpaces", ((CheckBox)ControlDictionary["convertTabsToSpacesCheckBox"]).Checked);
            ((Properties)CustomizationObject).Set("MouseWheelScrollDown", ((ComboBox)ControlDictionary["mouseWhellDirectionComboBox"]).SelectedIndex == 0);

            ((Properties)CustomizationObject).Set("AutoInsertCurlyBracket", ((CheckBox)ControlDictionary["autoinsertCurlyBraceCheckBox"]).Checked);
            ((Properties)CustomizationObject).Set("HideMouseCursor", ((CheckBox)ControlDictionary["hideMouseCursorCheckBox"]).Checked);
            ((Properties)CustomizationObject).Set("CursorBehindEOL", ((CheckBox)ControlDictionary["caretBehindEOLCheckBox"]).Checked);
            ((Properties)CustomizationObject).Set("AutoInsertTemplates", ((CheckBox)ControlDictionary["auotInsertTemplatesCheckBox"]).Checked);
            ((Properties)CustomizationObject).Set("CutCopyWholeLine", ((CheckBox)ControlDictionary["cutCopyWholeLine"]).Checked);

            ((Properties)CustomizationObject).Set("IndentStyle", (IndentStyle)((ComboBox)ControlDictionary["indentStyleComboBox"]).SelectedIndex);

            try {
                int tabSize = Int32.Parse(ControlDictionary["tabSizeTextBox"].Text);

                // FIX: don't allow to set tab size to zero as this will cause divide by zero exceptions in the text control.
                // Zero isn't a setting that makes sense, anyway.
                if (tabSize > 0)
                {
                    ((Properties)CustomizationObject).Set("TabIndent", tabSize);
                }
            } catch (Exception) {
            }

            try {
                ((Properties)CustomizationObject).Set("IndentationSize", Int32.Parse(ControlDictionary["indentSizeTextBox"].Text));
            } catch (Exception) {
            }

            IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;

            if (window != null && (window.ViewContent is ITextEditorControlProvider))
            {
                TextEditorControl textarea = ((ITextEditorControlProvider)window.ViewContent).TextEditorControl;
                textarea.OptionsChanged();
            }

            return(true);
        }
コード例 #40
0
		bool IsStateOk(IWorkbenchWindow window)
		{
			if (window == null || window.ViewContent == null) {
				return false;
			}
			// use IWorkbenchWindow instead of IViewContent because maybe window info is needed in the future (for example: sub view content info.)
			bool isWindowStateOk = false;
			if (windowState != WindowState.None) {
				if ((windowState & WindowState.Dirty) > 0) {
					isWindowStateOk |= window.ViewContent.IsDirty;
				} 
				if ((windowState & WindowState.Untitled) > 0) {
					isWindowStateOk |= window.ViewContent.IsUntitled;
				}
				if ((windowState & WindowState.ViewOnly) > 0) {
					isWindowStateOk |= window.ViewContent.IsViewOnly;
				}
			} else {
				isWindowStateOk = true;
			}
			
			if (nowindowState != WindowState.None) {
				if ((nowindowState & WindowState.Dirty) > 0) {
					isWindowStateOk &= !window.ViewContent.IsDirty;
				}
				
				if ((nowindowState & WindowState.Untitled) > 0) {
					isWindowStateOk &= !window.ViewContent.IsUntitled;
				}
				
				if ((nowindowState & WindowState.ViewOnly) > 0) {
					isWindowStateOk &= !window.ViewContent.IsViewOnly;
				}
			}
			return isWindowStateOk;
		}
コード例 #41
0
 /// <summary>
 /// <para>Gets a value indicating whether the
 ///    <see cref="WorkspaceWindowCollection"/> contains the specified <see cref="IWorkspaceWindow"/>.</para>
 /// </summary>
 /// <param name="value">The <see cref="IWorkspaceWindow"/> to locate.</param>
 /// <returns>
 /// <para><see langword="true"/> if the <see cref="IWorkspaceWindow"/> is contained in the collection;
 ///   otherwise, <see langword="false"/>.</para>
 /// </returns>
 /// <seealso cref="WorkspaceWindowCollection.IndexOf"/>
 public bool Contains(IWorkbenchWindow value)
 {
     return List.Contains(value);
 }
コード例 #42
0
ファイル: WpfWorkbench.cs プロジェクト: pluraldj/SharpDevelop
		void OnActiveWindowChanged(object sender, EventArgs e)
		{
			if (closeAll)
				return;
			
			if (workbenchLayout != null) {
				this.ActiveContent = workbenchLayout.ActiveContent;
				this.ActiveWorkbenchWindow = workbenchLayout.ActiveWorkbenchWindow;
			} else {
				this.ActiveContent = null;
				this.ActiveWorkbenchWindow = null;
			}
		}
コード例 #43
0
 internal static string GetTitle(IWorkbenchWindow window)
 {
     if (window.ViewContent.IsUntitled)
         return GetDefaultTitle ();
     string post = String.Empty;
     if (window.ViewContent.IsDirty) {
         post = "*";
     }
     if (window.ViewContent.Project != null) {
         return window.ViewContent.Project.Name + " - " + window.ViewContent.PathRelativeToProject + post + " - " + BrandingService.ApplicationName;
     }
     return window.ViewContent.ContentName + post + " - " + BrandingService.ApplicationName;
 }
コード例 #44
0
		public UnderlyingDocument (IWorkbenchWindow window)
			: base (window)
		{
		}
コード例 #45
0
 /// <summary>
 ///    <para>Adds a <see cref="IWorkspaceWindow"/> with the specified value to the
 ///    <see cref="WorkspaceWindowCollection"/> .</para>
 /// </summary>
 /// <param name="value">The <see cref="IWorkspaceWindow"/> to add.</param>
 /// <returns>
 ///    <para>The index at which the new element was inserted.</para>
 /// </returns>
 /// <seealso cref="WorkspaceWindowCollection.AddRange"/>
 public int Add(IWorkbenchWindow value)
 {
     return List.Add(value);
 }
コード例 #46
0
 /// <summary>
 ///     <para>
 ///       Initializes a new instance of <see cref="WorkspaceWindowCollection"/> containing any array of <see cref="IWorkspaceWindow"/> objects.
 ///    </para>
 /// </summary>
 /// <param name="value">
 ///       A array of <see cref="IWorkspaceWindow"/> objects with which to intialize the collection
 /// </param>
 public WorkbenchWindowCollection(IWorkbenchWindow[] value)
 {
     this.AddRange(value);
 }
コード例 #47
0
		void OnActiveWindowChanged (object sender, EventArgs e)
		{
			if (ignorePageSwitch)
				return;
			
			if (lastActive == ActiveWorkbenchWindow)
				return;
			
			if (lastActiveWindows.Count > MAX_LASTACTIVEWINDOWS)
				lastActiveWindows.RemoveFirst ();
			lastActiveWindows.AddLast (lastActive);
			lastActive = ActiveWorkbenchWindow;
			SetWorkbenchTitle ();
			
			if (!closeAll && ActiveWorkbenchWindowChanged != null) {
				ActiveWorkbenchWindowChanged(this, e);
			}
		}
コード例 #48
0
 public ViewCommandHandlers(IWorkbenchWindow window)
 {
     this.window = window;
 }
コード例 #49
0
 /// <summary>
 /// <para>Copies the elements of an array to the end of the <see cref="WorkspaceWindowCollection"/>.</para>
 /// </summary>
 /// <param name="value">
 ///    An array of type <see cref="IWorkspaceWindow"/> containing the objects to add to the collection.
 /// </param>
 /// <returns>
 ///   <para>None.</para>
 /// </returns>
 /// <seealso cref="WorkspaceWindowCollection.Add"/>
 public void AddRange(IWorkbenchWindow[] value)
 {
     for (int i = 0; (i < value.Length); i = (i + 1)) {
         this.Add(value[i]);
     }
 }
コード例 #50
0
ファイル: FileCommands.cs プロジェクト: Paccc/SharpDevelop
		internal static void Save(IWorkbenchWindow window)
		{
			List<IViewContent> remainingViewContents = new List<IViewContent>();
			
			foreach (IViewContent content in window.ViewContents) {
				// try to run customized Save As Command, exclude ViewContent if successful
				var customizedCommands = content.GetService<ICustomizedCommands>();
				if (customizedCommands != null && customizedCommands.SaveAsCommand())
					continue;
				// exclude view only ViewContents
				if (content.IsViewOnly)
					continue;
				
				remainingViewContents.Add(content);
			}
			
			// save remaining files once (display Save As dialog)
			var files = remainingViewContents.SelectMany(content => content.Files).Distinct();
			
			foreach (var file in files)
				Save(file);
		}
コード例 #51
0
ファイル: FileCommands.cs プロジェクト: Paccc/SharpDevelop
		internal static void Save(IWorkbenchWindow window)
		{
			foreach (var vc in window.ViewContents)
				Save(vc);
		}
コード例 #52
0
 /// <summary>
 /// <para>Copies the <see cref="WorkspaceWindowCollection"/> values to a one-dimensional <see cref="System.Array"/> instance at the
 ///    specified index.</para>
 /// </summary>
 /// <param name="array"><para>The one-dimensional <see cref="System.Array"/> that is the destination of the values copied from <see cref="WorkspaceWindowCollection"/> .</para></param>
 /// <param name="index">The index in <paramref name="array"/> where copying begins.</param>
 /// <returns>
 ///   <para>None.</para>
 /// </returns>
 /// <exception cref="System.ArgumentException"><para><paramref name="array"/> is multidimensional.</para> <para>-or-</para> <para>The number of elements in the <see cref="WorkspaceWindowCollection"/> is greater than the available space between <paramref name="arrayIndex"/> and the end of <paramref name="array"/>.</para></exception>
 /// <exception cref="System.ArgumentNullException"><paramref name="array"/> is <see langword="null"/>. </exception>
 /// <exception cref="System.ArgumentOutOfRangeException"><paramref name="arrayIndex"/> is less than <paramref name="array"/>"s lowbound. </exception>
 /// <seealso cref="System.Array"/>
 public void CopyTo(IWorkbenchWindow[] array, int index)
 {
     List.CopyTo(array, index);
 }
コード例 #53
0
		void OnActiveWindowChanged (object sender, EventArgs e)
		{
			if (ignorePageSwitch)
				return;
			
			if (lastActive == ActiveWorkbenchWindow)
				return;

			WelcomePage.WelcomePageService.HideWelcomePage ();

			if (lastActive != null)
				((SdiWorkspaceWindow)lastActive).OnDeactivated ();

			if (lastActiveWindows.Count > MAX_LASTACTIVEWINDOWS)
				lastActiveWindows.RemoveFirst ();

			lastActiveWindows.Remove (lastActive);
			lastActiveWindows.AddLast (lastActive);
			lastActive = ActiveWorkbenchWindow;
			SetWorkbenchTitle ();

			if (!closeAll && ActiveWorkbenchWindow != null)
				((SdiWorkspaceWindow)ActiveWorkbenchWindow).OnActivated ();

			if (!closeAll && ActiveWorkbenchWindowChanged != null) {
				ActiveWorkbenchWindowChanged(this, e);
			}
		}
コード例 #54
0
 /// <summary>
 ///    <para>Returns the index of a <see cref="IWorkspaceWindow"/> in
 ///       the <see cref="WorkspaceWindowCollection"/> .</para>
 /// </summary>
 /// <param name="value">The <see cref="IWorkspaceWindow"/> to locate.</param>
 /// <returns>
 /// <para>The index of the <see cref="IWorkspaceWindow"/> of <paramref name="value"/> in the
 /// <see cref="WorkspaceWindowCollection"/>, if found; otherwise, -1.</para>
 /// </returns>
 /// <seealso cref="WorkspaceWindowCollection.Contains"/>
 public int IndexOf(IWorkbenchWindow value)
 {
     return List.IndexOf(value);
 }
コード例 #55
0
		bool SelectLastActiveWindow (IWorkbenchWindow cur)
		{
			if (lastActiveWindows.Count == 0)
				return false;
			IWorkbenchWindow last = null;
			do {
				last = lastActiveWindows.Last.Value;
				lastActiveWindows.RemoveLast ();
			} while (lastActiveWindows.Count > 0 && (last == cur || last == null || (last != null && last.ViewContent == null)));
			if (last != null) {
				last.SelectWindow ();
				return true;
			}
			return false;
		}
コード例 #56
0
 /// <summary>
 /// <para>Inserts a <see cref="IWorkspaceWindow"/> into the <see cref="WorkspaceWindowCollection"/> at the specified index.</para>
 /// </summary>
 /// <param name="index">The zero-based index where <paramref name="value"/> should be inserted.</param>
 /// <param name=" value">The <see cref="IWorkspaceWindow"/> to insert.</param>
 /// <returns><para>None.</para></returns>
 /// <seealso cref="WorkspaceWindowCollection.Add"/>
 public void Insert(int index, IWorkbenchWindow value)
 {
     List.Insert(index, value);
 }
コード例 #57
0
ファイル: Document.cs プロジェクト: xuchuansheng/GenXSource
		private Document(IWorkbenchWindow window, IEditable editable)
		{
			this.window = window;
			this.editable = editable;
		}
コード例 #58
0
 /// <summary>
 ///    <para> Removes a specific <see cref="IWorkspaceWindow"/> from the
 ///    <see cref="WorkspaceWindowCollection"/> .</para>
 /// </summary>
 /// <param name="value">The <see cref="IWorkspaceWindow"/> to remove from the <see cref="WorkspaceWindowCollection"/> .</param>
 /// <returns><para>None.</para></returns>
 /// <exception cref="System.ArgumentException"><paramref name="value"/> is not found in the Collection. </exception>
 public void Remove(IWorkbenchWindow value)
 {
     List.Remove(value);
 }
コード例 #59
0
        internal void OnActiveWindowChanged(object sender, EventArgs e)
        {
            if (activeWindowChangeLock > 0)
                return;
            if (lastActive == ActiveWorkbenchWindow)
                return;

            WelcomePage.WelcomePageService.HideWelcomePage ();

            if (lastActive != null)
                ((SdiWorkspaceWindow)lastActive).OnDeactivated ();

            lastActive = ActiveWorkbenchWindow;
            SetWorkbenchTitle ();

            if (!closeAll && ActiveWorkbenchWindow != null)
                ((SdiWorkspaceWindow)ActiveWorkbenchWindow).OnActivated ();

            if (!closeAll && ActiveWorkbenchWindowChanged != null) {
                ActiveWorkbenchWindowChanged(this, e);
            }
        }
コード例 #60
0
		public virtual void Dispose()
		{
			workbenchWindow = null;
		}