本文整理汇总了C#中IContentType类的典型用法代码示例。如果您正苦于以下问题:C# IContentType类的具体用法?C# IContentType怎么用?C# IContentType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IContentType类属于命名空间,在下文中一共展示了IContentType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateReplWindow
public IReplWindow CreateReplWindow(IContentType contentType, string/*!*/ title, Guid languageServiceGuid, string replId)
{
int curId = 0;
ReplWindow window;
do {
curId++;
window = FindReplWindowInternal(curId);
} while (window != null);
foreach (var provider in _evaluators) {
var evaluator = provider.GetEvaluator(replId);
if (evaluator != null) {
string[] roles = provider.GetType().GetCustomAttributes(typeof(ReplRoleAttribute), true).Select(r => ((ReplRoleAttribute)r).Name).ToArray();
window = CreateReplWindowInternal(evaluator, contentType, roles, curId, title, languageServiceGuid, replId);
if ((null == window) || (null == window.Frame)) {
throw new NotSupportedException(Resources.CanNotCreateWindow);
}
return window;
}
}
throw new InvalidOperationException(String.Format("ReplId {0} was not provided by an IReplWindowProvider", replId));
}
示例2: CreateVsTextBufferAdapter
public IVsTextBuffer CreateVsTextBufferAdapter(OLE.Interop.IServiceProvider serviceProvider, IContentType contentType)
{
VsTextBufferMock tb = new VsTextBufferMock(contentType);
_textBufferAdapters[tb.TextBuffer] = tb;
_vsTextBufferAdapters[tb] = tb.TextBuffer;
return tb;
}
示例3: JadeClassifierProvider
public JadeClassifierProvider(IClassificationTypeRegistryService registryService,
ITextBufferFactoryService bufferFact,
IContentTypeRegistryService contentTypeService,
[ImportMany(typeof(ITaggerProvider))]Lazy<ITaggerProvider, TaggerProviderMetadata>[] taggerProviders,
[ImportMany(typeof(IClassifierProvider))]Lazy<IClassifierProvider, IClassifierProviderMetadata>[] classifierProviders) {
ClassificationRegistryService = registryService;
BufferFactoryService = bufferFact;
JsContentType = contentTypeService.GetContentType(NodejsConstants.JavaScript);
CssContentType = contentTypeService.GetContentType(NodejsConstants.CSS);
var jsTagger = taggerProviders.Where(
provider =>
provider.Metadata.ContentTypes.Contains(NodejsConstants.JavaScript) &&
provider.Metadata.TagTypes.Any(tagType => tagType.IsSubclassOf(typeof(ClassificationTag)))
).FirstOrDefault();
if (JsTaggerProvider != null) {
JsTaggerProvider = jsTagger.Value;
}
var cssTagger = classifierProviders.Where(
provider => provider.Metadata.ContentTypes.Any(x => x.Equals("css", StringComparison.OrdinalIgnoreCase))
).FirstOrDefault();
if (cssTagger != null) {
CssClassifierProvider = cssTagger.Value;
}
}
示例4: ExecuteAppCommand
private int ExecuteAppCommand(ref Guid pguidCmdGroup, uint commandId, uint executeInformation, IntPtr pvaIn, IntPtr pvaOut, ITextBuffer subjectBuffer, IContentType contentType)
{
int result = VSConstants.S_OK;
var guidCmdGroup = pguidCmdGroup;
Action executeNextCommandTarget = () =>
{
result = NextCommandTarget.Exec(ref guidCmdGroup, commandId, executeInformation, pvaIn, pvaOut);
};
switch ((VSConstants.AppCommandCmdID)commandId)
{
case VSConstants.AppCommandCmdID.BrowserBackward:
ExecuteBrowserBackward(subjectBuffer, contentType, executeNextCommandTarget);
break;
case VSConstants.AppCommandCmdID.BrowserForward:
ExecuteBrowserForward(subjectBuffer, contentType, executeNextCommandTarget);
break;
default:
return NextCommandTarget.Exec(ref pguidCmdGroup, commandId, executeInformation, pvaIn, pvaOut);
}
return result;
}
示例5: InteractiveEvaluator
internal InteractiveEvaluator(
IContentType contentType,
HostServices hostServices,
IViewClassifierAggregatorService classifierAggregator,
IInteractiveWindowCommandsFactory commandsFactory,
ImmutableArray<IInteractiveWindowCommand> commands,
string responseFilePath,
string initialWorkingDirectory,
string interactiveHostPath,
Type replType)
{
Debug.Assert(responseFilePath == null || PathUtilities.IsAbsolute(responseFilePath));
_contentType = contentType;
_responseFilePath = responseFilePath;
_workspace = new InteractiveWorkspace(this, hostServices);
_contentTypeChangedHandler = new EventHandler<ContentTypeChangedEventArgs>(LanguageBufferContentTypeChanged);
_classifierAggregator = classifierAggregator;
_initialWorkingDirectory = initialWorkingDirectory;
_commandsFactory = commandsFactory;
_commands = commands;
var hostPath = interactiveHostPath;
_interactiveHost = new InteractiveHost(replType, hostPath, initialWorkingDirectory);
_interactiveHost.ProcessStarting += ProcessStarting;
}
示例6: GetContentType
public static IContentType GetContentType(this IContentTypeRegistryService contentTypeRegistryService, IContentType contentType, string contentTypeString) {
if (contentType != null)
return contentType;
if (contentTypeString != null)
return contentTypeRegistryService.GetContentType(contentTypeString);
return null;
}
示例7: SetLanguage
public static void SetLanguage(this IInteractiveWindow window, Guid languageServiceGuid, IContentType contentType)
{
VsInteractiveWindowEditorFactoryService.GetDispatcher(window).CheckAccess();
var commandFilter = VsInteractiveWindowEditorFactoryService.GetCommandFilter(window);
window.Properties[typeof(IContentType)] = contentType;
commandFilter.firstLanguageServiceCommandFilter = null;
var provider = commandFilter._oleCommandTargetProviders.OfContentType(contentType, commandFilter._contentTypeRegistry);
if (provider != null)
{
var targetFilter = commandFilter.firstLanguageServiceCommandFilter ?? commandFilter.EditorServicesCommandFilter;
var target = provider.GetCommandTarget(window.TextView, targetFilter);
if (target != null)
{
commandFilter.firstLanguageServiceCommandFilter = target;
}
}
if (window.CurrentLanguageBuffer != null)
{
window.CurrentLanguageBuffer.ChangeContentType(contentType, null);
}
VsInteractiveWindowEditorFactoryService.SetEditorOptions(window.TextView.Options, languageServiceGuid);
}
示例8: Initialize
private void Initialize(string targetFileContents, string mapFileContents, string directory, IContentType contentType)
{
_contentType = contentType;
_parser = CssParserLocator.FindComponent(_contentType).CreateParser();
_directory = directory;
PopulateMap(targetFileContents, mapFileContents); // Begin two-steps initialization.
}
示例9: InteractiveEvaluator
internal InteractiveEvaluator(
IContentType contentType,
HostServices hostServices,
IViewClassifierAggregatorService classifierAggregator,
IInteractiveWindowCommandsFactory commandsFactory,
ImmutableArray<IInteractiveWindowCommand> commands,
string responseFilePath,
string initialWorkingDirectory,
string interactiveHostPath,
Type replType)
{
Debug.Assert(responseFilePath == null || PathUtilities.IsAbsolute(responseFilePath));
_contentType = contentType;
_responseFilePath = responseFilePath;
_workspace = new InteractiveWorkspace(this, hostServices);
_contentTypeChangedHandler = new EventHandler<ContentTypeChangedEventArgs>(LanguageBufferContentTypeChanged);
_classifierAggregator = classifierAggregator;
_initialWorkingDirectory = initialWorkingDirectory;
_commandsFactory = commandsFactory;
_commands = commands;
// The following settings will apply when the REPL starts without .rsp file.
// They are discarded once the REPL is reset.
ReferenceSearchPaths = ImmutableArray<string>.Empty;
SourceSearchPaths = ImmutableArray<string>.Empty;
WorkingDirectory = initialWorkingDirectory;
var metadataService = _workspace.CurrentSolution.Services.MetadataService;
_metadataReferenceResolver = CreateMetadataReferenceResolver(metadataService, ReferenceSearchPaths, _initialWorkingDirectory);
_sourceReferenceResolver = CreateSourceReferenceResolver(SourceSearchPaths, _initialWorkingDirectory);
_interactiveHost = new InteractiveHost(replType, interactiveHostPath, initialWorkingDirectory);
_interactiveHost.ProcessStarting += ProcessStarting;
}
示例10: MapComposition
private static void MapComposition(IContentType umbracoContentType, ContentType type)
{
type.Composition = umbracoContentType.ContentTypeComposition
.Where(cmp => cmp.Id != umbracoContentType.ParentId)
.Select(MapContentTypeBase)
.ToList();
}
示例11: Content
/// <summary>
/// Constructor for creating a Content object
/// </summary>
/// <param name="name">Name of the content</param>
/// <param name="parentId">Id of the Parent content</param>
/// <param name="contentType">ContentType for the current Content object</param>
/// <param name="properties">Collection of properties</param>
public Content(string name, int parentId, IContentType contentType, PropertyCollection properties)
: base(name, parentId, contentType, properties)
{
Mandate.ParameterNotNull(contentType, "contentType");
_contentType = contentType;
}
示例12: CreateInteractiveWindow
public IVsInteractiveWindow CreateInteractiveWindow(
IContentType contentType,
string/*!*/ title,
Guid languageServiceGuid,
string replId
) {
int curId = 0;
InteractiveWindowInfo window;
do {
curId++;
window = FindReplWindowInternal(curId);
} while (window != null);
foreach (var provider in _evaluators) {
var evaluator = provider.GetEvaluator(replId);
if (evaluator != null) {
string[] roles = evaluator.GetType().GetCustomAttributes(typeof(InteractiveWindowRoleAttribute), true)
.OfType<InteractiveWindowRoleAttribute>()
.Select(r => r.Name)
.ToArray();
window = CreateInteractiveWindowInternal(evaluator, contentType, roles, curId, title, languageServiceGuid, replId);
return window.Window;
}
}
throw new InvalidOperationException(String.Format("ReplId {0} was not provided by an IInteractiveWindowProvider", replId));
}
示例13: CreateAllTypesContent
public static Content CreateAllTypesContent(IContentType contentType, string name, int parentId)
{
var content = new Content("Random Content Name", parentId, contentType) { Language = "en-US", Level = 1, SortOrder = 1, CreatorId = 0, WriterId = 0 };
content.SetValue("isTrue", true);
content.SetValue("number", 42);
content.SetValue("bodyText", "Lorem Ipsum Body Text Test");
content.SetValue("singleLineText", "Single Line Text Test");
content.SetValue("multilineText", "Multiple lines \n in one box");
content.SetValue("upload", "/media/1234/koala.jpg");
content.SetValue("label", "Non-editable label");
content.SetValue("dateTime", DateTime.Now.AddDays(-20));
content.SetValue("colorPicker", "black");
content.SetValue("folderBrowser", "");
content.SetValue("ddlMultiple", "1234,1235");
content.SetValue("rbList", "random");
content.SetValue("date", DateTime.Now.AddDays(-10));
content.SetValue("ddl", "1234");
content.SetValue("chklist", "randomc");
content.SetValue("contentPicker", 1090);
content.SetValue("mediaPicker", 1091);
content.SetValue("memberPicker", 1092);
content.SetValue("simpleEditor", "This is simply edited");
content.SetValue("ultimatePicker", "1234,1235");
content.SetValue("relatedLinks", "<links><link title=\"google\" link=\"http://google.com\" type=\"external\" newwindow=\"0\" /></links>");
content.SetValue("tags", "this,is,tags");
content.SetValue("macroContainer", "");
content.SetValue("imgCropper", "");
return content;
}
示例14: CompareAllowedTemplates
private static bool CompareAllowedTemplates(IContentType contentType, DocumentTypeAttribute docTypeAttr, Type typeDocType)
{
List<ITemplate> allowedTemplates = DocumentTypeManager.GetAllowedTemplates(docTypeAttr, typeDocType);
IEnumerable<ITemplate> existingTemplates = contentType.AllowedTemplates;
if (allowedTemplates.Count != existingTemplates.Count())
{
return false;
}
foreach (Template template in allowedTemplates)
{
if (!existingTemplates.Any(t => t.Alias == template.Alias))
{
return false;
}
}
ITemplate defaultTemplate = DocumentTypeManager.GetDefaultTemplate(docTypeAttr, typeDocType, allowedTemplates);
if (defaultTemplate != null)
{
return (contentType.DefaultTemplate.Id == defaultTemplate.Id);
}
if (allowedTemplates.Count == 1)
{
return (contentType.DefaultTemplate.Id == allowedTemplates.First().Id);
}
return true;
}
示例15: EditorTextFactoryService
public EditorTextFactoryService(
ITextBufferFactoryService textBufferFactoryService,
IContentTypeRegistryService contentTypeRegistryService)
{
_textBufferFactory = textBufferFactoryService;
_unknownContentType = contentTypeRegistryService.UnknownContentType;
}