本文整理汇总了Java中org.eclipse.jface.dialogs.Dialog.CANCEL属性的典型用法代码示例。如果您正苦于以下问题:Java Dialog.CANCEL属性的具体用法?Java Dialog.CANCEL怎么用?Java Dialog.CANCEL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jface.dialogs.Dialog
的用法示例。
在下文中一共展示了Dialog.CANCEL属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openDbDriverLocationDialog
private int openDbDriverLocationDialog(String dbType, String driverName, String driverLocation) {
DbDriverMetaData dbDriverMetaData = new DbDriverMetaData();
dbDriverMetaData.setDbNmae(dbType);
dbDriverMetaData.setDriverClassName(driverName);
dbDriverMetaData.setDriverLocation(driverLocation);
DbDriverLocationDialog dialog = new DbDriverLocationDialog("请先配置数据库驱动", getWorkbenchPart().getSite().getShell(), dbDriverMetaData);
if (dialog.open() == Dialog.OK) {
dbDriverMetaData.setDriverLocation(dialog.getDriverLocation());
IPreferenceStore store = Activator.getDefault().getPreferenceStore();
store.setValue(dbType, dialog.getDriverLocation());
return attemptTestJdbcDriver(dbType, driverName, dbDriverMetaData.getDriverLocation());
} else {
return Dialog.CANCEL;
}
}
示例2: execute
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
BookmarkFolder bookmarkFolder = getSelectedBookmarkFolder(selection);
if (bookmarkFolder == null) {
return null;
}
Optional<String> fileId = bookmarkMappingsStore.getMapping(bookmarkFolder.getId()).map(mapping->mapping.getFileId());
if (!fileId.isPresent()) {
return null;
}
Shell shell = HandlerUtil.getActiveShell(event);
Drive drive = gDriveConnectionManager.getDrive();
if (drive == null) {
return null;
}
ShareBookmarksFileDialog dialog = new ShareBookmarksFileDialog(shell);
if (dialog.open() == Dialog.CANCEL) {
return null;
}
ShareFileOperation shareFileOperation = new ShareFileOperation(drive);
try {
shareFileOperation.shareWithUser(fileId.get(), dialog.getEmail(), dialog.canWrite());
} catch (IOException e) {
throw new ExecutionException("Could not share bookmarks file with user", e);
}
return null;
}