KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > javaeditor > saveparticipant > IPostSaveListener


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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.jdt.internal.ui.javaeditor.saveparticipant;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.core.runtime.IProgressMonitor;
15
16 import org.eclipse.jdt.core.ICompilationUnit;
17
18 import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider;
19
20 /**
21  * This <code>IPostSaveListener</code> is informed when
22  * a compilation unit is saved through the {@link CompilationUnitDocumentProvider}.
23  * <p>
24  * In oder to get notified the listener must be registered with the {@link SaveParticipantRegistry}
25  * and be enabled on the save participant preference page.</p>
26  * <p>
27  * The notification order of post save listeners is unspecified.</p>
28  * <p>
29  * Clients may implement this interface.
30  * </p>
31  *
32  * @see SaveParticipantDescriptor
33  * @see CompilationUnitDocumentProvider
34  * @since 3.3
35  */

36 public interface IPostSaveListener {
37     
38     /**
39      * A human readable name of this listener.
40      *
41      * @return the name
42      */

43     String JavaDoc getName();
44     
45     /**
46      * The unique id of this listener.
47      *
48      * @return a non-empty id
49      */

50     String JavaDoc getId();
51     
52     /**
53      * Informs this post save listener that the given <code>compilationUnit</code>
54      * has been saved by the {@link CompilationUnitDocumentProvider}. The listener
55      * is allowed to modify the given compilation unit and to open a dialog.
56      * <p>
57      * <em>Every implementor of this method must strictly obey these rules:</em>
58      * <ul>
59      * <li>not touch any file other than the given <code>compilationUnit</code>
60      * which is already locked by a scheduling rule </li>
61      * <li>changing the scheduling rule or posting a new job is not allowed</li>
62      * <li>it is not allowed to save the given <code>compilationUnit</code></li>
63      * <li>it must be able to deal with unsaved resources and with compilation units which are not on the Java build path</li>
64      * <li>must not assume to be called in the UI thread</li>
65      * <li>should be as fast as possible since this code is executed every time the <code>compilationUnit</code> is saved</li>
66      * </ul>
67      * The compilation unit document provider can disable a listener that violates any of the above rules.</p>
68      *
69      * @param compilationUnit the compilation unit which was saved
70      * @param monitor the progress monitor for reporting progress
71      * @see CompilationUnitDocumentProvider
72      */

73     void saved(ICompilationUnit compilationUnit, IProgressMonitor monitor) throws CoreException;
74
75 }
76
Popular Tags