Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Getting the Parent View of a control.
Getting the Parent View of a control. [message #1759783] Tue, 18 April 2017 13:24
Naveen Sabapathy is currently offline Naveen SabapathyFriend
Messages: 46
Registered: July 2016
I would like to get the control of a Part. i.e. I have created a View and that view contains a Combo Widget and a Contol.

            <control class="com.test.rac.actions.V4BPCColumnControlContribution"

I would like to get the control from my view class.

else, I would like to get the view from the control class.
package com.test.rac.actions;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.menus.WorkbenchWindowControlContribution;

import com.test.rac.V4BPCMessages;
import com.test.rac.V4BPCPtiNatView;
import com.test.rac.V4BPCPtiTableViewer;
import com.test.rac.util.V4BPCGeneralUtils;

public class V4BPCColumnControlContribution extends WorkbenchWindowControlContribution {

	private static Combo columnCombo = null;
	protected Control createControl(Composite paramComposite) {
		Composite viewPanel = new Composite(paramComposite, SWT.LEFT_TO_RIGHT);
		GridLayout viewPanelLayout = new GridLayout(2,false);
		viewPanelLayout.marginBottom = 1;
		viewPanelLayout.marginTop = 1;
		viewPanelLayout.marginHeight = 0;
		return viewPanel;

	 * Adds the components to the View Panel.
	 * @param viewPanel
	private void addComponents(Composite viewPanel) {
		Label label = new Label(viewPanel,SWT.CENTER);
		columnCombo=new Combo(viewPanel, SWT.READ_ONLY | SWT.DROP_DOWN );
		GridData gd = new GridData();
		// Naveen 24.01.2017
		// #160 - Prevent changing of cell values in cell editor when using the mouse wheel


	private V4BPCPtiTableViewer getTableViewer(){
		IWorkbenchPart part = getWorkbenchWindow().getActivePage().getActivePart();
		if(part!=null && part instanceof V4BPCPtiNatView) {
			return ((V4BPCPtiNatView)part).getTableViewer();
		return null;

If I'm tring to get the part using "IWorkbenchPart part = getWorkbenchWindow().getActivePage().getActivePart();" I'm getting the source part, Not the newly created part. Whats the method to get the parent part of any control?
Previous Topic:neon nightmare
Next Topic:Add custom wizards to new menu in eclipse plugin
Goto Forum:

Current Time: Sat Jan 28 10:42:59 GMT 2023

Powered by FUDForum. Page generated in 0.03179 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top