KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > viewers > provisional > IModelSelectionPolicy


1 /*******************************************************************************
2  * Copyright (c) 2005, 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.debug.internal.ui.viewers.provisional;
12
13 import org.eclipse.jface.viewers.ISelection;
14
15 /**
16  * Resolves selection conflicts within a model. When
17  * a selection exists in a viewer, and a client asks
18  * to set another selection, the selection policy for
19  * that model is asked to determine whether the new
20  * selection should override the previous selection.
21  * When a selection is from a different model, the
22  * original selection is maintained if its model selection
23  * policy specifies the selection to be 'sticky'.
24  * <p>
25  * A selection policy is obtained by querying for the selection
26  * policy factory for a given element. The selection policy factory
27  * will then be asked to create a model selection policy adapter.
28  * The adapter represents selections from an instance of a model.
29  * </p>
30  *
31  * @see IModelSelectionPolicyFactoryAdapter
32  * @since 3.2
33  */

34 public interface IModelSelectionPolicy {
35     
36     /**
37      * Returns whether the given selection is contained in
38      * this model.
39      *
40      * @param selection
41      * @param context
42      * @return
43      */

44     public boolean contains(ISelection selection, IPresentationContext context);
45     
46     /**
47      * Returns whether the candidate selection overrides the
48      * existing selection. The policy is only asked about selections
49      * that it contains.
50      *
51      * @param existing
52      * @param candidate
53      * @param context
54      * @return
55      */

56     public boolean overrides(ISelection existing, ISelection candidate, IPresentationContext context);
57
58     /**
59      * Returns whether the given selection should be maintained in the
60      * face of a selection attempt from a different model.
61      *
62      * @param selection
63      * @param context
64      * @return
65      */

66     public boolean isSticky(ISelection selection, IPresentationContext context);
67     
68 }
69
Popular Tags