[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] Programatically getting settings from the current project
|
>
> Hello folks,
> =20
> I want to write an external tool which will transfer the output of a =
> selected managed make project to the target machine. So I need to find =
> out
> =20
> - which project is currently selected in the C/C++ projects navigator
If it is specific to the C/C++ project navigator you can get the Viewer
which is an ISelectionProvider, see the docs on ISelectionProvider and Viewer classes.
But you may want to be a little more general:
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
IWorkbenchPage page = window.getActivePage();
if (page != null) {
IWorkbenchPart activePart = page.getActivePart();
if (activePart instanceof IEditorPart) {
IEditorInput input = ((IEditorPart)activePart).getEditorInput();
// TODO:extract project from the input IFile.
} else if (activePart != null) {
IWorkbenchPartSite site = activePart.getSite();
if (site != null) {
ISelectionProvider selectionProvider = site.getSelectionProvider();
if (selectionProvider != null) {
ISelection selection = selectionProvider.getSelection();
if (selection instanceof IStructuredSelection) {
List list = ((IStructuredSelection)selection).toList();
// TODO: Go through the object an extract the Project.
}
}
}
}
}
}
Browse the Eclipse API and documentation, this is not really a specific CDT task.
> - which configuration of this project is currently activated and
Browse the org.eclipse.cdt.managedbuilder.core plugin, you will probably find what you are
looking for. However as a policy, do not use classes in *internal* package name.
See Eclipse coding conventions.
> - what the name of output artifact is.=20
> =20
> Can you give me any hints on how to gather this information?
> =20
> Regards,
> =20