Пример #1
0
        /// <summary>
        /// Executes a command from the standard Visual Studio 97 command set.
        /// </summary>
        /// <param name="command">The command to execute.</param>
        /// <returns>true if the command is supported; otherwise, false.</returns>
        public override bool ExecuteStandard97Command(VsCommand command)
        {
            bool supported = true;

            switch (command)
            {
            case VsCommand.NewFolder:
            {
                // We'll create a new folder, then immediately give the user a chance to rename it.
                // The code in for the Caption setter will make sure to rename the node and directory.
                string     folderName = this.GenerateUniqueName("NewFolder", String.Empty, true);
                FolderNode folderNode = this.Hierarchy.CreateAndAddFolder(this, folderName);
                folderNode.StartNodeEdit();
                break;
            }

            case VsCommand.AddNewItem:
                this.Hierarchy.ShowAddFileDialogBox(this, AddFileDialogType.AddNew);
                break;

            case VsCommand.AddExistingItem:
                this.Hierarchy.ShowAddFileDialogBox(this, AddFileDialogType.AddExisting);
                break;

            default:
                supported = base.ExecuteStandard97Command(command);
                break;
            }
            return(supported);
        }
Пример #2
0
        /// <summary>
        /// Executes a command from the standard Visual Studio 97 command set.
        /// </summary>
        /// <param name="command">The command to execute.</param>
        /// <returns>true if the command is supported; otherwise, false.</returns>
        public override bool ExecuteStandard97Command(VsCommand command)
        {
            bool supported = true;

            switch (command)
            {
            case VsCommand.BuildCtx:
            case VsCommand.BuildSel:
                this.Hierarchy.AttachedProject.StartBuild(BuildOperation.Build);
                break;

            case VsCommand.RebuildCtx:
            case VsCommand.RebuildSel:
                this.Hierarchy.AttachedProject.StartBuild(BuildOperation.Rebuild);
                break;

            case VsCommand.CleanCtx:
            case VsCommand.CleanSel:
                this.Hierarchy.AttachedProject.StartBuild(BuildOperation.Clean);
                break;

            default:
                supported = false;
                break;
            }

            return(supported);
        }
Пример #3
0
        /// <summary>
        /// Queries the state of a command from the standard Visual Studio 97 command set on this node.
        /// </summary>
        /// <param name="command">The command to query.</param>
        /// <returns>One of the <see cref="CommandStatus"/> values if the node handles the command;
        /// otherwise <see cref="CommandStatus.Unhandled"/>.</returns>
        public virtual CommandStatus QueryStandard97CommandStatus(VsCommand command)
        {
            CommandStatus status = CommandStatus.Unhandled;

            switch (command)
            {
            case VsCommand.Cut:
            case VsCommand.Copy:
                if (!this.IsVirtual)
                {
                    status = CommandStatus.SupportedAndEnabled;
                }
                break;

            case VsCommand.Delete:
                if (this.CanDelete)
                {
                    status = CommandStatus.SupportedAndEnabled;
                }
                else
                {
                    status = CommandStatus.NotSupportedOrEnabled;
                }
                break;

            case VsCommand.NewFolder:
            case VsCommand.AddNewItem:
            case VsCommand.AddExistingItem:
            case VsCommand.Paste:
                if (this.IsFolder)
                {
                    status = CommandStatus.SupportedAndEnabled;
                }
                break;

            case VsCommand.Open:
            case VsCommand.OpenWith:
                if (this.IsFile)
                {
                    status = CommandStatus.SupportedAndEnabled;
                }
                break;

            case VsCommand.Rename:
                if (this.CaptionEditable)
                {
                    status = CommandStatus.SupportedAndEnabled;
                }
                break;
            }

            return(status);
        }
Пример #4
0
        /// <summary>
        /// Queries the state of a command from the standard Visual Studio 97 command set on this node.
        /// </summary>
        /// <param name="command">The command to query.</param>
        /// <returns>One of the <see cref="CommandStatus"/> values if the node handles the command;
        /// otherwise <see cref="CommandStatus.Unhandled"/>.</returns>
        public override CommandStatus QueryStandard97CommandStatus(VsCommand command)
        {
            if (this.Unavailable)
            {
                return(CommandStatus.Unhandled);
            }

            CommandStatus status = CommandStatus.Unhandled;

            switch (command)
            {
            case VsCommand.Cut:
            case VsCommand.Copy:
            case VsCommand.Delete:
                status = CommandStatus.NotSupportedOrEnabled;
                break;

            case VsCommand.Remove:
                status = CommandStatus.SupportedAndEnabled;
                break;

            case VsCommand.BuildSel:
            case VsCommand.BuildCtx:
            case VsCommand.RebuildSel:
            case VsCommand.RebuildCtx:
            case VsCommand.CleanSel:
            case VsCommand.CleanCtx:
                if (!Package.Instance.Context.IsSolutionBuilding)
                {
                    status = CommandStatus.SupportedAndEnabled;
                }
                else
                {
                    status = CommandStatus.Supported;
                }
                break;

            case VsCommand.ProjectDependencies:
            case VsCommand.BuildOrder:
            case VsCommand.ProjectSettings:
                status = CommandStatus.SupportedAndEnabled;
                break;

            default:
                status = base.QueryStandard97CommandStatus(command);
                break;
            }

            return(status);
        }
Пример #5
0
        //==========================================================================================
        // Methods
        //==========================================================================================

        /// <summary>
        /// Queries the state of a command from the standard Visual Studio 97 command set on this node.
        /// </summary>
        /// <param name="command">The command to query.</param>
        /// <returns>One of the <see cref="CommandStatus"/> values if the node handles the command;
        /// otherwise <see cref="CommandStatus.Unhandled"/>.</returns>
        public override CommandStatus QueryStandard97CommandStatus(VsCommand command)
        {
            CommandStatus status = CommandStatus.Unhandled;

            switch (command)
            {
            case VsCommand.ViewCode:
                status = CommandStatus.SupportedAndEnabled;
                break;

            default:
                status = base.QueryStandard97CommandStatus(command);
                break;
            }

            return(status);
        }
Пример #6
0
        //==========================================================================================
        // Methods
        //==========================================================================================
        /// <summary>
        /// Queries the state of a command from the standard Visual Studio 97 command set on this node.
        /// </summary>
        /// <param name="command">The command to query.</param>
        /// <returns>One of the <see cref="CommandStatus"/> values if the node handles the command;
        /// otherwise <see cref="CommandStatus.Unhandled"/>.</returns>
        public override CommandStatus QueryStandard97CommandStatus(VsCommand command)
        {
            CommandStatus status = CommandStatus.Unhandled;

            switch (command)
            {
                case VsCommand.ViewCode:
                    status = CommandStatus.SupportedAndEnabled;
                    break;

                default:
                    status = base.QueryStandard97CommandStatus(command);
                    break;
            }

            return status;
        }
Пример #7
0
        //==========================================================================================
        // Methods
        //==========================================================================================

        /// <summary>
        /// Executes a command from the standard Visual Studio 97 command set.
        /// </summary>
        /// <param name="command">The command to execute.</param>
        /// <returns>true if the command is supported; otherwise, false.</returns>
        public override bool ExecuteStandard97Command(VsCommand command)
        {
            bool supported = true;

            switch (command)
            {
            case VsCommand.Remove:
            case VsCommand.Delete:
                this.RemoveFromProject();
                break;

            default:
                supported = base.ExecuteStandard97Command(command);
                break;
            }

            return(supported);
        }
Пример #8
0
        /// <summary>
        /// Queries the state of a command from the standard Visual Studio 97 command set on this node.
        /// </summary>
        /// <param name="command">The command to query.</param>
        /// <returns>One of the <see cref="CommandStatus"/> values if the node handles the command;
        /// otherwise <see cref="CommandStatus.Unhandled"/>.</returns>
        public override CommandStatus QueryStandard97CommandStatus(VsCommand command)
        {
            CommandStatus status = CommandStatus.Unhandled;

            switch (command)
            {
            case VsCommand.Open:
            case VsCommand.OpenWith:
                status = CommandStatus.NotSupportedOrEnabled;
                break;

            case VsCommand.Rename:
                status = CommandStatus.NotSupportedOrEnabled;
                break;
            }

            return(status);
        }
Пример #9
0
        /// <summary>
        /// Executes a command from the standard Visual Studio 97 command set.
        /// </summary>
        /// <param name="command">The command to execute.</param>
        /// <returns>true if the command is supported; otherwise, false.</returns>
        public override bool ExecuteStandard97Command(VsCommand command)
        {
            bool supported = true;

            switch (command)
            {
            case VsCommand.ViewCode:
                this.Open(VsLogicalView.Code);
                break;

            case VsCommand.Open:
                this.Open();
                break;

            default:
                supported = base.ExecuteStandard97Command(command);
                break;
            }

            return(supported);
        }
Пример #10
0
        /// <summary>
        /// Executes a command from the standard Visual Studio 97 command set.
        /// </summary>
        /// <param name="command">The command to execute.</param>
        /// <returns>true if the command is supported; otherwise, false.</returns>
        public virtual bool ExecuteStandard97Command(VsCommand command)
        {
            bool supported = true;

            if (command != VsCommand.SolutionCfg && command != VsCommand.SearchCombo)
            {
                Tracer.Assert(true, "Put breakpoint here if you want to debug a specific menu command or find out what menu commands Visual Studio is sending.");
            }

            switch (command)
            {
            // TODO: Implement cut, copy and paste.
            case VsCommand.Cut:
                break;

            case VsCommand.Copy:
                break;

            case VsCommand.Paste:
                break;

            case VsCommand.Delete:
                this.Delete();
                break;

            case VsCommand.Rename:
                this.StartNodeEdit();
                break;

            default:
                supported = false;
                break;
            }

            return(supported);
        }
Пример #11
0
        /// <summary>
        /// Executes a command from the standard Visual Studio 97 command set.
        /// </summary>
        /// <param name="command">The command to execute.</param>
        /// <returns>true if the command is supported; otherwise, false.</returns>
        public override bool ExecuteStandard97Command(VsCommand command)
        {
            bool supported = true;
            switch (command)
            {
                case VsCommand.ViewCode:
                    this.Open(VsLogicalView.Code);
                    break;

                case VsCommand.Open:
                    this.Open();
                    break;

                default:
                    supported = base.ExecuteStandard97Command(command);
                    break;
            }

            return supported;
        }
Пример #12
0
        /// <summary>
        /// Queries the state of a command from the standard Visual Studio 97 command set on this node.
        /// </summary>
        /// <param name="command">The command to query.</param>
        /// <returns>One of the <see cref="CommandStatus"/> values if the node handles the command;
        /// otherwise <see cref="CommandStatus.Unhandled"/>.</returns>
        public override CommandStatus QueryStandard97CommandStatus(VsCommand command)
        {
            CommandStatus status = CommandStatus.Unhandled;

            switch (command)
            {
                case VsCommand.Open:
                case VsCommand.OpenWith:
                    status = CommandStatus.NotSupportedOrEnabled;
                    break;

                case VsCommand.Rename:
                    status = CommandStatus.NotSupportedOrEnabled;
                    break;
            }

            return status;
        }
Пример #13
0
        //==========================================================================================
        // Methods
        //==========================================================================================
        /// <summary>
        /// Executes a command from the standard Visual Studio 97 command set.
        /// </summary>
        /// <param name="command">The command to execute.</param>
        /// <returns>true if the command is supported; otherwise, false.</returns>
        public override bool ExecuteStandard97Command(VsCommand command)
        {
            bool supported = true;

            switch (command)
            {
                case VsCommand.Remove:
                case VsCommand.Delete:
                    this.RemoveFromProject();
                    break;

                default:
                    supported = base.ExecuteStandard97Command(command);
                    break;
            }

            return supported;
        }
Пример #14
0
        /// <summary>
        /// Executes a command from the standard Visual Studio 97 command set.
        /// </summary>
        /// <param name="command">The command to execute.</param>
        /// <returns>true if the command is supported; otherwise, false.</returns>
        public override bool ExecuteStandard97Command(VsCommand command)
        {
            bool supported = true;
            switch (command)
            {
                case VsCommand.NewFolder:
                {
                    // We'll create a new folder, then immediately give the user a chance to rename it.
                    // The code in for the Caption setter will make sure to rename the node and directory.
                    string folderName = this.GenerateUniqueName("NewFolder", String.Empty, true);
                    FolderNode folderNode = this.Hierarchy.CreateAndAddFolder(this, folderName);
                    folderNode.StartNodeEdit();
                    break;
                }

                case VsCommand.AddNewItem:
                    this.Hierarchy.ShowAddFileDialogBox(this, AddFileDialogType.AddNew);
                    break;

                case VsCommand.AddExistingItem:
                    this.Hierarchy.ShowAddFileDialogBox(this, AddFileDialogType.AddExisting);
                    break;

                default:
                    supported = base.ExecuteStandard97Command(command);
                    break;
            }
            return supported;
        }
Пример #15
0
        /// <summary>
        /// Queries the state of a command from the standard Visual Studio 97 command set on this node.
        /// </summary>
        /// <param name="command">The command to query.</param>
        /// <returns>One of the <see cref="CommandStatus"/> values if the node handles the command;
        /// otherwise <see cref="CommandStatus.Unhandled"/>.</returns>
        public override CommandStatus QueryStandard97CommandStatus(VsCommand command)
        {
            if (this.Unavailable)
            {
                return CommandStatus.Unhandled;
            }

            CommandStatus status = CommandStatus.Unhandled;

            switch (command)
            {
                case VsCommand.Cut:
                case VsCommand.Copy:
                case VsCommand.Delete:
                    status = CommandStatus.NotSupportedOrEnabled;
                    break;

                case VsCommand.Remove:
                    status = CommandStatus.SupportedAndEnabled;
                    break;

                case VsCommand.BuildSel:
                case VsCommand.BuildCtx:
                case VsCommand.RebuildSel:
                case VsCommand.RebuildCtx:
                case VsCommand.CleanSel:
                case VsCommand.CleanCtx:
                    if (!Package.Instance.Context.IsSolutionBuilding)
                    {
                        status = CommandStatus.SupportedAndEnabled;
                    }
                    else
                    {
                        status = CommandStatus.Supported;
                    }
                    break;

                case VsCommand.ProjectDependencies:
                case VsCommand.BuildOrder:
                case VsCommand.ProjectSettings:
                    status = CommandStatus.SupportedAndEnabled;
                    break;

                default:
                    status = base.QueryStandard97CommandStatus(command);
                    break;
            }

            return status;
        }
Пример #16
0
        /// <summary>
        /// Executes a command from the standard Visual Studio 97 command set.
        /// </summary>
        /// <param name="command">The command to execute.</param>
        /// <returns>true if the command is supported; otherwise, false.</returns>
        public virtual bool ExecuteStandard97Command(VsCommand command)
        {
            bool supported = true;

            if (command != VsCommand.SolutionCfg && command != VsCommand.SearchCombo)
            {
                Tracer.Assert(true, "Put breakpoint here if you want to debug a specific menu command or find out what menu commands Visual Studio is sending.");
            }

            switch (command)
            {
                // TODO: Implement cut, copy and paste.
                case VsCommand.Cut:
                    break;

                case VsCommand.Copy:
                    break;

                case VsCommand.Paste:
                    break;

                case VsCommand.Delete:
                    this.Delete();
                    break;

                case VsCommand.Rename:
                    this.StartNodeEdit();
                    break;

                default:
                    supported = false;
                    break;
            }

            return supported;
        }
Пример #17
0
        /// <summary>
        /// Queries the state of a command from the standard Visual Studio 97 command set on this node.
        /// </summary>
        /// <param name="command">The command to query.</param>
        /// <returns>One of the <see cref="CommandStatus"/> values if the node handles the command;
        /// otherwise <see cref="CommandStatus.Unhandled"/>.</returns>
        public virtual CommandStatus QueryStandard97CommandStatus(VsCommand command)
        {
            CommandStatus status = CommandStatus.Unhandled;

            switch (command)
            {
                case VsCommand.Cut:
                case VsCommand.Copy:
                    if (!this.IsVirtual)
                    {
                        status = CommandStatus.SupportedAndEnabled;
                    }
                    break;

                case VsCommand.Delete:
                    if (this.CanDelete)
                    {
                        status = CommandStatus.SupportedAndEnabled;
                    }
                    else
                    {
                        status = CommandStatus.NotSupportedOrEnabled;
                    }
                    break;

                case VsCommand.NewFolder:
                case VsCommand.AddNewItem:
                case VsCommand.AddExistingItem:
                case VsCommand.Paste:
                    if (this.IsFolder)
                    {
                        status = CommandStatus.SupportedAndEnabled;
                    }
                    break;

                case VsCommand.Open:
                case VsCommand.OpenWith:
                    if (this.IsFile)
                    {
                        status = CommandStatus.SupportedAndEnabled;
                    }
                    break;

                case VsCommand.Rename:
                    if (this.CaptionEditable)
                    {
                        status = CommandStatus.SupportedAndEnabled;
                    }
                    break;
            }

            return status;
        }
Пример #18
0
        protected virtual bool ExecuteStandard97Command(Node node, VsCommand command)
        {
            Tracer.VerifyNonNullArgument(node, "node");

            // Give the node first dibs on executing the command.
            bool supported = node.ExecuteStandard97Command(command);
            Tracer.WriteLineIf(classType, "ExecuteStandard97Command", Tracer.Level.Verbose, !supported, "Not executing the command '{0}'", command);
            return supported;
        }
Пример #19
0
        /// <summary>
        /// Executes a command from the standard Visual Studio 97 command set.
        /// </summary>
        /// <param name="command">The command to execute.</param>
        /// <returns>true if the command is supported; otherwise, false.</returns>
        public override bool ExecuteStandard97Command(VsCommand command)
        {
            bool supported = true;

            switch (command)
            {
                case VsCommand.BuildCtx:
                case VsCommand.BuildSel:
                    this.Hierarchy.AttachedProject.StartBuild(BuildOperation.Build);
                    break;

                case VsCommand.RebuildCtx:
                case VsCommand.RebuildSel:
                    this.Hierarchy.AttachedProject.StartBuild(BuildOperation.Rebuild);
                    break;

                case VsCommand.CleanCtx:
                case VsCommand.CleanSel:
                    this.Hierarchy.AttachedProject.StartBuild(BuildOperation.Clean);
                    break;

                default:
                    supported = false;
                    break;
            }

            return supported;
        }