protected override void CommandBeforeQueryStatus(EnvDTE80.DTE2 applicationObject, OleMenuCommand menuCommand) { CommonHandlers.ActionBeforeQueryStatusActiveDocumentIsXml(applicationObject, menuCommand, out var doc); if (doc == null) { menuCommand.Enabled = menuCommand.Visible = false; return; } string docRootName = doc.Name.ToString(); var schemas = AbstractDynamicCommandXsdSchemas.GetSchemaByRootName(docRootName); if (!string.IsNullOrEmpty(schemas)) { menuCommand.Text = string.Format(Properties.CommandNames.CodeXmlCommonXsdSchemaSetProperCommandFormat1, schemas); } else { menuCommand.Enabled = menuCommand.Visible = false; } }
protected override void CommandBeforeQueryStatus(EnvDTE80.DTE2 applicationObject, OleMenuCommand menuCommand) { CommonHandlers.ActionBeforeQueryStatusActiveDocumentIsXml(applicationObject, menuCommand, out var doc); if (doc == null) { menuCommand.Enabled = menuCommand.Visible = false; return; } string docRootName = doc.Name.ToString(); if (string.Equals(docRootName, AbstractDynamicCommandXsdSchemas.SiteMapXmlRoot, StringComparison.InvariantCultureIgnoreCase)) { string nameCommand = Properties.CommandNames.CodeXmlSiteMapUpdateCommand; var attribute = doc.Attribute(Intellisense.Model.IntellisenseContext.IntellisenseContextAttributeSiteMapNameUnique); if (attribute != null && !string.IsNullOrEmpty(attribute.Value)) { nameCommand = string.Format(Properties.CommandNames.CodeXmlSiteMapUpdateByNameCommandFormat1, attribute.Value); } CommonHandlers.CorrectCommandNameForConnectionName(applicationObject, menuCommand, nameCommand); } else if (string.Equals(docRootName, AbstractDynamicCommandXsdSchemas.RibbonDiffXmlRoot, StringComparison.InvariantCultureIgnoreCase)) { var attribute = doc.Attribute(Intellisense.Model.IntellisenseContext.IntellisenseContextAttributeEntityName); if (attribute != null) { string entityName = attribute.Value; string nameCommand = Properties.CommandNames.CodeXmlRibbonDiffXmlApplicationUpdateCommand; if (!string.IsNullOrEmpty(entityName)) { nameCommand = string.Format(Properties.CommandNames.CodeXmlRibbonDiffXmlEntityUpdateCommandFormat1, entityName); } CommonHandlers.ActionBeforeQueryStatusConnectionIsNotReadOnly(applicationObject, menuCommand); CommonHandlers.CorrectCommandNameForConnectionName(applicationObject, menuCommand, nameCommand); } } else if (string.Equals(docRootName, AbstractDynamicCommandXsdSchemas.FetchRoot, StringComparison.InvariantCultureIgnoreCase) || string.Equals(docRootName, AbstractDynamicCommandXsdSchemas.GridRoot, StringComparison.InvariantCultureIgnoreCase) || string.Equals(docRootName, AbstractDynamicCommandXsdSchemas.ColumnSetRoot, StringComparison.InvariantCultureIgnoreCase) ) { var attribute = doc.Attribute(Intellisense.Model.IntellisenseContext.IntellisenseContextAttributeSavedQueryId); CommonHandlers.CorrectCommandNameForConnectionName(applicationObject, menuCommand, Properties.CommandNames.CodeXmlSavedQueryUpdateCommand); if (attribute == null || !Guid.TryParse(attribute.Value, out _)) { menuCommand.Enabled = menuCommand.Visible = false; } } else if (string.Equals(docRootName, AbstractDynamicCommandXsdSchemas.FormXmlRoot, StringComparison.InvariantCultureIgnoreCase)) { var attribute = doc.Attribute(Intellisense.Model.IntellisenseContext.IntellisenseContextAttributeFormId); CommonHandlers.CorrectCommandNameForConnectionName(applicationObject, menuCommand, Properties.CommandNames.CodeXmlSystemFormUpdateCommand); if (attribute == null || !Guid.TryParse(attribute.Value, out _)) { menuCommand.Enabled = menuCommand.Visible = false; } } else if (doc.Name == AbstractDynamicCommandXsdSchemas.WorkflowActivityRoot) { var attribute = doc.Attribute(Intellisense.Model.IntellisenseContext.IntellisenseContextAttributeWorkflowId); CommonHandlers.CorrectCommandNameForConnectionName(applicationObject, menuCommand, Properties.CommandNames.CodeXmlWorkflowUpdateCommand); if (attribute == null || !Guid.TryParse(attribute.Value, out _)) { menuCommand.Enabled = menuCommand.Visible = false; } } else if (string.Equals(docRootName, AbstractDynamicCommandXsdSchemas.WebResourceDependencyXmlRoot, StringComparison.InvariantCultureIgnoreCase)) { var attribute = doc.Attribute(Intellisense.Model.IntellisenseContext.IntellisenseContextAttributeWebResourceName); CommonHandlers.CorrectCommandNameForConnectionName(applicationObject, menuCommand, Properties.CommandNames.CodeXmlWebResourceDependencyXmlUpdateCommand); if (attribute == null || string.IsNullOrEmpty(attribute.Value)) { menuCommand.Enabled = menuCommand.Visible = false; } } else { menuCommand.Enabled = menuCommand.Visible = false; } //else if (string.Equals(docRootName, AbstractDynamicCommandXsdSchemas.RootSiteMap, StringComparison.InvariantCultureIgnoreCase)) //{ //} //else if (string.Equals(docRootName, AbstractDynamicCommandXsdSchemas.RootSiteMap, StringComparison.InvariantCultureIgnoreCase)) //{ //} //else if (string.Equals(docRootName, AbstractDynamicCommandXsdSchemas.RootSiteMap, StringComparison.InvariantCultureIgnoreCase)) //{ //} }