I'm writing a plugin to eclipse and as part of my scenario, I'm generating a html file. After the file had been generated, a web browser is been opened within eclipse, hosted by an editor.
What I'd like to do is to extend this web browser context menu (when I'm right clicking on it, I'd like to add another functionality which is called "copy URL", which will copy the URL of the web page.
Could you please assist in how this can be achieved?
I must point out and say that this is not an eclipse editor, which can be extended by adding an extension.
This web page that is been opened is a web page and not an eclipse editor. it's just been hosted by it by the following:
IWebBrowser browser = support.createBrowser(IWorkbenchBrowserSupport.AS_EDITOR, null, "RDLEditor", "tooltip");
Please assist.
Thank you,
Ido
I have tried to do this in the past and the issue is the embedded browser is not part of the eclipse framework and there are no extensions or API's available on the SWT browser object to extend the context menu. The next best thing I can think of is to create your own eclipse view that embeds a SWT browser object and then create an action in the view tool bar that will get a reference to the browser object in the Action class and copy the current URL to the clip board like you are trying to do. - Duncan Krebs
I was able to add a button to the WebBrowserView toolbar, if that is what you are looking to do. I declared an extension of WebBrowserView and then did the following.
public void createPartControl(Composite parent) {
super.createPartControl(parent);
browserViewer = this.viewer;
Composite toolbarComp = (Composite) browserViewer.getChildren()[0];
browserToolBar = (ToolBar) toolbarComp.getChildren()[0];
// add new ToolItems to that
Related
I need to add dynamic content inside about menu in eclipse application.
Any idea about the About menu plugin??
In the Branding tab inside product file i am adding static content in the About dialog. Now i need to add some dynamic content that will be decided in the run time of the application.
Is there any method to override to get the dynamic content inside the About menu???
Please can anyone help me.
The about dialog org.eclipse.ui.internal.dialogs.AboutDialog does not support any dynamic context.
The main text comes from the aboutText property defined in the org.eclipse.core.runtime.products product definition.
The images come from the installed bundle groups.
The data on the branding / feature dialog just comes from the feature and branding plugin and is also not dynamic.
I'm using "Netbeans platform 8.1" to develop a rich client application.
It has default menus and actions inside it. I want to hide "Menu/Tools/Plugins" and open the Plugin Window programmatically from my code.
My question is: if I hide the menu from "layer.xml" and change its name to "Plugin_hidden", how can I open that window programmatically?
Use the following code.
Action action = FileUtil.getConfigObject("Actions/System/org-netbeans-modules-autoupdate-ui-actions-PluginManagerAction.instance", Action.class);
action.actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, ""));
I determined the path for the action by expanding Important Files/XML Layer/<this layer in context>/Menu Bar/Tools under my project in the Projects window and double clicking on Plugins. This will open a generated layer XML that contains the Plugin manager action. From there you can figure out what the action path is.
If you don't have an XML Layer in important files, you can add an empty one using the New File wizard. Just select Module Development/XML Layer. An XML layer isn't required for the above code to work; it just makes it possible to browse the available actions so that you can determine the path for the action.
For more information see DevFaqInvokeActionProgrammatically
Requirement is to download the Excel file from IE9 browser. I could able to click the Download button using Web driver in Java by which new window is displayed as shown below:
When I am trying to view the attributes of save button in IE developer tool, tool could not recognize them. Please help where is the problem with this window or how to resolve this issue.
I'm developing an application using Vaadin framework. The application has a main menu, when user clicks a menu item, application executes descendant of AbstractMenuCommand class like
public class RunReportCommand extends AbstractMenuAction {
#Override
public void execute() throws MenuException {
Window = .... // create window here
openWindow(window);
}
protected void openWindow(Window window) {
application.getMainWindow().open(new ExternalResource(window.getURL()));
application.setMainWindow(window);
}
}
After this main browser window content is replace with needed window. After spending a lot of time I came to this solution: if you want replace browser window content with Vaadin Window you should always do
application.getMainWindow().open(new ExternalResource(window.getURL()));
application.setMainWindow(window);
Recently I got a new task to add a feature to application: users should have ability open windows in diffirent tabs and so the problem is that I have only one main window in vaadin (and window.open works only for the main window) but user can have a lot of diffirent windows in diffirent browser tabs, so if user clicks a menu item in browser tab that contains not main window, reloading vaading window content won't work.
Vaadin 7 & Vaadin 8
With versions 7 and 8 came the new concept and class of UI. You can now very easily open another window/tab in the user’s web browser. Fantastic new feature and great advantage for the Vaadin platform to support multi-window apps.
All the open windows/tabs share the same user session.
The tricky part is that for purposes of security and avoiding obnoxious behaviors, browsers do not allow JavaScript to directly open another window, known as "pop-up window". The new window/tab can only be opened as a direct result of a user gesture such as clicking a button.
So in Vaadin, you must use associate a BrowserWindowOpener object with a Button. You pass the .class of your UI subclass you wrote. That UI subclass is automatically instantiated for you, and displayed in the new window/tab.
All of this is explained well in the Handling Browser Windows page in the manual.
One limitation is that I see no direct way to pass objects to the new window/tab, that new UI-subclass instance. You might be able to do so indirectly. Perhaps posting an attribute in the session. Or perhaps setting string parameters on the URI of the new window/tab. I have asked about this issue of passing information to the new window for Vaadin 7 and asked again for Vaadin 8.
Vaadin 6
In 2011, I spoke with members of the Vaadin development team about the issue of multiple web browser windows or tabs for the same Vaadin 6 app. They strongly recommended against doing so. They said while it is possible, doing so requires much effort and tends to be troublesome and error-prone.
Instead they suggested using Vaadin TabSheet within a single browser window/tab.
The TabSheet is quite dynamic, so you can add and drop tabs as needed. Performance is surprisingly fast in my experience. Remember that only the content of the frontmost tab is actually in the user's browser window. The other tabs' content is in memory on the server, but is not a burden to the web browser/client. While tabs cannot be word wrapped and so tend to be wide, the TabSheet automatically provides scrolling through too many tabs to show.
Until release of Vaadin7, you can look at Navigator7 add-on (found here)
Navigator7 allows multi browser tabs navigaton. (A click in a browser tab, only affect this browser tab)
We use it in our application and it's work verry well.
Regards.
I'm using Vaadin framework and everything is setup fine using the Book of Vaadin. When I alter source code it automatically builds and synchronizes the server which I can see in the Server tab, however when I refresh my browser window nothing is changed.
The only time when I can see the change is when I select my module in the Server tab and choose Clean Module Working Directory in the right-click menu.
I have looked everywhere in Eclipse, but there must be a way where this is not needed or is done automatically, because it's somewhat tedious. Any ideas?
Which browser are you using? The Eclipse built-in browser (based on IE, I think) is not the best at noticing changes to the application.
Anyway, try appending "?restartApplication" after your URL to force restarting the app.
I had same problem, before i finished reading book of Vaadin. In my case it was because of session, i just add close listener for mainWindow:
mainWindow.addListener(new Window.CloseListener() {
#Override
public void windowClose(CloseEvent e) {
getMainWindow().getApplication().close();
}
});
It will close old session when F5 is pressed, try it!