Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Curious about the make target

> 
> Hello,
> 
> Trying to add new make target to the "Make Target" view part, and refresh
> the MakeView view, I wrote the following lines:
> 
> 	/*
> 	 * Add it
> 	 */
> 	
> MakeUtil.removePersistentTarget(getCProject().getProject(),"MyNewTarget");
> // Remove in case it already exists
> 	
> MakeUtil.addPersistentTarget(getCProject().getProject(),"MyNewTarget"); //
> Add it
> 
> 	/*
> 	 * Refresh the MakeView
> 	 */
> 	IWorkbenchPage
> page=CUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getAct
> ivePage();
> 	IViewPart makeView=page.findView("org.eclipse.cdt.ui.MakeView");
> 	if((makeView!=null)&&(makeView instanceof MakeView))
> 	{
> 		MakeView v=(MakeView)makeView;
> 		v.viewer.refresh();  // Which works only if the tree viewer
> of the MakeView is public (which is not).
> 	}
> 
> Any better way to do this ?
> If not, wouldn't it be an idea to provide a public method in the MakeView
> allowing to create/remove target (refreshing the view), or simply to set the
> TreeViewer with a public access ?

Better to have accessory methods, since I expect the makeview to evolve
depending on the builder.  Accessory methods will isolate you, for example,
if the view is no longer a Tree but move to be a table or something.

Send me a patch or the methods you would like to add.



Back to the top