use of org.tigris.subversion.subclipse.ui.repository.model.AllRootsElement in project subclipse by subclipse.
the class RepositoriesView method createPartControl.
/*
* @see WorkbenchPart#createPartControl
*/
public void createPartControl(Composite parent) {
treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
contentProvider = new RemoteContentProvider();
treeViewer.setContentProvider(contentProvider);
final RepositoriesViewDecorator decorator = new RepositoriesViewDecorator();
DecoratingLabelProvider labelProvider = new DecoratingLabelProvider(new WorkbenchLabelProvider(), new ILabelDecorator() {
public Image decorateImage(Image image, Object obj) {
if (obj instanceof RemoteFile) {
RemoteFile remoteFile = (RemoteFile) obj;
if (remoteFile.getLock() != null) {
return decorator.getImage(image);
}
}
return null;
}
public String decorateText(String text, Object obj) {
return null;
}
public void addListener(ILabelProviderListener listener) {
}
public void dispose() {
}
public boolean isLabelProperty(Object obj, String prop) {
return false;
}
public void removeListener(ILabelProviderListener listener) {
}
});
treeViewer.setLabelProvider(labelProvider);
getSite().setSelectionProvider(treeViewer);
root = new AllRootsElement();
treeViewer.setInput(root);
treeViewer.setSorter(new RepositorySorter());
drillPart = new DrillDownAdapter(treeViewer);
contributeActions();
// F1 Help
String helpID = getHelpContextId();
if (helpID != null)
PlatformUI.getWorkbench().getHelpSystem().setHelp(treeViewer.getControl(), helpID);
initializeListeners();
SVNUIPlugin.getPlugin().getRepositoryManager().addRepositoryListener(repositoryListener);
}
use of org.tigris.subversion.subclipse.ui.repository.model.AllRootsElement 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.ui.repository.model.AllRootsElement in project subclipse by subclipse.
the class MoveRemoteResourceWizardMainPage 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.MOVE_RENAME_REMOTE_RESOURCE_PAGE);
Listener listener = new Listener() {
public void handleEvent(Event event) {
resourceName = resourceNameText.getText();
validateFields();
}
};
// the text field for the parent folder
createLabel(composite, // $NON-NLS-1$
Policy.bind("MoveRemoteResourceWizardMainPage.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());
viewer.setContentProvider(new RemoteContentProvider());
viewer.setInput(new AllRootsElement());
viewer.addFilter(RepositoryFilters.FOLDERS_ONLY);
viewer.addSelectionChangedListener(treeSelectionChangedListener);
// the text field for the resource name
createLabel(composite, // $NON-NLS-1$
Policy.bind("MoveRemoteResourceWizardMainPage.resourceName"));
resourceNameText = createTextField(composite);
resourceNameText.addListener(SWT.Selection, listener);
resourceNameText.addListener(SWT.Modify, listener);
resourceNameText.setText(resourceName);
validateFields();
resourceNameText.setFocus();
setControl(composite);
// set the initial selection in the tree
if (parentFolder != null) {
Object toSelect = null;
if (parentFolder.getParent() == null) {
// the root folder : select the repository
toSelect = parentFolder.getRepository();
} else
toSelect = parentFolder;
viewer.expandToLevel(toSelect, 0);
viewer.setSelection(new StructuredSelection(toSelect), true);
}
}
use of org.tigris.subversion.subclipse.ui.repository.model.AllRootsElement 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);
}
}
Aggregations