use of org.tigris.subversion.subclipse.ui.actions.OpenRemoteFileAction in project subclipse by subclipse.
the class RepositoriesView method contributeActions.
/**
* Contribute actions to the view
*/
protected void contributeActions() {
final Shell shell = getShell();
// Create actions
// New Repository (popup)
newAction = new Action(// $NON-NLS-1$
Policy.bind("RepositoriesView.new"), SVNUIPlugin.getPlugin().getImageDescriptor(// $NON-NLS-1$
ISVNUIConstants.IMG_NEWLOCATION)) {
public void run() {
if (!WorkspacePathValidator.validateWorkspacePath())
return;
NewLocationWizard wizard = new NewLocationWizard();
WizardDialog dialog = new ClosableWizardDialog(shell, wizard);
dialog.open();
}
};
PlatformUI.getWorkbench().getHelpSystem().setHelp(newAction, IHelpContextIds.NEW_REPOSITORY_LOCATION_ACTION);
// Properties
propertiesAction = new PropertyDialogAction(new SameShellProvider(shell), getViewer());
getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), propertiesAction);
IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection();
if (selection.size() == 1 && selection.getFirstElement() instanceof ISVNRepositoryLocation) {
propertiesAction.setEnabled(true);
} else {
propertiesAction.setEnabled(false);
}
getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
IStructuredSelection ss = (IStructuredSelection) event.getSelection();
boolean enabled = ss.size() == 1 && ss.getFirstElement() instanceof ISVNRepositoryLocation;
propertiesAction.setEnabled(enabled);
}
});
// Remove Root
removeRootAction = new RemoveRootAction(treeViewer.getControl().getShell());
removeRootAction.selectionChanged((IStructuredSelection) null);
PlatformUI.getWorkbench().getHelpSystem().setHelp(removeRootAction, IHelpContextIds.REMOVE_REPOSITORY_LOCATION_ACTION);
IActionBars bars = getViewSite().getActionBars();
bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), removeRootAction);
// Refresh action (toolbar)
SVNUIPlugin plugin = SVNUIPlugin.getPlugin();
refreshAction = new Action(Policy.bind("RepositoriesView.refresh"), SVNUIPlugin.getPlugin().getImageDescriptor(// $NON-NLS-1$
ISVNUIConstants.IMG_REFRESH_ENABLED)) {
public void run() {
refreshViewer(null, true);
}
};
// $NON-NLS-1$
refreshAction.setToolTipText(Policy.bind("RepositoriesView.refreshTooltip"));
refreshAction.setDisabledImageDescriptor(plugin.getImageDescriptor(ISVNUIConstants.IMG_REFRESH_DISABLED));
refreshAction.setHoverImageDescriptor(plugin.getImageDescriptor(ISVNUIConstants.IMG_REFRESH));
getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction);
refreshPopupAction = new Action(Policy.bind("RepositoriesView.refreshPopup"), SVNUIPlugin.getPlugin().getImageDescriptor(// $NON-NLS-1$
ISVNUIConstants.IMG_REFRESH)) {
public void run() {
refreshViewerNode();
}
};
// Collapse action
collapseAllAction = new Action(Policy.bind("RepositoriesView.collapseAll"), SVNUIPlugin.getPlugin().getImageDescriptor(// $NON-NLS-1$
ISVNUIConstants.IMG_COLLAPSE_ALL_ENABLED)) {
public void run() {
collapseAll();
}
};
collapseAllAction.setToolTipText(// $NON-NLS-1$
Policy.bind("RepositoriesView.collapseAllTooltip"));
collapseAllAction.setHoverImageDescriptor(plugin.getImageDescriptor(ISVNUIConstants.IMG_COLLAPSE_ALL));
// Create the popup menu
MenuManager menuMgr = new MenuManager();
Tree tree = treeViewer.getTree();
Menu menu = menuMgr.createContextMenu(tree);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
addWorkbenchActions(manager);
}
});
menuMgr.setRemoveAllWhenShown(true);
tree.setMenu(menu);
getSite().registerContextMenu(menuMgr, treeViewer);
// Create the local tool bar
IToolBarManager tbm = bars.getToolBarManager();
drillPart.addNavigationActions(tbm);
tbm.add(refreshAction);
tbm.add(new Separator());
tbm.add(collapseAllAction);
tbm.update(false);
// Create the open action for double clicks
openAction = new OpenRemoteFileAction();
bars.updateActionBars();
IActionBars actionBars = getViewSite().getActionBars();
IMenuManager actionBarsMenu = actionBars.getMenuManager();
Action newRepositoryAction = new // $NON-NLS-1$
Action(// $NON-NLS-1$
Policy.bind("RepositoriesView.newRepository")) {
public void run() {
SvnWizardNewRepositoryPage newRepositoryPage = new SvnWizardNewRepositoryPage();
SvnWizard wizard = new SvnWizard(newRepositoryPage);
SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
if (dialog.open() == SvnWizardDialog.OK)
refreshViewer(null, false);
}
};
actionBarsMenu.add(newRepositoryAction);
}
Aggregations