Search in sources :

Example 31 with InputDialog

use of org.eclipse.jface.dialogs.InputDialog in project sling by apache.

the class JcrNodeRenameHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    ISelection sel = HandlerUtil.getCurrentSelection(event);
    JcrNode node = SelectionUtils.getFirst(sel, JcrNode.class);
    if (node == null) {
        return null;
    }
    Shell shell = HandlerUtil.getActiveShell(event);
    InputDialog id = new InputDialog(shell, "Change Node Name", "Enter new name for node '" + node.getDescription() + "':", node.getLabel(), NodeNameValidator.INSTANCE);
    if (id.open() == IStatus.OK) {
        node.rename(id.getValue());
    }
    return null;
}
Also used : Shell(org.eclipse.swt.widgets.Shell) JcrNode(org.apache.sling.ide.eclipse.ui.nav.model.JcrNode) InputDialog(org.eclipse.jface.dialogs.InputDialog) ISelection(org.eclipse.jface.viewers.ISelection)

Aggregations

InputDialog (org.eclipse.jface.dialogs.InputDialog)31 IInputValidator (org.eclipse.jface.dialogs.IInputValidator)12 Composite (org.eclipse.swt.widgets.Composite)7 SelectionEvent (org.eclipse.swt.events.SelectionEvent)5 SelectionListener (org.eclipse.swt.events.SelectionListener)5 FillLayout (org.eclipse.swt.layout.FillLayout)5 GridLayout (org.eclipse.swt.layout.GridLayout)5 Button (org.eclipse.swt.widgets.Button)5 Group (org.eclipse.swt.widgets.Group)5 Label (org.eclipse.swt.widgets.Label)5 IStatus (org.eclipse.core.runtime.IStatus)4 Control (org.eclipse.swt.widgets.Control)4 Event (org.eclipse.swt.widgets.Event)4 Listener (org.eclipse.swt.widgets.Listener)4 IllegalOperationException (cl.utfsm.acs.acg.core.IllegalOperationException)3 ArrayList (java.util.ArrayList)3 Status (org.eclipse.core.runtime.Status)3 ErrorDialog (org.eclipse.jface.dialogs.ErrorDialog)3 SashForm (org.eclipse.swt.custom.SashForm)3 TreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)3