本文整理汇总了C#中_DTE类的典型用法代码示例。如果您正苦于以下问题:C# _DTE类的具体用法?C# _DTE怎么用?C# _DTE使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
_DTE类属于命名空间,在下文中一共展示了_DTE类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTarget
public object GetTarget(_DTE vs)
{
if ((vs.SelectedItems == null) || (vs.SelectedItems.Count <= 0))
{
throw new InvalidOperationException("invalid");
}
if (vs.SelectedItems.Count != 1)
{
return vs.SelectedItems;
}
SelectedItem item = vs.SelectedItems.Item(1);
if (item.Project != null)
{
return item.Project;
}
if (item.ProjectItem != null)
{
return item.ProjectItem;
}
if (vs.Solution.Properties.Item("Name").Value.Equals(item.Name))
{
return vs.Solution;
}
return item;
}
示例2: MovePageCodeToBackup
public static bool MovePageCodeToBackup(string id, string file, string name, string backupFolder, _DTE dte)
{
string csfileName = string.Format("{0}.cs", file);
string designerfileName = string.Format("{0}.designer.cs", file);
string aspxfileNameBackup = string.Format(@"{0}BTPage_{1}_{2}.aspx", backupFolder, id.Replace("-", "_"), name);
string csfileNameBackup = string.Format("{0}.cs", aspxfileNameBackup);
string designerfileNameBackup = string.Format("{0}.designer.cs", aspxfileNameBackup);
if (File.Exists(file))
{
if (File.Exists(aspxfileNameBackup))
File.Delete(aspxfileNameBackup);
if (File.Exists(csfileNameBackup))
File.Delete(csfileNameBackup);
if (File.Exists(designerfileNameBackup))
File.Delete(designerfileNameBackup);
dte.Solution.FindProjectItem(file).Remove();
File.Move(file, aspxfileNameBackup);
File.Move(csfileName, csfileNameBackup);
File.Move(designerfileName, designerfileNameBackup);
return true;
}
return false;
}
示例3: VsVimHost
internal VsVimHost(
IVsAdapter adapter,
ITextBufferFactoryService textBufferFactoryService,
ITextEditorFactoryService textEditorFactoryService,
ITextDocumentFactoryService textDocumentFactoryService,
ITextBufferUndoManagerProvider undoManagerProvider,
IVsEditorAdaptersFactoryService editorAdaptersFactoryService,
IEditorOperationsFactoryService editorOperationsFactoryService,
IWordUtilFactory wordUtilFactory,
ITextManager textManager,
ISharedServiceFactory sharedServiceFactory,
SVsServiceProvider serviceProvider)
: base(textBufferFactoryService, textEditorFactoryService, textDocumentFactoryService, editorOperationsFactoryService)
{
_vsAdapter = adapter;
_editorAdaptersFactoryService = editorAdaptersFactoryService;
_wordUtilFactory = wordUtilFactory;
_dte = (_DTE)serviceProvider.GetService(typeof(_DTE));
_vsExtensibility = (IVsExtensibility)serviceProvider.GetService(typeof(IVsExtensibility));
_textManager = textManager;
_sharedService = sharedServiceFactory.Create();
_vsMonitorSelection = serviceProvider.GetService<SVsShellMonitorSelection, IVsMonitorSelection>();
uint cookie;
_vsMonitorSelection.AdviseSelectionEvents(this, out cookie);
}
示例4: CheckOutFile
/// <summary>
/// Checks the out file.
/// </summary>
/// <param name="vs">The vs.</param>
/// <param name="filePath">The file path.</param>
public static void CheckOutFile(_DTE vs, string filePath)
{
Guard.ArgumentNotNullOrWhiteSpaceString(filePath, "filePath");
//Do nothing if no DTE instance
if (vs == null)
{
Trace.TraceWarning("TFSHelper.CheckOutFile: No DTE instance available to access TFS functions.");
return;
}
if (File.Exists(filePath))
{
if (vs.SourceControl.IsItemUnderSCC(filePath) &&
!vs.SourceControl.IsItemCheckedOut(filePath))
{
bool checkout = vs.SourceControl.CheckOutItem(filePath);
if (!checkout)
{
throw new CheckoutException(
string.Format(CultureInfo.CurrentCulture, Properties.Resources.CheckoutException, filePath));
}
}
else
{
// perform an extra check if the file is read only.
if (IsReadOnly(filePath))
{
ResetReadOnly(filePath);
}
}
}
}
示例5: VsVimHost
internal VsVimHost(
IVsAdapter adapter,
ITextBufferFactoryService textBufferFactoryService,
ITextEditorFactoryService textEditorFactoryService,
ITextDocumentFactoryService textDocumentFactoryService,
ITextBufferUndoManagerProvider undoManagerProvider,
IVsEditorAdaptersFactoryService editorAdaptersFactoryService,
IEditorOperationsFactoryService editorOperationsFactoryService,
ISmartIndentationService smartIndentationService,
ITextManager textManager,
ISharedServiceFactory sharedServiceFactory,
IVimApplicationSettings vimApplicationSettings,
SVsServiceProvider serviceProvider)
: base(textBufferFactoryService, textEditorFactoryService, textDocumentFactoryService, editorOperationsFactoryService)
{
_vsAdapter = adapter;
_editorAdaptersFactoryService = editorAdaptersFactoryService;
_dte = (_DTE)serviceProvider.GetService(typeof(_DTE));
_vsExtensibility = (IVsExtensibility)serviceProvider.GetService(typeof(IVsExtensibility));
_textManager = textManager;
_sharedService = sharedServiceFactory.Create();
_vsMonitorSelection = serviceProvider.GetService<SVsShellMonitorSelection, IVsMonitorSelection>();
_fontProperties = new TextEditorFontProperties(serviceProvider);
_vimApplicationSettings = vimApplicationSettings;
_smartIndentationService = smartIndentationService;
uint cookie;
_vsMonitorSelection.AdviseSelectionEvents(this, out cookie);
}
示例6: SettingsMigrator
internal SettingsMigrator(SVsServiceProvider serviceProvider, IVimApplicationSettings vimApplicationSettings, ILegacySettings legacySettings, [EditorUtilsImport] IProtectedOperations protectedOperations)
{
_dte = serviceProvider.GetService<SDTE, _DTE>();
_vimApplicationSettings = vimApplicationSettings;
_legacySettings = legacySettings;
_protectedOperations = protectedOperations;
}
示例7: CommandFilter
public CommandFilter(IWpfTextView textView, IVsEditorAdaptersFactoryService factoryService, _DTE dt)
{
this.textView = textView;
this.factoryService = factoryService;
dte = dt;
textView.GotAggregateFocus += textView_GotAggregateFocus;
}
示例8: CheckoutFileIfRequired
private static void CheckoutFileIfRequired(_DTE dte, String fileName)
{
_checkOutAction = (String fn) => dte.SourceControl.CheckOutItem(fn);
var sc = dte.SourceControl;
if (sc != null && sc.IsItemUnderSCC(fileName) && !sc.IsItemCheckedOut(fileName))
_checkOutAction.EndInvoke(_checkOutAction.BeginInvoke(fileName, null, null));
}
示例9: KeyBindingService
internal KeyBindingService(SVsServiceProvider serviceProvider, IOptionsDialogService service, [EditorUtilsImport] IProtectedOperations protectedOperations, IVimApplicationSettings vimApplicationSettings)
{
_dte = serviceProvider.GetService<SDTE, _DTE>();
_vsShell = serviceProvider.GetService<SVsShell, IVsShell>();
_optionsDialogService = service;
_protectedOperations = protectedOperations;
_vimApplicationSettings = vimApplicationSettings;
_importantScopeSet = new Lazy<HashSet<string>>(CreateImportantScopeSet);
}
示例10: BackspaceDeleteKeyFilter
public BackspaceDeleteKeyFilter(_DTE app, IWpfTextView textView)
: base(textView)
{
var events = (Events2) app.Events;
// ReSharper disable RedundantArgumentDefaultValue
_keyPressEvents = events.TextDocumentKeyPressEvents[null];
// ReSharper restore RedundantArgumentDefaultValue
_keyPressEvents.BeforeKeyPress += BeforeKeyPress;
}
示例11: KeyBindingService
internal KeyBindingService(SVsServiceProvider serviceProvider, IOptionsDialogService service, IProtectedOperations protectedOperations, ILegacySettings legacySettings)
{
_dte = serviceProvider.GetService<SDTE, _DTE>();
_vsShell = serviceProvider.GetService<SVsShell, IVsShell>();
_optionsDialogService = service;
_protectedOperations = protectedOperations;
_legacySettings = legacySettings;
_importantScopeSet = new Lazy<HashSet<string>>(CreateImportantScopeSet);
}
示例12: Configuration
public Configuration(_DTE application, WizardRunKind kind, Dictionary<string, string> replacements)
{
Application = application;
Kind = kind;
Replacements = replacements;
DefineSolutionName();
DefineSolutionRoot();
}
示例13: VsVimHost
internal VsVimHost(
ITextBufferUndoManagerProvider undoManagerProvider,
IVsEditorAdaptersFactoryService editorAdaptersFactoryService,
SVsServiceProvider serviceProvider)
{
_undoManagerProvider = undoManagerProvider;
_editorAdaptersFactoryService = editorAdaptersFactoryService;
_dte = (_DTE)serviceProvider.GetService(typeof(_DTE));
_textManager = (IVsTextManager)serviceProvider.GetService(typeof(SVsTextManager));
}
示例14: FallbackKeyProcessorProvider
internal FallbackKeyProcessorProvider(SVsServiceProvider serviceProvider, IKeyUtil keyUtil, IVimApplicationSettings vimApplicationSettings, IVim vim)
{
_dte = (_DTE)serviceProvider.GetService(typeof(_DTE));
_keyUtil = keyUtil;
_vimApplicationSettings = vimApplicationSettings;
_vim = vim;
var vsShell = (IVsShell)serviceProvider.GetService(typeof(SVsShell));
_scopeData = new ScopeData(vsShell);
}
示例15: InitialCleanup
internal InitialCleanup(ITextDocument textDocument, _DTE ide, FileConfiguration settings)
{
_doc = ide.Documents.OfType<Document>()
.FirstOrDefault(x => x.FullName == textDocument.FilePath);
if (_doc != null)
_textDoc = (TextDocument) _doc.Object("TextDocument");
_ide = ide;
_settings = settings;
_eol = settings.EndOfLine();
}