Note that there are some explanatory texts on larger screens.

plurals
  1. POEclipse Plugin Development---PopupMenuCreation
    primarykey
    data
    text
    <p>I am developing a wizard using eclipse plugin development.</p> <p>Requirement:</p> <p>I have to create a context menu that needs to get populated as soon as the user right clicks on the source folder in java project. once the User performs the first step my handler needs to get the selected src folder in my wizard. My wizard contains a treeviewer where i need to get the selected src folder packaged.</p> <p>My analysis:</p> <p>i have my handler class that gets the selected packages</p> <p>SampleHandler.java</p> <pre class="lang-java prettyprint-override"><code>public Object execute(ExecutionEvent event) throws ExecutionException { shell = HandlerUtil.getActiveShell(event); // Initializing workbench window object IWorkbenchWindow window = (IWorkbenchWindow) HandlerUtil.getActiveWorkbenchWindow(event); ISelection sel = HandlerUtil.getActiveMenuSelection(event); final IStructuredSelection selection = (IStructuredSelection) sel; Object firstElement = selection.getFirstElement(); if (firstElement instanceof IPackageFragment) { // Get the selected fragment IPackageFragment packageFragment = (IPackageFragment) firstElement; modelPackage = packageFragment.getElementName(); boolean a =!ProjectResourceHelper.isEntityBasePackage(modelPackage); if(a == true){ MessageDialog.openInformation(shell, "Warning", "Please click from entity base package"); Shell shell = HandlerUtil.getActiveShell(event); GreenWizard wizard = new GreenWizard(); WizardDialog dialog = new WizardDialog( part.getSite().getShell(), wizard); dialog.create(); dialog.open(); return null; } try{ window.run(true, true, new IRunnableWithProgress(){ @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { monitor.beginTask("Layer codes are being generated...", 1); // Invocation of generate layers method monitor.worked(1); // Done with operation completion. monitor.done(); } }); } catch(InvocationTargetException ite){ MessageDialog.openError(shell, "Greenfield Code Generation Exception", ite.getMessage()); } catch (InterruptedException ie) { MessageDialog.openError(shell, "Greenfield Code Generation Exception", ie.getMessage()); } } </code></pre> <p>I have my main wizard class that is called within this method.</p> <p><code>GreenWizard wizard = new GreenWizard();</code></p> <p>and my main wizard in return calls my wizard page where i need to get the selection performed on right click by the user.</p> <p>My Wizardpageclass</p> <pre class="lang-java prettyprint-override"><code>public GenerateGreenfieldLayer(IWorkbench workbench, IStructuredSelection selection) { super("Greenfield"); setImageDescriptor(ResourceManager .getImageDescriptor("\\icons\\greenfield-new-wiz.png")); setTitle("GreenField Generate layer"); setDescription("Select specfic class to grenerate Layers"); } /** * Create contents of the wizard. * * @param parent */ @Override public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); setControl(container); container.setLayout(new GridLayout(2, false)); final CheckboxTreeViewer treeViewer = new CheckboxTreeViewer(container, SWT.BORDER); tree = treeViewer.getTree(); tree.setToolTipText("Choose package"); GridData gd_tree = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); gd_tree.widthHint = 280; gd_tree.heightHint = 140; tree.setLayoutData(gd_tree); treeViewer.setContentProvider(new GreenfieldTreeContentProvider()); treeViewer.setLabelProvider(new WorkbenchLabelProvider()); treeViewer.addSelectionChangedListener(new ISelectionChangedListener () { public void selectionChanged(SelectionChangedEvent event) { } }); } </code></pre> <p>Can anyone please guide me how to get the selection from object method and pass as treeviewer initial input in my wizard page.</p> <p>Please correct me if i am missing any steps as i am very new to this.</p> <p>Thanks in advance</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload