Home » Eclipse Projects » Remote Application Platform (RAP) » Custom widget embedding FCKeditor
|
Re: Custom widget embedding FCKeditor [message #513370 is a reply to message #513362] |
Tue, 09 February 2010 21:11 |
Nikolai Raitsev Messages: 102 Registered: July 2009 |
Senior Member |
|
|
Hi,
maybe you still need to register the fckeditor resources?
We do it programmatically, e.g.:
public RichHtmlEditor(Composite parent, int style) {
super(parent, style);
logger.debug("creating RichHtmlEditor Object, register tinymce resources");
Activator activator = Activator.getDefault();
if (!activator.isResoursesRegistered())
activator.registerResources();
}
In Activator of RichHtmlEditor-Bundle:
(under tiny_mce-Folder are all TinyMCE resources (all js-files and images)
public void registerResources()
{
try
{
logger.debug("register tinymce resources");
registerResources("tiny_mce", new String[]{".svn"});
resourcesRegistered = true;
}catch (Exception e)
{
logger.error("Error in registerResources", e);
resourcesRegistered = false;
}
}
/**
* Register all resources, recursively under specified folder
* <br />
* search path = plugin root location
*
* @param clazz - executor class
* @param folder - folder name
* @param exclude - compared by filename.startsWith(exclude[*])
*/
private void registerResources(String folder, String...exclude) {
RWT.getResourceManager().setContextLoader(this.getClass().ge tClassLoader());
List<String> collectedPaths = new ArrayList<String>();
getContents("/" + folder, collectedPaths, exclude);
for ( String resource:collectedPaths ) {
if ( !RWT.getResourceManager().isRegistered(resource) ) {
RWT.getResourceManager().register(resource);
logger.debug("registered resource ->" + resource);
}
}
}
private void getContents(String path, List<String> collectedPaths,
String...exclude)
{
Enumeration<?> enums = getBundle().getEntryPaths(path);
while(enums.hasMoreElements())
{
Object object = enums.nextElement();
Enumeration<?> tmpEnum =getBundle().getEntryPaths(object.toString());
if(tmpEnum != null)
getContents(object.toString(), collectedPaths, exclude);
else
{
boolean accept = true;
for(String str:exclude)
{
if(object.toString().contains(str))
accept = false;
}
if(accept)
collectedPaths.add(object.toString());
}
}
}
for more see in code from Georgi:)
wish you much fun:)
Best regards,
Nikolai
Valer Roman schrieb:
> Hello,
>
> I am trying to create a custom widget for the FCKEditor.
> I have studied the GMap example and all seems clear but ... the
> problem I have is in using the fckeditor.js java script library as a
> resource.
> I have used it as an external resource on a different server path
> localhost:8080/fckeditor/fckeditor.js. Here the problem is that it
> reports "Permission denied" messages on some code of other javascripts
> libraries fckeditor.js uses. This is I think because rap runs on
> localhost:9090/rap so it sees localhost:8080 as a different server and
> browser security forbids some methods to be executed.
> I would like somehow to have the fckeditor deployed on the same server
> as rap, localhost:9090/rap or something like that, to avoid the security
> problems.
> If somebody could help me ... maybe I am on the wrong track ...
>
> Thank you,
> Valer Roman
|
|
|
Re: Custom widget embedding FCKeditor [message #513373 is a reply to message #513370] |
Tue, 09 February 2010 21:29 |
Valer Roman Messages: 36 Registered: July 2009 |
Member |
|
|
Thanks again :)
I have also tried the TinyMCE code, works great. The only issue is that
I want to use also images in the text so I am still playing with
FCKEditor integration.
I have managed to start the FCKEditor visually, thanks to code from
TinyMCE, but got some errors when using.
I think your code for registering recursively resources will help me
advance.
will get back with more info or problems :)
Nikolai Raitsev wrote:
> Hi,
>
> maybe you still need to register the fckeditor resources?
>
> We do it programmatically, e.g.:
>
> public RichHtmlEditor(Composite parent, int style) {
> super(parent, style);
>
> logger.debug("creating RichHtmlEditor Object, register tinymce
> resources");
> Activator activator = Activator.getDefault();
> if (!activator.isResoursesRegistered())
> activator.registerResources();
> }
>
> In Activator of RichHtmlEditor-Bundle:
> (under tiny_mce-Folder are all TinyMCE resources (all js-files and images)
>
> public void registerResources()
> {
> try
> {
> logger.debug("register tinymce resources");
> registerResources("tiny_mce", new String[]{".svn"});
> resourcesRegistered = true;
> }catch (Exception e)
> {
> logger.error("Error in registerResources", e);
> resourcesRegistered = false;
> }
> }
>
> /**
> * Register all resources, recursively under specified folder
> * <br />
> * search path = plugin root location
> *
> * @param clazz - executor class
> * @param folder - folder name
> * @param exclude - compared by filename.startsWith(exclude[*])
> */
> private void registerResources(String folder, String...exclude) {
>
> RWT.getResourceManager().setContextLoader(this.getClass().ge tClassLoader());
>
>
> List<String> collectedPaths = new ArrayList<String>();
> getContents("/" + folder, collectedPaths, exclude);
> for ( String resource:collectedPaths ) {
> if ( !RWT.getResourceManager().isRegistered(resource) ) {
> RWT.getResourceManager().register(resource);
> logger.debug("registered resource ->" + resource);
> }
> }
>
> }
>
>
> private void getContents(String path, List<String> collectedPaths,
> String...exclude)
> {
> Enumeration<?> enums = getBundle().getEntryPaths(path);
>
> while(enums.hasMoreElements())
> {
> Object object = enums.nextElement();
> Enumeration<?> tmpEnum
> =getBundle().getEntryPaths(object.toString());
> if(tmpEnum != null)
> getContents(object.toString(), collectedPaths, exclude);
> else
> {
> boolean accept = true;
> for(String str:exclude)
> {
> if(object.toString().contains(str))
> accept = false;
> }
>
> if(accept)
> collectedPaths.add(object.toString());
> }
>
>
> }
> }
>
>
> for more see in code from Georgi:)
>
> wish you much fun:)
>
> Best regards,
>
> Nikolai
>
>
>
> Valer Roman schrieb:
>> Hello,
>>
>> I am trying to create a custom widget for the FCKEditor.
>> I have studied the GMap example and all seems clear but ... the
>> problem I have is in using the fckeditor.js java script library as a
>> resource.
>> I have used it as an external resource on a different server path
>> localhost:8080/fckeditor/fckeditor.js. Here the problem is that it
>> reports "Permission denied" messages on some code of other javascripts
>> libraries fckeditor.js uses. This is I think because rap runs on
>> localhost:9090/rap so it sees localhost:8080 as a different server and
>> browser security forbids some methods to be executed.
>> I would like somehow to have the fckeditor deployed on the same server
>> as rap, localhost:9090/rap or something like that, to avoid the security
>> problems.
>> If somebody could help me ... maybe I am on the wrong track ...
>>
>> Thank you,
>> Valer Roman
|
|
|
Goto Forum:
Current Time: Thu Oct 10 01:57:41 GMT 2024
Powered by FUDForum. Page generated in 0.07125 seconds
|