diff options
Diffstat (limited to 'plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/LabelEditorDialog.java')
-rw-r--r-- | plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/LabelEditorDialog.java | 177 |
1 files changed, 7 insertions, 170 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/LabelEditorDialog.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/LabelEditorDialog.java index 8cd7c8ef0be..4635a432328 100644 --- a/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/LabelEditorDialog.java +++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.extensionpoints.editors/src/org/eclipse/papyrus/extensionpoints/editors/ui/LabelEditorDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 CEA List. + * Copyright (c) 2006, 2018 CEA List. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at @@ -9,60 +9,21 @@ * * Contributors: * CEA List - initial API and implementation + * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Bug 533667 + * *******************************************************************************/ package org.eclipse.papyrus.extensionpoints.editors.ui; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.IInputValidator; -import org.eclipse.jface.text.source.SourceViewer; -import org.eclipse.papyrus.extensionpoints.editors.Activator; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; // equivalent au inputDialog (code recopie) mais donne un sourceviewer a la place du label /** * + * @deprecated since 3.1. Use {@link org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.LabelEditorDialog} instead. */ -public class LabelEditorDialog extends Dialog implements ILabelEditorDialog { - - /** - * The title of the dialog. - */ - protected String title; - - /** - * The input value; the empty string by default. - */ - protected String value = "";//$NON-NLS-1$ - - /** - * The input validator, or <code>null</code> if none. - */ - protected IInputValidator validator; - - /** - * Ok button widget. - */ - protected Button okButton; - - /** - * Error message label widget. - */ - protected CLabel errorMessageText; - - /** - * Error message string. - */ - protected String errorMessage; - - /** - * SourceViewer : area that displays text. - */ - protected SourceViewer viewer; +@Deprecated +public class LabelEditorDialog extends org.eclipse.papyrus.infra.gmfdiag.extensionpoints.editors.ui.LabelEditorDialog { /** * Creates a dialog with OK and Cancel buttons. Note that the dialog will have no visual @@ -82,130 +43,6 @@ public class LabelEditorDialog extends Dialog implements ILabelEditorDialog { * string) */ public LabelEditorDialog(Shell parentShell, String dialogTitle, String initialValue, IInputValidator validator) { - super(parentShell); - this.title = dialogTitle; - if (initialValue == null) { - value = "";//$NON-NLS-1$ - } else { - value = initialValue; - } - this.validator = validator; - } - - /* - * (non-Javadoc) Method declared on Dialog. - */ - /** - * - * - * @param buttonId - */ - @Override - protected void buttonPressed(int buttonId) { - if (buttonId == IDialogConstants.OK_ID) { - value = viewer.getDocument().get(); - } else { - value = null; - } - super.buttonPressed(buttonId); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets .Shell) - */ - /** - * - * - * @param shell - */ - @Override - protected void configureShell(Shell shell) { - super.configureShell(shell); - if (title != null) { - shell.setText(title); - } - } - - /** - * Returns the ok button. - * - * @return the ok button - */ - // @unused - protected Button getOkButton() { - return okButton; - } - - /** - * Returns the text area. - * - * @return the text area - */ - // @unused - protected SourceViewer getSourceViewer() { - return viewer; - } - - /** - * Returns the validator. - * - * @return the validator - */ - // @unused - protected IInputValidator getValidator() { - return validator; - } - - /** - * Returns the string typed into this input dialog. - * - * @return the input string - */ - public String getValue() { - return value; - } - - /** - * Validates the input. - * <p> - * The default implementation of this framework method delegates the request to the supplied input validator object; if it finds the input invalid, the error message is displayed in the dialog's message line. This hook method is called whenever the text - * changes in the input field. - * </p> - */ - protected void validateInput() { - String errorMessage = null; - if (validator != null) { - errorMessage = validator.isValid(viewer.getDocument().get()); - } - // Bug 16256: important not to treat "" (blank error) the same as null - // (no error) - setErrorMessage(errorMessage); - } - - /** - * Sets or clears the error message. If not <code>null</code>, the OK button is disabled. - * - * @param errorMessage - * the error message, or <code>null</code> to clear - * - * @since 3.0 - */ - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - if ((errorMessageText != null) && !errorMessageText.isDisposed()) { - Image errorImage = Activator.getImage("icons/error.gif"); - errorMessageText.setImage(errorMessage == null ? null : errorImage); - errorMessageText.setText(errorMessage == null ? "" : errorMessage); //$NON-NLS-1$ - errorMessageText.getParent().update(); - // Access the ok button by id, in case clients have overridden - // button creation. - // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643 - Control button = getButton(IDialogConstants.OK_ID); - if (button != null) { - button.setEnabled(errorMessage == null); - } - } + super(parentShell, dialogTitle, initialValue, validator); } } |