本文整理汇总了Java中org.eclipse.ui.dialogs.ElementListSelectionDialog.getResult方法的典型用法代码示例。如果您正苦于以下问题:Java ElementListSelectionDialog.getResult方法的具体用法?Java ElementListSelectionDialog.getResult怎么用?Java ElementListSelectionDialog.getResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.dialogs.ElementListSelectionDialog
的用法示例。
在下文中一共展示了ElementListSelectionDialog.getResult方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showComponentTypeSelectionDialog
import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
public static Optional<ComponentType> showComponentTypeSelectionDialog(Shell parentShell) throws CoreException {
ElementListSelectionDialog dialog = new ElementListSelectionDialog(parentShell, new LabelProvider());
dialog.setElements(loadAllComponentTypes().toArray(new String[0]));
dialog.setTitle("Select subcomponent's type");
// user pressed cancel
if (dialog.open() == Window.OK) {
Object[] objects = dialog.getResult();
for (Object result : objects) {
System.out.println("result = " + result);
}
String typeName = objects[0].toString();
ComponentType type = loadComponentType(typeName);
return Optional.of(type);
}
return Optional.empty();
}
示例2: selectPreferences
import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
private Preferences selectPreferences(String title) throws Exception {
String[] sa = pref.childrenNames();
if (sa.length == 0){
return null;
}
Preferences[] pa = new Preferences[sa.length];
for (int i = 0; i < pa.length; i++) {
pa[i] = pref.node(sa[i]);
}
ElementListSelectionDialog dialog = new ElementListSelectionDialog(fAccessText.getShell(), new PLP());
dialog.setTitle(title);
dialog.setElements(pa);
dialog.setMessage("Type to filter by name:");
dialog.setMultipleSelection(false);
if (dialog.open() == ElementListSelectionDialog.OK) {
return (Preferences)dialog.getResult()[0];
}
return null;
}
示例3: deletePre
import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
private void deletePre() {
try {
String[] sa = pref.node("fileList").keys();
if (sa.length == 0){
return;
}
ElementListSelectionDialog dialog = new ElementListSelectionDialog(input.getShell(), new LabelProvider());
dialog.setTitle("Select file list that you want to remove");
dialog.setElements(sa);
dialog.setMessage("Type to filter by name:");
dialog.setMultipleSelection(true);
if (dialog.open() == ElementListSelectionDialog.OK) {
Object[] oa = dialog.getResult();
Preferences p = pref.node("fileList");
for (int i = 0; i < oa.length; i++) {
String key = (String)oa[i];
remove(key);
p.remove(key);
}
pref.put("selectedList", "");
}
} catch (Exception e) {
TFMPlugin.error("FileListMenuMgr deletePre", e);
}
}
示例4: showMediaSelection
import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
/**
* Show media selection.
*
* @param excludeItemList
* the exclude item list
* @param owner
* the owner
* @return the list
*/
private List<MediaNode> showMediaSelection(String[] excludeItemList, Composite owner) {
List<INode> availableMediaList = ((ProjectNode) _collectionNode.getLastParent()).getMediaRootNode().getMediaNodes(excludeItemList);
if (availableMediaList.size() >= 0) {
ElementListSelectionDialog dialog = new ElementListSelectionDialog(owner.getShell(), new NavigatorLabelProvider());
dialog.setMultipleSelection(true);
dialog.setElements(availableMediaList.toArray(new INode[availableMediaList.size()]));
dialog.setTitle(ResourceLoader.getString("SESSION_PROPERTY_MEDIA_SELECTOR_TITLE"));
dialog.open();
Object[] selectedObjects = dialog.getResult();
List<MediaNode> nodeList = new ArrayList<MediaNode>();
if (selectedObjects != null) {
for (Object node : selectedObjects) {
nodeList.add((MediaNode) node);
}
}
return nodeList;
} else {
MessageDialog.openError(owner.getShell(), ResourceLoader.getString("DIALOG_ERROR_TITLE"), ResourceLoader.getString("SESSION_PROPERTY_MEDIA_SELECTOR_NO_MEDIA"));
return null;
}
}
示例5: selectDataSource
import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
private IConnectionProfile selectDataSource()
{
ElementListSelectionDialog dialog = new ElementListSelectionDialog(
getViewSite().getShell(), new LabelProvider() {
@Override
public String getText(Object element)
{
IConnectionProfile connectionProfile = (IConnectionProfile) element;
return connectionProfile.getName();
}
});
dialog.setElements(CommonEclipseUtil.getConnectionProfiles());
dialog.setTitle("DataSource Explorer");
dialog.setMessage("Select a datasource");
dialog.setMultipleSelection(false);
if (dialog.open() != Window.OK) {
// this.hideView();
return null;
}
Object[] result = dialog.getResult();
return result.length > 0 ? (IConnectionProfile) result[0] : null;
}
示例6: addPackage
import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
protected void addPackage() {
Shell shell = getShell();
ElementListSelectionDialog dialog = null;
try {
dialog = createAllPackagesDialog(shell, null, true);
} catch (JavaModelException jme) {
String title = JDepend4EclipsePlugin.getResourceString("JDependPreferencePage.Add_package_to_package_filters"); //$NON-NLS-1$
String message = JDepend4EclipsePlugin.getResourceString("JDependPreferencePage.Could_not_open_package_selection_dialog_for_package_filters"); //$NON-NLS-1$
JDepend4EclipsePlugin.logError(jme, title + message);
return;
}
dialog.setTitle(JDepend4EclipsePlugin.getResourceString("JDependPreferencePage.Add_package_to_package_filters")); //$NON-NLS-1$
dialog.setMessage(JDepend4EclipsePlugin.getResourceString("JDependPreferencePage.Select_a_package_to_filter_for_JDepend")); //$NON-NLS-1$
dialog.setMultipleSelection(true);
if (dialog.open() == IDialogConstants.CANCEL_ID) {
return;
}
Object[] packages = dialog.getResult();
if (packages != null) {
for (int i = 0; i < packages.length; i++) {
IJavaElement pkg = (IJavaElement) packages[i];
String filter = pkg.getElementName();
if (filter.length() < 1) {
filter = JDepend4EclipsePlugin.getResourceString("JDependPreferencePage.default_package"); //$NON-NLS-1$
} else {
filter += ".*"; //$NON-NLS-1$
}
fStepFilterContentProvider.addFilter(filter, true);
}
}
}
示例7: showDialog
import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
private void showDialog(Shell shell, String europaHost, int europaPort, List<String> modelList) {
ElementListSelectionDialog deleteDialog = new ElementListSelectionDialog(shell, new BoringLabelProvider());
String message = "Select a model or models to delete.";
deleteDialog.setTitle("Deleting Europa Models");
deleteDialog.setEmptySelectionMessage(message);
deleteDialog.setEmptyListMessage("No models on the server.");
deleteDialog.setMessage(message);
deleteDialog.setMultipleSelection(true);
deleteDialog.setBlockOnOpen(true);
deleteDialog.setElements(modelList.toArray());
deleteDialog.open();
Object[] result = deleteDialog.getResult();
if (result != null) {
List<String> deleteModels = new ArrayList<String>(result.length);
for (Object object : result) {
if (object instanceof String) {
String string = (String) object;
deleteModels.add(string);
}
}
try {
EuropaSessionClient.deleteModels(europaHost, europaPort, deleteModels);
} catch (RuntimeException e) {
ErrorDialog.openError(shell, "Failed to delete a model", e.getMessage(), new ExceptionStatus(EuropaPlugin.ID, e.getMessage(), e));
}
}
}
示例8: getQuickfixApplication
import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
@Override
public QuickfixApplication getQuickfixApplication() {
OclModelElement me = (OclModelElement) this.getProblematicElement();
String mmName = me.getModel().getName();
List<EClass> allClasses = getAnalysisResult().getNamespace().getNamespace(mmName).getAllClasses();
ElementListSelectionDialog dialog = new ElementListSelectionDialog(null, new LabelProvider() {
@Override
public String getText(Object element) {
return ((EClass) element).getName();
}
});
dialog.setTitle("Choose meta-class");
dialog.setElements(allClasses.toArray(new EClass[allClasses.size()]));
dialog.setMultipleSelection(false);
if (dialog.open() != Window.OK) {
return NullQuickfixApplication.NullInstance;
}
Object[] result = dialog.getResult();
EClass c = (EClass) result[0];
QuickfixApplication qfa = new QuickfixApplication(this);
qfa.replace(me, (expr, trace) -> {
OclModelElement newOme = OCLFactory.eINSTANCE.createOclModelElement();
newOme.setName(c.getName());
newOme.setModel( (OclModel) ATLCopier.copySingleElement(me.getModel()) );
return newOme;
});
return qfa;
}
示例9: showDialog
import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
/**
* Shows an element selection dialog with specified initial contents and title, and returns an array of selected
* elements.
*
* @param content initial contents
* @param title title
* @return selected elements.
*/
protected Object[] showDialog(Collection<ACOrgUnit> content, String title) {
final ElementListSelectionDialog dlg = new ElementListSelectionDialog(getShell(),
new ILabelProviderImplementation());
dlg.setElements(content.toArray(new Object[content.size()]));
dlg.setTitle(title);
dlg.setBlockOnOpen(true);
dlg.setMultipleSelection(true);
Object[] result = new Object[0];
if (dlg.open() == Window.OK) {
result = dlg.getResult();
}
return result;
}
示例10: getActiveProject
import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
private static IProject getActiveProject(IProject[] projects) {
if ((projects != null) && (projects.length > 0)) {
ElementListSelectionDialog dialog = createProjectSelectionDialog(projects);
if (dialog.open() == Window.OK) {
return (IProject)dialog.getResult()[0];
}
}
return null;
}
示例11: doRun
import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
/**
*
* {@inheritDoc}
*
* @see org.eclipse.emf.emfstore.internal.client.ui.common.MonitoredEMFStoreAction#doRun(org.eclipse.core.runtime.IProgressMonitor)
*/
@Override
public Void doRun(IProgressMonitor monitor) throws ESException {
// TODO: controller currently does not work if the active workbench window is not
// the history view
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
if (activePage == null || !(activePage.getActivePart() instanceof HistoryBrowserView)) {
return null;
}
final HistoryBrowserView historyBrowserView = (HistoryBrowserView) activePage.getActivePart();
final LabelProvider tagLabelProvider = new LabelProvider() {
@Override
public String getText(Object element) {
return ((ESTagVersionSpec) element).getName();
}
};
ElementListSelectionDialog dlg = new ElementListSelectionDialog(PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell(), tagLabelProvider);
dlg.setElements(historyInfo.getTagSpecs().toArray());
dlg.setTitle("Tag selection");
dlg.setBlockOnOpen(true);
dlg.setMultipleSelection(true);
int ret = dlg.open();
if (ret != Window.OK) {
return null;
}
ProjectSpace projectSpace = historyBrowserView.getProjectSpace();
Object[] result = dlg.getResult();
for (Object o : result) {
if (o instanceof ESTagVersionSpec) {
ESTagVersionSpec tag = (ESTagVersionSpec) o;
try {
// TODO: monitor
projectSpace.toAPI().removeTag(historyInfo.getPrimarySpec(), tag, new NullProgressMonitor());
} catch (ESException e) {
MessageDialog.openError(getShell(), "Remove tag failed", "Remove tag failed: " + e.getMessage());
}
}
}
historyBrowserView.refresh();
return null;
}