public void widgetSelected(SelectionEvent evt) { String newValue = changePressed(); if (newValue != null) { setStringValue(newValue); } } });
/** * Creates a string button field editor. * * @param name the name of the preference this field editor works on * @param labelText the label text of the field editor * @param parent the parent of the field editor's control */ protected StringButtonFieldEditor(String name, String labelText, Composite parent) { init(name, labelText); createControl(parent); }
/** * Get the change control. Create it in parent if required. * @param parent * @return Button */ protected Button getChangeControl(Composite parent) { if (changeButton == null) { changeButton = new Button(parent, SWT.PUSH); if (changeButtonText == null) { changeButtonText = JFaceResources.getString("openChange"); //$NON-NLS-1$ } changeButton.setText(changeButtonText); changeButton.setFont(parent.getFont()); changeButton.addSelectionListener(widgetSelectedAdapter(evt -> { String newValue = changePressed(); if (newValue != null) { setStringValue(newValue); } })); changeButton.addDisposeListener(event -> changeButton = null); } else { checkParent(changeButton, parent); } return changeButton; }
extensionEditor.setChangeButtonText("Choose..."); extensionEditor.setEmptyStringAllowed(true); extensionEditor.setPreferenceStore(InstaSearchPlugin.getDefault().getPreferenceStore()); extensionEditor.load(); Text txt = extensionEditor.getTextControl(extensionsComposite); txt.setToolTipText("E.g:\njava, xml");
@Override protected void doFillIntoGrid(Composite parent, int numColumns) { super.doFillIntoGrid(parent, numColumns - 1); changeButton = getChangeControl(parent); GridData gd = new GridData(); gd.horizontalAlignment = GridData.FILL; int widthHint = convertHorizontalDLUsToPixels(changeButton, IDialogConstants.BUTTON_WIDTH); gd.widthHint = Math.max(widthHint, changeButton.computeSize( SWT.DEFAULT, SWT.DEFAULT, true).x); changeButton.setLayoutData(gd); }
@Override protected void adjustForNumColumns(int numColumns) { ((GridData) getTextControl().getLayoutData()).horizontalSpan = numColumns - 2; }
/** * Get the change control. Create it in parent if required. * @param parent * @return Button */ protected Button getChangeControl(Composite parent) { if (changeButton == null) { changeButton = new Button(parent, SWT.PUSH); if (changeButtonText == null) { changeButtonText = JFaceResources.getString("openChange"); //$NON-NLS-1$ } changeButton.setText(changeButtonText); changeButton.setFont(parent.getFont()); changeButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent evt) { String newValue = changePressed(); if (newValue != null) { setStringValue(newValue); } } }); changeButton.addDisposeListener(event -> changeButton = null); } else { checkParent(changeButton, parent); } return changeButton; }
protected void doFillIntoGrid(Composite parent, int numColumns) { super.doFillIntoGrid(parent, numColumns - 1); changeButton = getChangeControl(parent); GridData gd = new GridData(); gd.horizontalAlignment = GridData.FILL; int widthHint = convertHorizontalDLUsToPixels(changeButton, IDialogConstants.BUTTON_WIDTH); gd.widthHint = Math.max(widthHint, changeButton.computeSize( SWT.DEFAULT, SWT.DEFAULT, true).x); changeButton.setLayoutData(gd); }
@Override protected void adjustForNumColumns(int numColumns) { ((GridData) getTextControl().getLayoutData()).horizontalSpan = numColumns - 2; }
checkParent(changeButton, parent);
/** * Creates a string button field editor. * * @param name the name of the preference this field editor works on * @param labelText the label text of the field editor * @param parent the parent of the field editor's control */ protected StringButtonFieldEditor(String name, String labelText, Composite parent) { init(name, labelText); createControl(parent); }
@Override protected void doFillIntoGrid(Composite parent, int numColumns) { super.doFillIntoGrid(parent, numColumns - 1); changeButton = getChangeControl(parent); GridData gd = new GridData(); gd.horizontalAlignment = GridData.FILL; int widthHint = convertHorizontalDLUsToPixels(changeButton, IDialogConstants.BUTTON_WIDTH); gd.widthHint = Math.max(widthHint, changeButton.computeSize( SWT.DEFAULT, SWT.DEFAULT, true).x); changeButton.setLayoutData(gd); }
@Override public void widgetSelected(SelectionEvent evt) { String newValue = changePressed(); if (newValue != null) { setStringValue(newValue); } } });
protected void adjustForNumColumns(int numColumns) { ((GridData) getTextControl().getLayoutData()).horizontalSpan = numColumns - 2; }
/** * Creates a string button field editor. * * @param name the name of the preference this field editor works on * @param labelText the label text of the field editor * @param parent the parent of the field editor's control */ protected StringButtonFieldEditor(String name, String labelText, Composite parent) { init(name, labelText); createControl(parent); }