Search in sources :

Example 1 with SearchControl

use of org.talend.camel.designer.ui.editor.dependencies.controls.SearchControl in project tesb-studio-se by Talend.

the class CamelDependenciesEditor method createPartControl.

@Override
public void createPartControl(Composite parent) {
    FormToolkit toolkit = new FormToolkit(parent.getDisplay());
    parent.setLayout(new GridLayout());
    //create search group, hide button and refresh button
    Composite toolsPanel = toolkit.createComposite(parent);
    toolsPanel.setLayout(new GridLayout(4, false));
    toolsPanel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    toolsPanel.setBackgroundMode(SWT.INHERIT_FORCE);
    toolkit.createLabel(toolsPanel, Messages.RouterDependenciesEditor_filterLabel);
    SearchControl searchComposite = new SearchControl(toolsPanel, SWT.NONE);
    searchComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    searchComposite.setActiveImage(CamelDesignerPlugin.getImage(CamelDesignerPlugin.HIGHLIGHT_REM_ICON));
    searchComposite.setDeactiveImage(CamelDesignerPlugin.getImage(CamelDesignerPlugin.GRAY_REM_ICON));
    Text filterText = searchComposite.getText();
    Button hideBuiltIn = toolkit.createButton(toolsPanel, Messages.RouterDependenciesEditor_hideBuiltInItems, SWT.CHECK);
    Button refreshBtn = toolkit.createButton(toolsPanel, null, SWT.PUSH);
    refreshBtn.setImage(CamelDesignerPlugin.getImage(CamelDesignerPlugin.REFRESH_ICON));
    refreshBtn.setToolTipText(Messages.RouterDependenciesEditor_refreshDependenciesTooltip);
    refreshBtn.setEnabled(!isReadOnly());
    // create data tables
    ScrolledComposite top = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    top.setLayoutData(new GridData(GridData.FILL_BOTH));
    SashForm mainForm = new SashForm(top, SWT.VERTICAL);
    manageRouteResourcePanel = createResourceTableViewer(mainForm, toolkit, Messages.CamelDependenciesEditor_Resources);
    SashForm topPart = new SashForm(mainForm, SWT.HORIZONTAL);
    importPackageViewer = createTableViewer(topPart, toolkit, Messages.RouterDependenciesEditor_importPackageSec, ManifestItem.IMPORT_PACKAGE);
    bundleClasspathViewer = createTableViewer(topPart, toolkit, Messages.RouterDependenciesEditor_classpathSec, ManifestItem.BUNDLE_CLASSPATH);
    SashForm centerPart = new SashForm(mainForm, SWT.HORIZONTAL);
    exportPackageViewer = createTableViewer(centerPart, toolkit, Messages.RouterDependenciesEditor_exportPackage, ManifestItem.EXPORT_PACKAGE);
    requireBundleViewer = createTableViewer(centerPart, toolkit, Messages.RouterDependenciesEditor_requireBundleSec, ManifestItem.REQUIRE_BUNDLE);
    top.setExpandHorizontal(true);
    top.setExpandVertical(true);
    top.setContent(mainForm);
    top.setMinSize(mainForm.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    //create status
    Composite statusComposite = toolkit.createComposite(parent);
    statusComposite.setLayout(new GridLayout(2, false));
    statusComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    statusLabel = toolkit.createLabel(statusComposite, null);
    statusLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    //		if (isReadOnly()) {
    //			statusLabel.setText(Messages.RouterDependenciesEditor_itemIsLockedByOther);
    //		}
    Label shortCuts = toolkit.createLabel(statusComposite, Messages.RouterDependenciesEditor_KeyBindingw, SWT.SHADOW_OUT);
    shortCuts.setEnabled(false);
    // add filter listener
    filterText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            final String filterString = ((Text) e.widget).getText().trim();
            importPackageViewer.setFilterString(filterString);
            requireBundleViewer.setFilterString(filterString);
            bundleClasspathViewer.setFilterString(filterString);
            exportPackageViewer.setFilterString(filterString);
            manageRouteResourcePanel.setFilterString(filterString);
        }
    });
    // add hide listener
    hideBuiltIn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            final boolean show = ((Button) e.widget).getSelection();
            importPackageViewer.setShowBuiltIn(!show);
            requireBundleViewer.setShowBuiltIn(!show);
            bundleClasspathViewer.setShowBuiltIn(!show);
            exportPackageViewer.setShowBuiltIn(!show);
            manageRouteResourcePanel.setShowBuiltIn(!show);
        }
    });
    refreshBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            //	          setDirty(false);
            updateInput();
        }
    });
}
Also used : FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) ModifyListener(org.eclipse.swt.events.ModifyListener) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) SashForm(org.eclipse.swt.custom.SashForm) GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) SearchControl(org.talend.camel.designer.ui.editor.dependencies.controls.SearchControl)

Aggregations

SashForm (org.eclipse.swt.custom.SashForm)1 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridData (org.eclipse.swt.layout.GridData)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 Text (org.eclipse.swt.widgets.Text)1 FormToolkit (org.eclipse.ui.forms.widgets.FormToolkit)1 SearchControl (org.talend.camel.designer.ui.editor.dependencies.controls.SearchControl)1