コード例 #1
0
        public override bool Equals(object obj)
        {
            SolutionFolderFileNode other = obj as SolutionFolderFileNode;

            if (other == null)
            {
                return(false);
            }
            return(file == other.file && parent == other.parent);
        }
コード例 #2
0
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
        {
            SolutionFolderFileNode file = (SolutionFolderFileNode)dataObject;

            nodeInfo.Label = file.FileName.FileName;
            if (!System.IO.File.Exists(file.FileName))
            {
                nodeInfo.Label = "<span foreground='red'>" + nodeInfo.Label + "</span>";
            }
            nodeInfo.Icon = DesktopService.GetIconForFile(file.FileName, Gtk.IconSize.Menu);
        }
コード例 #3
0
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, ref string label, ref Gdk.Pixbuf icon, ref Gdk.Pixbuf closedIcon)
        {
            SolutionFolderFileNode file = (SolutionFolderFileNode)dataObject;

            label = file.FileName.FileName;
            if (!System.IO.File.Exists(file.FileName))
            {
                label = "<span foreground='red'>" + label + "</span>";
            }
            icon = DesktopService.GetPixbufForFile(file.FileName, Gtk.IconSize.Menu);
        }
コード例 #4
0
        public override void BuildNode(ITreeBuilder treeBuilder, object dataObject, NodeInfo nodeInfo)
        {
            SolutionFolderFileNode file = (SolutionFolderFileNode)dataObject;

            nodeInfo.Label = file.Name;
            if (!System.IO.File.Exists(file.Path))
            {
                nodeInfo.Label = "<span foreground='" + Styles.ErrorForegroundColor.ToHexString(false) + "'>" + nodeInfo.Label + "</span>";
            }
            nodeInfo.Icon = IdeServices.DesktopService.GetIconForFile(file.Path, Gtk.IconSize.Menu);
        }
コード例 #5
0
        public override object GetParentObject(object dataObject)
        {
            SolutionFolderFileNode file = (SolutionFolderFileNode)dataObject;

            if (file.Parent.IsRoot)
            {
                return(file.Parent.ParentSolution);
            }
            else
            {
                return(file.Parent);
            }
        }
コード例 #6
0
        public override void DeleteMultipleItems()
        {
            var             modifiedSolutionsToSave = new HashSet <Solution> ();
            QuestionMessage msg = new QuestionMessage();

            msg.SecondaryText = GettextCatalog.GetString("The Delete option permanently removes the file from your hard disk. Click Remove from Solution if you only want to remove it from your current solution.");
            AlertButton removeFromSolution = new AlertButton(GettextCatalog.GetString("_Remove from Solution"), Gtk.Stock.Remove);

            msg.Buttons.Add(AlertButton.Delete);
            msg.Buttons.Add(AlertButton.Cancel);
            msg.Buttons.Add(removeFromSolution);
            msg.AllowApplyToAll = true;

            foreach (ITreeNavigator nav in CurrentNodes)
            {
                SolutionFolderFileNode file = (SolutionFolderFileNode)nav.DataItem;
                if (file.Parent.IsRoot)
                {
                    msg.Text = GettextCatalog.GetString("Are you sure you want to remove the file {0} from the solution folder {1}?", file.FileName.FileName, file.Parent.Name);
                }
                else
                {
                    msg.Text = GettextCatalog.GetString("Are you sure you want to remove the file {0} from the solution {1}?", file.FileName.FileName, file.Parent.ParentSolution.Name);
                }
                AlertButton result = MessageService.AskQuestion(msg);
                if (result == AlertButton.Cancel)
                {
                    return;
                }

                file.Parent.Files.Remove(file.FileName);

                if (result == AlertButton.Delete)
                {
                    FileService.DeleteFile(file.FileName);
                }

                if (file.Parent != null && file.Parent.ParentSolution != null)
                {
                    modifiedSolutionsToSave.Add(file.Parent.ParentSolution);
                }
            }

            IdeApp.ProjectOperations.SaveAsync(modifiedSolutionsToSave);
        }
コード例 #7
0
        public override void ActivateItem()
        {
            SolutionFolderFileNode file = (SolutionFolderFileNode)CurrentNode.DataItem;

            IdeApp.Workbench.OpenDocument(file.FileName, project: null);
        }