KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > core > IEditable


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.core;
12
13 import java.io.PrintWriter JavaDoc;
14 /**
15  * Models that implement this interface indicate that
16  * they can be changed. When a model is changed,
17  * it becomes 'dirty'. This state can either be reset
18  * (in case of a 'false alarm' or naturally set to
19  * false as a result of saving the changes.
20  * Models that implement this interface are expected
21  * to be able to save in ASCII file format
22  * (e.g. XML).
23  * @since 2.0
24  */

25 public interface IEditable {
26     /**
27      * Tests whether the model marked as editable can be
28      * edited. Even though a model is generally editable,
29      * it can me marked as read-only because some condition
30      * prevents it from changing state (for example,
31      * the underlying resource is locked). While
32      * read-only models can never be changed, editable
33      * models can go in and out editable state during
34      * their life cycle.
35      *
36      * @return <code>true</code> if model can be modified, <code>false</code>
37      * otherwise.
38      */

39     public boolean isEditable();
40     /**
41      * Tests whether the model has been changed from the last clean
42      * state.
43      * @return <code>true</code> if the model has been changed and need saving
44      */

45     public boolean isDirty();
46     /**
47      * Saves the model into the provided writer.
48      * The assumption is that the model can be
49      * persisted in an ASCII output stream (for example, an XML file).
50      * This method should clear the 'dirty' flag when
51      * done.
52      *
53      * @param writer an object that should be used to
54      * write ASCII representation of the model
55      */

56     public void save(PrintWriter JavaDoc writer);
57     /**
58      * Sets the dirty flag of the model. This method is
59      * normally not intended to be used outside the model.
60      * Most often, a dirty model should be saved to clear the flag.
61      *
62      * @param dirty a new value for the 'dirty' flag
63      */

64     void setDirty(boolean dirty);
65 }
66
Popular Tags