本文整理汇总了C#中Plugin.AddFeature方法的典型用法代码示例。如果您正苦于以下问题:C# Plugin.AddFeature方法的具体用法?C# Plugin.AddFeature怎么用?C# Plugin.AddFeature使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugin
的用法示例。
在下文中一共展示了Plugin.AddFeature方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnConnection
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst_, ref Array custom)
{
if(null != m_plugin)
return;
// Load up the options from file.
string optionsFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "NiftyPerforce.xml");
Config options = Config.Load(optionsFileName);
// Every plugin needs a command bar.
m_plugin = new Plugin((DTE2)application, (AddIn)addInInst_, "NiftyPerforce", "Aurora.NiftyPerforce.Connect", options);
CommandBar commandBar = m_plugin.AddCommandBar("NiftyPerforce", MsoBarPosition.msoBarTop);
m_commandRegistry = new CommandRegistry(m_plugin, commandBar);
// Initialize the logging system.
if(Log.HandlerCount == 0)
{
#if DEBUG
Log.AddHandler(new DebugLogHandler());
#endif
Log.AddHandler(new VisualStudioLogHandler(m_plugin.OutputPane));
Log.Prefix = "NiftyPerforce";
}
// Now we can take care of registering ourselves and all our commands and hooks.
Log.Debug("Booting up...");
Log.IncIndent();
bool doContextCommands = true;
bool doBindings = options.EnableBindings;
m_commandRegistry.RegisterCommand("NiftyConfig", doBindings, new NiftyConfigure(m_plugin), true);
m_commandRegistry.RegisterCommand("NiftyEditModified", doBindings, new P4EditModified(m_plugin), true);
m_commandRegistry.RegisterCommand("NiftyEdit", doBindings, new P4EditItem(m_plugin), true);
if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyEditItem", doBindings, new P4EditItem(m_plugin), false);
if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyEditSolution", doBindings, new P4EditSolution(m_plugin), false);
m_commandRegistry.RegisterCommand("NiftyDiff", doBindings, new P4DiffItem(m_plugin));
if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyDiffItem", doBindings, new P4DiffItem(m_plugin), false);
if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyDiffSolution", doBindings, new P4DiffSolution(m_plugin), false);
m_commandRegistry.RegisterCommand("NiftyHistory", doBindings, new P4RevisionHistoryItem(m_plugin, false), true);
m_commandRegistry.RegisterCommand("NiftyHistoryMain", doBindings, new P4RevisionHistoryItem(m_plugin, true), true);
if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyHistoryItem", doBindings, new P4RevisionHistoryItem(m_plugin, false), false);
if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyHistoryItemMain", doBindings, new P4RevisionHistoryItem(m_plugin, true), false);
if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyHistorySolution", doBindings, new P4RevisionHistorySolution(m_plugin), false);
m_commandRegistry.RegisterCommand("NiftyTimeLapse", doBindings, new P4TimeLapseItem(m_plugin, false), true);
m_commandRegistry.RegisterCommand("NiftyTimeLapseMain", doBindings, new P4TimeLapseItem(m_plugin, true), true);
if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyTimeLapseItem", doBindings, new P4TimeLapseItem(m_plugin, false), false);
if (doContextCommands) m_commandRegistry.RegisterCommand("NiftyTimeLapseItemMain", doBindings, new P4TimeLapseItem(m_plugin, true), false);
m_commandRegistry.RegisterCommand("NiftyRevisionGraph", doBindings, new P4RevisionGraphItem(m_plugin, false), true);
m_commandRegistry.RegisterCommand("NiftyRevisionGraphMain", doBindings, new P4RevisionGraphItem(m_plugin, true), true);
if (doContextCommands) m_commandRegistry.RegisterCommand("NiftyRevisionGraphItem", doBindings, new P4RevisionGraphItem(m_plugin, false), false);
if (doContextCommands) m_commandRegistry.RegisterCommand("NiftyRevisionGraphItemMain", doBindings, new P4RevisionGraphItem(m_plugin, true), false);
m_commandRegistry.RegisterCommand("NiftyRevert", doBindings, new P4RevertItem(m_plugin), true);
if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyRevertItem", doBindings, new P4RevertItem(m_plugin), false);
m_commandRegistry.RegisterCommand("NiftyShow", doBindings, new P4ShowItem(m_plugin), true);
if(doContextCommands) m_commandRegistry.RegisterCommand("NiftyShowItem", doBindings, new P4ShowItem(m_plugin), false);
m_plugin.AddFeature(new AutoAddDelete(m_plugin));
m_plugin.AddFeature(new AutoCheckoutProject(m_plugin));
m_plugin.AddFeature(new AutoCheckoutOnBuild(m_plugin));
m_plugin.AddFeature(new AutoCheckoutTextEdit(m_plugin));
m_plugin.AddFeature(new AutoCheckoutOnSave(m_plugin));
#if DEBUG
// Use this to track down event GUIDs.
//m_plugin.AddFeature(new FindEvents(m_plugin));
#endif
P4Operations.CheckInstalledFiles();
AsyncProcess.Init();
Log.DecIndent();
Log.Debug("Initialized...");
#if DEBUG
Log.Info("NiftyPerforce (Debug)");
#else
//Log.Info("NiftyPerforce (Release)");
#endif
// Show where we are and when we were compiled...
Log.Info("I'm running {0} compiled on {1}", Assembly.GetExecutingAssembly().Location, System.IO.File.GetLastWriteTime(Assembly.GetExecutingAssembly().Location));
}