本文整理汇总了Java中org.eclipse.jdt.ui.JavaElementComparator类的典型用法代码示例。如果您正苦于以下问题:Java JavaElementComparator类的具体用法?Java JavaElementComparator怎么用?Java JavaElementComparator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavaElementComparator类属于org.eclipse.jdt.ui包,在下文中一共展示了JavaElementComparator类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: configureDropDownViewer
import org.eclipse.jdt.ui.JavaElementComparator; //导入依赖的package包/类
@Override
public void configureDropDownViewer(TreeViewer viewer, Object input) {
viewer.setContentProvider(createDropDownContentProvider());
viewer.setLabelProvider(createDropDownLabelProvider());
viewer.setComparator(new JavaElementComparator());
viewer.addFilter(new ViewerFilter() {
@Override
public boolean select(Viewer viewer1, Object parentElement, Object element) {
if (element instanceof IMember) {
if (((IMember) element).getElementName().startsWith("<")) { //$NON-NLS-1$
// filter out <clinit>
return false;
}
}
return true;
}
});
if (SHOW_LIBRARIES_NODE)
viewer.addFilter(new EmptyLibraryContainerFilter());
JavaUIHelp.setHelp(viewer, IJavaHelpContextIds.JAVA_EDITOR_BREADCRUMB);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:23,代码来源:JavaEditorBreadcrumb.java
示例2: addProjectDialog
import org.eclipse.jdt.ui.JavaElementComparator; //导入依赖的package包/类
private CPListElement[] addProjectDialog() {
try {
Object[] selectArr= getNotYetRequiredProjects();
new JavaElementComparator().sort(null, selectArr);
ListSelectionDialog dialog= new ListSelectionDialog(getShell(), Arrays.asList(selectArr), new ArrayContentProvider(), new JavaUILabelProvider(), NewWizardMessages.ProjectsWorkbookPage_chooseProjects_message);
dialog.setTitle(NewWizardMessages.ProjectsWorkbookPage_chooseProjects_title);
dialog.setHelpAvailable(false);
if (dialog.open() == Window.OK) {
Object[] result= dialog.getResult();
CPListElement[] cpElements= new CPListElement[result.length];
for (int i= 0; i < result.length; i++) {
IJavaProject curr= (IJavaProject) result[i];
cpElements[i]= new CPListElement(fCurrJProject, IClasspathEntry.CPE_PROJECT, curr.getPath(), curr.getResource());
}
return cpElements;
}
} catch (JavaModelException e) {
return null;
}
return null;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:24,代码来源:ProjectsWorkbookPage.java
示例3: ClientBundleResourceSelectionDialog
import org.eclipse.jdt.ui.JavaElementComparator; //导入依赖的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));
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:15,代码来源:ClientBundleResourceSelectionDialog.java
示例4: addMemberListComposite
import org.eclipse.jdt.ui.JavaElementComparator; //导入依赖的package包/类
private void addMemberListComposite(Composite result) {
Composite composite= new Composite(result, SWT.NONE);
GridLayout layout= new GridLayout();
layout.numColumns= 2;
layout.marginWidth= 0;
layout.marginHeight= 0;
composite.setLayout(layout);
GridData gd= new GridData(GridData.FILL_BOTH);
gd.heightHint= convertHeightInCharsToPixels(12);
gd.horizontalSpan= 2;
composite.setLayoutData(gd);
fTableViewer= CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
fTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
fTableViewer.setLabelProvider(createLabelProvider());
fTableViewer.setContentProvider(new ArrayContentProvider());
try {
fTableViewer.setInput(getExtractableMembers());
} catch (JavaModelException e) {
ExceptionHandler.handle(e, RefactoringMessages.ExtractInterfaceInputPage_Extract_Interface, RefactoringMessages.ExtractInterfaceInputPage_Internal_Error);
fTableViewer.setInput(new IMember[0]);
}
fTableViewer.addCheckStateListener(new ICheckStateListener(){
public void checkStateChanged(CheckStateChangedEvent event) {
ExtractInterfaceInputPage.this.updateUIElementEnablement();
}
});
fTableViewer.setComparator(new JavaElementComparator());
fTableViewer.getControl().setEnabled(anyMembersToExtract());
createButtonComposite(composite);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:33,代码来源:ExtractInterfaceWizard.java
示例5: createSuperTypeList
import org.eclipse.jdt.ui.JavaElementComparator; //导入依赖的package包/类
/**
* Creates the super type list.
*
* @param parent
* the parent control
* @throws JavaModelException
*/
protected void createSuperTypeList(final Composite parent) throws JavaModelException {
createSpacer(parent);
final Label label= new Label(parent, SWT.NONE);
label.setText(RefactoringMessages.ExtractSupertypeMemberPage_types_list_caption);
GridData data= new GridData();
data.horizontalSpan= 2;
label.setLayoutData(data);
final Composite composite= new Composite(parent, SWT.NONE);
final GridLayout layout= new GridLayout();
layout.numColumns= 2;
layout.marginWidth= 0;
layout.marginHeight= 0;
composite.setLayout(layout);
data= new GridData(GridData.FILL_BOTH);
data.horizontalSpan= 2;
composite.setLayoutData(data);
fTableViewer= new TableViewer(composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
data= new GridData(GridData.FILL_BOTH);
data.heightHint= SWTUtil.getTableHeightHint(fTableViewer.getTable(), 3);
fTableViewer.getTable().setLayoutData(data);
fTableViewer.setLabelProvider(createLabelProvider());
fTableViewer.setContentProvider(new ArrayContentProvider());
fTableViewer.setComparator(new JavaElementComparator());
fTypesToExtract.add(getDeclaringType());
fTableViewer.setInput(fTypesToExtract.toArray());
createButtonComposite(composite);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:39,代码来源:ExtractSupertypeMemberPage.java
示例6: createViewer
import org.eclipse.jdt.ui.JavaElementComparator; //导入依赖的package包/类
private TreeViewer createViewer(Composite parent) {
TreeViewer treeViewer= new TreeViewer(parent, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
GridData gd= new GridData(GridData.FILL_BOTH);
gd.widthHint= convertWidthInCharsToPixels(40);
gd.heightHint= convertHeightInCharsToPixels(15);
treeViewer.getTree().setLayoutData(gd);
treeViewer.setLabelProvider(new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_SMALL_ICONS));
treeViewer.setContentProvider(new DestinationContentProvider(getDestinationValidator()));
treeViewer.setComparator(new JavaElementComparator());
treeViewer.setInput(JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()));
return treeViewer;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:13,代码来源:ReorgUserInputPage.java
示例7: SourceContainerDialog
import org.eclipse.jdt.ui.JavaElementComparator; //导入依赖的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());
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:9,代码来源:SourceContainerDialog.java
示例8: createWorkspaceFileSelectionDialog
import org.eclipse.jdt.ui.JavaElementComparator; //导入依赖的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;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:34,代码来源:JarManifestWizardPage.java
示例9: setComparator
import org.eclipse.jdt.ui.JavaElementComparator; //导入依赖的package包/类
private void setComparator() {
if (getRootMode() == WORKING_SETS_AS_ROOTS) {
fViewer.setComparator(new WorkingSetAwareJavaElementSorter());
} else {
fViewer.setComparator(new JavaElementComparator());
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:8,代码来源:PackageExplorerPart.java
示例10: createInputGroup
import org.eclipse.jdt.ui.JavaElementComparator; //导入依赖的package包/类
protected void createInputGroup(Composite composite) {
createLabel(composite, SWT.NONE, JavadocExportMessages.JavadocTreeWizardPage_checkboxtreeandlistgroup_label, createGridData(6));
Composite c= new Composite(composite, SWT.NONE);
GridLayout layout= new GridLayout();
layout.numColumns= 1;
layout.makeColumnsEqualWidth= true;
layout.marginWidth= 0;
layout.marginHeight= 0;
c.setLayout(layout);
c.setLayoutData(createGridData(GridData.FILL_BOTH, 6, 0));
ITreeContentProvider treeContentProvider= new JavadocProjectContentProvider();
ITreeContentProvider listContentProvider= new JavadocMemberContentProvider();
fInputGroup= new CheckboxTreeAndListGroup(c, this, treeContentProvider, new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT), listContentProvider, new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT), SWT.NONE, convertWidthInCharsToPixels(60), convertHeightInCharsToPixels(7));
fInputGroup.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent e) {
doValidation(TREESTATUS);
}
});
fInputGroup.setTreeComparator(new JavaElementComparator());
SWTUtil.setAccessibilityText(fInputGroup.getTree(), JavadocExportMessages.JavadocTreeWizardPage_tree_accessibility_message);
SWTUtil.setAccessibilityText(fInputGroup.getTable(), JavadocExportMessages.JavadocTreeWizardPage_table_accessibility_message);
IJavaElement[] elements= fStore.getInitialElements();
setTreeChecked(elements);
if (elements.length > 0) {
fInputGroup.setTreeSelection(new StructuredSelection(elements[0].getJavaProject()));
}
fInputGroup.aboutToOpen();
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:35,代码来源:JavadocTreeWizardPage.java
示例11: configureTree
import org.eclipse.jdt.ui.JavaElementComparator; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void configureTree(TreeViewer tree) {
tree.setContentProvider(new JavaWorkingSetPageContentProvider());
AppearanceAwareLabelProvider javaElementLabelProvider=
new AppearanceAwareLabelProvider(
AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS | JavaElementLabels.P_COMPRESSED,
AppearanceAwareLabelProvider.DEFAULT_IMAGEFLAGS | JavaElementImageProvider.SMALL_ICONS
);
tree.setLabelProvider(new DecoratingJavaLabelProvider(javaElementLabelProvider));
tree.setComparator(new JavaElementComparator());
tree.addFilter(new EmptyInnerPackageFilter());
tree.setInput(JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()));
if (getSelection() == null)
return;
Object[] selection= getInitialTreeSelection();
if (selection.length > 0) {
try {
tree.getTree().setRedraw(false);
for (int i= 0; i < selection.length; i++) {
tree.expandToLevel(selection[i], 0);
}
tree.setSelection(new StructuredSelection(selection));
} finally {
tree.getTree().setRedraw(true);
}
}
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:37,代码来源:JavaWorkingSetPage.java
示例12: configureTable
import org.eclipse.jdt.ui.JavaElementComparator; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void configureTable(TableViewer table) {
AppearanceAwareLabelProvider javaElementLabelProvider= new AppearanceAwareLabelProvider(
AppearanceAwareLabelProvider.DEFAULT_TEXTFLAGS | JavaElementLabels.P_COMPRESSED
| JavaElementLabels.ROOT_POST_QUALIFIED | JavaElementLabels.P_POST_QUALIFIED,
AppearanceAwareLabelProvider.DEFAULT_IMAGEFLAGS | JavaElementImageProvider.SMALL_ICONS
);
table.setLabelProvider(new DecoratingJavaLabelProvider(javaElementLabelProvider));
table.setComparator(new JavaElementComparator());
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:15,代码来源:JavaWorkingSetPage.java
示例13: addProjectDialog
import org.eclipse.jdt.ui.JavaElementComparator; //导入依赖的package包/类
private IDECPListElement[] addProjectDialog( )
{
try
{
Object[] selectArr = getNotYetRequiredProjects( );
new JavaElementComparator( ).sort( null, selectArr );
ListSelectionDialog dialog = new ListSelectionDialog( getShell( ),
Arrays.asList( selectArr ),
new ArrayContentProvider( ),
new ProjectLabelProvider( ),
Messages.getString("IDEClassPathBlock.ProjectDialog_message") ); //$NON-NLS-1$
dialog.setTitle( Messages.getString("IDEClassPathBlock.ProjectDialog_title") ); //$NON-NLS-1$
dialog.setHelpAvailable( false );
if ( dialog.open( ) == Window.OK )
{
Object[] result = dialog.getResult( );
IDECPListElement[] cpElements = new IDECPListElement[result.length];
for ( int i = 0; i < result.length; i++ )
{
IJavaProject curr = ( (IJavaProject) result[i] );
cpElements[i] = new IDECPListElement( IClasspathEntry.CPE_PROJECT,
curr.getPath( ),
curr.getResource( ) );
}
return cpElements;
}
}
catch ( JavaModelException e )
{
return null;
}
return null;
}
开发者ID:eclipse,项目名称:birt,代码行数:36,代码来源:IDEClassPathBlock.java
示例14: run
import org.eclipse.jdt.ui.JavaElementComparator; //导入依赖的package包/类
private void run(IType type, IField[] preselected, boolean editor) throws CoreException {
if (type.isAnnotation()) {
MessageDialog.openInformation(getShell(), DIALOG_TITLE, ActionMessages.AddGetterSetterAction_annotation_not_applicable);
notifyResult(false);
return;
} else if (type.isInterface()) {
MessageDialog.openInformation(getShell(), DIALOG_TITLE, ActionMessages.AddGetterSetterAction_interface_not_applicable);
notifyResult(false);
return;
} else if (type.getCompilationUnit() == null) {
MessageDialog.openInformation(getShell(), DIALOG_TITLE, ActionMessages.AddGetterSetterAction_error_not_in_source_file);
notifyResult(false);
return;
}
if (!ElementValidator.check(type, getShell(), DIALOG_TITLE, editor)) {
notifyResult(false);
return;
}
if (!ActionUtil.isEditable(getShell(), type)) {
notifyResult(false);
return;
}
ILabelProvider lp= new AddGetterSetterLabelProvider();
resetNumEntries();
Map<IField, GetterSetterEntry[]> entries= createGetterSetterMapping(type);
if (entries.isEmpty()) {
MessageDialog.openInformation(getShell(), DIALOG_TITLE, ActionMessages.AddGettSetterAction_typeContainsNoFields_message);
notifyResult(false);
return;
}
AddGetterSetterContentProvider cp= new AddGetterSetterContentProvider(entries);
GetterSetterTreeSelectionDialog dialog= new GetterSetterTreeSelectionDialog(getShell(), lp, cp, fEditor, type);
dialog.setComparator(new JavaElementComparator());
dialog.setTitle(DIALOG_TITLE);
String message= ActionMessages.AddGetterSetterAction_dialog_label;
dialog.setMessage(message);
dialog.setValidator(createValidator(fNumEntries));
dialog.setContainerMode(true);
dialog.setSize(60, 18);
dialog.setInput(type);
if (preselected.length > 0) {
dialog.setInitialSelections(preselected);
dialog.setExpandedElements(preselected);
}
final Set<IField> keySet= new LinkedHashSet<IField>(entries.keySet());
int dialogResult= dialog.open();
if (dialogResult == Window.OK) {
Object[] result= dialog.getResult();
if (result == null) {
notifyResult(false);
return;
}
fSort= dialog.getSortOrder();
fSynchronized= dialog.getSynchronized();
fFinal= dialog.getFinal();
fVisibility= dialog.getVisibilityModifier();
fGenerateComment= dialog.getGenerateComment();
IField[] getterFields, setterFields, getterSetterFields;
if (fSort) {
getterFields= getGetterFields(result, keySet);
setterFields= getSetterFields(result, keySet);
getterSetterFields= new IField[0];
} else {
getterFields= getGetterOnlyFields(result, keySet);
setterFields= getSetterOnlyFields(result, keySet);
getterSetterFields= getGetterSetterFields(result, keySet);
}
generate(type, getterFields, setterFields, getterSetterFields, new RefactoringASTParser(ASTProvider.SHARED_AST_LEVEL).parse(type.getCompilationUnit(), true), dialog.getElementPosition());
}
notifyResult(dialogResult == Window.OK);
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:74,代码来源:AddGetterSetterAction.java
示例15: createPackageDialog
import org.eclipse.jdt.ui.JavaElementComparator; //导入依赖的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;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:57,代码来源:JarManifestWizardPage.java
示例16: AbstractHierarchyViewerSorter
import org.eclipse.jdt.ui.JavaElementComparator; //导入依赖的package包/类
public AbstractHierarchyViewerSorter() {
fNormalSorter= new JavaElementComparator();
fSourcePositonSorter= new SourcePositionComparator();
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:5,代码来源:AbstractHierarchyViewerSorter.java
示例17: createJavaElementComparator
import org.eclipse.jdt.ui.JavaElementComparator; //导入依赖的package包/类
protected JavaElementComparator createJavaElementComparator() {
return new JavaElementComparator();
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:4,代码来源:JavaBrowsingPart.java
注:本文中的org.eclipse.jdt.ui.JavaElementComparator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论