@Override public int open() { addHandlerAndKeyBindingSupport(); return super.open(); }
public void run() { close(); } });
protected Control createContents(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); getPopupLayout().applyTo(composite); getGrabBothGridData().applyTo(composite); if (hasTitleArea()) { createTitleMenuArea(composite); titleSeparator = createHorizontalSeparator(composite); dialogArea = createDialogArea(composite); getGrabBothGridData().applyTo(dialogArea); if (hasInfoArea()) { infoSeparator = createHorizontalSeparator(composite); createInfoTextArea(composite); applyColors(composite); applyFonts(composite); return composite;
/** * Set the specified background color for the specified control and all of * its children. Subclasses may override this method, but typically do not. * If a subclass wishes to exclude a particular control in its contents from * getting the specified background color, it may instead override * {@link #getBackgroundColorExclusions()} * * @param color * the color to use as the background color * @param control * the control whose color is to be changed * @see PopupDialog#getBackgroundColorExclusions() */ protected void applyBackgroundColor(Color color, Control control) { applyBackgroundColor(color, control, getBackgroundColorExclusions()); }
/** * Apply any desired color to the specified composite and its children. * * @param composite * the contents composite */ private void applyColors(Composite composite) { // The getForeground() and getBackground() methods // should not answer null, but IColorProvider clients // are accustomed to null meaning use the default, so we guard // against this assumption. Color color = getForeground(); if (color == null) color = getDefaultForeground(); applyForegroundColor(color, composite, getForegroundColorExclusions()); color = getBackground(); if (color == null) color = getDefaultBackground(); applyBackgroundColor(color, composite, getBackgroundColorExclusions()); }
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); Label label = new Label(composite, SWT.NONE); label.setText(message); GridData gd = new GridData(GridData.BEGINNING | GridData.FILL_BOTH); gd.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING; gd.verticalIndent = PopupDialog.POPUP_VERTICALSPACING; label.setLayoutData(gd); Button btnDoNotShow = new Button(composite, SWT.CHECK); btnDoNotShow.setText(messageDoNotShowAgain); btnDoNotShow.setSelection(WorkbenchPlugin.getDefault().getPreferenceStore() .getBoolean(FULL_SCREEN_COMMAND_DO_NOT_SHOW_INFO_AGAIN_PREF_ID)); GridData gd2 = new GridData(GridData.BEGINNING | GridData.FILL_BOTH); gd2.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING; gd2.verticalIndent = PopupDialog.POPUP_VERTICALSPACING; btnDoNotShow.setLayoutData(gd2); composite.addDisposeListener((e) -> { WorkbenchPlugin.getDefault().getPreferenceStore() .setValue(FULL_SCREEN_COMMAND_DO_NOT_SHOW_INFO_AGAIN_PREF_ID, btnDoNotShow.getSelection()); }); return composite; }
/** * Show the dialog's menu. This message has no effect if the receiver was * not configured to show a menu. Clients may call this method in order to * trigger the menu via keystrokes or other gestures. Subclasses typically * do not override method. */ protected void showDialogMenu() { if (!showDialogMenu) { return; } if (menuManager == null) { menuManager = new MenuManager(); fillDialogMenu(menuManager); } // Setting this flag works around a problem that remains on X only, // whereby activating the menu deactivates our shell. listenToDeactivate = !Util.isGtk(); Menu menu = menuManager.createContextMenu(getShell()); Rectangle bounds = toolBar.getBounds(); Point topLeft = new Point(bounds.x, bounds.y + bounds.height); topLeft = getShell().toDisplay(topLeft); menu.setLocation(topLeft.x, topLeft.y); menu.setVisible(true); }
@Override protected void fillDialogMenu(IMenuManager dialogMenu) { super.fillDialogMenu(dialogMenu); fillViewMenu(dialogMenu); }
/** * Creates the title and menu area. Subclasses typically need not override * this method, but instead should use the constructor parameters * <code>showDialogMenu</code> and <code>showPersistAction</code> to * indicate whether a menu should be shown, and * <code>createTitleControl</code> to to customize the presentation of the * title. * * <p> * If this method is overridden, the returned control's layout data must be * an instance of <code>GridData</code>. This method must not modify the * parent's layout. * * @param parent * The parent composite. * @return The Control representing the title and menu area. */ protected Control createTitleMenuArea(Composite parent) { Composite titleAreaComposite = new Composite(parent, SWT.NONE); getPopupLayout().copy().numColumns(2).applyTo(titleAreaComposite); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(titleAreaComposite); createTitleControl(titleAreaComposite); if (showDialogMenu) { createDialogMenu(titleAreaComposite); } return titleAreaComposite; }
/** * Creates the title and menu area. Subclasses typically need not override * this method, but instead should use the constructor parameters * <code>showDialogMenu</code> and <code>showPersistAction</code> to * indicate whether a menu should be shown, and * <code>createTitleControl</code> to to customize the presentation of the * title. * * <p> * If this method is overridden, the returned control's layout data must be * an instance of <code>GridData</code>. This method must not modify the * parent's layout. * * @param parent * The parent composite. * @return The Control representing the title and menu area. */ protected Control createTitleMenuArea(Composite parent) { Composite titleAreaComposite = new Composite(parent, SWT.NONE); POPUP_LAYOUT_FACTORY.copy().numColumns(2).applyTo(titleAreaComposite); GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(titleAreaComposite); createTitleControl(titleAreaComposite); if (showDialogMenu) { createDialogMenu(titleAreaComposite); } return titleAreaComposite; }
protected Control createTitleControl(Composite parent) { Control control = super.createTitleControl(parent); Object data = control.getLayoutData(); if (data instanceof GridData) { ((GridData) data).horizontalSpan = 1; } return control; }
protected Control createTitleMenuArea(Composite parent) { fViewMenuButtonComposite= (Composite) super.createTitleMenuArea(parent); // If there is a header, then the filter text must be created // underneath the title and menu area. if (hasHeader()) { fFilterText= createFilterText(parent); } // Create show view menu action fShowViewMenuAction= new Action("showViewMenu") { //$NON-NLS-1$ /* * @see org.eclipse.jface.action.Action#run() */ public void run() { showDialogMenu(); } }; fShowViewMenuAction.setEnabled(true); fShowViewMenuAction.setActionDefinitionId("org.eclipse.ui.window.showViewMenu"); //$NON-NLS-1$ return fViewMenuButtonComposite; }
protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText(AutomaticUpdateMessages.AutomaticUpdatesPopup_UpdatesAvailableTitle); }
@Override protected List<Control> getBackgroundColorExclusions() { final List<Control> list = copyControls(super.getBackgroundColorExclusions()); if (separator != null) list.add(separator); return list; }
/** * Apply any desired color to the specified composite and its children. * * @param composite * the contents composite */ private void applyColors(Composite composite) { // The getForeground() and getBackground() methods // should not answer null, but IColorProvider clients // are accustomed to null meaning use the default, so we guard // against this assumption. Color color = getForeground(); if (color == null) color = getDefaultForeground(); applyForegroundColor(color, composite, getForegroundColorExclusions()); color = getBackground(); if (color == null) color = getDefaultBackground(); applyBackgroundColor(color, composite, getBackgroundColorExclusions()); }
@Override protected Control createDialogArea(Composite parent) { final Composite listViewComposite = (Composite)super.createDialogArea(parent); listView = new org.eclipse.swt.widgets.List(listViewComposite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL); listView.addSelectionListener(this); listView.addKeyListener(this); for (int i=0;i<menuDataList.size();i++) { MenuData item = menuDataList.get(i); String prefix = (i < chars.size() ? Character.toString(chars.get(i)) : "?") + ": "; listView.add(prefix + item.getNameExpanded()); } listView.select(0); return listViewComposite; }
/** * Show the dialog's menu. This message has no effect if the receiver was * not configured to show a menu. Clients may call this method in order to * trigger the menu via keystrokes or other gestures. Subclasses typically * do not override method. */ protected void showDialogMenu() { if (!showDialogMenu) { return; } if (menuManager == null) { menuManager = new MenuManager(); fillDialogMenu(menuManager); } // Setting this flag works around a problem that remains on X only, // whereby activating the menu deactivates our shell. listenToDeactivate = !Util.isGtk(); Menu menu = menuManager.createContextMenu(getShell()); Rectangle bounds = toolBar.getBounds(); Point topLeft = new Point(bounds.x, bounds.y + bounds.height); topLeft = getShell().toDisplay(topLeft); menu.setLocation(topLeft.x, topLeft.y); menu.setVisible(true); }
@Override protected void fillDialogMenu(IMenuManager dialogMenu) { super.fillDialogMenu(dialogMenu); fillViewMenu(dialogMenu); }