KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > IEditorMatchingStrategy


1 /*******************************************************************************
2  * Copyright (c) 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  *******************************************************************************/

11
12 package org.eclipse.ui;
13
14 /**
15  * An editor matching strategy allows editor extensions to provide their own
16  * algorithm for matching the input of an open editor of that type to a
17  * given editor input. This is used to find a matching editor during
18  * {@link org.eclipse.ui.IWorkbenchPage#openEditor(IEditorInput, String, boolean)} and
19  * {@link org.eclipse.ui.IWorkbenchPage#findEditor(IEditorInput)}.
20  *
21  * @since 3.1
22  */

23 public interface IEditorMatchingStrategy {
24     
25     /**
26      * Returns whether the editor represented by the given editor reference
27      * matches the given editor input.
28      * <p>
29      * Implementations should inspect the given editor input first,
30      * and try to reject it early before calling <code>IEditorReference.getEditorInput()</code>,
31      * since that method may be expensive.
32      * </p>
33      *
34      * @param editorRef the editor reference to match against
35      * @param input the editor input to match
36      * @return <code>true</code> if the editor matches the given editor input,
37      * <code>false</code> if it does not match
38      */

39     boolean matches(IEditorReference editorRef, IEditorInput input);
40     
41 }
42
Popular Tags