1 /*******************************************************************************
2  *  Copyright (c) 2000, 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.schema;
15 
16 import java.io.PrintWriter;
17 import java.net.URL;
18 import org.eclipse.pde.core.IEditable;
19 import org.eclipse.pde.core.IModelChangedEvent;
20 import org.eclipse.pde.internal.core.ischema.ISchemaDescriptor;
21 
22 public class EditableSchema extends Schema implements IEditable {
23 
EditableSchema(ISchemaDescriptor schemaDescriptor, URL url, boolean abbreviated)24 	public EditableSchema(ISchemaDescriptor schemaDescriptor, URL url, boolean abbreviated) {
25 		super(schemaDescriptor, url, abbreviated);
26 	}
27 
EditableSchema(String pluginId, String pointId, String name, boolean abbreviated)28 	public EditableSchema(String pluginId, String pointId, String name, boolean abbreviated) {
29 		super(pluginId, pointId, name, abbreviated);
30 	}
31 
32 	private boolean dirty;
33 
34 	@Override
fireModelChanged(IModelChangedEvent event)35 	public void fireModelChanged(IModelChangedEvent event) {
36 		if (isNotificationEnabled()) {
37 			dirty = true;
38 		}
39 		super.fireModelChanged(event);
40 	}
41 
42 	@Override
isDirty()43 	public boolean isDirty() {
44 		return dirty;
45 	}
46 
47 	@Override
isEditable()48 	public boolean isEditable() {
49 		return true;
50 	}
51 
52 	@Override
save(PrintWriter writer)53 	public void save(PrintWriter writer) {
54 		this.write("", writer); //$NON-NLS-1$
55 		dirty = false;
56 	}
57 
58 	@Override
setDirty(boolean newDirty)59 	public void setDirty(boolean newDirty) {
60 		dirty = newDirty;
61 	}
62 }
63