List of usage examples for org.eclipse.jface.viewers StructuredSelection StructuredSelection
public StructuredSelection(List elements)
List
. From source file:ch.elexis.core.ui.views.KonsDetailView.java
License:Open Source License
/** * Aktuelle Konsultation setzen./*from w w w.j a va 2 s. com*/ */ private synchronized void setKons(final Konsultation kons) { if (actKons != null && text.isDirty()) { actKons.updateEintrag(text.getContentsAsXML(), false); } if (kons != null) { Fall act = kons.getFall(); setPatient(act.getPatient()); setKonsText(kons, kons.getHeadVersion()); comboFallSelectionListener.ignoreSelectionEventOnce(); comboViewerFall.setSelection(new StructuredSelection(act)); comboViewerFall.getCombo().setEnabled(act.isOpen()); Mandant m = kons.getMandant(); lBeh.setText(kons.getDatum() + " (" //$NON-NLS-1$ + new TimeTool(kons.getDatum()).getDurationToNowString() + ")"); //$NON-NLS-1$ StringBuilder sb = new StringBuilder(); if (m == null) { sb.append(Messages.KonsDetailView_NotYours); // $NON-NLS-1$ hlMandant.setBackground(hlMandant.getParent().getBackground()); } else { Rechnungssteller rs = m.getRechnungssteller(); if (rs.getId().equals(m.getId())) { sb.append("(").append(m.getLabel()).append(")"); //$NON-NLS-1$ //$NON-NLS-2$ } else { sb.append("(").append(m.getLabel()).append("/").append( //$NON-NLS-1$ //$NON-NLS-2$ rs.getLabel()).append(")"); //$NON-NLS-1$ } hlMandant.setBackground(UiMandant.getColorForMandator(m)); } hlMandant.setText(sb.toString()); boolean hlMandantEnabled = kons.isEditable(false) && CoreHub.acl.request(AccessControlDefaults.KONS_REASSIGN); hlMandant.setEnabled(hlMandantEnabled); dd.setDiagnosen(kons); vd.setLeistungen(kons); vd.setEnabled(true); dd.setEnabled(true); if (kons.isEditable(false)) { text.setEnabled(true); text.setToolTipText(""); lBeh.setForeground(UiDesk.getColor(UiDesk.COL_BLACK)); lBeh.setBackground(defaultBackground); } else { text.setToolTipText("Konsultation geschlossen oder nicht von Ihnen"); lBeh.setForeground(UiDesk.getColor(UiDesk.COL_GREY60)); lBeh.setBackground(UiDesk.getColor(UiDesk.COL_GREY20)); } if (isKonsToday(kons)) { text.setTextBackground(UiDesk.getColor(UiDesk.COL_WHITE)); } else { text.setTextBackground(UiDesk.getColorFromRGB("FAFAFA")); } } else { form.setText(NO_CONS_SELECTED); lBeh.setText("-"); //$NON-NLS-1$ hlMandant.setText("--"); //$NON-NLS-1$ hlMandant.setEnabled(false); hlMandant.setBackground(hlMandant.getParent().getBackground()); dd.clear(); vd.clear(); text.setText(""); //$NON-NLS-1$ text.setEnabled(false); vd.setEnabled(false); dd.setEnabled(false); } actKons = kons; cDesc.layout(); if (actKons == null) { setUnlocked(false); } else { setUnlocked(CoreHub.getLocalLockService().isLockedLocal(actKons)); } }
From source file:ch.elexis.core.ui.views.PatHeuteView.java
License:Open Source License
@Override public void createPartControl(final Composite parent) { parent.setLayout(new GridLayout()); this.parent = parent; makeActions();//from www .j ava 2 s . c o m ldFilter = new ListDisplay<IVerrechenbar>(parent, SWT.NONE, new ListDisplay.LDListener() { public String getLabel(final Object o) { return ((IVerrechenbar) o).getCode(); } public void hyperlinkActivated(final String l) { if (l.equals(LEISTUNG_HINZU)) { try { if (StringTool.isNothing(LeistungenView.ID)) { SWTHelper.alert(Messages.PatHeuteView_error, //$NON-NLS-1$ "LeistungenView.ID"); //$NON-NLS-1$ } getViewSite().getPage().showView(LeistungenView.ID); CodeSelectorHandler.getInstance().setCodeSelectorTarget(dropTarget); } catch (Exception ex) { ExHandler.handle(ex); } } else if (l.equals(STAT_LEEREN)) { ldFilter.clear(); } } }); ldFilter.addHyperlinks(LEISTUNG_HINZU, STAT_LEEREN); ldFilter.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); ((GridData) ldFilter.getLayoutData()).heightHint = 0; dropTarget = new PersistentObjectDropTarget("Statfilter", ldFilter, //$NON-NLS-1$ new DropReceiver()); Composite top = new Composite(parent, SWT.BORDER); top.setLayout(new RowLayout()); final DatePickerCombo dpc = new DatePickerCombo(top, SWT.BORDER); dpc.setDate(datVon.getTime()); dpc.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { datVon.setTimeInMillis(dpc.getDate().getTime()); } }); final DatePickerCombo dpb = new DatePickerCombo(top, SWT.BORDER); dpb.setDate(datBis.getTime()); dpb.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { datBis.setTimeInMillis(dpb.getDate().getTime()); } }); final Button bOpenKons = new Button(top, SWT.CHECK); bOpenKons.setText(Messages.PatHeuteView_open); //$NON-NLS-1$ bOpenKons.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { bOpen = bOpenKons.getSelection(); } }); final Button bClosedKons = new Button(top, SWT.CHECK); bClosedKons.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { bClosed = bClosedKons.getSelection(); } }); ComboViewer cAccountingSys = new ComboViewer(top, SWT.READ_ONLY); cAccountingSys.setContentProvider(ArrayContentProvider.getInstance()); cAccountingSys.setLabelProvider(new LabelProvider()); String allCases = Messages.PatHeuteView_all; List<String> faelle = Arrays.asList(Fall.getAbrechnungsSysteme()); List<String> accountingSys = new ArrayList<String>(); accountingSys.add(allCases); accountingSys.addAll(faelle); cAccountingSys.setInput(accountingSys); cAccountingSys.setSelection(new StructuredSelection(allCases)); cAccountingSys.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection selection = (IStructuredSelection) event.getSelection(); accountSys = (String) selection.getFirstElement(); // call reload if (kons != null) { kload.schedule(); } } }); bClosedKons.setText(Messages.PatHeuteView_billed); //$NON-NLS-1$ bOpenKons.setSelection(bOpen); bClosedKons.setSelection(bClosed); cv = new CommonViewer(); vc = new ViewerConfigurer(new DefaultContentProvider(cv, Patient.class) { @Override public Object[] getElements(final Object inputElement) { if (!CoreHub.acl.request(AccessControlDefaults.ACCOUNTING_STATS)) { return new Konsultation[0]; } if (kons == null) { kons = new Konsultation[0]; kload.schedule(); } return kons; } }, new DefaultLabelProvider() { @Override public String getText(final Object element) { if (element instanceof Konsultation) { Fall fall = ((Konsultation) element).getFall(); if (fall == null) { return Messages.PatHeuteView_noCase + ((Konsultation) element).getLabel(); //$NON-NLS-1$ } Patient pat = fall.getPatient(); return pat.getLabel(); } return super.getText(element); } }, null, new ViewerConfigurer.DefaultButtonProvider(), new SimpleWidgetProvider(SimpleWidgetProvider.TYPE_LIST, SWT.V_SCROLL, cv)); cv.create(vc, parent, SWT.BORDER, getViewSite()); form = tk.createForm(parent); form.setText(Messages.PatHeuteView_all); //$NON-NLS-1$ form.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); Composite bottom = form.getBody(); bottom.setLayout(new GridLayout(2, false)); tk.createLabel(bottom, Messages.PatHeuteView_consultations); //$NON-NLS-1$ tPat = tk.createText(bottom, "", SWT.BORDER); //$NON-NLS-1$ tPat.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); tPat.setEditable(false); tk.createLabel(bottom, Messages.PatHeuteView_accTime); //$NON-NLS-1$ tTime = tk.createText(bottom, "", SWT.BORDER); //$NON-NLS-1$ tTime.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); tTime.setEditable(false); tk.createLabel(bottom, Messages.PatHeuteView_accAmount); //$NON-NLS-1$ tMoney = tk.createText(bottom, "", SWT.BORDER); //$NON-NLS-1$ tMoney.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); tMoney.setEditable(false); // Group grpSel=new Group(parent,SWT.BORDER); // grpSel.setText("Markierte"); // grpSel.setLayoutData(SWTHelper.getFillGridData(1,true,1,true)); Form fSel = tk.createForm(parent); fSel.setText(Messages.PatHeuteView_marked); //$NON-NLS-1$ fSel.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); Composite cSel = fSel.getBody(); cSel.setLayout(new GridLayout(2, false)); tk.createLabel(cSel, Messages.PatHeuteView_accTime); //$NON-NLS-1$ tTime2 = tk.createText(cSel, "", SWT.BORDER); //$NON-NLS-1$ tTime2.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); tk.createLabel(cSel, Messages.PatHeuteView_accAmount); //$NON-NLS-1$ tMoney2 = tk.createText(cSel, "", SWT.BORDER); //$NON-NLS-1$ tMoney2.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); tTime2.setEditable(false); tMoney2.setEditable(false); ViewMenus menus = new ViewMenus(getViewSite()); menus.createMenu(printAction, reloadAction, statAction); menus.createToolbar(reloadAction, filterAction); // setFocus(); cv.getConfigurer().getContentProvider().startListening(); GlobalEventDispatcher.addActivationListener(this, this); kload.schedule(); cv.addDoubleClickListener(new DoubleClickListener() { @Override public void doubleClicked(PersistentObject obj, CommonViewer cv) { Konsultation k = (Konsultation) obj; ElexisEventDispatcher.fireSelectionEvent(k); ElexisEventDispatcher.fireSelectionEvent(k.getFall()); ElexisEventDispatcher.fireSelectionEvent(k.getFall().getPatient()); try { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() .showView(KonsDetailView.ID); } catch (PartInitException e) { ExHandler.handle(e); } } }); }
From source file:ch.elexis.core.ui.views.RezepteView.java
License:Open Source License
private void doSelectNewRezept(Rezept rezept) { tv.getTable().setFocus(); tv.setSelection(new StructuredSelection(rezept), true); }
From source file:ch.elexis.core.ui.wizards.DBConnectNewOrEditConnectionWizardPage.java
License:Open Source License
private void fillConnectionDetailFields(DBConnection dbConnection) { if (dbConnection.rdbmsType != null) { comboViewerDBType.setSelection(new StructuredSelection(dbConnection.rdbmsType)); } else {/*www . j av a 2 s. c o m*/ comboViewerDBType.setSelection(new StructuredSelection(DBType.MySQL)); } txtDBHost.setText(PersistentObject.checkNull(dbConnection.hostName)); txtDBName.setText(PersistentObject.checkNull(dbConnection.databaseName)); txtDBUsername.setText(PersistentObject.checkNull(dbConnection.username)); if (dbConnection.port != null) txtDBPort.setText(dbConnection.port); txtDBPassword.setText(PersistentObject.checkNull(dbConnection.password)); }
From source file:ch.elexis.core.ui.wizards.DBConnectSelectionConnectionWizardPage.java
License:Open Source License
private void setCurrentSelection() { if (getDBConnectWizard().getCurrentConnection() == null) return;/* ww w .j a v a 2 s .c om*/ cViewerConns.setSelection(new StructuredSelection(getDBConnectWizard().getCurrentConnection())); }
From source file:ch.elexis.data.TarmedImporter.java
License:Open Source License
@Override public Composite createPage(final Composite parent) { FileBasedImporter fis = new ImporterPage.FileBasedImporter(parent, this); fis.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); Composite updateIDsComposite = new Composite(fis, SWT.NONE); updateIDsComposite.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); updateIDsComposite.setLayout(new FormLayout()); Label lbl = new Label(updateIDsComposite, SWT.NONE); lbl.setText("Gesetz des Datensatz (relevant ab Tarmed 1.09)"); final ComboViewer lawCombo = new ComboViewer(updateIDsComposite, SWT.BORDER); lawCombo.setContentProvider(ArrayContentProvider.getInstance()); lawCombo.setInput(availableLaws);//from w w w .j a v a 2s. c o m lawCombo.setSelection(new StructuredSelection(selectedLaw)); lawCombo.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { StructuredSelection selection = (StructuredSelection) event.getSelection(); if (selection != null && !selection.isEmpty()) { selectedLaw = (String) selection.getFirstElement(); } else { selectedLaw = ""; } } }); FormData fd = new FormData(); fd.top = new FormAttachment(0, 5); fd.left = new FormAttachment(0, 0); lbl.setLayoutData(fd); fd = new FormData(); fd.top = new FormAttachment(0, 0); fd.left = new FormAttachment(lbl, 5); lawCombo.getCombo().setLayoutData(fd); lbl = new Label(updateIDsComposite, SWT.NONE); lbl.setText(Messages.TarmedImporter_updateOldIDEntries); final Button updateIDsBtn = new Button(updateIDsComposite, SWT.CHECK); fd = new FormData(); fd.top = new FormAttachment(lawCombo.getControl(), 5); fd.left = new FormAttachment(0, 0); lbl.setLayoutData(fd); fd = new FormData(); fd.top = new FormAttachment(lawCombo.getControl(), 5); fd.left = new FormAttachment(lbl, 5); updateIDsBtn.setLayoutData(fd); updateIDsBtn.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { updateIDs = updateIDsBtn.getSelection(); } @Override public void widgetDefaultSelected(SelectionEvent e) { updateIDs = updateIDsBtn.getSelection(); } }); return fis; }
From source file:ch.elexis.preferences.LabGroupPrefs.java
License:Open Source License
protected Control createContents(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); composite.setLayout(new GridLayout(1, false)); Label label;/*from w w w .j a v a 2 s . c om*/ GridLayout layout; Composite topArea = new Composite(composite, SWT.NONE); topArea.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); layout = new GridLayout(3, false); layout.verticalSpacing = 20; topArea.setLayout(layout); label = new Label(topArea, SWT.NONE); label.setText(Messages.LabGroupPrefs_ExplanationsLine1 + Messages.LabGroupPrefs_ExplanationsLine2 + Messages.LabGroupPrefs_ExplanationsLine3); label.setLayoutData(SWTHelper.getFillGridData(3, true, 1, false)); GridData gd; label = new Label(topArea, SWT.NONE); label.setText(Messages.LabGroupPrefs_group); gd = SWTHelper.getFillGridData(1, false, 1, false); gd.verticalAlignment = GridData.BEGINNING; label.setLayoutData(gd); groupsViewer = new ComboViewer(topArea, SWT.READ_ONLY); gd = SWTHelper.getFillGridData(1, true, 1, false); gd.verticalAlignment = GridData.BEGINNING; groupsViewer.getControl().setLayoutData(gd); groupsViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection sel = (IStructuredSelection) groupsViewer.getSelection(); Object element = sel.getFirstElement(); if (element instanceof LabGroup) { actGroup = (LabGroup) element; itemsViewer.refresh(); } updateButtonsState(); } }); groupsViewer.setContentProvider(new GroupsContentProvider()); groupsViewer.setLabelProvider(new DefaultLabelProvider()); groupsViewer.setInput(this); Composite groupButtonArea = new Composite(topArea, SWT.PUSH); layout = new GridLayout(1, false); layout.marginHeight = 0; groupButtonArea.setLayout(layout); newButton = new Button(groupButtonArea, SWT.PUSH); newButton.setText(Messages.LabGroupPrefs_new); newButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { InputDialog dialog = new InputDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), Messages.LabGroupPrefs_newLabGroup, Messages.LabGroupPrefs_selectNameForLabGroup, "", null); //$NON-NLS-1$ int rc = dialog.open(); if (rc == Window.OK) { String name = dialog.getValue(); LabGroup group = new LabGroup(name, null); groupsViewer.refresh(); groupsViewer.setSelection(new StructuredSelection(group)); } } public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } }); removeButton = new Button(groupButtonArea, SWT.PUSH); removeButton.setText(Messages.LabGroupPrefs_delete); removeButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { if (actGroup != null) { if (SWTHelper.askYesNo(Messages.LabGroupPrefs_deleteGroup, MessageFormat.format(Messages.LabGroupPrefs_reallyDeleteGroup, actGroup.getLabel()))) ; { actGroup.delete(); actGroup = null; groupsViewer.refresh(); itemsViewer.refresh(); selectFirstGroup(); } } } public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } }); Composite bottomArea = new Composite(composite, SWT.NONE); bottomArea.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); bottomArea.setLayout(new GridLayout(1, false)); label = new Label(bottomArea, SWT.NONE); label.setText(Messages.LabGroupPrefs_containingLabItems); itemsViewer = new ListViewer(bottomArea, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); itemsViewer.getControl().setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); itemsViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { updateItemButtonsState(); } }); itemsViewer.setContentProvider(new GroupItemsContentProvider()); itemsViewer.setLabelProvider(new ItemsLabelProvider()); itemsViewer.setInput(this); Composite buttonArea = new Composite(bottomArea, SWT.NONE); buttonArea.setLayoutData(SWTHelper.getFillGridData(1, false, 1, false)); buttonArea.setLayout(new GridLayout(2, true)); addItemButton = new Button(buttonArea, SWT.PUSH); addItemButton.setText(Messages.LabGroupPrefs_add); addItemButton.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); removeItemButton = new Button(buttonArea, SWT.PUSH); removeItemButton.setText(Messages.LabGroupPrefs_remove); removeItemButton.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); addItemButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { if (actGroup != null) { ItemsSelectionDialog dialog = new ItemsSelectionDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), actGroup); if (dialog.open() == ItemsSelectionDialog.OK) { itemsViewer.refresh(); } } } public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } }); removeItemButton.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { if (actGroup != null) { IStructuredSelection sel = (IStructuredSelection) itemsViewer.getSelection(); for (Object obj : sel.toList()) { if (obj instanceof LabItem) { LabItem item = (LabItem) obj; actGroup.removeItem(item); } } itemsViewer.refresh(); } } public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } }); selectFirstGroup(); return composite; }
From source file:ch.elexis.tarmedprefs.RechnungsPrefs.java
License:Open Source License
void setMandant(Mandant m) { actMandant = m;// ww w . jav a 2 s . c om tTreat.setText(actMandant.getLabel()); cvMandantType.setSelection(new StructuredSelection(TarmedLeistung.getMandantType(actMandant))); actBank = Kontakt.load(actMandant.getInfoString(ta.RNBANK)); if (actBank != null && actBank.isValid()) { tPost.setText(""); //$NON-NLS-1$ tBank.setText(actBank.getLabel()); } else { tPost.setText(actMandant.getInfoString(ta.ESRNUMBER)); tBank.setText(""); //$NON-NLS-1$ actBank = null; } bPost.setSelection(actBank == null); bBank.setSelection(actBank != null); bUseTC.setSelection(actMandant.getInfoString(PreferenceConstants.USETC).equals("1")); //$NON-NLS-1$ //bUseEDA.setSelection(actMandant.getInfoString(PreferenceConstants.USEEDA).equals("1")); //$NON-NLS-1$ //bWithImage.setSelection(actMandant.getInfoString(PreferenceConstants.TCWITHIMAGE).equals("1")); //$NON-NLS-1$ cbTC.setText(TarmedRequirements.getTCName(actMandant)); // actMandant.getInfoString(PreferenceConstants.TARMEDTC)); bBillsElec.setSelection( CoreHub.getUserSetting(actMandant).get(PreferenceConstants.BILL_ELECTRONICALLY, false)); responsible.setMandant(m); }
From source file:ch.elexis.tarmedprefs.ResponsibleComposite.java
License:Open Source License
private void updateViewer() { if (mandant != null) { Query<Mandant> qbe = new Query<Mandant>(Mandant.class); List<Mandant> input = qbe.execute(); input.add(0, noMandant);/*w ww . jav a2 s . co m*/ responsibleViewer.setInput(input); String responsibleId = (String) mandant.getInfoElement(TarmedRequirements.RESPONSIBLE_INFO_KEY); if (responsibleId != null && !responsibleId.isEmpty()) { Mandant responsible = Mandant.load(responsibleId); if (responsible != null && responsible.exists()) { responsibleViewer.setSelection(new StructuredSelection(responsible)); } } } else { responsibleViewer.setInput(Collections.EMPTY_LIST); } }
From source file:ch.elexis.views.BBSView.java
License:Open Source License
@Override public void createPartControl(Composite parent) { SashForm sash = new SashForm(parent, SWT.NONE); qbe = new Query<BBSEntry>(BBSEntry.class); loader = new LazyTreeLoader<BBSEntry>("BBS", qbe, "reference", new String[] { //$NON-NLS-1$ //$NON-NLS-2$ "datum", "time", "Thema" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ });//from ww w . j av a 2s . c o m headlines = new CommonViewer(); vc = new ViewerConfigurer(new TreeContentProvider(headlines, loader), new ViewerConfigurer.TreeLabelProvider(), new DefaultControlFieldProvider(headlines, new String[] { "Thema" //$NON-NLS-1$ }), new NewThread(), new SimpleWidgetProvider(SimpleWidgetProvider.TYPE_TREE, SWT.NONE, null)); headlines.create(vc, sash, SWT.NONE, getViewSite()); tk = Desk.getToolkit(); form = tk.createScrolledForm(sash); form.getBody().setLayout(new GridLayout(1, false)); form.setText(Messages.getString("BBSView.PleaseEnterSubject")); //$NON-NLS-1$ origin = tk.createLabel(form.getBody(), ""); //$NON-NLS-1$ GridData gd = new GridData(GridData.FILL_HORIZONTAL); origin.setLayoutData(gd); msg = tk.createFormText(form.getBody(), false); gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL | GridData.FILL_VERTICAL); msg.setLayoutData(gd); msg.setColor(Messages.getString("BBSView.rot"), Desk.getColor(Desk.COL_RED)); //$NON-NLS-1$ msg.setColor(Messages.getString("BBSView.gruen"), Desk.getColor(Desk.COL_GREEN)); //$NON-NLS-1$ msg.setColor(Messages.getString("BBSView.blau"), Desk.getColor(Desk.COL_BLUE)); //$NON-NLS-1$ input = tk.createText(form.getBody(), "", SWT.WRAP | SWT.MULTI | SWT.BORDER); //$NON-NLS-1$ gd = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL); input.setLayoutData(gd); Button send = tk.createButton(form.getBody(), Messages.getString("BBSView.DoSend"), SWT.PUSH); //$NON-NLS-1$ send.addSelectionListener(new SelectionAdapter() { @SuppressWarnings("unchecked") @Override public void widgetSelected(SelectionEvent e) { Object[] sel = headlines.getSelection(); if (sel == null || sel.length == 0) { return; } Tree item = (Tree) sel[0]; BBSEntry en = (BBSEntry) (item).contents; BBSEntry ne = new BBSEntry(en.getTopic(), Hub.actUser, en, input.getText()); Tree child = item.add(ne); ((TreeViewer) headlines.getViewerWidget()).add(sel[0], child); ((TreeViewer) headlines.getViewerWidget()).setSelection(new StructuredSelection(child), true); } }); headlines.getViewerWidget().addSelectionChangedListener(this); ((TreeContentProvider) headlines.getConfigurer().getContentProvider()).startListening(); setDisplay(); }