本文整理汇总了Java中org.eclipse.ui.dialogs.SelectionDialog.getReturnCode方法的典型用法代码示例。如果您正苦于以下问题:Java SelectionDialog.getReturnCode方法的具体用法?Java SelectionDialog.getReturnCode怎么用?Java SelectionDialog.getReturnCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.dialogs.SelectionDialog
的用法示例。
在下文中一共展示了SelectionDialog.getReturnCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: browseForBuilderClass
import org.eclipse.ui.dialogs.SelectionDialog; //导入方法依赖的package包/类
private void browseForBuilderClass() {
try {
IJavaSearchScope scope= SearchEngine.createJavaSearchScope(new IJavaElement[] { getType().getJavaProject() });
SelectionDialog dialog= JavaUI.createTypeDialog(getShell(), PlatformUI.getWorkbench().getProgressService(), scope,
IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*ToString", fExtension); //$NON-NLS-1$
dialog.setTitle(JavaUIMessages.GenerateToStringDialog_customBuilderConfig_classSelection_windowTitle);
dialog.setMessage(JavaUIMessages.GenerateToStringDialog_customBuilderConfig_classSelection_message);
dialog.open();
if (dialog.getReturnCode() == OK) {
IType type= (IType)dialog.getResult()[0];
fBuilderClassName.setText(type.getFullyQualifiedParameterizedName());
List<String> suggestions= fValidator.getAppendMethodSuggestions(type);
if (!suggestions.contains(fAppendMethodName.getText()))
fAppendMethodName.setText(suggestions.get(0));
suggestions= fValidator.getResultMethodSuggestions(type);
if (!suggestions.contains(fResultMethodName.getText()))
fResultMethodName.setText(suggestions.get(0));
}
} catch (JavaModelException e) {
JavaPlugin.log(e);
}
}
示例2: run
import org.eclipse.ui.dialogs.SelectionDialog; //导入方法依赖的package包/类
@Override
public void run() {
// fail if the action hasn't been initialized
if (site == null) {
return;
}
final Object[] selectionElements = getStructuredSelection().toArray();
// get Iterable of selected project names
Iterable<String> selectionProjectNames = Arrays.asList(selectionElements)
.stream().filter(item -> item instanceof IProject)
.map(item -> ((IProject) item).getName())
.collect(Collectors.toList());
// double-check that the active Working Sets Manager is {@link ManualAssociationAwareWorkingSetManager}
if (!(broker.getActiveManager() instanceof ManualAssociationAwareWorkingSetManager)) {
return;
}
// open the dialog
SelectionDialog dialog = createDialog(Arrays.asList(((ManualAssociationAwareWorkingSetManager) broker
.getActiveManager()).getWorkingSets()), selectionElements.length);
dialog.open();
// Abort if user didn't press OK
if (dialog.getReturnCode() != Window.OK) {
return;
}
// perform specified working set updates
performWorkingSetUpdate(dialog.getResult(), selectionProjectNames);
}
示例3: getPackagesFromDialog
import org.eclipse.ui.dialogs.SelectionDialog; //导入方法依赖的package包/类
/**
* Converts selection dialog results into an array of IPackageFragments.
* An empty array is returned in case of errors.
* @param dialog the dialog
* @return the selected IPackageFragments
* @throws ClassCastException if results are not IPackageFragments
*/
protected IPackageFragment[] getPackagesFromDialog(SelectionDialog dialog) {
if (dialog.getReturnCode() == Window.OK && dialog.getResult().length > 0)
return Arrays.asList(dialog.getResult()).toArray(new IPackageFragment[dialog.getResult().length]);
else
return new IPackageFragment[0];
}