David Karr <davidmichaelkarr@xxxxxxxxx> To:
mailing list of the Eclipse project." <eclipse-dev@xxxxxxxxxxx> Date:
12.01.2016 09:22 Subject:
Get current project in custom action Sent by:
Thanks. I managed to resolve this particular problem.
I posted this question on SO, and someone pointed out that the actual type
of the "editorInput" property I get from the editor is a "FileEditorInput",
which has a project property. However, I'm now seeing another similar
"action" issue with this, and the action class is part of Eclipse,
so I can't change it.
Specifically, I'm now examining the list of choices that
are presented for content assistance. The application has a "TextSourceViewerConfiguration"
subclass that overrides "getContentAssistant()". This method
creates a "ContentAssistant" and sets a custom "IContentAssistProcessor"
instance (which extends "TemplateCompletionProcessor").
When the user attempts completion, I don't see a project or editor easily
available. For lack of any other strategy, while sitting at the breakpoint,
I'm looking at all the getters available in the "TemplateCompletionProcessor"
subclass, looking for anything that might statically or dynamically lead
to a project or editor property.
Ironically, the TSVC subclass DOES have an "editor"
property, but I don't see any way to get access to that from the TCP subclass.
On Mon, Jan 11, 2016 at 1:18 AM Doug Schaefer <cdtdoug@xxxxxxxxx>
wrote: I would look at the code for "Open Declaration"
in the Java editor. But I assume it gets the current selection and goes
On Fri, Jan 8, 2016 at 6:21 PM, David Karr <davidmichaelkarr@xxxxxxxxx>
wrote: While in a custom editor action, how can I get the current
project that the file in the editor view resides within?
I would assume the "Open Declaration" action
in the Java editor has to deal with a similar problem. If the component
is defined with the same name in multiple projects, I assume it would prefer
to show the component from the same project as the current file in the
editor view belongs to. So how does it do that?