Custom Outline View for HTML files [message #227789] |
Thu, 12 February 2009 17:01  |
Eclipse User |
|
|
|
Hi all,
I try to provide a custom outline view for HTML files. In my plugin.xml
I have
<extension point="org.eclipse.wst.sse.ui.editorConfiguration">
<sourceViewerConfiguration
class="ch.raymi.plugin.coder.StructuredTextViewerConfiguration "
target="org.eclipse.wst.html.core.htmlsource"/>
<contentOutlineConfiguration
class="ch.raymi.plugin.coder.outline.OutlineConfiguration"
target="org.eclipse.wst.html.core.htmlsource"/>
</extension>
My StructuredTextViewerConfiguration extends
StructuredTextViewerConfigurationHTML. This seems to work (I am able to
provide my own content assist processors).
My OutlineConfiguration extends
org.eclipse.wst.html.ui.views.contentoutline.HTMLContentOutl ineConfiguration.
However none of the overridden methods is called (not even the
constructor), when I open a HTML file. The Outline View is there, but it
doesn't seem to use my class.
What's wrong?
Thanks for your help.
Dominik
|
|
|
|
|
|
Re: Custom Outline View for HTML files [message #227937 is a reply to message #227907] |
Mon, 16 February 2009 18:19   |
Eclipse User |
|
|
|
Thanks Nitin for your reply.
However, I'm really going to become desperate. Whatever I try, nothing
seems to work.
I tried as suggested (with ch.raymi.plugin being my Plugin ID):
<extension
point="org.eclipse.core.runtime.contentTypes">
<content-type
file-extensions="html"
priority="high"
name="BX HTML"
id="bx"
base-type="org.eclipse.wst.html.core.htmlsource"/>
</extension>
<extension
point="org.eclipse.wst.sse.ui.editorConfiguration">
<sourceViewerConfiguration
class=ch.raymi.plugin.coder.StructuredTextViewerConfiguratio n "
target="ch.raymi.plugin.bx" />
<contentOutlineConfiguration
class="ch.raymi.plugin.coder.outline.OutlineConfiguration"
target="ch.raymi.plugin.bx"/>
</extension>
Neither my StructuredTextViewerConfiguration nor the
OutlineConfiguration work with this configuration. If I change both
targets to the super type "org.eclipse.wst.html.core.htmlsource" (as in
my first attempt): the StructuredTextViewerConfiguration starts to work,
the OutlineConfiguration does not.
How can this asymmetrical behavior be explained? Why are the targets
differently resolved?
Is there a way I can debug this problem easily?
Can you provide a working example (this should be easily reproducible,
shouldn't it?)?
Thank you very much for your help. I'd really like this to work...
Dominik
Nitin Dahyabhai schrieb:
> Dominik Raymann wrote:
>> Thanks for your quick reply.
>>
>> Being new to plugin development in general (and wst extensions
>> specifically) I do not really understand what you mean by "higher
>> target IDs".
>>
>> The following naive approach of extending the HTML content type does
>> not seem to work either:
>>
>> <extension
>> point="org.eclipse.core.runtime.contentTypes">
>> <content-type
>> file-extensions="html"
>> priority="high"
>> name="BX HTML"
>> id="ch.raymi.plugin.html"
>> base-type="org.eclipse.wst.html.core.htmlsource"
>> default-charset="UTF-8" />
>> </extension>
>>
>> <extension
>> point="org.eclipse.wst.sse.ui.editorConfiguration">
>> <sourceViewerConfiguration
>> class=" ch.raymi.plugin.html.plugin.coder.StructuredTextViewerConfig uration "
>>
>> target="ch.raymi.plugin.html"/>
>> <contentOutlineConfiguration
>> class=" ch.raymi.plugin.html.plugin.coder.outline.OutlineConfigurati on "
>> target="ch.raymi.plugin.html"/>
>> </extension>
>>
>>
>> Now even my StructuredTextViewerConfiguation doesn't seem to work any
>> longer. Could someone elaborate a bit further, what needs to be done?
>>
>> Sorry for my newbie questions, but I find it quite difficult to get
>> started.
>
> Odds are you're making invalid assumptions about the ID for your content
> type, since I think the value is always appended to the declaring
> plug-in's ID. For example, our org.eclipse.wst.html.core plug-in
> specifies an ID value of "htmlsource" to its HTML content type, but the
> end result is the org.eclipse.wst.html.core.htmlsource that you are
> referring to above.
>
> As for the target IDs, we look them up using a list we generate at
> runtime with a very specific order, so when I say "higher" I mean higher
> in that list. Targets based on content types come after the IDs based
> on the editor's part ID and class name. The generation of target IDs
> occurs in the
> org.eclipse.wst.sse.ui.internal.provisional.extensions.Confi gurationPointCalculator
> class if you're curious.
> http://www.eclipse.org/webtools/wst/components/sse/designs/E ditorConfiguration.html
> mentions it as the "Target Resolution Policy".
>
|
|
|
Re: Custom Outline View for HTML files [message #227985 is a reply to message #227937] |
Tue, 17 February 2009 18:18   |
Eclipse User |
|
|
|
Note:
I read the following on
http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. wst.doc.isv/html/plugin_descriptions_WST/cheatsheet_tutorial .html
---
Providing your own outline view
To change the default outline view you have to provide your own adapter
factory provider. To register it with the SSE extend the
org.eclipse.wst.sse.ui.adapterFactoryDescription extension point.
<extension point="org.eclipse.wst.sse.ui.adapterFactoryDescription">
<adapterFactoryDescription
class="org.eclipse.wst.cs.ui.registry.AdapterFactoryProviderForCS "/>
</extension>
The adapter factory provider should add your own adapter factory to the
factory registry.
---
Do I really have to provide an implementation of this adapter? How
should I do that?
Dominik Raymann schrieb:
> Thanks Nitin for your reply.
>
>
> However, I'm really going to become desperate. Whatever I try, nothing
> seems to work.
>
> I tried as suggested (with ch.raymi.plugin being my Plugin ID):
>
> <extension
> point="org.eclipse.core.runtime.contentTypes">
> <content-type
> file-extensions="html"
> priority="high"
> name="BX HTML"
> id="bx"
> base-type="org.eclipse.wst.html.core.htmlsource"/>
> </extension>
>
> <extension
> point="org.eclipse.wst.sse.ui.editorConfiguration">
>
> <sourceViewerConfiguration
> class=ch.raymi.plugin.coder.StructuredTextViewerConfiguratio n "
> target="ch.raymi.plugin.bx" />
>
> <contentOutlineConfiguration
> class="ch.raymi.plugin.coder.outline.OutlineConfiguration"
> target="ch.raymi.plugin.bx"/>
>
> </extension>
>
> Neither my StructuredTextViewerConfiguration nor the
> OutlineConfiguration work with this configuration. If I change both
> targets to the super type "org.eclipse.wst.html.core.htmlsource" (as in
> my first attempt): the StructuredTextViewerConfiguration starts to work,
> the OutlineConfiguration does not.
>
> How can this asymmetrical behavior be explained? Why are the targets
> differently resolved?
>
> Is there a way I can debug this problem easily?
> Can you provide a working example (this should be easily reproducible,
> shouldn't it?)?
>
> Thank you very much for your help. I'd really like this to work...
>
>
> Dominik
>
>
>
>
> Nitin Dahyabhai schrieb:
>> Dominik Raymann wrote:
>>> Thanks for your quick reply.
>>>
>>> Being new to plugin development in general (and wst extensions
>>> specifically) I do not really understand what you mean by "higher
>>> target IDs".
>>>
>>> The following naive approach of extending the HTML content type does
>>> not seem to work either:
>>>
>>> <extension
>>> point="org.eclipse.core.runtime.contentTypes">
>>> <content-type
>>> file-extensions="html"
>>> priority="high"
>>> name="BX HTML"
>>> id="ch.raymi.plugin.html"
>>> base-type="org.eclipse.wst.html.core.htmlsource"
>>> default-charset="UTF-8" />
>>> </extension>
>>>
>>> <extension
>>> point="org.eclipse.wst.sse.ui.editorConfiguration">
>>> <sourceViewerConfiguration
>>> class=" ch.raymi.plugin.html.plugin.coder.StructuredTextViewerConfig uration "
>>>
>>> target="ch.raymi.plugin.html"/>
>>> <contentOutlineConfiguration
>>> class=" ch.raymi.plugin.html.plugin.coder.outline.OutlineConfigurati on "
>>> target="ch.raymi.plugin.html"/>
>>> </extension>
>>>
>>>
>>> Now even my StructuredTextViewerConfiguation doesn't seem to work any
>>> longer. Could someone elaborate a bit further, what needs to be done?
>>>
>>> Sorry for my newbie questions, but I find it quite difficult to get
>>> started.
>>
>> Odds are you're making invalid assumptions about the ID for your
>> content type, since I think the value is always appended to the
>> declaring plug-in's ID. For example, our org.eclipse.wst.html.core
>> plug-in specifies an ID value of "htmlsource" to its HTML content
>> type, but the end result is the org.eclipse.wst.html.core.htmlsource
>> that you are referring to above.
>>
>> As for the target IDs, we look them up using a list we generate at
>> runtime with a very specific order, so when I say "higher" I mean
>> higher in that list. Targets based on content types come after the
>> IDs based on the editor's part ID and class name. The generation of
>> target IDs occurs in the
>> org.eclipse.wst.sse.ui.internal.provisional.extensions.Confi gurationPointCalculator
>> class if you're curious.
>> http://www.eclipse.org/webtools/wst/components/sse/designs/E ditorConfiguration.html
>> mentions it as the "Target Resolution Policy".
>>
|
|
|
|
|
|
Re: Custom Outline View for HTML files [message #228149 is a reply to message #228142] |
Sat, 21 February 2009 12:20   |
Eclipse User |
|
|
|
Nitin Dahyabhai schrieb:>
> That shouldn't be necessary, after all, contentOutlineConfiguration is
> the same extension point as sourceViewerConfiguration. If one loads,
> the other should. Are you certain your content outline configuration
> class is not being instantiated?
I'm quite sure. But because you made me uncertain, I started over (using
the Plugin Wizard) with a minimalistic example. I permit myself to
include all the files of this little test plugin at the end of this
post. When you run the plugin and create/open a file named test.html,
you'll see, that the constructor of the
StructuredTextViewerConfiguration is called, but the one of the
OutlineConfiguration is not.
-- MANIFEST.MF --
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: MyPlugin Plug-in
Bundle-SymbolicName: ch.raymi.plugin;singleton:=true
Bundle-Version: 1.0.0
Bundle-Activator: ch.raymi.plugin.Activator
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.wst.sse.ui,
org.eclipse.wst.html.ui;bundle-version="1.0.301",
org.eclipse.jface.text;bundle-version="3.4.1",
org.eclipse.wst.xml.ui;bundle-version="1.0.410"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-- END OF MANIFEST.MF --
-- plugin.xml --
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension
point="org.eclipse.core.runtime.contentTypes">
<content-type
file-extensions="html"
priority="high"
name="BX HTML"
id="bx"
base-type="org.eclipse.wst.html.core.htmlsource"/>
<file-association
content-type="ch.raymi.plugin.bx"
file-names="test.html" />
</extension>
<extension
point="org.eclipse.wst.sse.ui.editorConfiguration">
<sourceViewerConfiguration
class="ch.raymi.plugin.StructuredTextViewerConfiguration"
target="ch.raymi.plugin.bx"/>
<contentOutlineConfiguration
class="ch.raymi.plugin.OutlineConfiguration"
target="ch.raymi.plugin.bx"/>
</extension>
</plugin>
-- END OF plugin.xml --
-- ch.raymi.plugin.Activator --
public class Activator extends AbstractUIPlugin {
Standard Implementation as generated by wizard
}
-- END OF ch.raymi.plugin.Activator --
-- ch.raymi.plugin.StructuredTextViewerConfiguration --
package ch.raymi.plugin;
import org.eclipse.wst.html.ui.StructuredTextViewerConfigurationHTM L;
public class StructuredTextViewerConfiguration extends
StructuredTextViewerConfigurationHTML {
public StructuredTextViewerConfiguration() {
System.out.println("structured configuration called");
}
}
-- END OF ch.raymi.plugin.StructuredTextViewerConfiguration --
-- ch.raymi.plugin.OutlineConfiguration --
package ch.raymi.plugin;
import
org.eclipse.wst.html.ui.views.contentoutline.HTMLContentOutl ineConfiguration;
public class OutlineConfiguration extends HTMLContentOutlineConfiguration {
public OutlineConfiguration() {
System.out.println("outline configuration called");
}
}
-- END OF ch.raymi.plugin.OutlineConfiguration --
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07084 seconds