use of org.tigris.subversion.subclipse.ui.actions.WorkspaceAction in project subclipse by subclipse.
the class SVNHistoryPage method getRevertChangesAction.
// get revert changes action (context menu)
private IAction getRevertChangesAction() {
revisionRanges = getRevisionRanges();
if (revertChangesAction == null) {
revertChangesAction = new Action() {
public void run() {
ISelection selection = getSelection();
if (!(selection instanceof IStructuredSelection))
return;
final IStructuredSelection ss = (IStructuredSelection) selection;
if (ss.size() == 1) {
if (!MessageDialog.openConfirm(getSite().getShell(), Policy.bind("HistoryView.revertRevision"), Policy.bind("HistoryView.confirmRevertRevision", // $NON-NLS-1$
resource.getFullPath().toString())))
return;
} else {
if (!MessageDialog.openConfirm(getSite().getShell(), Policy.bind("HistoryView.revertRevisions"), Policy.bind("HistoryView.confirmRevertRevisions", // $NON-NLS-1$
resource.getFullPath().toString())))
return;
}
BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
public void run() {
ILogEntry firstElement = getFirstElement();
ILogEntry lastElement = getLastElement();
final IResource[] resources = { resource };
try {
final SVNUrl path1 = new SVNUrl(firstElement.getResource().getUrl() + "@HEAD");
final SVNUrl path2 = new SVNUrl(lastElement.getResource().getUrl() + "@HEAD");
for (int i = 0; i < revisionRanges.length; i++) {
final SVNRevision revision1 = revisionRanges[i].getFromRevision();
final SVNRevision revision2 = new SVNRevision.Number(((SVNRevision.Number) revisionRanges[i].getToRevision()).getNumber() - 1);
WorkspaceAction mergeAction = new WorkspaceAction() {
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
new MergeOperation(getSite().getPage().getActivePart(), resources, path1, revision1, path2, revision2).run();
}
};
mergeAction.run(null);
}
} catch (Exception e) {
MessageDialog.openError(getSite().getShell(), revertChangesAction.getText(), e.getMessage());
}
}
});
}
};
}
ISelection selection = getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
if (ss.size() == 1) {
ILogEntry currentSelection = getLogEntry(ss);
revertChangesAction.setText(Policy.bind("HistoryView.revertChangesFromRevision", // $NON-NLS-1$ //$NON-NLS-2$
"" + currentSelection.getRevision().getNumber()));
}
if (ss.size() > 1) {
revertChangesAction.setText(// $NON-NLS-1$
Policy.bind("HistoryView.revertChangesFromRevisions"));
}
}
revertChangesAction.setImageDescriptor(SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_MENU_MARKMERGED));
revertChangesAction.setEnabled(revertEnabled);
return revertChangesAction;
}
use of org.tigris.subversion.subclipse.ui.actions.WorkspaceAction in project subclipse by subclipse.
the class SVNUIPlugin method getMergeProviders.
// Initialize the merge providers by searching the registry for users of the
// mergeProviders extension point.
public static WorkspaceAction[] getMergeProviders() throws Exception {
if (mergeProviders == null) {
ArrayList mergeProviderList = new ArrayList();
IExtensionRegistry extensionRegistry = Platform.getExtensionRegistry();
IConfigurationElement[] configurationElements = extensionRegistry.getConfigurationElementsFor(MERGE_PROVIDERS);
for (int i = 0; i < configurationElements.length; i++) {
IConfigurationElement configurationElement = configurationElements[i];
WorkspaceAction mergeProvider = (WorkspaceAction) // $NON-NLS-1$
configurationElement.createExecutableExtension("class");
// $NON-NLS-1$
mergeProvider.setName(configurationElement.getAttribute("name"));
mergeProviderList.add(mergeProvider);
}
mergeProviders = new WorkspaceAction[mergeProviderList.size()];
mergeProviderList.toArray(mergeProviders);
}
return mergeProviders;
}
Aggregations