本文整理汇总了Java中org.eclipse.jdt.ui.JavaElementLabelProvider.SHOW_DEFAULT属性的典型用法代码示例。如果您正苦于以下问题:Java JavaElementLabelProvider.SHOW_DEFAULT属性的具体用法?Java JavaElementLabelProvider.SHOW_DEFAULT怎么用?Java JavaElementLabelProvider.SHOW_DEFAULT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jdt.ui.JavaElementLabelProvider
的用法示例。
在下文中一共展示了JavaElementLabelProvider.SHOW_DEFAULT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: chooseGW4EProject
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;
}
示例2: ProjectCombo
/**
* Creates a new project selector combo
*
* @param helper associated {@link ProjectChooserHelper} for looking up
* projects
* @param parent parent composite to add the combo to
* @param initialProject the initial project to select, or null (which
* will show a "Please Choose Project..." label instead.)
*/
public ProjectCombo(ProjectChooserHelper helper, Composite parent,
IProject initialProject) {
super(parent, SWT.BORDER | SWT.FLAT | SWT.READ_ONLY);
mProject = initialProject;
mAvailableProjects = helper.getAguiProjects(null);
String[] items = new String[mAvailableProjects.length + 1];
items[0] = "--- Choose Project ---";
ILabelProvider labelProvider = new JavaElementLabelProvider(
JavaElementLabelProvider.SHOW_DEFAULT);
int selectionIndex = 0;
for (int i = 0, n = mAvailableProjects.length; i < n; i++) {
IProject project = mAvailableProjects[i].getProject();
items[i + 1] = labelProvider.getText(project);
if (project == initialProject) {
selectionIndex = i + 1;
}
}
setItems(items);
select(selectionIndex);
addSelectionListener(this);
}
示例3: chooseJavaProject
/**
* 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;
}
示例4: selectClass
/**
* @param shell
* @param project
* @param filter
* @return the selected file
*/
public static IType selectClass(final Shell shell,
final IProject project,
final Filter filter) {
final int flags = JavaElementLabelProvider.SHOW_DEFAULT |
JavaElementLabelProvider.SHOW_POST_QUALIFIED |
JavaElementLabelProvider.SHOW_ROOT;
final ElementListSelectionDialog dlg =
new ElementListSelectionDialog(shell, new JavaElementLabelProvider(flags));
dlg.setTitle("Select Custom Operation(s) Class");
dlg.setMessage("Select a custom operation(s) class");
dlg.setMatchEmptyString(true);
dlg.setHelpAvailable(false);
final List<IType> types = new ArrayList<>();
populateClasses(shell, JavaCore.create(project), types, filter);
dlg.setElements(types.toArray());
return (dlg.open() == Window.OK) ? (IType) dlg.getFirstResult() : null;
}
示例5: handleProjectButtonSelected
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());
}
}
示例6: selectJavaElement
/**
* Shows a dialog for resolving an ambiguous Java element. Utility method that can be called by subclasses.
*
* @param elements the elements to select from
* @param shell the parent shell
* @param title the title of the selection dialog
* @param message the message of the selection dialog
* @return returns the selected element or <code>null</code> if the dialog has been cancelled
*/
public static IJavaElement selectJavaElement(IJavaElement[] elements, Shell shell, String title, String message) {
int nResults= elements.length;
if (nResults == 0)
return null;
if (nResults == 1)
return elements[0];
int flags= JavaElementLabelProvider.SHOW_DEFAULT | JavaElementLabelProvider.SHOW_QUALIFIED | JavaElementLabelProvider.SHOW_ROOT;
ElementListSelectionDialog dialog= new ElementListSelectionDialog(shell, new JavaElementLabelProvider(flags));
dialog.setTitle(title);
dialog.setMessage(message);
dialog.setElements(elements);
if (dialog.open() == Window.OK) {
return (IJavaElement) dialog.getFirstResult();
}
return null;
}
示例7: chooseProject
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;
}
示例8: chooseJavaProject
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;
}
示例9: choosePackage
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);
if (dialog.open() == Window.OK) {
return (IPackageFragment) dialog.getFirstResult();
}
return null;
}
示例10: createTreeViewer
private CheckboxTreeViewer createTreeViewer(Composite parent) {
checkboxTreeViewer = new ContainerCheckedTreeViewer(parent, SWT.CHECK);
ITreeContentProvider contentProvider = new StandardJavaElementContentProvider(
true);
checkboxTreeViewer.setContentProvider(contentProvider);
// label provider
ILabelProvider labelProvider = new JavaElementLabelProvider(
JavaElementLabelProvider.SHOW_DEFAULT
| JavaElementLabelProvider.SHOW_RETURN_TYPE);
checkboxTreeViewer.setLabelProvider(labelProvider);
return checkboxTreeViewer;
}
示例11: chooseJavaProject
/**
* 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;
}
示例12: JavaProjectSelectionDialog
private JavaProjectSelectionDialog(Shell parent, List<IJavaProject> projects,
IJavaProject initialSelection) {
super(parent, new JavaElementLabelProvider(
JavaElementLabelProvider.SHOW_DEFAULT));
setTitle("Project Selection");
setMessage("Choose a project:");
setElements(projects.toArray(new IJavaProject[0]));
setInitialSelections(new Object[] {initialSelection});
setHelpAvailable(false);
}
示例13: chooseProject
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;
}
示例14: choosePackage
private IPackageFragment choosePackage() {
IPackageFragmentRoot root = getPackageFragmentRoot();
IJavaElement[] packages = null;
try {
if (root != null && root.exists()) {
packages = root.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);
if (dialog.open() == Window.OK) {
return (IPackageFragment) dialog.getFirstResult();
}
return null;
}
示例15: chooseProject
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;
}