KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > team > internal > ui > history > LocalHistoryPageSource


1 /*******************************************************************************
2  * Copyright (c) 2006, 2007 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.team.internal.ui.history;
12
13 import org.eclipse.core.resources.IFile;
14 import org.eclipse.core.resources.IResource;
15 import org.eclipse.team.internal.ui.Utils;
16 import org.eclipse.team.ui.history.HistoryPageSource;
17 import org.eclipse.team.ui.history.IHistoryPageSource;
18 import org.eclipse.ui.part.Page;
19
20 public class LocalHistoryPageSource extends HistoryPageSource {
21
22     private static LocalHistoryPageSource instance;
23
24     public static IFile getFile(Object JavaDoc object) {
25         IResource resource = Utils.getResource(object);
26         if (resource instanceof IFile) {
27             return (IFile) resource;
28         }
29         return null;
30     }
31     
32     public boolean canShowHistoryFor(Object JavaDoc object) {
33         return getFile(object) != null;
34     }
35
36     public Page createPage(Object JavaDoc object) {
37         LocalHistoryPage page = new LocalHistoryPage();
38         return page;
39     }
40
41     public synchronized static IHistoryPageSource getInstance() {
42         if (instance == null)
43             instance = new LocalHistoryPageSource();
44         return instance;
45     }
46
47 }
48
Popular Tags