1 11 package org.eclipse.team.ui; 12 13 import org.eclipse.jface.util.IPropertyChangeListener; 14 import org.eclipse.team.internal.ui.TeamUIPlugin; 15 import org.eclipse.team.internal.ui.history.GenericHistoryView; 16 import org.eclipse.team.internal.ui.registry.TeamContentProviderManager; 17 import org.eclipse.team.ui.history.IHistoryPageSource; 18 import org.eclipse.team.ui.history.IHistoryView; 19 import org.eclipse.team.ui.mapping.ITeamContentProviderManager; 20 import org.eclipse.team.ui.synchronize.ISynchronizeManager; 21 import org.eclipse.ui.*; 22 23 28 public class TeamUI { 29 30 33 public static final String GLOBAL_IGNORES_CHANGED = TeamUIPlugin.ID + "global_ignores_changed"; 35 39 public static final String GLOBAL_FILE_TYPES_CHANGED = TeamUIPlugin.ID + "global_file_types_changed"; 41 47 public static ISynchronizeManager getSynchronizeManager() { 48 return TeamUIPlugin.getPlugin().getSynchronizeManager(); 49 } 50 51 56 public static void addPropertyChangeListener(IPropertyChangeListener listener) { 57 TeamUIPlugin.addPropertyChangeListener(listener); 58 } 59 60 65 public static void removePropertyChangeListener(IPropertyChangeListener listener) { 66 TeamUIPlugin.removePropertyChangeListener(listener); 67 } 68 69 76 public static IHistoryView getHistoryView() { 77 try { 78 TeamUIPlugin.getActivePage().showView(IHistoryView.VIEW_ID); 79 return (IHistoryView) TeamUIPlugin.getActivePage().findView(IHistoryView.VIEW_ID); 80 } catch (PartInitException e) { 81 } 82 83 return null; 84 } 85 86 99 public static IHistoryView showHistoryFor(IWorkbenchPage page, Object input, IHistoryPageSource pageSource) { 100 try { 101 IHistoryView view = (IHistoryView) page.findView(IHistoryView.VIEW_ID); 102 if (view == null) { 103 page.showView(IHistoryView.VIEW_ID); 104 view = (IHistoryView) TeamUIPlugin.getActivePage().findView(IHistoryView.VIEW_ID); 105 return showInputInView(page, input, view, pageSource); 106 } else { 107 view = ((GenericHistoryView)view).findAppropriateHistoryViewFor(input, pageSource); 108 if (view == null) { 109 view = (IHistoryView) page.showView(IHistoryView.VIEW_ID, IHistoryView.VIEW_ID + System.currentTimeMillis(), IWorkbenchPage.VIEW_CREATE); 110 return showInputInView(page, input, view, pageSource); 111 } else { 112 return showInputInView(page, input, view, pageSource); 113 } 114 } 115 } catch (PartInitException e) { 116 } 117 118 return null; 119 } 120 121 private static IHistoryView showInputInView(IWorkbenchPage page, 122 Object input, IHistoryView view, IHistoryPageSource pageSource) { 123 page.activate((IWorkbenchPart)view); 124 ((GenericHistoryView)view).showHistoryPageFor(input, true, false, pageSource); 125 return view; 126 } 127 128 136 public static ITeamContentProviderManager getTeamContentProviderManager() { 137 return TeamContentProviderManager.getInstance(); 138 } 139 } 140 | Popular Tags |