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


Java ElementListSelectionDialog.setInitialSelections方法代码示例

本文整理汇总了Java中org.eclipse.ui.dialogs.ElementListSelectionDialog.setInitialSelections方法的典型用法代码示例。如果您正苦于以下问题:Java ElementListSelectionDialog.setInitialSelections方法的具体用法?Java ElementListSelectionDialog.setInitialSelections怎么用?Java ElementListSelectionDialog.setInitialSelections使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.ui.dialogs.ElementListSelectionDialog的用法示例。


在下文中一共展示了ElementListSelectionDialog.setInitialSelections方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: chooseGW4EProject

import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
public static IJavaProject chooseGW4EProject(IJavaProject javaProject) {
	Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
	IJavaProject[] projects = getGW4EProjects();
	ILabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
	ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, labelProvider);
	dialog.setTitle(MessageUtil.getString("projectdialog_title"));
	dialog.setMessage(MessageUtil.getString("projectdialog_message"));
	dialog.setElements(projects);

	if (javaProject != null) {
		dialog.setInitialSelections(new Object[] { javaProject });
	}
	if (dialog.open() == Window.OK) {
		return (IJavaProject) dialog.getFirstResult();
	}
	return null;
}
 
开发者ID:gw4e,项目名称:gw4e.project,代码行数:18,代码来源:GraphWalkerContextManager.java

示例2: chooseJavaProject

import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
/**
 * Shows a dialog to choose the {@link IJavaProject}.
 *
 * @return the chosen {@link IJavaProject}
 */
private IJavaProject chooseJavaProject() {
	final ILabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
	final ElementListSelectionDialog dialog = new ElementListSelectionDialog(this.getShell(), labelProvider);
	dialog.setTitle(LauncherMessages.AbstractJavaMainTab_4);
	dialog.setMessage(LauncherMessages.AbstractJavaMainTab_3);
	try {
		dialog.setElements(JavaCore.create(this.getWorkspaceRoot()).getJavaProjects());
	} catch (final JavaModelException javaModelException) {
		JDIDebugUIPlugin.log(javaModelException);
	}
	final IJavaProject javaProject = this.getJavaProject();
	if (javaProject != null) {
		dialog.setInitialSelections(new Object[] {
			javaProject
		});
	}
	if (dialog.open() == Window.OK) {
		return (IJavaProject) dialog.getFirstResult();
	}
	return null;
}
 
开发者ID:Beagle-PSE,项目名称:Beagle,代码行数:27,代码来源:ProjectTab.java

示例3: chooseProject

import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
private IJavaProject chooseProject() {
	IJavaProject[] projects;
	try {
		projects= JavaCore.create(fWorkspaceRoot).getJavaProjects();
	} catch (JavaModelException e) {
		JavaPlugin.log(e);
		projects= new IJavaProject[0];
	}

	ILabelProvider labelProvider= new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
	ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), labelProvider);
	dialog.setTitle(NewWizardMessages.NewSourceFolderWizardPage_ChooseProjectDialog_title);
	dialog.setMessage(NewWizardMessages.NewSourceFolderWizardPage_ChooseProjectDialog_description);
	dialog.setElements(projects);
	dialog.setInitialSelections(new Object[] { fCurrJProject });
	dialog.setHelpAvailable(false);
	if (dialog.open() == Window.OK) {
		return (IJavaProject) dialog.getFirstResult();
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:NewSourceFolderWizardPage.java

示例4: open

import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
/**
 * Opens a type selection dialog based on the given <code>title</code> and <code>types</code>.
 * 
 * @param <T> the specific data type to work with
 * @param shell the parent shell
 * @param title the title
 * @param types the types to select from
 * @param selected the type to be selected by default, <b>null</b> for none
 * @return the selected datatype, <b>null</b> if none was selected
 */
@SuppressWarnings("unchecked")
public static <T extends IDatatype> T open(Shell shell, String title, Collection<T> types, T selected) {
    T result = null;
    ElementListSelectionDialog dialog =
        new ElementListSelectionDialog(shell, new TypeLabelProvider());
    dialog.setAllowDuplicates(false);
    dialog.setMultipleSelection(false);
    dialog.setElements(types.toArray());
    dialog.setTitle(title);
    if (null != selected) {
        Object[] initialSelections = new Object[1];
        initialSelections[0] = selected;
        dialog.setInitialSelections(initialSelections);
    }
    if (dialog.open() == Window.OK) {
        result = (T) dialog.getFirstResult();
    }
    return result;
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:30,代码来源:TypeSelectionDialog.java

示例5: handleProjectButtonSelected

import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
private void handleProjectButtonSelected()
{
	ILabelProvider labelProvider= new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
	ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), labelProvider);
	dialog.setTitle("Select Project");
	dialog.setMessage("Select a LeJOS Project"); 
	try
	{
		dialog.setElements(getLejosProjects());
	}
	catch (CoreException jme)
	{
		LeJOSEV3Util.log(jme);
	}
	IJavaProject javaProject= getJavaProject();
	if (javaProject != null)
		dialog.setInitialSelections(new Object[] { javaProject });
	
	if (dialog.open() == Window.OK)
	{
		IJavaProject project = (IJavaProject) dialog.getFirstResult();
		projectText.setText(project.getElementName());
	}
}
 
开发者ID:JanKoehnlein,项目名称:XRobot,代码行数:25,代码来源:LaunchEV3MainTab.java

示例6: chooseJavaProject

import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
private IJavaProject chooseJavaProject() {
    ILabelProvider labelProvider = new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT);
    ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
    dialog.setTitle("Project Secletion"); 
    dialog.setMessage("Select a RoboVM project to launch");
    try {
        IJavaProject[] projects = getRoboVMProjects();
        dialog.setElements(projects);
        
        IJavaProject selectedProject = findProject(projects, projectText.getText());
        if (selectedProject != null) {
            dialog.setInitialSelections(new Object[] { selectedProject });
        }
        if (dialog.open() == Window.OK) {                       
            return (IJavaProject) dialog.getFirstResult();
        }
    } catch (CoreException e) {
        RoboVMPlugin.log(e);
    }
        
    return null;            
}
 
开发者ID:robovm,项目名称:robovm-eclipse,代码行数:23,代码来源:RoboVMTab.java

示例7: chooseProject

import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
protected IProject chooseProject() throws OperationCancellation {
	Shell shell = button.getShell();
	ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, new WorkbenchLabelProvider());
	dialog.setTitle(LangUIMessages.projectField_chooseProject_title);
	dialog.setMessage(LangUIMessages.projectField_chooseProject_message);

	try {
		final IProject[] projects = getDialogChooseElements(); 
		dialog.setElements(projects);
	} catch (CoreException ce) {
		EclipseCore.logStatus(ce);
	}
	
	final IProject project = getProject();
	if (project != null && project.isOpen()) {
		dialog.setInitialSelections(new Object[] { project });
	}
	
	if (dialog.open() == Window.OK) {
		return (IProject) dialog.getFirstResult();
	}
	throw new OperationCancellation();
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:24,代码来源:ProjectField.java

示例8: chooseCuinaProject

import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
private CuinaProject chooseCuinaProject()
	{
		ILabelProvider labelProvider = new LabelProvider(); // XXX war:
// CuinaElementLabelProvider
		ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, labelProvider);
		dialog.setTitle("Projekt Auswahl");
		dialog.setMessage("Wähle ein Projekt aus.");

		dialog.setElements(CuinaCore.getCuinaProjects());

		CuinaProject project = getCuinaProject();
		if (project != null)
		{
			dialog.setInitialSelections(new Object[] { project });
		}
		if (dialog.open() == Window.OK) { return (CuinaProject) dialog.getFirstResult(); }
		return null;
	}
 
开发者ID:TheWhiteShadow3,项目名称:cuina,代码行数:19,代码来源:ProjectBlock.java

示例9: chooseProject

import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
/**
 * Realize a Java Project selection dialog and return the first selected project,
 * or null if there was none.
 */
protected IProject chooseProject() {
	IProject[] projects;
	try {
		projects= getWorkspaceRoot().getProjects();
	} catch (Exception e) {
		projects= new IProject[0];
	}
	
	ILabelProvider labelProvider=new LabelProvider() {
		public String getText(Object obj) {
			String ret="<unknown>";
			if (obj instanceof IResource) {
				ret = ((IResource)obj).getName();
			}
			return(ret);
		}
	};

	ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), labelProvider);
	dialog.setTitle("Projects");
	dialog.setMessage("Select the relevant project");
	dialog.setElements(projects);
	
	IProject project = getProject();
	if (project != null) {
		dialog.setInitialSelections(new Object[] { project });
	}
	if (dialog.open() == Window.OK) {			
		return (IProject) dialog.getFirstResult();
	}			
	return null;		
}
 
开发者ID:scribble,项目名称:scribble-eclipse,代码行数:37,代码来源:SimulationMainTab.java

示例10: chooseJavaProject

import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
/**
 * Displays a project chooser dialog which lists all available projects with the Android nature.
 * <p/>
 * The list of project is built from Android flagged projects currently opened in the workspace.
 *
 * @param projectName If non null and not empty, represents the name of an Android project
 *                    that will be selected by default.
 * @param message Message for the dialog box. Can be null in which case a default message
 *                is displayed.
 * @return the project chosen by the user in the dialog, or null if the dialog was canceled.
 */
public IJavaProject chooseJavaProject(String projectName, String message) {
    ILabelProvider labelProvider = new JavaElementLabelProvider(
            JavaElementLabelProvider.SHOW_DEFAULT);
    ElementListSelectionDialog dialog = new ElementListSelectionDialog(
            mParentShell, labelProvider);
    dialog.setTitle("Project Selection");
    if (message == null) {
        message = "Please select a project";
    }
    dialog.setMessage(message);

    IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
    IJavaModel javaModel = JavaCore.create(workspaceRoot);

    // set the elements in the dialog. These are opened android projects.
    dialog.setElements(getAguiProjects(javaModel));

    // look for the project matching the given project name
    IJavaProject javaProject = null;
    if (projectName != null && projectName.length() > 0) {
        javaProject = javaModel.getJavaProject(projectName);
    }

    // if we found it, we set the initial selection in the dialog to this one.
    if (javaProject != null) {
        dialog.setInitialSelections(new Object[] { javaProject });
    }

    // open the dialog and return the object selected if OK was clicked, or null otherwise
    if (dialog.open() == Window.OK) {
        return (IJavaProject) dialog.getFirstResult();
    }
    return null;
}
 
开发者ID:thahn0720,项目名称:agui_eclipse_plugin,代码行数:46,代码来源:ProjectChooserHelper.java

示例11: chooseProject

import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
private IJavaProject chooseProject() {
  IJavaProject[] javaProjects;

  try {
    javaProjects = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()).getJavaProjects();
  } catch (JavaModelException e) {
    GWTPluginLog.logError(e);
    javaProjects = new IJavaProject[0];
  }

  // Filter the list to only show GWT projects
  List<IJavaProject> gwtProjects = new ArrayList<IJavaProject>();
  for (IJavaProject javaProject : javaProjects) {
    if (GWTNature.isGWTProject(javaProject.getProject())) {
      gwtProjects.add(javaProject);
    }
  }

  ILabelProvider labelProvider = new JavaElementLabelProvider(
      JavaElementLabelProvider.SHOW_DEFAULT);
  ElementListSelectionDialog dialog = new ElementListSelectionDialog(getShell(), labelProvider);
  dialog.setTitle("Project Selection");
  dialog.setMessage("Choose a project to compile");
  dialog.setElements(gwtProjects.toArray(new IJavaProject[0]));
  dialog.setInitialSelections(new Object[] {JavaCore.create(project)});

  dialog.setHelpAvailable(false);
  if (dialog.open() == Window.OK) {
    return (IJavaProject) dialog.getFirstResult();
  }
  return null;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:33,代码来源:GWTCompileDialog.java

示例12: chooseProject

import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
private IJavaProject chooseProject() {
  IJavaProject[] projects;
  try {
    projects = JavaCore.create(Util.getWorkspaceRoot()).getJavaProjects();
  } catch (JavaModelException e) {
    JavaPlugin.log(e);
    projects = new IJavaProject[0];
  }

  // Filter the list to only show GWT projects
  List<IJavaProject> gwtProjects = new ArrayList<IJavaProject>();
  for (IJavaProject project : projects) {
    if (GWTNature.isGWTProject(project.getProject())) {
      gwtProjects.add(project);
    }
  }

  // TODO: refactor this into utility function
  ILabelProvider labelProvider = new JavaElementLabelProvider(
      JavaElementLabelProvider.SHOW_DEFAULT);
  ElementListSelectionDialog dialog = new ElementListSelectionDialog(
      getShell(), labelProvider);
  dialog.setTitle("Project Selection");
  dialog.setMessage("Choose a project for the new HTML page");
  dialog.setElements(gwtProjects.toArray(new IJavaProject[0]));
  dialog.setInitialSelections(new Object[] {getJavaProject()});
  dialog.setHelpAvailable(false);
  if (dialog.open() == Window.OK) {
    return (IJavaProject) dialog.getFirstResult();
  }
  return null;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:33,代码来源:NewHostPageWizardPage.java

示例13: choosePackage

import org.eclipse.ui.dialogs.ElementListSelectionDialog; //导入方法依赖的package包/类
/**
 * Opens a selection dialog that allows to select a package.
 *
 * @return returns the selected package or <code>null</code> if the dialog has been canceled.
 * The caller typically sets the result to the package input field.
 * <p>
 * Clients can override this method if they want to offer a different dialog.
 * </p>
 *
 * @since 3.2
 */
protected IPackageFragment choosePackage() {
	IPackageFragmentRoot froot= getPackageFragmentRoot();
	IJavaElement[] packages= null;
	try {
		if (froot != null && froot.exists()) {
			packages= froot.getChildren();
		}
	} catch (JavaModelException e) {
		JavaPlugin.log(e);
	}
	if (packages == null) {
		packages= new IJavaElement[0];
	}

	ElementListSelectionDialog dialog= new ElementListSelectionDialog(getShell(), new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT));
	dialog.setIgnoreCase(false);
	dialog.setTitle(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_title);
	dialog.setMessage(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_description);
	dialog.setEmptyListMessage(NewWizardMessages.NewTypeWizardPage_ChoosePackageDialog_empty);
	dialog.setElements(packages);
	dialog.setHelpAvailable(false);

	IPackageFragment pack= getPackageFragment();
	if (pack != null) {
		dialog.setInitialSelections(new Object[] { pack });
	}

	if (dialog.open() == Window.OK) {
		return (IPackageFragment) dialog.getFirstResult();
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:44,代码来源:NewTypeWizardPage.java


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