![]() |
![]() |
org.eclipse.team.ui_3.6.101.R37x_v20111109-0800View$7 extends Action { final GenericHistoryView this$0; GenericHistoryView$7(GenericHistoryView paramGenericHistoryView, String $anonymous0, ImageDescriptor $anonymous1) { super($anonymous0, $anonymous1);this$0 = paramGenericHistoryView; } public void run() { if (isChecked()) { GenericHistoryView.access$7(this$0).setChecked(false); this$0.setViewPinned(false); } this$0.setLinkingEnabled(this$0.isViewPinned() ? false : isChecked()); } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.history.GenericHistoryView.7 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.history; import org.eclipse.team.ui.history.IHistoryPage; class GenericHistoryView$8 implements Runnable { final GenericHistoryView this$0; GenericHistoryView$8(GenericHistoryView paramGenericHistoryView) { this$0 = paramGenericHistoryView; } public void run() { IHistoryPage historyPage = (IHistoryPage)this$0.currentPageContainer.getPage(); GenericHistoryView.access$8(this$0, historyPage.getName()); this$0.navigationHistory.updateName(historyPage, this$0.currentPageContainer.getSource()); } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.history.GenericHistoryView.8 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.history; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IMenuCreator; import org.eclipse.jface.action.MenuManager; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Menu; abstract class GenericHistoryView$MenuCreator implements IMenuCreator { private MenuManager menuManager; final GenericHistoryView this$0; GenericHistoryView$MenuCreator(GenericHistoryView paramGenericHistoryView) { this$0 = paramGenericHistoryView; } public void dispose() { if (menuManager != null) { menuManager.dispose(); menuManager = null; } } public Menu getMenu(Control parent) { Menu fMenu = null; if (menuManager == null) { menuManager = new MenuManager(); fMenu = menuManager.createContextMenu(parent); IAction[] actions = getDropDownActions(); for (int i = actions.length - 1; i >= 0; i--) { IAction action = actions[i]; menuManager.add(action); } updateMenuState(); } else { fMenu = menuManager.getMenu(); } return fMenu; } protected void updateMenuState() { if (menuManager != null) { menuManager.update(true); } } protected abstract IAction[] getDropDownActions(); public Menu getMenu(Menu parent) { return null; } public void rebuildMenu() { if (menuManager != null) { menuManager.dispose(); menuManager = null; } } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.history.GenericHistoryView.MenuCreator * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.history; import java.util.ArrayList; import java.util.List; import org.eclipse.team.ui.history.IHistoryPage; import org.eclipse.team.ui.history.IHistoryPageSource; class GenericHistoryView$NavigationHistory { List history; int position; private boolean navigating; final GenericHistoryView this$0; GenericHistoryView$NavigationHistory(GenericHistoryView paramGenericHistoryView) { this$0 = paramGenericHistoryView; history = new ArrayList(); } public int size() { return history.size(); } public void gotoPreviousEntry() { if (position > 0) { position -= 1; gotoEntry(); } else { position = (history.size() - 1); gotoEntry(); } } /* Error */ private void gotoEntry() { // Byte code: // 0: aload_0 // 1: iconst_1 // 2: putfield 113 org/eclipse/team/internal/ui/history/GenericHistoryView$NavigationHistory:navigating Z // 5: aload_0 // 6: invokespecial 125 org/eclipse/team/internal/ui/history/GenericHistoryView$NavigationHistory:getCurrentEntry ()Lorg/eclipse/team/internal/ui/history/GenericHistoryView$NavigationHistoryEntry; // 9: astore_1 // 10: aload_0 // 11: getfield 115 org/eclipse/team/internal/ui/history/GenericHistoryView$NavigationHistory:this$0 Lorg/eclipse/team/internal/ui/history/GenericHistoryView; // 14: aload_1 // 15: getfield 116 org/eclipse/team/internal/ui/history/GenericHistoryView$NavigationHistoryEntry:object Ljava/lang/Object; // 18: iconst_1 // 19: iconst_1 // 20: aload_1 // 21: getfield 118 org/eclipse/team/internal/ui/history/GenericHistoryView$NavigationHistoryEntry:source Lorg/eclipse/team/ui/history/IHistoryPageSource; // 24: invokevirtual 122 org/eclipse/team/internal/ui/history/GenericHistoryView:showHistoryPageFor (Ljava/lang/Object;ZZLorg/eclipse/team/ui/history/IHistoryPageSource;)Lorg/eclipse/team/ui/history/IHistoryPage; // 27: pop // 28: goto +11 -> 39 // 31: astore_2 // 32: aload_0 // 33: iconst_0 // 34: putfield 113 org/eclipse/team/internal/ui/history/GenericHistoryView$NavigationHistory:navigating Z // 37: aload_2 // 38: athrow // 39: aload_0 // 40: iconst_0 // 41: putfield 113 org/eclipse/team/internal/ui/history/GenericHistoryView$NavigationHistory:navigating Z // 44: return // Line number table: // Java source line #119 -> byte code offset #0 // Java source line #120 -> byte code offset #5 // Java source line #121 -> byte code offset #10 // Java source line #122 -> byte code offset #31 // Java source line #123 -> byte code offset #32 // Java source line #124 -> byte code offset #37 // Java source line #123 -> byte code offset #39 // Java source line #125 -> byte code offset #44 // Local variable table: // start length slot name signature // 0 45 0 this NavigationHistory // 9 12 1 currentEntry GenericHistoryView.NavigationHistoryEntry // 31 7 2 localObject Object // Exception table: // from to target type // 0 31 31 finally } private GenericHistoryView.NavigationHistoryEntry getCurrentEntry() { return (GenericHistoryView.NavigationHistoryEntry)history.get(position); } public void addEntry(Object object, String name, IHistoryPageSource source) { if (!navigating) { GenericHistoryView.NavigationHistoryEntry navigationHistoryEntry = new GenericHistoryView.NavigationHistoryEntry(object, name, source); if (history.contains(navigationHistoryEntry)) { history.remove(navigationHistoryEntry); } history.add(navigationHistoryEntry); if (history.size() > 15) { history.remove(0); } position = (history.size() - 1); } GenericHistoryView.access$5(this$0).update(); } public GenericHistoryView.NavigationHistoryEntry[] getEntries() { return (GenericHistoryView.NavigationHistoryEntry[])history.toArray(new GenericHistoryView.NavigationHistoryEntry[history.size()]); } private GenericHistoryView.NavigationHistoryEntry getEntry(int i) { return (GenericHistoryView.NavigationHistoryEntry)history.get(i); } public void gotoEntry(GenericHistoryView.NavigationHistoryEntry navigationHistoryEntry) { position = history.indexOf(navigationHistoryEntry); gotoEntry(); } public GenericHistoryView.NavigationHistoryEntry getPreviousEntry() { int next = position - 1; if (next < 0) { next = size() - 1; } return getEntry(next); } public void updateName(IHistoryPage historyPage, IHistoryPageSource pageSource) { GenericHistoryView.NavigationHistoryEntry[] historyEntries = getEntries(); for (int i = 0; i < historyEntries.length; i++) { GenericHistoryView.NavigationHistoryEntry historyEntry = historyEntries[i]; if (historyEntry.matches(historyPage, pageSource)) { name = historyPage.getName(); } } GenericHistoryView.access$5(this$0).update(); } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.history.GenericHistoryView.NavigationHistory * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.history; import java.util.ArrayList; import java.util.List; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; import org.eclipse.osgi.util.NLS; import org.eclipse.team.internal.ui.TeamUIMessages; class GenericHistoryView$NavigationHistoryAction extends Action { private GenericHistoryView.MenuCreator menuCreator; private IAction[] actions; final GenericHistoryView this$0; public GenericHistoryView$NavigationHistoryAction(GenericHistoryView paramGenericHistoryView) { this$0 = paramGenericHistoryView; menuCreator = new GenericHistoryView.4(this, paramGenericHistoryView); setMenuCreator(menuCreator); update(); } private IAction[] createActions() { GenericHistoryView.NavigationHistoryEntry[] entries = getDropDownEntries(); List actions = new ArrayList(); for (int i = 0; i < entries.length; i++) { GenericHistoryView.NavigationHistoryEntry navigationHistoryEntry = entries[i]; actions.add(new GenericHistoryView.NavigationHistoryEntryAction(this$0, navigationHistoryEntry)); } return (IAction[])actions.toArray(new IAction[actions.size()]); } protected GenericHistoryView.NavigationHistoryEntry[] getDropDownEntries() { return this$0.navigationHistory.getEntries(); } public void run() { this$0.navigationHistory.gotoPreviousEntry(); updateCheckState(); } public void update() { setEnabled(this$0.navigationHistory.size() > 1); if (isEnabled()) { setToolTipText(NLS.bind(TeamUIMessages.GenericHistoryView_1, this$0.navigationHistory.getPreviousEntry().name)); } else { setToolTipText(TeamUIMessages.GenericHistoryView_2); } actions = null; menuCreator.rebuildMenu(); updateCheckState(); } private void updateCheckState() { IAction[] actions = getActions(); for (int i = 0; i < actions.length; i++) { IAction action = actions[i]; if ((action instanceof GenericHistoryView.NavigationHistoryEntryAction)) { GenericHistoryView.NavigationHistoryEntryAction a = (GenericHistoryView.NavigationHistoryEntryAction)action; a.update(); } } menuCreator.updateMenuState(); } public void dispose() { menuCreator.dispose(); } private IAction[] getActions() { if (actions == null) { actions = createActions(); } return actions; } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.history.GenericHistoryView.NavigationHistoryAction * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.history; import org.eclipse.team.ui.history.IHistoryPage; import org.eclipse.team.ui.history.IHistoryPageSource; class GenericHistoryView$NavigationHistoryEntry { Object object; String name; IHistoryPageSource source; public GenericHistoryView$NavigationHistoryEntry(Object object, String name, IHistoryPageSource source) { this.object = object; this.name = name; this.source = source; } public boolean equals(Object obj) { if ((obj instanceof NavigationHistoryEntry)) { NavigationHistoryEntry other = (NavigationHistoryEntry)obj; return (object.equals(object)) && (GenericHistoryView.sameSource(source, source)); } return false; } public boolean matches(IHistoryPage historyPage, IHistoryPageSource pageSource) { return (object.equals(historyPage.getInput())) && (GenericHistoryView.sameSource(source, pageSource)); } public int hashCode() { return object.hashCode(); } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.history.GenericHistoryView.NavigationHistoryEntry * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.history; import org.eclipse.jface.action.Action; class GenericHistoryView$NavigationHistoryEntryAction extends Action { private final GenericHistoryView.NavigationHistoryEntry navigationHistoryEntry; final GenericHistoryView this$0; public GenericHistoryView$NavigationHistoryEntryAction(GenericHistoryView paramGenericHistoryView, GenericHistoryView.NavigationHistoryEntry navigationHistoryEntry) { super(name);this$0 = paramGenericHistoryView; this.navigationHistoryEntry = navigationHistoryEntry; } public void run() { this$0.navigationHistory.gotoEntry(navigationHistoryEntry); GenericHistoryView.NavigationHistoryAction.access$1(GenericHistoryView.access$5(this$0)); } public void update() { setChecked(GenericHistoryView.NavigationHistory.access$0(this$0.navigationHistory) == navigationHistoryEntry); } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.history.GenericHistoryView.NavigationHistoryEntryAction * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.history; import org.eclipse.team.ui.history.IHistoryPage; import org.eclipse.team.ui.history.IHistoryPageSource; import org.eclipse.ui.SubActionBars; import org.eclipse.ui.part.Page; class GenericHistoryView$PageContainer { private Page page; private SubActionBars subBars; private final IHistoryPageSource source; final GenericHistoryView this$0; public GenericHistoryView$PageContainer(GenericHistoryView paramGenericHistoryView, Page page, IHistoryPageSource source) { this$0 = paramGenericHistoryView; this.page = page; this.source = source; } public Page getPage() { return page; } public void setPage(Page page) { this.page = page; } public SubActionBars getSubBars() { return subBars; } public void setSubBars(SubActionBars subBars) { this.subBars = subBars; } public IHistoryPageSource getSource() { return source; } public boolean matches(Object object, IHistoryPageSource pageSource) { if ((page instanceof IHistoryPage)) { Object input = ((IHistoryPage)page).getInput(); if (input != null) { return (input.equals(object)) && (GenericHistoryView.sameSource(GenericHistoryView.access$4(this$0, object, pageSource), GenericHistoryView.access$4(this$0, input, source))); } } return false; } public boolean canShow(Object object, IHistoryPageSource pageSource) { if (((page instanceof IHistoryPage)) && (GenericHistoryView.sameSource(GenericHistoryView.access$4(this$0, object, pageSource), GenericHistoryView.access$4(this$0, ((IHistoryPage)page).getInput(), source)))) { return ((IHistoryPage)page).isValidInput(object); } return false; } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.history.GenericHistoryView.PageContainer * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.history; import com.ibm.icu.text.SimpleDateFormat; import java.io.PrintStream; import java.util.ArrayList; import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IMenuCreator; import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.dnd.DropTarget; import org.eclipse.swt.dnd.Transfer; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Menu; import org.eclipse.team.core.RepositoryProvider; import org.eclipse.team.core.history.IFileHistoryProvider; import org.eclipse.team.core.synchronize.SyncInfo; import org.eclipse.team.internal.ui.Policy; import org.eclipse.team.internal.ui.TeamUIMessages; import org.eclipse.team.internal.ui.TeamUIPlugin; import org.eclipse.team.internal.ui.Utils; import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement; import org.eclipse.team.ui.history.HistoryPage; import org.eclipse.team.ui.history.IHistoryPage; import org.eclipse.team.ui.history.IHistoryPageSource; import org.eclipse.team.ui.history.IHistoryView; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IPartListener; import org.eclipse.ui.IPartListener2; import org.eclipse.ui.ISelectionListener; import org.eclipse.ui.IViewPart; import org.eclipse.ui.IViewReference; import org.eclipse.ui.IViewSite; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPartReference; import org.eclipse.ui.IWorkbenchPartSite; import org.eclipse.ui.PartInitException; import org.eclipse.ui.SubActionBars; import org.eclipse.ui.actions.ActionFactory; import org.eclipse.ui.ide.ResourceUtil; import org.eclipse.ui.part.IPage; import org.eclipse.ui.part.IPageBookViewPage; import org.eclipse.ui.part.IShowInTarget; import org.eclipse.ui.part.Page; import org.eclipse.ui.part.PageBook; import org.eclipse.ui.part.PageSite; import org.eclipse.ui.part.PluginTransfer; import org.eclipse.ui.part.ResourceTransfer; import org.eclipse.ui.part.ShowInContext; import org.eclipse.ui.part.ViewPart; public class GenericHistoryView extends ViewPart implements IHistoryView, IPropertyChangeListener, IShowInTarget { private static final String HISTORY_VIEW_GROUP = "org.eclipse.team.ui.historyView"; private static final String NAVIGATION_GROUP = "org.eclipse.team.ui.navigation"; private static final int MAX_NAVIGATION_HISTORY_ENTRIES = 15; private PageBook book; private Action refreshAction; private Action linkWithEditorAction; private Action pinAction; private NavigationHistoryAction navigateAction; private PageContainer defaultPageContainer; PageContainer currentPageContainer; DropTarget dropTarget; GenericHistoryDropAdapter dropAdapter; static boolean sameSource(IHistoryPageSource source1, IHistoryPageSource source2) { return (source1 == source2) || ((source1 != null) && (source2 != null) && (source1.equals(source2))); } class PageContainer { private Page page; private SubActionBars subBars; private final IHistoryPageSource source; public PageContainer(Page page, IHistoryPageSource source) { this.page = page; this.source = source; } public Page getPage() { return page; } public void setPage(Page page) { this.page = page; } public SubActionBars getSubBars() { return subBars; } public void setSubBars(SubActionBars subBars) { this.subBars = subBars; } public IHistoryPageSource getSource() { return source; } public boolean matches(Object object, IHistoryPageSource pageSource) { if ((page instanceof IHistoryPage)) { Object input = ((IHistoryPage)page).getInput(); if (input != null) { return (input.equals(object)) && (GenericHistoryView.sameSource(GenericHistoryView.this.getPageSourceFor(object, pageSource), GenericHistoryView.this.getPageSourceFor(input, source))); } } return false; } public boolean canShow(Object object, IHistoryPageSource pageSource) { if (((page instanceof IHistoryPage)) && (GenericHistoryView.sameSource(GenericHistoryView.this.getPageSourceFor(object, pageSource), GenericHistoryView.this.getPageSourceFor(((IHistoryPage)page).getInput(), source)))) { return ((IHistoryPage)page).isValidInput(object); } return false; } } class NavigationHistory { List history = new ArrayList(); int position; private boolean navigating; NavigationHistory() {} public int size() { return history.size(); } public void gotoPreviousEntry() { if (position > 0) { position -= 1; gotoEntry(); } else { position = (history.size() - 1); gotoEntry(); } } /* Error */ private void gotoEntry() { // Byte code: // 0: aload_0 // 1: iconst_1 // 2: putfield 113 org/eclipse/team/internal/ui/history/GenericHistoryView$NavigationHistory:navigating Z // 5: aload_0 // 6: invokespecial 125 org/eclipse/team/internal/ui/history/GenericHistoryView$NavigationHistory:getCurrentEntry ()Lorg/eclipse/team/internal/ui/history/GenericHistoryView$NavigationHistoryEntry; // 9: astore_1 // 10: aload_0 // 11: getfield 115 org/eclipse/team/internal/ui/history/GenericHistoryView$NavigationHistory:this$0 Lorg/eclipse/team/internal/ui/history/GenericHistoryView; // 14: aload_1 // 15: getfield 116 org/eclipse/team/internal/ui/history/GenericHistoryView$NavigationHistoryEntry:object Ljava/lang/Object; // 18: iconst_1 // 19: iconst_1 // 20: aload_1 // 21: getfield 118 org/eclipse/team/internal/ui/history/GenericHistoryView$NavigationHistoryEntry:source Lorg/eclipse/team/ui/history/IHistoryPageSource; // 24: invokevirtual 122 org/eclipse/team/internal/ui/history/GenericHistoryView:showHistoryPageFor (Ljava/lang/Object;ZZLorg/eclipse/team/ui/history/IHistoryPageSource;)Lorg/eclipse/team/ui/history/IHistoryPage; // 27: pop // 28: goto +11 -> 39 // 31: astore_2 // 32: aload_0 // 33: iconst_0 // 34: putfield 113 org/eclipse/team/internal/ui/history/GenericHistoryView$NavigationHistory:navigating Z // 37: aload_2 // 38: athrow // 39: aload_0 // 40: iconst_0 // 41: putfield 113 org/eclipse/team/internal/ui/history/GenericHistoryView$NavigationHistory:navigating Z // 44: return // Line number table: // Java source line #119 -> byte code offset #0 // Java source line #120 -> byte code offset #5 // Java source line #121 -> byte code offset #10 // Java source line #122 -> byte code offset #31 // Java source line #123 -> byte code offset #32 // Java source line #124 -> byte code offset #37 // Java source line #123 -> byte code offset #39 // Java source line #125 -> byte code offset #44 // Local variable table: // start length slot name signature // 0 45 0 this NavigationHistory // 9 12 1 currentEntry GenericHistoryView.NavigationHistoryEntry // 31 7 2 localObject Object // Exception table: // from to target type // 0 31 31 finally } private GenericHistoryView.NavigationHistoryEntry getCurrentEntry() { return (GenericHistoryView.NavigationHistoryEntry)history.get(position); } public void addEntry(Object object, String name, IHistoryPageSource source) { if (!navigating) { GenericHistoryView.NavigationHistoryEntry navigationHistoryEntry = new GenericHistoryView.NavigationHistoryEntry(object, name, source); if (history.contains(navigationHistoryEntry)) { history.remove(navigationHistoryEntry); } history.add(navigationHistoryEntry); if (history.size() > 15) { history.remove(0); } position = (history.size() - 1); } navigateAction.update(); } public GenericHistoryView.NavigationHistoryEntry[] getEntries() { return (GenericHistoryView.NavigationHistoryEntry[])history.toArray(new GenericHistoryView.NavigationHistoryEntry[history.size()]); } private GenericHistoryView.NavigationHistoryEntry getEntry(int i) { return (GenericHistoryView.NavigationHistoryEntry)history.get(i); } public void gotoEntry(GenericHistoryView.NavigationHistoryEntry navigationHistoryEntry) { position = history.indexOf(navigationHistoryEntry); gotoEntry(); } public GenericHistoryView.NavigationHistoryEntry getPreviousEntry() { int next = position - 1; if (next < 0) { next = size() - 1; } return getEntry(next); } public void updateName(IHistoryPage historyPage, IHistoryPageSource pageSource) { GenericHistoryView.NavigationHistoryEntry[] historyEntries = getEntries(); for (int i = 0; i < historyEntries.length; i++) { GenericHistoryView.NavigationHistoryEntry historyEntry = historyEntries[i]; if (historyEntry.matches(historyPage, pageSource)) { name = historyPage.getName(); } } navigateAction.update(); } } static class NavigationHistoryEntry { Object object; String name; IHistoryPageSource source; public NavigationHistoryEntry(Object object, String name, IHistoryPageSource source) { this.object = object; this.name = name; this.source = source; } public boolean equals(Object obj) { if ((obj instanceof NavigationHistoryEntry)) { NavigationHistoryEntry other = (NavigationHistoryEntry)obj; return (object.equals(object)) && (GenericHistoryView.sameSource(source, source)); } return false; } public boolean matches(IHistoryPage historyPage, IHistoryPageSource pageSource) { return (object.equals(historyPage.getInput())) && (GenericHistoryView.sameSource(source, pageSource)); } public int hashCode() { return object.hashCode(); } } abstract class MenuCreator implements IMenuCreator { private MenuManager menuManager; MenuCreator() {} public void dispose() { if (menuManager != null) { menuManager.dispose(); menuManager = null; } } public Menu getMenu(Control parent) { Menu fMenu = null; if (menuManager == null) { menuManager = new MenuManager(); fMenu = menuManager.createContextMenu(parent); IAction[] actions = getDropDownActions(); for (int i = actions.length - 1; i >= 0; i--) { IAction action = actions[i]; menuManager.add(action); } updateMenuState(); } else { fMenu = menuManager.getMenu(); } return fMenu; } protected void updateMenuState() { if (menuManager != null) { menuManager.update(true); } } protected abstract IAction[] getDropDownActions(); public Menu getMenu(Menu parent) { return null; } public void rebuildMenu() { if (menuManager != null) { menuManager.dispose(); menuManager = null; } } } class NavigationHistoryAction extends Action { private GenericHistoryView.MenuCreator menuCreator; private IAction[] actions; public NavigationHistoryAction() { menuCreator = new GenericHistoryView.4(this, GenericHistoryView.this); setMenuCreator(menuCreator); update(); } private IAction[] createActions() { GenericHistoryView.NavigationHistoryEntry[] entries = getDropDownEntries(); List actions = new ArrayList(); for (int i = 0; i < entries.length; i++) { GenericHistoryView.NavigationHistoryEntry navigationHistoryEntry = entries[i]; actions.add(new GenericHistoryView.NavigationHistoryEntryAction(GenericHistoryView.this, navigationHistoryEntry)); } return (IAction[])actions.toArray(new IAction[actions.size()]); } protected GenericHistoryView.NavigationHistoryEntry[] getDropDownEntries() { return navigationHistory.getEntries(); } public void run() { navigationHistory.gotoPreviousEntry(); updateCheckState(); } public void update() { setEnabled(navigationHistory.size() > 1); if (isEnabled()) { setToolTipText(NLS.bind(TeamUIMessages.GenericHistoryView_1, navigationHistory.getPreviousEntry().name)); } else { setToolTipText(TeamUIMessages.GenericHistoryView_2); } actions = null; menuCreator.rebuildMenu(); updateCheckState(); } private void updateCheckState() { IAction[] actions = getActions(); for (int i = 0; i < actions.length; i++) { IAction action = actions[i]; if ((action instanceof GenericHistoryView.NavigationHistoryEntryAction)) { GenericHistoryView.NavigationHistoryEntryAction a = (GenericHistoryView.NavigationHistoryEntryAction)action; a.update(); } } menuCreator.updateMenuState(); } public void dispose() { menuCreator.dispose(); } private IAction[] getActions() { if (actions == null) { actions = createActions(); } return actions; } } class NavigationHistoryEntryAction extends Action { private final GenericHistoryView.NavigationHistoryEntry navigationHistoryEntry; public NavigationHistoryEntryAction(GenericHistoryView.NavigationHistoryEntry navigationHistoryEntry) { super(); this.navigationHistoryEntry = navigationHistoryEntry; } public void run() { navigationHistory.gotoEntry(navigationHistoryEntry); navigateAction.updateCheckState(); } public void update() { setChecked(navigationHistory.getCurrentEntry() == navigationHistoryEntry); } } NavigationHistory navigationHistory = new NavigationHistory(); private Object lastSelectedElement; private IPartListener partListener = new IPartListener() { public void partActivated(IWorkbenchPart part) { if ((part instanceof IEditorPart)) { editorActivated((IEditorPart)part); } } public void partBroughtToTop(IWorkbenchPart part) { if (part == GenericHistoryView.this) { editorActivated(getViewSite().getPage().getActiveEditor()); } } public void partOpened(IWorkbenchPart part) { if (part == GenericHistoryView.this) { editorActivated(getViewSite().getPage().getActiveEditor()); } } public void partClosed(IWorkbenchPart part) {} public void partDeactivated(IWorkbenchPart part) {} }; private IPartListener2 partListener2 = new IPartListener2() { public void partActivated(IWorkbenchPartReference ref) {} public void partBroughtToTop(IWorkbenchPartReference ref) {} public void partClosed(IWorkbenchPartReference ref) {} public void partDeactivated(IWorkbenchPartReference ref) {} public void partOpened(IWorkbenchPartReference ref) {} public void partHidden(IWorkbenchPartReference ref) {} public void partVisible(IWorkbenchPartReference ref) { if (ref.getPart(true) == GenericHistoryView.this) { editorActivated(getViewSite().getPage().getActiveEditor()); } } public void partInputChanged(IWorkbenchPartReference ref) {} }; private ISelectionListener selectionListener = new ISelectionListener() { public void selectionChanged(IWorkbenchPart part, ISelection selection) { if ((selection instanceof IStructuredSelection)) { IStructuredSelection structSelection = (IStructuredSelection)selection; lastSelectedElement = structSelection.getFirstElement(); if ((!isLinkingEnabled()) || (!GenericHistoryView.this.checkIfPageIsVisible())) { return; } if (lastSelectedElement != null) { Object resource; Object resource; if ((lastSelectedElement instanceof SyncInfoModelElement)) { SyncInfoModelElement syncInfoModelElement = (SyncInfoModelElement)lastSelectedElement; resource = syncInfoModelElement.getSyncInfo().getLocal(); } else { Class tmp104_101 = GenericHistoryView.class$0; if (tmp104_101 == null) { tmp104_101; try { tmpTernaryOp = (GenericHistoryView.class$0 = Class.forName("org.eclipse.core.resources.IResource")); } catch (ClassNotFoundException localClassNotFoundException) { throw new NoClassDefFoundError(localClassNotFoundException.getMessage()); } } resource = Utils.getAdapter(lastSelectedElement, tmp104_101); } if (resource != null) { GenericHistoryView.this.showHistory((IResource)resource); } else { GenericHistoryView.this.showHistory(lastSelectedElement); } lastSelectedElement = null; } } } }; private boolean linkingEnabled; private boolean viewPinned; void refreshGlobalActionHandlers() { IActionBars bars = getViewSite().getActionBars(); bars.clearGlobalActionHandlers(); Map newActionHandlers = currentPageContainer.getSubBars().getGlobalActionHandlers(); if (newActionHandlers != null) { Set keys = newActionHandlers.entrySet(); Iterator iter = keys.iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry)iter.next(); bars.setGlobalActionHandler((String)entry.getKey(), (IAction)entry.getValue()); } } bars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction); } public void createPartControl(Composite parent) { book = new PageBook(parent, 0); linkingEnabled = TeamUIPlugin.getPlugin().getPreferenceStore().getBoolean("pref_generichistory_view_linking"); defaultPageContainer = createDefaultPage(book); configureToolbars(getViewSite().getActionBars()); getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction); initDragAndDrop(); showPageRec(defaultPageContainer); getSite().getPage().addPartListener(partListener); getSite().getPage().addPartListener(partListener2); getSite().getPage().addPostSelectionListener(selectionListener); } private void configureToolbars(IActionBars actionBars) { pinAction = new Action(TeamUIMessages.GenericHistoryView_PinCurrentHistory, TeamUIPlugin.getImageDescriptor("elcl16/pin.gif")) { public void run() { if (isChecked()) { linkWithEditorAction.setChecked(false); setLinkingEnabled(false); } setViewPinned(isChecked()); } }; pinAction.setChecked(isViewPinned()); pinAction.setToolTipText(TeamUIMessages.GenericHistoryView_0); refreshAction = new Action(TeamUIMessages.GenericHistoryView_Refresh, TeamUIPlugin.getImageDescriptor("elcl16/refresh.gif")) { public void run() { ((IHistoryPage)currentPageContainer.getPage()).refresh(); } }; refreshAction.setToolTipText(TeamUIMessages.GenericHistoryView_RefreshTooltip); refreshAction.setEnabled(true); linkWithEditorAction = new Action(TeamUIMessages.GenericHistoryView_LinkWithEditor, TeamUIPlugin.getImageDescriptor("elcl16/synced.gif")) { public void run() { if (isChecked()) { pinAction.setChecked(false); setViewPinned(false); } setLinkingEnabled(isViewPinned() ? false : isChecked()); } }; linkWithEditorAction.setChecked(isLinkingEnabled()); linkWithEditorAction.setToolTipText(TeamUIMessages.GenericHistoryView_LinkWithTooltip); navigateAction = new NavigationHistoryAction(); Utils.initAction(navigateAction, "action.previousHistory."); IToolBarManager tbm = actionBars.getToolBarManager(); tbm.add(new Separator("org.eclipse.team.ui.historyView")); tbm.appendToGroup("org.eclipse.team.ui.historyView", refreshAction); tbm.appendToGroup("org.eclipse.team.ui.historyView", linkWithEditorAction); tbm.appendToGroup("org.eclipse.team.ui.historyView", pinAction); tbm.add(new Separator("org.eclipse.team.ui.navigation")); tbm.appendToGroup("org.eclipse.team.ui.navigation", navigateAction); tbm.update(false); } boolean isLinkingEnabled() { return linkingEnabled; } public void setLinkingEnabled(boolean enabled) { linkingEnabled = enabled; TeamUIPlugin.getPlugin().getPreferenceStore().setValue("pref_generichistory_view_linking", enabled); if (enabled) { editorActivated(getSite().getPage().getActiveEditor()); } } void setViewPinned(boolean pinned) { viewPinned = pinned; } void initDragAndDrop() { int ops = 7; Transfer[] transfers = { ResourceTransfer.getInstance(), PluginTransfer.getInstance() }; dropTarget = new DropTarget(book, ops); dropTarget.setTransfer(transfers); dropAdapter = new GenericHistoryDropAdapter(this); dropTarget.addDropListener(dropAdapter); } public void setFocus() { if ((isLinkingEnabled()) && (lastSelectedElement != null)) { if ((lastSelectedElement instanceof IEditorPart)) { editorActivated((IEditorPart)lastSelectedElement); } else { Object resource = Utils.getAdapter(lastSelectedElement, IResource.class); if (resource != null) { showHistoryPageFor((IResource)resource, false, false, null); } else { showHistoryPageFor(lastSelectedElement, false, false, null); } } lastSelectedElement = null; } if ((currentPageContainer.page instanceof IPage)) { currentPageContainer.page.setFocus(); } } protected void showPageRec(PageContainer pageContainer) { if (currentPageContainer == pageContainer) { addNavigationHistoryEntry(); return; } if (currentPageContainer != null) { currentPageContainer.getSubBars().deactivate(); ((IHistoryPage)currentPageContainer.getPage()).removePropertyChangeListener(this); currentPageContainer.getPage().dispose(); currentPageContainer.getSubBars().dispose(); } currentPageContainer = pageContainer; Control pageControl = currentPageContainer.getPage().getControl(); if ((pageControl != null) && (!pageControl.isDisposed())) { book.showPage(pageControl); ((IHistoryPage)currentPageContainer.getPage()).addPropertyChangeListener(this); currentPageContainer.getSubBars().activate(); refreshGlobalActionHandlers(); getViewSite().getActionBars().updateActionBars(); addNavigationHistoryEntry(); } } private void addNavigationHistoryEntry() { if (currentPageContainer != null) { Object input = ((IHistoryPage)currentPageContainer.getPage()).getInput(); if (input != null) { navigationHistory.addEntry(input, ((IHistoryPage)currentPageContainer.getPage()).getNa Further reading...For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.New!JAR listings
|