StructureView Filter

What is the hook of getting the button state from the
ActionPresentationData.

In the Javascript language example there is no example for add a filter
to the structure.

I understand the Filter interface from the API and implement it. I
understand the ActionPresentationData which is delivered by my filter
and the icon is shown in the structure viewer. But I don't know how to
get its checking state, which could be requested by isVisible in the filter.

Thanks
Thomas

8 comments
Comment actions Permalink

Hello, anybody out there from Jetbrains? Please give me some brain for
my post.

And I wanted to ask one further question which might be related, can you
give me some hints how to expand/collapse the tree in the structure
viewer by a similar button?

Thomas

Thomas Hartwig wrote:

What is the hook of getting the button state from the
ActionPresentationData.

In the Javascript language example there is no example for add a filter
to the structure.

I understand the Filter interface from the API and implement it. I
understand the ActionPresentationData which is delivered by my filter
and the icon is shown in the structure viewer. But I don't know how to
get its checking state, which could be requested by isVisible in the
filter.

Thanks
Thomas

0
Comment actions Permalink

Thomas Hartwig wrote:

I understand the Filter interface from the API and implement it. I
understand the ActionPresentationData which is delivered by my filter
and the icon is shown in the structure viewer. But I don't know how to
get its checking state, which could be requested by isVisible in the
filter.


From a quick glance at the API I think the point is that you don't need to know the
state of the filter-action. IDEA applies the filter if it's checked (or if it's not
checked and isReverted() returns true). You don't have anything else to do than
implementing isVisible() for the kind of filter you want to add.

As I understand it, TreeAction & friends are not meant to represent arbitrary actions,
it's just about Groupers, Filters and Sorters - nothing more. If you want custom actions
in your Structure View you'll have to provide an own implementation for it. There's the
base component com.intellij.ide.structureView.newStructureView.StructureViewComponent, but
it's not part of the OpenAPI. This also looks like it has methods to expand/select certain
nodes in the tree.

I never actually used this, so this is only how I think it works. Someone please correct
me if I'm wrong.

HTH,
Sascha

0
Comment actions Permalink

Sascha, thank you so much. Please check:

I did know this because...

[] I'm are a guru
[] I read the f. manual, please specify which one: ...
[] I know how the people from Jetbrains code without documentating
[] the rest of the world is doing this in that way (Thomas must be stupid)

Thomas

Sascha Weinreuter wrote:

Thomas Hartwig wrote:

>>I understand the Filter interface from the API and implement it. I
>>understand the ActionPresentationData which is delivered by my filter
>>and the icon is shown in the structure viewer. But I don't know how to
>>get its checking state, which could be requested by isVisible in the
>>filter.


From a quick glance at the API I think the point is that you don't need to know the
state of the filter-action. IDEA applies the filter if it's checked (or if it's not
checked and isReverted() returns true). You don't have anything else to do than
implementing isVisible() for the kind of filter you want to add.

As I understand it, TreeAction & friends are not meant to represent arbitrary actions,
it's just about Groupers, Filters and Sorters - nothing more. If you want custom actions
in your Structure View you'll have to provide an own implementation for it. There's the
base component com.intellij.ide.structureView.newStructureView.StructureViewComponent, but
it's not part of the OpenAPI. This also looks like it has methods to expand/select certain
nodes in the tree.

I never actually used this, so this is only how I think it works. Someone please correct
me if I'm wrong.

HTH,
Sascha

0
Comment actions Permalink

I think for me and Sascha it's a combination of the last 3. The manual is the
javadoc. The biggest one for me is #3. As you use the OpenAPI you learn about
how JB typically structures and names things. When I'm looking for how to use a
feature, I press Ctrl+N and type *Manager. If I don't know how to acquire an
instance of some class I need to call some method, I search CtrlShiftN for
getwhateverthing and a few variations.

Thomas Hartwig wrote:

Sascha, thank you so much. Please check:

I did know this because...

[] I'm are a guru
[] I read the f. manual, please specify which one: ...
[] I know how the people from Jetbrains code without documentating
[] the rest of the world is doing this in that way (Thomas must be stupid)

Thomas

Sascha Weinreuter wrote:

>> Thomas Hartwig wrote:
>>
>>> I understand the Filter interface from the API and implement it. I
>>> understand the ActionPresentationData which is delivered by my filter
>>> and the icon is shown in the structure viewer. But I don't know how to
>>> get its checking state, which could be requested by isVisible in the
>>> filter.
>>
>>
>>
>> From a quick glance at the API I think the point is that you don't
>> need to know the
>> state of the filter-action. IDEA applies the filter if it's checked
>> (or if it's not
>> checked and isReverted() returns true). You don't have anything else
>> to do than
>> implementing isVisible() for the kind of filter you want to add.
>>
>> As I understand it, TreeAction & friends are not meant to represent
>> arbitrary actions,
>> it's just about Groupers, Filters and Sorters - nothing more. If you
>> want custom actions
>> in your Structure View you'll have to provide an own implementation
>> for it. There's the
>> base component
>> com.intellij.ide.structureView.newStructureView.StructureViewComponent,
>> but
>> it's not part of the OpenAPI. This also looks like it has methods to
>> expand/select certain
>> nodes in the tree.
>>
>> I never actually used this, so this is only how I think it works.
>> Someone please correct
>> me if I'm wrong.
>>
>> HTH,
>> Sascha

0
Comment actions Permalink

Thomas Hartwig wrote:

Sascha, thank you so much. Please check:

I did know this because...

[] I'm are a guru

Haha, I'm not so overconfident to check this, but well, I've been following the API since
its early days for more than 3 years now and I've indeed come across a lot of stuff.

[] I read the f. manual, please specify which one: ...

Sorry, no manual except the OpenAPI javadoc which has made some good progress in some
areas lately. But it still doesn't cover all opened subsystems yet.

[] I know how the people from Jetbrains code without documentating

Hmm, kind of. As I said, after all that time you get a 6th sense for how some things are
done or might work. And of course there are the tools you get with IDEA, such as ctrl-n,
the implements- and overrides-indicators, Structural Search, etc.

[] the rest of the world is doing this in that way (Thomas must be stupid)

Nah, the rest of the world is writing crappy Eclipse plugins. The fact that you're
developing an IDEA plugin says you're not stupid ;)

Sascha

0
Comment actions Permalink

I do think you are an openapi guru.

Bas

Sascha Weinreuter wrote:

Thomas Hartwig wrote:

>> Sascha, thank you so much. Please check:
>>
>> I did know this because...
>>
>> [] I'm are a guru

Haha, I'm not so overconfident to check this, but well, I've been following the API since
its early days for more than 3 years now and I've indeed come across a lot of stuff.

>> [] I read the f. manual, please specify which one: ...

Sorry, no manual except the OpenAPI javadoc which has made some good progress in some
areas lately. But it still doesn't cover all opened subsystems yet.

>> [] I know how the people from Jetbrains code without documentating

Hmm, kind of. As I said, after all that time you get a 6th sense for how some things are
done or might work. And of course there are the tools you get with IDEA, such as ctrl-n,
the implements- and overrides-indicators, Structural Search, etc.

>> [] the rest of the world is doing this in that way (Thomas must be stupid)

Nah, the rest of the world is writing crappy Eclipse plugins. The fact that you're
developing an IDEA plugin says you're not stupid ;)

Sascha

0
Comment actions Permalink

Bas Leijdekkers wrote:

I do think you are an openapi guru.


Ohhh - getting slightly red - thanks ;)

Sascha

0
Comment actions Permalink

Nah, the rest of the world is writing crappy Eclipse plugins. The fact that you're
developing an IDEA plugin says you're not stupid ;)

Well amen to this.

0

Please sign in to leave a comment.