本文整理汇总了Java中org.eclipse.ui.model.WorkbenchLabelProvider类的典型用法代码示例。如果您正苦于以下问题:Java WorkbenchLabelProvider类的具体用法?Java WorkbenchLabelProvider怎么用?Java WorkbenchLabelProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WorkbenchLabelProvider类属于org.eclipse.ui.model包,在下文中一共展示了WorkbenchLabelProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: N4JSProjectExplorerLabelProvider
import org.eclipse.ui.model.WorkbenchLabelProvider; //导入依赖的package包/类
/**
* Sole constructor.
*/
public N4JSProjectExplorerLabelProvider() {
decorator = new N4JSProjectExplorerProblemsDecorator();
workbenchLabelProvider = new WorkbenchLabelProvider();
delegate = new DecoratingLabelProvider(workbenchLabelProvider, decorator);
workingSetLabelProviderListener = new ILabelProviderListener() {
@Override
public void labelProviderChanged(final LabelProviderChangedEvent event) {
final LabelProviderChangedEvent wrapperEvent = createWorkingSetWrapperEvent(event);
if (null != wrapperEvent) {
UIUtils.getDisplay().asyncExec(() -> fireLabelProviderChanged(wrapperEvent));
}
}
};
delegate.addListener(workingSetLabelProviderListener);
}
示例2: chooseWorkspace
import org.eclipse.ui.model.WorkbenchLabelProvider; //导入依赖的package包/类
protected void chooseWorkspace ()
{
final ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog ( getShell (), new WorkbenchLabelProvider (), new WorkbenchContentProvider () );
dialog.setTitle ( "Select driver exporter configuration file" );
dialog.setMessage ( "Choose a driver exporter file for the configuration" );
dialog.setInput ( ResourcesPlugin.getWorkspace ().getRoot () );
dialog.setComparator ( new ResourceComparator ( ResourceComparator.NAME ) );
dialog.setAllowMultiple ( true );
dialog.setDialogBoundsSettings ( getDialogBoundsSettings ( HiveTab.WORKSPACE_SELECTION_DIALOG ), Dialog.DIALOG_PERSISTSIZE );
if ( dialog.open () == IDialogConstants.OK_ID )
{
final IResource resource = (IResource)dialog.getFirstResult ();
if ( resource != null )
{
final String arg = resource.getFullPath ().toString ();
final String fileLoc = VariablesPlugin.getDefault ().getStringVariableManager ().generateVariableExpression ( "workspace_loc", arg ); //$NON-NLS-1$
this.fileText.setText ( fileLoc );
makeDirty ();
}
}
}
示例3: createDialogArea
import org.eclipse.ui.model.WorkbenchLabelProvider; //导入依赖的package包/类
@Override
protected Control createDialogArea(Composite parent)
{
Composite dialogArea = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(dialogArea, SWT.NONE);
createMessageArea(composite);
listViewer = new TableViewer(composite, SWT.TOP | SWT.BORDER);
GridData data = new GridData(GridData.FILL_BOTH);
data.widthHint = 400;
data.heightHint = 400;
listViewer.getTable().setLayoutData(data);
listViewer.setLabelProvider(WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider());
listViewer.setContentProvider(new JarProjectContentProvider(null));
listViewer.setComparator(new ViewerComparator());
listViewer.setInput(ResourcesPlugin.getWorkspace());
applyDialogFont(composite);
listViewer.setSelection(new StructuredSelection(initialSelection));
GridLayoutFactory.fillDefaults().generateLayout(composite);
return dialogArea;
}
示例4: createControl
import org.eclipse.ui.model.WorkbenchLabelProvider; //导入依赖的package包/类
public void createControl(Composite parent) {
initializeDialogUnits(parent);
parent = new Composite(parent, SWT.NONE);
parent.setLayout(new GridLayout());
new Label(parent, SWT.NONE)
.setText(UIMessages.ExportSessionPage1Sessions_label);
sessionstable = new TableViewer(parent, SWT.BORDER);
sessionstable.setLabelProvider(new WorkbenchLabelProvider());
sessionstable.setContentProvider(ArrayContentProvider.getInstance());
sessionstable.setInput(CoverageTools.getSessionManager().getSessions());
ICoverageSession active = CoverageTools.getSessionManager()
.getActiveSession();
if (active != null) {
sessionstable.setSelection(new StructuredSelection(active));
}
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = convertHeightInCharsToPixels(8);
sessionstable.getControl().setLayoutData(gd);
Group group = new Group(parent, SWT.NONE);
group.setText(UIMessages.ExportSessionPage1DestinationGroup_label);
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
createExportOptionsGroup(group);
setControl(parent);
ContextHelp.setHelp(parent, ContextHelp.SESSION_EXPORT);
restoreWidgetValues();
}
示例5: createResourceSelectionTree
import org.eclipse.ui.model.WorkbenchLabelProvider; //导入依赖的package包/类
protected TreeViewer createResourceSelectionTree(Composite composite, int types, int span) {
TreeViewer tree = new TreeViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
tree.setUseHashlookup(true);
tree.setContentProvider(getResourceProvider(types));
tree.setLabelProvider(
new DecoratingLabelProvider(
new WorkbenchLabelProvider(),
SVNUIPlugin.getPlugin().getWorkbench().getDecoratorManager().getLabelDecorator()));
tree.setSorter(new ResourceSorter(ResourceSorter.NAME));
GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
data.heightHint = LIST_HEIGHT_HINT;
data.horizontalSpan = span;
tree.getControl().setLayoutData(data);
return tree;
}
示例6: getColumnImage
import org.eclipse.ui.model.WorkbenchLabelProvider; //导入依赖的package包/类
public Image getColumnImage(Object element, int columnIndex) {
if (columnIndex == 0) {
IResource elementResource;
if (element instanceof SVNTreeConflict)
elementResource = ((SVNTreeConflict)element).getResource();
else
elementResource = (IResource)element;
Image image;
if (!elementResource.exists() && elementResource.getName().indexOf(".") == -1) { //$NON-NLS-1$
image = WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider().getImage(ResourcesPlugin.getWorkspace().getRoot().getFolder(new Path(elementResource.getFullPath().toString())));
} else {
image = WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider().getImage(elementResource);
}
return image;
}
return null;
}
示例7: handleManifestmainclassBrowse
import org.eclipse.ui.model.WorkbenchLabelProvider; //导入依赖的package包/类
/**
* Uses the standard container selection dialog to
* choose the new value for the container field.
*/
private void handleManifestmainclassBrowse() {
String mainClass = getManifestmainclass();
ILabelProvider lp= new WorkbenchLabelProvider();
ITreeContentProvider cp= new WorkbenchContentProvider();
IResource[] res=jproject.getResource();
IJavaSearchScope searchScope= JavaSearchScopeFactory.getInstance().createJavaSearchScope(res, true);
SelectionDialog dialog = JavaUI.createMainTypeDialog(getShell(), getContainer(), searchScope, 0, false);
dialog.setMessage("Select Main-Class for JAR file");
dialog.setTitle("Fat Jar Config");
if (dialog.open() == SelectionDialog.OK) {
Object[] elements= dialog.getResult();
if (elements.length == 1) {
SourceType mainElement = (SourceType)elements[0];
mainClass = mainElement.getFullyQualifiedName();
manifestmainclassText.setText(mainClass);
}
}
}
示例8: createTreeViewer
import org.eclipse.ui.model.WorkbenchLabelProvider; //导入依赖的package包/类
@Override
protected CheckboxTreeViewer createTreeViewer(Composite parent) {
int style = SWT.VIRTUAL | SWT.FULL_SELECTION | SWT.BORDER
| SWT.H_SCROLL | SWT.V_SCROLL;
CheckboxTreeViewer result = new CheckboxTreeViewer(parent, style);
result.setLabelProvider(new WorkbenchLabelProvider());
result.setContentProvider(new BaseWorkbenchContentProvider());
result.setComparator(new NodeWrapperTreeSorter());
result.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
if (recursiveTreeSelect) {
tree.setSubtreeChecked(event.getElement(), event.getChecked());
}
}
});
tree = result;
return result;
}
示例9: selectFile
import org.eclipse.ui.model.WorkbenchLabelProvider; //导入依赖的package包/类
/**
* Open a dialog box asking the user to select an existing project under the
* current workspace.
*
* @param parentShell
* @param title
*/
public static IResource selectFile(Shell parentShell, String title) {
ElementTreeSelectionDialog dialog =
new ElementTreeSelectionDialog(
parentShell,
new WorkbenchLabelProvider(),
new WorkbenchContentProvider()
);
dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
dialog.setTitle(title);
dialog.setAllowMultiple(false);
if(dialog.open() == ElementTreeSelectionDialog.OK) {
return (IResource) dialog.getFirstResult();
}
return null;
}
示例10: ResourceTreeSelectionDialog
import org.eclipse.ui.model.WorkbenchLabelProvider; //导入依赖的package包/类
/**
* Constructs an instance of <code>ResourceTreeSelectionDialog</code>.
*
* @param parent the parent shell for the dialog
* @param title dialog title
* @param message dialog message
* @param rootResource resource that serves as the root of the tree. This
* resource's descendants are visible in the tree, but the root
* itself is not.
* @param initialResource the initially-selected resource
* @param visibleResourceTypes a set of {@link IResource} types that are
* visible in the tree (e.g.
* <code>IResource.FILE | IResource.FOLDER</code>)
* @param acceptedResourceTypes a set of {@link IResource} types that can be
* selected
* @param multiSelection whether or not to allow selection of multiple
* resources
*/
public ResourceTreeSelectionDialog(Shell parent, String title,
String message, IContainer rootResource, IResource initialResource,
int visibleResourceTypes, int acceptedResourceTypes,
boolean multiSelection) {
super(parent, new WorkbenchLabelProvider(), new WorkbenchContentProvider());
setTitle(title);
setMessage(message);
setHelpAvailable(false);
setInput(rootResource);
if (initialResource != null) {
setInitialSelection(initialResource);
}
setComparator(new ResourceComparator(ResourceComparator.NAME));
setValidator(new ResourceFilter(acceptedResourceTypes, multiSelection));
addFilter(new ResourceFilter(visibleResourceTypes));
}
示例11: ProjectListSelectionDialog
import org.eclipse.ui.model.WorkbenchLabelProvider; //导入依赖的package包/类
/**
* @param parent
*/
public ProjectListSelectionDialog(Shell parent) {
super(parent, WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider());
setTitle(Messages.ProjectSelectionDialog_Title);
setMessage(Messages.ProjectSelectionDialog_Message);
final List<Object> list = new ArrayList<Object>();
try {
ResourcesPlugin.getWorkspace().getRoot().accept(new IResourceProxyVisitor() {
public boolean visit(IResourceProxy proxy) throws CoreException {
if (proxy.getType() == IResource.ROOT) {
return true;
}
if (proxy.isAccessible()) {
list.add(proxy.requestResource());
}
return false;
}
}, 0);
} catch (CoreException e) {
IdeLog.logError(UIPlugin.getDefault(), e);
}
setElements(list.toArray());
}
示例12: createResourcesGroup
import org.eclipse.ui.model.WorkbenchLabelProvider; //导入依赖的package包/类
/**
* Creates the checkbox tree and list for selecting resources.
* @param parent
* the parent control
*/
protected final void createResourcesGroup(Composite parent) {
// create the input element, which has the root resource
// as its only child
List input = new ArrayList();
IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
for (int i = 0; i < projects.length; i++) {
if (projects[i].isOpen()) {
input.add(projects[i]);
}
}
this.resourceGroup = new ResourceTreeAndListGroup(parent, input, getResourceProvider(IResource.FOLDER
| IResource.PROJECT), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(),
getResourceProvider(IResource.FILE), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(),
SWT.NONE, DialogUtil.inRegularFontMode(parent));
ICheckStateListener listener = new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
updateWidgetEnablements();
}
};
this.resourceGroup.addCheckStateListener(listener);
}
示例13: selectInProject
import org.eclipse.ui.model.WorkbenchLabelProvider; //导入依赖的package包/类
private void selectInProject() {
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(),
new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider());
dialog.setTitle("Select a file in the project:");
dialog.setMessage("Select a file in the project:");
// Filter to the project
dialog.addFilter(new ViewerFilter() {
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof IProject) {
return ((IProject) element).getName().equals(project.getName());
}
// we want a folder
return defaultExtension != null || element instanceof IContainer;
}
});
dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
// TODO try to preselect the current file
dialog.open();
Object[] results = dialog.getResult();
if ((results != null) && (results.length > 0) && (results[0] instanceof IResource)) {
IPath path = ((IResource) results[0]).getFullPath();
setProjectLoc(path.removeFirstSegments(1).makeRelative().toString());
}
}
示例14: selectFolderInProject
import org.eclipse.ui.model.WorkbenchLabelProvider; //导入依赖的package包/类
private IFolder selectFolderInProject() {
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getControl().getShell(),
new WorkbenchLabelProvider(), new BaseWorkbenchContentProvider());
dialog.setTitle("Select View Root");
dialog.setMessage("select the view root:");
dialog.setInput(getProject());
dialog.addFilter(new ViewerFilter() {
public boolean select(Viewer viewer, Object parentElement, Object element) {
return element instanceof IFolder && ((IFolder) element).isAccessible();
}
});
if (Window.OK == dialog.open()) {
Object[] result = dialog.getResult();
if (result.length > 0) {
return (IFolder) result[0];
}
}
return null;
}
示例15: chooseWorkspaceDirectory
import org.eclipse.ui.model.WorkbenchLabelProvider; //导入依赖的package包/类
private String chooseWorkspaceDirectory(String prompt) {
ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(),
new WorkbenchContentProvider());
dialog.setTitle("Selecting directory");
dialog.setMessage(prompt);
dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
if (dialog.open() == IDialogConstants.OK_ID) {
IResource resource = (IResource)dialog.getFirstResult();
if (resource != null) {
String path = resource.getFullPath().toString();
String fileLoc = VariablesPlugin.getDefault().getStringVariableManager()
.generateVariableExpression("workspace_loc", path);
return fileLoc;
}
}
return null;
}