0

I have this selection dialog in eclipse that I implement, when I resize this dialog after a certain limit the vertical scrollbar diappears, I want to implement it similarly to how eclipse implements its "open type" dialog when you press ctrl+shift+T. However when I saw the code for the "open type" dialog, there was no cue from it that I could take for how they implement their scrollbar feature. Kindly help if anybody has any idea regarding this.

My code for the dialog area is

@Override
    protected Control createDialogArea(Composite parent) {
        initializeDialogUnits(parent);
        Composite comp = (Composite) super.createDialogArea(parent);
        String label = getMessage();
        if (label != null && label.trim().length() != 0) {
            Label labelComp = new Label(comp, SWT.BEGINNING);
            labelComp.setText(label);
        }
        label = getViewerLabel();
        if (label != null && label.trim().length() != 0) {
            Label viewerLabel = new Label(comp, SWT.BEGINNING);
            viewerLabel.setText(label);
        }
        createMessageArea(comp);
        StructuredViewer fViewer;
        fViewer = createViewer(comp);
        fViewer.setLabelProvider(getLabelProvider());
        fViewer.setContentProvider(getContentProvider());
        fViewer.setInput(getViewerInput());
        List<?> selectedElements = getInitialElementSelections();
        if (selectedElements != null && !selectedElements.isEmpty()) {
            fViewer.setSelection(new StructuredSelection(selectedElements));
        }
        addViewerListeners(fViewer);
        addCustomFooterControls(comp);
        Dialog.applyDialogFont(comp);
        String help = getHelpContextId();
        if (help != null) {
            PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, help);
        }
        return comp;
    }

thanks and regards

greg-449
  • 109,219
  • 232
  • 102
  • 145
HiteshJolly
  • 55
  • 1
  • 11
  • Don't understand what you want. The scroll bar disappears on Open Type when it is sized large enough. – greg-449 Nov 28 '13 at 07:52
  • Sorry, by re sizing I meant when we make smaller the Open Type dialog not maximize it. – HiteshJolly Nov 28 '13 at 11:48
  • Could anyone please comment on this..maybe try to answer this...I am stuck here. event the eclipse codebase doesnt help much – HiteshJolly Jan 14 '14 at 10:03
  • If you just want a scroll bar specify SWT.V_SCROLL when you create the viewer. Otherwise you need to explain more clearly what you want. – greg-449 Jan 14 '14 at 10:28
  • Hi, I can create a scrollbar..that is not a problem. The problem is that when I reduce the size of my dialog by using my mouse, after a particular point the scrollbars disappear for my dialog. But if you reduce the size of "Open Type" dialog by using your mouse on the borders, it never hides the scrollbars at any point. I want to achieve the same functionality. I have been going through the eclipse code base but there is nothing there as such that can help me with identifying how they have implemented this functionality. – HiteshJolly Jan 15 '14 at 11:49

1 Answers1

0

I found a solution to this problem, I used eclipse spy to determine what all layout was set in case of a open type dialog and I used the same layout data in case of my dialog. I gives me a similar result.

HiteshJolly
  • 55
  • 1
  • 11