Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: f8ffdc1602fba8845df49d3b90e2b3c5839c8283 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*******************************************************************************
 * Copyright (c) 2000, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.core.filebuffers;

import org.eclipse.core.runtime.IPath;

/**
 * Interface for listeners to file buffer changes.
 * 
 * @since 3.0
 */
public interface IFileBufferListener {

	/**
	 * Informs the listener about the creation of the given buffer.
	 * 
	 * @param buffer the created file buffer
	 */
	void bufferCreated(IFileBuffer buffer);
	
	/**
	 * Informs the listener that the given buffer has been disposed.
	 * All state information has already been disposed and accessing
	 * it is forbidden. However, accessing the file buffer's content is
	 * still allowed during the notification. 
	 * 
	 * @param buffer the disposed file buffer
	 */
	void bufferDisposed(IFileBuffer buffer);

	/**
	 * Informs the listener about an upcoming replace of the contents of the given buffer.
	 * 
	 * @param buffer the effected file buffer
	 */
	void bufferContentAboutToBeReplaced(IFileBuffer buffer);
	
	/**
	 * Informs the listener that the buffer of the given buffer has been replaced.
	 * 
	 * @param buffer the effected file buffer
	 */
	void bufferContentReplaced(IFileBuffer buffer);

	/**
	 * Informs the listener about the start of a state changing operation on
	 * the given buffer.
	 * 
	 * @param buffer the effected file buffer
	 */
	void stateChanging(IFileBuffer buffer);
	
	/**
	 * Informs the listener that the dirty state of the given buffer changed
	 * to the specified value
	 * 
	 * @param buffer the effected file buffer
	 * @param isDirty <code>true</code> if the buffer is dirty, <code>false</code> otherwise
	 */
	void dirtyStateChanged(IFileBuffer buffer, boolean isDirty);
	
	/**
	 * Informs the listener that the state validation changed to the specified value.
	 * 
	 * @param buffer the effected file buffer
	 * @param isStateValidated <code>true</code> if the buffer state is validated, <code>false</code> otherwise
	 */
	void stateValidationChanged(IFileBuffer buffer, boolean isStateValidated);
	
	/**
	 * Informs the listener that the file underlying the given file buffer has been moved to the
	 * given location.
	 * 
	 * @param buffer the effected file buffer
	 * @param path the new location (not just the container)
	 */
	void underlyingFileMoved(IFileBuffer buffer, IPath path);
	
	/**
	 * Informs the listener that the file underlying the given file buffer has been deleted.
	 * 
	 * @param buffer the effected file buffer
	 */
	void underlyingFileDeleted(IFileBuffer buffer);
	
	/**
	 * Informs the listener that a state changing operation on the given
	 * file buffer failed.
	 * 
	 * @param buffer the effected file buffer
	 */
	void stateChangeFailed(IFileBuffer buffer);
}

Back to the top