Closed christianguenter2 closed 5 years ago
Well I think thats with the parameter should not be a big deal on ABAP in Eclipse side too (still have to check this). But If the package changes I have to open a new GUI window and each time ZABAPGIT is opened the user has to provide his login data within abapGit for the GIT repository again (as far as I know). Well one solution would be that I send also the username/password as parameters, but I am not sure if this opens a security vulnerability. Then there to think about how the Eclipse editor should behave when a abapGIT is opened several times for the same package or for several packages.
But to sum it up if we can solve the credential issue the rest should not be something which stops us.
Ṫhere is a userexit for authentication. https://github.com/larshp/abapGit/issues/1841 https://github.com/sandraros/abapGit-user-exit-logon-by-rfc If one uses this auth shouldn't be a problem.
Imho abapGit should only be opened when the user explicitly triggers via context menu. And then I think it's also ok for users to provide their credentials.
INCLUDE zabapgit_unit_test.
Hi Christian!
I added the functionality. Now I send the current package name as parameter, which can be retrieved over CL_ADT_GUI_INTEGRATION_CONTEXT=>read_context( ) ... see sample coding within abapGit below.
The version is not yet releases but commited to this github repository.
Let me know if the parameter name and the mode of transfer is ok for you. From Eclipse site I think you will get requests with a filled parameter and without or with the value ''.
Greetings, Andreas
INCLUDE zabapgit_forms.
INITIALIZATION.
DATA(context) = CL_ADT_GUI_INTEGRATION_CONTEXT=>read_context( ). DATA(parameters) = context-parameters. "sample content for parameters: p_package_name%3Dtestpackage
lcl_password_dialog=>on_screen_init( ).
If this proposal works on abapGit side I think I will let Eclipse open for each package a ZABAPGIT transaction. Therefore the user has to login only once for each package (or never when he/she uses the userexit.
Looks good. Implemented the abapGit part in this branch. https://github.com/christianguenter2/abapGit/tree/start_with_package
Couldn't test as I don't know how to start eclipse with a plugin from source. Any hints? Do I need the PDE eclipse installation?
Normally it should be quite straightforward to start the plugin in testmode, see the following issue.
From this issue take step 1 and afterwards build the project and run it as Eclipse application.
Thanks. I get some errors regarding
import org.powermock.reflect.Whitebox;
Any idea how to resolve them?
I think there is a plugin missing which contains the mockito framework The fastest solution is to remove the entire test folder.
Ok, deleting the file AbapGitHandlerTest.java seems to work. Btw. it's not in test folder, but in src.
When I test I get this exception and nothing happens.
!ENTRY org.eclipse.ui 4 0 2018-11-30 17:51:24.400 !MESSAGE Unhandled event loop exception !STACK 0 org.eclipse.e4.core.di.InjectionException: java.lang.ClassCastException: org.eclipse.ui.part.FileEditorInput cannot be cast to com.sap.adt.sapgui.ui.internal.editors.GuiEditorInput at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:65) at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:318) at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:252) at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:161) at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:494) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487) at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:204) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:433) at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.handleWidgetSelection(AbstractContributionItem.java:446) at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.lambda$2(AbstractContributionItem.java:472) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4118) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3931) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3534) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1170) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1059) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153) at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:667) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:597) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:656) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:592) at org.eclipse.equinox.launcher.Main.run(Main.java:1498) at org.eclipse.equinox.launcher.Main.main(Main.java:1471) Caused by: java.lang.ClassCastException: org.eclipse.ui.part.FileEditorInput cannot be cast to com.sap.adt.sapgui.ui.internal.editors.GuiEditorInput at abapci.handlers.AbapGitHandler.getAbapGitEditorReference(AbapGitHandler.java:142) at abapci.handlers.AbapGitHandler.execute(AbapGitHandler.java:105) at abapci.handlers.AbapGitHandler.execute(AbapGitHandler.java:93) at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:291) at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:93) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:55) ... 37 more
Interesting error message. I am pretty sure that the reason is that you had at least one tab open named with ZABAPGIT. The old logic is that in this case no new tab is opened, but nevertheless it should be brought to the forefront.
This logic will anyway be changed, thus for testing purposes I would ask you to ensure that ideally no tab is open or at least no tab with the label ZABAPGIT, when pressing the abapGit context menu in the project explorer (with an package entry selected in the project explorer of course)
You're right, I had an abapGit class open. Now it works! The right repo is opened.
I'll submit a PR for abapGit changes during the weekend.
perfect, I will finalize the Eclipse part and release it also the next week
implemented and new version 0.5.4.4 released, but not yet testet with the latest abapGit version
Tested successfully.
Currently when we call![image](https://user-images.githubusercontent.com/17437789/49076278-e9d5e680-f238-11e8-95cf-656c91bb7ffd.png)
abapGit
in the context menu of a package abapGit is opened with home screen and no repo is opened.It would be nice if we could open the repo corresponding to the selected package automatically. Technically we can solve this with a GET/SET parameter (which doesn't exist yet in abapGit but would be easy to implement). Is it possible to supply GET/SET parameters from ADT when calling a transaction? If yes we can do this.