List of usage examples for org.eclipse.jface.viewers StructuredSelection isEmpty
@Override public boolean isEmpty()
From source file:ch.elexis.tarmedprefs.ResponsibleComposite.java
License:Open Source License
private void createContent() { setLayout(new GridLayout()); responsibleViewer = new ComboViewer(this); responsibleViewer.setContentProvider(new ArrayContentProvider()); responsibleViewer.getCombo().setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); responsibleViewer.addSelectionChangedListener(new ISelectionChangedListener() { @Override//from w w w. ja v a 2 s . c o m public void selectionChanged(SelectionChangedEvent event) { StructuredSelection selection = (StructuredSelection) responsibleViewer.getSelection(); if (selection != null && !selection.isEmpty()) { Mandant selected = (Mandant) selection.getFirstElement(); if (selected != noMandant) { mandant.setInfoElement(TarmedRequirements.RESPONSIBLE_INFO_KEY, selected.getId()); } else { mandant.setInfoElement(TarmedRequirements.RESPONSIBLE_INFO_KEY, ""); } } } }); responsibleViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof Mandant) { return ((Mandant) element).getLabel(); } return super.getText(element); } }); }
From source file:ch.elexis.views.TarmedDetailDialog.java
License:Open Source License
@Override protected Control createDialogArea(Composite parent) { TarmedLeistung tl = (TarmedLeistung) verrechnet.getVerrechenbar(); Composite ret = (Composite) super.createDialogArea(parent); ret.setLayout(new GridLayout(8, false)); Label lTitle = new Label(ret, SWT.WRAP); lTitle.setText(tl.getText());/*from www . j a v a 2 s . c om*/ lTitle.setLayoutData(SWTHelper.getFillGridData(8, true, 1, true)); double primaryScale = verrechnet.getPrimaryScaleFactor(); double secondaryScale = verrechnet.getSecondaryScaleFactor(); double tpAL = TarmedLeistung.getAL(verrechnet) / 100.0; double tpTL = TarmedLeistung.getTL(verrechnet) / 100.0; double tpw = verrechnet.getTPW(); Money mAL = new Money(tpAL * tpw * primaryScale * secondaryScale); Money mTL = new Money(tpTL * tpw * primaryScale * secondaryScale); double tpAll = Math.round((tpAL + tpTL) * 100.0) / 100.0; Money mAll = new Money(tpAll * tpw * primaryScale * secondaryScale); new Label(ret, SWT.NONE).setText("TP AL"); new Label(ret, SWT.NONE).setText(Double.toString(tpAL)); new Label(ret, SWT.NONE).setText(" x "); new Label(ret, SWT.NONE).setText("TP-Wert"); new Label(ret, SWT.NONE).setText(Double.toString(tpw)); new Label(ret, SWT.NONE).setText(" = "); new Label(ret, SWT.NONE).setText("CHF AL"); new Label(ret, SWT.NONE).setText(mAL.getAmountAsString()); new Label(ret, SWT.NONE).setText("TP TL"); new Label(ret, SWT.NONE).setText(Double.toString(tpTL)); new Label(ret, SWT.NONE).setText(" x "); new Label(ret, SWT.NONE).setText("TP-Wert"); new Label(ret, SWT.NONE).setText(Double.toString(tpw)); new Label(ret, SWT.NONE).setText(" = "); new Label(ret, SWT.NONE).setText("CHF TL"); new Label(ret, SWT.NONE).setText(mTL.getAmountAsString()); Label sep = new Label(ret, SWT.SEPARATOR | SWT.HORIZONTAL); sep.setLayoutData(SWTHelper.getFillGridData(8, true, 1, false)); new Label(ret, SWT.NONE).setText("TP "); new Label(ret, SWT.NONE).setText(Double.toString(tpAll)); new Label(ret, SWT.NONE).setText(" x "); new Label(ret, SWT.NONE).setText("TP-Wert"); new Label(ret, SWT.NONE).setText(Double.toString(tpw)); new Label(ret, SWT.NONE).setText(" = "); new Label(ret, SWT.NONE).setText("CHF "); new Label(ret, SWT.NONE).setText(mAll.getAmountAsString()); Label sep2 = new Label(ret, SWT.SEPARATOR | SWT.HORIZONTAL); sep2.setLayoutData(SWTHelper.getFillGridData(8, true, 1, false)); String mins = Integer.toString(tl.getMinutes()); new Label(ret, SWT.NONE).setText("Zeit:"); new Label(ret, SWT.NONE).setText(mins + " min."); new Label(ret, SWT.NONE).setText("Seite"); cSide = new Combo(ret, SWT.SINGLE); cSide.setItems(new String[] { "egal", "links", "rechts" }); new Label(ret, SWT.NONE).setText("Pflichtleist."); bPflicht = new Button(ret, SWT.CHECK); String sPflicht = verrechnet.getDetail(TarmedLeistung.PFLICHTLEISTUNG); if ((sPflicht == null) || (Boolean.parseBoolean(sPflicht))) { bPflicht.setSelection(true); } String side = verrechnet.getDetail(TarmedLeistung.SIDE); if (side == null) { cSide.select(0); } else if (side.equalsIgnoreCase("l")) { cSide.select(1); } else { cSide.select(2); } if (tl.getServiceTyp().equals("Z") || tl.getServiceTyp().equals("R") || tl.getServiceTyp().equals("B")) { new Label(ret, SWT.NONE); new Label(ret, SWT.NONE); new Label(ret, SWT.NONE).setText("Bezug"); cBezug = new ComboViewer(ret, SWT.BORDER); cBezug.setContentProvider(ArrayContentProvider.getInstance()); cBezug.setLabelProvider(new LabelProvider()); List<BezugComboItem> input = new ArrayList<>(); input.add(BezugComboItem.noBezug()); for (Verrechnet kVerr : verrechnet.getKons().getLeistungen()) { if (!kVerr.getCode().equals(tl.getCode())) { input.add(BezugComboItem.of(kVerr.getCode())); } } cBezug.setInput(input); String bezug = verrechnet.getDetail("Bezug"); if (bezug != null) { cBezug.setSelection(new StructuredSelection(BezugComboItem.of(bezug)), true); } else { cBezug.setSelection(new StructuredSelection(BezugComboItem.noBezug()), true); } cBezug.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { StructuredSelection selection = (StructuredSelection) cBezug.getSelection(); if (selection != null && !selection.isEmpty()) { BezugComboItem selected = (BezugComboItem) selection.getFirstElement(); if (selected.isNoBezug) { verrechnet.setDetail("Bezug", ""); } else { verrechnet.setDetail("Bezug", selected.getCode()); } } } }); } ret.pack(); return ret; }
From source file:ch.medshare.elexis.directories.views.WeisseSeitenSearchView.java
License:Open Source License
@SuppressWarnings("unchecked") private void openPatientenDialog() { final StructuredSelection selection = (StructuredSelection) kontakteTableViewer.getSelection(); if (!selection.isEmpty()) { Iterator<KontaktEntry> iterator = selection.iterator(); while (iterator.hasNext()) { final KontaktEntry selectedKontakt = iterator.next(); searchForm.openPatientenDialog(selectedKontakt); }/* w w w . j a va 2s .co m*/ } }
From source file:ch.medshare.elexis.directories.views.WeisseSeitenSearchView.java
License:Open Source License
@SuppressWarnings("unchecked") private void openKontaktDialog() { final StructuredSelection selection = (StructuredSelection) kontakteTableViewer.getSelection(); if (!selection.isEmpty()) { Iterator<KontaktEntry> iterator = selection.iterator(); while (iterator.hasNext()) { final KontaktEntry selectedKontakt = iterator.next(); searchForm.openKontaktDialog(selectedKontakt); }/*from ww w . j a va2 s . c o m*/ } }
From source file:ch.opentrainingcenter.client.views.dialoge.SearchDialog.java
License:Open Source License
private void updateButton() { final StructuredSelection selection = (StructuredSelection) viewer.getSelection(); getButton(Dialog.OK).setEnabled(!selection.isEmpty()); }
From source file:com.alibaba.antx.config.gui.dialog.SettingsDialog.java
License:Open Source License
private void remove() { StructuredSelection selection = (StructuredSelection) filesViewer.getSelection(); if (!selection.isEmpty()) { File nextFile = removeAndGetNext(files, (File) selection.getFirstElement()); filesViewer.refresh();/*from ww w . j a va 2 s . com*/ updateCommandLine(); if (nextFile != null) { filesViewer.setSelection(new StructuredSelection(nextFile)); } } }
From source file:com.alibaba.antx.config.gui.dialog.SettingsDialog.java
License:Open Source License
private File getCurrentDir() { StructuredSelection selection = (StructuredSelection) filesViewer.getSelection(); File dir = null;//from w ww .j a v a 2 s . c om if (!selection.isEmpty()) { File file = (File) selection.getFirstElement(); File parent = file.getParentFile(); if (parent != null) { dir = parent.getAbsoluteFile(); // ? } else if (file.isDirectory()) { dir = file.getAbsoluteFile(); // ? } } if (dir == null) { dir = new File("").getAbsoluteFile(); // ? } return dir; }
From source file:com.aptana.editor.common.internal.scripting.TemplateSelectionPage.java
License:Open Source License
public void selectionChanged(SelectionChangedEvent event) { StructuredSelection selection = (StructuredSelection) event.getSelection(); if (!selection.isEmpty()) { setPreviewContent(((TemplateElement) selection.getFirstElement())); } else {/* w ww . j a va 2 s . c o m*/ setPreviewContent(null); } }
From source file:com.aptana.ide.core.ui.preferences.ProjectNaturesPage.java
License:Open Source License
private void updateButtons() { StructuredSelection selection = (StructuredSelection) listViewer.getSelection(); makePrimaryButton.setEnabled(!selection.isEmpty() && !isPrimary(selection.getFirstElement())); restoreButton.setEnabled(modified || isPrimaryModified()); }
From source file:com.aptana.ide.server.ui.generic.dialogs.ServerTypeSelectionDialog.java
License:Open Source License
private IServerType calcResult() { StructuredSelection ss = (StructuredSelection) viewer.getSelection(); if (!ss.isEmpty()) { return (IServerType) ss.getFirstElement(); } else {/* www . j a v a 2s . c o m*/ return null; } }