@Override public void createPartControl(Composite parent) { FeatureModelManager featureModelManager = FeatureSupport.getManager(); ProductModelManager productModelManager = ProductSupport.getManager(); FeatureAndProductInput input = new FeatureAndProductInput(featureModelManager, productModelManager); this.featureIndex = new FeatureIndex(featureModelManager, productModelManager); FilteredTree filteredTree = createFilteredTree(parent); this.viewer = filteredTree.getViewer(); this.patternFilter = filteredTree.getPatternFilter(); this.viewerFilters.add(patternFilter); this.clipboard = new Clipboard(parent.getDisplay()); this.copyAction = new FeatureAndPluginCopyAction(viewer, clipboard); this.pasteAction = new FeatureAndPluginPasteAction(viewer, clipboard); registerGlobalActions(); contributeToActionBar(featureModelManager, productModelManager); hookContextMenu(); initialiseViewer(input); }
/** * Creates the filtered tree that will be shown on the left side of dialog. * It uses a label provider which gets the IPropertiesViewerNode.getName() * * @param parent the widget container * @return the filtered tree widget */ protected FilteredTree createTreeViewer(Composite parent) { FilteredTree filteredTree = new FilteredTree(parent, SWT.SINGLE, new PropertiesPatternFilter(), true); filteredTree.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); final TreeViewer viewer = filteredTree.getViewer(); viewer.setLabelProvider( new LabelProvider() { public String getText(Object element) { return ((IPropertiesViewerNode) element).getName(); } }); viewer.setContentProvider(new PropertiesViewerContentProvider<T>(nodes)); return filteredTree; }
/** * 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); }
public void setSearchVisible(boolean b) { if (content instanceof FilteredTree) { FilteredTree ftree = (FilteredTree)content; GridUtils.setVisible(ftree.getFilterControl().getParent(), b); ftree.layout(new Control[]{ftree.getFilterControl().getParent()}); } }
/** * Create contents of the view part. * * @param parent */ @Override public void createPartControl(Composite parent) { // create the desired layout for this wizard page GridLayout glLeft = new GridLayout(); glLeft.numColumns = 3; parent.setLayout(glLeft); // Create the sorters and filters viewerFilterDisplay = new ViewerFilterObjectGraph(); viewerSorterDisplay = new ArchitecturalViewerSorter(); GridData gdVisualFilteredViewer = new org.eclipse.swt.layout.GridData(); gdVisualFilteredViewer.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL; gdVisualFilteredViewer.verticalAlignment = org.eclipse.swt.layout.GridData.FILL; gdVisualFilteredViewer.grabExcessHorizontalSpace = true; gdVisualFilteredViewer.grabExcessVerticalSpace = true; gdVisualFilteredViewer.horizontalSpan = 3; ftDisplay = new FilteredTree(parent, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, new ObjectGraphPatternFilter()); // Support // single ftDisplay.setLayoutData(gdVisualFilteredViewer); viewer = ftDisplay.getViewer(); drillDownAdapter = new DrillDownAdapter(viewer); viewer.setContentProvider(new ContentProviderDisplayGraph()); viewer.setLabelProvider(new ArchitecturalDecoratingLabelProvider( ftDisplay)); // By default, no sorting viewer.setSorter(viewerSorterDisplay); viewer.addFilter(viewerFilterDisplay); viewer.setUseHashlookup(true); createActions(); initializeToolBar(); initializeMenu(); hookLogListeners(); refresh(); }
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 createPartControl(Composite parent) { Filter filter = new Filter(); FilteredTree tree = new FilteredTree(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL, filter, true) { @Override protected void updateToolbar(boolean visible) { super.updateToolbar(visible); viewer.collapseAll(); viewer.expandToLevel(2); } }; viewer = tree.getViewer(); drillDownAdapter = new DrillDownAdapter(viewer); viewer.setContentProvider(new ViewContentProvider(this)); viewer.setLabelProvider(new ViewLabelProvider()); viewer.setComparator(new ViewSorter()); viewer.getTree().setToolTipText(null); ColumnViewerToolTipSupport.enableFor(viewer); getSite().setSelectionProvider(viewer); refresh(new Object()); targetActions = new LinkedHashSet<>(); makeActions(); hookContextMenu(); hookDoubleClickAction(); contributeToActionBars(); readTargetDefinitions(); }
@Override protected TreeViewer doCreateTreeViewer(Composite parent, int style) { FilteredTree tree= new FilteredTreeWithFilter(parent, style, fInitialFilter, fIsDeepFiltering); tree.setLayoutData(new GridData(GridData.FILL_BOTH)); applyDialogFont(tree); TreeViewer viewer= tree.getViewer(); SWTUtil.setAccessibilityText(viewer.getControl(), Strings.removeMnemonicIndicator(getMessage())); return viewer; }
private void createTree(Composite panel) { FilteredTree ft = new FilteredTree(panel, SWT.BORDER, new PropertyKeyFilter(), true); keysViewer = ft.getViewer(); MuleEnvironmentsTreeProvider environmentsProvider = new MuleEnvironmentsTreeProvider(); keysViewer.setContentProvider(environmentsProvider); keysViewer.setLabelProvider(environmentsProvider); keysViewer.setInput(keyModel); }
/** * Creates an editor for the tree passed in * @param parent * @param tree which is edited. If this ControlTreeViewer was created without specifiying a default, this is cloned for the default. * @param managers, may be null * @throws Exception */ public Composite createPartControl(Composite parent, ControlTree tree, IContributionManager... managers) throws Exception { if (viewer!=null) throw new IllegalArgumentException("The createPartControl() method must only be called once!"); if (defaultTree==null && tree==null) throw new IllegalArgumentException("No control tree has been defined!"); // Clone this tree so that they can reset it! if (defaultTree==null) defaultTree = ControlTreeUtils.clone(tree); if (tree == null) tree = ControlTreeUtils.clone(defaultTree); if (setUseFilteredTree) { FilteredTree ftree = new FilteredTree(parent, SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE, new NamedNodeFilter(), true); this.viewer = ftree.getViewer(); this.content = ftree; } else { this.viewer = new TreeViewer(parent, SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE); this.content = viewer.getTree(); } viewer.getTree().setLinesVisible(true); viewer.getTree().setHeaderVisible(false); ViewerUtils.setItemHeight(viewer.getTree(), 30); content.setLayoutData(new GridData(GridData.FILL_BOTH)); createColumns(viewer); try { viewer.setContentProvider(new ControlContentProvider()); } catch (Exception e) { logger.error("Cannot create content provider", e); } viewer.setInput(tree); viewer.expandAll(); createActions(viewer, tree, managers); setSearchVisible(false); try { registerAll(); } catch (Exception ne) { logger.error("Cannot listen to motor values changing..."); } return content; }
public LabelProviderObjectGraph(FilteredTree filterTree) { super(filterTree); }
PreferenceBoldLabelProvider(FilteredTree filterTree) { this.filterTree = filterTree; }
public Font getFont(Object element) { return FilteredTree.getBoldFont(element, filterTree, filterForBoldElements); }
public ArchitecturalDecoratingLabelProvider(FilteredTree filterTree) { super(new LabelProviderObjectGraph(filterTree), new LabelDecoratorObjectGraph()); }
public ArchitecturalDecoratingLabelProvider(FilteredTree filterTree) { super(new LabelProviderObjectGraph(filterTree), new ArchitecturalLabelDecorator()); }
@Override public void setPaletteRoot(PaletteRoot root) { super.setPaletteRoot(root); ((FilteredTree) getControl()).getViewer().setInput(getRootEditPart().getContents()); }
protected org.eclipse.jface.viewers.TreeViewer getTreeViewer() { final FilteredTree filteredTree = (FilteredTree) getControl(); return filteredTree.getViewer(); }
@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; }
/** * 创建包含过滤文本的 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); }
public FilteredTree getLogFilteredTree() { return logFilteredTree; }
/** * 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); }
/** * 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 the detail {@link TreeViewer}. * * @param parent * the parent {@link Composite} * @return the created detail {@link TreeViewer} */ protected TreeViewer createDetailViewer(Composite parent) { final FilteredTree treeViewer = new FilteredTree(parent, SWT.None, createDetailPatternFilter(), false); return treeViewer.getViewer(); }