1 /******************************************************************************* 2 * Copyright (c) 2005, 2008 IBM Corporation and others. 3 * 4 * This program and the accompanying materials 5 * are made available under the terms of the Eclipse Public License 2.0 6 * which accompanies this distribution, and is available at 7 * https://www.eclipse.org/legal/epl-2.0/ 8 * 9 * SPDX-License-Identifier: EPL-2.0 10 * 11 * Contributors: 12 * IBM Corporation - initial API and implementation 13 *******************************************************************************/ 14 package org.eclipse.pde.internal.core.product; 15 16 import java.io.PrintWriter; 17 import org.eclipse.pde.internal.core.iproduct.IIntroInfo; 18 import org.eclipse.pde.internal.core.iproduct.IProductModel; 19 import org.w3c.dom.Element; 20 import org.w3c.dom.Node; 21 22 public class IntroInfo extends ProductObject implements IIntroInfo { 23 24 public static final String P_INTRO_ID = "introId"; //$NON-NLS-1$ 25 private static final long serialVersionUID = 1L; 26 private String fIntroId; 27 IntroInfo(IProductModel model)28 public IntroInfo(IProductModel model) { 29 super(model); 30 } 31 32 @Override setId(String id)33 public void setId(String id) { 34 String old = fIntroId; 35 fIntroId = id; 36 if (isEditable()) { 37 firePropertyChanged(P_INTRO_ID, old, fIntroId); 38 } 39 } 40 41 @Override getId()42 public String getId() { 43 return fIntroId; 44 } 45 46 @Override parse(Node node)47 public void parse(Node node) { 48 if (node.getNodeType() == Node.ELEMENT_NODE) { 49 Element element = (Element) node; 50 fIntroId = element.getAttribute(P_INTRO_ID); 51 } 52 } 53 54 @Override write(String indent, PrintWriter writer)55 public void write(String indent, PrintWriter writer) { 56 if (fIntroId != null && fIntroId.length() > 0) { 57 writer.println(indent + "<intro " + P_INTRO_ID + "=\"" + getWritableString(fIntroId) + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ 58 } 59 } 60 61 } 62