+ Composite body = form.getBody();
+ body.setLayout(layout);
+
+ // Add the filter section
+ createFilterPart(body);
+ // Add the table
+ createTableViewer(body);
+
+ // Add a listener to enable custom resize process
+ form.addControlListener(new ControlListener() {
+ public void controlResized(ControlEvent e) {
+ refreshLayout();
+ }
+
+ public void controlMoved(ControlEvent e) {
+ }
+ });
+
+ // This below doesn not work; the listener must be added as a control
+ // listener to be correctly notified when resize events happen
+
+ // form.addListener(SWT.RESIZE, new Listener() {
+ // public void handleEvent(Event event) {
+ // log.debug("Form resized ....");
+ // }
+ // });
+
+ }
+
+ private void createFilterPart(Composite parent) {
+ header = tk.createComposite(parent);
+ GridLayout layout = new GridLayout(2, false);
+ header.setLayout(layout);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, false, false);
+ header.setLayoutData(gd);
+
+ // Artifact Name
+ tk.createLabel(header, "Artifact name: ", SWT.NONE);
+ artifactTxt = tk.createText(header, "", SWT.BORDER | SWT.SINGLE);
+ gd = new GridData(SWT.FILL, SWT.FILL, false, false);
+ gd.grabExcessHorizontalSpace = true;
+ artifactTxt.setLayoutData(gd);
+ artifactTxt.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent event) {
+ refreshFilteredList();
+ }
+ });
+
+ headerSection = tk.createSection(header, Section.TWISTIE);
+ headerSection.setText("Advanced filters");
+ headerSection.setExpanded(false);
+ gd = new GridData(SWT.FILL, SWT.FILL, false, false);
+ gd.horizontalSpan = 2;
+ headerSection.setLayoutData(gd);
+
+ Composite body = new Composite(headerSection, SWT.FILL);
+ headerSection.setClient(body);
+
+ // Layout
+ layout = new GridLayout(2, false);
+ body.setLayout(layout);
+
+ // Artifact Name
+ tk.createLabel(body, "Add some more filters here ", SWT.NONE);
+ // lbl = tk.createLabel(body, "Artifact name: ", SWT.NONE);
+ // artifactTxt = tk.createText(body, "", SWT.BORDER | SWT.SINGLE);
+ // gd = new GridData(SWT.FILL, SWT.FILL, false, false);
+ // gd.grabExcessHorizontalSpace = true;
+ // artifactTxt.setLayoutData(gd);
+ // artifactTxt.addModifyListener(new ModifyListener() {
+ //
+ // public void modifyText(ModifyEvent event) {
+ // refreshFilteredList();
+ // }
+ // });
+ }
+
+ private void refreshFilteredList() {
+ viewer.refresh();
+ }
+
+ private void createTableViewer(Composite parent) {