Skip to main content
summaryrefslogtreecommitdiffstats
blob: c89d648c86f9423d78dc1693c14948143b7bf090 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*******************************************************************************
 * Copyright (c) 2004, 2005 Sybase, Inc. and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Sybase, Inc. - initial API and implementation
 *******************************************************************************/

package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy;

import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.DirectEditPolicy;
import org.eclipse.gef.requests.DirectEditRequest;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.command.RenameNodeCommand;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode;

/**
 * EditPolicy for the direct editing of pageflow node's name.
 * 
 * @author Xiaoguang Zhang
 */
public class PageflowNodeDirectEditPolicy extends DirectEditPolicy {

	/*
	 * (non-javadoc)
	 * 
	 * @see DirectEditPolicy#getDirectEditCommand(DirectEditRequest)
	 */
	protected Command getDirectEditCommand(DirectEditRequest request) {
		RenameNodeCommand cmd = new RenameNodeCommand();
		cmd.setSource((PageflowNode) getHost().getModel());
		cmd.setOldName(((PageflowNode) getHost().getModel()).getName());
		cmd.setName((String) request.getCellEditor().getValue());
		return cmd;
	}

	/*
	 * (non-javadoc)
	 * 
	 * @see DirectEditPolicy#showCurrentEditValue(DirectEditRequest)
	 */
	protected void showCurrentEditValue(DirectEditRequest request) {
		// String value = (String)request.getCellEditor().getValue();
		// ((PageflowNodeFigure)getHostFigure()).setText(value);
	}

}

Back to the top