create a dialog using menu in eclipse plugin - eclipse

I am creating a popupmenu(org.eclipse.ui.popupMenus) in my eclipse plugin. Now I want to launch one textfield or dialog to take user input. And on based on input I will run my run method associated with the popupMenu. Please help me out.

In it's most basic interaction, you could use org.eclipse.jface.dialogs.MessageDialog.openQuestion(Shell, String, String) to have the user answer a yes/no question.
If you'd like them to enter a string, you can use org.eclipse.jface.dialogs.InputDialog. After it's closed, getValue() returns their input.

Related

How to customize default SaveHandler of an e4 application?

In my e4 application, I am using the default ISaveHandler(which i have not defined explicitly anywhere) as shown in the image.
I just need to update the icon, title & text of this handler, rest works fine for me for single mPart save or multiple mPart save prompt.
I don't want to create my own save handler UI. Even if I could inherit the original one, that will work for me.
[
That dialog is an inner class of org.eclipse.e4.ui.workbench.renderers.swt.WBWRenderer so you can't get at it. I don't think you have any choice but to write your own ISaveHandler and the dialog.
You might be able to use org.eclipse.e4.ui.internal.workbench.PartServiceSaveHandler to do some of the work.
To use your save handler everywhere set it in the main window context. (see this question).

How do I display data/information with Matlab App Designer?

I would like to display some information to the user via Matlab App Designer's GUI. I am new to this program and can't seem to find a widget that provides what I feel should be a simple function. Am I missing something? Examples would include showing the user:
The path of the file that he/she selected
Errors such as "No files detected" that are printed in a Matlab script called on by the GUI code.
Other print statements in code such as "Done!", etc that will inform the user when a process is complete.
Is there a way to capture the output in the Matlab command line and report these in a window of some sort in the GUI? Thanks in advance!
You can use a TextArea to display information for the user. Here's how I made a simple example:
Drag a button to the app in design view.
Drag in a text area also. I changed the label to Feedback.
Select the button and use the Callbacks tab in the bottom right of app designer to add a callback with the default name it gives you.
Edit the callback to contain
answer = 'what your want to display';
app.FeedbackTextArea.Value = answer;
When you push the button the text area gets filled. In your code, instead of just setting 'answer' to some string, set a variable using whatever code is dealing with your user's information. The key is to store what you want the user to see in a variable and then assign that to the "Value" parameter of the text area or other widget where you want them to see the results.

Remove 'Details' button from ProgressMonitorJobsDialog JFace

I am trying to remove the 'Details' button from the following ProgressMonitorJobsDialog:
I am running a org.eclipse.core.runtime.jobs.Job that opens the default Dialog. I have seen examples here of disabling the Cancel button, but I need to remove the third one and extending the default ProgressMonitorJobsDialog won't help, since it is invoked by the default UIJob class. Any ideas?
This dialog is usually ProgressMonitorFocusJobDialog displayed by ProgressManager. It isn't really possible to change the dialog without using internal APIs.
Instead of a Job you could use an IRunnableWithProgress and use ProgressMonitorDialog to run it. This dialog does not have the Details section.

How can I use mnemonics on JavaFX 8 Alerts

I would like to be able to add accelerator keys for the buttons that are provided as a part of the Alert Dialog Controls included with JavaFX.
I am unsure if this is possible using the standard alert types ERROR, INFORMATION, CONFIRMATION, WARNING?
I created my own login window - which doesn't use an Alert structure and it works as follows:
When the stage opens up.
Then when the user hits the "ALT" key:
I would like the ability to "Hot Key" the buttons on the Alerts in the system. However, I am unsure if I can use the standard alerts, or if I need to create my own, and if so, how should I do that.
I really would like to use the Dialogs natively, if at all possible.
Thanks.
As far as I understood your question, I think it isn't possible without some extra code.
Looking at the code of OpenJFX the labels of the buttons are localized and fixed.
You might just want to create some buttons on your own by using the apropiate constructor which takes some buttons where you can override the existing ones.
EDIT: after rethinking everything, I tried to recreate your problem. You can see that project on GitHub..
This is the special code:
public void showCustomizedAlertWindow() {
Alert a = new Alert(AlertType.CONFIRMATION, "some content text", ButtonType.OK, ButtonType.CANCEL, ButtonType.FINISH);
((Button) a.getDialogPane().lookupButton(ButtonType.FINISH)).setText("_finished");
a.show();
}
But be aware, you are removing localization-support of that buttons.

How to call a Dialogue box from Menu using Matlab?

I want to Make a Help Dialogue Box. When we Press Help Menu then Dialogue box will appear.
Current code is
h_opt3 = uimenu('Label','&Help');
uimenu(h_opt3,'Label','How to Use','Callback','dialog','separator','on');
It only show empty dialog.
In place of dialog i want to put a dialogbox which will describe how to use my software.
How to code this all. Please help.
Requirements: How to Add stuff in DialogBox and how to call it in above mention scenario.
Try writing an additional callback function, and look at helpdlg instead of dialog.
I can't test any code now, but something like the following should work.
function help_callback
h = helpdlg('Directions','title');
end
Then change your uimenu call to this code
uimenu(h_opt3,'Label','How to Use','Callback',#help_callback,'separator','on');