List of usage examples for org.eclipse.jface.dialogs PopupDialog open
@Override public int open()
From source file:com.aptana.scripting.keybindings.internal.KeybindingsManager.java
License:Open Source License
private void popup(final Shell shell, final IBindingService bindingService, final IContextService contextService, final ICommandElementsProvider commandElementsProvider, final List<CommandElement> commandElements, final Event event, final Binding binding, final Point initialLocation) { PopupDialog popupDialog = new PopupDialog(shell, PopupDialog.INFOPOPUP_SHELLSTYLE, true, false, false, false, false, null, null) {/* w w w .j av a 2 s .c o m*/ @Override protected Point getInitialLocation(Point initialSize) { Display display = shell.getDisplay(); Point cursorLocation = display.getCursorLocation(); if (initialLocation != null) { // Warp the cursor ? // if (!cursorLocation.equals(initialLocation)) // { // display.setCursorLocation(initialLocation); // } return initialLocation; } return cursorLocation; } protected Control createDialogArea(Composite parent) { registerShellType(); // Create a composite for the dialog area. final Composite composite = new Composite(parent, SWT.NONE); final GridLayout compositeLayout = new GridLayout(); compositeLayout.marginHeight = 1; compositeLayout.marginWidth = 1; composite.setLayout(compositeLayout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); // Layout the table. final Table commandElementTable = new Table(composite, SWT.FULL_SELECTION | SWT.SINGLE | SWT.NO_SCROLL); final GridData gridData = new GridData(GridData.FILL_BOTH); commandElementTable.setLayoutData(gridData); commandElementTable.setLinesVisible(true); // Initialize the columns and rows. final TableColumn columnCommandName = new TableColumn(commandElementTable, SWT.LEFT, 0); final TableColumn columnAccelerator = new TableColumn(commandElementTable, SWT.CENTER, 1); int mnemonic = 0; for (CommandElement commandElement : commandElements) { final String[] text = { commandElement.getDisplayName(), (mnemonic < MNEMONICS.length() ? String.valueOf(MNEMONICS.charAt(mnemonic++)) : "") }; //$NON-NLS-1$ final TableItem item = new TableItem(commandElementTable, SWT.NULL); item.setText(text); item.setData(CommandElement.class.getName(), commandElement); } if (binding != null) { ParameterizedCommand originalParameterizedCommand = binding.getParameterizedCommand(); // Add original command if (originalParameterizedCommand != null) { try { String name = originalParameterizedCommand.getName(); final TableItem item = new TableItem(commandElementTable, SWT.NULL); item.setText(new String[] { name, (mnemonic < MNEMONICS.length() ? String.valueOf(MNEMONICS.charAt(mnemonic++)) : "") }); //$NON-NLS-1$ item.setData(ParameterizedCommand.class.getName(), originalParameterizedCommand); } catch (NotDefinedException nde) { IdeLog.logError(ScriptingActivator.getDefault(), nde.getMessage(), nde); } } } Dialog.applyDialogFont(parent); columnAccelerator.pack(); columnCommandName.pack(); columnAccelerator.setWidth(columnAccelerator.getWidth() * 4); /* * If the user double-clicks on the table row, it should execute the selected command. */ commandElementTable.addListener(SWT.DefaultSelection, new Listener() { public final void handleEvent(final Event event) { // Try to execute the corresponding command. Object commandElement = null; Object parameterizedCommand = null; final TableItem[] selection = commandElementTable.getSelection(); if (selection.length > 0) { commandElement = selection[0].getData(CommandElement.class.getName()); parameterizedCommand = selection[0].getData(ParameterizedCommand.class.getName()); } close(); if (commandElement instanceof CommandElement) { executeCommandElement(commandElementsProvider, (CommandElement) commandElement); } else if (parameterizedCommand instanceof ParameterizedCommand) { try { executeCommand(binding, event); } catch (CommandException e) { IdeLog.logError(ScriptingActivator.getDefault(), e.getMessage(), e); } } } }); commandElementTable.addKeyListener(new KeyListener() { public void keyReleased(KeyEvent e) { } public void keyPressed(KeyEvent e) { if (!e.doit) { return; } int index = MNEMONICS.indexOf(e.character); if (index != -1) { if (index < commandElementTable.getItemCount()) { e.doit = false; TableItem tableItem = commandElementTable.getItem(index); Object commandElement = tableItem.getData(CommandElement.class.getName()); Object parameterizedCommand = tableItem .getData(ParameterizedCommand.class.getName()); close(); if (commandElement instanceof CommandElement) { executeCommandElement(commandElementsProvider, (CommandElement) commandElement); } else if (parameterizedCommand instanceof ParameterizedCommand) { try { executeCommand(binding, event); } catch (CommandException ex) { IdeLog.logError(ScriptingActivator.getDefault(), ex.getMessage(), ex); } } } } } }); return composite; } protected Color getBackground() { return getShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); } @Override protected Control createContents(Composite parent) { return super.createContents(parent); } @Override public int open() { showingCommandsMenu = true; bindingService.setKeyFilterEnabled(false); return super.open(); } @Override public boolean close() { boolean closed = super.close(); if (closed) { showingCommandsMenu = false; bindingService.setKeyFilterEnabled(true); } return closed; } /** * Registers the shell as the same type as its parent with the context support. This ensures that it does * not modify the current state of the application. */ private final void registerShellType() { final Shell shell = getShell(); contextService.registerShell(shell, contextService.getShellType((Shell) shell.getParent())); } }; popupDialog.open(); }
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;//w w w . j a v a2 s. com 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.eclipse.gyrex.admin.ui.pages.FilteredAdminPage.java
License:Open Source License
void openFilterPopUp(final String filter, final Point location, final Runnable closeCallback) { final PopupDialog dialog = new PopupDialog(SwtUtil.getShell(filterPanel), SWT.NO_TRIM | SWT.NO_SCROLL | SWT.MODELESS, false, false, false, false, false, null, null) { /** serialVersionUID */ private static final long serialVersionUID = 1L; @Override// w w w . j ava 2 s .c om protected void adjustBounds() { getShell().pack(true); getShell().setLocation(location); } @Override public boolean close() { final boolean closed = super.close(); if (!closed) { return closed; } if (null != closeCallback) { closeCallback.run(); } return closed; } @Override protected void configureShell(final Shell shell) { super.configureShell(shell); shell.setLayout(new FillLayout()); shell.setData(RWT.CUSTOM_VARIANT, "filter-popup"); //$NON-NLS-1$ } @Override protected Control createContents(final Composite parent) { final Control control = createFilterControl(filter, parent); if (parent.getLayout() instanceof FillLayout) { final Control[] children = parent.getChildren(); for (final Control child : children) { if (null != child.getLayoutData()) { throw new IllegalStateException(String.format( "%s#createFilterControl not allowed to set layout data on children!", FilteredAdminPage.this.getClass())); } } } return control; } @Override public int open() { final int result = super.open(); final Listener closeListener = new Listener() { /** serialVersionUID */ private static final long serialVersionUID = 1L; @Override public void handleEvent(final Event event) { close(); } }; getShell().addListener(SWT.Deactivate, closeListener); getShell().addListener(SWT.Close, closeListener); getShell().setActive(); return result; } }; dialog.open(); }
From source file:org.eclipse.rap.demo.presentation.DemoPresentationWorkbenchWindowAdvisor.java
License:Open Source License
private void createMenuBar(final Composite banner) { final Composite menuBar = new Composite(banner, SWT.NONE); menuBar.setBackgroundMode(SWT.INHERIT_FORCE); FormData fdMenuBar = new FormData(); menuBar.setLayoutData(fdMenuBar);/*from ww w . j a v a 2 s. co m*/ fdMenuBar.top = new FormAttachment(100, -26); fdMenuBar.left = new FormAttachment(0, 10); fdMenuBar.bottom = new FormAttachment(100, -8); final ApplicationWindow window = (ApplicationWindow) getWindowConfigurer().getWindow(); MenuManager menuBarManager = window.getMenuBarManager(); IContributionItem[] menuBarItems = menuBarManager.getItems(); List<Action> actions = new ArrayList<Action>(); for (int i = 0; i < menuBarItems.length; i++) { final MenuManager menuManager = (MenuManager) menuBarItems[i]; actions.add(new Action() { @Override public String getId() { return menuManager.getId(); } @Override public String getText() { return menuManager.getMenuText(); } @Override public void run() { final Shell shell = window.getShell(); final Color background = new Color(shell.getDisplay(), 9, 34, 60); final PopupDialog popupDialog = new PopupDialog(shell, SWT.RESIZE | SWT.ON_TOP, false, false, false, false, null, null) { @Override protected Control createDialogArea(Composite parent) { final Composite popup = new Composite(parent, SWT.NONE); popup.setBackgroundMode(SWT.INHERIT_FORCE); popup.setLayout(new FormLayout()); popup.setBackground(background); Label roundedCornerLeft = new Label(popup, SWT.NONE); roundedCornerLeft.setImage(Images.IMG_BANNER_ROUNDED_LEFT); roundedCornerLeft.pack(); FormData fdRoundedCornerLeft = new FormData(); roundedCornerLeft.setLayoutData(fdRoundedCornerLeft); fdRoundedCornerLeft.top = new FormAttachment(100, -5); fdRoundedCornerLeft.left = new FormAttachment(0, 0); Label roundedCornerRight = new Label(popup, SWT.NONE); roundedCornerRight.setImage(Images.IMG_BANNER_ROUNDED_RIGHT); roundedCornerRight.pack(); FormData fdRoundedCornerRight = new FormData(); roundedCornerRight.setLayoutData(fdRoundedCornerRight); fdRoundedCornerRight.top = new FormAttachment(100, -5); fdRoundedCornerRight.left = new FormAttachment(100, -5); final Composite content = new Composite(popup, SWT.NONE); FormData fdContent = new FormData(); content.setLayoutData(fdContent); fdContent.top = new FormAttachment(0, 5); fdContent.left = new FormAttachment(0, 14); content.setLayout(new FillLayout(SWT.VERTICAL)); IContributionItem[] menuItems = menuManager.getItems(); for (int j = 0; j < menuItems.length; j++) { IContributionItem contributionItem = menuItems[j]; if (contributionItem instanceof ActionContributionItem) { ActionContributionItem actionItem = (ActionContributionItem) contributionItem; Action action = (Action) actionItem.getAction(); new ActionBarButton(action, content) { @Override public void run() { close(); super.run(); } }; } } content.pack(); return popup; } }; final Composite popup = new Composite(shell, SWT.NONE); popup.setBackgroundMode(SWT.INHERIT_FORCE); popup.setLayout(new FormLayout()); Label roundedCornerLeft = new Label(popup, SWT.NONE); roundedCornerLeft.setImage(Images.IMG_BANNER_ROUNDED_LEFT); roundedCornerLeft.pack(); FormData fdRoundedCornerLeft = new FormData(); roundedCornerLeft.setLayoutData(fdRoundedCornerLeft); fdRoundedCornerLeft.top = new FormAttachment(100, -5); fdRoundedCornerLeft.left = new FormAttachment(0, 0); roundedCornerLeft.moveAbove(banner); Label roundedCornerRight = new Label(popup, SWT.NONE); roundedCornerRight.setImage(Images.IMG_BANNER_ROUNDED_RIGHT); roundedCornerRight.pack(); FormData fdRoundedCornerRight = new FormData(); roundedCornerRight.setLayoutData(fdRoundedCornerRight); fdRoundedCornerRight.top = new FormAttachment(100, -5); fdRoundedCornerRight.left = new FormAttachment(100, -5); roundedCornerRight.moveAbove(banner); final Composite content = new Composite(popup, SWT.NONE); FormData fdContent = new FormData(); content.setLayoutData(fdContent); fdContent.top = new FormAttachment(0, 5); fdContent.left = new FormAttachment(0, 14); content.setLayout(new FillLayout(SWT.VERTICAL)); IContributionItem[] menuItems = menuManager.getItems(); for (int j = 0; j < menuItems.length; j++) { IContributionItem contributionItem = menuItems[j]; if (contributionItem instanceof ActionContributionItem) { ActionContributionItem actionItem = (ActionContributionItem) contributionItem; Action action = (Action) actionItem.getAction(); new ActionBarButton(action, content); } } content.pack(); popup.setBackground(background); Rectangle popUpBounds = calculatePopUpBounds(banner, menuBar, content); popup.setBounds(popUpBounds); shell.addControlListener(new ControlAdapter() { @Override public void controlResized(ControlEvent e) { Rectangle popUpBounds = calculatePopUpBounds(banner, menuBar, content); popup.setBounds(popUpBounds); } }); popup.moveAbove(null); popupDialog.open(); Listener closeListener = new Listener() { public void handleEvent(Event event) { if (popupDialog.getShell() != null) { popupDialog.getShell().removeListener(SWT.Close, this); popupDialog.getShell().removeListener(SWT.Deactivate, this); popupDialog.getShell().removeListener(SWT.Dispose, this); popupDialog.close(); } if (!popup.isDisposed()) { popup.dispose(); } } }; popupDialog.getShell().addListener(SWT.Deactivate, closeListener); popupDialog.getShell().addListener(SWT.Close, closeListener); popupDialog.getShell().addListener(SWT.Dispose, closeListener); // content.addListener( SWT.Dispose, closeListener ); // Shell controlShell = content.getShell(); // controlShell.addListener( SWT.Move, closeListener ); popupDialog.getShell().setAlpha(0); popupDialog.getShell().setActive(); popupDialog.getShell().setBounds(popUpBounds); // shell.addMouseListener( new MouseAdapter() { // public void mouseUp( final MouseEvent e ) { // //System.out.println( "mouseup" ); // shell.removeMouseListener( this ); // popup.dispose(); // } // } ); } private Rectangle calculatePopUpBounds(Composite banner, Composite menuBar, Composite content) { Rectangle menuBarBounds = menuBar.getBounds(); Rectangle bannerBounds = banner.getBounds(); Display display = menuBar.getDisplay(); Shell shell = menuBar.getShell(); Point bannerPosition = display.map(banner.getParent(), shell, banner.getLocation()); return new Rectangle(bannerPosition.x, bannerBounds.height - 5, menuBarBounds.width + 10, content.getSize().y + 10); } }); } ActionBar.create(actions, menuBar); }
From source file:org.eclipse.rap.demo.presentation.StackPresentationImpl.java
License:Open Source License
protected StackPresentationImpl(final IStackPresentationSite stackSite, final Composite parent) { super(stackSite); Display display = parent.getDisplay(); Composite background = new Composite(parent, SWT.NONE); background.setBackgroundMode(SWT.INHERIT_FORCE); background.setLayout(new FormLayout()); content = new Label(background, SWT.NONE); content.setBackground(display.getSystemColor(SWT.COLOR_WHITE)); FormData fdContent = createFormData(content); fdContent.top = new FormAttachment(0, TITLE_HEIGHT); fdContent.left = new FormAttachment(0, 2); fdContent.right = new FormAttachment(100, -2); fdContent.bottom = new FormAttachment(100, -2); content.addControlListener(new ControlAdapter() { @Override// ww w .j a v a 2s .com public void controlResized(final ControlEvent evt) { layout(); } }); head = new Button(background, SWT.PUSH | SWT.FLAT | SWT.LEAD); FontData fontData = head.getFont().getFontData()[0]; head.setFont(new Font(display, fontData.getName(), fontData.getHeight() + 2, fontData.getStyle())); FormData fdHead = createFormData(head); fdHead.top = new FormAttachment(0, -1); fdHead.left = new FormAttachment(0, -1); fdHead.height = TITLE_HEIGHT + 1; fdHead.right = new FormAttachment(100, 1); head.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent evt) { Object[] parts = presentableParts.toArray(); SelectionListener listener = new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent evt) { TableItem item = (TableItem) evt.item; IPresentablePart part = (IPresentablePart) item.getData(); getSite().selectPart(part); Control control = (Control) evt.widget; control.getShell().close(); } }; PopupDialog popupDialog = new StackPopup(head.getShell(), content, parts, listener); popupDialog.open(); } }); Label topLeft = createImageLabel(background, Images.IMG_TOP_LEFT); FormData fdTopLeft = createFormData(topLeft); fdTopLeft.left = new FormAttachment(0, 0); fdTopLeft.top = new FormAttachment(0, 0); Label topRight = createImageLabel(background, Images.IMG_TOP_RIGHT); FormData fdTopRight = createFormData(topRight); fdTopRight.top = new FormAttachment(0, 0); fdTopRight.left = new FormAttachment(100, -topRight.getSize().x); Label topCenter = new Label(background, SWT.NONE); topCenter.setBackgroundImage(Images.IMG_TOP_CENTER); FormData fdTopCenter = createFormData(topCenter); fdTopCenter.top = new FormAttachment(0, 0); fdTopCenter.left = new FormAttachment(topLeft); fdTopCenter.right = new FormAttachment(topRight); fdTopCenter.height = Images.IMG_TOP_CENTER.getBounds().height; Label middleLeft = new Label(background, SWT.NONE); middleLeft.setBackgroundImage(Images.IMG_MIDDLE_LEFT); FormData fdMiddleLeft = createFormData(middleLeft); fdMiddleLeft.top = new FormAttachment(topLeft); fdMiddleLeft.left = new FormAttachment(0, 0); fdMiddleLeft.width = Images.IMG_MIDDLE_LEFT.getBounds().width; fdMiddleLeft.bottom = new FormAttachment(100, -Images.IMG_BOTTOM_LEFT.getBounds().height); Label middleRight = new Label(background, SWT.NONE); middleRight.setBackgroundImage(Images.IMG_MIDDLE_RIGHT); FormData fdMiddleRight = createFormData(middleRight); fdMiddleRight.top = new FormAttachment(topRight); fdMiddleRight.left = new FormAttachment(100, -Images.IMG_MIDDLE_RIGHT.getBounds().width); fdMiddleRight.width = Images.IMG_MIDDLE_RIGHT.getBounds().width; int height = -Images.IMG_BOTTOM_RIGHT.getBounds().height; fdMiddleRight.bottom = new FormAttachment(100, height); Label bottomLeft = createImageLabel(background, Images.IMG_BOTTOM_LEFT); FormData fdBottomLeft = createFormData(bottomLeft); fdBottomLeft.left = new FormAttachment(0, 0); fdBottomLeft.top = new FormAttachment(middleLeft); Label bottomRight = createImageLabel(background, Images.IMG_BOTTOM_RIGHT); FormData fdBottomRight = createFormData(bottomRight); fdBottomRight.top = new FormAttachment(middleRight); fdBottomRight.left = new FormAttachment(100, -bottomRight.getSize().x); Label bottomCenter = new Label(background, SWT.NONE); bottomCenter.setBackgroundImage(Images.IMG_BOTTOM_CENTER); FormData fdBottomCenter = createFormData(bottomCenter); fdBottomCenter.bottom = new FormAttachment(100, 0); fdBottomCenter.left = new FormAttachment(bottomLeft); fdBottomCenter.right = new FormAttachment(bottomRight); fdBottomCenter.height = Images.IMG_BOTTOM_CENTER.getBounds().height; Label middleCenter = new Label(background, SWT.NONE); middleCenter.setBackgroundImage(Images.IMG_MIDDLE_CENTER); FormData fdMiddleCenter = createFormData(middleCenter); fdMiddleCenter.top = new FormAttachment(topCenter); fdMiddleCenter.left = new FormAttachment(middleLeft); fdMiddleCenter.right = new FormAttachment(middleRight); fdMiddleCenter.bottom = new FormAttachment(bottomCenter); control = background; }
From source file:org.eclipse.rcptt.ecl.popup.ui.internal.EclPopupHandler.java
License:Open Source License
public Object execute(ExecutionEvent executionEvent) { window = HandlerUtil.getActiveWorkbenchWindow(executionEvent); if (window == null) { return null; }/* w w w. j a v a 2 s . co m*/ final PopupDialog popupDialog = new EclPopupDialog(window); popupDialog.open(); return null; }
From source file:org.eclipse.ui.internal.quickaccess.QuickAccessHandler.java
License:Open Source License
/** * Utility method to displays the original/legacy QuickAccess dialog. * * @param window//from w w w . j a v a2 s .co m * the active workbench window * @param command * the command which invokes the open of the dialog */ private static void displayQuickAccessDialog(IWorkbenchWindow window, Command command) { PopupDialog popupDialog = new QuickAccessDialog(window, command); popupDialog.open(); }
From source file:org.marketcetera.photon.views.CurrencyOrderTicketView.java
@Override protected void customizeWidgets(final ICurrencyOrderTicket ticket) { super.customizeWidgets(ticket); /*//from www.j a va 2 s .c o m * Update size of text fields since default will be small. */ updateSize(ticket.getNearTenorText(), 8); updateSize(ticket.getFarTenorText(), 8); /* * Customize text fields to auto select the text on focus to make it * easy to change the value. */ selectOnFocus(ticket.getNearTenorText()); selectOnFocus(ticket.getFarTenorText()); /* * If the ticket has no errors, enter on these fields will trigger a * send. */ addSendOrderListener(ticket.getNearTenorText()); addSendOrderListener(ticket.getFarTenorText()); ticket.getSelectNearTenorButton().addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { PopupDialog d = new CalendarPopup(getSite().getShell(), ticket.getSelectNearTenorButton(), ticket.getNearTenorText()); d.open(); }; }); ticket.getSelectFarTenorButton().addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { PopupDialog d = new CalendarPopup(getSite().getShell(), ticket.getSelectFarTenorButton(), ticket.getFarTenorText()); d.open(); }; }); }
From source file:org.marketcetera.photon.views.OptionOrderTicketView.java
@Override protected void customizeWidgets(final IOptionOrderTicket ticket) { super.customizeWidgets(ticket); /*//w w w . j ava 2s . com * Update size of text fields since default will be small. */ updateSize(ticket.getOptionExpiryText(), 10); updateSize(ticket.getStrikePriceText(), 10); /* * Customize text fields to auto select the text on focus to make it * easy to change the value. */ selectOnFocus(ticket.getOptionExpiryText()); selectOnFocus(ticket.getStrikePriceText()); /* * If the ticket has no errors, enter on these fields will trigger a * send. */ addSendOrderListener(ticket.getOptionExpiryText()); addSendOrderListener(ticket.getStrikePriceText()); addSendOrderListener(ticket.getPutOrCallCombo()); addSendOrderListener(ticket.getOrderCapacityCombo()); addSendOrderListener(ticket.getOpenCloseCombo()); ticket.getSelectExpiryButton().addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { PopupDialog d = new CalendarPopup(getSite().getShell()); d.open(); }; }); }
From source file:org.mwc.debrief.core.ResetPerspective.java
License:Open Source License
protected void showDialog(Shell shell, final String info) { final PopupDialog dialog = new PopupDialog(shell, PopupDialog.HOVER_SHELLSTYLE, true, false, false, false, false, null, null) {//from w w w . j a v a2 s.c om @Override protected Control createDialogArea(Composite parent) { GridData gd = new GridData(GridData.FILL_BOTH); StyledText text = new StyledText(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP); text.setLayoutData(gd); text.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND)); text.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); text.setText(info); text.setEditable(false); return text; } }; dialog.open(); }