use of org.tigris.subversion.subclipse.ui.dialogs.CommitToTagsWarningDialog 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.dialogs.CommitToTagsWarningDialog in project subclipse by subclipse.
the class CommitAction method confirmCommit.
/**
* prompt commit of selected resources.
*
* @throws SVNException
*/
protected boolean confirmCommit(IResource[] modifiedResources, ProjectProperties projectProperties) throws SVNException {
IPreferenceStore preferenceStore = SVNUIPlugin.getPlugin().getPreferenceStore();
boolean commitToTagsPathWithoutWarning = preferenceStore.getBoolean(ISVNUIConstants.PREF_COMMIT_TO_TAGS_PATH_WITHOUT_WARNING);
if (!commitToTagsPathWithoutWarning && onTagPath(modifiedResources)) {
// Warning - working copy appears to be on a tag path.
CommitToTagsWarningDialog dialog = new CommitToTagsWarningDialog(getShell());
if (dialog.open() != CommitToTagsWarningDialog.OK) {
return false;
}
}
int highestProblemSeverity = getHighestProblemSeverity(modifiedResources);
switch(highestProblemSeverity) {
case IMarker.SEVERITY_WARNING:
String allowCommitsWithWarnings = preferenceStore.getString(ISVNUIConstants.PREF_ALLOW_COMMIT_WITH_WARNINGS);
if (MessageDialogWithToggle.PROMPT.equals(allowCommitsWithWarnings) || MessageDialogWithToggle.NEVER.equals(allowCommitsWithWarnings)) {
MessageDialogWithToggle warningDialog = MessageDialogWithToggle.openYesNoQuestion(shell, Policy.bind("CommitWizard.commitResources"), Policy.bind("CommitWizard.warningMarkers"), Policy.bind("CommitWizard.warningQuestion"), false, preferenceStore, ISVNUIConstants.PREF_ALLOW_COMMIT_WITH_WARNINGS);
if (IDialogConstants.YES_ID != warningDialog.getReturnCode()) {
return false;
}
}
break;
case IMarker.SEVERITY_ERROR:
String allowCommitsWithErrors = preferenceStore.getString(ISVNUIConstants.PREF_ALLOW_COMMIT_WITH_ERRORS);
if (MessageDialogWithToggle.PROMPT.equals(allowCommitsWithErrors) || MessageDialogWithToggle.NEVER.equals(allowCommitsWithErrors)) {
MessageDialogWithToggle errorDialog = MessageDialogWithToggle.openYesNoQuestion(shell, Policy.bind("CommitWizard.commitResources"), Policy.bind("CommitWizard.errorMarkers"), Policy.bind("CommitWizard.errorQuestion"), false, preferenceStore, ISVNUIConstants.PREF_ALLOW_COMMIT_WITH_ERRORS);
if (IDialogConstants.YES_ID != errorDialog.getReturnCode()) {
return false;
}
}
break;
}
SvnWizardCommitPage commitPage = new SvnWizardCommitPage(modifiedResources, url, projectProperties, statusMap, null, false);
// commitPage.setSharing(sharing);
SvnWizard wizard = new SvnWizard(commitPage);
SvnWizardDialog dialog = new SvnWizardDialog(getShell(), wizard);
if (proposedComment == null || proposedComment.length() == 0) {
commitPage.setComment(getProposedComment(modifiedResources));
} else {
commitPage.setComment(proposedComment);
}
wizard.setParentDialog(dialog);
boolean commitOK = (dialog.open() == SvnWizardDialog.OK);
url = null;
commitComment = commitPage.getComment();
resourcesToCommit = commitPage.getSelectedResources();
keepLocks = commitPage.isKeepLocks();
return commitOK;
}
Aggregations