当前位置: 首页>>代码示例>>Java>>正文


Java ElementListSelectionDialog.getResult方法代码示例

本文整理汇总了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();
}
 
开发者ID:awortmann,项目名称:xmontiarc,代码行数:18,代码来源:DesignerHelper.java

示例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;
}
 
开发者ID:BeckYang,项目名称:TeamFileList,代码行数:20,代码来源:CustomUnpackMgr.java

示例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);
	}
}
 
开发者ID:BeckYang,项目名称:TeamFileList,代码行数:26,代码来源:FileListMenuMgr.java

示例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;
}
   }
 
开发者ID:synergynet,项目名称:synergyview,代码行数:33,代码来源:CollectionEditor.java

示例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;
}
 
开发者ID:winture,项目名称:wt-studio,代码行数:23,代码来源:QueryDesignerView.java

示例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);
        }
    }
}
 
开发者ID:iloveeclipse,项目名称:jdepend4eclipse,代码行数:35,代码来源:JDependPreferencePage.java

示例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));
		}
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:28,代码来源:ModelManagementAction.java

示例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;
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:34,代码来源:NoClassFoundInMetamodelQuickFix_SelectDialog.java

示例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;
}
 
开发者ID:edgarmueller,项目名称:emfstore-rest,代码行数:23,代码来源:PropertiesComposite.java

示例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;
}
 
开发者ID:Elphel,项目名称:vdt-plugin,代码行数:10,代码来源:LaunchShortcut.java

示例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;
}
 
开发者ID:edgarmueller,项目名称:emfstore-rest,代码行数:59,代码来源:UIRemoveTagController.java


注:本文中的org.eclipse.ui.dialogs.ElementListSelectionDialog.getResult方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。