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


Java ILabelProvider.getText方法代码示例

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


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

示例1: ProjectCombo

import org.eclipse.jface.viewers.ILabelProvider; //导入方法依赖的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);
}
 
开发者ID:thahn0720,项目名称:agui_eclipse_plugin,代码行数:34,代码来源:ProjectChooserHelper.java

示例2: compare

import org.eclipse.jface.viewers.ILabelProvider; //导入方法依赖的package包/类
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
    ILabelProvider lprov = (ILabelProvider) ((ContentViewer) viewer).getLabelProvider();
    String name1 = lprov.getText(e1);
    String name2 = lprov.getText(e2);
    if (name1 == null) {
        name1 = "";
    }
    if (name2 == null) {
        name2 = "";
    }
    if (name1.length() > 0 && name2.length() > 0) {
        char char1 = name1.charAt(name1.length() - 1);
        char char2 = name2.charAt(name2.length() - 1);
        if (char1 == '*' && char1 != char2) {
            return -1;
        }
        if (char2 == '*' && char2 != char1) {
            return 1;
        }
    }
    return name1.compareTo(name2);
}
 
开发者ID:iloveeclipse,项目名称:datahierarchy,代码行数:24,代码来源:FilterListEditor.java

示例3: compare

import org.eclipse.jface.viewers.ILabelProvider; //导入方法依赖的package包/类
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
    ILabelProvider lprov = (ILabelProvider) ((ContentViewer) viewer).getLabelProvider();
    String name1 = lprov.getText(e1);
    String name2 = lprov.getText(e2);
    if (name1 == null) {
        name1 = ""; //$NON-NLS-1$
    }
    if (name2 == null) {
        name2 = ""; //$NON-NLS-1$
    }
    if (name1.length() > 0 && name2.length() > 0) {
        char char1 = name1.charAt(name1.length() - 1);
        char char2 = name2.charAt(name2.length() - 1);
        if (char1 == '*' && char1 != char2) {
            return -1;
        }
        if (char2 == '*' && char2 != char1) {
            return 1;
        }
    }
    return name1.compareTo(name2);
}
 
开发者ID:iloveeclipse,项目名称:jdepend4eclipse,代码行数:24,代码来源:JDependPreferencePage.java

示例4: findElement

import org.eclipse.jface.viewers.ILabelProvider; //导入方法依赖的package包/类
public Object findElement(Widget[] items, ILabelProvider labelProvider) {
    for (int i = 0; i < items.length; i++) {
        Object element = items[i].getData();
        if (pattern == null) {
            return element;
        }

        if (element != null) {
            String label = labelProvider.getText(element);
            if(label == null) {
                return null;
            }
            // remove the dirty prefix from the editor's label
            String prefix = PartTab.DIRTY_PREFIX;
            if (label.startsWith(prefix)) {
                label = label.substring(prefix.length());
            }
            if (matches(pattern, label)) {
                return element;
            }
        }
    }
    return null;
}
 
开发者ID:iloveeclipse,项目名称:skin4eclipse,代码行数:25,代码来源:NamePatternFilter.java

示例5: getLabel

import org.eclipse.jface.viewers.ILabelProvider; //导入方法依赖的package包/类
private String getLabel(final Viewer viewer, final Object e1) {
	String name1;
	if (viewer == null || !(viewer instanceof ContentViewer)) {
		name1 = e1.toString();
	} else {
		final IBaseLabelProvider prov = ((ContentViewer) viewer).getLabelProvider();
		if (prov instanceof ILabelProvider) {
			final ILabelProvider lprov = (ILabelProvider) prov;
			name1 = lprov.getText(e1);
		} else {
			name1 = e1.toString();
		}
	}
	if (name1 == null) {
		name1 = "";//$NON-NLS-1$
	}
	return name1;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:19,代码来源:FileFolderSorter.java

示例6: getText

import org.eclipse.jface.viewers.ILabelProvider; //导入方法依赖的package包/类
public String getText(Object element)
{
	List<ILabelProvider> providers = this.getProcessors();
	String result = StringUtil.EMPTY;

	for (ILabelProvider provider : providers)
	{
		String text = provider.getText(element);

		if (!StringUtil.isEmpty(text))
		{
			result = text;
			break;
		}
	}

	return result;
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:19,代码来源:IndexViewLabelProvider.java

示例7: getLabel

import org.eclipse.jface.viewers.ILabelProvider; //导入方法依赖的package包/类
protected String getLabel(Object element) {
	if (hasConfiguration(AttributeControlConfigurations.LABEL_PROVIDER)) {
		ILabelProvider labelProvider = getConfiguration(AttributeControlConfigurations.LABEL_PROVIDER, ILabelProvider.class);
		if (labelProvider != null) {
			return labelProvider.getText(element);
		}
	}
	return element.toString();
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:10,代码来源:BaseAttributeControl.java

示例8: getValuesAsString

import org.eclipse.jface.viewers.ILabelProvider; //导入方法依赖的package包/类
protected String[] getValuesAsString(T[] values) {	
			
	ILabelProvider labelProvider = getConfiguration(AttributeControlConfigurations.LABEL_PROVIDER, ILabelProvider.class);
	String[] valuesAsString = new String[values.length];
	for (int i = 0; i < valuesAsString.length; i++) {
		T val = values[i];
		valuesAsString[i] = labelProvider.getText(val);
	}
	
	return valuesAsString;
}
 
开发者ID:Talend,项目名称:avro-schema-editor,代码行数:12,代码来源:MultiChoiceAttributeControl.java

示例9: getForeignObjectLabel

import org.eclipse.jface.viewers.ILabelProvider; //导入方法依赖的package包/类
/**
 * Get the label from the given eObject's {@link IResourceServiceProvider}.
 *
 * @param eObject
 *          the target object
 * @return the label for the given eObject
 */
private String getForeignObjectLabel(final EObject eObject) {
  IResourceServiceProvider serviceProvider = ((XtextResource) eObject.eResource()).getResourceServiceProvider();
  ILabelProvider labelProvider = serviceProvider.get(ILabelProvider.class);
  if (labelProvider != null) {
    return labelProvider.getText(eObject);
  }
  return null;
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:16,代码来源:AbstractLabelProvider.java

示例10: findFirstMatchToPattern

import org.eclipse.jface.viewers.ILabelProvider; //导入方法依赖的package包/类
/**
 * Recursively searches the first element in the tree which matches the current
 * filter pattern.
 * 
 * @param items
 *            tree root items
 * @return tree element
 */
private Object findFirstMatchToPattern(TreeItem[] items) {
	// Match the string pattern against labels
	ILabelProvider labelProvider = (ILabelProvider) treeViewer.getLabelProvider();
	// Process each item in the tree
	for (int i = 0; i < items.length; i++) {
		Object element = items[i].getData();
		// Return the first element if no pattern is set
		if (stringMatcher == null) {
			return element;
		}
		// Return the element if it matches the pattern
		if (element != null) {
			String label = labelProvider.getText(element);
			if (stringMatcher.match(label)) {
				return element;
			}
		}
		// Recursively check the elements children for a match
		element = findFirstMatchToPattern(items[i].getItems());
		// Return the child element match if found
		if (element != null) {
			return element;
		}
	}
	// No match found
	return null;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:36,代码来源:AbstractInformationControl.java

示例11: getText

import org.eclipse.jface.viewers.ILabelProvider; //导入方法依赖的package包/类
public String getText(Object element) {
	if (element == null) {
		return Messages.GlobalDescriptionLabelProvider_0;
	} else {
		ILabelProvider descriptionLabelProvider = lookupDescriptionLabelProvider(element);
		if (descriptionLabelProvider != null) {
			return descriptionLabelProvider.getText(element);
		} else {
			return element.toString();
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:13,代码来源:GlobalDescriptionLabelProvider.java

示例12: getStyledText

import org.eclipse.jface.viewers.ILabelProvider; //导入方法依赖的package包/类
public StyledString getStyledText(Object element) {
	if (element == null) {
		return new StyledString(Messages.GlobalDescriptionLabelProvider_0);
	} else {
		ILabelProvider descriptionLabelProvider = lookupDescriptionLabelProvider(element);
		if (descriptionLabelProvider instanceof IStyledLabelProvider)
			return ((IStyledLabelProvider) descriptionLabelProvider).getStyledText(element);
		else if(descriptionLabelProvider != null) {
			return new StyledString(descriptionLabelProvider.getText(element));
		} else {
			return new StyledString(element.toString());
		}
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:15,代码来源:GlobalDescriptionLabelProvider.java

示例13: compare

import org.eclipse.jface.viewers.ILabelProvider; //导入方法依赖的package包/类
public int compare(Viewer viewer, Object e1, Object e2)
{
	int cat1 = category(e1);
	int cat2 = category(e2);
	if (cat1 != cat2) return cat1 - cat2;
	String name1, name2;
	if (viewer == null || !(viewer instanceof ContentViewer))
	{
		name1 = e1.toString();
		name2 = e2.toString();
	}
	else
	{
		IBaseLabelProvider prov = ((ContentViewer) viewer)
		        .getLabelProvider();
		if (prov instanceof ILabelProvider)
		{
			ILabelProvider lprov = (ILabelProvider) prov;
			name1 = lprov.getText(e1);
			name2 = lprov.getText(e2);
		}
		else
		{
			name1 = e1.toString();
			name2 = e2.toString();
		}
	}
	if (name1 == null) name1 = "";
	if (name2 == null) name2 = "";
	return name1.compareToIgnoreCase(name2);
}
 
开发者ID:Spacecraft-Code,项目名称:SPELL,代码行数:32,代码来源:NodeSorter.java

示例14: compare

import org.eclipse.jface.viewers.ILabelProvider; //导入方法依赖的package包/类
public int compare(Viewer viewer, Object e1, Object e2) {
    if(!sortTabList){
        return 0;
    }
    String name1;
    String name2;

    if (viewer == null || !(viewer instanceof ContentViewer)) {
        name1 = e1.toString();
        name2 = e2.toString();
    } else {
        IBaseLabelProvider prov = ((ContentViewer) viewer)
        .getLabelProvider();
        if (prov instanceof ILabelProvider) {
            ILabelProvider lprov = (ILabelProvider) prov;
            name1 = lprov.getText(e1);
            name2 = lprov.getText(e2);
        } else {
            name1 = e1.toString();
            name2 = e2.toString();
        }
    }
    if (name1 == null) {
        name1 = "";
    }
    if (name2 == null) {
        name2 = "";
    }
    return getComparator().compare(name1, name2);
}
 
开发者ID:iloveeclipse,项目名称:skin4eclipse,代码行数:31,代码来源:ClosedPartListControl.java

示例15: getValueAsString

import org.eclipse.jface.viewers.ILabelProvider; //导入方法依赖的package包/类
@Override
public String getValueAsString() {
	ILabelProvider provider = getDescriptor().getLabelProvider();
	if (provider instanceof CheckBoxLabelProvider) {
		return provider.getText(editValue);//$NON-NLS-1$
	}
	if (provider == null) {
		return editValue.toString();
	}
	String text = provider.getText(editValue);
	if (text == null) {
		return "";//$NON-NLS-1$
	}
	return text;
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:16,代码来源:JRPropertySheetEntry.java


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