use of org.tigris.subversion.subclipse.core.ISVNRemoteFolder in project subclipse by subclipse.
the class CheckoutWizardSelectionPage method createControl.
public void createControl(Composite parent) {
Composite outerContainer = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 1;
outerContainer.setLayout(layout);
outerContainer.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
treeViewer = new TreeViewer(outerContainer, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER);
RepositoryContentProvider contentProvider = new RepositoryContentProvider();
treeViewer.setContentProvider(contentProvider);
treeViewer.addFilter(RepositoryFilters.FOLDERS_ONLY);
treeViewer.setLabelProvider(new WorkbenchLabelProvider());
treeViewer.setInput(repositoryLocation);
GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
data.heightHint = LIST_HEIGHT_HINT;
data.widthHint = LIST_WIDTH_HINT;
treeViewer.getControl().setLayoutData(data);
treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
CheckoutWizard wizard = (CheckoutWizard) getWizard();
ArrayList folderArray = new ArrayList();
IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
Iterator iter = selection.iterator();
while (iter.hasNext()) {
Object object = iter.next();
if (object instanceof ISVNRemoteFolder || object instanceof ISVNRepositoryLocation) {
if (object instanceof ISVNRepositoryLocation)
folderArray.add(((ISVNRepositoryLocation) object).getRootFolder());
else
folderArray.add(object);
}
}
ISVNRemoteFolder[] remoteFolders = new ISVNRemoteFolder[folderArray.size()];
folderArray.toArray(remoteFolders);
wizard.setRemoteFolders(remoteFolders);
setPageComplete(!treeViewer.getSelection().isEmpty());
}
});
final Action refreshAction = new Action(Policy.bind("RepositoriesView.refreshPopup"), SVNUIPlugin.getPlugin().getImageDescriptor(// $NON-NLS-1$
ISVNUIConstants.IMG_REFRESH)) {
public void run() {
refreshViewerNode();
}
};
MenuManager menuMgr = new MenuManager();
Tree tree = treeViewer.getTree();
Menu menu = menuMgr.createContextMenu(tree);
menuMgr.addMenuListener(new IMenuListener() {
public void menuAboutToShow(IMenuManager manager) {
manager.add(refreshAction);
}
});
menuMgr.setRemoveAllWhenShown(true);
tree.setMenu(menu);
// $NON-NLS-1$
setMessage(Policy.bind("CheckoutWizardSelectionPage.text"));
setControl(outerContainer);
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteFolder in project subclipse by subclipse.
the class NewRemoteFolderWizard method performFinish.
/*
* @see IWizard#performFinish
*/
public boolean performFinish() {
try {
final String folderName = mainPage.getFolderName();
final String comment = commitCommentPage.getComment();
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
try {
ISVNRemoteFolder parentFolder = mainPage.getParentFolder();
parentFolder.createRemoteFolder(folderName, comment, monitor);
} catch (SVNException e) {
throw new InvocationTargetException(e);
}
}
};
new ProgressMonitorDialog(getShell()).run(true, false, runnable);
} catch (InterruptedException e) {
// operation canceled
} catch (InvocationTargetException e) {
SVNUIPlugin.openError(getContainer().getShell(), Policy.bind("exception"), null, e.getCause(), // $NON-NLS-1$
SVNUIPlugin.PERFORM_SYNC_EXEC);
return false;
}
return true;
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteFolder in project subclipse by subclipse.
the class NewRemoteFolderWizardMainPage method createControl.
/**
* Creates the UI part of the page.
*
* @param parent the parent of the created widgets
*/
public void createControl(Composite parent) {
Composite composite = createComposite(parent, 1);
// set F1 help
PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.CREATE_REMOTE_FOLDER_PAGE);
Listener listener = new Listener() {
public void handleEvent(Event event) {
validateFields();
}
};
// the text field for the parent folder
createLabel(composite, // $NON-NLS-1$
Policy.bind("NewRemoteFolderWizardMainPage.selectParentUrl"));
urlParentText = createTextField(composite);
urlParentText.addListener(SWT.Selection, listener);
urlParentText.addListener(SWT.Modify, listener);
urlParentText.setEditable(false);
// Create drill down.
DrillDownComposite drillDown = new DrillDownComposite(composite, SWT.BORDER);
GridData spec = new GridData(GridData.FILL_BOTH);
spec.widthHint = LIST_WIDTH;
spec.heightHint = LIST_HEIGHT;
drillDown.setLayoutData(spec);
// Create tree viewer inside drill down.
viewer = new TreeViewer(drillDown, SWT.H_SCROLL | SWT.V_SCROLL);
drillDown.setChildTree(viewer);
viewer.setLabelProvider(new WorkbenchLabelProvider());
RemoteContentProvider remoteContentProvider = new RemoteContentProvider();
remoteContentProvider.setUseDeferredContentManager(false);
viewer.setContentProvider(remoteContentProvider);
viewer.setInput(new AllRootsElement());
viewer.addFilter(RepositoryFilters.FOLDERS_ONLY);
viewer.addSelectionChangedListener(treeSelectionChangedListener);
// the text field for the folder name
// $NON-NLS-1$
createLabel(composite, Policy.bind("NewRemoteFolderWizardMainPage.folderName"));
folderNameText = createTextField(composite);
folderNameText.addListener(SWT.Selection, listener);
folderNameText.addListener(SWT.Modify, listener);
validateFields();
folderNameText.setFocus();
setControl(composite);
// set the initial selection in the tree
if (parentFolder != null) {
List itemsToExpand = new ArrayList();
ISVNRemoteFolder remoteParent = parentFolder.getParent();
while (remoteParent != null) {
if (remoteParent.getParent() == null)
itemsToExpand.add(0, remoteParent.getRepository());
else
itemsToExpand.add(0, remoteParent);
remoteParent = remoteParent.getParent();
}
viewer.setExpandedElements(itemsToExpand.toArray());
if (parentFolder.getParent() == null)
viewer.setSelection(new StructuredSelection(parentFolder.getRepository()), true);
else
viewer.setSelection(new StructuredSelection(parentFolder), true);
}
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteFolder in project subclipse by subclipse.
the class RemoteFolderElement method fetchDeferredChildren.
public void fetchDeferredChildren(Object o, IElementCollector collector, IProgressMonitor monitor) {
// If it's not a folder, return an empty array
if (!(o instanceof ISVNRemoteFolder)) {
collector.add(new Object[0], monitor);
}
try {
monitor = Policy.monitorFor(monitor);
monitor.beginTask(Policy.bind("RemoteFolderElement_fetchingRemoteMembers.message", getLabel(o)), // $NON-NLS-1$
100);
FetchMembersOperation operation = new FetchMembersOperation(null, (ISVNRemoteFolder) o, collector);
operation.run(Policy.subMonitorFor(monitor, 100));
} catch (InvocationTargetException e) {
SVNUIPlugin.openError(null, null, null, e);
} catch (InterruptedException e) {
// Cancelled by the user;
} finally {
monitor.done();
}
}
use of org.tigris.subversion.subclipse.core.ISVNRemoteFolder in project subclipse by subclipse.
the class RemoteFolderElement method getParent.
/**
* Return null.
*/
public Object getParent(Object o) {
if (!(o instanceof ISVNRemoteFolder))
return null;
ISVNRemoteFolder folder = (ISVNRemoteFolder) o;
ISVNRemoteFolder parentFolder = folder.getParent();
if (parentFolder != null)
return parentFolder;
else {
return folder.getRepository();
}
}
Aggregations