KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > compare > INavigatable


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.compare;
12
13 import org.eclipse.swt.widgets.Widget;
14
15 /**
16  * Interface that allow clients to navigate through the changes shown in a compare pane.
17  * <p>
18  * This interface may be implemented by clients.
19  * </p>
20  * @since 3.3
21  * @see ICompareNavigator
22  */

23 public interface INavigatable {
24     
25     /**
26      * Property key that can be used to associate an instance of this interface with
27      * an SWT widget using {@link Widget#setData(String, Object)}.
28      */

29     static final String JavaDoc NAVIGATOR_PROPERTY= "org.eclipse.compare.internal.Navigator"; //$NON-NLS-1$
30

31     /**
32      * Change flag used to navigate to the next change.
33      * @see #selectChange(int)
34      */

35     static final int NEXT_CHANGE= 1;
36     
37     /**
38      * Change flag used to navigate to the previous change.
39      * @see #selectChange(int)
40      */

41     static final int PREVIOUS_CHANGE= 2;
42     
43     /**
44      * Change flag used to navigate to the first change.
45      * @see #selectChange(int)
46      */

47     static final int FIRST_CHANGE= 3;
48     
49     /**
50      * Change flag used to navigate to the last change.
51      * @see #selectChange(int)
52      */

53     static final int LAST_CHANGE= 4;
54     
55     /**
56      * Return the input of the compare pane being navigated or <code>null</code>
57      * if the pane does not have an input.
58      * @return the input of the compare pane being navigated or <code>null</code>
59      */

60     Object JavaDoc getInput();
61     
62     /**
63      * Starting from the current selection <code>selectChange</code> selects and reveals the specified change.
64      * If the end (or beginning) is reached, the method returns <code>true</code>.
65      *
66      * @param changeFlag the change to be selected. One of <code>NEXT_CHANGE</code>, <code>PREVIOUS_CHANGE</code>,
67      * <code>FIRST_CHANGE</code> or <code>LAST_CHANGE</code>.
68      * @return returns <code>true</code> if end (beginning) is reached, <code>false</code> otherwise
69      */

70     boolean selectChange(int changeFlag);
71     
72     /**
73      * Return whether a call to {@link #selectChange(int)} with the same parameter
74      * would succeed.
75      * @param changeFlag the change to be selected. One of <code>NEXT_CHANGE</code> or <code>PREVIOUS_CHANGE</code>
76      * @return whether a call to {@link #selectChange(int)} with the same parameter
77      * would succeed.
78      */

79     boolean hasChange(int changeFlag);
80     
81     /**
82      * Request that the currently selected change be opened. Return <code>true</code>
83      * if the request resulted in the change being opened and <code>false/code> if the
84      * currently selected change could not be opened.
85      * @return whether the selected change was opened.
86      */

87     boolean openSelectedChange();
88
89 }
90
Popular Tags