comparison dwtx/jface/text/ISlaveDocumentManager.d @ 129:eb30df5ca28b

Added JFace Text sources
author Frank Benoit <benoit@tionex.de>
date Sat, 23 Aug 2008 19:10:48 +0200
parents
children c4fb132a086c
comparison
equal deleted inserted replaced
128:8df1d4193877 129:eb30df5ca28b
1 /*******************************************************************************
2 * Copyright (c) 2000, 2005 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 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/
13
14 module dwtx.jface.text.ISlaveDocumentManager;
15
16 import dwt.dwthelper.utils;
17
18 /**
19 * Slave documents are documents whose contents is defined in terms of a master
20 * document. Thus, slave documents usually reflect a projection of the master document.
21 * Slave documents are causally connected to the master document. This means, changes
22 * of the master document have immediate effect on the slave document and vice versa.
23 * <p>
24 * A slave document manager creates slave documents for given master documents, manages the
25 * life cycle of the slave documents, and keeps track of the information flow between
26 * master and slave documents. The slave document manager defines the construction rules of the
27 * slave documents in terms of the master document.</p>
28 * <p>
29 * In order to provided backward compatibility for clients of <code>ISlaveDocumentManager</code>, extension
30 * interfaces are used to provide a means of evolution. The following extension interfaces
31 * exist:
32 * <ul>
33 * <li> {@link dwtx.jface.text.ISlaveDocumentManagerExtension} since version 3.0 extending the protocol
34 * with an access to all managed slave document for a given master document. </li>
35 * </ul>
36 * </p>
37 *
38 * @see dwtx.jface.text.IDocument
39 * @since 2.1
40 */
41 public interface ISlaveDocumentManager {
42
43 /**
44 * Creates a new slave document for the given master document. The slave document
45 * is causally connected to its master document until <code>freeSlaveDocument</code>
46 * is called. The connection between the newly created slave document and the master
47 * document is managed by this slave document manager.
48 *
49 * @param master the master document
50 * @return the newly created slave document
51 * @see #freeSlaveDocument(IDocument)
52 */
53 IDocument createSlaveDocument(IDocument master);
54
55 /**
56 * Frees the given slave document. If the given document is not a slave document known
57 * to this slave document manager, this call does not have any effect. A slave
58 * document is known to this slave document manager if it has been created by
59 * this manager using <code>createSlaveDocument</code>.
60 *
61 * @param slave the slave document to be freed
62 * @see #createSlaveDocument(IDocument)
63 */
64 void freeSlaveDocument(IDocument slave);
65
66 /**
67 * Creates a new document information mapping between the given slave document and
68 * its master document. Returns <code>null</code> if the given document is unknown
69 * to this slave document manager.
70 *
71 * @param slave the slave document
72 * @return a document information mapping between the slave document and its master document or
73 * <code>null</code>
74 */
75 IDocumentInformationMapping createMasterSlaveMapping(IDocument slave);
76
77 /**
78 * Returns the master document of the given slave document or <code>null</code> if the
79 * given document is unknown to this slave document manager.
80 *
81 * @param slave the slave document
82 * @return the master document of the given slave document or <code>null</code>
83 */
84 IDocument getMasterDocument(IDocument slave);
85
86 /**
87 * Returns whether the given document is a slave document known to this slave document manager. A slave document
88 * is known to this slave document manager, if the document has been created by this manager.
89 *
90 * @param document the document to be checked whether it is a slave document known to this manager
91 * @return <code>true</code> if the document is a slave document, <code>false</code> otherwise
92 */
93 bool isSlaveDocument(IDocument document);
94
95 /**
96 * Sets the given slave document's auto expand mode. In auto expand mode, a
97 * slave document is automatically adapted to reflect all changes applied to it's master document.
98 * Assume a master document contains 30 lines and the slave is defined to contain the lines 11-20.
99 * In auto expand mode, when the master document is changed at line 8, the slave document is expanded
100 * to contain the lines 8-20.<p>
101 * This call is without effect if the given document is unknown to this slave document manager.
102 *
103 * @param slave the slave whose auto expand mode should be set
104 * @param autoExpand <code>true</code> for auto expand, <code>false</code> otherwise
105 */
106 void setAutoExpandMode(IDocument slave, bool autoExpand);
107 }