本文整理汇总了C#中MonoDevelop.Components.Commands.CommandInfo类的典型用法代码示例。如果您正苦于以下问题:C# CommandInfo类的具体用法?C# CommandInfo怎么用?C# CommandInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommandInfo类属于MonoDevelop.Components.Commands命名空间,在下文中一共展示了CommandInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CommandUpdate
/// <summary>
/// Updates the text and visibility of each command with this attribute.
/// </summary>
/// <param name="target">Target node handler.</param>
/// <param name="cinfo">Command info.</param>
protected override void CommandUpdate(object target, CommandInfo cinfo)
{
if (cinfo != null)
{
cinfo.Visible = true;
StyleCopNodeCommandHandler.CancelStypeCopRun = false;
base.CommandUpdate(target, cinfo);
if (IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted)
{
// Set the default StyleCop run text.
if (string.IsNullOrEmpty(cinfo.Text))
{
cinfo.Text = StaticStringResources.StyleCopRunText;
}
}
else
{
if (IdeApp.ProjectOperations.IsStyleCopRunning())
{
cinfo.Text = StaticStringResources.StyleCopCancelText;
StyleCopNodeCommandHandler.CancelStypeCopRun = true;
}
}
}
}
示例2: Update
protected override void Update (CommandInfo info)
{
if (IdeApp.Workspace.IsOpen)
info.Enabled = IdeApp.ProjectOperations.CurrentSelectedSolution != null && IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted;
else
info.Enabled = (IdeApp.Workbench.ActiveDocument != null && IdeApp.Workbench.ActiveDocument.IsBuildTarget);
}
示例3: RenameCommand_Update
public void RenameCommand_Update(CommandInfo ci)
{
var doc = IdeApp.Workbench.ActiveDocument;
if (doc == null)
return;
var editor = doc.GetContent<ITextBuffer>();
if (editor == null)
return;
var dom = doc.Dom;
ResolveResult result;
INode item;
CurrentRefactoryOperationsHandler.GetItem(dom, doc, editor, out result, out item);
var options = new RefactoringOptions()
{
Document = doc,
Dom = dom,
ResolveResult = result,
SelectedItem = item is InstantiatedType ? ((InstantiatedType)item).UninstantiatedType : item
};
// If not a valid operation, allow command to be handled by others
if (!new RenameRefactoring().IsValid(options))
ci.Bypass = true;
}
示例4: Update
protected override void Update (CommandInfo info)
{
MonoDevelop.Core.LoggingService.LogError ("*********UPDATE");
info.Enabled = true;
//MonoDevelop.Ide.Gui.Document doc = MonoDevelop.Ide.IdeApp.Workbench.ActiveDocument;
//info.Enabled = doc != null && doc.GetContent<MonoDevelop.Ide.Gui.Content.IEditableTextBuffer> () != null;
}
示例5: Update
protected override void Update (CommandInfo info)
{
MonoDevelop.Ide.Gui.Document document;
IList<FixableResult> results;
info.Enabled = FixOperationsHandler.GetFixes (out document, out results)
&& results.Any (r => FixOperationsHandler.GetActions (document, r).Any ());
}
示例6: Update
void Update (CommandInfo cmdInfo)
{
updating = true;
if (Active != cmdInfo.Checked)
Active = cmdInfo.Checked;
updating = false;
//same as CommandToolButton
//only update each if changed, else we grab focus from tooltips during the command scane
if (lastDesc != cmdInfo.Description) {
string toolTip;
if (string.IsNullOrEmpty (cmdInfo.AccelKey)) {
toolTip = cmdInfo.Description;
} else {
toolTip = cmdInfo.Description + " (" + KeyBindingManager.BindingToDisplayLabel (cmdInfo.AccelKey, false) + ")";
}
TooltipText = toolTip;
lastDesc = cmdInfo.Description;
}
if (Label != cmdInfo.Text)
Label = cmdInfo.Text;
if (cmdInfo.Icon != stockId) {
stockId = cmdInfo.Icon;
this.IconWidget = new Gtk.Image (cmdInfo.Icon, Gtk.IconSize.Menu);
}
if (cmdInfo.Enabled != Sensitive)
Sensitive = cmdInfo.Enabled;
if (cmdInfo.Visible != Visible)
Visible = cmdInfo.Visible;
if (cmdInfo.Icon.IsNull)
IsImportant = true;
}
示例7: Update
protected override void Update(CommandInfo info)
{
try
{
/* Pregunta si algun projecto se encuentra abierto para habilitar la opcion */
if(IdeApp.Workspace.IsOpen)
{
/* Obtiene el proyecto actualmente seleccionado */
//MonoDevelop.Projects.Project startupProject = (MonoDevelop.Projects.Project)IdeApp.Workspace.GetAllSolutions()[0].StartupItem;
MonoDevelop.Projects.Project currentProject = IdeApp.ProjectOperations.CurrentSelectedProject;
/* Si el tipo de proyecto es un proyecto web, habilitamos la opcion en el menu Project */
if(currentProject != null && currentProject.ProjectType == "AspNetApp")
info.Enabled = true;
else
info.Enabled = false;
}
else
info.Enabled = false;
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
示例8:
void ICommandMenuItem.SetUpdateInfo (CommandInfo cmdInfo, object initialTarget)
{
isArrayItem = true;
arrayDataItem = cmdInfo.DataItem;
this.initialTarget = initialTarget;
Update (cmdInfo);
}
示例9: CommandResult
public CommandResult(Command cmd, CommandInfo ci, CommandTargetRoute route, string match, string matchedString, int rank)
: base(match, matchedString, rank)
{
this.ci = ci;
command = cmd;
this.route = route;
}
示例10: Update
protected override void Update (CommandInfo info)
{
info.Enabled = IdeApp.Workbench.ActiveDocument != null &&
IdeApp.Workbench.ActiveDocument.Editor != null &&
IdeApp.Workbench.ActiveDocument.Editor.Document.MimeType == "text/x-csharp";
base.Update (info);
}
示例11: Update
void Update (CommandInfo cmdInfo)
{
if (lastDesc != cmdInfo.Description) {
string toolTip;
if (string.IsNullOrEmpty (cmdInfo.AccelKey)) {
toolTip = cmdInfo.Description;
} else {
toolTip = cmdInfo.Description + " (" + KeyBindingManager.BindingToDisplayLabel (cmdInfo.AccelKey, false) + ")";
}
TooltipText = toolTip;
lastDesc = cmdInfo.Description;
}
if (Label != cmdInfo.Text)
Label = cmdInfo.Text;
if (cmdInfo.Icon != stockId) {
stockId = cmdInfo.Icon;
this.IconWidget = new Gtk.Image (cmdInfo.Icon, Gtk.IconSize.Menu);
}
if (cmdInfo.Enabled != Sensitive)
Sensitive = cmdInfo.Enabled;
if (cmdInfo.Visible != Visible)
Visible = cmdInfo.Visible;
if (cmdInfo.Icon.IsNull)
IsImportant = true;
}
示例12: OnUpdateExclude
public void OnUpdateExclude (CommandInfo cinfo)
{
bool anyChecked = false;
bool allChecked = true;
bool anyEnabled = false;
bool allEnabled = true;
foreach (ITreeNavigator node in CurrentNodes) {
ProjectFile file = (ProjectFile) node.DataItem;
if (file.Project != null) {
MakefileData data = file.Project.ExtendedProperties [infoProperty] as MakefileData;
if (data != null && data.IsFileIntegrationEnabled (file.BuildAction)) {
anyEnabled = true;
if (!data.IsFileExcluded (file.FilePath)) {
anyChecked = true;
} else {
allChecked = false;
}
} else {
allEnabled = false;
}
}
}
cinfo.Visible = anyEnabled;
cinfo.Enabled = anyEnabled && allEnabled;
cinfo.Checked = anyChecked;
cinfo.CheckedInconsistent = anyChecked && !allChecked;
}
示例13: Update
protected override void Update (CommandInfo info)
{
//if no open window or only one
if (IdeApp.Workbench.Documents.Count < 2) {
info.Enabled = false;
}
}
示例14: Update
protected override void Update(CommandInfo info)
{
//info.Enabled = IsSupportedFile;
info.Text = _presenter.IsConnected ? "Disconnect" : "Connect";
Console.WriteLine (info.Command.Id);
}
示例15: Insert
public void Insert (int index, CommandInfo info, object dataItem)
{
info.DataItem = dataItem;
if (info.Text == null) info.Text = defaultInfo.Text;
if (info.Icon.IsNull) info.Icon = defaultInfo.Icon;
list.Insert (index, info);
}