Commit 1e728d2c authored by Philip Makedonski's avatar Philip Makedonski
Browse files

+ add Render JUnit in right click popup menu on active editor (missing Handler support), #132

parent 1a635247
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -25,7 +25,9 @@ import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.handlers.HandlerUtil;
import org.eclipse.ui.part.FileEditorInput;
import org.etsi.mts.tdl.Package;
import org.etsi.mts.tdl.execution.java.codegen.JUnitTestGenerator;
import org.etsi.mts.tdl.execution.java.codegen.Settings;
@@ -39,7 +41,10 @@ public class RenderHandler extends AbstractHandler implements IHandler {
		IFile tdl = null;
		
		ISelection selection = HandlerUtil.getCurrentSelection(event);
		if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
		IEditorInput input = HandlerUtil.getActiveEditorInput(event);
		if (input != null && input instanceof FileEditorInput) {
			tdl = ((FileEditorInput) input).getFile();
		} else if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
			Object element = ((IStructuredSelection) selection).getFirstElement();
			if (element instanceof IFile) {
				String ext = ((IFile) element).getFileExtension();