javafx packaging: provide serializer for top element

(cherry picked from commit 629b16275ddb45fb1128d278475e3e260c7c47fa)
This commit is contained in:
anna
2013-03-15 21:55:39 +01:00
parent 515b5d6923
commit fba316b4b6
6 changed files with 101 additions and 20 deletions
@@ -11,6 +11,7 @@
<orderEntry type="module" module-name="jps-model-api" />
<orderEntry type="module" module-name="jps-model-serialization" />
<orderEntry type="module" module-name="common-javaFX-plugin" />
<orderEntry type="module" module-name="jps-model-impl" />
</component>
</module>
@@ -1 +1 @@
org.jetbrains.plugins.javaFX.JavaFxBuilderService
org.jetbrains.jps.incremental.artifacts.ArtifactBuilderService
@@ -1,19 +0,0 @@
package org.jetbrains.plugins.javaFX;
import org.jetbrains.jps.builders.BuildTargetType;
import org.jetbrains.jps.incremental.BuilderService;
import org.jetbrains.jps.incremental.artifacts.ArtifactBuildTargetType;
import java.util.Arrays;
import java.util.List;
/**
* User: anna
* Date: 3/13/13
*/
public class JavaFxBuilderService extends BuilderService {
@Override
public List<? extends BuildTargetType<?>> getTargetTypes() {
return Arrays.<BuildTargetType<?>>asList(ArtifactBuildTargetType.INSTANCE);
}
}
@@ -2,6 +2,7 @@ package org.jetbrains.plugins.javaFX;
import org.jetbrains.jps.model.serialization.JpsModelSerializerExtension;
import org.jetbrains.jps.model.serialization.artifact.JpsArtifactPropertiesSerializer;
import org.jetbrains.jps.model.serialization.artifact.JpsPackagingElementSerializer;
import java.util.Collections;
import java.util.List;
@@ -15,4 +16,9 @@ public class JpsJavaFxModelSerializerExtension extends JpsModelSerializerExtensi
public List<? extends JpsArtifactPropertiesSerializer<?>> getArtifactTypePropertiesSerializers() {
return Collections.singletonList(new JpsJavaFxArtifactPropertiesSerializer());
}
@Override
public List<? extends JpsPackagingElementSerializer<?>> getPackagingElementSerializers() {
return Collections.singletonList(new JpsJavaFxRootElementSerializer());
}
}
@@ -0,0 +1,39 @@
/*
* Copyright 2000-2013 JetBrains s.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.plugins.javaFX;
import org.jdom.Element;
import org.jetbrains.jps.model.serialization.artifact.JpsPackagingElementSerializer;
/**
* User: anna
* Date: 3/13/13
*/
public class JpsJavaFxRootElementSerializer extends JpsPackagingElementSerializer<JpsJavaFxRootPackagingElement> {
public JpsJavaFxRootElementSerializer() {
super("javafx-root", JpsJavaFxRootPackagingElement.class);
}
@Override
public JpsJavaFxRootPackagingElement load(Element element) {
return new JpsJavaFxRootPackagingElement(element.getAttributeValue("name"));
}
@Override
public void save(JpsJavaFxRootPackagingElement element, Element tag) {
tag.setAttribute("name", element.getArtifactFile());
}
}
@@ -0,0 +1,54 @@
/*
* Copyright 2000-2013 JetBrains s.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.plugins.javaFX;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jps.model.artifact.impl.elements.JpsCompositePackagingElementBase;
/**
* User: anna
* Date: 3/13/13
*/
public class JpsJavaFxRootPackagingElement extends JpsCompositePackagingElementBase<JpsJavaFxRootPackagingElement> {
private String myArtifactFile;
public JpsJavaFxRootPackagingElement(String artifactFile) {
myArtifactFile = artifactFile;
}
private JpsJavaFxRootPackagingElement(JpsJavaFxRootPackagingElement original) {
super(original);
myArtifactFile = original.myArtifactFile;
}
@NotNull
@Override
public JpsJavaFxRootPackagingElement createCopy() {
return new JpsJavaFxRootPackagingElement(this);
}
public String getArtifactFile() {
return myArtifactFile;
}
public void setArtifactFile(String directoryName) {
if (!myArtifactFile.equals(directoryName)) {
myArtifactFile = directoryName;
fireElementChanged();
}
}
}