private void createSearchSection(Composite editorComposite, FormToolkit toolkit) { Section section = toolkit.createSection( editorComposite, ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); section.setText("Search"); section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); section.addExpansionListener( new IExpansionListener() { public void expansionStateChanging(ExpansionEvent e) { m_sform.reflow(true); } public void expansionStateChanged(ExpansionEvent e) { m_sform.reflow(true); } }); Composite sectionClient = toolkit.createComposite(section); section.setClient(sectionClient); GridLayout layout = new GridLayout(); layout.numColumns = 2; sectionClient.setLayout(layout); sectionClient.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label label_freeSearch = toolkit.createLabel(sectionClient, "Query", SWT.NONE); label_freeSearch.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_text_freeSearch = toolkit.createText(sectionClient, new String(), SWT.BORDER); m_text_freeSearch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); m_text_freeSearch.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { firePropertyChange(IEditorPart.PROP_DIRTY); } }); Label label_state = toolkit.createLabel(sectionClient, "State"); label_state.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_news_state = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_news_state.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); try { m_combo_news_state.setItems(FieldDataHelper.getStates()); } catch (Exception e1) { m_combo_news_state.setEnabled(false); label_state.setEnabled(false); } }
private void createQueryPreferencesSection(Composite editorComposite, FormToolkit toolkit) { Section section = toolkit.createSection( editorComposite, ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); section.setText("Query Preferences"); section.setLayout(new GridLayout()); section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); section.addExpansionListener( new IExpansionListener() { public void expansionStateChanging(ExpansionEvent e) { m_sform.reflow(true); } public void expansionStateChanged(ExpansionEvent e) { m_sform.reflow(true); } }); Composite sectionClient = toolkit.createComposite(section); section.setClient(sectionClient); GridLayout layout = new GridLayout(); layout.numColumns = 2; sectionClient.setLayout(layout); GridData gridData = new GridData(GridData.FILL_HORIZONTAL); String[] fielddata; // Market Label label_market = toolkit.createLabel(sectionClient, "Market"); label_market.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_market = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_market.setLayoutData(gridData); try { fielddata = FieldDataHelper.getMarkets(); if (fielddata.length == 0) { m_combo_market.setEnabled(false); label_market.setEnabled(false); } else { m_combo_market.setItems(fielddata); } } catch (Exception e1) { m_combo_market.setEnabled(false); label_market.setEnabled(false); } // Segment Label label_segment = toolkit.createLabel(sectionClient, "Segment"); label_segment.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_segment = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_segment.setLayoutData(gridData); try { fielddata = FieldDataHelper.getSegments(); if (fielddata.length == 0) { m_combo_segment.setEnabled(false); label_segment.setEnabled(false); } else { m_combo_segment.setItems(fielddata); } } catch (Exception e1) { m_combo_segment.setEnabled(false); label_segment.setEnabled(false); } // Maker Label label_maker = toolkit.createLabel(sectionClient, "Maker"); label_maker.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_maker = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_maker.setLayoutData(gridData); try { fielddata = FieldDataHelper.getMakers(); if (fielddata.length == 0) { m_combo_maker.setEnabled(false); label_maker.setEnabled(false); } else { m_combo_maker.setItems(fielddata); } } catch (Exception e1) { m_combo_maker.setEnabled(false); label_maker.setEnabled(false); } // Model Label label_model = toolkit.createLabel(sectionClient, "Model"); label_model.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_model = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_model.setLayoutData(gridData); try { fielddata = FieldDataHelper.getModels(); if (fielddata.length == 0) { m_combo_model.setEnabled(false); label_model.setEnabled(false); } else { m_combo_model.setItems(fielddata); } } catch (Exception e1) { m_combo_model.setEnabled(false); label_model.setEnabled(false); } // Concept Label label_concept = toolkit.createLabel(sectionClient, "Concept"); label_concept.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_concept = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_concept.setLayoutData(gridData); try { fielddata = FieldDataHelper.getConcepts(); if (fielddata.length == 0) { m_combo_concept.setEnabled(false); label_concept.setEnabled(false); } else { m_combo_concept.setItems(fielddata); } } catch (Exception e1) { m_combo_concept.setEnabled(false); label_concept.setEnabled(false); } // Technology Label label_technology = toolkit.createLabel(sectionClient, "Technology"); label_technology.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_technology = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_technology.setLayoutData(gridData); try { fielddata = FieldDataHelper.getTechnology(); if (fielddata.length == 0) { m_combo_technology.setEnabled(false); label_technology.setEnabled(false); } else { m_combo_technology.setItems(fielddata); } } catch (Exception e1) { m_combo_technology.setEnabled(false); label_technology.setEnabled(false); } // Date Label label_date_from = toolkit.createLabel(sectionClient, "Date (from)"); label_date_from.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_text_date_from = toolkit.createText(sectionClient, new String(), SWT.BORDER); m_text_date_from.setLayoutData(gridData); m_text_date_from.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { firePropertyChange(IEditorPart.PROP_DIRTY); } }); // TODO: Dates currently not supported label_date_from.setEnabled(false); m_text_date_from.setEnabled(false); Label label_date_to = toolkit.createLabel(sectionClient, "Date (to)"); label_date_to.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_text_date_to = toolkit.createText(sectionClient, new String(), SWT.BORDER); m_text_date_to.setLayoutData(gridData); m_text_date_to.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { firePropertyChange(IEditorPart.PROP_DIRTY); } }); // TODO: Dates currently not supported label_date_to.setEnabled(false); m_text_date_to.setEnabled(false); // Source Label label_source = toolkit.createLabel(sectionClient, "Source"); label_source.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_source = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_source.setLayoutData(gridData); try { fielddata = FieldDataHelper.getSources(); if (fielddata.length == 0) { m_combo_source.setEnabled(false); label_source.setEnabled(false); } else { m_combo_source.setItems(fielddata); } } catch (Exception e1) { m_combo_source.setEnabled(false); label_source.setEnabled(false); } // Language Label label_language = toolkit.createLabel(sectionClient, "Language"); label_language.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_language = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_language.setLayoutData(gridData); try { fielddata = FieldDataHelper.getLanguages(); if (fielddata.length == 0) { m_combo_language.setEnabled(false); label_language.setEnabled(false); } else { m_combo_language.setItems(fielddata); } } catch (Exception e1) { m_combo_language.setEnabled(false); label_language.setEnabled(false); } }