Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Assign ".a.b" extention to my editor?
Assign ".a.b" extention to my editor? [message #335538] Tue, 14 April 2009 04:20 Go to next message
Dollyn Sun is currently offline Dollyn Sun
Messages: 59
Registered: July 2009
Location: China
Member

This is a multi-part message in MIME format.
--------------080902000204070301020906
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

For some reason, my client wants to make the *.ui.xml files to open with
a custom editor. But I found that it's no use to config it in the
org.eclipse.ui.editors extention.

I noticed the bug22905's status is still "new". Is there some other way
to achieve what I want?
<https://bugs.eclipse.org/bugs/show_bug.cgi?id=22905>
--

*/Dollyn/*


--------------080902000204070301020906
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
For some reason, my client wants to make the *.ui.xml files to open
with a custom editor. But I found that it's no use to config it in the
org.eclipse.ui.editors extention.<br>
<br>
I noticed the bug22905's status is still "new". Is there some other way
to achieve what I want?<a
href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=22905"></a>
<div class="moz-signature">-- <br>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; ">
<title>Dollyn</title>
<p><b><i><font color="#0000ff" face="Courier New">Dollyn</font></i></b></p>
</div>
</body>
</html>

--------------080902000204070301020906--


Dollyn
Re: Assign ".a.b" extention to my editor? [message #335542 is a reply to message #335538] Tue, 14 April 2009 05:45 Go to previous messageGo to next message
Dani Megert is currently offline Dani Megert
Messages: 3801
Registered: July 2009
Senior Member
Dollyn wrote:
> For some reason, my client wants to make the *.ui.xml files to open
> with a custom editor. But I found that it's no use to config it in the
> org.eclipse.ui.editors extention.
>
> I noticed the bug22905's status is still "new". Is there some other
> way to achieve what I want?
You could define a new content type and hook up your editor to it.

Dani
> --
>
> */Dollyn/*
>
Re: Assign ".a.b" extention to my editor? [message #335561 is a reply to message #335542] Tue, 14 April 2009 21:35 Go to previous messageGo to next message
Dollyn Sun is currently offline Dollyn Sun
Messages: 59
Registered: July 2009
Location: China
Member

This is a multi-part message in MIME format.
--------------000401090705040009020407
Content-Type: text/plain; charset=gb18030; format=flowed
Content-Transfer-Encoding: 7bit

But how? A content type can only define file-extensions and file-names,
but it seems no use to give it "double-extension"(like filenames xx.a.b).

Daniel Megert wrote:
> Dollyn wrote:
>> For some reason, my client wants to make the *.ui.xml files to open
>> with a custom editor. But I found that it's no use to config it in
>> the org.eclipse.ui.editors extention.
>>
>> I noticed the bug22905's status is still "new". Is there some other
>> way to achieve what I want?
> You could define a new content type and hook up your editor to it.
>
> Dani
>> --
>>
>> */Dollyn/*
>>

--

*/Dollyn/*


--------------000401090705040009020407
Content-Type: text/html; charset=gb18030
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=gb18030" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
But how? A content type can only define file-extensions and file-names,
but it seems no use to give it "double-extension"(like filenames
xx.a.b). <br>
<br>
Daniel Megert wrote:
<blockquote cite="mid:gs1lvc$r7v$1@build.eclipse.org" type="cite">Dollyn
wrote:
<br>
<blockquote type="cite">For some reason, my client wants to make the
*.ui.xml files to open with a custom editor. But I found that it's no
use to config it in the org.eclipse.ui.editors extention.
<br>
<br>
I noticed the bug22905's status is still "new". Is there some other way
to achieve what I want?
<br>
</blockquote>
You could define a new content type and hook up your editor to it.
<br>
<br>
Dani
<br>
<blockquote type="cite">--


Dollyn
Re: Assign ".a.b" extention to my editor? [message #335562 is a reply to message #335561] Wed, 15 April 2009 01:57 Go to previous messageGo to next message
Dani Megert is currently offline Dani Megert
Messages: 3801
Registered: July 2009
Senior Member
Dollyn wrote:
> But how? A content type can only define file-extensions and
> file-names, but it seems no use to give it "double-extension"(like
> filenames xx.a.b).
Read the extension point doc again with focus on content describer.

Dani
>
>
> Daniel Megert wrote:
>> Dollyn wrote:
>>> For some reason, my client wants to make the *.ui.xml files to open
>>> with a custom editor. But I found that it's no use to config it in
>>> the org.eclipse.ui.editors extention.
>>>
>>> I noticed the bug22905's status is still "new". Is there some other
>>> way to achieve what I want?
>> You could define a new content type and hook up your editor to it.
>>
>> Dani
>>> --
>>>
>>> */Dollyn/*
>>>
>
> --
>
> */Dollyn/*
>
Re: Assign ".a.b" extention to my editor? [message #335615 is a reply to message #335562] Thu, 16 April 2009 09:10 Go to previous messageGo to next message
Dollyn Sun is currently offline Dollyn Sun
Messages: 59
Registered: July 2009
Location: China
Member

The describer can only get the inputstream, but my files are the same
with normal xml-files, except the file-name.


Daniel Megert 写道:
> Dollyn wrote:
>> But how? A content type can only define file-extensions and
>> file-names, but it seems no use to give it "double-extension"(like
>> filenames xx.a.b).
> Read the extension point doc again with focus on content describer.
>
> Dani
>>
>>
>> Daniel Megert wrote:
>>> Dollyn wrote:
>>>> For some reason, my client wants to make the *.ui.xml files to open
>>>> with a custom editor. But I found that it's no use to config it in
>>>> the org.eclipse.ui.editors extention.
>>>>
>>>> I noticed the bug22905's status is still "new". Is there some other
>>>> way to achieve what I want?
>>> You could define a new content type and hook up your editor to it.
>>>
>>> Dani
>>>> --
>>>>
>>>> */Dollyn/*
>>>>
>>
>> --
>>
>> */Dollyn/*
>>


Dollyn
Re: Assign ".a.b" extention to my editor? [message #335619 is a reply to message #335615] Thu, 16 April 2009 11:44 Go to previous messageGo to next message
Dani Megert is currently offline Dani Megert
Messages: 3801
Registered: July 2009
Senior Member
Dollyn wrote:
> The describer can only get the inputstream,
The API is:
org.eclipse.core.runtime.content.IContentDescriber.describe( InputStream,
IContentDescription)

and it allows to set properties on the content description, doesn't it?

Dani
> but my files are the same with normal xml-files, except the file-name.
>
>
> Daniel Megert 写道:
>> Dollyn wrote:
>>> But how? A content type can only define file-extensions and
>>> file-names, but it seems no use to give it "double-extension"(like
>>> filenames xx.a.b).
>> Read the extension point doc again with focus on content describer.
>>
>> Dani
>>>
>>>
>>> Daniel Megert wrote:
>>>> Dollyn wrote:
>>>>> For some reason, my client wants to make the *.ui.xml files to
>>>>> open with a custom editor. But I found that it's no use to config
>>>>> it in the org.eclipse.ui.editors extention.
>>>>>
>>>>> I noticed the bug22905's status is still "new". Is there some
>>>>> other way to achieve what I want?
>>>> You could define a new content type and hook up your editor to it.
>>>>
>>>> Dani
>>>>> --
>>>>>
>>>>> */Dollyn/*
>>>>>
>>>
>>> --
>>>
>>> */Dollyn/*
>>>
Re: Assign ".a.b" extention to my editor? [message #335630 is a reply to message #335619] Thu, 16 April 2009 23:36 Go to previous messageGo to next message
Dollyn Sun is currently offline Dollyn Sun
Messages: 59
Registered: July 2009
Location: China
Member



Dollyn
Re: Assign ".a.b" extention to my editor? [message #335632 is a reply to message #335630] Fri, 17 April 2009 01:18 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.
Messages: 621
Registered: July 2009
Senior Member
>What I want is: all and only the files that have the name like *.a.b will
>be opened with my editor. Is that possible?


AFAIK, that is not possible. However, as Dani said, you can use the
contentTypes extension point. Since your files are XML, you can set the
content type with the root element of your XML:

<extension
point="org.eclipse.core.contenttype.contentTypes">
<content-type
id="yourXmlTypeId"
name="Some Name"
priority="normal">
<describer
class=" org.eclipse.core.runtime.content.XMLRootElementContentDescri ber ">
<parameter
name="element"
value="your_root_element">
</parameter>
</describer>
</content-type>
</extension>


Now you can associate this content type with your editor. HTH

- Prakash

--

http://blog.eclipse-tips.com
Re: Assign ".a.b" extention to my editor? [message #335634 is a reply to message #335632] Fri, 17 April 2009 01:53 Go to previous message
Dollyn Sun is currently offline Dollyn Sun
Messages: 59
Registered: July 2009
Location: China
Member

This is a multi-part message in MIME format.
--------------030700010009020609020407
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Well, this seems not what I want...

Our XML's have nothing in common, no common root's, no common schema...

But thank you all the same. Maybe we can persuade our clients to create
a common schema
for the XML...

Prakash G.R. wrote:
>> What I want is: all and only the files that have the name like *.a.b will
>> be opened with my editor. Is that possible?
>>
>
>
> AFAIK, that is not possible. However, as Dani said, you can use the
> contentTypes extension point. Since your files are XML, you can set the
> content type with the root element of your XML:
>
> <extension
> point="org.eclipse.core.contenttype.contentTypes">
> <content-type
> id="yourXmlTypeId"
> name="Some Name"
> priority="normal">
> <describer
> class=" org.eclipse.core.runtime.content.XMLRootElementContentDescri ber ">
> <parameter
> name="element"
> value="your_root_element">
> </parameter>
> </describer>
> </content-type>
> </extension>
>
>
> Now you can associate this content type with your editor. HTH
>
> - Prakash
>
>

--

*/Dollyn/*


--------------030700010009020609020407
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Well, this seems not what I want...<br>
<br>
Our XML's have nothing in common, no common root's, no common schema...<br>
<br>
But thank you all the same. Maybe we can persuade our clients to create
a common schema<br>
for the XML...<br>
<br>
Prakash G.R. wrote:
<blockquote cite="mid:gs93fi$es6$1@build.eclipse.org" type="cite">
<blockquote type="cite">
<pre wrap="">What I want is: all and only the files that have the name like *.a.b will
be opened with my editor. Is that possible?
</pre>
</blockquote>
<pre wrap=""><!---->

AFAIK, that is not possible. However, as Dani said, you can use the
contentTypes extension point. Since your files are XML, you can set the
content type with the root element of your XML:

&lt;extension
point="org.eclipse.core.contenttype.contentTypes"&gt;
&lt;content-type
id="yourXmlTypeId"
name="Some Name"
priority="normal"&gt;
&lt;describer
class=" org.eclipse.core.runtime.content.XMLRootElementContentDescri ber "&gt;
&lt;parameter
name="element"
value="your_root_element"&gt;
&lt;/parameter&gt;
&lt;/describer&gt;
&lt;/content-type&gt;
&lt;/extension&gt;


Now you can associate this content type with your editor. HTH

- Prakash

</pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; ">
<title>Dollyn</title>
<p><b><i><font color="#0000ff" face="Courier New">Dollyn</font></i></b></p>
</div>
</body>
</html>

--------------030700010009020609020407--


Dollyn
Previous Topic:Preferences: bugs and REF's for 3.4.2?
Next Topic:Re: Don't succeed to fetch bundles with p2IU, nor to use p2 director
Goto Forum:
  


Current Time: Mon Apr 21 09:02:23 EDT 2014

Powered by FUDForum. Page generated in 0.08445 seconds