SelectionListener / SelectionProvider Problem

krazun

Bekanntes Mitglied
Tag zusammen,

ich habe in meinem Eclipse RCP Programm 2 Views. In einer View ist ein CommonViewer und in der anderen View möchte ich auf die ausgewählten Objekte des CommonViewer zugreifen. Wenn ich wie in folgendem Beispiel, alles in einer View mache funktioniert es wunderbar.

Java:
	@Override
	public void createPartControl(Composite parent) {
		super.createPartControl(parent);	
		
		CommonViewer viewer = getCommonViewer();
		getSite().setSelectionProvider(viewer);
		getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(this);
		
	}

	@Override
	public void selectionChanged(IWorkbenchPart part, ISelection selection) {
		System.out.println(selection);
	}
}

Wenn aber eine andere View ISelectionListener implementiert und sich mit getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(this); als Listener anmeldet, kommen keine Events mehr an.

Hat jemand eine Idee woran dies liegen könnte?

mfg,
krazun
 

dzim

Top Contributor
Hi,

ich hab den Spaß auch schon hinter mir.
Ich hab das auch so gemacht, dass ich im Editor, der das forwarden soll den Provider in createPartControl() angemeldet habe
Code:
getSite().setSelectionProvider(selectionProvider);
und im View den Listener in init() registriert habe.
Code:
getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(selectionListener);

Überprüfe, an welchen Stellen du den Provider und den Listener registriert hast. Das ist mein einziger Tipp den ich dir auf die schnelle geben kann.

Daniel
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
C TableViewer im Dialog / SelectionListener??? Plattformprogrammierung 3
T SelectionProvider ohne Viewer? Plattformprogrammierung 3
dzim RCP SelectionProvider-Listener Plattformprogrammierung 11
K Problem bei Einbinden einer DLL in Java-Projekt Plattformprogrammierung 4
Wurstsemmel RCP SWT-Problem: Programm sucht Cocoa-Bibliothek unter Windows Plattformprogrammierung 6
Shams Antbuild - Problem bei OSGi Anfängertutorial Plattformprogrammierung 0
D Problem mit eclipse Plattformprogrammierung 2
J JNA Implimentierungs Problem Plattformprogrammierung 0
Shams Problem bei der Knopflerfischinstallation Plattformprogrammierung 2
J Charset-Problem nach Plugin-Export Plattformprogrammierung 1
TheWhiteShadow RCP Problem mit Plugin Interaktion Plattformprogrammierung 6
D Eclipse_Visual Editor Problem Plattformprogrammierung 2
J Eclipse Plug-In für UML-Diagramme Problem Plattformprogrammierung 4
O Eclipse Plugin - Einfachstes Problem, das es gibt. Plattformprogrammierung 2
dzim OSGi Problem beim Verwenden von Declaratice Services Plattformprogrammierung 18
T netbeans problem? Plattformprogrammierung 4
dzim RCP Problem mit MenuManager Plattformprogrammierung 3
H RCP Problem mit Extension Schema Plattformprogrammierung 10
R JFace Databinding Problem Plattformprogrammierung 5
F Ecilpse plugin und MWE Workflow: classpath Problem Plattformprogrammierung 12
W Wahrscheinlich triviales Problem, aber komm nicht weiter Plattformprogrammierung 7
M Xpand Anfäger Problem Plattformprogrammierung 3
K Eclipse RCP, EMF, Hibernate Problem Plattformprogrammierung 7
dzim RCP Problem mit Umsetzen des Workspace unter Win Plattformprogrammierung 4
B PreferencesService Problem Plattformprogrammierung 2
K EMF/Teneo EMap Problem Plattformprogrammierung 6
K Problem mit EMF/Teneo, GregorianCalendar, Date, Hibernate Timestamp Plattformprogrammierung 6
L RCP TreeViewer Listener Problem Plattformprogrammierung 12
C target platform problem Plattformprogrammierung 2
K NoClassDefFoundError Problem Plattformprogrammierung 24
F Eclipse: Plug-In mit Ecoding Problem Plattformprogrammierung 7
O Problem mit relativen Pfaden in einem RCP-Plugin Plattformprogrammierung 5
dzim Problem beim neuanlegen von Composites Plattformprogrammierung 4
hdi Problem bei Eclipse Plugin Export Plattformprogrammierung 9
K Bild Problem in exportierter RCP Anwendung Plattformprogrammierung 5
M Problem beim Zugriff auf Klasse aus Fragment in einem anderen Plugin Plattformprogrammierung 3
D Problem mit Synth Painter und OSGi (Equinox) Plattformprogrammierung 8
G plugin.xml Problem Plattformprogrammierung 4
I SWT Popup-Menu Problem (Position) Plattformprogrammierung 4

Ähnliche Java Themen

Neue Themen


Oben