use of org.tigris.subversion.subclipse.core.ISVNLocalResource in project subclipse by subclipse.
the class ResourceWithStatusUtil method getPropertyStatus.
public static String getPropertyStatus(IResource resource) {
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
String result = null;
try {
LocalResourceStatus status = svnResource.getStatus();
if (status.isPropConflicted())
// $NON-NLS-1$
result = Policy.bind("CommitDialog.conflicted");
else if ((svnResource.getStatus() != null) && (svnResource.getStatus().getPropStatus() != null) && (svnResource.getStatus().getPropStatus().equals(SVNStatusKind.MODIFIED)))
// $NON-NLS-1$
result = Policy.bind("CommitDialog.modified");
else
// $NON-NLS-1$
result = "";
} catch (TeamException e) {
// $NON-NLS-1$
result = "";
}
return result;
}
use of org.tigris.subversion.subclipse.core.ISVNLocalResource in project subclipse by subclipse.
the class ResourceWithStatusUtil method getStatusKind.
public static SVNStatusKind getStatusKind(IResource resource) {
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
SVNStatusKind statusKind = null;
try {
LocalResourceStatus status = svnResource.getStatus();
if (status.isTextConflicted())
statusKind = SVNStatusKind.CONFLICTED;
else if (status.isAdded())
statusKind = SVNStatusKind.ADDED;
else if (status.isDeleted())
statusKind = SVNStatusKind.DELETED;
else if (status.isMissing())
statusKind = SVNStatusKind.MISSING;
else if (status.isReplaced())
statusKind = SVNStatusKind.REPLACED;
else if (status.isTextModified())
statusKind = SVNStatusKind.MODIFIED;
else if (!status.isManaged())
statusKind = SVNStatusKind.UNVERSIONED;
} catch (TeamException e) {
}
return statusKind;
}
use of org.tigris.subversion.subclipse.core.ISVNLocalResource in project subclipse by subclipse.
the class SVNLightweightDecorator method resourceStateChanged.
/**
* @see
* org.tigris.subversion.subclipse.core.IResourceStateChangeListener#resourceStateChanged(org.eclipse.core.resources.IResource[])
*/
public void resourceStateChanged(IResource[] changedResources) {
// add depth first so that update thread processes parents first.
// System.out.println(">> State Change Event");
Set resourcesToUpdate = new HashSet();
for (int i = 0; i < changedResources.length; i++) {
IResource resource = changedResources[i];
if (resource != null) {
if (resource.exists()) {
if (computeDeepDirtyCheck) {
IResource current = resource;
while ((current.getType() != IResource.ROOT) && (!resourcesToUpdate.contains(current))) {
resourcesToUpdate.add(current);
current = current.getParent();
}
} else {
resourcesToUpdate.add(resource);
}
} else {
// (We can no longer count on .svn folder updates forcing refresh)
try {
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
if (!svnResource.isIgnored()) {
IResource current = resource.getParent();
while (current.getType() != IResource.ROOT) {
if (current.exists() && SVNWorkspaceRoot.getSVNResourceFor(current).isManaged()) {
resourcesToUpdate.add(current);
}
current = current.getParent();
}
}
} catch (SVNException e) {
}
}
}
}
postLabelEvent(new LabelProviderChangedEvent(this, resourcesToUpdate.toArray()));
}
use of org.tigris.subversion.subclipse.core.ISVNLocalResource 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;
}
use of org.tigris.subversion.subclipse.core.ISVNLocalResource in project subclipse by subclipse.
the class EditPropertyConflictsWizardPropertyPage method createControl.
public void createControl(Composite parent) {
EditPropertyConflictsWizard wizard = (EditPropertyConflictsWizard) getWizard();
ISVNLocalResource svnResource = wizard.getSvnResource();
try {
ISVNProperty[] properties = svnResource.getSvnProperties();
for (int i = 0; i < properties.length; i++) {
if (properties[i].getName().equals(propertyConflict.getPropertyName())) {
propertyValue = properties[i].getValue();
break;
}
}
} catch (SVNException e) {
}
ISVNProperty[] remoteProperties = wizard.getRemoteProperties();
for (int i = 0; i < remoteProperties.length; i++) {
if (remoteProperties[i].getName().equals(propertyConflict.getPropertyName())) {
remoteProperty = remoteProperties[i];
break;
}
}
Composite outerContainer = new Composite(parent, SWT.NONE);
outerContainer.setLayout(new GridLayout());
outerContainer.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
myValueButton = new Button(outerContainer, SWT.RADIO);
myValueButton.setText(Messages.EditPropertyConflictsWizardPropertyPage_0);
myValueText = new Text(outerContainer, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL);
GridData data = new GridData(GridData.FILL_BOTH);
data.heightHint = 100;
data.widthHint = 400;
data.horizontalIndent = 30;
data.grabExcessHorizontalSpace = true;
myValueText.setLayoutData(data);
if (propertyValue != null) {
myValueText.setText(propertyValue);
}
incomingValueButton = new Button(outerContainer, SWT.RADIO);
incomingValueButton.setText(Messages.EditPropertyConflictsWizardPropertyPage_1);
incomingValueText = new Text(outerContainer, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL);
data = new GridData(GridData.FILL_BOTH);
data.horizontalSpan = 2;
data.heightHint = 100;
data.widthHint = 400;
data.horizontalIndent = 30;
data.grabExcessHorizontalSpace = true;
incomingValueText.setLayoutData(data);
if (remoteProperty != null) {
incomingValueText.setText(remoteProperty.getValue());
}
myValueButton.setSelection(true);
SelectionListener selectionListener = new SelectionAdapter() {
public void widgetSelected(SelectionEvent evt) {
if (incomingValueButton.getSelection()) {
propertyValue = incomingValueText.getText();
} else {
propertyValue = myValueText.getText();
}
}
};
myValueButton.addSelectionListener(selectionListener);
incomingValueButton.addSelectionListener(selectionListener);
ModifyListener modifyListener = new ModifyListener() {
public void modifyText(ModifyEvent evt) {
if (evt.getSource() == myValueText && myValueButton.getSelection()) {
propertyValue = myValueText.getText();
}
if (evt.getSource() == incomingValueText && incomingValueButton.getSelection()) {
propertyValue = incomingValueText.getText();
}
}
};
myValueText.addModifyListener(modifyListener);
incomingValueText.addModifyListener(modifyListener);
setControl(outerContainer);
setMessage(Messages.EditPropertyConflictsWizardPropertyPage_2 + propertyConflict.getPropertyName() + Messages.EditPropertyConflictsWizardPropertyPage_3);
}
Aggregations