1 11 package org.eclipse.team.ui.history; 12 13 import org.eclipse.core.resources.IResource; 14 import org.eclipse.team.core.RepositoryProvider; 15 import org.eclipse.team.core.history.IFileHistoryProvider; 16 import org.eclipse.team.internal.ui.Utils; 17 18 23 public abstract class HistoryPageSource implements IHistoryPageSource { 24 25 33 public static IHistoryPageSource getHistoryPageSource(Object object) { 34 IResource resource = Utils.getResource(object); 35 if (resource != null) { 36 RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject()); 37 if (provider != null) { 38 IFileHistoryProvider fileHistoryProvider = provider.getFileHistoryProvider(); 39 if (fileHistoryProvider != null) { 40 IHistoryPageSource pageSource = (IHistoryPageSource)Utils.getAdapter(fileHistoryProvider, IHistoryPageSource.class); 41 if (pageSource != null) 42 return pageSource; 43 } 44 IHistoryPageSource pageSource = (IHistoryPageSource)Utils.getAdapter(provider, IHistoryPageSource.class); 45 if (pageSource != null) 46 return pageSource; 47 } 48 } 49 IHistoryPageSource pageSource = (IHistoryPageSource)Utils.getAdapter(object, IHistoryPageSource.class); 50 return pageSource; 51 } 52 53 } 54 | Popular Tags |