本文整理汇总了Java中org.eclipse.jface.dialogs.MessageDialog.openQuestion方法的典型用法代码示例。如果您正苦于以下问题:Java MessageDialog.openQuestion方法的具体用法?Java MessageDialog.openQuestion怎么用?Java MessageDialog.openQuestion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.dialogs.MessageDialog
的用法示例。
在下文中一共展示了MessageDialog.openQuestion方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeNode
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
private void removeNode() {
final INamedNode selectedNode = getSelection();
ControlTree controlTree = getControlTree();
INamedNode parent = controlTree.getNode(selectedNode.getParentName());
if (selectedNode.getChildren()==null || selectedNode.getChildren().length<1) {
controlTree.delete(selectedNode);
} else {
boolean ok = MessageDialog.openQuestion(content.getShell(), "Confirm Delete", "The item '"+selectedNode.getName()+"' is a group.\n\nAre you sure you would like to delete it?");
if (ok) controlTree.delete(selectedNode);
}
viewer.refresh();
if (parent.hasChildren()) {
setSelection(parent.getChildren()[parent.getChildren().length-1]);
} else {
setSelection(parent);
}
}
示例2: handleDirtyConflict
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
/**
* Shows a dialog that asks if conflicting changes should be discarded.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected boolean handleDirtyConflict() {
return
MessageDialog.openQuestion
(getSite().getShell(),
getString("_UI_FileConflict_label"),
getString("_WARN_FileConflict"));
}
示例3: execute
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
logger.info ( "Execute command: {}", event ); //$NON-NLS-1$
final Collection<ConnectionHolder> connections = getConnections ();
final boolean result = MessageDialog.openQuestion ( getWorkbenchWindow ().getShell (), Messages.DeleteConnection_MessageDialog_Title, MessageFormat.format ( Messages.DeleteConnection_MessageDialog_Message, connections.size () ) );
if ( !result )
{
// user pressed "NO"
return null;
}
final MultiStatus status = new MultiStatus ( Activator.PLUGIN_ID, 0, Messages.DeleteConnection_MultiStatus_Text, null );
for ( final ConnectionHolder holder : connections )
{
final ConnectionStore store = AdapterHelper.adapt ( holder.getDiscoverer (), ConnectionStore.class );
if ( store != null )
{
try
{
store.remove ( holder.getConnectionInformation () );
}
catch ( final CoreException e )
{
logger.info ( "Failed to remove connection", e ); //$NON-NLS-1$
status.add ( e.getStatus () );
}
}
}
return null;
}
示例4: run
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
@Override
public boolean run(XcenBean copy) throws Exception {
boolean ok = MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), "Rerun '"+copy.getName()+"'",
"Would you like to rerun X-Ray Centering?\n\n"+
"The bean was:\n"+copy);
if (ok) {
ISubmitter<XcenBean> submitter = eventService.createSubmitter(conf.getUri(), conf.getSubmissionQueue());
copy.setName("Copy of "+copy.getName());
submitter.submit(copy, true);
submitter.disconnect(); // Not really required for submitters.
}
return true; // We handled it
}
示例5: canHandleShellCloseEvent
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
@Override
protected boolean canHandleShellCloseEvent() {
if (settings.isConfirmExit() && !MessageDialog.openQuestion(getShell(), resourceBundle.getString("confirm_action"),
resourceBundle.getString("exit_confirm_message"))) {
return false;
}
if (viewListener != null) {
viewListener.applicationViewWillDisappear();
}
return super.canHandleShellCloseEvent();
}
示例6: configure
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
protected void configure() {
DeviceInformation<?> info = getSelection();
if (info==null) return; // Nothing to configure
boolean ok = MessageDialog.openQuestion(getViewSite().getShell(), "Confirm Configure", "Are you sure you want to configure '"+info.getName()+"' now?\n\n"+
"If the device is active or being used this will change its behaviour.");
if (!ok) return;
try {
IRunnableDevice<Object> device = dservice.getRunnableDevice(info.getName());
Object model = info.getModel();
// Pass null to 'clear' the validation results view
selectionProvider.fireSelection(new StructuredSelection(new ValidateResults(info.getName(), null)));
Object validateReturn = device.validateWithReturn(model);
ValidateResults validateResults = new ValidateResults(info.getName(), validateReturn);
showValidationResultsView(validateResults);
selectionProvider.fireSelection(new StructuredSelection(validateResults));
device.configure(model);
} catch (ScanningException|ValidationException ne) {
ErrorDialog.openError(getViewSite().getShell(), "Configure Failed", "The configure of '"+info.getName()+"' failed",
new Status(IStatus.ERROR, "org.eclipse.scanning.device.ui", ne.getMessage(), ne));
logger.error("Cannot configure '"+info.getName()+"'", ne);
}
}
示例7: handleDirtyConflict
import org.eclipse.jface.dialogs.MessageDialog; //导入方法依赖的package包/类
/**
* Shows a dialog that asks if conflicting changes should be discarded.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected boolean handleDirtyConflict ()
{
return MessageDialog.openQuestion ( getSite ().getShell (), getString ( "_UI_FileConflict_label" ), //$NON-NLS-1$
getString ( "_WARN_FileConflict" ) ); //$NON-NLS-1$
}