01: /*******************************************************************************
02: * Copyright (c) 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui;
11:
12: /**
13: * An editor matching strategy allows editor extensions to provide their own
14: * algorithm for matching the input of an open editor of that type to a
15: * given editor input. This is used to find a matching editor during
16: * {@link org.eclipse.ui.IWorkbenchPage#openEditor(IEditorInput, String, boolean)} and
17: * {@link org.eclipse.ui.IWorkbenchPage#findEditor(IEditorInput)}.
18: *
19: * @since 3.1
20: */
21: public interface IEditorMatchingStrategy {
22:
23: /**
24: * Returns whether the editor represented by the given editor reference
25: * matches the given editor input.
26: * <p>
27: * Implementations should inspect the given editor input first,
28: * and try to reject it early before calling <code>IEditorReference.getEditorInput()</code>,
29: * since that method may be expensive.
30: * </p>
31: *
32: * @param editorRef the editor reference to match against
33: * @param input the editor input to match
34: * @return <code>true</code> if the editor matches the given editor input,
35: * <code>false</code> if it does not match
36: */
37: boolean matches(IEditorReference editorRef, IEditorInput input);
38:
39: }
|