本文整理匯總了Java中org.eclipse.jface.viewers.TreeViewer.setContentProvider方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeViewer.setContentProvider方法的具體用法?Java TreeViewer.setContentProvider怎麽用?Java TreeViewer.setContentProvider使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.viewers.TreeViewer
的用法示例。
在下文中一共展示了TreeViewer.setContentProvider方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createControl
import org.eclipse.jface.viewers.TreeViewer; //導入方法依賴的package包/類
/**
* @wbp.parser.entryPoint
*/
@Override
public void createControl(Composite parent) {
fRootControl = new Composite(parent, SWT.NULL);
fRootControl.setLayout(new FillLayout(SWT.HORIZONTAL));
viewer = new TreeViewer(fRootControl, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
viewer.setContentProvider(new ViewContentProvider());
viewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new ViewLabelProvider(createImageDescriptor())));
viewer.addDoubleClickListener(new IDoubleClickListener () {
@Override
public void doubleClick(DoubleClickEvent evt) {
TreeSelection sel = (TreeSelection) evt.getSelection();
IFile file = (IFile) sel.getFirstElement();
if (isModelFile(file)) {
JDTManager.openEditor(file, "org.gw4e.eclipse.studio.editor.GW4EEditor", null);
return;
}
JDTManager.openEditor(file, null);
}
});
files = new ArrayList<IFile>();
}
示例2: createControl
import org.eclipse.jface.viewers.TreeViewer; //導入方法依賴的package包/類
@Override
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
setControl(container);
container.setLayout(new FillLayout(SWT.HORIZONTAL));
treeViewer = new TreeViewer(container, SWT.BORDER);
treeViewer.setUseHashlookup(true);
treeViewer.setLabelProvider(new SigTypeLabelProvider());
treeViewer.setContentProvider(new SigTypeContentProvider());
treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot().getProjects());
treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
if (((TreeSelection) event.getSelection()).getFirstElement() instanceof IMarker) {
selection = event.getSelection();
ContainerSelectionPage.this.setPageComplete(true);
} else {
ContainerSelectionPage.this.setPageComplete(false);
}
}
});
}
示例3: createControl
import org.eclipse.jface.viewers.TreeViewer; //導入方法依賴的package包/類
@Override
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
this.setControl(container);
container.setLayout(new FillLayout(SWT.HORIZONTAL));
TreeViewer treeViewer = new TreeViewer(container, SWT.BORDER);
treeViewer.setUseHashlookup(true);
treeViewer.setLabelProvider(new CreatingAtomWizardLabelProvider());
treeViewer.setContentProvider(new CreatingAtomWizardContentProvider());
treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot().getProjects());
treeViewer.setFilters(new ViewerFilter[] {new CreatingAtomWizardFilter()});
treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
if (((TreeSelection) event.getSelection()).getFirstElement() instanceof IMarker) {
UntypedMarkerPage.this.selection = event.getSelection();
UntypedMarkerPage.this.setPageComplete(true);
} else {
UntypedMarkerPage.this.setPageComplete(false);
}
}
});
}
示例4: createPartControl
import org.eclipse.jface.viewers.TreeViewer; //導入方法依賴的package包/類
/**
* This is a callback that will allow us
* to create the viewer and initialize it.
*/
public void createPartControl(Composite parent) {
_viewer = new TreeViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
_contentProvider = new ViewContentProvider();
_viewer.setContentProvider(_contentProvider);
ColumnViewerToolTipSupport.enableFor(_viewer);
_viewer.addSelectionChangedListener(
new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
fireEngineSelectionChanged();
}
});
createColumns();
// _viewer.setColumnProperties( new String[] {"Status", "Identifier", "Step", "Status"} );
// _viewer.getTree().setHeaderVisible(true);
Font mono = JFaceResources.getFont(JFaceResources.TEXT_FONT);
_viewer.getTree().setFont(mono);
// Create the help context id for the viewer's control
PlatformUI.getWorkbench().getHelpSystem().setHelp(_viewer.getControl(), "org.eclipse.gemoc.executionframework.ui.views.engine.EngineStatusView");
// register for changes in the RunningEngineRegistry
//org.eclipse.gemoc.executionframework.engine.Activator.getDefault().gemocRunningEngineRegistry.addObserver(this);
buildMenu();
org.eclipse.gemoc.executionframework.engine.Activator.getDefault().gemocRunningEngineRegistry.addEngineRegistrationListener(this);
}
示例5: createControl
import org.eclipse.jface.viewers.TreeViewer; //導入方法依賴的package包/類
public void createControl(Composite parent) {
super.createControl(parent);
labelProvider = new BatchEditorOutlineLabelProvider();
TreeViewer viewer = getTreeViewer();
viewer.setContentProvider(contentProvider);
viewer.addDoubleClickListener(this);
viewer.setLabelProvider(new DelegatingStyledCellLabelProvider(labelProvider));
viewer.addSelectionChangedListener(this);
/* it can happen that input is already updated before control created */
if (input != null) {
viewer.setInput(input);
}
toggleLinkingAction = new ToggleLinkingAction();
toggleLinkingAction.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR);
IActionBars actionBars = getSite().getActionBars();
IToolBarManager toolBarManager = actionBars.getToolBarManager();
toolBarManager.add(toggleLinkingAction);
IMenuManager viewMenuManager = actionBars.getMenuManager();
viewMenuManager.add(new Separator("EndFilterGroup")); //$NON-NLS-1$
viewMenuManager.add(new Separator("treeGroup")); //$NON-NLS-1$
viewMenuManager.add(toggleLinkingAction);
/*
* when no input is set on init state - let the editor rebuild outline
* (async)
*/
if (input == null && editor != null) {
editor.rebuildOutline();
}
}
示例6: initialize
import org.eclipse.jface.viewers.TreeViewer; //導入方法依賴的package包/類
private void initialize() {
setLayout(new FillLayout());
viewer = new TreeViewer(this);
viewer.setContentProvider(this);
viewer.setLabelProvider(this);
viewer.setInput(getInitalInput());
viewer.expandAll();
viewer.addSelectionChangedListener(this);
}
示例7: initialize
import org.eclipse.jface.viewers.TreeViewer; //導入方法依賴的package包/類
private void initialize() {
setLayout(new FillLayout());
screenClasses = new TreeViewer(this);
screenClasses.setContentProvider(this);
screenClasses.setLabelProvider(this);
screenClasses.setInput(getInitalInput());
screenClasses.expandAll();
screenClasses.addSelectionChangedListener(this);
screenClasses.collapseAll();
}
示例8: createPartControl
import org.eclipse.jface.viewers.TreeViewer; //導入方法依賴的package包/類
@Override
public void createPartControl(Composite parent) {
treeViewer = new TreeViewer(parent);
treeViewer.setContentProvider(new ViewRefContentProvider());
treeViewer.setLabelProvider(new ViewRefLabelProvider());
treeViewer.setInput(null);
treeViewer.expandAll();
getSite().setSelectionProvider(treeViewer);
getSite().getPage().addSelectionListener(this);
}
示例9: createControl
import org.eclipse.jface.viewers.TreeViewer; //導入方法依賴的package包/類
public void createControl(Composite parent) {
super.createControl(parent);
labelProvider = new BashEditorOutlineLabelProvider();
TreeViewer viewer = getTreeViewer();
viewer.setContentProvider(contentProvider);
viewer.addDoubleClickListener(this);
viewer.setLabelProvider(new DelegatingStyledCellLabelProvider(labelProvider));
viewer.addSelectionChangedListener(this);
/* it can happen that input is already updated before control created */
if (input != null) {
viewer.setInput(input);
}
toggleLinkingAction = new ToggleLinkingAction();
toggleLinkingAction.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_TOGGLE_LINK_WITH_EDITOR);
IActionBars actionBars = getSite().getActionBars();
IToolBarManager toolBarManager = actionBars.getToolBarManager();
toolBarManager.add(toggleLinkingAction);
IMenuManager viewMenuManager = actionBars.getMenuManager();
viewMenuManager.add(new Separator("EndFilterGroup")); //$NON-NLS-1$
viewMenuManager.add(new Separator("treeGroup")); //$NON-NLS-1$
viewMenuManager.add(toggleLinkingAction);
/*
* when no input is set on init state - let the editor rebuild outline
* (async)
*/
if (input == null && editor != null) {
editor.rebuildOutline();
}
}
示例10: createViewer
import org.eclipse.jface.viewers.TreeViewer; //導入方法依賴的package包/類
protected void createViewer() {
FormLayout formLayout = new FormLayout();
setLayout(formLayout);
Composite con = new Composite(this, SWT.NONE);
FormData topData = new FormData();
topData.left = new FormAttachment(0,0);
topData.right = new FormAttachment(100,0);
topData.top = new FormAttachment(0,0);
con.setLayoutData(topData);
con.setLayout(new GridLayout(3,false));
createTopArea(con);
viewer = new TreeViewer(this, SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
contentProvider = new PrefsContentProvider();
viewer.setContentProvider(contentProvider);
viewer.getTree().setHeaderVisible(true);
viewer.getTree().setLinesVisible(true);
FormData viewerData = new FormData();
viewerData.top = new FormAttachment(con, 5);
viewerData.bottom = new FormAttachment(100,0);
viewerData.left = new FormAttachment(0,0);
viewerData.right = new FormAttachment(100,0);
viewer.getTree().setLayoutData(viewerData);
viewerFilter = new PreferenceFilter();
viewer.addFilter(viewerFilter);
filterJob = new SetFilterJob(viewer, viewerFilter);
}
示例11: createControl
import org.eclipse.jface.viewers.TreeViewer; //導入方法依賴的package包/類
@Override
public void createControl(Composite parent) {
super.createControl(parent);
TreeViewer viewer = getTreeViewer();
viewer.setContentProvider(new KspContentProvider());
viewer.setLabelProvider(new KspLabelProvider());
viewer.addSelectionChangedListener(this);
viewer.setInput((Object) UiUtils.getEditorFile(editor));
createActions();
createToolbar();
}
示例12: createControl
import org.eclipse.jface.viewers.TreeViewer; //導入方法依賴的package包/類
@Override
public void createControl(final Composite parent) {
final Composite container = new Composite(parent, SWT.NONE);
setControl(container);
container.setLayout(new FillLayout(SWT.HORIZONTAL));
treeViewer = new TreeViewer(container, SWT.BORDER);
treeViewer.setUseHashlookup(true);
treeViewer.setLabelProvider(new CreatingAtomWizardLabelProvider());
treeViewer.setContentProvider(new CreatingAtomWizardContentProvider());
treeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot().getProjects());
treeViewer.setFilters(new ViewerFilter[] {new CreatingAtomWizardFilter()});
treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(final SelectionChangedEvent event) {
if (((TreeSelection) event.getSelection()).getFirstElement() instanceof IMarker) {
SelectionPage.this.setPageComplete(true);
} else {
SelectionPage.this.setPageComplete(false);
}
}
});
setPageComplete(false);
}
示例13: createControl
import org.eclipse.jface.viewers.TreeViewer; //導入方法依賴的package包/類
@Override
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
this.setControl(container);
container.setLayout(new FillLayout(SWT.HORIZONTAL));
TreeViewer treeViewer = new TreeViewer(container, SWT.BORDER);
treeViewer.setUseHashlookup(true);
treeViewer.setLabelProvider(new MarkerTreeViewLabelProvider());
treeViewer.setContentProvider(new MarkerTreeViewContentProvider());
String savedTree = Activator.getDefault().getDialogSettings().get("universe");
try {
Object[] array = new Object[1];
if (savedTree != null) {
array[0] = Serialization.getInstance().fromString(savedTree);
treeViewer.setInput(array);
}
} catch (IOException | ClassNotFoundException e) {
e.printStackTrace();
}
treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
String markerType =
((MarkerTypeElement) ((TreeSelection) event.getSelection()).getFirstElement())
.getType();
if (markerType.equals("universe") || markerType.endsWith("{abs}")) {
MarkerTypesPage.this.setPageComplete(false);
} else {
MarkerTypesPage.this.selection = event.getSelection();
MarkerTypesPage.this.setPageComplete(true);
}
}
});
}
示例14: createPartControl
import org.eclipse.jface.viewers.TreeViewer; //導入方法依賴的package包/類
@Override
public void createPartControl(Composite parent) {
FillLayout fillLayout = new FillLayout(SWT.VERTICAL);
fillLayout.marginHeight = 5;
fillLayout.marginWidth = 5;
parent.setLayout(fillLayout);
// main container
container = new Composite(parent, SWT.BORDER);
container.setLayout(new FillLayout());
// create container for stack trace data
Composite stacktraceDataContainer = new Composite(parent, SWT.BORDER);
FormLayout formLayout = new FormLayout();
formLayout.marginHeight = 5;
formLayout.marginWidth = 5;
formLayout.spacing = 5;
stacktraceDataContainer.setLayout(formLayout);
Composite stackLabelContainer = new Composite(stacktraceDataContainer, SWT.NO_SCROLL | SWT.SHADOW_NONE);
stackLabelContainer.setLayout(new GridLayout());
FormData stackLabelFormData = new FormData();
stackLabelFormData.top = new FormAttachment(0);
stackLabelFormData.left = new FormAttachment(0);
stackLabelFormData.right = new FormAttachment(100);
stackLabelFormData.bottom = new FormAttachment(20);
stackLabelContainer.setLayoutData(stackLabelFormData);
Composite stackTraceContainer = new Composite(stacktraceDataContainer, SWT.NO_SCROLL | SWT.SHADOW_NONE);
stackTraceContainer.setLayout(new FillLayout());
FormData stackTraceFormData = new FormData();
stackTraceFormData.top = new FormAttachment(stackLabelContainer);
stackTraceFormData.left = new FormAttachment(0);
stackTraceFormData.right = new FormAttachment(100);
stackTraceFormData.bottom = new FormAttachment(100);
stackTraceContainer.setLayoutData(stackTraceFormData);
// Create viewer for test tree in main container
testTreeViewer = new TreeViewer(container);
testTreeViewer.setContentProvider(new XpectContentProvider());
testTreeViewer.setLabelProvider(new XpectLabelProvider(this.testsExecutionStatus));
testTreeViewer.setInput(null);
// create stack trace label
stacktraceLabel = new Label(stackLabelContainer, SWT.SHADOW_OUT);
FontData fontData = stacktraceLabel.getFont().getFontData()[0];
Display display = Display.getCurrent();
// may be null if outside the UI thread
if (display == null)
display = Display.getDefault();
Font font = new Font(display, new FontData(fontData.getName(), fontData
.getHeight(), SWT.BOLD));
// Make stack trace label bold
stacktraceLabel.setFont(font);
stacktraceLabel.setText(NO_TRACE_MSG);
// create stack trace console
MessageConsole messageConsole = new MessageConsole("trace", null);
stacktraceConsole = new TraceConsole(messageConsole);
stacktraceConsoleViewer = new TextConsoleViewer(stackTraceContainer, messageConsole);
// context menu
getSite().setSelectionProvider(testTreeViewer);
MenuManager contextMenu = new MenuManager();
contextMenu.setRemoveAllWhenShown(true);
getSite().registerContextMenu(contextMenu, testTreeViewer);
Control control = testTreeViewer.getControl();
Menu menu = contextMenu.createContextMenu(control);
control.setMenu(menu);
activateContext();
createSelectionActions();
}
示例15: createDataModel
import org.eclipse.jface.viewers.TreeViewer; //導入方法依賴的package包/類
protected void createDataModel ( final TreeViewer viewer )
{
final DataBindingContext dbc = new DataBindingContext ();
final IObservableFactory listFactory = new IObservableFactory () {
@Override
public IObservable createObservable ( final Object target )
{
if ( target instanceof IObservableList )
{
return (IObservableList)target;
}
else if ( target instanceof World )
{
return EMFObservables.observeList ( (EObject)target, InfrastructurePackage.Literals.WORLD__NODES );
}
else if ( target instanceof SystemNode )
{
return EMFObservables.observeList ( (EObject)target, InfrastructurePackage.Literals.SYSTEM_NODE__DRIVERS );
}
return null;
}
};
final AdapterFactory adapterFactory = new InfrastructureItemProviderAdapterFactory ();
final AdapterFactoryLabelProvider labelProvider = new AdapterFactoryLabelProvider ( adapterFactory );
final ObservableListTreeContentProvider cp = new ObservableListTreeContentProvider ( listFactory, null );
viewer.setContentProvider ( cp );
viewer.setLabelProvider ( labelProvider );
viewer.setInput ( EMFObservables.observeList ( this.world, InfrastructurePackage.Literals.WORLD__NODES ) );
dbc.bindValue ( ViewersObservables.observeSingleSelection ( viewer ), this.driverValue );
this.driverValue.addValueChangeListener ( new IValueChangeListener () {
@Override
public void handleValueChange ( final ValueChangeEvent event )
{
update ();
}
} );
viewer.getControl ().addDisposeListener ( new DisposeListener () {
@Override
public void widgetDisposed ( final DisposeEvent e )
{
dbc.dispose ();
}
} );
}