org.eclipse.ui.ISelectionService#addPostSelectionListener ( )源码实例Demo

下面列出了org.eclipse.ui.ISelectionService#addPostSelectionListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: APICloud-Studio   文件: IndexView.java
/**
 * addListeners
 */
private void addListeners()
{
	// this.listenForScriptChanges();
	ISelectionService selectionService = getSite().getWorkbenchWindow().getSelectionService();

	// @formatter:off
	selectionService.addPostSelectionListener(
		IPageLayout.ID_PROJECT_EXPLORER,
		new ISelectionListener() {
			public void selectionChanged(IWorkbenchPart part, ISelection selection)
			{
				if (part != IndexView.this && selection instanceof IStructuredSelection)
				{
					setInputFromSelection(selection);
				}
			}
		}
	);
	// @formatter:on
}
 
源代码2 项目: slr-toolkit   文件: BibtexEntryWatcher.java
public BibtexEntryWatcher(ISelectionService selectionService) {
	this.selectionService = selectionService;
	this.selectionListener = new ISelectionListener() {
		@Override
		public void selectionChanged(IWorkbenchPart part, ISelection selection) {
			List<Document> documents = new LinkedList<Document>();

			if (selection instanceof IStructuredSelection)
				for (Object element : ((IStructuredSelection) selection).toList())
					if (element instanceof Document)
						documents.add((Document) element);

			final Document doc;
			if (documents.size() == 1)
				doc = documents.get(0);
			else
				doc = null;
			listeners.stream().forEach(it -> it.accept(doc));
		}
	};
	selectionService.addPostSelectionListener(selectionListener);
}
 
源代码3 项目: bonita-studio   文件: ValidationViewPart.java
@Override
public void createPartControl(final Composite parent) {
    final Composite mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayout(GridLayoutFactory.fillDefaults()
            .extendedMargins(5, 0, 3, 1).create());
    mainComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    createValidateButton(mainComposite);
    createTableComposite(mainComposite);

    final ISelectionService ss = getSite().getWorkbenchWindow()
            .getSelectionService();
    ss.addPostSelectionListener(this);
    if (getSite().getPage().getActiveEditor() != null) {
        selectionProvider = getSite().getPage().getActiveEditor()
                .getEditorSite().getSelectionProvider();
        getSite().setSelectionProvider(this);

    }

    final TableColumnSorter sorter = new TableColumnSorter(tableViewer);
    sorter.setColumn(severityColumn.getColumn());
}
 
源代码4 项目: bonita-studio   文件: MigrationStatusView.java
@Override
public void createPartControl(final Composite parent) {
    final Composite mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 5).create());

    createTopComposite(mainComposite);
    createTableComposite(mainComposite);
    createBottomComposite(mainComposite);

    final ISelectionService ss = getSite().getWorkbenchWindow().getSelectionService();
    ss.addPostSelectionListener(this);
    final IEditorPart activeEditor = getSite().getPage().getActiveEditor();
    if (activeEditor instanceof DiagramEditor) {
        selectionProvider = activeEditor.getEditorSite().getSelectionProvider();
    }
    getSite().setSelectionProvider(this);
    createActions();
}
 
源代码5 项目: dsl-devkit   文件: SpyViewPart.java
/**
 * Install selection listeners.
 */
private void installSelectionListeners() {
  ISelectionService service = getSite().getService(ISelectionService.class);
  service.addPostSelectionListener(selectionListener);
  selectionListener.addSelectionChangedListener(grammarView);
  selectionListener.addSelectionChangedListener(eClassTypeView);
  eClassTypeView.addPostSelectionChangedListener(eObjectOutline);
  selectionListener.addSelectionChangedListener(eObjectOutline);
}
 
源代码6 项目: CodeCheckerEclipsePlugin   文件: StartupJob.java
/**
 * The added listener will be a PostSelectionListener.
 * @param win The {@link IWorkbenchWindow} that gets listened.
 */
private void addListenerToWorkbenchWindow(IWorkbenchWindow win) {
    ISelectionService ss = win.getSelectionService();
    ss.addPostSelectionListener(IPageLayout.ID_PROJECT_EXPLORER, projectExplorerSelectionlistener);
    win.getActivePage().addPartListener(partListener);
}
 
源代码7 项目: lapse-plus   文件: LapseView.java
/**
 * Initializes this view
 */
public void init(IViewSite site) throws PartInitException {
	
	log("In init(...)");
	
	super.setSite(site);
	
	if (fSuperListener == null) {
		
		
		fSuperListener = new SuperListener(this);
		
		//showMessage("Registering the plugin");
		
		//To track if the plugin is selected
		ISelectionService service = site.getWorkbenchWindow().getSelectionService();
		
		//We add a listener to notify if the selection has changed
		service.addPostSelectionListener(fSuperListener);
		
		//A file that can be edited by more than one client
		FileBuffers.getTextFileBufferManager().addFileBufferListener(fSuperListener);
		
	}
	
	//We create the parser for the Abstract Syntax Tree
	fParser = ASTParser.newParser(AST.JLS3);//Java Language Specifitacion 3
	
	fParser.setResolveBindings(true);//The compiler have to provide binding information for the AST nodes
	
	//Backward slicer from sinks
	fSlicingJob = new SlicingJob("Backward data slicer");
	fSlicingFromSinkJob = new SlicingFromSinkJob("Backward slicer from a sink", this);
	
}