/** * This is a callback that will allow us to create the viewer and initialize it. */ public void createPartControl(Composite parent) { PatternFilter filter = new PatternFilter(); FilteredTree tree = new FilteredTree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, filter, true); viewer = tree.getViewer(); drillDownAdapter = new DrillDownAdapter(viewer); viewer.setContentProvider(new ViewContentProvider()); viewer.setLabelProvider(new ViewLabelProvider()); viewer.setSorter(new NameSorter()); viewer.setInput(getViewSite()); makeActions(); hookContextMenu(); hookDoubleClickAction(); contributeToActionBars(); getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(this); }
protected TreeViewer doCreateTreeViewer(Composite parent, int style) { FilteredTree tree = new FilteredTree(parent, style, new PatternFilter(), true); tree.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(tree); TreeViewer viewer = tree.getViewer(); return viewer; }
@Override public void createControl(Composite parent) { patternFilter = new PatternFilter(); filter = PyFilteredTree.create(parent, patternFilter, false); treeViewer = filter.getViewer(); treeViewer.addSelectionChangedListener(this); }
public static PyFilteredTree create(Composite parent, PatternFilter filter, boolean border) { int treeStyle = SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL; if (border) { treeStyle |= SWT.BORDER; } return create(parent, treeStyle, filter); }
public PaletteFilteredTree(Composite parent, int treeStyle, PatternFilter filter, boolean useNewLook) { super(parent, treeStyle, filter, useNewLook); }
@Override protected Control createDialogArea(Composite base) { Composite parent = (Composite) super.createDialogArea(base); Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout); composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); // Manage dialog tree content. FilteredTree tree = new FilteredTree(composite, SWT.SINGLE | SWT.BORDER, new PatternFilter(), true); projectTree = tree.getViewer(); projectTree.setLabelProvider(new EIPModelTreeLabelProvider()); projectTree.setContentProvider(new EIPModelTreeContentProvider()); projectTree.setInput(ResourcesPlugin.getWorkspace().getRoot()); GridDataFactory.fillDefaults().grab(true, true).hint(500, 300).applyTo(tree); // Manage dialog tree events. projectTree.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { if (event.getSelection() instanceof TreeSelection) { TreeSelection tSelection = (TreeSelection)event.getSelection(); if (tSelection.getFirstElement() instanceof IResource) { eipModel = (IResource) tSelection.getFirstElement(); } } } }); setTitle("Choose a target EIP model"); setMessage("Select the EIP model for designing a new Route from Service"); applyDialogFont(composite); return composite; }
@Override protected Control createDialogArea(Composite base) { Composite parent = (Composite) super.createDialogArea(base); Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout); composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); // Manage dialog tree content. FilteredTree tree = new FilteredTree(composite, SWT.SINGLE | SWT.BORDER, new PatternFilter(), true); projectTree = tree.getViewer(); projectTree.setLabelProvider(new RouteTreeLabelProvider()); projectTree.setContentProvider(new RouteTreeContentProvider()); projectTree.setInput(ResourcesPlugin.getWorkspace().getRoot()); GridDataFactory.fillDefaults().grab(true, true).hint(500, 300).applyTo(tree); // Manage dialog tree events. projectTree.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { if (event.getSelection() instanceof TreeSelection) { TreeSelection tSelection = (TreeSelection)event.getSelection(); if (tSelection.getFirstElement() instanceof Route) { selectedRoute = (Route) tSelection.getFirstElement(); } } } }); setTitle("Compare '" + fileName + "' with an EIP Route model"); setMessage("Select an EIP Route to compare the resource with"); applyDialogFont(composite); return composite; }
@Override protected Control createDialogArea(Composite base) { Composite parent = (Composite) super.createDialogArea(base); Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); composite.setLayout(layout); composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); // Manage dialog tree content. FilteredTree tree = new FilteredTree(composite, SWT.SINGLE | SWT.BORDER, new PatternFilter(), true); projectTree = tree.getViewer(); projectTree.setLabelProvider(new EIPModelTreeLabelProvider()); projectTree.setContentProvider(new EIPModelTreeContentProvider()); projectTree.setInput(ResourcesPlugin.getWorkspace().getRoot()); GridDataFactory.fillDefaults().grab(true, true).hint(500, 300).applyTo(tree); // Manage dialog tree events. projectTree.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { if (event.getSelection() instanceof TreeSelection) { TreeSelection tSelection = (TreeSelection)event.getSelection(); if (tSelection.getFirstElement() instanceof IResource) { selectedEIPModel = (IResource) tSelection.getFirstElement(); } } } }); setTitle("Parse and merge '" + fileName + "' with an EIP Model"); setMessage("Select an EIP Model to persist the parsed resource within"); applyDialogFont(composite); return composite; }
@SuppressWarnings("deprecation") public CheckboxFilteredTree(Composite parent, int treeStyle, PatternFilter filter) { super(parent, treeStyle, filter); }
/** * 创建包含过滤文本的 TreeViewer * @param parent * 顶层容器 ; */ private void createFilterControls(Composite parent) { fFilteredTree = new FilteredTree(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION, new PatternFilter(), true); GridData gridData; final GridLayout layout = new GridLayout(1, false); layout.marginWidth = 0; fFilteredTree.setLayout(layout); gridData = new GridData(); gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; gridData.horizontalAlignment = SWT.FILL; gridData.verticalAlignment = SWT.FILL; fFilteredTree.setLayoutData(gridData); final TreeViewer viewer = fFilteredTree.getViewer(); // 确保 filtered tree 有显示 ITEMS_TO_SHOW 的高度 final Tree tree = viewer.getTree(); tree.setHeaderVisible(true); tree.setLinesVisible(true); final Object layoutData = tree.getLayoutData(); if (layoutData instanceof GridData) { gridData = (GridData) layoutData; gridData.heightHint = parent.getSize().y; // 适应大小 } LanguageCodeComparator comparator = new LanguageCodeComparator(); final TreeColumn codeColumn = new TreeColumn(tree, SWT.LEFT, LANGUAGE_CODE_COLUMN); codeColumn.setText(Messages.getString("languagecode.LanguageCodesPreferencePage.codeColumn")); tree.setSortColumn(codeColumn); tree.setSortColumn(codeColumn); tree.setSortDirection(SWT.UP); codeColumn.addSelectionListener(new ResortColumn(comparator, codeColumn, viewer, LANGUAGE_CODE_COLUMN)); final TreeColumn nameColumn = new TreeColumn(tree, SWT.LEFT, LANGUAGE_NAME_COLUMN); nameColumn.setText(Messages.getString("languagecode.LanguageCodesPreferencePage.nameColumn")); nameColumn.addSelectionListener(new ResortColumn(comparator, nameColumn, viewer, LANGUAGE_NAME_COLUMN)); final TreeColumn bidiColumn = new TreeColumn(tree, SWT.LEFT, LANGUAGE_BIDI_COLUMN); bidiColumn.setText(Messages.getString("languagecode.LanguageCodesPreferencePage.bidiColumn")); bidiColumn.addSelectionListener(new ResortColumn(comparator, bidiColumn, viewer, LANGUAGE_BIDI_COLUMN)); viewer.setContentProvider(new LanguageCodeContentProvider()); viewer.setLabelProvider(new LanguageCodeLabelProvider()); viewer.setComparator(comparator); viewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { verifyCurrentSelected(EDIT); } }); fFilteredTree.getPatternFilter().setIncludeLeadingWildcard(true); final TreeColumn[] columns = viewer.getTree().getColumns(); columns[LANGUAGE_CODE_COLUMN].setWidth(100); columns[LANGUAGE_NAME_COLUMN].setWidth(240); columns[LANGUAGE_BIDI_COLUMN].setWidth(100); }
/** * Create contents of the wizard. * @param parent */ public void createControl(Composite parent) { final Composite container = new Composite(parent, SWT.NULL); container.setLayout(new GridLayout(8, false)); init(); FilteredTree filteredTree = new FilteredTree(container, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, new PatternFilter(), true); filteredTree.getFilterControl().setText(""); GridData gd_filteredTree = new GridData(SWT.FILL, SWT.FILL, true, true, 8, 1); gd_filteredTree.heightHint = 138; gd_filteredTree.widthHint = 300; filteredTree.setLayoutData(gd_filteredTree); treeViewer = filteredTree.getViewer(); treeViewer.setContentProvider(new TreeViewerContentProvider()); treeViewer.setLabelProvider(new TreeViewerLabelProvider()); Map<String, List<String>> filesUrl = manager.getApiUrls(); treeViewer.setInput(DataFactory.getList(iProject, filesUrl)); treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { ISelection iSelection = treeViewer.getSelection(); dialogChanged(); if (iSelection != null) { Object selectItem = ((TreeSelection) iSelection) .getFirstElement(); if (selectItem instanceof RestFulApi) { isChosed = true; RestFulApi api = (RestFulApi) selectItem; changeIsUseInnerOps(api.getParent().getParent()); if (isUseInnerSchema) { currentUrlBean = new UrlBean(manager.getApiManager().getRestApiJsonByUrl(api.getName())); } else { currentUrlBean = new UrlBean(manager.getUserApiManager().getRestApiJsonByUrl(api.getName())); } IWizardPage page = getNextPage(); if(page instanceof AddPostBodyPage2){ ((AddPostBodyPage2)page).createItem(currentUrlBean); } } else { isChosed = false; } if (selectItem instanceof SchemaFile) { SchemaFile file = (SchemaFile) selectItem; changeIsUseInnerOps(file.getParent()); isChosed = false; } } dialogChanged(); } }); setControl(container); new Label(container, SWT.NONE); new Label(container, SWT.NONE); new Label(container, SWT.NONE); new Label(container, SWT.NONE); new Label(container, SWT.NONE); Label label_1 = new Label(container, SWT.NONE); new Label(container, SWT.NONE); new Label(container, SWT.NONE); }
/** * Create contents of the wizard. * @param parent */ public void createControl(Composite parent) { final Composite container = new Composite(parent, SWT.NULL); container.setLayout(new GridLayout(8, false)); init(); FilteredTree filteredTree = new FilteredTree(container, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, new PatternFilter(), true); filteredTree.getFilterControl().setText(""); GridData gd_filteredTree = new GridData(SWT.FILL, SWT.FILL, true, true, 8, 1); gd_filteredTree.heightHint = 138; gd_filteredTree.widthHint = 300; filteredTree.setLayoutData(gd_filteredTree); treeViewer = filteredTree.getViewer(); treeViewer.setContentProvider(new TreeViewerContentProvider()); treeViewer.setLabelProvider(new TreeViewerLabelProvider()); Map<String, List<String>> filesUrl = manager.getApiUrls(); treeViewer.setInput(DataFactory.getList(iProject, filesUrl)); treeViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { ISelection iSelection = treeViewer.getSelection(); dialogChanged(); if (iSelection != null) { Object selectItem = ((TreeSelection) iSelection) .getFirstElement(); if (selectItem instanceof RestFulApi) { isChosed = true; RestFulApi api = (RestFulApi) selectItem; choseUrl = api.getName(); changeIsUseInnerOps(api.getParent().getParent()); if (isUseInnerSchema) { currentUrlBean = new UrlBean(manager.getApiManager().getRestApiJsonByUrl(api.getName())); } else { currentUrlBean = new UrlBean(manager.getUserApiManager().getRestApiJsonByUrl(api.getName())); } IWizardPage page = getNextPage(); if(page instanceof AddPostBodyPage2){ ((AddPostBodyPage2)page).createItem(currentUrlBean,choseUrl); } } else { isChosed = false; } if (selectItem instanceof SchemaFile) { SchemaFile file = (SchemaFile) selectItem; changeIsUseInnerOps(file.getParent()); isChosed = false; } } dialogChanged(); } }); setControl(container); new Label(container, SWT.NONE); new Label(container, SWT.NONE); new Label(container, SWT.NONE); new Label(container, SWT.NONE); new Label(container, SWT.NONE); Label label_1 = new Label(container, SWT.NONE); new Label(container, SWT.NONE); new Label(container, SWT.NONE); }
PatternFilteredTree(Composite parent, int treeStyle, PatternFilter filter) { super(parent, treeStyle, filter); }
private PyFilteredTree(Composite parent, int treeStyle, PatternFilter filter, boolean useNewLook) { super(parent, treeStyle, filter, useNewLook); }
private PyFilteredTree(Composite parent, int treeStyle, PatternFilter filter) { super(parent, treeStyle, filter); }
/** * Creates the default tree and sets it as the control. The default styles will show scrollbars as needed, and allows * for multiple selection. * <p> * Doesn't use the default createControl method name, as that one is made final in the ScrollingGraphicalViewer base * class... * </p> * * @param parent * The parent for the Tree * @return the control */ public Control createTreeControl(Composite parent) { PatternFilter filter = new PatternFilter(); FilteredTree tree = new PaletteFilteredTree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, filter, true); tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); tree.getViewer().setContentProvider(new PaletteTreeProvider(tree.getViewer())); tree.getViewer().setLabelProvider(new PaletteLabelProvider(this)); setControl(tree); addDropTargetListener(new UserLibraryTransferDropListener(this)); return tree; }
/** * Creates a {@link PatternFilter} for the detail view. * * @return the created {@link PatternFilter} for the detail view */ protected PatternFilter createDetailPatternFilter() { PatternFilter res = new PatternFilter(); return res; }
/** * Constructor. * * @param parent * the parent <code>Composite</code> * @param treeStyle * the style bits for the <code>Tree</code> * @param filter * the filter to be used * @param useNewLook * <code>true</code> if the new 3.5 look should be used */ public FilteredCheckboxTree(Composite parent, int treeStyle, PatternFilter filter, boolean useNewLook) { super(parent, treeStyle, filter, useNewLook); }
/** * Constructor that creates a tree with preset style bits and a CachedContainerCheckedTreeViewer for the tree. * * @param parent parent composite * @param toolkit optional toolkit to create UI elements with, required if the tree is being created in a form editor * @param treeStyle */ public FilteredCheckboxTree(Composite parent, FormToolkit toolkit, int treeStyle) { this(parent, toolkit, treeStyle, new PatternFilter()); }
/** * Constructor that creates a tree with preset style bits and a CachedContainerCheckedTreeViewer for the tree. * * @param parent parent composite * @param toolkit optional toolkit to create UI elements with, required if the tree is being created in a form editor * @param treeStyle * @param filter pattern filter to use in the filter control */ public FilteredCheckboxTree(Composite parent, FormToolkit toolkit, int treeStyle, PatternFilter filter) { super(parent, treeStyle, filter, true); fToolkit = toolkit; }