Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-dev] Get current project in custom action

Hi David,

The Text Editor Recipes tutorial might help. You can get the slides and code from here: https://www.eclipse.org/eclipse/platform-text/eclipseCon/2006/texteditorrecipes.zip.

Dani



From:        David Karr <davidmichaelkarr@xxxxxxxxx>
To:        "General development mailing list of the Eclipse project." <eclipse-dev@xxxxxxxxxxx>
Date:        12.01.2016 09:22
Subject:        Re: [eclipse-dev] Get current project in custom action
Sent by:        eclipse-dev-bounces@xxxxxxxxxxx




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 from there.

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?

My posting on the forum has more detail, but the previous statement is the main question: https://www.eclipse.org/forums/index.php/t/1073665/.

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?

_______________________________________________
eclipse-dev mailing list

eclipse-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

https://dev.eclipse.org/mailman/listinfo/eclipse-dev

_______________________________________________
eclipse-dev mailing list

eclipse-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

https://dev.eclipse.org/mailman/listinfo/eclipse-dev_______________________________________________
eclipse-dev mailing list
eclipse-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipse-dev


Back to the top