KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > terracotta > dso > EditorMatchingStrategy


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package org.terracotta.dso;
5
6 import org.eclipse.core.resources.IFile;
7 import org.eclipse.core.resources.IProject;
8 import org.eclipse.ui.IEditorInput;
9 import org.eclipse.ui.IEditorMatchingStrategy;
10 import org.eclipse.ui.IEditorReference;
11 import org.eclipse.ui.IFileEditorInput;
12
13 public class EditorMatchingStrategy implements IEditorMatchingStrategy {
14   public boolean matches(IEditorReference editorRef, IEditorInput input) {
15     if(input instanceof IFileEditorInput) {
16       IFile file = ((IFileEditorInput)input).getFile();
17       IProject project = file.getProject();
18       
19       return file.getFullPath().getFileExtension().equals("xml") &&
20          TcPlugin.getDefault().hasTerracottaNature(project);
21     }
22     
23     return false;
24   }
25 }
26
Popular Tags