org.eclipse.core.runtime.Platform.getContentTypeManager()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(136)

本文整理了Java中org.eclipse.core.runtime.Platform.getContentTypeManager()方法的一些代码示例,展示了Platform.getContentTypeManager()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Platform.getContentTypeManager()方法的具体详情如下:
包路径:org.eclipse.core.runtime.Platform
类名称:Platform
方法名:getContentTypeManager

Platform.getContentTypeManager介绍

[英]Returns the content type manager.

Clients are also able to acquire the IContentTypeManager service.
[中]返回内容类型管理器。
客户还可以获得IContentTypeManager服务。

代码示例

代码示例来源:origin: org.eclipse.platform/org.eclipse.core.resources

public void shutdown() {
  IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
  //if the service is already gone there is nothing to do
  if (contentTypeManager != null)
    contentTypeManager.removeContentTypeChangeListener(this);
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.jsp.core

/**
 * Returns JSP fragment content type
 * 
 * @return jspf content type
 */
private IContentType getJSPFContentType() {
  if (fJSPFContentType == null) {
    fJSPFContentType = Platform.getContentTypeManager().getContentType(ContentTypeIdForJSP.ContentTypeID_JSPFRAGMENT);
  }
  return fJSPFContentType;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.team.core

private IContentType getTextContentType() {
  if (textContentType == null)
    textContentType = Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT);
  return textContentType;
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.xml.ui

/**
 * Get content type associated with this new file wizard
 * 
 * @return IContentType
 */
protected IContentType getContentType() {
  return Platform.getContentTypeManager().getContentType(ContentTypeIdForXML.ContentTypeID_XML);
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.jsp.core

/**
 * Gets list of content types this visitor is interested in
 * 
 * @return All JSP-related content types
 */
private IContentType[] getValidContentTypes() {
  if (fContentTypes == null) {
    // currently "hard-coded" to be jsp & jspf
    fContentTypes = new IContentType[]{Platform.getContentTypeManager().getContentType(ContentTypeIdForJSP.ContentTypeID_JSP), Platform.getContentTypeManager().getContentType(ContentTypeIdForJSP.ContentTypeID_JSPFRAGMENT)};
  }
  return fContentTypes;
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.jsp.core

/**
 * Returns JSP fragment content type
 * 
 * @return jspf content type
 */
private IContentType getJSPFContentType() {
  if (fJSPFContentType == null) {
    fJSPFContentType = Platform.getContentTypeManager().getContentType(ContentTypeIdForJSP.ContentTypeID_JSPFRAGMENT);
  }
  return fJSPFContentType;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.core.resources

public void shutdown() {
  IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
  //if the service is already gone there is nothing to do
  if (contentTypeManager != null)
    contentTypeManager.removeContentTypeChangeListener(this);
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.core.resources

public void shutdown() {
  IContentTypeManager contentTypeManager = Platform.getContentTypeManager();
  //if the service is already gone there is nothing to do
  if (contentTypeManager != null)
    contentTypeManager.removeContentTypeChangeListener(this);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

@Override
  public Object compute(IEclipseContext context, String contextKey) {
    if (editorRegistry == null) {
      editorRegistry = new EditorRegistry(Platform.getContentTypeManager());
    }
    return editorRegistry;
  }
});

代码示例来源:origin: org.eclipse/org.eclipse.jst.jsp.core

IContentType getJspContentType() {
  if (this.fContentTypeJSP == null)
    this.fContentTypeJSP = Platform.getContentTypeManager().getContentType(ContentTypeIdForJSP.ContentTypeID_JSP);
  return this.fContentTypeJSP;
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.jsp.core

IContentType getJspContentType() {
  if(this.fContentTypeJSP == null)
    this.fContentTypeJSP = Platform.getContentTypeManager().getContentType(ContentTypeIdForJSP.ContentTypeID_JSP);
  return this.fContentTypeJSP;
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.xml.ui

/**
 * Get list of valid extensions for XML Content type
 * 
 * @return List
 */
List getValidExtensions() {
  if (fValidExtensions == null) {
    IContentType type = Platform.getContentTypeManager().getContentType(ContentTypeIdForXML.ContentTypeID_XML);
    fValidExtensions = new ArrayList(Arrays.asList(type.getFileSpecs(IContentType.FILE_EXTENSION_SPEC)));
  }
  return fValidExtensions;
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.xml.ui

public void createXMLDocument(String xmlFileName) throws Exception {
  IContentType contentType = Platform.getContentTypeManager().findContentTypeFor(xmlFileName);
  String charset = null;
  if (contentType != null) {
    charset = contentType.getDefaultCharset();
  }
  ByteArrayOutputStream outputStream = createXMLDocument(xmlFileName, charset);
  File file = new File(xmlFileName);
  FileOutputStream fos = new FileOutputStream(file);
  outputStream.writeTo(fos);
  fos.close();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.core.filebuffers

private static abstract class SafeNotifier implements ISafeRunnable {
  @Override
  public void handleException(Throwable ex) {
    // NOTE: Logging is done by SafeRunner
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.core.filebuffers

private static abstract class SafeNotifier implements ISafeRunnable {
  public void handleException(Throwable ex) {
    IStatus status= new Status(IStatus.ERROR, FileBuffersPlugin.PLUGIN_ID, IStatus.OK, "TextFileBufferManager failed to notify an ITextFileBufferListener", ex);  //$NON-NLS-1$
    FileBuffersPlugin.getDefault().getLog().log(status);
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.core.resources

/**
 * Creates a content type matcher for the given project. Takes natures and user settings into account.
 */
private IContentTypeMatcher createMatcher(Project project) {
  ProjectContentTypeSelectionPolicy projectContentTypeSelectionPolicy = new ProjectContentTypeSelectionPolicy(project);
  return Platform.getContentTypeManager().getMatcher(projectContentTypeSelectionPolicy, projectContentTypeSelectionPolicy);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.team.core

/**
 * Return the storage merger associated with the <code>IContentTypeManager.CT_TEXT</code>
 * content type.
 * @return the storage merger associated with the <code>IContentTypeManager.CT_TEXT</code>
 * content type
 */
public static IStorageMerger createTextMerger() {
  return Team.createMerger(Platform.getContentTypeManager().getContentType(IContentTypeManager.CT_TEXT));
}

代码示例来源:origin: org.eclipse/org.eclipse.jst.jee

private IContentDescription getContentType(String contentTypeDescriber) {
  
    if (contentTypeDescriber != null)
      return Platform.getContentTypeManager().getContentType(contentTypeDescriber).getDefaultDescription();
    else
      return null;
    
  }

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.core.resources

/**
 * Creates a content type matcher for the given project. Takes natures and user settings into account.
 */
private IContentTypeMatcher createMatcher(Project project) {
  ProjectContentTypeSelectionPolicy projectContentTypeSelectionPolicy = new ProjectContentTypeSelectionPolicy(project);
  return Platform.getContentTypeManager().getMatcher(projectContentTypeSelectionPolicy, projectContentTypeSelectionPolicy);
}

代码示例来源:origin: org.eclipse/org.eclipse.jem.util

protected static String getContentTypeName(URI uri) {
  
  if (WorkbenchResourceHelperBase.isPlatformResourceURI(uri) || !isValidFullyQualifiedModuleURI(uri))
    return null;
  String contentTypeIdentifier = (uri.segmentCount() > 3 ? uri.segment(ModuleURI.CONTENT_TYPE_INDX) : null);
  if (contentTypeIdentifier != null && Platform.getContentTypeManager().getContentType(uri.segment(ModuleURI.CONTENT_TYPE_INDX)) != null)
    return contentTypeIdentifier;
  else
    return null;
}
public static boolean isValidFullyQualifiedModuleURI(URI aModuleURI) {

相关文章