use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.
the class UpdateSynchronizeOperation method run.
protected void run(SVNTeamProvider provider, SyncInfoSet set, IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
IResource[] resourceArray = extractResources(resources, set);
Map<ISVNRepositoryLocation, List<IResource>> items = groupByRepository(resourceArray, set);
Set<ISVNRepositoryLocation> keys = items.keySet();
for (Iterator<ISVNRepositoryLocation> iterator = keys.iterator(); iterator.hasNext(); ) {
ISVNRepositoryLocation repos = iterator.next();
List<IResource> resourceList = items.get(repos);
resourceArray = new IResource[resourceList.size()];
resourceList.toArray(resourceArray);
SVNRevision revision = getRevisionForUpdate(resourceArray, set);
IResource[] resourcesToUpdate = changeSetSelected ? resourceArray : trimResources(resourceArray);
doUpdate(provider, monitor, resourcesToUpdate, revision);
if (SVNProviderPlugin.getPlugin().getPluginPreferences().getBoolean(ISVNCoreConstants.PREF_SHOW_OUT_OF_DATE_FOLDERS) && resourcesToUpdate.length != resourceArray.length) {
try {
SVNWorkspaceSubscriber.getInstance().refresh(resourceArray, IResource.DEPTH_INFINITE, monitor);
} catch (TeamException e) {
}
}
}
}
use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.
the class BranchTagWizard method performFinish.
public boolean performFinish() {
if (confirmUserData() == false) {
return false;
}
svnExternals = copyPage.getSvnExternals();
comment = commentPage.getComment();
repositoryPage.saveUrl();
createOnServer = !copyPage.workingCopyButton.getSelection();
makeParents = repositoryPage.makeParentsButton.getSelection();
sameStructure = repositoryPage.sameStructureButton != null && repositoryPage.sameStructureButton.getSelection();
if (commentPage.switchAfterBranchTagCheckBox != null) {
switchAfterBranchTag = commentPage.switchAfterBranchTagCheckBox.getSelection();
}
if (copyPage.serverButton.getSelection())
revision = SVNRevision.HEAD;
try {
toUrl = new SVNUrl(repositoryPage.getToUrl());
if (copyPage.revisionButton.getSelection())
revision = SVNRevision.getRevision(copyPage.getRevision());
} catch (Exception e) {
MessageDialog.openError(getShell(), Policy.bind("BranchTagDialog.title"), // $NON-NLS-1$
e.getMessage());
return false;
}
if (!multipleSelections()) {
BusyIndicator.showWhile(Display.getDefault(), new Runnable() {
public void run() {
ISVNInfo svnInfo = null;
SVNUrl[] sourceUrls = getUrls();
ISVNClientAdapter svnClient = null;
ISVNRepositoryLocation repository = null;
try {
SVNProviderPlugin.disableConsoleLogging();
repository = SVNProviderPlugin.getPlugin().getRepository(sourceUrls[0].toString());
svnClient = repository.getSVNClient();
svnInfo = svnClient.getInfo(toUrl);
} catch (Exception e) {
} finally {
SVNProviderPlugin.enableConsoleLogging();
if (repository != null) {
repository.returnSVNClient(svnClient);
}
}
alreadyExists = svnInfo != null;
}
});
if (alreadyExists) {
MessageDialog.openError(getShell(), Policy.bind("BranchTagDialog.title"), Policy.bind("BranchTagDialog.alreadyExists", // $NON-NLS-1$ //$NON-NLS-2$
toUrl.toString()));
return false;
}
}
if (resources != null)
updateTagsProperty(toUrl);
return true;
}
use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.
the class SVNLightweightDecorator method decorateTextLabel.
/**
* decorate the text label of the given resource. This method assumes that only one thread will be
* accessing it at a time.
*/
protected void decorateTextLabel(ISVNLocalResource svnResource, LocalResourceStatus status, IDecoration decoration, boolean isDirty) {
Map bindings = new HashMap(6);
// has been deleted after we where asked to decorate it.
if (svnResource.getIResource().getLocation() == null) {
return;
}
if (status.isUnversioned())
return;
// get the format
IDecoratorComponent[][] format;
int type = svnResource.getIResource().getType();
if (type == IResource.FOLDER) {
format = folderDecoratorFormat;
} else if (type == IResource.PROJECT) {
format = projectDecoratorFormat;
} else {
format = fileDecoratorFormat;
}
// fill the bindings
if (isDirty & !status.isAdded()) {
bindings.put(SVNDecoratorConfiguration.DIRTY_FLAG, dirtyFlag);
}
if (status.getUrlString() != null) {
String label = null;
ISVNRepositoryLocation repository = status.getRepository();
if (repository != null) {
label = status.getRepository().getLabel();
}
bindings.put(SVNDecoratorConfiguration.RESOURCE_LABEL, label == null ? status.getUrlString() : label);
bindings.put(SVNDecoratorConfiguration.RESOURCE_URL, Util.unescape(status.getUrlString()));
// short url is the path relative to root url of repository
SVNUrl repositoryRoot = null;
if (repository != null) {
repositoryRoot = repository.getRepositoryRoot();
}
if (repositoryRoot != null) {
int urlLen = status.getUrlString().length();
int rootLen = repositoryRoot.toString().length() + 1;
String shortUrl;
if (urlLen > rootLen)
shortUrl = status.getUrlString().substring(rootLen);
else
shortUrl = status.getUrlString();
bindings.put(SVNDecoratorConfiguration.RESOURCE_URL_SHORT, Util.unescape(shortUrl));
}
}
if (status.isAdded()) {
bindings.put(SVNDecoratorConfiguration.ADDED_FLAG, addedFlag);
} else if (SVNStatusKind.EXTERNAL.equals(status.getTextStatus())) {
bindings.put(SVNDecoratorConfiguration.EXTERNAL_FLAG, externalFlag);
} else {
if ((status.getTextStatus() != SVNStatusKind.UNVERSIONED) && (status.getTextStatus() != SVNStatusKind.ADDED)) {
if (status.getLastChangedRevision() != null) {
bindings.put(SVNDecoratorConfiguration.RESOURCE_REVISION, status.getLastChangedRevision().toString());
}
if (status.getLastCommitAuthor() != null) {
bindings.put(SVNDecoratorConfiguration.RESOURCE_AUTHOR, status.getLastCommitAuthor());
}
}
if (status.getLastChangedDate() != null) {
bindings.put(SVNDecoratorConfiguration.RESOURCE_DATE, dateFormat.format(status.getLastChangedDate()));
}
}
SVNDecoratorConfiguration.decorate(decoration, format, bindings);
}
use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.
the class ChooseUrlDialog method okPressed.
protected void okPressed() {
saveLocation();
ISelection selection = treeViewer.getSelection();
if (!selection.isEmpty() && (selection instanceof IStructuredSelection)) {
IStructuredSelection structured = (IStructuredSelection) selection;
Object first = structured.getFirstElement();
if (first instanceof ISVNRemoteResource) {
url = ((ISVNRemoteResource) first).getUrl().toString();
name = ((ISVNRemoteResource) first).getName();
}
if (first instanceof ISVNRepositoryLocation)
url = ((ISVNRepositoryLocation) first).getUrl().toString();
if (first instanceof Alias)
url = AliasManager.transformUrl(resource, (Alias) first);
ArrayList urlArray = new ArrayList();
ArrayList nameArray = new ArrayList();
Iterator iter = structured.iterator();
while (iter.hasNext()) {
Object selectedItem = iter.next();
if (selectedItem instanceof ISVNRemoteResource) {
urlArray.add(((ISVNRemoteResource) selectedItem).getUrl().toString());
nameArray.add(((ISVNRemoteResource) selectedItem).getName());
}
}
urls = new String[urlArray.size()];
urlArray.toArray(urls);
names = new String[nameArray.size()];
nameArray.toArray(names);
}
super.okPressed();
}
use of org.tigris.subversion.subclipse.core.ISVNRepositoryLocation in project subclipse by subclipse.
the class ChooseUrlDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
// $NON-NLS-1$
getShell().setText(Policy.bind("ChooseUrlDialog.title"));
Composite composite = new Composite(parent, SWT.NULL);
composite.setLayout(new GridLayout());
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
if (message != null) {
Label messageLabel = new Label(composite, SWT.NONE);
messageLabel.setText(message);
}
if (multipleSelect)
treeViewer = new TreeViewer(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
else
treeViewer = new TreeViewer(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
contentProvider = new RemoteContentProvider();
contentProvider.setIncludeBranchesAndTags(includeBranchesAndTags);
contentProvider.setResource(resource);
treeViewer.setContentProvider(contentProvider);
if (foldersOnly)
treeViewer.addFilter(RepositoryFilters.FOLDERS_ONLY);
// treeViewer.setLabelProvider(new WorkbenchLabelProvider());
treeViewer.setLabelProvider(new RemoteLabelProvider());
ISVNRepositoryLocation repository = null;
if (repositoryLocation == null) {
if (resource == null)
treeViewer.setInput(new AllRootsElement());
else {
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
try {
LocalResourceStatus status = svnResource.getStatus();
if (status != null) {
repository = svnResource.getStatus().getRepository();
}
} catch (SVNException e1) {
}
if (repository == null) {
repository = svnResource.getRepository();
}
if (!repository.getUrl().toString().equals(repository.getRepositoryRoot().toString())) {
RepositoryRootFolder rootFolder = new RepositoryRootFolder(repository, repository.getRepositoryRoot(), repository.getRootFolder().getRevision());
contentProvider.setRootFolder(rootFolder);
}
}
} else {
repository = repositoryLocation;
}
if (repository == null)
treeViewer.setInput(new AllRootsElement());
else {
try {
repository.validateConnection(new NullProgressMonitor());
treeViewer.setInput(repository);
} catch (SVNException e) {
MessageDialog.openError(getShell(), Policy.bind("ChooseUrlDialog.title"), e.getMessage());
saveLocation = false;
cancelPressed();
return composite;
}
}
GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
data.heightHint = LIST_HEIGHT_HINT;
data.widthHint = LIST_WIDTH_HINT;
treeViewer.getControl().setLayoutData(data);
// when F5 is pressed, refresh
treeViewer.getControl().addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent event) {
if (event.keyCode == SWT.F5) {
refreshAction.run();
}
}
});
treeViewer.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent e) {
okPressed();
}
});
// 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) {
manager.add(newFolderAction);
if (!treeViewer.getSelection().isEmpty())
manager.add(deleteFolderAction);
manager.add(refreshAction);
}
});
menuMgr.setRemoveAllWhenShown(true);
tree.setMenu(menu);
// set F1 help
PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.CHOOSE_URL_DIALOG);
return composite;
}
Aggregations