List of usage examples for org.eclipse.jface.dialogs MessageDialog openQuestion
public static boolean openQuestion(Shell parent, String title, String message)
From source file:edu.tsinghua.lumaqq.ui.helper.MenuHelper.java
License:Open Source License
/** * ???//from ww w . ja va 2s. c o m */ private void initClusterMenu() { clusterMenu = new CMenu(); // ?? CMenuItem mi = new CMenuItem(clusterMenu, SWT.PUSH); mi.setText(menu_cluster_send); mi.setImage(res.getImage(Resources.icoSendReceiveMessage)); mi.addSelectionListener(new ISelectionListener() { public void widgetSelected(SelectionEvent e) { shellLauncher.openClusterIMWindow((Cluster) clusterMenu.getData()); } }); // final CMenuItem miInfo = new CMenuItem(clusterMenu, SWT.PUSH); miInfo.setImage(res.getImage(Resources.icoClusterInfo)); miInfo.addSelectionListener(new ISelectionListener() { public void widgetSelected(SelectionEvent e) { // model Cluster c = (Cluster) clusterMenu.getData(); if (c.isPermanent()) shellLauncher.openClusterInfoWindow(c); else shellLauncher.openMemberEditShell(MemberEditShell.TEMP_CLUSTER, c.getParentCluster(), null, c); } }); // separator mi = new CMenuItem(clusterMenu, SWT.SEPARATOR); // ???? mi = new CMenuItem(clusterMenu, SWT.CASCADE); mi.setText(menu_cluster_message_manage); mi.setImage(res.getImage(Resources.icoMessageManage)); CMenu msgMenu = new CMenu(mi); // ?? mi = new CMenuItem(msgMenu, SWT.PUSH); mi.setText(menu_cluster_message_export); mi.setImage(res.getImage(Resources.icoTxtFile)); mi.addSelectionListener(new ISelectionListener() { public void widgetSelected(SelectionEvent e) { // model Cluster c = (Cluster) clusterMenu.getData(); // exportHelper.exportMessage(c); } }); // separator mi = new CMenuItem(clusterMenu, SWT.SEPARATOR); // mi = new CMenuItem(clusterMenu, SWT.PUSH); mi.setText(menu_cluster_exit); mi.setImage(res.getImage(Resources.icoExit)); mi.addSelectionListener(new ISelectionListener() { public void widgetSelected(SelectionEvent e) { Cluster c = (Cluster) clusterMenu.getData(); boolean yes = false; if (c.creator == main.getMyModel().qq) yes = MessageDialog.openQuestion(shell, message_box_common_question_title, message_box_exit_my_cluster); else yes = MessageDialog.openQuestion(shell, message_box_common_question_title, message_box_exit_cluster); if (yes) { if (c.isPermanent()) { if (c.creator == main.getMyModel().qq) client.dismissCluster(c.clusterId); else client.exitCluster(c.clusterId); } else client.exitTempCluster(c.clusterType.toQQConstant(), c.clusterId, c.parentClusterId); } } }); // ??? clusterMenu.addMenuListener(new IMenuListener() { public void menuShown(MenuEvent e) { // model Cluster c = (Cluster) clusterMenu.getData(); if (!c.isPermanent() || c.isSuperMember(main.getMyModel().qq)) miInfo.setText(menu_cluster_modifyinfo); else miInfo.setText(menu_cluster_viewinfo); } }); }
From source file:edu.tsinghua.lumaqq.ui.InfoManagerWindow.java
License:Open Source License
protected void onDelete() { boolean onTree = treeViewer.getTree().isFocusControl(); if (MessageDialog.openQuestion(getShell(), message_box_common_question_title, message_box_confirm_delete_message)) { if (onTree) { RecordManager rm = main.getRecordManager(); Object obj = getSelectedObject(); int owner = 0; if (obj instanceof User) owner = ((User) obj).qq; else if (obj instanceof Cluster) owner = ((Cluster) obj).clusterId; else if (obj instanceof Integer) { Integer i = (Integer) obj; if (i == 3) owner = 10000;/*from ww w . ja v a 2 s .c om*/ else return; } rm.delete(owner, IKeyConstants.ALL, IKeyConstants.SUB_ALL); records.clear(); pageCount = 0; pageNum = 0; recordViewer.refresh(); resetNavigator(); refreshRichBox(null); } else { // RecordManager rm = main.getRecordManager(); int base = pageNum * rm.getPageSize(); int[] indices = recordViewer.getTable().getSelectionIndices(); for (int i = indices.length - 1; i >= 0; i--) { TableItem ti = recordViewer.getTable().getItem(indices[i]); RecordEntry entry = (RecordEntry) ti.getData(); rm.delete(entry); records.remove(base + indices[i]); } // ? if (records.isEmpty()) pageCount = 0; else pageCount = (records.size() + rm.getPageSize() - 1) / rm.getPageSize(); if (pageNum >= pageCount) pageNum = Math.max(0, pageCount - 1); if (pageCount > 0) lblPage.setText(NLS.bind(info_page, String.valueOf(pageNum + 1), String.valueOf(pageCount))); else lblPage.setText(""); // ? recordViewer.refresh(); resetNavigator(); rm.sync(); } } }
From source file:edu.tsinghua.lumaqq.ui.jobs.AbstractDiskJob.java
License:Open Source License
/** * //from w w w .j a va 2 s. co m */ protected void exit() { main.getDisplay().syncExec(new Runnable() { public void run() { onExit(); main.setDiskOpHint(getFinishHint()); if (exitCode == DISK_NOT_OPEN) { if (MessageDialog.openQuestion(main.getShell(), message_box_common_question_title, disk_hint_do_you_want_to_apply)) { main.getDiskJobQueue().addJob(new ApplyDiskJob()); } } } }); }
From source file:edu.tsinghua.lumaqq.ui.MainShell.java
License:Open Source License
/** * ???//from w ww . j av a 2 s .co m */ public void checkGroupDirty() { // if (isGroupDirty() && client.getUser().isLoggedIn()) { if (optionHelper.getAutoUploadGroup() == OpType.PROMPT_LITERAL) { if (MessageDialog.openQuestion(shell, message_box_common_question_title, message_box_upload_group)) { uploadGroup(); } } else if (optionHelper.getAutoUploadGroup() == OpType.ALWAYS_LITERAL) uploadGroup(); } }
From source file:edu.tum.in.bruegge.epd.emfstore.handler.merge.util.CaseStudySwitch.java
License:Open Source License
/** * Flatten changepackages.//from w w w . ja v a 2 s . c om * * @param myChangePackage my cp * @param theirChangePackages their cps */ public void flattenChangePackages(ChangePackage myChangePackage, List<ChangePackage> theirChangePackages) { boolean openQuestion = MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), "Remove CompositeOperations?", "Do you want to remove the composite operations for testing purposes?"); if (!openQuestion) { return; } if (myChangePackage != null) { flattenComposites(myChangePackage.getOperations()); } for (ChangePackage cp : theirChangePackages) { flattenComposites(cp.getOperations()); } }
From source file:edu.wpi.cs.jburge.SEURAT.actions.AssociateArtifactAction.java
License:Open Source License
/** * Show a dialog box to confirm the association * @param message - the message for the user * @return - true if the association is confirmed *//*from ww w . j av a 2s. c o m*/ private boolean showQuestion(String message) { return MessageDialog.openQuestion(viewer.getControl().getShell(), "RationaleExplorer", message); }
From source file:edu.wpi.cs.jburge.SEURAT.actions.RemoveRationaleAssociation.java
License:Open Source License
/** * Displays a message/*from w w w .jav a2s.c o m*/ * @param message - the string defining the message * @return true if the user confirms */ private boolean showQuestion(String message) { return MessageDialog.openQuestion(new Shell(), "SEURAT", message); }
From source file:edu.wpi.cs.jburge.SEURAT.editors.EditAlternative.java
License:Open Source License
/** * Used to ask the user questions when saving the alternative. * These could be status questions (to supply a history) or ask for confirmation * if they try to select a previously rejected alternative * @param message/*from ww w . j ava 2s .c om*/ * @return the response to the dialog */ private boolean showQuestion(String message) { return MessageDialog.openQuestion(shell, "Save Alternative", message); }
From source file:es.axios.udig.ui.commons.util.DialogUtil.java
License:LGPL
/** * Opens an question dialog in a standardized way * /*from w w w. j ava 2 s . c o m*/ * @param title * message dialog title * @param message * message dialog content * @return wether the question was accepted or not */ public static boolean openQuestion(final String title, final String message) { final boolean[] confirm = { false }; PlatformGISMediator.syncInDisplayThread(new Runnable() { public void run() { confirm[0] = MessageDialog.openQuestion(null, title, message); } }); return confirm[0]; }