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