List of usage examples for org.eclipse.swt.custom ScrolledComposite setMinSize
public void setMinSize(Point size)
From source file:org.eclipse.swt.snippets.Snippet188.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setText("Snippet 188"); shell.setLayout(new GridLayout()); final ScrolledComposite sc = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); sc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); Composite c = new Composite(sc, SWT.NONE); c.setLayout(new GridLayout(10, true)); for (int i = 0; i < 300; i++) { Button b = new Button(c, SWT.PUSH); b.setText("Button " + i); }/*from ww w. j a v a 2s .c o m*/ sc.setContent(c); sc.setExpandHorizontal(true); sc.setExpandVertical(true); sc.setMinSize(c.computeSize(SWT.DEFAULT, SWT.DEFAULT)); sc.setShowFocusedControl(true); shell.setSize(300, 500); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:ScrollWidgetViewFocusIn.java
public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); Button b1 = new Button(shell, SWT.PUSH); b1.setText("top"); b1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); final ScrolledComposite sc = new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); sc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); Composite c = new Composite(sc, SWT.NONE); c.setLayout(new GridLayout(10, true)); for (int i = 0; i < 300; i++) { Button b = new Button(c, SWT.PUSH); b.setText("Button " + i); }/*from w w w .j a v a 2s. c o m*/ Button b2 = new Button(shell, SWT.PUSH); b2.setText("bottom"); b2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); sc.setContent(c); sc.setExpandHorizontal(true); sc.setExpandVertical(true); sc.setMinSize(c.computeSize(SWT.DEFAULT, SWT.DEFAULT)); Listener listener = new Listener() { public void handleEvent(Event e) { Control child = (Control) e.widget; Rectangle bounds = child.getBounds(); Rectangle area = sc.getClientArea(); Point origin = sc.getOrigin(); if (origin.x > bounds.x) origin.x = Math.max(0, bounds.x); if (origin.y > bounds.y) origin.y = Math.max(0, bounds.y); if (origin.x + area.width < bounds.x + bounds.width) origin.x = Math.max(0, bounds.x + bounds.width - area.width); if (origin.y + area.height < bounds.y + bounds.height) origin.y = Math.max(0, bounds.y + bounds.height - area.height); sc.setOrigin(origin); } }; Control[] controls = c.getChildren(); for (int i = 0; i < controls.length; i++) { controls[i].addListener(SWT.Activate, listener); } shell.setSize(300, 500); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
From source file:org.eclipse.swt.snippets.Snippet166.java
public static void main(String[] args) { Display display = new Display(); Image image1 = display.getSystemImage(SWT.ICON_WORKING); Image image2 = display.getSystemImage(SWT.ICON_QUESTION); Image image3 = display.getSystemImage(SWT.ICON_ERROR); Shell shell = new Shell(display); shell.setText("Snippet 166"); shell.setLayout(new FillLayout()); final ScrolledComposite scrollComposite = new ScrolledComposite(shell, SWT.V_SCROLL | SWT.BORDER); final Composite parent = new Composite(scrollComposite, SWT.NONE); for (int i = 0; i <= 50; i++) { Label label = new Label(parent, SWT.NONE); if (i % 3 == 0) label.setImage(image1);// w w w. jav a2s. c om if (i % 3 == 1) label.setImage(image2); if (i % 3 == 2) label.setImage(image3); } RowLayout layout = new RowLayout(SWT.HORIZONTAL); layout.wrap = true; parent.setLayout(layout); scrollComposite.setContent(parent); scrollComposite.setExpandVertical(true); scrollComposite.setExpandHorizontal(true); scrollComposite.addControlListener(ControlListener.controlResizedAdapter(e -> { Rectangle r = scrollComposite.getClientArea(); scrollComposite.setMinSize(parent.computeSize(r.width, SWT.DEFAULT)); })); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:ScrolledCompositeCreate.java
public static void main(String[] args) { Display display = new Display(); Image image1 = display.getSystemImage(SWT.ICON_WORKING); Image image2 = display.getSystemImage(SWT.ICON_QUESTION); Image image3 = display.getSystemImage(SWT.ICON_ERROR); Shell shell = new Shell(display); shell.setLayout(new FillLayout()); final ScrolledComposite scrollComposite = new ScrolledComposite(shell, SWT.V_SCROLL | SWT.BORDER); final Composite parent = new Composite(scrollComposite, SWT.NONE); for (int i = 0; i <= 50; i++) { Label label = new Label(parent, SWT.NONE); if (i % 3 == 0) label.setImage(image1);/*from ww w . ja v a 2s . com*/ if (i % 3 == 1) label.setImage(image2); if (i % 3 == 2) label.setImage(image3); } RowLayout layout = new RowLayout(SWT.HORIZONTAL); layout.wrap = true; parent.setLayout(layout); scrollComposite.setContent(parent); scrollComposite.setExpandVertical(true); scrollComposite.setExpandHorizontal(true); scrollComposite.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { Rectangle r = scrollComposite.getClientArea(); scrollComposite.setMinSize(parent.computeSize(r.width, SWT.DEFAULT)); } }); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); }
From source file:edu.isistan.carcha.plugin.editors.TraceabilityEditor.java
/** * Creates the impact list page./*from w w w . j a v a 2s .c o m*/ */ void impactListPage() { final Composite composite = new Composite(getContainer(), SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); composite.setLayout(new GridLayout()); Label concernLabel = new Label(composite, SWT.BORDER); concernLabel.setText("Crosccuting Concerns(CCC)"); concernLabel.setToolTipText("This are the concern detected on the requierement document."); GridData gridData = new GridData(SWT.LEFT, SWT.TOP, false, false); concernLabel.setLayoutData(gridData); ///////////////////// ScrolledComposite sc = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL); Composite parent = new Composite(sc, SWT.NONE); parent.setLayout(new GridLayout()); topViewLink = new TableViewer(parent, SWT.BORDER); createColumns(parent, topViewLink); final Table table = topViewLink.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); topViewLink.setContentProvider(new ArrayContentProvider()); getSite().setSelectionProvider(topViewLink); GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); data.heightHint = 10 * table.getItemHeight(); table.setLayoutData(data); sc.setContent(parent); sc.setExpandHorizontal(true); sc.setExpandVertical(true); sc.setMinSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT)); ///////////////////// Button button = new Button(composite, SWT.PUSH); button.setText("Remove"); button.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent event) { } public void widgetSelected(SelectionEvent event) { IStructuredSelection topSelection = (IStructuredSelection) topViewLink.getSelection(); IStructuredSelection bottomSelection = (IStructuredSelection) bottomViewLink.getSelection(); String[] crosscuttingConcern = (String[]) topSelection.getFirstElement(); String[] designDecision = (String[]) bottomSelection.getFirstElement(); if (topSelection.size() > 1) { MessageDialog.openError(composite.getShell(), "Error", "Please select one crosscutting concern"); } else { if ((crosscuttingConcern != null) && (designDecision != null)) { // create dialog with ok and cancel button and info icon MessageBox dialog = new MessageBox(composite.getShell(), SWT.ICON_QUESTION | SWT.OK | SWT.CANCEL); dialog.setText("Link confirmation"); dialog.setMessage("Do you want to remove the link between the selected items?"); // open dialog and await user selection int response = dialog.open(); if (response == SWT.OK) { PluginUtil.removeLink(crosscuttingConcern, designDecision, cp); dirty = true; firePropertyChange(IEditorPart.PROP_DIRTY); // update the list after the remove generateLinkViewData(); bottomViewLink.getTable().clearAll(); } } else { MessageDialog.openError(composite.getShell(), "Error", "Please select a crosscutting concern and a design decision to remove a traceability link"); } } } }); gridData = new GridData(SWT.CENTER, SWT.TOP, false, false, 2, 1); button.setLayoutData(gridData); Label ddsLabel = new Label(composite, SWT.BORDER); ddsLabel.setText("Architectural design decisions"); ddsLabel.setToolTipText("This are the design decisions detected on the architectural document"); gridData = new GridData(SWT.LEFT, SWT.TOP, false, false); ddsLabel.setLayoutData(gridData); bottomViewLink = new TableViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.BORDER); createColumns(composite, bottomViewLink); Table table2 = bottomViewLink.getTable(); table2.setHeaderVisible(true); table2.setLinesVisible(true); bottomViewLink.setContentProvider(new ArrayContentProvider()); topViewLink.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection selection = (IStructuredSelection) event.getSelection(); if (!selection.isEmpty()) { String[] cccs = (String[]) selection.getFirstElement(); List<DesignDecision> dds = PluginUtil.getDesignDecisionsForCrossCuttingConcern(cp, cccs[1], cccs[0]); logger.info("Impact List for CCC (" + dds.size() + " DDD): " + cccs[0] + " - " + cccs[1]); List<String[]> designDecisions = new ArrayList<String[]>(); for (DesignDecision dd : dds) { String[] designDecision = { dd.getKind(), dd.getName() }; designDecisions.add(designDecision); } bottomViewLink.setInput(designDecisions); } } }); getSite().setSelectionProvider(bottomViewLink); gridData = new GridData(SWT.FILL, SWT.FILL, true, true); bottomViewLink.getControl().setLayoutData(gridData); int index = addPage(composite); setPageText(index, "Links"); }
From source file:com.planetmayo.debrief.satc_rcp.views.MaintainContributionsView.java
private void initAnalystContributionsGroup(Composite parent) { GridData gridData = new GridData(); gridData.horizontalAlignment = SWT.FILL; gridData.verticalAlignment = SWT.FILL; gridData.grabExcessHorizontalSpace = true; gridData.grabExcessVerticalSpace = true; Group group = new Group(parent, SWT.SHADOW_ETCHED_IN); group.setLayout(new GridLayout(1, false)); group.setLayoutData(gridData);//www. j a v a 2s .co m group.setText("Analyst Contributions"); fillAnalystContributionsGroup(group); final ScrolledComposite scrolled = new ScrolledComposite(group, SWT.V_SCROLL | SWT.H_SCROLL); scrolled.setLayoutData(new GridData(GridData.FILL_BOTH)); contList = UIUtils.createScrolledBody(scrolled, SWT.NONE); contList.setLayout(new GridLayout(1, false)); scrolled.addListener(SWT.Resize, new Listener() { @Override public void handleEvent(Event e) { scrolled.setMinSize(contList.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } }); scrolled.setAlwaysShowScrollBars(true); scrolled.setContent(contList); scrolled.setMinSize(contList.computeSize(SWT.DEFAULT, SWT.DEFAULT)); scrolled.setExpandHorizontal(true); scrolled.setExpandVertical(true); }
From source file:com.planetmayo.debrief.satc_rcp.views.MaintainContributionsView.java
private void initPreferencesGroup(Composite parent) { GridData gridData = new GridData(); gridData.horizontalAlignment = SWT.FILL; gridData.grabExcessHorizontalSpace = true; Group group = new Group(parent, SWT.SHADOW_ETCHED_IN); GridLayout layout = new GridLayout(1, false); group.setLayoutData(gridData);//www . jav a2s . co m group.setLayout(layout); group.setText("Preferences"); final ScrolledComposite scrolled = new ScrolledComposite(group, SWT.H_SCROLL); scrolled.setLayoutData(new GridData(GridData.FILL_BOTH)); final Composite preferencesComposite = UIUtils.createScrolledBody(scrolled, SWT.NONE); preferencesComposite.setLayout(new GridLayout(6, false)); scrolled.addListener(SWT.Resize, new Listener() { @Override public void handleEvent(Event e) { scrolled.setMinSize(preferencesComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } }); scrolled.setAlwaysShowScrollBars(true); scrolled.setContent(preferencesComposite); scrolled.setMinSize(preferencesComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); scrolled.setExpandHorizontal(true); scrolled.setExpandVertical(true); liveConstraints = new Button(preferencesComposite, SWT.TOGGLE); liveConstraints.setText("Auto-Recalc of Constraints"); liveConstraints.setEnabled(false); liveConstraints .setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER)); recalculate = new Button(preferencesComposite, SWT.DEFAULT); recalculate.setText("Calculate Solution"); recalculate.setEnabled(false); recalculate.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (activeSolver != null) { // ok - make sure the performance tab is open graphTabs.setSelection(performanceTab); activeSolver.run(true, true); main.setSize(0, 0); main.getParent().layout(true, true); } } }); recalculate.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_CENTER)); cancelGeneration = new Button(preferencesComposite, SWT.PUSH); cancelGeneration.setText("Cancel"); cancelGeneration.setVisible(false); cancelGeneration.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (activeSolver != null) { activeSolver.cancel(); } } }); suppressCuts = new Button(preferencesComposite, SWT.CHECK); suppressCuts.setText("Suppress Cuts"); suppressCuts.setVisible(true); suppressCuts.setEnabled(false); suppressCuts.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (activeSolver != null) { boolean doSuppress = suppressCuts.getSelection(); activeSolver.setAutoSuppress(doSuppress); } } }); showOSCourse = new Button(preferencesComposite, SWT.CHECK); showOSCourse.setText("Plot O/S Course"); showOSCourse.setVisible(true); showOSCourse.setEnabled(false); showOSCourse.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (activeSolver != null) { redoOwnshipStates(); } } }); Composite precisionPanel = new Composite(preferencesComposite, SWT.NONE); precisionPanel.setLayoutData(new GridData( GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER)); GridLayout precisionLayout = new GridLayout(2, false); precisionLayout.horizontalSpacing = 5; precisionPanel.setLayout(precisionLayout); Label precisionLabel = new Label(precisionPanel, SWT.NONE); precisionLabel.setText("Precision:"); precisionLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_CENTER)); precisionsCombo = new ComboViewer(precisionPanel); precisionsCombo.getCombo().setEnabled(false); precisionsCombo.setContentProvider(new ArrayContentProvider()); precisionsCombo.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { return ((Precision) element).getLabel(); } }); precisionsCombo.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { ISelection sel = precisionsCombo.getSelection(); IStructuredSelection cSel = (IStructuredSelection) sel; Precision precision = (Precision) cSel.getFirstElement(); if (activeSolver != null) { activeSolver.setPrecision(precision); } } }); }
From source file:ClipboardExample.java
public void open(Display display) { clipboard = new Clipboard(display); shell = new Shell(display); shell.setText("SWT Clipboard"); shell.setLayout(new FillLayout()); ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL); Composite parent = new Composite(sc, SWT.NONE); sc.setContent(parent);//from w ww . j a v a 2 s. c o m parent.setLayout(new GridLayout(2, true)); Group copyGroup = new Group(parent, SWT.NONE); copyGroup.setText("Copy From:"); GridData data = new GridData(GridData.FILL_BOTH); copyGroup.setLayoutData(data); copyGroup.setLayout(new GridLayout(3, false)); Group pasteGroup = new Group(parent, SWT.NONE); pasteGroup.setText("Paste To:"); data = new GridData(GridData.FILL_BOTH); pasteGroup.setLayoutData(data); pasteGroup.setLayout(new GridLayout(3, false)); Group controlGroup = new Group(parent, SWT.NONE); controlGroup.setText("Control API:"); data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 2; controlGroup.setLayoutData(data); controlGroup.setLayout(new GridLayout(5, false)); Group typesGroup = new Group(parent, SWT.NONE); typesGroup.setText("Available Types"); data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 2; typesGroup.setLayoutData(data); typesGroup.setLayout(new GridLayout(2, false)); status = new Label(parent, SWT.BORDER); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; data.heightHint = 60; status.setLayoutData(data); createTextTransfer(copyGroup, pasteGroup); createRTFTransfer(copyGroup, pasteGroup); createHTMLTransfer(copyGroup, pasteGroup); createFileTransfer(copyGroup, pasteGroup); createMyTransfer(copyGroup, pasteGroup); createControlTransfer(controlGroup); createAvailableTypes(typesGroup); sc.setMinSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT)); sc.setExpandHorizontal(true); sc.setExpandVertical(true); Point size = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT); Rectangle monitorArea = shell.getMonitor().getClientArea(); shell.setSize(Math.min(size.x, monitorArea.width - 20), Math.min(size.y, monitorArea.height - 20)); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } clipboard.dispose(); }
From source file:org.eclipse.swt.examples.clipboard.ClipboardExample.java
public void open(Display display) { clipboard = new Clipboard(display); shell = new Shell(display); shell.setText("SWT Clipboard"); shell.setLayout(new FillLayout()); ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL); Composite parent = new Composite(sc, SWT.NONE); sc.setContent(parent);/*w w w . ja v a2 s . c o m*/ parent.setLayout(new GridLayout(2, true)); Group copyGroup = new Group(parent, SWT.NONE); copyGroup.setText("Copy From:"); GridData data = new GridData(GridData.FILL_BOTH); copyGroup.setLayoutData(data); copyGroup.setLayout(new GridLayout(3, false)); Group pasteGroup = new Group(parent, SWT.NONE); pasteGroup.setText("Paste To:"); data = new GridData(GridData.FILL_BOTH); pasteGroup.setLayoutData(data); pasteGroup.setLayout(new GridLayout(3, false)); Group controlGroup = new Group(parent, SWT.NONE); controlGroup.setText("Control API:"); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; controlGroup.setLayoutData(data); controlGroup.setLayout(new GridLayout(5, false)); Group typesGroup = new Group(parent, SWT.NONE); typesGroup.setText("Available Types"); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; typesGroup.setLayoutData(data); typesGroup.setLayout(new GridLayout(2, false)); status = new Label(parent, SWT.NONE); data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; status.setLayoutData(data); createTextTransfer(copyGroup, pasteGroup); createRTFTransfer(copyGroup, pasteGroup); createHTMLTransfer(copyGroup, pasteGroup); createFileTransfer(copyGroup, pasteGroup); createImageTransfer(copyGroup, pasteGroup); createMyTransfer(copyGroup, pasteGroup); createControlTransfer(controlGroup); createAvailableTypes(typesGroup); sc.setMinSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT)); sc.setExpandHorizontal(true); sc.setExpandVertical(true); Point size = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT); Rectangle monitorArea = shell.getMonitor().getClientArea(); shell.setSize(Math.min(size.x, monitorArea.width - 20), Math.min(size.y, monitorArea.height - 20)); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } clipboard.dispose(); }
From source file:org.eclipse.swt.examples.dnd.DNDExample.java
public void open(Display display) { Shell shell = new Shell(display); shell.setText("Drag and Drop Example"); shell.setLayout(new FillLayout()); itemImage = new Image(display, DNDExample.class.getResourceAsStream("openFolder.gif")); ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL); Composite parent = new Composite(sc, SWT.NONE); sc.setContent(parent);// ww w . j a va 2 s . co m parent.setLayout(new FormLayout()); Label dragLabel = new Label(parent, SWT.LEFT); dragLabel.setText("Drag Source:"); Group dragWidgetGroup = new Group(parent, SWT.NONE); dragWidgetGroup.setText("Widget"); createDragWidget(dragWidgetGroup); Composite cLeft = new Composite(parent, SWT.NONE); cLeft.setLayout(new GridLayout(2, false)); Group dragOperationsGroup = new Group(cLeft, SWT.NONE); dragOperationsGroup.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1)); dragOperationsGroup.setText("Allowed Operation(s):"); createDragOperations(dragOperationsGroup); Group dragTypesGroup = new Group(cLeft, SWT.NONE); dragTypesGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); dragTypesGroup.setText("Transfer Type(s):"); createDragTypes(dragTypesGroup); dragConsole = new Text(cLeft, SWT.READ_ONLY | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI); dragConsole.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); Menu menu = new Menu(shell, SWT.POP_UP); MenuItem item = new MenuItem(menu, SWT.PUSH); item.setText("Clear"); item.addSelectionListener(widgetSelectedAdapter(e -> dragConsole.setText(""))); item = new MenuItem(menu, SWT.CHECK); item.setText("Show Event detail"); item.addSelectionListener(widgetSelectedAdapter(e -> { MenuItem eItem = (MenuItem) e.widget; dragEventDetail = eItem.getSelection(); })); dragConsole.setMenu(menu); Label dropLabel = new Label(parent, SWT.LEFT); dropLabel.setText("Drop Target:"); Group dropWidgetGroup = new Group(parent, SWT.NONE); dropWidgetGroup.setText("Widget"); createDropWidget(dropWidgetGroup); Composite cRight = new Composite(parent, SWT.NONE); cRight.setLayout(new GridLayout(2, false)); Group dropOperationsGroup = new Group(cRight, SWT.NONE); dropOperationsGroup.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 2)); dropOperationsGroup.setText("Allowed Operation(s):"); createDropOperations(dropOperationsGroup); Group dropTypesGroup = new Group(cRight, SWT.NONE); dropTypesGroup.setText("Transfer Type(s):"); createDropTypes(dropTypesGroup); Group feedbackTypesGroup = new Group(cRight, SWT.NONE); feedbackTypesGroup.setText("Feedback Type(s):"); createFeedbackTypes(feedbackTypesGroup); dropConsole = new Text(cRight, SWT.READ_ONLY | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI); dropConsole.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); menu = new Menu(shell, SWT.POP_UP); item = new MenuItem(menu, SWT.PUSH); item.setText("Clear"); item.addSelectionListener(widgetSelectedAdapter(e -> dropConsole.setText(""))); item = new MenuItem(menu, SWT.CHECK); item.setText("Show Event detail"); item.addSelectionListener(widgetSelectedAdapter(e -> { MenuItem eItem = (MenuItem) e.widget; dropEventDetail = eItem.getSelection(); })); dropConsole.setMenu(menu); if (dragEnabled) createDragSource(); if (dropEnabled) createDropTarget(); int height = 200; FormData data = new FormData(); data.top = new FormAttachment(0, 10); data.left = new FormAttachment(0, 10); dragLabel.setLayoutData(data); data = new FormData(); data.top = new FormAttachment(dragLabel, 10); data.left = new FormAttachment(0, 10); data.right = new FormAttachment(50, -10); data.height = height; dragWidgetGroup.setLayoutData(data); data = new FormData(); data.top = new FormAttachment(dragWidgetGroup, 10); data.left = new FormAttachment(0, 10); data.right = new FormAttachment(50, -10); data.bottom = new FormAttachment(100, -10); cLeft.setLayoutData(data); data = new FormData(); data.top = new FormAttachment(0, 10); data.left = new FormAttachment(cLeft, 10); dropLabel.setLayoutData(data); data = new FormData(); data.top = new FormAttachment(dropLabel, 10); data.left = new FormAttachment(cLeft, 10); data.right = new FormAttachment(100, -10); data.height = height; dropWidgetGroup.setLayoutData(data); data = new FormData(); data.top = new FormAttachment(dropWidgetGroup, 10); data.left = new FormAttachment(cLeft, 10); data.right = new FormAttachment(100, -10); data.bottom = new FormAttachment(100, -10); cRight.setLayoutData(data); sc.setMinSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT)); sc.setExpandHorizontal(true); sc.setExpandVertical(true); Point size = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT); Rectangle monitorArea = shell.getMonitor().getClientArea(); shell.setSize(Math.min(size.x, monitorArea.width - 20), Math.min(size.y, monitorArea.height - 20)); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } itemImage.dispose(); }