tinyMce function to determine if popup is already open - tinymce

With tinyMce, I've got onclick code to open a plugin using this:
ed.windowManager.open(...)
Right now, it will open a 2nd, 3rd, etc. instance of this plugin window each time I click the target.
Instead, I want the onclick code to ignore the click if the window is already open. How can I detect the open window.

Here's the solution I'm going with:
I seem to have confirmed:
-- that windowManager.open() does not return a reference to the window the same way that window.open() does
-- windowManager does not have a built-in way to limit the number of instances that can be opened.
But it does have a way to add an onClose function to the plugin window:
ed.windowManager.onClose.add(function() {alert('Closing!');});
So I'll be using a variable in the onClick code to keep track of whether the popup window has been opened and closed. The onClose function will mark that variable as closed

Related

Detecting a click on Grid while row editor is opened in buffered mode

I want to show the dialog box by clicking on a different row (with options to save changes or cancel).
When Editor is open, it will catch the click and is stoping the event propagation, thus underlying Grid does not get the click event and ItemClickEvent is not being fired.
Is it possible to detect a click on the grid row through extensions or another way?
Is it possible to detect a click on the grid row through extensions or another way?
Technically speaking yes. E.g. GridFastNavigation add-on does this trick in order to make possible single click editor opening.
But you could also listen to Editor opening, see (https://vaadin.com/download/release/8.3/8.3.1/docs/api/com/vaadin/ui/components/grid/Editor.html#addOpenListener-com.vaadin.ui.components.grid.EditorOpenListener- ) when you are in unbuffered mode Editor already open, editor will re-open on the row you click. This catching this event could help you find a way.

MATLAB: set keyboard shortcut to go to line where current code execution stopped

I would like to set a key short-cut. e.g. ctrl+1 or so, to go in the editor into the file and line where the 'keyboard' command stopped the current code execution in order to debug faster. Is this possible? Or does it exist already? Now, even when I click the function in the debugger tab, it doesn't go there if that function was last clicked and in the mean time you moved manually to another function in the editor. I first have to click another function in the pop down menu and than re-click to function I want to go to. Very annoying.

Eclipse Plugin - How to get the last worked on editor

I am writing an eclipse plugin which exposes a view to the user with several buttons. On the click of any button, I would like to paste a certain comment into the editor window where the user is currently working and at the cursor location he is pointing to.
Once the user clicks the button, the editor window no longer has focus and the following code does not work.
workbench.getActiveWorkbenchWindow().getActivePage().getActiveEditor()
How can I detect the editor window where the user was working and the cursor location before the user clicked the button?
Use an IPartListener to listen to part activation events.
Set the listener up in your view initialization:
getSite().getPage().addPartListener(partListener);
(and don't forget to remove the listener in the view dispose).
Among other things this will give you part activation events:
public void partActivated(IWorkbenchPart part)
If part is an instance of IEditorPart then it is an editor being activated. So you just need to keep track of this activated editor.

Can I programmatically close a context menu in jsTree?

Is there a way I can programatically close a context menu in jsTree? I implemented a way to open the context menus on hover using show_contextmenu but I need to close it when the mouse leaves
Ok, looking through the code I found what I needed, there is a property called hide_on_mouseleave which I just set to true in the source and it started working as expected.
If that doesn't work, this is the code used to close the context menu executed when hide_on_mouseleave property is true:
$.vakata.context.hide();

How to make GraphicalEditorWithFlyoutPalette's PaletteView visible on first start

My GEF editor (extending GraphicalEditorWithFlyoutPalette) always opens the editor with the palette hidden on first start of the application / first opening of the editor (after a build for example).
As this will potentially bewilder users who'll need to go in search of the flyout icon first, I'd like to have the palette view shown whenever the editor is opened. The user can then choose to close it on his/her preferences.
How can I achieve this? The API doesn't seem to give any clues, or I'm unable to find them...
The state of the palette defines if it is open or closed. This state is accessible using the getPalettePreferences().setPaletteState() method that is accessible in the GraphicalEditorWithFlyoutPalette. To open the palette, you must set it to the FlyoutPaletteComposite.STATE_PINNED_OPEN, like this:
getPalettePreferences().setPaletteState(FlyoutPaletteComposite.STATE_PINNED_OPEN);
If you want to ALWAYS override the state so that the palette is always opened with the editor, you have to add the line to the constructor of your editor. If you only want to do this once, and then leave the state as it was last selected by the user... No idea how to do this :-(