use of org.tigris.subversion.subclipse.core.ISVNLocalResource in project subclipse by subclipse.
the class SVNHistoryPage method tagsPropertySet.
private boolean tagsPropertySet(IResource resource) {
if (resource == null)
return false;
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
try {
if (svnResource.isManaged()) {
ISVNProperty property = null;
// $NON-NLS-1$
property = svnResource.getSvnProperty("subclipse:tags");
if (property != null && property.getValue() != null)
return true;
}
} catch (SVNException e) {
}
IResource checkResource = resource;
while (checkResource.getParent() != null) {
checkResource = checkResource.getParent();
if (checkResource.getParent() == null)
return false;
svnResource = SVNWorkspaceRoot.getSVNResourceFor(checkResource);
try {
if (svnResource.isManaged()) {
ISVNProperty property = null;
// $NON-NLS-1$
property = svnResource.getSvnProperty("subclipse:tags");
if (property != null && property.getValue() != null)
return true;
}
} catch (SVNException e) {
}
}
return false;
}
use of org.tigris.subversion.subclipse.core.ISVNLocalResource in project subclipse by subclipse.
the class SVNHistoryPage method getGetContentsAction.
// get contents Action (context menu)
private IAction getGetContentsAction() {
if (getContentsAction == null) {
getContentsAction = getContextMenuAction(Policy.bind("HistoryView.getContentsAction"), new // $NON-NLS-1$
IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) throws CoreException {
ISelection selection = getSelection();
if (!(selection instanceof IStructuredSelection))
return;
IStructuredSelection ss = (IStructuredSelection) selection;
ISVNRemoteFile remoteFile = (ISVNRemoteFile) getLogEntry(ss).getRemoteResource();
monitor.beginTask(null, 100);
try {
if (remoteFile != null) {
if (confirmOverwrite()) {
if (remoteFile instanceof RemoteResource) {
if (resource != null) {
ISVNLocalResource localResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
((RemoteResource) remoteFile).setPegRevision(localResource.getRevision());
} else {
((RemoteResource) remoteFile).setPegRevision(SVNRevision.HEAD);
}
}
InputStream in = ((IResourceVariant) remoteFile).getStorage(new SubProgressMonitor(monitor, 50)).getContents();
IFile file = (IFile) resource;
file.setContents(in, false, true, new SubProgressMonitor(monitor, 50));
}
}
} catch (TeamException e) {
throw new CoreException(e.getStatus());
} finally {
monitor.done();
}
}
});
PlatformUI.getWorkbench().getHelpSystem().setHelp(getContentsAction, IHelpContextIds.GET_FILE_CONTENTS_ACTION);
}
return getContentsAction;
}
use of org.tigris.subversion.subclipse.core.ISVNLocalResource in project subclipse by subclipse.
the class CommitSynchronizeAction method getSubscriberOperation.
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSubscriberOperation(org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration, org.eclipse.compare.structuremergeviewer.IDiffElement[])
*/
protected SynchronizeModelOperation getSubscriberOperation(ISynchronizePageConfiguration configuration, IDiffElement[] elements) {
changeSets = new ArrayList();
// override the elemenents (this has to be done this way because of final methods in eclipse
// api)
elements = getFilteredDiffElementsOverride();
String url = null;
ChangeSet changeSet = null;
IStructuredSelection selection = getStructuredSelection();
Iterator iter = selection.iterator();
String proposedComment = "";
while (iter.hasNext()) {
ISynchronizeModelElement synchronizeModelElement = (ISynchronizeModelElement) iter.next();
proposedComment = getProposedComment(proposedComment, synchronizeModelElement);
if (!(synchronizeModelElement instanceof ChangeSetDiffNode)) {
if (url == null && selection.size() == 1) {
IResource resource = synchronizeModelElement.getResource();
if (resource != null) {
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
try {
url = svnResource.getStatus().getUrlString();
if ((url == null) || (resource.getType() == IResource.FILE))
url = Util.getParentUrl(svnResource);
} catch (SVNException e) {
if (!e.operationInterrupted()) {
SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e);
}
}
}
}
} else {
if (selection.size() == 1) {
ChangeSetDiffNode changeSetDiffNode = (ChangeSetDiffNode) synchronizeModelElement;
changeSet = changeSetDiffNode.getSet();
}
}
}
CommitSynchronizeOperation operation = new CommitSynchronizeOperation(configuration, elements, url, proposedComment);
operation.setChangeSet(changeSet);
return operation;
}
use of org.tigris.subversion.subclipse.core.ISVNLocalResource 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.core.ISVNLocalResource in project subclipse by subclipse.
the class EditConflictsSynchronizeAction method getSyncInfoFilter.
/* (non-Javadoc)
* @see org.eclipse.team.ui.synchronize.SynchronizeModelAction#getSyncInfoFilter()
*/
protected FastSyncInfoFilter getSyncInfoFilter() {
return new FastSyncInfoFilter() {
public boolean select(SyncInfo info) {
IStructuredSelection selection = getStructuredSelection();
if (selection.size() != 1)
return false;
ISynchronizeModelElement element = (ISynchronizeModelElement) selection.getFirstElement();
IResource resource = element.getResource();
if (resource == null)
return false;
if (!(resource instanceof IFile))
return false;
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
try {
return svnResource.getStatus().isTextConflicted();
} catch (SVNException e) {
return false;
}
}
};
}
Aggregations