本文整理汇总了Java中org.eclipse.jface.viewers.IPostSelectionProvider类的典型用法代码示例。如果您正苦于以下问题:Java IPostSelectionProvider类的具体用法?Java IPostSelectionProvider怎么用?Java IPostSelectionProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IPostSelectionProvider类属于org.eclipse.jface.viewers包,在下文中一共展示了IPostSelectionProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TexlipseAnnotationUpdater
import org.eclipse.jface.viewers.IPostSelectionProvider; //导入依赖的package包/类
/**
* Creates a new TexlipseAnnotationUpdater and adds itself to the TexEditor via
* <code>addPostSelectionChangedListener</code>
* @param editor The TexEditor
*/
public TexlipseAnnotationUpdater (AbstractTextEditor editor) {
//Add this listener to the current editors IPostSelectionListener (lazy update)
((IPostSelectionProvider) editor.getSelectionProvider()).addPostSelectionChangedListener(this);
fEditor = editor;
fEnabled = TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(
TexlipseProperties.TEX_EDITOR_ANNOTATATIONS);
//Add a PropertyChangeListener
TexlipsePlugin.getDefault().getPreferenceStore().addPropertyChangeListener(new
IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
String property = event.getProperty();
if (TexlipseProperties.TEX_EDITOR_ANNOTATATIONS.equals(property)) {
boolean enabled = TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(
TexlipseProperties.TEX_EDITOR_ANNOTATATIONS);
fEnabled = enabled;
}
}
});
}
示例2: setSelectionProviderDelegate
import org.eclipse.jface.viewers.IPostSelectionProvider; //导入依赖的package包/类
/**
* Sets a new selection provider to delegate to. Selection listeners registered with the previous delegate
* are removed before.
*
* @param newDelegate
* new selection provider
*/
public void setSelectionProviderDelegate(ISelectionProvider newDelegate) {
if (delegate != newDelegate) {
if (delegate != null) {
delegate.removeSelectionChangedListener(selectionListener);
if (delegate instanceof IPostSelectionProvider) {
((IPostSelectionProvider)delegate).removePostSelectionChangedListener(
postSelectionListener);
}
}
delegate = newDelegate;
if (newDelegate != null) {
newDelegate.addSelectionChangedListener(selectionListener);
if (newDelegate instanceof IPostSelectionProvider) {
((IPostSelectionProvider)newDelegate).addPostSelectionChangedListener(
postSelectionListener);
}
fireSelectionChanged(newDelegate.getSelection());
firePostSelectionChanged(newDelegate.getSelection());
}
}
}
示例3: setSelectionProvider
import org.eclipse.jface.viewers.IPostSelectionProvider; //导入依赖的package包/类
/**
* The <code>MultiPageEditorSite</code> implementation of this <code>IWorkbenchPartSite</code> method remembers the
* selection provider, and also hooks a listener on it, which calls <code>handleSelectionChanged</code> when a
* selection changed event occurs.
*
* @param provider
* The selection provider.
* @see MultiPageEditorSite#handleSelectionChanged(SelectionChangedEvent)
*/
public void setSelectionProvider(ISelectionProvider provider) {
ISelectionProvider oldSelectionProvider = selectionProvider;
selectionProvider = provider;
if (oldSelectionProvider != null) {
oldSelectionProvider.removeSelectionChangedListener(getSelectionChangedListener());
if (oldSelectionProvider instanceof IPostSelectionProvider) {
((IPostSelectionProvider) oldSelectionProvider)
.removePostSelectionChangedListener(getPostSelectionChangedListener());
} else {
oldSelectionProvider.removeSelectionChangedListener(getPostSelectionChangedListener());
}
}
if (selectionProvider != null) {
selectionProvider.addSelectionChangedListener(getSelectionChangedListener());
if (selectionProvider instanceof IPostSelectionProvider) {
((IPostSelectionProvider) selectionProvider).addPostSelectionChangedListener(getPostSelectionChangedListener());
} else {
selectionProvider.addSelectionChangedListener(getPostSelectionChangedListener());
}
}
}
示例4: setSelectionProviderDelegate
import org.eclipse.jface.viewers.IPostSelectionProvider; //导入依赖的package包/类
/**
* Sets a new selection provider to delegate to. Selection listeners registered with the
* previous delegate are removed before.
*
* @param newDelegate
* new selection provider
*/
public void setSelectionProviderDelegate(ISelectionProvider newDelegate){
if (delegate == newDelegate) {
return;
}
if (delegate != null) {
delegate.removeSelectionChangedListener(selectionListener);
if (delegate instanceof IPostSelectionProvider) {
((IPostSelectionProvider) delegate)
.removePostSelectionChangedListener(postSelectionListener);
}
}
delegate = newDelegate;
if (newDelegate != null) {
newDelegate.addSelectionChangedListener(selectionListener);
if (newDelegate instanceof IPostSelectionProvider) {
((IPostSelectionProvider) newDelegate)
.addPostSelectionChangedListener(postSelectionListener);
}
fireSelectionChanged(newDelegate.getSelection());
firePostSelectionChanged(newDelegate.getSelection());
}
}
示例5: setSelectionProvider
import org.eclipse.jface.viewers.IPostSelectionProvider; //导入依赖的package包/类
/**
* Sets a new {@link ISelectionProvider} for this
* {@link SwitchingSelectionProvider}. Any {@link ISelectionChangedListener}
* s that are registered with this {@link SwitchingSelectionProvider} will
* receive {@link SelectionChangedEvent}s. The new
* {@link ISelectionProvider} may be <code>null</code>.
*
* @param selectionProvider
* a new {@link ISelectionProvider} to use (may be <code>null</code>)
*/
public void setSelectionProvider(final ISelectionProvider selectionProvider) {
synchronized (currentWrappedProviderLock) {
if (currentWrappedProvider != null) {
currentWrappedProvider.removeSelectionChangedListener(selectionChangedListener);
if (currentWrappedProvider instanceof IPostSelectionProvider) {
((IPostSelectionProvider) currentWrappedProvider).removePostSelectionChangedListener(
postSelectionChangedListener);
}
}
currentWrappedProvider = selectionProvider;
if (selectionProvider != null) {
selectionProvider.addSelectionChangedListener(selectionChangedListener);
if (selectionProvider instanceof IPostSelectionProvider) {
((IPostSelectionProvider) selectionProvider).addPostSelectionChangedListener(
postSelectionChangedListener);
}
}
final ISelection selection =
(selectionProvider != null ? selectionProvider.getSelection() : StructuredSelection.EMPTY);
selectionChangedListener.fireChildListeners(selection);
postSelectionChangedListener.fireChildListeners(selection);
}
}
示例6: disconnect
import org.eclipse.jface.viewers.IPostSelectionProvider; //导入依赖的package包/类
protected void disconnect() {
if(editor != null) {
if (editor.getSelectionProvider() instanceof IPostSelectionProvider) {
((IPostSelectionProvider) editor.getSelectionProvider()).removePostSelectionChangedListener(this);
}
editor.getSite().getPage().removePartListener(partListener);
editor = null;
document = null;
}
}
示例7: connect
import org.eclipse.jface.viewers.IPostSelectionProvider; //导入依赖的package包/类
private void connect() {
Assert.isNotNull(fCurrentTarget);
ITextViewer viewer = fCurrentTarget.getViewer();
Assert.isNotNull(viewer);
fCurrentTarget.fWidget = viewer.getTextWidget();
if (fCurrentTarget.fWidget == null)
leave(ILinkedModeListener.EXIT_ALL);
if (fCurrentTarget.fKeyListener == null) {
fCurrentTarget.fKeyListener = new KeyListener();
((ITextViewerExtension) viewer).prependVerifyKeyListener(fCurrentTarget.fKeyListener);
} else
fCurrentTarget.fKeyListener.setEnabled(true);
registerAutoEditVetoer(viewer);
((IPostSelectionProvider) viewer).addPostSelectionChangedListener(fSelectionListener);
createAnnotationModel();
showSelection();
fCurrentTarget.fShell = fCurrentTarget.fWidget.getShell();
if (fCurrentTarget.fShell == null)
leave(ILinkedModeListener.EXIT_ALL);
fCurrentTarget.fShell.addShellListener(fCloser);
fAssistant.install(viewer);
viewer.addTextInputListener(fCloser);
viewer.getDocument().addDocumentListener(fDocumentListener);
}
示例8: disconnect
import org.eclipse.jface.viewers.IPostSelectionProvider; //导入依赖的package包/类
private void disconnect() {
Assert.isNotNull(fCurrentTarget);
ITextViewer viewer = fCurrentTarget.getViewer();
Assert.isNotNull(viewer);
viewer.getDocument().removeDocumentListener(fDocumentListener);
fAssistant.uninstall();
fAssistant.removeProposalListener(fProposalListener);
fCurrentTarget.fWidget = null;
Shell shell = fCurrentTarget.fShell;
fCurrentTarget.fShell = null;
if (shell != null && !shell.isDisposed())
shell.removeShellListener(fCloser);
// this one is asymmetric: we don't install the model in
// connect, but leave it to its callers to ensure they
// have the model installed if they need it
uninstallAnnotationModel(fCurrentTarget);
unregisterAutoEditVetoer(viewer);
// don't remove the verify key listener to let it keep its position
// in the listener queue
if (fCurrentTarget.fKeyListener != null)
fCurrentTarget.fKeyListener.setEnabled(false);
((IPostSelectionProvider) viewer).removePostSelectionChangedListener(fSelectionListener);
redraw();
}
示例9: createPartControl
import org.eclipse.jface.viewers.IPostSelectionProvider; //导入依赖的package包/类
/**
* Create the part control.
*
* @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
public void createPartControl(Composite parent) {
super.createPartControl(parent);
// enable projection support (for code folder)
ProjectionViewer projectionViewer = (ProjectionViewer) getSourceViewer();
fProjectionSupport = new ProjectionSupport(projectionViewer,
getAnnotationAccess(), getSharedColors());
fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.error");
fProjectionSupport.addSummarizableAnnotationType("org.eclipse.ui.workbench.texteditor.warning");
fProjectionSupport.install();
if (TexlipsePlugin.getDefault().getPreferenceStore().getBoolean(TexlipseProperties.CODE_FOLDING)) {
projectionViewer.doOperation(ProjectionViewer.TOGGLE);
}
fAnnotationUpdater = new TexlipseAnnotationUpdater(this);
((IPostSelectionProvider) getSelectionProvider()).addPostSelectionChangedListener(
new ISelectionChangedListener(){
public void selectionChanged(SelectionChangedEvent event) {
//Delete all StatuslineErrors after selection changes
documentModel.removeStatusLineErrorMessage();
}
});
// register documentModel as documentListener
// in initializeEditor this would cause NPE
this.getDocumentProvider().getDocument(getEditorInput()).addDocumentListener(this.documentModel);
this.documentModel.initializeModel();
this.documentModel.updateNow();
ISourceViewer sourceViewer = getSourceViewer();
if (sourceViewer instanceof ITextViewerExtension) {
if (fBracketInserter == null)
fBracketInserter = new BracketInserter(getSourceViewer(), this);
((ITextViewerExtension) sourceViewer).prependVerifyKeyListener(fBracketInserter);
}
}
示例10: install
import org.eclipse.jface.viewers.IPostSelectionProvider; //导入依赖的package包/类
/**
* Installs this selection changed listener with the given selection
* provider. If the selection provider is a post selection provider,
* post selection changed events are the preferred choice, otherwise
* normal selection changed events are requested.
*
* @param selectionProvider
*/
public void install(ISelectionProvider selectionProvider) {
if (selectionProvider == null)
return;
if (selectionProvider instanceof IPostSelectionProvider) {
IPostSelectionProvider provider = (IPostSelectionProvider) selectionProvider;
provider.addPostSelectionChangedListener(this);
} else {
selectionProvider.addSelectionChangedListener(this);
}
}
示例11: uninstall
import org.eclipse.jface.viewers.IPostSelectionProvider; //导入依赖的package包/类
/**
* Removes this selection changed listener from the given selection
* provider.
*
* @param selectionProvider
* the selection provider
*/
public void uninstall(ISelectionProvider selectionProvider) {
if (selectionProvider == null)
return;
if (selectionProvider instanceof IPostSelectionProvider) {
IPostSelectionProvider provider = (IPostSelectionProvider) selectionProvider;
provider.removePostSelectionChangedListener(this);
} else {
selectionProvider.removeSelectionChangedListener(this);
}
}
示例12: activate
import org.eclipse.jface.viewers.IPostSelectionProvider; //导入依赖的package包/类
public void activate(OutlinePage outlinePage) {
this.outlinePage = outlinePage;
treeViewer = outlinePage.getTreeViewer();
treeListener = new TreeListener();
treeViewer.addPostSelectionChangedListener(treeListener);
treeViewer.addDoubleClickListener(treeListener);
textViewer = outlinePage.getSourceViewer();
textListener = new TextListener();
ISelectionProvider textSelectionProvider = textViewer.getSelectionProvider();
if (textSelectionProvider instanceof IPostSelectionProvider)
((IPostSelectionProvider) textSelectionProvider).addPostSelectionChangedListener(textListener);
else
textSelectionProvider.addSelectionChangedListener(textListener);
}
示例13: deactivate
import org.eclipse.jface.viewers.IPostSelectionProvider; //导入依赖的package包/类
public void deactivate() {
ISelectionProvider textSelectionProvider = textViewer.getSelectionProvider();
if (textSelectionProvider instanceof IPostSelectionProvider)
((IPostSelectionProvider) textSelectionProvider).removePostSelectionChangedListener(textListener);
else
textSelectionProvider.removeSelectionChangedListener(textListener);
textListener = null;
textViewer = null;
treeViewer.removePostSelectionChangedListener(treeListener);
treeViewer.removeDoubleClickListener(treeListener);
treeViewer = null;
treeListener = null;
outlinePage = null;
}
示例14: installSelectionChangedListener
import org.eclipse.jface.viewers.IPostSelectionProvider; //导入依赖的package包/类
private void installSelectionChangedListener() {
selectionChangedListener = new ISelectionChangedListener() {
public void selectionChanged(final SelectionChangedEvent event) {
updateStatusLine();
}
};
final ISelectionProvider selectionProvider = getSelectionProvider();
if (selectionProvider instanceof IPostSelectionProvider) {
final IPostSelectionProvider postSelectionProvider = (IPostSelectionProvider) selectionProvider;
postSelectionProvider.addPostSelectionChangedListener(selectionChangedListener);
} else {
getSelectionProvider().addSelectionChangedListener(selectionChangedListener);
}
}
示例15: uninstallSelectionChangedListener
import org.eclipse.jface.viewers.IPostSelectionProvider; //导入依赖的package包/类
private void uninstallSelectionChangedListener() {
ISelectionProvider selectionProvider = getSelectionProvider();
if (selectionProvider != null) {
if (selectionProvider instanceof IPostSelectionProvider) {
final IPostSelectionProvider postSelectionProvider = (IPostSelectionProvider) selectionProvider;
postSelectionProvider.removePostSelectionChangedListener(selectionChangedListener);
} else {
selectionProvider.removeSelectionChangedListener(selectionChangedListener);
}
}
}