本文整理汇总了Java中com.intellij.util.xml.DomFileDescription类的典型用法代码示例。如果您正苦于以下问题:Java DomFileDescription类的具体用法?Java DomFileDescription怎么用?Java DomFileDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DomFileDescription类属于com.intellij.util.xml包,在下文中一共展示了DomFileDescription类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getCumulativeVersion
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
public int getCumulativeVersion(boolean forStubs) {
int result = 0;
for (DomFileDescription description : getAllFileDescriptions()) {
if (forStubs) {
if (description.hasStubs()) {
result += description.getStubVersion();
result += description.getRootTagName().hashCode(); // so that a plugin enabling/disabling could trigger the reindexing
}
}
else {
result += description.getVersion();
result += description.getRootTagName().hashCode(); // so that a plugin enabling/disabling could trigger the reindexing
}
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:DomApplicationComponent.java
示例2: getContextSpecificSettings
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
@Nullable
private static ContextSpecificSettingsProviders.Provider getContextSpecificSettings(PsiElement context) {
final PsiFile file = context.getContainingFile();
if (!(file instanceof XmlFile) ||
AndroidFacet.getInstance(file) == null) {
return null;
}
final DomFileDescription<?> description = DomManager.getDomManager(
context.getProject()).getDomFileDescription((XmlFile)file);
if (description instanceof LayoutDomFileDescription) {
return ContextSpecificSettingsProviders.LAYOUT;
}
else if (description instanceof ManifestDomFileDescription) {
return ContextSpecificSettingsProviders.MANIFEST;
}
else if (description instanceof ResourcesDomFileDescription ||
description instanceof DrawableStateListDomFileDescription ||
description instanceof ColorDomFileDescription) {
return ContextSpecificSettingsProviders.VALUE_RESOURCE_FILE;
}
else if (description instanceof AndroidResourceDomFileDescription) {
return ContextSpecificSettingsProviders.OTHER;
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:AndroidXmlFormattingModelBuilder.java
示例3: checkFile
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
@Override
public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) {
if (!(file instanceof XmlFile)) {
return ProblemDescriptor.EMPTY_ARRAY;
}
final AndroidFacet facet = AndroidFacet.getInstance(file);
if (facet == null) {
return ProblemDescriptor.EMPTY_ARRAY;
}
final DomFileDescription<?> description = DomManager.getDomManager(file.getProject()).getDomFileDescription((XmlFile)file);
if (!(description instanceof LayoutDomFileDescription) &&
!(description instanceof MenuDomFileDescription)) {
return ProblemDescriptor.EMPTY_ARRAY;
}
final Collection<PsiClass> activities = findRelatedActivities((XmlFile)file, facet, description);
final MyVisitor visitor = new MyVisitor(manager, isOnTheFly, activities);
file.accept(visitor);
return visitor.myResult.toArray(new ProblemDescriptor[visitor.myResult.size()]);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:AndroidMissingOnClickHandlerInspection.java
示例4: isMyFile
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
static boolean isMyFile(@NotNull AndroidFacet facet, XmlFile file) {
String resourceType = facet.getLocalResourceManager().getFileResourceType(file);
if (resourceType != null) {
if (ourSupportedResourceTypes == null) {
ourSupportedResourceTypes = new HashSet<String>();
for (DomFileDescription description : DomFileDescription.EP_NAME.getExtensions()) {
if (description instanceof AndroidResourceDomFileDescription) {
String[] resourceTypes = ((AndroidResourceDomFileDescription)description).getResourceTypes();
Collections.addAll(ourSupportedResourceTypes, resourceTypes);
}
}
}
if (!ourSupportedResourceTypes.contains(resourceType)) {
return false;
}
if (ResourceType.XML.getName().equals(resourceType)) {
final XmlTag rootTag = file.getRootTag();
return rootTag != null && AndroidXmlResourcesUtil.isSupportedRootTag(facet, rootTag.getName());
}
return true;
}
return ManifestDomFileDescription.isManifestFile(file, facet);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:AndroidUnknownAttributeInspection.java
示例5: registerFileDescription
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
public final synchronized void registerFileDescription(final DomFileDescription description)
{
myRootTagName2FileDescription.get(description.getRootTagName()).add(description);
if(description.acceptsOtherRootTagNames())
{
myAcceptingOtherRootTagNamesDescriptions.add(description);
}
//noinspection unchecked
final Map<Class<? extends DomElement>, Class<? extends DomElement>> implementations = description.getImplementations();
for(final Map.Entry<Class<? extends DomElement>, Class<? extends DomElement>> entry : implementations.entrySet())
{
registerImplementation(entry.getKey(), entry.getValue(), null);
}
myTypeChooserManager.copyFrom(description.getTypeChooserManager());
}
开发者ID:consulo,项目名称:consulo-xml,代码行数:18,代码来源:DomApplicationComponent.java
示例6: registerFileDescription
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
public final synchronized void registerFileDescription(final DomFileDescription description) {
myRootTagName2FileDescription.get(description.getRootTagName()).add(description);
if (description.acceptsOtherRootTagNames()) {
myAcceptingOtherRootTagNamesDescriptions.add(description);
}
//noinspection unchecked
final Map<Class<? extends DomElement>, Class<? extends DomElement>> implementations = description.getImplementations();
for (final Map.Entry<Class<? extends DomElement>, Class<? extends DomElement>> entry : implementations.entrySet()) {
registerImplementation(entry.getKey(), entry.getValue(), null);
}
myTypeChooserManager.copyFrom(description.getTypeChooserManager());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:DomApplicationComponent.java
示例7: getAllFileDescriptions
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
public synchronized List<DomFileDescription> getAllFileDescriptions() {
final List<DomFileDescription> result = newArrayList();
for (Set<DomFileDescription> descriptions : myRootTagName2FileDescription.values()) {
result.addAll(descriptions);
}
result.addAll(myAcceptingOtherRootTagNamesDescriptions);
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DomApplicationComponent.java
示例8: findRelatedActivities
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
@NotNull
private static Collection<PsiClass> findRelatedActivities(@NotNull XmlFile file,
@NotNull AndroidFacet facet,
@NotNull DomFileDescription<?> description) {
if (description instanceof LayoutDomFileDescription) {
final Computable<List<GotoRelatedItem>> computable = AndroidGotoRelatedProvider.getLazyItemsForXmlFile(file, facet);
if (computable == null) {
return Collections.emptyList();
}
final List<GotoRelatedItem> items = computable.compute();
if (items.isEmpty()) {
return Collections.emptyList();
}
final PsiClass activityClass = findActivityClass(facet.getModule());
if (activityClass == null) {
return Collections.emptyList();
}
final List<PsiClass> result = new ArrayList<PsiClass>();
for (GotoRelatedItem item : items) {
final PsiElement element = item.getElement();
if (element instanceof PsiClass) {
final PsiClass aClass = (PsiClass)element;
if (aClass.isInheritor(activityClass, true)) {
result.add(aClass);
}
}
}
return result;
}
else {
return findRelatedActivitiesForMenu(file, facet);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:AndroidMissingOnClickHandlerInspection.java
示例9: isMyFile
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
@Override
protected boolean isMyFile(PsiFile file) {
final DomFileDescription<?> description = DomManager.getDomManager(file.getProject()).getDomFileDescription((XmlFile)file);
return description instanceof LayoutDomFileDescription ||
description instanceof ResourcesDomFileDescription;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:AndroidInlineStyleReferenceAction.java
示例10: getStubVersion
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
@Override
public int getStubVersion()
{
int version = 11;
DomFileDescription[] descriptions = Extensions.getExtensions(DomFileDescription.EP_NAME);
for(DomFileDescription description : descriptions)
{
version += description.getStubVersion();
}
return version;
}
开发者ID:consulo,项目名称:consulo-xml,代码行数:12,代码来源:DomStubBuilder.java
示例11: DomApplicationComponent
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
public DomApplicationComponent()
{
for(final DomFileDescription description : Extensions.getExtensions(DomFileDescription.EP_NAME))
{
registerFileDescription(description);
}
}
开发者ID:consulo,项目名称:consulo-xml,代码行数:8,代码来源:DomApplicationComponent.java
示例12: getCumulativeVersion
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
public int getCumulativeVersion()
{
int result = 0;
for(DomFileDescription description : getAllFileDescriptions())
{
result += description.getVersion();
result += description.getRootTagName().hashCode(); // so that a plugin enabling/disabling could trigger the reindexing
}
return result;
}
开发者ID:consulo,项目名称:consulo-xml,代码行数:11,代码来源:DomApplicationComponent.java
示例13: getAllFileDescriptions
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
public synchronized List<DomFileDescription> getAllFileDescriptions()
{
final List<DomFileDescription> result = newArrayList();
for(Set<DomFileDescription> descriptions : myRootTagName2FileDescription.values())
{
result.addAll(descriptions);
}
result.addAll(myAcceptingOtherRootTagNamesDescriptions);
return result;
}
开发者ID:consulo,项目名称:consulo-xml,代码行数:11,代码来源:DomApplicationComponent.java
示例14: create
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
@Override
protected Set<DomFileDescription> create(final String key) {
return new THashSet<DomFileDescription>();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:DomApplicationComponent.java
示例15: DomApplicationComponent
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
public DomApplicationComponent() {
for (final DomFileDescription description : Extensions.getExtensions(DomFileDescription.EP_NAME)) {
registerFileDescription(description);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:DomApplicationComponent.java
示例16: getFileDescriptions
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
public final synchronized Set<DomFileDescription> getFileDescriptions(String rootTagName) {
return myRootTagName2FileDescription.get(rootTagName);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:DomApplicationComponent.java
示例17: getAcceptingOtherRootTagNameDescriptions
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
public final synchronized Set<DomFileDescription> getAcceptingOtherRootTagNameDescriptions() {
return myAcceptingOtherRootTagNamesDescriptions;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:DomApplicationComponent.java
示例18: fillCompletionVariants
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
@Override
public void fillCompletionVariants(@NotNull CompletionParameters parameters, @NotNull final CompletionResultSet result) {
if (TemplateManager.getInstance(parameters.getOriginalFile().getProject()).getActiveTemplate(parameters.getEditor()) != null) {
return; // Don't brake the template.
}
PsiFile psiFile = parameters.getOriginalFile();
if (!(psiFile instanceof XmlFile)) return;
if (!MavenDomUtil.isProjectFile(psiFile)) return;
DomFileDescription<?> description = DomManager.getDomManager(psiFile.getProject()).getDomFileDescription((XmlFile)psiFile);
if (!(description instanceof MavenDomProjectModelDescription)) return;
result.runRemainingContributors(parameters, new Consumer<CompletionResult>() {
@Override
public void consume(CompletionResult r) {
final LookupElement lookupElement = r.getLookupElement();
if (myHandledTags.contains(lookupElement.getLookupString())) {
LookupElement decorator =
LookupElementDecorator.withInsertHandler(lookupElement, new InsertHandler<LookupElementDecorator<LookupElement>>() {
@Override
public void handleInsert(final InsertionContext context, LookupElementDecorator<LookupElement> item) {
lookupElement.handleInsert(context);
Object object = lookupElement.getObject();
if ("dependency".equals(lookupElement.getLookupString()) && object instanceof XmlTag
&& "maven-4.0.0.xsd".equals(((XmlTag)object).getContainingFile().getName())) {
context.commitDocument();
CaretModel caretModel = context.getEditor().getCaretModel();
PsiElement psiElement = context.getFile().findElementAt(caretModel.getOffset());
XmlTag xmlTag = PsiTreeUtil.getParentOfType(psiElement, XmlTag.class);
if (xmlTag != null) {
DomElement domElement = DomManager.getDomManager(context.getProject()).getDomElement(xmlTag);
if (domElement instanceof MavenDomDependency) {
String s = "\n<groupId></groupId>\n<artifactId></artifactId>\n";
context.getDocument().insertString(caretModel.getOffset(), s);
caretModel.moveToOffset(caretModel.getOffset() + s.length() - "</artifactId>\n".length());
context.commitDocument();
new ReformatCodeProcessor(context.getProject(), context.getFile(), xmlTag.getTextRange(), false).run();
MavenDependencyCompletionUtil.invokeCompletion(context, CompletionType.BASIC);
}
}
}
}
});
r = r.withLookupElement(decorator);
}
result.passResult(r);
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:62,代码来源:MavenPomXmlCompletionTagListenerContributor.java
示例19: create
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
protected Set<DomFileDescription> create(final String key) {
return new THashSet<DomFileDescription>();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:4,代码来源:DomApplicationComponent.java
示例20: findFileDescription
import com.intellij.util.xml.DomFileDescription; //导入依赖的package包/类
@Nullable
private DomFileDescription<T> findFileDescription(final XmlFileHeader rootTagName, @Nullable StringBuilder sb)
{
final DomFileDescription<T> mockDescription = myXmlFile.getUserData(DomManagerImpl.MOCK_DESCRIPTION);
if(mockDescription != null)
{
return mockDescription;
}
if(sb != null)
{
sb.append("no mock\n");
}
final XmlFile originalFile = (XmlFile) myXmlFile.getOriginalFile();
if(sb != null)
{
sb.append("original: " + originalFile + "\n");
}
if(!originalFile.equals(myXmlFile))
{
final FileDescriptionCachedValueProvider<T> provider = myDomManager.getOrCreateCachedValueProvider(originalFile);
final DomFileElementImpl<T> element = provider.getFileElement();
if(sb != null)
{
sb.append("originalDom " + element + "\n");
}
return element == null ? null : element.getFileDescription();
}
//noinspection unchecked
final Set<DomFileDescription> namedDescriptions = myDomManager.getFileDescriptions(rootTagName.getRootTagLocalName());
if(sb != null)
{
sb.append("named " + new HashSet<DomFileDescription>(namedDescriptions) + "\n");
}
DomFileDescription<T> description = ContainerUtil.find(namedDescriptions, myCondition);
if(description == null)
{
final Set<DomFileDescription> unnamed = myDomManager.getAcceptingOtherRootTagNameDescriptions();
description = ContainerUtil.find(unnamed, myCondition);
}
if(sb != null)
{
sb.append("found " + description + "\n");
}
return description;
}
开发者ID:consulo,项目名称:consulo-xml,代码行数:49,代码来源:FileDescriptionCachedValueProvider.java
注:本文中的com.intellij.util.xml.DomFileDescription类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论