diff --git a/jps/model-api/src/org/jetbrains/jps/model/module/JpsFacet.java b/jps/model-api/src/org/jetbrains/jps/model/module/JpsFacet.java deleted file mode 100644 index e4fac75ac921..000000000000 --- a/jps/model-api/src/org/jetbrains/jps/model/module/JpsFacet.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2000-2012 JetBrains s.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.jetbrains.jps.model.module; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.jps.model.JpsNamedElement; -import org.jetbrains.jps.model.JpsReferenceableElement; - -/** - * @author nik - */ -//todo[nik] I'm not sure that we really need separate interface for facets in the project model. -//Perhaps facets should be replaced by extensions for module elements -public interface JpsFacet extends JpsNamedElement, JpsReferenceableElement { - - JpsModule getModule(); - - @NotNull - JpsFacetType getType(); - - void delete(); - - @NotNull - @Override - JpsFacetReference createReference(); - - void setParentFacet(@NotNull JpsFacet facet); - - @Nullable - JpsFacet getParentFacet(); -} diff --git a/jps/model-api/src/org/jetbrains/jps/model/module/JpsFacetListener.java b/jps/model-api/src/org/jetbrains/jps/model/module/JpsFacetListener.java deleted file mode 100644 index 582e35bfc8aa..000000000000 --- a/jps/model-api/src/org/jetbrains/jps/model/module/JpsFacetListener.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2000-2012 JetBrains s.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.jetbrains.jps.model.module; - -import java.util.EventListener; - -/** - * @author nik - */ -public interface JpsFacetListener extends EventListener { - void facetAdded(JpsFacet facet); - void facetRemoved(JpsFacet facet); -} diff --git a/jps/model-api/src/org/jetbrains/jps/model/module/JpsFacetReference.java b/jps/model-api/src/org/jetbrains/jps/model/module/JpsFacetReference.java deleted file mode 100644 index f4754b45242c..000000000000 --- a/jps/model-api/src/org/jetbrains/jps/model/module/JpsFacetReference.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2000-2012 JetBrains s.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.jetbrains.jps.model.module; - -import org.jetbrains.jps.model.JpsElementReference; - -/** - * @author nik - */ -public interface JpsFacetReference extends JpsElementReference { -} diff --git a/jps/model-api/src/org/jetbrains/jps/model/module/JpsFacetType.java b/jps/model-api/src/org/jetbrains/jps/model/module/JpsFacetType.java deleted file mode 100644 index 4ae5adc90d5d..000000000000 --- a/jps/model-api/src/org/jetbrains/jps/model/module/JpsFacetType.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2000-2012 JetBrains s.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.jetbrains.jps.model.module; - -import org.jetbrains.jps.model.JpsElement; - -/** - * @author nik - */ -//todo[nik] I'm not sure that we really need separate interface for facets in the project model. -//Perhaps facets should be replaced by extensions for module elements -public abstract class JpsFacetType

{ -} diff --git a/jps/model-api/src/org/jetbrains/jps/model/module/JpsModule.java b/jps/model-api/src/org/jetbrains/jps/model/module/JpsModule.java index 668b4f18c372..e11ca1c0fc18 100644 --- a/jps/model-api/src/org/jetbrains/jps/model/module/JpsModule.java +++ b/jps/model-api/src/org/jetbrains/jps/model/module/JpsModule.java @@ -54,13 +54,6 @@ public interface JpsModule extends JpsNamedElement, JpsReferenceableElement - JpsFacet addFacet(@NotNull String name, @NotNull JpsFacetType

type, @NotNull P properties); - - @NotNull - List getFacets(); - JpsDependenciesList getDependenciesList(); @NotNull diff --git a/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsFacetImpl.java b/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsFacetImpl.java deleted file mode 100644 index 9822b5b40dcd..000000000000 --- a/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsFacetImpl.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2000-2012 JetBrains s.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.jetbrains.jps.model.module.impl; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.jps.model.JpsElement; -import org.jetbrains.jps.model.JpsElementChildRole; -import org.jetbrains.jps.model.JpsElementCollection; -import org.jetbrains.jps.model.ex.JpsElementChildRoleBase; -import org.jetbrains.jps.model.ex.JpsNamedCompositeElementBase; -import org.jetbrains.jps.model.module.JpsFacet; -import org.jetbrains.jps.model.module.JpsFacetReference; -import org.jetbrains.jps.model.module.JpsFacetType; -import org.jetbrains.jps.model.module.JpsModule; - -/** - * @author nik - */ -public class JpsFacetImpl extends JpsNamedCompositeElementBase implements JpsFacet { - private static final JpsElementChildRole PARENT_FACET_REFERENCE = JpsElementChildRoleBase.create("parent facet"); - private final JpsFacetType myFacetType; - - public

JpsFacetImpl(JpsFacetType facetType, @NotNull String name, @NotNull P properties) { - super(name); - myFacetType = facetType; - myContainer.setChild(JpsFacetRole.COLLECTION_ROLE); - } - - private JpsFacetImpl(JpsFacetImpl original) { - super(original); - myFacetType = original.myFacetType; - } - - @NotNull - @Override - public JpsFacetImpl createCopy() { - return new JpsFacetImpl(this); - } - - @Override - @NotNull - public JpsFacetType getType() { - return myFacetType; - } - - @Override - public void setParentFacet(@NotNull JpsFacet facet) { - myContainer.setChild(PARENT_FACET_REFERENCE, facet.createReference()); - } - - @Override - @Nullable - public JpsFacet getParentFacet() { - final JpsFacetReference reference = myContainer.getChild(PARENT_FACET_REFERENCE); - return reference != null ? reference.resolve() : null; - } - - @Override - public JpsModule getModule() { - return myParent != null ? (JpsModule)myParent.getParent() : null; - } - - @NotNull - @Override - public JpsFacetReference createReference() { - return new JpsFacetReferenceImpl(getName(), getModule().createReference()); - } - - @Override - public void delete() { - //noinspection unchecked - ((JpsElementCollection)myParent).removeChild(this); - } -} diff --git a/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsFacetReferenceImpl.java b/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsFacetReferenceImpl.java deleted file mode 100644 index a1d9b3593ea0..000000000000 --- a/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsFacetReferenceImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2000-2012 JetBrains s.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.jetbrains.jps.model.module.impl; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.jps.model.impl.JpsNamedElementReferenceImpl; -import org.jetbrains.jps.model.module.JpsFacet; -import org.jetbrains.jps.model.module.JpsFacetReference; -import org.jetbrains.jps.model.module.JpsModuleReference; - -/** - * @author nik - */ -public class JpsFacetReferenceImpl extends JpsNamedElementReferenceImpl implements JpsFacetReference { - public JpsFacetReferenceImpl(String facetName, JpsModuleReference moduleReference) { - super(JpsFacetRole.COLLECTION_ROLE, facetName, moduleReference); - } - - private JpsFacetReferenceImpl(JpsFacetReferenceImpl original) { - super(original); - } - - @NotNull - @Override - public JpsFacetReferenceImpl createCopy() { - return new JpsFacetReferenceImpl(this); - } -} diff --git a/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsFacetRole.java b/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsFacetRole.java deleted file mode 100644 index d59044b60f16..000000000000 --- a/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsFacetRole.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2000-2012 JetBrains s.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.jetbrains.jps.model.module.impl; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.jps.model.JpsEventDispatcher; -import org.jetbrains.jps.model.ex.JpsElementCollectionRole; -import org.jetbrains.jps.model.ex.JpsElementChildRoleBase; -import org.jetbrains.jps.model.module.JpsFacet; -import org.jetbrains.jps.model.module.JpsFacetListener; - -/** - * @author nik - */ -public class JpsFacetRole extends JpsElementChildRoleBase { - public static final JpsFacetRole INSTANCE = new JpsFacetRole(); - public static final JpsElementCollectionRole COLLECTION_ROLE = JpsElementCollectionRole.create(INSTANCE); - - public JpsFacetRole() { - super("facet"); - } - - @Override - public void fireElementAdded(@NotNull JpsEventDispatcher dispatcher, @NotNull JpsFacet element) { - dispatcher.getPublisher(JpsFacetListener.class).facetAdded(element); - } - - @Override - public void fireElementRemoved(@NotNull JpsEventDispatcher dispatcher, @NotNull JpsFacet element) { - dispatcher.getPublisher(JpsFacetListener.class).facetRemoved(element); - } -} diff --git a/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsModuleImpl.java b/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsModuleImpl.java index 847affcb3219..8bf2845b136a 100644 --- a/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsModuleImpl.java +++ b/jps/model-impl/src/org/jetbrains/jps/model/module/impl/JpsModuleImpl.java @@ -50,7 +50,6 @@ public class JpsModuleImpl

extends JpsNamedCompositeElemen myContainer.setChild(myModuleType.getPropertiesRole(), properties); myContainer.setChild(CONTENT_ROOTS_ROLE); myContainer.setChild(EXCLUDED_ROOTS_ROLE); - myContainer.setChild(JpsFacetRole.COLLECTION_ROLE); myContainer.setChild(DEPENDENCIES_LIST_CHILD_ROLE, new JpsDependenciesListImpl()); getDependenciesList().addModuleSourceDependency(); myLibraryCollection = new JpsLibraryCollectionImpl(myContainer.setChild(JpsLibraryRole.LIBRARIES_COLLECTION_ROLE)); @@ -136,18 +135,6 @@ public class JpsModuleImpl

extends JpsNamedCompositeElemen } } - @NotNull - @Override - public

JpsFacet addFacet(@NotNull String name, @NotNull JpsFacetType

type, @NotNull P properties) { - return myContainer.getChild(JpsFacetRole.COLLECTION_ROLE).addChild(new JpsFacetImpl(type, name, properties)); - } - - @NotNull - @Override - public List getFacets() { - return myContainer.getChild(JpsFacetRole.COLLECTION_ROLE).getElements(); - } - @NotNull @Override public JpsDependenciesList getDependenciesList() { diff --git a/jps/model-impl/testSrc/org/jetbrains/jps/model/JpsFacetTest.java b/jps/model-impl/testSrc/org/jetbrains/jps/model/JpsFacetTest.java deleted file mode 100644 index 7c1f7ae95ea7..000000000000 --- a/jps/model-impl/testSrc/org/jetbrains/jps/model/JpsFacetTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2000-2012 JetBrains s.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.jetbrains.jps.model; - -import org.jetbrains.jps.model.java.JpsJavaModuleType; -import org.jetbrains.jps.model.module.JpsFacet; -import org.jetbrains.jps.model.module.JpsFacetType; -import org.jetbrains.jps.model.module.JpsModule; - -/** - * @author nik - */ -public class JpsFacetTest extends JpsModelTestCase { - public void testAddFacet() { - final JpsModule m = myProject.addModule("m", JpsJavaModuleType.INSTANCE); - m.addFacet("f", MY_FACET_TYPE, JpsElementFactory.getInstance().createDummyElement()); - assertEquals("f", assertOneElement(m.getFacets()).getName()); - } - - public void testCreateReferenceByFacet() { - final JpsFacet facet = myProject.addModule("m", JpsJavaModuleType.INSTANCE).addFacet("f", MY_FACET_TYPE, JpsElementFactory.getInstance().createDummyElement()); - final JpsElementReference reference = facet.createReference().asExternal(myModel); - assertSame(facet, reference.resolve()); - } - - private static final JpsFacetType MY_FACET_TYPE = new JpsFacetType() { }; -}