本文整理汇总了Java中org.eclipse.jface.viewers.TreeViewer.addSelectionChangedListener方法的典型用法代码示例。如果您正苦于以下问题:Java TreeViewer.addSelectionChangedListener方法的具体用法?Java TreeViewer.addSelectionChangedListener怎么用?Java TreeViewer.addSelectionChangedListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.viewers.TreeViewer
的用法示例。
在下文中一共展示了TreeViewer.addSelectionChangedListener方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
});
}
示例2: 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);
}
}
});
}
示例3: 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);
}
示例4: 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();
}
}
示例5: 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);
}
示例6: 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();
}
示例7: 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();
}
}
示例8: 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();
}
示例9: 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);
}
示例10: 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);
}
}
});
}
示例11: 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 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();
}
for (LoadItem loadItem : TraceManager.get().getLoads()) {
allEClasses.addAll(loadItem.getAllEClasses().values());
}
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}")) {
TypeSelectionPage.this.setPageComplete(false);
canFlip = false;
} else {
selection = event.getSelection();
containerSigTypes = TraceManager.get().findContainers(allEClasses, getSelectedType());
canFlip = !containerSigTypes.isEmpty();
TypeSelectionPage.this.setPageComplete(true);
getContainer().updateButtons();
}
}
});
}
示例12: createControl
import org.eclipse.jface.viewers.TreeViewer; //导入方法依赖的package包/类
/**
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createControl(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
setControl(composite);
composite.setLayout(new FillLayout());
final SashForm mainSashForm = new SashForm(composite, SWT.HORIZONTAL);
// Master
final TreeViewer viewer = new TreeViewer(mainSashForm);
viewer.setContentProvider(new ExamplesContentProvider());
viewer.setLabelProvider(new ExamplesLabelProvider());
viewer.setInput(ExamplesRegistry.getInstance().getRegisteredExamples());
// Details
Composite details = new Composite(mainSashForm, SWT.NULL);
final FillLayout detailsLayout = new FillLayout(SWT.VERTICAL);
detailsLayout.marginWidth = detailsLayout.spacing = 10;
details.setLayout(detailsLayout);
final SashForm detailsSashForm = new SashForm(details, SWT.VERTICAL);
final ImageCanvas screenshotLabel = new ImageCanvas(detailsSashForm, SWT.BORDER);
final Label descriptionLabel = new Label(detailsSashForm, SWT.NULL);
// Selection behaviour
viewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent arg0) {
chosenExample = (IExample) ((IStructuredSelection) viewer.getSelection()).getFirstElement();
screenshotLabel.setImage(chosenExample.getScreenshot());
descriptionLabel.setText(chosenExample.getDescription());
setPageComplete(chosenExample != null && check(chosenExample));
}
});
// Sash weights
mainSashForm.setWeights(new int[] { 1, 3, });
detailsSashForm.setWeights(new int[] { 2, 1, });
}