Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3177

read source code by using ADT SDK

$
0
0

Hi experts,

 

I am currently creating an ADT plugin for eclipse.

My aim is to read abap source code of current frame program / class, parse it and display some extracts in my own view.

 

But how can I read source code via ADT SDK?

 

Maybe I can use AdtSourceFileRetrievalServiceFactory/IAdtSourceFileRetrievalService, but I have to pass IFile. How do I get IFile when all I have is program name?


Are there any existing code samples / template projects?


Any hints appreciated.


Thank you

Peter

 

Message was edited by: Peter Herweg P. S.: Of course I can read content of current editor (see below). But when coding contains INCLUDEs, I have to read content of these includes additionally.     public Object execute(ExecutionEvent event) throws ExecutionException {         IWorkbenchWindow window = HandlerUtil                 .getActiveWorkbenchWindowChecked(event);         try {                     IEditorPart editorPart = window.getActivePage().getActiveEditor();                         ITextEditor editor = (ITextEditor) editorPart                     .getAdapter(ITextEditor.class);                         if (editor != null) {                 IDocumentProvider provider = editor.getDocumentProvider();                 IDocument document = provider.getDocument(editor.getEditorInput());                     try {                     String code = document.get();                         code = AbapSource.getCleanCode(code);                                     document.set(code);                 } catch (Exception ex) {                     //TODO                                    }             }         } catch (java.lang.Exception ex) {             //TODO         }         return null;     }


Viewing all articles
Browse latest Browse all 3177

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>