1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-08 16:55:38 +02:00

[216596] determine whether to show yes/no or just okay

This commit is contained in:
David McKnight 2008-01-29 15:22:45 +00:00
parent 5b654c8a89
commit bb87b76359
2 changed files with 26 additions and 4 deletions

View file

@ -6,6 +6,7 @@
* *
* Contributors: * Contributors:
* Michael Berger (IBM) - Initial API and implementation * Michael Berger (IBM) - Initial API and implementation
* David McKnight (IBM) - [216596] determine whether to show yes/no or just okay
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.actions; package org.eclipse.rse.ui.actions;
@ -20,6 +21,8 @@ public class DisplayHidableSystemMessageAction extends
{ {
protected IPreferenceStore _store; protected IPreferenceStore _store;
protected String _prefID; protected String _prefID;
protected boolean _showYesNo = true;
public DisplayHidableSystemMessageAction(SystemMessage message, IPreferenceStore prefStore, String prefID) public DisplayHidableSystemMessageAction(SystemMessage message, IPreferenceStore prefStore, String prefID)
{ {
super(message); super(message);
@ -27,6 +30,14 @@ public class DisplayHidableSystemMessageAction extends
_prefID = prefID; _prefID = prefID;
} }
public DisplayHidableSystemMessageAction(SystemMessage message, IPreferenceStore prefStore, String prefID, boolean showYesNo)
{
super(message);
_store = prefStore;
_prefID = prefID;
_showYesNo = showYesNo;
}
/** /**
* @see Runnable#run() * @see Runnable#run()
*/ */
@ -38,7 +49,7 @@ public class DisplayHidableSystemMessageAction extends
if (shells[loop].isEnabled() && shells[loop].isVisible()) { if (shells[loop].isEnabled() && shells[loop].isVisible()) {
SystemMessageDialog dialog = new SystemMessageDialog(shells[loop], message); SystemMessageDialog dialog = new SystemMessageDialog(shells[loop], message);
dialog.setNoShowAgainOption(true, _store, _prefID, false); dialog.setNoShowAgainOption(true, _store, _prefID, false);
dialog.openQuestionNoException(); dialog.openQuestionNoException(_showYesNo);
rc = dialog.getButtonPressedId(); rc = dialog.getButtonPressedId();
finished = true; finished = true;
} }

View file

@ -14,6 +14,7 @@
* Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
* Martin Oberhuber (Wind River) - [187115] force SystemMessageDialog always into Display thread * Martin Oberhuber (Wind River) - [187115] force SystemMessageDialog always into Display thread
* Martin Oberhuber (Wind River) - [189272] exception when canceling ssh connect * Martin Oberhuber (Wind River) - [189272] exception when canceling ssh connect
* David McKnight (IBM) - [216596] determine whether to show yes/no or just okay
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.messages; package org.eclipse.rse.ui.messages;
@ -443,13 +444,23 @@ public class SystemMessageDialog extends ErrorDialog implements Listener {
open(); open();
return (buttonIdPressed==IDialogConstants.YES_ID); return (buttonIdPressed==IDialogConstants.YES_ID);
} }
/** /**
* opens the dialog with Yes, No, Details button for an Inquiry/Question message. * opens the dialog with Yes/No, Details button for an Inquiry/Question message.
* Eats up the IndicatorException, so only call this when you know what you are doing! * Eats up the IndicatorException, so only call this when you know what you are doing!
*/ */
public boolean openQuestionNoException() public boolean openQuestionNoException()
{ {
yesNoButtons=true; return openQuestionNoException(true);
}
/**
* opens the dialog with an optional Yes/No or OK, Details button for an Inquiry/Question message.
* Eats up the IndicatorException, so only call this when you know what you are doing!
*/
public boolean openQuestionNoException(boolean showYesNo)
{
yesNoButtons=showYesNo;
open(); open();
return (buttonIdPressed==IDialogConstants.YES_ID); return (buttonIdPressed==IDialogConstants.YES_ID);
} }