From 53723716f469d270fe143b8e28b658fc063c4665 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 2 Jun 2014 20:25:13 +0400 Subject: [PATCH] cleanup --- .../NavigationGutterIconBuilder.java | 6 ++ .../NavigationGutterIconRenderer.java | 7 +- .../xml/AbstractDomDeclarationSearcher.java | 3 +- .../util/xml/DomDocumentationProvider.java | 7 +- .../util/xml/DomNameSuggestionProvider.java | 3 +- .../util/xml/DomUsageTypeProvider.java | 3 +- .../xml/ElementPresentationManagerImpl.java | 4 +- .../com/intellij/util/xml/EnumConverter.java | 5 + .../intellij/util/xml/ModelMergerImpl.java | 30 +++++- .../DomCollectionProblemDescriptorImpl.java | 3 +- .../DomElementAnnotationHolderImpl.java | 11 ++- .../DomElementProblemDescriptorImpl.java | 7 ++ ...omElementResolveProblemDescriptorImpl.java | 5 +- .../highlighting/DomElementsErrorPanel.java | 14 ++- .../DomElementsHighlightingUtil.java | 2 + .../DomElementsProblemsHolderImpl.java | 15 ++- .../DomHighlightingHelperImpl.java | 13 ++- .../MockAnnotatingDomInspection.java | 6 +- .../xml/highlighting/MockDomInspection.java | 5 +- .../impl/AbstractDomChildDescriptionImpl.java | 10 +- .../util/xml/impl/AddChildInvocation.java | 1 + .../AddToCompositeCollectionInvocation.java | 3 +- .../impl/AttributeChildDescriptionImpl.java | 6 ++ .../impl/AttributeChildInvocationHandler.java | 15 +++ .../impl/CollectionChildDescriptionImpl.java | 12 +++ .../CollectionElementInvocationHandler.java | 5 + .../util/xml/impl/ConvertAnnotationImpl.java | 5 +- .../util/xml/impl/ConvertContextFactory.java | 1 + .../util/xml/impl/ConvertContextImpl.java | 3 + .../util/xml/impl/ConverterManagerImpl.java | 4 + .../CustomDomChildrenDescriptionImpl.java | 7 +- .../util/xml/impl/DefaultDomAnnotator.java | 3 +- .../DefaultDomTargetDescriptionProvider.java | 3 +- .../impl/DefaultDomTargetIconProvider.java | 3 +- .../intellij/util/xml/impl/DomAnchorImpl.java | 8 ++ .../xml/impl/DomApplicationComponent.java | 4 +- .../xml/impl/DomChildDescriptionImpl.java | 5 + .../util/xml/impl/DomDeclarationSearcher.java | 3 +- .../util/xml/impl/DomDescriptorProvider.java | 3 +- .../DomElementsNavigationManagerImpl.java | 8 +- .../util/xml/impl/DomFileElementImpl.java | 56 ++++++++++- .../util/xml/impl/DomGenericInfoEx.java | 3 +- .../intellij/util/xml/impl/DomImplUtil.java | 3 + .../util/xml/impl/DomInvocationHandler.java | 38 +++++++- .../util/xml/impl/DomManagerImpl.java | 29 ++++++ .../util/xml/impl/DomMetaDataContributor.java | 4 +- .../xml/impl/DomReferenceContributor.java | 3 +- .../xml/impl/DomRootInvocationHandler.java | 10 ++ .../util/xml/impl/DomSemContributor.java | 10 +- .../util/xml/impl/DomServiceImpl.java | 11 ++- .../util/xml/impl/DomTemplateRunnerImpl.java | 3 +- .../util/xml/impl/DynamicGenericInfo.java | 20 +++- .../FileDescriptionCachedValueProvider.java | 3 +- .../xml/impl/FixedChildDescriptionImpl.java | 6 ++ .../xml/impl/GenericDomValueReference.java | 10 +- .../impl/GenericValueReferenceProvider.java | 2 + .../xml/impl/GetAttributeChildInvocation.java | 1 + .../impl/GetCollectionChildInvocation.java | 1 + .../GetCompositeCollectionInvocation.java | 3 +- .../xml/impl/GetFixedChildInvocation.java | 1 + .../xml/impl/ImplementationClassCache.java | 2 + .../impl/IndexedElementInvocationHandler.java | 7 ++ .../util/xml/impl/InvocationCache.java | 15 +++ .../util/xml/impl/MockDomFileDescription.java | 6 +- .../xml/impl/PhysicalDomParentStrategy.java | 8 +- .../xml/impl/PropertyAccessorInvocation.java | 3 +- .../util/xml/impl/RootDomParentStrategy.java | 7 +- .../intellij/util/xml/impl/SetInvocation.java | 1 + .../xml/impl/StableInvocationHandler.java | 6 +- .../util/xml/impl/StaticGenericInfo.java | 22 +++++ .../xml/impl/StaticGenericInfoBuilder.java | 1 + .../xml/impl/VirtualDomParentStrategy.java | 7 +- .../model/gotosymbol/GoToSymbolProvider.java | 11 ++- .../util/xml/reflect/DomExtensionImpl.java | 9 +- .../reflect/DomExtensionsRegistrarImpl.java | 7 +- .../structure/DomStructureTreeElement.java | 10 ++ .../com/intellij/util/xml/stubs/DomStub.java | 3 +- .../intellij/util/xml/stubs/ElementStub.java | 3 +- .../actions/AddDomElementActionGroup.java | 5 +- .../actions/AddElementInCollectionAction.java | 17 +++- .../xml/tree/actions/BaseDomTreeAction.java | 4 +- .../xml/tree/actions/DeleteDomElement.java | 5 +- .../tree/actions/DomElementsToggleAction.java | 8 +- .../GotoDomElementDeclarationAction.java | 15 +-- .../util/xml/ui/DomUIFactoryImpl.java | 19 +++- .../util/xml/ui/EditorTextFieldControl.java | 18 +++- .../com/intellij/util/xml/ui/TextControl.java | 8 +- .../dom/AbstractDomChildrenDescriptor.java | 20 ++++ .../impl/dom/DomAttributeXmlDescriptor.java | 16 +++- .../xml/impl/dom/DomElementXmlDescriptor.java | 21 ++++- .../intellij/patterns/DomElementPattern.java | 6 +- .../com/intellij/patterns/DomPatterns.java | 3 +- .../patterns/GenericDomValuePattern.java | 6 +- .../util/xml/AbstractConvertContext.java | 8 +- .../src/com/intellij/util/xml/Converter.java | 7 +- .../intellij/util/xml/DomFileDescription.java | 4 +- .../intellij/util/xml/DomIconProvider.java | 3 +- .../com/intellij/util/xml/DomMetaData.java | 10 +- .../util/xml/DomResolveConverter.java | 10 +- .../src/com/intellij/util/xml/DomService.java | 3 +- .../src/com/intellij/util/xml/DomTarget.java | 6 +- .../src/com/intellij/util/xml/DomUtil.java | 4 + .../util/xml/DummyEvaluatedXmlName.java | 6 +- .../util/xml/ElementPresentationManager.java | 10 +- .../util/xml/EvaluatedXmlNameImpl.java | 8 +- .../intellij/util/xml/GenericDomValue.java | 4 +- .../intellij/util/xml/GenericValueUtil.java | 4 +- .../intellij/util/xml/HyphenNameStrategy.java | 4 +- .../src/com/intellij/util/xml/JavaMethod.java | 1 + .../intellij/util/xml/JavaNameStrategy.java | 5 +- .../util/xml/MergingFileDescription.java | 5 +- .../intellij/util/xml/ModelMergerUtil.java | 3 + .../xml/ModuleContentRootSearchScope.java | 6 +- .../com/intellij/util/xml/NamedEnumUtil.java | 2 + .../util/xml/ParentScopeProvider.java | 3 +- .../intellij/util/xml/ResolvingConverter.java | 13 ++- .../intellij/util/xml/RootScopeProvider.java | 3 +- .../intellij/util/xml/TypeChooserManager.java | 5 +- .../intellij/util/xml/WrappingConverter.java | 4 +- .../src/com/intellij/util/xml/XmlName.java | 3 +- .../generate/AbstractDomGenerateProvider.java | 5 +- .../DefaultGenerateElementProvider.java | 3 +- .../converters/DelimitedListConverter.java | 10 ++ .../converters/PathReferenceConverter.java | 18 ++-- .../values/BooleanValueConverter.java | 6 +- .../values/CharacterValueConverter.java | 5 +- .../values/NumberValueConverter.java | 6 +- .../highlighting/AddDomElementQuickFix.java | 5 +- .../BasicDomElementsInspection.java | 1 + .../DomElementResolveProblemDescriptor.java | 3 +- .../highlighting/DomElementsInspection.java | 5 + .../RemoveDomElementQuickFix.java | 5 +- .../ResolvingElementQuickFix.java | 14 ++- .../util/xml/model/DomModelCache.java | 4 +- .../xml/model/impl/BaseDomModelFactory.java | 15 ++- .../impl/CachedMultipleDomModelFactory.java | 7 +- .../impl/CachedSimpleDomModelFactory.java | 4 +- .../util/xml/model/impl/DomModelFactory.java | 3 +- .../util/xml/model/impl/DomModelImpl.java | 7 +- .../xml/model/impl/SimpleDomModelFactory.java | 3 +- .../xml/reflect/DomFixedChildDescription.java | 3 +- .../util/xml/tree/AbstractDomElementNode.java | 3 +- .../util/xml/tree/BaseDomElementNode.java | 12 ++- .../util/xml/tree/DomElementsGroupNode.java | 9 +- .../util/xml/tree/DomFileElementNode.java | 5 +- .../util/xml/tree/DomModelTreeStructure.java | 3 +- .../util/xml/tree/DomModelTreeView.java | 9 +- .../util/xml/tree/GenericValueNode.java | 8 +- .../xml/ui/AbstractDomElementComponent.java | 4 +- .../util/xml/ui/AbstractTableView.java | 11 ++- .../com/intellij/util/xml/ui/BaseControl.java | 16 +++- .../util/xml/ui/BaseModifiableControl.java | 4 +- .../util/xml/ui/BasicDomElementComponent.java | 5 +- .../util/xml/ui/BigStringComponent.java | 3 +- .../util/xml/ui/BooleanColumnInfo.java | 6 +- .../intellij/util/xml/ui/BooleanControl.java | 6 +- .../util/xml/ui/BooleanEnumControl.java | 6 +- .../util/xml/ui/CaptionComponent.java | 6 +- .../xml/ui/ChildGenericValueColumnInfo.java | 7 +- .../intellij/util/xml/ui/ComboControl.java | 23 ++++- .../util/xml/ui/ComboTableCellEditor.java | 5 +- .../intellij/util/xml/ui/CommitAdapter.java | 4 +- .../CommitablePanelUserActivityListener.java | 5 +- .../util/xml/ui/CompositeCommittable.java | 6 +- .../util/xml/ui/DomCollectionControl.java | 35 ++++++- .../util/xml/ui/DomCollectionWrapper.java | 6 +- .../intellij/util/xml/ui/DomColumnInfo.java | 4 +- .../intellij/util/xml/ui/DomFileEditor.java | 18 +++- .../intellij/util/xml/ui/DomFixedWrapper.java | 6 +- .../util/xml/ui/DomStringWrapper.java | 6 +- .../intellij/util/xml/ui/DomTableView.java | 5 +- .../intellij/util/xml/ui/DomUIFactory.java | 6 +- .../util/xml/ui/DomUINavigationProvider.java | 5 +- .../xml/ui/ErrorableTableCellRenderer.java | 3 +- .../util/xml/ui/GenericValueColumnInfo.java | 6 +- .../util/xml/ui/MockDomElementsEditor.java | 10 +- .../util/xml/ui/StringColumnInfo.java | 3 +- .../util/xml/ui/StripeTableCellRenderer.java | 3 +- .../com/intellij/util/xml/ui/UndoHelper.java | 7 +- .../xml/ui/actions/AddDomElementAction.java | 6 +- .../util/xml/ui/actions/DefaultAddAction.java | 7 +- .../generate/GenerateDomElementAction.java | 8 +- .../generate/GenerateDomElementProvider.java | 3 +- .../com/intellij/util/xml/DomBasicsTest.java | 4 +- .../intellij/util/xml/DomChildrenTest.java | 4 +- .../util/xml/DomConcurrencyStressTest.java | 4 +- .../intellij/util/xml/DomExtensionsTest.java | 5 +- .../intellij/util/xml/DomIncludesTest.java | 12 ++- .../intellij/util/xml/DomSaxParserTest.java | 17 +++- .../com/intellij/util/xml/ProxyTest.java | 1 + .../xml/impl/IncrementalUpdateEventsTest.java | 3 +- .../xml/impl/TreeIncrementalUpdateTest.java | 8 +- .../options/CodeStyleHtmlPanel.java | 10 ++ .../options/CodeStyleXmlPanel.java | 9 ++ .../actions/GenerateDTDAction.java | 2 +- .../analysis/AddSchemaPrefixIntention.java | 4 +- .../analysis/InsertRequiredAttributeFix.java | 2 +- .../editorActions/HtmlQuoteHandler.java | 2 +- .../XmlCopyPastePreProcessor.java | 2 + .../editorActions/XmlEqTypedHandler.java | 2 +- .../api/impls/XmlParameterInfoHandler.java | 10 +- .../javaee/MapExternalResourceDialog.java | 1 - .../com/intellij/javaee/NameLocationPair.java | 4 +- .../lang/xml/XmlElementRenameValidator.java | 2 +- .../intellij/lang/xml/XmlFormattingModel.java | 4 +- .../psi/formatter/xml/AbstractXmlBlock.java | 2 +- .../psi/formatter/xml/HtmlPolicy.java | 3 +- .../psi/formatter/xml/XmlTagBlock.java | 4 + ...erateInstanceDocumentFromSchemaAction.java | 3 + ...erateInstanceDocumentFromSchemaDialog.java | 11 ++- ...erateSchemaFromInstanceDocumentAction.java | 3 + .../xml/actions/xmlbeans/UIUtils.java | 2 + .../actions/xmlbeans/Xsd2InstanceUtils.java | 33 +++---- .../XmlLanguageBreadcrumbsInfoProvider.java | 4 +- .../impl/schema/SchemaDefinitionsSearch.java | 1 - .../HtmlDocumentationProvider.java | 2 + .../XmlDocumentationProvider.java | 2 +- .../xml/breadcrumbs/BreadcrumbsComponent.java | 29 +++++- .../RelaxedHtmlFromRngElementDescriptor.java | 6 +- .../html/RelaxedHtmlFromRngNSDescriptor.java | 4 +- .../html/RngHtml5MetaDataContributor.java | 2 + .../plugins/relaxNG/ApplicationLoader.java | 6 ++ .../relaxNG/GotoSymbolContributor.java | 2 + .../relaxNG/RelaxNGReferenceContributor.java | 17 +++- .../relaxNG/RngDocumentationProvider.java | 5 + .../relaxNG/RngDomFileDescription.java | 17 ++++ .../relaxNG/compact/RncCompletionData.java | 4 + .../relaxNG/compact/RncElementTypeEx.java | 3 +- .../relaxNG/compact/RncElementTypes.java | 1 - .../plugins/relaxNG/compact/RncFileType.java | 5 + .../relaxNG/compact/RncHighlighter.java | 2 + .../relaxNG/compact/RncParserDefinition.java | 10 ++ .../relaxNG/compact/RncTokenTypes.java | 1 + .../compact/folding/RncFoldingBuilder.java | 3 + .../relaxNG/compact/formatting/RncBlock.java | 9 ++ .../formatting/RncFormattingModelBuilder.java | 2 + .../lexer/CompactSyntaxLexerAdapter.java | 10 ++ .../compact/parser/PatternParsing.java | 1 + .../relaxNG/compact/parser/RncParser.java | 1 + .../relaxNG/compact/psi/RncDefine.java | 1 + .../relaxNG/compact/psi/RncGrammar.java | 1 + .../relaxNG/compact/psi/RncInclude.java | 1 + .../plugins/relaxNG/compact/psi/RncRef.java | 2 + .../compact/psi/impl/PatternReference.java | 14 +++ .../compact/psi/impl/RncAnnotationImpl.java | 3 + .../relaxNG/compact/psi/impl/RncDeclImpl.java | 4 + .../compact/psi/impl/RncDefineImpl.java | 17 ++++ .../relaxNG/compact/psi/impl/RncDivImpl.java | 1 + .../relaxNG/compact/psi/impl/RncDocument.java | 7 ++ .../compact/psi/impl/RncElementImpl.java | 4 + .../compact/psi/impl/RncExternalRefImpl.java | 1 + .../relaxNG/compact/psi/impl/RncFileImpl.java | 6 ++ .../psi/impl/RncFileReferenceImpl.java | 3 + .../compact/psi/impl/RncGrammarImpl.java | 3 + .../compact/psi/impl/RncIncludeImpl.java | 3 + .../compact/psi/impl/RncNsDeclImpl.java | 1 + .../relaxNG/compact/psi/impl/RncRefImpl.java | 3 + .../relaxNG/compact/psi/util/PsiFunction.java | 1 + .../relaxNG/compact/psi/util/RenameUtil.java | 2 +- .../relaxNG/config/NoNamespaceConfigImpl.java | 11 +++ .../config/NoNamespaceConfigPanel.java | 8 ++ .../config/NoNamespaceSchemaProvider.java | 1 + .../relaxNG/convert/AdvancedDtdOptions.java | 13 +++ .../convert/AdvancedOptionsDialog.java | 1 + .../relaxNG/convert/AdvancedXsdOptions.java | 3 + .../relaxNG/convert/ConvertSchemaAction.java | 3 +- .../relaxNG/convert/ConvertSchemaDialog.java | 3 + .../convert/ConvertSchemaSettingsImpl.java | 8 ++ .../plugins/relaxNG/convert/IdeaDriver.java | 3 +- .../relaxNG/inspections/RngDomInspection.java | 3 + .../inspections/UnusedDefineInspection.java | 8 ++ .../annotation/CommonAnnotationHolder.java | 2 + .../model/annotation/ModelAnnotator.java | 5 + .../annotation/OverriddenDefineRenderer.java | 5 + .../annotation/OverriddenDefineSearcher.java | 19 ++++ .../annotation/OverridingDefineRenderer.java | 6 ++ .../model/descriptors/AttributeFinder.java | 7 ++ .../model/descriptors/ChildElementFinder.java | 2 + .../descriptors/CompositeDescriptor.java | 5 + .../model/descriptors/NamedPatternFilter.java | 1 + .../descriptors/RecursionSaveWalker.java | 5 +- .../descriptors/RngElementDescriptor.java | 23 +++++ .../model/descriptors/RngNsDescriptor.java | 14 +++ .../RngXmlAttributeDescriptor.java | 14 +++ .../model/resolve/DefinitionResolver.java | 6 ++ .../model/resolve/RelaxIncludeIndex.java | 16 ++++ .../relaxNG/references/AddValueCondition.java | 1 + .../references/AttributeValueCondition.java | 1 + .../references/AttributeValueFunction.java | 1 + .../relaxNG/references/IdRefProvider.java | 8 ++ .../relaxNG/references/ResolvingVisitor.java | 4 + .../relaxNG/validation/MessageViewHelper.java | 7 ++ .../relaxNG/validation/Psi2SaxAdapter.java | 6 ++ .../plugins/relaxNG/validation/RngParser.java | 6 ++ .../validation/RngSchemaValidator.java | 7 +- .../relaxNG/validation/ValidateAction.java | 16 +++- .../plugins/relaxNG/xml/dom/Combine.java | 1 + .../relaxNG/xml/dom/RngDomVisitor.java | 1 + .../xml/dom/impl/CreatePatternFix.java | 7 ++ .../xml/dom/impl/DefinitionReference.java | 6 ++ .../relaxNG/xml/dom/impl/RngDefineImpl.java | 5 + .../xml/dom/impl/RngDefineMetaData.java | 4 + .../xml/dom/impl/RngDomElementBase.java | 4 + .../relaxNG/xml/dom/impl/RngGrammarImpl.java | 1 + .../xml/dom/impl/RngHrefConverter.java | 3 + .../relaxNG/xml/dom/impl/RngIncludeImpl.java | 2 + .../relaxNG/xml/dom/impl/RngRefImpl.java | 2 + .../xml/dom/impl/RngReferenceConverter.java | 3 + .../plugins/relaxNG/AbstractIndexTest.java | 1 + .../plugins/relaxNG/AbstractParsingTest.java | 1 + .../relaxNG/AttributeCompletionTest.java | 1 + .../relaxNG/ElementCompletionTest.java | 1 + .../relaxNG/ExternalRncParsingTest.java | 1 + .../plugins/relaxNG/HighlightingTestBase.java | 10 +- .../plugins/relaxNG/RncCompletionTest.java | 1 + .../relaxNG/RncExternalHighlightingTest.java | 2 + .../plugins/relaxNG/RncHighlightingTest.java | 1 + .../relaxNG/RncIndexHighlightingTest.java | 1 + .../plugins/relaxNG/RncRenameTest.java | 3 + .../plugins/relaxNG/RngCompletionTest.java | 1 + .../plugins/relaxNG/RngHighlightingTest.java | 1 + .../relaxNG/RngIndexHighlightingTest.java | 1 + .../plugins/relaxNG/RngRenameTest.java | 2 + .../relaxNG/RngXmlHighlightingTest.java | 3 + .../plugins/relaxNG/RngXmlValidationTest.java | 3 + .../intellij/codeInsight/XmlBuilderTest.java | 18 +++- .../codeInsight/XmlDocumentationTest.java | 2 +- .../com/intellij/codeInsight/XmlDtdTest.java | 4 +- .../intellij/codeInsight/XmlEventsTest.java | 24 +++-- .../intellij/codeInsight/XmlInsightTest.java | 4 +- .../codeInsight/XmlPerformanceTest.java | 16 +++- .../intellij/codeInsight/XmlSchemaTest.java | 17 +++- .../com/intellij/codeInsight/XmlTagTest.java | 92 +++++++++++++------ .../intellij/codeInsight/XmlTagWriteTest.java | 6 +- .../com/intellij/codeInsight/XmlTestUtil.java | 19 +++- .../completion/XmlCompletionTest.java | 21 ++++- .../daemon/XmlHighlightingTest.java | 32 +++++-- .../ExtractExternalResourceLinksTest.java | 17 +++- .../html/MicrodataCompletionTest.java | 4 +- .../intellij/xml/XMLCatalogManagerTest.java | 4 +- .../src/com/intellij/xml/XmlFoldingTest.java | 4 +- .../com/intellij/xml/XmlNamespacesTest.java | 17 +++- .../com/intellij/xml/XmlSchemaPrefixTest.java | 17 +++- .../xml/actions/SplitTagActionTest.java | 16 ++++ .../XmlWrongClosingTagNameInspection.java | 6 +- .../impl/providers/IdRefReference.java | 4 +- .../XmlSuppressionProvider.java | 4 +- .../patterns/XmlAttributeValuePattern.java | 4 +- .../intellij/patterns/XmlElementPattern.java | 5 +- .../com/intellij/patterns/XmlFilePattern.java | 3 +- .../patterns/XmlNamedElementPattern.java | 6 +- .../com/intellij/patterns/XmlTagPattern.java | 10 +- .../com/intellij/pom/xml/XmlChangeSet.java | 3 +- .../psi/XmlRecursiveElementVisitor.java | 3 +- .../psi/filters/position/NamespaceFilter.java | 2 + .../com/intellij/psi/xml/XmlElementDecl.java | 3 +- .../com/intellij/psi/xml/XmlEntityDecl.java | 3 +- .../com/intellij/xml/XmlSchemaProvider.java | 3 +- .../src/com/intellij/xml/util/XmlTagUtil.java | 14 +-- .../options/editor/XmlFoldingSettings.java | 4 + ...elaxedHtmlFromSchemaElementDescriptor.java | 7 +- .../RelaxedHtmlFromSchemaNSDescriptor.java | 5 +- .../ide/highlighter/HtmlFileHighlighter.java | 4 +- .../ide/highlighter/XmlFileHighlighter.java | 17 ++-- .../javaee/ExternalResourceManagerExImpl.java | 29 +++++- .../javaee/InternalResourceProvider.java | 3 +- .../com/intellij/javaee/ProjectResources.java | 2 + .../javaee/ResourceRegistrarImpl.java | 6 +- .../intellij/javaee/XMLCatalogManager.java | 8 +- .../intellij/lang/XmlCodeFoldingBuilder.java | 5 +- .../lang/dtd/DTDParserDefinition.java | 4 +- .../lang/dtd/DtdSyntaxHighlighterFactory.java | 16 ++++ .../com/intellij/lang/html/HTMLParser.java | 3 +- .../lang/html/HTMLParserDefinition.java | 11 ++- .../html/HtmlSyntaxHighlighterFactory.java | 16 ++++ .../lang/xhtml/XHTMLParserDefinition.java | 5 +- .../xhtml/XhtmlSyntaxHighlighterFactory.java | 16 ++++ .../lang/xml/XMLParserDefinition.java | 11 ++- .../lang/xml/XmlSyntaxHighlighterFactory.java | 16 ++++ .../lang/xml/XmlTemplateTreePatcher.java | 2 + .../src/com/intellij/lexer/BaseHtmlLexer.java | 4 +- .../intellij/lexer/HtmlHighlightingLexer.java | 4 +- .../src/com/intellij/lexer/XHtmlLexer.java | 3 +- .../intellij/lexer/XmlHighlightingLexer.java | 3 +- .../pom/xml/impl/XmlAspectChangeSetImpl.java | 11 ++- .../xml/impl/events/XmlAttributeSetImpl.java | 5 +- .../impl/events/XmlDocumentChangedImpl.java | 3 +- .../xml/impl/events/XmlTagChildAddImpl.java | 4 +- .../impl/events/XmlTagNameChangedImpl.java | 4 +- .../xml/impl/events/XmlTextChangedImpl.java | 4 +- .../intellij/psi/filters/XmlTagFilter.java | 4 +- .../intellij/psi/filters/XmlTextFilter.java | 5 +- .../position/TargetNamespaceFilter.java | 2 + .../filters/position/XmlTokenTypeFilter.java | 2 + .../cache/impl/idCache/XmlFilterLexer.java | 3 +- .../impl/cache/impl/idCache/XmlIdIndexer.java | 3 +- .../html/HtmlConditionalCommentInjector.java | 2 + .../impl/source/html/HtmlDocumentImpl.java | 3 +- .../source/html/HtmlEmbeddedContentImpl.java | 4 + .../psi/impl/source/html/HtmlTagImpl.java | 10 +- .../html/dtd/HtmlAttributeDescriptorImpl.java | 15 ++- .../html/dtd/HtmlElementDescriptorImpl.java | 18 +++- .../source/html/dtd/HtmlNSDescriptorImpl.java | 14 ++- .../source/parsing/xml/HtmlBuilderDriver.java | 3 +- .../impl/source/parsing/xml/XmlParser.java | 3 +- .../BasicAttributeValueReference.java | 6 +- .../impl/providers/DependentNSReference.java | 3 + .../providers/SchemaReferencesProvider.java | 16 +++- .../TypeOrElementOrAttributeReference.java | 18 +++- .../impl/providers/URLReference.java | 14 ++- .../impl/providers/XmlValueReference.java | 2 +- .../psi/impl/source/tree/HtmlFileElement.java | 3 +- .../psi/impl/source/tree/XmlFileElement.java | 3 +- .../injected/XmlAttributeLiteralEscaper.java | 5 +- .../injected/XmlCommentLiteralEscaper.java | 5 +- .../tree/injected/XmlTextLiteralEscaper.java | 6 +- .../impl/source/xml/LanguageXmlPsiPolicy.java | 17 +++- .../psi/impl/source/xml/SchemaPrefix.java | 5 +- .../source/xml/SchemaPrefixReference.java | 4 +- .../psi/impl/source/xml/TagNameReference.java | 11 ++- .../impl/source/xml/XmlAttlistDeclImpl.java | 8 +- .../impl/source/xml/XmlAttributeDeclImpl.java | 20 +++- .../source/xml/XmlAttributeReference.java | 12 ++- .../source/xml/XmlAttributeValueImpl.java | 17 +++- .../psi/impl/source/xml/XmlCommentImpl.java | 11 ++- .../source/xml/XmlConditionalSectionImpl.java | 4 +- .../psi/impl/source/xml/XmlDeclImpl.java | 3 +- .../psi/impl/source/xml/XmlDoctypeImpl.java | 15 ++- .../psi/impl/source/xml/XmlDocumentImpl.java | 19 +++- .../source/xml/XmlElementContentSpecImpl.java | 9 +- .../impl/source/xml/XmlElementDeclImpl.java | 15 ++- .../psi/impl/source/xml/XmlElementImpl.java | 10 +- .../psi/impl/source/xml/XmlEntityCache.java | 16 ++++ .../impl/source/xml/XmlEntityDeclImpl.java | 12 ++- .../psi/impl/source/xml/XmlEntityRefImpl.java | 10 +- .../source/xml/XmlEnumeratedTypeImpl.java | 3 +- .../impl/source/xml/XmlMarkupDeclImpl.java | 3 +- .../impl/source/xml/XmlNotationDeclImpl.java | 5 +- .../xml/XmlProcessingInstructionImpl.java | 6 +- .../psi/impl/source/xml/XmlPrologImpl.java | 5 +- .../psi/impl/source/xml/XmlTagValueImpl.java | 8 +- .../psi/impl/source/xml/XmlTextImpl.java | 23 ++++- .../xml/behavior/CDATAOnAnyEncodedPolicy.java | 3 +- .../xml/behavior/DefaultXmlPsiPolicy.java | 3 +- .../com/intellij/psi/xml/XmlChildRole.java | 5 +- .../com/intellij/psi/xml/XmlElementType.java | 3 +- .../com/intellij/xml/DefaultXmlExtension.java | 5 +- .../validate/ValidateXmlActionHandler.java | 9 +- .../xml/impl/BasicXmlAttributeDescriptor.java | 6 +- .../dtd/BaseXmlElementDescriptorImpl.java | 22 ++++- .../impl/dtd/XmlAttributeDescriptorImpl.java | 14 ++- .../impl/dtd/XmlElementDescriptorImpl.java | 19 +++- .../xml/impl/dtd/XmlNSDescriptorImpl.java | 20 +++- .../schema/AnyXmlAttributeDescriptor.java | 15 ++- .../impl/schema/AnyXmlElementDescriptor.java | 16 +++- .../impl/schema/ComplexTypeDescriptor.java | 8 +- .../impl/schema/NamedObjectDescriptor.java | 8 +- .../impl/schema/NullElementDescriptor.java | 16 +++- .../xml/impl/schema/SchemaNSDescriptor.java | 9 +- .../schema/XmlAttributeDescriptorImpl.java | 12 ++- .../schema/XmlElementDescriptorByType.java | 8 +- .../impl/schema/XmlElementDescriptorImpl.java | 19 +++- .../xml/impl/schema/XmlNSDescriptorImpl.java | 21 +++++ .../impl/schema/XsdEnumerationDescriptor.java | 19 ++++ .../xml/index/IndexedRelevantResource.java | 4 +- .../src/com/intellij/xml/index/XmlIndex.java | 8 ++ .../com/intellij/xml/util/HTMLControls.java | 4 +- .../intellij/xml/util/IncludedXmlText.java | 10 +- .../intellij/xml/util/InclusionProvider.java | 3 +- .../xml/util/XmlApplicationComponent.java | 3 +- .../xml/util/XmlNSDescriptorSequence.java | 63 ++++++------- .../src/com/intellij/xml/util/XmlPsiUtil.java | 16 ++++ .../xml/util/XmlResourceResolver.java | 8 +- .../src/com/intellij/xml/util/XmlUtil.java | 7 ++ .../CompositeAttributeTagDescriptor.java | 4 +- .../impl/xml/AbstractXmlTagTreeElement.java | 1 + .../impl/xml/DtdFileTreeElement.java | 7 ++ .../impl/xml/XmlFileTreeElement.java | 2 + .../structureView/Html5SectionsProcessor.java | 5 +- 479 files changed, 3068 insertions(+), 513 deletions(-) diff --git a/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconBuilder.java b/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconBuilder.java index 350fe416980f..098a3e7f9377 100644 --- a/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconBuilder.java +++ b/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconBuilder.java @@ -57,6 +57,7 @@ import java.util.*; public class NavigationGutterIconBuilder { @NonNls private static final String PATTERN = "    {0}"; private static final NotNullFunction> DEFAULT_PSI_CONVERTOR = new NotNullFunction>() { + @Override @NotNull public Collection fun(final PsiElement element) { return ContainerUtil.createMaybeSingletonList(element); @@ -77,6 +78,7 @@ public class NavigationGutterIconBuilder { private NullableFunction myNamer = ElementPresentationManager.namer(); private final NotNullFunction> myGotoRelatedItemProvider; public static final NotNullFunction> DEFAULT_DOM_CONVERTOR = new NotNullFunction>() { + @Override @NotNull public Collection fun(final DomElement o) { return ContainerUtil.createMaybeSingletonList(o.getXmlElement()); @@ -295,6 +297,7 @@ public class NavigationGutterIconBuilder { } return new NotNullLazyValue>() { + @Override @NotNull public List compute() { return calcPsiTargets(project, targets.create(), converter); @@ -359,16 +362,19 @@ public class NavigationGutterIconBuilder { return !myEmpty; } + @Override @NotNull public Icon getIcon() { return myIcon; } + @Override @Nullable public String getTooltipText() { return myTooltipText; } + @Override public Alignment getAlignment() { return myAlignment; } diff --git a/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconRenderer.java b/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconRenderer.java index 84c47f2db646..e4651158fc2c 100644 --- a/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconRenderer.java +++ b/xml/dom-impl/src/com/intellij/codeInsight/navigation/NavigationGutterIconRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,12 +58,14 @@ public abstract class NavigationGutterIconRenderer extends GutterIconRenderer im myPointers = pointers; } + @Override public boolean isNavigateAction() { return true; } public List getTargetElements() { return ContainerUtil.mapNotNull(myPointers.getValue(), new NullableFunction() { + @Override public PsiElement fun(final SmartPsiElementPointer smartPsiElementPointer) { return smartPsiElementPointer.getElement(); } @@ -91,15 +93,18 @@ public abstract class NavigationGutterIconRenderer extends GutterIconRenderer im return result; } + @Override @Nullable public AnAction getClickAction() { return new AnAction() { + @Override public void actionPerformed(AnActionEvent e) { navigate(e == null ? null : (MouseEvent)e.getInputEvent(), null); } }; } + @Override public void navigate(@Nullable final MouseEvent event, @Nullable final PsiElement elt) { final List list = getTargetElements(); if (list.isEmpty()) { diff --git a/xml/dom-impl/src/com/intellij/util/xml/AbstractDomDeclarationSearcher.java b/xml/dom-impl/src/com/intellij/util/xml/AbstractDomDeclarationSearcher.java index f11d5ada84e9..4f3a7cbc2237 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/AbstractDomDeclarationSearcher.java +++ b/xml/dom-impl/src/com/intellij/util/xml/AbstractDomDeclarationSearcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ import org.jetbrains.annotations.Nullable; */ public abstract class AbstractDomDeclarationSearcher extends PomDeclarationSearcher { + @Override public void findDeclarationsAt(@NotNull PsiElement psiElement, int offsetInElement, Consumer consumer) { if (!(psiElement instanceof XmlToken)) return; diff --git a/xml/dom-impl/src/com/intellij/util/xml/DomDocumentationProvider.java b/xml/dom-impl/src/com/intellij/util/xml/DomDocumentationProvider.java index 0daaf2d95612..086141f855b3 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/DomDocumentationProvider.java +++ b/xml/dom-impl/src/com/intellij/util/xml/DomDocumentationProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,14 +29,17 @@ import java.util.List; */ public class DomDocumentationProvider implements DocumentationProvider { + @Override public String getQuickNavigateInfo(final PsiElement element, PsiElement originalElement) { return null; } + @Override public List getUrlFor(final PsiElement element, final PsiElement originalElement) { return null; } + @Override public String generateDoc(PsiElement element, final PsiElement originalElement) { if (element instanceof PomTargetPsiElement) { PomTarget target = ((PomTargetPsiElement)element).getTarget(); @@ -56,10 +59,12 @@ public class DomDocumentationProvider implements DocumentationProvider { return ElementPresentationManager.getDocumentationForElement(domElement); } + @Override public PsiElement getDocumentationElementForLookupItem(final PsiManager psiManager, final Object object, final PsiElement element) { return null; } + @Override public PsiElement getDocumentationElementForLink(final PsiManager psiManager, final String link, final PsiElement context) { return null; } diff --git a/xml/dom-impl/src/com/intellij/util/xml/DomNameSuggestionProvider.java b/xml/dom-impl/src/com/intellij/util/xml/DomNameSuggestionProvider.java index b322d8fc37b8..31ac8c20a04c 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/DomNameSuggestionProvider.java +++ b/xml/dom-impl/src/com/intellij/util/xml/DomNameSuggestionProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ import java.util.Set; * @author Gregory.Shrago */ public class DomNameSuggestionProvider implements NameSuggestionProvider { + @Override public SuggestedNameInfo getSuggestedNames(final PsiElement element, final PsiElement nameSuggestionContext, final Set result) { if (element instanceof PsiMetaOwner) { final PsiMetaData psiMetaData = ((PsiMetaOwner)element).getMetaData(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/DomUsageTypeProvider.java b/xml/dom-impl/src/com/intellij/util/xml/DomUsageTypeProvider.java index 17b61ba22aec..27a85c8d1ea2 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/DomUsageTypeProvider.java +++ b/xml/dom-impl/src/com/intellij/util/xml/DomUsageTypeProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ import org.jetbrains.annotations.Nullable; * @author Gregory.Shrago */ public class DomUsageTypeProvider implements UsageTypeProvider { + @Override @Nullable public UsageType getUsageType(PsiElement element) { final PsiFile psiFile = element.getContainingFile(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/ElementPresentationManagerImpl.java b/xml/dom-impl/src/com/intellij/util/xml/ElementPresentationManagerImpl.java index d1d370d15fac..28cb6c0bde2a 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/ElementPresentationManagerImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/ElementPresentationManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ import java.util.List; */ public class ElementPresentationManagerImpl extends ElementPresentationManager { + @Override @NotNull public Object[] createVariants(Collection elements, Function namer, int iconFlags) { List result = new ArrayList(elements.size()); @@ -43,6 +44,7 @@ public class ElementPresentationManagerImpl extends ElementPresentationManager { return result.toArray(); } + @Override public Object createVariant(final Object variant, final String name, final PsiElement psiElement) { final LookupElementBuilder builder; if (psiElement != null) { diff --git a/xml/dom-impl/src/com/intellij/util/xml/EnumConverter.java b/xml/dom-impl/src/com/intellij/util/xml/EnumConverter.java index edb8521f914c..8f65646a524c 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/EnumConverter.java +++ b/xml/dom-impl/src/com/intellij/util/xml/EnumConverter.java @@ -34,6 +34,7 @@ import java.util.HashSet; */ public class EnumConverter extends ResolvingConverter{ private static final ConcurrentFactoryMap ourCache = new ConcurrentFactoryMap() { + @Override @NotNull protected EnumConverter create(final Class key) { return new EnumConverter(key); @@ -53,18 +54,22 @@ public class EnumConverter extends ResolvingConverter{ return NamedEnumUtil.getEnumValueByElement(anEnum); } + @Override public final T fromString(final String s, final ConvertContext context) { return s==null?null:(T)NamedEnumUtil.getEnumElementByValue((Class)myType, s); } + @Override public final String toString(final T t, final ConvertContext context) { return t == null? null:getStringValue(t); } + @Override public String getErrorMessage(@Nullable final String s, final ConvertContext context) { return CodeInsightBundle.message("error.unknown.enum.value.message", s); } + @Override @NotNull public Collection getVariants(final ConvertContext context) { final XmlElement element = context.getXmlElement(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/ModelMergerImpl.java b/xml/dom-impl/src/com/intellij/util/xml/ModelMergerImpl.java index 6d6e95c4c8a9..7a2698038a8d 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/ModelMergerImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/ModelMergerImpl.java @@ -45,6 +45,7 @@ public class ModelMergerImpl implements ModelMerger { private static final Class MERGED_OBJECT_CLASS = MergedObject.class; private final ConcurrentFactoryMap>> myAcceptsCache = new ConcurrentFactoryMap>>() { + @Override protected List> create(final Method method) { List> result = new ArrayList>(); for (int i = myInvocationStrategies.size() - 1; i >= 0; i--) { @@ -59,10 +60,12 @@ public class ModelMergerImpl implements ModelMerger { public ModelMergerImpl() { addInvocationStrategy(Object.class, new InvocationStrategy() { + @Override public boolean accepts(final Method method) { return true; } + @Override public Object invokeMethod(final JavaMethod javaMethod, final Object proxy, final Object[] args, final List implementations) throws IllegalAccessException, InvocationTargetException { final Method method = javaMethod.getMethod(); @@ -72,10 +75,12 @@ public class ModelMergerImpl implements ModelMerger { }); addInvocationStrategy(Object.class, new InvocationStrategy() { + @Override public boolean accepts(final Method method) { return Collection.class.isAssignableFrom(method.getReturnType()); } + @Override public Object invokeMethod(final JavaMethod method, final Object proxy, final Object[] args, final List implementations) throws IllegalAccessException, InvocationTargetException { @@ -87,10 +92,12 @@ public class ModelMergerImpl implements ModelMerger { addInvocationStrategy(Object.class, new InvocationStrategy() { + @Override public boolean accepts(final Method method) { return Object.class.equals(method.getDeclaringClass()); } + @Override public Object invokeMethod(final JavaMethod method, final Object proxy, final Object[] args, final List implementations) { @NonNls String methodName = method.getName(); if ("toString".equals(methodName)) { @@ -114,10 +121,12 @@ public class ModelMergerImpl implements ModelMerger { }); addInvocationStrategy(Object.class, new InvocationStrategy() { + @Override public boolean accepts(final Method method) { return "isValid".equals(method.getName()); } + @Override public Object invokeMethod(final JavaMethod method, final Object proxy, final Object[] args, final List implementations) throws IllegalAccessException, InvocationTargetException { for (final Object implementation : implementations) { @@ -130,10 +139,12 @@ public class ModelMergerImpl implements ModelMerger { }); addInvocationStrategy(Object.class, new InvocationStrategy() { + @Override public boolean accepts(final Method method) { return void.class.equals(method.getReturnType()); } + @Override public Object invokeMethod(final JavaMethod method, final Object proxy, final Object[] args, final List implementations) throws IllegalAccessException, InvocationTargetException { for (final Object t : implementations) { @@ -144,10 +155,12 @@ public class ModelMergerImpl implements ModelMerger { }); addInvocationStrategy(Object.class, new InvocationStrategy() { + @Override public boolean accepts(final Method method) { return MERGED_OBJECT_CLASS.equals(method.getDeclaringClass()); } + @Override public Object invokeMethod(final JavaMethod method, final Object proxy, final Object[] args, final List implementations) throws IllegalAccessException, InvocationTargetException { assert "getImplementations".equals(method.getName()); @@ -156,10 +169,12 @@ public class ModelMergerImpl implements ModelMerger { }); addInvocationStrategy(DomElement.class, new InvocationStrategy() { + @Override public boolean accepts(final Method method) { return DomInvocationHandler.ACCEPT_METHOD.equals(method); } + @Override public Object invokeMethod(final JavaMethod method, final DomElement proxy, final Object[] args, final List implementations) throws IllegalAccessException, InvocationTargetException { final DomElementVisitor visitor = (DomElementVisitor)args[0]; @@ -169,10 +184,12 @@ public class ModelMergerImpl implements ModelMerger { }); addInvocationStrategy(DomElement.class, new InvocationStrategy() { + @Override public boolean accepts(final Method method) { return DomInvocationHandler.ACCEPT_CHILDREN_METHOD.equals(method); } + @Override public Object invokeMethod(final JavaMethod method, final DomElement proxy, final Object[] args, final List implementations) throws IllegalAccessException, InvocationTargetException { final DomElementVisitor visitor = (DomElementVisitor)args[0]; @@ -191,21 +208,25 @@ public class ModelMergerImpl implements ModelMerger { return javaMethod.getMethod().getAnnotation(Intersect.class) != null; } + @Override public final void addInvocationStrategy(Class aClass, InvocationStrategy strategy) { myInvocationStrategies.add(Pair.create(strategy, aClass)); } + @Override public final void addMergingStrategy(Class aClass, MergingStrategy strategy) { myMergingStrategies.add(strategy); myMergingStrategyClasses.add(aClass); } + @Override public T mergeModels(final Class aClass, final T... implementations) { if (implementations.length == 1) return implementations[0]; final MergingInvocationHandler handler = new MergingInvocationHandler(aClass, Arrays.asList(implementations)); return _mergeModels(aClass, handler, implementations); } + @Override public T mergeModels(final Class aClass, final Collection implementations) { return (T)mergeModels((Class)aClass, implementations.toArray()); } @@ -232,7 +253,7 @@ public class ModelMergerImpl implements ModelMerger { } - private static final Map, Method> ourPrimaryKeyMethods = new HashMap, Method>(); + private static final Map, Method> ourPrimaryKeyMethods = new HashMap, Method>(); public class MergingInvocationHandler implements InvocationHandler { private final Class myClass; @@ -262,6 +283,7 @@ public class ModelMergerImpl implements ModelMerger { throw new AssertionError("impossible"); } + @Override public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable { try { return findStrategy(proxy, method).invokeMethod(getJavaMethod(method), proxy, args, myImplementations); @@ -300,7 +322,7 @@ public class ModelMergerImpl implements ModelMerger { } @Nullable - private static Method getPrimaryKeyMethod(final Class aClass) { + private static Method getPrimaryKeyMethod(final Class aClass) { Method method = ourPrimaryKeyMethods.get(aClass); if (method == null) { if (ourPrimaryKeyMethods.containsKey(aClass)) return null; @@ -332,6 +354,7 @@ public class ModelMergerImpl implements ModelMerger { if (returnType.isInterface()) { final List orderedPrimaryKeys = new SmartList(); final FactoryMap>> map = new FactoryMap>>() { + @Override @NotNull protected List> create(final Object key) { orderedPrimaryKeys.add(key); @@ -339,6 +362,7 @@ public class ModelMergerImpl implements ModelMerger { } }; final FactoryMap counts = new FactoryMap() { + @Override @NotNull protected int[] create(final Object key) { return new int[implementations.size()]; @@ -402,7 +426,7 @@ public class ModelMergerImpl implements ModelMerger { final int index, final List results, final boolean singleValuedInvocation, - final boolean intersect) throws IllegalAccessException, InvocationTargetException { + final boolean intersect) { final Object primaryKey = getPrimaryKey(o, singleValuedInvocation); if (primaryKey != null || singleValuedInvocation) { final List> list = map.get(primaryKey); diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomCollectionProblemDescriptorImpl.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomCollectionProblemDescriptorImpl.java index e6ea34fe2852..9cdfb7f98f10 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomCollectionProblemDescriptorImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomCollectionProblemDescriptorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,6 +47,7 @@ public class DomCollectionProblemDescriptorImpl extends DomElementProblemDescrip return super.toString() + "; " + myChildDescription; } + @Override public DomCollectionChildDescription getChildDescription() { return myChildDescription; } diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementAnnotationHolderImpl.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementAnnotationHolderImpl.java index 55b140a05ff4..4673dfcf1a52 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementAnnotationHolderImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementAnnotationHolderImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,11 +49,13 @@ public class DomElementAnnotationHolderImpl extends SmartList getAnnotations() { if (myAnnotations == null) { @@ -120,6 +125,7 @@ public class DomElementProblemDescriptorImpl implements DomElementProblemDescrip return myAnnotations; } + @Override public void highlightWholeElement() { final PsiElement psiElement = getPsiElement(); if (psiElement instanceof XmlAttributeValue) { @@ -230,6 +236,7 @@ public class DomElementProblemDescriptorImpl implements DomElementProblemDescrip return null; } + @Override @Nullable public ProblemHighlightType getHighlightType() { return myHighlightType; diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptorImpl.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptorImpl.java index cf61ef35a186..e9b436ef40af 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptorImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,16 +40,19 @@ class DomElementResolveProblemDescriptorImpl extends DomElementProblemDescriptor myReference = reference; } + @Override @NotNull public PsiReference getPsiReference() { return myReference; } + @Override @NotNull public GenericDomValue getDomElement() { return (GenericDomValue)super.getDomElement(); } + @Override @NotNull protected Pair computeProblemRange() { final PsiReference reference = myReference; diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsErrorPanel.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsErrorPanel.java index 9a40ed5446cb..b4a3502f223a 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsErrorPanel.java +++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsErrorPanel.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,12 +68,14 @@ public class DomElementsErrorPanel extends JPanel implements CommittablePanel, H addUpdateRequest(); domManager.addDomEventListener(new DomChangeAdapter() { + @Override protected void elementChanged(DomElement element) { addUpdateRequest(); } }, this); } + @Override public void updateHighlighting() { updatePanel(); } @@ -105,8 +107,10 @@ public class DomElementsErrorPanel extends JPanel implements CommittablePanel, H private void addUpdateRequest() { ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override public void run() { myAlarm.addRequest(new Runnable() { + @Override public void run() { if (myProject.isOpen() && !myProject.isDisposed()) { updatePanel(); @@ -117,23 +121,28 @@ public class DomElementsErrorPanel extends JPanel implements CommittablePanel, H }); } + @Override protected void paintComponent(Graphics g) { super.paintComponent(g); myErrorStripeRenderer.paint(this, g, new Rectangle(0, 0, getWidth(), getHeight())); } + @Override public void dispose() { myAlarm.cancelAllRequests(); } + @Override public JComponent getComponent() { return this; } + @Override public void commit() { } + @Override public void reset() { updatePanel(); } @@ -149,6 +158,7 @@ public class DomElementsErrorPanel extends JPanel implements CommittablePanel, H PsiDocumentManager.getInstance(xmlFile.getProject()).getDocument(xmlFile), xmlFile); } + @Override protected DaemonCodeAnalyzerStatus getDaemonCodeAnalyzerStatus(boolean fillErrorsCount, SeverityRegistrar severityRegistrar) { final DaemonCodeAnalyzerStatus status = super.getDaemonCodeAnalyzerStatus(fillErrorsCount, severityRegistrar); if (status != null && isInspectionCompleted()) { @@ -179,6 +189,7 @@ public class DomElementsErrorPanel extends JPanel implements CommittablePanel, H protected boolean isInspectionCompleted() { return ContainerUtil.and(myDomElements, new Condition() { + @Override public boolean value(final DomElement element) { return myAnnotationsManager.getHighlightStatus(element) == DomHighlightStatus.INSPECTIONS_FINISHED; } @@ -187,6 +198,7 @@ public class DomElementsErrorPanel extends JPanel implements CommittablePanel, H protected boolean isErrorAnalyzingFinished() { return ContainerUtil.and(myDomElements, new Condition() { + @Override public boolean value(final DomElement element) { return myAnnotationsManager.getHighlightStatus(element).compareTo(DomHighlightStatus.ANNOTATORS_FINISHED) >= 0; } diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsHighlightingUtil.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsHighlightingUtil.java index 06cfcd327156..6fb09e193270 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsHighlightingUtil.java +++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsHighlightingUtil.java @@ -43,6 +43,7 @@ public class DomElementsHighlightingUtil { public static ProblemDescriptor createProblemDescriptors(final InspectionManager manager, final DomElementProblemDescriptor problemDescriptor) { final ProblemHighlightType type = getProblemHighlightType(problemDescriptor); return createProblemDescriptors(problemDescriptor, new Function, ProblemDescriptor>() { + @Override public ProblemDescriptor fun(final Pair s) { return manager .createProblemDescriptor(s.second, s.first, problemDescriptor.getDescriptionTemplate(), type, true, problemDescriptor.getFixes()); @@ -68,6 +69,7 @@ public class DomElementsHighlightingUtil { public static Annotation createAnnotation(final DomElementProblemDescriptor problemDescriptor) { return createProblemDescriptors(problemDescriptor, new Function, Annotation>() { + @Override public Annotation fun(final Pair s) { String text = problemDescriptor.getDescriptionTemplate(); if (StringUtil.isEmpty(text)) text = null; diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsProblemsHolderImpl.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsProblemsHolderImpl.java index a9f70bcc8ad1..02d494e123f4 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsProblemsHolderImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomElementsProblemsHolderImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,6 +45,7 @@ public class DomElementsProblemsHolderImpl implements DomElementsProblemsHolder private final Function> myDomProblemsGetter = new Function>() { + @Override public List fun(final DomElement s) { final Map, List> map = myCachedErrors.get(s); return map != null ? ContainerUtil.concat(map.values()) : Collections.emptyList(); @@ -54,11 +55,13 @@ public class DomElementsProblemsHolderImpl implements DomElementsProblemsHolder private final DomFileElement myElement; private static final Factory,List>> CONCURRENT_HASH_MAP_FACTORY = new Factory, List>>() { + @Override public Map, List> create() { return new ConcurrentHashMap, List>(); } }; private static final Factory> SMART_LIST_FACTORY = new Factory>() { + @Override public List create() { return new SmartList(); } @@ -79,6 +82,7 @@ public class DomElementsProblemsHolderImpl implements DomElementsProblemsHolder myPassedInspections.add(inspectionClass); } + @Override public final boolean isInspectionCompleted(@NotNull final DomElementsInspection inspection) { return isInspectionCompleted(inspection.getClass()); } @@ -99,16 +103,19 @@ public class DomElementsProblemsHolderImpl implements DomElementsProblemsHolder myCachedChildrenErrors.clear(); } + @Override @NotNull public synchronized List getProblems(DomElement domElement) { if (domElement == null || !domElement.isValid()) return Collections.emptyList(); return myDomProblemsGetter.fun(domElement); } + @Override public List getProblems(final DomElement domElement, boolean includeXmlProblems) { return getProblems(domElement); } + @Override public List getProblems(final DomElement domElement, final boolean includeXmlProblems, final boolean withChildren) { @@ -119,6 +126,7 @@ public class DomElementsProblemsHolderImpl implements DomElementsProblemsHolder return ContainerUtil.concat(getProblemsMap(domElement).values()); } + @Override public List getProblems(DomElement domElement, final boolean includeXmlProblems, final boolean withChildren, @@ -126,8 +134,10 @@ public class DomElementsProblemsHolderImpl implements DomElementsProblemsHolder return getProblems(domElement, withChildren, minSeverity); } + @Override public List getProblems(final DomElement domElement, final boolean withChildren, final HighlightSeverity minSeverity) { return ContainerUtil.findAll(getProblems(domElement, true, withChildren), new Condition() { + @Override public boolean value(final DomElementProblemDescriptor object) { return SeverityRegistrar.getSeverityRegistrar(domElement.getManager().getProject()).compare(object.getHighlightSeverity(), minSeverity) >= 0; } @@ -151,6 +161,7 @@ public class DomElementsProblemsHolderImpl implements DomElementsProblemsHolder mergeMaps(problems, myCachedErrors.get(domElement)); if (DomUtil.hasXml(domElement)) { domElement.acceptChildren(new DomElementVisitor() { + @Override public void visitDomElement(DomElement element) { mergeMaps(problems, getProblemsMap(element)); } @@ -169,10 +180,12 @@ public class DomElementsProblemsHolderImpl implements DomElementsProblemsHolder } } + @Override public List getAllProblems() { return getProblems(myElement, false, true); } + @Override public List getAllProblems(@NotNull DomElementsInspection inspection) { if (!myElement.isValid()) { return Collections.emptyList(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomHighlightingHelperImpl.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomHighlightingHelperImpl.java index 3330f90c5c77..b9f49b22f81b 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomHighlightingHelperImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/DomHighlightingHelperImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,6 +56,7 @@ public class DomHighlightingHelperImpl extends DomHighlightingHelper { private final GenericValueReferenceProvider myProvider = new GenericValueReferenceProvider(); private final DomApplicationComponent myDomApplicationComponent = DomApplicationComponent.getInstance(); + @Override public void runAnnotators(DomElement element, DomElementAnnotationHolder holder, Class rootClass) { final DomElementsAnnotator annotator = myDomApplicationComponent.getAnnotator(rootClass); if (annotator != null) { @@ -63,6 +64,7 @@ public class DomHighlightingHelperImpl extends DomHighlightingHelper { } } + @Override @NotNull public List checkRequired(final DomElement element, final DomElementAnnotationHolder holder) { final Required required = element.getAnnotation(Required.class); @@ -105,6 +107,7 @@ public class DomHighlightingHelperImpl extends DomHighlightingHelper { return Collections.emptyList(); } + @Override @NotNull public List checkResolveProblems(GenericDomValue element, final DomElementAnnotationHolder holder) { if (StringUtil.isEmpty(element.getStringValue())) { @@ -156,6 +159,7 @@ public class DomHighlightingHelperImpl extends DomHighlightingHelper { converter instanceof ResolvingConverter && ((ResolvingConverter)converter).getAdditionalVariants(domReference.getConvertContext()).contains(element.getStringValue()); } + @Override @NotNull public List checkNameIdentity(DomElement element, final DomElementAnnotationHolder holder) { final String elementName = ElementPresentationManager.getElementName(element); @@ -243,33 +247,40 @@ public class DomHighlightingHelperImpl extends DomHighlightingHelper { parentTag = _parentTag; } + @Override @NotNull public String getName() { return XmlBundle.message("insert.required.tag.fix", tagName); } + @Override @NotNull public String getText() { return getName(); } + @Override @NotNull public String getFamilyName() { return getName(); } + @Override public boolean isAvailable(@NotNull final Project project, final Editor editor, final PsiFile file) { return true; } + @Override public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException { doFix(); } + @Override public boolean startInWriteAction() { return true; } + @Override public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) { doFix(); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/MockAnnotatingDomInspection.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/MockAnnotatingDomInspection.java index 0f9863299cbd..32d42f2a81ff 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/MockAnnotatingDomInspection.java +++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/MockAnnotatingDomInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,24 +29,28 @@ public class MockAnnotatingDomInspection extends BasicDomE super(domClass); } + @Override protected void checkDomElement(DomElement element, DomElementAnnotationHolder holder, DomHighlightingHelper helper) { for (final Class aClass : getDomClasses()) { helper.runAnnotators(element, holder, aClass); } } + @Override @Nls @NotNull public String getGroupDisplayName() { throw new UnsupportedOperationException("Method getGroupDisplayName is not yet implemented in " + getClass().getName()); } + @Override @Nls @NotNull public String getDisplayName() { throw new UnsupportedOperationException("Method getDisplayName is not yet implemented in " + getClass().getName()); } + @Override @NonNls @NotNull public String getShortName() { diff --git a/xml/dom-impl/src/com/intellij/util/xml/highlighting/MockDomInspection.java b/xml/dom-impl/src/com/intellij/util/xml/highlighting/MockDomInspection.java index 85460928a068..3bd26c4d0ac1 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/highlighting/MockDomInspection.java +++ b/xml/dom-impl/src/com/intellij/util/xml/highlighting/MockDomInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,18 +29,21 @@ public class MockDomInspection extends BasicDomElementsIns super(domClass); } + @Override @Nls @NotNull public String getGroupDisplayName() { throw new UnsupportedOperationException("Method getGroupDisplayName is not yet implemented in " + getClass().getName()); } + @Override @Nls @NotNull public String getDisplayName() { throw new UnsupportedOperationException("Method getDisplayName is not yet implemented in " + getClass().getName()); } + @Override @NonNls @NotNull public String getShortName() { diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/AbstractDomChildDescriptionImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/AbstractDomChildDescriptionImpl.java index 20a9702cc56c..9a9dc53329af 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/AbstractDomChildDescriptionImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/AbstractDomChildDescriptionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,6 @@ import com.intellij.openapi.util.NullableLazyValue; import com.intellij.pom.references.PomService; import com.intellij.psi.PsiElement; import com.intellij.psi.SmartPsiElementPointer; -import com.intellij.util.xml.Stubbed; import com.intellij.util.ReflectionUtil; import com.intellij.util.xml.*; import com.intellij.util.xml.reflect.AbstractDomChildrenDescription; @@ -100,15 +99,18 @@ public abstract class AbstractDomChildDescriptionImpl implements AbstractDomChil myUserMap = userMap; } + @Override @Nullable public T getAnnotation(final Class annotationClass) { return myCustomAnnotations == null ? null : (T)myCustomAnnotations.get(annotationClass); } + @Override public T getUserData(final Key key) { return myUserMap == null ? null : (T)myUserMap.get(key); } + @Override @NotNull public final List getStableValues(@NotNull final DomElement parent) { final List list = getValues(parent); @@ -117,6 +119,7 @@ public abstract class AbstractDomChildDescriptionImpl implements AbstractDomChil for (int i = 0; i < list.size(); i++) { final int i1 = i; result.add(domManager.createStableValue(new Factory() { + @Override @Nullable public DomElement create() { if (!parent.isValid()) return null; @@ -130,11 +133,13 @@ public abstract class AbstractDomChildDescriptionImpl implements AbstractDomChil } + @Override @NotNull public final Type getType() { return myType; } + @Override @NotNull public DomNameStrategy getDomNameStrategy(@NotNull DomElement parent) { final DomNameStrategy strategy = DomImplUtil.getDomNameStrategy(ReflectionUtil.getRawType(getType()), false); @@ -166,6 +171,7 @@ public abstract class AbstractDomChildDescriptionImpl implements AbstractDomChil return myPresentationTemplate.getValue(); } + @Override @Nullable public PsiElement getDeclaration(final Project project) { DomElement domDeclaration = getDomDeclaration(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/AddChildInvocation.java b/xml/dom-impl/src/com/intellij/util/xml/impl/AddChildInvocation.java index 2bca8dd84e92..c7cbd2c0c67d 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/AddChildInvocation.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/AddChildInvocation.java @@ -38,6 +38,7 @@ public class AddChildInvocation implements Invocation{ myType = type; } + @Override public Object invoke(final DomInvocationHandler handler, final Object[] args) throws Throwable { return handler.addCollectionChild(myDescription, myClassGetter.fun(args), myIndexGetter.fun(args)); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/AddToCompositeCollectionInvocation.java b/xml/dom-impl/src/com/intellij/util/xml/impl/AddToCompositeCollectionInvocation.java index da04e8edd1df..0f8af9b81c01 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/AddToCompositeCollectionInvocation.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/AddToCompositeCollectionInvocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,6 +36,7 @@ class AddToCompositeCollectionInvocation implements Invocation { myType = type; } + @Override public Object invoke(final DomInvocationHandler handler, final Object[] args) throws Throwable { Set set = ContainerUtil.newTroveSet(); for (final CollectionChildDescriptionImpl qname : myQnames) { diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/AttributeChildDescriptionImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/AttributeChildDescriptionImpl.java index 076ab2812d09..945af2258c12 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/AttributeChildDescriptionImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/AttributeChildDescriptionImpl.java @@ -43,6 +43,7 @@ public class AttributeChildDescriptionImpl extends DomChildDescriptionImpl imple myGetterMethod = null; } + @Override @NotNull public DomNameStrategy getDomNameStrategy(@NotNull DomElement parent) { final DomNameStrategy strategy = DomImplUtil.getDomNameStrategy(ReflectionUtil.getRawType(getType()), true); @@ -50,6 +51,7 @@ public class AttributeChildDescriptionImpl extends DomChildDescriptionImpl imple } + @Override public final JavaMethod getGetterMethod() { return myGetterMethod; } @@ -59,22 +61,26 @@ public class AttributeChildDescriptionImpl extends DomChildDescriptionImpl imple return "Attribute:" + getXmlName(); } + @Override @Nullable public T getAnnotation(Class annotationClass) { final JavaMethod method = getGetterMethod(); return method == null ? super.getAnnotation(annotationClass) : method.getAnnotation(annotationClass); } + @Override @NotNull public List getValues(@NotNull DomElement parent) { return Arrays.asList(getDomAttributeValue(parent)); } + @Override @NotNull public String getCommonPresentableName(@NotNull DomNameStrategy strategy) { throw new UnsupportedOperationException("Method getCommonPresentableName is not yet implemented in " + getClass().getName()); } + @Override public GenericAttributeValue getDomAttributeValue(DomElement parent) { final DomInvocationHandler handler = DomManagerImpl.getDomInvocationHandler(parent); if (handler != null) { diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/AttributeChildInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/AttributeChildInvocationHandler.java index 42099493d27d..c98e9319c414 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/AttributeChildInvocationHandler.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/AttributeChildInvocationHandler.java @@ -48,17 +48,21 @@ public class AttributeChildInvocationHandler extends DomInvocationHandler T createStableCopy() { final DomElement parentCopy = getParent().createStableCopy(); return getManager().createStableValue(new Factory() { + @Override public T create() { return parentCopy.isValid() ? (T) getChildDescription().getValues(parentCopy).get(0) : null; } }); } + @Override public final void undefineInternal() { final XmlTag tag = getXmlTag(); if (tag != null) { getManager().runChange(new Runnable() { + @Override public void run() { try { setXmlElement(null); @@ -130,18 +139,21 @@ public class AttributeChildInvocationHandler extends DomInvocationHandler myGetterMethods; private final NotNullFunction> myTagsGetter = new NotNullFunction>() { + @Override @NotNull public List fun(final DomInvocationHandler handler) { XmlTag tag = handler.getXmlTag(); @@ -65,6 +66,7 @@ public class CollectionChildDescriptionImpl extends DomChildDescriptionImpl impl return myTagsGetter; } + @Override public DomElement addValue(@NotNull DomElement element) { assert element.getGenericInfo().getCollectionChildrenDescriptions().contains(this); return addChild(element, getType(), Integer.MAX_VALUE); @@ -81,24 +83,29 @@ public class CollectionChildDescriptionImpl extends DomChildDescriptionImpl impl } } + @Override public DomElement addValue(@NotNull DomElement element, int index) { return addChild(element, getType(), index); } + @Override public DomElement addValue(@NotNull DomElement parent, Type type) { return addValue(parent, type, Integer.MAX_VALUE); } + @Override public final DomElement addValue(@NotNull DomElement parent, Type type, int index) { return addChild(parent, type, index); } + @Override @Nullable public final JavaMethod getGetterMethod() { final Collection methods = myGetterMethods; return methods.isEmpty() ? null : methods.iterator().next(); } + @Override @NotNull public List getValues(@NotNull final DomElement element) { final DomInvocationHandler handler = DomManagerImpl.getDomInvocationHandler(element); @@ -109,6 +116,7 @@ public class CollectionChildDescriptionImpl extends DomChildDescriptionImpl impl if (getterMethod == null) { final Collection collection = ModelMergerUtil.getFilteredImplementations(element); return ContainerUtil.concat(collection, new Function>() { + @Override public Collection fun(final DomElement domElement) { final DomInvocationHandler handler = DomManagerImpl.getDomInvocationHandler(domElement); assert handler != null : domElement; @@ -119,12 +127,14 @@ public class CollectionChildDescriptionImpl extends DomChildDescriptionImpl impl return (List)getterMethod.invoke(element, ArrayUtil.EMPTY_OBJECT_ARRAY); } + @Override @NotNull public String getCommonPresentableName(@NotNull DomNameStrategy strategy) { String words = strategy.splitIntoWords(getXmlElementName()); return StringUtil.capitalizeWords(words.endsWith("es") ? words: StringUtil.pluralize(words), true); } + @Override @Nullable public T getAnnotation(Class annotationClass) { final JavaMethod method = getGetterMethod(); @@ -137,10 +147,12 @@ public class CollectionChildDescriptionImpl extends DomChildDescriptionImpl impl return elemType instanceof AnnotatedElement ? ((AnnotatedElement)elemType).getAnnotation(annotationClass) : super.getAnnotation(annotationClass); } + @Override public List getSubTags(final DomInvocationHandler handler, final XmlTag[] subTags, final XmlFile file) { return DomImplUtil.findSubTags(subTags, handler.createEvaluatedXmlName(getXmlName()), file); } + @Override public EvaluatedXmlName createEvaluatedXmlName(final DomInvocationHandler parent, final XmlTag childTag) { return parent.createEvaluatedXmlName(getXmlName()); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/CollectionElementInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/CollectionElementInvocationHandler.java index 7e294bd9eb9f..e30246ee6191 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/CollectionElementInvocationHandler.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/CollectionElementInvocationHandler.java @@ -50,10 +50,12 @@ public class CollectionElementInvocationHandler extends DomInvocationHandler() { + @Override @Nullable public DomElement create() { if (parentCopy.isValid()) { diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertAnnotationImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertAnnotationImpl.java index 2fcb9ebe2507..cd536620ec4f 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertAnnotationImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertAnnotationImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ public class ConvertAnnotationImpl implements Convert { mySoft = soft; } + @Override public Class annotationType() { return Convert.class; } @@ -40,10 +41,12 @@ public class ConvertAnnotationImpl implements Convert { return myConverter; } + @Override public Class value() { return myConverter.getClass(); } + @Override public boolean soft() { return mySoft; } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertContextFactory.java b/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertContextFactory.java index 00035b823307..07d8a033ffbe 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertContextFactory.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertContextFactory.java @@ -21,6 +21,7 @@ import com.intellij.util.xml.DomElement; public class ConvertContextFactory { public static ConvertContext createConvertContext(final DomElement element) { return new ConvertContextImpl(DomManagerImpl.getDomInvocationHandler(element)) { + @Override public DomElement getInvocationElement() { return element; } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertContextImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertContextImpl.java index 6478ba4b1f97..8c21795e6e7f 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertContextImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/ConvertContextImpl.java @@ -35,15 +35,18 @@ public class ConvertContextImpl extends AbstractConvertContext { this(DomManagerImpl.getDomInvocationHandler(element)); } + @Override @NotNull public DomElement getInvocationElement() { return myHandler.getProxy(); } + @Override public PsiManager getPsiManager() { return myHandler.getFile().getManager(); } + @Override public Module getModule() { final DomElement domElement = getInvocationElement(); if (domElement.getManager().isMockElement(domElement)) { diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/ConverterManagerImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/ConverterManagerImpl.java index 199ec2646ff5..ef2bfc446739 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/ConverterManagerImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/ConverterManagerImpl.java @@ -52,10 +52,12 @@ class ConverterManagerImpl implements ConverterManager { mySimpleConverters.put(PathReference.class, PathReferenceConverter.INSTANCE); } + @Override public void addConverter(Class clazz, Converter converter) { mySimpleConverters.put(clazz, converter); } + @Override @NotNull public final Converter getConverterInstance(final Class converterClass) { Converter converter = getInstance(converterClass); @@ -67,6 +69,7 @@ class ConverterManagerImpl implements ConverterManager { return (T)myConverterInstances.get(clazz); } + @Override @Nullable public final Converter getConverterByClass(final Class convertingClass) { final Converter converter = mySimpleConverters.get(convertingClass); @@ -83,6 +86,7 @@ class ConverterManagerImpl implements ConverterManager { return null; } + @Override public void registerConverterImplementation(Class converterInterface, T converterImpl) { myConverterInstances.put(converterInterface, converterImpl); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/CustomDomChildrenDescriptionImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/CustomDomChildrenDescriptionImpl.java index b99eda0c7a09..b0e5d8ab9c29 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/CustomDomChildrenDescriptionImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/CustomDomChildrenDescriptionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,6 +35,7 @@ import java.util.List; public class CustomDomChildrenDescriptionImpl extends AbstractDomChildDescriptionImpl implements CustomDomChildrenDescription, AbstractCollectionChildDescription { @Nullable private final JavaMethod myGetter; public static final NotNullFunction> CUSTOM_TAGS_GETTER = new NotNullFunction>() { + @Override @NotNull public List fun(final DomInvocationHandler handler) { return DomImplUtil.getCustomSubTags(handler, handler.getXmlTag().getSubTags(), handler.getFile()); @@ -75,6 +76,7 @@ public class CustomDomChildrenDescriptionImpl extends AbstractDomChildDescriptio return parent.getCollectionChildren(this, CUSTOM_TAGS_GETTER); } + @Override @NotNull public List getValues(@NotNull final DomElement parent) { final DomInvocationHandler handler = DomManagerImpl.getDomInvocationHandler(parent); @@ -84,14 +86,17 @@ public class CustomDomChildrenDescriptionImpl extends AbstractDomChildDescriptio return (List)myGetter.invoke(parent, ArrayUtil.EMPTY_OBJECT_ARRAY); } + @Override public int compareTo(final AbstractDomChildDescriptionImpl o) { return equals(o) ? 0 : -1; } + @Override public List getSubTags(final DomInvocationHandler handler, final XmlTag[] subTags, final XmlFile file) { return DomImplUtil.getCustomSubTags(handler, subTags, file); } + @Override public EvaluatedXmlName createEvaluatedXmlName(final DomInvocationHandler parent, final XmlTag childTag) { return new DummyEvaluatedXmlName(childTag.getLocalName(), childTag.getNamespace()); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomAnnotator.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomAnnotator.java index 3b52e145d996..cff0b24831b3 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomAnnotator.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomAnnotator.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,6 +63,7 @@ public class DefaultDomAnnotator implements Annotator { } + @Override public void annotate(@NotNull final PsiElement psiElement, @NotNull AnnotationHolder holder) { final List list = (List)holder; diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomTargetDescriptionProvider.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomTargetDescriptionProvider.java index dd016e721397..a31aaea1f5bc 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomTargetDescriptionProvider.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomTargetDescriptionProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ import org.jetbrains.annotations.NotNull; * @author peter */ public class DefaultDomTargetDescriptionProvider extends PomDescriptionProvider { + @Override public String getElementDescription(@NotNull PomTarget element, @NotNull ElementDescriptionLocation location) { if (!(element instanceof DomTarget)) return null; diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomTargetIconProvider.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomTargetIconProvider.java index e5540c1f25d5..6add1e8ebca4 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomTargetIconProvider.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DefaultDomTargetIconProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import javax.swing.*; * @author peter */ public class DefaultDomTargetIconProvider extends DomIconProvider implements DumbAware { + @Override public Icon getIcon(@NotNull DomElement element, int flags) { Icon icon = element.getPresentation().getIcon(); return icon == null ? ElementPresentationManager.getIconOld(element) : icon; diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java index c93552557c70..94a35842baa6 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomAnchorImpl.java @@ -140,9 +140,11 @@ public abstract class DomAnchorImpl implements DomAnchor implements DomAnchor implements DomAnchor implements DomAnchor implements DomAnchor implements DomAnchor fileElement = DomManager.getDomManager(myFile.getProject()).getFileElement(myFile, myClass); return fileElement == null ? null : fileElement.getRootElement(); } + @Override @NotNull public XmlFile getContainingFile() { return myFile; diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomApplicationComponent.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomApplicationComponent.java index c2687fddc860..061ab6ac83c4 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomApplicationComponent.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomApplicationComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,6 +43,7 @@ import static com.intellij.util.containers.ContainerUtil.newArrayList; */ public class DomApplicationComponent { private final FactoryMap> myRootTagName2FileDescription = new FactoryMap>() { + @Override protected Set create(final String key) { return new THashSet(); } @@ -76,6 +77,7 @@ public class DomApplicationComponent { }); private final ConcurrentFactoryMap, VisitorDescription> myVisitorDescriptions = new ConcurrentFactoryMap, VisitorDescription>() { + @Override @NotNull protected VisitorDescription create(final Class key) { return new VisitorDescription(key); diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomChildDescriptionImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomChildDescriptionImpl.java index 90ce7d2950a0..d53fbd04798d 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomChildDescriptionImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomChildDescriptionImpl.java @@ -33,20 +33,24 @@ public abstract class DomChildDescriptionImpl extends AbstractDomChildDescriptio myTagName = tagName; } + @Override public String getName() { return myTagName.getLocalName(); } + @Override @NotNull public String getXmlElementName() { return myTagName.getLocalName(); } + @Override @NotNull public final XmlName getXmlName() { return myTagName; } + @Override @NotNull public String getCommonPresentableName(@NotNull DomElement parent) { return getCommonPresentableName(getDomNameStrategy(parent)); @@ -69,6 +73,7 @@ public abstract class DomChildDescriptionImpl extends AbstractDomChildDescriptio return result; } + @Override public int compareTo(final AbstractDomChildDescriptionImpl o) { return o instanceof DomChildDescriptionImpl ? myTagName.compareTo(((DomChildDescriptionImpl)o).myTagName) : 1; } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomDeclarationSearcher.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomDeclarationSearcher.java index 937cec88b61e..2235f7b52ae3 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomDeclarationSearcher.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomDeclarationSearcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import org.jetbrains.annotations.Nullable; */ public class DomDeclarationSearcher extends AbstractDomDeclarationSearcher { + @Override @Nullable protected DomTarget createDomTarget(DomElement parent, DomElement nameElement) { final NameValue nameValue = nameElement.getAnnotation(NameValue.class); diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomDescriptorProvider.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomDescriptorProvider.java index 9fe2273d9a83..64c797cb69f6 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomDescriptorProvider.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomDescriptorProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ import org.jetbrains.annotations.Nullable; */ public class DomDescriptorProvider implements XmlElementDescriptorProvider { + @Override @Nullable public XmlElementDescriptor getDescriptor(final XmlTag tag) { Project project = tag.getProject(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomElementsNavigationManagerImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomElementsNavigationManagerImpl.java index 6744005c2c63..a551133bfdc3 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomElementsNavigationManagerImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomElementsNavigationManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,6 +43,7 @@ public class DomElementsNavigationManagerImpl extends DomElementsNavigationManag myProviders.put(myTextEditorProvider.getProviderName(), myTextEditorProvider); } + @Override public Set getDomElementsNavigateProviders(DomElement domElement) { Set result = new HashSet(); @@ -52,20 +53,24 @@ public class DomElementsNavigationManagerImpl extends DomElementsNavigationManag return result; } + @Override public DomElementNavigationProvider getDomElementsNavigateProvider(String providerName) { return myProviders.get(providerName); } + @Override public void registerDomElementsNavigateProvider(DomElementNavigationProvider provider) { myProviders.put(provider.getProviderName(), provider); } private class MyDomElementNavigateProvider extends DomElementNavigationProvider { + @Override public String getProviderName() { return DEFAULT_PROVIDER_NAME; } + @Override public void navigate(DomElement domElement, boolean requestFocus) { if (!domElement.isValid()) return; @@ -84,6 +89,7 @@ public class DomElementsNavigationManagerImpl extends DomElementsNavigationManag FileEditorManagerEx.getInstanceEx(myProject).openTextEditor(fileDescriptor, requestFocus); } + @Override public boolean canNavigate(DomElement domElement) { return domElement != null && domElement.isValid(); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomFileElementImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomFileElementImpl.java index ea02aa888f83..b1546cbd5a46 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomFileElementImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomFileElementImpl.java @@ -18,6 +18,7 @@ package com.intellij.util.xml.impl; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleUtil; +import com.intellij.openapi.module.ModuleUtilCore; import com.intellij.openapi.util.Factory; import com.intellij.openapi.util.Key; import com.intellij.psi.search.GlobalSearchScope; @@ -47,74 +48,89 @@ public class DomFileElementImpl implements DomFileElement< private static final Logger LOG = Logger.getInstance("#com.intellij.util.xml.impl.DomFileElementImpl"); private static final DomGenericInfo EMPTY_DOM_GENERIC_INFO = new DomGenericInfo() { + @Override @Nullable public XmlElement getNameElement(DomElement element) { return null; } + @Override @Nullable public GenericDomValue getNameDomElement(DomElement element) { return null; } + @Override @NotNull public List getCustomNameChildrenDescription() { return Collections.emptyList(); } + @Override @Nullable public String getElementName(DomElement element) { return null; } + @Override @NotNull public List getChildrenDescriptions() { return Collections.emptyList(); } + @Override @NotNull public List getFixedChildrenDescriptions() { return Collections.emptyList(); } + @Override @NotNull public List getCollectionChildrenDescriptions() { return Collections.emptyList(); } + @Override @NotNull public List getAttributeChildrenDescriptions() { return Collections.emptyList(); } + @Override public boolean isTagValueElement() { return false; } + @Override @Nullable public DomFixedChildDescription getFixedChildDescription(String tagName) { return null; } + @Override @Nullable public DomFixedChildDescription getFixedChildDescription(@NonNls String tagName, @NonNls String namespace) { return null; } + @Override @Nullable public DomCollectionChildDescription getCollectionChildDescription(String tagName) { return null; } + @Override @Nullable public DomCollectionChildDescription getCollectionChildDescription(@NonNls String tagName, @NonNls String namespace) { return null; } + @Override public DomAttributeChildDescription getAttributeChildDescription(String attributeName) { return null; } + @Override @Nullable public DomAttributeChildDescription getAttributeChildDescription(@NonNls String attributeName, @NonNls String namespace) { return null; @@ -144,16 +160,19 @@ public class DomFileElementImpl implements DomFileElement< stub == null ? null : stub.getRootTagStub()); } + @Override @NotNull public final XmlFile getFile() { return myFile; } + @Override @NotNull public XmlFile getOriginalFile() { return (XmlFile)myFile.getOriginalFile(); } + @Override @Nullable public XmlTag getRootTag() { if (!myFile.isValid()) { @@ -195,65 +214,80 @@ public class DomFileElementImpl implements DomFileElement< return result; } + @Override @NotNull public final DomManagerImpl getManager() { return myManager; } + @Override public final Type getDomElementType() { return getClass(); } + @Override @NotNull public AbstractDomChildrenDescription getChildDescription() { throw new UnsupportedOperationException("Method getChildDescription is not yet implemented in " + getClass().getName()); } + @Override public DomNameStrategy getNameStrategy() { return getRootHandler().getNameStrategy(); } + @Override @NotNull public ElementPresentation getPresentation() { return new ElementPresentation() { + @Override public @NonNls String getElementName() { return ""; } + @Override public @NonNls String getTypeName() { return ""; } + @Override public Icon getIcon() { return null; } }; } + @Override public GlobalSearchScope getResolveScope() { return myFile.getResolveScope(); } + @Override @Nullable public T getParentOfType(Class requiredClass, boolean strict) { return DomFileElement.class.isAssignableFrom(requiredClass) && !strict ? (T)this : null; } + @Override public Module getModule() { - return ModuleUtil.findModuleForPsiElement(getFile()); + return ModuleUtilCore.findModuleForPsiElement(getFile()); } + @Override public void copyFrom(DomElement other) { throw new UnsupportedOperationException("Method copyFrom is not yet implemented in " + getClass().getName()); } + @Override public final T createMockCopy(final boolean physical) { throw new UnsupportedOperationException("Method createMockCopy is not yet implemented in " + getClass().getName()); } + @Override public final T createStableCopy() { return myManager.createStableValue(new Factory() { + @Override @Nullable public T create() { return (T)myManager.getFileElement(myFile); @@ -261,17 +295,20 @@ public class DomFileElementImpl implements DomFileElement< }); } + @Override @NotNull public String getXmlElementNamespace() { return ""; } + @Override @Nullable @NonNls public String getXmlElementNamespaceKey() { return null; } + @Override @NotNull public final T getRootElement() { if (!isValid()) { @@ -291,11 +328,13 @@ public class DomFileElementImpl implements DomFileElement< return (T)getRootHandler().getProxy(); } + @Override @NotNull public Class getRootElementClass() { return myRootElementClass; } + @Override @NotNull public DomFileDescription getFileDescription() { return myFileDescription; @@ -310,10 +349,12 @@ public class DomFileElementImpl implements DomFileElement< return "File " + myFile.toString(); } + @Override public T getAnnotation(Class annotationClass) { return null; } + @Override public final XmlTag getXmlTag() { return null; } @@ -323,26 +364,32 @@ public class DomFileElementImpl implements DomFileElement< return (DomFileElementImpl)this; } + @Override @Nullable public DomElement getParent() { return null; } + @Override public final XmlTag ensureTagExists() { return null; } + @Override public final XmlElement getXmlElement() { return getFile(); } + @Override public final XmlElement ensureXmlElementExists() { return ensureTagExists(); } + @Override public void undefine() { } + @Override public final boolean isValid() { return checkValidity() == null; } @@ -364,32 +411,39 @@ public class DomFileElementImpl implements DomFileElement< return null; } + @Override @NotNull public final DomGenericInfo getGenericInfo() { return EMPTY_DOM_GENERIC_INFO; } + @Override @NotNull public String getXmlElementName() { return ""; } + @Override public void accept(final DomElementVisitor visitor) { myManager.getApplicationComponent().getVisitorDescription(visitor.getClass()).acceptElement(visitor, this); } + @Override public void acceptChildren(DomElementVisitor visitor) { getRootElement().accept(visitor); } + @Override public T getUserData(@NotNull Key key) { return (T)myUserData.get(key); } + @Override public void putUserData(@NotNull Key key, T value) { myUserData.put(key, value); } + @Override public final long getModificationCount() { return myFile.getModificationStamp(); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomGenericInfoEx.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomGenericInfoEx.java index 64ffab046f8a..918469068209 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomGenericInfoEx.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomGenericInfoEx.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,6 +38,7 @@ public abstract class DomGenericInfoEx implements DomGenericInfo { @Nullable public abstract Invocation createInvocation(final JavaMethod method); + @Override @NotNull public abstract List getAttributeChildrenDescriptions(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomImplUtil.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomImplUtil.java index a5e38a39b6c4..66507138ed2d 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomImplUtil.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomImplUtil.java @@ -152,6 +152,7 @@ public class DomImplUtil { } return ContainerUtil.findAll(tags, new Condition() { + @Override public boolean value(XmlTag childTag) { try { return isNameSuitable(name, childTag.getLocalName(), childTag.getName(), childTag.getNamespace(), file); @@ -176,6 +177,7 @@ public class DomImplUtil { } return ContainerUtil.findAll(tags, new Condition() { + @Override public boolean value(XmlTag childTag) { return isNameSuitable(name, childTag, file); } @@ -272,6 +274,7 @@ public class DomImplUtil { usedNames.add(description.getXmlName()); } return ContainerUtil.findAll(subTags, new Condition() { + @Override public boolean value(final XmlTag tag) { if (StringUtil.isEmpty(tag.getName())) return false; diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java index af3aef0a9f10..bdad1cf47d75 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomInvocationHandler.java @@ -18,6 +18,7 @@ package com.intellij.util.xml.impl; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleUtil; +import com.intellij.openapi.module.ModuleUtilCore; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.util.NullableFactory; import com.intellij.openapi.util.Pair; @@ -108,6 +109,7 @@ public abstract class DomInvocationHandler T createStableCopy() { XmlTag tag = getXmlTag(); if (tag != null && tag.isPhysical()) { @@ -221,12 +228,14 @@ public abstract class DomInvocationHandler T createMockCopy(final boolean physical) { final T copy = myManager.createMockElement((Class)getRawType(), getProxy().getModule(), physical); copy.copyFrom(getProxy()); return copy; } + @Override @NotNull public String getXmlElementNamespace() { final DomInvocationHandler parent = getParentHandler(); @@ -236,16 +245,19 @@ public abstract class DomInvocationHandler T getAnnotation(final Class annotationClass) { final AnnotatedElement childDescription = getChildDescription(); @@ -529,6 +552,7 @@ public abstract class DomInvocationHandler rawType = getRawType(); @@ -544,6 +568,7 @@ public abstract class DomInvocationHandler T getParentOfType(Class requiredClass, boolean strict) { return _getParentOfType(requiredClass, strict ? getParent() : getProxy()); } @@ -643,6 +673,7 @@ public abstract class DomInvocationHandler myDeletionEvents = new SmartList(); + @Override public void contentsChanged(@NotNull VirtualFileEvent event) { if (!event.isFromSave()) { fireEvents(calcDomChangeEvents(event.getFile())); @@ -126,10 +129,12 @@ public final class DomManagerImpl extends DomManager { fireEvents(calcDomChangeEvents(event.getFile())); } + @Override public void beforeFileDeletion(@NotNull final VirtualFileEvent event) { myDeletionEvents.addAll(calcDomChangeEvents(event.getFile())); } + @Override public void fileDeleted(@NotNull VirtualFileEvent event) { if (!myDeletionEvents.isEmpty()) { fireEvents(myDeletionEvents); @@ -137,6 +142,7 @@ public final class DomManagerImpl extends DomManager { } } + @Override public void propertyChanged(@NotNull VirtualFilePropertyEvent event) { final VirtualFile file = event.getFile(); if (!file.isDirectory() && VirtualFile.PROP_NAME.equals(event.getPropertyName())) { @@ -193,18 +199,22 @@ public final class DomManagerImpl extends DomManager { return (DomManagerImpl)DomManager.getDomManager(project); } + @Override public void addDomEventListener(DomEventListener listener, Disposable parentDisposable) { myListeners.addListener(listener, parentDisposable); } + @Override public final ConverterManager getConverterManager() { return ServiceManager.getService(ConverterManager.class); } + @Override public final void addPsiReferenceFactoryForClass(Class clazz, PsiReferenceFactory psiReferenceFactory) { myGenericValueReferenceProvider.addReferenceProviderForClass(clazz, psiReferenceFactory); } + @Override public final ModelMerger createModelMerger() { return new ModelMergerImpl(); } @@ -221,6 +231,7 @@ public final class DomManagerImpl extends DomManager { } } + @Override public final DomGenericInfo getGenericInfo(final Type type) { return myApplicationComponent.getStaticGenericInfo(type); } @@ -262,10 +273,12 @@ public final class DomManagerImpl extends DomManager { return myApplicationComponent; } + @Override public final Project getProject() { return myProject; } + @Override @NotNull public final DomFileElementImpl getFileElement(final XmlFile file, final Class aClass, String rootTagName) { //noinspection unchecked @@ -319,6 +332,7 @@ public final class DomManagerImpl extends DomManager { return oldChanging; } + @Override @Nullable public final DomFileElementImpl getFileElement(XmlFile file) { if (file == null) return null; @@ -334,6 +348,7 @@ public final class DomManagerImpl extends DomManager { return SoftReference.dereference(file.getUserData(CACHED_FILE_ELEMENT)); } + @Override @Nullable public final DomFileElementImpl getFileElement(XmlFile file, Class domClass) { final DomFileDescription description = getDomFileDescription(file); @@ -343,6 +358,7 @@ public final class DomManagerImpl extends DomManager { return null; } + @Override @Nullable public final DomElement getDomElement(final XmlTag element) { if (myChanging) return null; @@ -351,6 +367,7 @@ public final class DomManagerImpl extends DomManager { return handler != null ? handler.getProxy() : null; } + @Override @Nullable public GenericAttributeValue getDomElement(final XmlAttribute attribute) { if (myChanging) return null; @@ -372,6 +389,7 @@ public final class DomManagerImpl extends DomManager { return mySemService.getSemElement(DOM_HANDLER_KEY, tag); } + @Override @Nullable public AbstractDomChildrenDescription findChildrenDescription(@NotNull final XmlTag tag, @NotNull final DomElement parent) { return findChildrenDescription(tag, getDomInvocationHandler(parent)); @@ -397,6 +415,7 @@ public final class DomManagerImpl extends DomManager { return null; } + @Override public final T createMockElement(final Class aClass, final Module module, final boolean physical) { final XmlFile file = (XmlFile)PsiFileFactory.getInstance(myProject).createFileFromText("a.xml", StdFileTypes.XML, "", (long)0, physical); file.putUserData(MOCK_ELEMENT_MODULE, module); @@ -404,18 +423,22 @@ public final class DomManagerImpl extends DomManager { return getFileElement(file, aClass, "I_sincerely_hope_that_nobody_will_have_such_a_root_tag_name").getRootElement(); } + @Override public final boolean isMockElement(DomElement element) { return DomUtil.getFile(element).getUserData(MOCK) != null; } + @Override public final T createStableValue(final Factory provider) { return createStableValue(provider, new Condition() { + @Override public boolean value(T t) { return t.isValid(); } }); } + @Override public final T createStableValue(final Factory provider, final Condition validator) { final T initial = provider.create(); assert initial != null; @@ -433,6 +456,7 @@ public final class DomManagerImpl extends DomManager { public final void registerFileDescription(final DomFileDescription description, Disposable parentDisposable) { registerFileDescription(description); Disposer.register(parentDisposable, new Disposable() { + @Override public void dispose() { getFileDescriptions(description.getRootTagName()).remove(description); getAcceptingOtherRootTagNameDescriptions().remove(description); @@ -440,28 +464,33 @@ public final class DomManagerImpl extends DomManager { }); } + @Override public final void registerFileDescription(final DomFileDescription description) { mySemService.clearCache(); myApplicationComponent.registerFileDescription(description); } + @Override @NotNull public final DomElement getResolvingScope(GenericDomValue element) { final DomFileDescription description = DomUtil.getFileElement(element).getFileDescription(); return description.getResolveScope(element); } + @Override @Nullable public final DomElement getIdentityScope(DomElement element) { final DomFileDescription description = DomUtil.getFileElement(element).getFileDescription(); return description.getIdentityScope(element); } + @Override public TypeChooserManager getTypeChooserManager() { return myApplicationComponent.getTypeChooserManager(); } + @Override public long getModificationCount() { return myModificationCount + PsiManager.getInstance(myProject).getModificationTracker().getOutOfCodeBlockModificationCount(); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomMetaDataContributor.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomMetaDataContributor.java index 4e93b5420440..4a0d5833e00c 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomMetaDataContributor.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomMetaDataContributor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ public class DomMetaDataContributor implements MetaDataContributor { @Override public void contributeMetaData(MetaDataRegistrar registrar) { registrar.registerMetaData(new ElementFilter() { + @Override public boolean isAcceptable(Object element, PsiElement context) { if (element instanceof XmlTag) { final XmlTag tag = (XmlTag)element; @@ -42,6 +43,7 @@ public class DomMetaDataContributor implements MetaDataContributor { return false; } + @Override public boolean isClassAcceptable(Class hintClass) { return XmlTag.class.isAssignableFrom(hintClass); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomReferenceContributor.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomReferenceContributor.java index 9c1d04b48a59..f44fe05c92d1 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomReferenceContributor.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomReferenceContributor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import com.intellij.patterns.XmlPatterns; * @author peter */ public class DomReferenceContributor extends PsiReferenceContributor{ + @Override public void registerReferenceProviders(final PsiReferenceRegistrar registrar) { GenericValueReferenceProvider provider = new GenericValueReferenceProvider(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomRootInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomRootInvocationHandler.java index f10476216f47..f7d831ebec23 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomRootInvocationHandler.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomRootInvocationHandler.java @@ -48,11 +48,13 @@ public class DomRootInvocationHandler extends DomInvocationHandler getValues(@NotNull final DomElement parent) { throw new UnsupportedOperationException(); } + @Override public int compareTo(final AbstractDomChildDescriptionImpl o) { throw new UnsupportedOperationException(); } @@ -60,6 +62,7 @@ public class DomRootInvocationHandler extends DomInvocationHandler() { + @Override public DomElement create() { return stableCopy.isValid() ? stableCopy.getRootElement() : null; } }); } + @Override protected XmlTag setEmptyXmlTag() { final XmlTag[] result = new XmlTag[]{null}; getManager().runChange(new Runnable() { + @Override public void run() { try { final String namespace = getXmlElementNamespace(); @@ -144,6 +153,7 @@ public class DomRootInvocationHandler extends DomInvocationHandler rawType = getRawType(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomSemContributor.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomSemContributor.java index 9e44e4f3a857..f5a68aab0ee5 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomSemContributor.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomSemContributor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,8 +60,10 @@ public class DomSemContributor extends SemContributor { mySemService = semService; } + @Override public void registerSemProviders(SemRegistrar registrar) { registrar.registerSemElementProvider(DomManagerImpl.FILE_DESCRIPTION_KEY, xmlFile(), new NullableFunction() { + @Override public FileDescriptionCachedValueProvider fun(XmlFile xmlFile) { ApplicationManager.getApplication().assertReadAccessAllowed(); return new FileDescriptionCachedValueProvider(DomManagerImpl.getDomManager(xmlFile.getProject()), xmlFile); @@ -69,6 +71,7 @@ public class DomSemContributor extends SemContributor { }); registrar.registerSemElementProvider(DomManagerImpl.DOM_HANDLER_KEY, xmlTag().withParent(psiElement(XmlElementType.XML_DOCUMENT).withParent(xmlFile())), new NullableFunction() { + @Override public DomInvocationHandler fun(XmlTag xmlTag) { final FileDescriptionCachedValueProvider provider = mySemService.getSemElement(DomManagerImpl.FILE_DESCRIPTION_KEY, xmlTag.getContainingFile()); @@ -86,6 +89,7 @@ public class DomSemContributor extends SemContributor { final ElementPattern nonRootTag = xmlTag().withParent(or(xmlTag(), xmlEntityRef().withParent(xmlTag()))); registrar.registerSemElementProvider(DomManagerImpl.DOM_INDEXED_HANDLER_KEY, nonRootTag, new NullableFunction() { + @Override public IndexedElementInvocationHandler fun(XmlTag tag) { final XmlTag parentTag = PhysicalDomParentStrategy.getParentTag(tag); assert parentTag != null; @@ -129,6 +133,7 @@ public class DomSemContributor extends SemContributor { }); registrar.registerSemElementProvider(DomManagerImpl.DOM_COLLECTION_HANDLER_KEY, nonRootTag, new NullableFunction() { + @Override public CollectionElementInvocationHandler fun(XmlTag tag) { final XmlTag parentTag = PhysicalDomParentStrategy.getParentTag(tag); assert parentTag != null; @@ -156,6 +161,7 @@ public class DomSemContributor extends SemContributor { registrar.registerSemElementProvider(DomManagerImpl.DOM_CUSTOM_HANDLER_KEY, nonRootTag, new NullableFunction() { private final RecursionGuard myGuard = RecursionManager.createGuard("customDomParent"); + @Override public CollectionElementInvocationHandler fun(XmlTag tag) { if (StringUtil.isEmpty(tag.getName())) return null; @@ -199,6 +205,7 @@ public class DomSemContributor extends SemContributor { }); registrar.registerSemElementProvider(DomManagerImpl.DOM_ATTRIBUTE_HANDLER_KEY, xmlAttribute(), new NullableFunction() { + @Override public AttributeChildInvocationHandler fun(final XmlAttribute attribute) { final XmlTag tag = PhysicalDomParentStrategy.getParentTag(attribute); final DomInvocationHandler handler = getParentDom(tag); @@ -207,6 +214,7 @@ public class DomSemContributor extends SemContributor { final String localName = attribute.getLocalName(); final Ref result = Ref.create(null); handler.getGenericInfo().processAttributeChildrenDescriptions(new Processor() { + @Override public boolean process(AttributeChildDescriptionImpl description) { if (description.getXmlName().getLocalName().equals(localName)) { final EvaluatedXmlName evaluatedXmlName = handler.createEvaluatedXmlName(description.getXmlName()); diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomServiceImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomServiceImpl.java index b63a29d31783..94987bc604a9 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomServiceImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,8 +56,10 @@ import java.util.List; public class DomServiceImpl extends DomService { private static final Key> ROOT_TAG_NS_KEY = Key.create("rootTag&ns"); private static final UserDataCache,XmlFile,Object> ourRootTagCache = new UserDataCache, XmlFile, Object>() { + @Override protected CachedValue compute(final XmlFile file, final Object o) { return CachedValuesManager.getManager(file.getProject()).createCachedValue(new CachedValueProvider() { + @Override public Result compute() { return new Result(calcXmlFileHeader(file), file); } @@ -128,6 +130,7 @@ public class DomServiceImpl extends DomService { return XmlFileHeader.EMPTY; } + @Override public ModelMerger createModelMerger() { return new ModelMergerImpl(); } @@ -137,6 +140,7 @@ public class DomServiceImpl extends DomService { return DomAnchorImpl.createAnchor(domElement); } + @Override @NotNull public XmlFile getContainingFile(@NotNull DomElement domElement) { if (domElement instanceof DomFileElement) { @@ -145,21 +149,25 @@ public class DomServiceImpl extends DomService { return DomManagerImpl.getNotNullHandler(domElement).getFile(); } + @Override @NotNull public EvaluatedXmlName getEvaluatedXmlName(@NotNull final DomElement element) { return DomManagerImpl.getNotNullHandler(element).getXmlName(); } + @Override @NotNull public XmlFileHeader getXmlFileHeader(XmlFile file) { return file.isValid() ? ourRootTagCache.get(ROOT_TAG_NS_KEY, file, null).getValue() : XmlFileHeader.EMPTY; } + @Override public Collection getDomFileCandidates(Class description, Project project) { return FileBasedIndex.getInstance().getContainingFiles(DomFileIndex.NAME, description.getName(), GlobalSearchScope.allScope(project)); } + @Override public List> getFileElements(final Class clazz, final Project project, @Nullable final GlobalSearchScope scope) { final Collection list = scope == null ? getDomFileCandidates(clazz, project) : getDomFileCandidates(clazz, project, scope); final ArrayList> result = new ArrayList>(list.size()); @@ -177,6 +185,7 @@ public class DomServiceImpl extends DomService { } + @Override public StructureViewBuilder createSimpleStructureViewBuilder(final XmlFile file, final Function modeProvider) { return new DomStructureViewBuilder(file, modeProvider); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DomTemplateRunnerImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DomTemplateRunnerImpl.java index 97a66b9bbb4b..cd86f01f4ec0 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DomTemplateRunnerImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DomTemplateRunnerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,6 +40,7 @@ public class DomTemplateRunnerImpl extends DomTemplateRunner { myProject = project; } + @Override public void runTemplate(final T t, final String mappingId, final Editor editor) { runTemplate(t, mappingId, editor, new HashMap()); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/DynamicGenericInfo.java b/xml/dom-impl/src/com/intellij/util/xml/impl/DynamicGenericInfo.java index 96fbf46095e3..eebe00d9e0bb 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/DynamicGenericInfo.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/DynamicGenericInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,10 +66,12 @@ public class DynamicGenericInfo extends DomGenericInfoEx { myCollections = staticGenericInfo.getCollections(); } + @Override public Invocation createInvocation(final JavaMethod method) { return myStaticGenericInfo.createInvocation(method); } + @Override public final boolean checkInitialized() { if (myInitialized) return true; myStaticGenericInfo.buildMethodMaps(); @@ -177,14 +179,17 @@ public class DynamicGenericInfo extends DomGenericInfoEx { return registrar; } + @Override public XmlElement getNameElement(DomElement element) { return myStaticGenericInfo.getNameElement(element); } + @Override public GenericDomValue getNameDomElement(DomElement element) { return myStaticGenericInfo.getNameDomElement(element); } + @Override @NotNull public List getCustomNameChildrenDescription() { checkInitialized(); @@ -192,10 +197,12 @@ public class DynamicGenericInfo extends DomGenericInfoEx { return myStaticGenericInfo.getCustomNameChildrenDescription(); } + @Override public String getElementName(DomElement element) { return myStaticGenericInfo.getElementName(element); } + @Override @NotNull public List getChildrenDescriptions() { checkInitialized(); @@ -207,53 +214,63 @@ public class DynamicGenericInfo extends DomGenericInfoEx { return list; } + @Override @NotNull public final List getFixedChildrenDescriptions() { checkInitialized(); return myFixeds.getDescriptions(); } + @Override @NotNull public final List getCollectionChildrenDescriptions() { checkInitialized(); return myCollections.getDescriptions(); } + @Override public FixedChildDescriptionImpl getFixedChildDescription(String tagName) { checkInitialized(); return myFixeds.findDescription(tagName); } + @Override public DomFixedChildDescription getFixedChildDescription(@NonNls String tagName, @NonNls String namespace) { checkInitialized(); return myFixeds.getDescription(tagName, namespace); } + @Override public CollectionChildDescriptionImpl getCollectionChildDescription(String tagName) { checkInitialized(); return myCollections.findDescription(tagName); } + @Override public DomCollectionChildDescription getCollectionChildDescription(@NonNls String tagName, @NonNls String namespace) { checkInitialized(); return myCollections.getDescription(tagName, namespace); } + @Override public AttributeChildDescriptionImpl getAttributeChildDescription(String attributeName) { checkInitialized(); return myAttributes.findDescription(attributeName); } + @Override public DomAttributeChildDescription getAttributeChildDescription(@NonNls String attributeName, @NonNls String namespace) { checkInitialized(); return myAttributes.getDescription(attributeName, namespace); } + @Override public boolean isTagValueElement() { return myStaticGenericInfo.isTagValueElement(); } + @Override @NotNull public List getAttributeChildrenDescriptions() { checkInitialized(); @@ -264,6 +281,7 @@ public class DynamicGenericInfo extends DomGenericInfoEx { public boolean processAttributeChildrenDescriptions(final Processor processor) { final Set visited = new THashSet(); if (!myStaticGenericInfo.processAttributeChildrenDescriptions(new Processor() { + @Override public boolean process(AttributeChildDescriptionImpl attributeChildDescription) { visited.add(attributeChildDescription); return processor.process(attributeChildDescription); diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/FileDescriptionCachedValueProvider.java b/xml/dom-impl/src/com/intellij/util/xml/impl/FileDescriptionCachedValueProvider.java index 4b6ac953e91b..3ddc390475b8 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/FileDescriptionCachedValueProvider.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/FileDescriptionCachedValueProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -202,6 +202,7 @@ class FileDescriptionCachedValueProvider implements SemEle private class MyCondition implements Condition { public Module module; + @Override public boolean value(final DomFileDescription description) { return description.isMyFile(myXmlFile, module); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/FixedChildDescriptionImpl.java b/xml/dom-impl/src/com/intellij/util/xml/impl/FixedChildDescriptionImpl.java index 3f22adfef530..2e37e40302d5 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/FixedChildDescriptionImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/FixedChildDescriptionImpl.java @@ -48,6 +48,7 @@ public class FixedChildDescriptionImpl extends DomChildDescriptionImpl implement myGetterMethods = getterMethods; } + @Override public JavaMethod getGetterMethod(int index) { if (myGetterMethods.length == 0) return null; @@ -55,6 +56,7 @@ public class FixedChildDescriptionImpl extends DomChildDescriptionImpl implement return methods == null || methods.isEmpty() ? null : methods.iterator().next(); } + @Override @Nullable public T getAnnotation(int index, Class annotationClass) { final JavaMethod method = getGetterMethod(index); @@ -72,10 +74,12 @@ public class FixedChildDescriptionImpl extends DomChildDescriptionImpl implement return super.getAnnotation(annotationClass); } + @Override public int getCount() { return myCount; } + @Override @NotNull public List getValues(@NotNull final DomElement element) { final List result = new SmartList(); @@ -95,11 +99,13 @@ public class FixedChildDescriptionImpl extends DomChildDescriptionImpl implement return result; } + @Override @NotNull public String getCommonPresentableName(@NotNull DomNameStrategy strategy) { return StringUtil.capitalizeWords(strategy.splitIntoWords(getXmlElementName()), true); } + @Override @Nullable public final T getAnnotation(Class annotationClass) { return getAnnotation(0, annotationClass); diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/GenericDomValueReference.java b/xml/dom-impl/src/com/intellij/util/xml/impl/GenericDomValueReference.java index 881630e16325..18c97c2a839d 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/GenericDomValueReference.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/GenericDomValueReference.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -76,6 +76,7 @@ public class GenericDomValueReference extends PsiReferenceBase im return myGenericValue; } + @Override public boolean isSoft() { return true; } @@ -106,6 +107,7 @@ public class GenericDomValueReference extends PsiReferenceBase im return o != null ? getElement() : null; } + @Override public boolean isReferenceTo(final PsiElement element) { final Converter converter = getConverter(); if (converter instanceof ResolvingConverter) { @@ -131,17 +133,20 @@ public class GenericDomValueReference extends PsiReferenceBase im return WrappingConverter.getDeepestConverter(myGenericValue.getConverter(), myGenericValue); } + @Override @Nullable public PsiElement resolve() { final T value = myGenericValue.getValue(); return value == null ? null : resolveInner(value); } + @Override @NotNull public String getCanonicalText() { return StringUtil.notNullize(getStringValue()); } + @Override @NotNull public String getUnresolvedMessagePattern() { final ConvertContext context = getConvertContext(); @@ -152,6 +157,7 @@ public class GenericDomValueReference extends PsiReferenceBase im return ConvertContextFactory.createConvertContext(DomManagerImpl.getDomInvocationHandler(myGenericValue)); } + @Override public PsiElement handleElementRename(final String newElementName) throws IncorrectOperationException { final Converter converter = getConverter(); if (converter instanceof ResolvingConverter) { @@ -161,6 +167,7 @@ public class GenericDomValueReference extends PsiReferenceBase im return super.handleElementRename(newElementName); } + @Override public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException { final Converter converter = getConverter(); if (converter instanceof ResolvingConverter) { @@ -180,6 +187,7 @@ public class GenericDomValueReference extends PsiReferenceBase im return null; } + @Override @NotNull public Object[] getVariants() { final Converter converter = getConverter(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/GenericValueReferenceProvider.java b/xml/dom-impl/src/com/intellij/util/xml/impl/GenericValueReferenceProvider.java index 2df2c4c276a1..c2050b5be9de 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/GenericValueReferenceProvider.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/GenericValueReferenceProvider.java @@ -43,6 +43,7 @@ public class GenericValueReferenceProvider extends PsiReferenceProvider { myProviders.put(clazz, provider); } + @Override @NotNull public final PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull final ProcessingContext context) { final DomManager domManager = DomManager.getDomManager(psiElement.getProject()); @@ -147,6 +148,7 @@ public class GenericValueReferenceProvider extends PsiReferenceProvider { if (ReflectionUtil.isAssignable(Integer.class, clazz)) { return new PsiReference[]{new GenericDomValueReference((GenericDomValue)domValue) { + @Override @NotNull public Object[] getVariants() { return new Object[]{"0"}; diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/GetAttributeChildInvocation.java b/xml/dom-impl/src/com/intellij/util/xml/impl/GetAttributeChildInvocation.java index 47951e07b309..92f69dfd0bee 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/GetAttributeChildInvocation.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/GetAttributeChildInvocation.java @@ -25,6 +25,7 @@ public class GetAttributeChildInvocation implements Invocation { myDescription = description; } + @Override public Object invoke(final DomInvocationHandler handler, final Object[] args) throws Throwable { return handler.getAttributeChild(myDescription).getProxy(); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/GetCollectionChildInvocation.java b/xml/dom-impl/src/com/intellij/util/xml/impl/GetCollectionChildInvocation.java index df122f2dd1c1..e9fafaf87847 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/GetCollectionChildInvocation.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/GetCollectionChildInvocation.java @@ -25,6 +25,7 @@ public class GetCollectionChildInvocation implements Invocation { myDescription = qname; } + @Override public Object invoke(final DomInvocationHandler handler, final Object[] args) throws Throwable { return handler.getCollectionChildren(myDescription, myDescription.getTagsGetter()); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/GetCompositeCollectionInvocation.java b/xml/dom-impl/src/com/intellij/util/xml/impl/GetCompositeCollectionInvocation.java index 97984c80e905..d8afda3291c6 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/GetCompositeCollectionInvocation.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/GetCompositeCollectionInvocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ class GetCompositeCollectionInvocation implements Invocation { myQnames = qnames; } + @Override public Object invoke(final DomInvocationHandler handler, final Object[] args) throws Throwable { Map map = new THashMap(); for (final CollectionChildDescriptionImpl qname : myQnames) { diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/GetFixedChildInvocation.java b/xml/dom-impl/src/com/intellij/util/xml/impl/GetFixedChildInvocation.java index ea69bc905b83..6bff198de15f 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/GetFixedChildInvocation.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/GetFixedChildInvocation.java @@ -27,6 +27,7 @@ public class GetFixedChildInvocation implements Invocation { myPair = pair; } + @Override public Object invoke(final DomInvocationHandler handler, final Object[] args) throws Throwable { return handler.getFixedChild(myPair).getProxy(); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/ImplementationClassCache.java b/xml/dom-impl/src/com/intellij/util/xml/impl/ImplementationClassCache.java index 3cb49c94fdd5..6a62938197cd 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/ImplementationClassCache.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/ImplementationClassCache.java @@ -35,6 +35,7 @@ import java.util.TreeSet; */ class ImplementationClassCache { private static final Comparator CLASS_COMPARATOR = new Comparator() { + @Override public int compare(final Class o1, final Class o2) { if (o1.isAssignableFrom(o2)) return 1; if (o2.isAssignableFrom(o1)) return -1; @@ -98,6 +99,7 @@ class ImplementationClassCache { myImplementationClasses.putValue(domElementClass.getName(), ep); if (parentDisposable != null) { Disposer.register(parentDisposable, new Disposable() { + @Override public void dispose() { myImplementationClasses.remove(domElementClass.getName()); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/IndexedElementInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/IndexedElementInvocationHandler.java index 3e1479cda4ff..b77a838eb0ec 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/IndexedElementInvocationHandler.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/IndexedElementInvocationHandler.java @@ -57,6 +57,7 @@ public class IndexedElementInvocationHandler extends DomInvocationHandler T getAnnotation(Class annotationClass) { final T annotation = getChildDescription().getAnnotation(myIndex, annotationClass); if (annotation != null) return annotation; @@ -141,10 +146,12 @@ public class IndexedElementInvocationHandler extends DomInvocationHandler() { + @Override public DomElement create() { return parentCopy.isValid() ? description.getValues(parentCopy).get(myIndex) : null; } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/InvocationCache.java b/xml/dom-impl/src/com/intellij/util/xml/impl/InvocationCache.java index 16be7ddc8504..7b82589804b3 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/InvocationCache.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/InvocationCache.java @@ -83,11 +83,13 @@ public class InvocationCache { addCoreInvocations(AnnotatedElement.class); addCoreInvocations(Object.class); ourCoreInvocations.put(new JavaMethodSignature("getUserData", Key.class), new Invocation() { + @Override public Object invoke(DomInvocationHandler handler, Object[] args) throws Throwable { return handler.getUserData((Key)args[0]); } }); ourCoreInvocations.put(new JavaMethodSignature("putUserData", Key.class, Object.class), new Invocation() { + @Override public Object invoke(DomInvocationHandler handler, Object[] args) throws Throwable { //noinspection unchecked handler.putUserData((Key)args[0], args[1]); @@ -95,49 +97,58 @@ public class InvocationCache { } }); ourCoreInvocations.put(new JavaMethodSignature("getXmlElement"), new Invocation() { + @Override public Object invoke(DomInvocationHandler handler, Object[] args) throws Throwable { return handler.getXmlElement(); } }); ourCoreInvocations.put(new JavaMethodSignature("getXmlTag"), new Invocation() { + @Override public Object invoke(DomInvocationHandler handler, Object[] args) throws Throwable { return handler.getXmlTag(); } }); ourCoreInvocations.put(new JavaMethodSignature("getParent"), new Invocation() { + @Override public Object invoke(DomInvocationHandler handler, Object[] args) throws Throwable { return handler.getParent(); } }); ourCoreInvocations.put(new JavaMethodSignature("accept", DomElementVisitor.class), new Invocation() { + @Override public Object invoke(DomInvocationHandler handler, Object[] args) throws Throwable { handler.accept((DomElementVisitor)args[0]); return null; } }); ourCoreInvocations.put(new JavaMethodSignature("acceptChildren", DomElementVisitor.class), new Invocation() { + @Override public Object invoke(DomInvocationHandler handler, Object[] args) throws Throwable { handler.acceptChildren((DomElementVisitor)args[0]); return null; } }); ourCoreInvocations.put(new JavaMethodSignature("getAnnotation", Class.class), new Invocation() { + @Override public Object invoke(DomInvocationHandler handler, Object[] args) throws Throwable { //noinspection unchecked return handler.getAnnotation((Class)args[0]); } }); ourCoreInvocations.put(new JavaMethodSignature("getRawText"), new Invocation() { + @Override public final Object invoke(final DomInvocationHandler handler, final Object[] args) throws Throwable { return handler.getValue(); } }); ourCoreInvocations.put(new JavaMethodSignature("getXmlAttribute"), new Invocation() { + @Override public final Object invoke(final DomInvocationHandler handler, final Object[] args) throws Throwable { return handler.getXmlElement(); } }); ourCoreInvocations.put(new JavaMethodSignature("getXmlAttributeValue"), new Invocation() { + @Override @Nullable public final Object invoke(final DomInvocationHandler handler, final Object[] args) throws Throwable { final XmlAttribute attribute = (XmlAttribute)handler.getXmlElement(); @@ -145,6 +156,7 @@ public class InvocationCache { } }); ourCoreInvocations.put(new JavaMethodSignature("getConverter"), new Invocation() { + @Override public final Object invoke(final DomInvocationHandler handler, final Object[] args) throws Throwable { try { return handler.getScalarConverter(); @@ -164,6 +176,7 @@ public class InvocationCache { for (final Method method : ReflectionUtil.getClassDeclaredMethods(aClass)) { if ("equals".equals(method.getName())) { ourCoreInvocations.put(new JavaMethodSignature(method), new Invocation() { + @Override public Object invoke(DomInvocationHandler handler, Object[] args) throws Throwable { final DomElement proxy = handler.getProxy(); final Object arg = args[0]; @@ -182,6 +195,7 @@ public class InvocationCache { } else if ("hashCode".equals(method.getName())) { ourCoreInvocations.put(new JavaMethodSignature(method), new Invocation() { + @Override public Object invoke(DomInvocationHandler handler, Object[] args) throws Throwable { return handler.hashCode(); } @@ -189,6 +203,7 @@ public class InvocationCache { } else { ourCoreInvocations.put(new JavaMethodSignature(method), new Invocation() { + @Override public Object invoke(DomInvocationHandler handler, Object[] args) throws Throwable { return method.invoke(handler, args); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/MockDomFileDescription.java b/xml/dom-impl/src/com/intellij/util/xml/impl/MockDomFileDescription.java index cad15441333e..3e68ed9232d7 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/MockDomFileDescription.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/MockDomFileDescription.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,17 +31,21 @@ public class MockDomFileDescription extends DomFileDescription { myFile = file; } + @Override public boolean isMyFile(@NotNull final XmlFile xmlFile, final Module module) { return myFile == xmlFile; } + @Override public boolean acceptsOtherRootTagNames() { return true; } + @Override protected void initializeFileDescription() { } + @Override public boolean isAutomaticHighlightingEnabled() { return false; } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/PhysicalDomParentStrategy.java b/xml/dom-impl/src/com/intellij/util/xml/impl/PhysicalDomParentStrategy.java index a6427a417d84..3dba990044c8 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/PhysicalDomParentStrategy.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/PhysicalDomParentStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,6 +40,7 @@ public class PhysicalDomParentStrategy implements DomParentStrategy { myDomManager = domManager; } + @Override public DomInvocationHandler getParentHandler() { final XmlTag parentTag = getParentTag(myElement); assert parentTag != null; @@ -55,16 +56,19 @@ public class PhysicalDomParentStrategy implements DomParentStrategy { return parent instanceof XmlEntityRef ? parent.getParent() : parent; } + @Override @NotNull public final XmlElement getXmlElement() { return myElement; } + @Override @NotNull public DomParentStrategy refreshStrategy(final DomInvocationHandler handler) { return this; } + @Override @NotNull public DomParentStrategy setXmlElement(@NotNull final XmlElement element) { myElement = element; @@ -76,6 +80,7 @@ public class PhysicalDomParentStrategy implements DomParentStrategy { return "Physical:" + myElement; } + @Override @NotNull public DomParentStrategy clearXmlElement() { final DomInvocationHandler parent = getParentHandler(); @@ -83,6 +88,7 @@ public class PhysicalDomParentStrategy implements DomParentStrategy { return new VirtualDomParentStrategy(parent); } + @Override public String checkValidity() { return myElement.isValid() ? null : "Invalid PSI"; } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/PropertyAccessorInvocation.java b/xml/dom-impl/src/com/intellij/util/xml/impl/PropertyAccessorInvocation.java index 0d9ca1121ab3..c8a89c95ce78 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/PropertyAccessorInvocation.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/PropertyAccessorInvocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ class PropertyAccessorInvocation implements Invocation { myLastElement = myMethods.length - 1; } + @Override public final Object invoke(final DomInvocationHandler handler, final Object[] args) throws Throwable { return invoke(0, handler.getProxy()); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/RootDomParentStrategy.java b/xml/dom-impl/src/com/intellij/util/xml/impl/RootDomParentStrategy.java index 10861c0d781c..184dbe66e0cb 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/RootDomParentStrategy.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/RootDomParentStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,25 +30,30 @@ public class RootDomParentStrategy implements DomParentStrategy { myFileElement = fileElement; } + @Override @NotNull public DomInvocationHandler getParentHandler() { throw new UnsupportedOperationException("Method getParentHandler is not yet implemented in " + getClass().getName()); } + @Override public XmlTag getXmlElement() { return myFileElement.getRootTag(); } + @Override @NotNull public DomParentStrategy refreshStrategy(final DomInvocationHandler handler) { return this; } + @Override @NotNull public DomParentStrategy setXmlElement(@NotNull final XmlElement element) { return this; } + @Override @NotNull public DomParentStrategy clearXmlElement() { return this; diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/SetInvocation.java b/xml/dom-impl/src/com/intellij/util/xml/impl/SetInvocation.java index 95162df3b7fa..fc920a555ebb 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/SetInvocation.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/SetInvocation.java @@ -28,6 +28,7 @@ public class SetInvocation implements Invocation { myConverter = converter; } + @Override public Object invoke(final DomInvocationHandler handler, final Object[] args) throws Throwable { handler.assertValid(); final SubTag annotation = handler.getAnnotation(SubTag.class); diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/StableInvocationHandler.java b/xml/dom-impl/src/com/intellij/util/xml/impl/StableInvocationHandler.java index d15830140d69..0bbc82f11565 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/StableInvocationHandler.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/StableInvocationHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,6 +53,7 @@ class StableInvocationHandler implements InvocationHandler, StableElement { } + @Override public final Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable { if (StableElement.class.equals(method.getDeclaringClass())) { try { @@ -113,6 +114,7 @@ class StableInvocationHandler implements InvocationHandler, StableElement { } } + @Override public final void revalidate() { final T t = myProvider.create(); if (!isNotValid(t) && !t.equals(myCachedValue)) { @@ -120,12 +122,14 @@ class StableInvocationHandler implements InvocationHandler, StableElement { } } + @Override public final void invalidate() { if (!isNotValid(myCachedValue)) { myCachedValue = null; } } + @Override public final T getWrappedElement() { if (isNotValid(myCachedValue)) { myCachedValue = myProvider.create(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/StaticGenericInfo.java b/xml/dom-impl/src/com/intellij/util/xml/impl/StaticGenericInfo.java index 72e7104d8a2b..a4974944a56a 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/StaticGenericInfo.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/StaticGenericInfo.java @@ -86,6 +86,7 @@ public class StaticGenericInfo extends DomGenericInfoEx { } final NotNullFunction mapper = new NotNullFunction() { + @Override @NotNull public CollectionChildDescriptionImpl fun(final String xmlName) { return ObjectUtils.assertNotNull(myCollections.findDescription(xmlName)); @@ -115,10 +116,12 @@ public class StaticGenericInfo extends DomGenericInfoEx { } } + @Override public boolean checkInitialized() { return buildMethodMaps(); } + @Override public final Invocation createInvocation(final JavaMethod method) { buildMethodMaps(); @@ -143,6 +146,7 @@ public class StaticGenericInfo extends DomGenericInfoEx { if (myCustomDescription != null && method.equals(myCustomDescription.getGetterMethod())) { return new Invocation() { + @Override @Nullable public Object invoke(final DomInvocationHandler handler, final Object[] args) throws Throwable { return myCustomDescription.getValues(handler); @@ -176,6 +180,7 @@ public class StaticGenericInfo extends DomGenericInfoEx { if (parameterTypes.length == 2 && parameterTypes[1].equals(Class.class)) { return new Function() { + @Override public Type fun(final Object[] s) { return (Type)s[1]; } @@ -183,6 +188,7 @@ public class StaticGenericInfo extends DomGenericInfoEx { } return new Function() { + @Override public Type fun(final Object[] s) { return method.getGenericReturnType(); } @@ -198,6 +204,7 @@ public class StaticGenericInfo extends DomGenericInfoEx { if (parameterTypes.length == 2 && parameterTypes[1].equals(int.class)) { return new Function() { + @Override public Integer fun(final Object[] s) { return (Integer)s[1]; } @@ -207,6 +214,7 @@ public class StaticGenericInfo extends DomGenericInfoEx { return new ConstantFunction(Integer.MAX_VALUE); } + @Override @Nullable public XmlElement getNameElement(DomElement element) { buildMethodMaps(); @@ -222,6 +230,7 @@ public class StaticGenericInfo extends DomGenericInfoEx { } } + @Override @Nullable public GenericDomValue getNameDomElement(DomElement element) { buildMethodMaps(); @@ -230,6 +239,7 @@ public class StaticGenericInfo extends DomGenericInfoEx { return o instanceof GenericDomValue ? (GenericDomValue)o : null; } + @Override @NotNull public List getCustomNameChildrenDescription() { return myCustomDescription == null ? Collections.emptyList() : Collections.singletonList(myCustomDescription); @@ -240,6 +250,7 @@ public class StaticGenericInfo extends DomGenericInfoEx { return myNameValueGetter == null ? null : myNameValueGetter.invoke(element); } + @Override @Nullable public String getElementName(DomElement element) { buildMethodMaps(); @@ -247,6 +258,7 @@ public class StaticGenericInfo extends DomGenericInfoEx { return o == null || o instanceof String ? (String)o : ((GenericValue)o).getStringValue(); } + @Override @NotNull public List getChildrenDescriptions() { buildMethodMaps(); @@ -258,23 +270,27 @@ public class StaticGenericInfo extends DomGenericInfoEx { return list; } + @Override @NotNull public List getFixedChildrenDescriptions() { buildMethodMaps(); return myFixed.getDescriptions(); } + @Override @NotNull public List getCollectionChildrenDescriptions() { buildMethodMaps(); return myCollections.getDescriptions(); } + @Override public boolean isTagValueElement() { buildMethodMaps(); return myValueElement; } + @Override @NotNull public List getAttributeChildrenDescriptions() { buildMethodMaps(); @@ -287,36 +303,42 @@ public class StaticGenericInfo extends DomGenericInfoEx { return ContainerUtil.process(descriptions, processor); } + @Override @Nullable public DomFixedChildDescription getFixedChildDescription(@NonNls final String tagName) { buildMethodMaps(); return myFixed.findDescription(tagName); } + @Override @Nullable public DomFixedChildDescription getFixedChildDescription(@NonNls final String tagName, @NonNls final String namespaceKey) { buildMethodMaps(); return myFixed.getDescription(tagName, namespaceKey); } + @Override @Nullable public DomCollectionChildDescription getCollectionChildDescription(@NonNls final String tagName) { buildMethodMaps(); return myCollections.findDescription(tagName); } + @Override @Nullable public DomCollectionChildDescription getCollectionChildDescription(@NonNls final String tagName, @NonNls final String namespaceKey) { buildMethodMaps(); return myCollections.getDescription(tagName, namespaceKey); } + @Override @Nullable public DomAttributeChildDescription getAttributeChildDescription(@NonNls final String attributeName) { buildMethodMaps(); return myAttributes.findDescription(attributeName); } + @Override @Nullable public DomAttributeChildDescription getAttributeChildDescription(@NonNls final String attributeName, @NonNls final String namespaceKey) { buildMethodMaps(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/StaticGenericInfoBuilder.java b/xml/dom-impl/src/com/intellij/util/xml/impl/StaticGenericInfoBuilder.java index 3968ff8f73af..0874bbc6dd23 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/StaticGenericInfoBuilder.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/StaticGenericInfoBuilder.java @@ -52,6 +52,7 @@ public class StaticGenericInfoBuilder { private final Map myCompositeCollectionGetters = new THashMap(); private final Map> myCompositeCollectionAdders = new THashMap>(); private final FactoryMap>> myFixedChildrenGetters = new FactoryMap>>() { + @Override protected TIntObjectHashMap> create(final XmlName key) { return new TIntObjectHashMap>(); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/impl/VirtualDomParentStrategy.java b/xml/dom-impl/src/com/intellij/util/xml/impl/VirtualDomParentStrategy.java index 73da7d6197c3..f031ef79b5fa 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/impl/VirtualDomParentStrategy.java +++ b/xml/dom-impl/src/com/intellij/util/xml/impl/VirtualDomParentStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,15 +38,18 @@ public class VirtualDomParentStrategy implements DomParentStrategy { return myModificationTracker.getModificationStamp(); } + @Override @NotNull public DomInvocationHandler getParentHandler() { return myParentHandler; } + @Override public XmlElement getXmlElement() { return null; } + @Override @NotNull public synchronized DomParentStrategy refreshStrategy(final DomInvocationHandler handler) { if (!myParentHandler.isValid()) return this; @@ -62,11 +65,13 @@ public class VirtualDomParentStrategy implements DomParentStrategy { return this; } + @Override @NotNull public DomParentStrategy setXmlElement(@NotNull final XmlElement element) { return new PhysicalDomParentStrategy(element, DomManagerImpl.getDomManager(element.getProject())); } + @Override @NotNull public synchronized DomParentStrategy clearXmlElement() { myModCount = getModCount(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/model/gotosymbol/GoToSymbolProvider.java b/xml/dom-impl/src/com/intellij/util/xml/model/gotosymbol/GoToSymbolProvider.java index 1798e2423bf4..0419343f60de 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/model/gotosymbol/GoToSymbolProvider.java +++ b/xml/dom-impl/src/com/intellij/util/xml/model/gotosymbol/GoToSymbolProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,6 +57,7 @@ public abstract class GoToSymbolProvider implements ChooseByNameContributor { } } + @Override @NotNull public String[] getNames(final Project project, boolean includeNonProjectItems) { Set result = new HashSet(); @@ -70,6 +71,7 @@ public abstract class GoToSymbolProvider implements ChooseByNameContributor { return ArrayUtil.toStringArray(result); } + @Override @NotNull public NavigationItem[] getItemsByName(final String name, final String pattern, final Project project, boolean includeNonProjectItems) { List result = new ArrayList(); @@ -126,27 +128,33 @@ public abstract class GoToSymbolProvider implements ChooseByNameContributor { myIcon = icon; } + @Override @NotNull public PsiElement getNavigationElement() { return myPsiElement; } + @Override public Icon getIcon(boolean flags) { return myIcon; } + @Override public ItemPresentation getPresentation() { return new ItemPresentation() { + @Override public String getPresentableText() { return myText; } + @Override @Nullable public String getLocationString() { return '(' + myPsiElement.getContainingFile().getName() + ')'; } + @Override @Nullable public Icon getIcon(boolean open) { return myIcon; @@ -154,6 +162,7 @@ public abstract class GoToSymbolProvider implements ChooseByNameContributor { }; } + @Override public PsiElement getParent() { return myPsiElement.getParent(); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/reflect/DomExtensionImpl.java b/xml/dom-impl/src/com/intellij/util/xml/reflect/DomExtensionImpl.java index d3931ddee3ae..f0c84fa21917 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/reflect/DomExtensionImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/reflect/DomExtensionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,11 +78,13 @@ public class DomExtensionImpl implements DomExtension { return myXmlName; } + @Override @NotNull public Type getType() { return myType; } + @Override public DomExtension setDeclaringElement(@NotNull DomElement declaringElement) { putUserData(KEY_DOM_DECLARATION, DomAnchorImpl.createAnchor(declaringElement, true)); return this; @@ -94,26 +96,31 @@ public class DomExtensionImpl implements DomExtension { return this; } + @Override public DomExtension setConverter(@NotNull Converter converter) { return setConverter(converter, false); } + @Override public final DomExtension setConverter(@NotNull final Converter converter, final boolean soft) { myConverter = converter; mySoft = soft; return this; } + @Override public DomExtension addCustomAnnotation(@NotNull final Annotation anno) { myCustomAnnos.add(anno); return this; } + @Override public void putUserData(final Key key, final T value) { if (myUserMap == null) myUserMap = new THashMap(); myUserMap.put(key, value); } + @Override public DomExtension addExtender(final DomExtender extender) { if (myUserMap == null || !myUserMap.containsKey(DOM_EXTENDER_KEY)) { putUserData(DOM_EXTENDER_KEY, new SmartList()); diff --git a/xml/dom-impl/src/com/intellij/util/xml/reflect/DomExtensionsRegistrarImpl.java b/xml/dom-impl/src/com/intellij/util/xml/reflect/DomExtensionsRegistrarImpl.java index 415b0f667c98..e5e88ba04140 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/reflect/DomExtensionsRegistrarImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/reflect/DomExtensionsRegistrarImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,27 +60,32 @@ public class DomExtensionsRegistrarImpl implements DomExtensionsRegistrar { return addExtension(myFixeds, name, type).setCount(count); } + @Override @NotNull public DomExtension registerFixedNumberChildExtension(@NotNull final XmlName name, @NotNull final Type type) { return registerFixedNumberChildrenExtension(name, type, 1); } + @Override @NotNull public DomExtension registerCollectionChildrenExtension(@NotNull final XmlName name, @NotNull final Type type) { return addExtension(myCollections, name, type); } + @Override @NotNull public DomExtension registerGenericAttributeValueChildExtension(@NotNull final XmlName name, final Type parameterType) { return addExtension(myAttributes, name, new ParameterizedTypeImpl(GenericAttributeValue.class, parameterType)); } + @Override @NotNull public DomExtension registerAttributeChildExtension(@NotNull final XmlName name, @NotNull final Type type) { assert GenericAttributeValue.class.isAssignableFrom(ReflectionUtil.getRawType(type)); return addExtension(myAttributes, name, type); } + @Override @NotNull public DomExtension registerCustomChildrenExtension(@NotNull final Type type) { return registerCustomChildrenExtension(type, CustomDomChildrenDescription.TagNameDescriptor.EMPTY); diff --git a/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureTreeElement.java b/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureTreeElement.java index 548276faf5e9..552f0ad20060 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureTreeElement.java +++ b/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureTreeElement.java @@ -47,21 +47,25 @@ public class DomStructureTreeElement implements StructureViewTreeElement, ItemPr return myElement; } + @Override @Nullable public Object getValue() { return myElement.isValid() ? myElement.getXmlElement() : null; } + @Override @NotNull public ItemPresentation getPresentation() { return this; } + @Override @NotNull public TreeElement[] getChildren() { if (!myElement.isValid()) return EMPTY_ARRAY; final ArrayList result = new ArrayList(); final DomElementVisitor elementVisitor = new DomElementVisitor() { + @Override public void visitDomElement(final DomElement element) { if (element instanceof GenericDomValue) return; final DomService.StructureViewMode viewMode = myDescriptor.fun(element); @@ -85,18 +89,22 @@ public class DomStructureTreeElement implements StructureViewTreeElement, ItemPr return new DomStructureTreeElement(element, myDescriptor, myNavigationProvider); } + @Override public void navigate(boolean requestFocus) { if (myNavigationProvider != null) myNavigationProvider.navigate(myElement, true); } + @Override public boolean canNavigate() { return myNavigationProvider != null && myNavigationProvider.canNavigate(myElement); } + @Override public boolean canNavigateToSource() { return myNavigationProvider != null && myNavigationProvider.canNavigate(myElement); } + @Override public String getPresentableText() { if (!myElement.isValid()) return ""; final ElementPresentation presentation = myElement.getPresentation(); @@ -104,11 +112,13 @@ public class DomStructureTreeElement implements StructureViewTreeElement, ItemPr return name != null? name : presentation.getTypeName(); } + @Override @Nullable public String getLocationString() { return null; } + @Override @Nullable public Icon getIcon(boolean open) { if (!myElement.isValid()) return null; diff --git a/xml/dom-impl/src/com/intellij/util/xml/stubs/DomStub.java b/xml/dom-impl/src/com/intellij/util/xml/stubs/DomStub.java index 8ddbadaf122d..45a4b8637679 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/stubs/DomStub.java +++ b/xml/dom-impl/src/com/intellij/util/xml/stubs/DomStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,6 +51,7 @@ public abstract class DomStub extends ObjectStubBase { myLocalName = localName; } + @Override public abstract List getChildrenStubs(); public String getName() { diff --git a/xml/dom-impl/src/com/intellij/util/xml/stubs/ElementStub.java b/xml/dom-impl/src/com/intellij/util/xml/stubs/ElementStub.java index 04ef4b89f462..4e8597f3603c 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/stubs/ElementStub.java +++ b/xml/dom-impl/src/com/intellij/util/xml/stubs/ElementStub.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,6 +69,7 @@ public class ElementStub extends DomStub { return StringUtil.isEmpty(key) ? getName() : key + ":" + getName(); } + @Override public boolean isCustom() { return myCustom; } diff --git a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/AddDomElementActionGroup.java b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/AddDomElementActionGroup.java index 07e295825fd2..02c428677bcd 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/AddDomElementActionGroup.java +++ b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/AddDomElementActionGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,16 +28,19 @@ import org.jetbrains.annotations.Nullable; public class AddDomElementActionGroup extends ActionGroup { private final AddElementInCollectionAction myAction = new AddElementInCollectionAction() { + @Override protected boolean showAsPopup() { return false; } }; + @Override @NotNull public AnAction[] getChildren(@Nullable AnActionEvent e) { return myAction.getChildren(e); } + @Override public void update(AnActionEvent e) { // myAction.getChildren(e).length getTemplatePresentation().setText(myAction.getTemplatePresentation().getText()); diff --git a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/AddElementInCollectionAction.java b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/AddElementInCollectionAction.java index 0828d3cc3e60..029feda9c59c 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/AddElementInCollectionAction.java +++ b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/AddElementInCollectionAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -61,6 +61,7 @@ public class AddElementInCollectionAction extends AddDomElementAction { return DomModelTreeView.DATA_KEY.getData(e.getDataContext()); } + @Override protected boolean isEnabled(final AnActionEvent e) { final DomModelTreeView treeView = getTreeView(e); @@ -71,6 +72,7 @@ public class AddElementInCollectionAction extends AddDomElementAction { } + @Override protected void showPopup(final ListPopup groupPopup, final AnActionEvent e) { if (myTreeView == null) { if (e.getPlace().equals(DomModelTreeView.DOM_MODEL_TREE_VIEW_POPUP)) { @@ -85,6 +87,7 @@ public class AddElementInCollectionAction extends AddDomElementAction { } } + @Override @NotNull protected DomCollectionChildDescription[] getDomCollectionChildDescriptions(final AnActionEvent e) { final DomModelTreeView view = getTreeView(e); @@ -104,6 +107,7 @@ public class AddElementInCollectionAction extends AddDomElementAction { : new DomCollectionChildDescription[]{groupNode.getChildDescription()}; } + @Override protected DomElement getParentDomElement(final AnActionEvent e) { final DomModelTreeView view = getTreeView(e); SimpleNode node = view.getTree().getSelectedNode(); @@ -117,14 +121,17 @@ public class AddElementInCollectionAction extends AddDomElementAction { return groupNode == null ? null : groupNode.getDomElement(); } + @Override protected JComponent getComponent(AnActionEvent e) { return getTreeView(e); } + @Override protected boolean showAsPopup() { return true; } + @Override protected String getActionText(final AnActionEvent e) { String text = ApplicationBundle.message("action.add"); if (e.getPresentation().isEnabled()) { @@ -150,6 +157,7 @@ public class AddElementInCollectionAction extends AddDomElementAction { } + @Override protected AnAction createAddingAction(final AnActionEvent e, final String name, final Icon icon, @@ -192,22 +200,27 @@ public class AddElementInCollectionAction extends AddDomElementAction { myView = getTreeView(e); } + @Override protected Type getElementType() { return myType; } + @Override protected DomCollectionChildDescription getDomCollectionChildDescription() { return myDescription; } + @Override protected DomElement getParentDomElement() { return myParent; } - protected void afterAddition(final DomElement newElement) { + @Override + protected void afterAddition(@NotNull final DomElement newElement) { final DomElement copy = newElement.createStableCopy(); ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override public void run() { myView.setSelectedDomElement(copy); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/BaseDomTreeAction.java b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/BaseDomTreeAction.java index 81d5ef356d11..16c3084d3990 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/BaseDomTreeAction.java +++ b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/BaseDomTreeAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ abstract public class BaseDomTreeAction extends AnAction { myTreeView = treeView; } + @Override final public void update(AnActionEvent e) { final DomModelTreeView treeView = getTreeView(e); @@ -50,6 +51,7 @@ abstract public class BaseDomTreeAction extends AnAction { return DomModelTreeView.DATA_KEY.getData(e.getDataContext()); } + @Override final public void actionPerformed(AnActionEvent e) { final DomModelTreeView treeView = getTreeView(e); if (treeView != null) { diff --git a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/DeleteDomElement.java b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/DeleteDomElement.java index d525acf46d29..c293df56af66 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/DeleteDomElement.java +++ b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/DeleteDomElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,6 +43,7 @@ public class DeleteDomElement extends BaseDomTreeAction { super(treeView); } + @Override public void actionPerformed(AnActionEvent e, DomModelTreeView treeView) { final SimpleNode selectedNode = treeView.getTree().getSelectedNode(); @@ -59,6 +60,7 @@ public class DeleteDomElement extends BaseDomTreeAction { Messages.getQuestionIcon()); if (ret == Messages.OK) { new WriteCommandAction(domElement.getManager().getProject(), DomUtil.getFile(domElement)) { + @Override protected void run(final Result result) throws Throwable { domElement.undefine(); } @@ -67,6 +69,7 @@ public class DeleteDomElement extends BaseDomTreeAction { } } + @Override public void update(AnActionEvent e, DomModelTreeView treeView) { final SimpleNode selectedNode = treeView.getTree().getSelectedNode(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/DomElementsToggleAction.java b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/DomElementsToggleAction.java index 9a1cb04e586c..e391ae571e39 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/DomElementsToggleAction.java +++ b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/DomElementsToggleAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.ToggleAction; import com.intellij.util.xml.DomUtil; import com.intellij.util.xml.ElementPresentationManager; +import com.intellij.util.xml.tree.AbstractDomElementNode; import com.intellij.util.xml.tree.BaseDomElementNode; import com.intellij.util.xml.tree.DomModelTreeView; @@ -51,11 +52,12 @@ public class DomElementsToggleAction extends ToggleAction { myText = TypePresentationService.getService().getTypePresentableName(myClass); - if(getHiders() == null) DomUtil.getFile(myTreeView.getRootElement()).putUserData(BaseDomElementNode.TREE_NODES_HIDERS_KEY, new HashMap()); + if(getHiders() == null) DomUtil.getFile(myTreeView.getRootElement()).putUserData(AbstractDomElementNode.TREE_NODES_HIDERS_KEY, new HashMap()); if(getHiders().get(myClass) == null) getHiders().put(myClass, true); } + @Override public void update(final AnActionEvent e) { super.update(e); @@ -65,6 +67,7 @@ public class DomElementsToggleAction extends ToggleAction { e.getPresentation().setEnabled(getHiders() != null && getHiders().get(myClass)!=null); } + @Override public boolean isSelected(AnActionEvent e) { return getHiders().get(myClass); } @@ -73,6 +76,7 @@ public class DomElementsToggleAction extends ToggleAction { return DomUtil.getFile(myTreeView.getRootElement()).getUserData(BaseDomElementNode.TREE_NODES_HIDERS_KEY); } + @Override public void setSelected(AnActionEvent e, boolean state) { getHiders().put(myClass, state); myTreeView.getBuilder().updateFromRoot(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/GotoDomElementDeclarationAction.java b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/GotoDomElementDeclarationAction.java index 256a397e441e..f096c1682237 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/tree/actions/GotoDomElementDeclarationAction.java +++ b/xml/dom-impl/src/com/intellij/util/xml/tree/actions/GotoDomElementDeclarationAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,21 +16,21 @@ package com.intellij.util.xml.tree.actions; +import com.intellij.idea.ActionsBundle; import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.application.ApplicationBundle; -import com.intellij.util.xml.tree.DomModelTreeView; -import com.intellij.util.xml.tree.BaseDomElementNode; -import com.intellij.util.xml.DomElementsNavigationManager; +import com.intellij.ui.treeStructure.SimpleNode; import com.intellij.util.xml.DomElement; import com.intellij.util.xml.DomElementNavigationProvider; -import com.intellij.ui.treeStructure.SimpleNode; -import com.intellij.idea.ActionsBundle; +import com.intellij.util.xml.DomElementsNavigationManager; +import com.intellij.util.xml.tree.BaseDomElementNode; +import com.intellij.util.xml.tree.DomModelTreeView; /** * User: Sergey.Vasiliev */ public class GotoDomElementDeclarationAction extends BaseDomTreeAction { + @Override public void actionPerformed(AnActionEvent e, DomModelTreeView treeView) { final SimpleNode simpleNode = treeView.getTree().getSelectedNode(); @@ -44,6 +44,7 @@ public class GotoDomElementDeclarationAction extends BaseDomTreeAction { } } + @Override public void update(AnActionEvent e, DomModelTreeView treeView) { e.getPresentation().setVisible(treeView.getTree().getSelectedNode() instanceof BaseDomElementNode); e.getPresentation().setText(ActionsBundle.message("action.EditSource.text")); diff --git a/xml/dom-impl/src/com/intellij/util/xml/ui/DomUIFactoryImpl.java b/xml/dom-impl/src/com/intellij/util/xml/ui/DomUIFactoryImpl.java index d07b40fb63e9..168b6a514b0a 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/ui/DomUIFactoryImpl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/ui/DomUIFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,6 +60,7 @@ public class DomUIFactoryImpl extends DomUIFactory { public DomUIFactoryImpl() { final Function booleanCreator = new Function() { + @Override public TableCellEditor fun(final DomElement domElement) { return new BooleanTableCellEditor(); } @@ -67,6 +68,7 @@ public class DomUIFactoryImpl extends DomUIFactory { registerCustomCellEditor(Boolean.class, booleanCreator); registerCustomCellEditor(boolean.class, booleanCreator); registerCustomCellEditor(String.class, new Function() { + @Override public TableCellEditor fun(final DomElement domElement) { return new DefaultCellEditor(removeBorder(new JTextField())); } @@ -77,6 +79,7 @@ public class DomUIFactoryImpl extends DomUIFactory { } } + @Override protected TableCellEditor createCellEditor(DomElement element, Class type) { if (Enum.class.isAssignableFrom(type)) { return new ComboTableCellEditor((Class)type, false); @@ -87,14 +90,17 @@ public class DomUIFactoryImpl extends DomUIFactory { return function.fun(element); } + @Override public final UserActivityWatcher createEditorAwareUserActivityWatcher() { return new UserActivityWatcher() { private final DocumentAdapter myListener = new DocumentAdapter() { + @Override public void documentChanged(DocumentEvent e) { fireUIChanged(); } }; + @Override protected void processComponent(final Component component) { super.processComponent(component); if (component instanceof EditorComponentImpl) { @@ -102,6 +108,7 @@ public class DomUIFactoryImpl extends DomUIFactory { } } + @Override protected void unprocessComponent(final Component component) { super.unprocessComponent(component); if (component instanceof EditorComponentImpl) { @@ -111,11 +118,13 @@ public class DomUIFactoryImpl extends DomUIFactory { }; } + @Override public void setupErrorOutdatingUserActivityWatcher(final CommittablePanel panel, final DomElement... elements) { final UserActivityWatcher userActivityWatcher = createEditorAwareUserActivityWatcher(); userActivityWatcher.addUserActivityListener(new UserActivityListener() { private boolean isProcessingChange; + @Override public void stateChanged() { if (isProcessingChange) return; isProcessingChange = true; @@ -133,19 +142,23 @@ public class DomUIFactoryImpl extends DomUIFactory { userActivityWatcher.register(panel.getComponent()); } + @Override @Nullable public BaseControl createCustomControl(final Type type, DomWrapper wrapper, final boolean commitOnEveryChange) { final Function, BaseControl> factory = myCustomControlCreators.get(ReflectionUtil.getRawType(type)); return factory == null ? null : factory.fun(wrapper); } + @Override public CaptionComponent addErrorPanel(CaptionComponent captionComponent, DomElement... elements) { captionComponent.initErrorPanel(new DomElementsErrorPanel(elements)); return captionComponent; } + @Override public BackgroundEditorHighlighter createDomHighlighter(final Project project, final PerspectiveFileEditor editor, final DomElement element) { return new BackgroundEditorHighlighter() { + @Override @NotNull public HighlightingPass[] createPassesForEditor() { if (!element.isValid()) return HighlightingPass.EMPTY_ARRAY; @@ -168,6 +181,7 @@ public class DomUIFactoryImpl extends DomUIFactory { return new HighlightingPass[]{ghp, lip}; } + @Override @NotNull public HighlightingPass[] createPassesForVisibleArea() { return createPassesForEditor(); @@ -176,14 +190,17 @@ public class DomUIFactoryImpl extends DomUIFactory { } + @Override public BaseControl createTextControl(DomWrapper wrapper, final boolean commitOnEveryChange) { return new TextControl(wrapper, commitOnEveryChange); } + @Override public void registerCustomControl(Class aClass, Function, BaseControl> creator) { myCustomControlCreators.put(aClass, creator); } + @Override public void registerCustomCellEditor(final Class aClass, final Function creator) { myCustomCellEditorCreators.put(aClass, creator); } diff --git a/xml/dom-impl/src/com/intellij/util/xml/ui/EditorTextFieldControl.java b/xml/dom-impl/src/com/intellij/util/xml/ui/EditorTextFieldControl.java index eb27a93d0e60..e9a9f70c7a54 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/ui/EditorTextFieldControl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/ui/EditorTextFieldControl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,16 +47,19 @@ import java.util.List; */ public abstract class EditorTextFieldControl extends BaseModifiableControl { private static final JTextField J_TEXT_FIELD = new JTextField() { + @Override public void addNotify() { throw new UnsupportedOperationException("Shouldn't be shown"); } + @Override public void setVisible(boolean aFlag) { throw new UnsupportedOperationException("Shouldn't be shown"); } }; private final boolean myCommitOnEveryChange; private final DocumentListener myListener = new DocumentAdapter() { + @Override public void documentChanged(DocumentEvent e) { setModified(); if (myCommitOnEveryChange) { @@ -77,6 +80,7 @@ public abstract class EditorTextFieldControl extends BaseM protected abstract EditorTextField getEditorTextField(@NotNull T component); + @Override protected void doReset() { final EditorTextField textField = getEditorTextField(getComponent()); textField.getDocument().removeDocumentListener(myListener); @@ -84,14 +88,17 @@ public abstract class EditorTextFieldControl extends BaseM textField.getDocument().addDocumentListener(myListener); } + @Override protected JComponent getComponentToListenFocusLost(final T component) { return getEditorTextField(getComponent()); } + @Override protected JComponent getHighlightedComponent(final T component) { return J_TEXT_FIELD; } + @Override protected T createMainComponent(T boundedComponent) { final Project project = getProject(); boundedComponent = createMainComponent(boundedComponent, project); @@ -104,15 +111,19 @@ public abstract class EditorTextFieldControl extends BaseM protected abstract T createMainComponent(T boundedComponent, Project project); + @Override @NotNull protected String getValue() { return getEditorTextField(getComponent()).getText(); } + @Override protected void setValue(final String value) { CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() { + @Override public void run() { new WriteAction() { + @Override protected void run(Result result) throws Throwable { final T component = getComponent(); final Document document = getEditorTextField(component).getDocument(); @@ -123,6 +134,7 @@ public abstract class EditorTextFieldControl extends BaseM }); } + @Override protected void updateComponent() { final DomElement domElement = getDomElement(); if (domElement == null || !domElement.isValid()) return; @@ -130,6 +142,7 @@ public abstract class EditorTextFieldControl extends BaseM final EditorTextField textField = getEditorTextField(getComponent()); final Project project = getProject(); ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override public void run() { if (!project.isOpen()) return; if (!getDomWrapper().isValid()) return; @@ -170,13 +183,16 @@ public abstract class EditorTextFieldControl extends BaseM } + @Override public boolean canNavigate(final DomElement element) { return getDomElement().equals(element); } + @Override public void navigate(final DomElement element) { final EditorTextField field = getEditorTextField(getComponent()); SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { field.requestFocus(); field.selectAll(); diff --git a/xml/dom-impl/src/com/intellij/util/xml/ui/TextControl.java b/xml/dom-impl/src/com/intellij/util/xml/ui/TextControl.java index c6dec44320f2..51702cbea5f7 100644 --- a/xml/dom-impl/src/com/intellij/util/xml/ui/TextControl.java +++ b/xml/dom-impl/src/com/intellij/util/xml/ui/TextControl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,6 +47,7 @@ public class TextControl extends EditorTextFieldControl { super(domWrapper, commitOnEveryChange); } + @Override protected EditorTextField getEditorTextField(@NotNull final TextPanel panel) { final Component component = panel.getComponent(0); if (component instanceof ReferenceEditorWithBrowseButton) { @@ -55,12 +56,14 @@ public class TextControl extends EditorTextFieldControl { return (EditorTextField)component; } + @Override protected TextPanel createMainComponent(TextPanel boundedComponent, final Project project) { if (boundedComponent == null) { boundedComponent = new TextPanel(); } boundedComponent.removeAll(); final Function factory = new Function() { + @Override public Document fun(final String s) { return PsiDocumentManager.getInstance(project) .getDocument(PsiFileFactory.getInstance(project).createFileFromText("a.txt", PlainTextLanguage.INSTANCE, "", true, false)); @@ -68,6 +71,7 @@ public class TextControl extends EditorTextFieldControl { }; final TextPanel boundedComponent1 = boundedComponent; final EditorTextField editorTextField = new EditorTextField(factory.fun(""), project, FileTypes.PLAIN_TEXT) { + @Override protected EditorEx createEditor() { final EditorEx editor = super.createEditor(); return boundedComponent1 instanceof MultiLineTextPanel ? makeBigEditor(editor, ((MultiLineTextPanel)boundedComponent1).getRowCount()) : editor; @@ -82,8 +86,10 @@ public class TextControl extends EditorTextFieldControl { final ReferenceEditorWithBrowseButton editor = new ReferenceEditorWithBrowseButton(null, editorTextField, factory); boundedComponent.add(editor); editor.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { EditorTextField textArea = new EditorTextField(editorTextField.getDocument(), project, FileTypes.PLAIN_TEXT) { + @Override protected EditorEx createEditor() { final EditorEx editor = super.createEditor(); editor.setEmbeddedIntoDialogWrapper(true); diff --git a/xml/dom-impl/src/com/intellij/xml/impl/dom/AbstractDomChildrenDescriptor.java b/xml/dom-impl/src/com/intellij/xml/impl/dom/AbstractDomChildrenDescriptor.java index e003931067aa..bc750c2690c1 100644 --- a/xml/dom-impl/src/com/intellij/xml/impl/dom/AbstractDomChildrenDescriptor.java +++ b/xml/dom-impl/src/com/intellij/xml/impl/dom/AbstractDomChildrenDescriptor.java @@ -49,6 +49,7 @@ public abstract class AbstractDomChildrenDescriptor implements XmlElementDescrip myManager = manager; } + @Override public XmlElementDescriptor[] getElementsDescriptors(final XmlTag context) { final DomElement domElement = myManager.getDomElement(context); if (domElement == null) return EMPTY_ARRAY; @@ -104,6 +105,7 @@ public abstract class AbstractDomChildrenDescriptor implements XmlElementDescrip return null; } + @Override @Nullable public XmlElementDescriptor getElementDescriptor(@NotNull final XmlTag childTag, @Nullable XmlTag contextTag) { DomElement domElement = myManager.getDomElement(childTag); @@ -147,6 +149,7 @@ public abstract class AbstractDomChildrenDescriptor implements XmlElementDescrip return new DomElementXmlDescriptor((DomChildrenDescription)description, myManager); } + @Override public XmlAttributeDescriptor[] getAttributesDescriptors(final @Nullable XmlTag context) { if (context == null) return XmlAttributeDescriptor.EMPTY; @@ -172,6 +175,7 @@ public abstract class AbstractDomChildrenDescriptor implements XmlElementDescrip return descriptors.toArray(new XmlAttributeDescriptor[descriptors.size()]); } + @Override @Nullable public XmlAttributeDescriptor getAttributeDescriptor(final String attributeName, final @Nullable XmlTag context) { DomElement domElement = myManager.getDomElement(context); @@ -185,57 +189,69 @@ public abstract class AbstractDomChildrenDescriptor implements XmlElementDescrip return null; } + @Override @Nullable public XmlAttributeDescriptor getAttributeDescriptor(final XmlAttribute attribute) { return getAttributeDescriptor(attribute.getName(), attribute.getParent()); } + @Override public XmlNSDescriptor getNSDescriptor() { return new XmlNSDescriptor() { + @Override @Nullable public XmlElementDescriptor getElementDescriptor(@NotNull final XmlTag tag) { throw new UnsupportedOperationException("Method getElementDescriptor not implemented in " + getClass()); } + @Override @NotNull public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable final XmlDocument document) { throw new UnsupportedOperationException("Method getRootElementsDescriptors not implemented in " + getClass()); } + @Override @Nullable public XmlFile getDescriptorFile() { return null; } + @Override public boolean isHierarhyEnabled() { throw new UnsupportedOperationException("Method isHierarhyEnabled not implemented in " + getClass()); } + @Override @Nullable public PsiElement getDeclaration() { throw new UnsupportedOperationException("Method getDeclaration not implemented in " + getClass()); } + @Override @NonNls public String getName(final PsiElement context) { throw new UnsupportedOperationException("Method getName not implemented in " + getClass()); } + @Override @NonNls public String getName() { throw new UnsupportedOperationException("Method getName not implemented in " + getClass()); } + @Override public void init(final PsiElement element) { throw new UnsupportedOperationException("Method init not implemented in " + getClass()); } + @Override public Object[] getDependences() { throw new UnsupportedOperationException("Method getDependences not implemented in " + getClass()); } }; } + @Override public int getContentType() { return CONTENT_TYPE_UNKNOWN; } @@ -245,19 +261,23 @@ public abstract class AbstractDomChildrenDescriptor implements XmlElementDescrip return null; } + @Override public void init(final PsiElement element) { throw new UnsupportedOperationException("Method init not implemented in " + getClass()); } + @Override public Object[] getDependences() { throw new UnsupportedOperationException("Method getDependences not implemented in " + getClass()); } + @Override @NonNls public String getName() { return getDefaultName(); } + @Override public String getQualifiedName() { return getDefaultName(); } diff --git a/xml/dom-impl/src/com/intellij/xml/impl/dom/DomAttributeXmlDescriptor.java b/xml/dom-impl/src/com/intellij/xml/impl/dom/DomAttributeXmlDescriptor.java index 635420098b6e..282215bf663a 100644 --- a/xml/dom-impl/src/com/intellij/xml/impl/dom/DomAttributeXmlDescriptor.java +++ b/xml/dom-impl/src/com/intellij/xml/impl/dom/DomAttributeXmlDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,47 +43,57 @@ public class DomAttributeXmlDescriptor implements NamespaceAwareXmlAttributeDesc myProject = project; } + @Override public boolean isRequired() { final Required required = myDescription.getAnnotation(Required.class); return required != null && required.value(); } + @Override public boolean isFixed() { return false; } + @Override public boolean hasIdType() { return false; } + @Override public boolean hasIdRefType() { return false; } + @Override @Nullable public String getDefaultValue() { return null; }//todo: refactor to hierarchy of value descriptor? + @Override public boolean isEnumerated() { return false; } + @Override @Nullable public String[] getEnumeratedValues() { return null; } + @Override @Nullable public String validateValue(final XmlElement context, final String value) { return null; } + @Override @Nullable public PsiElement getDeclaration() { return myDescription.getDeclaration(myProject); } + @Override @NonNls public String getName(final PsiElement context) { return getQualifiedAttributeName(context, myDescription.getXmlName()); @@ -108,6 +118,7 @@ public class DomAttributeXmlDescriptor implements NamespaceAwareXmlAttributeDesc return localName; } + @Override @NonNls public String getName() { return getLocalName(); @@ -117,6 +128,7 @@ public class DomAttributeXmlDescriptor implements NamespaceAwareXmlAttributeDesc return myDescription.getXmlName().getLocalName(); } + @Override @Nullable public String getNamespace(@NotNull XmlTag context) { final DomInvocationHandler handler = DomManagerImpl.getDomManager(myProject).getDomHandler(context); @@ -127,10 +139,12 @@ public class DomAttributeXmlDescriptor implements NamespaceAwareXmlAttributeDesc return handler.createEvaluatedXmlName(myDescription.getXmlName()).getNamespace(context, handler.getFile()); } + @Override public void init(final PsiElement element) { throw new UnsupportedOperationException("Method init not implemented in " + getClass()); } + @Override public Object[] getDependences() { throw new UnsupportedOperationException("Method getDependences not implemented in " + getClass()); } diff --git a/xml/dom-impl/src/com/intellij/xml/impl/dom/DomElementXmlDescriptor.java b/xml/dom-impl/src/com/intellij/xml/impl/dom/DomElementXmlDescriptor.java index d5894851bf93..e754a54ca0f6 100644 --- a/xml/dom-impl/src/com/intellij/xml/impl/dom/DomElementXmlDescriptor.java +++ b/xml/dom-impl/src/com/intellij/xml/impl/dom/DomElementXmlDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,15 +50,18 @@ public class DomElementXmlDescriptor extends AbstractDomChildrenDescriptor imple myChildrenDescription = childrenDescription; } + @Override public String getDefaultName() { return myChildrenDescription.getXmlElementName(); } + @Override @Nullable public PsiElement getDeclaration() { return myChildrenDescription.getDeclaration(myManager.getProject()); } + @Override @NonNls public String getName(final PsiElement context) { final String name = getDefaultName(); @@ -95,65 +98,79 @@ public class DomElementXmlDescriptor extends AbstractDomChildrenDescriptor imple myDomElement = domElement; } + @Override public String getName() { return getXmlElementName(); } + @Override public boolean isValid() { return true; } + @Override public void navigate(boolean requestFocus) { } + @Override public boolean canNavigate() { return false; } + @Override public boolean canNavigateToSource() { return false; } + @Override @NotNull public XmlName getXmlName() { throw new UnsupportedOperationException("Method getXmlName not implemented in " + getClass()); } + @Override @NotNull public String getXmlElementName() { return myDomElement.getXmlElementName(); } + @Override @NotNull public String getCommonPresentableName(@NotNull final DomNameStrategy strategy) { throw new UnsupportedOperationException("Method getCommonPresentableName not implemented in " + getClass()); } + @Override @NotNull public String getCommonPresentableName(@NotNull final DomElement parent) { throw new UnsupportedOperationException("Method getCommonPresentableName not implemented in " + getClass()); } + @Override @NotNull public List getValues(@NotNull final DomElement parent) { throw new UnsupportedOperationException("Method getValues not implemented in " + getClass()); } + @Override @NotNull public List getStableValues(@NotNull final DomElement parent) { throw new UnsupportedOperationException("Method getStableValues not implemented in " + getClass()); } + @Override @NotNull public Type getType() { throw new UnsupportedOperationException("Method getType not implemented in " + getClass()); } + @Override @NotNull public DomNameStrategy getDomNameStrategy(@NotNull final DomElement parent) { throw new UnsupportedOperationException("Method getDomNameStrategy not implemented in " + getClass()); } + @Override public T getUserData(final Key key) { return null; } @@ -163,11 +180,13 @@ public class DomElementXmlDescriptor extends AbstractDomChildrenDescriptor imple return null; } + @Override @Nullable public T getAnnotation(final Class annotationClass) { throw new UnsupportedOperationException("Method getAnnotation not implemented in " + getClass()); } + @Override @Nullable public PsiElement getDeclaration(final Project project) { return PomService.convertToPsi(project, this); diff --git a/xml/dom-openapi/src/com/intellij/patterns/DomElementPattern.java b/xml/dom-openapi/src/com/intellij/patterns/DomElementPattern.java index e68cf0d0e899..3e24bd642ac2 100644 --- a/xml/dom-openapi/src/com/intellij/patterns/DomElementPattern.java +++ b/xml/dom-openapi/src/com/intellij/patterns/DomElementPattern.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,13 +38,16 @@ public class DomElementPattern children = new ArrayList(); domElement.acceptChildren(new DomElementVisitor() { + @Override public void visitDomElement(final DomElement element) { children.add(element); } @@ -61,6 +64,7 @@ public class DomElementPattern("withChild") { + @Override public boolean accepts(@NotNull final T t, final ProcessingContext context) { for (final AbstractDomChildrenDescription description : t.getGenericInfo().getChildrenDescriptions()) { if (!(description instanceof DomChildrenDescription) || localName.equals(((DomChildrenDescription)description).getXmlElementName())) { diff --git a/xml/dom-openapi/src/com/intellij/patterns/DomPatterns.java b/xml/dom-openapi/src/com/intellij/patterns/DomPatterns.java index 025b42c5326c..aa5bfdbc4ace 100644 --- a/xml/dom-openapi/src/com/intellij/patterns/DomPatterns.java +++ b/xml/dom-openapi/src/com/intellij/patterns/DomPatterns.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,6 +52,7 @@ public class DomPatterns { public static XmlElementPattern.Capture withDom(final ElementPattern pattern) { return new XmlElementPattern.Capture().with(new PatternCondition("tagWithDom") { + @Override public boolean accepts(@NotNull final XmlElement xmlElement, final ProcessingContext context) { final DomManager manager = DomManager.getDomManager(xmlElement.getProject()); if (xmlElement instanceof XmlAttribute) { diff --git a/xml/dom-openapi/src/com/intellij/patterns/GenericDomValuePattern.java b/xml/dom-openapi/src/com/intellij/patterns/GenericDomValuePattern.java index f02965b18353..b990f9bcc379 100644 --- a/xml/dom-openapi/src/com/intellij/patterns/GenericDomValuePattern.java +++ b/xml/dom-openapi/src/com/intellij/patterns/GenericDomValuePattern.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import org.jetbrains.annotations.Nullable; */ public class GenericDomValuePattern extends DomElementPattern, GenericDomValuePattern>{ private static final InitialPatternCondition CONDITION = new InitialPatternCondition(GenericDomValue.class) { + @Override public boolean accepts(@Nullable final Object o, final ProcessingContext context) { return o instanceof GenericDomValue; } @@ -37,6 +38,7 @@ public class GenericDomValuePattern extends DomElementPattern aClass) { super(new InitialPatternCondition(aClass) { + @Override public boolean accepts(@Nullable final Object o, final ProcessingContext context) { return o instanceof GenericDomValue && aClass.equals(DomUtil.getGenericValueParameter(((GenericDomValue)o).getDomElementType())); } @@ -46,6 +48,7 @@ public class GenericDomValuePattern extends DomElementPattern withStringValue(final ElementPattern pattern) { return with(new PatternCondition>("withStringValue") { + @Override public boolean accepts(@NotNull final GenericDomValue genericDomValue, final ProcessingContext context) { return pattern.getCondition().accepts(genericDomValue.getStringValue(), context); } @@ -59,6 +62,7 @@ public class GenericDomValuePattern extends DomElementPattern withValue(final ElementPattern pattern) { return with(new PatternCondition>("withValue") { + @Override public boolean accepts(@NotNull final GenericDomValue genericDomValue, final ProcessingContext context) { return pattern.getCondition().accepts(genericDomValue.getValue(), context); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/AbstractConvertContext.java b/xml/dom-openapi/src/com/intellij/util/xml/AbstractConvertContext.java index 4a4f9ddc4c17..c2799d7a4b68 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/AbstractConvertContext.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/AbstractConvertContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,20 +34,24 @@ import org.jetbrains.annotations.Nullable; */ public abstract class AbstractConvertContext extends ConvertContext { + @Override public final XmlTag getTag() { return getInvocationElement().getXmlTag(); } + @Override @Nullable public XmlElement getXmlElement() { return getInvocationElement().getXmlElement(); } + @Override @NotNull public final XmlFile getFile() { return DomUtil.getFile(getInvocationElement()); } + @Override public Module getModule() { final DomFileElement fileElement = DomUtil.getFileElement(getInvocationElement()); if (fileElement == null) { @@ -57,10 +61,12 @@ public abstract class AbstractConvertContext extends ConvertContext { return fileElement.isValid() ? fileElement.getRootElement().getModule() : null; } + @Override public PsiManager getPsiManager() { return getFile().getManager(); } + @Override @Nullable public GlobalSearchScope getSearchScope() { GlobalSearchScope scope = null; diff --git a/xml/dom-openapi/src/com/intellij/util/xml/Converter.java b/xml/dom-openapi/src/com/intellij/util/xml/Converter.java index 48a02fc43847..38f542d7f237 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/Converter.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/Converter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,6 +53,7 @@ public abstract class Converter { */ @Deprecated public static final Converter INTEGER_CONVERTER = new Converter() { + @Override public Integer fromString(final String s, final ConvertContext context) { if (s == null) return null; try { @@ -63,10 +64,12 @@ public abstract class Converter { } } + @Override public String toString(final Integer t, final ConvertContext context) { return t == null? null: t.toString(); } + @Override public String getErrorMessage(final String s, final ConvertContext context) { return IdeBundle.message("value.should.be.integer"); } @@ -74,10 +77,12 @@ public abstract class Converter { @Deprecated public static final Converter EMPTY_CONVERTER = new Converter() { + @Override public String fromString(final String s, final ConvertContext context) { return s; } + @Override public String toString(final String t, final ConvertContext context) { return t; } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/DomFileDescription.java b/xml/dom-openapi/src/com/intellij/util/xml/DomFileDescription.java index 74dc6a849344..eb5de3eebf43 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/DomFileDescription.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/DomFileDescription.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -220,7 +220,7 @@ public class DomFileDescription { * @return dependency item set */ @NotNull - public Set getDependencyItems(XmlFile file) { + public Set getDependencyItems(XmlFile file) { return Collections.emptySet(); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/DomIconProvider.java b/xml/dom-openapi/src/com/intellij/util/xml/DomIconProvider.java index fd47a61b5a06..bd5a9c2244f8 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/DomIconProvider.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/DomIconProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ import javax.swing.*; * @see com.intellij.ide.presentation.Presentation */ public abstract class DomIconProvider extends PomIconProvider { + @Override public Icon getIcon(@NotNull PomTarget target, int flags) { if (target instanceof DomTarget) { return getIcon(((DomTarget)target).getDomElement(), flags); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/DomMetaData.java b/xml/dom-openapi/src/com/intellij/util/xml/DomMetaData.java index 0975c4a0480f..dd94f5be2748 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/DomMetaData.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/DomMetaData.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ public class DomMetaData implements PsiWritableMetaData, P @Nullable private GenericDomValue myNameElement; + @Override public final PsiElement getDeclaration() { return myElement.getXmlTag(); } @@ -42,11 +43,13 @@ public class DomMetaData implements PsiWritableMetaData, P return myElement; } + @Override @NonNls public String getName(PsiElement context) { return getName(); } + @Override @NonNls public final String getName() { final String s = ElementPresentationManager.getElementName(myElement); @@ -56,6 +59,7 @@ public class DomMetaData implements PsiWritableMetaData, P return value == null ? null : value.getStringValue(); } + @Override public void init(PsiElement element) { myElement = (T) DomManager.getDomManager(element.getProject()).getDomElement((XmlTag)element); assert myElement != null : element; @@ -71,6 +75,7 @@ public class DomMetaData implements PsiWritableMetaData, P return myElement.getGenericInfo().getNameDomElement(t); } + @Override public Object[] getDependences() { final PsiElement declaration = getDeclaration(); if (myElement != null && myElement.isValid()) { @@ -79,16 +84,19 @@ public class DomMetaData implements PsiWritableMetaData, P return new Object[]{declaration}; } + @Override public void setName(String name) throws IncorrectOperationException { if (myNameElement != null) { myNameElement.setStringValue(name); } } + @Override public String getTypeName() { return ElementPresentationManager.getTypeNameForObject(myElement); } + @Override public Icon getIcon() { return ElementPresentationManager.getIcon(myElement); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/DomResolveConverter.java b/xml/dom-openapi/src/com/intellij/util/xml/DomResolveConverter.java index 22a59e2989eb..6bcc8a9d30a6 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/DomResolveConverter.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/DomResolveConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,6 +44,7 @@ import java.util.Map; */ public class DomResolveConverter extends ResolvingConverter{ private static final FactoryMap,DomResolveConverter> ourCache = new ConcurrentFactoryMap, DomResolveConverter>() { + @Override @NotNull protected DomResolveConverter create(final Class key) { return new DomResolveConverter(key); @@ -51,11 +52,13 @@ public class DomResolveConverter extends ResolvingConverte }; private final boolean myAttribute; private final SoftFactoryMap>> myResolveCache = new SoftFactoryMap>>() { + @Override @NotNull protected CachedValue> create(final DomElement scope) { final DomManager domManager = scope.getManager(); final Project project = domManager.getProject(); return CachedValuesManager.getManager(project).createCachedValue(new CachedValueProvider>() { + @Override public Result> compute() { final Map map = new THashMap(); visitDomElement(scope, map); @@ -91,6 +94,7 @@ public class DomResolveConverter extends ResolvingConverte return ourCache.get(aClass); } + @Override public final T fromString(final String s, final ConvertContext context) { if (s == null) return null; return (T) myResolveCache.get(getResolvingScope(context)).getValue().get(s); @@ -113,16 +117,19 @@ public class DomResolveConverter extends ResolvingConverte return invocationElement.getManager().getResolvingScope((GenericDomValue)invocationElement); } + @Override public String getErrorMessage(final String s, final ConvertContext context) { return CodeInsightBundle.message("error.cannot.resolve.0.1", TypePresentationService.getService().getTypePresentableName(myClass), s); } + @Override public final String toString(final T t, final ConvertContext context) { if (t == null) return null; return ElementPresentationManager.getElementName(t); } + @Override @NotNull public Collection getVariants(final ConvertContext context) { final DomElement reference = context.getInvocationElement(); @@ -130,6 +137,7 @@ public class DomResolveConverter extends ResolvingConverte return (Collection)myResolveCache.get(scope).getValue().values(); } + @Override public LocalQuickFix[] getQuickFixes(final ConvertContext context) { final DomElement element = context.getInvocationElement(); final GenericDomValue value = ((GenericDomValue)element).createStableCopy(); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/DomService.java b/xml/dom-openapi/src/com/intellij/util/xml/DomService.java index 11a6b632f2d2..dced490f43d5 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/DomService.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/DomService.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,6 +54,7 @@ public abstract class DomService { */ public Collection getDomFileCandidates(Class rootElementClass, Project project, final GlobalSearchScope scope) { return ContainerUtil.findAll(getDomFileCandidates(rootElementClass, project), new Condition() { + @Override public boolean value(final VirtualFile file) { return scope.contains(file); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/DomTarget.java b/xml/dom-openapi/src/com/intellij/util/xml/DomTarget.java index 9f061d0ac7a5..21236fe0e856 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/DomTarget.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/DomTarget.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,19 +81,23 @@ public class DomTarget extends DelegatePsiTarget implements PsiDeclaredTarget, P return new DomTarget(element, tag, XmlTagUtil.getTrimmedValueRange(tag), nameElement); } + @Override public TextRange getNameIdentifierRange() { return myRange; } + @Override public boolean isWritable() { return getNavigationElement().isWritable(); } + @Override public Object setName(@NotNull String newName) { myNameDomElement.setStringValue(newName); return myDomElement; } + @Override @Nullable public String getName() { return myNameDomElement.getStringValue(); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/DomUtil.java b/xml/dom-openapi/src/com/intellij/util/xml/DomUtil.java index 69a261fd149d..723568d2ebeb 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/DomUtil.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/DomUtil.java @@ -53,6 +53,7 @@ public class DomUtil { private static final Key FILE_ELEMENT_KEY = Key.create("dom file element"); private static final ConcurrentFactoryMap ourTypeParameters = new ConcurrentFactoryMap() { + @Override @NotNull protected Class create(final Type key) { final Class result = substituteGenericType(GENERIC_VALUE_TYPE_VARIABLE, key); @@ -60,6 +61,7 @@ public class DomUtil { } }; private static final ConcurrentFactoryMap, Class> ourVariableSubstitutions = new ConcurrentFactoryMap, Class>() { + @Override @Nullable protected Class create(final Couple key) { return ReflectionUtil.substituteGenericType(key.first, key.second); @@ -208,6 +210,7 @@ public class DomUtil { public static List getChildrenOfType(@NotNull final DomElement parent, final Class type) { final List result = new SmartList(); parent.acceptChildren(new DomElementVisitor() { + @Override public void visitDomElement(final DomElement element) { if (type.isInstance(element)) { result.add((T)element); @@ -221,6 +224,7 @@ public class DomUtil { if (parent instanceof MergedObject) { final SmartList result = new SmartList(); parent.acceptChildren(new DomElementVisitor() { + @Override public void visitDomElement(final DomElement element) { if (hasXml(element)) { result.add(element); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/DummyEvaluatedXmlName.java b/xml/dom-openapi/src/com/intellij/util/xml/DummyEvaluatedXmlName.java index 30dbe7f18bd1..dedd40e9a1c3 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/DummyEvaluatedXmlName.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/DummyEvaluatedXmlName.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,10 +36,12 @@ public class DummyEvaluatedXmlName implements EvaluatedXmlName { myNamespace = namespace; } + @Override public XmlName getXmlName() { return myXmlName; } + @Override public EvaluatedXmlName evaluateChildName(@NotNull final XmlName name) { String namespaceKey = name.getNamespaceKey(); if (namespaceKey == null) { @@ -48,10 +50,12 @@ public class DummyEvaluatedXmlName implements EvaluatedXmlName { return EvaluatedXmlNameImpl.createEvaluatedXmlName(name, namespaceKey, false); } + @Override public boolean isNamespaceAllowed(final String namespace, final XmlFile file, boolean qualified) { return namespace.equals(myNamespace); } + @Override @NotNull @NonNls public String getNamespace(@NotNull final XmlElement parentElement, final XmlFile file) { diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ElementPresentationManager.java b/xml/dom-openapi/src/com/intellij/util/xml/ElementPresentationManager.java index 1092a54eabc2..72a33b8144d2 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ElementPresentationManager.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ElementPresentationManager.java @@ -43,6 +43,7 @@ import java.util.List; */ public abstract class ElementPresentationManager { private static final ConcurrentFactoryMap ourNameValueMethods = new ConcurrentFactoryMap() { + @Override @Nullable protected Method create(final Class key) { for (final Method method : ReflectionUtil.getClassPublicMethods(key)) { @@ -55,6 +56,7 @@ public abstract class ElementPresentationManager { }; private final static Function DEFAULT_NAMER = new Function() { + @Override @Nullable public String fun(final Object element) { return getElementName(element); @@ -96,6 +98,7 @@ public abstract class ElementPresentationManager { static { ourIconProviders.add(new NullableFunction() { + @Override public Icon fun(final Object o) { return o instanceof Iconable ? ((Iconable)o).getIcon(Iconable.ICON_FLAG_READ_STATUS) : null; } @@ -115,8 +118,9 @@ public abstract class ElementPresentationManager { public static void registerDocumentationProvider(Function function) { ourDocumentationProviders.add(function); } - public static final NullableFunction NAMER() { + public static NullableFunction NAMER() { return new NullableFunction() { + @Override public String fun(final T o) { return getElementName(o); } @@ -124,6 +128,7 @@ public abstract class ElementPresentationManager { } public static final NullableFunction NAMER = new NullableFunction() { + @Override public String fun(final Object o) { return getElementName(o); } @@ -259,7 +264,7 @@ public abstract class ElementPresentationManager { return null; } - public static Method findNameValueMethod(final Class aClass) { + public static Method findNameValueMethod(final Class aClass) { synchronized (ourNameValueMethods) { return ourNameValueMethods.get(aClass); } @@ -268,6 +273,7 @@ public abstract class ElementPresentationManager { @Nullable public static T findByName(Collection collection, final String name) { return ContainerUtil.find(collection, new Condition() { + @Override public boolean value(final T object) { return Comparing.equal(name, getElementName(object), true); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/EvaluatedXmlNameImpl.java b/xml/dom-openapi/src/com/intellij/util/xml/EvaluatedXmlNameImpl.java index c2422f03a1cc..a0caa3453840 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/EvaluatedXmlNameImpl.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/EvaluatedXmlNameImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,10 +55,12 @@ public class EvaluatedXmlNameImpl implements EvaluatedXmlName { return myXmlName.getLocalName(); } + @Override public final XmlName getXmlName() { return myXmlName; } + @Override public final EvaluatedXmlName evaluateChildName(@NotNull final XmlName name) { String namespaceKey = name.getNamespaceKey(); final boolean equalToParent = Comparing.equal(namespaceKey, myNamespaceKey); @@ -105,8 +107,10 @@ public class EvaluatedXmlNameImpl implements EvaluatedXmlName { CachedValue>> value = file.getUserData(NAMESPACE_PROVIDER_KEY); if (value == null) { file.putUserData(NAMESPACE_PROVIDER_KEY, value = CachedValuesManager.getManager(file.getProject()).createCachedValue(new CachedValueProvider>>() { + @Override public Result>> compute() { final FactoryMap> map = new ConcurrentFactoryMap>() { + @Override protected List create(final String key) { final DomFileDescription description = DomManager.getDomManager(file.getProject()).getDomFileDescription(file); if (description == null) return Collections.emptyList(); @@ -128,10 +132,12 @@ public class EvaluatedXmlNameImpl implements EvaluatedXmlName { } + @Override public final boolean isNamespaceAllowed(String namespace, final XmlFile file, boolean qualified) { return myNamespaceKey == null || myEqualToParent && !qualified || isNamespaceAllowed(namespace, getNamespaceList(file)); } + @Override @NotNull @NonNls public final String getNamespace(@NotNull XmlElement parentElement, final XmlFile file) { final String xmlElementNamespace = getXmlElementNamespace(parentElement); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/GenericDomValue.java b/xml/dom-openapi/src/com/intellij/util/xml/GenericDomValue.java index ce75a5fbcbd1..3eecaa424675 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/GenericDomValue.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/GenericDomValue.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +25,11 @@ public interface GenericDomValue extends DomElement, MutableGenericValue{ @NotNull Converter getConverter(); + @Override @TagValue void setStringValue(String value); + @Override void setValue(T value); /** diff --git a/xml/dom-openapi/src/com/intellij/util/xml/GenericValueUtil.java b/xml/dom-openapi/src/com/intellij/util/xml/GenericValueUtil.java index d83c043b042f..814f46ffe04f 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/GenericValueUtil.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/GenericValueUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,11 +31,13 @@ public class GenericValueUtil { } public static NullableFunction STRING_VALUE = new NullableFunction() { + @Override public String fun(final GenericValue genericValue) { return genericValue.getStringValue(); } }; public static NullableFunction OBJECT_VALUE = new NullableFunction() { + @Override public Object fun(final GenericValue genericValue) { return genericValue.getValue(); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/HyphenNameStrategy.java b/xml/dom-openapi/src/com/intellij/util/xml/HyphenNameStrategy.java index 2242e0f7a0e1..dd1c111ecbee 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/HyphenNameStrategy.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/HyphenNameStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import com.intellij.openapi.util.text.StringUtil; * @author peter */ public class HyphenNameStrategy extends DomNameStrategy { + @Override public String convertName(String propertyName) { final String[] words = NameUtil.nameToWords(propertyName); for (int i = 0; i < words.length; i++) { @@ -33,6 +34,7 @@ public class HyphenNameStrategy extends DomNameStrategy { return StringUtil.join(words, "-"); } + @Override public String splitIntoWords(final String tagName) { return tagName.replace('-', ' '); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/JavaMethod.java b/xml/dom-openapi/src/com/intellij/util/xml/JavaMethod.java index c4fe1c96596f..4f615dadda6a 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/JavaMethod.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/JavaMethod.java @@ -92,6 +92,7 @@ public final class JavaMethod implements AnnotatedElement { return myMethod.getName(); } + @Override public final T getAnnotation(Class annotationClass) { Object annotation = myAnnotationsMap.get(annotationClass); if (annotation == null) { diff --git a/xml/dom-openapi/src/com/intellij/util/xml/JavaNameStrategy.java b/xml/dom-openapi/src/com/intellij/util/xml/JavaNameStrategy.java index e6cabb9db0e8..998f4068b200 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/JavaNameStrategy.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/JavaNameStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,15 +28,18 @@ import java.util.Arrays; */ public class JavaNameStrategy extends DomNameStrategy { public static final Function DECAPITALIZE_FUNCTION = new Function() { + @Override public String fun(final String s) { return StringUtil.decapitalize(s); } }; + @Override public final String convertName(String propertyName) { return StringUtil.decapitalize(propertyName); } + @Override public final String splitIntoWords(final String tagName) { return StringUtil.join(Arrays.asList(NameUtil.nameToWords(tagName)), DECAPITALIZE_FUNCTION, " "); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/MergingFileDescription.java b/xml/dom-openapi/src/com/intellij/util/xml/MergingFileDescription.java index 1dbe3d4a354e..451e2751809a 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/MergingFileDescription.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/MergingFileDescription.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,6 +38,7 @@ public abstract class MergingFileDescription extends DomFi @NotNull protected abstract Set getFilesToMerge(DomElement element); + @Override @NotNull public DomElement getResolveScope(GenericDomValue reference) { final DomElement annotation = getScopeFromAnnotation(reference); @@ -82,6 +83,7 @@ public abstract class MergingFileDescription extends DomFi return myMerger.mergeModels(getRootElementClass(), roots); } + @Override @NotNull public DomElement getIdentityScope(DomElement element) { final DomElement annotation = getScopeFromAnnotation(element); @@ -98,6 +100,7 @@ public abstract class MergingFileDescription extends DomFi return (DomElement)o; } + @Override public boolean isAutomaticHighlightingEnabled() { return false; } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ModelMergerUtil.java b/xml/dom-openapi/src/com/intellij/util/xml/ModelMergerUtil.java index 2481f42aba2f..2b38c6a965e5 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ModelMergerUtil.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ModelMergerUtil.java @@ -59,6 +59,7 @@ public class ModelMergerUtil { public static V getImplementation(final T element, final Class clazz) { if (element == null) return null; CommonProcessors.FindFirstProcessor processor = new CommonProcessors.FindFirstProcessor() { + @Override public boolean process(final T t) { return !ReflectionUtil.isAssignable(clazz, t.getClass()) || super.process(t); } @@ -71,6 +72,7 @@ public class ModelMergerUtil { public static Collection getImplementations(final T element, final Class clazz) { if (element == null) return Collections.emptyList(); CommonProcessors.CollectProcessor processor = new CommonProcessors.CollectProcessor() { + @Override public boolean process(final T t) { return !ReflectionUtil.isAssignable(clazz, t.getClass()) || super.process(t); } @@ -115,6 +117,7 @@ public class ModelMergerUtil { myProcessMerged = processMerged; } + @Override public boolean process(final T t) { final boolean merged = t instanceof MergedObject; if ((!merged || myProcessMerged) && !myProcessor.process(t)) { diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ModuleContentRootSearchScope.java b/xml/dom-openapi/src/com/intellij/util/xml/ModuleContentRootSearchScope.java index 8a509404bca9..2b54b14d8564 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ModuleContentRootSearchScope.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ModuleContentRootSearchScope.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,18 +31,22 @@ public class ModuleContentRootSearchScope extends GlobalSearchScope { myModule = module; } + @Override public boolean contains(@NotNull final VirtualFile file) { return myRootManager.getFileIndex().isInContent(file); } + @Override public int compare(@NotNull final VirtualFile file1, @NotNull final VirtualFile file2) { return 0; } + @Override public boolean isSearchInModuleContent(@NotNull final Module aModule) { return aModule == myModule; } + @Override public boolean isSearchInLibraries() { return false; } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/NamedEnumUtil.java b/xml/dom-openapi/src/com/intellij/util/xml/NamedEnumUtil.java index 85a59b8c36cb..d8bada07207b 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/NamedEnumUtil.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/NamedEnumUtil.java @@ -24,11 +24,13 @@ import com.intellij.util.ReflectionUtil; */ public class NamedEnumUtil { private static final Function NAMED_SHOW = new Function() { + @Override public String fun(final Enum s) { return ((NamedEnum) s).getValue(); } }; private static final Function SIMPLE_SHOW = new Function() { + @Override public String fun(final Enum s) { return s.name(); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ParentScopeProvider.java b/xml/dom-openapi/src/com/intellij/util/xml/ParentScopeProvider.java index c84fa31631d8..a476377ad097 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ParentScopeProvider.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ParentScopeProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ package com.intellij.util.xml; * @author peter */ public class ParentScopeProvider extends ScopeProvider{ + @Override public DomElement getScope(DomElement element) { return element.getParent(); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ResolvingConverter.java b/xml/dom-openapi/src/com/intellij/util/xml/ResolvingConverter.java index f6aa635ad663..7c39d3ecb4c5 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ResolvingConverter.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ResolvingConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,15 +37,18 @@ import java.util.Set; public abstract class ResolvingConverter extends Converter { @Deprecated public static final ResolvingConverter EMPTY_CONVERTER = new ResolvingConverter() { + @Override @NotNull public Collection getVariants(final ConvertContext context) { return Collections.emptyList(); } + @Override public Object fromString(final String s, final ConvertContext context) { return s; } + @Override public String toString(final Object t, final ConvertContext context) { return String.valueOf(t); } @@ -54,6 +57,7 @@ public abstract class ResolvingConverter extends Converter { /** @see com.intellij.util.xml.converters.values.BooleanValueConverter */ @Deprecated public static final Converter BOOLEAN_CONVERTER = new ResolvingConverter() { + @Override public Boolean fromString(final String s, final ConvertContext context) { if ("true".equalsIgnoreCase(s)) { return Boolean.TRUE; @@ -64,10 +68,12 @@ public abstract class ResolvingConverter extends Converter { return null; } + @Override public String toString(final Boolean t, final ConvertContext context) { return t == null? null:t.toString(); } + @Override @NotNull public Collection getVariants(final ConvertContext context) { final DomElement element = context.getInvocationElement(); @@ -80,6 +86,7 @@ public abstract class ResolvingConverter extends Converter { } }; + @Override public String getErrorMessage(@Nullable String s, final ConvertContext context) { return CodeInsightBundle.message("error.cannot.resolve.default.message", s); } @@ -202,10 +209,12 @@ public abstract class ResolvingConverter extends Converter { */ public static abstract class StringConverter extends ResolvingConverter { + @Override public String fromString(final String s, final ConvertContext context) { return s; } + @Override public String toString(final String s, final ConvertContext context) { return s; } @@ -223,10 +232,12 @@ public abstract class ResolvingConverter extends Converter { myWrappedConverter = converter; } + @Override public T fromString(final String s, final ConvertContext context) { return myWrappedConverter.fromString(s, context); } + @Override public String toString(final T t, final ConvertContext context) { return myWrappedConverter.toString(t, context); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/RootScopeProvider.java b/xml/dom-openapi/src/com/intellij/util/xml/RootScopeProvider.java index 79e19230c198..53e559a6b4cd 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/RootScopeProvider.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/RootScopeProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import org.jetbrains.annotations.NotNull; */ public class RootScopeProvider extends ScopeProvider{ + @Override public DomElement getScope(@NotNull DomElement element) { return DomUtil.getRoot(element); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/TypeChooserManager.java b/xml/dom-openapi/src/com/intellij/util/xml/TypeChooserManager.java index 5086052bb6d4..6602d0fe9a7a 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/TypeChooserManager.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/TypeChooserManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,13 +30,16 @@ public class TypeChooserManager { public TypeChooser getTypeChooser(final Type type) { final TypeChooser typeChooser = myClassChoosers.get(type); return typeChooser != null ? typeChooser : new TypeChooser() { + @Override public Type chooseType(final XmlTag tag) { return type; } + @Override public void distinguishTag(final XmlTag tag, final Type aClass) { } + @Override public Type[] getChooserTypes() { return new Type[]{type}; } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/WrappingConverter.java b/xml/dom-openapi/src/com/intellij/util/xml/WrappingConverter.java index c80c89b6a45b..a0305a935e52 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/WrappingConverter.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/WrappingConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ import java.util.List; */ public abstract class WrappingConverter extends Converter { + @Override public Object fromString(@Nullable @NonNls String s, final ConvertContext context) { final List converters = getConverters((GenericDomValue)context.getInvocationElement()); if (converters.isEmpty()) return s; @@ -42,6 +43,7 @@ public abstract class WrappingConverter extends Converter { return null; } + @Override public String toString(@Nullable Object t, final ConvertContext context) { final List converters = getConverters((GenericDomValue)context.getInvocationElement()); if (converters.isEmpty()) return String.valueOf(t); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/XmlName.java b/xml/dom-openapi/src/com/intellij/util/xml/XmlName.java index a3a562ea2526..669182205b1a 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/XmlName.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/XmlName.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,6 +69,7 @@ public class XmlName implements Comparable { } + @Override public int compareTo(XmlName o) { final int i = myLocalName.compareTo(o.myLocalName); if (i != 0) { diff --git a/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/AbstractDomGenerateProvider.java b/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/AbstractDomGenerateProvider.java index 769d848396cf..536ef38ec6d0 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/AbstractDomGenerateProvider.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/AbstractDomGenerateProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,6 +45,7 @@ public abstract class AbstractDomGenerateProvider extends myMappingId = mappingId; } + @Override public T generate(final Project project, final Editor editor, final PsiFile file) { DomElement parentDomElement = getParentDomElement(project, editor, file); @@ -87,8 +88,10 @@ public abstract class AbstractDomGenerateProvider extends DomTemplateRunner.getInstance(file.getProject()).runTemplate(t, myMappingId, editor, predefinedVars); } + @Override protected abstract DomElement getParentDomElement(final Project project, final Editor editor, final PsiFile file); + @Override @SuppressWarnings({"unchecked"}) protected void doNavigate(final DomElementNavigationProvider navigateProvider, final DomElement copy) { final DomElement element = getElementToNavigate((T)copy); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/DefaultGenerateElementProvider.java b/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/DefaultGenerateElementProvider.java index a14ad6801cce..2ab81a61877c 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/DefaultGenerateElementProvider.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/actions/generate/DefaultGenerateElementProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,6 +48,7 @@ public abstract class DefaultGenerateElementProvider exten } + @Override @Nullable public T generate(final Project project, final Editor editor, final PsiFile file) { return generate(getParentDomElement(project, editor, file), editor); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/converters/DelimitedListConverter.java b/xml/dom-openapi/src/com/intellij/util/xml/converters/DelimitedListConverter.java index f7b946dec9cb..a951032b1b03 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/converters/DelimitedListConverter.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/converters/DelimitedListConverter.java @@ -60,6 +60,7 @@ public abstract class DelimitedListConverter extends ResolvingConverter> getVariants(final ConvertContext context) { return Collections.emptyList(); @@ -84,6 +85,7 @@ public abstract class DelimitedListConverter extends ResolvingConverter fromString(@Nullable final String str, final ConvertContext context) { if (str == null) { return null; @@ -99,6 +101,7 @@ public abstract class DelimitedListConverter extends ResolvingConverter ts, final ConvertContext context) { final StringBuilder buffer = new StringBuilder(); final char delimiter = getDefaultDelimiter(); @@ -114,6 +117,7 @@ public abstract class DelimitedListConverter extends ResolvingConverter> genericDomValue, final PsiElement element, @@ -126,6 +130,7 @@ public abstract class DelimitedListConverter extends ResolvingConverter references = new ArrayList(); new DelimitedListProcessor(myDelimiters) { + @Override protected void processToken(final int start, final int end, final boolean delimitersOnly) { references.add(createPsiReference(element, start + 1, end + 1, context, genericDomValue, delimitersOnly)); } @@ -182,6 +187,7 @@ public abstract class DelimitedListConverter extends ResolvingConverter extends ResolvingConverter extends ResolvingConverter getSuperBindToElementFunction(final Ref ref) { return new Function() { + @Override public PsiElement fun(final PsiElement s) { try { return MyPsiReference.super.bindToElement(s); @@ -240,6 +248,7 @@ public abstract class DelimitedListConverter extends ResolvingConverter getSuperElementRenameFunction(final Ref ref) { return new Function() { + @Override public PsiElement fun(final String s) { try { return MyPsiReference.super.handleElementRename(s); @@ -253,6 +262,7 @@ public abstract class DelimitedListConverter extends ResolvingConverter implements CustomReferenceConverter { public final static Converter INSTANCE = new PathReferenceConverter(); + @Override public PathReference fromString(@Nullable final String s, final ConvertContext context) { final XmlElement element = context.getXmlElement(); return s == null || element == null ? null : PathReferenceManager.getInstance().getPathReference(s, element); } + @Override public String toString(final PathReference t, final ConvertContext context) { return t == null ? null : t.getPath(); } + @Override @NotNull public PsiReference[] createReferences(final GenericDomValue genericDomValue, final PsiElement element, final ConvertContext context) { return createReferences(element, true); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/converters/values/BooleanValueConverter.java b/xml/dom-openapi/src/com/intellij/util/xml/converters/values/BooleanValueConverter.java index ed98cb728ed8..be6fe9bf2c7c 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/converters/values/BooleanValueConverter.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/converters/values/BooleanValueConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,6 +69,7 @@ public class BooleanValueConverter extends ResolvingConverter { return Arrays.binarySearch(getTrueValues(), s) >= 0; } + @Override public String fromString(@Nullable @NonNls final String stringValue, final ConvertContext context) { if (stringValue != null && ((myAllowEmpty && stringValue.trim().length() == 0) || Arrays.binarySearch(getAllValues(), stringValue) >= 0)) { return stringValue; @@ -76,15 +77,18 @@ public class BooleanValueConverter extends ResolvingConverter { return null; } + @Override public String toString(@Nullable final String s, final ConvertContext context) { return s; } + @Override @NotNull public Collection getVariants(final ConvertContext context) { return Arrays.asList(VARIANTS); } + @Override public String getErrorMessage(@Nullable final String s, final ConvertContext context) { return DomBundle.message("value.converter.format.exception", s, BOOLEAN); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/converters/values/CharacterValueConverter.java b/xml/dom-openapi/src/com/intellij/util/xml/converters/values/CharacterValueConverter.java index d740a82c47f5..c6654ba31f4d 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/converters/values/CharacterValueConverter.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/converters/values/CharacterValueConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ public class CharacterValueConverter extends Converter { } + @Override public String fromString(@Nullable @NonNls String s, final ConvertContext context) { if (s == null) return null; @@ -52,10 +53,12 @@ public class CharacterValueConverter extends Converter { return sequence.startsWith(UNICODE_PREFIX) && sequence.length() == UNICODE_LENGTH; } + @Override public String toString(@Nullable String s, final ConvertContext context) { return s; } + @Override public String getErrorMessage(@Nullable final String s, final ConvertContext context) { return DomBundle.message("value.converter.format.exception", s, "char"); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/converters/values/NumberValueConverter.java b/xml/dom-openapi/src/com/intellij/util/xml/converters/values/NumberValueConverter.java index 7aa3b9d33aef..bf24b6b9cc3d 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/converters/values/NumberValueConverter.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/converters/values/NumberValueConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ package com.intellij.util.xml.converters.values; import com.intellij.util.xml.ConvertContext; -import com.intellij.util.xml.Converter; import com.intellij.util.xml.DomBundle; import com.intellij.util.xml.ResolvingConverter; import org.jetbrains.annotations.NonNls; @@ -40,6 +39,7 @@ public class NumberValueConverter extends ResolvingConverter { myAllowEmpty = allowEmpty; } + @Override public String fromString(@Nullable @NonNls final String s, final ConvertContext context) { if (s == null) return null; @@ -48,10 +48,12 @@ public class NumberValueConverter extends ResolvingConverter { return parseNumber(s, myNumberClass) == null ? null : s; } + @Override public String toString(@Nullable final String s, final ConvertContext context) { return null; } + @Override public String getErrorMessage(@Nullable final String s, final ConvertContext context) { if (s == null) return super.getErrorMessage(s, context); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/AddDomElementQuickFix.java b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/AddDomElementQuickFix.java index b7a4a74809b6..5a735bdb45f8 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/AddDomElementQuickFix.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/AddDomElementQuickFix.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,6 +37,7 @@ public class AddDomElementQuickFix implements LocalQuickFi myName = computeName(); } + @Override @NotNull public String getName() { return myName; @@ -53,11 +54,13 @@ public class AddDomElementQuickFix implements LocalQuickFi return myElement.getXmlElement() instanceof XmlTag; } + @Override @NotNull public String getFamilyName() { return DomBundle.message("quick.fixes.family"); } + @Override public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { myElement.ensureXmlElementExists(); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/BasicDomElementsInspection.java b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/BasicDomElementsInspection.java index f1c7c089450d..d62ef2d37433 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/BasicDomElementsInspection.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/BasicDomElementsInspection.java @@ -53,6 +53,7 @@ public abstract class BasicDomElementsInspection extends D * @param holder a place to add problems to * @param helper helper object */ + @Override protected void checkDomElement(DomElement element, DomElementAnnotationHolder holder, DomHighlightingHelper helper) { final int oldSize = holder.getSize(); if (element instanceof GenericDomValue) { diff --git a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptor.java b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptor.java index b67b1a64f43f..c4560493ef84 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptor.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementResolveProblemDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ public interface DomElementResolveProblemDescriptor extends DomElementProblemDes @NotNull PsiReference getPsiReference(); + @Override @NotNull GenericDomValue getDomElement(); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementsInspection.java b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementsInspection.java index 3c7844b0e04e..2200e6fc15c9 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementsInspection.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/DomElementsInspection.java @@ -65,6 +65,7 @@ public abstract class DomElementsInspection extends XmlSup final DomHighlightingHelper helper = DomElementAnnotationsManager.getInstance(domFileElement.getManager().getProject()).getHighlightingHelper(); final Consumer consumer = new Consumer() { + @Override public void consume(final DomElement element) { checkChildren(element, this); checkDomElement(element, holder, helper); @@ -111,6 +112,7 @@ public abstract class DomElementsInspection extends XmlSup * Override {@link #checkFileElement(com.intellij.util.xml.DomFileElement, DomElementAnnotationHolder)} (which is preferred) or * {@link #checkDomElement(com.intellij.util.xml.DomElement, DomElementAnnotationHolder, DomHighlightingHelper)} instead. */ + @Override @Nullable public ProblemDescriptor[] checkFile(@NotNull PsiFile file, @NotNull InspectionManager manager, boolean isOnTheFly) { if (file instanceof XmlFile && (file.isPhysical() || ApplicationManager.getApplication().isUnitTestMode())) { @@ -125,11 +127,13 @@ public abstract class DomElementsInspection extends XmlSup return null; } + @Override @NotNull public HighlightDisplayLevel getDefaultLevel() { return HighlightDisplayLevel.ERROR; } + @Override public boolean isEnabledByDefault() { return true; } @@ -148,6 +152,7 @@ public abstract class DomElementsInspection extends XmlSup List problems = ContainerUtil.concat(list, new Function>() { + @Override public Collection fun(final DomElementProblemDescriptor s) { return annotationsManager.createProblemDescriptors(manager, s); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/RemoveDomElementQuickFix.java b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/RemoveDomElementQuickFix.java index d24f7caf1456..67710fa38187 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/RemoveDomElementQuickFix.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/RemoveDomElementQuickFix.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +39,7 @@ public class RemoveDomElementQuickFix implements LocalQuickFix { myName = element.getXmlElementName(); } + @Override @NotNull public String getName() { return myIsTag ? @@ -46,11 +47,13 @@ public class RemoveDomElementQuickFix implements LocalQuickFix { DomBundle.message("remove.attribute.fix.name", myName); } + @Override @NotNull public String getFamilyName() { return DomBundle.message("quick.fixes.family"); } + @Override public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { if (myIsTag) { final XmlTag tag = (XmlTag)descriptor.getPsiElement(); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/ResolvingElementQuickFix.java b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/ResolvingElementQuickFix.java index 5dafd7e23aee..7b0bdbdfdb68 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/highlighting/ResolvingElementQuickFix.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/highlighting/ResolvingElementQuickFix.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -65,41 +65,50 @@ public class ResolvingElementQuickFix implements LocalQuickFix, IntentionAction myTypeName = typeName; } + @Override @NotNull public String getName() { return DomBundle.message("create.new.element", myTypeName, myNewName); } + @Override @NotNull public String getText() { return getName(); } + @Override @NotNull public String getFamilyName() { return DomBundle.message("quick.fixes.family"); } + @Override public boolean isAvailable(@NotNull final Project project, final Editor editor, final PsiFile file) { return true; } + @Override public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException { applyFix(); } + @Override public boolean startInWriteAction() { return false; } + @Override public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) { applyFix(); } private void applyFix() { chooseParent(myParents, new Consumer() { + @Override public void consume(final DomElement parent) { new WriteCommandAction.Simple(parent.getManager().getProject(), DomUtil.getFile(parent)) { + @Override protected void run() throws Throwable { doFix(parent, myChildDescription, myNewName); } @@ -125,15 +134,18 @@ public class ResolvingElementQuickFix implements LocalQuickFix, IntentionAction return; default: JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep(DomBundle.message("choose.file"), files) { + @Override public PopupStep onChosen(final DomElement selectedValue, final boolean finalChoice) { onChoose.consume(selectedValue); return super.onChosen(selectedValue, finalChoice); } + @Override public Icon getIconFor(final DomElement aValue) { return DomUtil.getFile(aValue).getIcon(0); } + @Override @NotNull public String getTextFor(final DomElement value) { final String name = DomUtil.getFile(value).getName(); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/model/DomModelCache.java b/xml/dom-openapi/src/com/intellij/util/xml/model/DomModelCache.java index 1a1829ed7e66..dfe2f7e29e74 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/model/DomModelCache.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/model/DomModelCache.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ package com.intellij.util.xml.model; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.UserDataHolder; -import com.intellij.psi.PsiManager; import com.intellij.psi.util.CachedValue; import com.intellij.psi.util.CachedValueProvider; import com.intellij.psi.util.CachedValuesManager; @@ -45,6 +44,7 @@ public abstract class DomModelCache { CachedValue cachedValue = dataHolder.getUserData(myKey); if (cachedValue == null) { final CachedValueProvider myProvider = new CachedValueProvider() { + @Override @Nullable public Result compute() { return computeValue(dataHolder); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/BaseDomModelFactory.java b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/BaseDomModelFactory.java index 70c0b2e3096c..dbeaeac199bb 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/BaseDomModelFactory.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/BaseDomModelFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -74,11 +74,13 @@ public abstract class BaseDomModelFactory getAllModels(@NotNull S scope) { return myMultipleDomModelFactory.getAllModels(scope); } + @Override @Nullable public M getModelByConfigFile(@Nullable XmlFile psiFile) { return mySimpleDomModelFactory.getModelByConfigFile(psiFile); @@ -110,16 +112,19 @@ public abstract class BaseDomModelFactory getAllConfigFiles(@NotNull S scope) { return myMultipleDomModelFactory.getAllConfigFiles(scope); } + @Override @Nullable public DomFileElement createMergedModelRoot(final Set configFiles) { return mySimpleDomModelFactory.createMergedModelRoot(configFiles); @@ -130,14 +135,17 @@ public abstract class BaseDomModelFactory(aClass, modelMerger, project, name) { + @Override public M getModel(@NotNull final C context) { return BaseDomModelFactory.this.getModel(context); } + @Override protected List computeAllModels(@NotNull final S scope) { return BaseDomModelFactory.this.computeAllModels(scope); } + @Override protected M createCombinedModel(final Set configFiles, final DomFileElement mergedModel, final M firstModel, @@ -145,11 +153,13 @@ public abstract class BaseDomModelFactory(aClass, modelMerger, project, name) { + @Override protected M computeModel(@NotNull final XmlFile psiFile, @Nullable final S scope) { return BaseDomModelFactory.this.computeModel(psiFile, scope); } + @Override @NotNull public Object[] computeDependencies(@Nullable final M model, @Nullable final S scope) { return BaseDomModelFactory.this.computeDependencies(model, scope); } + @Override public S getModelScope(@NotNull XmlFile file) { return BaseDomModelFactory.this.getModelScope(file); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/CachedMultipleDomModelFactory.java b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/CachedMultipleDomModelFactory.java index fba3581a28c8..3109e8cb2edd 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/CachedMultipleDomModelFactory.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/CachedMultipleDomModelFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,6 +52,7 @@ public abstract class CachedMultipleDomModelFactory(project, name + " combined model") { + @Override @NotNull protected CachedValueProvider.Result computeValue(@NotNull final Scope scope) { final M combinedModel = computeCombinedModel(scope); @@ -60,6 +61,7 @@ public abstract class CachedMultipleDomModelFactory, Scope>(project, name + " models list") { + @Override @NotNull protected CachedValueProvider.Result> computeValue(@NotNull final Scope scope) { final List models = computeAllModels(scope); @@ -71,6 +73,7 @@ public abstract class CachedMultipleDomModelFactory getAllModels(@NotNull Scope scope) { @@ -86,6 +89,7 @@ public abstract class CachedMultipleDomModelFactory computeAllModels(@NotNull Scope scope); + @Override @Nullable public M getCombinedModel(@Nullable Scope scope) { if (scope == null) { @@ -143,6 +147,7 @@ public abstract class CachedMultipleDomModelFactory getAllConfigFiles(@NotNull Scope scope) { final HashSet xmlFiles = new HashSet(); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/CachedSimpleDomModelFactory.java b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/CachedSimpleDomModelFactory.java index ec4f9d402536..0a8f30e4f36b 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/CachedSimpleDomModelFactory.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/CachedSimpleDomModelFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,6 +43,7 @@ public abstract class CachedSimpleDomModelFactory(project, name + " model") { + @Override @NotNull protected CachedValueProvider.Result computeValue(@NotNull XmlFile file) { file = (XmlFile)file.getOriginalFile(); @@ -54,6 +55,7 @@ public abstract class CachedSimpleDomModelFactory implements DomModel { myClass = clazz; } + @Override @NotNull public T getMergedModel() { if (myMergedModel == null) { final DomManager domManager = DomManager.getDomManager(myProject); return domManager.createModelMerger().mergeModels(myClass, ContainerUtil.mapNotNull(myConfigFiles, new NullableFunction() { + @Override public T fun(XmlFile xmlFile) { DomFileElement fileElement = domManager.getFileElement(xmlFile, myClass); return fileElement == null ? null : fileElement.getRootElement(); @@ -74,15 +76,18 @@ public class DomModelImpl implements DomModel { return myMergedModel.getRootElement(); } + @Override @NotNull public Set getConfigFiles() { return myConfigFiles; } + @Override @NotNull public List> getRoots() { if (myMergedModel == null) { return ContainerUtil.mapNotNull(myConfigFiles, new NullableFunction>() { + @Override public DomFileElement fun(XmlFile xmlFile) { return DomManager.getDomManager(xmlFile.getProject()).getFileElement(xmlFile, myClass); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/SimpleDomModelFactory.java b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/SimpleDomModelFactory.java index 72d0e3a6246d..77e15914f7c9 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/model/impl/SimpleDomModelFactory.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/model/impl/SimpleDomModelFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,6 +40,7 @@ public abstract class SimpleDomModelFactory createMergedModelRoot(Set configFiles) { List> configs = new ArrayList>(configFiles.size()); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/reflect/DomFixedChildDescription.java b/xml/dom-openapi/src/com/intellij/util/xml/reflect/DomFixedChildDescription.java index fcfde5c4a5a5..0dae377d4fb7 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/reflect/DomFixedChildDescription.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/reflect/DomFixedChildDescription.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ */ package com.intellij.util.xml.reflect; -import com.intellij.util.xml.DomElement; import com.intellij.util.xml.JavaMethod; import org.jetbrains.annotations.Nullable; diff --git a/xml/dom-openapi/src/com/intellij/util/xml/tree/AbstractDomElementNode.java b/xml/dom-openapi/src/com/intellij/util/xml/tree/AbstractDomElementNode.java index e2c00c5cdd7d..1beb01a0a1b3 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/tree/AbstractDomElementNode.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/tree/AbstractDomElementNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ abstract public class AbstractDomElementNode extends SimpleNode { public static final Key> TREE_NODES_HIDERS_KEY = Key.create("TREE_NODES_HIDERS_KEY"); private final static Comparator INHERITORS_COMPARATOR = new Comparator() { + @Override public int compare(final Class o1, final Class o2) { return o1.isAssignableFrom(o2) ? 1 : -1; } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/tree/BaseDomElementNode.java b/xml/dom-openapi/src/com/intellij/util/xml/tree/BaseDomElementNode.java index 92aaedede5a5..e5f08bbdf638 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/tree/BaseDomElementNode.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/tree/BaseDomElementNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -65,10 +65,12 @@ public class BaseDomElementNode extends AbstractDomElementNode { folder = isMarkedType(modelElement.getDomElementType(), FOLDER_NODES_KEY); } + @Override public SimpleNode[] getChildren() { return doGetChildren(myDomElement); } + @Override public void handleDoubleClickOrEnter(SimpleTree tree, InputEvent inputEvent) { if (inputEvent instanceof MouseEvent) { inputEvent.consume(); @@ -146,6 +148,7 @@ public class BaseDomElementNode extends AbstractDomElementNode { final XmlElementDescriptor[] childDescriptors = descriptor.getElementsDescriptors(tag); if (childDescriptors != null && childDescriptors.length > 1) { return new Comparator() { + @Override public int compare(final AbstractDomElementNode o1, final AbstractDomElementNode o2) { return findDescriptor(childDescriptors, o1.getTagName()) - findDescriptor(childDescriptors, o2.getTagName()); } @@ -178,11 +181,13 @@ public class BaseDomElementNode extends AbstractDomElementNode { return consolidated; } + @Override @NotNull public Object[] getEqualityObjects() { return new Object[]{myDomElement}; } + @Override protected void doUpdate() { if (!myDomElement.isValid()) return; final Project project = myDomElement.getManager().getProject(); @@ -236,6 +241,7 @@ public class BaseDomElementNode extends AbstractDomElementNode { return true; } + @Override public String getNodeName() { if (!myDomElement.isValid()) return ""; @@ -243,18 +249,22 @@ public class BaseDomElementNode extends AbstractDomElementNode { return name != null && name.trim().length() > 0 ? name : getPropertyName(); } + @Override public String getTagName() { return myTagName; } + @Override public DomElement getDomElement() { return myDomElement; } + @Override public boolean isAutoExpandNode() { return getParent() == null; } + @Override public boolean expandOnDoubleClick() { return true; } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/tree/DomElementsGroupNode.java b/xml/dom-openapi/src/com/intellij/util/xml/tree/DomElementsGroupNode.java index ea8ca192df60..501b3a0ee050 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/tree/DomElementsGroupNode.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/tree/DomElementsGroupNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,6 +49,7 @@ public class DomElementsGroupNode extends AbstractDomElementNode { myRootDomElement = rootDomElement; } + @Override public SimpleNode[] getChildren() { if (!myParentElement.isValid()) return NO_CHILDREN; @@ -61,11 +62,13 @@ public class DomElementsGroupNode extends AbstractDomElementNode { return simpleNodes.toArray(new SimpleNode[simpleNodes.size()]); } + @Override @NotNull public Object[] getEqualityObjects() { return new Object[]{myParentElement, myChildrenTagName}; } + @Override protected void doUpdate() { setUniformIcon(getNodeIcon()); @@ -100,16 +103,19 @@ public class DomElementsGroupNode extends AbstractDomElementNode { return false; } + @Override public String getNodeName() { if (!myParentElement.isValid()) return ""; return myChildDescription.getCommonPresentableName(myParentElement); } + @Override public String getTagName() { return myChildrenTagName; } + @Override public DomElement getDomElement() { return myParentElement; } @@ -120,6 +126,7 @@ public class DomElementsGroupNode extends AbstractDomElementNode { } + @Override public Icon getNodeIcon() { Class clazz = ReflectionUtil.getRawType(myChildDescription.getType()); // Class arrayClass = Array.newInstance(clazz, 0).getClass(); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/tree/DomFileElementNode.java b/xml/dom-openapi/src/com/intellij/util/xml/tree/DomFileElementNode.java index 6ce17cd900db..8c57658d195a 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/tree/DomFileElementNode.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/tree/DomFileElementNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,16 +28,19 @@ public class DomFileElementNode extends BaseDomElementNode { myFileElement = fileElement; } + @Override public SimpleNode[] getChildren() { return doGetChildren(myFileElement.getRootElement()); } + @Override public DomFileElement getDomElement() { return (DomFileElement)super.getDomElement(); } + @Override public boolean isShowContainingFileInfo() { return false; } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/tree/DomModelTreeStructure.java b/xml/dom-openapi/src/com/intellij/util/xml/tree/DomModelTreeStructure.java index ceda5e16f43c..415574ebc416 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/tree/DomModelTreeStructure.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/tree/DomModelTreeStructure.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ public class DomModelTreeStructure extends SimpleTreeStructure { return new BaseDomElementNode(myDomElement); } + @Override public AbstractDomElementNode getRootElement() { if (myRootNode == null) { myRootNode = createRoot(myDomElement); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/tree/DomModelTreeView.java b/xml/dom-openapi/src/com/intellij/util/xml/tree/DomModelTreeView.java index 14886ebe1e82..1935228d86eb 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/tree/DomModelTreeView.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/tree/DomModelTreeView.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,6 +83,7 @@ public class DomModelTreeView extends Wrapper implements DataProvider, Disposabl add(myTree, BorderLayout.CENTER); myTree.addTreeExpansionListener(new TreeExpansionListener() { + @Override public void treeExpanded(TreeExpansionEvent event) { final SimpleNode simpleNode = myTree.getNodeFor(event.getPath()); @@ -91,6 +92,7 @@ public class DomModelTreeView extends Wrapper implements DataProvider, Disposabl } } + @Override public void treeCollapsed(TreeExpansionEvent event) { final SimpleNode simpleNode = myTree.getNodeFor(event.getPath()); @@ -102,6 +104,7 @@ public class DomModelTreeView extends Wrapper implements DataProvider, Disposabl }); myDomManager.addDomEventListener(new DomChangeAdapter() { + @Override protected void elementChanged(DomElement element) { if (element.isValid()) { queueUpdate(DomUtil.getFile(element).getVirtualFile()); @@ -115,6 +118,7 @@ public class DomModelTreeView extends Wrapper implements DataProvider, Disposabl final Project project = myDomManager.getProject(); DomElementAnnotationsManager.getInstance(project).addHighlightingListener(new DomElementAnnotationsManager.DomHighlightingListener() { + @Override public void highlightingFinished(DomFileElement element) { if (element.isValid()) { queueUpdate(DomUtil.getFile(element).getVirtualFile()); @@ -133,6 +137,7 @@ public class DomModelTreeView extends Wrapper implements DataProvider, Disposabl if (file == null) return; if (getProject().isDisposed()) return; ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override public void run() { if (getProject().isDisposed()) return; if (!file.isValid() || isRightFile(file)) { @@ -162,6 +167,7 @@ public class DomModelTreeView extends Wrapper implements DataProvider, Disposabl return myBuilder; } + @Override public void dispose() { } @@ -181,6 +187,7 @@ public class DomModelTreeView extends Wrapper implements DataProvider, Disposabl return group; } + @Override @Nullable public Object getData(String dataId) { if (DomModelTreeView.DATA_KEY.is(dataId)) { diff --git a/xml/dom-openapi/src/com/intellij/util/xml/tree/GenericValueNode.java b/xml/dom-openapi/src/com/intellij/util/xml/tree/GenericValueNode.java index d71a64c4692d..dce3154170cb 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/tree/GenericValueNode.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/tree/GenericValueNode.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,18 +33,22 @@ public class GenericValueNode extends AbstractDomElementNode { myTagName = modelElement.getXmlElementName(); } + @Override public String getNodeName() { return getPropertyName(); } + @Override public String getTagName() { return myTagName; } + @Override public DomElement getDomElement() { return myModelElement; } + @Override protected void doUpdate() { setUniformIcon(getNodeIcon()); clearColoredText(); @@ -63,10 +67,12 @@ public class GenericValueNode extends AbstractDomElementNode { } } + @Override public SimpleNode[] getChildren() { return NO_CHILDREN; } + @Override @NotNull public Object[] getEqualityObjects() { return new Object[]{myModelElement}; diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/AbstractDomElementComponent.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/AbstractDomElementComponent.java index a01f73f592aa..f161f3b0cc2f 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/AbstractDomElementComponent.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/AbstractDomElementComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,6 @@ package com.intellij.util.xml.ui; import com.intellij.util.ui.UIUtil; import com.intellij.util.xml.DomElement; -import com.intellij.util.xml.DomFileElement; -import com.intellij.util.xml.highlighting.DomElementAnnotationsManager; import java.awt.*; diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/AbstractTableView.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/AbstractTableView.java index 2e372bfa26fa..eb254c2a3ae3 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/AbstractTableView.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/AbstractTableView.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,11 +80,13 @@ public abstract class AbstractTableView extends JPanel implements TypeSafeDat final JTableHeader header = myTable.getTableHeader(); header.addMouseMotionListener(new MouseMotionAdapter() { + @Override public void mouseMoved(MouseEvent e) { updateTooltip(e); } }); header.addMouseListener(new MouseAdapter() { + @Override public void mouseEntered(MouseEvent e) { updateTooltip(e); } @@ -135,6 +137,7 @@ public abstract class AbstractTableView extends JPanel implements TypeSafeDat toolbarComponent.setBorder(BorderFactory.createCompoundBorder(matteBorder, toolbarComponent.getBorder())); getTable().getSelectionModel().addListSelectionListener(new ListSelectionListener() { + @Override public void valueChanged(ListSelectionEvent e) { myActionToolbar.updateActionsImmediately(); } @@ -164,6 +167,7 @@ public abstract class AbstractTableView extends JPanel implements TypeSafeDat if (getEmptyPaneText() != null) { final CardLayout cardLayout = ((CardLayout)myInnerPanel.getLayout()); myTable.getModel().addTableModelListener(new TableModelListener() { + @Override public void tableChanged(TableModelEvent e) { cardLayout.show(myInnerPanel, myTable.getRowCount() == 0 ? EMPTY_PANE : TREE); } @@ -220,6 +224,7 @@ public abstract class AbstractTableView extends JPanel implements TypeSafeDat return myTableModel; } + @Override public void calcData(DataKey key, DataSink sink) { if (PlatformDataKeys.HELP_ID.equals(key)) { sink.put(PlatformDataKeys.HELP_ID, getHelpId()); @@ -294,6 +299,7 @@ public abstract class AbstractTableView extends JPanel implements TypeSafeDat setSortable(false); } + @Override public Object getValueAt(final int rowIndex, final int columnIndex) { return myTableData[rowIndex][columnIndex]; } @@ -310,10 +316,12 @@ public abstract class AbstractTableView extends JPanel implements TypeSafeDat myTableData = objects; } + @Override public void setValueAt(final Object aValue, final int rowIndex, final int columnIndex) { final Object oldValue = getValueAt(rowIndex, columnIndex); if (!Comparing.equal(oldValue, aValue)) { wrapValueSetting(getItems().get(rowIndex), new Runnable() { + @Override public void run() { MyListTableModel.super.setValueAt("".equals(aValue) ? null : aValue, rowIndex, columnIndex); } @@ -350,6 +358,7 @@ public abstract class AbstractTableView extends JPanel implements TypeSafeDat return super.getCellRenderer(row, column); } + @Override public final TableCellRenderer getCellRenderer(int row, int column) { return myCachedRenderers[row][column]; } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/BaseControl.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/BaseControl.java index d6dbc13ac63e..d809b86eecad 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/BaseControl.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/BaseControl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,9 +90,11 @@ public abstract class BaseControl extends DomUICont final JComponent component = getComponentToListenFocusLost(myBoundComponent); if (component != null) { component.addFocusListener(new FocusListener() { + @Override public void focusGained(FocusEvent e) { } + @Override public void focusLost(FocusEvent e) { if (!e.isTemporary() && isValid()) { commit(); @@ -111,18 +113,22 @@ public abstract class BaseControl extends DomUICont protected abstract Bound createMainComponent(Bound boundedComponent); + @Override public void bind(JComponent component) { initialize((Bound)component); } + @Override public void addCommitListener(CommitListener listener) { myDispatcher.addListener(listener); } + @Override public void removeCommitListener(CommitListener listener) { myDispatcher.removeListener(listener); } + @Override public final DomElement getDomElement() { return myDomWrapper.getWrappedElement(); } @@ -131,14 +137,17 @@ public abstract class BaseControl extends DomUICont return myDomWrapper; } + @Override public final Bound getComponent() { checkInitialized(); return myBoundComponent; } + @Override public void dispose() { } + @Override public final void commit() { if (isValid() && !isCommitted()) { setValueToXml(getValue()); @@ -160,6 +169,7 @@ public abstract class BaseControl extends DomUICont return valueInXml instanceof String && valueInControl instanceof String && ((String)valueInXml).trim().equals(((String)valueInControl).trim()); } + @Override public final void reset() { if (!myCommitting) { doReset(); @@ -167,6 +177,7 @@ public abstract class BaseControl extends DomUICont } } + @Override public void updateHighlighting() { updateComponent(); } @@ -195,6 +206,7 @@ public abstract class BaseControl extends DomUICont final CommitListener multicaster = myDispatcher.getMulticaster(); multicaster.beforeCommit(this); new WriteCommandAction(getProject(), getDomWrapper().getFile()) { + @Override protected void run(Result result) throws Throwable { doCommit(value); } @@ -227,10 +239,12 @@ public abstract class BaseControl extends DomUICont } + @Override public boolean canNavigate(DomElement element) { return false; } + @Override public void navigate(DomElement element) { } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/BaseModifiableControl.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/BaseModifiableControl.java index 3d0c4f9425b7..52a7be3f1dd6 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/BaseModifiableControl.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/BaseModifiableControl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,11 +33,13 @@ public abstract class BaseModifiableControl extends myModified = true; } + @Override protected void doCommit(final T value) throws IllegalAccessException, InvocationTargetException { super.doCommit(value); myModified = false; } + @Override protected boolean isCommitted() { return !myModified; } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/BasicDomElementComponent.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/BasicDomElementComponent.java index 7ba3553ec570..d2a17dd553c5 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/BasicDomElementComponent.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/BasicDomElementComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,8 +62,10 @@ public abstract class BasicDomElementComponent extends Abs if (domElement == null) return; DomElementAnnotationsManager.getInstance(domElement.getManager().getProject()).addHighlightingListener(new DomElementAnnotationsManager.DomHighlightingListener() { + @Override public void highlightingFinished(@NotNull final DomFileElement element) { ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override public void run() { if (getComponent().isShowing() && element.isValid()) { updateHighlighting(); @@ -79,6 +81,7 @@ public abstract class BasicDomElementComponent extends Abs if (description instanceof DomFixedChildDescription && DomUtil.isGenericValueType(description.getType())) { if ((description.getValues(domElement)).size() == 1) { final GenericDomValue element = domElement.getManager().createStableValue(new Factory() { + @Override public GenericDomValue create() { return domElement.isValid() ? (GenericDomValue)description.getValues(domElement).get(0) : null; } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/BigStringComponent.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/BigStringComponent.java index e4a60e04f614..fa49bf152e00 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/BigStringComponent.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/BigStringComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,6 +37,7 @@ public class BigStringComponent extends TextFieldWithBrowseButton { myWindowTitle = windowTitle; setButtonIcon(PlatformIcons.OPEN_EDIT_DIALOG_ICON); addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { Messages.showTextAreaDialog(getTextField(), myWindowTitle, "DescriptionDialogEditor"); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanColumnInfo.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanColumnInfo.java index 0b977a5c8452..293fa0f5245a 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanColumnInfo.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanColumnInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,18 +30,22 @@ public class BooleanColumnInfo extends DomColumnInfo, B super(name, new BooleanTableCellRenderer()); } + @Override public TableCellEditor getEditor(GenericDomValue value) { return new DefaultCellEditor(new JCheckBox()); } + @Override public final Class getColumnClass() { return Boolean.class; } + @Override public final void setValue(final GenericDomValue o, final Boolean aValue) { o.setValue(aValue); } + @Override public final Boolean valueOf(GenericDomValue object) { final Boolean value = object.getValue(); return value == null ? Boolean.FALSE : value; diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanControl.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanControl.java index 86f32c3a8b69..ca921d0c8191 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanControl.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanControl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,10 +29,12 @@ public class BooleanControl extends BaseModifiableControl { super(domWrapper); } + @Override protected JCheckBox createMainComponent(JCheckBox boundComponent) { JCheckBox checkBox = boundComponent == null ? new JCheckBox() : boundComponent; checkBox.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { myUndefined = false; setModified(); @@ -43,10 +45,12 @@ public class BooleanControl extends BaseModifiableControl { return checkBox; } + @Override protected Boolean getValue() { return myUndefined ? null : getComponent().isSelected(); } + @Override protected void setValue(final Boolean value) { myUndefined = value == null; getComponent().setSelected(value != null && value); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanEnumControl.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanEnumControl.java index c567fccfd1ad..255a60cf84b8 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanEnumControl.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/BooleanEnumControl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,10 +40,12 @@ public class BooleanEnumControl extends BaseModifiableControl assert enumClass.getEnumConstants().length == 2 : enumClass; } + @Override protected JCheckBox createMainComponent(JCheckBox boundComponent) { JCheckBox checkBox = boundComponent == null ? new JCheckBox() : boundComponent; checkBox.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { myUndefined = false; setModified(); @@ -54,10 +56,12 @@ public class BooleanEnumControl extends BaseModifiableControl return checkBox; } + @Override protected String getValue() { return myUndefined ? null : (getComponent().isSelected() ? mySelectedValue : myUnselectedValue); } + @Override protected void setValue(final String value) { myUndefined = value == null; getComponent().setSelected(mySelectedValue.equals(value)); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/CaptionComponent.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/CaptionComponent.java index ed30d6b94a20..c4bd0556e4c1 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/CaptionComponent.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/CaptionComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -63,6 +63,7 @@ public class CaptionComponent extends JPanel implements Committable, Highlightab } } + @Override public void updateHighlighting() { CommittableUtil.updateHighlighting(myCommittableErrorPanel); } @@ -105,13 +106,16 @@ public class CaptionComponent extends JPanel implements Committable, Highlightab updateBorder(); } + @Override public final void commit() { } + @Override public void reset() { if (myCommittableErrorPanel != null) myCommittableErrorPanel.reset(); } + @Override public final void dispose() { } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/ChildGenericValueColumnInfo.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/ChildGenericValueColumnInfo.java index dfaa714b1dc5..0978d3b7bada 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/ChildGenericValueColumnInfo.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/ChildGenericValueColumnInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,14 +64,17 @@ public class ChildGenericValueColumnInfo extends DomColumn return result; } + @Override public final TableCellEditor getEditor(T value) { return myEditor; } + @Override public final Class getColumnClass() { return (Class)ReflectionUtil.getRawType(myChildDescription.getType()); } + @Override public TableCellRenderer getCustomizedRenderer(final T domElement, final TableCellRenderer renderer) { assert domElement.isValid(); return getErrorableCellRenderer(renderer, domElement); @@ -81,6 +84,7 @@ public class ChildGenericValueColumnInfo extends DomColumn return new ErrorableTableCellRenderer(getGenericValue(domElement), renderer, domElement); } + @Override public void setValue(final T o, final String aValue) { getGenericValue(o).setStringValue(aValue); } @@ -89,6 +93,7 @@ public class ChildGenericValueColumnInfo extends DomColumn return (GenericDomValue)myChildDescription.getValues(o).get(0); } + @Override public final String valueOf(T object) { if (!object.isValid()) return null; final String stringValue = getGenericValue(object).getStringValue(); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboControl.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboControl.java index 4966c85f1b17..81b615f077f1 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboControl.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboControl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,6 +48,7 @@ public class ComboControl extends BaseModifiableControl { private boolean myNullable; private final Map myIcons = new HashMap(); private final ItemListener myCommitListener = new ItemListener() { + @Override public void itemStateChanged(ItemEvent e) { setModified(); commit(); @@ -84,10 +85,12 @@ public class ComboControl extends BaseModifiableControl { public static Factory>> createResolvingFunction(final GenericDomValue reference) { return new Factory>>() { + @Override public List> create() { final Converter converter = reference.getConverter(); if (converter instanceof ResolvingConverter) { final AbstractConvertContext context = new AbstractConvertContext() { + @Override @NotNull public DomElement getInvocationElement() { return reference; @@ -97,11 +100,13 @@ public class ComboControl extends BaseModifiableControl { final Collection variants = resolvingConverter.getVariants(context); final List> all = new ArrayList>(ContainerUtil.map(variants, new Function>() { + @Override public Pair fun(final Object s) { return Pair.create(ElementPresentationManager.getElementName(s), ElementPresentationManager.getIcon(s)); } })); all.addAll(ContainerUtil.map(resolvingConverter.getAdditionalVariants(context), new Function() { + @Override public Object fun(final Object s) { return new Pair(s, null); } @@ -113,11 +118,13 @@ public class ComboControl extends BaseModifiableControl { }; } - public static Factory>> createPresentationFunction(final Factory> variantFactory) { + public static Factory>> createPresentationFunction(final Factory> variantFactory) { return new Factory>>() { + @Override public List> create() { return ContainerUtil.map(variantFactory.create(), new Function>() { + @Override public Pair fun(final Object s) { return Pair.create(ElementPresentationManager.getElementName(s), ElementPresentationManager.getIcon(s)); } @@ -129,8 +136,10 @@ public class ComboControl extends BaseModifiableControl { static Factory>> createEnumFactory(final Class aClass) { return new Factory>>() { + @Override public List> create() { return ContainerUtil.map2List(aClass.getEnumConstants(), new Function>() { + @Override public Pair fun(final Enum s) { return Pair.create(NamedEnumUtil.getEnumValueByElement(s), ElementPresentationManager.getIcon(s)); } @@ -151,6 +160,7 @@ public class ComboControl extends BaseModifiableControl { standardValues.add(pair.first); } return initComboBox(comboBox, new Condition() { + @Override public boolean value(final String object) { return standardValues.contains(object); } @@ -176,6 +186,7 @@ public class ComboControl extends BaseModifiableControl { comboBox.setEditable(false); comboBox.setPrototypeDisplayValue(new ComboBoxItem("A", null)); comboBox.setRenderer(new DefaultListCellRenderer() { + @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); final Pair pair = (Pair)value; @@ -194,8 +205,10 @@ public class ComboControl extends BaseModifiableControl { return comboBox; } + @Override protected JComboBox createMainComponent(final JComboBox boundedComponent) { return initComboBox(boundedComponent == null ? new JComboBox() : boundedComponent, new Condition() { + @Override public boolean value(final String object) { return isValidValue(object); } @@ -223,10 +236,12 @@ public class ComboControl extends BaseModifiableControl { return !newData.equals(oldData); } + @Override protected boolean isCommitted() { return getComponent().isPopupVisible() || super.isCommitted(); } + @Override protected void doReset() { final List> data = myDataFactory.create(); final JComboBox comboBox = getComponent(); @@ -255,12 +270,14 @@ public class ComboControl extends BaseModifiableControl { } } + @Override @Nullable protected final String getValue() { final Pair pair = (Pair)getComponent().getSelectedItem(); return pair == null || pair == EMPTY ? null : pair.first; } + @Override protected final void setValue(final String value) { final JComboBox component = getComponent(); if (!isValidValue(value)) { @@ -271,6 +288,7 @@ public class ComboControl extends BaseModifiableControl { } + @Override protected void updateComponent() { final DomElement domElement = getDomElement(); if (domElement == null || !domElement.isValid()) return; @@ -279,6 +297,7 @@ public class ComboControl extends BaseModifiableControl { final Project project = getProject(); ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override public void run() { if (!project.isOpen()) return; if (!getDomWrapper().isValid()) return; diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboTableCellEditor.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboTableCellEditor.java index 8e0ef03d067b..c9f61c91a9da 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboTableCellEditor.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/ComboTableCellEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,6 +43,7 @@ public class ComboTableCellEditor extends DefaultCellEditor { comboBox.setBorder(null); comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE); ComboControl.initComboBox(comboBox, new Condition() { + @Override public boolean value(final String object) { return myData != null && myData.containsKey(object) || myNullable && EMPTY.first == object; } @@ -53,11 +54,13 @@ public class ComboTableCellEditor extends DefaultCellEditor { this(ComboControl.createEnumFactory(anEnum), nullable); } + @Override public Object getCellEditorValue() { final Pair cellEditorValue = (Pair)super.getCellEditorValue(); return EMPTY == cellEditorValue || null == cellEditorValue ? null : cellEditorValue.first; } + @Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { final List> list = myDataFactory.create(); myData = new HashMap(); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/CommitAdapter.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/CommitAdapter.java index 537fc1f1145f..d03cf974d1f7 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/CommitAdapter.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/CommitAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,9 +19,11 @@ package com.intellij.util.xml.ui; * @author peter */ public abstract class CommitAdapter implements CommitListener{ + @Override public void beforeCommit(DomUIControl control) { } + @Override public void afterCommit(DomUIControl control) { } } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/CommitablePanelUserActivityListener.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/CommitablePanelUserActivityListener.java index d34619d3e7c6..6e008c500766 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/CommitablePanelUserActivityListener.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/CommitablePanelUserActivityListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,11 +42,13 @@ public class CommitablePanelUserActivityListener implements UserActivityListener myProject = project; } + @Override final public void stateChanged() { if (myApplying) return; cancel(); cancelAllRequests(); myAlarm.addRequest(new Runnable() { + @Override public void run() { myApplying = true; cancel(); @@ -89,6 +91,7 @@ public class CommitablePanelUserActivityListener implements UserActivityListener myAlarm.cancelAllRequests(); } + @Override public void dispose() { cancelAllRequests(); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/CompositeCommittable.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/CompositeCommittable.java index edb07490638f..1563f3bdbb3b 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/CompositeCommittable.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/CompositeCommittable.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,18 +32,21 @@ public class CompositeCommittable implements Committable, Highlightable { return panel; } + @Override public void commit() { for (final Committable committable : myComponents) { committable.commit(); } } + @Override public void reset() { for (final Committable committable : myComponents) { committable.reset(); } } + @Override public void dispose() { } @@ -51,6 +54,7 @@ public class CompositeCommittable implements Committable, Highlightable { return myComponents; } + @Override public void updateHighlighting() { for (final Committable component : myComponents) { CommittableUtil.updateHighlighting(component); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomCollectionControl.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomCollectionControl.java index ba69ab5992b9..54ec270b746d 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomCollectionControl.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomCollectionControl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -98,21 +98,25 @@ public class DomCollectionControl extends DomUIControl imp return myEditable; } + @Override public void bind(JComponent component) { assert component instanceof DomTableView; initialize((DomTableView)component); } + @Override public void addCommitListener(CommitListener listener) { myDispatcher.addListener(listener); } + @Override public void removeCommitListener(CommitListener listener) { myDispatcher.removeListener(listener); } + @Override public boolean canNavigate(DomElement element) { final Class aClass = (Class)ReflectionUtil.getRawType(myChildDescription.getType()); @@ -121,6 +125,7 @@ public class DomCollectionControl extends DomUIControl imp return domElement != null && myCollectionElements.contains(domElement); } + @Override public void navigate(DomElement element) { final Class aClass = (Class)ReflectionUtil.getRawType(myChildDescription.getType()); final DomElement domElement = element.getParentOfType(aClass, false); @@ -131,6 +136,7 @@ public class DomCollectionControl extends DomUIControl imp myCollectionPanel.getTable().setRowSelectionInterval(index, index); } + @Override public void calcData(final DataKey key, final DataSink sink) { if (DOM_COLLECTION_CONTROL.equals(key)) { sink.put(DOM_COLLECTION_CONTROL, this); @@ -158,7 +164,8 @@ public class DomCollectionControl extends DomUIControl imp myCollectionPanel.installPopup(ActionPlaces.J2EE_ATTRIBUTES_VIEW_POPUP, createPopupActionGroup()); myCollectionPanel.initializeTable(); myCollectionPanel.addCustomDataProvider(this); - myCollectionPanel.addChangeListener(new DomTableView.ChangeListener() { + myCollectionPanel.addChangeListener(new AbstractTableView.ChangeListener() { + @Override public void changed() { reset(); } @@ -197,6 +204,7 @@ public class DomCollectionControl extends DomUIControl imp } new WriteCommandAction(getProject(), PsiUtilCore.toPsiFileArray(files)) { + @Override protected void run(Result result) throws Throwable { for (final T t : toDelete) { if (t.isValid()) { @@ -209,6 +217,7 @@ public class DomCollectionControl extends DomUIControl imp protected final void doRemove() { ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override public void run() { final int[] selected = myCollectionPanel.getTable().getSelectedRows(); if (selected == null || selected.length == 0) return; @@ -234,6 +243,7 @@ public class DomCollectionControl extends DomUIControl imp writeCommandAction.execute(); } + @Override public void commit() { final CommitListener listener = myDispatcher.getMulticaster(); listener.beforeCommit(this); @@ -256,6 +266,7 @@ public class DomCollectionControl extends DomUIControl imp myCollectionPanel.repaint(); } + @Override public void dispose() { if (myCollectionPanel != null) { myCollectionPanel.dispose(); @@ -266,6 +277,7 @@ public class DomCollectionControl extends DomUIControl imp return myParentDomElement.getManager().getProject(); } + @Override public DomTableView getComponent() { if (myCollectionPanel == null) initialize(null); @@ -276,10 +288,12 @@ public class DomCollectionControl extends DomUIControl imp return myChildDescription; } + @Override public final DomElement getDomElement() { return myParentDomElement; } + @Override public final void reset() { myCollectionElements = new ArrayList(getCollectionElements()); myCollectionPanel.reset(createColumnInfos(myParentDomElement), myCollectionElements); @@ -297,6 +311,7 @@ public class DomCollectionControl extends DomUIControl imp protected DefaultAddAction createDefaultAction(final String name, final Icon icon, final Type type) { return new ControlAddAction(name, name, icon) { + @Override protected Type getElementType() { return type; } @@ -321,6 +336,7 @@ public class DomCollectionControl extends DomUIControl imp return (DomEditorManager)component; } + @Override public void updateHighlighting() { if (myCollectionPanel != null) { myCollectionPanel.revalidate(); @@ -341,10 +357,12 @@ public class DomCollectionControl extends DomUIControl imp super(text, description, icon); } + @Override protected final DomCollectionChildDescription getDomCollectionChildDescription() { return myChildDescription; } + @Override protected final DomElement getParentDomElement() { return myParentDomElement; } @@ -365,7 +383,8 @@ public class DomCollectionControl extends DomUIControl imp } } - protected final void afterAddition(final T newElement) { + @Override + protected final void afterAddition(@NotNull final T newElement) { reset(); afterAddition(myCollectionPanel.getTable(), myCollectionElements.size() - 1); } @@ -381,6 +400,7 @@ public class DomCollectionControl extends DomUIControl imp setShortcutSet(CommonActionsPanel.getCommonShortcut(CommonActionsPanel.Buttons.ADD)); } + @Override protected boolean isEnabled(final AnActionEvent e) { return getDomCollectionControl(e) != null; } @@ -389,19 +409,23 @@ public class DomCollectionControl extends DomUIControl imp return DomCollectionControl.getDomCollectionControl(e); } + @Override @NotNull protected DomCollectionChildDescription[] getDomCollectionChildDescriptions(final AnActionEvent e) { return new DomCollectionChildDescription[] {getDomCollectionControl(e).getChildDescription()}; } + @Override protected DomElement getParentDomElement(final AnActionEvent e) { return getDomCollectionControl(e).getDomElement(); } + @Override protected JComponent getComponent(AnActionEvent e) { return getDomCollectionControl(e).getComponent(); } + @Override @NotNull public AnAction[] getChildren(final AnActionEvent e) { final DomCollectionControl control = getDomCollectionControl(e); @@ -409,6 +433,7 @@ public class DomCollectionControl extends DomUIControl imp return actions == null ? super.getChildren(e) : actions; } + @Override protected DefaultAddAction createAddingAction(final AnActionEvent e, final String name, final Icon icon, @@ -426,12 +451,14 @@ public class DomCollectionControl extends DomUIControl imp setShortcutSet(CommonActionsPanel.getCommonShortcut(CommonActionsPanel.Buttons.EDIT)); } + @Override public void actionPerformed(AnActionEvent e) { final DomCollectionControl control = DomCollectionControl.getDomCollectionControl(e); control.doEdit(); control.reset(); } + @Override public void update(AnActionEvent e) { final DomCollectionControl control = DomCollectionControl.getDomCollectionControl(e); final boolean visible = control != null && control.isEditable(); @@ -446,12 +473,14 @@ public class DomCollectionControl extends DomUIControl imp setShortcutSet(CommonActionsPanel.getCommonShortcut(CommonActionsPanel.Buttons.REMOVE)); } + @Override public void actionPerformed(AnActionEvent e) { final DomCollectionControl control = DomCollectionControl.getDomCollectionControl(e); control.doRemove(); control.reset(); } + @Override public void update(AnActionEvent e) { final boolean enabled; final DomCollectionControl control = DomCollectionControl.getDomCollectionControl(e); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomCollectionWrapper.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomCollectionWrapper.java index b2c25d91d871..77d2be60151d 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomCollectionWrapper.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomCollectionWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,16 +50,19 @@ public class DomCollectionWrapper extends DomWrapper{ myGetter = getter; } + @Override @NotNull public DomElement getExistingDomElement() { return myDomElement; } + @Override public DomElement getWrappedElement() { final List list = myChildDescription.getValues(myDomElement); return list.isEmpty() ? null : list.get(0); } + @Override public void setValue(final T value) throws IllegalAccessException, InvocationTargetException { final List list = myChildDescription.getValues(myDomElement); final DomElement domElement; @@ -71,6 +74,7 @@ public class DomCollectionWrapper extends DomWrapper{ mySetter.invoke(domElement, value); } + @Override public T getValue() throws IllegalAccessException, InvocationTargetException { if (!myDomElement.isValid()) return null; final List list = myChildDescription.getValues(myDomElement); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomColumnInfo.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomColumnInfo.java index 044bb44a657d..eea9a266c1f1 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomColumnInfo.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomColumnInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,10 +35,12 @@ public abstract class DomColumnInfo extends ColumnInfo { myRenderer = renderer; } + @Override public boolean isCellEditable(final T o) { return getEditor(o) != null; } + @Override public TableCellRenderer getRenderer(T value) { return myRenderer; } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomFileEditor.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomFileEditor.java index a4f19649d7aa..ee8f1faaf450 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomFileEditor.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomFileEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,6 +46,7 @@ public class DomFileEditor extends Perspecti public DomFileEditor(final Project project, final VirtualFile file, final String name, final T component) { this(project, file, name, new Factory() { + @Override public T create() { return component; } @@ -58,6 +59,7 @@ public class DomFileEditor extends Perspecti myName = name; DomElementAnnotationsManager.getInstance(project).addHighlightingListener(new DomElementAnnotationsManager.DomHighlightingListener() { + @Override public void highlightingFinished(@NotNull DomFileElement element) { if (isInitialised() && getComponent().isShowing() && element.isValid()) { updateHighlighting(); @@ -66,12 +68,14 @@ public class DomFileEditor extends Perspecti }, this); } + @Override public void updateHighlighting() { if (checkIsValid()) { CommittableUtil.updateHighlighting(myComponent); } } + @Override public void commit() { if (checkIsValid() && isInitialised()) { setShowing(false); @@ -84,6 +88,7 @@ public class DomFileEditor extends Perspecti } } + @Override @Nullable public JComponent getPreferredFocusedComponent() { ensureInitialized(); @@ -94,12 +99,14 @@ public class DomFileEditor extends Perspecti return myComponent; } + @Override @NotNull protected JComponent createCustomComponent() { new MnemonicHelper().register(getComponent()); myComponent = myComponentFactory.create(); DomUIFactory.getDomUIFactory().setupErrorOutdatingUserActivityWatcher(this, getDomElement()); DomManager.getDomManager(getProject()).addDomEventListener(new DomEventListener() { + @Override public void eventOccured(DomEvent event) { checkIsValid(); } @@ -108,16 +115,19 @@ public class DomFileEditor extends Perspecti return myComponent.getComponent(); } + @Override @NotNull public final String getName() { return myName; } + @Override protected DomElement getSelectedDomElement() { if (myComponent == null) return null; return DomUINavigationProvider.findDomElement(myComponent); } + @Override protected void setSelectedDomElement(DomElement domElement) { final DomUIControl domControl = DomUINavigationProvider.findDomControl(myComponent, domElement); if (domControl != null) { @@ -125,6 +135,7 @@ public class DomFileEditor extends Perspecti } } + @Override public BackgroundEditorHighlighter getBackgroundHighlighter() { ensureInitialized(); return DomUIFactory.getDomUIFactory().createDomHighlighter(getProject(), this, getDomElement()); @@ -135,10 +146,12 @@ public class DomFileEditor extends Perspecti } + @Override public boolean isValid() { return super.isValid() && (!isInitialised() || getDomElement().isValid()); } + @Override public void reset() { if (checkIsValid()) { myComponent.reset(); @@ -152,6 +165,7 @@ public class DomFileEditor extends Perspecti final XmlFile file = DomUtil.getFile(element); final Factory factory = new Factory() { + @Override public BasicDomElementComponent create() { CaptionComponent captionComponent = new CaptionComponent(name, icon); @@ -162,6 +176,7 @@ public class DomFileEditor extends Perspecti } }; return new DomFileEditor(file.getProject(), file.getVirtualFile(), name, factory) { + @Override public JComponent getPreferredFocusedComponent() { return null; } @@ -176,6 +191,7 @@ public class DomFileEditor extends Perspecti panel.add(element.isValid() ? committablePanel.getComponent() : new JPanel(), BorderLayout.CENTER); BasicDomElementComponent component = new BasicDomElementComponent(element) { + @Override public JComponent getComponent() { return panel; } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomFixedWrapper.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomFixedWrapper.java index 7597791f266a..b43eb0392f5e 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomFixedWrapper.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomFixedWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,19 +31,23 @@ public class DomFixedWrapper extends DomWrapper{ myDomElement = domElement; } + @Override public DomElement getWrappedElement() { return myDomElement; } + @Override public void setValue(final T value) throws IllegalAccessException, InvocationTargetException { DomUIFactory.SET_VALUE_METHOD.invoke(getWrappedElement(), value); } + @Override public T getValue() throws IllegalAccessException, InvocationTargetException { final DomElement element = getWrappedElement(); return element.isValid() ? (T)DomUIFactory.GET_VALUE_METHOD.invoke(element) : null; } + @Override @NotNull public DomElement getExistingDomElement() { return myDomElement; diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomStringWrapper.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomStringWrapper.java index b2e9c2958cdb..32946908413b 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomStringWrapper.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomStringWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,19 +31,23 @@ public class DomStringWrapper extends DomWrapper{ myDomElement = domElement; } + @Override @NotNull public DomElement getExistingDomElement() { return myDomElement; } + @Override public DomElement getWrappedElement() { return myDomElement; } + @Override public void setValue(final String value) throws IllegalAccessException, InvocationTargetException { myDomElement.setStringValue(value); } + @Override public String getValue() throws IllegalAccessException, InvocationTargetException { return myDomElement.isValid() ? myDomElement.getStringValue() : null; } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomTableView.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomTableView.java index f25fbfc798e5..e228ad7756d0 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomTableView.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomTableView.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,6 +44,7 @@ public class DomTableView extends AbstractTableView { myCustomDataProviders.add(provider); } + @Override public void calcData(final DataKey key, final DataSink sink) { super.calcData(key, sink); for (final TypeSafeDataProvider customDataProvider : myCustomDataProviders) { @@ -56,9 +57,11 @@ public class DomTableView extends AbstractTableView { installPopup(ActionPlaces.J2EE_ATTRIBUTES_VIEW_POPUP, group); } + @Override protected void wrapValueSetting(@NotNull final DomElement domElement, final Runnable valueSetter) { if (domElement.isValid()) { new WriteCommandAction(getProject(), DomUtil.getFile(domElement)) { + @Override protected void run(final Result result) throws Throwable { valueSetter.run(); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomUIFactory.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomUIFactory.java index e5effb1e63bd..2184ff8ca2b7 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomUIFactory.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomUIFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,8 +44,8 @@ public abstract class DomUIFactory { public final static ExtensionPointName> EXTENSION_POINT_NAME = ExtensionPointName.create("com.intellij.dom.uiControlsProvider"); - public static Method GET_VALUE_METHOD = ReflectionUtil.getMethod(GenericDomValue.class, "getValue"); - public static Method SET_VALUE_METHOD = findMethod(GenericDomValue.class, "setValue"); + public static final Method GET_VALUE_METHOD = ReflectionUtil.getMethod(GenericDomValue.class, "getValue"); + public static final Method SET_VALUE_METHOD = findMethod(GenericDomValue.class, "setValue"); public static Method GET_STRING_METHOD = ReflectionUtil.getMethod(GenericDomValue.class, "getStringValue"); public static Method SET_STRING_METHOD = findMethod(GenericDomValue.class, "setStringValue"); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomUINavigationProvider.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomUINavigationProvider.java index 7aa1e5f54ff5..adfa209ce858 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/DomUINavigationProvider.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/DomUINavigationProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,10 +35,12 @@ public class DomUINavigationProvider extends DomElementNavigationProvider { } + @Override public String getProviderName() { return DOM_UI_NAVIGATION_PROVIDER_NAME; } + @Override public void navigate(DomElement domElement, boolean requestFocus) { final DomUIControl domUIControl = findDomControl(myComponent, domElement); if(domUIControl != null) { @@ -46,6 +48,7 @@ public class DomUINavigationProvider extends DomElementNavigationProvider { } } + @Override public boolean canNavigate(DomElement domElement) { return findDomControl(myComponent, domElement) != null; } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/ErrorableTableCellRenderer.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/ErrorableTableCellRenderer.java index 59b40c101b58..a92015cca615 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/ErrorableTableCellRenderer.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/ErrorableTableCellRenderer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,6 +48,7 @@ public class ErrorableTableCellRenderer extends DefaultTab myRoot = DomUtil.getRoot(myRowDomElement); } + @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { final Component component = myRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (!myRoot.isValid()) { diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/GenericValueColumnInfo.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/GenericValueColumnInfo.java index 033e6095672a..16644b138437 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/GenericValueColumnInfo.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/GenericValueColumnInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,18 +38,22 @@ public class GenericValueColumnInfo extends DomColumnInfo, this(name, columnClass, new DefaultTableCellRenderer(), editor); } + @Override public final TableCellEditor getEditor(GenericDomValue value) { return myEditor; } + @Override public final Class getColumnClass() { return myColumnClass; } + @Override public final void setValue(final GenericDomValue o, final String aValue) { o.setStringValue(aValue); } + @Override public final String valueOf(GenericDomValue object) { return object.getStringValue(); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/MockDomElementsEditor.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/MockDomElementsEditor.java index 5cd8a743bcec..ee99db4fe353 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/MockDomElementsEditor.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/MockDomElementsEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,6 +50,7 @@ public class MockDomElementsEditor { protected final T addEditedElement(final Class aClass, final EditedElementDescription description) { final DomManager domManager = DomManager.getDomManager(myModule.getProject()); final T t = domManager.createStableValue(new Factory() { + @Override public T create() { T t = description.find(); if (t == null) { @@ -68,6 +69,7 @@ public class MockDomElementsEditor { protected final DomFileEditor initFileEditor(final BasicDomElementComponent component, final VirtualFile virtualFile, final String name) { initFileEditor(component.getProject(), virtualFile, name, new Factory() { + @Override public BasicDomElementComponent create() { return component; } @@ -78,10 +80,12 @@ public class MockDomElementsEditor { protected final DomFileEditor initFileEditor(final Project project, final VirtualFile virtualFile, final String name, final Factory component) { myFileEditor = new DomFileEditor(project, virtualFile, name, component) { + @Override public JComponent getPreferredFocusedComponent() { return null; } + @Override @NotNull protected JComponent createCustomComponent() { final JComponent customComponent = super.createCustomComponent(); @@ -89,6 +93,7 @@ public class MockDomElementsEditor { return customComponent; } + @Override public void reset() { for (final Map.Entry, DomElement> entry : myDomElements.entrySet()) { final DomElement newValue = entry.getKey().find(); @@ -100,6 +105,7 @@ public class MockDomElementsEditor { super.reset(); } + @Override public void commit() { super.commit(); final List descriptions = new ArrayList(); @@ -116,6 +122,7 @@ public class MockDomElementsEditor { } } new WriteCommandAction(project, PsiUtilCore.toPsiFileArray(changedFiles)) { + @Override protected void run(Result result) throws Throwable { for (EditedElementDescription description : descriptions) { final DomElement editedElement = myDomElements.get(description); @@ -145,6 +152,7 @@ public class MockDomElementsEditor { private T createMockElement(final Class aClass, final Module module) { final Project project = module.getProject(); ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override public void run() { if (myFileEditor.isInitialised()) { myContents.reset(); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/StringColumnInfo.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/StringColumnInfo.java index edb3f41fa1a4..c20a715903ab 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/StringColumnInfo.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/StringColumnInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ public class StringColumnInfo extends DomColumnInfo myCurrentDocuments = new HashSet(); private boolean myDirty; private final DocumentAdapter myDocumentAdapter = new DocumentAdapter() { + @Override public void documentChanged(DocumentEvent e) { if (myShowing) { myDirty = true; @@ -47,14 +48,17 @@ public class UndoHelper { myProject = project; final PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(project); CommandProcessor.getInstance().addCommandListener(new CommandAdapter() { + @Override public void commandStarted(CommandEvent event) { undoTransparentActionStarted(); } + @Override public void undoTransparentActionStarted() { myDirty = false; } + @Override public void undoTransparentActionFinished() { if (myDirty) { psiDocumentManager.commitAllDocuments(); @@ -62,6 +66,7 @@ public class UndoHelper { } } + @Override public void commandFinished(CommandEvent event) { undoTransparentActionFinished(); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/AddDomElementAction.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/AddDomElementAction.java index 31629d52f5fa..4e6cf8a16378 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/AddDomElementAction.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/AddDomElementAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,6 +48,7 @@ public abstract class AddDomElementAction extends AnAction { super(ApplicationBundle.message("action.add"), null, DomCollectionControl.ADD_ICON); } + @Override public void update(AnActionEvent e) { if (!isEnabled(e)) { e.getPresentation().setEnabled(false); @@ -75,6 +76,7 @@ public abstract class AddDomElementAction extends AnAction { super.update(e); } + @Override public void actionPerformed(AnActionEvent e) { final AnAction[] actions = getChildren(e); if (actions.length > 1) { @@ -138,6 +140,7 @@ public abstract class AddDomElementAction extends AnAction { } if (actions.size() > 1 && showAsPopup()) { ActionGroup group = new ActionGroup() { + @Override @NotNull public AnAction[] getChildren(@Nullable AnActionEvent e) { return actions.toArray(new AnAction[actions.size()]); @@ -183,6 +186,7 @@ public abstract class AddDomElementAction extends AnAction { setShortcutSet(CommonActionsPanel.getCommonShortcut(CommonActionsPanel.Buttons.ADD)); } + @Override public void actionPerformed(AnActionEvent e) { final ListPopup groupPopup = JBPopupFactory.getInstance().createActionGroupPopup(null, diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/DefaultAddAction.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/DefaultAddAction.java index a564e03150fc..eafc360d0248 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/DefaultAddAction.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/DefaultAddAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -66,6 +66,7 @@ public abstract class DefaultAddAction extends AnAction { protected void afterAddition(@NotNull T newElement) { } + @Override public final void actionPerformed(final AnActionEvent e) { final T result = performElementAddition(); if (result != null) { @@ -80,6 +81,7 @@ public abstract class DefaultAddAction extends AnAction { final TypeChooser[] oldChoosers = new TypeChooser[]{null}; final Type[] aClass = new Type[]{null}; final StableElement result = new WriteCommandAction>(domManager.getProject(), DomUtil.getFile(parent)) { + @Override protected void run(Result> result) throws Throwable { final DomElement parentDomElement = getParentDomElement(); final T t = (T)getDomCollectionChildDescription().addValue(parentDomElement, getElementType()); @@ -89,6 +91,7 @@ public abstract class DefaultAddAction extends AnAction { final SmartPsiElementPointer pointer = SmartPointerManager.getInstance(getProject()).createSmartPsiElementPointer(t.getXmlTag()); domManager.getTypeChooserManager().registerTypeChooser(aClass[0], new TypeChooser() { + @Override public Type chooseType(final XmlTag tag) { if (tag == pointer.getElement()) { return getElementType(); @@ -96,10 +99,12 @@ public abstract class DefaultAddAction extends AnAction { return oldChoosers[0].chooseType(tag); } + @Override public void distinguishTag(final XmlTag tag, final Type aClass) throws IncorrectOperationException { oldChoosers[0].distinguishTag(tag, aClass); } + @Override public Type[] getChooserTypes() { return oldChoosers[0].getChooserTypes(); } diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/GenerateDomElementAction.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/GenerateDomElementAction.java index dd6f1c03ae2c..89229194ea57 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/GenerateDomElementAction.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/GenerateDomElementAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,11 +50,14 @@ public class GenerateDomElementAction extends CodeInsightAction { this(generateProvider, null); } + @Override @NotNull protected CodeInsightActionHandler getHandler() { return new CodeInsightActionHandler() { + @Override public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) { final Runnable runnable = new Runnable() { + @Override public void run() { final DomElement element = myProvider.generate(project, editor, file); myProvider.navigate(element); @@ -63,6 +66,7 @@ public class GenerateDomElementAction extends CodeInsightAction { if (GenerateDomElementAction.this.startInWriteAction()) { new WriteCommandAction(project, file) { + @Override protected void run(final Result result) throws Throwable { runnable.run(); } @@ -73,6 +77,7 @@ public class GenerateDomElementAction extends CodeInsightAction { } } + @Override public boolean startInWriteAction() { return false; } @@ -83,6 +88,7 @@ public class GenerateDomElementAction extends CodeInsightAction { return true; } + @Override protected boolean isValidForFile(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) { final DomElement element = DomUtil.getContextElement(editor); return element != null && myProvider.isAvailableForElement(element); diff --git a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/GenerateDomElementProvider.java b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/GenerateDomElementProvider.java index 810a778ab235..1115521da25c 100644 --- a/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/GenerateDomElementProvider.java +++ b/xml/dom-openapi/src/com/intellij/util/xml/ui/actions/generate/GenerateDomElementProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,6 +51,7 @@ public abstract class GenerateDomElementProvider { if (navigateProvider != null && navigateProvider.canNavigate(copy)) { ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override public void run() { if (!project.isDisposed()) { doNavigate(navigateProvider, copy); diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomBasicsTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomBasicsTest.java index 7f059e4f000a..630ad79f03d0 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/DomBasicsTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/DomBasicsTest.java @@ -200,7 +200,7 @@ public class DomBasicsTest extends DomTestCase { private void assertFixedChildDescription(final DomFixedChildDescription description, final DomElement child, - final String tagName) throws NoSuchMethodException { + final String tagName) { assertEquals(1, description.getCount()); assertEquals(Arrays.asList(child), description.getValues(child.getParent())); assertEquals(tagName, description.getXmlElementName()); @@ -210,7 +210,7 @@ public class DomBasicsTest extends DomTestCase { private static void assertGenericChildDescription(final DomFixedChildDescription description, final DomElement child, - final String tagName) throws NoSuchMethodException { + final String tagName) { assertEquals(1, description.getCount()); assertEquals(Arrays.asList(child), description.getValues(child.getParent())); assertEquals(tagName, description.getXmlElementName()); diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomChildrenTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomChildrenTest.java index efd932523d86..60cb32b093cb 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/DomChildrenTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/DomChildrenTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -207,6 +207,7 @@ public class DomChildrenTest extends DomTestCase { assertEquals(element, child2.getParent()); WriteCommandAction.runWriteCommandAction(null, new Runnable() { + @Override public void run() { child2.undefine(); assertFalse(child2.isValid()); @@ -409,6 +410,7 @@ public class DomChildrenTest extends DomTestCase { final MyElement element = createElement(""); final MyElement child = element.getChild(); ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override public void run() { element.undefine(); } diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomConcurrencyStressTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomConcurrencyStressTest.java index 4a94d0e5ba26..d7df24ea570f 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/DomConcurrencyStressTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/DomConcurrencyStressTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,6 +82,7 @@ public class DomConcurrencyStressTest extends DomTestCase { public void run() { for (int i = 0; i < ITERATIONS; i++) { ApplicationManager.getApplication().runReadAction(new Runnable() { + @Override public void run() { final DomFileElementImpl element = getDomManager().getFileElement(file); assertNotNull(element); @@ -197,6 +198,7 @@ public class DomConcurrencyStressTest extends DomTestCase { final Random random = new Random(); for (int i = 0; i < ITERATIONS; i++) { ApplicationManager.getApplication().runReadAction(new Runnable() { + @Override public void run() { int offset = random.nextInt(file.getTextLength() - 10); XmlTag tag = PsiTreeUtil.findElementOfClassAtOffset(file, offset, XmlTag.class, false); diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomExtensionsTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomExtensionsTest.java index 5aa8c0b2255d..c75fe42d2bc7 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/DomExtensionsTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/DomExtensionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,6 +18,7 @@ package com.intellij.util.xml; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.util.Key; import com.intellij.testFramework.IdeaTestUtil; +import com.intellij.testFramework.PlatformTestUtil; import com.intellij.util.Consumer; import com.intellij.util.ParameterizedTypeImpl; import com.intellij.util.ReflectionUtil; @@ -212,7 +213,7 @@ public class DomExtensionsTest extends DomTestCase { final DomExtenderEP extenderEP = new DomExtenderEP(); extenderEP.domClassName = domClass.getName(); extenderEP.extenderClassName = extenderClass.getName(); - IdeaTestUtil.registerExtension(Extensions.getRootArea(), DomExtenderEP.EP_NAME, extenderEP, myTestRootDisposable); + PlatformTestUtil.registerExtension(Extensions.getRootArea(), DomExtenderEP.EP_NAME, extenderEP, myTestRootDisposable); } diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomIncludesTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomIncludesTest.java index 095c9d40b050..d141ce0abcbf 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/DomIncludesTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/DomIncludesTest.java @@ -66,7 +66,7 @@ public class DomIncludesTest extends CodeInsightFixtureTestCase { assertEquals("a", element.getXxx().getValue()); } }; - assertOrderedCollection(children, new Consumer[] { consumer1, consumer2 }); + assertOrderedCollection(children, consumer1, consumer2); } public void testNamespaces() throws Throwable { @@ -127,6 +127,7 @@ public class DomIncludesTest extends CodeInsightFixtureTestCase { try { for (int k = 0; k < iterationCount; k++) { ApplicationManager.getApplication().runReadAction(new Runnable() { + @Override public void run() { final List boys = rootElement.getBoys(); Thread.yield(); @@ -151,6 +152,7 @@ public class DomIncludesTest extends CodeInsightFixtureTestCase { for (int i = 0; i < iterationCount; i++) { WriteCommandAction.runWriteCommandAction(null, new Runnable() { + @Override public void run() { fileB.getViewProvider().getDocument().insertString(0, " "); fileD.getViewProvider().getDocument().insertString(0, " "); @@ -158,14 +160,18 @@ public class DomIncludesTest extends CodeInsightFixtureTestCase { } }); Thread.sleep(10); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { fileC.getViewProvider().getDocument().insertString(0, " "); fileE.getViewProvider().getDocument().insertString(0, " "); PsiDocumentManager.getInstance(getProject()).commitAllDocuments(); //clear xinclude caches } }); Thread.sleep(10); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { fileB.getViewProvider().getDocument().setText(textB); fileC.getViewProvider().getDocument().setText(textC); diff --git a/xml/dom-tests/tests/com/intellij/util/xml/DomSaxParserTest.java b/xml/dom-tests/tests/com/intellij/util/xml/DomSaxParserTest.java index c5ec2d4bd9b8..e9ab73077873 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/DomSaxParserTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/DomSaxParserTest.java @@ -1,6 +1,17 @@ /* - * Copyright (c) 2000-2005 by JetBrains s.r.o. All Rights Reserved. - * Use is subject to license terms. + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.intellij.util.xml; @@ -100,7 +111,7 @@ public class DomSaxParserTest extends LightPlatformCodeInsightFixtureTestCase { "\n" + "%globals;\n" + "]>", "a", null, null, "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"); } - private void assertData(final String start, @Nullable final String localName, @Nullable String namespace, @Nullable String publicId, @Nullable String systemId) throws IOException, SAXException { + private void assertData(final String start, @Nullable final String localName, @Nullable String namespace, @Nullable String publicId, @Nullable String systemId) { XmlFileHeader expected = new XmlFileHeader(localName, namespace, publicId, systemId); XmlFile file = createXmlFile(start); diff --git a/xml/dom-tests/tests/com/intellij/util/xml/ProxyTest.java b/xml/dom-tests/tests/com/intellij/util/xml/ProxyTest.java index 95c25fc3540a..3db1009c15de 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/ProxyTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/ProxyTest.java @@ -201,6 +201,7 @@ public class ProxyTest extends TestCase { } interface ConcreteInterface extends GenericInterface { + @Override Object foo(String t); } diff --git a/xml/dom-tests/tests/com/intellij/util/xml/impl/IncrementalUpdateEventsTest.java b/xml/dom-tests/tests/com/intellij/util/xml/impl/IncrementalUpdateEventsTest.java index 41c6b49fd168..5568b312844c 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/impl/IncrementalUpdateEventsTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/impl/IncrementalUpdateEventsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -124,6 +124,7 @@ public class IncrementalUpdateEventsTest extends DomTestCase { private void deleteTag(final int index) throws IncorrectOperationException { WriteCommandAction.runWriteCommandAction(null, new Runnable() { + @Override public void run() { myElement.getXmlTag().getSubTags()[index].delete(); } diff --git a/xml/dom-tests/tests/com/intellij/util/xml/impl/TreeIncrementalUpdateTest.java b/xml/dom-tests/tests/com/intellij/util/xml/impl/TreeIncrementalUpdateTest.java index 3ad475aa67b3..32e9f2d5a71c 100644 --- a/xml/dom-tests/tests/com/intellij/util/xml/impl/TreeIncrementalUpdateTest.java +++ b/xml/dom-tests/tests/com/intellij/util/xml/impl/TreeIncrementalUpdateTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -373,6 +373,7 @@ public class TreeIncrementalUpdateTest extends DomTestCase { final XmlTag tag = element.getXmlTag(); final XmlTag childTag = tag.getSubTags()[0]; WriteCommandAction.runWriteCommandAction(null, new Runnable() { + @Override public void run() { childTag.delete(); } @@ -391,7 +392,9 @@ public class TreeIncrementalUpdateTest extends DomTestCase { final Sepulka element = createElement("", Sepulka.class); final List list = element.getCustomChildren(); final XmlTag tag = element.getXmlTag(); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { tag.getSubTags()[0].delete(); tag.getSubTags()[0].delete(); } @@ -420,6 +423,7 @@ public class TreeIncrementalUpdateTest extends DomTestCase { assertNoCache(leafTag); ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override public void run() { tag.getSubTags()[1].delete(); diff --git a/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.java b/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.java index 2fe84b14bec3..ba5a72a80beb 100644 --- a/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.java +++ b/xml/impl/src/com/intellij/application/options/CodeStyleHtmlPanel.java @@ -89,6 +89,7 @@ public class CodeStyleHtmlPanel extends CodeStyleAbstractPanel { addPanelToWatch(myPanel); } + @Override protected EditorHighlighter createHighlighter(final EditorColorsScheme scheme) { return XmlHighlighterFactory.createXMLHighlighter(scheme); } @@ -107,6 +108,7 @@ public class CodeStyleHtmlPanel extends CodeStyleAbstractPanel { uiField.getTextField().setEditable(false); uiField.setButtonIcon(PlatformIcons.OPEN_EDIT_DIALOG_ICON); uiField.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { final TagListDialog tagListDialog = new TagListDialog(title); tagListDialog.setData(createCollectionOn(uiField.getText())); @@ -130,10 +132,12 @@ public class CodeStyleHtmlPanel extends CodeStyleAbstractPanel { }); } + @Override protected int getRightMargin() { return 60; } + @Override public void apply(CodeStyleSettings settings) { settings.HTML_KEEP_BLANK_LINES = getIntValue(myKeepBlankLines); settings.HTML_ATTRIBUTE_WRAP = ourWrappings[myWrapAttributes.getSelectedIndex()]; @@ -165,6 +169,7 @@ public class CodeStyleHtmlPanel extends CodeStyleAbstractPanel { } } + @Override protected void resetImpl(final CodeStyleSettings settings) { myKeepBlankLines.setText(String.valueOf(settings.HTML_KEEP_BLANK_LINES)); myWrapAttributes.setSelectedIndex(getIndexForWrapping(settings.HTML_ATTRIBUTE_WRAP)); @@ -187,6 +192,7 @@ public class CodeStyleHtmlPanel extends CodeStyleAbstractPanel { myKeepWhiteSpacesTagNames.setText(settings.HTML_KEEP_WHITESPACES_INSIDE); } + @Override public boolean isModified(CodeStyleSettings settings) { if (settings.HTML_KEEP_BLANK_LINES != getIntValue(myKeepBlankLines)) { return true; @@ -257,20 +263,24 @@ public class CodeStyleHtmlPanel extends CodeStyleAbstractPanel { return false; } + @Override public JComponent getPanel() { return myPanel; } + @Override protected String getPreviewText() { return readFromFile(this.getClass(), "preview.html.template"); } + @Override @NotNull protected FileType getFileType() { return StdFileTypes.HTML; } + @Override protected void prepareForReformat(final PsiFile psiFile) { //psiFile.putUserData(PsiUtil.FILE_LANGUAGE_LEVEL_KEY, LanguageLevel.HIGHEST); } diff --git a/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.java b/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.java index 387366122cd8..ab3126162dde 100644 --- a/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.java +++ b/xml/impl/src/com/intellij/application/options/CodeStyleXmlPanel.java @@ -58,14 +58,17 @@ public class CodeStyleXmlPanel extends CodeStyleAbstractPanel{ addPanelToWatch(myPanel); } + @Override protected EditorHighlighter createHighlighter(final EditorColorsScheme scheme) { return XmlHighlighterFactory.createXMLHighlighter(scheme); } + @Override protected int getRightMargin() { return 60; } + @Override public void apply(CodeStyleSettings settings) { XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class); xmlSettings.XML_KEEP_BLANK_LINES = getIntValue(myKeepBlankLines); @@ -91,6 +94,7 @@ public class CodeStyleXmlPanel extends CodeStyleAbstractPanel{ } } + @Override protected void resetImpl(final CodeStyleSettings settings) { XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class); myKeepBlankLines.setText(String.valueOf(xmlSettings.XML_KEEP_BLANK_LINES)); @@ -107,6 +111,7 @@ public class CodeStyleXmlPanel extends CodeStyleAbstractPanel{ myKeepWhitespaceInsideCDATACheckBox.setSelected(xmlSettings.XML_KEEP_WHITE_SPACES_INSIDE_CDATA); } + @Override public boolean isModified(CodeStyleSettings settings) { XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class); if (myWrapText.isSelected() != wrapText(settings)) { @@ -159,19 +164,23 @@ public class CodeStyleXmlPanel extends CodeStyleAbstractPanel{ return xmlSettings.XML_TEXT_WRAP == CommonCodeStyleSettings.WRAP_AS_NEEDED; } + @Override public JComponent getPanel() { return myPanel; } + @Override protected String getPreviewText() { return readFromFile(getClass(), "preview.xml.template"); } + @Override @NotNull protected FileType getFileType() { return StdFileTypes.XML; } + @Override protected void prepareForReformat(final PsiFile psiFile) { //psiFile.putUserData(PsiUtil.FILE_LANGUAGE_LEVEL_KEY, LanguageLevel.HIGHEST); } diff --git a/xml/impl/src/com/intellij/codeInsight/actions/GenerateDTDAction.java b/xml/impl/src/com/intellij/codeInsight/actions/GenerateDTDAction.java index d7acaf3c8510..c0930b4d9971 100644 --- a/xml/impl/src/com/intellij/codeInsight/actions/GenerateDTDAction.java +++ b/xml/impl/src/com/intellij/codeInsight/actions/GenerateDTDAction.java @@ -54,7 +54,7 @@ public class GenerateDTDAction extends BaseCodeInsightAction{ public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) { final XmlDocument document = findSuitableXmlDocument(file); if (document != null) { - final @NonNls StringBuffer buffer = new StringBuffer(); + final @NonNls StringBuilder buffer = new StringBuilder(); buffer.append("\n"); diff --git a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/AddSchemaPrefixIntention.java b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/AddSchemaPrefixIntention.java index 5ce032e24dfd..2cec8cacd6ce 100644 --- a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/AddSchemaPrefixIntention.java +++ b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/AddSchemaPrefixIntention.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,7 +82,7 @@ public class AddSchemaPrefixIntention extends PsiElementBaseIntentionAction { final List values = new ArrayList(); new WriteCommandAction(project, NAME, tag.getContainingFile()) { @Override - protected void run(Result result) throws Throwable { + protected void run(@NotNull Result result) throws Throwable { tag.accept(new XmlRecursiveElementVisitor() { @Override public void visitXmlTag(XmlTag tag) { diff --git a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/InsertRequiredAttributeFix.java b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/InsertRequiredAttributeFix.java index 1a4a5842443d..ae3b12492881 100644 --- a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/InsertRequiredAttributeFix.java +++ b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/InsertRequiredAttributeFix.java @@ -107,7 +107,7 @@ public class InsertRequiredAttributeFix extends LocalQuickFixAndIntentionActionO } Expression expression = new Expression() { - TextResult result = new TextResult(""); + final TextResult result = new TextResult(""); @Override public Result calculateResult(ExpressionContext context) { diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlQuoteHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlQuoteHandler.java index c376856a6e58..7c3b19652d42 100644 --- a/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlQuoteHandler.java +++ b/xml/impl/src/com/intellij/codeInsight/editorActions/HtmlQuoteHandler.java @@ -22,7 +22,7 @@ import com.intellij.openapi.editor.highlighter.HighlighterIterator; * @author peter */ public class HtmlQuoteHandler implements QuoteHandler { - private QuoteHandler myBaseQuoteHandler; + private final QuoteHandler myBaseQuoteHandler; public HtmlQuoteHandler() { this(new XmlQuoteHandler()); diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlCopyPastePreProcessor.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlCopyPastePreProcessor.java index 0a7b8dfa1456..fa2f9c276a40 100644 --- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlCopyPastePreProcessor.java +++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlCopyPastePreProcessor.java @@ -38,11 +38,13 @@ public class XmlCopyPastePreProcessor implements CopyPastePreProcessor { private static final EncodeEachSymbolPolicy ENCODE_EACH_SYMBOL_POLICY = new EncodeEachSymbolPolicy(); + @Override @Nullable public String preprocessOnCopy(PsiFile file, int[] startOffsets, int[] endOffsets, String text) { return null; } + @Override @NotNull public String preprocessOnPaste(Project project, PsiFile file, Editor editor, String text, RawText rawText) { final Document document = editor.getDocument(); diff --git a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java index 35080e98b9e5..43084679f455 100644 --- a/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java +++ b/xml/impl/src/com/intellij/codeInsight/editorActions/XmlEqTypedHandler.java @@ -31,7 +31,7 @@ import org.jetbrains.annotations.NotNull; import java.util.List; public class XmlEqTypedHandler extends TypedHandlerDelegate { - private List caretsForInsertingQuotes = ContainerUtil.newSmartList(); + private final List caretsForInsertingQuotes = ContainerUtil.newSmartList(); @Override public Result beforeCharTyped(char c, Project project, Editor editor, PsiFile file, FileType fileType) { diff --git a/xml/impl/src/com/intellij/codeInsight/hint/api/impls/XmlParameterInfoHandler.java b/xml/impl/src/com/intellij/codeInsight/hint/api/impls/XmlParameterInfoHandler.java index c528c4c43c87..62e7a2255681 100644 --- a/xml/impl/src/com/intellij/codeInsight/hint/api/impls/XmlParameterInfoHandler.java +++ b/xml/impl/src/com/intellij/codeInsight/hint/api/impls/XmlParameterInfoHandler.java @@ -165,7 +165,7 @@ public class XmlParameterInfoHandler implements ParameterInfoHandler attributePresentFun) { final XmlAttributeDescriptor[] attributes = descriptor != null ? getSortedDescriptors(descriptor) : XmlAttributeDescriptor.EMPTY; - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); int highlightStartOffset = -1; int highlightEndOffset = -1; @@ -182,9 +182,9 @@ public class XmlParameterInfoHandler implements ParameterInfoHandler(), new Xsd2InstanceUtils.SchemaReferenceProcessor() { + @Override public void processSchema(String schemaFileName, byte[] schemaContent) { try { final String fullFileName = tempDir.getPath() + File.separatorChar + schemaFileName; @@ -169,6 +171,7 @@ public class GenerateInstanceDocumentFromSchemaAction extends AnAction { final File xmlFile = new File(xmlFileName); VirtualFile virtualFile = ApplicationManager.getApplication().runWriteAction(new Computable() { + @Override @Nullable public VirtualFile compute() { return LocalFileSystem.getInstance().refreshAndFindFileByIoFile(xmlFile); diff --git a/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateInstanceDocumentFromSchemaDialog.java b/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateInstanceDocumentFromSchemaDialog.java index 20c6b278f775..ffc37a5e9136 100644 --- a/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateInstanceDocumentFromSchemaDialog.java +++ b/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateInstanceDocumentFromSchemaDialog.java @@ -20,7 +20,6 @@ import com.intellij.javaee.ExternalResourceManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.TextFieldWithBrowseButton; -import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiFile; @@ -89,14 +88,17 @@ public class GenerateInstanceDocumentFromSchemaDialog extends DialogWrapper { if (component instanceof JTextField) { ((JTextField)component).getDocument().addDocumentListener(new DocumentListener() { + @Override public void insertUpdate(DocumentEvent e) { validateData(); } + @Override public void removeUpdate(DocumentEvent e) { validateData(); } + @Override public void changedUpdate(DocumentEvent e) { validateData(); } @@ -106,20 +108,24 @@ public class GenerateInstanceDocumentFromSchemaDialog extends DialogWrapper { JComboBox jComboBox = ((JComboBox)component); jComboBox.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { validateData(); } }); ((JTextField)jComboBox.getEditor().getEditorComponent()).getDocument().addDocumentListener(new DocumentListener() { + @Override public void insertUpdate(DocumentEvent e) { validateData(); } + @Override public void removeUpdate(DocumentEvent e) { validateData(); } + @Override public void changedUpdate(DocumentEvent e) { validateData(); } @@ -127,6 +133,7 @@ public class GenerateInstanceDocumentFromSchemaDialog extends DialogWrapper { if (jComboBox.isEditable()) { jComboBox.getEditor().getEditorComponent().addKeyListener(new KeyAdapter() { + @Override public void keyTyped(KeyEvent e) { validateData(); } @@ -265,6 +272,7 @@ public class GenerateInstanceDocumentFromSchemaDialog extends DialogWrapper { return status; } + @Override protected JComponent createCenterPanel() { return panel; } @@ -293,6 +301,7 @@ public class GenerateInstanceDocumentFromSchemaDialog extends DialogWrapper { } } + @Override @NotNull protected String getHelpId() { return "webservices.GenerateInstanceDocumentFromSchema"; diff --git a/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateSchemaFromInstanceDocumentAction.java b/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateSchemaFromInstanceDocumentAction.java index 93fb14ca6746..4a84ad70f2dc 100644 --- a/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateSchemaFromInstanceDocumentAction.java +++ b/xml/impl/src/com/intellij/xml/actions/xmlbeans/GenerateSchemaFromInstanceDocumentAction.java @@ -66,12 +66,14 @@ public class GenerateSchemaFromInstanceDocumentAction extends AnAction { } } + @Override public void actionPerformed(AnActionEvent e) { final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext()); final VirtualFile file = CommonDataKeys.VIRTUAL_FILE.getData(e.getDataContext()); final GenerateSchemaFromInstanceDocumentDialog dialog = new GenerateSchemaFromInstanceDocumentDialog(project, file); dialog.setOkAction(new Runnable() { + @Override public void run() { doAction(project, dialog); } @@ -128,6 +130,7 @@ public class GenerateSchemaFromInstanceDocumentAction extends AnAction { final VirtualFile xsdFile = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(xsd); if (xsdFile != null) { ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override public void run() { try { xsdFile.delete(null); diff --git a/xml/impl/src/com/intellij/xml/actions/xmlbeans/UIUtils.java b/xml/impl/src/com/intellij/xml/actions/xmlbeans/UIUtils.java index 1b86cbf99ec2..80df3ad11067 100644 --- a/xml/impl/src/com/intellij/xml/actions/xmlbeans/UIUtils.java +++ b/xml/impl/src/com/intellij/xml/actions/xmlbeans/UIUtils.java @@ -46,10 +46,12 @@ public class UIUtils { wsdlUrl.getButton().setToolTipText(XmlBundle.message("browse.button.tooltip")); wsdlUrl.getButton().addActionListener( new ActionListener() { + @Override public void actionPerformed(ActionEvent actionEvent) { final FileChooserDescriptor fileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, multipleFileSelection) { private final List extensions = Arrays.asList(_extensions); + @Override public boolean isFileSelectable(VirtualFile virtualFile) { return extensions.contains(virtualFile.getExtension()); } diff --git a/xml/impl/src/com/intellij/xml/actions/xmlbeans/Xsd2InstanceUtils.java b/xml/impl/src/com/intellij/xml/actions/xmlbeans/Xsd2InstanceUtils.java index c6c358eda169..963544945212 100644 --- a/xml/impl/src/com/intellij/xml/actions/xmlbeans/Xsd2InstanceUtils.java +++ b/xml/impl/src/com/intellij/xml/actions/xmlbeans/Xsd2InstanceUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -79,18 +79,15 @@ public class Xsd2InstanceUtils { // Process Schema files List sdocs = new ArrayList(); - for (int i = 0; i < schemaFiles.length; i++) - { - try - { - sdocs.add(XmlObject.Factory.parse(schemaFiles[i], - (new XmlOptions()).setLoadLineNumbers().setLoadMessageDigest())); - } - catch (Exception e) - { - throw new IllegalArgumentException("Can not load schema file: " + schemaFiles[i] + ": " + e.getLocalizedMessage()); - } + for (File schemaFile : schemaFiles) { + try { + sdocs.add(XmlObject.Factory.parse(schemaFile, + (new XmlOptions()).setLoadLineNumbers().setLoadMessageDigest())); } + catch (Exception e) { + throw new IllegalArgumentException("Can not load schema file: " + schemaFile + ": " + e.getLocalizedMessage()); + } + } XmlObject[] schemas = (XmlObject[]) sdocs.toArray(new XmlObject[sdocs.size()]); @@ -121,14 +118,12 @@ public class Xsd2InstanceUtils { } SchemaType[] globalElems = sts.documentTypes(); SchemaType elem = null; - for (int i = 0; i < globalElems.length; i++) - { - if (rootName.equals(globalElems[i].getDocumentElementName().getLocalPart())) - { - elem = globalElems[i]; - break; - } + for (SchemaType globalElem : globalElems) { + if (rootName.equals(globalElem.getDocumentElementName().getLocalPart())) { + elem = globalElem; + break; } + } if (elem == null) { throw new IllegalArgumentException("Could not find a global element with name \"" + rootName + "\""); diff --git a/xml/impl/src/com/intellij/xml/breadcrumbs/XmlLanguageBreadcrumbsInfoProvider.java b/xml/impl/src/com/intellij/xml/breadcrumbs/XmlLanguageBreadcrumbsInfoProvider.java index 3e0653a986f7..43470c2d55f4 100644 --- a/xml/impl/src/com/intellij/xml/breadcrumbs/XmlLanguageBreadcrumbsInfoProvider.java +++ b/xml/impl/src/com/intellij/xml/breadcrumbs/XmlLanguageBreadcrumbsInfoProvider.java @@ -53,7 +53,7 @@ public class XmlLanguageBreadcrumbsInfoProvider extends BreadcrumbsInfoProvider @NotNull public String getElementInfo(@NotNull final PsiElement e) { final XmlTag tag = (XmlTag)e; - final StringBuffer sb = new StringBuffer(); + final StringBuilder sb = new StringBuilder(); sb.append(tag.getName()); @@ -81,7 +81,7 @@ public class XmlLanguageBreadcrumbsInfoProvider extends BreadcrumbsInfoProvider @Nullable public String getElementTooltip(@NotNull final PsiElement e) { final XmlTag tag = (XmlTag)e; - final StringBuffer result = new StringBuffer("<"); + final StringBuilder result = new StringBuilder("<"); result.append(tag.getName()); final XmlAttribute[] attributes = tag.getAttributes(); for (final XmlAttribute each : attributes) { diff --git a/xml/impl/src/com/intellij/xml/impl/schema/SchemaDefinitionsSearch.java b/xml/impl/src/com/intellij/xml/impl/schema/SchemaDefinitionsSearch.java index 1fdacf2def18..b3cc34ff57a1 100644 --- a/xml/impl/src/com/intellij/xml/impl/schema/SchemaDefinitionsSearch.java +++ b/xml/impl/src/com/intellij/xml/impl/schema/SchemaDefinitionsSearch.java @@ -17,7 +17,6 @@ package com.intellij.xml.impl.schema; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleUtil; import com.intellij.openapi.module.ModuleUtilCore; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Comparing; diff --git a/xml/impl/src/com/intellij/xml/util/documentation/HtmlDocumentationProvider.java b/xml/impl/src/com/intellij/xml/util/documentation/HtmlDocumentationProvider.java index d78b9b144d00..11fb4a784c42 100644 --- a/xml/impl/src/com/intellij/xml/util/documentation/HtmlDocumentationProvider.java +++ b/xml/impl/src/com/intellij/xml/util/documentation/HtmlDocumentationProvider.java @@ -251,6 +251,7 @@ public class HtmlDocumentationProvider implements DocumentationProvider { return buf.toString(); } + @Override public PsiElement getDocumentationElementForLookupItem(PsiManager psiManager, Object object, PsiElement element) { PsiElement result = createNavigationElementHTML(psiManager, object.toString(),element); @@ -266,6 +267,7 @@ public class HtmlDocumentationProvider implements DocumentationProvider { return result; } + @Override public PsiElement getDocumentationElementForLink(PsiManager psiManager, String link, PsiElement context) { PsiElement result = createNavigationElementHTML(psiManager, link, context); diff --git a/xml/impl/src/com/intellij/xml/util/documentation/XmlDocumentationProvider.java b/xml/impl/src/com/intellij/xml/util/documentation/XmlDocumentationProvider.java index 19ffd32da6b7..2d6b70ed31d8 100644 --- a/xml/impl/src/com/intellij/xml/util/documentation/XmlDocumentationProvider.java +++ b/xml/impl/src/com/intellij/xml/util/documentation/XmlDocumentationProvider.java @@ -375,7 +375,7 @@ public class XmlDocumentationProvider implements DocumentationProvider { if (object == null) return null; try { - @NonNls StringBuffer tagText = new StringBuffer(object.toString()); + @NonNls StringBuilder tagText = new StringBuilder(object.toString()); String namespacePrefix = XmlUtil.findPrefixByQualifiedName(object.toString()); String namespace = xmlTag.getNamespaceByPrefix(namespacePrefix); diff --git a/xml/openapi/src/com/intellij/xml/breadcrumbs/BreadcrumbsComponent.java b/xml/openapi/src/com/intellij/xml/breadcrumbs/BreadcrumbsComponent.java index 9e3b5ae2107c..9cb570842442 100644 --- a/xml/openapi/src/com/intellij/xml/breadcrumbs/BreadcrumbsComponent.java +++ b/xml/openapi/src/com/intellij/xml/breadcrumbs/BreadcrumbsComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,7 +54,7 @@ public class BreadcrumbsComponent extends JComponent addMouseListener(myMouseListener); addMouseMotionListener(myMouseListener); - setToolTipText(new String()); + setToolTipText(""); } public void setItems(@Nullable final List itemsList) { @@ -74,6 +74,7 @@ public class BreadcrumbsComponent extends JComponent myListeners.remove(listener); } + @Override public String getToolTipText(final MouseEvent event) { final Crumb c = getCrumb(event.getPoint()); if (c != null) { @@ -145,6 +146,7 @@ public class BreadcrumbsComponent extends JComponent repaint(); } + @Override public void paint(final Graphics g) { final Graphics2D g2 = ((Graphics2D)g); final Dimension d = getSize(); @@ -335,19 +337,23 @@ public class BreadcrumbsComponent extends JComponent return totalWidth; } + @Override public Dimension getMinimumSize() { return getPreferredSize(); } + @Override public Dimension getPreferredSize() { final Graphics2D g2 = (Graphics2D)getGraphics(); return new Dimension(Integer.MAX_VALUE, g2 != null ? DEFAULT_PAINTER.getSize("DUMMY", g2.getFontMetrics(), Integer.MAX_VALUE).height + 1 : 1); } + @Override public Dimension getMaximumSize() { return getPreferredSize(); } + @Override public void dispose() { removeMouseListener(myMouseListener); removeMouseMotionListener(myMouseListener); @@ -419,10 +425,12 @@ public class BreadcrumbsComponent extends JComponent myBreadcrumbs = line; } + @Override public void mouseDragged(final MouseEvent e) { // nothing } + @Override public void mouseMoved(final MouseEvent e) { final Crumb crumb = myBreadcrumbs.getCrumb(e.getPoint()); if (crumb != myHoveredCrumb) { @@ -431,14 +439,17 @@ public class BreadcrumbsComponent extends JComponent } } + @Override public void mouseExited(final MouseEvent e) { mouseMoved(e); } + @Override public void mouseEntered(final MouseEvent e) { mouseMoved(e); } + @Override public void mouseClicked(final MouseEvent e) { final Crumb crumb = myBreadcrumbs.getCrumb(e.getPoint()); if (crumb != null) { @@ -448,9 +459,9 @@ public class BreadcrumbsComponent extends JComponent } private static class Crumb { - private String myString; + private final String myString; private int myOffset = -1; - private int myWidth; + private final int myWidth; private T myItem; private BreadcrumbsComponent myLine; private boolean mySelected; @@ -552,6 +563,7 @@ public class BreadcrumbsComponent extends JComponent myLine = line; } + @Override public void performAction(final int modifiers) { if (myForward) { myLine.nextPage(); @@ -567,10 +579,12 @@ public class BreadcrumbsComponent extends JComponent super(null, width); } + @Override public void paint(@NotNull final Graphics2D g2, @NotNull final Painter painter, final int height, final int pageOffset) { // does nothing } + @Override public void performAction(final int modifiers) { // does nothing } @@ -632,6 +646,7 @@ public class BreadcrumbsComponent extends JComponent return DEFAULT_BG_COLOR; } + @Override @Nullable Color getBackgroundColor(@NotNull final Crumb c) { final BreadcrumbsItem item = c.getItem(); @@ -644,6 +659,7 @@ public class BreadcrumbsComponent extends JComponent return getBackgroundColor(c.isSelected(), c.isHovered(), c.isLight(), c instanceof NavigationCrumb); } + @Override @Nullable Color getForegroundColor(@NotNull final Crumb c) { if (c.isLight() && !c.isHovered() && !(c instanceof NavigationCrumb)) { @@ -653,6 +669,7 @@ public class BreadcrumbsComponent extends JComponent return super.getForegroundColor(c); } + @Override @Nullable Color getBorderColor(@NotNull final Crumb c) { return (c.isLight() && !c.isHovered() && !(c instanceof NavigationCrumb)) ? LIGHT_BORDER_COLOR : DEFAULT_BORDER_COLOR; @@ -687,6 +704,7 @@ public class BreadcrumbsComponent extends JComponent super(s); } + @Override public void paint(@NotNull final Crumb c, @NotNull final Graphics2D g2, final int height, final int pageOffset) { final PainterSettings s = getSettings(); final Font oldFont = g2.getFont(); @@ -720,7 +738,7 @@ public class BreadcrumbsComponent extends JComponent String string = c.getString(); if (fm.stringWidth(string) > width) { final int dotsWidth = fm.stringWidth("..."); - final StringBuffer sb = new StringBuffer(); + final StringBuilder sb = new StringBuilder(); int length = 0; for (int i = 0; i < string.length(); i++) { final int charWidth = fm.charWidth(string.charAt(i)); @@ -741,6 +759,7 @@ public class BreadcrumbsComponent extends JComponent g2.setFont(oldFont); } + @Override @NotNull Dimension getSize(@NotNull @NonNls final String s, @NotNull final FontMetrics fm, final int maxWidth) { final int width = fm.stringWidth(s) + (ROUND_VALUE * 2); diff --git a/xml/relaxng/src/org/intellij/html/RelaxedHtmlFromRngElementDescriptor.java b/xml/relaxng/src/org/intellij/html/RelaxedHtmlFromRngElementDescriptor.java index 6abb42080052..08ada22129d9 100644 --- a/xml/relaxng/src/org/intellij/html/RelaxedHtmlFromRngElementDescriptor.java +++ b/xml/relaxng/src/org/intellij/html/RelaxedHtmlFromRngElementDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ public class RelaxedHtmlFromRngElementDescriptor implements XmlElementDescriptor myDelegate = delegate; } + @Override public XmlElementDescriptor getElementDescriptor(XmlTag childTag, XmlTag contextTag) { XmlElementDescriptor elementDescriptor = myDelegate.getElementDescriptor(childTag, contextTag); @@ -53,6 +54,7 @@ public class RelaxedHtmlFromRngElementDescriptor implements XmlElementDescriptor return myDelegate.getDefaultName(); } + @Override public XmlElementDescriptor[] getElementsDescriptors(final XmlTag context) { return ArrayUtil.mergeArrays( myDelegate.getElementsDescriptors(context), @@ -60,6 +62,7 @@ public class RelaxedHtmlFromRngElementDescriptor implements XmlElementDescriptor ); } + @Override public XmlAttributeDescriptor[] getAttributesDescriptors(final XmlTag context) { return RelaxedHtmlFromSchemaElementDescriptor.addAttrDescriptorsForFacelets(context, myDelegate.getAttributesDescriptors(context)); } @@ -89,6 +92,7 @@ public class RelaxedHtmlFromRngElementDescriptor implements XmlElementDescriptor return null; } + @Override public XmlAttributeDescriptor getAttributeDescriptor(String attributeName, final XmlTag context) { final XmlAttributeDescriptor descriptor = myDelegate.getAttributeDescriptor(attributeName.toLowerCase(), context); if (descriptor != null) return descriptor; diff --git a/xml/relaxng/src/org/intellij/html/RelaxedHtmlFromRngNSDescriptor.java b/xml/relaxng/src/org/intellij/html/RelaxedHtmlFromRngNSDescriptor.java index 984f50d0ec5a..7ceb911889fb 100644 --- a/xml/relaxng/src/org/intellij/html/RelaxedHtmlFromRngNSDescriptor.java +++ b/xml/relaxng/src/org/intellij/html/RelaxedHtmlFromRngNSDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ import org.jetbrains.annotations.Nullable; public class RelaxedHtmlFromRngNSDescriptor extends RngNsDescriptor implements RelaxedHtmlNSDescriptor { private static final Logger LOG = Logger.getInstance("#org.intellij.html.RelaxedHtmlFromRngNSDescriptor"); + @Override public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) { XmlElementDescriptor elementDescriptor = super.getElementDescriptor(tag); @@ -61,6 +62,7 @@ public class RelaxedHtmlFromRngNSDescriptor extends RngNsDescriptor implements R return new RelaxedHtmlFromRngElementDescriptor(descriptor); } + @Override @NotNull public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable final XmlDocument doc) { return ArrayUtil.mergeArrays(super.getRootElementsDescriptors(doc), HtmlUtil.getCustomTagDescriptors(doc)); diff --git a/xml/relaxng/src/org/intellij/html/RngHtml5MetaDataContributor.java b/xml/relaxng/src/org/intellij/html/RngHtml5MetaDataContributor.java index 5bdfd431849b..a367deb4f254 100644 --- a/xml/relaxng/src/org/intellij/html/RngHtml5MetaDataContributor.java +++ b/xml/relaxng/src/org/intellij/html/RngHtml5MetaDataContributor.java @@ -48,10 +48,12 @@ public class RngHtml5MetaDataContributor implements MetaDataContributor { super(namespaces); } + @Override public boolean isClassAcceptable(Class hintClass) { return ReflectionUtil.isAssignable(RncDocument.class, hintClass); } + @Override public boolean isAcceptable(Object element, PsiElement context) { if (!(element instanceof RncDocument)) { return false; diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/ApplicationLoader.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/ApplicationLoader.java index 8b812f3f4542..ea44c0c9dd2c 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/ApplicationLoader.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/ApplicationLoader.java @@ -51,12 +51,14 @@ public class ApplicationLoader implements ApplicationComponent { private static final String VALIDATE_XML = "ValidateXml"; public static final String RNG_NAMESPACE = "http://relaxng.org/ns/structure/1.0"; + @Override @NonNls @NotNull public String getComponentName() { return "Relax-NG"; } + @Override public void initComponent() { registerMetaData(); @@ -84,6 +86,7 @@ public class ApplicationLoader implements ApplicationComponent { RngNsDescriptor.class); registrar.registerMetaData(new ElementFilter() { + @Override public boolean isAcceptable(Object element, PsiElement context) { if (element instanceof XmlTag) { final XmlTag tag = (XmlTag)element; @@ -93,12 +96,14 @@ public class ApplicationLoader implements ApplicationComponent { return false; } + @Override public boolean isClassAcceptable(Class hintClass) { return XmlTag.class.isAssignableFrom(hintClass); } }, RngDefineMetaData.class); } + @Override public void disposeComponent() { } @@ -110,6 +115,7 @@ public class ApplicationLoader implements ApplicationComponent { } public static class ResourceProvider implements StandardResourceProvider { + @Override public void registerResources(ResourceRegistrar registrar) { registrar.addStdResource(RNG_NAMESPACE, "/resources/relaxng.rng", getClass()); registrar.addIgnoredResource("http://relaxng.org/ns/compatibility/annotations/1.0"); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/GotoSymbolContributor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/GotoSymbolContributor.java index 48e001bf40f6..7fac0831a136 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/GotoSymbolContributor.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/GotoSymbolContributor.java @@ -32,11 +32,13 @@ import java.util.Collection; */ public class GotoSymbolContributor implements ChooseByNameContributor { + @Override @NotNull public NavigationItem[] getItemsByName(String name, String pattern, Project project, boolean includeNonProjectItems) { return RelaxSymbolIndex.getSymbolsByName(name, project, includeNonProjectItems); } + @Override @NotNull public String[] getNames(Project project, boolean includeNonProjectItems) { final Collection names = RelaxSymbolIndex.getSymbolNames(project); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/RelaxNGReferenceContributor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/RelaxNGReferenceContributor.java index 216271f46494..c9317dd79ac4 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/RelaxNGReferenceContributor.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/RelaxNGReferenceContributor.java @@ -1,14 +1,27 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.intellij.plugins.relaxNG; import com.intellij.patterns.XmlNamedElementPattern; import com.intellij.psi.PsiReferenceContributor; import com.intellij.psi.PsiReferenceRegistrar; import com.intellij.psi.filters.position.PatternFilter; -import com.intellij.psi.xml.XmlTag; import com.intellij.xml.util.XmlUtil; import org.intellij.plugins.relaxNG.references.PrefixReferenceProvider; -import static com.intellij.patterns.StandardPatterns.string; import static com.intellij.patterns.XmlPatterns.*; /** diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/RngDocumentationProvider.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/RngDocumentationProvider.java index de71f0d8126f..fe15a25f8b75 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/RngDocumentationProvider.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/RngDocumentationProvider.java @@ -50,6 +50,7 @@ public class RngDocumentationProvider implements DocumentationProvider { @NonNls private static final String COMPATIBILITY_ANNOTATIONS_1_0 = "http://relaxng.org/ns/compatibility/annotations/1.0"; + @Override @Nullable public String generateDoc(PsiElement element, @Nullable PsiElement originalElement) { final XmlElement c = PsiTreeUtil.getParentOfType(originalElement, XmlTag.class, XmlAttribute.class); @@ -133,21 +134,25 @@ public class RngDocumentationProvider implements DocumentationProvider { return null; } + @Override @Nullable public PsiElement getDocumentationElementForLink(PsiManager psiManager, String link, PsiElement context) { return null; } + @Override @Nullable public PsiElement getDocumentationElementForLookupItem(PsiManager psiManager, Object object, PsiElement element) { return null; } + @Override @Nullable public String getQuickNavigateInfo(PsiElement element, PsiElement originalElement) { return null; } + @Override public List getUrlFor(PsiElement element, PsiElement originalElement) { return null; } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/RngDomFileDescription.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/RngDomFileDescription.java index 7e1e2a2313e3..236b03d399ae 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/RngDomFileDescription.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/RngDomFileDescription.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.intellij.plugins.relaxNG; import com.intellij.util.xml.DomFileDescription; @@ -14,10 +29,12 @@ public class RngDomFileDescription extends DomFileDescription { registerNamespacePolicy("RELAX-NG", ApplicationLoader.RNG_NAMESPACE); } + @Override public boolean isAutomaticHighlightingEnabled() { return true; } + @Override public DomElementsAnnotator createAnnotator() { return new ModelAnnotator(); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncCompletionData.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncCompletionData.java index c83739307839..9b2053d25416 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncCompletionData.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncCompletionData.java @@ -52,10 +52,12 @@ public class RncCompletionData extends CompletionData { final CompletionVariant variant = new CompletionVariant(new AndFilter( new ElementFilter() { + @Override public boolean isAcceptable(Object element, PsiElement context) { return true; } + @Override public boolean isClassAcceptable(Class hintClass) { return PsiElement.class.isAssignableFrom(hintClass); } @@ -97,8 +99,10 @@ public class RncCompletionData extends CompletionData { private static final String[] PATTERN_KEYWORDS = new String[]{ "attribute", "element", "grammar", "notAllowed", "text", "empty", "external", "parent", "list", "mixed" }; + @Override public Object[] get(PsiElement context, CompletionContext completionContext) { return ContainerUtil.map2Array(doGetKeywords(context), LookupElement.class, new Function() { + @Override public LookupElement fun(String s) { return TailTypeDecorator.withTail(LookupElementBuilder.create(s).bold(), TailType.SPACE); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncElementTypeEx.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncElementTypeEx.java index 76274c567a9e..6f3af07813a6 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncElementTypeEx.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncElementTypeEx.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +39,7 @@ class RncElementTypeEx extends RncElementType implements N } } + @Override @NotNull public final C fun(ASTNode node) { try { diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncElementTypes.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncElementTypes.java index 7454d6926d84..95a6b22bcff3 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncElementTypes.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncElementTypes.java @@ -17,7 +17,6 @@ package org.intellij.plugins.relaxNG.compact; import com.intellij.psi.tree.IElementType; -import com.intellij.psi.tree.IFileElementType; import org.intellij.plugins.relaxNG.compact.psi.*; import org.intellij.plugins.relaxNG.compact.psi.impl.*; diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncFileType.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncFileType.java index 4e5a50121938..eb7e763fc9d2 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncFileType.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncFileType.java @@ -41,23 +41,27 @@ public class RncFileType extends LanguageFileType { super(RngCompactLanguage.INSTANCE); } + @Override @NotNull @NonNls public String getName() { return "RNG Compact"; } + @Override @NotNull public String getDescription() { return "RELAX NG Compact Syntax"; } + @Override @NotNull @NonNls public String getDefaultExtension() { return "rnc"; } + @Override @Nullable public Icon getIcon() { return AllIcons.FileTypes.Text; @@ -68,6 +72,7 @@ public class RncFileType extends LanguageFileType { } public static class Factory extends FileTypeFactory { + @Override public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) { fileTypeConsumer.consume(INSTANCE, RNC_EXT); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncHighlighter.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncHighlighter.java index f73aa00751f9..fb1fccc27346 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncHighlighter.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncHighlighter.java @@ -35,6 +35,7 @@ import java.util.Map; * Date: 04.08.2007 */ public class RncHighlighter extends SyntaxHighlighterBase { + @Override @NotNull public Lexer getHighlightingLexer() { return new CompactSyntaxLexerAdapter(); @@ -69,6 +70,7 @@ public class RncHighlighter extends SyntaxHighlighterBase { ourMap1.put(RncTokenTypes.ILLEGAL_CHAR, HighlighterColors.BAD_CHARACTER); } + @Override @NotNull public TextAttributesKey[] getTokenHighlights(IElementType tokenType) { return pack(ourMap1.get(tokenType)); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncParserDefinition.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncParserDefinition.java index 431b40e345b0..3d16fa2d8257 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncParserDefinition.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncParserDefinition.java @@ -45,34 +45,41 @@ public class RncParserDefinition implements ParserDefinition { public static final IFileElementType FILE_ELEMENT_TYPE = new IFileElementType(RngCompactLanguage.INSTANCE); private static final TokenSet myCommentTypes = TokenSet.orSet(RncTokenTypes.COMMENTS, RncTokenTypes.DOC_TOKENS); + @Override @NotNull public Lexer createLexer(Project project) { return new CompactSyntaxLexerAdapter(); } + @Override public PsiParser createParser(Project project) { return new RncParser(); } + @Override public IFileElementType getFileNodeType() { return FILE_ELEMENT_TYPE; } + @Override @NotNull public TokenSet getWhitespaceTokens() { return TokenSet.create(TokenType.WHITE_SPACE); } + @Override @NotNull public TokenSet getCommentTokens() { return myCommentTypes; } + @Override @NotNull public TokenSet getStringLiteralElements() { return TokenSet.create(RncTokenTypes.LITERAL); } + @Override @NotNull @SuppressWarnings({ "unchecked" }) public PsiElement createElement(ASTNode node) { @@ -85,10 +92,12 @@ public class RncParserDefinition implements ParserDefinition { return new MyRncElement(node); } + @Override public PsiFile createFile(FileViewProvider viewProvider) { return new RncFileImpl(viewProvider); } + @Override public SpaceRequirements spaceExistanceTypeBetweenTokens(ASTNode left, ASTNode right) { return SpaceRequirements.MAY; } @@ -98,6 +107,7 @@ public class RncParserDefinition implements ParserDefinition { super(node); } + @Override public void accept(@NotNull RncElementVisitor visitor) { visitor.visitElement(this); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncTokenTypes.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncTokenTypes.java index dd3fb641b6db..b1faabd693a2 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncTokenTypes.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/RncTokenTypes.java @@ -79,6 +79,7 @@ public class RncTokenTypes { assert !ourTokenTypes.isEmpty(); final Ref ref = new Ref(); ourTokenTypes.forEachValue(new TObjectProcedure() { + @Override public boolean execute(IElementType iElementType) { if (iElementType.toString().equals(name)) { ref.set(iElementType); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/folding/RncFoldingBuilder.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/folding/RncFoldingBuilder.java index 94ddafe1aa76..457f64ac8713 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/folding/RncFoldingBuilder.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/folding/RncFoldingBuilder.java @@ -41,6 +41,7 @@ import java.util.ArrayList; * Date: 10.08.2007 */ public class RncFoldingBuilder implements FoldingBuilder { + @Override @NotNull public FoldingDescriptor[] buildFoldRegions(@NotNull ASTNode node, @NotNull Document document) { @@ -52,6 +53,7 @@ public class RncFoldingBuilder implements FoldingBuilder { : FoldingDescriptor.EMPTY; } + @Override public String getPlaceholderText(@NotNull ASTNode node) { final IElementType type = node.getElementType(); if (type == RncTokenTypes.LBRACE) { @@ -79,6 +81,7 @@ public class RncFoldingBuilder implements FoldingBuilder { return RncTokenTypes.COMMENTS.contains(type) || RncTokenTypes.DOC_TOKENS.contains(type); } + @Override public boolean isCollapsedByDefault(@NotNull ASTNode node) { return isCommentLike(node.getElementType()) && CodeFoldingSettings.getInstance().COLLAPSE_DOC_COMMENTS; } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/formatting/RncBlock.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/formatting/RncBlock.java index 5b466ed87413..025a5c4edbd3 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/formatting/RncBlock.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/formatting/RncBlock.java @@ -40,11 +40,13 @@ class RncBlock implements Block { myNode = element; } + @Override @NotNull public TextRange getTextRange() { return myNode.getTextRange(); } + @Override @NotNull public List getSubBlocks() { final List list = new ArrayList(); @@ -58,12 +60,14 @@ class RncBlock implements Block { return list; } + @Override @Nullable public Wrap getWrap() { // TODO return null; } + @Override @Nullable public Indent getIndent() { if (isTopLevel()) { @@ -82,12 +86,14 @@ class RncBlock implements Block { parent instanceof RncGrammar && parent.getParent() instanceof RncDocument; } + @Override @Nullable public Alignment getAlignment() { // TODO return null; } + @Override @Nullable public Spacing getSpacing(Block child1, @NotNull Block child2) { if (child1 == null) { @@ -113,16 +119,19 @@ class RncBlock implements Block { return Spacing.createSpacing(0, Integer.MAX_VALUE, 1, true, 100); } + @Override @NotNull public ChildAttributes getChildAttributes(int newChildIndex) { return new ChildAttributes(null, null); } + @Override public boolean isIncomplete() { // TODO return false; } + @Override public boolean isLeaf() { // TODO return false; diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/formatting/RncFormattingModelBuilder.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/formatting/RncFormattingModelBuilder.java index 1861127d4b57..e7e4fa898b3f 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/formatting/RncFormattingModelBuilder.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/formatting/RncFormattingModelBuilder.java @@ -27,11 +27,13 @@ import com.intellij.psi.codeStyle.CodeStyleSettings; import org.jetbrains.annotations.NotNull; public class RncFormattingModelBuilder implements FormattingModelBuilder { + @Override @NotNull public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) { return FormattingModelProvider.createFormattingModelForPsiFile(element.getContainingFile(), new RncBlock(element.getNode()), settings); } + @Override public TextRange getRangeAffectingIndent(PsiFile file, int offset, ASTNode elementAtOffset) { // TODO return null; diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/lexer/CompactSyntaxLexerAdapter.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/lexer/CompactSyntaxLexerAdapter.java index b6911ccd79f4..f967b4333f2b 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/lexer/CompactSyntaxLexerAdapter.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/lexer/CompactSyntaxLexerAdapter.java @@ -71,6 +71,7 @@ public class CompactSyntaxLexerAdapter extends LexerBase { private int myEndOffset; private TIntIntHashMap myLengthMap; + @Override public void advance() { try { myCurrentToken = nextToken(); @@ -137,10 +138,12 @@ public class CompactSyntaxLexerAdapter extends LexerBase { return myBuffer; } + @Override public int getBufferEnd() { return myEndOffset; } + @Override public int getState() { try { return (Integer)myStateField.get(myLexer); @@ -149,14 +152,17 @@ public class CompactSyntaxLexerAdapter extends LexerBase { } } + @Override public int getTokenEnd() { return myCurrentEnd; } + @Override public int getTokenStart() { return myCurrentToken == null ? 0 : myCurrentOffset; } + @Override @Nullable public IElementType getTokenType() { if (myCurrentToken == null) { @@ -174,6 +180,7 @@ public class CompactSyntaxLexerAdapter extends LexerBase { init(startOffset, endOffset, reader, initialState); } + @Override @SuppressWarnings("IOResourceOpenedButNotSafelyClosed") public void start(@NotNull CharSequence buffer, int startOffset, int endOffset, int initialState) { myBuffer = buffer; @@ -250,9 +257,11 @@ public class CompactSyntaxLexerAdapter extends LexerBase { myCurPos = startOffset; } + @Override public void close() { } + @Override public int read(char[] cbuf, int off, int len) { if ((off < 0) || (off > cbuf.length) || (len < 0) || ((off + len) > cbuf.length) || ((off + len) < 0)) { throw new IndexOutOfBoundsException(); @@ -278,6 +287,7 @@ public class CompactSyntaxLexerAdapter extends LexerBase { return charsToCopy; } + @Override public int read() { if (myCurPos >= myEndOffset) return -1; return myText.charAt(myCurPos++); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/PatternParsing.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/PatternParsing.java index 7fff0c3d0627..68b8dc2e5059 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/PatternParsing.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/PatternParsing.java @@ -56,6 +56,7 @@ public class PatternParsing extends DeclarationParsing { parseTopLevel(); } + @Override protected boolean parsePattern() { PsiBuilder.Marker marker = myBuilder.mark(); if (!parseQuantifiedPattern()) { diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/RncParser.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/RncParser.java index 799b9ebbdc26..331e186baff5 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/RncParser.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/parser/RncParser.java @@ -30,6 +30,7 @@ import org.jetbrains.annotations.NotNull; */ public class RncParser implements PsiParser { + @Override @NotNull public ASTNode parse(IElementType root, PsiBuilder builder) { final PsiBuilder.Marker fileMarker = builder.mark(); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncDefine.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncDefine.java index b1c3120aaf0d..929307dbbda3 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncDefine.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncDefine.java @@ -26,6 +26,7 @@ import org.jetbrains.annotations.Nullable; * Date: 13.08.2007 */ public interface RncDefine extends RncPattern, PsiNamedElement, Define { + @Override @Nullable RncPattern getPattern(); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncGrammar.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncGrammar.java index 55f56507e3d5..fe3ae1763692 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncGrammar.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncGrammar.java @@ -25,6 +25,7 @@ import org.jetbrains.annotations.Nullable; * Date: 13.08.2007 */ public interface RncGrammar extends RncElement, Grammar { + @Override @Nullable RncPattern getStart(); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncInclude.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncInclude.java index f4736a15fb1f..97bfc746109e 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncInclude.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncInclude.java @@ -25,6 +25,7 @@ import org.jetbrains.annotations.NotNull; * Date: 11.08.2007 */ public interface RncInclude extends RncFileReference, Include { + @Override @NotNull RncDefine[] getOverrides(); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncRef.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncRef.java index 6cb9d83c4d6d..5fc1ef8aad63 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncRef.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/RncRef.java @@ -25,9 +25,11 @@ import org.jetbrains.annotations.Nullable; * Date: 11.08.2007 */ public interface RncRef extends RncPattern, Ref { + @Override @Nullable RncDefine getPattern(); + @Override @Nullable String getReferencedName(); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/PatternReference.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/PatternReference.java index b32f7a7ae37c..cffc06c68a8d 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/PatternReference.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/PatternReference.java @@ -58,6 +58,7 @@ class PatternReference extends PsiReferenceBase.Poly implements Function super(ref); } + @Override public TextRange getRangeInElement() { final ASTNode node = findNameNode(); if (node == null) return TextRange.from(0, 0); @@ -71,12 +72,14 @@ class PatternReference extends PsiReferenceBase.Poly implements Function return node.findChildByType(RncTokenTypes.IDENTIFIERS); } + @Override @Nullable public PsiElement resolve() { final ResolveResult[] results = multiResolve(false); return results.length == 1 ? results[0].getElement() : null; } + @Override @NotNull public ResolveResult[] multiResolve(boolean incompleteCode) { final RncGrammar scope = getScope(); @@ -90,13 +93,16 @@ class PatternReference extends PsiReferenceBase.Poly implements Function return ContainerUtil.map2Array(set, ResolveResult.class, this); } + @Override public ResolveResult fun(Define rncDefine) { final PsiElement element = rncDefine.getPsiElement(); return element != null ? new PsiElementResolveResult(element) : new ResolveResult() { + @Override @Nullable public PsiElement getElement() { return null; } + @Override public boolean isValidResult() { return false; } @@ -108,12 +114,14 @@ class PatternReference extends PsiReferenceBase.Poly implements Function return PsiTreeUtil.getParentOfType(myElement, RncGrammar.class, true, PsiFile.class); } + @Override @NotNull public String getCanonicalText() { final ASTNode node = findNameNode(); return node != null ? EscapeUtil.unescapeText(node) : ""; } + @Override public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException { final ASTNode newNode = RenameUtil.createIdentifierNode(getElement().getManager(), newElementName); @@ -122,10 +130,12 @@ class PatternReference extends PsiReferenceBase.Poly implements Function return getElement(); } + @Override public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException { throw new UnsupportedOperationException(); } + @Override @NotNull public Object[] getVariants() { final RncGrammar scope = getScope(); @@ -137,16 +147,19 @@ class PatternReference extends PsiReferenceBase.Poly implements Function if (map == null || map.size() == 0) return ArrayUtil.EMPTY_OBJECT_ARRAY; return ContainerUtil.mapNotNull(map.values(), new Function, Object>() { + @Override public Object fun(Set defines) { return defines.size() == 0 ? null : defines.iterator().next().getPsiElement(); } }).toArray(); } + @Override public boolean isSoft() { return false; } + @Override @NotNull public String getUnresolvedMessagePattern() { return "Unresolved pattern reference ''{0}''"; @@ -174,6 +187,7 @@ class PatternReference extends PsiReferenceBase.Poly implements Function return "Create Pattern '" + myReference.getCanonicalText() + "'"; } + @Override @NotNull public String getFamilyName() { return "Create Pattern"; diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncAnnotationImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncAnnotationImpl.java index 986763c21af4..c1bfabc51fd2 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncAnnotationImpl.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncAnnotationImpl.java @@ -34,14 +34,17 @@ public class RncAnnotationImpl extends RncElementImpl implements RncAnnotation { super(node); } + @Override public void accept(@NotNull RncElementVisitor visitor) { visitor.visitAnnotation(this); } + @Override public IElementType getTokenType() { return getNode().getElementType(); } + @Override @Nullable public RncName getNameElement() { return findChildByClass(RncName.class); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDeclImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDeclImpl.java index e7f386833bea..89694bd31d85 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDeclImpl.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDeclImpl.java @@ -37,11 +37,13 @@ public class RncDeclImpl extends RncElementImpl implements RncDecl { super(node); } + @Override public String getPrefix() { final ASTNode ns = findIdentifierNode(); return ns != null ? EscapeUtil.unescapeText(ns) : null; } + @Override public String getDeclaredNamespace() { final ASTNode ns = getNode().findChildByType(RncTokenTypes.LITERAL); return ns != null ? EscapeUtil.parseLiteralValue(ns) : null; @@ -74,6 +76,7 @@ public class RncDeclImpl extends RncElementImpl implements RncDecl { return s != null ? s : ""; } + @Override public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException { final ASTNode node = findIdentifierNode(); if (node == null) return this; @@ -81,6 +84,7 @@ public class RncDeclImpl extends RncElementImpl implements RncDecl { return this; } + @Override public void accept(@NotNull RncElementVisitor visitor) { visitor.visitElement(this); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDefineImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDefineImpl.java index eca900114f6c..b365b32bcf0b 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDefineImpl.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDefineImpl.java @@ -51,10 +51,12 @@ public class RncDefineImpl extends RncElementImpl implements RncDefine, PsiMetaO super(node); } + @Override public void accept(@NotNull RncElementVisitor visitor) { visitor.visitDefine(this); } + @Override public void accept(Visitor visitor) { visitor.visitDefine(this); } @@ -65,6 +67,7 @@ public class RncDefineImpl extends RncElementImpl implements RncDefine, PsiMetaO return EscapeUtil.unescapeText(node); } + @Override public PsiElement getNameElement() { return getNameNode().getPsi(); } @@ -76,25 +79,30 @@ public class RncDefineImpl extends RncElementImpl implements RncDefine, PsiMetaO return node; } + @Override public PsiElement setName(@NonNls @NotNull String name) throws IncorrectOperationException { final ASTNode node = getNameNode(); node.getTreeParent().replaceChild(node, RenameUtil.createIdentifierNode(getManager(), name)); return this; } + @Override @Nullable public RncPattern getPattern() { return findChildByClass(RncPattern.class); } + @Override public PsiReference getReference() { if (getParent() instanceof RncInclude) { final TextRange range = TextRange.from(0, getNameNode().getTextLength()); return new PsiReferenceBase(this, range, true) { + @Override public PsiElement resolve() { return RncDefineImpl.this; } + @Override @NotNull public Object[] getVariants() { final RncInclude parent = (RncInclude)getParent(); @@ -118,6 +126,7 @@ public class RncDefineImpl extends RncElementImpl implements RncDefine, PsiMetaO return super.getReference(); } + @Override @Nullable public Icon getIcon(int flags) { return AllIcons.Nodes.Property; @@ -127,6 +136,7 @@ public class RncDefineImpl extends RncElementImpl implements RncDefine, PsiMetaO return true; } + @Override @Nullable public PsiMetaData getMetaData() { return new MyMetaData(); @@ -137,32 +147,39 @@ public class RncDefineImpl extends RncElementImpl implements RncDefine, PsiMetaO return false; }*/ + @Override @Nullable public Icon getIcon() { return RncDefineImpl.this.getIcon(0); } + @Override public String getTypeName() { return "Pattern Definition"; } + @Override public PsiElement getDeclaration() { return RncDefineImpl.this; } + @Override @NonNls public String getName(PsiElement context) { return RncDefineImpl.this.getName(); } + @Override @NonNls public String getName() { return RncDefineImpl.this.getName(); } + @Override public void init(PsiElement element) { } + @Override public Object[] getDependences() { return ArrayUtil.EMPTY_OBJECT_ARRAY; } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDivImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDivImpl.java index 2568918dcf1b..15ce79f1551e 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDivImpl.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDivImpl.java @@ -31,6 +31,7 @@ public class RncDivImpl extends RncElementImpl implements RncDiv { super(node); } + @Override public void accept(@NotNull RncElementVisitor visitor) { visitor.visitDiv(this); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDocument.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDocument.java index ea549635847a..1c91dabd4d70 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDocument.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncDocument.java @@ -35,27 +35,33 @@ public class RncDocument extends RncElementImpl implements XmlDocument { super(node); } + @Override public XmlNSDescriptor getDefaultNSDescriptor(String namespace, boolean strict) { return null; } + @Override public XmlProlog getProlog() { return null; } + @Override @Nullable public XmlTag getRootTag() { return null; } + @Override public XmlNSDescriptor getRootTagNSDescriptor() { return null; } + @Override public boolean processElements(PsiElementProcessor processor, PsiElement place) { return false; } + @Override @Nullable public PsiMetaData getMetaData() { return MetaRegistry.getMeta(this); @@ -75,6 +81,7 @@ public class RncDocument extends RncElementImpl implements XmlDocument { return super.findChildrenByClass(aClass); } + @Override public void accept(@NotNull RncElementVisitor visitor) { visitor.visitElement(this); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncElementImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncElementImpl.java index 7c1819c9e5e0..9c7e14d7516e 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncElementImpl.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncElementImpl.java @@ -91,6 +91,7 @@ public abstract class RncElementImpl extends ASTWrapperPsiElement implements Rnc } } + @Override public final void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof RncElementVisitor) { accept((RncElementVisitor)visitor); @@ -116,10 +117,12 @@ public abstract class RncElementImpl extends ASTWrapperPsiElement implements Rnc public abstract void accept(@NotNull RncElementVisitor visitor); + @Override public void accept(Visitor visitor) { visitor.visitElement(this); } + @Override public void acceptChildren(Visitor visitor) { final PsiElement[] elements = getChildren(); //noinspection ForLoopReplaceableByForEach @@ -131,6 +134,7 @@ public abstract class RncElementImpl extends ASTWrapperPsiElement implements Rnc } } + @Override public RncElement getPsiElement() { return this; } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncExternalRefImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncExternalRefImpl.java index 51ec6ada276d..b43b0fa6f59a 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncExternalRefImpl.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncExternalRefImpl.java @@ -31,6 +31,7 @@ public class RncExternalRefImpl extends RncFileReferenceImpl implements RncExter super(node); } + @Override public void accept(@NotNull RncElementVisitor visitor) { visitor.visitExternalRef(this); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncFileImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncFileImpl.java index 497c74f736db..0bc22c5f407b 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncFileImpl.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncFileImpl.java @@ -51,11 +51,13 @@ public class RncFileImpl extends PsiFileBase implements RncFile, XmlFile { super(viewProvider, RngCompactLanguage.INSTANCE); } + @Override @NotNull public FileType getFileType() { return RncFileType.getInstance(); } + @Override @NotNull public XmlDocument getDocument() { // this needs to be a seperate child element because of com.intellij.util.xml.impl.ExternalChangeProcessor.visitDocumentChanged() @@ -108,10 +110,12 @@ public class RncFileImpl extends PsiFileBase implements RncFile, XmlFile { return getDocument().addBefore(element, anchor); } + @Override public boolean processElements(PsiElementProcessor processor, PsiElement place) { return false; } + @Override public GlobalSearchScope getFileResolveScope() { return ProjectScope.getAllScope(getProject()); } @@ -126,10 +130,12 @@ public class RncFileImpl extends PsiFileBase implements RncFile, XmlFile { return getClass().getSimpleName() + ":" + getName(); } + @Override public RncDecl[] getDeclarations() { return ((RncDocument)getDocument()).findChildrenByClass(RncDecl.class); } + @Override public RncGrammar getGrammar() { final XmlDocument document = getDocument(); return ((RncDocument)document).getGrammar(); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncFileReferenceImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncFileReferenceImpl.java index f5c3419b6452..c2a32421554d 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncFileReferenceImpl.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncFileReferenceImpl.java @@ -60,6 +60,7 @@ abstract class RncFileReferenceImpl extends RncElementImpl implements RncFileRef return FileReferenceUtil.restrict(set, FileReferenceUtil.byType(RncFileType.getInstance())); } + @Override public RncFile getReferencedFile() { final String href = getFileReference(); if (href != null) { @@ -71,6 +72,7 @@ abstract class RncFileReferenceImpl extends RncElementImpl implements RncFileRef return null; } + @Override @Nullable public String getFileReference() { final ASTNode element = getNode().findChildByType(RncTokenTypes.LITERAL); @@ -79,6 +81,7 @@ abstract class RncFileReferenceImpl extends RncElementImpl implements RncFileRef return s.substring(1, s.length() - 1); } + @Override public TextRange getReferenceRange() { final ASTNode literal = getNode().findChildByType(RncTokenTypes.LITERAL); if (literal == null) return TextRange.from(0, 0); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncGrammarImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncGrammarImpl.java index ab0987f53d83..6055bba05fcc 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncGrammarImpl.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncGrammarImpl.java @@ -36,14 +36,17 @@ public class RncGrammarImpl extends RncElementImpl implements RncGrammar { super(node); } + @Override public void accept(@NotNull RncElementVisitor visitor) { visitor.visitGrammar(this); } + @Override public void accept(Visitor visitor) { visitor.visitGrammar(this); } + @Override public RncPattern getStart() { final ASTNode node = getNode().findChildByType(RncElementTypes.START); return node != null ? (RncPattern)node.getPsi() : null; diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncIncludeImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncIncludeImpl.java index 7c967bbc522d..0e7b9de2be75 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncIncludeImpl.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncIncludeImpl.java @@ -47,6 +47,7 @@ public class RncIncludeImpl extends RncFileReferenceImpl implements RncInclude { return super.processDeclarations(processor, substitutor, lastParent, place); } + @Override public void accept(@NotNull RncElementVisitor visitor) { visitor.visitInclude(this); } @@ -56,10 +57,12 @@ public class RncIncludeImpl extends RncFileReferenceImpl implements RncInclude { visitor.visitInclude(this); } + @Override public PsiFile getInclude() { return getReferencedFile(); } + @Override @NotNull public RncDefine[] getOverrides() { // TODO: DIVs? diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncNsDeclImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncNsDeclImpl.java index 4de51d47d6ef..dfcee263fa19 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncNsDeclImpl.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncNsDeclImpl.java @@ -30,6 +30,7 @@ public class RncNsDeclImpl extends RncDeclImpl implements RncNsDecl { super(node); } + @Override public boolean isDefault() { return getNode().findChildByType(RncTokenTypes.KEYWORD_DEFAULT) != null; } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncRefImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncRefImpl.java index c1902406b5ee..743f9dff4192 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncRefImpl.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/impl/RncRefImpl.java @@ -36,6 +36,7 @@ public class RncRefImpl extends RncElementImpl implements RncRef { super(node); } + @Override @Nullable public RncDefine getPattern() { final PsiReference ref = getReference(); @@ -43,6 +44,7 @@ public class RncRefImpl extends RncElementImpl implements RncRef { return ref instanceof PatternReference ? (RncDefine)ref.resolve() : null; } + @Override public String getReferencedName() { final ASTNode node = findNameNode(); assert node != null; @@ -58,6 +60,7 @@ public class RncRefImpl extends RncElementImpl implements RncRef { visitor.visitRef(this); } + @Override public void accept(Visitor visitor) { visitor.visitRef(this); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/util/PsiFunction.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/util/PsiFunction.java index ce3a96afce18..2abee8424c93 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/util/PsiFunction.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/util/PsiFunction.java @@ -29,6 +29,7 @@ import org.jetbrains.annotations.NotNull; public final class PsiFunction implements NotNullFunction { public static final PsiFunction INSTANCE = new PsiFunction(); + @Override @NotNull public PsiElement fun(ASTNode astNode) { return astNode.getPsi(); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/util/RenameUtil.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/util/RenameUtil.java index 5261d48a57ce..38ae3ed4e3d2 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/util/RenameUtil.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/compact/psi/util/RenameUtil.java @@ -39,7 +39,7 @@ import java.util.Set; */ public class RenameUtil { - private static Set ourRncKeywords = new HashSet(); + private static final Set ourRncKeywords = new HashSet(); static { Collections.addAll(ourRncKeywords, "attribute", "default", "datatypes", "div", "element", "empty", "external", diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceConfigImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceConfigImpl.java index d36c4b73862b..09b30b48e5d5 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceConfigImpl.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceConfigImpl.java @@ -67,17 +67,20 @@ class NoNamespaceConfigImpl extends NoNamespaceConfig implements PersistentState return null; } + @Override @Nullable public String getMapping(@NotNull PsiFile file) { final VirtualFilePointer pointer = getMappedPointer(file); return pointer != null ? pointer.getUrl() : null; } + @Override public VirtualFile getMappedFile(@NotNull PsiFile file) { final VirtualFilePointer url = getMappedPointer(file); return url != null ? url.getFile() : null; } + @Override public void setMapping(@NotNull PsiFile file, String location) { final VirtualFile virtualFile = file.getVirtualFile(); assert virtualFile != null; @@ -102,24 +105,30 @@ class NoNamespaceConfigImpl extends NoNamespaceConfig implements PersistentState } } + @Override public void initComponent() { } + @Override public void disposeComponent() { } + @Override @NotNull public String getComponentName() { return "RELAX-NG.NoNamespaceConfig"; } + @Override public void projectOpened() { } + @Override public void projectClosed() { reset(); } + @Override public Mappings getState() { final HashMap map = new HashMap(); for (Map.Entry entry : myMappings.entrySet()) { @@ -128,6 +137,7 @@ class NoNamespaceConfigImpl extends NoNamespaceConfig implements PersistentState return new Mappings(map); } + @Override public void loadState(Mappings state) { reset(); @@ -157,6 +167,7 @@ class NoNamespaceConfigImpl extends NoNamespaceConfig implements PersistentState } public static class HectorProvider implements HectorComponentPanelsProvider { + @Override @Nullable public HectorComponentPanel createConfigurable(@NotNull PsiFile file) { if (file instanceof XmlFile) { diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceConfigPanel.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceConfigPanel.java index 690dac40a8c1..aaa0c9eb9fd4 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceConfigPanel.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceConfigPanel.java @@ -57,6 +57,7 @@ class NoNamespaceConfigPanel extends HectorComponentPanel { myMapping = myConfig.getMapping(file); final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, false, false, false, false) { + @Override public boolean isFileSelectable(VirtualFile file) { final boolean b = super.isFileSelectable(file); if (b) { @@ -81,6 +82,7 @@ class NoNamespaceConfigPanel extends HectorComponentPanel { final ComponentWithBrowseButton.BrowseFolderActionListener actionListener = new ComponentWithBrowseButton.BrowseFolderActionListener("Select Schema", "Select a RELAX-NG file to associate with the document", mySchemaFile, project, descriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT) { + @Override public void actionPerformed(ActionEvent e) { myDialogOpen = true; try { @@ -94,20 +96,24 @@ class NoNamespaceConfigPanel extends HectorComponentPanel { mySchemaFile.addActionListener(actionListener); } + @Override public boolean canClose() { return super.canClose() && !myDialogOpen; } + @Override public JComponent createComponent() { return myRoot; } + @Override public boolean isModified() { final String s = mySchemaFile.getText(); final String m = myMapping != null ? myMapping : ""; return !s.equals(m); } + @Override public void apply() throws ConfigurationException { final String s = getMapping(); if (s != null) { @@ -122,10 +128,12 @@ class NoNamespaceConfigPanel extends HectorComponentPanel { return s.length() > 0 ? VfsUtil.pathToUrl(s.replace(File.separatorChar, '/')) : null; } + @Override public void reset() { mySchemaFile.setText(myMapping != null ? VfsUtil.urlToPath(myMapping).replace('/', File.separatorChar) : ""); } + @Override public void disposeUIResources() { // doesn't help - updating the validation needs a hard modification // DaemonCodeAnalyzer.getInstance(myFile.getProject()).restart(); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceSchemaProvider.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceSchemaProvider.java index db4054aca590..46cad56b8ad0 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceSchemaProvider.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/config/NoNamespaceSchemaProvider.java @@ -34,6 +34,7 @@ import org.jetbrains.annotations.Nullable; * Date: 22.11.2007 */ public class NoNamespaceSchemaProvider extends XmlSchemaProvider { + @Override @Nullable public XmlFile getSchema(@NotNull @NonNls String url, @Nullable Module module, @NotNull PsiFile baseFile) { if ("".equals(url)) { diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedDtdOptions.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedDtdOptions.java index 9e72a15ec849..1ce9d5fbba52 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedDtdOptions.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedDtdOptions.java @@ -76,6 +76,7 @@ public class AdvancedDtdOptions implements AdvancedOptions { public AdvancedDtdOptions() { myInlineAttlistCheckBox.addItemListener(new ItemListener() { + @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { myAttlistDefine.setEnabled(false); @@ -89,6 +90,7 @@ public class AdvancedDtdOptions implements AdvancedOptions { final DefaultActionGroup group = new DefaultActionGroup(); group.add(new AnAction(null, "Remove Entry", AllIcons.General.Remove) { + @Override public void update(AnActionEvent e) { if (myNamespaceMap.getModel().getRowCount() == 0 || myNamespaceMap.getSelectedRow() == -1) { e.getPresentation().setEnabled(false); @@ -97,6 +99,7 @@ public class AdvancedDtdOptions implements AdvancedOptions { } } + @Override public void actionPerformed(AnActionEvent e) { ((NamespaceMapModel)myNamespaceMap.getModel()).removeRow(myNamespaceMap.getSelectedRow()); } @@ -106,10 +109,12 @@ public class AdvancedDtdOptions implements AdvancedOptions { myToolbar.add(toolbar.getComponent()); } + @Override public JComponent getRoot() { return myRoot; } + @Override public Map getOptions() { final HashMap map = new LinkedHashMap(); @@ -147,6 +152,7 @@ public class AdvancedDtdOptions implements AdvancedOptions { } } + @Override public void setOptions(Map inputOptions) { if (inputOptions.containsKey(COLON_REPLACEMENT)) { myColonReplacement.setText((String)inputOptions.get(COLON_REPLACEMENT)); @@ -189,6 +195,7 @@ public class AdvancedDtdOptions implements AdvancedOptions { final HashMap map = new LinkedHashMap(); file.accept(new PsiRecursiveElementVisitor() { + @Override public void visitElement(PsiElement element) { if (element instanceof XmlElementDecl) { final String s = ((XmlElementDecl)element).getName(); @@ -217,26 +224,32 @@ public class AdvancedDtdOptions implements AdvancedOptions { private static class NamespaceMapModel extends AbstractTableModel { private final List myList = new ArrayList(); + @Override public String getColumnName(int column) { return column == 0 ? "Prefix" : "URI"; } + @Override public int getRowCount() { return myList.size(); } + @Override public int getColumnCount() { return 2; } + @Override public boolean isCellEditable(int rowIndex, int columnIndex) { return columnIndex == 1; } + @Override public void setValueAt(Object aValue, int rowIndex, int columnIndex) { myList.get(rowIndex)[columnIndex] = (String)aValue; } + @Override public Object getValueAt(int rowIndex, int columnIndex) { return myList.get(rowIndex)[columnIndex]; } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedOptionsDialog.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedOptionsDialog.java index 9f6da66b1820..4a669af9ab5f 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedOptionsDialog.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedOptionsDialog.java @@ -50,6 +50,7 @@ public class AdvancedOptionsDialog extends DialogWrapper { init(); } + @Override @Nullable protected JComponent createCenterPanel() { JComponent root; diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedXsdOptions.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedXsdOptions.java index d29c7b29098e..ead97c9daa96 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedXsdOptions.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/AdvancedXsdOptions.java @@ -42,10 +42,12 @@ public class AdvancedXsdOptions implements AdvancedOptions { private ComboBox myAnyProcessContents; private ComboBox myAnyAttributeProcessContents; + @Override public JComponent getRoot() { return myRoot; } + @Override public Map getOptions() { final Map strings = new HashMap(); if (myDisableAbstractElements.isSelected()) { @@ -56,6 +58,7 @@ public class AdvancedXsdOptions implements AdvancedOptions { return strings; } + @Override public void setOptions(Map inputOptions) { myDisableAbstractElements.setSelected(inputOptions.get(DISABLE_ABSTRACT_ELEMENTS) == Boolean.TRUE); final Object o = inputOptions.get(ANY_PROCESS_CONTENTS); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaAction.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaAction.java index 7aa3b2b795a0..ff71ae09e94f 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaAction.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaAction.java @@ -19,7 +19,6 @@ package org.intellij.plugins.relaxNG.convert; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.CommonDataKeys; -import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.fileTypes.StdFileTypes; import com.intellij.openapi.project.Project; @@ -43,6 +42,7 @@ import java.io.File; */ public class ConvertSchemaAction extends AnAction { + @Override public void update(AnActionEvent e) { final VirtualFile[] files = e.getData(CommonDataKeys.VIRTUAL_FILE_ARRAY); final Project project = e.getData(CommonDataKeys.PROJECT); @@ -93,6 +93,7 @@ public class ConvertSchemaAction extends AnAction { return null; } + @Override public void actionPerformed(AnActionEvent e) { final VirtualFile file = e.getData(CommonDataKeys.VIRTUAL_FILE); final Project project = e.getData(CommonDataKeys.PROJECT); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaDialog.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaDialog.java index b61f00b7a18c..d7f4b54263e8 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaDialog.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaDialog.java @@ -45,6 +45,7 @@ public class ConvertSchemaDialog extends DialogWrapper implements PropertyChange mySettings.addPropertyChangeListener(ConvertSchemaSettingsImpl.OUTPUT_PATH, this); myAdvancedAction = new AbstractAction("Advanced...") { + @Override public void actionPerformed(ActionEvent e) { mySettings.showAdvancedSettings(); } @@ -69,6 +70,7 @@ public class ConvertSchemaDialog extends DialogWrapper implements PropertyChange return mySettings.getPreferredFocusedComponent(); } + @Override @Nullable protected JComponent createCenterPanel() { return mySettings.getRoot(); @@ -78,6 +80,7 @@ public class ConvertSchemaDialog extends DialogWrapper implements PropertyChange return mySettings; } + @Override public void propertyChange(PropertyChangeEvent evt) { if (ConvertSchemaSettingsImpl.OUTPUT_TYPE.equals(evt.getPropertyName())) { myAdvancedAction.setEnabled(mySettings.hasAdvancedSettings()); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaSettingsImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaSettingsImpl.java index 893c1ad0baf6..56fe4c92f733 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaSettingsImpl.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/ConvertSchemaSettingsImpl.java @@ -144,6 +144,7 @@ public class ConvertSchemaSettingsImpl implements ConvertSchemaSettings { final JTextField tf = myOutputDestination.getTextField(); tf.getDocument().addDocumentListener(new DocumentAdapter() { + @Override protected void textChanged(DocumentEvent e) { myPropertyChangeSupport.firePropertyChange(OUTPUT_PATH, null, getOutputDestination()); } @@ -151,6 +152,7 @@ public class ConvertSchemaSettingsImpl implements ConvertSchemaSettings { tf.setText(firstFile.getParent().getPath().replace('/', File.separatorChar)); final ItemListener listener = new ItemListener() { + @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { final SchemaType type = getOutputType(); @@ -169,6 +171,7 @@ public class ConvertSchemaSettingsImpl implements ConvertSchemaSettings { } } + @Override @NotNull public SchemaType getOutputType() { if (myOutputRng.isSelected()) { @@ -183,10 +186,12 @@ public class ConvertSchemaSettingsImpl implements ConvertSchemaSettings { } } + @Override public String getOutputEncoding() { return (String)myEncoding.getSelectedItem(); } + @Override public int getIndent() { return parseInt(myIndent.getText().trim()); } @@ -199,14 +204,17 @@ public class ConvertSchemaSettingsImpl implements ConvertSchemaSettings { } } + @Override public int getLineLength() { return parseInt(myLineLength.getText()); } + @Override public String getOutputDestination() { return myOutputDestination.getText(); } + @Override public void addAdvancedSettings(List inputParams, List outputParams) { setParams(myInputOptions, inputParams); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/IdeaDriver.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/IdeaDriver.java index 46e5f9753d30..a0b8cad3d94f 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/IdeaDriver.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/convert/IdeaDriver.java @@ -133,8 +133,9 @@ public class IdeaDriver { length > 0 ? length : DEFAULT_LINE_LENGTH, indent > 0 ? indent : DEFAULT_INDENT) { + @Override public Stream open(String sourceUri, String encoding) throws IOException { - final String s = super.reference(null, sourceUri); + final String s = reference(null, sourceUri); final File file = new File(outputFile.getParentFile(), s); if (file.exists()) { final String msg = "The file '" + file.getAbsolutePath() + "' already exists. Overwrite it?"; diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/inspections/RngDomInspection.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/inspections/RngDomInspection.java index e85067d2907b..4426b40fab76 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/inspections/RngDomInspection.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/inspections/RngDomInspection.java @@ -44,18 +44,21 @@ public class RngDomInspection extends BasicDomElementsInspection return true; } + @Override @Nls @NotNull public String getGroupDisplayName() { return BaseInspection.getRngGroupDisplayName(); } + @Override @Nls @NotNull public String getDisplayName() { return "Unresolved References"; } + @Override @NonNls @NotNull public String getShortName() { diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/inspections/UnusedDefineInspection.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/inspections/UnusedDefineInspection.java index b6d4eeade213..addcb96c8dad 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/inspections/UnusedDefineInspection.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/inspections/UnusedDefineInspection.java @@ -57,22 +57,26 @@ import org.jetbrains.annotations.NotNull; * Date: 26.07.2007 */ public class UnusedDefineInspection extends BaseInspection { + @Override public boolean isEnabledByDefault() { return false; } + @Override @Nls @NotNull public String getDisplayName() { return "Unused Define"; } + @Override @NonNls @NotNull public String getShortName() { return "UnusedDefine"; } + @Override @NotNull public RncElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) { return new MyElementVisitor(holder); @@ -92,6 +96,7 @@ public class UnusedDefineInspection extends BaseInspection { myHolder = holder; } + @Override protected void superVisitElement(PsiElement element) { element.accept(myXmlVisitor); } @@ -205,16 +210,19 @@ public class UnusedDefineInspection extends BaseInspection { myTag = tag; } + @Override @NotNull public String getName() { return "Remove Define"; } + @Override @NotNull public String getFamilyName() { return getName(); } + @Override public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { try { if (myTag.isValid()) { diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/CommonAnnotationHolder.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/CommonAnnotationHolder.java index 408bd1e4348f..c797125bc9ae 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/CommonAnnotationHolder.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/CommonAnnotationHolder.java @@ -42,6 +42,7 @@ abstract class CommonAnnotationHolder { myHolder = holder; } + @Override public Annotation createAnnotation(DomElement element, @NotNull HighlightSeverity severity, String message) { final Annotation annotation = myHolder.createAnnotation(element, severity, message); annotation.setTooltip(message); // no tooltip by default?? @@ -56,6 +57,7 @@ abstract class CommonAnnotationHolder { myHolder = holder; } + @Override public Annotation createAnnotation(T element, @NotNull HighlightSeverity severity, String message) { if (severity == HighlightSeverity.ERROR) { return myHolder.createErrorAnnotation(element, message); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/ModelAnnotator.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/ModelAnnotator.java index 51c9fcdd2025..5efdcb4dd4a7 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/ModelAnnotator.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/ModelAnnotator.java @@ -50,12 +50,14 @@ import java.util.Set; */ public final class ModelAnnotator implements Annotator, DomElementsAnnotator { + @Override public void annotate(@NotNull PsiElement psiElement, @NotNull AnnotationHolder holder) { if (psiElement instanceof CommonElement) { ((CommonElement)psiElement).accept(new MyAnnotator(CommonAnnotationHolder.create(holder))); } } + @Override public void annotate(DomElement element, DomElementAnnotationHolder holder) { if (element instanceof RngDomElement) { ((RngDomElement)element).accept(new MyAnnotator(CommonAnnotationHolder.create(holder))); @@ -69,6 +71,7 @@ public final class ModelAnnotator implements Annotator, DomElementsAnnotator { myHolder = holder; } + @Override public void visitDefine(final Define define) { final PsiElement element = define.getPsiElement(); if (element != null) { @@ -78,6 +81,7 @@ public final class ModelAnnotator implements Annotator, DomElementsAnnotator { final OverriddenDefineSearcher searcher = new OverriddenDefineSearcher(define, xmlFile, result); final PsiElementProcessor.FindElement processor = new PsiElementProcessor.FindElement() { + @Override public boolean execute(@NotNull XmlFile file) { final Grammar grammar = GrammarFactory.getGrammar(file); if (grammar == null) return true; @@ -102,6 +106,7 @@ public final class ModelAnnotator implements Annotator, DomElementsAnnotator { a.setGutterIconRenderer(renderer); } + @Override public void visitInclude(Include inc) { final Define[] overrides = inc.getOverrides(); for (Define define : overrides) { diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverriddenDefineRenderer.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverriddenDefineRenderer.java index 38127319f8d3..c83575d6dc4d 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverriddenDefineRenderer.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverriddenDefineRenderer.java @@ -43,14 +43,17 @@ class OverriddenDefineRenderer extends GutterIconRenderer { myDefine = define; } + @Override @NotNull public Icon getIcon() { return AllIcons.Gutter.OverridenMethod; } + @Override @Nullable public AnAction getClickAction() { return new AnAction() { + @Override public void actionPerformed(AnActionEvent e) { final PsiElement element = myDefine.getPsiElement(); if (element == null || !element.isValid()) return; @@ -75,10 +78,12 @@ class OverriddenDefineRenderer extends GutterIconRenderer { }; } + @Override public boolean isNavigateAction() { return true; } + @Override @Nullable public String getTooltipText() { return "Is overridden"; diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverriddenDefineSearcher.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverriddenDefineSearcher.java index a69cbc0fce6f..9364b1030365 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverriddenDefineSearcher.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverriddenDefineSearcher.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.intellij.plugins.relaxNG.model.annotation; import com.intellij.psi.xml.XmlFile; @@ -25,6 +40,7 @@ class OverriddenDefineSearcher extends CommonElement.Visitor { myDefine = define; } + @Override public void visitInclude(Include inc) { myIncludes.add(inc.getInclude() == myLocalFile ? 1 : 0); try { @@ -34,10 +50,12 @@ class OverriddenDefineSearcher extends CommonElement.Visitor { } } + @Override public void visitDiv(Div ref) { ref.acceptChildren(this); } + @Override public void visitDefine(Define d) { if (myIncludes.size() > 0 && myIncludes.get(myIncludes.size() - 1) == 1) { if (d.getName().equals(myDefine.getName())) { @@ -47,6 +65,7 @@ class OverriddenDefineSearcher extends CommonElement.Visitor { d.acceptChildren(this); } + @Override public void visitGrammar(Grammar pattern) { pattern.acceptChildren(this); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverridingDefineRenderer.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverridingDefineRenderer.java index 3e8c525e308a..0e9ad1c74325 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverridingDefineRenderer.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/annotation/OverridingDefineRenderer.java @@ -46,26 +46,31 @@ class OverridingDefineRenderer extends GutterIconRenderer { myMessage = message; } + @Override @NotNull public Icon getIcon() { return AllIcons.Gutter.OverridingMethod; } + @Override public boolean isNavigateAction() { return true; } + @Override @Nullable public AnAction getClickAction() { return new MyClickAction(); } + @Override @Nullable public String getTooltipText() { return myMessage; } private class MyClickAction extends AnAction { + @Override public void actionPerformed(AnActionEvent e) { doClickAction(e, mySet, "Go to overridden define"); } @@ -78,6 +83,7 @@ class OverridingDefineRenderer extends GutterIconRenderer { } else { final Define[] array = set.toArray(new Define[set.size()]); NavigationUtil.getPsiElementPopup(ContainerUtil.map(array, new Function() { + @Override public PsiElement fun(Define define) { return define.getPsiElement(); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/AttributeFinder.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/AttributeFinder.java index 88dbf60129b0..32830be50fcc 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/AttributeFinder.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/AttributeFinder.java @@ -46,6 +46,7 @@ class AttributeFinder extends RecursionSaveWalker { myQname = qname; } + @Override public Void onElement(DElementPattern p) { depth++; try { @@ -59,6 +60,7 @@ class AttributeFinder extends RecursionSaveWalker { } } + @Override public Void onAttribute(DAttributePattern p) { assert depth > 0; @@ -70,6 +72,7 @@ class AttributeFinder extends RecursionSaveWalker { return null; } + @Override public Void onValue(DValuePattern p) { if (myLastAttr != null) { myAttributes.get(myLastAttr).first.put(p.getValue(), p.getType()); @@ -77,6 +80,7 @@ class AttributeFinder extends RecursionSaveWalker { return super.onValue(p); } + @Override public Void onOptional(DOptionalPattern p) { optional++; try { @@ -86,6 +90,7 @@ class AttributeFinder extends RecursionSaveWalker { } } + @Override public Void onZeroOrMore(DZeroOrMorePattern p) { optional++; try { @@ -95,6 +100,7 @@ class AttributeFinder extends RecursionSaveWalker { } } + @Override public Void onChoice(DChoicePattern p) { optional++; try { @@ -104,6 +110,7 @@ class AttributeFinder extends RecursionSaveWalker { } } + @Override public Void onData(DDataPattern p) { if (depth == 1 && myLastAttr != null) { myAttributes.get(myLastAttr).first.put(null, p.getType()); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/ChildElementFinder.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/ChildElementFinder.java index c472e3586310..91f29035efef 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/ChildElementFinder.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/ChildElementFinder.java @@ -34,6 +34,7 @@ class ChildElementFinder extends RecursionSaveWalker { myTargetDepth = targetDepth; } + @Override public Void onRef(DRefPattern p) { if (myDepth < myTargetDepth || myTargetDepth == -1) { return super.onRef(p); @@ -41,6 +42,7 @@ class ChildElementFinder extends RecursionSaveWalker { return null; } + @Override public Void onElement(DElementPattern p) { myDepth++; try { diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/CompositeDescriptor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/CompositeDescriptor.java index 153374e5ce12..6f5af11459f0 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/CompositeDescriptor.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/CompositeDescriptor.java @@ -38,6 +38,7 @@ public class CompositeDescriptor extends RngElementDescriptor { myPatterns = patterns.toArray(new DElementPattern[patterns.size()]); } + @Override protected XmlElementDescriptor findElementDescriptor(XmlTag childTag) { final List patterns = new ArrayList(); for (DElementPattern pattern : myPatterns) { @@ -58,6 +59,7 @@ public class CompositeDescriptor extends RngElementDescriptor { return NULL; } + @Override public XmlElementDescriptor[] getElementsDescriptors(XmlTag context) { final List descriptors = new ArrayList(Arrays.asList(super.getElementsDescriptors(context))); for (DElementPattern pattern : myPatterns) { @@ -67,12 +69,14 @@ public class CompositeDescriptor extends RngElementDescriptor { return descriptors.toArray(new XmlElementDescriptor[descriptors.size()]); } + @Override protected XmlAttributeDescriptor getAttributeDescriptor(String namespace, String localName) { final QName qname = new QName(namespace, localName); return computeAttributeDescriptor(AttributeFinder.find(qname, myPatterns)); } + @Override protected XmlAttributeDescriptor[] collectAttributeDescriptors(@Nullable XmlTag context) { final QName qName = null; final DPattern[] patterns; @@ -80,6 +84,7 @@ public class CompositeDescriptor extends RngElementDescriptor { patterns = myPatterns; } else { final List p = ContainerUtil.findAll(myPatterns, new Condition() { + @Override public boolean value(DElementPattern pattern) { return pattern.getName().contains(qName); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/NamedPatternFilter.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/NamedPatternFilter.java index 30ee91424a80..032d8f805ce3 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/NamedPatternFilter.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/NamedPatternFilter.java @@ -22,6 +22,7 @@ import org.kohsuke.rngom.digested.DXmlTokenPattern; final class NamedPatternFilter implements Condition { public static final NamedPatternFilter INSTANCE = new NamedPatternFilter(); + @Override public boolean value(DXmlTokenPattern pattern) { return pattern.getName().listNames().size() > 0; } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RecursionSaveWalker.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RecursionSaveWalker.java index 2f6b7cc66d2f..b497e0a92be3 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RecursionSaveWalker.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RecursionSaveWalker.java @@ -19,7 +19,6 @@ package org.intellij.plugins.relaxNG.model.descriptors; import com.intellij.util.SpinAllocator; import com.intellij.util.containers.ContainerUtil; import gnu.trove.THashSet; -import gnu.trove.TObjectHashingStrategy; import org.kohsuke.rngom.digested.*; /* @@ -45,6 +44,7 @@ public class RecursionSaveWalker extends DPatternWalker { return null; } + @Override public Void onRef(DRefPattern p) { if (myVisited.add(p)) { try { @@ -56,6 +56,7 @@ public class RecursionSaveWalker extends DPatternWalker { return null; } + @Override protected Void onUnary(DUnaryPattern p) { if (myVisited.add(p)) { try { @@ -81,12 +82,14 @@ public class RecursionSaveWalker extends DPatternWalker { private static final SpinAllocator> ourAllocator = new SpinAllocator>( new SpinAllocator.ICreator>() { + @Override @SuppressWarnings({ "unchecked" }) public THashSet createInstance() { return ContainerUtil.newIdentityTroveSet(256); } }, new SpinAllocator.IDisposer>() { + @Override public void disposeInstance(THashSet instance) { instance.clear(); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngElementDescriptor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngElementDescriptor.java index 43cc0bf421d7..5472ce3a3e20 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngElementDescriptor.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngElementDescriptor.java @@ -62,15 +62,18 @@ public class RngElementDescriptor implements XmlElementDescriptor { myElementPattern = pattern; } + @Override public String getQualifiedName() { final QName qName = getQName(); return qName != null ? format(qName, "") : "#unknown"; } + @Override public String getDefaultName() { return getName(); } + @Override public XmlElementDescriptor[] getElementsDescriptors(XmlTag context) { if (context == null) { return EMPTY_ARRAY; @@ -101,8 +104,10 @@ public class RngElementDescriptor implements XmlElementDescriptor { return getElementDescriptor(childTag, null); } + @Override public final XmlElementDescriptor getElementDescriptor(final XmlTag childTag, XmlTag contextTag) { final XmlElementDescriptor value = getCachedValue(childTag, this, DESCR_KEY, new ParameterizedCachedValueProvider() { + @Override public CachedValueProvider.Result compute(RngElementDescriptor p) { final XmlElementDescriptor descriptor = p.findElementDescriptor(childTag); return CachedValueProvider.Result.create(descriptor, p.getDependences(), childTag); @@ -111,9 +116,11 @@ public class RngElementDescriptor implements XmlElementDescriptor { return value == NULL ? null : value; } + @Override public final XmlAttributeDescriptor[] getAttributesDescriptors(@Nullable final XmlTag context) { if (context != null) { return getCachedValue(context, this, ATTRS_KEY, new ParameterizedCachedValueProvider() { + @Override public CachedValueProvider.Result compute(RngElementDescriptor p) { final XmlAttributeDescriptor[] value = p.collectAttributeDescriptors(context); return CachedValueProvider.Result.create(value, p.getDependences(), context); @@ -155,10 +162,12 @@ public class RngElementDescriptor implements XmlElementDescriptor { return result.toArray(new RngXmlAttributeDescriptor[result.size()]); } + @Override public final XmlAttributeDescriptor getAttributeDescriptor(String attributeName, @Nullable XmlTag context) { return getAttributeDescriptor("", attributeName); } + @Override public final XmlAttributeDescriptor getAttributeDescriptor(XmlAttribute attribute) { return getAttributeDescriptor(attribute.getNamespace(), attribute.getLocalName()); } @@ -189,6 +198,7 @@ public class RngElementDescriptor implements XmlElementDescriptor { } } + @Override public XmlNSDescriptor getNSDescriptor() { return myNsDescriptor; } @@ -199,6 +209,7 @@ public class RngElementDescriptor implements XmlElementDescriptor { } // is this actually used anywhere? + @Override public int getContentType() { final DPattern child = myElementPattern.getChild(); if (child instanceof DEmptyPattern) { @@ -217,6 +228,7 @@ public class RngElementDescriptor implements XmlElementDescriptor { return null; } + @Override public PsiElement getDeclaration() { final SmartPsiElementPointer declaration = myDeclaration; if (declaration != null) { @@ -287,6 +299,7 @@ public class RngElementDescriptor implements XmlElementDescriptor { return PsiTreeUtil.getParentOfType(at, XmlTag.class); } + @Override @NonNls public String getName(PsiElement context) { final QName qName = getQName(); @@ -298,6 +311,7 @@ public class RngElementDescriptor implements XmlElementDescriptor { return format(qName, prefix != null ? prefix : qName.getPrefix()); } + @Override @NonNls public String getName() { final QName qName = getQName(); @@ -321,6 +335,7 @@ public class RngElementDescriptor implements XmlElementDescriptor { return iterator.next(); } + @Override public void init(PsiElement element) { } @@ -340,6 +355,7 @@ public class RngElementDescriptor implements XmlElementDescriptor { return myElementPattern.hashCode(); } + @Override public Object[] getDependences() { if (myDeclaration != null) { return ArrayUtil.append(myNsDescriptor.getDependences(), myDeclaration.getElement()); @@ -351,30 +367,37 @@ public class RngElementDescriptor implements XmlElementDescriptor { private static class MyNameClassVisitor implements NameClassVisitor { public static final MyNameClassVisitor INSTANCE = new MyNameClassVisitor(); + @Override public Integer visitAnyName() { return CONTENT_TYPE_ANY; } + @Override public Integer visitAnyNameExcept(NameClass nc) { return CONTENT_TYPE_ANY; } + @Override public Integer visitChoice(NameClass nc1, NameClass nc2) { return CONTENT_TYPE_CHILDREN; } + @Override public Integer visitName(QName name) { return CONTENT_TYPE_CHILDREN; } + @Override public Integer visitNsName(String ns) { return CONTENT_TYPE_CHILDREN; } + @Override public Integer visitNsNameExcept(String ns, NameClass nc) { return CONTENT_TYPE_CHILDREN; } + @Override public Integer visitNull() { return CONTENT_TYPE_EMPTY; } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngNsDescriptor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngNsDescriptor.java index 2bed77f5299b..93744a94a380 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngNsDescriptor.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngNsDescriptor.java @@ -70,6 +70,7 @@ public class RngNsDescriptor implements XmlNSDescriptorEx, Validator { private DPattern myPattern; private PsiManager myManager; + @Override @Nullable public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) { if (myPattern == null) { @@ -107,6 +108,7 @@ public class RngNsDescriptor implements XmlNSDescriptorEx, Validator { private XmlElementDescriptor findRootDescriptor(final XmlTag tag) { return CachedValuesManager.getManager(tag.getProject()) .getParameterizedCachedValue(tag, ROOT_KEY, new ParameterizedCachedValueProvider() { + @Override public CachedValueProvider.Result compute(RngNsDescriptor o) { final XmlElementDescriptor descr = o.findRootDescriptorInner(tag); if (descr != null) { @@ -151,6 +153,7 @@ public class RngNsDescriptor implements XmlNSDescriptorEx, Validator { } } final List patterns = ContainerUtil.findAll(list, new Condition() { + @Override public boolean value(DElementPattern pattern) { final NameClass nameClass = pattern.getName(); return nameClass.contains(qName); @@ -168,6 +171,7 @@ public class RngNsDescriptor implements XmlNSDescriptorEx, Validator { } } + @Override @NotNull public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable XmlDocument document) { if (myPattern == null) { @@ -210,15 +214,18 @@ public class RngNsDescriptor implements XmlNSDescriptorEx, Validator { return descriptor; } + @Override @NotNull public XmlFile getDescriptorFile() { return myFile; } + @Override public boolean isHierarhyEnabled() { return false; } + @Override public synchronized PsiElement getDeclaration() { if (!myElement.isValid() || !myFile.isValid()) { if (myUrl != null) { @@ -234,16 +241,19 @@ public class RngNsDescriptor implements XmlNSDescriptorEx, Validator { return myFile.isValid() ? myFile.getDocument() : null; } + @Override @NonNls public String getName(PsiElement context) { return getName(); } + @Override @NonNls public String getName() { return getDescriptorFile().getName(); } + @Override public Object[] getDependences() { if (myPattern != null) { if (DumbService.isDumb(myElement.getProject())) { @@ -261,6 +271,7 @@ public class RngNsDescriptor implements XmlNSDescriptorEx, Validator { return new Object[]{ ModificationTracker.EVER_CHANGED }; } + @Override public synchronized void init(PsiElement element) { myElement = element; myFile = element instanceof XmlFile ? (XmlFile)element : (XmlFile)element.getContainingFile(); @@ -274,6 +285,7 @@ public class RngNsDescriptor implements XmlNSDescriptorEx, Validator { myPattern = RngParser.getCachedPattern(getDescriptorFile(), RngParser.DEFAULT_HANDLER); } + @Override public void validate(@NotNull PsiElement context, @NotNull final ValidationHost host) { final XmlDocument doc = PsiTreeUtil.getContextOfType(context, XmlDocument.class, false); if (doc == null) { @@ -290,12 +302,14 @@ public class RngNsDescriptor implements XmlNSDescriptorEx, Validator { } //@Override + @Override public XmlElementDescriptor getElementDescriptor(String localName, String namespace) { final QName qName = new QName(namespace, localName); CachedValue cachedValue = myDescriptorsMap.get(qName); if (cachedValue == null) { cachedValue = CachedValuesManager.getManager(myElement.getProject()).createCachedValue(new CachedValueProvider() { + @Override public Result compute() { final XmlElementDescriptor descriptor = findRootDescriptorInner(qName); return descriptor != null diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngXmlAttributeDescriptor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngXmlAttributeDescriptor.java index b05794e92320..85dd71acf168 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngXmlAttributeDescriptor.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/descriptors/RngXmlAttributeDescriptor.java @@ -44,10 +44,12 @@ public class RngXmlAttributeDescriptor extends BasicXmlAttributeDescriptor { private static final QName UNKNOWN = new QName("", "#unknown"); private static final TObjectHashingStrategy HASHING_STRATEGY = new TObjectHashingStrategy() { + @Override public int computeHashCode(Locator o) { final String s = o.getSystemId(); return o.getLineNumber() * 31 + o.getColumnNumber() * 23 + (s != null ? s.hashCode() * 11 : 0); } + @Override public boolean equals(Locator o, Locator o1) { if ((o.getLineNumber() == o1.getLineNumber() && o.getColumnNumber() == o1.getColumnNumber())) { if (Comparing.equal(o.getSystemId(), o1.getSystemId())) { @@ -93,31 +95,38 @@ public class RngXmlAttributeDescriptor extends BasicXmlAttributeDescriptor { return new RngXmlAttributeDescriptor(myElementDescriptor, name, values, myOptional || d.myOptional, locations.toArray(new Locator[locations.size()])); } + @Override public boolean isRequired() { return !myOptional; } + @Override public boolean isFixed() { return isEnumerated() && myValues.size() == 1; } + @Override public boolean hasIdType() { return myValues.values().contains("ID"); } + @Override public boolean hasIdRefType() { return myValues.values().contains("IDREF"); } + @Override @Nullable public String getDefaultValue() { return isEnumerated() ? myValues.keySet().iterator().next() : null; } + @Override public boolean isEnumerated() { return myValues.size() > 0 && myValues.get(null) == null; } + @Override public String[] getEnumeratedValues() { if (myValues.size() > 0) { final Map copy; @@ -133,6 +142,7 @@ public class RngXmlAttributeDescriptor extends BasicXmlAttributeDescriptor { } } + @Override public PsiElement getDeclaration() { final Iterator it = myDeclarations.iterator(); if (!it.hasNext()) return null; @@ -142,6 +152,7 @@ public class RngXmlAttributeDescriptor extends BasicXmlAttributeDescriptor { public Collection getDeclarations() { return ContainerUtil.map2List(myDeclarations, new Function() { + @Override public PsiElement fun(Locator locator) { return myElementDescriptor.getDeclaration(locator); } @@ -171,15 +182,18 @@ public class RngXmlAttributeDescriptor extends BasicXmlAttributeDescriptor { return myName.getLocalPart(); } + @Override @NonNls public String getName() { return myName.getLocalPart(); } + @Override public void init(PsiElement element) { } + @Override public Object[] getDependences() { return myElementDescriptor.getDependences(); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/DefinitionResolver.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/DefinitionResolver.java index afbbcc0e9df8..ee11a5f7cc4c 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/DefinitionResolver.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/DefinitionResolver.java @@ -103,20 +103,25 @@ public class DefinitionResolver extends CommonElement.Visitor implements ContainerUtil.getOrCreate(myDefines.get(), def.getName(), this).add(def); } + @Override public void visitPattern(Pattern pattern) { } + @Override public void visitGrammar(Grammar pattern) { } + @Override public void visitRef(Ref ref) { } + @Override public Set create() { return new THashSet(); } + @Override public Result>> compute() { try { myScope.acceptChildren(this); @@ -193,6 +198,7 @@ public class DefinitionResolver extends CommonElement.Visitor implements myValue = value; } + @Override public boolean execute(@NotNull XmlFile element) { final Grammar g = GrammarFactory.getGrammar(element); if (g != null) { diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/RelaxIncludeIndex.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/RelaxIncludeIndex.java index ab9beda8cc01..6cbc2e164da7 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/RelaxIncludeIndex.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/model/resolve/RelaxIncludeIndex.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.intellij.plugins.relaxNG.model.resolve; import com.intellij.ide.highlighter.XmlFileType; @@ -48,6 +63,7 @@ public class RelaxIncludeIndex { Project project = file.getProject(); final PsiManager psiManager = PsiManager.getInstance(project); final PsiFile[] psiFiles = ContainerUtil.map2Array(files, PsiFile.class, new NullableFunction() { + @Override public PsiFile fun(VirtualFile file) { return psiManager.findFile(file); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AddValueCondition.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AddValueCondition.java index 739b0e50280a..ed8d8cd28f97 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AddValueCondition.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AddValueCondition.java @@ -35,6 +35,7 @@ class AddValueCondition extends PatternCondition { return new AddValueCondition(key); } + @Override public boolean accepts(@NotNull T value, ProcessingContext context) { context.get(myKey).add(value); return true; diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AttributeValueCondition.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AttributeValueCondition.java index b1ce0d36e0ad..059159d0785a 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AttributeValueCondition.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AttributeValueCondition.java @@ -29,6 +29,7 @@ class AttributeValueCondition extends PatternCondition { myRef = ref; } + @Override public boolean accepts(@NotNull XmlAttributeValue value, ProcessingContext context) { return myRef.equals(value.getValue()); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AttributeValueFunction.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AttributeValueFunction.java index fd5468e68139..7d06d00ca285 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AttributeValueFunction.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/AttributeValueFunction.java @@ -23,6 +23,7 @@ import com.intellij.util.containers.ContainerUtil; import java.util.Set; class AttributeValueFunction implements Function { + @Override public String fun(XmlAttributeValue value) { return value.getValue(); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/IdRefProvider.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/IdRefProvider.java index d3857c7f728b..ade3ec5ecdb0 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/IdRefProvider.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/IdRefProvider.java @@ -44,6 +44,7 @@ public class IdRefProvider extends PsiReferenceProvider { public static final HasIdRefTypeCondition HAS_ID_REF_TYPE = new HasIdRefTypeCondition(); public static final HasIdTypeCondition HAS_ID_TYPE = new HasIdTypeCondition(); + @Override @NotNull public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) { final XmlAttributeValue value = (XmlAttributeValue)element; @@ -73,15 +74,18 @@ public class IdRefProvider extends PsiReferenceProvider { myCondition = new AttributeValueCondition(element.getValue()); } + @Override public PsiElement resolve() { final ProcessingContext context = new ProcessingContext(); final ResolvingVisitor visitor = new ResolvingVisitor(PATTERN.with(myCondition).save(TARGET), context) { + @Override public void visitXmlTag(XmlTag tag) { super.visitXmlTag(tag); if (shouldContinue()) { visitSubTags(tag); } } + @Override protected boolean shouldContinue() { return context.get(TARGET) == null; } @@ -99,12 +103,14 @@ public class IdRefProvider extends PsiReferenceProvider { } } + @Override @NotNull public Object[] getVariants() { final ProcessingContext context = new ProcessingContext(); context.put(VARIANTS, new HashSet()); final ResolvingVisitor visitor = new ResolvingVisitor(PATTERN.with(AddValueCondition.create(VARIANTS)), context) { + @Override public void visitXmlTag(XmlTag tag) { super.visitXmlTag(tag); visitSubTags(tag); @@ -132,6 +138,7 @@ public class IdRefProvider extends PsiReferenceProvider { super("IdType"); } + @Override public boolean accepts(@NotNull XmlAttributeValue xmlAttributeValue, ProcessingContext context) { return hasIdType(xmlAttributeValue); } @@ -142,6 +149,7 @@ public class IdRefProvider extends PsiReferenceProvider { super("IdRef"); } + @Override public boolean accepts(@NotNull XmlAttributeValue xmlAttributeValue, ProcessingContext context) { return hasIdRefType(xmlAttributeValue); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/ResolvingVisitor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/ResolvingVisitor.java index 116ea246a9d5..0d9676b4627f 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/references/ResolvingVisitor.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/references/ResolvingVisitor.java @@ -48,6 +48,7 @@ class ResolvingVisitor extends XmlElementVisitor implements PsiElementProcessor myProcessingContext.put(VISITED_KEY, new THashSet()); } + @Override public void visitXmlDocument(@Nullable XmlDocument document) { if (document != null) { final XmlTag rootTag = document.getRootTag(); @@ -61,6 +62,7 @@ class ResolvingVisitor extends XmlElementVisitor implements PsiElementProcessor myIncludePattern = includePattern; } + @Override public void visitXmlAttribute(XmlAttribute attribute) { if (myIncludePattern != null && myIncludePattern.accepts(attribute, myProcessingContext)) { final String value = attribute.getValue(); @@ -79,6 +81,7 @@ class ResolvingVisitor extends XmlElementVisitor implements PsiElementProcessor myPattern.accepts(attribute.getValueElement(), myProcessingContext); } + @Override @SuppressWarnings({ "ForLoopReplaceableByForEach" }) public void visitXmlTag(XmlTag tag) { visitAttributes(tag); @@ -115,6 +118,7 @@ class ResolvingVisitor extends XmlElementVisitor implements PsiElementProcessor rootTag.processElements(this, attribute); } + @Override public boolean execute(@NotNull PsiElement element) { element.accept(this); return shouldContinue(); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/MessageViewHelper.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/MessageViewHelper.java index 6344c1d28efc..a180cec5bca6 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/MessageViewHelper.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/MessageViewHelper.java @@ -102,6 +102,7 @@ public class MessageViewHelper { final VirtualFile file1 = file; ApplicationManager.getApplication().invokeLater( new Runnable() { + @Override public void run() { myErrorsView.addMessage( warning ? MessageCategory.WARNING : MessageCategory.ERROR, @@ -137,6 +138,7 @@ public class MessageViewHelper { private void openMessageViewImpl() { CommandProcessor commandProcessor = CommandProcessor.getInstance(); commandProcessor.executeCommand(myProject, new Runnable() { + @Override public void run() { MessageView messageView = MessageView.SERVICE.getInstance(myProject); Content content = ContentFactory.SERVICE.getInstance().createContent(myErrorsView.getComponent(), myContentName, true); @@ -155,9 +157,11 @@ public class MessageViewHelper { private static class MyProcessController implements NewErrorTreeViewPanel.ProcessController { public static final MyProcessController INSTANCE = new MyProcessController(); + @Override public void stopProcess() { } + @Override public boolean isProcessStopped() { return true; } @@ -175,6 +179,7 @@ public class MessageViewHelper { myErrorsView = errorsView; } + @Override public void contentRemoved(ContentManagerEvent event) { if (event.getContent() == myContent) { if (myErrorsView.canControlProcess()) { @@ -188,6 +193,7 @@ public class MessageViewHelper { } } + @Override public void contentRemoveQuery(ContentManagerEvent event) { if (event.getContent() == myContent) { if (myErrorsView != null && myErrorsView.canControlProcess() && !myErrorsView.isProcessStopped()) { @@ -215,6 +221,7 @@ public class MessageViewHelper { myKey = key; } + @Override public void contentRemoved(ContentManagerEvent event) { final Content eventContent = event.getContent(); if (!eventContent.equals(myContent)) { diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/Psi2SaxAdapter.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/Psi2SaxAdapter.java index c95a455c2675..7db07c02bf2d 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/Psi2SaxAdapter.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/Psi2SaxAdapter.java @@ -45,6 +45,7 @@ class Psi2SaxAdapter extends XmlElementVisitor implements PsiElementProcessor> PATTERN_KEY = Key.create("PATTERN"); public static final DefaultHandler DEFAULT_HANDLER = new DefaultHandler() { + @Override public void error(SAXParseException e) throws SAXException { LOG.info("e.getMessage() = " + e.getMessage() + " [" + e.getSystemId() + "]"); LOG.info(e); @@ -116,6 +117,7 @@ public class RngParser { final CachedValuesManager mgr = CachedValuesManager.getManager(descriptorFile.getProject()); return mgr.getCachedValue(descriptorFile, PATTERN_KEY, new CachedValueProvider() { + @Override public Result compute() { return Result.create(parsePattern(descriptorFile, eh, false), descriptorFile); } @@ -150,6 +152,7 @@ public class RngParser { if (file.getFileType() == RncFileType.getInstance()) { return new CompactParseable(source, eh) { + @Override public ParsedPattern parseInclude(String uri, SchemaBuilder schemaBuilder, IncludedGrammar g, String inheritedNs) throws BuildException, IllegalSchemaException { @@ -158,6 +161,7 @@ public class RngParser { }; } else { return new SAXParseable(source, eh) { + @Override public ParsedPattern parseInclude(String uri, SchemaBuilder schemaBuilder, IncludedGrammar g, String inheritedNs) throws BuildException, IllegalSchemaException { @@ -204,6 +208,7 @@ public class RngParser { CachedValue value = descriptorFile.getUserData(SCHEMA_KEY); if (value == null) { final CachedValueProvider provider = new CachedValueProvider() { + @Override public Result compute() { final InputSource inputSource = makeInputSource(descriptorFile); @@ -246,6 +251,7 @@ public class RngParser { myDescriptorFile = descriptorFile; } + @Override protected com.thaiopensource.relaxng.parse.Parseable createParseable(XMLReaderCreator xmlReaderCreator, InputSource inputSource, ErrorHandler errorHandler) { if (myDescriptorFile.getFileType() == RncFileType.getInstance()) { return new com.thaiopensource.relaxng.parse.compact.CompactParseable(inputSource, errorHandler); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/RngSchemaValidator.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/RngSchemaValidator.java index fe052df70892..758dea80e9db 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/RngSchemaValidator.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/RngSchemaValidator.java @@ -27,6 +27,7 @@ import com.intellij.openapi.fileTypes.StdFileTypes; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Pair; import com.intellij.openapi.vfs.VfsUtil; +import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager; import com.intellij.psi.*; @@ -114,8 +115,8 @@ public class RngSchemaValidator extends ExternalAnnotator> errors = new ArrayList>(); - List> warnings = new ArrayList>(); + final List> errors = new ArrayList>(); + final List> warnings = new ArrayList>(); ValidationMessageConsumer error() { return new ValidationMessageConsumer() { @Override @@ -204,7 +205,7 @@ public class RngSchemaValidator extends ExternalAnnotator", e); - return VirtualFileManager.getInstance().findFileByUrl(VfsUtil.fixURLforIDEA(systemId)); + return VirtualFileManager.getInstance().findFileByUrl(VfsUtilCore.fixURLforIDEA(systemId)); } } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/ValidateAction.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/ValidateAction.java index f45b89cef2c7..6ad5e2fe4c42 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/ValidateAction.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/validation/ValidateAction.java @@ -20,8 +20,6 @@ import com.intellij.ide.errorTreeView.NewErrorTreeViewPanel; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.CommonDataKeys; -import com.intellij.openapi.actionSystem.LangDataKeys; -import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; @@ -73,12 +71,14 @@ public class ValidateAction extends AnAction { setEnabledInModalContext(origAction.isEnabledInModalContext()); } + @Override public void actionPerformed(AnActionEvent e) { if (!actionPerformedImpl(e)) { myOrigAction.actionPerformed(e); } } + @Override public final void update(AnActionEvent e) { super.update(e); myOrigAction.update(e); @@ -125,14 +125,17 @@ public class ValidateAction extends AnAction { final MessageViewHelper helper = new MessageViewHelper(project, CONTENT_NAME, KEY); helper.openMessageView(new Runnable() { + @Override public void run() { doRun(project, instanceFile, schemaFile); } }); final Future future = ApplicationManager.getApplication().executeOnPooledThread(new Runnable() { + @Override public void run() { ApplicationManager.getApplication().runReadAction(new Runnable() { + @Override public void run() { final MessageViewHelper.ErrorHandler eh = helper.new ErrorHandler(); @@ -145,10 +148,12 @@ public class ValidateAction extends AnAction { SwingUtilities.invokeLater( new Runnable() { + @Override public void run() { if (!eh.hadErrorOrWarning()) { SwingUtilities.invokeLater( new Runnable() { + @Override public void run() { helper.close(); WindowManager.getInstance().getStatusBar(project).setInfo("No errors detected"); @@ -165,10 +170,12 @@ public class ValidateAction extends AnAction { }); helper.setProcessController(new NewErrorTreeViewPanel.ProcessController() { + @Override public void stopProcess() { future.cancel(true); } + @Override public boolean isProcessStopped() { return future.isDone(); } @@ -229,22 +236,27 @@ public class ValidateAction extends AnAction { return null; } + @Override public boolean displayTextInToolbar() { return myOrigAction.displayTextInToolbar(); } + @Override public void setDefaultIcon(boolean b) { myOrigAction.setDefaultIcon(b); } + @Override public boolean isDefaultIcon() { return myOrigAction.isDefaultIcon(); } + @Override public void setInjectedContext(boolean worksInInjected) { myOrigAction.setInjectedContext(worksInInjected); } + @Override public boolean isInInjectedContext() { return myOrigAction.isInInjectedContext(); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/Combine.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/Combine.java index f544c0675866..1555037a814a 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/Combine.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/Combine.java @@ -32,6 +32,7 @@ public enum Combine implements com.intellij.util.xml.NamedEnum { this.value = value; } + @Override public String getValue() { return value; } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/RngDomVisitor.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/RngDomVisitor.java index 2ee37fc3c78a..e4a927768be4 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/RngDomVisitor.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/RngDomVisitor.java @@ -25,6 +25,7 @@ import com.intellij.util.xml.DomElementVisitor; * Date: 18.08.2007 */ public class RngDomVisitor implements DomElementVisitor { + @Override public void visitDomElement(DomElement element) { } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/CreatePatternFix.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/CreatePatternFix.java index 661e34100528..e0c6bc6d600a 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/CreatePatternFix.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/CreatePatternFix.java @@ -47,21 +47,25 @@ class CreatePatternFix implements IntentionAction, LocalQuickFix { myReference = reference; } + @Override @NotNull public String getText() { return "Create Pattern '" + myReference.getCanonicalText() + "'"; } + @Override @NotNull public String getFamilyName() { return "Create Pattern"; } + @Override @NotNull public String getName() { return getText(); } + @Override public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { if (!isAvailable()) { return; @@ -73,6 +77,7 @@ class CreatePatternFix implements IntentionAction, LocalQuickFix { } } + @Override public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { return isAvailable(); } @@ -91,6 +96,7 @@ class CreatePatternFix implements IntentionAction, LocalQuickFix { } } + @Override public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { doFix(); } @@ -120,6 +126,7 @@ class CreatePatternFix implements IntentionAction, LocalQuickFix { root.add(defineTag); } + @Override public boolean startInWriteAction() { return true; } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/DefinitionReference.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/DefinitionReference.java index 9ac61ebb9a20..e424583acb8c 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/DefinitionReference.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/DefinitionReference.java @@ -67,6 +67,7 @@ public class DefinitionReference extends PsiReferenceBase.Poly, Object>() { + @Override public Object fun(Set defines) { final Define define = defines.iterator().next(); if (defines.size() == 0) { @@ -130,6 +134,7 @@ public class DefinitionReference extends PsiReferenceBase.Poly value = getNameAttr(); if (value.getStringValue() != null) { @@ -34,18 +35,22 @@ public abstract class RngDefineImpl extends RngDomElementBase implements RngDefi } } + @Override public String getName() { return getNameAttr().getValue(); } + @Override public PsiElement getNameElement() { return getNameAttr().getXmlAttributeValue(); } + @Override public Pattern getPattern() { return getPatternFrom(this); } + @Override public void accept(Visitor visitor) { visitor.visitDefine(this); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDefineMetaData.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDefineMetaData.java index 92d0c3db7ccd..6c3cd28c9361 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDefineMetaData.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDefineMetaData.java @@ -33,6 +33,7 @@ import javax.swing.*; */ public class RngDefineMetaData extends DomMetaData { + @Override @Nullable protected GenericDomValue getNameElement(final RngDefine element) { final GenericAttributeValue id = element.getNameAttr(); @@ -42,14 +43,17 @@ public class RngDefineMetaData extends DomMetaData { return null; } + @Override public void setName(final String name) throws IncorrectOperationException { getElement().setName(name); } + @Override public Icon getIcon() { return AllIcons.Nodes.Property; } + @Override public String getTypeName() { return "Pattern Definition"; } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDomElementBase.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDomElementBase.java index 731c15d5cb0a..ec3f077ab98c 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDomElementBase.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngDomElementBase.java @@ -33,10 +33,12 @@ import java.util.List; * Date: 31.08.2007 */ public abstract class RngDomElementBase implements RngDomElement, Pattern { + @Override public XmlElement getPsiElement() { return getXmlElement(); } + @Override public void accept(Visitor visitor) { if (this instanceof Div) { visitor.visitDiv((Div)this); // TODO fix me @@ -45,8 +47,10 @@ public abstract class RngDomElementBase implements RngDomElement, Pattern implements CustomReferenceConverter { + @Override public XmlFile fromString(@Nullable @NonNls String s, ConvertContext context) { if (s != null) { final GenericAttributeValue element = (GenericAttributeValue)context.getInvocationElement(); @@ -47,10 +48,12 @@ public class RngHrefConverter extends Converter implements CustomRefere return null; } + @Override public String toString(@Nullable XmlFile psiFile, ConvertContext context) { return psiFile == null ? null : psiFile.getName(); } + @Override @NotNull public PsiReference[] createReferences(GenericDomValue genericDomValue, PsiElement element, ConvertContext context) { final String s = genericDomValue.getStringValue(); diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngIncludeImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngIncludeImpl.java index 1dddea3ade51..ea339f414011 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngIncludeImpl.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngIncludeImpl.java @@ -35,10 +35,12 @@ public abstract class RngIncludeImpl extends RngDomElementBase implements RngInc visitor.visitInclude(this); } + @Override public PsiFile getInclude() { return getIncludedFile().getValue(); } + @Override @NotNull public RngDefine[] getOverrides() { // TODO: include stuff inside DIVs - fix when this is actually used diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngRefImpl.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngRefImpl.java index b5afb61a4aaf..2a0f59c62b36 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngRefImpl.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngRefImpl.java @@ -35,6 +35,7 @@ public abstract class RngRefImpl extends RngDomElementBase implements RngRef { visitor.visitRef(this); } + @Override public Define getPattern() { final XmlAttributeValue value = getName().getXmlAttributeValue(); if (value == null) return null; @@ -59,6 +60,7 @@ public abstract class RngRefImpl extends RngDomElementBase implements RngRef { return getParentOfType(RngGrammar.class, true); } + @Override public String getReferencedName() { return getName().getValue(); } diff --git a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngReferenceConverter.java b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngReferenceConverter.java index 02a4af18bd19..cadef4d2c0b3 100644 --- a/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngReferenceConverter.java +++ b/xml/relaxng/src/org/intellij/plugins/relaxNG/xml/dom/impl/RngReferenceConverter.java @@ -41,6 +41,7 @@ import java.util.Set; * Date: 18.08.2007 */ public class RngReferenceConverter implements CustomReferenceConverter { + @Override @NotNull public PsiReference[] createReferences(GenericDomValue genericDomValue, PsiElement element, ConvertContext context) { final GenericAttributeValue e = (GenericAttributeValue)genericDomValue; @@ -53,6 +54,7 @@ public class RngReferenceConverter implements CustomReferenceConverter { return new PsiReference[]{ new PsiReferenceBase(value, true) { + @Override public PsiElement resolve() { // final XmlTag tag = PsiTreeUtil.getParentOfType(value, XmlTag.class); // final XmlTag include = getAncestorTag(tag, "include", ProjectLoader.RNG_NAMESPACE); @@ -64,6 +66,7 @@ public class RngReferenceConverter implements CustomReferenceConverter { return myElement.getParent().getParent(); } + @Override @NotNull public Object[] getVariants() { final RngInclude include = e.getParentOfType(RngInclude.class, true); diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/AbstractIndexTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/AbstractIndexTest.java index eb70d7642ce9..6f22edf738dd 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/AbstractIndexTest.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/AbstractIndexTest.java @@ -27,6 +27,7 @@ import org.jetbrains.annotations.NotNull; */ public abstract class AbstractIndexTest extends HighlightingTestBase { + @Override protected final CodeInsightTestFixture createFixture(@NotNull IdeaTestFixtureFactory factory) { return createContentFixture(factory); } diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/AbstractParsingTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/AbstractParsingTest.java index 6492f49ee3db..77251f7a3605 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/AbstractParsingTest.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/AbstractParsingTest.java @@ -30,6 +30,7 @@ public abstract class AbstractParsingTest extends ParsingTestCase { super("psi/" + s, "rnc", new RncParserDefinition()); } + @Override protected String getTestDataPath() { return PlatformTestUtil.getCommunityPath() + "/xml/relaxng/testData/parsing"; } diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/AttributeCompletionTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/AttributeCompletionTest.java index 77386a31f947..e39ee3cd6157 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/AttributeCompletionTest.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/AttributeCompletionTest.java @@ -25,6 +25,7 @@ import org.intellij.plugins.testUtil.CopyFile; */ @CopyFile("*.rng") public class AttributeCompletionTest extends HighlightingTestBase { + @Override public String getTestDataPath() { return "completion"; } diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/ElementCompletionTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/ElementCompletionTest.java index fd8ea31b3108..7dbbf6257926 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/ElementCompletionTest.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/ElementCompletionTest.java @@ -26,6 +26,7 @@ import org.intellij.plugins.testUtil.CopyFile; */ @CopyFile("element-completion.rng") public class ElementCompletionTest extends HighlightingTestBase { + @Override public String getTestDataPath() { return "completion"; } diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/ExternalRncParsingTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/ExternalRncParsingTest.java index c1928b8a1eee..22d0fa930d01 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/ExternalRncParsingTest.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/ExternalRncParsingTest.java @@ -22,6 +22,7 @@ package org.intellij.plugins.relaxNG; * Date: 07.08.2007 */ public class ExternalRncParsingTest extends HighlightingTestBase { + @Override public String getTestDataPath() { return "parsing"; } diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java index 53558fe2dbe1..2b6f0b36e71e 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/HighlightingTestBase.java @@ -151,7 +151,7 @@ public abstract class HighlightingTestBase extends UsefulTestCase implements Ide doCustomHighlighting(name, true, true); } - protected void doCustomHighlighting(String name, final boolean checkWeakWarnings, final Boolean includeExternalToolPass) throws Throwable { + protected void doCustomHighlighting(String name, final boolean checkWeakWarnings, final Boolean includeExternalToolPass) { myTestFixture.configureByFile(name); doCustomHighlighting(checkWeakWarnings, includeExternalToolPass); @@ -188,11 +188,11 @@ public abstract class HighlightingTestBase extends UsefulTestCase implements Ide return CodeInsightTestFixtureImpl.instantiateAndRun(myTestFixture.getFile(), editor, ignore, false); } - protected void doTestCompletion(String name, String ext) throws Throwable { + protected void doTestCompletion(String name, String ext) { myTestFixture.testCompletion(name + "." + ext, name + "_after." + ext); } - protected void doTestCompletion(String before, String... variants) throws Throwable { + protected void doTestCompletion(String before, String... variants) { myTestFixture.testCompletionVariants(before, variants); } @@ -200,12 +200,12 @@ public abstract class HighlightingTestBase extends UsefulTestCase implements Ide doTestCompletion(before, "xml"); } - protected void doTestRename(String name, String ext, String newName) throws Throwable { + protected void doTestRename(String name, String ext, String newName) { myTestFixture.testRename(name + "." + ext, name + "_after." + ext, newName); } @SuppressWarnings({ "deprecation", "unchecked" }) - protected void doTestQuickFix(String file, String ext) throws Throwable { + protected void doTestQuickFix(String file, String ext) { final PsiReference psiReference = myTestFixture.getReferenceAtCaretPositionWithAssertion(file + "." + ext); assertNull("Reference", psiReference.resolve()); assertTrue(psiReference.getClass().getName() + " is not a QuickFixProvider", psiReference instanceof LocalQuickFixProvider); diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncCompletionTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncCompletionTest.java index fe552d07fdcb..d0e2e99ae480 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncCompletionTest.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncCompletionTest.java @@ -31,6 +31,7 @@ public class RncCompletionTest extends HighlightingTestBase { CamelHumpMatcher.forceStartMatching(getTestRootDisposable()); } + @Override public String getTestDataPath() { return "completion/rnc"; } diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncExternalHighlightingTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncExternalHighlightingTest.java index da70d9f62ae5..8f9146a7a370 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncExternalHighlightingTest.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncExternalHighlightingTest.java @@ -25,10 +25,12 @@ import org.intellij.plugins.testUtil.CopyFile; */ public class RncExternalHighlightingTest extends HighlightingTestBase { + @Override public String getTestDataPath() { return "highlighting/rnc"; } + @Override protected void init() { // new ProjectLoader(myTestFixture.getProject()).initComponent(); // ExternalResourceManager.getInstance().addResource("http://relaxng.org/ns/structure/1.0", new File("highlighting/relaxng.rng").getAbsolutePath()); diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncHighlightingTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncHighlightingTest.java index f28b0864dce1..801dbfd6e4e4 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncHighlightingTest.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncHighlightingTest.java @@ -25,6 +25,7 @@ import org.intellij.plugins.testUtil.CopyFile; */ public class RncHighlightingTest extends HighlightingTestBase { + @Override public String getTestDataPath() { return "highlighting/rnc"; } diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncIndexHighlightingTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncIndexHighlightingTest.java index 97b6219105e3..dd592368dc9c 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncIndexHighlightingTest.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncIndexHighlightingTest.java @@ -26,6 +26,7 @@ import org.intellij.plugins.testUtil.CopyFile; @CopyFile("*.rnc") public class RncIndexHighlightingTest extends AbstractIndexTest { + @Override public String getTestDataPath() { return "highlighting/rnc"; } diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncRenameTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncRenameTest.java index e8c789e2bc63..4ef44f823700 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RncRenameTest.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RncRenameTest.java @@ -36,10 +36,12 @@ import java.io.File; */ public class RncRenameTest extends HighlightingTestBase { + @Override protected CodeInsightTestFixture createFixture(@NotNull IdeaTestFixtureFactory factory) { return createContentFixture(factory); } + @Override public String getTestDataPath() { return "rename/rnc"; } @@ -79,6 +81,7 @@ public class RncRenameTest extends HighlightingTestBase { assertNotNull(file); new WriteCommandAction.Simple(project) { + @Override protected void run() throws Throwable { myTestFixture.configureByFile("rename-in-include.rnc"); final RenameRefactoring refactoring = factory.createRename(file, "rename-after.rnc"); diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngCompletionTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngCompletionTest.java index 82a674451ef1..4f1a7d2f0fb8 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngCompletionTest.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngCompletionTest.java @@ -25,6 +25,7 @@ import org.intellij.plugins.testUtil.CopyFile; * Date: 22.08.2007 */ public class RngCompletionTest extends HighlightingTestBase { + @Override public String getTestDataPath() { return "completion/rng"; } diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngHighlightingTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngHighlightingTest.java index aa44eca4f674..aab32bdfe9d8 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngHighlightingTest.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngHighlightingTest.java @@ -29,6 +29,7 @@ import com.intellij.psi.xml.XmlTag; */ public class RngHighlightingTest extends HighlightingTestBase { + @Override public String getTestDataPath() { return "highlighting/rng"; } diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngIndexHighlightingTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngIndexHighlightingTest.java index 0b89884ccace..f70595c39ce7 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngIndexHighlightingTest.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngIndexHighlightingTest.java @@ -26,6 +26,7 @@ import org.intellij.plugins.testUtil.CopyFile; @CopyFile("*.rng") public class RngIndexHighlightingTest extends AbstractIndexTest { + @Override public String getTestDataPath() { return "highlighting/rng"; } diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngRenameTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngRenameTest.java index 4923b8c8bb55..602500898c95 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngRenameTest.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngRenameTest.java @@ -26,10 +26,12 @@ import org.jetbrains.annotations.NotNull; * Date: 22.08.2007 */ public class RngRenameTest extends HighlightingTestBase { + @Override protected CodeInsightTestFixture createFixture(@NotNull IdeaTestFixtureFactory factory) { return createContentFixture(factory); } + @Override public String getTestDataPath() { return "rename/rng"; } diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java index 261ca4e2e98e..59f5bae41175 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlHighlightingTest.java @@ -30,15 +30,18 @@ import org.intellij.plugins.testUtil.CopyFile; */ public class RngXmlHighlightingTest extends HighlightingTestBase { + @Override public String getTestDataPath() { return "highlighting"; } + @Override protected void init() { super.init(); FileTypeManager.getInstance().registerFileType(StdFileTypes.XML, "fo"); ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override public void run() { final ExternalResourceManagerEx m = ExternalResourceManagerEx.getInstanceEx(); ExternalResourceManagerExImpl diff --git a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlValidationTest.java b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlValidationTest.java index 1472e0a86abb..06bff38158a8 100644 --- a/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlValidationTest.java +++ b/xml/relaxng/test/org/intellij/plugins/relaxNG/RngXmlValidationTest.java @@ -83,9 +83,11 @@ public class RngXmlValidationTest extends HighlightingTestBase { doExternalToolHighlighting(name); } + @Override protected void init() { super.init(); ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override public void run() { final ExternalResourceManager mgr = ExternalResourceManager.getInstance(); mgr.addResource("urn:test:simple.rng", toAbsolutePath("validation/simple.rng")); @@ -95,6 +97,7 @@ public class RngXmlValidationTest extends HighlightingTestBase { }); } + @Override public String getTestDataPath() { return "validation"; } diff --git a/xml/tests/src/com/intellij/codeInsight/XmlBuilderTest.java b/xml/tests/src/com/intellij/codeInsight/XmlBuilderTest.java index b735141ace9d..70b0263d35ad 100644 --- a/xml/tests/src/com/intellij/codeInsight/XmlBuilderTest.java +++ b/xml/tests/src/com/intellij/codeInsight/XmlBuilderTest.java @@ -1,3 +1,19 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + /* * @author max */ @@ -249,7 +265,7 @@ public class XmlBuilderTest extends LightCodeInsightTestCase { ); } - private static void doTest(String xml, String expectedEventSequence, final XmlBuilder.ProcessingOrder tagsAndAttributes) throws Exception { + private static void doTest(String xml, String expectedEventSequence, final XmlBuilder.ProcessingOrder tagsAndAttributes) { final TestXmlBuilder builder = new TestXmlBuilder(tagsAndAttributes); new XmlBuilderDriver(xml).build(builder); assertEquals(expectedEventSequence, builder.getResult()); diff --git a/xml/tests/src/com/intellij/codeInsight/XmlDocumentationTest.java b/xml/tests/src/com/intellij/codeInsight/XmlDocumentationTest.java index 5e4d8c48587c..5d77aa2fc2b1 100644 --- a/xml/tests/src/com/intellij/codeInsight/XmlDocumentationTest.java +++ b/xml/tests/src/com/intellij/codeInsight/XmlDocumentationTest.java @@ -128,7 +128,7 @@ public class XmlDocumentationTest extends LightPlatformCodeInsightFixtureTestCas PsiElement element; final PsiFile psiFile; - DocumentationTestContext(String... fileNames) throws Exception { + DocumentationTestContext(String... fileNames) { copyAdditionalFiles(fileNames); psiFile = myFixture.configureByFile(fileNames[0]); originalElement = psiFile.findElementAt(myFixture.getEditor().getCaretModel().getOffset()); diff --git a/xml/tests/src/com/intellij/codeInsight/XmlDtdTest.java b/xml/tests/src/com/intellij/codeInsight/XmlDtdTest.java index e4c1da51c96e..72b67dbcb5d1 100644 --- a/xml/tests/src/com/intellij/codeInsight/XmlDtdTest.java +++ b/xml/tests/src/com/intellij/codeInsight/XmlDtdTest.java @@ -323,7 +323,7 @@ public class XmlDtdTest extends LightPlatformTestCase { assertEquals("date", elements[0].getName()); } - private static XmlNSDescriptor createDescriptor(String dtdText) throws Exception { + private static XmlNSDescriptor createDescriptor(String dtdText) { PsiFile dtdFile = createLightFile("test.dtd", dtdText); XmlNSDescriptorImpl descriptor = new XmlNSDescriptorImpl(); @@ -331,7 +331,7 @@ public class XmlDtdTest extends LightPlatformTestCase { return descriptor; } - private static XmlTag tag(String tagName) throws Exception { + private static XmlTag tag(String tagName) { XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("tag.xml", StdFileTypes.XML, "<" + tagName + "/>"); return file.getDocument().getRootTag(); } diff --git a/xml/tests/src/com/intellij/codeInsight/XmlEventsTest.java b/xml/tests/src/com/intellij/codeInsight/XmlEventsTest.java index 0e2090f94eed..049cc14ed864 100644 --- a/xml/tests/src/com/intellij/codeInsight/XmlEventsTest.java +++ b/xml/tests/src/com/intellij/codeInsight/XmlEventsTest.java @@ -66,7 +66,9 @@ public class XmlEventsTest extends LightCodeInsightTestCase { final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText("aaa"); final XmlTag otherTag = XmlElementFactory.getInstance(getProject()).createTagFromText(""); final XmlText xmlText = tagFromText.getValue().getTextElements()[0]; - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { xmlText.insertAtOffset(otherTag, 2); } }); @@ -78,7 +80,9 @@ public class XmlEventsTest extends LightCodeInsightTestCase { final Listener listener = addPomListener(); final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText("aaa"); final XmlText xmlText = tagFromText.getValue().getTextElements()[0]; - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { xmlText.insertText("bb", 2); } }); @@ -89,7 +93,9 @@ public class XmlEventsTest extends LightCodeInsightTestCase { public void test4() throws Exception{ final Listener listener = addPomListener(); final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText("a "); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { tagFromText.addAfter(tagFromText.getValue().getTextElements()[0], tagFromText.getValue().getTextElements()[0]); } }); @@ -100,7 +106,9 @@ public class XmlEventsTest extends LightCodeInsightTestCase { public void test5() throws Exception{ final Listener listener = addPomListener(); final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText("aaa"); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { tagFromText.delete(); } }); @@ -156,7 +164,9 @@ public class XmlEventsTest extends LightCodeInsightTestCase { final XmlTag tag = XmlElementFactory.getInstance(getProject()).createTagFromText(text); final XmlAttribute attribute = tag.getAttribute("name", null); assert attribute != null; - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { attribute.setValue("new"); } }); @@ -173,7 +183,9 @@ public class XmlEventsTest extends LightCodeInsightTestCase { final PsiFileImpl containingFile = (PsiFileImpl)tagFromText.getContainingFile(); final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(getProject()); final Document document = documentManager.getDocument(containingFile); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { document.insertString(positionToInsert, stringToInsert); documentManager.commitDocument(document); } diff --git a/xml/tests/src/com/intellij/codeInsight/XmlInsightTest.java b/xml/tests/src/com/intellij/codeInsight/XmlInsightTest.java index 01d46ca33790..675a424a4c3f 100644 --- a/xml/tests/src/com/intellij/codeInsight/XmlInsightTest.java +++ b/xml/tests/src/com/intellij/codeInsight/XmlInsightTest.java @@ -143,11 +143,11 @@ public class XmlInsightTest extends LightPlatformTestCase { assertTrue(attributes[1].isRequired()); } - private static XmlFile createFile(String text) throws Exception { + private static XmlFile createFile(String text) { return (XmlFile)createFile("test.xml", text); } - private static XmlNSDescriptor createDescriptor(XmlFile file) throws Exception{ + private static XmlNSDescriptor createDescriptor(XmlFile file) { return file.getDocument().getRootTagNSDescriptor(); } diff --git a/xml/tests/src/com/intellij/codeInsight/XmlPerformanceTest.java b/xml/tests/src/com/intellij/codeInsight/XmlPerformanceTest.java index fc5fec29df21..089daa98ecae 100644 --- a/xml/tests/src/com/intellij/codeInsight/XmlPerformanceTest.java +++ b/xml/tests/src/com/intellij/codeInsight/XmlPerformanceTest.java @@ -1,5 +1,17 @@ /* - * Copyright (c) 2000-2006 JetBrains s.r.o. All Rights Reserved. + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ /* @@ -59,7 +71,7 @@ public class XmlPerformanceTest extends LightQuickFixTestCase { return ourTestsWithFolding.contains(getTestName(false)); } - private void doIndentTest(int time) throws Exception { + private void doIndentTest(int time) { configureByFile(getBasePath() + getTestName(false)+".xml"); doHighlighting(); myEditor.getSelectionModel().setSelection(0,myEditor.getDocument().getTextLength()); diff --git a/xml/tests/src/com/intellij/codeInsight/XmlSchemaTest.java b/xml/tests/src/com/intellij/codeInsight/XmlSchemaTest.java index fc9fe64b7ec1..9100b11c206e 100644 --- a/xml/tests/src/com/intellij/codeInsight/XmlSchemaTest.java +++ b/xml/tests/src/com/intellij/codeInsight/XmlSchemaTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.codeInsight; import com.intellij.psi.PsiFile; @@ -749,7 +764,7 @@ public class XmlSchemaTest extends LightCodeInsightTestCase { assertNull(attribute); } - private static XmlNSDescriptor createDescriptor(@NonNls String dtdText) throws Exception { + private static XmlNSDescriptor createDescriptor(@NonNls String dtdText) { PsiFile dtdFile = createFile("test.xml", dtdText); return new XmlNSDescriptorImpl((XmlFile)dtdFile); diff --git a/xml/tests/src/com/intellij/codeInsight/XmlTagTest.java b/xml/tests/src/com/intellij/codeInsight/XmlTagTest.java index 19385dd61e5f..5c4d0535c25b 100644 --- a/xml/tests/src/com/intellij/codeInsight/XmlTagTest.java +++ b/xml/tests/src/com/intellij/codeInsight/XmlTagTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -99,7 +99,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testDeleteTag() throws Throwable { XmlTag aTag = XmlElementFactory.getInstance(getProject()).createTagFromText(" "); final XmlTag bTag = aTag.findFirstSubTag("b"); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { bTag.delete(); } }); @@ -110,7 +112,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testReplaceTag() throws Throwable { final XmlTag aTag = XmlElementFactory.getInstance(getProject()).createTagFromText(""); final XmlTag bTag = aTag.findFirstSubTag("b"); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { PsiElement cTag = bTag.replace(XmlElementFactory.getInstance(getProject()).createTagFromText("")); assertEquals(1, aTag.getSubTags().length); assertEquals(cTag, aTag.getSubTags()[0]); @@ -123,7 +127,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { final XmlTag aTag = elementFactory.createTagFromText("1"); final XmlText displayText = elementFactory.createDisplayText("2"); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { final PsiElement psiElement = aTag.addAfter(displayText, aTag.getValue().getChildren()[0]); assertEquals(psiElement.getContainingFile(), aTag.getContainingFile()); } @@ -131,7 +137,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { } public void testWhitespaceInsideTag() throws Exception { - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { XmlElementFactory.getInstance(getProject()).createTagFromText("

").getValue().setText("\n"); } }); @@ -141,7 +149,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { XmlFile xhtmlFile = (XmlFile)PsiFileFactory.getInstance(getProject()).createFileFromText("dummy.xhtml", ""); final XmlTag rootTag = xhtmlFile.getDocument().getRootTag(); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { rootTag.setAttribute("foo", "bar"); } }); @@ -153,7 +163,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testSetAttribute() throws Exception { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText(""); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { rootTag.setAttribute("foo", "bar"); } }); @@ -167,7 +179,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testSetAttributeWithQuotes() throws Exception { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText(""); final String value = "a \"b\" c"; - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { rootTag.setAttribute("foo", value); } }); @@ -181,7 +195,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testSetAttributeWithQuotes2() throws Exception { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText(""); final String value = "'a \"b\" c'"; - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { rootTag.setAttribute("foo", value); } }); @@ -211,7 +227,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testSetAttributeWithNamespaces() throws Exception { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText(""); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { rootTag.setAttribute("foo", "", "bar"); } }); @@ -225,7 +243,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testTextEdit1() throws Exception { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("aaa"); final XmlText xmlText = rootTag.getValue().getTextElements()[0]; - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { xmlText.removeText(0, 3); } }); @@ -235,7 +255,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testTextEdit2() throws Exception { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("a<a"); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { rootTag.getValue().getTextElements()[0].removeText(0, 3); } }); @@ -246,7 +268,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testTextEdit3() throws Exception { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("a<a"); final XmlText xmlText = rootTag.getValue().getTextElements()[0]; - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { xmlText.removeText(1, 2); } }); @@ -258,7 +282,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testTextEdit4() throws Exception { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("aaa"); final XmlText xmlText = rootTag.getValue().getTextElements()[0]; - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { xmlText.removeText(1, 2); } }); @@ -293,7 +319,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testTextEdit6() throws Exception { final XmlTag rootTag = XmlElementFactory.getInstance(getProject()).createTagFromText("a1c"); final XmlTag xmlTag = rootTag.findFirstSubTag("b"); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { xmlTag.delete(); } }); @@ -303,7 +331,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testBrace() throws Exception { final XmlTag tagFromText = XmlElementFactory.getInstance(getProject()).createTagFromText(""); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { tagFromText.getValue().setText("<"); } }); @@ -406,7 +436,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { final XmlTagChild child = tag.getValue().getChildren()[0]; assertTrue(child instanceof XmlText && child.getText().equals("234")); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { assertNotNull(tag.getParent().addBefore(child, tag)); tag.delete(); } @@ -424,7 +456,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { final XmlTagChild child = tag.getValue().getChildren()[0]; assertTrue(child instanceof XmlText && child.getText().equals("234")); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { assertNotNull(tag.getParent().addBefore(child, tag)); tag.delete(); } @@ -437,7 +471,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { public void testDisplayText() throws Throwable { final XmlTag tag = XmlElementFactory.getInstance(getProject()).createTagFromText(" "); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { tag.add(XmlElementFactory.getInstance(getProject()).createDisplayText("aaa\nbbb")); } }); @@ -453,7 +489,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { final XmlTagChild[] tagElements = tagB.getValue().getChildren(); final PsiElement parent = tagB.getParent(); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { PsiElement first = parent.addBefore(tagElements[0], tagB); assertNotNull(first); } @@ -507,7 +545,9 @@ public class XmlTagTest extends LightCodeInsightTestCase { final XmlFile file = (XmlFile)PsiFileFactory.getInstance(getProject()) .createFileFromText("test.xml", "\n \n \n hasgdgasjdgasdg asgdjhasgd\n \n"); final XmlTag tagB = file.getDocument().getRootTag(); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { tagB.getSubTags()[0].getSubTags()[0].delete(); } }); @@ -598,7 +638,7 @@ public class XmlTagTest extends LightCodeInsightTestCase { final XmlText xmlText = (XmlText)children[0]; assertEquals(text, xmlText.getText()); xmlText.removeText(i, j); - final StringBuffer expected = new StringBuffer(text); + final StringBuilder expected = new StringBuilder(text); expected.delete(i, j); assertEquals(expected.toString(), xmlText.getValue()); } @@ -618,7 +658,7 @@ public class XmlTagTest extends LightCodeInsightTestCase { final XmlText xmlText = (XmlText)children[0]; assertEquals(text, xmlText.getValue()); xmlText.insertText(textToInsert, i); - final StringBuffer expected = new StringBuffer(text); + final StringBuilder expected = new StringBuilder(text); expected.insert(i, textToInsert); assertEquals(expected.toString(), xmlText.getValue()); } @@ -653,7 +693,7 @@ public class XmlTagTest extends LightCodeInsightTestCase { doTestEscapedInsertion("_x_y_z_", "a"); } - public static void notestEscapedDeletion() throws Throwable { + public static void notestEscapedDeletion() { doTestEscapedDeletion("&"); doTestEscapedDeletion("&&"); doTestEscapedDeletion(" &&"); @@ -686,7 +726,7 @@ public class XmlTagTest extends LightCodeInsightTestCase { final XmlText xmlText = (XmlText)children[0]; assertEquals(tagText, xmlText.getText()); xmlText.insertText(textToInsert, i); - final StringBuffer expectedDisplay = new StringBuffer(text.replace('_', '\u00a0')); + final StringBuilder expectedDisplay = new StringBuilder(text.replace('_', '\u00a0')); expectedDisplay.insert(i, textToInsert); assertEquals(expectedDisplay.toString(), xmlText.getValue()); @@ -708,7 +748,7 @@ public class XmlTagTest extends LightCodeInsightTestCase { final XmlText xmlText = (XmlText)children[0]; assertEquals(tagText, xmlText.getText()); xmlText.removeText(i, j); - final StringBuffer expectedDisplay = new StringBuffer(text.replace('_', ' ')); + final StringBuilder expectedDisplay = new StringBuilder(text.replace('_', ' ')); expectedDisplay.delete(i, j); assertEquals(expectedDisplay.toString(), xmlText.getValue()); diff --git a/xml/tests/src/com/intellij/codeInsight/XmlTagWriteTest.java b/xml/tests/src/com/intellij/codeInsight/XmlTagWriteTest.java index 89cc1263131a..39c77f1ff37b 100644 --- a/xml/tests/src/com/intellij/codeInsight/XmlTagWriteTest.java +++ b/xml/tests/src/com/intellij/codeInsight/XmlTagWriteTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,7 +48,9 @@ public class XmlTagWriteTest extends LightCodeInsightTestCase{ public void test2() throws IncorrectOperationException { final XmlTag xmlTag = XmlElementFactory.getInstance(getProject()).createTagFromText(""); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { xmlTag.add(xmlTag.createChildTag("tag2", XmlUtil.EMPTY_URI, null, false)); } }); diff --git a/xml/tests/src/com/intellij/codeInsight/XmlTestUtil.java b/xml/tests/src/com/intellij/codeInsight/XmlTestUtil.java index 75aa8825cc68..1fd17df1b612 100644 --- a/xml/tests/src/com/intellij/codeInsight/XmlTestUtil.java +++ b/xml/tests/src/com/intellij/codeInsight/XmlTestUtil.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.codeInsight; import com.intellij.openapi.project.Project; @@ -8,12 +23,12 @@ import org.jetbrains.annotations.NonNls; public class XmlTestUtil { - public static XmlTag tag(@NonNls String tagName, Project project) throws Exception { + public static XmlTag tag(@NonNls String tagName, Project project) { XmlFile file = (XmlFile)PsiFileFactory.getInstance(project).createFileFromText("tag.xml", "<" + tagName + "/>"); return file.getDocument().getRootTag(); } - public static XmlTag tag(@NonNls String tagName, @NonNls String namespace, Project project) throws Exception { + public static XmlTag tag(@NonNls String tagName, @NonNls String namespace, Project project) { XmlFile file = (XmlFile)PsiFileFactory.getInstance(project) .createFileFromText("tag.xml", "<" + tagName + " xmlns=\"" + namespace + "\"/>"); return file.getDocument().getRootTag(); diff --git a/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java b/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java index e53821560604..2b6b36c44197 100644 --- a/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java +++ b/xml/tests/src/com/intellij/codeInsight/completion/XmlCompletionTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.codeInsight.completion; import com.intellij.codeInsight.CodeInsightSettings; @@ -201,7 +216,7 @@ public class XmlCompletionTest extends LightCodeInsightFixtureTestCase { myFixture.type(c); } - private void doCompletionTest(final String ext, final String url, final String location) throws Exception { + private void doCompletionTest(final String ext, final String url, final String location) { final String testName = getTestName(false); addResource(url, location); @@ -412,7 +427,7 @@ public class XmlCompletionTest extends LightCodeInsightFixtureTestCase { basicDoTest(""); } - private void basicDoTest(String ext) throws Exception { + private void basicDoTest(String ext) { final String testName = getTestName(false) + ext; configureByFile(testName + ".xml"); checkResultByFile(testName + "_after.xml"); @@ -519,7 +534,7 @@ public class XmlCompletionTest extends LightCodeInsightFixtureTestCase { checkResultByFile(testName + "_after.xml"); } - public void _testIDEADEV_32773() throws Exception { + public void _testIDEADEV_32773() { final String testName = getTestName(false); configureByFiles(testName + ".xml", diff --git a/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java b/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java index a46dc716a940..7bfe266493e6 100644 --- a/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java +++ b/xml/tests/src/com/intellij/codeInsight/daemon/XmlHighlightingTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -548,7 +548,9 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase { final XmlAttribute attribute = t.getAttribute("name", null); final XmlAttributeValue valueElement = attribute.getValueElement(); final PsiReference nameReference = valueElement.getReferences()[0]; - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { nameReference.handleElementRename("zzz"); } }); @@ -561,7 +563,9 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase { public void testExternalValidatorOnValidXmlWithNamespacesNotSetup() throws Exception { final ExternalResourceManagerEx instanceEx = ExternalResourceManagerEx.getInstanceEx(); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { instanceEx.addIgnoredResource("http://xml.apache.org/axis/wsdd2/"); instanceEx.addIgnoredResource("http://xml.apache.org/axis/wsdd2/providers/java"); instanceEx.addIgnoredResource("http://soapinterop.org/xsd2"); @@ -575,14 +579,18 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase { public void testExternalValidatorOnValidXmlWithNamespacesNotSetup2() throws Exception { final ExternalResourceManagerEx instanceEx = ExternalResourceManagerEx.getInstanceEx(); try { - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { instanceEx.addIgnoredResource(""); } }); doTest(getFullRelativeTestName(".xml"), true, false); } finally { - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { instanceEx.removeIgnoredResource(""); } }); @@ -1057,7 +1065,9 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase { } public void testIgnoredNamespaceHighlighting() throws Exception { - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { ExternalResourceManagerEx.getInstanceEx().addIgnoredResource("http://ignored/uri"); } }); @@ -1234,6 +1244,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase { final String text = myEditor.getDocument().getText(); WriteCommandAction.runWriteCommandAction(null, new Runnable() { + @Override public void run() { myEditor.getSelectionModel().setSelection(0, myEditor.getDocument().getTextLength()); } @@ -1409,7 +1420,9 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase { final Editor schemaEditor = allEditors[0] == myEditor ? allEditors[1]:allEditors[0]; final String text = schemaEditor.getDocument().getText(); final String newText = text.replaceAll("xsd","xs"); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { schemaEditor.getDocument().replaceString(0, text.length(), newText); } }); @@ -1566,7 +1579,9 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase { Collection infos = filterInfos(doHighlighting()); assertEquals(2, infos.size()); - WriteCommandAction.runWriteCommandAction(null, new Runnable(){public void run() { + WriteCommandAction.runWriteCommandAction(null, new Runnable(){ + @Override + public void run() { EditorModificationUtil.deleteSelectedText(myEditor); } }); @@ -1576,6 +1591,7 @@ public class XmlHighlightingTest extends DaemonAnalyzerTestCase { assertEquals(11, infos.size()); WriteCommandAction.runWriteCommandAction(null, new Runnable() { + @Override public void run() { EditorModificationUtil.insertStringAtCaret(myEditor, "<"); } diff --git a/xml/tests/src/com/intellij/codeInsight/daemon/quickFix/ExtractExternalResourceLinksTest.java b/xml/tests/src/com/intellij/codeInsight/daemon/quickFix/ExtractExternalResourceLinksTest.java index 96f752a4f2a1..a3d4cbdfa1b7 100644 --- a/xml/tests/src/com/intellij/codeInsight/daemon/quickFix/ExtractExternalResourceLinksTest.java +++ b/xml/tests/src/com/intellij/codeInsight/daemon/quickFix/ExtractExternalResourceLinksTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.codeInsight.daemon.quickFix; import com.intellij.codeInsight.daemon.impl.quickfix.FetchExtResourceAction; @@ -78,7 +93,7 @@ public class ExtractExternalResourceLinksTest extends LightCodeInsightTestCase { doExtractionOfEmbeddedFiles(new String[] {shortFileName}, new String[][] {expectedFileNames} ); } - private void doExtractionOfEmbeddedFiles(String[] shortFileName,String[][] expectedFileNames) throws Exception { + private void doExtractionOfEmbeddedFiles(String[] shortFileName,String[][] expectedFileNames) { final List files = new ArrayList(shortFileName.length); for(String s: shortFileName) { if (FileUtilRt.getExtension(s).length() < 3) { diff --git a/xml/tests/src/com/intellij/html/MicrodataCompletionTest.java b/xml/tests/src/com/intellij/html/MicrodataCompletionTest.java index 9a0c19ed5542..a253430643e6 100644 --- a/xml/tests/src/com/intellij/html/MicrodataCompletionTest.java +++ b/xml/tests/src/com/intellij/html/MicrodataCompletionTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -54,7 +54,7 @@ public class MicrodataCompletionTest extends CodeInsightFixtureTestCase { } } - private void configureAndComplete(String text, String[] items) throws Exception { + private void configureAndComplete(String text, String[] items) { myFixture.configureByText(StdFileTypes.HTML, text); myFixture.complete(CompletionType.BASIC); } diff --git a/xml/tests/src/com/intellij/xml/XMLCatalogManagerTest.java b/xml/tests/src/com/intellij/xml/XMLCatalogManagerTest.java index e2091af5410f..8db30d1cf057 100644 --- a/xml/tests/src/com/intellij/xml/XMLCatalogManagerTest.java +++ b/xml/tests/src/com/intellij/xml/XMLCatalogManagerTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -79,7 +79,7 @@ public class XMLCatalogManagerTest extends LightPlatformCodeInsightFixtureTestCa assertFalse(new XMLCatalogConfigurable().isModified()); } - private XMLCatalogManager getManager() throws IOException { + private XMLCatalogManager getManager() { return new XMLCatalogManager(getTestDataPath() + "catalog.properties"); } diff --git a/xml/tests/src/com/intellij/xml/XmlFoldingTest.java b/xml/tests/src/com/intellij/xml/XmlFoldingTest.java index c6f76e3c55ad..76cb6f3d0dd1 100644 --- a/xml/tests/src/com/intellij/xml/XmlFoldingTest.java +++ b/xml/tests/src/com/intellij/xml/XmlFoldingTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,7 +43,7 @@ public class XmlFoldingTest extends LightPlatformCodeInsightFixtureTestCase { doTest(".html"); } - private void doTest(String extension) throws Throwable { + private void doTest(String extension) { myFixture.testFolding(getTestDataPath() + getTestName(true) + extension); } diff --git a/xml/tests/src/com/intellij/xml/XmlNamespacesTest.java b/xml/tests/src/com/intellij/xml/XmlNamespacesTest.java index 5e0932b2a579..c38ce07bc1e2 100644 --- a/xml/tests/src/com/intellij/xml/XmlNamespacesTest.java +++ b/xml/tests/src/com/intellij/xml/XmlNamespacesTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.xml; import com.intellij.codeInsight.actions.OptimizeImportsProcessor; @@ -224,7 +239,7 @@ public class XmlNamespacesTest extends CodeInsightFixtureTestCase { doUnusedDeclarationTest(text, after, name, true); } - private void doUnusedDeclarationTest(String text, String after, String name, boolean testOptimizeImports) throws Exception { + private void doUnusedDeclarationTest(String text, String after, String name, boolean testOptimizeImports) { myFixture.configureByText("a.xml", text); myFixture.testHighlighting(); IntentionAction action = myFixture.getAvailableIntention(name); diff --git a/xml/tests/src/com/intellij/xml/XmlSchemaPrefixTest.java b/xml/tests/src/com/intellij/xml/XmlSchemaPrefixTest.java index feae6f6f487c..74aefe81ad47 100644 --- a/xml/tests/src/com/intellij/xml/XmlSchemaPrefixTest.java +++ b/xml/tests/src/com/intellij/xml/XmlSchemaPrefixTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.xml; import com.intellij.testFramework.fixtures.CodeInsightFixtureTestCase; @@ -24,7 +39,7 @@ public class XmlSchemaPrefixTest extends CodeInsightFixtureTestCase { doRename("xsd"); } - private void doRename(String newValue) throws Exception { + private void doRename(String newValue) { final String name = getTestName(true); CodeInsightTestUtil.doInlineRenameTest(new SchemaPrefixRenameHandler(), name, "xml", newValue, myFixture); } diff --git a/xml/tests/src/com/intellij/xml/actions/SplitTagActionTest.java b/xml/tests/src/com/intellij/xml/actions/SplitTagActionTest.java index 205c03f8a285..f4fdf292c705 100644 --- a/xml/tests/src/com/intellij/xml/actions/SplitTagActionTest.java +++ b/xml/tests/src/com/intellij/xml/actions/SplitTagActionTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.xml.actions; import com.intellij.codeInsight.daemon.LightIntentionActionTestCase; @@ -20,6 +35,7 @@ public class SplitTagActionTest extends LightIntentionActionTestCase { return ""; } + @Override @NotNull protected String getTestDataPath() { return PlatformTestUtil.getCommunityPath() + "/xml/tests/testData/intentions/splitTag"; diff --git a/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/XmlWrongClosingTagNameInspection.java b/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/XmlWrongClosingTagNameInspection.java index b1b550163120..7ecdf14bad43 100644 --- a/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/XmlWrongClosingTagNameInspection.java +++ b/xml/xml-analysis-impl/src/com/intellij/codeInspection/htmlInspections/XmlWrongClosingTagNameInspection.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -154,8 +154,8 @@ public class XmlWrongClosingTagNameInspection implements Annotator { while (current != null) { final IElementType elementType = prev.getElementType(); - if ((elementType == XmlElementType.XML_NAME || elementType == XmlElementType.XML_TAG_NAME) && - current.getElementType() == XmlElementType.XML_END_TAG_START) { + if ((elementType == XmlTokenType.XML_NAME || elementType == XmlTokenType.XML_TAG_NAME) && + current.getElementType() == XmlTokenType.XML_END_TAG_START) { return (XmlToken)prev.getPsi(); } diff --git a/xml/xml-analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/IdRefReference.java b/xml/xml-analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/IdRefReference.java index 601b6e339439..27d23f849942 100644 --- a/xml/xml-analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/IdRefReference.java +++ b/xml/xml-analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/IdRefReference.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -185,7 +185,7 @@ public class IdRefReference extends BasicAttributeValueReference { public PsiElement resolve() { final PsiElement[] result = new PsiElement[1]; process(new PsiElementProcessor() { - String canonicalText = getCanonicalText(); + final String canonicalText = getCanonicalText(); @Override public boolean execute(@NotNull final PsiElement element) { diff --git a/xml/xml-psi-api/src/com/intellij/codeInspection/XmlSuppressionProvider.java b/xml/xml-psi-api/src/com/intellij/codeInspection/XmlSuppressionProvider.java index f6be5cdc5ae2..de68c7a5a7ca 100644 --- a/xml/xml-psi-api/src/com/intellij/codeInspection/XmlSuppressionProvider.java +++ b/xml/xml-psi-api/src/com/intellij/codeInspection/XmlSuppressionProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ import org.jetbrains.annotations.NotNull; */ public abstract class XmlSuppressionProvider { - public static ExtensionPointName EP_NAME = new ExtensionPointName("com.intellij.xml.xmlSuppressionProvider"); + public static final ExtensionPointName EP_NAME = new ExtensionPointName("com.intellij.xml.xmlSuppressionProvider"); public static boolean isSuppressed(@NotNull PsiElement element, @NotNull String inspectionId) { for (XmlSuppressionProvider provider : Extensions.getExtensions(EP_NAME)) { diff --git a/xml/xml-psi-api/src/com/intellij/patterns/XmlAttributeValuePattern.java b/xml/xml-psi-api/src/com/intellij/patterns/XmlAttributeValuePattern.java index 8cfd471e936d..aef856484bbd 100644 --- a/xml/xml-psi-api/src/com/intellij/patterns/XmlAttributeValuePattern.java +++ b/xml/xml-psi-api/src/com/intellij/patterns/XmlAttributeValuePattern.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import org.jetbrains.annotations.NonNls; */ public class XmlAttributeValuePattern extends XmlElementPattern{ private static final InitialPatternCondition CONDITION = new InitialPatternCondition(XmlAttributeValue.class) { + @Override public boolean accepts(@Nullable final Object o, final ProcessingContext context) { return o instanceof XmlAttributeValue; } @@ -54,6 +55,7 @@ public class XmlAttributeValuePattern extends XmlElementPattern namePattern) { return with(new PsiNamePatternCondition("withLocalName", namePattern) { + @Override public String getPropertyValue(@NotNull final Object o) { if (o instanceof XmlAttributeValue) { final XmlAttributeValue value = (XmlAttributeValue)o; diff --git a/xml/xml-psi-api/src/com/intellij/patterns/XmlElementPattern.java b/xml/xml-psi-api/src/com/intellij/patterns/XmlElementPattern.java index 611bb40c5e96..f8ae6f217fdf 100644 --- a/xml/xml-psi-api/src/com/intellij/patterns/XmlElementPattern.java +++ b/xml/xml-psi-api/src/com/intellij/patterns/XmlElementPattern.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,6 +37,7 @@ public class XmlElementPattern { protected Capture() { super(new InitialPatternCondition(XmlElement.class) { + @Override public boolean accepts(@Nullable final Object o, final ProcessingContext context) { return o instanceof XmlElement; } @@ -47,6 +48,7 @@ public class XmlElementPattern { public XmlTextPattern() { super(new InitialPatternCondition(XmlText.class) { + @Override public boolean accepts(@Nullable final Object o, final ProcessingContext context) { return o instanceof XmlText; } @@ -57,6 +59,7 @@ public class XmlElementPattern { public XmlEntityRefPattern() { super(new InitialPatternCondition(XmlEntityRef.class) { + @Override public boolean accepts(@Nullable final Object o, final ProcessingContext context) { return o instanceof XmlEntityRef; } diff --git a/xml/xml-psi-api/src/com/intellij/patterns/XmlFilePattern.java b/xml/xml-psi-api/src/com/intellij/patterns/XmlFilePattern.java index 200fa32387e3..1a273fbae591 100644 --- a/xml/xml-psi-api/src/com/intellij/patterns/XmlFilePattern.java +++ b/xml/xml-psi-api/src/com/intellij/patterns/XmlFilePattern.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,6 +36,7 @@ public class XmlFilePattern> extends PsiFilePa public Self withRootTag(final ElementPattern rootTag) { return with(new PatternCondition("withRootTag") { + @Override public boolean accepts(@NotNull final XmlFile xmlFile, final ProcessingContext context) { XmlDocument document = xmlFile.getDocument(); return document != null && rootTag.getCondition().accepts(document.getRootTag(), context); diff --git a/xml/xml-psi-api/src/com/intellij/patterns/XmlNamedElementPattern.java b/xml/xml-psi-api/src/com/intellij/patterns/XmlNamedElementPattern.java index 2bc01880db02..c5064cdcc76a 100644 --- a/xml/xml-psi-api/src/com/intellij/patterns/XmlNamedElementPattern.java +++ b/xml/xml-psi-api/src/com/intellij/patterns/XmlNamedElementPattern.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,6 +46,7 @@ public abstract class XmlNamedElementPattern localName) { return with(new PsiNamePatternCondition("withLocalName", localName) { + @Override public String getPropertyValue(@NotNull final Object o) { return o instanceof XmlElement ? getLocalName((T)o) : null; } @@ -74,16 +75,19 @@ public abstract class XmlNamedElementPattern { protected XmlAttributePattern() { super(new InitialPatternCondition(XmlAttribute.class) { + @Override public boolean accepts(@Nullable final Object o, final ProcessingContext context) { return o instanceof XmlAttribute; } }); } + @Override protected String getLocalName(XmlAttribute xmlAttribute) { return xmlAttribute.getLocalName(); } + @Override protected String getNamespace(XmlAttribute xmlAttribute) { return xmlAttribute.getNamespace(); } diff --git a/xml/xml-psi-api/src/com/intellij/patterns/XmlTagPattern.java b/xml/xml-psi-api/src/com/intellij/patterns/XmlTagPattern.java index 5be06fa8472e..c1d4badacac1 100644 --- a/xml/xml-psi-api/src/com/intellij/patterns/XmlTagPattern.java +++ b/xml/xml-psi-api/src/com/intellij/patterns/XmlTagPattern.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ import java.util.Collection; public class XmlTagPattern> extends XmlNamedElementPattern { protected XmlTagPattern() { super(new InitialPatternCondition(XmlTag.class) { + @Override public boolean accepts(@Nullable final Object o, final ProcessingContext context) { return o instanceof XmlTag; } @@ -42,16 +43,19 @@ public class XmlTagPattern> extends XmlNamedEle super(condition); } + @Override protected String getLocalName(XmlTag tag) { return tag.getLocalName(); } + @Override protected String getNamespace(XmlTag tag) { return tag.getNamespace(); } public Self withAttributeValue(@NotNull @NonNls final String attributeName, @NotNull final String attributeValue) { return with(new PatternCondition("withAttributeValue") { + @Override public boolean accepts(@NotNull final XmlTag xmlTag, final ProcessingContext context) { return Comparing.equal(xmlTag.getAttributeValue(attributeName), attributeValue); } @@ -60,6 +64,7 @@ public class XmlTagPattern> extends XmlNamedEle public Self withAnyAttribute(@NotNull @NonNls final String... attributeNames) { return with(new PatternCondition("withAnyAttribute") { + @Override public boolean accepts(@NotNull final XmlTag xmlTag, final ProcessingContext context) { for (String attributeName : attributeNames) { if (xmlTag.getAttribute(attributeName) != null) { @@ -73,6 +78,7 @@ public class XmlTagPattern> extends XmlNamedEle public Self withDescriptor(@NotNull final ElementPattern metaDataPattern) { return with(new PatternCondition("withDescriptor") { + @Override public boolean accepts(@NotNull final XmlTag xmlTag, final ProcessingContext context) { return metaDataPattern.accepts(xmlTag.getDescriptor()); } @@ -81,6 +87,7 @@ public class XmlTagPattern> extends XmlNamedEle public Self isFirstSubtag(@NotNull final ElementPattern pattern) { return with(new PatternCondition("isFirstSubtag") { + @Override public boolean accepts(@NotNull final XmlTag xmlTag, final ProcessingContext context) { final XmlTag parent = xmlTag.getParentTag(); return parent != null && @@ -95,6 +102,7 @@ public class XmlTagPattern> extends XmlNamedEle public Self withSubTags(@NotNull final ElementPattern> pattern) { return with(new PatternCondition("withSubTags") { + @Override public boolean accepts(@NotNull final XmlTag xmlTag, final ProcessingContext context) { return pattern.getCondition().accepts(Arrays.asList(xmlTag.getSubTags()), context); } diff --git a/xml/xml-psi-api/src/com/intellij/pom/xml/XmlChangeSet.java b/xml/xml-psi-api/src/com/intellij/pom/xml/XmlChangeSet.java index 4ea483566105..9e9a8d725ada 100644 --- a/xml/xml-psi-api/src/com/intellij/pom/xml/XmlChangeSet.java +++ b/xml/xml-psi-api/src/com/intellij/pom/xml/XmlChangeSet.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import java.util.List; public interface XmlChangeSet extends PomChangeSet { List getChanges(); + @Override @NotNull PomModelAspect getAspect(); diff --git a/xml/xml-psi-api/src/com/intellij/psi/XmlRecursiveElementVisitor.java b/xml/xml-psi-api/src/com/intellij/psi/XmlRecursiveElementVisitor.java index 6c99c53fc424..cb63266d76b9 100644 --- a/xml/xml-psi-api/src/com/intellij/psi/XmlRecursiveElementVisitor.java +++ b/xml/xml-psi-api/src/com/intellij/psi/XmlRecursiveElementVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ public class XmlRecursiveElementVisitor extends XmlElementVisitor { myVisitAllFileRoots = visitAllFileRoots; } + @Override public void visitElement(final PsiElement element) { element.acceptChildren(this); } diff --git a/xml/xml-psi-api/src/com/intellij/psi/filters/position/NamespaceFilter.java b/xml/xml-psi-api/src/com/intellij/psi/filters/position/NamespaceFilter.java index 88aba0702cfd..82bafa6818eb 100644 --- a/xml/xml-psi-api/src/com/intellij/psi/filters/position/NamespaceFilter.java +++ b/xml/xml-psi-api/src/com/intellij/psi/filters/position/NamespaceFilter.java @@ -29,10 +29,12 @@ public class NamespaceFilter implements ElementFilter { myNamespaces = namespaces; } + @Override public boolean isClassAcceptable(Class hintClass){ return ReflectionUtil.isAssignable(XmlTag.class, hintClass) || ReflectionUtil.isAssignable(XmlDocument.class, hintClass); } + @Override public boolean isAcceptable(Object element, PsiElement context){ if(element instanceof XmlTag){ final XmlTag psiElement = (XmlTag)element; diff --git a/xml/xml-psi-api/src/com/intellij/psi/xml/XmlElementDecl.java b/xml/xml-psi-api/src/com/intellij/psi/xml/XmlElementDecl.java index d18b990b12b1..7105f87ec8f8 100644 --- a/xml/xml-psi-api/src/com/intellij/psi/xml/XmlElementDecl.java +++ b/xml/xml-psi-api/src/com/intellij/psi/xml/XmlElementDecl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import org.jetbrains.annotations.Nullable; */ public interface XmlElementDecl extends XmlElement, PsiMetaOwner, PsiNameIdentifierOwner { XmlElement getNameElement(); + @Override @Nullable String getName(); XmlElementContentSpec getContentSpecElement(); } diff --git a/xml/xml-psi-api/src/com/intellij/psi/xml/XmlEntityDecl.java b/xml/xml-psi-api/src/com/intellij/psi/xml/XmlEntityDecl.java index 268b41c8b6b3..9901e61775de 100644 --- a/xml/xml-psi-api/src/com/intellij/psi/xml/XmlEntityDecl.java +++ b/xml/xml-psi-api/src/com/intellij/psi/xml/XmlEntityDecl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ public interface XmlEntityDecl extends XmlElement, PsiNamedElement { ENUMERATED_TYPE, ATTR_VALUE } + @Override String getName(); PsiElement getNameElement(); XmlAttributeValue getValueElement(); diff --git a/xml/xml-psi-api/src/com/intellij/xml/XmlSchemaProvider.java b/xml/xml-psi-api/src/com/intellij/xml/XmlSchemaProvider.java index 25e4f1d7e87d..622894d19053 100644 --- a/xml/xml-psi-api/src/com/intellij/xml/XmlSchemaProvider.java +++ b/xml/xml-psi-api/src/com/intellij/xml/XmlSchemaProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -83,6 +83,7 @@ public abstract class XmlSchemaProvider { public static List getAvailableProviders(@NotNull final XmlFile file) { return ContainerUtil.findAll(Extensions.getExtensions(EP_NAME), new Condition() { + @Override public boolean value(XmlSchemaProvider xmlSchemaProvider) { return xmlSchemaProvider.isAvailable(file); } diff --git a/xml/xml-psi-api/src/com/intellij/xml/util/XmlTagUtil.java b/xml/xml-psi-api/src/com/intellij/xml/util/XmlTagUtil.java index 4850c98cb95e..b5b086b4e9d6 100644 --- a/xml/xml-psi-api/src/com/intellij/xml/util/XmlTagUtil.java +++ b/xml/xml-psi-api/src/com/intellij/xml/util/XmlTagUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,12 +42,12 @@ public class XmlTagUtil extends XmlTagUtilBase { static { ourCharacterEntities = new HashMap(); - ourCharacterEntities.put("lt", new Character('<')); - ourCharacterEntities.put("gt", new Character('>')); - ourCharacterEntities.put("apos", new Character('\'')); - ourCharacterEntities.put("quot", new Character('\"')); - ourCharacterEntities.put("nbsp", new Character('\u00a0')); - ourCharacterEntities.put("amp", new Character('&')); + ourCharacterEntities.put("lt", '<'); + ourCharacterEntities.put("gt", '>'); + ourCharacterEntities.put("apos", '\''); + ourCharacterEntities.put("quot", '\"'); + ourCharacterEntities.put("nbsp", '\u00a0'); + ourCharacterEntities.put("amp", '&'); } /** diff --git a/xml/xml-psi-impl/src/com/intellij/application/options/editor/XmlFoldingSettings.java b/xml/xml-psi-impl/src/com/intellij/application/options/editor/XmlFoldingSettings.java index 397edc25decc..ada94b1e709c 100644 --- a/xml/xml-psi-impl/src/com/intellij/application/options/editor/XmlFoldingSettings.java +++ b/xml/xml-psi-impl/src/com/intellij/application/options/editor/XmlFoldingSettings.java @@ -60,20 +60,24 @@ public class XmlFoldingSettings implements XmlCodeFoldingSettings, PersistentSta @SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_XML_TAGS = false; @SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_HTML_STYLE_ATTRIBUTE = true; + @Override @NotNull public File[] getExportFiles() { return new File[]{PathManager.getOptionsFile("editor.codeinsight")}; } + @Override @NotNull public String getPresentableName() { return XmlBundle.message("xml.folding.settings"); } + @Override public XmlFoldingSettings getState() { return this; } + @Override public void loadState(final XmlFoldingSettings state) { XmlSerializerUtil.copyBean(state, this); } diff --git a/xml/xml-psi-impl/src/com/intellij/html/impl/RelaxedHtmlFromSchemaElementDescriptor.java b/xml/xml-psi-impl/src/com/intellij/html/impl/RelaxedHtmlFromSchemaElementDescriptor.java index 52a1920a1d9b..4f6f0d1b8f9e 100644 --- a/xml/xml-psi-impl/src/com/intellij/html/impl/RelaxedHtmlFromSchemaElementDescriptor.java +++ b/xml/xml-psi-impl/src/com/intellij/html/impl/RelaxedHtmlFromSchemaElementDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,6 +35,7 @@ public class RelaxedHtmlFromSchemaElementDescriptor extends XmlElementDescriptor super(tag); } + @Override public XmlElementDescriptor getElementDescriptor(XmlTag childTag, XmlTag contextTag) { XmlElementDescriptor elementDescriptor = super.getElementDescriptor(childTag, contextTag); @@ -45,6 +46,7 @@ public class RelaxedHtmlFromSchemaElementDescriptor extends XmlElementDescriptor return elementDescriptor; } + @Override public XmlElementDescriptor[] getElementsDescriptors(final XmlTag context) { return ArrayUtil.mergeArrays( super.getElementsDescriptors(context), @@ -64,6 +66,7 @@ public class RelaxedHtmlFromSchemaElementDescriptor extends XmlElementDescriptor return null; } + @Override public XmlAttributeDescriptor[] getAttributesDescriptors(final XmlTag context) { return addAttrDescriptorsForFacelets(context, super.getAttributesDescriptors(context)); } @@ -84,6 +87,7 @@ public class RelaxedHtmlFromSchemaElementDescriptor extends XmlElementDescriptor return getAttributeDescriptor(attribute.getName(), attribute.getParent()); } + @Override public XmlAttributeDescriptor getAttributeDescriptor(String attributeName, final XmlTag context) { final XmlAttributeDescriptor descriptor = super.getAttributeDescriptor(attributeName.toLowerCase(), context); if (descriptor != null) return descriptor; @@ -105,6 +109,7 @@ public class RelaxedHtmlFromSchemaElementDescriptor extends XmlElementDescriptor return null; } + @Override public boolean allowElementsFromNamespace(final String namespace, final XmlTag context) { return true; } diff --git a/xml/xml-psi-impl/src/com/intellij/html/impl/RelaxedHtmlFromSchemaNSDescriptor.java b/xml/xml-psi-impl/src/com/intellij/html/impl/RelaxedHtmlFromSchemaNSDescriptor.java index 06a9bc979947..0703377055e8 100644 --- a/xml/xml-psi-impl/src/com/intellij/html/impl/RelaxedHtmlFromSchemaNSDescriptor.java +++ b/xml/xml-psi-impl/src/com/intellij/html/impl/RelaxedHtmlFromSchemaNSDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class RelaxedHtmlFromSchemaNSDescriptor extends XmlNSDescriptorImpl implements RelaxedHtmlNSDescriptor { + @Override public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) { XmlElementDescriptor elementDescriptor = super.getElementDescriptor(tag); @@ -43,10 +44,12 @@ public class RelaxedHtmlFromSchemaNSDescriptor extends XmlNSDescriptorImpl imple return elementDescriptor; } + @Override protected XmlElementDescriptor createElementDescriptor(final XmlTag tag) { return new RelaxedHtmlFromSchemaElementDescriptor(tag); } + @Override @NotNull public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable final XmlDocument doc) { return ArrayUtil.mergeArrays(super.getRootElementsDescriptors(doc), HtmlUtil.getCustomTagDescriptors(doc)); diff --git a/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileHighlighter.java b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileHighlighter.java index 9f8510bd6f9e..715c068d80ae 100644 --- a/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileHighlighter.java +++ b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/HtmlFileHighlighter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -93,7 +93,7 @@ public class HtmlFileHighlighter extends SyntaxHighlighterBase { return SyntaxHighlighterBase.pack(XmlHighlighterColors.HTML_CODE, pack(keys1.get(tokenType), keys2.get(tokenType))); } - public static final void registerEmbeddedTokenAttributes(Map _keys1, + public static void registerEmbeddedTokenAttributes(Map _keys1, Map _keys2) { if (_keys1 != null) { for (Iterator iterator = _keys1.keySet().iterator(); iterator.hasNext();) { diff --git a/xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlFileHighlighter.java b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlFileHighlighter.java index 6c515a179b5f..e34dd98367ad 100644 --- a/xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlFileHighlighter.java +++ b/xml/xml-psi-impl/src/com/intellij/ide/highlighter/XmlFileHighlighter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,7 +28,6 @@ import com.intellij.psi.xml.XmlTokenType; import org.jetbrains.annotations.NotNull; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; public class XmlFileHighlighter extends SyntaxHighlighterBase { @@ -118,7 +117,7 @@ public class XmlFileHighlighter extends SyntaxHighlighterBase { keys2.put(XmlTokenType.XML_ENTITY_REF_TOKEN, XmlHighlighterColors.XML_ENTITY_REFERENCE); } - private boolean myIsDtd; + private final boolean myIsDtd; private boolean myIsXHtml; public XmlFileHighlighter() { @@ -152,19 +151,17 @@ public class XmlFileHighlighter extends SyntaxHighlighterBase { return pack(keys1.get(tokenType), keys2.get(tokenType)); } - public static final void registerEmbeddedTokenAttributes(Map _keys1, + public static void registerEmbeddedTokenAttributes(Map _keys1, Map _keys2) { if (_keys1!=null) { - for (Iterator iterator = _keys1.keySet().iterator(); iterator.hasNext();) { - IElementType iElementType = iterator.next(); - keys1.put(iElementType,_keys1.get(iElementType)); + for (IElementType iElementType : _keys1.keySet()) { + keys1.put(iElementType, _keys1.get(iElementType)); } } if (_keys2!=null) { - for (Iterator iterator = _keys2.keySet().iterator(); iterator.hasNext();) { - IElementType iElementType = iterator.next(); - keys2.put(iElementType,_keys2.get(iElementType)); + for (IElementType iElementType : _keys2.keySet()) { + keys2.put(iElementType, _keys2.get(iElementType)); } } } diff --git a/xml/xml-psi-impl/src/com/intellij/javaee/ExternalResourceManagerExImpl.java b/xml/xml-psi-impl/src/com/intellij/javaee/ExternalResourceManagerExImpl.java index 0a395e02b871..f27126af9b01 100644 --- a/xml/xml-psi-impl/src/com/intellij/javaee/ExternalResourceManagerExImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/javaee/ExternalResourceManagerExImpl.java @@ -105,6 +105,7 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { myPathMacros = pathMacros; } + @Override public boolean isStandardResource(VirtualFile file) { VirtualFile parent = file.getParent(); return parent != null && parent.getName().equals("standardSchemas"); @@ -133,10 +134,12 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { return map; } + @Override public String getResourceLocation(String url) { return getResourceLocation(url, DEFAULT_VERSION); } + @Override public String getResourceLocation(@NonNls String url, String version) { String result = getUserResource(url, version); if (result == null) { @@ -180,6 +183,7 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { return map != null ? map.get(url) : null; } + @Override public String getResourceLocation(@NonNls String url, @NotNull Project project) { String location = getProjectResources(project).getResourceLocation(url); return location == null || location.equals(url) ? getResourceLocation(url) : location; @@ -190,6 +194,7 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { return location == null || location.equals(url) ? getResourceLocation(url, version) : location; } + @Override @Nullable public PsiFile getResourceLocation(@NotNull @NonNls final String url, @NotNull final PsiFile baseFile, final String version) { final XmlFile schema = XmlSchemaProvider.findSchema(url, baseFile); @@ -200,10 +205,12 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { return XmlUtil.findXmlFile(baseFile, location); } + @Override public String[] getResourceUrls(FileType fileType, final boolean includeStandard) { return getResourceUrls(fileType, DEFAULT_VERSION, includeStandard); } + @Override public String[] getResourceUrls(@Nullable final FileType fileType, @NonNls final String version, final boolean includeStandard) { final List result = new LinkedList(); addResourcesFromMap(result, version, myResources); @@ -227,6 +234,7 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { public static void addTestResource(final String url, final String location, Disposable parentDisposable) { final ExternalResourceManagerExImpl instance = (ExternalResourceManagerExImpl)getInstance(); ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override public void run() { instance.addResource(url, location); } @@ -235,6 +243,7 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { @Override public void dispose() { ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override public void run() { instance.removeResource(url); } @@ -242,10 +251,12 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { } }); } + @Override public void addResource(String url, String location) { addResource(url, DEFAULT_VERSION, location); } + @Override public void addResource(@NonNls String url, @NonNls String version, @NonNls String location) { ApplicationManager.getApplication().assertWriteAccessAllowed(); addSilently(url, version, location); @@ -260,10 +271,12 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { myModificationCount++; } + @Override public void removeResource(String url) { removeResource(url, DEFAULT_VERSION); } + @Override public void removeResource(String url, String version) { ApplicationManager.getApplication().assertWriteAccessAllowed(); Map map = getMap(myResources, version, false); @@ -287,6 +300,7 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { getProjectResources(project).addResource(url, location); } + @Override public String[] getAvailableUrls() { Set urls = new HashSet(); for (Map map : myResources.values()) { @@ -300,11 +314,13 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { return getProjectResources(project).getAvailableUrls(); } + @Override public void clearAllResources() { myResources.clear(); myIgnoredResources.clear(); } + @Override public void clearAllResources(Project project) { ApplicationManager.getApplication().assertWriteAccessAllowed(); clearAllResources(); @@ -313,6 +329,7 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { fireExternalResourceChanged(); } + @Override public void addIgnoredResource(String url) { ApplicationManager.getApplication().assertWriteAccessAllowed(); addIgnoredSilently(url); @@ -324,6 +341,7 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { myModificationCount++; } + @Override public void removeIgnoredResource(String url) { ApplicationManager.getApplication().assertWriteAccessAllowed(); if (myIgnoredResources.remove(url)) { @@ -332,6 +350,7 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { } } + @Override public boolean isIgnoredResource(String url) { myStdResources.getValue(); // ensure ignored resources are loaded return myIgnoredResources.contains(url) || isImplicitNamespaceDescriptor(url); @@ -345,11 +364,13 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { return false; } + @Override public String[] getIgnoredResources() { myStdResources.getValue(); // ensure ignored resources are loaded return ArrayUtil.toStringArray(myIgnoredResources); } + @Override public long getModificationCount() { return myModificationCount; } @@ -359,7 +380,7 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { return getProjectResources(project).getModificationCount(); } - public void readExternal(Element element) throws InvalidDataException { + public void readExternal(Element element) { final ExpandMacroToPathMap macroExpands = new ExpandMacroToPathMap(); myPathMacros.addMacroExpands(macroExpands); macroExpands.substitute(element, SystemInfo.isFileSystemCaseSensitive); @@ -389,7 +410,7 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { } } - public void writeExternal(Element element) throws WriteExternalException { + public void writeExternal(Element element) { final String[] urls = getAvailableUrls(); for (String url : urls) { if (url == null) continue; @@ -425,10 +446,12 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { macroReplacements.substitute(element, SystemInfo.isFileSystemCaseSensitive); } + @Override public void addExternalResourceListener(ExternalResourceListener listener) { myListeners.add(listener); } + @Override public void removeExternalResourceListener(ExternalResourceListener listener) { myListeners.remove(listener); } @@ -505,6 +528,7 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { @TestOnly public static void registerResourceTemporarily(final String url, final String location, Disposable disposable) { ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override public void run() { getInstance().addResource(url, location); } @@ -514,6 +538,7 @@ public class ExternalResourceManagerExImpl extends ExternalResourceManagerEx { @Override public void dispose() { ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override public void run() { getInstance().removeResource(url); } diff --git a/xml/xml-psi-impl/src/com/intellij/javaee/InternalResourceProvider.java b/xml/xml-psi-impl/src/com/intellij/javaee/InternalResourceProvider.java index d9755ad98847..673540ef38e8 100644 --- a/xml/xml-psi-impl/src/com/intellij/javaee/InternalResourceProvider.java +++ b/xml/xml-psi-impl/src/com/intellij/javaee/InternalResourceProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import com.intellij.xml.util.XmlUtil; */ public class InternalResourceProvider implements StandardResourceProvider{ + @Override public void registerResources(ResourceRegistrar registrar) { ResourceRegistrarImpl impl = (ResourceRegistrarImpl)registrar; diff --git a/xml/xml-psi-impl/src/com/intellij/javaee/ProjectResources.java b/xml/xml-psi-impl/src/com/intellij/javaee/ProjectResources.java index 3df6e0f3c284..d69dc15b7a57 100644 --- a/xml/xml-psi-impl/src/com/intellij/javaee/ProjectResources.java +++ b/xml/xml-psi-impl/src/com/intellij/javaee/ProjectResources.java @@ -44,10 +44,12 @@ public class ProjectResources extends ExternalResourceManagerExImpl implements P return Collections.emptyMap(); } + @Override public Element getState() { return myAdapter.getState(); } + @Override public void loadState(Element state) { myAdapter.loadState(state); } diff --git a/xml/xml-psi-impl/src/com/intellij/javaee/ResourceRegistrarImpl.java b/xml/xml-psi-impl/src/com/intellij/javaee/ResourceRegistrarImpl.java index d660b259d642..a0fa57929f14 100644 --- a/xml/xml-psi-impl/src/com/intellij/javaee/ResourceRegistrarImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/javaee/ResourceRegistrarImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,10 +32,12 @@ public class ResourceRegistrarImpl implements ResourceRegistrar { private final Map> myResources = new HashMap>(); private final List myIgnored = new ArrayList(); + @Override public void addStdResource(@NonNls String resource, @NonNls String fileName) { addStdResource(resource, null, fileName, getClass()); } + @Override public void addStdResource(@NonNls String resource, @NonNls String fileName, Class klass) { addStdResource(resource, null, fileName, klass); } @@ -47,10 +49,12 @@ public class ResourceRegistrarImpl implements ResourceRegistrar { map.put(resource, new ExternalResourceManagerExImpl.Resource(fileName, klass, classLoader)); } + @Override public void addStdResource(@NonNls String resource, @Nullable @NonNls String version, @NonNls String fileName, Class klass) { addStdResource(resource, version, fileName, klass, null); } + @Override public void addIgnoredResource(@NonNls String url) { myIgnored.add(url); } diff --git a/xml/xml-psi-impl/src/com/intellij/javaee/XMLCatalogManager.java b/xml/xml-psi-impl/src/com/intellij/javaee/XMLCatalogManager.java index c9eacea92662..d3d7d39dc446 100644 --- a/xml/xml-psi-impl/src/com/intellij/javaee/XMLCatalogManager.java +++ b/xml/xml-psi-impl/src/com/intellij/javaee/XMLCatalogManager.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,8 +37,8 @@ public class XMLCatalogManager { private final static Logger LOG = Logger.getInstance(XMLCatalogManager.class); - private static Field ourResources; - private static Field ourPropertyFileUri; + private static final Field ourResources; + private static final Field ourPropertyFileUri; static { try { @@ -48,7 +48,7 @@ public class XMLCatalogManager { ourPropertyFileUri.setAccessible(true); } catch (NoSuchFieldException e) { - LOG.error(e); + throw new RuntimeException(e); } } diff --git a/xml/xml-psi-impl/src/com/intellij/lang/XmlCodeFoldingBuilder.java b/xml/xml-psi-impl/src/com/intellij/lang/XmlCodeFoldingBuilder.java index 959f3a4919a9..db2fd348a71e 100644 --- a/xml/xml-psi-impl/src/com/intellij/lang/XmlCodeFoldingBuilder.java +++ b/xml/xml-psi-impl/src/com/intellij/lang/XmlCodeFoldingBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,6 +46,7 @@ public abstract class XmlCodeFoldingBuilder implements FoldingBuilder, DumbAware private static final int MIN_TEXT_RANGE_LENGTH = 3; private static final String STYLE_ATTRIBUTE = "style"; + @Override @NotNull public FoldingDescriptor[] buildFoldRegions(@NotNull ASTNode node, @NotNull Document document) { final PsiElement psiElement = node.getPsi(); @@ -217,6 +218,7 @@ public abstract class XmlCodeFoldingBuilder implements FoldingBuilder, DumbAware return false; } + @Override public String getPlaceholderText(@NotNull ASTNode node) { final PsiElement psi = node.getPsi(); if (psi instanceof XmlTag || @@ -227,6 +229,7 @@ public abstract class XmlCodeFoldingBuilder implements FoldingBuilder, DumbAware return null; } + @Override public boolean isCollapsedByDefault(@NotNull ASTNode node) { final PsiElement psi = node.getPsi(); final XmlCodeFoldingSettings foldingSettings = getFoldingSettings(); diff --git a/xml/xml-psi-impl/src/com/intellij/lang/dtd/DTDParserDefinition.java b/xml/xml-psi-impl/src/com/intellij/lang/dtd/DTDParserDefinition.java index 541aa16a72f7..8197314a18c6 100644 --- a/xml/xml-psi-impl/src/com/intellij/lang/dtd/DTDParserDefinition.java +++ b/xml/xml-psi-impl/src/com/intellij/lang/dtd/DTDParserDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,10 +37,12 @@ import org.jetbrains.annotations.NotNull; * @author max */ public class DTDParserDefinition extends XMLParserDefinition { + @Override public SpaceRequirements spaceExistanceTypeBetweenTokens(ASTNode left, ASTNode right) { return LanguageUtil.canStickTokensTogetherByLexer(left, right, new DtdLexer(false)); } + @Override public PsiFile createFile(FileViewProvider viewProvider) { return new XmlFileImpl(viewProvider, XmlElementType.DTD_FILE); } diff --git a/xml/xml-psi-impl/src/com/intellij/lang/dtd/DtdSyntaxHighlighterFactory.java b/xml/xml-psi-impl/src/com/intellij/lang/dtd/DtdSyntaxHighlighterFactory.java index 8095517bcdb5..c57c77a23ec2 100644 --- a/xml/xml-psi-impl/src/com/intellij/lang/dtd/DtdSyntaxHighlighterFactory.java +++ b/xml/xml-psi-impl/src/com/intellij/lang/dtd/DtdSyntaxHighlighterFactory.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.lang.dtd; import com.intellij.ide.highlighter.XmlFileHighlighter; @@ -6,6 +21,7 @@ import com.intellij.openapi.fileTypes.SyntaxHighlighter; import org.jetbrains.annotations.NotNull; public class DtdSyntaxHighlighterFactory extends SingleLazyInstanceSyntaxHighlighterFactory { + @Override @NotNull protected SyntaxHighlighter createHighlighter() { return new XmlFileHighlighter(true); diff --git a/xml/xml-psi-impl/src/com/intellij/lang/html/HTMLParser.java b/xml/xml-psi-impl/src/com/intellij/lang/html/HTMLParser.java index db0c3e263923..89bb48e4fc85 100644 --- a/xml/xml-psi-impl/src/com/intellij/lang/html/HTMLParser.java +++ b/xml/xml-psi-impl/src/com/intellij/lang/html/HTMLParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ import org.jetbrains.annotations.NotNull; public class HTMLParser implements PsiParser { + @Override @NotNull public ASTNode parse(final IElementType root, final PsiBuilder builder) { parseWithoutBuildingTree(root, builder); diff --git a/xml/xml-psi-impl/src/com/intellij/lang/html/HTMLParserDefinition.java b/xml/xml-psi-impl/src/com/intellij/lang/html/HTMLParserDefinition.java index 0e3dc6685097..8690f87fa414 100644 --- a/xml/xml-psi-impl/src/com/intellij/lang/html/HTMLParserDefinition.java +++ b/xml/xml-psi-impl/src/com/intellij/lang/html/HTMLParserDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,35 +38,42 @@ import org.jetbrains.annotations.NotNull; * @author max */ public class HTMLParserDefinition implements ParserDefinition { + @Override @NotNull public Lexer createLexer(Project project) { return new HtmlLexer(); } + @Override public IFileElementType getFileNodeType() { return XmlElementType.HTML_FILE; } + @Override @NotNull public TokenSet getWhitespaceTokens() { return XmlTokenType.WHITESPACES; } + @Override @NotNull public TokenSet getCommentTokens() { return XmlTokenType.COMMENTS; } + @Override @NotNull public TokenSet getStringLiteralElements() { return TokenSet.EMPTY; } + @Override @NotNull public PsiParser createParser(final Project project) { return new HTMLParser(); } + @Override @NotNull public PsiElement createElement(ASTNode node) { if (node.getElementType() == XmlElementType.HTML_EMBEDDED_CONTENT) { @@ -75,10 +82,12 @@ public class HTMLParserDefinition implements ParserDefinition { return PsiUtilCore.NULL_PSI_ELEMENT; } + @Override public PsiFile createFile(FileViewProvider viewProvider) { return new HtmlFileImpl(viewProvider); } + @Override public SpaceRequirements spaceExistanceTypeBetweenTokens(ASTNode left, ASTNode right) { final Lexer lexer = createLexer(left.getPsi().getProject()); return XMLParserDefinition.canStickTokensTogetherByLexerInXml(left, right, lexer, 0); diff --git a/xml/xml-psi-impl/src/com/intellij/lang/html/HtmlSyntaxHighlighterFactory.java b/xml/xml-psi-impl/src/com/intellij/lang/html/HtmlSyntaxHighlighterFactory.java index 25c491355495..23b2f552512b 100644 --- a/xml/xml-psi-impl/src/com/intellij/lang/html/HtmlSyntaxHighlighterFactory.java +++ b/xml/xml-psi-impl/src/com/intellij/lang/html/HtmlSyntaxHighlighterFactory.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.lang.html; import com.intellij.ide.highlighter.HtmlFileHighlighter; @@ -6,6 +21,7 @@ import com.intellij.openapi.fileTypes.SyntaxHighlighter; import org.jetbrains.annotations.NotNull; public class HtmlSyntaxHighlighterFactory extends SingleLazyInstanceSyntaxHighlighterFactory { + @Override @NotNull protected SyntaxHighlighter createHighlighter() { return new HtmlFileHighlighter(); diff --git a/xml/xml-psi-impl/src/com/intellij/lang/xhtml/XHTMLParserDefinition.java b/xml/xml-psi-impl/src/com/intellij/lang/xhtml/XHTMLParserDefinition.java index 93b34c035233..098d58bc12c7 100644 --- a/xml/xml-psi-impl/src/com/intellij/lang/xhtml/XHTMLParserDefinition.java +++ b/xml/xml-psi-impl/src/com/intellij/lang/xhtml/XHTMLParserDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,16 +31,19 @@ import org.jetbrains.annotations.NotNull; */ public class XHTMLParserDefinition extends XMLParserDefinition { + @Override @NotNull public Lexer createLexer(Project project) { return new XHtmlLexer(); } + @Override public SpaceRequirements spaceExistanceTypeBetweenTokens(ASTNode left, ASTNode right) { final Lexer lexer = createLexer(left.getPsi().getProject()); return canStickTokensTogetherByLexerInXml(left, right, lexer, 0); } + @Override public PsiFile createFile(FileViewProvider viewProvider) { return new XmlFileImpl(viewProvider, XmlElementType.XHTML_FILE); } diff --git a/xml/xml-psi-impl/src/com/intellij/lang/xhtml/XhtmlSyntaxHighlighterFactory.java b/xml/xml-psi-impl/src/com/intellij/lang/xhtml/XhtmlSyntaxHighlighterFactory.java index 108fed274c14..6f09db4edeea 100644 --- a/xml/xml-psi-impl/src/com/intellij/lang/xhtml/XhtmlSyntaxHighlighterFactory.java +++ b/xml/xml-psi-impl/src/com/intellij/lang/xhtml/XhtmlSyntaxHighlighterFactory.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.lang.xhtml; import com.intellij.ide.highlighter.XmlFileHighlighter; @@ -6,6 +21,7 @@ import com.intellij.openapi.fileTypes.SyntaxHighlighter; import org.jetbrains.annotations.NotNull; public class XhtmlSyntaxHighlighterFactory extends SingleLazyInstanceSyntaxHighlighterFactory { + @Override @NotNull protected SyntaxHighlighter createHighlighter() { return new XmlFileHighlighter(false, true); diff --git a/xml/xml-psi-impl/src/com/intellij/lang/xml/XMLParserDefinition.java b/xml/xml-psi-impl/src/com/intellij/lang/xml/XMLParserDefinition.java index a25df7758b13..b37cc3546629 100644 --- a/xml/xml-psi-impl/src/com/intellij/lang/xml/XMLParserDefinition.java +++ b/xml/xml-psi-impl/src/com/intellij/lang/xml/XMLParserDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,44 +37,53 @@ import org.jetbrains.annotations.NotNull; * @author max */ public class XMLParserDefinition implements ParserDefinition { + @Override @NotNull public Lexer createLexer(Project project) { return new XmlLexer(); } + @Override public IFileElementType getFileNodeType() { return XmlElementType.XML_FILE; } + @Override @NotNull public TokenSet getWhitespaceTokens() { return XmlTokenType.WHITESPACES; } + @Override @NotNull public TokenSet getCommentTokens() { return XmlTokenType.COMMENTS; } + @Override @NotNull public TokenSet getStringLiteralElements() { return TokenSet.EMPTY; } + @Override @NotNull public PsiParser createParser(final Project project) { return new XmlParser(); } + @Override @NotNull public PsiElement createElement(ASTNode node) { return PsiUtilCore.NULL_PSI_ELEMENT; } + @Override public PsiFile createFile(FileViewProvider viewProvider) { return new XmlFileImpl(viewProvider, XmlElementType.XML_FILE); } + @Override public SpaceRequirements spaceExistanceTypeBetweenTokens(ASTNode left, ASTNode right) { final Lexer lexer = createLexer(left.getPsi().getProject()); return canStickTokensTogetherByLexerInXml(left, right, lexer, 0); diff --git a/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlSyntaxHighlighterFactory.java b/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlSyntaxHighlighterFactory.java index 152b2bb28bcd..cd5b675565a9 100644 --- a/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlSyntaxHighlighterFactory.java +++ b/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlSyntaxHighlighterFactory.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.lang.xml; import com.intellij.ide.highlighter.XmlFileHighlighter; @@ -6,6 +21,7 @@ import com.intellij.openapi.fileTypes.SyntaxHighlighter; import org.jetbrains.annotations.NotNull; public class XmlSyntaxHighlighterFactory extends SingleLazyInstanceSyntaxHighlighterFactory { + @Override @NotNull protected SyntaxHighlighter createHighlighter() { return new XmlFileHighlighter(); diff --git a/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlTemplateTreePatcher.java b/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlTemplateTreePatcher.java index 0669461187c6..7cdb9311064f 100644 --- a/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlTemplateTreePatcher.java +++ b/xml/xml-psi-impl/src/com/intellij/lang/xml/XmlTemplateTreePatcher.java @@ -25,6 +25,7 @@ import com.intellij.psi.xml.XmlTokenType; import com.intellij.util.CharTable; public class XmlTemplateTreePatcher implements TreePatcher { + @Override public void insert(CompositeElement parent, TreeElement anchorBefore, OuterLanguageElement toInsert) { if(anchorBefore != null) { //[mike] @@ -39,6 +40,7 @@ public class XmlTemplateTreePatcher implements TreePatcher { else parent.rawAddChildren((TreeElement)toInsert); } + @Override public LeafElement split(LeafElement leaf, int offset, final CharTable table) { final CharSequence chars = leaf.getChars(); final LeafElement leftPart = ASTFactory.leaf(leaf.getElementType(), table.intern(chars, 0, offset)); diff --git a/xml/xml-psi-impl/src/com/intellij/lexer/BaseHtmlLexer.java b/xml/xml-psi-impl/src/com/intellij/lexer/BaseHtmlLexer.java index 7e2c1727d63b..3e01e209c5eb 100644 --- a/xml/xml-psi-impl/src/com/intellij/lexer/BaseHtmlLexer.java +++ b/xml/xml-psi-impl/src/com/intellij/lexer/BaseHtmlLexer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,7 +47,7 @@ abstract class BaseHtmlLexer extends DelegateLexer { private static final int SEEN_CONTENT_TYPE = 0x400; protected static final int BASE_STATE_SHIFT = 11; @Nullable - protected static Language ourDefaultLanguage = Language.findLanguageByID("JavaScript"); + protected static final Language ourDefaultLanguage = Language.findLanguageByID("JavaScript"); private boolean seenTag; private boolean seenAttribute; diff --git a/xml/xml-psi-impl/src/com/intellij/lexer/HtmlHighlightingLexer.java b/xml/xml-psi-impl/src/com/intellij/lexer/HtmlHighlightingLexer.java index 1303d56d7591..eeae1d318e15 100644 --- a/xml/xml-psi-impl/src/com/intellij/lexer/HtmlHighlightingLexer.java +++ b/xml/xml-psi-impl/src/com/intellij/lexer/HtmlHighlightingLexer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ public class HtmlHighlightingLexer extends BaseHtmlLexer { protected Lexer elLexer; private boolean hasNoEmbeddments; private final FileType ourStyleFileType;// = FileTypeManager.getInstance().getStdFileType("CSS"); - private static FileType ourInlineScriptFileType = null; + private static final FileType ourInlineScriptFileType; static { diff --git a/xml/xml-psi-impl/src/com/intellij/lexer/XHtmlLexer.java b/xml/xml-psi-impl/src/com/intellij/lexer/XHtmlLexer.java index 784198ced9c2..b108e9c722bb 100644 --- a/xml/xml-psi-impl/src/com/intellij/lexer/XHtmlLexer.java +++ b/xml/xml-psi-impl/src/com/intellij/lexer/XHtmlLexer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ public class XHtmlLexer extends HtmlLexer { this(new XmlLexer(true)); } + @Override protected boolean isHtmlTagState(int state) { return state == __XmlLexer.TAG || state == __XmlLexer.END_TAG; } diff --git a/xml/xml-psi-impl/src/com/intellij/lexer/XmlHighlightingLexer.java b/xml/xml-psi-impl/src/com/intellij/lexer/XmlHighlightingLexer.java index e4857748841f..65485236e353 100644 --- a/xml/xml-psi-impl/src/com/intellij/lexer/XmlHighlightingLexer.java +++ b/xml/xml-psi-impl/src/com/intellij/lexer/XmlHighlightingLexer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ public class XmlHighlightingLexer extends DelegateLexer { super(new XmlLexer()); } + @Override public IElementType getTokenType() { IElementType tokenType = getDelegate().getTokenType(); diff --git a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/XmlAspectChangeSetImpl.java b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/XmlAspectChangeSetImpl.java index eb9da7bc8cbb..9aa3054a5148 100644 --- a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/XmlAspectChangeSetImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/XmlAspectChangeSetImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,15 +46,18 @@ public class XmlAspectChangeSetImpl implements XmlChangeSet { } } + @Override public List getChanges(){ return Collections.unmodifiableList(myChanges); } + @Override @NotNull public PomModelAspect getAspect() { return myModel.getModelAspect(XmlAspect.class); } + @Override public void merge(@NotNull PomChangeSet blocked) { final List changes = ((XmlAspectChangeSetImpl)blocked).myChanges; for (XmlChange xmlChange : changes) { @@ -62,21 +65,24 @@ public class XmlAspectChangeSetImpl implements XmlChangeSet { } } + @Override public void add(XmlChange xmlChange) { myChanges.add(xmlChange); } + @Override public void clear() { myChanges.clear(); } + @Override @NotNull public Iterable getChangedFiles() { return myChangedFiles; } public String toString(){ - final StringBuffer buffer = new StringBuffer(); + final StringBuilder buffer = new StringBuilder(); final Iterator iterator = myChanges.iterator(); while (iterator.hasNext()) { XmlChange xmlChange = iterator.next(); @@ -88,6 +94,7 @@ public class XmlAspectChangeSetImpl implements XmlChangeSet { return buffer.toString(); } + @Override public void addChangedFile(@NotNull final XmlFile xmlFile) { myChangedFiles.add(xmlFile); } diff --git a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlAttributeSetImpl.java b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlAttributeSetImpl.java index 2f9f08e4a7e0..4f2a013ba7f7 100644 --- a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlAttributeSetImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlAttributeSetImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,14 +35,17 @@ public class XmlAttributeSetImpl implements XmlAttributeSet { myTag = xmlTag; } + @Override public String getName() { return myName; } + @Override public String getValue() { return myValue; } + @Override public XmlTag getTag() { return myTag; } diff --git a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlDocumentChangedImpl.java b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlDocumentChangedImpl.java index 2bad3d23b66d..3b406552929b 100644 --- a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlDocumentChangedImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlDocumentChangedImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ public class XmlDocumentChangedImpl implements XmlDocumentChanged { myDocument = document; } + @Override public XmlDocument getDocument() { return myDocument; } diff --git a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagChildAddImpl.java b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagChildAddImpl.java index 21024aa15bbc..94b4e063542f 100644 --- a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagChildAddImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagChildAddImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,10 +27,12 @@ public class XmlTagChildAddImpl implements XmlTagChildAdd { myChild = treeElement; } + @Override public XmlTag getTag() { return myTag; } + @Override public XmlTagChild getChild() { return myChild; } diff --git a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagNameChangedImpl.java b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagNameChangedImpl.java index db972eb8536d..35a65c9d078c 100644 --- a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagNameChangedImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTagNameChangedImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,10 +33,12 @@ public class XmlTagNameChangedImpl implements XmlTagNameChanged { myTag = tag; } + @Override public String getOldName() { return myOldName; } + @Override public XmlTag getTag() { return myTag; } diff --git a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTextChangedImpl.java b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTextChangedImpl.java index 78fa37e03b49..77d0899e64ff 100644 --- a/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTextChangedImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/pom/xml/impl/events/XmlTextChangedImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,10 +33,12 @@ public class XmlTextChangedImpl implements XmlTextChanged { myText = xmlText; } + @Override public String getOldText() { return myOldText; } + @Override public XmlText getText() { return myText; } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/filters/XmlTagFilter.java b/xml/xml-psi-impl/src/com/intellij/psi/filters/XmlTagFilter.java index 2b2e7737bf4b..7dd7727e286c 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/filters/XmlTagFilter.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/filters/XmlTagFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,10 +27,12 @@ public class XmlTagFilter implements ElementFilter { private XmlTagFilter() {} + @Override public boolean isAcceptable(Object element, PsiElement context) { return element instanceof XmlTag; } + @Override public boolean isClassAcceptable(Class hintClass) { return true; } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/filters/XmlTextFilter.java b/xml/xml-psi-impl/src/com/intellij/psi/filters/XmlTextFilter.java index 9f633432616e..265911962240 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/filters/XmlTextFilter.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/filters/XmlTextFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -56,10 +56,12 @@ public class XmlTextFilter implements ElementFilter, InitializableFilter{ myValue[1] = value2; } + @Override public boolean isClassAcceptable(Class hintClass){ return true; } + @Override public boolean isAcceptable(Object element, PsiElement context){ if(element != null) { for (final String value : myValue) { @@ -91,6 +93,7 @@ public class XmlTextFilter implements ElementFilter, InitializableFilter{ return ret; } + @Override public void init(Object[] fromGetter){ try{ myValue = new String[fromGetter.length]; diff --git a/xml/xml-psi-impl/src/com/intellij/psi/filters/position/TargetNamespaceFilter.java b/xml/xml-psi-impl/src/com/intellij/psi/filters/position/TargetNamespaceFilter.java index 1c5e2cae0b03..c738f4560674 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/filters/position/TargetNamespaceFilter.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/filters/position/TargetNamespaceFilter.java @@ -37,10 +37,12 @@ public class TargetNamespaceFilter extends XmlTextFilter { super(strs); } + @Override public boolean isClassAcceptable(Class hintClass){ return ReflectionUtil.isAssignable(XmlTag.class, hintClass) || ReflectionUtil.isAssignable(XmlDocument.class, hintClass); } + @Override public boolean isAcceptable(Object element, PsiElement context){ if(element instanceof XmlTag){ final String attributeValue = ((XmlTag)element).getAttributeValue("targetNamespace"); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/filters/position/XmlTokenTypeFilter.java b/xml/xml-psi-impl/src/com/intellij/psi/filters/position/XmlTokenTypeFilter.java index fca6f8995e8c..bd96f5cb4ac3 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/filters/position/XmlTokenTypeFilter.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/filters/position/XmlTokenTypeFilter.java @@ -38,10 +38,12 @@ public class XmlTokenTypeFilter implements ElementFilter{ myType = type; } + @Override public boolean isClassAcceptable(Class hintClass){ return ReflectionUtil.isAssignable(XmlToken.class, hintClass); } + @Override public boolean isAcceptable(Object element, PsiElement context){ if(element instanceof PsiElement) { final ASTNode node = ((PsiElement)element).getNode(); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlFilterLexer.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlFilterLexer.java index 0b4d5c20b7e2..c1dd31d91ec6 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlFilterLexer.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlFilterLexer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,6 +49,7 @@ public class XmlFilterLexer extends BaseFilterLexer { super(originalLexer, table); } + @Override public void advance() { final IElementType tokenType = myDelegate.getTokenType(); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlIdIndexer.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlIdIndexer.java index ba047854274c..502f8af8d9f8 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlIdIndexer.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlIdIndexer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import com.intellij.psi.impl.cache.impl.OccurrenceConsumer; import com.intellij.psi.impl.cache.impl.id.LexerBasedIdIndexer; public class XmlIdIndexer extends LexerBasedIdIndexer { + @Override public Lexer createLexer(final OccurrenceConsumer consumer) { return createIndexingLexer(consumer); } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlConditionalCommentInjector.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlConditionalCommentInjector.java index d78e94172080..395b40cf5b7b 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlConditionalCommentInjector.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlConditionalCommentInjector.java @@ -77,6 +77,7 @@ public class HtmlConditionalCommentInjector implements MultiHostInjector { return endOfEnd == null ? null : Pair.create(conditionalStart, conditionalEnd); } + @Override public void getLanguagesToInject(@NotNull final MultiHostRegistrar registrar, @NotNull final PsiElement host) { Pair pair = parseConditionalCommentBoundaries(host); if (pair == null) { @@ -93,6 +94,7 @@ public class HtmlConditionalCommentInjector implements MultiHostInjector { } } + @Override @NotNull public List> elementsToInjectIn() { return Arrays.asList(PsiComment.class); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlDocumentImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlDocumentImpl.java index 7aa9ce9f2d9f..864a854b69f5 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlDocumentImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlDocumentImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ public class HtmlDocumentImpl extends XmlDocumentImpl { super(XmlElementType.HTML_DOCUMENT); } + @Override public XmlTag getRootTag() { return (XmlTag)findElementByTokenType(XmlElementType.HTML_TAG); } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlEmbeddedContentImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlEmbeddedContentImpl.java index 8cdeb23a0efe..7a37200c039f 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlEmbeddedContentImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlEmbeddedContentImpl.java @@ -33,24 +33,28 @@ public class HtmlEmbeddedContentImpl extends ASTWrapperPsiElement implements Xml super(node); } + @Override public XmlTag getParentTag() { final PsiElement parent = getParent(); if (parent instanceof XmlTag) return (XmlTag)parent; return null; } + @Override public XmlTagChild getNextSiblingInTag() { PsiElement nextSibling = getNextSibling(); if (nextSibling instanceof XmlTagChild) return (XmlTagChild)nextSibling; return null; } + @Override public XmlTagChild getPrevSiblingInTag() { final PsiElement prevSibling = getPrevSibling(); if (prevSibling instanceof XmlTagChild) return (XmlTagChild)prevSibling; return null; } + @Override public boolean processElements(PsiElementProcessor processor, PsiElement place) { // TODO return true; diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlTagImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlTagImpl.java index 843514d4d88c..c6afcbe5b1b4 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlTagImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/HtmlTagImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ public class HtmlTagImpl extends XmlTagImpl implements HtmlTag { super(XmlElementType.HTML_TAG); } + @Override @NotNull public XmlTag[] findSubTags(String name, String namespace) { final XmlTag[] subTags = getSubTags(); @@ -66,25 +67,30 @@ public class HtmlTagImpl extends XmlTagImpl implements HtmlTag { return result == null ? EMPTY : result.toArray(new XmlTag[result.size()]); } + @Override protected boolean isCaseSensitive() { return false; } + @Override public String getAttributeValue(String qname) { qname = qname.toLowerCase(); return super.getAttributeValue(qname); } + @Override protected void cacheOneAttributeValue(String name, String value, final Map attributesValueMap) { name = name.toLowerCase(); super.cacheOneAttributeValue(name, value, attributesValueMap); } + @Override public String getAttributeValue(String name, String namespace) { name = name.toLowerCase(); return super.getAttributeValue(name, namespace); } + @Override @NotNull public String getNamespace() { final String xmlNamespace = super.getNamespace(); @@ -101,6 +107,7 @@ public class HtmlTagImpl extends XmlTagImpl implements HtmlTag { return xmlNamespace; } + @Override protected String getRealNs(final String value) { if (XmlUtil.XHTML_URI.equals(value)) return XmlUtil.HTML_URI; return value; @@ -110,6 +117,7 @@ public class HtmlTagImpl extends XmlTagImpl implements HtmlTag { return "HtmlTag:" + getName(); } + @Override public String getPrefixByNamespace(String namespace) { if (XmlUtil.HTML_URI.equals(namespace)) namespace = XmlUtil.XHTML_URI; return super.getPrefixByNamespace(namespace); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlAttributeDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlAttributeDescriptorImpl.java index 7204bf720403..eaa52b87534f 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlAttributeDescriptorImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlAttributeDescriptorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,56 +34,69 @@ public class HtmlAttributeDescriptorImpl extends BasicXmlAttributeDescriptor { myCaseSensitive = caseSensitive; } + @Override public boolean isRequired() { return delegate.isRequired(); } + @Override public boolean isFixed() { return delegate.isFixed(); } + @Override public boolean hasIdType() { return delegate.hasIdType(); } + @Override public boolean hasIdRefType() { return delegate.hasIdRefType(); } + @Override public String getDefaultValue() { return delegate.getDefaultValue(); } //todo: refactor to hierarchy of value descriptor? + @Override public boolean isEnumerated() { return delegate.isEnumerated(); } + @Override public String[] getEnumeratedValues() { return delegate.getEnumeratedValues(); } + @Override public String validateValue(XmlElement context, String value) { if (!myCaseSensitive) value = value.toLowerCase(); return delegate.validateValue(context, value); } + @Override public PsiElement getDeclaration() { return delegate.getDeclaration(); } + @Override public String getName(PsiElement context) { return delegate.getName(context); } + @Override public String getName() { return delegate.getName(); } + @Override public void init(PsiElement element) { delegate.init(element); } + @Override public Object[] getDependences() { return ArrayUtil.EMPTY_OBJECT_ARRAY; } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlElementDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlElementDescriptorImpl.java index bd9085a50b42..aec421651439 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlElementDescriptorImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlElementDescriptorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,15 +42,18 @@ public class HtmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl { myCaseSensitive = caseSensitive; } + @Override public String getQualifiedName() { return myDelegate.getQualifiedName(); } + @Override public String getDefaultName() { return myDelegate.getDefaultName(); } // Read-only calculation + @Override protected final XmlElementDescriptor[] doCollectXmlDescriptors(final XmlTag context) { XmlElementDescriptor[] elementsDescriptors = myDelegate.getElementsDescriptors(context); XmlElementDescriptor[] temp = new XmlElementDescriptor[elementsDescriptors.length]; @@ -61,6 +64,7 @@ public class HtmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl { return temp; } + @Override public XmlElementDescriptor getElementDescriptor(XmlTag element, XmlTag contextTag) { String name = element.getName(); if (!myCaseSensitive) name = name.toLowerCase(); @@ -74,6 +78,7 @@ public class HtmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl { } // Read-only calculation + @Override protected HashMap collectElementDescriptorsMap(final XmlTag element) { final HashMap hashMap = new HashMap(); final XmlElementDescriptor[] elementDescriptors = myDelegate.getElementsDescriptors(element); @@ -85,6 +90,7 @@ public class HtmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl { } // Read-only calculation + @Override protected XmlAttributeDescriptor[] collectAttributeDescriptors(final XmlTag context) { final XmlAttributeDescriptor[] attributesDescriptors = myDelegate.getAttributesDescriptors(context); XmlAttributeDescriptor[] temp = new XmlAttributeDescriptor[attributesDescriptors.length]; @@ -95,6 +101,7 @@ public class HtmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl { return temp; } + @Override public XmlAttributeDescriptor getAttributeDescriptor(String attributeName, final XmlTag context) { String caseSensitiveAttributeName = !myCaseSensitive ? attributeName.toLowerCase() : attributeName; XmlAttributeDescriptor descriptor = super.getAttributeDescriptor(caseSensitiveAttributeName, context); @@ -118,6 +125,7 @@ public class HtmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl { } // Read-only calculation + @Override protected HashMap collectAttributeDescriptorsMap(final XmlTag context) { final HashMap hashMap = new HashMap(); XmlAttributeDescriptor[] elementAttributeDescriptors = myDelegate.getAttributesDescriptors(context); @@ -131,34 +139,42 @@ public class HtmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl { return hashMap; } + @Override public XmlNSDescriptor getNSDescriptor() { return myDelegate.getNSDescriptor(); } + @Override public int getContentType() { return myDelegate.getContentType(); } + @Override public PsiElement getDeclaration() { return myDelegate.getDeclaration(); } + @Override public String getName(PsiElement context) { return myDelegate.getName(context); } + @Override public String getName() { return myDelegate.getName(); } + @Override public void init(PsiElement element) { myDelegate.init(element); } + @Override public Object[] getDependences() { return myDelegate.getDependences(); } + @Override public XmlAttributeDescriptor[] getAttributesDescriptors(final XmlTag context) { return RelaxedHtmlFromSchemaElementDescriptor.addAttrDescriptorsForFacelets(context, super.getAttributesDescriptors(context)); } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlNSDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlNSDescriptorImpl.java index 368efbf89ea2..daf7de410668 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlNSDescriptorImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/html/dtd/HtmlNSDescriptorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,14 +41,17 @@ public class HtmlNSDescriptorImpl implements XmlNSDescriptor, DumbAware, XmlNSTy private final boolean myCaseSensitive; private static final SimpleFieldCache, HtmlNSDescriptorImpl> myCachedDeclsCache = new SimpleFieldCache, HtmlNSDescriptorImpl>() { + @Override protected Map compute(final HtmlNSDescriptorImpl htmlNSDescriptor) { return htmlNSDescriptor.doBuildCachedMap(); } + @Override protected Map getValue(final HtmlNSDescriptorImpl htmlNSDescriptor) { return htmlNSDescriptor.myCachedDecls; } + @Override protected void putValue(final Map map, final HtmlNSDescriptorImpl htmlNSDescriptor) { htmlNSDescriptor.myCachedDecls = map; } @@ -84,6 +87,7 @@ public class HtmlNSDescriptorImpl implements XmlNSDescriptor, DumbAware, XmlNSTy return decls; } + @Override public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) { String name = tag.getLocalName(); if (!myCaseSensitive) name = name.toLowerCase(); @@ -95,36 +99,44 @@ public class HtmlNSDescriptorImpl implements XmlNSDescriptor, DumbAware, XmlNSTy return xmlElementDescriptor; } + @Override @NotNull public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable final XmlDocument document) { return myDelegate == null ? XmlElementDescriptor.EMPTY_ARRAY : myDelegate.getRootElementsDescriptors(document); } + @Override @Nullable public XmlFile getDescriptorFile() { return myDelegate == null ? null : myDelegate.getDescriptorFile(); } + @Override public boolean isHierarhyEnabled() { return false; } + @Override public PsiElement getDeclaration() { return myDelegate == null ? null : myDelegate.getDeclaration(); } + @Override public String getName(PsiElement context) { return myDelegate == null ? "" : myDelegate.getName(context); } + @Override public String getName() { return myDelegate == null ? "" : myDelegate.getName(); } + @Override public void init(PsiElement element) { myDelegate.init(element); } + @Override public Object[] getDependences() { return myDelegate == null ? null : myDelegate.getDependences(); } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/HtmlBuilderDriver.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/HtmlBuilderDriver.java index 571b1e42d633..8be807ed7ace 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/HtmlBuilderDriver.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/HtmlBuilderDriver.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ public class HtmlBuilderDriver extends XmlBuilderDriver { super(text); } + @Override protected PsiBuilder createBuilderAndParse() { final ParserDefinition htmlParserDef = LanguageParserDefinitions.INSTANCE.forLanguage(HTMLLanguage.INSTANCE); assert htmlParserDef != null; diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/XmlParser.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/XmlParser.java index 8c5889da8d62..b0edbdabb916 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/XmlParser.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/XmlParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,6 +59,7 @@ public class XmlParser implements PsiParser { } }; + @Override @NotNull public ASTNode parse(final IElementType root, final PsiBuilder builder) { builder.enforceCommentTokens(TokenSet.EMPTY); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/BasicAttributeValueReference.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/BasicAttributeValueReference.java index 6cd7479593a2..efaf54a1e592 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/BasicAttributeValueReference.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/BasicAttributeValueReference.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,8 +26,8 @@ import org.jetbrains.annotations.NotNull; * @author peter */ public abstract class BasicAttributeValueReference implements PsiReference { - protected PsiElement myElement; - protected TextRange myRange; + protected final PsiElement myElement; + protected final TextRange myRange; public BasicAttributeValueReference(final PsiElement element) { this ( element, ElementManipulators.getValueTextRange(element)); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/DependentNSReference.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/DependentNSReference.java index 9a33ba714c99..944ca40e0563 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/DependentNSReference.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/DependentNSReference.java @@ -40,6 +40,7 @@ public class DependentNSReference extends BasicAttributeValueReference { myForceFetchResultValid = valid; } + @Override @Nullable public PsiElement resolve() { final String canonicalText = getCanonicalText(); @@ -48,11 +49,13 @@ public class DependentNSReference extends BasicAttributeValueReference { return myReference.resolve(); } + @Override @NotNull public Object[] getVariants() { return ArrayUtil.EMPTY_OBJECT_ARRAY; } + @Override public boolean isSoft() { return false; } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferencesProvider.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferencesProvider.java index 450ae1043c6e..97613a6f2bcf 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferencesProvider.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/SchemaReferencesProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,6 +72,7 @@ public class SchemaReferencesProvider extends PsiReferenceProvider { private static final Pattern pattern = Pattern.compile("^(?:\\\\i|\\\\l)"); private static final Pattern pattern2 = Pattern.compile("([^\\\\])(?:\\\\i|\\\\l)"); + @Override @Nullable public PsiElement resolve() { try { @@ -90,15 +91,18 @@ public class SchemaReferencesProvider extends PsiReferenceProvider { } } + @Override @NotNull public Object[] getVariants() { return ArrayUtil.EMPTY_OBJECT_ARRAY; } + @Override public boolean isSoft() { return false; } + @Override @NotNull public String getUnresolvedMessagePattern() { return message; @@ -112,25 +116,30 @@ public class SchemaReferencesProvider extends PsiReferenceProvider { myElement = element; } + @Override public PsiElement getElement() { return myElement; } + @Override public TextRange getRangeInElement() { return ElementManipulators.getValueTextRange(myElement); } + @Override @Nullable public PsiElement resolve() { return myElement.getParent().getParent(); } + @Override @NotNull public String getCanonicalText() { String text = myElement.getText(); return text.substring(1,text.length()- 1); } + @Override public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException { return ElementManipulators.getManipulator(myElement).handleContentChange( myElement, @@ -139,24 +148,29 @@ public class SchemaReferencesProvider extends PsiReferenceProvider { ); } + @Override public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException { return null; } + @Override public boolean isReferenceTo(PsiElement element) { return myElement.getManager().areElementsEquivalent(resolve(), element); } + @Override @NotNull public Object[] getVariants() { return ArrayUtil.EMPTY_OBJECT_ARRAY; } + @Override public boolean isSoft() { return true; } } + @Override @NotNull public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull final ProcessingContext context) { final PsiElement parent = element.getParent(); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/TypeOrElementOrAttributeReference.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/TypeOrElementOrAttributeReference.java index df4b38a5a54a..47a77fef37a9 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/TypeOrElementOrAttributeReference.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/TypeOrElementOrAttributeReference.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -108,14 +108,17 @@ public class TypeOrElementOrAttributeReference implements PsiReference { return null; } + @Override public PsiElement getElement() { return myElement; } + @Override public TextRange getRangeInElement() { return myRange; } + @Override @Nullable public PsiElement resolve() { final PsiElement psiElement = ResolveCache @@ -216,6 +219,7 @@ public class TypeOrElementOrAttributeReference implements PsiReference { URLReference.processWsdlSchemas( document.getRootTag(), new Processor() { + @Override public boolean process(final XmlTag xmlTag) { if (namespace.equals(xmlTag.getAttributeValue(TARGET_NAMESPACE))) { descrs[0] = (XmlNSDescriptor)xmlTag.getMetaData(); @@ -255,6 +259,7 @@ public class TypeOrElementOrAttributeReference implements PsiReference { return namespaceByPrefix; } + @Override @NotNull public String getCanonicalText() { final String text = myElement.getText(); @@ -265,6 +270,7 @@ public class TypeOrElementOrAttributeReference implements PsiReference { return name; } + @Override public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException { final String canonicalText = getCanonicalText(); @@ -274,14 +280,17 @@ public class TypeOrElementOrAttributeReference implements PsiReference { return element; } + @Override public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException { throw new IncorrectOperationException(); } + @Override public boolean isReferenceTo(PsiElement element) { return myElement.getManager().areElementsEquivalent(resolve(), element); } + @Override @NotNull public Object[] getVariants() { final XmlTag tag = PsiTreeUtil.getContextOfType(myElement, XmlTag.class, true); @@ -356,19 +365,21 @@ public class TypeOrElementOrAttributeReference implements PsiReference { ); } + @Override public boolean isSoft() { return false; } private static class MyResolver implements ResolveCache.Resolver { - static MyResolver INSTANCE = new MyResolver(); + static final MyResolver INSTANCE = new MyResolver(); + @Override public PsiElement resolve(@NotNull PsiReference ref, boolean incompleteCode) { return ((TypeOrElementOrAttributeReference)ref).resolveInner(); } } private static class CompletionProcessor implements PsiElementProcessor { - List myElements = new ArrayList(1); + final List myElements = new ArrayList(1); String namespace; final XmlTag tag; private final String prefix; @@ -378,6 +389,7 @@ public class TypeOrElementOrAttributeReference implements PsiReference { this.prefix = prefix; } + @Override public boolean execute(@NotNull final XmlTag element) { String name = element.getAttributeValue(SchemaReferencesProvider.NAME_ATTR_NAME); final String prefixByNamespace = tag.getPrefixByNamespace(namespace); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/URLReference.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/URLReference.java index 557e8e0b0878..3ae8bc8d24dd 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/URLReference.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/URLReference.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,14 +64,17 @@ public class URLReference implements PsiReference, EmptyResolveMessageProvider { mySoft = soft; } + @Override public PsiElement getElement() { return myElement; } + @Override public TextRange getRangeInElement() { return myRange != null ? myRange : ElementManipulators.getValueTextRange(myElement); } + @Override @Nullable public PsiElement resolve() { myIncorrectResourceMapped = false; @@ -134,6 +137,7 @@ public class URLReference implements PsiReference, EmptyResolveMessageProvider { final PsiElement[] result = new PsiElement[1]; processWsdlSchemas(rootTag,new Processor() { + @Override public boolean process(final XmlTag t) { if (canonicalText.equals(t.getAttributeValue(TARGET_NAMESPACE_ATTR_NAME))) { result[0] = t; @@ -156,6 +160,7 @@ public class URLReference implements PsiReference, EmptyResolveMessageProvider { return null; } + @Override @NotNull public String getCanonicalText() { final String text = myElement.getText(); @@ -166,6 +171,7 @@ public class URLReference implements PsiReference, EmptyResolveMessageProvider { return ""; } + @Override public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException { final TextRange textRangeInElement = getRangeInElement(); final PsiElement elementToChange = myElement.findElementAt(textRangeInElement.getStartOffset()); @@ -178,6 +184,7 @@ public class URLReference implements PsiReference, EmptyResolveMessageProvider { return myElement; } + @Override public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException { assert element instanceof PsiFile; @@ -190,10 +197,12 @@ public class URLReference implements PsiReference, EmptyResolveMessageProvider { return myElement; } + @Override public boolean isReferenceTo(PsiElement element) { return myElement.getManager().areElementsEquivalent(resolve(),element); } + @Override @NotNull public Object[] getVariants() { final XmlFile file = (XmlFile)myElement.getContainingFile(); @@ -212,6 +221,7 @@ public class URLReference implements PsiReference, EmptyResolveMessageProvider { XmlTag rootTag = document.getRootTag(); final ArrayList additionalNs = new ArrayList(); if (rootTag != null) processWsdlSchemas(rootTag, new Processor() { + @Override public boolean process(final XmlTag xmlTag) { final String s = xmlTag.getAttributeValue(TARGET_NAMESPACE_ATTR_NAME); if (s != null) { additionalNs.add(s); } @@ -222,10 +232,12 @@ public class URLReference implements PsiReference, EmptyResolveMessageProvider { return resourceUrls; } + @Override public boolean isSoft() { return mySoft; } + @Override @NotNull public String getUnresolvedMessagePattern() { return XmlErrorMessages.message(myIncorrectResourceMapped ? "registered.resource.is.not.recognized":"uri.is.not.registered"); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/XmlValueReference.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/XmlValueReference.java index 7f851a89ba51..ba1e6898d533 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/XmlValueReference.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/XmlValueReference.java @@ -28,7 +28,7 @@ import org.jetbrains.annotations.NotNull; * @author Dmitry Avdeev */ public abstract class XmlValueReference implements PsiReference { - protected XmlTag myTag; + protected final XmlTag myTag; protected TextRange myRange; protected XmlValueReference(XmlTag tag) { diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/HtmlFileElement.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/HtmlFileElement.java index e1d0624b2a40..3ff9ed89bef9 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/HtmlFileElement.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/HtmlFileElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ public class HtmlFileElement extends FileElement implements XmlElementType { super(HTML_FILE, text); } + @Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); if (child.getElementType() == HTML_DOCUMENT) { diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/XmlFileElement.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/XmlFileElement.java index db3128d8c962..1296afa99d9f 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/XmlFileElement.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/XmlFileElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ public class XmlFileElement extends FileElement implements XmlElementType { super(type, text); } + @Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); if (child.getElementType() == XML_DOCUMENT || diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlAttributeLiteralEscaper.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlAttributeLiteralEscaper.java index 21606615f0da..a4e0ce1c55cd 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlAttributeLiteralEscaper.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlAttributeLiteralEscaper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ public class XmlAttributeLiteralEscaper extends LiteralTextEscaper super(host); } + @Override public boolean decode(@NotNull final TextRange rangeInsideHost, @NotNull final StringBuilder outChars) { ProperTextRange.assertProperRange(rangeInsideHost); outChars.append(myHost.getText(), rangeInsideHost.getStartOffset(), rangeInsideHost.getEndOffset()); return true; } + @Override public int getOffsetInHost(final int offsetInDecoded, @NotNull final TextRange rangeInsideHost) { int offset = offsetInDecoded + rangeInsideHost.getStartOffset(); if (offset < rangeInsideHost.getStartOffset()) offset = rangeInsideHost.getStartOffset(); @@ -45,6 +47,7 @@ public class XmlCommentLiteralEscaper extends LiteralTextEscaper return offset; } + @Override public boolean isOneLine() { final Commenter commenter = LanguageCommenters.INSTANCE.forLanguage(myHost.getLanguage()); if (commenter instanceof CodeDocumentationAwareCommenter) { diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlTextLiteralEscaper.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlTextLiteralEscaper.java index ca6154728968..92a6b1f1a72b 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlTextLiteralEscaper.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/tree/injected/XmlTextLiteralEscaper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ public class XmlTextLiteralEscaper extends LiteralTextEscaper { super(xmlText); } + @Override public boolean decode(@NotNull final TextRange rangeInsideHost, @NotNull StringBuilder outChars) { ProperTextRange.assertProperRange(rangeInsideHost); int startInDecoded = myHost.physicalToDisplay(rangeInsideHost.getStartOffset()); @@ -37,6 +38,7 @@ public class XmlTextLiteralEscaper extends LiteralTextEscaper { return true; } + @Override public int getOffsetInHost(final int offsetInDecoded, @NotNull final TextRange rangeInsideHost) { final int rangeInsideHostStartOffset = rangeInsideHost.getStartOffset(); int displayStart = myHost.physicalToDisplay(rangeInsideHostStartOffset); @@ -48,11 +50,13 @@ public class XmlTextLiteralEscaper extends LiteralTextEscaper { return i; } + @Override @NotNull public TextRange getRelevantTextRange() { return myHost.getCDATAInterior(); } + @Override public boolean isOneLine() { return false; } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/LanguageXmlPsiPolicy.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/LanguageXmlPsiPolicy.java index a67b4603cb6a..2dfa64e07460 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/LanguageXmlPsiPolicy.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/LanguageXmlPsiPolicy.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.psi.impl.source.xml; import com.intellij.lang.LanguageExtension; @@ -7,7 +22,7 @@ import com.intellij.psi.impl.source.xml.behavior.CDATAOnAnyEncodedPolicy; * @author yole */ public class LanguageXmlPsiPolicy extends LanguageExtension { - public static LanguageXmlPsiPolicy INSTANCE = new LanguageXmlPsiPolicy(); + public static final LanguageXmlPsiPolicy INSTANCE = new LanguageXmlPsiPolicy(); private LanguageXmlPsiPolicy() { super("com.intellij.xml.psiPolicy", new CDATAOnAnyEncodedPolicy()); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/SchemaPrefix.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/SchemaPrefix.java index 5fbc795e6851..a0e272549ebe 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/SchemaPrefix.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/SchemaPrefix.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,10 +52,12 @@ public class SchemaPrefix extends RenameableFakePsiElement { }; } + @Override public String getTypeName() { return "XML Namespace Prefix"; } + @Override public Icon getIcon() { return PlatformIcons.VARIABLE_ICON; } @@ -75,6 +77,7 @@ public class SchemaPrefix extends RenameableFakePsiElement { return myName; } + @Override public XmlAttribute getDeclaration() { return (XmlAttribute)getParent(); } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/SchemaPrefixReference.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/SchemaPrefixReference.java index 4d4c3aa60187..64b9232075a3 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/SchemaPrefixReference.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/SchemaPrefixReference.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,10 +67,12 @@ public class SchemaPrefixReference extends PsiReferenceBase implemen return myName; } + @Override public SchemaPrefix resolve() { return myPrefix == null ? resolvePrefix(myElement, myName) : myPrefix; } + @Override @NotNull public Object[] getVariants() { return ArrayUtil.EMPTY_OBJECT_ARRAY; diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/TagNameReference.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/TagNameReference.java index 814b06805a09..26fcc9940608 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/TagNameReference.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/TagNameReference.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,6 +45,7 @@ public class TagNameReference implements PsiReference { myNameElement = nameElement; } + @Override public PsiElement getElement() { PsiElement element = myNameElement.getPsi(); final PsiElement parent = element.getParent(); @@ -58,6 +59,7 @@ public class TagNameReference implements PsiReference { return (XmlTag)element; } + @Override public TextRange getRangeInElement() { final ASTNode nameElement = getNameElement(); if (nameElement == null){ @@ -89,6 +91,7 @@ public class TagNameReference implements PsiReference { return myNameElement; } + @Override public PsiElement resolve() { final XmlTag tag = getTagElement(); final XmlElementDescriptor descriptor = tag != null ? tag.getDescriptor():null; @@ -104,11 +107,13 @@ public class TagNameReference implements PsiReference { return null; } + @Override @NotNull public String getCanonicalText() { return getNameElement().getText(); } + @Override @Nullable public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException { final XmlTag element = getTagElement(); @@ -136,6 +141,7 @@ public class TagNameReference implements PsiReference { return newElementName; } + @Override public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException { PsiMetaData metaData = null; @@ -162,15 +168,18 @@ public class TagNameReference implements PsiReference { throw new IncorrectOperationException("Cant bind to not a xml element definition!"+element+","+metaData + "," + tag + "," + (tag != null ? tag.getDescriptor() : "unknown descriptor")); } + @Override public boolean isReferenceTo(PsiElement element) { return getElement().getManager().areElementsEquivalent(element, resolve()); } + @Override @NotNull public Object[] getVariants(){ return ArrayUtil.EMPTY_OBJECT_ARRAY; } + @Override public boolean isSoft() { return false; } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttlistDeclImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttlistDeclImpl.java index d65ea69662f7..c53037cc0d55 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttlistDeclImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttlistDeclImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +39,7 @@ public class XmlAttlistDeclImpl extends XmlElementImpl implements XmlAttlistDecl super(XmlElementType.XML_ATTLIST_DECL); } + @Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); if (child.getElementType() == XmlTokenType.XML_NAME) { @@ -49,13 +50,16 @@ public class XmlAttlistDeclImpl extends XmlElementImpl implements XmlAttlistDecl } } + @Override public XmlElement getNameElement() { return (XmlElement)findChildByRoleAsPsiElement(XmlChildRole.XML_NAME); } + @Override public XmlAttributeDecl[] getAttributeDecls() { final List result = new ArrayList(); processElements(new FilterElementProcessor(new ClassFilter(XmlAttributeDecl.class), result) { + @Override public boolean execute(@NotNull final PsiElement element) { if (element instanceof XmlAttributeDecl) { if (element.getNextSibling() == null && element.getChildren().length == 1) { @@ -69,11 +73,13 @@ public class XmlAttlistDeclImpl extends XmlElementImpl implements XmlAttlistDecl return result.toArray(new XmlAttributeDecl[result.size()]); } + @Override @NotNull public PsiReference[] getReferences() { return ReferenceProvidersRegistry.getReferencesFromProviders(this,XmlAttlistDecl.class); } + @Override public String getName() { XmlElement xmlElement = getNameElement(); if (xmlElement != null) return xmlElement.getText(); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeDeclImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeDeclImpl.java index 1d060810ae2b..f09b6892bbbb 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeDeclImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeDeclImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,6 +45,7 @@ public class XmlAttributeDeclImpl extends XmlElementImpl implements XmlAttribute super(XML_ATTRIBUTE_DECL); } + @Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); @@ -71,26 +72,32 @@ public class XmlAttributeDeclImpl extends XmlElementImpl implements XmlAttribute } } + @Override public XmlElement getNameElement() { return findElementByTokenType(XML_NAME); } + @Override public boolean isAttributeRequired() { return findElementByTokenType(XML_ATT_REQUIRED) != null; } + @Override public boolean isAttributeFixed() { return findElementByTokenType(XML_ATT_FIXED) != null; } + @Override public boolean isAttributeImplied() { return findElementByTokenType(XML_ATT_IMPLIED) != null; } + @Override public XmlAttributeValue getDefaultValue() { return (XmlAttributeValue)findElementByTokenType(XML_ATTRIBUTE_VALUE); } + @Override public String getDefaultValueText() { XmlAttributeValue value = getDefaultValue(); if (value == null) return null; @@ -99,6 +106,7 @@ public class XmlAttributeDeclImpl extends XmlElementImpl implements XmlAttribute final StringBuilder builder = new StringBuilder(); value.processElements(new PsiElementProcessor() { + @Override public boolean execute(@NotNull PsiElement element) { builder.append(element.getText()); return true; @@ -107,10 +115,12 @@ public class XmlAttributeDeclImpl extends XmlElementImpl implements XmlAttribute return builder.toString(); } + @Override public boolean isEnumerated() { return findElementByTokenType(XML_ENUMERATED_TYPE) != null; } + @Override public XmlElement[] getEnumeratedValues() { XmlEnumeratedType enumeratedType = (XmlEnumeratedType)findElementByTokenType(XML_ENUMERATED_TYPE); if (enumeratedType != null) { @@ -121,6 +131,7 @@ public class XmlAttributeDeclImpl extends XmlElementImpl implements XmlAttribute } } + @Override public boolean isIdAttribute() { final PsiElement elementType = findElementType(); @@ -135,32 +146,38 @@ public class XmlAttributeDeclImpl extends XmlElementImpl implements XmlAttribute return elementType; } + @Override public boolean isIdRefAttribute() { final PsiElement elementType = findElementType(); return elementType != null && elementType.getText().equals(IDREF_ATT); } + @Override public PsiMetaData getMetaData() { return MetaRegistry.getMeta(this); } + @Override public PsiElement setName(@NotNull String name) throws IncorrectOperationException { XmlElementChangeUtil.doNameReplacement(this, getNameElement(), name); return null; } + @Override public String getName() { XmlElement name = getNameElement(); return (name != null) ? name.getText() : null; } + @Override public boolean canNavigate() { if (isPhysical()) return super.canNavigate(); final PsiNamedElement psiNamedElement = XmlUtil.findRealNamedElement(this); return psiNamedElement != null && psiNamedElement != this && ((Navigatable)psiNamedElement).canNavigate(); } + @Override public void navigate(final boolean requestFocus) { if (isPhysical()) { super.navigate(requestFocus); @@ -181,6 +198,7 @@ public class XmlAttributeDeclImpl extends XmlElementImpl implements XmlAttribute } } + @Override @NotNull public PsiElement getNavigationElement() { return this; diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeReference.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeReference.java index b3b29ce4e0d0..44eec73d35f7 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeReference.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeReference.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ import org.jetbrains.annotations.Nullable; public class XmlAttributeReference implements PsiReference { private final NullableLazyValue myDescriptor = new NullableLazyValue() { + @Override protected XmlAttributeDescriptor compute() { XmlTag parent = myAttribute.getParent(); final XmlElementDescriptor descr = parent.getDescriptor(); @@ -48,10 +49,12 @@ public class XmlAttributeReference implements PsiReference { myAttribute = attribute; } + @Override public XmlAttribute getElement() { return myAttribute; } + @Override public TextRange getRangeInElement() { final int parentOffset = myAttribute.getNameElement().getStartOffsetInParent(); int nsLen = myAttribute.getNamespacePrefix().length(); @@ -59,16 +62,19 @@ public class XmlAttributeReference implements PsiReference { return new TextRange(parentOffset + nsLen, parentOffset + myAttribute.getNameElement().getTextLength()); } + @Override public PsiElement resolve() { final XmlAttributeDescriptor descriptor = getDescriptor(); return descriptor != null ? descriptor.getDeclaration() : null; } + @Override @NotNull public String getCanonicalText() { return myAttribute.getName(); } + @Override public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException { String newName = newElementName; if (getDescriptor() instanceof XmlAttributeDescriptorEx) { @@ -82,6 +88,7 @@ public class XmlAttributeReference implements PsiReference { return myAttribute.setName(newName); } + @Override public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException { if (element instanceof PsiMetaOwner) { final PsiMetaOwner owner = (PsiMetaOwner)element; @@ -92,15 +99,18 @@ public class XmlAttributeReference implements PsiReference { throw new IncorrectOperationException("Cant bind to not a xml element definition!"); } + @Override public boolean isReferenceTo(PsiElement element) { return myAttribute.getManager().areElementsEquivalent(element, resolve()); } + @Override @NotNull public Object[] getVariants() { return ArrayUtil.EMPTY_OBJECT_ARRAY; // moved to XmlAttributeReferenceCompletionProvider } + @Override public boolean isSoft() { return getDescriptor() == null; } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeValueImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeValueImpl.java index 29e4dab483d3..690ec23e015a 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeValueImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttributeValueImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -50,6 +50,7 @@ public class XmlAttributeValueImpl extends XmlElementImpl implements XmlAttribut super(XmlElementType.XML_ATTRIBUTE_VALUE); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlAttributeValue(this); @@ -59,6 +60,7 @@ public class XmlAttributeValueImpl extends XmlElementImpl implements XmlAttribut } } + @Override public String getValue() { // it is more correct way to strip quotes since injected xml may have quotes encoded String text = getText(); @@ -73,6 +75,7 @@ public class XmlAttributeValueImpl extends XmlElementImpl implements XmlAttribut return text; } + @Override public TextRange getValueTextRange() { final TextRange range = getTextRange(); final String value = getValue(); @@ -84,11 +87,13 @@ public class XmlAttributeValueImpl extends XmlElementImpl implements XmlAttribut return new TextRange(start, end); } + @Override public void clearCaches() { super.clearCaches(); myCachedReferences = null; } + @Override @NotNull public PsiReference[] getReferences() { PsiReference[] cachedReferences = myCachedReferences; @@ -102,6 +107,7 @@ public class XmlAttributeValueImpl extends XmlElementImpl implements XmlAttribut return cachedReferences; } + @Override public PsiReference getReference() { final PsiReference[] refs = getReferences(); if (refs.length > 0) return refs[0]; @@ -109,6 +115,7 @@ public class XmlAttributeValueImpl extends XmlElementImpl implements XmlAttribut } + @Override public int getTextOffset() { return getTextRange().getStartOffset() + 1; } @@ -118,6 +125,7 @@ public class XmlAttributeValueImpl extends XmlElementImpl implements XmlAttribut return getParent() instanceof XmlAttributeImpl; } + @Override public PsiLanguageInjectionHost updateText(@NotNull String text) { try { final String quoteChar = getTextLength() > 0 ? getText().substring(0, 1) : ""; @@ -135,30 +143,37 @@ public class XmlAttributeValueImpl extends XmlElementImpl implements XmlAttribut return this; } + @Override @NotNull public LiteralTextEscaper createLiteralTextEscaper() { return new XmlAttributeLiteralEscaper(this); } + @Override public PsiMetaData getMetaData() { return this; } + @Override public PsiElement getDeclaration() { return this; } + @Override public String getName(final PsiElement context) { return getValue(); } + @Override public String getName() { return getValue(); } + @Override public void init(final PsiElement element) { } + @Override public Object[] getDependences() { return ArrayUtil.EMPTY_OBJECT_ARRAY; } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlCommentImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlCommentImpl.java index 9b3faa535ecb..eb9f65b66a6f 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlCommentImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlCommentImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,10 +35,12 @@ public class XmlCommentImpl extends XmlElementImpl implements XmlComment, XmlEle super(XML_COMMENT); } + @Override public IElementType getTokenType() { return XML_COMMENT; } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlComment(this); @@ -53,31 +55,37 @@ public class XmlCommentImpl extends XmlElementImpl implements XmlComment, XmlEle return true; } + @Override public XmlTag getParentTag() { if(getParent() instanceof XmlTag) return (XmlTag)getParent(); return null; } + @Override public XmlTagChild getNextSiblingInTag() { if(getParent() instanceof XmlTag) return (XmlTagChild)getNextSibling(); return null; } + @Override public XmlTagChild getPrevSiblingInTag() { if(getParent() instanceof XmlTag) return (XmlTagChild)getPrevSibling(); return null; } + @Override @NotNull public PsiReference[] getReferences() { return ReferenceProvidersRegistry.getReferencesFromProviders(this, XmlComment.class); } + @Override @Nullable public PsiMetaData getMetaData() { return MetaRegistry.getMetaBase(this); } + @Override public PsiLanguageInjectionHost updateText(@NotNull final String text) { final PsiFile psiFile = getContainingFile(); @@ -93,6 +101,7 @@ public class XmlCommentImpl extends XmlElementImpl implements XmlComment, XmlEle return this; } + @Override @NotNull public LiteralTextEscaper createLiteralTextEscaper() { return new XmlCommentLiteralEscaper(this); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlConditionalSectionImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlConditionalSectionImpl.java index 26c0bec1f622..976eb4fb8f0f 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlConditionalSectionImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlConditionalSectionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ public class XmlConditionalSectionImpl extends XmlElementImpl implements XmlCond super(XmlElementType.XML_CONDITIONAL_SECTION); } + @Override public boolean isIncluded(PsiFile targetFile) { ASTNode child = findChildByType(XmlTokenType.XML_CONDITIONAL_SECTION_START); @@ -72,6 +73,7 @@ public class XmlConditionalSectionImpl extends XmlElementImpl implements XmlCond return false; } + @Override public PsiElement getBodyStart() { ASTNode child = findChildByType(XmlTokenType.XML_MARKUP_START); if (child != null) child = child.getTreeNext(); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDeclImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDeclImpl.java index da165b63c416..2022c144cf37 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDeclImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDeclImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ public class XmlDeclImpl extends XmlElementImpl implements XmlDecl{ super(XmlElementType.XML_DECL); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlDecl(this); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDoctypeImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDoctypeImpl.java index 14d07718ba87..b2e5192a4df7 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDoctypeImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDoctypeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,6 +41,7 @@ public class XmlDoctypeImpl extends XmlElementImpl implements XmlDoctype { super(XmlElementType.XML_DOCTYPE); } + @Override public void clearCaches() { final XmlDocument doc = getContainingDocument(); if (doc != null) { @@ -64,6 +65,7 @@ public class XmlDoctypeImpl extends XmlElementImpl implements XmlDoctype { return null; } + @Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); @@ -81,6 +83,7 @@ public class XmlDoctypeImpl extends XmlElementImpl implements XmlDoctype { } } + @Override @Nullable public String getDtdUri() { final PsiElement dtdUrlElement = getDtdUrlElement(); @@ -119,6 +122,7 @@ public class XmlDoctypeImpl extends XmlElementImpl implements XmlDoctype { return false; } + @Override @Nullable public PsiElement getDtdUrlElement() { PsiElement docTypePublic = findChildByRoleAsPsiElement(XmlChildRole.XML_DOCTYPE_PUBLIC); @@ -162,15 +166,18 @@ public class XmlDoctypeImpl extends XmlElementImpl implements XmlDoctype { return null; } + @Override public XmlElement getNameElement() { return (XmlElement)findChildByRoleAsPsiElement(XmlChildRole.XML_NAME); } + @Override @Nullable public String getPublicId() { return getSomeId(XmlChildRole.XML_DOCTYPE_PUBLIC); } + @Override public String getSystemId() { return getSomeId(XmlChildRole.XML_DOCTYPE_SYSTEM); } @@ -195,6 +202,7 @@ public class XmlDoctypeImpl extends XmlElementImpl implements XmlDoctype { return null; } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlDoctype(this); @@ -204,6 +212,7 @@ public class XmlDoctypeImpl extends XmlElementImpl implements XmlDoctype { } } + @Override public XmlMarkupDecl getMarkupDecl() { for(PsiElement child = getFirstChild(); child != null; child = child.getNextSibling()){ if (child instanceof XmlMarkupDecl){ @@ -214,6 +223,7 @@ public class XmlDoctypeImpl extends XmlElementImpl implements XmlDoctype { return null; } + @Override @NotNull public PsiReference[] getReferences() { final PsiElement dtdUrlElement = getDtdUrlElement(); @@ -230,15 +240,18 @@ public class XmlDoctypeImpl extends XmlElementImpl implements XmlDoctype { protected PsiReference createUrlReference(final PsiElement dtdUrlElement) { return new URLReference(XmlDoctypeImpl.this) { + @Override @NotNull public Object[] getVariants() { return findChildByRoleAsPsiElement(XmlChildRole.XML_DOCTYPE_PUBLIC) != null ? super.getVariants(): EMPTY_ARRAY; } + @Override @NotNull public String getCanonicalText() { return extractValue(dtdUrlElement); } + @Override public TextRange getRangeInElement() { return TextRange.from(dtdUrlElement.getTextRange().getStartOffset() - getTextRange().getStartOffset() + 1, Math.max(dtdUrlElement.getTextRange().getLength() - 2, 0)); } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDocumentImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDocumentImpl.java index 29d212496148..c86139c4bbcd 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDocumentImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlDocumentImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,6 +82,7 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument { super(type); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlDocument(this); @@ -91,6 +92,7 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument { } } + @Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); @@ -105,6 +107,7 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument { } } + @Override public XmlProlog getProlog() { XmlProlog prolog = myProlog; @@ -121,6 +124,7 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument { return myProlog; } + @Override public XmlTag getRootTag() { XmlTag rootTag = myRootTag; @@ -137,6 +141,7 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument { return myRootTag; } + @Override @SuppressWarnings("ConstantConditions") public XmlNSDescriptor getRootTagNSDescriptor() { XmlTag rootTag = getRootTag(); @@ -146,6 +151,7 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument { private ConcurrentHashMap> myDefaultDescriptorsCacheStrict = new ConcurrentHashMap>(); private ConcurrentHashMap> myDefaultDescriptorsCacheNotStrict = new ConcurrentHashMap>(); + @Override public void clearCaches() { myDefaultDescriptorsCacheStrict.clear(); myDefaultDescriptorsCacheNotStrict.clear(); @@ -154,6 +160,7 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument { super.clearCaches(); } + @Override public XmlNSDescriptor getDefaultNSDescriptor(final String namespace, final boolean strict) { long curExtResourcesModCount = ExternalResourceManagerEx.getInstanceEx().getModificationCount(getProject()); if (myExtResourcesModCount != curExtResourcesModCount) { @@ -173,6 +180,7 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument { CachedValue cachedValue = defaultDescriptorsCache.get(namespace); if (cachedValue == null) { defaultDescriptorsCache.put(namespace, cachedValue = new PsiCachedValueImpl(getManager(), new CachedValueProvider() { + @Override public Result compute() { final XmlNSDescriptor defaultNSDescriptorInner = getDefaultNSDescriptorInner(namespace, strict); @@ -339,6 +347,7 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument { return descriptor; } + @Override public CompositePsiElement clone() { HashMap> cacheStrict = new HashMap>( myDefaultDescriptorsCacheStrict @@ -351,6 +360,7 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument { return copy; } + @Override public PsiElement copy() { HashMap> cacheStrict = new HashMap>( myDefaultDescriptorsCacheStrict @@ -383,6 +393,7 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument { } } + @Override public PsiMetaData getMetaData() { return MetaRegistry.getMeta(this); } @@ -418,12 +429,14 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument { } } + @Override public TreeElement addInternal(final TreeElement first, final ASTNode last, final ASTNode anchor, final Boolean before) { final PomModel model = PomManager.getModel(getProject()); final XmlAspect aspect = model.getModelAspect(XmlAspect.class); final TreeElement[] holder = new TreeElement[1]; try{ model.runTransaction(new PomTransactionBase(this, aspect) { + @Override public PomModelEvent runInner() { holder[0] = XmlDocumentImpl.super.addInternal(first, last, anchor, before); return XmlDocumentChangedImpl.createXmlDocumentChanged(model, XmlDocumentImpl.this); @@ -434,11 +447,13 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument { return holder[0]; } + @Override public void deleteChildInternal(@NotNull final ASTNode child) { final PomModel model = PomManager.getModel(getProject()); final XmlAspect aspect = model.getModelAspect(XmlAspect.class); try{ model.runTransaction(new PomTransactionBase(this, aspect) { + @Override public PomModelEvent runInner() { XmlDocumentImpl.super.deleteChildInternal(child); return XmlDocumentChangedImpl.createXmlDocumentChanged(model, XmlDocumentImpl.this); @@ -448,11 +463,13 @@ public class XmlDocumentImpl extends XmlElementImpl implements XmlDocument { catch(IncorrectOperationException ignored){} } + @Override public void replaceChildInternal(@NotNull final ASTNode child, @NotNull final TreeElement newElement) { final PomModel model = PomManager.getModel(getProject()); final XmlAspect aspect = model.getModelAspect(XmlAspect.class); try{ model.runTransaction(new PomTransactionBase(this, aspect) { + @Override public PomModelEvent runInner() { XmlDocumentImpl.super.replaceChildInternal(child, newElement); return XmlDocumentChangedImpl.createXmlDocumentChanged(model, XmlDocumentImpl.this); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementContentSpecImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementContentSpecImpl.java index c060c4327df7..6b041acd1d7e 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementContentSpecImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementContentSpecImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +39,7 @@ public class XmlElementContentSpecImpl extends XmlElementImpl implements XmlElem super(XML_ELEMENT_CONTENT_SPEC); } + @Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); @@ -56,19 +57,23 @@ public class XmlElementContentSpecImpl extends XmlElementImpl implements XmlElem } } + @Override public boolean isEmpty() { return findElementByTokenType(XML_CONTENT_EMPTY) != null; } + @Override public boolean isAny() { return findElementByTokenType(XML_CONTENT_ANY) != null; } + @Override public boolean isMixed() { XmlElementContentGroup topGroup = getTopGroup(); return topGroup != null && ((XmlElementImpl)topGroup).findElementByTokenType(XML_PCDATA) != null; } + @Override public boolean hasChildren() { return !(isEmpty() || isAny() || isMixed()); } @@ -78,11 +83,13 @@ public class XmlElementContentSpecImpl extends XmlElementImpl implements XmlElem return (XmlElementContentGroup)findElementByTokenType(XML_ELEMENT_CONTENT_GROUP); } + @Override @NotNull public PsiReference[] getReferences() { return ReferenceProvidersRegistry.getReferencesFromProviders(this,XmlElementContentSpec.class); } + @Override public void accept(@NotNull final PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlElement(this); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementDeclImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementDeclImpl.java index c45e6492f6c5..39e9d622b64c 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementDeclImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementDeclImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,6 +41,7 @@ public class XmlElementDeclImpl extends XmlElementImpl implements XmlElementDecl super(XML_ELEMENT_DECL); } + @Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); IElementType i = child.getElementType(); @@ -55,34 +56,41 @@ public class XmlElementDeclImpl extends XmlElementImpl implements XmlElementDecl } } + @Override public int getTextOffset() { final XmlElement name = getNameElement(); return name != null ? name.getTextOffset() : super.getTextOffset(); } + @Override public XmlElement getNameElement() { return (XmlElement)findChildByRoleAsPsiElement(XmlChildRole.XML_NAME); } + @Override public XmlElementContentSpec getContentSpecElement() { return (XmlElementContentSpec)findChildByRoleAsPsiElement(XmlChildRole.XML_ELEMENT_CONTENT_SPEC); } + @Override public PsiMetaData getMetaData() { return MetaRegistry.getMeta(this); } + @Override public PsiElement setName(@NotNull String name) throws IncorrectOperationException { XmlElementChangeUtil.doNameReplacement(this, getNameElement(), name); return null; } + @Override @NotNull public PsiReference[] getReferences() { return ReferenceProvidersRegistry.getReferencesFromProviders(this,XmlElementDecl.class); } + @Override public PsiElement getOriginalElement() { if (isPhysical()) return super.getOriginalElement(); @@ -95,6 +103,7 @@ public class XmlElementDeclImpl extends XmlElementImpl implements XmlElementDecl return this; } + @Override public boolean canNavigate() { if (!isPhysical()) { return getOriginalElement() != this; @@ -103,6 +112,7 @@ public class XmlElementDeclImpl extends XmlElementImpl implements XmlElementDecl return super.canNavigate(); } + @Override public void navigate(boolean requestFocus) { if (!isPhysical()) { PsiElement element = getOriginalElement(); @@ -116,6 +126,7 @@ public class XmlElementDeclImpl extends XmlElementImpl implements XmlElementDecl super.navigate(requestFocus); } + @Override public String getName() { XmlElement xmlElement = getNameElement(); if (xmlElement != null) return xmlElement.getText(); @@ -134,10 +145,12 @@ public class XmlElementDeclImpl extends XmlElementImpl implements XmlElementDecl return element1 == element2; } + @Override public PsiElement getNameIdentifier() { return null; } + @Override @NotNull public PsiElement getNavigationElement() { return this; diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementImpl.java index e0ec1ad033c6..ec5f1d903b37 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,6 +47,7 @@ public abstract class XmlElementImpl extends CompositePsiElement implements XmlE super(type); } + @Override public boolean processElements(PsiElementProcessor processor, PsiElement place){ return XmlPsiUtil.processXmlElements(this, processor, false); } @@ -60,6 +61,7 @@ public abstract class XmlElementImpl extends CompositePsiElement implements XmlE result[0] = null; processElements(new PsiElementProcessor(){ + @Override public boolean execute(@NotNull PsiElement element){ if(element instanceof TreeElement && ((ASTNode)element).getElementType() == type){ result[0] = (XmlElement)element; @@ -72,6 +74,7 @@ public abstract class XmlElementImpl extends CompositePsiElement implements XmlE return result[0]; } + @Override public PsiElement getContext() { final XmlElement data = getUserData(INCLUDING_ELEMENT); if(data != null) return data; @@ -82,6 +85,7 @@ public abstract class XmlElementImpl extends CompositePsiElement implements XmlE return super.getParent(); } + @Override @NotNull public PsiElement getNavigationElement() { if (!isPhysical()) { @@ -97,10 +101,12 @@ public abstract class XmlElementImpl extends CompositePsiElement implements XmlE return super.getNavigationElement(); } + @Override public PsiElement getParent(){ return getContext(); } + @Override @NotNull public Language getLanguage() { return getContainingFile().getLanguage(); @@ -120,6 +126,7 @@ public abstract class XmlElementImpl extends CompositePsiElement implements XmlE final StringBuilder builder = new StringBuilder(); ((XmlElement)name.getPsi()).processElements(new PsiElementProcessor() { + @Override public boolean execute(@NotNull final PsiElement element) { builder.append(element.getText()); return true; @@ -130,6 +137,7 @@ public abstract class XmlElementImpl extends CompositePsiElement implements XmlE return null; } + @Override @NotNull public SearchScope getUseScope() { return GlobalSearchScope.allScope(getProject()); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityCache.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityCache.java index 8f91c22899a1..8b3052d0400d 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityCache.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityCache.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.psi.impl.source.xml; import com.intellij.openapi.util.Key; @@ -23,6 +38,7 @@ public class XmlEntityCache { cachingMap.put( name, CachedValuesManager.getManager(file.getProject()).createCachedValue(new CachedValueProvider() { + @Override public Result compute() { PsiElement declElement = declPointer.getElement(); if (declElement instanceof XmlEntityDecl && declElement.isValid() && name.equals(((XmlEntityDecl)declElement).getName())) diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityDeclImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityDeclImpl.java index deff9ba1f680..1eb615fb58fd 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityDeclImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityDeclImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,6 +39,7 @@ public class XmlEntityDeclImpl extends XmlElementImpl implements XmlEntityDecl, super(XML_ENTITY_DECL); } + @Override public PsiElement getNameElement() { for (ASTNode e = getFirstChildNode(); e != null; e = e.getTreeNext()) { if (e instanceof XmlTokenImpl) { @@ -51,6 +52,7 @@ public class XmlEntityDeclImpl extends XmlElementImpl implements XmlEntityDecl, return null; } + @Override public XmlAttributeValue getValueElement() { if (isInternalReference()) { for (ASTNode e = getFirstChildNode(); e != null; e = e.getTreeNext()) { @@ -70,11 +72,13 @@ public class XmlEntityDeclImpl extends XmlElementImpl implements XmlEntityDecl, return null; } + @Override public String getName() { PsiElement nameElement = getNameElement(); return nameElement != null ? nameElement.getText() : ""; } + @Override public PsiElement setName(@NotNull String name) throws IncorrectOperationException { final PsiElement nameElement = getNameElement(); @@ -88,6 +92,7 @@ public class XmlEntityDeclImpl extends XmlElementImpl implements XmlEntityDecl, return null; } + @Override public PsiElement parse(PsiFile baseFile, EntityContextType contextType, final XmlEntityRef originalElement) { PsiElement dep = XmlElement.DEPENDING_ELEMENT.get(getParent()); PsiElement dependsOnElement = getValueElement(dep instanceof PsiFile ? (PsiFile)dep : baseFile); @@ -153,6 +158,7 @@ public class XmlEntityDeclImpl extends XmlElementImpl implements XmlEntityDecl, return null; } + @Override public boolean isInternalReference() { for (ASTNode e = getFirstChildNode(); e != null; e = e.getTreeNext()) { if (e.getElementType() instanceof IXmlLeafElementType) { @@ -167,22 +173,26 @@ public class XmlEntityDeclImpl extends XmlElementImpl implements XmlEntityDecl, return true; } + @Override @NotNull public PsiElement getNavigationElement() { return getNameElement(); } + @Override public int getTextOffset() { final PsiElement name = getNameElement(); return name != null ? name.getTextOffset() : super.getTextOffset(); } + @Override public boolean canNavigate() { if (isPhysical()) return super.canNavigate(); final PsiNamedElement psiNamedElement = XmlUtil.findRealNamedElement(this); return psiNamedElement != null; } + @Override public void navigate(final boolean requestFocus) { if (!isPhysical()) { ((Navigatable)XmlUtil.findRealNamedElement(this)).navigate(requestFocus); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityRefImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityRefImpl.java index 8bd39976fe44..b74834a28162 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityRefImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityRefImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,6 +51,7 @@ public class XmlEntityRefImpl extends XmlElementImpl implements XmlEntityRef { private static final Key EVALUATION_IN_PROCESS = Key.create("EvalKey"); + @Override public XmlEntityDecl resolve(PsiFile targetFile) { String text = getText(); if (text.equals(GT_ENTITY) || text.equals(QUOT_ENTITY)) return null; @@ -79,6 +80,7 @@ public class XmlEntityRefImpl extends XmlElementImpl implements XmlEntityRef { return resolveEntity(targetElement, entityName, containingFile).getValue(); } value = CachedValuesManager.getManager(manager.getProject()).createCachedValue(new CachedValueProvider() { + @Override public Result compute() { return resolveEntity(targetElement, entityName, containingFile); } @@ -103,6 +105,7 @@ public class XmlEntityRefImpl extends XmlElementImpl implements XmlEntityRef { final XmlEntityDecl[] result = {null}; PsiElementProcessor processor = new PsiElementProcessor() { + @Override public boolean execute(@NotNull PsiElement element) { if (element instanceof XmlDoctype) { XmlDoctype xmlDoctype = (XmlDoctype)element; @@ -187,29 +190,34 @@ public class XmlEntityRefImpl extends XmlElementImpl implements XmlEntityRef { return HtmlUtil.isHtml5Doctype(xmlDoctype) ? Html5SchemaProvider.getCharsDtdLocation() : XmlUtil.getDtdUri(xmlDoctype); } + @Override public XmlTag getParentTag() { final XmlElement parent = (XmlElement)getParent(); if(parent instanceof XmlTag) return (XmlTag)parent; return null; } + @Override public XmlTagChild getNextSiblingInTag() { PsiElement nextSibling = getNextSibling(); if(nextSibling instanceof XmlTagChild) return (XmlTagChild)nextSibling; return null; } + @Override public XmlTagChild getPrevSiblingInTag() { final PsiElement prevSibling = getPrevSibling(); if(prevSibling instanceof XmlTagChild) return (XmlTagChild)prevSibling; return null; } + @Override @NotNull public PsiReference[] getReferences() { return ReferenceProvidersRegistry.getReferencesFromProviders(this,XmlEntityRef.class); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlElement(this); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEnumeratedTypeImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEnumeratedTypeImpl.java index 2390f7fc3157..6cdd06855584 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEnumeratedTypeImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEnumeratedTypeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,6 +33,7 @@ public class XmlEnumeratedTypeImpl extends XmlElementImpl implements XmlEnumerat super(XML_ENUMERATED_TYPE); } + @Override public XmlElement[] getEnumeratedValues() { final List result = new ArrayList(); processElements(new FilterElementProcessor(new XmlTokenTypeFilter(XmlTokenType.XML_NAME), result), this); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlMarkupDeclImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlMarkupDeclImpl.java index a022992fa34d..a490a5516d9e 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlMarkupDeclImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlMarkupDeclImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ public class XmlMarkupDeclImpl extends XmlElementImpl implements XmlMarkupDecl { super(XmlElementType.XML_MARKUP_DECL); } + @Override public PsiMetaData getMetaData(){ return MetaRegistry.getMeta(this); } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlNotationDeclImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlNotationDeclImpl.java index e7e07a27b0f3..3a52fe8a804d 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlNotationDeclImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlNotationDeclImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ public class XmlNotationDeclImpl extends XmlElementImpl implements XmlNotationDe super(XML_NOTATION_DECL); } + @Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); if (child.getElementType() == XML_ELEMENT_CONTENT_SPEC) { @@ -40,10 +41,12 @@ public class XmlNotationDeclImpl extends XmlElementImpl implements XmlNotationDe } } + @Override public XmlElement getNameElement() { return (XmlElement)findChildByRoleAsPsiElement(XmlChildRole.XML_NAME); } + @Override public XmlElementContentSpec getContentSpecElement() { return (XmlElementContentSpec)findChildByRoleAsPsiElement(XmlChildRole.XML_ELEMENT_CONTENT_SPEC); } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlProcessingInstructionImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlProcessingInstructionImpl.java index 92891154ff30..d0d67bf490cb 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlProcessingInstructionImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlProcessingInstructionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,6 +37,7 @@ public class XmlProcessingInstructionImpl extends XmlElementImpl implements XmlP super(XmlElementType.XML_PROCESSING_INSTRUCTION); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlProcessingInstruction(this); @@ -46,18 +47,21 @@ public class XmlProcessingInstructionImpl extends XmlElementImpl implements XmlP } } + @Override public XmlTag getParentTag() { final PsiElement parent = getParent(); if(parent instanceof XmlTag) return (XmlTag)parent; return null; } + @Override public XmlTagChild getNextSiblingInTag() { PsiElement nextSibling = getNextSibling(); if(nextSibling instanceof XmlTagChild) return (XmlTagChild)nextSibling; return null; } + @Override public XmlTagChild getPrevSiblingInTag() { final PsiElement prevSibling = getPrevSibling(); if(prevSibling instanceof XmlTagChild) return (XmlTagChild)prevSibling; diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlPrologImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlPrologImpl.java index 88b534951634..ee78a746f249 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlPrologImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlPrologImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,6 +36,7 @@ public class XmlPrologImpl extends XmlElementImpl implements XmlProlog, XmlEleme super(XML_PROLOG); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlProlog(this); @@ -45,6 +46,7 @@ public class XmlPrologImpl extends XmlElementImpl implements XmlProlog, XmlEleme } } + @Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); if (child.getElementType() == XML_DOCTYPE) { @@ -55,6 +57,7 @@ public class XmlPrologImpl extends XmlElementImpl implements XmlProlog, XmlEleme } } + @Override public XmlDoctype getDoctype() { return (XmlDoctype)findChildByRoleAsPsiElement(XmlChildRole.XML_DOCTYPE); } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java index ddbd368cc1df..dbfb181a5881 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTagValueImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,11 +45,13 @@ public class XmlTagValueImpl implements XmlTagValue{ myElements = bodyElements; } + @Override @NotNull public XmlTagChild[] getChildren() { return myElements; } + @Override @NotNull public XmlText[] getTextElements() { XmlText[] textElements = myTextElements; @@ -61,6 +63,7 @@ public class XmlTagValueImpl implements XmlTagValue{ return myTextElements = textElementsList.isEmpty() ? XmlText.EMPTY_ARRAY : ContainerUtil.toArray(textElementsList, new XmlText[textElementsList.size()]); } + @Override @NotNull public String getText() { String text = myText; @@ -72,6 +75,7 @@ public class XmlTagValueImpl implements XmlTagValue{ return myText = consolidatedText.toString(); } + @Override @NotNull public TextRange getTextRange() { if(myElements.length == 0){ @@ -83,6 +87,7 @@ public class XmlTagValueImpl implements XmlTagValue{ return new TextRange(myElements[0].getTextRange().getStartOffset(), myElements[myElements.length - 1].getTextRange().getEndOffset()); } + @Override @NotNull public String getTrimmedText() { String trimmedText = myTrimmedText; @@ -159,6 +164,7 @@ public class XmlTagValueImpl implements XmlTagValue{ tag.processElements(new PsiElementProcessor() { boolean insideBody = false; + @Override public boolean execute(@NotNull PsiElement element) { final ASTNode treeElement = element.getNode(); if (insideBody) { diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTextImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTextImpl.java index c640e27f1ce8..9a8b11a88c2d 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTextImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlTextImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,6 +67,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI return true; } + @Override @Nullable public XmlText split(int displayIndex) { try { @@ -77,6 +78,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI } } + @Override public String getValue() { String displayText = myDisplayText; if (displayText != null) return displayText; @@ -133,6 +135,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI return text; } + @Override public int physicalToDisplay(int physicalIndex) { getValue(); if (myGapPhysicalStarts.length == 0) return physicalIndex; @@ -157,6 +160,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI return physicalIndex - prevPhysGapStart + prevDisplayGapStart; } + @Override public int displayToPhysical(int displayIndex) { getValue(); if (myGapDisplayStarts.length == 0) return displayIndex; @@ -170,6 +174,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI return displayIndex - prevDisplayGapStart + prevPhysGapStart; } + @Override public void setValue(String s) throws IncorrectOperationException { doSetValue(s, getPolicy()); } @@ -178,6 +183,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI final PomModel model = PomManager.getModel(getProject()); final XmlAspect aspect = model.getModelAspect(XmlAspect.class); model.runTransaction(new PomTransactionBase(this, aspect) { + @Override public PomModelEvent runInner() { final String oldText = getText(); final ASTNode firstEncodedElement = policy.encodeXmlTextContents(s, XmlTextImpl.this); @@ -192,6 +198,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI }); } + @Override public XmlElement insertAtOffset(final XmlElement element, final int displayOffset) throws IncorrectOperationException { if (element instanceof XmlText) { insertText(((XmlText)element).getValue(), displayOffset); @@ -200,6 +207,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI final PomModel model = PomManager.getModel(getProject()); final XmlAspect aspect = model.getModelAspect(XmlAspect.class); model.runTransaction(new PomTransactionBase(getParent(), aspect) { + @Override public PomModelEvent runInner() throws IncorrectOperationException { final XmlTag tag = getParentTag(); assert tag != null; @@ -224,6 +232,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI return LanguageXmlPsiPolicy.INSTANCE.forLanguage(getLanguage()); } + @Override public void insertText(String text, int displayOffset) throws IncorrectOperationException { if (text == null || text.isEmpty()) return; @@ -241,6 +250,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI final PomModel model = PomManager.getModel(getProject()); final XmlAspect aspect = model.getModelAspect(XmlAspect.class); model.runTransaction(new PomTransactionBase(this, aspect) { + @Override public PomModelEvent runInner() { final String oldText = getText(); @@ -265,6 +275,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI } } + @Override public void removeText(int displayStart, int displayEnd) throws IncorrectOperationException { final String value = getValue(); @@ -291,6 +302,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI final PomModel model = PomManager.getModel(getProject()); final XmlAspect aspect = model.getModelAspect(XmlAspect.class); model.runTransaction(new PomTransactionBase(this, aspect) { + @Override public PomModelEvent runInner() throws IncorrectOperationException { final String oldText = getText(); @@ -321,28 +333,33 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI } } + @Override public XmlTag getParentTag() { final PsiElement parent = getParent(); if (parent instanceof XmlTag) return (XmlTag)parent; return null; } + @Override public XmlTagChild getNextSiblingInTag() { PsiElement nextSibling = getNextSibling(); if (nextSibling instanceof XmlTagChild) return (XmlTagChild)nextSibling; return null; } + @Override public XmlTagChild getPrevSiblingInTag() { PsiElement prevSibling = getPrevSibling(); if (prevSibling instanceof XmlTagChild) return (XmlTagChild)prevSibling; return null; } + @Override public TreeElement addInternal(TreeElement first, ASTNode last, ASTNode anchor, Boolean before) { throw new RuntimeException("Clients must not use operations with direct children of XmlText!"); } + @Override public void accept(@NotNull PsiElementVisitor visitor) { if (visitor instanceof XmlElementVisitor) { ((XmlElementVisitor)visitor).visitXmlText(this); @@ -352,6 +369,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI } } + @Override public void clearCaches() { super.clearCaches(); myDisplayText = null; @@ -387,6 +405,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI return new TextRange(start, end); } + @Override public PsiLanguageInjectionHost updateText(@NotNull final String text) { try { doSetValue(text, new DefaultXmlPsiPolicy()); @@ -416,6 +435,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI super(xmlTag, aspect); } + @Override @Nullable public PomModelEvent runInner() throws IncorrectOperationException { final String oldText = getValue(); @@ -506,6 +526,7 @@ public class XmlTextImpl extends XmlElementImpl implements XmlText, PsiLanguageI return event; } + @Override @NotNull public LiteralTextEscaper createLiteralTextEscaper() { return new XmlTextLiteralEscaper(this); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/CDATAOnAnyEncodedPolicy.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/CDATAOnAnyEncodedPolicy.java index 69f8c40c3ff5..b3425e80501d 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/CDATAOnAnyEncodedPolicy.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/CDATAOnAnyEncodedPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ import com.intellij.util.CharTable; import com.intellij.xml.util.XmlUtil; public class CDATAOnAnyEncodedPolicy extends DefaultXmlPsiPolicy{ + @Override public ASTNode encodeXmlTextContents(String displayText, PsiElement text) { final ASTNode firstChild = text.getNode().getFirstChildNode(); boolean textAlreadyHasCDATA = firstChild != null && firstChild.getElementType() == XmlElementType.XML_CDATA; diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/DefaultXmlPsiPolicy.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/DefaultXmlPsiPolicy.java index a5bfb195dab7..23f0cf1988bf 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/DefaultXmlPsiPolicy.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/behavior/DefaultXmlPsiPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ import com.intellij.util.CharTable; public class DefaultXmlPsiPolicy implements XmlPsiPolicy{ private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.xml.behavior.DefaultXmlPsiPolicy"); + @Override public ASTNode encodeXmlTextContents(String displayText, PsiElement text) { final PsiFile containingFile = text.getContainingFile(); CharTable charTable = SharedImplUtil.findCharTableByTree(text.getNode()); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/xml/XmlChildRole.java b/xml/xml-psi-impl/src/com/intellij/psi/xml/XmlChildRole.java index 02cb1fe03b5a..4a4f66cf1dd2 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/xml/XmlChildRole.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/xml/XmlChildRole.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ import org.jetbrains.annotations.Nullable; public interface XmlChildRole { RoleFinder START_TAG_NAME_FINDER = new RoleFinder() { + @Override public ASTNode findChild(@NotNull ASTNode parent) { final PsiElement element = XmlTagUtil.getStartTagNameElement((XmlTag)parent.getPsi()); return element == null ? null : element.getNode(); @@ -35,6 +36,7 @@ public interface XmlChildRole { }; RoleFinder CLOSING_TAG_NAME_FINDER = new RoleFinder() { + @Override @Nullable public ASTNode findChild(@NotNull ASTNode parent) { final PsiElement element = XmlTagUtil.getEndTagNameElement((XmlTag)parent.getPsi()); @@ -43,6 +45,7 @@ public interface XmlChildRole { }; RoleFinder DOCUMENT_FINDER = new RoleFinder() { + @Override public ASTNode findChild(@NotNull ASTNode parent) { ASTNode oldDocument = parent.findChildByType(XmlElementType.XML_DOCUMENT); if(oldDocument == null) oldDocument = parent.findChildByType(XmlElementType.HTML_DOCUMENT); diff --git a/xml/xml-psi-impl/src/com/intellij/psi/xml/XmlElementType.java b/xml/xml-psi-impl/src/com/intellij/psi/xml/XmlElementType.java index 6e3d2db4f393..04f5d67d3694 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/xml/XmlElementType.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/xml/XmlElementType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,6 +67,7 @@ public interface XmlElementType extends XmlTokenType { IFileElementType DTD_FILE = new IFileElementType("DTD_FILE", DTDLanguage.INSTANCE); IElementType XML_MARKUP_DECL = new CustomParsingType("XML_MARKUP_DECL", XMLLanguage.INSTANCE){ + @Override public ASTNode parse(CharSequence text, CharTable table) { return new DtdParsing(text, XML_MARKUP_DECL, DtdParsing.TYPE_FOR_MARKUP_DECL, null).parse(); } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/DefaultXmlExtension.java b/xml/xml-psi-impl/src/com/intellij/xml/DefaultXmlExtension.java index 2a29eea055f2..de06f8cef03b 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/DefaultXmlExtension.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/DefaultXmlExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -37,10 +37,12 @@ import java.util.*; */ public class DefaultXmlExtension extends XmlExtension { + @Override public boolean isAvailable(final PsiFile file) { return true; } + @Override @NotNull public List getAvailableTagNames(@NotNull final XmlFile file, @NotNull final XmlTag context) { @@ -110,6 +112,7 @@ public class DefaultXmlExtension extends XmlExtension { return false; } + @Override public SchemaPrefix getPrefixDeclaration(final XmlTag context, String namespacePrefix) { @NonNls String nsDeclarationAttrName = null; for(XmlTag t = context; t != null; t = t.getParentTag()) { diff --git a/xml/xml-psi-impl/src/com/intellij/xml/actions/validate/ValidateXmlActionHandler.java b/xml/xml-psi-impl/src/com/intellij/xml/actions/validate/ValidateXmlActionHandler.java index 1495efb9d93f..2e851e555812 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/actions/validate/ValidateXmlActionHandler.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/actions/validate/ValidateXmlActionHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -138,24 +138,29 @@ public class ValidateXmlActionHandler { public void doParse() { try { myParser.parse(new InputSource(new StringReader(myFile.getText())), new DefaultHandler() { + @Override public void warning(SAXParseException e) throws SAXException { if (myErrorReporter.isUniqueProblem(e)) myErrorReporter.processError(e, ProblemType.WARNING); } + @Override public void error(SAXParseException e) throws SAXException { if (myErrorReporter.isUniqueProblem(e)) myErrorReporter.processError(e, ProblemType.ERROR); } + @Override public void fatalError(SAXParseException e) throws SAXException { if (myErrorReporter.isUniqueProblem(e)) myErrorReporter.processError(e, ProblemType.FATAL); } + @Override public InputSource resolveEntity(String publicId, String systemId) { final PsiFile psiFile = myXmlResourceResolver.resolve(null, systemId); if (psiFile == null) return null; return new InputSource(new StringReader(psiFile.getText())); } + @Override public void startDocument() throws SAXException { super.startDocument(); myParser.setProperty( @@ -173,7 +178,7 @@ public class ValidateXmlActionHandler { } myFile.putUserData(DEPENDENT_FILES_KEY, files); - myFile.putUserData(GRAMMAR_POOL_TIME_STAMP_KEY, new Long(calculateTimeStamp(files, myProject))); + myFile.putUserData(GRAMMAR_POOL_TIME_STAMP_KEY, calculateTimeStamp(files, myProject)); } myFile.putUserData(KNOWN_NAMESPACES_KEY, getNamespaces(myFile)); } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/BasicXmlAttributeDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/BasicXmlAttributeDescriptor.java index 4e2055d40fe7..541ab9a9794c 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/BasicXmlAttributeDescriptor.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/BasicXmlAttributeDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,10 +31,12 @@ import com.intellij.xml.XmlAttributeDescriptor; import org.jetbrains.annotations.Nullable; public abstract class BasicXmlAttributeDescriptor extends XmlEnumerationDescriptor implements XmlAttributeDescriptor { + @Override public String validateValue(XmlElement context, String value) { return null; } + @Override public String getName(PsiElement context){ return getName(); } @@ -54,12 +56,14 @@ public abstract class BasicXmlAttributeDescriptor extends XmlEnumerationDescript return getName(); } + @Override protected PsiElement getEnumeratedValueDeclaration(XmlElement xmlElement, String value) { String[] values = getEnumeratedValues(); if (values == null || values.length == 0) return getDeclaration(); return ArrayUtilRt.find(values, value) != -1 ? getDeclaration() : null; } + @Override protected PsiElement getDefaultValueDeclaration() { return getDeclaration(); } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/BaseXmlElementDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/BaseXmlElementDescriptorImpl.java index 5e144f7bdc4f..97e3b042c7e4 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/BaseXmlElementDescriptorImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/BaseXmlElementDescriptorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,9 +25,6 @@ import com.intellij.xml.XmlElementsGroup; import java.util.HashMap; -/** - * @by maxim - */ public abstract class BaseXmlElementDescriptorImpl implements XmlElementDescriptor { private volatile XmlElementDescriptor[] myElementDescriptors = null; private volatile XmlAttributeDescriptor[] myAttributeDescriptors; @@ -51,38 +48,46 @@ public abstract class BaseXmlElementDescriptorImpl implements XmlElementDescript static final FieldCache myElementDescriptorsCache = new FieldCache() { + @Override protected final XmlElementDescriptor[] compute(final BaseXmlElementDescriptorImpl xmlElementDescriptor, XmlTag tag) { return xmlElementDescriptor.doCollectXmlDescriptors(tag); } + @Override protected final XmlElementDescriptor[] getValue(final BaseXmlElementDescriptorImpl xmlElementDescriptor, Object o) { return xmlElementDescriptor.myElementDescriptors; } + @Override protected final void putValue(final XmlElementDescriptor[] xmlElementDescriptors, final BaseXmlElementDescriptorImpl xmlElementDescriptor,Object o) { xmlElementDescriptor.myElementDescriptors = xmlElementDescriptors; } }; + @Override public XmlElementDescriptor[] getElementsDescriptors(XmlTag context) { return myElementDescriptorsCache.get(null, this, context); } private static final SimpleFieldCache myAttributeDescriptorsCache = new SimpleFieldCache() { + @Override protected final XmlAttributeDescriptor[] compute(final BaseXmlElementDescriptorImpl xmlElementDescriptor) { return xmlElementDescriptor.collectAttributeDescriptors(null); } + @Override protected final XmlAttributeDescriptor[] getValue(final BaseXmlElementDescriptorImpl xmlElementDescriptor) { return xmlElementDescriptor.myAttributeDescriptors; } + @Override protected final void putValue(final XmlAttributeDescriptor[] xmlAttributeDescriptors, final BaseXmlElementDescriptorImpl xmlElementDescriptor) { xmlElementDescriptor.myAttributeDescriptors = xmlAttributeDescriptors; } }; + @Override public XmlAttributeDescriptor[] getAttributesDescriptors(final XmlTag context) { return myAttributeDescriptorsCache.get(this); } @@ -92,19 +97,23 @@ public abstract class BaseXmlElementDescriptorImpl implements XmlElementDescript private static final SimpleFieldCache, BaseXmlElementDescriptorImpl> attributeDescriptorsMapCache = new SimpleFieldCache, BaseXmlElementDescriptorImpl>() { + @Override protected final HashMap compute(final BaseXmlElementDescriptorImpl baseXmlElementDescriptor) { return baseXmlElementDescriptor.collectAttributeDescriptorsMap(null); } + @Override protected final HashMap getValue(final BaseXmlElementDescriptorImpl baseXmlElementDescriptor) { return baseXmlElementDescriptor.attributeDescriptorsMap; } + @Override protected final void putValue(final HashMap hashMap, final BaseXmlElementDescriptorImpl baseXmlElementDescriptor) { baseXmlElementDescriptor.attributeDescriptorsMap = hashMap; } }; + @Override public XmlAttributeDescriptor getAttributeDescriptor(String attributeName, final XmlTag context) { return attributeDescriptorsMapCache.get(this).get(attributeName); } @@ -114,20 +123,24 @@ public abstract class BaseXmlElementDescriptorImpl implements XmlElementDescript private static final FieldCache,BaseXmlElementDescriptorImpl,Object,XmlTag> myElementDescriptorsMapCache = new FieldCache, BaseXmlElementDescriptorImpl, Object, XmlTag>() { + @Override protected final HashMap compute(final BaseXmlElementDescriptorImpl baseXmlElementDescriptor, final XmlTag p) { return baseXmlElementDescriptor.collectElementDescriptorsMap(p); } + @Override protected final HashMap getValue(final BaseXmlElementDescriptorImpl baseXmlElementDescriptor, final Object p) { return baseXmlElementDescriptor.myElementDescriptorsMap; } + @Override protected final void putValue(final HashMap hashMap, final BaseXmlElementDescriptorImpl baseXmlElementDescriptor, final Object p) { baseXmlElementDescriptor.myElementDescriptorsMap = hashMap; } }; + @Override public XmlElementDescriptor getElementDescriptor(XmlTag element, XmlTag contextTag){ return myElementDescriptorsMapCache.get(null, this, element).get(element.getName()); } @@ -139,6 +152,7 @@ public abstract class BaseXmlElementDescriptorImpl implements XmlElementDescript // Read-only calculation protected abstract HashMap collectElementDescriptorsMap(final XmlTag element); + @Override public final XmlAttributeDescriptor getAttributeDescriptor(XmlAttribute attr){ return getAttributeDescriptor(attr.getName(), attr.getParent()); } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlAttributeDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlAttributeDescriptorImpl.java index 1471fc459eb0..fe0a8abdc80c 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlAttributeDescriptorImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlAttributeDescriptorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -44,14 +44,17 @@ public class XmlAttributeDescriptorImpl extends BasicXmlAttributeDescriptor impl init(decl); } + @Override public boolean isRequired() { return myRequired; } + @Override public PsiElement getDeclaration(){ return myDecl; } + @Override public String getName() { if (myName!=null) { return myName; @@ -60,6 +63,7 @@ public class XmlAttributeDescriptorImpl extends BasicXmlAttributeDescriptor impl return myName; } + @Override public void init(PsiElement element){ myDecl = (XmlAttributeDecl) element; myRequired = myDecl.isAttributeRequired(); @@ -67,22 +71,27 @@ public class XmlAttributeDescriptorImpl extends BasicXmlAttributeDescriptor impl myEnumerated = myDecl.isEnumerated(); } + @Override public Object[] getDependences(){ return new Object[]{myDecl}; } + @Override public boolean isFixed() { return myFixed; } + @Override public boolean hasIdType() { return myDecl.isIdAttribute(); } + @Override public boolean hasIdRefType() { return myDecl.isIdRefAttribute(); } + @Override public String getDefaultValue() { String text = myDecl.getDefaultValueText(); if (text != null) { @@ -92,10 +101,12 @@ public class XmlAttributeDescriptorImpl extends BasicXmlAttributeDescriptor impl return null; } + @Override public boolean isEnumerated() { return myEnumerated; } + @Override public String[] getEnumeratedValues() { XmlElement[] values = myDecl.getEnumeratedValues(); @@ -111,6 +122,7 @@ public class XmlAttributeDescriptorImpl extends BasicXmlAttributeDescriptor impl return getName(); } + @Override public void setName(String name) throws IncorrectOperationException { myName = name; ((PsiNamedElement)getDeclaration()).setName(name); diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlElementDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlElementDescriptorImpl.java index 551856d7e326..46ce5b49a362 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlElementDescriptorImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlElementDescriptorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -64,8 +64,10 @@ public class XmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl imple } private static final UserDataCache,XmlElement, Object> myAttlistDeclCache = new UserDataCache,XmlElement, Object>() { + @Override protected final CachedValue compute(final XmlElement owner, Object o) { return CachedValuesManager.getManager(owner.getProject()).createCachedValue(new CachedValueProvider() { + @Override public Result compute() { return new Result(doCollectAttlistDeclarations(owner),owner); } @@ -73,28 +75,34 @@ public class XmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl imple } }; + @Override public PsiElement getDeclaration(){ return myElementDecl; } + @Override public String getName(PsiElement context){ return getName(); } + @Override public String getName() { if (myName!=null) return myName; return myName = myElementDecl.getName(); } + @Override public void init(PsiElement element){ myElementDecl = (XmlElementDecl) element; } + @Override @SuppressWarnings("SpellCheckingInspection") public Object[] getDependences(){ return new Object[]{myElementDecl, ExternalResourceManager.getInstance()}; } + @Override public XmlNSDescriptor getNSDescriptor() { return getNsDescriptorFrom(myElementDecl); } @@ -112,6 +120,7 @@ public class XmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl imple } // Read-only action + @Override protected final XmlElementDescriptor[] doCollectXmlDescriptors(final XmlTag context) { final LinkedHashSet result = new LinkedHashSet(); final XmlElementContentSpec contentSpecElement = myElementDecl.getContentSpecElement(); @@ -119,6 +128,7 @@ public class XmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl imple final XmlNSDescriptor NSDescriptor = nsDescriptor != null? nsDescriptor:getNsDescriptorFrom(context); XmlUtil.processXmlElements(contentSpecElement, new PsiElementProcessor(){ + @Override public boolean execute(@NotNull PsiElement child){ if (child instanceof XmlToken) { final XmlToken token = (XmlToken)child; @@ -172,6 +182,7 @@ public class XmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl imple } // Read-only calculation + @Override protected final XmlAttributeDescriptor[] collectAttributeDescriptors(final XmlTag context) { final List result = new SmartList(); for (XmlAttlistDecl attlistDecl : findAttlistDeclarations(getName())) { @@ -185,6 +196,7 @@ public class XmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl imple } // Read-only calculation + @Override protected HashMap collectAttributeDescriptorsMap(final XmlTag context) { final HashMap localADM; final XmlAttributeDescriptor[] xmlAttributeDescriptors = getAttributesDescriptors(context); @@ -230,6 +242,7 @@ public class XmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl imple return topGroup == null ? null : new XmlElementsGroupImpl(topGroup, null); } + @Override public int getContentType() { if (myElementDecl.getContentSpecElement().isAny()) { return CONTENT_TYPE_ANY; @@ -248,6 +261,7 @@ public class XmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl imple } // Read-only calculation + @Override protected HashMap collectElementDescriptorsMap(final XmlTag element) { final HashMap elementDescriptorsMap; final XmlElementDescriptor[] descriptors = getElementsDescriptors(element); @@ -259,14 +273,17 @@ public class XmlElementDescriptorImpl extends BaseXmlElementDescriptorImpl imple return elementDescriptorsMap; } + @Override public String getQualifiedName() { return getName(); } + @Override public String getDefaultName() { return getName(); } + @Override public void setName(final String name) throws IncorrectOperationException { // IDEADEV-11439 myName = null; diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlNSDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlNSDescriptorImpl.java index b95ac5d2bd6d..18ea646c8b8b 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlNSDescriptorImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/dtd/XmlNSDescriptorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,14 +46,17 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator>, XmlNSDescriptorImpl> myCachedDeclsCache = new SimpleFieldCache>, XmlNSDescriptorImpl>() { + @Override protected final CachedValue> compute(final XmlNSDescriptorImpl xmlNSDescriptor) { return xmlNSDescriptor.doBuildDeclarationMap(); } + @Override protected final CachedValue> getValue(final XmlNSDescriptorImpl xmlNSDescriptor) { return xmlNSDescriptor.myCachedDecls; } + @Override protected final void putValue(final CachedValue> cachedValue, final XmlNSDescriptorImpl xmlNSDescriptor) { xmlNSDescriptor.myCachedDecls = cachedValue; } @@ -61,15 +64,18 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator> myCachedDecls; private static final XmlUtil.DuplicationInfoProvider XML_ELEMENT_DECL_PROVIDER = new XmlUtil.DuplicationInfoProvider() { + @Override public String getName(@NotNull final XmlElementDecl psiElement) { return psiElement.getName(); } + @Override @NotNull public String getNameKey(@NotNull final XmlElementDecl psiElement, @NotNull final String name) { return name; } + @Override @NotNull public PsiElement getNodeForMessage(@NotNull final XmlElementDecl psiElement) { return psiElement.getNameElement(); @@ -78,10 +84,12 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator> doBuildDeclarationMap() { return CachedValuesManager.getManager(myElement.getProject()).createCachedValue(new CachedValueProvider>() { + @Override public Result> compute() { final List result = new ArrayList(); myElement.processElements(new FilterElementProcessor(new ClassFilter(XmlElementDecl.class), result), getDeclaration()); @@ -116,11 +125,13 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator exists @@ -147,18 +158,22 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator decls = new ArrayList(3); XmlUtil.processXmlElements(document, new PsiElementProcessor() { + @Override public boolean execute(@NotNull final PsiElement element) { if (element instanceof XmlElementDecl) decls.add((XmlElementDecl)element); return true; diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/AnyXmlAttributeDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/AnyXmlAttributeDescriptor.java index 986ea48a921d..2a73abf3ef2c 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/AnyXmlAttributeDescriptor.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/AnyXmlAttributeDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,21 +42,26 @@ public class AnyXmlAttributeDescriptor implements XmlAttributeDescriptor { myCanContainAttributeType = canContainAttributeType; } + @Override public PsiElement getDeclaration(){ return null; } + @Override public String getName(PsiElement context){ return myAttributeName; } + @Override public String getName() { return myAttributeName; } + @Override public void init(PsiElement element){ } + @Override public Object[] getDependences(){ return ArrayUtil.EMPTY_OBJECT_ARRAY; } @@ -69,35 +74,43 @@ public class AnyXmlAttributeDescriptor implements XmlAttributeDescriptor { return myAttributeName; } + @Override public boolean isRequired() { return false; } + @Override public boolean isFixed() { return false; } + @Override public boolean hasIdType() { return false; } + @Override public boolean hasIdRefType() { return false; } + @Override public String getDefaultValue() { return null; } //todo: refactor to hierarchy of value descriptor? + @Override public boolean isEnumerated() { return false; } + @Override public String[] getEnumeratedValues() { return ArrayUtil.EMPTY_STRING_ARRAY; } + @Override public String validateValue(XmlElement context, String value) { return null; } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/AnyXmlElementDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/AnyXmlElementDescriptor.java index 7343adf58a01..a50c3a0ffea1 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/AnyXmlElementDescriptor.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/AnyXmlElementDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,6 +42,7 @@ public class AnyXmlElementDescriptor implements XmlElementDescriptor { myXmlNSDescriptor = xmlNSDescriptor; } + @Override public XmlNSDescriptor getNSDescriptor() { return myXmlNSDescriptor; } @@ -51,53 +52,66 @@ public class AnyXmlElementDescriptor implements XmlElementDescriptor { return null; } + @Override public PsiElement getDeclaration(){ return null; } + @Override public String getName(PsiElement context){ return getName(); } + @Override public String getName() { return myParentDescriptor.getName(); } + @Override public void init(PsiElement element){ } + @Override public Object[] getDependences(){ return ArrayUtil.EMPTY_OBJECT_ARRAY; } + @Override public String getQualifiedName() { return myParentDescriptor.getQualifiedName(); } + @Override public String getDefaultName() { return myParentDescriptor.getDefaultName(); } + @Override public XmlElementDescriptor[] getElementsDescriptors(XmlTag context) { return myParentDescriptor.getElementsDescriptors(context); } + @Override public XmlElementDescriptor getElementDescriptor(XmlTag tag, XmlTag contextTag){ return new AnyXmlElementDescriptor(this, myXmlNSDescriptor); } + @Override public XmlAttributeDescriptor[] getAttributesDescriptors(final XmlTag context) { return new XmlAttributeDescriptor[0]; } + @Override public XmlAttributeDescriptor getAttributeDescriptor(final String attributeName, final XmlTag context) { return new AnyXmlAttributeDescriptor(attributeName); } + @Override public XmlAttributeDescriptor getAttributeDescriptor(XmlAttribute attr){ return myParentDescriptor.getAttributeDescriptor(attr); } + @Override public int getContentType() { return CONTENT_TYPE_UNKNOWN; } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/ComplexTypeDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/ComplexTypeDescriptor.java index 31fd2d385364..09a51017260f 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/ComplexTypeDescriptor.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/ComplexTypeDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -49,14 +49,17 @@ public class ComplexTypeDescriptor extends TypeDescriptor { private static final FieldCache myElementDescriptorsCache = new FieldCache() { + @Override protected XmlElementDescriptor[] compute(final ComplexTypeDescriptor complexTypeDescriptor, final XmlElement p) { return complexTypeDescriptor.doCollectElements(p); } + @Override protected XmlElementDescriptor[] getValue(final ComplexTypeDescriptor complexTypeDescriptor, final Object p) { return complexTypeDescriptor.myElementDescriptors; } + @Override protected void putValue(final XmlElementDescriptor[] xmlElementDescriptors, final ComplexTypeDescriptor complexTypeDescriptor, final Object p) { complexTypeDescriptor.myElementDescriptors = xmlElementDescriptors; @@ -65,14 +68,17 @@ public class ComplexTypeDescriptor extends TypeDescriptor { private static final FieldCache myAttributeDescriptorsCache = new FieldCache() { + @Override protected final XmlAttributeDescriptor[] compute(final ComplexTypeDescriptor complexTypeDescriptor, XmlElement p) { return complexTypeDescriptor.doCollectAttributes(p); } + @Override protected final XmlAttributeDescriptor[] getValue(final ComplexTypeDescriptor complexTypeDescriptor, Object o) { return complexTypeDescriptor.myAttributeDescriptors; } + @Override protected final void putValue(final XmlAttributeDescriptor[] xmlAttributeDescriptors, final ComplexTypeDescriptor complexTypeDescriptor, final Object p) { complexTypeDescriptor.myAttributeDescriptors = xmlAttributeDescriptors; diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/NamedObjectDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/NamedObjectDescriptor.java index 04779f1707c1..be1801d252c0 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/NamedObjectDescriptor.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/NamedObjectDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ public class NamedObjectDescriptor implements PsiWritableMetaData, PsiMetaData { public NamedObjectDescriptor() {} + @Override public void setName(String name) throws IncorrectOperationException { setName(myDcl, name); } @@ -47,22 +48,27 @@ public class NamedObjectDescriptor implements PsiWritableMetaData, PsiMetaData { } } + @Override public PsiElement getDeclaration() { return myDcl; } + @Override public String getName(PsiElement context) { return getName(); } + @Override public String getName() { return myDcl.getAttributeValue("name"); } + @Override public void init(PsiElement element) { myDcl = (XmlTag)element; } + @Override public Object[] getDependences() { return new Object[] { myDcl }; } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/NullElementDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/NullElementDescriptor.java index 3704042e0aaa..63a0c2da0466 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/NullElementDescriptor.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/NullElementDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,35 +38,43 @@ public class NullElementDescriptor implements XmlElementDescriptor { private NullElementDescriptor() { } + @Override public String getQualifiedName() { return null; } + @Override public String getDefaultName() { return null; } //todo: refactor to support full DTD spec + @Override public XmlElementDescriptor[] getElementsDescriptors(XmlTag context) { return new XmlElementDescriptor[0]; } + @Override public XmlElementDescriptor getElementDescriptor(XmlTag childTag, XmlTag contextTag) { return null; } + @Override public XmlAttributeDescriptor[] getAttributesDescriptors(final XmlTag context) { return new XmlAttributeDescriptor[0]; } + @Override public XmlAttributeDescriptor getAttributeDescriptor(String attributeName, final XmlTag context) { return null; } + @Override public XmlAttributeDescriptor getAttributeDescriptor(XmlAttribute attribute) { return null; } + @Override public XmlNSDescriptor getNSDescriptor() { return null; } @@ -76,6 +84,7 @@ public class NullElementDescriptor implements XmlElementDescriptor { return null; } + @Override public int getContentType() { return 0; } @@ -85,21 +94,26 @@ public class NullElementDescriptor implements XmlElementDescriptor { return null; } + @Override public PsiElement getDeclaration() { return null; } + @Override public String getName(PsiElement context) { return null; } + @Override public String getName() { return null; } + @Override public void init(PsiElement element) { } + @Override public Object[] getDependences() { return ArrayUtil.EMPTY_OBJECT_ARRAY; } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/SchemaNSDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/SchemaNSDescriptor.java index f29bf32f1878..65a91cc93a16 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/SchemaNSDescriptor.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/SchemaNSDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,6 +42,7 @@ public class SchemaNSDescriptor extends XmlNSDescriptorImpl { @NonNls private static final String NAME_ATTR_NAME = "name"; private static final Validator ELEMENT_VALIDATOR = new Validator() { + @Override public void validate(@NotNull final XmlTag tag, @NotNull ValidationHost host) { if (!isFromSchemaNs(tag)) return; final boolean hasRefAttribute = tag.getAttributeValue(REF_ATTR_NAME) != null; @@ -95,6 +96,7 @@ public class SchemaNSDescriptor extends XmlNSDescriptorImpl { }; private static final Validator ATTRIBUTE_VALIDATOR = new Validator() { + @Override public void validate(@NotNull final XmlTag tag, @NotNull ValidationHost host) { if (!isFromSchemaNs(tag)) return; @@ -123,15 +125,18 @@ public class SchemaNSDescriptor extends XmlNSDescriptorImpl { }; private static final XmlUtil.DuplicationInfoProvider SCHEMA_ATTR_DUP_INFO_PROVIDER = new XmlUtil.DuplicationInfoProvider() { + @Override public String getName(@NotNull final XmlTag t) { return t.getAttributeValue(NAME_ATTR_NAME); } + @Override @NotNull public String getNameKey(@NotNull final XmlTag t, @NotNull String name) { return name; } + @Override @NotNull public PsiElement getNodeForMessage(@NotNull final XmlTag t) { return t.getAttribute(NAME_ATTR_NAME, null).getValueElement(); @@ -139,6 +144,7 @@ public class SchemaNSDescriptor extends XmlNSDescriptorImpl { }; private static final Validator ELEMENT_AND_ATTR_VALIDATOR = new Validator() { + @Override public void validate(@NotNull final XmlTag tag, @NotNull ValidationHost host) { if (!isFromSchemaNs(tag)) return; final String nsPrefix = tag.getNamespacePrefix(); @@ -166,6 +172,7 @@ public class SchemaNSDescriptor extends XmlNSDescriptorImpl { return XmlUtil.XML_SCHEMA_URI.equals(tag.getNamespace()); } + @Override protected XmlElementDescriptor createElementDescriptor(final XmlTag tag) { final XmlElementDescriptor descriptor = super.createElementDescriptor(tag); String localName = tag.getAttributeValue(NAME_ATTR_NAME); diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlAttributeDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlAttributeDescriptorImpl.java index 36156ae7fdaf..b463e92aa706 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlAttributeDescriptorImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlAttributeDescriptorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,23 +47,28 @@ public class XmlAttributeDescriptorImpl extends XsdEnumerationDescriptor impleme public XmlAttributeDescriptorImpl() {} + @Override public XmlTag getDeclaration(){ return myTag; } + @Override public String getName() { return myTag.getAttributeValue("name"); } + @Override public void init(PsiElement element){ myTag = (XmlTag) element; myUse = myTag.getAttributeValue("use"); } + @Override public Object[] getDependences(){ return ArrayUtil.EMPTY_OBJECT_ARRAY; } + @Override public boolean isRequired() { return REQUIRED_ATTR_VALUE.equals(myUse); } @@ -91,14 +96,17 @@ public class XmlAttributeDescriptorImpl extends XsdEnumerationDescriptor impleme return myTag.getAttributeValue("type"); } + @Override public boolean hasIdType() { return hasSimpleSchemaType("ID"); } + @Override public boolean hasIdRefType() { return hasSimpleSchemaType("IDREF"); } + @Override public boolean isEnumerated() { return isEnumerated(null); } @@ -109,6 +117,7 @@ public class XmlAttributeDescriptorImpl extends XsdEnumerationDescriptor impleme return null; } + @Override public String getName(PsiElement context) { String name = getName(); @@ -165,6 +174,7 @@ public class XmlAttributeDescriptorImpl extends XsdEnumerationDescriptor impleme return attributeShouldBeQualified; } + @Override public void setName(String name) throws IncorrectOperationException { NamedObjectDescriptor.setName(myTag, name); } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorByType.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorByType.java index 5e1bbd182e68..e901d597fd31 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorByType.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorByType.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,14 +39,17 @@ public class XmlElementDescriptorByType extends XmlElementDescriptorImpl { public XmlElementDescriptorByType() {} + @Override public XmlTag getDeclaration(){ return myDescriptorTag; } + @Override public String getName(PsiElement context){ return myDescriptorTag.getName(); } + @Override public XmlNSDescriptor getNSDescriptor() { XmlNSDescriptor nsDescriptor = NSDescriptor; if (nsDescriptor ==null) { @@ -60,10 +63,12 @@ public class XmlElementDescriptorByType extends XmlElementDescriptorImpl { return nsDescriptor; } + @Override public ComplexTypeDescriptor getType(XmlElement context) { return myType; } + @Override public String getDefaultName() { XmlTag rootTag = ((XmlFile)getType(null).getDeclaration().getContainingFile()).getDocument().getRootTag(); @@ -74,6 +79,7 @@ public class XmlElementDescriptorByType extends XmlElementDescriptorImpl { return getName(); } + @Override protected boolean askParentDescriptorViaXsi() { return false; } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorImpl.java index 3c75d9efcbf8..7bf9f02710b3 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlElementDescriptorImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -59,10 +59,12 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor public XmlElementDescriptorImpl() {} + @Override public XmlTag getDeclaration(){ return myDescriptorTag; } + @Override public String getName(PsiElement context){ String value = myDescriptorTag.getAttributeValue("name"); @@ -93,6 +95,7 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor } /** getter for _local_ name */ + @Override public String getName() { return XmlUtil.findLocalNameByQualifiedName(getName(null)); } @@ -122,6 +125,7 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor myDescriptorTag.getNamespaceByPrefix(namespacePrefix); } + @Override public void init(PsiElement element){ if (myDescriptorTag!=element && myDescriptorTag!=null) { NSDescriptor = null; @@ -129,6 +133,7 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor myDescriptorTag = (XmlTag) element; } + @Override public Object[] getDependences(){ return new Object[]{myDescriptorTag}; } @@ -151,6 +156,7 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor return nsDescriptor; } + @Override public XmlNSDescriptor getNSDescriptor() { XmlNSDescriptor nsDescriptor = NSDescriptor; if (nsDescriptor == null || !NSDescriptor.getDeclaration().isValid()) { @@ -198,6 +204,7 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor return type; } + @Override public XmlElementDescriptor[] getElementsDescriptors(XmlTag context) { if (context != null) { final XmlElementDescriptor parentDescriptorByType = XmlUtil.findXmlDescriptorByType(context); @@ -272,6 +279,7 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor return EMPTY_ARRAY; } + @Override public XmlAttributeDescriptor[] getAttributesDescriptors(final XmlTag context) { TypeDescriptor type = getType(context); @@ -318,6 +326,7 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor return attributeDescriptors; } + @Override public XmlAttributeDescriptor getAttributeDescriptor(String attributeName, final XmlTag context){ return getAttributeDescriptorImpl(attributeName,context); } @@ -355,6 +364,7 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor return attribute; } + @Override public XmlAttributeDescriptor getAttributeDescriptor(XmlAttribute attribute){ return getAttributeDescriptorImpl(attribute.getName(),attribute.getParent()); } @@ -384,6 +394,7 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor return null; } + @Override public int getContentType() { TypeDescriptor type = getType(); @@ -448,6 +459,7 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor return null; } + @Override public XmlElementDescriptor getElementDescriptor(XmlTag element, XmlTag contextTag){ final XmlElement context = (XmlElement)element.getParent(); @@ -475,6 +487,7 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor return true; } + @Override public String getQualifiedName() { String ns = getNS(); if (ns != null && !ns.isEmpty()) { @@ -489,6 +502,7 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor return XmlUtil.findNamespacePrefixByURI((XmlFile) myDescriptorTag.getContainingFile(), getNamespace()); } + @Override public String getDefaultName() { final PsiFile psiFile = myDescriptorTag.getContainingFile(); XmlTag rootTag = psiFile instanceof XmlFile ?((XmlFile)psiFile).getRootTag():null; @@ -508,6 +522,7 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor return Boolean.valueOf(descriptorTag.getAttributeValue("abstract")); } + @Override public void setName(String name) throws IncorrectOperationException { NamedObjectDescriptor.setName(myDescriptorTag, name); } @@ -516,6 +531,7 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor myValidator = validator; } + @Override public void validate(@NotNull XmlTag context, @NotNull ValidationHost host) { Validator validator = myValidator; if (validator != null) { @@ -533,6 +549,7 @@ public class XmlElementDescriptorImpl extends XsdEnumerationDescriptor }; } + @Override public boolean allowElementsFromNamespace(final String namespace, final XmlTag context) { final TypeDescriptor type = getType(context); diff --git a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlNSDescriptorImpl.java b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlNSDescriptorImpl.java index 63633af5ed0a..192c272a5f23 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlNSDescriptorImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/impl/schema/XmlNSDescriptorImpl.java @@ -136,10 +136,12 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator> myDescriptorsMap = Collections.synchronizedMap(new HashMap>()); private final Map, CachedValue> myTypesMap = Collections.synchronizedMap(new HashMap, CachedValue>()); + @Override @Nullable public XmlElementDescriptor getElementDescriptor(String localName, String namespace) { return getElementDescriptor(localName, namespace, new HashSet(),false); @@ -185,6 +188,7 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator cachedValue = CachedValuesManager.getManager(tag.getProject()).createCachedValue(new CachedValueProvider() { + @Override public Result compute() { final String name = tag.getAttributeValue("name"); @@ -324,6 +328,7 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator value = CachedValuesManager.getManager(includedDocument.getProject()).createCachedValue( new CachedValueProvider(){ + @Override public Result compute() { Object[] deps = attributeDescriptor.getDependences(); if (deps.length == 0) { @@ -350,6 +355,7 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator value = CachedValuesManager.getManager(tag.getProject()).createCachedValue(new CachedValueProvider() { + @Override public Result compute() { final String currentName = tag.getAttributeValue("name"); @@ -600,6 +608,7 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator createAndPutTypesCachedValueSimpleType(final XmlTag tag, final Pair pair) { final CachedValue value = CachedValuesManager.getManager(tag.getProject()).createCachedValue(new CachedValueProvider() { + @Override public CachedValueProvider.Result compute() { final SimpleTypeDescriptor simpleTypeDescriptor = new SimpleTypeDescriptor(tag); return new Result(simpleTypeDescriptor, tag); @@ -611,6 +620,7 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator createAndPutTypesCachedValue(final XmlTag tag, final Pair pair) { final CachedValue value = CachedValuesManager.getManager(tag.getProject()).createCachedValue(new CachedValueProvider() { + @Override public CachedValueProvider.Result compute() { final String name = tag.getAttributeValue("name"); @@ -630,6 +640,7 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator { final List result = new ArrayList(); + @Override public boolean execute(@NotNull final XmlTag element) { ContainerUtil.addIfNotNull(result, getElementDescriptor(element.getAttributeValue("name"), getDefaultNamespace())); return true; @@ -688,6 +701,7 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator { final List result = new ArrayList(); + @Override public boolean execute(@NotNull final XmlTag element) { result.add(createAttributeDescriptor(element)); return true; @@ -893,18 +908,22 @@ public class XmlNSDescriptorImpl implements XmlNSDescriptorEx,Validator extends Xml public abstract XmlTag getDeclaration(); + @Override public String getDefaultValue() { if (isFixed()) { return getDeclaration().getAttributeValue("fixed"); @@ -35,10 +51,12 @@ public abstract class XsdEnumerationDescriptor extends Xml return getDeclaration().getAttributeValue("default"); } + @Override public boolean isFixed() { return getDeclaration().getAttributeValue("fixed") != null; } + @Override public String[] getEnumeratedValues() { return getEnumeratedValues(null); } @@ -112,6 +130,7 @@ public abstract class XsdEnumerationDescriptor extends Xml } + @Override public boolean isEnumerated(@Nullable XmlElement context) { return processEnumeration(context, PairProcessor.TRUE); } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/index/IndexedRelevantResource.java b/xml/xml-psi-impl/src/com/intellij/xml/index/IndexedRelevantResource.java index 9005a94f76dc..ea1396c9bce8 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/index/IndexedRelevantResource.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/index/IndexedRelevantResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,6 +48,7 @@ public class IndexedRelevantResource implements Compara final ArrayList> resources = new ArrayList>(); final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex(); FileBasedIndex.getInstance().processValues(indexId, key, null, new FileBasedIndex.ValueProcessor() { + @Override public boolean process(VirtualFile file, V value) { ResourceRelevance relevance = ResourceRelevance.getRelevance(file, module, fileIndex, additionalScope); resources.add(new IndexedRelevantResource(file, key, value, relevance)); @@ -104,6 +105,7 @@ public class IndexedRelevantResource implements Compara return myRelevance; } + @Override public int compareTo(IndexedRelevantResource o) { int i = myRelevance.compareTo(o.getRelevance()); return i == 0 ? myValue.compareTo(o.getValue()) : i; diff --git a/xml/xml-psi-impl/src/com/intellij/xml/index/XmlIndex.java b/xml/xml-psi-impl/src/com/intellij/xml/index/XmlIndex.java index fb5242cb3e51..28a43ab9bf52 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/index/XmlIndex.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/index/XmlIndex.java @@ -45,10 +45,12 @@ public abstract class XmlIndex extends FileBasedIndexExtension { protected static GlobalSearchScope createFilter(final Project project) { final GlobalSearchScope projectScope = GlobalSearchScope.allScope(project); return new GlobalSearchScope(project) { + @Override public int compare(@NotNull VirtualFile file1, @NotNull VirtualFile file2) { return projectScope.compare(file1, file2); } + @Override public boolean isSearchInModuleContent(@NotNull Module aModule) { return true; } @@ -71,6 +73,7 @@ public abstract class XmlIndex extends FileBasedIndexExtension { final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(module.getProject()).getFileIndex(); return new VirtualFileFilter() { + @Override public boolean accept(final VirtualFile file) { Module moduleForFile = fileIndex.getModuleForFile(file); if (moduleForFile != null) { // in module content @@ -95,14 +98,17 @@ public abstract class XmlIndex extends FileBasedIndexExtension { }; } + @Override @NotNull public KeyDescriptor getKeyDescriptor() { return KEY_DESCRIPTOR; } + @Override @NotNull public FileBasedIndex.InputFilter getInputFilter() { return new DefaultFileTypeSpecificInputFilter(XmlFileType.INSTANCE, DTDFileType.INSTANCE) { + @Override public boolean acceptInput(@NotNull final VirtualFile file) { FileType fileType = file.getFileType(); final String extension = file.getExtension(); @@ -112,10 +118,12 @@ public abstract class XmlIndex extends FileBasedIndexExtension { }; } + @Override public boolean dependsOnFileContent() { return true; } + @Override public int getVersion() { return 0; } diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/HTMLControls.java b/xml/xml-psi-impl/src/com/intellij/xml/util/HTMLControls.java index 1611b7819155..30586d613e14 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/util/HTMLControls.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/util/HTMLControls.java @@ -39,7 +39,7 @@ import java.util.Set; * @author Dennis.Ushakov */ public class HTMLControls { - private static Logger LOG = Logger.getInstance(HTMLControls.class); + private static final Logger LOG = Logger.getInstance(HTMLControls.class); private static Control[] ourControls; public static Control[] getControls() { @@ -85,7 +85,7 @@ public class HTMLControls { @Attribute("emptyAllowed") public boolean emptyAllowed; @Attribute(value = "autoClosedBy", converter = AutoCloseConverter.class) - public Set autoClosedBy = Collections.emptySet(); + public final Set autoClosedBy = Collections.emptySet(); } private static class TagStateConverter extends Converter { diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/IncludedXmlText.java b/xml/xml-psi-impl/src/com/intellij/xml/util/IncludedXmlText.java index b98a360193b0..51120a9baa61 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/util/IncludedXmlText.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/util/IncludedXmlText.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -51,34 +51,42 @@ public class IncludedXmlText extends IncludedXmlElement implements XmlT return getOriginal().getText(); } + @Override public String getValue() { return getOriginal().getValue(); } + @Override public void setValue(String s) throws IncorrectOperationException { throw new UnsupportedOperationException("Can't modify included elements"); } + @Override public XmlElement insertAtOffset(XmlElement element, int displayOffset) throws IncorrectOperationException { throw new UnsupportedOperationException("Can't modify included elements"); } + @Override public void insertText(String text, int displayOffset) throws IncorrectOperationException { throw new UnsupportedOperationException("Can't modify included elements"); } + @Override public void removeText(int displayStart, int displayEnd) throws IncorrectOperationException { throw new UnsupportedOperationException("Can't modify included elements"); } + @Override public int physicalToDisplay(int offset) { return getOriginal().physicalToDisplay(offset); } + @Override public int displayToPhysical(int offset) { return getOriginal().displayToPhysical(offset); } + @Override @Nullable public XmlText split(int displayIndex) { throw new UnsupportedOperationException("Can't modify included elements"); diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/InclusionProvider.java b/xml/xml-psi-impl/src/com/intellij/xml/util/InclusionProvider.java index 7c05a0aaf750..d1fdde132e12 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/util/InclusionProvider.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/util/InclusionProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,6 +46,7 @@ class InclusionProvider implements CachedValueProvider { return CachedValuesManager.getCachedValue(xincludeTag, new InclusionProvider(xincludeTag)); } + @Override public Result compute() { PsiElement[] result = RecursionManager.doPreventingRecursion(myXincludeTag, true, new NullableComputable() { @Override diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlApplicationComponent.java b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlApplicationComponent.java index 764db5ac479d..513d280b8eee 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlApplicationComponent.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlApplicationComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ import com.intellij.xml.impl.schema.XmlElementDescriptorImpl; * @author Maxim.Mossienko */ public class XmlApplicationComponent implements MetaDataContributor { + @Override public void contributeMetaData(final MetaDataRegistrar registrar) { { registrar.registerMetaData( diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlNSDescriptorSequence.java b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlNSDescriptorSequence.java index 06ab056c8eb1..ead67f6cacf9 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlNSDescriptorSequence.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlNSDescriptorSequence.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; /** @@ -43,8 +42,7 @@ public class XmlNSDescriptorSequence implements XmlNSDescriptor{ } public XmlNSDescriptorSequence(XmlNSDescriptor[] descriptors){ - for(int i = 0; i < descriptors.length; i++){ - final XmlNSDescriptor descriptor = descriptors[i]; + for (final XmlNSDescriptor descriptor : descriptors) { add(descriptor); } } @@ -53,34 +51,31 @@ public class XmlNSDescriptorSequence implements XmlNSDescriptor{ sequence.add(descriptor); } + @Override public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag){ - final Iterator iterator = sequence.iterator(); - while(iterator.hasNext()){ - final XmlNSDescriptor descriptor = (XmlNSDescriptor) iterator.next(); + for (XmlNSDescriptor descriptor : sequence) { final XmlElementDescriptor elementDescriptor = descriptor.getElementDescriptor(tag); - if(elementDescriptor != null) return elementDescriptor; + if (elementDescriptor != null) return elementDescriptor; } return null; } + @Override @NotNull public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable final XmlDocument document) { final List descriptors = new ArrayList(); - final Iterator iterator = sequence.iterator(); - while(iterator.hasNext()) { - final XmlNSDescriptor descriptor = (XmlNSDescriptor)iterator.next(); + for (XmlNSDescriptor descriptor : sequence) { ContainerUtil.addAll(descriptors, descriptor.getRootElementsDescriptors(document)); } return descriptors.toArray(new XmlElementDescriptor[descriptors.size()]); } + @Override public XmlFile getDescriptorFile(){ - final Iterator iterator = sequence.iterator(); - while(iterator.hasNext()){ - final XmlNSDescriptor descriptor = (XmlNSDescriptor) iterator.next(); + for (XmlNSDescriptor descriptor : sequence) { final XmlFile file = descriptor.getDescriptorFile(); - if(file != null) return file; + if (file != null) return file; } return null; } @@ -89,58 +84,52 @@ public class XmlNSDescriptorSequence implements XmlNSDescriptor{ return sequence; } + @Override public boolean isHierarhyEnabled() { - final Iterator iterator = sequence.iterator(); - while(iterator.hasNext()){ - final XmlNSDescriptor descriptor = (XmlNSDescriptor) iterator.next(); - if(descriptor.isHierarhyEnabled()) return true; + for (XmlNSDescriptor descriptor : sequence) { + if (descriptor.isHierarhyEnabled()) return true; } return false; } + @Override public PsiElement getDeclaration(){ - final Iterator iterator = sequence.iterator(); - while(iterator.hasNext()){ - final XmlNSDescriptor descriptor = (XmlNSDescriptor) iterator.next(); + for (XmlNSDescriptor descriptor : sequence) { final PsiElement declaration = descriptor.getDeclaration(); - if(declaration != null) return declaration; + if (declaration != null) return declaration; } return null; } + @Override public String getName(PsiElement context){ - final Iterator iterator = sequence.iterator(); - while(iterator.hasNext()){ - final XmlNSDescriptor descriptor = (XmlNSDescriptor) iterator.next(); + for (XmlNSDescriptor descriptor : sequence) { final String name = descriptor.getName(context); - if(name != null) return name; + if (name != null) return name; } return null; } + @Override public String getName(){ - final Iterator iterator = sequence.iterator(); - while(iterator.hasNext()){ - final XmlNSDescriptor descriptor = (XmlNSDescriptor) iterator.next(); + for (XmlNSDescriptor descriptor : sequence) { final String name = descriptor.getName(); - if(name != null) return name; + if (name != null) return name; } return null; } + @Override public void init(PsiElement element){ - final Iterator iterator = sequence.iterator(); - while(iterator.hasNext()){ - final XmlNSDescriptor descriptor = (XmlNSDescriptor) iterator.next(); + for (XmlNSDescriptor descriptor : sequence) { descriptor.init(element); } } + @Override public Object[] getDependences(){ final List ret = new ArrayList(); - final Iterator iterator = sequence.iterator(); - while(iterator.hasNext()) { - final XmlNSDescriptor descriptor = (XmlNSDescriptor)iterator.next(); + for (XmlNSDescriptor descriptor : sequence) { ContainerUtil.addAll(ret, descriptor.getDependences()); } return ret.toArray(); diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlPsiUtil.java b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlPsiUtil.java index 57cff1c08069..9f2453e0b515 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlPsiUtil.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlPsiUtil.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.xml.util; import com.intellij.openapi.util.Key; @@ -204,6 +219,7 @@ public class XmlPsiUtil { if (value == null) { value = CachedValuesManager.getManager(entityDecl.getProject()).createCachedValue(new CachedValueProvider() { + @Override public Result compute() { final PsiElement res = entityDecl.parse(targetFile, type, entityRef); if (res == null) return new Result(res, targetFile); diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlResourceResolver.java b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlResourceResolver.java index fdd2690ac746..cc3269f38107 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlResourceResolver.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlResourceResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -81,7 +81,7 @@ public class XmlResourceResolver implements XMLEntityResolver { @Nullable public PsiFile resolve(@Nullable final String baseSystemId, final String _systemId) { if (LOG.isDebugEnabled()) { - LOG.debug("enter: resolveEntity(baseSystemId='" + baseSystemId + "' systemId='" + _systemId + "," + super.toString() + "')"); + LOG.debug("enter: resolveEntity(baseSystemId='" + baseSystemId + "' systemId='" + _systemId + "," + toString() + "')"); } if (_systemId == null) return null; @@ -95,6 +95,7 @@ public class XmlResourceResolver implements XMLEntityResolver { final PsiFile[] result = new PsiFile[] { null }; final Runnable action = new Runnable() { + @Override public void run() { PsiFile baseFile = null; VirtualFile vFile = null; @@ -213,7 +214,7 @@ public class XmlResourceResolver implements XMLEntityResolver { if (file != null) { final String url = file.getUrl(); if (LOG.isDebugEnabled()) { - LOG.debug("Adding external resource ref:"+systemId+","+url+","+super.toString()); + LOG.debug("Adding external resource ref:"+systemId+","+url+","+ toString()); } myExternalResourcesMap.put(systemId,url); } @@ -221,6 +222,7 @@ public class XmlResourceResolver implements XMLEntityResolver { return psiFile; } + @Override @Nullable public XMLInputSource resolveEntity(XMLResourceIdentifier xmlResourceIdentifier) throws XNIException, IOException { String publicId = xmlResourceIdentifier.getLiteralSystemId() != null ? diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlUtil.java b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlUtil.java index b82f69bb7ffb..a513db49b121 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/util/XmlUtil.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/util/XmlUtil.java @@ -284,6 +284,7 @@ public class XmlUtil { resources = XmlNamespaceIndex.getResourcesByNamespace(namespace, project, module); final PsiManager psiManager = PsiManager.getInstance(project); return ContainerUtil.mapNotNull(resources, new NullableFunction, XmlFile>() { + @Override public XmlFile fun(IndexedRelevantResource resource) { PsiFile file = psiManager.findFile(resource.getFile()); return file instanceof XmlFile ? (XmlFile)file : null; @@ -427,6 +428,7 @@ public class XmlUtil { final XmlTag[] simpleContent = new XmlTag[1]; processXmlElements(((ComplexTypeDescriptor)type).getDeclaration(), new PsiElementProcessor() { + @Override public boolean execute(@NotNull final PsiElement element) { if (element instanceof XmlTag) { final XmlTag tag = (XmlTag)element; @@ -848,6 +850,7 @@ public class XmlUtil { final XmlAttribute[] attributes = tag.getAttributes(); ContainerUtil.sort(list); Arrays.sort(attributes, new Comparator() { + @Override public int compare(XmlAttribute attr1, XmlAttribute attr2) { return attr1.getName().compareTo(attr2.getName()); } @@ -890,6 +893,7 @@ public class XmlUtil { tagsMap.put(tagName, tags); PsiFile file = tag.isValid() ? tag.getContainingFile() : null; processXmlElements(tag, new FilterElementProcessor(XmlTagFilter.INSTANCE) { + @Override public void add(PsiElement element) { XmlTag tag = (XmlTag)element; if (!tags.contains(tag.getName())) { @@ -953,6 +957,7 @@ public class XmlUtil { public static boolean collectEnumerationValues(final XmlTag element, final HashSet variants) { return processEnumerationValues(element, new Processor() { + @Override public boolean process(XmlTag xmlTag) { variants.add(xmlTag.getAttributeValue(VALUE_ATTR_NAME)); return true; @@ -1146,6 +1151,7 @@ public class XmlUtil { final PsiNamedElement[] result = new PsiNamedElement[1]; processXmlElements((XmlFile)currentElement, new PsiElementProcessor() { + @Override public boolean execute(@NotNull final PsiElement element) { if (element instanceof PsiNamedElement) { final String elementName = ((PsiNamedElement)element).getName(); @@ -1196,6 +1202,7 @@ public class XmlUtil { myRequired = flag; } + @Override public int compareTo(Object o) { if (o instanceof MyAttributeInfo) { return myName.compareTo(((MyAttributeInfo)o).myName); diff --git a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/CompositeAttributeTagDescriptor.java b/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/CompositeAttributeTagDescriptor.java index 53fdca8c4ee0..c23f3539c2e0 100644 --- a/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/CompositeAttributeTagDescriptor.java +++ b/xml/xml-psi-impl/src/com/intellij/xml/util/documentation/CompositeAttributeTagDescriptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ import java.util.List; * @author maxim */ class CompositeAttributeTagDescriptor extends HtmlAttributeDescriptor { - List attributes = new LinkedList(); + final List attributes = new LinkedList(); HtmlAttributeDescriptor findHtmlAttributeInContext(XmlTag tag) { if (tag == null) return null; diff --git a/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/AbstractXmlTagTreeElement.java b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/AbstractXmlTagTreeElement.java index 2383784267ae..55e994d05619 100644 --- a/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/AbstractXmlTagTreeElement.java +++ b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/AbstractXmlTagTreeElement.java @@ -36,6 +36,7 @@ public abstract class AbstractXmlTagTreeElement extends Ps (XmlStructureViewElementProvider[])Extensions.getExtensions(XmlStructureViewElementProvider.EXTENSION_POINT_NAME); return ContainerUtil.map2List(subTags, new Function() { + @Override public StructureViewTreeElement fun(final XmlTag xmlTag) { for (final XmlStructureViewElementProvider provider : providers) { final StructureViewTreeElement element = provider.createCustomXmlTagTreeElement(xmlTag); diff --git a/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/DtdFileTreeElement.java b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/DtdFileTreeElement.java index 8ca2b8933572..c1c811b55c53 100644 --- a/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/DtdFileTreeElement.java +++ b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/DtdFileTreeElement.java @@ -36,6 +36,7 @@ public class DtdFileTreeElement extends PsiTreeElementBase { super(file); } + @Override @NotNull public Collection getChildrenBase() { return collectElements(getElement().getDocument()); @@ -45,6 +46,7 @@ public class DtdFileTreeElement extends PsiTreeElementBase { final List elements = new ArrayList(); XmlUtil.processXmlElements(element, new PsiElementProcessor() { + @Override public boolean execute(@NotNull final PsiElement element) { if (element instanceof XmlElementDecl || element instanceof XmlEntityDecl) { @@ -56,6 +58,7 @@ public class DtdFileTreeElement extends PsiTreeElementBase { return elements; } + @Override public String getPresentableText() { return getElement().getName(); } @@ -72,20 +75,24 @@ public class DtdFileTreeElement extends PsiTreeElementBase { super(element); } + @Override @NotNull public Collection getChildrenBase() { return Collections.emptyList(); } + @Override public String getPresentableText() { final PsiNamedElement namedElement = getElement(); return namedElement != null ? namedElement.getName():""; } + @Override public Icon getIcon(final boolean open) { return PlatformIcons.XML_TAG_ICON; } + @Override public String getLocationString() { final XmlElement owner = (XmlElement)getElement(); diff --git a/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/XmlFileTreeElement.java b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/XmlFileTreeElement.java index f13fe1ccba61..d9447ea774a7 100644 --- a/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/XmlFileTreeElement.java +++ b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/XmlFileTreeElement.java @@ -29,6 +29,7 @@ public class XmlFileTreeElement extends AbstractXmlTagTreeElement { super(file); } + @Override @NotNull public Collection getChildrenBase() { final XmlDocument document = getElement().getDocument(); @@ -66,6 +67,7 @@ public class XmlFileTreeElement extends AbstractXmlTagTreeElement { return structureViewTreeElements; } + @Override public String getPresentableText() { return getElement().getName(); } diff --git a/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/Html5SectionsProcessor.java b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/Html5SectionsProcessor.java index 2ca1c8b3ca63..fc5361b11f53 100644 --- a/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/Html5SectionsProcessor.java +++ b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/Html5SectionsProcessor.java @@ -36,7 +36,7 @@ class Html5SectionsProcessor { private static class SectionHolder { private final XmlTag myTag; - private LinkedList
myChildren = new LinkedList
(); + private final LinkedList
myChildren = new LinkedList
(); private SectionHolder(final XmlTag tag) { myTag = tag; @@ -63,6 +63,7 @@ class Html5SectionsProcessor { super(tag); } + @Override public void addChildSection(final Section section) { section.myParent = this; super.addChildSection(section); @@ -87,6 +88,7 @@ class Html5SectionsProcessor { private static final String HGROUP_ELEMENT = "hgroup"; private final Collection myRootSectionHolders = new SortedList(new Comparator() { + @Override public int compare(final SectionHolder first, final SectionHolder second) { return first.getTag().getTextRange().getStartOffset() - second.getTag().getTextRange().getStartOffset(); } @@ -216,6 +218,7 @@ class Html5SectionsProcessor { private static Computable> createChildrenComputable(final Collection
children) { return new Computable>() { + @Override public Collection compute() { final Collection result = new ArrayList(); for (Section section : children) {