本文整理汇总了Java中org.eclipse.jdt.ui.StandardJavaElementContentProvider类的典型用法代码示例。如果您正苦于以下问题:Java StandardJavaElementContentProvider类的具体用法?Java StandardJavaElementContentProvider怎么用?Java StandardJavaElementContentProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StandardJavaElementContentProvider类属于org.eclipse.jdt.ui包,在下文中一共展示了StandardJavaElementContentProvider类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createInputGroup
import org.eclipse.jdt.ui.StandardJavaElementContentProvider; //导入依赖的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));
}
示例2: propertyChange
import org.eclipse.jdt.ui.StandardJavaElementContentProvider; //导入依赖的package包/类
public void propertyChange(PropertyChangeEvent event) {
if (fViewer == null)
return;
boolean refreshViewer= false;
if (PreferenceConstants.SHOW_CU_CHILDREN.equals(event.getProperty())) {
boolean showCUChildren= PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.SHOW_CU_CHILDREN);
((StandardJavaElementContentProvider)fViewer.getContentProvider()).setProvideMembers(showCUChildren);
refreshViewer= true;
} else if (MembersOrderPreferenceCache.isMemberOrderProperty(event.getProperty())) {
refreshViewer= true;
}
if (refreshViewer)
fViewer.refresh();
}
示例3: createDialogArea
import org.eclipse.jdt.ui.StandardJavaElementContentProvider; //导入依赖的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;
}
示例4: createTreeViewer
import org.eclipse.jdt.ui.StandardJavaElementContentProvider; //导入依赖的package包/类
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;
}
示例5: ClientBundleResourceSelectionDialog
import org.eclipse.jdt.ui.StandardJavaElementContentProvider; //导入依赖的package包/类
private ClientBundleResourceSelectionDialog(Shell shell,
IJavaProject javaProject, boolean multiSelection) {
super(shell, new JavaElementLabelProvider(
JavaElementLabelProvider.SHOW_DEFAULT),
new StandardJavaElementContentProvider());
setValidator(new TypedElementSelectionValidator(new Class[] {IFile.class},
multiSelection));
setComparator(new JavaElementComparator());
setTitle("Resource Selection");
String message = MessageFormat.format("Choose {0} to bundle:",
(multiSelection ? "one or more resources" : "a resource"));
setMessage(message);
addFilter(new ViewerFilter(javaProject));
}
示例6: SourceContainerDialog
import org.eclipse.jdt.ui.StandardJavaElementContentProvider; //导入依赖的package包/类
private SourceContainerDialog(Shell shell) {
super(shell,new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT),new StandardJavaElementContentProvider());
setValidator(new PackageAndProjectSelectionValidator());
setComparator(new JavaElementComparator());
setTitle(NewWizardMessages.NewContainerWizardPage_ChooseSourceContainerDialog_title);
setMessage(NewWizardMessages.NewContainerWizardPage_ChooseSourceContainerDialog_description);
addFilter(new JavaTypedViewerFilter());
}
示例7: createWorkspaceFileSelectionDialog
import org.eclipse.jdt.ui.StandardJavaElementContentProvider; //导入依赖的package包/类
/**
* Creates and returns a dialog to choose an existing workspace file.
* @param title the title
* @param message the dialog message
* @return the dialog
*/
protected ElementTreeSelectionDialog createWorkspaceFileSelectionDialog(String title, String message) {
int labelFlags= JavaElementLabelProvider.SHOW_BASICS
| JavaElementLabelProvider.SHOW_OVERLAY_ICONS
| JavaElementLabelProvider.SHOW_SMALL_ICONS;
final DecoratingLabelProvider provider= new DecoratingLabelProvider(new JavaElementLabelProvider(labelFlags), new ProblemsLabelDecorator(null));
ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getShell(), provider, new StandardJavaElementContentProvider());
dialog.setComparator(new JavaElementComparator());
dialog.setAllowMultiple(false);
dialog.setValidator(new ISelectionStatusValidator() {
public IStatus validate(Object[] selection) {
StatusInfo res= new StatusInfo();
// only single selection
if (selection.length == 1 && (selection[0] instanceof IFile))
res.setOK();
else
res.setError(""); //$NON-NLS-1$
return res;
}
});
dialog.addFilter(new EmptyInnerPackageFilter());
dialog.addFilter(new LibraryFilter());
dialog.setTitle(title);
dialog.setMessage(message);
dialog.setStatusLineAboveButtons(true);
dialog.setInput(JavaCore.create(JavaPlugin.getWorkspace().getRoot()));
return dialog;
}
示例8: createTree
import org.eclipse.jdt.ui.StandardJavaElementContentProvider; //导入依赖的package包/类
private void createTree(Composite parent) {
TreeViewer viewer = new TreeViewer(parent, SWT.SINGLE);
// Provide members of a compilation unit or class file
ITreeContentProvider contentProvider = new StandardJavaElementContentProvider(true);
viewer.setContentProvider(contentProvider);
// There are more flags defined in class JavaElementLabelProvider
ILabelProvider labelProvider = new JavaElementLabelProvider( JavaElementLabelProvider.SHOW_DEFAULT );
viewer.setLabelProvider(labelProvider);
// Using the Java model as the viewers input present Java projects on the first level.
viewer.setInput(JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()));
viewer.addFilter(new MyJavaElementFilter());
viewer.addSelectionChangedListener( new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
ITreeSelection selection = (ITreeSelection)event.getSelection();
Object selectedObject = selection.getFirstElement();
if (selectedObject instanceof IType || selectedObject instanceof IMethod) {
setOkButtonEnabled(true);
setMessage("You have selected a proper element", IMessageProvider.INFORMATION);
setSelectedElement((IMember)selectedObject);
} else {
setOkButtonEnabled(false);
setMessage("You have to pick a method or a class", IMessageProvider.ERROR);
setSelectedElement(null);
}
}
});
if (initialSelection != null)
viewer.reveal(initialSelection);
}
示例9: JarFileExportOperation
import org.eclipse.jdt.ui.StandardJavaElementContentProvider; //导入依赖的package包/类
private JarFileExportOperation(Shell parent) {
fParentShell= parent;
fStatus= new MessageMultiStatus(JavaPlugin.getPluginId(), IStatus.OK, "", null); //$NON-NLS-1$
fJavaElementContentProvider= new StandardJavaElementContentProvider();
}
示例10: createPackageDialog
import org.eclipse.jdt.ui.StandardJavaElementContentProvider; //导入依赖的package包/类
/**
* Creates a selection dialog that lists all packages under the given package
* fragment root.
* The caller is responsible for opening the dialog with <code>Window.open</code>,
* and subsequently extracting the selected packages (of type
* <code>IPackageFragment</code>) via <code>SelectionDialog.getResult</code>.
*
* @param packageFragments the package fragments
* @return a new selection dialog
*/
protected SelectionDialog createPackageDialog(Set<IJavaElement> packageFragments) {
List<IPackageFragment> packages= new ArrayList<IPackageFragment>(packageFragments.size());
for (Iterator<IJavaElement> iter= packageFragments.iterator(); iter.hasNext();) {
IPackageFragment fragment= (IPackageFragment)iter.next();
boolean containsJavaElements= false;
int kind;
try {
kind= fragment.getKind();
containsJavaElements= fragment.getChildren().length > 0;
} catch (JavaModelException ex) {
ExceptionHandler.handle(ex, getContainer().getShell(), JarPackagerMessages.JarManifestWizardPage_error_jarPackageWizardError_title, Messages.format(JarPackagerMessages.JarManifestWizardPage_error_jarPackageWizardError_message, JavaElementLabels.getElementLabel(fragment, JavaElementLabels.ALL_DEFAULT)));
continue;
}
if (kind != IPackageFragmentRoot.K_BINARY && containsJavaElements)
packages.add(fragment);
}
StandardJavaElementContentProvider cp= new StandardJavaElementContentProvider() {
@Override
public boolean hasChildren(Object element) {
// prevent the + from being shown in front of packages
return !(element instanceof IPackageFragment) && super.hasChildren(element);
}
};
final DecoratingLabelProvider provider= new DecoratingLabelProvider(new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT), new ProblemsLabelDecorator(null));
ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getContainer().getShell(), provider, cp);
dialog.setDoubleClickSelects(false);
dialog.setComparator(new JavaElementComparator());
dialog.setInput(JavaCore.create(JavaPlugin.getWorkspace().getRoot()));
dialog.addFilter(new EmptyInnerPackageFilter());
dialog.addFilter(new LibraryFilter());
dialog.addFilter(new SealPackagesFilter(packages));
dialog.setValidator(new ISelectionStatusValidator() {
public IStatus validate(Object[] selection) {
StatusInfo res= new StatusInfo();
for (int i= 0; i < selection.length; i++) {
if (!(selection[i] instanceof IPackageFragment)) {
res.setError(JarPackagerMessages.JarManifestWizardPage_error_mustContainPackages);
return res;
}
}
res.setOK();
return res;
}
});
return dialog;
}
示例11: JavaEditorBreadcrumbContentProvider
import org.eclipse.jdt.ui.StandardJavaElementContentProvider; //导入依赖的package包/类
public JavaEditorBreadcrumbContentProvider(StandardJavaElementContentProvider parent) {
fParent= parent;
}
示例12: createContentProvider
import org.eclipse.jdt.ui.StandardJavaElementContentProvider; //导入依赖的package包/类
/**
* Create a new instance of the content provider to use for the Java editor breadcrumb.
*
* @return a new content provider
*/
private static JavaEditorBreadcrumbContentProvider createContentProvider() {
StandardJavaElementContentProvider parentContentProvider= new StandardJavaElementContentProvider(true);
return new JavaEditorBreadcrumbContentProvider(parentContentProvider);
}