本文整理汇总了Java中org.eclipse.jdt.ui.JavaElementLabelProvider类的典型用法代码示例。如果您正苦于以下问题:Java JavaElementLabelProvider类的具体用法?Java JavaElementLabelProvider怎么用?Java JavaElementLabelProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JavaElementLabelProvider类属于org.eclipse.jdt.ui包,在下文中一共展示了JavaElementLabelProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: chooseGW4EProject
import org.eclipse.jdt.ui.JavaElementLabelProvider; //导入依赖的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;
}
示例2: createInputGroup
import org.eclipse.jdt.ui.JavaElementLabelProvider; //导入依赖的package包/类
private void createInputGroup(Composite parent)
{
int labelFlags = 272;
org.eclipse.jface.viewers.ITreeContentProvider treeContentProvider = new StandardJavaElementContentProvider() {
public boolean hasChildren(Object element)
{
return !(element instanceof IPackageFragment) && super.hasChildren(element);
}
}
;
fInputGroup = new CheckboxTreeAndListGroup(parent, JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()), treeContentProvider, new JavaElementLabelProvider(labelFlags), new StandardJavaElementContentProvider(), new JavaElementLabelProvider(labelFlags), 0x800000, 480, 150);
fInputGroup.addTreeFilter(new EmptyInnerPackageFilter());
fInputGroup.setTreeSorter(new JavaElementSorter());
fInputGroup.setListSorter(new JavaElementSorter());
fInputGroup.addTreeFilter(new ContainerFilter(ContainerFilter.FILTER_NON_CONTAINERS));
fInputGroup.addTreeFilter(new LibraryFilter());
fInputGroup.addListFilter(new ContainerFilter(ContainerFilter.FILTER_CONTAINERS));
}
示例3: ProjectCombo
import org.eclipse.jdt.ui.JavaElementLabelProvider; //导入依赖的package包/类
/**
* 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);
}
示例4: createFieldComposite
import org.eclipse.jdt.ui.JavaElementLabelProvider; //导入依赖的package包/类
private Composite createFieldComposite(final Composite composite) {
Composite fieldComposite = new Composite(composite, SWT.NONE);
GridLayout layout = new GridLayout();
fieldComposite.setLayout(layout);
fieldViewer = CheckboxTableViewer.newCheckList(fieldComposite, SWT.MULTI | SWT.TOP | SWT.BORDER);
GridData data = new GridData(GridData.FILL_BOTH);
data.grabExcessHorizontalSpace = true;
fieldViewer.getTable().setLayoutData(data);
fieldViewer.setLabelProvider(new JavaElementLabelProvider());
fieldViewer.setContentProvider(new ArrayContentProvider());
fieldViewer.setInput(allFields);
selectAllNonTransientFields();
return fieldComposite;
}
示例5: chooseJavaProject
import org.eclipse.jdt.ui.JavaElementLabelProvider; //导入依赖的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;
}
示例6: getPostQualifiedLabelProvider
import org.eclipse.jdt.ui.JavaElementLabelProvider; //导入依赖的package包/类
public static IBaseLabelProvider getPostQualifiedLabelProvider() {
return new DelegatingStyledCellLabelProvider(new JavaElementLabelProvider(
JavaElementLabelProvider.SHOW_POST_QUALIFIED | JavaElementLabelProvider.SHOW_SMALL_ICONS)) {
@Override
protected StyledString getStyledText(Object element) {
String nameWithQualifier = getStyledStringProvider().getStyledText(element).getString() + " ";
int separatorIndex = nameWithQualifier.indexOf('-');
if (separatorIndex == -1)
return new StyledString(nameWithQualifier);
StyledString name = new StyledString(nameWithQualifier.substring(0, separatorIndex));
String qualifier = nameWithQualifier.substring(separatorIndex);
return name.append(new StyledString(qualifier, StyledString.QUALIFIER_STYLER));
};
};
}
示例7: createQueryRunnable
import org.eclipse.jdt.ui.JavaElementLabelProvider; //导入依赖的package包/类
private Runnable createQueryRunnable(final String question, final Object[] elements, final int[] result) {
return new Runnable() {
public void run() {
ListDialog dialog= new YesNoListDialog(fShell, true);
dialog.setAddCancelButton(false);
dialog.setBlockOnOpen(true);
dialog.setContentProvider(new ArrayContentProvider());
dialog.setLabelProvider(new JavaElementLabelProvider());
dialog.setTitle(fDialogTitle);
dialog.setMessage(question);
dialog.setInput(elements);
dialog.open();
result[0]= dialog.getReturnCode();
}
};
}
示例8: PackageSelectionDialogButtonField
import org.eclipse.jdt.ui.JavaElementLabelProvider; //导入依赖的package包/类
public PackageSelectionDialogButtonField(String label, String button, PackageBrowseAdapter adapter, IJavaProject root) {
super(adapter);
setContentAssistProcessor(new JavaPackageCompletionProcessor(new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_ROOT)));
IPackageFragmentRoot[] roots;
try {
roots= root.getAllPackageFragmentRoots();
((JavaPackageCompletionProcessor)getContentAssistProcessor()).setPackageFragmentRoot(roots[0]);
} catch (JavaModelException e) {
JavaPlugin.log(e);
// if exception no content assist .. but thats no problem
}
setLabelText(label);
setButtonLabel(button);
adapter.setReceiver(this);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:17,代码来源:PackageSelectionDialogButtonField.java
示例9: selectJavaElement
import org.eclipse.jdt.ui.JavaElementLabelProvider; //导入依赖的package包/类
/**
* 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;
}
示例10: MultiMainTypeSelectionDialog
import org.eclipse.jdt.ui.JavaElementLabelProvider; //导入依赖的package包/类
/**
* Constructor.
*/
public MultiMainTypeSelectionDialog(Shell shell, IRunnableContext context,
IJavaSearchScope scope, int style)
{
super(shell, new JavaElementLabelProvider(
JavaElementLabelProvider.SHOW_PARAMETERS | JavaElementLabelProvider.SHOW_POST_QUALIFIED | JavaElementLabelProvider.SHOW_ROOT));
setMultipleSelection(true);
Assert.isNotNull(context);
Assert.isNotNull(scope);
fRunnableContext= context;
fScope= scope;
fStyle= style;
}
示例11: chooseProject
import org.eclipse.jdt.ui.JavaElementLabelProvider; //导入依赖的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;
}
示例12: createDialogArea
import org.eclipse.jdt.ui.JavaElementLabelProvider; //导入依赖的package包/类
@Override
protected Control createDialogArea(Composite parent) {
setTitle("Choose a Class");
setMessage(message, IMessageProvider.NONE);
Control control = super.createDialogArea(parent);
Composite composite = new Composite((Composite) control, SWT.NONE);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
FillLayout layout = new FillLayout();
composite.setLayout(layout);
tree = new TreeViewer(composite, SWT.BORDER);
tree.setContentProvider(new StandardJavaElementContentProvider());
tree.addFilter(new SourceViewerFilter());
JavaElementLabelProvider provider = new JavaElementLabelProvider();
tree.setLabelProvider(provider);
IJavaModel javaModel = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
tree.setInput(javaModel);
tree.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
selectionChangeHandler(event);
}
});
return control;
}
示例13: selectClass
import org.eclipse.jdt.ui.JavaElementLabelProvider; //导入依赖的package包/类
/**
* @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;
}
示例14: handleProjectButtonSelected
import org.eclipse.jdt.ui.JavaElementLabelProvider; //导入依赖的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());
}
}
示例15: chooseJavaProject
import org.eclipse.jdt.ui.JavaElementLabelProvider; //导入依赖的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;
}