blob: 68b22e9f67596399558f7a4d7271ac34c24b3080 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2004-2008 Istvan Rath and Daniel Varro
* 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:
* Istvan Rath - initial API and implementation
*******************************************************************************/
package org.eclipse.viatra2.treeeditor.actions;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbenchPart;
public abstract class ViatraTreeEditorSelectionAction extends Action {
protected IWorkbenchPart iPart;
public ViatraTreeEditorSelectionAction() {
}
public ViatraTreeEditorSelectionAction(IWorkbenchPart part) {
iPart = part;
}
public void setWorkbenchPart(IWorkbenchPart part)
{
iPart = part;
}
/**
* Returns the selected objects in the tree viewer.
* @return
*/
public IStructuredSelection getSelectedObjects() {
try {
return (IStructuredSelection)iPart.getSite().getSelectionProvider().getSelection();
}
catch (ClassCastException e) {
return null;
}
}
/**
* Called when something has changed upon which the enabledness update must be propagated.
*/
public abstract void updateSelf();
int order_number = 0;
public Integer getOrderNumber() {
return order_number;
}
public void setOrderNumber(int i) {
order_number = i;
}
}