Example usage for org.eclipse.jface.dialogs ProgressMonitorDialog run

List of usage examples for org.eclipse.jface.dialogs ProgressMonitorDialog run

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs ProgressMonitorDialog run.

Prototype

@Override
public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable)
        throws InvocationTargetException, InterruptedException 

Source Link

Document

This implementation of IRunnableContext#run(boolean, boolean, IRunnableWithProgress) runs the given IRunnableWithProgress using the progress monitor for this progress dialog and blocks until the runnable has been run, regardless of the value of fork.

Usage

From source file:be.ibridge.kettle.spoon.SpoonGraph.java

License:LGPL

/**
 * Display the input- or outputfields for a step.
 * // ww w . j  a  va 2 s.  c o m
 * @param stepMeta The step (it's metadata) to query
 * @param before set to true if you want to have the fields going INTO the step, false if you want to see all the
 * fields that exit the step.
 */
private void inputOutputFields(StepMeta stepMeta, boolean before) {
    spoon.refreshGraph();

    SearchFieldsProgressDialog op = new SearchFieldsProgressDialog(transMeta, stepMeta, before);
    try {
        final Thread parentThread = Thread.currentThread();
        final ProgressMonitorDialog pmd = new ProgressMonitorDialog(shell);

        // Run something in the background to cancel active database queries, forecably if needed!
        Runnable run = new Runnable() {
            public void run() {
                // This is running in a new process: copy some KettleVariables info
                LocalVariables.getInstance().createKettleVariables(Thread.currentThread().getName(),
                        parentThread.getName(), true);

                IProgressMonitor monitor = pmd.getProgressMonitor();
                while (pmd.getShell() == null || (!pmd.getShell().isDisposed() && !monitor.isCanceled())) {
                    try {
                        Thread.sleep(250);
                    } catch (InterruptedException e) {
                    }
                    ;
                }

                if (monitor.isCanceled()) // Disconnect and see what happens!
                {
                    try {
                        transMeta.cancelQueries();
                    } catch (Exception e) {
                    }
                    ;
                }
            }
        };
        // Dump the cancel looker in the background!
        new Thread(run).start();

        pmd.run(true, true, op);
    } catch (InvocationTargetException e) {
        new ErrorDialog(shell, Messages.getString("SpoonGraph.Dialog.GettingFields.Title"), //$NON-NLS-1$
                Messages.getString("SpoonGraph.Dialog.GettingFields.Message"), e); //$NON-NLS-1$
    } catch (InterruptedException e) {
        new ErrorDialog(shell, Messages.getString("SpoonGraph.Dialog.GettingFields.Title"), //$NON-NLS-1$
                Messages.getString("SpoonGraph.Dialog.GettingFields.Message"), e); //$NON-NLS-1$
    }

    Row fields = op.getFields();

    if (fields != null && fields.size() > 0) {
        StepFieldsDialog sfd = new StepFieldsDialog(shell, SWT.NONE, stepMeta.getName(), fields);
        String sn = (String) sfd.open();
        if (sn != null) {
            StepMeta esi = transMeta.findStep(sn);
            if (esi != null) {
                editStep(esi);
            }
        }
    } else {
        MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_INFORMATION);
        mb.setMessage(Messages.getString("SpoonGraph.Dialog.CouldntFindFields.Message")); //$NON-NLS-1$
        mb.setText(Messages.getString("SpoonGraph.Dialog.CouldntFindFields.Title")); //$NON-NLS-1$
        mb.open();
    }

}

From source file:br.ufmg.dcc.tabuleta.actions.LoadConcernModelAction.java

License:Open Source License

/**
 * Loads the concern model stored in the file wrapped in this object.
 * @see IActionDelegate#run(IAction)//from  w w w .j ava  2 s.  c  om
 * @param pAction the action proxy that handles the presentation portion of the
  *   action
 */
public void run(IAction pAction) {
    if (aFile == null) {
        return;
    }
    boolean lProceed = shouldProceed();
    if (!lProceed) {
        return;
    }

    ProgressMonitorDialog lProgressDialog = new ProgressMonitorDialog(
            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
    try {
        lProgressDialog.run(true, false, this);
    } catch (InvocationTargetException lException) {
        Throwable lCause = lException.getCause();
        if (lCause instanceof Exception) {
            ProblemManager.reportException((Exception) lCause);
        } else {
            ProblemManager.reportException(lException);
        }
    } catch (InterruptedException lException) {
        ProblemManager.reportException(lException);
    }
}

From source file:br.ufscar.sas.ui.handlers.UI.java

License:Open Source License

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {

    // get workbench window
    IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
    // set selection service
    ISelectionService service = window.getSelectionService();
    // set structured selection
    IStructuredSelection structured = (IStructuredSelection) service.getSelection();
    //Progress Monitor
    ProgressMonitorDialog dialog = new ProgressMonitorDialog(window.getShell());
    //Reset Perspective
    window.getActivePage().resetPerspective();

    try {/*from  ww  w .j a  v a  2s .  co  m*/
        dialog.run(true, true, new IRunnableWithProgress() {
            public void run(IProgressMonitor monitor) {
                //Creates KDM instance
                int totalUnitsOfWork = IProgressMonitor.UNKNOWN;
                monitor.beginTask("Performing Reverse Engineering....", totalUnitsOfWork);
                // Call Reverse Engineering
                String javaProjectName = "";
                String projectName = null;
                if (structured != null) {
                    if (structured.getFirstElement() instanceof IJavaProject) {
                        IJavaProject jProject = (IJavaProject) structured.getFirstElement();
                        projectName = jProject.getElementName();
                    }
                }

                javaProjectName = projectName;
                CreateKDM ck = new CreateKDM();
                ck.createKDMFile(javaProjectName);
                monitor.done();
                try {
                    refreshProjects();
                } catch (CoreException e) {
                    e.printStackTrace();
                }
            }
        });

        //Show main View
        window.getActivePage().showView("MainView");
        IWorkbenchPage ip = window.getActivePage();
        IViewPart myView = ip.findView("org.eclipse.jdt.ui.SourceView");
        ip.hideView(myView);
        myView = ip.findView("org.eclipse.jdt.ui.JavadocView");
        ip.hideView(myView);
        myView = ip.findView("org.eclipse.ui.views.ProblemView");
        ip.hideView(myView);
        myView = ip.findView("org.eclipse.mylyn.tasks.ui.views.tasks");
        ip.hideView(myView);
        myView = ip.findView("org.eclipse.ui.views.ContentOutline");
        ip.hideView(myView);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

From source file:ca.mcgill.cs.swevo.ppa.ui.actions.PPAOnCuAction.java

License:Open Source License

public void run(IAction action) {
    if (icu == null) {
        return;/*from  w w  w  . ja va2s .  c  om*/
    }

    try {
        MessageConsole mConsole = new MessageConsole("PPA Console", null);
        final PrintStream printer = new PrintStream(mConsole.newMessageStream());
        IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
        manager.addConsoles(new IConsole[] { mConsole });
        manager.showConsoleView(mConsole);

        ProgressMonitorDialog dialog = new ProgressMonitorDialog(
                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
        dialog.run(true, false, new IRunnableWithProgress() {

            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                try {
                    monitor.beginTask("Visiting AST", 100);
                    ASTNode node = PPAUtil.getCU((IFile) icu.getResource(), new PPAOptions());
                    monitor.worked(50);
                    node.accept(new NameBindingVisitor(printer, monitor));
                    printer.close();
                } catch (Exception e) {
                    e.printStackTrace();
                } finally {
                    monitor.done();
                }
            }
        });
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:ca.mcgill.cs.swevo.ppa.ui.actions.PPAOnFileAction.java

License:Open Source License

public void run(IAction action) {
    if (file == null) {
        return;/*from  w w w  .  j  a v a 2 s . c  o m*/
    }

    try {
        MessageConsole mConsole = new MessageConsole("PPA Console", null);
        final PrintStream printer = new PrintStream(mConsole.newMessageStream());
        IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
        manager.addConsoles(new IConsole[] { mConsole });
        manager.showConsoleView(mConsole);

        ProgressMonitorDialog dialog = new ProgressMonitorDialog(
                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
        dialog.run(true, false, new IRunnableWithProgress() {

            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                try {
                    monitor.beginTask("Visiting AST", 100);
                    CompilationUnit node = PPAUtil.getCU(file.getLocation().toFile(), new PPAOptions());
                    monitor.worked(50);
                    node.accept(new NameBindingVisitor(printer, monitor));
                    printer.close();
                    PPAUtil.cleanUp(node);
                } catch (Exception e) {
                    e.printStackTrace();
                } finally {
                    monitor.done();
                }
            }
        });

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:ca.mcgill.cs.swevo.ppa.ui.actions.PPAOnSnippetAction.java

License:Open Source License

public void run(IAction action) {
    if (file == null) {
        return;//  ww w.  j a va  2s.  c om
    }

    try {
        MessageConsole mConsole = new MessageConsole("PPA Console", null);
        final PrintStream printer = new PrintStream(mConsole.newMessageStream());
        IConsoleManager manager = ConsolePlugin.getDefault().getConsoleManager();
        manager.addConsoles(new IConsole[] { mConsole });
        manager.showConsoleView(mConsole);
        final boolean isTypeBody = action.getId().equals("ca.mcgill.cs.swevo.ppa.ui.performPPAOnTypeSnippet");
        ProgressMonitorDialog dialog = new ProgressMonitorDialog(
                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
        dialog.run(true, false, new IRunnableWithProgress() {

            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                try {
                    monitor.beginTask("Visiting AST", 100);
                    CompilationUnit node = (CompilationUnit) PPAUtil.getSnippet(file.getLocation().toFile(),
                            new PPAOptions(), isTypeBody);
                    monitor.worked(50);
                    node.accept(new NameBindingVisitor(printer, monitor));
                    printer.close();
                    PPAUtil.cleanUpSnippet();
                } catch (Exception e) {
                    e.printStackTrace();
                } finally {
                    monitor.done();
                }
            }
        });
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:ca.mcgill.cs.swevo.qualyzer.wizards.NewProjectWizard.java

License:Open Source License

@Override
public boolean performFinish() {
    fOne.save();/*from   w  w w  .ja  va2  s . c  om*/

    ProgressMonitorDialog dialog = new ProgressMonitorDialog(getShell());
    dialog.setOpenOnRun(true);
    dialog.create();
    dialog.getShell().setText(Messages.getString("wizards.NewProjectWizard.projectCreationStatus")); //$NON-NLS-1$
    try {
        dialog.run(true, false, new IRunnableWithProgress() {

            @Override
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                QualyzerActivator.getDefault().setCreatingProject(true);
                monitor.beginTask(Messages.getString("wizards.NewProjectWizard.creatingNewProject"), //$NON-NLS-1$
                        WORK);
                monitor.worked(1);
                monitor.worked(1);
                Project project = Facade.getInstance().createProject(fOne.getProjectName(),
                        fOne.getInvestigatorNickname(), fOne.getInvestigatorFullname(), fOne.getInstitution());
                monitor.worked(2);

                fProject = ResourcesPlugin.getWorkspace().getRoot().getProject(project.getFolderName());
                monitor.worked(1);
                monitor.done();
                QualyzerActivator.getDefault().setCreatingProject(false);
            }
        });
    } catch (InvocationTargetException e) {

    } catch (InterruptedException e) {

    } catch (QualyzerException e) {
        MessageDialog.openError(getShell(), Messages.getString("wizard.NewProjectWizard.projectError"), //$NON-NLS-1$
                e.getMessage());
        return false;
    }

    return fProject != null && fProject.exists();
}

From source file:ca.uvic.cs.tagsea.research.UserIDDialog.java

License:Open Source License

@Override
protected void okPressed() {
    ProgressMonitorDialog progress = new ProgressMonitorDialog(this.getParentShell());
    GetIDWithProgress getID = new GetIDWithProgress(composite.getFirstName(), composite.getLastName(),
            composite.getEmail(), composite.isAnonymous(), composite.getJob(), composite.getCompanySize(),
            composite.getCompany());//www .  ja  va2s  .c o m
    try {
        progress.run(false, true, getID);
    } catch (InvocationTargetException ex) {
        Exception e = (Exception) ex.getCause();
        if (e instanceof NoRouteToHostException || e instanceof UnknownHostException) {
            MessageDialog.openError(null, "Error Communicating", "There was an error getting a new user id. \n"
                    + "No network connection.  Please try again later");
        } else {
            MessageDialog.openError(null, "Error Communicating", "There was an error getting a new user id: \n"
                    + e.getClass().getCanonicalName() + e.getMessage());
            TagSEAPlugin.log("", e);
        }
        return;
    } catch (InterruptedException e) {
    }
    if (getID.success()) {
        composite.setIDText(getID.getUID());
        this.id = getID.getUID();
        finish.setEnabled(true);
        cancel.setEnabled(false);
        okay.setEnabled(false);
    } else {
        setReturnCode(ERROR);
    }
}

From source file:ch.elexis.actions.ReadOnceTreeLoader.java

License:Open Source License

@Override
public IStatus work(IProgressMonitor monitor, HashMap<String, Object> params) {
    Desk.asyncExec(new Runnable() {

        @Override/* w  w w  . ja va 2s.  c o  m*/
        public void run() {
            ProgressMonitorDialog dialog = new ProgressMonitorDialog(
                    cv.getViewerWidget().getControl().getShell());
            try {
                dialog.run(false, false, new IRunnableWithProgress() {

                    @Override
                    public void run(IProgressMonitor monitor)
                            throws InvocationTargetException, InterruptedException {
                        monitor.beginTask("Durchsuche Tarmed....", -1);
                        tv.refresh(false);
                        if (slp.isEmpty()) {
                            if (expanded != null) {
                                tv.setExpandedElements(expanded);
                                expanded = null;
                            }
                        } else {
                            if (expanded == null) {
                                expanded = tv.getExpandedElements();
                            }
                            tv.expandAll();
                        }
                        monitor.done();
                    }
                });
            } catch (InvocationTargetException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

        }
    });
    return Status.OK_STATUS;
}

From source file:ch.elexis.agenda.preferences.Tageseinteilung.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    Composite ret = new Composite(parent, SWT.NONE);
    ret.setLayout(new GridLayout());
    new Label(ret, SWT.None).setText(Messages.Tageseinteilung_enterPeriods);
    final Combo cbBereich = new Combo(ret, SWT.READ_ONLY | SWT.SINGLE);
    cbBereich.setItems(bereiche);// ww  w.ja  v a  2 s.com

    Composite grid = new Composite(ret, SWT.BORDER);
    grid.setLayout(new GridLayout(7, true));
    grid.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    new Label(grid, SWT.CENTER).setText(Messages.Tageseinteilung_mo);
    new Label(grid, SWT.CENTER).setText(Messages.Tageseinteilung_tu);
    new Label(grid, SWT.CENTER).setText(Messages.Tageseinteilung_we);
    new Label(grid, SWT.CENTER).setText(Messages.Tageseinteilung_th);
    new Label(grid, SWT.NONE).setText(Messages.Tageseinteilung_fr);
    new Label(grid, SWT.NONE).setText(Messages.Tageseinteilung_sa);
    new Label(grid, SWT.NONE).setText(Messages.Tageseinteilung_so);
    tMo = new Text(grid, SWT.BORDER | SWT.MULTI);
    tMo.setEnabled(false);
    tMo.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    originalBackgroundColor = tMo.getBackground();
    tDi = new Text(grid, SWT.BORDER | SWT.MULTI);
    tDi.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    tDi.setEnabled(false);
    tMi = new Text(grid, SWT.BORDER | SWT.MULTI);
    tMi.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    tMi.setEnabled(false);
    tDo = new Text(grid, SWT.BORDER | SWT.MULTI);
    tDo.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    tDo.setEnabled(false);
    tFr = new Text(grid, SWT.BORDER | SWT.MULTI);
    tFr.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    tFr.setEnabled(false);
    tSa = new Text(grid, SWT.BORDER | SWT.MULTI);
    tSa.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    tSa.setEnabled(false);
    tSo = new Text(grid, SWT.BORDER | SWT.MULTI);
    tSo.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
    tSo.setEnabled(false);
    cbBereich.select(actBereich);

    Composite editDayComposite = new Composite(grid, SWT.None);
    editDayComposite.setLayoutData(SWTHelper.getFillGridData(7, true, 1, false));
    editDayComposite.setLayout(new GridLayout(3, false));

    btnEditValuesFor = new Button(editDayComposite, SWT.NONE);
    btnEditValuesFor.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            StructuredSelection ss = (StructuredSelection) comboViewerDayEditSelector.getSelection();
            editSelection = (DAYS) ss.getFirstElement();
            if (editSelection == null)
                return;

            Text[] days = new Text[] { tMo, tDi, tMi, tDo, tFr, tSa, tSo };
            for (Text text : days) {
                text.setEnabled(false);
                text.setBackground(originalBackgroundColor);
            }

            switch (editSelection) {
            case MONDAY:
                editSelectionText = tMo;
                break;
            case TUESDAY:
                editSelectionText = tDi;
                break;
            case FRIDAY:
                editSelectionText = tFr;
                break;
            case SATURDAY:
                editSelectionText = tSa;
                break;
            case SUNDAY:
                editSelectionText = tSo;
                break;
            case THURSDAY:
                editSelectionText = tDo;
                break;
            case WEDNESDAY:
                editSelectionText = tMi;
                break;
            default:
                break;
            }
            editSelectionText.setEnabled(true);
            editSelectionText
                    .setBackground(PlatformUI.getWorkbench().getDisplay().getSystemColor(SWT.COLOR_YELLOW));
            btnApplyEdit.setEnabled(true);
            dateTimeStartingFrom.setEnabled(true);
            editSelectionText.setFocus();
        }
    });
    btnEditValuesFor.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    btnEditValuesFor.setText(Messages.Tageseinteilung_lblEditValuesFor_text);

    comboViewerDayEditSelector = new ComboViewer(editDayComposite, SWT.NONE);
    Combo comboDayEditSelector = comboViewerDayEditSelector.getCombo();
    comboDayEditSelector.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    compositeEditStarting = new Composite(editDayComposite, SWT.NONE);
    compositeEditStarting.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    GridLayout gl_compositeEditStarting = new GridLayout(3, false);
    gl_compositeEditStarting.verticalSpacing = 0;
    gl_compositeEditStarting.marginHeight = 0;
    compositeEditStarting.setLayout(gl_compositeEditStarting);

    lblChangedValuesAre = new Label(compositeEditStarting, SWT.NONE);
    lblChangedValuesAre.setText(Messages.Tageseinteilung_lblChangedValuesAre_text);

    dateTimeStartingFrom = new DateTime(compositeEditStarting, SWT.BORDER);
    TimeTool tomorrow = new TimeTool();
    tomorrow.addDays(1);
    dateTimeStartingFrom.setDate(tomorrow.get(TimeTool.YEAR), tomorrow.get(TimeTool.MONTH),
            tomorrow.get(TimeTool.DAY_OF_MONTH));
    dateTimeStartingFrom.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            setErrorMessage(null);
            DateTime dt = (DateTime) e.getSource();
            int day = dateTimeStartingFrom.getDay(); // Calendar.DAY_OF_MONTH
            int month = dateTimeStartingFrom.getMonth(); // Calendar.MONTH
            int year = dateTimeStartingFrom.getYear(); // Calendar.YEAR
            String timeString = String.format("%02d", day) + "." + String.format("%02d", month + 1) + "."
                    + String.format("%04d", year);
            TimeTool tt = new TimeTool(timeString);
            if (tt.isBefore(new TimeTool())) {
                setErrorMessage(Messages.Tageseinteilung_no_past_Date);
                TimeTool tomorrow = new TimeTool();
                tomorrow.addDays(1);
                dateTimeStartingFrom.setDate(tomorrow.get(TimeTool.YEAR), tomorrow.get(TimeTool.MONTH),
                        tomorrow.get(TimeTool.DAY_OF_MONTH));
            }
        }
    });
    dateTimeStartingFrom.setEnabled(false);

    btnApplyEdit = new Button(compositeEditStarting, SWT.NONE);
    btnApplyEdit.setText(Messages.Tageseinteilung_btnNewButton_text);
    btnApplyEdit.setEnabled(false);
    btnApplyEdit.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            // Apply the selected edits starting from the selected date
            int day = dateTimeStartingFrom.getDay(); // Calendar.DAY_OF_MONTH
            int month = dateTimeStartingFrom.getMonth(); // Calendar.MONTH
            int year = dateTimeStartingFrom.getYear(); // Calendar.YEAR
            String timeString = String.format("%02d", day) + "." + String.format("%02d", month + 1) + "."
                    + String.format("%04d", year);
            ProgressMonitorDialog pmd = new ProgressMonitorDialog(UiDesk.getTopShell());
            IRunnableWithProgress irp = new TermineLockedTimesUpdater(new TimeTool(timeString), editSelection,
                    editSelectionText.getText(), Termin.TerminBereiche[actBereich]);
            try {
                pmd.run(false, false, irp);
                editSelectionText.setBackground(originalBackgroundColor);
                editSelectionText.setEnabled(false);
            } catch (InvocationTargetException e1) {
                Status status = new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Execution Error", e1);
                StatusManager.getManager().handle(status, StatusManager.SHOW);
            } catch (InterruptedException e1) {
                Status status = new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Execution Error", e1);
                StatusManager.getManager().handle(status, StatusManager.SHOW);
            }

            dateTimeStartingFrom.setEnabled(false);
            btnApplyEdit.setEnabled(false);
        }
    });

    comboViewerDayEditSelector.setContentProvider(ArrayContentProvider.getInstance());
    comboViewerDayEditSelector.setLabelProvider(new LabelProvider() {
        @Override
        public String getText(Object element) {
            TimeTool.DAYS day = (TimeTool.DAYS) element;
            return day.fullName;
        }
    });
    TimeTool.DAYS[] days = TimeTool.DAYS.values();
    comboViewerDayEditSelector.setInput(days);
    comboViewerDayEditSelector.setSelection(new StructuredSelection(days[0]));

    compositeDayBorders = new Composite(ret, SWT.NONE);
    compositeDayBorders.setLayout(new GridLayout(2, false));

    Composite compositeStart = new Composite(compositeDayBorders, SWT.NONE);
    compositeStart.setLayout(new GridLayout(3, false));

    Label btnDayStartHourIsSet = new Label(compositeStart, SWT.CHECK);
    btnDayStartHourIsSet.setText(Messages.Tageseinteilung_btnCheckButton_text);

    sodt = new Text(compositeStart, SWT.BORDER);
    sodt.setTextLimit(4);

    Label lblHours = new Label(compositeStart, SWT.NONE);
    lblHours.setText(Messages.Tageseinteilung_lblHours_text);

    Composite compositeEnd = new Composite(compositeDayBorders, SWT.NONE);
    compositeEnd.setLayout(new GridLayout(3, false));

    Label btnEndStartHourIsSet = new Label(compositeEnd, SWT.CHECK);
    btnEndStartHourIsSet.setText(Messages.Tageseinteilung_btnCheckButton_text_1);

    eodt = new Text(compositeEnd, SWT.BORDER);
    eodt.setTextLimit(4);

    Label lblHours_1 = new Label(compositeEnd, SWT.NONE);
    lblHours_1.setText(Messages.Tageseinteilung_lblHours_1_text);

    reload();
    cbBereich.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            int idx = cbBereich.getSelectionIndex();
            if (idx != -1) {
                save();
                actBereich = idx;
                reload();
            }
        }

    });
    return ret;
}