Ejemplo n.º 1
0
        private void manager_NewFileTransfer(IFileTransfer transfer)
        {
            try {
                // Add transfer to list
                transferListStore.AppendValues(transfer);

                // Watch a few other events
                transfer.PeerAdded += (FileTransferPeerEventHandler)DispatchService.GuiDispatch(
                    new FileTransferPeerEventHandler(transfer_PeerAdded)
                    );

                transfer.Error += (FileTransferErrorEventHandler)DispatchService.GuiDispatch(
                    new FileTransferErrorEventHandler(transfer_Error)
                    );

                Gui.MainWindow.RefreshCounts();
            } catch (Exception ex) {
                LoggingService.LogError(ex);
                Gui.ShowErrorDialog(ex.ToString(), Gui.MainWindow.Window);
            }
        }
        IInteractiveSession SetupSession()
        {
            var ses = new CSharpInteractiveSession();

            ses.TextReceived += t => DispatchService.GuiDispatch(() => view.WriteOutput(t));
            ses.PromptReady  += () => DispatchService.GuiDispatch(() => view.Prompt(true));
            ses.Exited       += () => DispatchService.GuiDispatch(() => {
                if (kill == KillIntent.None)
                {
                    view.WriteOutput("\nSession termination detected. Press Enter to restart.");
                    isPrompting = true;
                }
                else if (kill == KillIntent.Restart)
                {
                    view.Clear();
                }
                kill = KillIntent.None;
            });
            ses.StartReceiving();
            return(ses);
        }
Ejemplo n.º 3
0
        public IProgressMonitor BeginProgress(string title)
        {
            progressStarted = true;

            logView.Clear();
            monitor        = logView.GetProgressMonitor();
            asyncOperation = monitor.AsyncOperation;

            DispatchService.GuiDispatch(delegate {
                window.HasNewData    = false;
                window.HasErrors     = false;
                window.IsWorking     = true;
                buttonStop.Sensitive = true;
            });

            monitor.AsyncOperation.Completed += delegate {
                EndProgress();
            };

            return(monitor);
        }
Ejemplo n.º 4
0
        }        // GetSymbolsVisibleFrom

        /// <summary>
        /// Add results to a ValaCompletionDataList on the GUI thread
        /// </summary>
        private static void AddResults(IEnumerable <Afrodite.Symbol> list, ValaCompletionDataList results)
        {
            if (null == list || null == results)
            {
                LoggingService.LogDebug("AddResults: null list or results!");
                return;
            }

            List <CompletionData> data = new List <CompletionData> ();

            foreach (Afrodite.Symbol symbol in list)
            {
                data.Add(new CompletionData(symbol));
            }

            DispatchService.GuiDispatch(delegate {
                results.IsChanging = true;
                results.AddRange(data);
                results.IsChanging = false;
            });
        }        // AddResults
        private void BuildChildNodesThreaded(object state)
        {
            BaseNode     node    = state as BaseNode;
            ITreeBuilder builder = Context.GetTreeBuilder(state);

            bool showSystemObjects = (bool)builder.Options["ShowSystemObjects"];
            ProcedureSchemaCollection procedures = node.ConnectionContext.SchemaProvider.GetProcedures();

            DispatchService.GuiDispatch(delegate {
                foreach (ProcedureSchema procedure in procedures)
                {
                    if (procedure.IsSystemProcedure && !showSystemObjects)
                    {
                        continue;
                    }

                    builder.AddChild(new ProcedureNode(node.ConnectionContext, procedure));
                }
                builder.Expanded = true;
            });
        }
Ejemplo n.º 6
0
        private void BuildChildNodesThreaded(object state)
        {
            BaseNode     node    = state as BaseNode;
            ITreeBuilder builder = Context.GetTreeBuilder(state);

            bool showSystemObjects     = (bool)builder.Options["ShowSystemObjects"];
            ViewSchemaCollection views = node.ConnectionContext.SchemaProvider.GetViews();

            DispatchService.GuiDispatch(delegate {
                foreach (ViewSchema view in views)
                {
                    if (view.IsSystemView && !showSystemObjects)
                    {
                        continue;
                    }

                    builder.AddChild(new ViewNode(node.ConnectionContext, view));
                }
                builder.Expanded = true;
            });
        }
 protected override BuildResult Build(IProgressMonitor monitor, Solution solution, ConfigurationSelector configuration)
 {
     try {
         buildingSolution = true;
         BuildResult res = base.Build(monitor, solution, configuration);
         if (res.ErrorCount == 0)
         {
             SolutionAddinData data = solution.GetAddinData();
             if (data != null && data.Registry != null)
             {
                 data.Registry.Update(new ProgressStatusMonitor(monitor));
                 DispatchService.GuiDispatch(delegate {
                     data.NotifyChanged();
                 });
             }
         }
         return(res);
     } finally {
         buildingSolution = false;
     }
 }
Ejemplo n.º 8
0
        void PerformSearch()
        {
            if (list == null)
            {
                return;
            }

            //	userSelecting = false;

            string toMatch = this.searchEntry.Text.ToUpper();

            lock (matchLock) {
                matchString = toMatch;
            }

            lock (searchResults) {
                // Clean the results list
                searchResults.Clear();
            }

            if (searchThread != null)
            {
                searchThread.Abort();
                searchThread = null;
            }

            // Queuing this seems to prevent things getting
            // added from queued events after the clear.
            DispatchService.GuiDispatch(list.Clear);

            ThreadStart start = new ThreadStart(SearchThread);

            searchThread = new Thread(start)
            {
                Name         = "Class pad search",
                IsBackground = true,
                Priority     = ThreadPriority.Lowest,
            };
            searchThread.Start();
        }
Ejemplo n.º 9
0
 static CSharpSyntaxMode()
 {
     MonoDevelop.Debugger.DebuggingService.DisableConditionalCompilation += DispatchService.GuiDispatch(new EventHandler <DocumentEventArgs> (OnDisableConditionalCompilation));
     if (IdeApp.Workspace != null)
     {
         IdeApp.Workspace.ActiveConfigurationChanged += delegate {
             foreach (var doc in IdeApp.Workbench.Documents)
             {
                 TextEditorData data = doc.Editor;
                 if (data == null)
                 {
                     continue;
                 }
                 // Force syntax mode reparse (required for #if directives)
                 var editor = doc.Editor;
                 if (editor != null)
                 {
                     if (data.Document.SyntaxMode is SyntaxMode)
                     {
                         ((SyntaxMode)data.Document.SyntaxMode).UpdateDocumentHighlighting();
                         SyntaxModeService.WaitUpdate(data.Document);
                     }
                     editor.Parent.TextViewMargin.PurgeLayoutCache();
                     doc.ReparseDocument();
                     editor.Parent.QueueDraw();
                 }
             }
         };
     }
     CommentTag.SpecialCommentTagsChanged += (sender, e) => {
         UpdateCommentRule();
         var actDoc = IdeApp.Workbench.ActiveDocument;
         if (actDoc != null && actDoc.Editor != null)
         {
             actDoc.UpdateParseDocument();
             actDoc.Editor.Parent.TextViewMargin.PurgeLayoutCache();
             actDoc.Editor.Parent.QueueDraw();
         }
     };
 }
Ejemplo n.º 10
0
        protected override void Run()
        {
            vc.Checkout(path, null, true, Monitor);
            if (Monitor.IsCancelRequested)
            {
                Monitor.ReportSuccess(GettextCatalog.GetString("Checkout operation cancelled"));
                return;
            }

            if (!System.IO.Directory.Exists(path))
            {
                Monitor.ReportError(GettextCatalog.GetString("Checkout folder does not exist"), null);
                return;
            }

            string projectFn = null;

            string[] list = System.IO.Directory.GetFiles(path);
            if (projectFn == null)
            {
                foreach (string str in list)
                {
                    if (MonoDevelop.Projects.Services.ProjectService.IsWorkspaceItemFile(str))
                    {
                        projectFn = str;
                        break;
                    }
                }
            }

            if (projectFn != null)
            {
                DispatchService.GuiDispatch(delegate {
                    IdeApp.Workspace.OpenWorkspaceItem(projectFn);
                });
            }

            Monitor.ReportSuccess(GettextCatalog.GetString("Solution checked out"));
        }
Ejemplo n.º 11
0
        protected virtual void RefreshClickedThreaded(object state)
        {
            DatabaseConnectionSettings settings = state as DatabaseConnectionSettings;
            DatabaseConnectionContext  context  = new DatabaseConnectionContext(settings);
            IDbFactory fac = DbFactoryService.GetDbFactory(settings.ProviderIdentifier);

            try {
                FakeConnectionPool pool = new FakeConnectionPool(fac, fac.ConnectionProvider, context);
                pool.Initialize();

                ISchemaProvider          prov      = fac.CreateSchemaProvider(pool);
                DatabaseSchemaCollection databases = prov.GetDatabases();

                foreach (DatabaseSchema db in databases)
                {
                    DispatchService.GuiDispatch(delegate() {
                        storeDatabases.AppendValues(db.Name);
                    });
                }
                isDatabaseListEmpty = databases.Count == 0;
            } catch {}

            if (isDatabaseListEmpty)
            {
                DispatchService.GuiDispatch(delegate() {
                    storeDatabases.AppendValues(GettextCatalog.GetString("No databases found!"));
                });
            }
            else
            {
                DispatchService.GuiDispatch(delegate() {
                    TreeIter iter;
                    if (storeDatabases.GetIterFirst(out iter))
                    {
                        comboDatabase.SetActiveIter(iter);
                    }
                });
            }
        }
Ejemplo n.º 12
0
        NSToolbarItem CreateStatusBarToolbarItem()
        {
            var bar = new StatusBar();

            viewCache.Add(bar);
            var item = new NSToolbarItem(StatusBarId)
            {
                View = bar,
                // Place some temporary values in there.
                MinSize = new CGSize(360, 22),
                MaxSize = new CGSize(360, 22),
            };

            Action <NSNotification> resizeAction = notif => DispatchService.GuiDispatch(() => {
                // Skip updates with a null Window. Only crashes on Mavericks.
                // The View gets updated once again when the window resize finishes.
                if (bar.Window == null)
                {
                    return;
                }

                // We're getting notified about all windows in the application (for example, NSPopovers) that change size when really we only care about
                // the window the bar is in.
                if (notif.Object != bar.Window)
                {
                    return;
                }

                double maxSize = Math.Round(bar.Window.Frame.Width * 0.30f);
                double minSize = Math.Round(bar.Window.Frame.Width * 0.25f);
                item.MinSize   = new CGSize((nfloat)Math.Max(220, minSize), 22);
                item.MaxSize   = new CGSize((nfloat)Math.Min(700, maxSize), 22);
                bar.RepositionStatusLayers();
            });

            NSNotificationCenter.DefaultCenter.AddObserver(NSWindow.DidResizeNotification, resizeAction);
            NSNotificationCenter.DefaultCenter.AddObserver(NSWindow.DidEndLiveResizeNotification, resizeAction);
            return(item);
        }
Ejemplo n.º 13
0
        public void Refresh(UnityProjectState state)
        {
            bool updated = folderUpdater.Update(state);

            DispatchService.GuiDispatch(() =>
            {
                if (updated)
                {
                    // Updated folder structure, refresh tree
                    TreeView.RefreshNode(TreeView.GetRootNode());
                }
                else
                {
                    // Created a new folder structure, replace old tree
                    TreeView.Clear();
                    foreach (var child in folderUpdater.RootFolder.Children)
                    {
                        TreeView.AddChild(child);
                    }
                }
            });
        }
Ejemplo n.º 14
0
        public void EndProgress()
        {
            DispatchService.GuiDispatch(delegate {
                if (window != null)
                {
                    window.IsWorking = false;
                    if (!asyncOperation.Success)
                    {
                        window.HasErrors = true;
                    }
                    else
                    {
                        window.HasNewData = true;
                    }
                }
                buttonStop.Sensitive = false;
                progressStarted      = false;
                if (window == null)
                {
                    buttonClear.Sensitive = false;
                }

                if (monitor.Errors.Length > 0)
                {
                    IdeApp.Workbench.StatusBar.ShowMessage(Stock.Error, monitor.Errors [monitor.Errors.Length - 1].Message);
                    IdeApp.Workbench.StatusBar.SetMessageSourcePad(statusSourcePad);
                }
                else if (monitor.Messages.Length > 0)
                {
                    IdeApp.Workbench.StatusBar.ShowMessage(monitor.Messages [monitor.Messages.Length - 1]);
                    IdeApp.Workbench.StatusBar.SetMessageSourcePad(statusSourcePad);
                }
                else if (monitor.Warnings.Length > 0)
                {
                    IdeApp.Workbench.StatusBar.ShowMessage(Stock.Warning, monitor.Warnings [monitor.Warnings.Length - 1]);
                    IdeApp.Workbench.StatusBar.SetMessageSourcePad(statusSourcePad);
                }
            });
        }
        public XmlEditorViewContent()
        {
            xmlEditorWindow = new XmlEditorWindow(this);
            view            = xmlEditorWindow.View;
            buffer          = (SourceBuffer)view.Buffer;
            buffer.Changed += BufferChanged;

            view.SchemaCompletionDataItems = XmlSchemaManager.SchemaCompletionDataItems;
            SetInitialValues();

            // Watch for changes to the source editor properties.
            propertyChangedHandler = (EventHandler <PropertyChangedEventArgs>)DispatchService.GuiDispatch(new EventHandler <PropertyChangedEventArgs>(SourceEditorPropertyChanged));
            TextEditorProperties.Properties.PropertyChanged += propertyChangedHandler;

            buffer.ModifiedChanged += new EventHandler(OnModifiedChanged);
            XmlEditorAddInOptions.PropertyChanged += new EventHandler <PropertyChangedEventArgs>(XmlEditorPropertyChanged);

            XmlSchemaManager.UserSchemaAdded   += new EventHandler(UserSchemaAdded);
            XmlSchemaManager.UserSchemaRemoved += new EventHandler(UserSchemaRemoved);

            xmlEditorWindow.ShowAll();
        }
Ejemplo n.º 16
0
        private void AddNetwork(Network network)
        {
            lock (this) {
                if (debug)
                {
                    Console.Out.WriteLine("*** Adding network {0}.", network.NetworkName);
                }

                PointD position = new PointD(rng.Next(200), rng.Next(200));

                Hashtable nodegroups     = Hashtable.Synchronized(new Hashtable());
                Hashtable node2nodegroup = Hashtable.Synchronized(new Hashtable());
                network.Properties["nodegroups"]     = nodegroups;
                network.Properties["node2nodegroup"] = node2nodegroup;
                network.Properties["rect"]           = new Rectangle(position.X, position.Y, 0, 0);
                networkZOrder.Add(network);

                foreach (Node node in network.Nodes.Values)
                {
                    AddNode(node, network);
                }

                network.NewIncomingConnection += delegate(Network eNetwork, LocalNodeConnection connection) { Gtk.Application.Invoke(delegate { this.QueueDraw(); }); };

                network.ConnectingTo += delegate(Network eNetwork, LocalNodeConnection connection) { Gtk.Application.Invoke(delegate { this.QueueDraw(); }); };

                network.UserOnline     += (NodeOnlineOfflineEventHandler)DispatchService.GuiDispatch(new NodeOnlineOfflineEventHandler(network_UserOnline));
                network.UserOffline    += (NodeOnlineOfflineEventHandler)DispatchService.GuiDispatch(new NodeOnlineOfflineEventHandler(network_UserOffline));
                network.UpdateNodeInfo += (UpdateNodeInfoEventHandler)DispatchService.GuiDispatch(new UpdateNodeInfoEventHandler(network_UpdateNodeInfo));

                network.ConnectionUp += delegate(INodeConnection connection) { Gtk.Application.Invoke(delegate { this.QueueDraw(); }); };

                network.ConnectionDown += delegate(INodeConnection connection) { Gtk.Application.Invoke(delegate { this.QueueDraw(); }); };

                network.CleanupFinished += delegate(object sender, EventArgs e) { Gtk.Application.Invoke(delegate { this.QueueDraw(); }); };
            }

            this.QueueDraw();
        }
Ejemplo n.º 17
0
        void RunTest(ITreeNavigator nav, IExecutionHandler mode)
        {
            if (nav == null)
            {
                return;
            }
            UnitTest test = nav.DataItem as UnitTest;

            if (test == null)
            {
                return;
            }
            TestSession.ResetResult(test.RootTest);

            this.buttonRun.Sensitive    = false;
            this.buttonRunAll.Sensitive = false;
            this.buttonStop.Sensitive   = true;

            IdeApp.Workbench.GetPad <TestPad> ().BringToFront();
            runningTestOperation            = testService.RunTest(test, mode);
            runningTestOperation.Completed += (OperationHandler)DispatchService.GuiDispatch(new OperationHandler(TestSessionCompleted));
        }
Ejemplo n.º 18
0
 public void TakeScreenshot(string screenshotPath)
 {
                 #if MAC
     DispatchService.GuiDispatch(delegate {
         try {
             IntPtr handle = CGDisplayCreateImage(MainDisplayID());
             CoreGraphics.CGImage screenshot = ObjCRuntime.Runtime.GetINativeObject <CoreGraphics.CGImage> (handle, true);
             AppKit.NSBitmapImageRep imgRep  = new AppKit.NSBitmapImageRep(screenshot);
             var imageData = imgRep.RepresentationUsingTypeProperties(AppKit.NSBitmapImageFileType.Png);
             imageData.Save(screenshotPath, true);
         } catch (Exception e) {
             Console.WriteLine(e);
             throw;
         }
     });
                 #else
     Sync(delegate {
         try {
             using (var bmp = new System.Drawing.Bitmap(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width,
                                                        System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height)) {
                 using (var g = System.Drawing.Graphics.FromImage(bmp))
                 {
                     g.CopyFromScreen(System.Windows.Forms.Screen.PrimaryScreen.Bounds.X,
                                      System.Windows.Forms.Screen.PrimaryScreen.Bounds.Y,
                                      0, 0,
                                      bmp.Size,
                                      System.Drawing.CopyPixelOperation.SourceCopy);
                 }
                 bmp.Save(screenshotPath);
             }
             return(null);
         } catch (Exception e) {
             Console.WriteLine(e);
             throw;
         }
     });
                 #endif
 }
Ejemplo n.º 19
0
        protected override void Run(object dataItem)
        {
            MessageHandler guiRun = delegate
            {
                var project = IdeApp.ProjectOperations.CurrentSelectedProject as DProject;
                if (project == null)
                {
                    return;
                }

                DProjectConfiguration conf = project.Configurations["Unittest"] as DProjectConfiguration;
                if (conf == null)
                {
                    return;
                }

                ProjectFile file = IdeApp.ProjectOperations.CurrentSelectedItem as ProjectFile;
                if (file == null)
                {
                    return;
                }

                string filePath = file.FilePath.FullPath;

                IdeApp.Workbench.SaveAll();

                if ((string)commandInfo.Command.Id == "MonoDevelop.D.Unittest.Commands.UnittestCommands.RunExternal")
                {
                    UnittestCore.RunExternal(filePath, project, conf);
                }
                else
                {
                    UnittestCore.Run(filePath, project, conf);
                }
            };

            DispatchService.GuiDispatch(guiRun);
        }
Ejemplo n.º 20
0
 public static void ReportStashResult(IProgressMonitor monitor, MergeCommandResult result)
 {
     if (result.GetMergeStatus() == NGit.Api.MergeStatus.FAILED)
     {
         string msg = GettextCatalog.GetString("Stash operation failed.");
         DispatchService.GuiDispatch(delegate
         {
             IdeApp.Workbench.StatusBar.ShowWarning(msg);
         });
         string txt = msg + "\n\n" + GetMergeResultErrorDetail(result);
         monitor.ReportError(txt, null);
     }
     else if (result.GetMergeStatus() == NGit.Api.MergeStatus.NOT_SUPPORTED)
     {
         string msg = GettextCatalog.GetString("Operation not supported");
         monitor.ReportError(msg, null);
         DispatchService.GuiDispatch(delegate
         {
             IdeApp.Workbench.StatusBar.ShowWarning(msg);
         });
     }
     else if (result.GetMergeStatus() == NGit.Api.MergeStatus.CONFLICTING)
     {
         string msg = GettextCatalog.GetString("Stash applied with conflicts");
         DispatchService.GuiDispatch(delegate
         {
             IdeApp.Workbench.StatusBar.ShowWarning(msg);
         });
     }
     else
     {
         string msg = GettextCatalog.GetString("Stash successfully applied");
         DispatchService.GuiDispatch(delegate
         {
             IdeApp.Workbench.StatusBar.ShowMessage(msg);
         });
     }
 }
Ejemplo n.º 21
0
        public void Start(bool rerun = false)
        {
            if (!rerun && alreadyStarted)
            {
                return;
            }
            alreadyStarted = true;
            ThreadPool.QueueUserWorkItem(delegate {
                lock (updateLock) {
                    try {
                        History     = Item.Repository.GetHistory(Item.Path, null);
                        VersionInfo = Item.Repository.GetVersionInfo(Item.Path, VersionInfoQueryFlags.IgnoreCache);
                    } catch (Exception ex) {
                        LoggingService.LogError("Error retrieving history", ex);
                    }

                    DispatchService.GuiDispatch(delegate {
                        OnUpdated(EventArgs.Empty);
                    });
                    isUpdated = true;
                }
            });
        }
Ejemplo n.º 22
0
        void UpdateReferences(IList <WebReferenceItem> items)
        {
            try {
                UpdateReferenceContext = IdeApp.Workbench.StatusBar.CreateContext();
                UpdateReferenceContext.BeginProgress(GettextCatalog.GetPluralString("Updating web reference", "Updating web references", items.Count));

                DispatchService.ThreadDispatch(() => {
                    for (int i = 0; i < items.Count; i++)
                    {
                        DispatchService.GuiDispatch(() => UpdateReferenceContext.SetProgressFraction(Math.Max(0.1, (double)i / items.Count)));
                        try {
                            items [i].Update();
                        } catch (Exception ex) {
                            DispatchService.GuiSyncDispatch(() => {
                                MessageService.ShowException(ex, GettextCatalog.GetString("Failed to update Web Reference '{0}'", items [i].Name));
                                DisposeUpdateContext();
                            });
                            return;
                        }
                    }

                    DispatchService.GuiDispatch(() => {
                        // Make sure that we save all relevant projects, there should only be 1 though
                        foreach (var project in items.Select(i => i.Project).Distinct())
                        {
                            IdeApp.ProjectOperations.Save(project);
                        }

                        IdeApp.Workbench.StatusBar.ShowMessage(GettextCatalog.GetPluralString("Updated Web Reference {0}", "Updated Web References", items.Count, items[0].Name));
                        DisposeUpdateContext();
                    });
                });
            } catch {
                DisposeUpdateContext();
                throw;
            }
        }
Ejemplo n.º 23
0
        void RunInstall(Gtk.Alignment commandBox, Update update)
        {
            installing = true;

            ProgressBarMonitor monitorBar = new ProgressBarMonitor();

            monitorBar.ShowErrorsDialog = true;
            monitorBar.Show();
            commandBox.Child.Destroy();
            commandBox.Add(monitorBar);

            IAsyncOperation oper = update.InstallAction(monitorBar.CreateProgressMonitor());

            oper.Completed += delegate {
                DispatchService.GuiDispatch(delegate {
                    monitorBar.Hide();
                    Gtk.Label result = new Gtk.Label();
                    if (oper.Success)
                    {
                        result.Text = GettextCatalog.GetString("Completed");
                    }
                    else
                    {
                        result.Text = GettextCatalog.GetString("Failed");
                    }
                    commandBox.Child.Destroy();
                    commandBox.Add(result);
                    result.Show();
                    installing = false;

                    if (installQueue.Count > 0)
                    {
                        installQueue.Dequeue()();
                    }
                });
            };
        }
Ejemplo n.º 24
0
        void AddFolderOverlay(Repository rep, string folder, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon, object dataObject)
        {
            Gdk.Pixbuf  overlay = null;
            VersionInfo vinfo   = GetVersionInfo(rep, folder, dataObject, false);

            if (vinfo == null)
            {
                ThreadPool.QueueUserWorkItem(x => {
                    VersionInfo info = GetVersionInfo(rep, folder, dataObject, true);
                    if (info != null)
                    {
                        DispatchService.GuiDispatch(() => UpdatePath(folder));
                    }
                });
                vinfo = VersionInfo.CreateUnversioned(folder, true);
            }
            else if (!vinfo.IsVersioned)
            {
                overlay = VersionControlService.LoadOverlayIconForStatus(VersionStatus.Unversioned);
            }
            else if (vinfo.IsVersioned && !vinfo.HasLocalChanges)
            {
                overlay = VersionControlService.overlay_controled;
            }
            else
            {
                overlay = VersionControlService.LoadOverlayIconForStatus(vinfo.Status);
            }
            if (overlay != null)
            {
                AddOverlay(ref icon, overlay);
                if (closedIcon != null)
                {
                    AddOverlay(ref closedIcon, overlay);
                }
            }
        }
Ejemplo n.º 25
0
        private void BuildChildNodesThreaded(object state)
        {
            TableNode    node    = state as TableNode;
            ITreeBuilder builder = Context.GetTreeBuilder(state);
            IDbFactory   fac     = node.ConnectionContext.DbFactory;

            if (fac.IsCapabilitySupported("Table", SchemaActions.Schema, TableCapabilities.Columns))
            {
                DispatchService.GuiDispatch(delegate {
                    builder.AddChild(new ColumnsNode(node.ConnectionContext, node.Table));
                });
            }

            if (fac.IsCapabilitySupported("Table", SchemaActions.Schema, TableCapabilities.PrimaryKeyConstraint) ||
                fac.IsCapabilitySupported("Table", SchemaActions.Schema, TableCapabilities.ForeignKeyConstraint) ||
                fac.IsCapabilitySupported("Table", SchemaActions.Schema, TableCapabilities.CheckConstraint) ||
                fac.IsCapabilitySupported("Table", SchemaActions.Schema, TableCapabilities.UniqueConstraint)
                )
            {
                DispatchService.GuiDispatch(delegate {
                    builder.AddChild(new ConstraintsNode(node.ConnectionContext, node.Table));
                });
            }

            if (fac.IsCapabilitySupported("Table", SchemaActions.Schema, TableCapabilities.Trigger))
            {
                DispatchService.GuiDispatch(delegate {
                    builder.AddChild(new TriggersNode(node.ConnectionContext));
                });
            }

            //TODO: rules

            DispatchService.GuiDispatch(delegate {
                builder.Expanded = true;
            });
        }
Ejemplo n.º 26
0
        protected void OnGetOutgoing()
        {
            VersionControlItem              vcitem   = GetItems()[0];
            MercurialRepository             repo     = ((MercurialRepository)vcitem.Repository);
            Dictionary <string, BranchType> branches = repo.GetKnownBranches(vcitem.Path);
            string defaultBranch = string.Empty,
                   localPath     = vcitem.IsDirectory? (string)vcitem.Path.FullPath: Path.GetDirectoryName(vcitem.Path.FullPath);

            foreach (KeyValuePair <string, BranchType> branch in branches)
            {
                if (BranchType.Parent == branch.Value)
                {
                    defaultBranch = branch.Key;
                    break;
                }
            }            // check for parent branch

            Dialogs.BranchSelectionDialog bsd = new Dialogs.BranchSelectionDialog(branches.Keys, defaultBranch, localPath, false, false, false, false);
            try {
                if ((int)Gtk.ResponseType.Ok == bsd.Run())
                {
                    MercurialTask worker = new MercurialTask();
                    worker.Description = string.Format("Outgoing to {0}", bsd.SelectedLocation);
                    worker.Operation   = delegate {
                        repo.LocalBasePath = MercurialRepository.GetLocalBasePath(localPath);
                        Revision[] history = repo.GetOutgoing(bsd.SelectedLocation);
                        DispatchService.GuiDispatch(() => {
                            var view = new MonoDevelop.VersionControl.Views.LogView(localPath, true, history, repo);
                            IdeApp.Workbench.OpenDocument(view, true);
                        });
                    };
                    worker.Start();
                }
            } finally {
                bsd.Destroy();
            }
        } // OnGetOutgoing
Ejemplo n.º 27
0
        private void RenameItemThreaded(object state)
        {
            object[] objs = state as object[];

            TableNode       node     = objs[0] as TableNode;
            string          newName  = objs[1] as string;
            ISchemaProvider provider = node.Table.SchemaProvider;

            if (provider.IsValidName(newName))
            {
                provider.RenameTable(node.Table, newName);
                node.Refresh();
            }
            else
            {
                DispatchService.GuiDispatch(delegate() {
                    Services.MessageService.ShowError(String.Format(
                                                          "Unable to rename table '{0}' to '{1}'!",
                                                          node.Table.Name, newName
                                                          ));
                });
            }
            node.Refresh();
        }
        public void AddNodeBefore(object data)
        {
            DotNetProject p     = (DotNetProject)CurrentNode.GetParentDataItem(typeof(Project), false);
            AddinData     adata = p.GetAddinData();

            Extension         en    = GetExtension();
            ExtensionNodeType ntype = (ExtensionNodeType)data;

            ExtensionNodeDescription newNode = new ExtensionNodeDescription(ntype.NodeName);

            en.ExtensionNodes.Add(newNode);
            CurrentNode.Expanded = true;

            adata.SaveAddinManifest();
            adata.NotifyChanged(false);

            DispatchService.GuiDispatch(delegate {
                ITreeNavigator nav = Tree.GetNodeAtObject(new ExtensionNodeInfo(newNode, false));
                if (nav != null)
                {
                    nav.Selected = true;
                }
            });
        }
Ejemplo n.º 29
0
        private void RenameItemThreaded(object state)
        {
            object[] objs = state as object[];

            ViewNode            node     = objs[0] as ViewNode;
            string              newName  = objs[1] as string;
            IEditSchemaProvider provider = (IEditSchemaProvider)node.View.SchemaProvider;

            if (provider.IsValidName(newName))
            {
                provider.RenameView(node.View, newName);
                node.Refresh();
            }
            else
            {
                DispatchService.GuiDispatch(delegate() {
                    MessageService.ShowError(String.Format(
                                                 "Unable to rename view '{0}' to '{1}'!",
                                                 node.View.Name, newName
                                                 ));
                });
            }
            node.Refresh();
        }
Ejemplo n.º 30
0
        protected override void Run()
        {
            MessageHandler guiRun = delegate
            {
                var project = IdeApp.ProjectOperations.CurrentSelectedProject as DProject;
                if (project == null)
                {
                    return;
                }

                Pad pad = IdeApp.Workbench.GetPad <DProfilerPad>();
                if (pad == null || !(pad.Content is DProfilerPad))
                {
                    return;
                }

                DProfilerPad profilerPad = (DProfilerPad)pad.Content;

                pad.Visible = true;
                profilerPad.AnalyseTraceFile(project);
            };

            DispatchService.GuiDispatch(guiRun);
        }