KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > core > schema > EditableSchema


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.core.schema;
12
13 import java.io.PrintWriter JavaDoc;
14 import java.net.URL JavaDoc;
15
16 import org.eclipse.pde.core.IEditable;
17 import org.eclipse.pde.core.IModelChangedEvent;
18 import org.eclipse.pde.internal.core.ischema.ISchemaDescriptor;
19
20 public class EditableSchema extends Schema implements IEditable {
21
22     public EditableSchema(ISchemaDescriptor schemaDescriptor, URL JavaDoc url, boolean abbreviated) {
23         super(schemaDescriptor, url, abbreviated);
24     }
25     
26     public EditableSchema(String JavaDoc pluginId, String JavaDoc pointId, String JavaDoc name, boolean abbreviated) {
27         super(pluginId, pointId, name, abbreviated);
28     }
29     
30
31     private boolean dirty;
32
33     public void fireModelChanged(IModelChangedEvent event) {
34         if (isNotificationEnabled())
35             dirty = true;
36         super.fireModelChanged(event);
37     }
38
39     public boolean isDirty() {
40         return dirty;
41     }
42
43     public boolean isEditable() {
44         return true;
45     }
46
47     public void save(PrintWriter JavaDoc writer) {
48         this.write("", writer); //$NON-NLS-1$
49
dirty = false;
50     }
51
52     public void setDirty(boolean newDirty) {
53         dirty = newDirty;
54     }
55 }
56
Popular Tags