List of usage examples for org.eclipse.jface.dialogs PopupDialog POPUP_HORIZONTALSPACING
int POPUP_HORIZONTALSPACING
To view the source code for org.eclipse.jface.dialogs PopupDialog POPUP_HORIZONTALSPACING.
Click Source Link
From source file:com.boothen.jsonedit.quickoutline.QuickOutlinePopup.java
License:Open Source License
@Override protected void createContent(Composite parent) { parent.setLayout(GridLayoutFactory.fillDefaults() .margins(PopupDialog.POPUP_MARGINWIDTH, PopupDialog.POPUP_MARGINHEIGHT) .spacing(PopupDialog.POPUP_HORIZONTALSPACING, PopupDialog.POPUP_VERTICALSPACING).create()); filterText = createFilterText(parent); final NamePatternFilter namePatternFilter = new NamePatternFilter(labelProvider); // use unstyled text filterText.addModifyListener(new ModifyListener() { @Override/*from w w w .j a v a 2 s . c om*/ public void modifyText(ModifyEvent e) { String text = ((Text) e.widget).getText(); pattern = Pattern.compile(text, Pattern.CASE_INSENSITIVE); namePatternFilter.setPattern(pattern); stringMatcherUpdated(); } }); Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL); separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); createTreeViewer(parent); treeViewer.addFilter(namePatternFilter); }
From source file:com.liferay.ide.project.ui.upgrade.animated.InitConfigureProjectPage.java
License:Open Source License
@Override public void createSpecialDescriptor(Composite parent, int style) { Composite fillLayoutComposite = SWTUtil.createComposite(parent, 2, 2, GridData.FILL_HORIZONTAL); final String descriptor = "The initial step will be to upgrade to Liferay Workspace or Liferay Plugins SDK 7.0. " + "For more details, please see <a>dev.liferay.com</a>."; String url = "https://dev.liferay.com/develop/tutorials"; SWTUtil.createHyperLink(fillLayoutComposite, SWT.WRAP, descriptor, 1, url); final String extensionDec = "The first step will help you convert a Liferay Plugins SDK 6.2 to Liferay Plugins SDK 7.0 or to Liferay Workspace.\n" + "Click the \"import\" button to import your project into Eclipse workspace" + "(this process maybe need 5-10 mins for bundle init).\n" + "Note:\n" + " In order to save time, downloading 7.0 ivy cache locally could be a good choice to upgrade to liferay plugins sdk 7. \n" + " Theme and ext projects will be ignored for that we do not support to upgrade them in this tool currently. \n"; Label image = new Label(fillLayoutComposite, SWT.WRAP); image.setImage(loadImage("question.png")); PopupDialog popupDialog = new PopupDialog(fillLayoutComposite.getShell(), PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, true, false, false, false, false, null, null) { private static final int CURSOR_SIZE = 15; protected Point getInitialLocation(Point initialSize) { Display display = getShell().getDisplay(); Point location = display.getCursorLocation(); location.x += CURSOR_SIZE;//from w ww . j ava2 s .c o m location.y += CURSOR_SIZE; return location; } protected Control createDialogArea(Composite parent) { Label label = new Label(parent, SWT.WRAP); label.setText(extensionDec); label.setFont(new Font(null, "Times New Roman", 11, SWT.NORMAL)); GridData gd = new GridData(GridData.BEGINNING | GridData.FILL_BOTH); gd.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING; gd.verticalIndent = PopupDialog.POPUP_VERTICALSPACING; label.setLayoutData(gd); return label; } }; image.addListener(SWT.MouseHover, new org.eclipse.swt.widgets.Listener() { @Override public void handleEvent(org.eclipse.swt.widgets.Event event) { popupDialog.open(); } }); image.addListener(SWT.MouseExit, new org.eclipse.swt.widgets.Listener() { @Override public void handleEvent(org.eclipse.swt.widgets.Event event) { popupDialog.close(); } }); }
From source file:org.apertium.api.translate.infopopup.InfoPopUp.java
License:Open Source License
protected Control createDialogArea(Composite parent) { Parent = parent;// www . ja v a2s . co m if (RESIZE) { text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.WRAP | SWT.NO_FOCUS); } else { text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP | SWT.NO_FOCUS); } // text.setBounds(bounds.x + 100, bounds.y + 100, bounds.width + 100, // bounds.height + 100); // Use the compact margins employed by PopupDialog. gd = new GridData(GridData.BEGINNING | GridData.FILL_BOTH); gd.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING; gd.verticalIndent = PopupDialog.POPUP_VERTICALSPACING; text.setLayoutData(gd); text.setText(contents); if (!RESIZE) { MouseListener = new MyMouseTrackListener(); text.addMouseTrackListener(MouseListener); } return text; }
From source file:org.csstudio.autocomplete.ui.content.ContentHelperPopup.java
License:Open Source License
protected void adjustBounds() { // Get our control's location in display coordinates. Point location = control.getDisplay().map(control.getParent(), null, control.getLocation()); int controlX = location.x; int controlY = location.y; int controlWidht = control.getBounds().width; int controlHeight = control.getBounds().height; if (content != null) { Point size = text.getSize(); controlWidht = size.x + margins.width * 2; controlHeight = size.y + margins.height * 2; }/*from www.j ava2 s . com*/ Rectangle parentBounds = new Rectangle(controlX, controlY, controlWidht, controlHeight); // Try placing the helper on the top final Rectangle proposedBounds = new Rectangle(parentBounds.x + PopupDialog.POPUP_HORIZONTALSPACING, parentBounds.y - parentBounds.height - PopupDialog.POPUP_VERTICALSPACING, parentBounds.width, parentBounds.height); // Constrain to the display Rectangle constrainedBounds = getConstrainedShellBounds(proposedBounds); // If it won't fit on the top, try the bottom if (constrainedBounds.intersects(parentBounds)) { proposedBounds.y = parentBounds.y + parentBounds.height + PopupDialog.POPUP_VERTICALSPACING; } proposedBounds.x = constrainedBounds.x; getShell().setBounds(proposedBounds); }
From source file:org.eclipse.e4.ui.workbench.swt.internal.copy.ShowViewDialog.java
License:Open Source License
private void popUp(final String description) { new PopupDialog(filteredTree.getShell(), PopupDialog.HOVER_SHELLSTYLE, true, false, false, false, false, null, null) {/* www .java2 s . co m*/ private static final int CURSOR_SIZE = 15; protected Point getInitialLocation(Point initialSize) { // show popup relative to cursor Display display = getShell().getDisplay(); Point location = display.getCursorLocation(); location.x += CURSOR_SIZE; location.y += CURSOR_SIZE; return location; } protected Control createDialogArea(Composite parent) { Label label = new Label(parent, SWT.WRAP); label.setText(description); label.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent event) { close(); } }); // Use the compact margins employed by PopupDialog. GridData gd = new GridData(GridData.BEGINNING | GridData.FILL_BOTH); gd.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING; gd.verticalIndent = PopupDialog.POPUP_VERTICALSPACING; label.setLayoutData(gd); return label; } }.open(); }
From source file:org.eclipse.sapphire.ui.forms.swt.Popup.java
License:Open Source License
/** * Override to populate with notifications. * // w w w . ja v a 2 s .co m * @param parent */ protected Control createContentArea(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().margins(PopupDialog.POPUP_MARGINWIDTH, PopupDialog.POPUP_MARGINHEIGHT) .spacing(PopupDialog.POPUP_HORIZONTALSPACING, PopupDialog.POPUP_VERTICALSPACING).applyTo(composite); GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); return composite; }
From source file:org.eclipse.ui.internal.dialogs.ShowViewDialog.java
License:Open Source License
private void popUp(final String description) { new PopupDialog(filteredTree.getShell(), PopupDialog.HOVER_SHELLSTYLE, true, false, false, false, false, null, null) {/*from w w w.j av a 2s. c om*/ private static final int CURSOR_SIZE = 15; protected Point getInitialLocation(Point initialSize) { //show popup relative to cursor Display display = getShell().getDisplay(); Point location = display.getCursorLocation(); location.x += CURSOR_SIZE; location.y += CURSOR_SIZE; return location; } protected Control createDialogArea(Composite parent) { Label label = new Label(parent, SWT.WRAP); label.setText(description); label.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent event) { close(); } }); // Use the compact margins employed by PopupDialog. GridData gd = new GridData(GridData.BEGINNING | GridData.FILL_BOTH); gd.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING; gd.verticalIndent = PopupDialog.POPUP_VERTICALSPACING; label.setLayoutData(gd); return label; } }.open(); }
From source file:org.modelio.core.ui.textelement.InfoPopup.java
License:Open Source License
@objid("de418b82-9038-45e6-896b-1a2267f97d77") @Override// ww w. ja v a 2 s. c o m protected Control createDialogArea(Composite parent) { this.text = new Browser(parent, SWT.NO_FOCUS); this.text.setBackground(getBackground()); // Use the compact margins employed by PopupDialog. final GridData gd = new GridData(GridData.BEGINNING | GridData.FILL_BOTH); gd.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING; gd.verticalIndent = PopupDialog.POPUP_VERTICALSPACING; this.text.setLayoutData(gd); this.text.setText(this.contents); // since SWT.NO_FOCUS is only a hint... this.text.addFocusListener(new FocusAdapter() { @Override public void focusGained(FocusEvent event) { // ContentProposalPopup.this.close(); } }); return this.text; }
From source file:org.modelio.core.ui.textelement.InfoPopup.java
License:Open Source License
@objid("449a0d47-8510-4001-8e6d-2a4fea1683f6") @Override//from www . ja va2 s.c o m protected void adjustBounds() { final Rectangle parentBounds = getParentShell().getBounds(); Rectangle proposedBounds; // Try placing the info popup to the right Rectangle rightProposedBounds = new Rectangle( parentBounds.x + parentBounds.width + PopupDialog.POPUP_HORIZONTALSPACING, parentBounds.y + PopupDialog.POPUP_VERTICALSPACING, parentBounds.width, parentBounds.height); rightProposedBounds = getConstrainedShellBounds(rightProposedBounds); // If it won't fit on the right, try the left if (rightProposedBounds.intersects(parentBounds)) { Rectangle leftProposedBounds = new Rectangle( parentBounds.x - parentBounds.width - POPUP_HORIZONTALSPACING - 1, parentBounds.y, parentBounds.width, parentBounds.height); leftProposedBounds = getConstrainedShellBounds(leftProposedBounds); // If it won't fit on the left, choose the proposed bounds // that fits the best if (leftProposedBounds.intersects(parentBounds)) { if (rightProposedBounds.x - parentBounds.x >= parentBounds.x - leftProposedBounds.x) { rightProposedBounds.x = parentBounds.x + parentBounds.width + PopupDialog.POPUP_HORIZONTALSPACING; proposedBounds = rightProposedBounds; } else { leftProposedBounds.width = parentBounds.x - POPUP_HORIZONTALSPACING - leftProposedBounds.x; proposedBounds = leftProposedBounds; } } else { // use the proposed bounds on the left proposedBounds = leftProposedBounds; } } else { // use the proposed bounds on the right proposedBounds = rightProposedBounds; } getShell().setBounds(proposedBounds); }