Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Programmatically get java proposals for eclipse bundle(Programmatically get java proposals for eclipse bundle)
Programmatically get java proposals for eclipse bundle [message #1703019] Tue, 28 July 2015 05:25 Go to next message
Shailendra Verma is currently offline Shailendra VermaFriend
Messages: 4
Registered: July 2015
Junior Member
Problem

I am developing one eclipse osgi bundle to correct java source code automatically. I am able to get java project object and a class object inside it which I want to correct. I put one test file in project which can be corrected (like duplicate imports) but I receive below error on my code

Error
[color=red]
java.lang.IllegalStateException: Workbench has not been created yet.
	at org.eclipse.ui.PlatformUI.getWorkbench(PlatformUI.java:93)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.install(ASTProvider.java:236)
	at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.<init>(ASTProvider.java:227)
	at org.eclipse.jdt.internal.ui.JavaPlugin.getASTProvider(JavaPlugin.java:741)
	at org.eclipse.jdt.ui.SharedASTProvider.getAST(SharedASTProvider.java:128)
	at org.eclipse.jdt.internal.ui.text.correction.AssistContext.getASTRoot(AssistContext.java:119)
	at org.eclipse.jdt.internal.ui.text.correction.ReorgCorrectionsSubProcessor.removeImportStatementProposals(ReorgCorrectionsSubProcessor.java:210)
	at org.eclipse.jdt.internal.ui.text.correction.QuickFixProcessor.process(QuickFixProcessor.java:337)
	at org.eclipse.jdt.internal.ui.text.correction.QuickFixProcessor.getCorrections(QuickFixProcessor.java:316)
	at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionCollector.safeRun(JavaCorrectionProcessor.java:378)
	at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.run(JavaCorrectionProcessor.java:339)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor$SafeCorrectionProcessorAccess.process(JavaCorrectionProcessor.java:335)
	at org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor.collectCorrections(JavaCorrectionProcessor.java:468)
[/color]



Below is my code snippet:
....
CompletionProposalCollector collectorPrjTemp= new CompletionProposalCollector(javaProject); // this line throws error
IJavaCompletionProposal[] prjProposals = collectorPrjTemp.getJavaCompletionProposals();
System.out.println("prjProposals == "+prjProposals.length);
....
Re: Programmatically get java proposals for eclipse bundle [message #1703306 is a reply to message #1703019] Thu, 30 July 2015 13:22 Go to previous messageGo to next message
Shailendra Verma is currently offline Shailendra VermaFriend
Messages: 4
Registered: July 2015
Junior Member
I though people would solve my problem here in minutes, but looks like this is really complex for them and I got no answer in this much time Sad
Re: Programmatically get java proposals for eclipse bundle [message #1703555 is a reply to message #1703306] Mon, 03 August 2015 05:03 Go to previous message
Shailendra Verma is currently offline Shailendra VermaFriend
Messages: 4
Registered: July 2015
Junior Member
I need to create one handler from where I get ExecutionEvent Object and then I trigger my flow from that point and get object of Workbench, ResourcePlugin, Workspace and Project/JavaProject.

And at last I am able to get proposals which I need. So if you need workbench object you need UI.

If some one need more information he can contact me at shailendravermag@gmail.com
Previous Topic:Can I use org.eclipse.equinox.ds v1.4.1 instead of 1.3.1 in RCP app based on 3.7.2?
Next Topic:Get host servletcontext init param with mars servlet bridge
Goto Forum:
  


Current Time: Fri Apr 26 08:27:44 GMT 2024

Powered by FUDForum. Page generated in 0.03775 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top