/*******************************************************************************
* Copyright (c) 2007, 2017 Red Hat Inc.
* 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:
* Red Hat - initial API and implementation
*******************************************************************************/
package org.eclipse.linuxtools.internal.rpm.ui.editor.actions;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.linuxtools.internal.rpm.ui.editor.SpecfileEditor;
import org.eclipse.linuxtools.rpm.ui.editor.parser.Specfile;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.handlers.HandlerUtil;
public class SpecfileEditorOrganizePatchesActionDelegate extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
if (editor instanceof SpecfileEditor) {
Specfile specfile = ((SpecfileEditor) editor).getSpecfile();
if (specfile != null) {
specfile.organizePatches();
}
}
return null;
}
}