Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2008 IBM Corporation 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: IBM Corporation - initial API and implementation /
package org.eclipse.pde.internal.ua.ui.editor.ctxhelp.details;
The action used to remove one or more elements from the context help xml.

Since:
3.4
public class CtxHelpRemoveAction extends Action {
	//The next object to be selected after the
	//selected object is removed
	public CtxHelpRemoveAction() {
		// Adds the 'Delete' keybinding to the action when displayed
		// in a context menu
		setActionDefinitionId("org.eclipse.ui.edit.delete"); //$NON-NLS-1$
	}

Sets the objects to be removed when this action is run.

Parameters:
objects objects to remove
	public void setToRemove(CtxHelpObject[] objects) {
		 = objects;
	}
	/* (non-Javadoc)
	 * @see org.eclipse.jface.action.Action#run()
	 */
	public void run() {
		if ( == null)
			return;
		for (int i = 0; i < .; ++i) {
			if ([i] != null && [i].canBeRemoved()) {
				if (parent != null) {
					parent.removeChild([i]);
				}
			}
		}
	}

Determine the next object that should be selected after the designated object has been removed

Parameters:
parent The parent of the deleted object
	private void determineNextSelection(CtxHelpObject parentint index) {
		// Select the next sibling
		if ( == null) {
			// No next sibling
			// Select the previous sibling
			if ( == null) {
				// No previous sibling
				// Select the parent
				 = parent;
			}
		}
	}

Returns the object that should be selected after the action is run.

Returns:
the object to select or null
	}

Clears the next selection returned by getNextSelection().
	public void clearNextSelection() {
	}
New to GrepCode? Check out our FAQ X