1 /*******************************************************************************
2 * Copyright (c) 2012 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.ui.workbench.editor.input;
14 import org.eclipse.ui.IEditorInput;
15 import org.eclipse.ui.IEditorMatchingStrategy;
16 import org.eclipse.ui.IEditorReference;
17 import org.eclipse.ui.PartInitException;
18 import org.simantics.ui.workbench.IResourceEditorInput;
19 import org.simantics.ui.workbench.IResourceEditorInput2;
20 import org.simantics.ui.workbench.ResourceEditorInput;
21 import org.simantics.ui.workbench.ResourceEditorInput2;
24 * An editor input matching strategy that does not take into account the name in
25 * the editor input. This is because in {@link ResourceEditorInput} and
26 * {@link ResourceEditorInput2} the name is not important, only
27 * <code>equals</code> is.
29 * @author Tuukka Lehtonen
31 * @see IResourceEditorInput
32 * @see IResourceEditorInput2
33 * @see ResourceEditorInput
34 * @see ResourceEditorInput2
36 public class ResourceEditorInputMatchingStrategy implements IEditorMatchingStrategy {
39 public boolean matches(IEditorReference editorRef, IEditorInput input) {
40 if (!(input instanceof IResourceEditorInput))
44 IEditorInput editorInput = editorRef.getEditorInput();
45 return input.equals(editorInput);
46 } catch (PartInitException e) {