Lines 1-5
Link Here
|
1 |
/******************************************************************************* |
1 |
/******************************************************************************* |
2 |
* Copyright (c) 2006, 2007 IBM Corporation and others. |
2 |
* Copyright (c) 2006, 2008 IBM Corporation and others. |
3 |
* All rights reserved. This program and the accompanying materials |
3 |
* All rights reserved. This program and the accompanying materials |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
5 |
* which accompanies this distribution, and is available at |
5 |
* which accompanies this distribution, and is available at |
Lines 17-22
Link Here
|
17 |
import org.eclipse.core.resources.IFile; |
17 |
import org.eclipse.core.resources.IFile; |
18 |
import org.eclipse.core.resources.IResource; |
18 |
import org.eclipse.core.resources.IResource; |
19 |
import org.eclipse.jface.action.*; |
19 |
import org.eclipse.jface.action.*; |
|
|
20 |
import org.eclipse.jface.commands.ActionHandler; |
21 |
import org.eclipse.jface.resource.ImageDescriptor; |
20 |
import org.eclipse.jface.util.IPropertyChangeListener; |
22 |
import org.eclipse.jface.util.IPropertyChangeListener; |
21 |
import org.eclipse.jface.util.PropertyChangeEvent; |
23 |
import org.eclipse.jface.util.PropertyChangeEvent; |
22 |
import org.eclipse.jface.viewers.ISelection; |
24 |
import org.eclipse.jface.viewers.ISelection; |
Lines 32-37
Link Here
|
32 |
import org.eclipse.team.ui.history.*; |
34 |
import org.eclipse.team.ui.history.*; |
33 |
import org.eclipse.ui.*; |
35 |
import org.eclipse.ui.*; |
34 |
import org.eclipse.ui.actions.ActionFactory; |
36 |
import org.eclipse.ui.actions.ActionFactory; |
|
|
37 |
import org.eclipse.ui.handlers.IHandlerService; |
35 |
import org.eclipse.ui.ide.ResourceUtil; |
38 |
import org.eclipse.ui.ide.ResourceUtil; |
36 |
import org.eclipse.ui.part.*; |
39 |
import org.eclipse.ui.part.*; |
37 |
|
40 |
|
Lines 477-486
Link Here
|
477 |
defaultPageContainer = createDefaultPage(book); |
480 |
defaultPageContainer = createDefaultPage(book); |
478 |
|
481 |
|
479 |
//Contribute toolbars |
482 |
//Contribute toolbars |
480 |
configureToolbars(getViewSite().getActionBars()); |
483 |
IActionBars actionBars= getViewSite().getActionBars(); |
|
|
484 |
configureToolbars(actionBars); |
481 |
|
485 |
|
482 |
//add global action handler |
486 |
//add global action handler |
483 |
getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction); |
487 |
actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction); |
|
|
488 |
IHandlerService handlerService= (IHandlerService) getViewSite().getService(IHandlerService.class); |
489 |
handlerService.activateHandler("org.eclipse.ui.navigate.linkWithEditor", new ActionHandler(linkWithEditorAction)); //$NON-NLS-1$ |
490 |
|
491 |
//initialize the page switcher |
492 |
initPageSwitcher(); |
484 |
|
493 |
|
485 |
//initialize the drag and drop |
494 |
//initialize the drag and drop |
486 |
initDragAndDrop(); |
495 |
initDragAndDrop(); |
Lines 519-525
Link Here
|
519 |
}; |
528 |
}; |
520 |
refreshAction.setToolTipText(TeamUIMessages.GenericHistoryView_RefreshTooltip); |
529 |
refreshAction.setToolTipText(TeamUIMessages.GenericHistoryView_RefreshTooltip); |
521 |
refreshAction.setEnabled(true); |
530 |
refreshAction.setEnabled(true); |
522 |
|
531 |
refreshAction.setActionDefinitionId("org.eclipse.ui.file.refresh"); //$NON-NLS-1$ |
523 |
|
532 |
|
524 |
linkWithEditorAction = new Action(TeamUIMessages.GenericHistoryView_LinkWithEditor, TeamUIPlugin.getImageDescriptor(ITeamUIImages.IMG_LINK_WITH)) { |
533 |
linkWithEditorAction = new Action(TeamUIMessages.GenericHistoryView_LinkWithEditor, TeamUIPlugin.getImageDescriptor(ITeamUIImages.IMG_LINK_WITH)) { |
525 |
public void run() { |
534 |
public void run() { |
Lines 533-538
Link Here
|
533 |
}; |
542 |
}; |
534 |
linkWithEditorAction.setChecked(isLinkingEnabled()); |
543 |
linkWithEditorAction.setChecked(isLinkingEnabled()); |
535 |
linkWithEditorAction.setToolTipText(TeamUIMessages.GenericHistoryView_LinkWithTooltip); |
544 |
linkWithEditorAction.setToolTipText(TeamUIMessages.GenericHistoryView_LinkWithTooltip); |
|
|
545 |
linkWithEditorAction.setActionDefinitionId("org.eclipse.ui.navigate.linkWithEditor"); //$NON-NLS-1$ |
536 |
|
546 |
|
537 |
navigateAction = new NavigationHistoryAction(); |
547 |
navigateAction = new NavigationHistoryAction(); |
538 |
Utils.initAction(navigateAction, "action.previousHistory."); //$NON-NLS-1$ |
548 |
Utils.initAction(navigateAction, "action.previousHistory."); //$NON-NLS-1$ |
Lines 589-594
Link Here
|
589 |
dropTarget.addDropListener(dropAdapter); |
599 |
dropTarget.addDropListener(dropAdapter); |
590 |
} |
600 |
} |
591 |
|
601 |
|
|
|
602 |
/** |
603 |
* Adds the page switcher to the history view. |
604 |
*/ |
605 |
void initPageSwitcher() { |
606 |
new PageSwitcher(this) { |
607 |
public void activatePage(Object page) { |
608 |
navigationHistory.gotoEntry((NavigationHistoryEntry) page); |
609 |
navigateAction.updateCheckState(); |
610 |
} |
611 |
|
612 |
public ImageDescriptor getImageDescriptor(Object page) { |
613 |
return null; |
614 |
} |
615 |
|
616 |
public String getName(Object page) { |
617 |
return ((NavigationHistoryEntry) page).name; |
618 |
} |
619 |
|
620 |
public Object[] getPages() { |
621 |
NavigationHistoryEntry[] entries= navigationHistory.getEntries(); |
622 |
Collections.reverse(Arrays.asList(entries)); |
623 |
return entries; |
624 |
} |
625 |
|
626 |
public int getCurrentPageIndex() { |
627 |
return navigationHistory.history.size() - 1 - navigationHistory.position; |
628 |
} |
629 |
}; |
630 |
} |
631 |
|
592 |
public void setFocus() { |
632 |
public void setFocus() { |
593 |
if (isLinkingEnabled()){ |
633 |
if (isLinkingEnabled()){ |
594 |
if (lastSelectedElement != null){ |
634 |
if (lastSelectedElement != null){ |