I'm developing an eclipse plugin , and at some point in my plugin , a jframe is opened , and inside the jframe, there is a button . I have added a mouselistener to the button , and when pressed , I want some code to be added to the editor at caret point . but, I get null pointer exception here:
IWorkbenchPage page = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage();
It appears you don't have an active page. Maybe your Swing based code is displaying a separate window?
Use IWorkbenchWindow.getPages() to get an array of IWorkbenchPage containing all the pages and look through the pages for the one containing the editor you want.
Related
I have to navigate between my components and I use a custom button like this:
button.addClickListener(click -> {
UI.getCurrent().navigate(ClassToNavigate.class);
});
The url does refresh in the search bar but it only shows a black page, I've to hit F5 to see the component in my parent layout.
My only fix is to add:
UI.getCurrent().getPage().reload();
...which reloads the page after navigating to the URL, and that breaks the UX in my opinion, however... when using a BeforeEnterEvent on a class and using the method:
forwardTo(ClassToNavigate.class);
redirects perfectly... although I can't have BeforeEnterEvent for every menu button I have, I can't see why forwardTo() works perfectly and navigate() doesn't.
Is there a way to navigate without having to reload the page? And without using RouterLink which I can't because I'm already using a custom component.
Thanks in advance!
I need to create drag and drop for my app.
I have a tree in the left part of the window and empty editor area in the right part of the window. I want to drag an element from the tree and drop to the right part.
Editor tab should opens after that.
What I have already done:
I created the button to open editor of selected tree item and it works. When I drag item and drop it to the existed editor a new editor opens.
But I can't to do the same when I don't have any editor (only empty editor area)
Please tell me what should I do or what should I specify like target for drop action. Thanks in advance!
In your RCP's worbench window advisor class you need to set up the editor area drag/drop transfer types and the drop adapter in the preWindowOpen method.
For example Eclipse itself uses:
public void preWindowOpen() {
IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
configurer.addEditorAreaTransfer(EditorInputTransfer.getInstance());
configurer.addEditorAreaTransfer(ResourceTransfer.getInstance());
configurer.addEditorAreaTransfer(FileTransfer.getInstance());
configurer.addEditorAreaTransfer(MarkerTransfer.getInstance());
configurer.configureEditorAreaDropListener(new EditorAreaDropAdapter(
configurer.getWindow()));
Note that EditorAreaDropAdapter is an internal class so you can't use it, you will have to write your own drop adapter. This is likely to end up calling IWorbenchPage.openEditor
I would like to display the HTML text in a Java SWT Label.
Below is my code for creating a label.
Label theLabel = new Label(controls,SWT.WRAP);
theLabel.setSize(100,500);
theLable.setText("<html><ol><li>Hello</li><li>welcome</li></ol></html>");
When I run the application as Eclipse Application I get the output as:
<html><ol><li>Hello</li><li>welcome</li></ol></html>
What is the mistake? Why I am not getting the html formatted output in my label? I am using Eclipse plugin with a view.
To show HTML with SWT you will have to use the Browser widget instead.
Browser browser = new Browser( parent, SWT.NONE );
browser.setText( "<html><ol><li>Hello</li><li>welcome</li></ol></html>" );
If you don't mind the extra dependency on org.eclipse.ui.forms you can also use FormText. But be aware that the control does only understand a subset of HTML (<p>, <b>, <li>, <img>, <br>, <span>) to render simple formatted text.
First of all i would like to say that i have gone through all the posts which are similar to my query but i have some different requirement.
In our project we are using gwt to develop the modules, in one of our module, we have "Edit" button which opens a new browser window which includes 'CKEditor'.
We are modifying the data in ckeditor comes(by url) from gwt widget .
The Window opens by using following code snippet(JSNI) in my gwt widget:
private static native BodyElement getBodyElement(String url) /*-{
var win = window.open("url", "win", "width=940,height=400,status=1,resizeable=1,scrollbars=1"); // a window object
return win.document.body;
}-*/;
The newly opened window have the html form which is with ckeditor.
So here i am closing new window once my form has been submitted but i want the edited text to be displayed in old window.
How can i achieve this requirement?
If you can use HTML5, it should be quite easy. Use Messaging.
Take a look here:
Cross-document messaging
With the reference of the newly opened window, yu can establish a communication between both windows.
i m developing a web page, where i want to show vertical menu. when any clicks on menu its content should open on same page inside a box, and on clicking next menu new content should open in same place . I m using java ,JSP,JSF, java script.. can any one help me on.....
jQuery(document).ready(function(){
$("#myLink").click(function() {
$(this).fancybox({href : 'temp.jsp'});
});
});
Open ajax content
I have tried this but i need to design lots of jsps.
use primefaces menu, it has all the fancy you need
You could also try RichFaces - rich:dropDownMenu and rich:popupPanel
rich:dropDownMenu - RichFaces Showcase
rich:popupPanel - RichFaces Showcase