http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationUtil.java ---------------------------------------------------------------------- diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationUtil.java new file mode 100644 index 0000000..962c1bb --- /dev/null +++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/PolygeneServiceAnnotationUtil.java @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.polygene.ide.plugin.idea.injections.service.common; + +import com.intellij.psi.PsiAnnotation; +import com.intellij.psi.PsiModifierList; +import com.intellij.psi.PsiModifierListOwner; +import com.intellij.psi.PsiVariable; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import static com.intellij.codeInsight.AnnotationUtil.findAnnotation; +import static com.intellij.psi.PsiModifier.STATIC; +import static org.apache.polygene.ide.plugin.idea.injections.service.common.PolygeneServiceAnnotationConstants.QUALIFIED_NAME_SERVICE_ANNOTATION; +import static org.apache.polygene.ide.plugin.idea.injections.service.common.PolygeneServiceAnnotationUtil.ServiceAnnotationDeclarationValidationResult.*; +import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.isInjecteableByStructureAnnotation; + +/** + * @author [email protected] + * @since 0.1 + */ +public final class PolygeneServiceAnnotationUtil +{ + /** + * Returns {@code @Service} annotation if exists. + * + * @param modifierListOwner modifier list owner to process. + * @return {@code @Service} annotation if exists, {@code null} otherwise. + * @since 0.1 + */ + @Nullable + public static PsiAnnotation getServiceAnnotation( @NotNull PsiModifierListOwner modifierListOwner ) + { + return findAnnotation( modifierListOwner, QUALIFIED_NAME_SERVICE_ANNOTATION ); + } + + /** + * Validates whether the variable has {@code @Service} annotation declared correctly. + * + * @param variable variable to check. + * @return Look at {@link ServiceAnnotationDeclarationValidationResult}. + * @since 0.1 + */ + @NotNull + public static ServiceAnnotationDeclarationValidationResult isValidServiceAnnotationDeclaration( + @NotNull PsiVariable variable ) + { + PsiAnnotation serviceAnnotation = getServiceAnnotation( variable ); + if( serviceAnnotation == null ) + { + return invalidServiceAnnotationNotDeclared; + } + + PsiModifierList modifierList = variable.getModifierList(); + if( modifierList != null ) + { + if( modifierList.hasModifierProperty( STATIC ) ) + { + return invalidDeclaredOnStaticVariable; + } + } + + // Can't be type that is injected by @Structure + if( isInjecteableByStructureAnnotation( variable ) ) + { + return invalidTypeIsInjectedViaStructureAnnotation; + } + + return valid; + } + + public enum ServiceAnnotationDeclarationValidationResult + { + invalidServiceAnnotationNotDeclared, + invalidDeclaredOnStaticVariable, + invalidTypeIsInjectedViaStructureAnnotation, + valid, + } + + private PolygeneServiceAnnotationUtil() + { + } +} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/ZestServiceAnnotationConstants.java ---------------------------------------------------------------------- diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/ZestServiceAnnotationConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/ZestServiceAnnotationConstants.java deleted file mode 100644 index 5a95513..0000000 --- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/ZestServiceAnnotationConstants.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.polygene.ide.plugin.idea.injections.service.common; - -/** - * @author [email protected] - * @since 0.1 - */ -public final class PolygeneServiceAnnotationConstants -{ - public static final String QUALIFIED_NAME_SERVICE_ANNOTATION = "org.apache.polygene.api.injection.scope.Service"; - - private PolygeneServiceAnnotationConstants() - { - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/ZestServiceAnnotationUtil.java ---------------------------------------------------------------------- diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/ZestServiceAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/ZestServiceAnnotationUtil.java deleted file mode 100644 index 962c1bb..0000000 --- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/service/common/ZestServiceAnnotationUtil.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.polygene.ide.plugin.idea.injections.service.common; - -import com.intellij.psi.PsiAnnotation; -import com.intellij.psi.PsiModifierList; -import com.intellij.psi.PsiModifierListOwner; -import com.intellij.psi.PsiVariable; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import static com.intellij.codeInsight.AnnotationUtil.findAnnotation; -import static com.intellij.psi.PsiModifier.STATIC; -import static org.apache.polygene.ide.plugin.idea.injections.service.common.PolygeneServiceAnnotationConstants.QUALIFIED_NAME_SERVICE_ANNOTATION; -import static org.apache.polygene.ide.plugin.idea.injections.service.common.PolygeneServiceAnnotationUtil.ServiceAnnotationDeclarationValidationResult.*; -import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.isInjecteableByStructureAnnotation; - -/** - * @author [email protected] - * @since 0.1 - */ -public final class PolygeneServiceAnnotationUtil -{ - /** - * Returns {@code @Service} annotation if exists. - * - * @param modifierListOwner modifier list owner to process. - * @return {@code @Service} annotation if exists, {@code null} otherwise. - * @since 0.1 - */ - @Nullable - public static PsiAnnotation getServiceAnnotation( @NotNull PsiModifierListOwner modifierListOwner ) - { - return findAnnotation( modifierListOwner, QUALIFIED_NAME_SERVICE_ANNOTATION ); - } - - /** - * Validates whether the variable has {@code @Service} annotation declared correctly. - * - * @param variable variable to check. - * @return Look at {@link ServiceAnnotationDeclarationValidationResult}. - * @since 0.1 - */ - @NotNull - public static ServiceAnnotationDeclarationValidationResult isValidServiceAnnotationDeclaration( - @NotNull PsiVariable variable ) - { - PsiAnnotation serviceAnnotation = getServiceAnnotation( variable ); - if( serviceAnnotation == null ) - { - return invalidServiceAnnotationNotDeclared; - } - - PsiModifierList modifierList = variable.getModifierList(); - if( modifierList != null ) - { - if( modifierList.hasModifierProperty( STATIC ) ) - { - return invalidDeclaredOnStaticVariable; - } - } - - // Can't be type that is injected by @Structure - if( isInjecteableByStructureAnnotation( variable ) ) - { - return invalidTypeIsInjectedViaStructureAnnotation; - } - - return valid; - } - - public enum ServiceAnnotationDeclarationValidationResult - { - invalidServiceAnnotationNotDeclared, - invalidDeclaredOnStaticVariable, - invalidTypeIsInjectedViaStructureAnnotation, - valid, - } - - private PolygeneServiceAnnotationUtil() - { - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationConstants.java ---------------------------------------------------------------------- diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationConstants.java new file mode 100644 index 0000000..2a5d3bf --- /dev/null +++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationConstants.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.polygene.ide.plugin.idea.injections.structure.common; + +import static java.util.Arrays.sort; + +/** + * @author [email protected] + * @since 0.1 + */ +public final class PolygeneStructureAnnotationConstants +{ + public static final String QUALIFIED_NAME_STRUCTURE_ANNOTATION = "org.apache.polygene.api.injection.scope.Structure"; + + public static final String[] VALID_STRUCTURE_INJECTION_TYPE; + + static + { + VALID_STRUCTURE_INJECTION_TYPE = new String[] + { + "org.apache.polygene.composite.CompositeBuilderFactory", + "org.apache.polygene.object.ObjectBuilderFactory", + "org.apache.polygene.entity.UnitOfWorkFactory", + "org.apache.polygene.service.ServiceFinder", + "org.apache.polygene.structure.Module", + "org.apache.polygene.structure.Layer", + "org.apache.polygene.structure.Application", + "org.apache.polygene.api.PolygeneAPI", + "org.apache.polygene.spi.PolygeneSPI" + }; + sort( VALID_STRUCTURE_INJECTION_TYPE ); + } + + private PolygeneStructureAnnotationConstants() + { + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationUtil.java ---------------------------------------------------------------------- diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationUtil.java new file mode 100644 index 0000000..c334276 --- /dev/null +++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/PolygeneStructureAnnotationUtil.java @@ -0,0 +1,124 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.polygene.ide.plugin.idea.injections.structure.common; + +import com.intellij.openapi.project.Project; +import com.intellij.psi.*; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import static com.intellij.codeInsight.AnnotationUtil.findAnnotation; +import static com.intellij.psi.PsiModifier.STATIC; +import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationConstants.QUALIFIED_NAME_STRUCTURE_ANNOTATION; +import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationConstants.VALID_STRUCTURE_INJECTION_TYPE; +import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.StructureAnnotationDeclarationValidationResult.*; + +/** + * @author [email protected] + * @since 0.1 + */ +public final class PolygeneStructureAnnotationUtil +{ + /** + * Returns {@code Structure} annotation if exists. + * + * @param modifierListOwner Modifier list owner. + * @return @Structure annotation if exists, {@code null} otherwise. + * @since 0.1 + */ + @Nullable + public static PsiAnnotation getStructureAnnotation( @NotNull PsiModifierListOwner modifierListOwner ) + { + return findAnnotation( modifierListOwner, QUALIFIED_NAME_STRUCTURE_ANNOTATION ); + } + + /** + * Create structure annotation. + * + * @param project project to create structure annotation. + * @param context the context to create structure annotation. + * @return @Structure annotation. + */ + @NotNull + public static PsiAnnotation createStructureAnnotation( @NotNull Project project, + @NotNull PsiElement context ) + { + JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project ); + PsiElementFactory factory = psiFacade.getElementFactory(); + return factory.createAnnotationFromText( "@" + QUALIFIED_NAME_STRUCTURE_ANNOTATION, context ); + } + + /** + * @param variable variable to check. + * @return Look at {@link StructureAnnotationDeclarationValidationResult}. + * @since 0.1 + */ + @NotNull + public static StructureAnnotationDeclarationValidationResult validateStructureAnnotationDeclaration( + @NotNull PsiVariable variable ) + { + PsiAnnotation structureAnnotation = getStructureAnnotation( variable ); + if( structureAnnotation == null ) + { + return invalidStructureAnnotationNotDeclared; + } + + PsiModifierList modifierList = variable.getModifierList(); + if( modifierList != null ) + { + if( modifierList.hasModifierProperty( STATIC ) ) + { + return invalidDeclaredOnStaticVariable; + } + } + + if( !isInjecteableByStructureAnnotation( variable ) ) + { + return invalidInjectionType; + } + + return valid; + } + + /** + * Returns a {@code boolean} indicator whether variable type is injectable by @Structure annotation. + * + * @param variable variable to check. + * @return {@code true} if variable type is injecteable by @Structure annotation. + * @since 0.1 + */ + public static boolean isInjecteableByStructureAnnotation( @NotNull PsiVariable variable ) + { + PsiType type = variable.getType(); + String fieldClassQualifiedName = type.getCanonicalText(); + return binarySearch( VALID_STRUCTURE_INJECTION_TYPE, fieldClassQualifiedName ) > -1; + } + + private PolygeneStructureAnnotationUtil() + { + } + + public enum StructureAnnotationDeclarationValidationResult + { + invalidStructureAnnotationNotDeclared, + invalidDeclaredOnStaticVariable, + invalidInjectionType, + valid, + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationConstants.java ---------------------------------------------------------------------- diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationConstants.java deleted file mode 100644 index 2a5d3bf..0000000 --- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationConstants.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.polygene.ide.plugin.idea.injections.structure.common; - -import static java.util.Arrays.sort; - -/** - * @author [email protected] - * @since 0.1 - */ -public final class PolygeneStructureAnnotationConstants -{ - public static final String QUALIFIED_NAME_STRUCTURE_ANNOTATION = "org.apache.polygene.api.injection.scope.Structure"; - - public static final String[] VALID_STRUCTURE_INJECTION_TYPE; - - static - { - VALID_STRUCTURE_INJECTION_TYPE = new String[] - { - "org.apache.polygene.composite.CompositeBuilderFactory", - "org.apache.polygene.object.ObjectBuilderFactory", - "org.apache.polygene.entity.UnitOfWorkFactory", - "org.apache.polygene.service.ServiceFinder", - "org.apache.polygene.structure.Module", - "org.apache.polygene.structure.Layer", - "org.apache.polygene.structure.Application", - "org.apache.polygene.api.PolygeneAPI", - "org.apache.polygene.spi.PolygeneSPI" - }; - sort( VALID_STRUCTURE_INJECTION_TYPE ); - } - - private PolygeneStructureAnnotationConstants() - { - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationUtil.java ---------------------------------------------------------------------- diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationUtil.java deleted file mode 100644 index c334276..0000000 --- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/injections/structure/common/ZestStructureAnnotationUtil.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.polygene.ide.plugin.idea.injections.structure.common; - -import com.intellij.openapi.project.Project; -import com.intellij.psi.*; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import static com.intellij.codeInsight.AnnotationUtil.findAnnotation; -import static com.intellij.psi.PsiModifier.STATIC; -import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationConstants.QUALIFIED_NAME_STRUCTURE_ANNOTATION; -import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationConstants.VALID_STRUCTURE_INJECTION_TYPE; -import static org.apache.polygene.ide.plugin.idea.injections.structure.common.PolygeneStructureAnnotationUtil.StructureAnnotationDeclarationValidationResult.*; - -/** - * @author [email protected] - * @since 0.1 - */ -public final class PolygeneStructureAnnotationUtil -{ - /** - * Returns {@code Structure} annotation if exists. - * - * @param modifierListOwner Modifier list owner. - * @return @Structure annotation if exists, {@code null} otherwise. - * @since 0.1 - */ - @Nullable - public static PsiAnnotation getStructureAnnotation( @NotNull PsiModifierListOwner modifierListOwner ) - { - return findAnnotation( modifierListOwner, QUALIFIED_NAME_STRUCTURE_ANNOTATION ); - } - - /** - * Create structure annotation. - * - * @param project project to create structure annotation. - * @param context the context to create structure annotation. - * @return @Structure annotation. - */ - @NotNull - public static PsiAnnotation createStructureAnnotation( @NotNull Project project, - @NotNull PsiElement context ) - { - JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project ); - PsiElementFactory factory = psiFacade.getElementFactory(); - return factory.createAnnotationFromText( "@" + QUALIFIED_NAME_STRUCTURE_ANNOTATION, context ); - } - - /** - * @param variable variable to check. - * @return Look at {@link StructureAnnotationDeclarationValidationResult}. - * @since 0.1 - */ - @NotNull - public static StructureAnnotationDeclarationValidationResult validateStructureAnnotationDeclaration( - @NotNull PsiVariable variable ) - { - PsiAnnotation structureAnnotation = getStructureAnnotation( variable ); - if( structureAnnotation == null ) - { - return invalidStructureAnnotationNotDeclared; - } - - PsiModifierList modifierList = variable.getModifierList(); - if( modifierList != null ) - { - if( modifierList.hasModifierProperty( STATIC ) ) - { - return invalidDeclaredOnStaticVariable; - } - } - - if( !isInjecteableByStructureAnnotation( variable ) ) - { - return invalidInjectionType; - } - - return valid; - } - - /** - * Returns a {@code boolean} indicator whether variable type is injectable by @Structure annotation. - * - * @param variable variable to check. - * @return {@code true} if variable type is injecteable by @Structure annotation. - * @since 0.1 - */ - public static boolean isInjecteableByStructureAnnotation( @NotNull PsiVariable variable ) - { - PsiType type = variable.getType(); - String fieldClassQualifiedName = type.getCanonicalText(); - return binarySearch( VALID_STRUCTURE_INJECTION_TYPE, fieldClassQualifiedName ) > -1; - } - - private PolygeneStructureAnnotationUtil() - { - } - - public enum StructureAnnotationDeclarationValidationResult - { - invalidStructureAnnotationNotDeclared, - invalidDeclaredOnStaticVariable, - invalidInjectionType, - valid, - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinConstants.java ---------------------------------------------------------------------- diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinConstants.java new file mode 100644 index 0000000..c871b3d --- /dev/null +++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinConstants.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.polygene.ide.plugin.idea.mixins.common; + +/** + * @author [email protected] + * @since 0.1 + */ +public final class PolygeneMixinConstants +{ + public static final String QUALIFIED_NAME_MIXINS = "org.apache.polygene.api.mixin.Mixins"; + + private PolygeneMixinConstants() + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinUtil.java ---------------------------------------------------------------------- diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinUtil.java new file mode 100644 index 0000000..729ff58 --- /dev/null +++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/PolygeneMixinUtil.java @@ -0,0 +1,196 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.polygene.ide.plugin.idea.mixins.common; + +import com.intellij.openapi.project.Project; +import com.intellij.psi.*; +import com.intellij.psi.codeStyle.JavaCodeStyleManager; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.Set; + +import static com.intellij.codeInsight.AnnotationUtil.findAnnotation; +import static java.util.Collections.emptyList; +import static java.util.Collections.emptySet; +import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue; +import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference; +import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getExtendsDeep; +import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass; +import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.isAConcern; +import static org.apache.polygene.ide.plugin.idea.mixins.common.PolygeneMixinConstants.QUALIFIED_NAME_MIXINS; +import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectUtil.isASideEffect; + +/** + * @author [email protected] + * @since 0.1 + */ +public final class PolygeneMixinUtil +{ + /** + * Get all valid mixin types of given the {@code psiClass} argument. + * + * @param psiClass The psi class to check. + * @return all vlaid mixin types of the given {@code psiClass} argument. + * @since 0.1 + */ + @NotNull + public static Set<PsiClass> getAllValidMixinTypes( @NotNull PsiClass psiClass ) + { + PsiAnnotation mixinsAnnotation = getMixinsAnnotation( psiClass ); + if( mixinsAnnotation == null ) + { + return emptySet(); + } + + Set<PsiClass> validMixinsType = getExtendsDeep( psiClass ); + validMixinsType.add( psiClass ); + return validMixinsType; + } + + @NotNull + public static List<PsiAnnotationMemberValue> getMixinsAnnotationValue( @NotNull PsiClass psiClass ) + { + return getMixinsAnnotationValue( getMixinsAnnotation( psiClass ) ); + } + + @NotNull + public static List<PsiAnnotationMemberValue> getMixinsAnnotationValue( @Nullable PsiAnnotation mixinsAnnotation ) + { + if( mixinsAnnotation == null ) + { + return emptyList(); + } + + String mixinsQualifiedName = mixinsAnnotation.getQualifiedName(); + if( !QUALIFIED_NAME_MIXINS.equals( mixinsQualifiedName ) ) + { + return emptyList(); + } + + return getAnnotationDefaultParameterValue( mixinsAnnotation ); + } + + @Nullable + public static PsiAnnotation getMixinsAnnotation( PsiElement element ) + { + PsiClass psiClass = getPSIClass( element ); + if( psiClass == null ) + { + return null; + } + + return findAnnotation( psiClass, QUALIFIED_NAME_MIXINS ); + } + + @NotNull + public static PsiAnnotation addOrReplaceMixinAnnotation( @NotNull PsiModifierListOwner modifierListOwner, + @NotNull PsiClass mixinClassToAdd ) + { + Project project = modifierListOwner.getProject(); + JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project ); + PsiElementFactory factory = psiFacade.getElementFactory(); + PsiAnnotation existingMixinsAnnotation = findAnnotation( modifierListOwner, QUALIFIED_NAME_MIXINS ); + + boolean isReplace = false; + PsiAnnotation newMixinsAnnotation; + if( existingMixinsAnnotation != null ) + { + // Check duplicate + List<PsiAnnotationMemberValue> mixinsValues = getMixinsAnnotationValue( existingMixinsAnnotation ); + for( PsiAnnotationMemberValue mixinValue : mixinsValues ) + { + PsiJavaCodeReferenceElement mixinClassReference = getMixinClassReference( mixinValue ); + if( mixinClassReference == null ) + { + continue; + } + + PsiElement mixinClass = mixinClassReference.resolve(); + if( mixinClassToAdd.equals( mixinClass ) ) + { + return existingMixinsAnnotation; + } + } + + isReplace = true; + } + + String mixinsAnnotationText = createMixinsAnnotationText( existingMixinsAnnotation, mixinClassToAdd ); + newMixinsAnnotation = factory.createAnnotationFromText( mixinsAnnotationText, modifierListOwner ); + + if( isReplace ) + { + // Replace @Mixins instead + existingMixinsAnnotation.replace( newMixinsAnnotation ); + } + else + { + // @Mixins doesn't exists, add it as first child + PsiModifierList modifierList = modifierListOwner.getModifierList(); + modifierList.addBefore( newMixinsAnnotation, modifierList.getFirstChild() ); + } + + // Shorten all class references if possible + JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance( project ); + codeStyleManager.shortenClassReferences( newMixinsAnnotation ); + + return newMixinsAnnotation; + } + + @NotNull + private static String createMixinsAnnotationText( @Nullable PsiAnnotation mixinsAnnotationBase, + @NotNull PsiClass mixinClassToAdd ) + { + StringBuilder annotationTextBuilder = new StringBuilder(); + annotationTextBuilder.append( "@" ).append( QUALIFIED_NAME_MIXINS ).append( "( {" ); + List<PsiAnnotationMemberValue> mixinsValues = getMixinsAnnotationValue( mixinsAnnotationBase ); + for( PsiAnnotationMemberValue mixinValue : mixinsValues ) + { + annotationTextBuilder.append( mixinValue.getText() ).append( ", " ); + } + annotationTextBuilder.append( mixinClassToAdd.getQualifiedName() ).append( ".class" ); + annotationTextBuilder.append( "} )" ); + + return annotationTextBuilder.toString(); + } + + + @Nullable + public static PsiJavaCodeReferenceElement getMixinClassReference( @NotNull PsiAnnotationMemberValue value ) + { + return getClassReference( value ); + } + + /** + * Validate whether psiClass is a mixin. + * + * @param psiClass psi class to check. + * @return {@code true} if psiClass is a mixin, {@code false} otherwise. + */ + public static boolean isAMixin( @NotNull PsiClass psiClass ) + { + return !( psiClass.isInterface() || isAConcern( psiClass ) || isASideEffect( psiClass ) ); + } + + private PolygeneMixinUtil() + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinConstants.java ---------------------------------------------------------------------- diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinConstants.java deleted file mode 100644 index c871b3d..0000000 --- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinConstants.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.polygene.ide.plugin.idea.mixins.common; - -/** - * @author [email protected] - * @since 0.1 - */ -public final class PolygeneMixinConstants -{ - public static final String QUALIFIED_NAME_MIXINS = "org.apache.polygene.api.mixin.Mixins"; - - private PolygeneMixinConstants() - { - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinUtil.java ---------------------------------------------------------------------- diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinUtil.java deleted file mode 100644 index 729ff58..0000000 --- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/mixins/common/ZestMixinUtil.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.polygene.ide.plugin.idea.mixins.common; - -import com.intellij.openapi.project.Project; -import com.intellij.psi.*; -import com.intellij.psi.codeStyle.JavaCodeStyleManager; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.List; -import java.util.Set; - -import static com.intellij.codeInsight.AnnotationUtil.findAnnotation; -import static java.util.Collections.emptyList; -import static java.util.Collections.emptySet; -import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue; -import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference; -import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getExtendsDeep; -import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass; -import static org.apache.polygene.ide.plugin.idea.concerns.common.PolygeneConcernUtil.isAConcern; -import static org.apache.polygene.ide.plugin.idea.mixins.common.PolygeneMixinConstants.QUALIFIED_NAME_MIXINS; -import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectUtil.isASideEffect; - -/** - * @author [email protected] - * @since 0.1 - */ -public final class PolygeneMixinUtil -{ - /** - * Get all valid mixin types of given the {@code psiClass} argument. - * - * @param psiClass The psi class to check. - * @return all vlaid mixin types of the given {@code psiClass} argument. - * @since 0.1 - */ - @NotNull - public static Set<PsiClass> getAllValidMixinTypes( @NotNull PsiClass psiClass ) - { - PsiAnnotation mixinsAnnotation = getMixinsAnnotation( psiClass ); - if( mixinsAnnotation == null ) - { - return emptySet(); - } - - Set<PsiClass> validMixinsType = getExtendsDeep( psiClass ); - validMixinsType.add( psiClass ); - return validMixinsType; - } - - @NotNull - public static List<PsiAnnotationMemberValue> getMixinsAnnotationValue( @NotNull PsiClass psiClass ) - { - return getMixinsAnnotationValue( getMixinsAnnotation( psiClass ) ); - } - - @NotNull - public static List<PsiAnnotationMemberValue> getMixinsAnnotationValue( @Nullable PsiAnnotation mixinsAnnotation ) - { - if( mixinsAnnotation == null ) - { - return emptyList(); - } - - String mixinsQualifiedName = mixinsAnnotation.getQualifiedName(); - if( !QUALIFIED_NAME_MIXINS.equals( mixinsQualifiedName ) ) - { - return emptyList(); - } - - return getAnnotationDefaultParameterValue( mixinsAnnotation ); - } - - @Nullable - public static PsiAnnotation getMixinsAnnotation( PsiElement element ) - { - PsiClass psiClass = getPSIClass( element ); - if( psiClass == null ) - { - return null; - } - - return findAnnotation( psiClass, QUALIFIED_NAME_MIXINS ); - } - - @NotNull - public static PsiAnnotation addOrReplaceMixinAnnotation( @NotNull PsiModifierListOwner modifierListOwner, - @NotNull PsiClass mixinClassToAdd ) - { - Project project = modifierListOwner.getProject(); - JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project ); - PsiElementFactory factory = psiFacade.getElementFactory(); - PsiAnnotation existingMixinsAnnotation = findAnnotation( modifierListOwner, QUALIFIED_NAME_MIXINS ); - - boolean isReplace = false; - PsiAnnotation newMixinsAnnotation; - if( existingMixinsAnnotation != null ) - { - // Check duplicate - List<PsiAnnotationMemberValue> mixinsValues = getMixinsAnnotationValue( existingMixinsAnnotation ); - for( PsiAnnotationMemberValue mixinValue : mixinsValues ) - { - PsiJavaCodeReferenceElement mixinClassReference = getMixinClassReference( mixinValue ); - if( mixinClassReference == null ) - { - continue; - } - - PsiElement mixinClass = mixinClassReference.resolve(); - if( mixinClassToAdd.equals( mixinClass ) ) - { - return existingMixinsAnnotation; - } - } - - isReplace = true; - } - - String mixinsAnnotationText = createMixinsAnnotationText( existingMixinsAnnotation, mixinClassToAdd ); - newMixinsAnnotation = factory.createAnnotationFromText( mixinsAnnotationText, modifierListOwner ); - - if( isReplace ) - { - // Replace @Mixins instead - existingMixinsAnnotation.replace( newMixinsAnnotation ); - } - else - { - // @Mixins doesn't exists, add it as first child - PsiModifierList modifierList = modifierListOwner.getModifierList(); - modifierList.addBefore( newMixinsAnnotation, modifierList.getFirstChild() ); - } - - // Shorten all class references if possible - JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance( project ); - codeStyleManager.shortenClassReferences( newMixinsAnnotation ); - - return newMixinsAnnotation; - } - - @NotNull - private static String createMixinsAnnotationText( @Nullable PsiAnnotation mixinsAnnotationBase, - @NotNull PsiClass mixinClassToAdd ) - { - StringBuilder annotationTextBuilder = new StringBuilder(); - annotationTextBuilder.append( "@" ).append( QUALIFIED_NAME_MIXINS ).append( "( {" ); - List<PsiAnnotationMemberValue> mixinsValues = getMixinsAnnotationValue( mixinsAnnotationBase ); - for( PsiAnnotationMemberValue mixinValue : mixinsValues ) - { - annotationTextBuilder.append( mixinValue.getText() ).append( ", " ); - } - annotationTextBuilder.append( mixinClassToAdd.getQualifiedName() ).append( ".class" ); - annotationTextBuilder.append( "} )" ); - - return annotationTextBuilder.toString(); - } - - - @Nullable - public static PsiJavaCodeReferenceElement getMixinClassReference( @NotNull PsiAnnotationMemberValue value ) - { - return getClassReference( value ); - } - - /** - * Validate whether psiClass is a mixin. - * - * @param psiClass psi class to check. - * @return {@code true} if psiClass is a mixin, {@code false} otherwise. - */ - public static boolean isAMixin( @NotNull PsiClass psiClass ) - { - return !( psiClass.isInterface() || isAConcern( psiClass ) || isASideEffect( psiClass ) ); - } - - private PolygeneMixinUtil() - { - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectConstants.java ---------------------------------------------------------------------- diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectConstants.java new file mode 100644 index 0000000..d3c269f --- /dev/null +++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectConstants.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.polygene.ide.plugin.idea.sideEffects.common; + +/** + * @author [email protected] + * @since 0.1 + */ +public final class PolygeneSideEffectConstants +{ + public static final String QUALIFIED_NAME_SIDE_EFFECTS = "org.apache.polygene.api.sideeffect.SideEffects"; + + public static final String QUALIFIED_NAME_SIDE_EFFECT_OF = "org.apache.polygene.api.sideeffect.SideEffectOf"; + public static final String QUALIFIED_NAME_GENERIC_SIDE_EFFECT = "org.apache.polygene.api.sideeffect.GenericSideEffect"; + + private PolygeneSideEffectConstants() + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectUtil.java ---------------------------------------------------------------------- diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectUtil.java new file mode 100644 index 0000000..c1533fc --- /dev/null +++ b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/PolygeneSideEffectUtil.java @@ -0,0 +1,188 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.polygene.ide.plugin.idea.sideEffects.common; + +import com.intellij.openapi.project.Project; +import com.intellij.psi.*; +import com.intellij.psi.search.GlobalSearchScope; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; + +import static com.intellij.codeInsight.AnnotationUtil.findAnnotation; +import static java.util.Collections.emptyList; +import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue; +import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference; +import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass; +import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope; +import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectConstants.*; + +/** + * @author [email protected] + * @since 0.1 + */ +public final class PolygeneSideEffectUtil +{ + /** + * @param searchContext Search context. + * @return {@code GenericSideEffect} class given the search context. {@code null} if not found. + * @since 0.1 + */ + @Nullable + public static PsiClass getGenericSideEffectClass( @NotNull PsiElement searchContext ) + { + Project project = searchContext.getProject(); + GlobalSearchScope searchScope = determineSearchScope( searchContext ); + return getGenericSideEffectClass( project, searchScope ); + } + + /** + * @param project project. + * @param scope search scope. + * @return {@code GenericSideEffect} class given {@code project} and {@code scope} parameters. + * Returns {@code null} if not found. + * @since 0.1 + */ + @Nullable + public static PsiClass getGenericSideEffectClass( @NotNull Project project, + @Nullable GlobalSearchScope scope ) + { + JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project ); + return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_GENERIC_SIDE_EFFECT, scope ); + } + + /** + * @param searchContext Search context. + * @return {@code SideEffectOf} class given the search context. {@code null} if not found. + * @since 0.1 + */ + @Nullable + public static PsiClass getSideEffectOfClass( @NotNull PsiElement searchContext ) + { + Project project = searchContext.getProject(); + GlobalSearchScope searchScope = determineSearchScope( searchContext ); + return getSideEffectOfClass( project, searchScope ); + } + + + /** + * @param project project. + * @param scope search scope. + * @return {@code SideEffectOf} class given {@code project} and {@code scope} parameters. + * Returns {@code null} if not found. + * @since 0.1 + */ + @Nullable + public static PsiClass getSideEffectOfClass( @NotNull Project project, + @Nullable GlobalSearchScope scope ) + { + JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project ); + return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_SIDE_EFFECT_OF, scope ); + } + + /** + * @param elementWithinJavaClass element within java class. + * @return {@code @SideEffects} annotation declaration of the class that contains the element. + * Returns {@code null} if not found, or {@code element} is an invalid context. + * @since 0.1 + */ + @Nullable + public static PsiAnnotation getSideEffectsAnnotation( @NotNull PsiElement elementWithinJavaClass ) + { + PsiClass psiClass = getPSIClass( elementWithinJavaClass ); + return findAnnotation( psiClass, QUALIFIED_NAME_SIDE_EFFECTS ); + } + + /** + * @param annotation annotation to process. + * @return {@code @SideEffects} annotation value. Returns {@link Collections#emptyList()} if {@code annotation} is + * {@code null} or annotation is not a {@code @SideEffects} annotation. + * @since 0.1 + */ + @NotNull + public static List<PsiAnnotationMemberValue> getSideEffectsAnnotationValue( @Nullable PsiAnnotation annotation ) + { + if( annotation == null ) + { + return emptyList(); + } + + String concernsQualifiedName = annotation.getQualifiedName(); + if( !QUALIFIED_NAME_SIDE_EFFECTS.equals( concernsQualifiedName ) ) + { + return emptyList(); + } + + return getAnnotationDefaultParameterValue( annotation ); + } + + /** + * @param value annotation member value. + * @return Side effect class reference given the {@code value} parameter. Returns {@code null} if it's not a + * class reference. + * @since 0.1 + */ + @Nullable + public static PsiJavaCodeReferenceElement getSideEffectClassReference( @NotNull PsiAnnotationMemberValue value ) + { + return getClassReference( value ); + } + + /** + * Returns a {@code boolean} indicator whether the specified {@code psiClass} is a side effect. + * + * @param psiClass class to check. + * @return {@code true} if {@code psiClass} is a side effect, {@code false} otherwise. + * @since 0.1 + */ + public static boolean isASideEffect( @NotNull PsiClass psiClass ) + { + if( psiClass.isInterface() ) + { + return false; + } + + PsiClass sideEffectOfClass = getSideEffectOfClass( psiClass ); + return sideEffectOfClass != null && psiClass.isInheritor( sideEffectOfClass, true ); + } + + /** + * @param psiClass psi class to check. + * @return {@code true} if {@code psiClass} inherits {@code GenericSideEffect} class, {@code false} if + * {@code psiClass} does + * not inherit {@code GenericSideEffect} or {@code GenericSideEffect} is not found. + * @since 0.1 + */ + public static boolean isAGenericSideEffect( @NotNull PsiClass psiClass ) + { + if( psiClass.isInterface() ) + { + return false; + } + + PsiClass genericSideEffect = getGenericSideEffectClass( psiClass ); + return genericSideEffect != null && psiClass.isInheritor( genericSideEffect, true ); + } + + private PolygeneSideEffectUtil() + { + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectConstants.java ---------------------------------------------------------------------- diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectConstants.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectConstants.java deleted file mode 100644 index d3c269f..0000000 --- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectConstants.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.polygene.ide.plugin.idea.sideEffects.common; - -/** - * @author [email protected] - * @since 0.1 - */ -public final class PolygeneSideEffectConstants -{ - public static final String QUALIFIED_NAME_SIDE_EFFECTS = "org.apache.polygene.api.sideeffect.SideEffects"; - - public static final String QUALIFIED_NAME_SIDE_EFFECT_OF = "org.apache.polygene.api.sideeffect.SideEffectOf"; - public static final String QUALIFIED_NAME_GENERIC_SIDE_EFFECT = "org.apache.polygene.api.sideeffect.GenericSideEffect"; - - private PolygeneSideEffectConstants() - { - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectUtil.java ---------------------------------------------------------------------- diff --git a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectUtil.java b/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectUtil.java deleted file mode 100644 index c1533fc..0000000 --- a/tools/qidea/src/main/java/org/apache/zest/ide/plugin/idea/sideEffects/common/ZestSideEffectUtil.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you 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.apache.polygene.ide.plugin.idea.sideEffects.common; - -import com.intellij.openapi.project.Project; -import com.intellij.psi.*; -import com.intellij.psi.search.GlobalSearchScope; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Collections; -import java.util.List; - -import static com.intellij.codeInsight.AnnotationUtil.findAnnotation; -import static java.util.Collections.emptyList; -import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getAnnotationDefaultParameterValue; -import static org.apache.polygene.ide.plugin.idea.common.psi.PsiAnnotationUtil.getClassReference; -import static org.apache.polygene.ide.plugin.idea.common.psi.PsiClassUtil.getPSIClass; -import static org.apache.polygene.ide.plugin.idea.common.psi.search.GlobalSearchScopeUtil.determineSearchScope; -import static org.apache.polygene.ide.plugin.idea.sideEffects.common.PolygeneSideEffectConstants.*; - -/** - * @author [email protected] - * @since 0.1 - */ -public final class PolygeneSideEffectUtil -{ - /** - * @param searchContext Search context. - * @return {@code GenericSideEffect} class given the search context. {@code null} if not found. - * @since 0.1 - */ - @Nullable - public static PsiClass getGenericSideEffectClass( @NotNull PsiElement searchContext ) - { - Project project = searchContext.getProject(); - GlobalSearchScope searchScope = determineSearchScope( searchContext ); - return getGenericSideEffectClass( project, searchScope ); - } - - /** - * @param project project. - * @param scope search scope. - * @return {@code GenericSideEffect} class given {@code project} and {@code scope} parameters. - * Returns {@code null} if not found. - * @since 0.1 - */ - @Nullable - public static PsiClass getGenericSideEffectClass( @NotNull Project project, - @Nullable GlobalSearchScope scope ) - { - JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project ); - return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_GENERIC_SIDE_EFFECT, scope ); - } - - /** - * @param searchContext Search context. - * @return {@code SideEffectOf} class given the search context. {@code null} if not found. - * @since 0.1 - */ - @Nullable - public static PsiClass getSideEffectOfClass( @NotNull PsiElement searchContext ) - { - Project project = searchContext.getProject(); - GlobalSearchScope searchScope = determineSearchScope( searchContext ); - return getSideEffectOfClass( project, searchScope ); - } - - - /** - * @param project project. - * @param scope search scope. - * @return {@code SideEffectOf} class given {@code project} and {@code scope} parameters. - * Returns {@code null} if not found. - * @since 0.1 - */ - @Nullable - public static PsiClass getSideEffectOfClass( @NotNull Project project, - @Nullable GlobalSearchScope scope ) - { - JavaPsiFacade psiFacade = JavaPsiFacade.getInstance( project ); - return scope == null ? null : psiFacade.findClass( QUALIFIED_NAME_SIDE_EFFECT_OF, scope ); - } - - /** - * @param elementWithinJavaClass element within java class. - * @return {@code @SideEffects} annotation declaration of the class that contains the element. - * Returns {@code null} if not found, or {@code element} is an invalid context. - * @since 0.1 - */ - @Nullable - public static PsiAnnotation getSideEffectsAnnotation( @NotNull PsiElement elementWithinJavaClass ) - { - PsiClass psiClass = getPSIClass( elementWithinJavaClass ); - return findAnnotation( psiClass, QUALIFIED_NAME_SIDE_EFFECTS ); - } - - /** - * @param annotation annotation to process. - * @return {@code @SideEffects} annotation value. Returns {@link Collections#emptyList()} if {@code annotation} is - * {@code null} or annotation is not a {@code @SideEffects} annotation. - * @since 0.1 - */ - @NotNull - public static List<PsiAnnotationMemberValue> getSideEffectsAnnotationValue( @Nullable PsiAnnotation annotation ) - { - if( annotation == null ) - { - return emptyList(); - } - - String concernsQualifiedName = annotation.getQualifiedName(); - if( !QUALIFIED_NAME_SIDE_EFFECTS.equals( concernsQualifiedName ) ) - { - return emptyList(); - } - - return getAnnotationDefaultParameterValue( annotation ); - } - - /** - * @param value annotation member value. - * @return Side effect class reference given the {@code value} parameter. Returns {@code null} if it's not a - * class reference. - * @since 0.1 - */ - @Nullable - public static PsiJavaCodeReferenceElement getSideEffectClassReference( @NotNull PsiAnnotationMemberValue value ) - { - return getClassReference( value ); - } - - /** - * Returns a {@code boolean} indicator whether the specified {@code psiClass} is a side effect. - * - * @param psiClass class to check. - * @return {@code true} if {@code psiClass} is a side effect, {@code false} otherwise. - * @since 0.1 - */ - public static boolean isASideEffect( @NotNull PsiClass psiClass ) - { - if( psiClass.isInterface() ) - { - return false; - } - - PsiClass sideEffectOfClass = getSideEffectOfClass( psiClass ); - return sideEffectOfClass != null && psiClass.isInheritor( sideEffectOfClass, true ); - } - - /** - * @param psiClass psi class to check. - * @return {@code true} if {@code psiClass} inherits {@code GenericSideEffect} class, {@code false} if - * {@code psiClass} does - * not inherit {@code GenericSideEffect} or {@code GenericSideEffect} is not found. - * @since 0.1 - */ - public static boolean isAGenericSideEffect( @NotNull PsiClass psiClass ) - { - if( psiClass.isInterface() ) - { - return false; - } - - PsiClass genericSideEffect = getGenericSideEffectClass( psiClass ); - return genericSideEffect != null && psiClass.isInheritor( genericSideEffect, true ); - } - - private PolygeneSideEffectUtil() - { - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.properties ---------------------------------------------------------------------- diff --git a/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.properties b/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.properties new file mode 100644 index 0000000..8c5f29b --- /dev/null +++ b/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/PolygeneResourceBundle.properties @@ -0,0 +1,164 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you 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. +# +# +# + +# ***************************************************************************** +# Common +# ***************************************************************************** +polygene.quick.fixes.family.name=Polygene +polygene.action.group.title=Polygene +polygene.action.group.description=Polygene +polygene.inspections.name=Polygene issues +polygene.file.template.group.title=Polygene + +# ***************************************************************************** +# Concern +# ***************************************************************************** + +# ========= +# Intention +# ========= +add.concern.family.name=Add Polygene Concern +add.concern.name=Add Polygene Concern + +# ========== +# Inspection +# ========== +concerns.annotation.declared.correctly.name.display=Concern class extends ConcernOf abstract class +concerns.annotation.declared.correctly.error.concern.class.does.not.extend.ConcernOf=Concern class ''{0}'' does not inherit ''org.apache.polygene.composite.ConcernOf'' class. +concerns.annotation.declared.correctly.fix.remove.concern.class.reference=Remove ''{0}'' concern class reference. +concerns.annotation.declared.correctly.error.annotation.declared.in.class=@Concerns annotation can only be declared at interface +concerns.annotation.declared.correctly.fix.remove.annotation=Remove @Concerns annotation + +# ======= +# Actions +# ======= + +# ------------------------- +# Create concern in package +# ------------------------- +createConcernOfInPackage.menu.action.text=Polygene Concern Of +createConcernOfInPackage.menu.action.description=Creates new Polygene ConcernOf +createConcernOfInPackage.dlg.title=New Polygene ConcernOf +createConcernOfInPackage.dlg.prompt=Enter name for new ConcernOf +createConcernOfInPackage.command.name=Create ConcernOf +createConcernOfInPackage.progress.text=Creating ConcernOf ''{0}'' class +createConcernOfInPackage.error.title=Create concern fail + +# ***************************************************************************** +# Mixin +# ***************************************************************************** + +# ========== +# Inspection +# ========== + +# ---------------------------- +# Mixins implements mixin type +# ---------------------------- +mixin.implements.mixin.type.name.display=Mixin class implements Mixin type class +mixin.implements.mixin.type.fix.remove.class.reference=Remove ''{0}'' mixin class reference. +mixin.implements.mixin.type.error.does.not.implement.any.mixin.type=Mixin class ''{0}'' does not inherit any mixin type of ''{1}'' +mixin.implements.mixin.type.error.mixin.is.an.interface=Mixin class ''{0}'' is an interface +mixin.implements.mixin.type.error.mixin.is.a.concern=''{0}'' class is a concern +mixin.implements.mixin.type.error.mixin.is.a.side.effect=''{0}'' class is a side effect + +# ------------------------------------------ +# Mixins declared on mixin type or composite +# ------------------------------------------ +mixins.annotation.declared.on.mixin.type.name.display=@Mixins must be declared on interface +mixins.annotation.declared.on.mixin.type.error.declared.on.class=@Mixins can only be declared on interface +mixins.annotation.declared.on.mixin.type.fix.remove.mixins.annotation=Remove @Mixins annotation + +# ***************************************************************************** +# Side Effect +# ***************************************************************************** + +# ========== +# Inspection +# ========== +side.effects.annotation.declared.correctly.name.display=@SideEffects annotation declared correctly +side.effects.annotation.declared.correctly.error.side.effect.does.not.extend.side.effect.of=Side Effect class ''{0}'' does not inherit ''org.apache.polygene.composite.SideEffectOf'' class. +side.effects.annotation.declared.correctly.fix.remove.class.reference=Remove ''{0}'' class reference +side.effects.annotation.declared.correctly.error.annotation.declared.in.class=@SideEffects annotation can only be declared at interface +side.effects.annotation.declared.correctly.fix.remove.annotation=Remove @SideEffects annotation + +# ***************************************************************************** +# Injections +# ***************************************************************************** + +# ----------------- +# Common Inspection +# ----------------- +abstract.injection.annotation.declaration.inspection.error.annotation.not.declared.correctly=''{0}'' can only be declared in constructor parameters or non static class field. + +# ------------------- +# @Structure injection +# ------------------- + +# ========== +# Inspection +# ========== +injections.structure.annotation.declared.correctly.name.display=@Structure Injection +injections.structure.annotation.declared.correctly.error.invalid.injection.type=@Structure does not inject ''{0}'' type. +injections.structure.annotation.declared.correctly.fix.remove.annotation=Remove @Structure annotation + +# ----------------- +# @Service injection +# ----------------- + +# ========== +# Inspection +# ========== +injections.service.annotation.declared.correctly.name.display=@Service Injection +injections.service.annotation.declared.correctly.error.type.is.injected.by.structure=''{0}'' type is injected by @Structure +injections.service.annotation.declared.correctly.fix.remove.annotation=Remove @Service annotation +injections.service.annotation.declared.correctly.fix.replace.with.structure.annotation=Replace @Service with @Structure annotation + +# ----------------- +# @Invocation injection +# ----------------- + +# ========== +# Inspection +# ========== +injections.invocation.annotation.declared.correctly.name.display=@Invocation Injection +injections.invocation.annotation.declared.correctly.error.type.is.injected.by.structure=''{0}'' type is injected by @Structure +injections.invocation.annotation.declared.correctly.error.type.is.not.injectable=''{0}'' type is not injectable by @Invocation +injections.invocation.annotation.declared.correctly.fix.remove.annotation=Remove @Invocation annotation +injections.invocation.annotation.declared.correctly.fix.replace.with.structure.annotation=Replace @Invocation with @Structure annotation + +# ***************************************************************************** +# Applies To +# ***************************************************************************** + +# ========== +# Inspection +# ========== +applies.to.annotation.declared.correctly.error.annotation.must.be.declared.on.class=@AppliesTo must be declared on class +applies.to.annotation.declared.correctly.error.value.is.invalid.for.mixin=''{0}'' is neither an interface or implements ''AppliesToFilter'' +applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericConcern=''{0}'' requires ''{1}'' to extends GenericConcern +applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericSideEffect=''{0}'' requires ''{1}'' to extends GenericSideEffect +applies.to.annotation.declared.correctly.error.value.requires.class.to.implements.InvocationHandler=''{0}'' requires ''{1}'' to implements InvocationHandler +applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericConcern=''{0}'' requires ''{1}'' to implement ''{0}'' interface or to extends ''GenericConcern'' +applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericSideEffect=''{0}'' requires ''{1}'' to implement ''{0}'' interface or to extends ''GenericSideEffect'' +applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.value.interface.or.implements.InvocationHandler=''{0}'' requires ''{1}'' to implement ''{0}'' or ''InvocationHandler'' interface +applies.to.annotation.declared.correctly.error.annotation.value.is.invalid.for.non.mixin=''{0}'' is not an annotation or ''AppliesToFilter'' or an interface +applies.to.annotation.declared.correctly.fix.remove.annotation=Remove ''@AppliesTo'' annotation +applies.to.annotation.declared.correctly.fix.remove.class.reference=Remove ''{0}'' class reference http://git-wip-us.apache.org/repos/asf/zest-java/blob/b45402f2/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.properties ---------------------------------------------------------------------- diff --git a/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.properties b/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.properties deleted file mode 100644 index 8c5f29b..0000000 --- a/tools/qidea/src/main/resources/org/apache/zest/ide/plugin/idea/common/resource/ZestResourceBundle.properties +++ /dev/null @@ -1,164 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# -# -# - -# ***************************************************************************** -# Common -# ***************************************************************************** -polygene.quick.fixes.family.name=Polygene -polygene.action.group.title=Polygene -polygene.action.group.description=Polygene -polygene.inspections.name=Polygene issues -polygene.file.template.group.title=Polygene - -# ***************************************************************************** -# Concern -# ***************************************************************************** - -# ========= -# Intention -# ========= -add.concern.family.name=Add Polygene Concern -add.concern.name=Add Polygene Concern - -# ========== -# Inspection -# ========== -concerns.annotation.declared.correctly.name.display=Concern class extends ConcernOf abstract class -concerns.annotation.declared.correctly.error.concern.class.does.not.extend.ConcernOf=Concern class ''{0}'' does not inherit ''org.apache.polygene.composite.ConcernOf'' class. -concerns.annotation.declared.correctly.fix.remove.concern.class.reference=Remove ''{0}'' concern class reference. -concerns.annotation.declared.correctly.error.annotation.declared.in.class=@Concerns annotation can only be declared at interface -concerns.annotation.declared.correctly.fix.remove.annotation=Remove @Concerns annotation - -# ======= -# Actions -# ======= - -# ------------------------- -# Create concern in package -# ------------------------- -createConcernOfInPackage.menu.action.text=Polygene Concern Of -createConcernOfInPackage.menu.action.description=Creates new Polygene ConcernOf -createConcernOfInPackage.dlg.title=New Polygene ConcernOf -createConcernOfInPackage.dlg.prompt=Enter name for new ConcernOf -createConcernOfInPackage.command.name=Create ConcernOf -createConcernOfInPackage.progress.text=Creating ConcernOf ''{0}'' class -createConcernOfInPackage.error.title=Create concern fail - -# ***************************************************************************** -# Mixin -# ***************************************************************************** - -# ========== -# Inspection -# ========== - -# ---------------------------- -# Mixins implements mixin type -# ---------------------------- -mixin.implements.mixin.type.name.display=Mixin class implements Mixin type class -mixin.implements.mixin.type.fix.remove.class.reference=Remove ''{0}'' mixin class reference. -mixin.implements.mixin.type.error.does.not.implement.any.mixin.type=Mixin class ''{0}'' does not inherit any mixin type of ''{1}'' -mixin.implements.mixin.type.error.mixin.is.an.interface=Mixin class ''{0}'' is an interface -mixin.implements.mixin.type.error.mixin.is.a.concern=''{0}'' class is a concern -mixin.implements.mixin.type.error.mixin.is.a.side.effect=''{0}'' class is a side effect - -# ------------------------------------------ -# Mixins declared on mixin type or composite -# ------------------------------------------ -mixins.annotation.declared.on.mixin.type.name.display=@Mixins must be declared on interface -mixins.annotation.declared.on.mixin.type.error.declared.on.class=@Mixins can only be declared on interface -mixins.annotation.declared.on.mixin.type.fix.remove.mixins.annotation=Remove @Mixins annotation - -# ***************************************************************************** -# Side Effect -# ***************************************************************************** - -# ========== -# Inspection -# ========== -side.effects.annotation.declared.correctly.name.display=@SideEffects annotation declared correctly -side.effects.annotation.declared.correctly.error.side.effect.does.not.extend.side.effect.of=Side Effect class ''{0}'' does not inherit ''org.apache.polygene.composite.SideEffectOf'' class. -side.effects.annotation.declared.correctly.fix.remove.class.reference=Remove ''{0}'' class reference -side.effects.annotation.declared.correctly.error.annotation.declared.in.class=@SideEffects annotation can only be declared at interface -side.effects.annotation.declared.correctly.fix.remove.annotation=Remove @SideEffects annotation - -# ***************************************************************************** -# Injections -# ***************************************************************************** - -# ----------------- -# Common Inspection -# ----------------- -abstract.injection.annotation.declaration.inspection.error.annotation.not.declared.correctly=''{0}'' can only be declared in constructor parameters or non static class field. - -# ------------------- -# @Structure injection -# ------------------- - -# ========== -# Inspection -# ========== -injections.structure.annotation.declared.correctly.name.display=@Structure Injection -injections.structure.annotation.declared.correctly.error.invalid.injection.type=@Structure does not inject ''{0}'' type. -injections.structure.annotation.declared.correctly.fix.remove.annotation=Remove @Structure annotation - -# ----------------- -# @Service injection -# ----------------- - -# ========== -# Inspection -# ========== -injections.service.annotation.declared.correctly.name.display=@Service Injection -injections.service.annotation.declared.correctly.error.type.is.injected.by.structure=''{0}'' type is injected by @Structure -injections.service.annotation.declared.correctly.fix.remove.annotation=Remove @Service annotation -injections.service.annotation.declared.correctly.fix.replace.with.structure.annotation=Replace @Service with @Structure annotation - -# ----------------- -# @Invocation injection -# ----------------- - -# ========== -# Inspection -# ========== -injections.invocation.annotation.declared.correctly.name.display=@Invocation Injection -injections.invocation.annotation.declared.correctly.error.type.is.injected.by.structure=''{0}'' type is injected by @Structure -injections.invocation.annotation.declared.correctly.error.type.is.not.injectable=''{0}'' type is not injectable by @Invocation -injections.invocation.annotation.declared.correctly.fix.remove.annotation=Remove @Invocation annotation -injections.invocation.annotation.declared.correctly.fix.replace.with.structure.annotation=Replace @Invocation with @Structure annotation - -# ***************************************************************************** -# Applies To -# ***************************************************************************** - -# ========== -# Inspection -# ========== -applies.to.annotation.declared.correctly.error.annotation.must.be.declared.on.class=@AppliesTo must be declared on class -applies.to.annotation.declared.correctly.error.value.is.invalid.for.mixin=''{0}'' is neither an interface or implements ''AppliesToFilter'' -applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericConcern=''{0}'' requires ''{1}'' to extends GenericConcern -applies.to.annotation.declared.correctly.error.value.requires.class.to.extends.GenericSideEffect=''{0}'' requires ''{1}'' to extends GenericSideEffect -applies.to.annotation.declared.correctly.error.value.requires.class.to.implements.InvocationHandler=''{0}'' requires ''{1}'' to implements InvocationHandler -applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericConcern=''{0}'' requires ''{1}'' to implement ''{0}'' interface or to extends ''GenericConcern'' -applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.interface.or.extends.GenericSideEffect=''{0}'' requires ''{1}'' to implement ''{0}'' interface or to extends ''GenericSideEffect'' -applies.to.annotation.declared.correctly.error.value.requires.class.to.implement.value.interface.or.implements.InvocationHandler=''{0}'' requires ''{1}'' to implement ''{0}'' or ''InvocationHandler'' interface -applies.to.annotation.declared.correctly.error.annotation.value.is.invalid.for.non.mixin=''{0}'' is not an annotation or ''AppliesToFilter'' or an interface -applies.to.annotation.declared.correctly.fix.remove.annotation=Remove ''@AppliesTo'' annotation -applies.to.annotation.declared.correctly.fix.remove.class.reference=Remove ''{0}'' class reference
