use of org.tigris.subversion.subclipse.core.resources.LocalResourceStatus in project subclipse by subclipse.
the class SVNHistoryPage method inputSet.
public boolean inputSet() {
Object input = getInput();
if (input instanceof IResource) {
IResource res = (IResource) input;
RepositoryProvider teamProvider = RepositoryProvider.getProvider(res.getProject(), SVNProviderPlugin.getTypeId());
if (teamProvider != null) {
try {
ISVNLocalResource localResource = SVNWorkspaceRoot.getSVNResourceFor(res);
LocalResourceStatus localResourceStatus = (localResource != null) ? localResource.getStatus() : null;
if (localResource != null && localResourceStatus.isManaged() && (!localResourceStatus.isAdded() || localResourceStatus.isCopied())) {
this.resource = res;
this.remoteResource = localResource.getBaseResource();
this.projectProperties = ProjectProperties.getProjectProperties(res);
boolean includeBugs = projectProperties != null;
boolean includeTags = tagsPropertySet(res);
if (includeTags != this.includeTags || this.includeBugs != includeBugs) {
this.includeTags = includeTags;
this.includeBugs = includeBugs;
refreshTable();
}
this.historyTableProvider.setRemoteResource(this.remoteResource);
this.historyTableProvider.setProjectProperties(this.projectProperties);
if (historySearchViewerFilter != null) {
// HistorySearchViewerFilter[] filters = { historySearchViewerFilter };
// this.tableHistoryViewer.setFilters(filters);
this.tableHistoryViewer.resetFilters();
this.tableHistoryViewer.addFilter(historySearchViewerFilter);
historySearchDialog = new HistorySearchDialog(getSite().getShell(), remoteResource);
historySearchDialog.setSearchAll(false);
historySearchDialog.setStartRevision(historySearchViewerFilter.getStartRevision());
historySearchDialog.setEndRevision(historySearchViewerFilter.getEndRevision());
historySearchViewerFilter = null;
getClearSearchAction().setEnabled(true);
} else {
this.tableHistoryViewer.resetFilters();
getClearSearchAction().setEnabled(false);
}
this.tableHistoryViewer.setInput(this.remoteResource);
// setTitleToolTip(baseResource.getRepositoryRelativePath());
return true;
}
} catch (TeamException e) {
SVNUIPlugin.openError(getSite().getShell(), null, null, e);
}
}
} else if (input instanceof ISVNRemoteResource) {
this.resource = null;
this.remoteResource = (ISVNRemoteResource) input;
boolean includeTags = tagsPropertySet(remoteResource);
if (includeTags != this.includeTags) {
this.includeTags = includeTags;
refreshTable();
}
try {
this.projectProperties = ProjectProperties.getProjectProperties(this.remoteResource);
} catch (SVNException e) {
if (!e.operationInterrupted()) {
SVNUIPlugin.openError(getSite().getShell(), null, null, e);
}
}
boolean includeBugs = projectProperties != null;
if (includeTags != this.includeTags || this.includeBugs != includeBugs) {
this.includeTags = includeTags;
this.includeBugs = includeBugs;
refreshTable();
}
this.historyTableProvider.setRemoteResource(this.remoteResource);
this.historyTableProvider.setProjectProperties(this.projectProperties);
if (historySearchViewerFilter != null) {
// HistorySearchViewerFilter[] filters = { historySearchViewerFilter };
// this.tableHistoryViewer.setFilters(filters);
this.tableHistoryViewer.resetFilters();
this.tableHistoryViewer.addFilter(historySearchViewerFilter);
historySearchDialog = new HistorySearchDialog(getSite().getShell(), remoteResource);
historySearchDialog.setSearchAll(false);
historySearchDialog.setStartRevision(historySearchViewerFilter.getStartRevision());
historySearchDialog.setEndRevision(historySearchViewerFilter.getEndRevision());
historySearchViewerFilter = null;
getClearSearchAction().setEnabled(true);
} else {
this.tableHistoryViewer.resetFilters();
getClearSearchAction().setEnabled(false);
}
this.tableHistoryViewer.setInput(this.remoteResource);
// setTitleToolTip(remoteResource.getRepositoryRelativePath());
return true;
}
return false;
}
use of org.tigris.subversion.subclipse.core.resources.LocalResourceStatus in project subclipse by subclipse.
the class ResourceWithStatusUtil method getStatus.
public static String getStatus(IResource resource) {
ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resource);
String result = null;
try {
LocalResourceStatus status = svnResource.getStatus();
if (// $NON-NLS-1$
status.isTextConflicted())
// $NON-NLS-1$
result = Policy.bind("CommitDialog.conflicted");
else if (// $NON-NLS-1$
status.isAdded())
// $NON-NLS-1$
result = Policy.bind("CommitDialog.added");
else if (// $NON-NLS-1$
status.isDeleted())
// $NON-NLS-1$
result = Policy.bind("CommitDialog.deleted");
else if (// $NON-NLS-1$
status.isMissing())
// $NON-NLS-1$
result = Policy.bind("CommitDialog.missing");
else if (// $NON-NLS-1$
status.isReplaced())
// $NON-NLS-1$
result = Policy.bind("CommitDialog.replaced");
else if (status.isTextModified())
// $NON-NLS-1$
result = Policy.bind("CommitDialog.modified");
else if (// $NON-NLS-1$
!status.isManaged())
// $NON-NLS-1$
result = Policy.bind("CommitDialog.unversioned");
else
// $NON-NLS-1$
result = "";
} catch (TeamException e) {
// $NON-NLS-1$
result = "";
}
return result;
}
use of org.tigris.subversion.subclipse.core.resources.LocalResourceStatus 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.resources.LocalResourceStatus 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.resources.LocalResourceStatus 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