private void createHeaderRegion()

in org.apache.ivyde.eclipse.resolvevisualizer/src/org/apache/ivyde/eclipse/resolvevisualizer/ResolveVisualizerForm.java [143:210]


    private void createHeaderRegion(ScrolledForm form) {
        Composite headClient = new Composite(form.getForm().getHead(), SWT.NULL);
        GridLayout glayout = new GridLayout();
        glayout.marginWidth = glayout.marginHeight = 0;
        glayout.numColumns = 3;
        headClient.setLayout(glayout);
        headClient.setBackgroundMode(SWT.INHERIT_DEFAULT);
        searchLabel = new Label(headClient, SWT.NONE);
        searchLabel.setText("Search:");
        searchBox = toolkit.createText(headClient, "");
        GridData data = new GridData();
        data.widthHint = 300;
        searchBox.setLayoutData(data);

        toolkit.paintBordersFor(headClient);
        form.setHeadClient(headClient);
        form.setText(HEADER_TEXT);
        enableSearchBox(false);

        form.getForm().addMessageHyperlinkListener(new HyperlinkAdapter() {
            @SuppressWarnings("unchecked")
            public void linkActivated(HyperlinkEvent e) {
                String title = e.getLabel();
                Object href = e.getHref();
                if (href instanceof IMessage[] && ((IMessage[]) href).length > 1) {
                    Point hl = ((Control) e.widget).toDisplay(0, 0);
                    hl.x += 10;
                    hl.y += 10;
                    final Shell shell = new Shell(ResolveVisualizerForm.this.form.getShell(), SWT.ON_TOP | SWT.TOOL);
                    shell.setImage(getImage(ResolveVisualizerForm.this.form.getMessageType()));
                    shell.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
                    shell.setBackgroundMode(SWT.INHERIT_DEFAULT);
                    GridLayout layout = new GridLayout();
                    layout.numColumns = 1;
                    layout.verticalSpacing = 0;
                    shell.setText(title);
                    shell.setLayout(layout);
                    Link link = new Link(shell, SWT.NONE);
                    link.setText("<A>close</A>");
                    GridData data = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
                    link.setLayoutData(data);
                    link.addSelectionListener(new SelectionAdapter() {
                        public void widgetSelected(SelectionEvent e) {
                            shell.close();
                        }
                    });
                    Group group = new Group(shell, SWT.NONE);
                    data = new GridData(SWT.LEFT, SWT.TOP, true, true);
                    group.setLayoutData(data);
                    group.setLayout(layout);
                    group.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
                    FormText text = toolkit.createFormText(group, true);
                    configureFormText(ResolveVisualizerForm.this.form.getForm(), text);
                    text.setText(createFormTextContent((IMessage[]) href), true, false);

                    shell.setLocation(hl);
                    shell.pack();
                    shell.open();
                } else if (href instanceof IMessage[]) {
                    IMessage oneMessage = ((IMessage[]) href)[0];
                    Set<IvyNodeElement> conflicts = (Set<IvyNodeElement>) oneMessage.getData();
                    if (conflicts != null) {
                        viewer.setSelection(new StructuredSelection(new ArrayList<>(conflicts)));
                    }
                }
            }
        });
    }