Example usage for org.eclipse.jface.viewers StructuredSelection StructuredSelection

List of usage examples for org.eclipse.jface.viewers StructuredSelection StructuredSelection

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers StructuredSelection StructuredSelection.

Prototype

public StructuredSelection(List elements) 

Source Link

Document

Creates a structured selection from the given List.

Usage

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  w w w. j  a  v  a  2s.com
    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.gpb.elexis.cst.view.CstProfileEditor.java

License:Open Source License

private void loadProfileData() {
    Mandant m = CoreHub.actMandant;//from  w w  w  .  java2  s . com
    log.info("load CST Profiles for mandant: " + m.getId() + " " + m.getName(), Log.INFOS);
    log.info("and patient: " + patient.getId() + " " + patient.getName(), Log.INFOS);

    cstProfiles = CstProfile.getCstGroups(patient, m.getId());

    tableViewerProfiles.refresh();

    if (!cstProfiles.isEmpty()) {
        tableViewerProfiles.setSelection(new StructuredSelection(tableViewerProfiles.getElementAt(0)), true);

    } else {
        therapieComposite.clear();
        docComposite.clear();
        cstGroups.clear();
        gastroComposite.clear();
        aoComposite.initDates();
    }

    if (tableViewerProfiles != null) {

        tableViewerProfiles.refresh();
        tableProfile.setFocus();
    }
    if (tableViewerCstGroups != null) {
        tableViewerCstGroups.refresh();
    }
}

From source file:ch.gpb.elexis.cst.view.CstProfileEditor.java

License:Open Source License

private void selectFirstRow() {
    if (tableViewerProfiles != null) {
        Object obj = tableViewerProfiles.getElementAt(0);
        if (!cstProfiles.isEmpty() && obj != null) {
            tableViewerProfiles.setSelection(new StructuredSelection(tableViewerProfiles.getElementAt(0)),
                    true);// w w w.j av a  2  s . c o m
        }
    }
}

From source file:ch.gpb.elexis.cst.view.CstProfileEditor.java

License:Open Source License

private void selectRow(int row) {
    if (tableViewerProfiles != null) {
        Object obj = tableViewerProfiles.getElementAt(row);
        if (!cstProfiles.isEmpty() && obj != null) {
            tableViewerProfiles.setSelection(new StructuredSelection(tableViewerProfiles.getElementAt(row)),
                    true);/*  w  w  w . ja  va 2 s.  c  o m*/
        }
    }
}

From source file:ch.gpb.elexis.cst.view.CstThemenblockEditor.java

License:Open Source License

private void selectFirstRow() {
    if (tableViewerCstGroup != null) {
        Object obj = tableViewerCstGroup.getElementAt(0);
        if (!cstGroups.isEmpty() && obj != null) {
            tableViewerCstGroup.setSelection(new StructuredSelection(tableViewerCstGroup.getElementAt(0)),
                    true);/*from ww  w .j  a  va2  s . co m*/
        }
    }
}

From source file:ch.gpb.elexis.cst.view.CstThemenblockEditor.java

License:Open Source License

private void selectRow(int row) {
    if (tableViewerCstGroup != null) {
        Object obj = tableViewerCstGroup.getElementAt(row);
        if (!cstGroups.isEmpty() && obj != null) {
            tableViewerCstGroup.setSelection(new StructuredSelection(tableViewerCstGroup.getElementAt(row)),
                    true);//from  w ww  . j  av  a 2 s  .c o  m
        }
    }
}

From source file:ch.hsr.ifs.cutelauncher.ui.TestViewer.java

License:Open Source License

public void selectNextFailure() {
    if (getSession().hasErrorOrFailure()) {
        Object firstElement = getSelectedElement();
        if (firstElement instanceof TestCase) {
            TestCase tCase = (TestCase) firstElement;
            treeViewer.setSelection(new StructuredSelection(findNextFailure(tCase)), true);
        } else {//from   ww w  .  j av a2s.c om
            treeViewer.setSelection(new StructuredSelection(findFirstFailure()));
        }

    }
}

From source file:ch.hsr.ifs.cutelauncher.ui.TestViewer.java

License:Open Source License

public void selectFirstFailure() {
    treeViewer.setSelection(new StructuredSelection(findFirstFailure()), true);
}

From source file:ch.hsr.ifs.cutelauncher.ui.TestViewer.java

License:Open Source License

public void selectPrevFailure() {
    if (getSession().hasErrorOrFailure()) {
        Object firstElement = getSelectedElement();
        if (firstElement instanceof TestCase) {
            TestCase tCase = (TestCase) firstElement;
            treeViewer.setSelection(new StructuredSelection(findPrevFailure(tCase)), true);
        } else { //show first Failure
            treeViewer.setSelection(new StructuredSelection(findFirstFailure()), true);
        }//  w  w  w  .  j  a  va  2 s  .  c  o  m
    }
}

From source file:ch.itemis.xdocker.ui.view.XdockerImageBrowserView.java

License:Open Source License

protected void openLaunchConfigurationDialog() {
    String image = getSelectedImage();
    if (isEmpty(image))
        return;//from w w w. j  a v a  2  s .co m
    Shell shell = Display.getDefault().getActiveShell();
    ILaunchConfiguration config = findLaunchConfig(image);
    if (config == null) {
        config = new XdockerRunLaunchConfigData(image, null, null, null, null, null, null, null, null, null,
                null, null, null).createConfiguration();
    }
    LaunchConfigurationDialog dialog = new LaunchConfigurationDialog(shell, config, getLaunchGroup());
    dialog.setInitialSelection(new StructuredSelection(config));
    dialog.setOpenMode(LaunchConfigurationDialog.LAUNCH_CONFIGURATION_DIALOG_OPEN_ON_SELECTION);
    dialog.setDefaultsOnOpen(true);
    dialog.open();
}