Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Example Outline View Filter Question
Example Outline View Filter Question [message #53942] Mon, 29 June 2009 11:53 Go to next message
Porter is currently offline PorterFriend
Messages: 42
Registered: July 2009
Member
I'm going through the outline view filtering example from the Xtext
documentation.

Regarding the example FilterFooAction class (see below):
- where does the "Activator" come from in the lines
setImageDescriptor(Activator.getImageDescriptor("icons/foo.gif "));
setDisabledImageDescriptor(Activator.getImageDescriptor("icons/foo.gif "));
?

I can't find any Activator class with the getImageDescriptor method in my
workspace.

There is an Activator org.eclipse.xtext.ui.core.internal.Activator
with an imageDescriptorFromPlugin method. I guess this should this be used
instead?

I'm using the 0.7.0.v200906222230 version of Xtext.


------------------------------------------------------------ -----------
public class FilterFooAction extends AbstractFilterAction {

public FilterFooAction(XtextContentOutlinePage outlinePage) {
super("Filter Foo", outlinePage);
setToolTipText("Show / hide foo");
setDescription("Show / hide foo");
setImageDescriptor(Activator.getImageDescriptor("icons/foo.gif "));

setDisabledImageDescriptor(Activator.getImageDescriptor("icons/foo.gif "));
}

@Override
protected String getToggleId() {
return "FilterFooAction.isChecked";
}

@Override
protected ViewerFilter createFilter() {
return new FooOutlineFilter();
}

}
Re: Example Outline View Filter Question [message #54044 is a reply to message #53942] Mon, 29 June 2009 13:49 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Porter,

this snippet makes the assumption that you have something like

public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}

in your ConcreteMyDslActivator (extends MyDslActivator).
It the ConcreteMyDslActivator does not exist, you have to create it on
your own in your UI plugin (and change the Manifest.MF accordingly).
The alternative is to use #imageDescriptorFromPlugin(String, String)
directly.

Thanks for the hint, we'll fix the docs as soon as possible.

Regards,
Sebastian


Am 29.06.2009 13:53 Uhr, schrieb Porter:
> I'm going through the outline view filtering example from the Xtext
> documentation.
>
> Regarding the example FilterFooAction class (see below):
> - where does the "Activator" come from in the lines
> setImageDescriptor(Activator.getImageDescriptor("icons/foo.gif "));
> setDisabledImageDescriptor(Activator.getImageDescriptor("icons/foo.gif "));
> ?
>
> I can't find any Activator class with the getImageDescriptor method in
> my workspace.
>
> There is an Activator org.eclipse.xtext.ui.core.internal.Activator
> with an imageDescriptorFromPlugin method. I guess this should this be
> used instead?
>
> I'm using the 0.7.0.v200906222230 version of Xtext.
>
>
> ------------------------------------------------------------ -----------
> public class FilterFooAction extends AbstractFilterAction {
>
> public FilterFooAction(XtextContentOutlinePage outlinePage) {
> super("Filter Foo", outlinePage);
> setToolTipText("Show / hide foo");
> setDescription("Show / hide foo");
> setImageDescriptor(Activator.getImageDescriptor("icons/foo.gif "));
> setDisabledImageDescriptor(Activator.getImageDescriptor("icons/foo.gif "));
> }
>
> @Override
> protected String getToggleId() {
> return "FilterFooAction.isChecked";
> }
>
> @Override
> protected ViewerFilter createFilter() {
> return new FooOutlineFilter();
> }
>
> }
>
Previous Topic:Suggestion - custom post processing
Next Topic:Can I create GPL + DSL by XTEXT
Goto Forum:
  


Current Time: Sun Nov 03 12:23:55 GMT 2024

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

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

Back to the top