1
/*******************************************************************************
2
* Copyright (C) 2003-2006, 2013, Guillaume Brocker
4
* All rights reserved. This program and the accompanying materials
5
* are made available under the terms of the Eclipse Public License v1.0
6
* which accompanies this distribution, and is available at
7
* http://www.eclipse.org/legal/epl-v10.html
10
* Guillaume Brocker - Initial API and implementation
12
******************************************************************************/
14
package eclox.ui.editor.editors;
16
import org.eclipse.jface.dialogs.IInputValidator;
17
import org.eclipse.jface.dialogs.InputDialog;
18
import org.eclipse.swt.widgets.Shell;
20
import eclox.core.doxyfiles.Setting;
23
* Implements a list editor that handle value compounds as simple text
27
public class TextListEditor extends ListEditor {
30
* Implements an input validator for the input dialog used to edit value compunds.
32
private class MyInputValidator implements IInputValidator {
34
public String isValid(String newText) {
35
if( newText.length() == 0 ) {
36
return "Empty value is not allowed.";
45
protected String editValueCompound(Shell parent, Setting setting, String compound) {
46
// Creates the edition dialog.
47
InputDialog dialog = new InputDialog(
50
"Enter the new text for the value.",
51
Convenience.unescapeValue( compound ),
52
new MyInputValidator() );
54
// Lauches the value edition
55
if( dialog.open() == InputDialog.OK ) {
56
return Convenience.escapeValue( dialog.getValue() );