org.eclipse.ui.part.DrillDownComposite Java Examples

The following examples show how to use org.eclipse.ui.part.DrillDownComposite. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProjectResourceControl.java    From depan with Apache License 2.0 5 votes vote down vote up
protected DrillDownComposite setupContainerControl(Composite parent) {
  DrillDownComposite result = new DrillDownComposite(parent, SWT.BORDER);

  containerViewer = new TreeViewer(result, SWT.NONE);
  result.setChildTree(containerViewer);

  containerViewer.setContentProvider(new WorkbenchContentProvider());
  containerViewer.setLabelProvider(new WorkbenchLabelProvider());
  containerViewer.setComparator(new ViewerComparator());
  containerViewer.setUseHashlookup(true);
  containerViewer.setInput(prepareInput());
  return result;
}
 
Example #2
Source File: MoveRemoteResourceWizardMainPage.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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, Policy.bind("MoveRemoteResourceWizardMainPage.selectParentUrl")); //$NON-NLS-1$

       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, Policy.bind("MoveRemoteResourceWizardMainPage.resourceName")); //$NON-NLS-1$

       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);
       }

}
 
Example #3
Source File: NewRemoteFolderWizardMainPage.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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, Policy.bind("NewRemoteFolderWizardMainPage.selectParentUrl")); //$NON-NLS-1$

       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
       createLabel(composite, Policy.bind("NewRemoteFolderWizardMainPage.folderName")); //$NON-NLS-1$

       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);
       }

}