use of org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog in project subclipse by subclipse.
the class SVNHistoryPage method getSwitchAction.
// get switch action (context menu)
private IAction getSwitchAction() {
if (switchAction == null) {
switchAction = new Action() {
public void run() {
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
if (ss.size() == 1) {
ILogEntry currentSelection = getLogEntry(ss);
IResource[] resources = { resource };
SvnWizardSwitchPage switchPage = new SvnWizardSwitchPage(resources, currentSelection.getRevision().getNumber());
SvnWizard wizard = new SvnWizard(switchPage);
SvnWizardDialog dialog = new SvnWizardDialog(getSite().getShell(), wizard);
wizard.setParentDialog(dialog);
if (dialog.open() == SvnWizardDialog.OK) {
SVNUrl[] svnUrls = switchPage.getUrls();
SVNRevision svnRevision = switchPage.getRevision();
SwitchOperation switchOperation = new SwitchOperation(getSite().getPage().getActivePart(), resources, svnUrls, svnRevision);
switchOperation.setDepth(switchPage.getDepth());
switchOperation.setSetDepth(switchPage.isSetDepth());
switchOperation.setIgnoreExternals(switchPage.isIgnoreExternals());
switchOperation.setForce(switchPage.isForce());
switchOperation.setIgnoreAncestry(switchPage.isIgnoreAncestry());
switchOperation.setConflictResolver(switchPage.getConflictResolver());
try {
switchOperation.run();
} catch (Exception e) {
MessageDialog.openError(getSite().getShell(), switchAction.getText(), e.getMessage());
}
}
}
}
}
};
}
ISelection selection = getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
if (ss.size() == 1) {
ILogEntry currentSelection = getLogEntry(ss);
switchAction.setText(Policy.bind("HistoryView.switchToRevision", // $NON-NLS-1$ //$NON-NLS-2$
"" + currentSelection.getRevision().getNumber()));
}
}
switchAction.setImageDescriptor(SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_MENU_SWITCH));
return switchAction;
}
use of org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog in project subclipse by subclipse.
the class CommitSynchronizeOperation method confirmCommit.
private boolean confirmCommit(SyncInfoSet set) {
commit = false;
IResource[] modified = set.getResources();
List conflictFiles = new ArrayList();
List filteredModified = new ArrayList();
boolean switched = false;
for (int i = 0; i < modified.length; i++) {
IResource resource = modified[i];
filteredModified.add(resource);
if (!(resource instanceof IContainer)) {
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
try {
if (svnResource.isManaged() && svnResource.getStatus().isTextConflicted()) {
IFile conflictNewFile = (IFile) File2Resource.getResource(svnResource.getStatus().getConflictNew());
if (conflictNewFile != null)
conflictFiles.add(conflictNewFile);
IFile conflictOldFile = (IFile) File2Resource.getResource(svnResource.getStatus().getConflictOld());
if (conflictOldFile != null)
conflictFiles.add(conflictOldFile);
IFile conflictWorkingFile = (IFile) File2Resource.getResource(svnResource.getStatus().getConflictWorking());
if (conflictWorkingFile != null)
conflictFiles.add(conflictWorkingFile);
}
if (svnResource.getStatus().isSwitched()) {
url = svnResource.getStatus().getUrlString();
switched = true;
}
} catch (SVNException e) {
}
}
}
if (switched && modified.length > 1) {
url = null;
}
if (conflictFiles.size() > 0) {
Iterator iter = conflictFiles.iterator();
while (iter.hasNext()) {
IFile conflictFile = (IFile) iter.next();
filteredModified.remove(conflictFile);
}
modified = new IResource[filteredModified.size()];
filteredModified.toArray(modified);
}
if (modified.length > 0) {
try {
IPreferenceStore preferenceStore = SVNUIPlugin.getPlugin().getPreferenceStore();
boolean commitToTagsPathWithoutWarning = preferenceStore.getBoolean(ISVNUIConstants.PREF_COMMIT_TO_TAGS_PATH_WITHOUT_WARNING);
if (!commitToTagsPathWithoutWarning && onTagPath(modified)) {
commit = true;
getShell().getDisplay().syncExec(new Runnable() {
public void run() {
CommitToTagsWarningDialog dialog = new CommitToTagsWarningDialog(getShell());
commit = dialog.open() == CommitToTagsWarningDialog.OK;
}
});
if (!commit) {
return false;
}
}
ProjectProperties projectProperties = ProjectProperties.getProjectProperties(modified[0]);
SvnWizardCommitPage commitPage = new SvnWizardCommitPage(modified, url, projectProperties, new HashMap(), changeSet, true);
if (proposedComment == null || proposedComment.length() == 0)
commitPage.setComment(getProposedComment(modified));
else
commitPage.setComment(proposedComment);
commitPage.setSyncInfoSet(set);
SvnWizard wizard = new SvnWizard(commitPage);
final SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
wizard.setParentDialog(dialog);
getShell().getDisplay().syncExec(new Runnable() {
public void run() {
commit = (dialog.open() == SvnWizardDialog.OK);
}
});
if (commit) {
resourcesToCommit = commitPage.getSelectedResources();
keepLocks = commitPage.isKeepLocks();
}
commitComment = commitPage.getComment();
} catch (SVNException e) {
if (!e.operationInterrupted()) {
SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
}
}
}
return commit;
}
use of org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog in project subclipse by subclipse.
the class SvnPropertiesView method getAddPropertyAction.
private Action getAddPropertyAction() {
if (addPropertyAction == null) {
SVNUIPlugin plugin = SVNUIPlugin.getPlugin();
addPropertyAction = new Action(Policy.bind("SvnPropertiesView.addPropertyLabel"), // $NON-NLS-1$
plugin.getImageDescriptor(ISVNUIConstants.IMG_MENU_PROPSET)) {
public void run() {
SvnWizardSetPropertyPage setPropertyPage = new SvnWizardSetPropertyPage(resource);
SvnWizard wizard = new SvnWizard(setPropertyPage);
SvnWizardDialog dialog = new SvnWizardDialog(getSite().getShell(), wizard);
wizard.setParentDialog(dialog);
if (dialog.open() != SvnWizardDialog.OK)
return;
try {
if (setPropertyPage.getPropertyValue() != null) {
resource.setSvnProperty(setPropertyPage.getPropertyName(), setPropertyPage.getPropertyValue(), setPropertyPage.getRecurse());
} else {
resource.setSvnProperty(setPropertyPage.getPropertyName(), setPropertyPage.getPropertyFile(), setPropertyPage.getRecurse());
}
refresh();
} catch (SVNException e) {
if (!e.operationInterrupted()) {
SVNUIPlugin.openError(getSite().getShell(), // $NON-NLS-1$
Policy.bind("SvnPropertiesView.errorAddTitle"), // $NON-NLS-1$
Policy.bind("SvnPropertiesView.errorAddMessage"), e);
}
}
}
};
addPropertyAction.setToolTipText(// $NON-NLS-1$
Policy.bind("SvnPropertiesView.addPropertyTooltip"));
}
return addPropertyAction;
}
use of org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog in project subclipse by subclipse.
the class RevertSynchronizeOperation method run.
protected void run(SVNTeamProvider provider, SyncInfoSet set, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
if (prompted)
return;
prompted = true;
getShell().getDisplay().syncExec(new Runnable() {
public void run() {
if (resources == null || resources.length == 0) {
revert = false;
return;
}
revertPage = new SvnWizardRevertPage(resources, url, statusMap, true);
revertPage.setResourceRemoved(SVNProviderPlugin.getPlugin().getPluginPreferences().getBoolean(ISVNCoreConstants.PREF_IGNORE_HIDDEN_CHANGES));
SvnWizard wizard = new SvnWizard(revertPage);
SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
revert = (dialog.open() == SvnWizardDialog.OK);
if (revert)
resourcesToRevert = revertPage.getSelectedResources();
}
});
if (revert) {
boolean includesExternals = false;
if (revertPage != null && !revertPage.isResourceRemoved()) {
for (IResource resource : resourcesToRevert) {
if (isExternal(resource)) {
includesExternals = true;
break;
}
}
}
RevertOperation revertOperation = null;
if (revertPage != null && !revertPage.isResourceRemoved() && !includesExternals) {
revertOperation = new RevertOperation(getPart(), selectedResources);
revertOperation.setRecurse(true);
revertOperation.setResourcesToRevert(resourcesToRevert);
} else {
revertOperation = new RevertOperation(getPart(), resourcesToRevert);
}
revertOperation.run();
}
}
use of org.tigris.subversion.subclipse.ui.wizards.dialogs.SvnWizardDialog in project subclipse by subclipse.
the class SVNFileModificationValidatorPrompt method prompt.
public boolean prompt(IFile[] lockFiles, Object context) {
if (context == null) {
comment = "";
stealLock = false;
return true;
}
this.files = lockFiles;
success = false;
SVNUIPlugin.getStandardDisplay().syncExec(new Runnable() {
public void run() {
SvnWizardLockPage lockPage = new SvnWizardLockPage(files);
SvnWizard wizard = new SvnWizard(lockPage);
SvnWizardDialog dialog = new SvnWizardDialog(Display.getCurrent().getActiveShell(), wizard);
wizard.setParentDialog(dialog);
if (dialog.open() == SvnWizardDialog.OK) {
success = true;
comment = lockPage.getComment();
stealLock = lockPage.isStealLock();
}
}
});
return success;
}
Aggregations