Java 类org.eclipse.ui.part.DrillDownComposite 实例源码

项目:depan    文件:ProjectResourceControl.java   
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;
}
项目:subclipse    文件:MoveRemoteResourceWizardMainPage.java   
/**
 * 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);
       }

}
项目:subclipse    文件:NewRemoteFolderWizardMainPage.java   
/**
 * 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);
       }

}
项目:APICloud-Studio    文件:MoveRemoteResourceWizardMainPage.java   
/**
 * 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);
       }

}
项目:APICloud-Studio    文件:NewRemoteFolderWizardMainPage.java   
/**
 * 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);
       }

}
项目:EMFtoCSP    文件:ElementSelectionWidget.java   
private void createContents() {
    setLayout(new FormLayout());
    FormData formData = new FormData();
    formData.left = new FormAttachment(0, 0);       
    formData.top = new FormAttachment(0, 0);
    formData.right = new FormAttachment(100, -5);
    formData.bottom = new FormAttachment(90, 0/*-5*/);      

    final DrillDownComposite ddComposite = new DrillDownComposite(this, SWT.BORDER);        
    ddComposite.setLayoutData(formData);
    treeViewer = new TreeViewer(ddComposite);
    ddComposite.setChildTree(treeViewer);

    if (!mandatorySelection) {
        FormData formData2 = new FormData();
        formData2.left = new FormAttachment(0, 0);      
        formData2.top = new FormAttachment(90, 0);
        formData2.right = new FormAttachment(100, -5);
        formData2.bottom = new FormAttachment(100, 0/*-5*/);                
        chkDisableSelection = new Button(this, SWT.CHECK);
        chkDisableSelection.setLayoutData(formData2);
        chkDisableSelection.setText("Skip selection");
        chkDisableSelection.addSelectionListener(
            new SelectionAdapter() {
              public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                ddComposite.setEnabled(!chkDisableSelection.getSelection());
                treeViewer.getControl().setEnabled(!chkDisableSelection.getSelection());
                if (!ddComposite.getEnabled())
                    elementSelectionChanged(null);
                else
                    elementSelectionChanged((IStructuredSelection)treeViewer.getSelection());
              }
            }
        );
    }

    treeViewer.setComparator(new ViewerComparator());
    treeViewer.setUseHashlookup(true);
    treeViewer.setContentProvider(new TreeContentProvider());
    treeViewer.setLabelProvider(new TreeLabelProvider());
    treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot().getProjects());
    treeViewer.addSelectionChangedListener(
        new ISelectionChangedListener() {
            public void selectionChanged(SelectionChangedEvent event) {
                elementSelectionChanged((IStructuredSelection)event.getSelection());
            }
        }               
    );
}