Search in sources :

Example 1 with Generator

use of org.eclipse.linuxtools.rpmstubby.Generator in project linuxtools by eclipse.

the class StubifyHandler method execute.

@Override
public Object execute(ExecutionEvent event) {
    IFile featureFile = null;
    IStructuredSelection selection = HandlerUtil.getCurrentStructuredSelection(event);
    for (Object element : selection.toList()) {
        if (element instanceof IFile) {
            featureFile = (IFile) element;
        } else if (element instanceof IAdaptable) {
            featureFile = ((IAdaptable) element).getAdapter(IFile.class);
        }
        if (featureFile != null) {
            Generator generator = new Generator(getInputType());
            generator.generate(featureFile);
        }
    }
    return null;
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) IFile(org.eclipse.core.resources.IFile) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Generator(org.eclipse.linuxtools.rpmstubby.Generator)

Aggregations

IFile (org.eclipse.core.resources.IFile)1 IAdaptable (org.eclipse.core.runtime.IAdaptable)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 Generator (org.eclipse.linuxtools.rpmstubby.Generator)1