本文整理汇总了C#中IOleCommandTarget类的典型用法代码示例。如果您正苦于以下问题:C# IOleCommandTarget类的具体用法?C# IOleCommandTarget怎么用?C# IOleCommandTarget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IOleCommandTarget类属于命名空间,在下文中一共展示了IOleCommandTarget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCommandTarget
public IOleCommandTarget GetCommandTarget(IWpfTextView textView, IOleCommandTarget nextTarget)
{
var target = new ScriptingOleCommandTarget(textView, _commandHandlerServiceFactory, _editorAdaptersFactory, _serviceProvider);
target.RefreshCommandFilters();
target.NextCommandTarget = nextTarget;
return target;
}
示例2: VSCodeEditorWindow
public VSCodeEditorWindow(ServiceBroker sb, UserControl parent)
{
services = sb;
coreEditor = new VSCodeEditor(parent.Handle, services);
//Create window
IVsCodeWindow win = coreEditor.CodeWindow;
cmdTarget = win as IOleCommandTarget;
IVsTextView textView;
int hr = win.GetPrimaryView(out textView);
if (hr != VSConstants.S_OK)
Marshal.ThrowExceptionForHR(hr);
// assign the window handle
IntPtr commandHwnd = textView.GetWindowHandle();
AssignHandle(commandHwnd);
//Register priority command target
hr = services.VsRegisterPriorityCommandTarget.RegisterPriorityCommandTarget(
0, (IOleCommandTarget)this, out cmdTargetCookie);
if (hr != VSConstants.S_OK)
Marshal.ThrowExceptionForHR(hr);
//Add message filter
Application.AddMessageFilter((System.Windows.Forms.IMessageFilter)this);
}
示例3: IsJSLSInstalled
///<summary>Attempts to figure out whether the JSLS language service has been installed yet.</summary>
static bool IsJSLSInstalled(IOleCommandTarget next)
{
Guid cmdGroup = VSConstants.VSStd2K;
var cmds = new[] { new OLECMD { cmdID = (uint)VSConstants.VSStd2KCmdID.AUTOCOMPLETE } };
ErrorHandler.ThrowOnFailure(next.QueryStatus(ref cmdGroup, 1, cmds, IntPtr.Zero));
return cmds[0].cmdf == 3;
}
示例4: VsCommandTargetTest
public VsCommandTargetTest()
{
_textView = CreateTextView("");
_buffer = Vim.CreateVimBuffer(_textView);
_bufferCoordinator = new VimBufferCoordinator(_buffer);
_vim = _buffer.Vim;
_factory = new MockRepository(MockBehavior.Strict);
// By default Resharper isn't loaded
_resharperUtil = _factory.Create<IResharperUtil>();
_resharperUtil.SetupGet(x => x.IsInstalled).Returns(false);
_nextTarget = _factory.Create<IOleCommandTarget>(MockBehavior.Strict);
_vsAdapter = _factory.Create<IVsAdapter>();
_vsAdapter.SetupGet(x => x.KeyboardDevice).Returns(InputManager.Current.PrimaryKeyboardDevice);
_vsAdapter.Setup(x => x.InAutomationFunction).Returns(false);
_vsAdapter.Setup(x => x.InDebugMode).Returns(false);
_vsAdapter.Setup(x => x.IsIncrementalSearchActive(It.IsAny<ITextView>())).Returns(false);
_broker = _factory.Create<IDisplayWindowBroker>(MockBehavior.Loose);
var oldCommandFilter = _nextTarget.Object;
var vsTextView = _factory.Create<IVsTextView>(MockBehavior.Loose);
vsTextView.Setup(x => x.AddCommandFilter(It.IsAny<IOleCommandTarget>(), out oldCommandFilter)).Returns(0);
var result = VsCommandTarget.Create(
_bufferCoordinator,
vsTextView.Object,
_vsAdapter.Object,
_broker.Object,
_resharperUtil.Object,
KeyUtil);
Assert.True(result.IsSuccess);
_targetRaw = result.Value;
_target = _targetRaw;
}
示例5: WrapQueryStatus
public static int WrapQueryStatus(
IOleCommandTarget receiver,
IOleCommandTarget implementer,
ref System.Guid pguidCmdGroup,
uint cCmds,
OLECMD[] prgCmds,
System.IntPtr pCmdText) {
Debug.Assert(receiver != null);
var commandId = new CommandID(pguidCmdGroup, (int)prgCmds[0].cmdID);
if (LogCommand(commandId)) {
Logger.LogInfo("WrapQueryStatus: => recv={0}, impl={1}, parent={2}",
receiver,
GetImplementerString(implementer),
GetParentTargetString(implementer));
}
var hr = (implementer == null)
? (int)Constants.OLECMDERR_E_NOTSUPPORTED
: implementer.QueryStatus(ref pguidCmdGroup, cCmds, prgCmds, pCmdText);
if (LogCommand(commandId)) {
Logger.LogInfo("WrapQueryStatus: <= recv={0}, impl={1}, parent={2}, hr={3}, cmdf={4}",
receiver,
GetImplementerString(implementer),
GetParentTargetString(implementer),
HrToString(hr),
CmdFlagsToString(prgCmds));
}
return hr;
}
示例6: RebarController
public RebarController(QTTabBarClass tabbar, IntPtr hwndReBar, IOleCommandTarget bandObjectSite)
{
this.tabbar = tabbar;
this.bandObjectSite = bandObjectSite;
ExplorerHandle = PInvoke.GetAncestor(hwndReBar, 2);
Handle = hwndReBar;
rebarController = new NativeWindowController(hwndReBar);
rebarController.MessageCaptured += RebarMessageCaptured;
REBARBANDINFO structure = new REBARBANDINFO();
structure.cbSize = Marshal.SizeOf(structure);
structure.fMask = RBBIM.CHILD | RBBIM.ID;
int num = (int)PInvoke.SendMessage(Handle, RB.GETBANDCOUNT, IntPtr.Zero, IntPtr.Zero);
for(int i = 0; i < num; i++) {
PInvoke.SendMessage(Handle, RB.GETBANDINFO, (IntPtr)i, ref structure);
if(PInvoke.GetClassName(structure.hwndChild) == "ToolbarWindow32" && structure.wID == 1) {
menuController = new NativeWindowController(structure.hwndChild);
menuController.MessageCaptured += MenuMessageCaptured;
break;
}
}
if(Config.Skin.UseRebarBGColor) {
if(DefaultRebarCOLORREF == -1) {
DefaultRebarCOLORREF = (int)PInvoke.SendMessage(Handle, RB.GETBKCOLOR, IntPtr.Zero, IntPtr.Zero);
}
int num2 = QTUtility2.MakeCOLORREF(Config.Skin.RebarColor);
PInvoke.SendMessage(Handle, RB.SETBKCOLOR, IntPtr.Zero, (IntPtr)num2);
}
EnsureMenuBarIsCorrect();
}
示例7: GetCommandTarget
public IOleCommandTarget GetCommandTarget(IWpfTextView textView, IOleCommandTarget nextTarget) {
IOleCommandTarget target = ServiceManager.GetService<IOleCommandTarget>(textView);
if (target == null) {
ReplCommandController controller = ReplCommandController.Attach(textView, textView.TextBuffer);
// Wrap controller into OLE command target
target = VsAppShell.Current.TranslateToHostCommandTarget(textView, controller) as IOleCommandTarget;
Debug.Assert(target != null);
ServiceManager.AddService(target, textView);
// Wrap next OLE target in the chain into ICommandTarget so we can have
// chain like: OLE Target -> Shim -> ICommandTarget -> Shim -> Next OLE target
ICommandTarget nextCommandTarget = VsAppShell.Current.TranslateCommandTarget(textView, nextTarget);
controller.ChainedController = nextCommandTarget;
// We need to listed when R projected buffer is attached and
// create R editor document over it.
textView.BufferGraph.GraphBuffersChanged += OnGraphBuffersChanged;
IProjectionBuffer pb = textView.TextBuffer as IProjectionBuffer;
if (pb != null) {
pb.SourceBuffersChanged += OnSourceBuffersChanged;
}
textView.Closed += TextView_Closed;
}
return target;
}
示例8: CommandTargetHelper
public CommandTargetHelper(IOleCommandTarget commandTarget)
{
if (null == commandTarget)
{
throw new ArgumentNullException("commandTarget");
}
this.target = commandTarget;
}
示例9:
int IVsSmartTagData.GetContextMenuInfo(out Guid guidID, out int nMenuID, out IOleCommandTarget pCmdTarget)
{
guidID = MenuCmd.guidNemerleProjectCmdSet;
nMenuID = (int)MenuCmd.CmdId.SmartTagContextMenu;
pCmdTarget = this;
return VSConstants.S_OK;
}
示例10: IntelliSenseManager
public IntelliSenseManager(ICompletionBroker broker, SVsServiceProvider provider, IOleCommandTarget commandHandler, ITextView textView)
{
_broker = broker;
NextCommandHandler = commandHandler;
_textView = textView;
_isRepl = _textView.Properties.ContainsProperty(BufferProperties.FromRepl);
_serviceProvider = provider;
}
示例11: OleMenuCommandService
/// <include file='doc\OleMenuCommandService.uex' path='docs/doc[@for="OleMenuCommandService.OleMenuCommandService1"]/*' />
/// <devdoc>
/// Creates a new menu command service.
/// </devdoc>
public OleMenuCommandService(IServiceProvider serviceProvider, IOleCommandTarget parentCommandTarget)
: base(serviceProvider)
{
if (parentCommandTarget == null) {
throw new ArgumentNullException("parentCommandTarget");
}
_parentTarget = parentCommandTarget;
_provider = serviceProvider;
}
示例12: AddCommandTarget
public void AddCommandTarget(Ankh.UI.VSContainerForm form, IOleCommandTarget commandTarget)
{
VSCommandRouting routing = VSCommandRouting.FromForm(form);
if (routing != null)
routing.AddCommandTarget(commandTarget);
else
throw new InvalidOperationException("Command routing not initialized yet");
}
示例13:
ICommandTarget ICommandTargetFactory.CreateCommandTarget(IOleCommandTarget nextCommandTarget, IVimBufferCoordinator vimBufferCoordinator)
{
if (!_reSharperUtil.IsInstalled)
{
return null;
}
return ReSharperKeyUtil.GetOrCreate(vimBufferCoordinator);
}
示例14: TextViewWrapper
internal TextViewWrapper(IVsContainedLanguageHost languageHost, IVsIntellisenseHost intellisenseHost, IVsTextBufferCoordinator coordinator, IOleCommandTarget nextTarget)
{
if (null == intellisenseHost) {
throw new ArgumentNullException("buffer");
}
this.intellisenseHost = intellisenseHost;
this.bufferCoordinator = coordinator;
this.languageHost = languageHost;
this.nextTarget = nextTarget;
}
示例15: DialogContainerWithToolbar
/// <include file='doc\DialogContainerWithToolbar.uex' path='docs/doc[@for="DialogContainerWithToolbar.DialogContainerWithToolbar"]/*' />
/// <devdoc>
/// Constructor of the DialogContainerWithToolbar. This constructor allow the caller to set a IServiceProvider,
/// the conatined control and an additional IOleCommandTarget implementation that will be chained to the one
/// implemented by OleMenuCommandTarget.
/// </devdoc>
public DialogContainerWithToolbar(IServiceProvider sp, Control contained, IOleCommandTarget parentCommandTarget)
{
if (null == contained)
throw new ArgumentNullException("contained");
if (null == sp)
throw new ArgumentNullException("sp");
PrivateInit(sp, contained, parentCommandTarget);
}