Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] Run As Shortcuts For .C Files

I see.
There is also some kind of magic involved.
You need to define an adapter factory for everything that is considered
launchable.

In your case you need to declare objects of type ITranslationUnit as
launchable:

	<extension point="org.eclipse.core.runtime.adapters">
         <factory 
            class="" 
            adaptableType="org.eclipse.cdt.core.model.ITranslationUnit">
            <adapter type="org.eclipse.debug.ui.actions.ILaunchable"/>
         </factory>
      </extension> 

The adapter factory class can be empty, it is not used anyway.

HTH
Toni

> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx 
> [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Karol Krizka
> Sent: Monday, July 14, 2008 7:12 PM
> To: CDT General developers list.
> Subject: Re: [cdt-dev] Run As Shortcuts For .C Files
> 
> Thank you very much for your suggestion, but sadly it did not help. :(
> 
> On Monday 14 July 2008 01:11:47 Leherbauer, Anton wrote:
> > One difference between Project Explorer and Package Explorer is that
> > C/C++ files appear as different object types in the views:
> > - in Project Explorer, C/C++ files are of type ITranslationUnit
> > - in Package Explorer (and all other non C/C++ aware 
> views), they appear
> > as IResource objects.
> >
> > I guess you have defined your shortcut to work on IResources of
> > extension ".C".
> >
> No, I haven't. The only requirement I have is that only 1 
> item can be selected 
> at a time, you can see my extension hook at the end of this 
> email. I can see 
> my shortcut in almost every entry except source folders and 
> source files.
> 
> But this could explain why it is not working. Would it be 
> possible that the 
> CDT Project Explorer does not process the shortcuts for 
> ITranslationUnits?
> 
> --
> Cheers,
> Karol Krizka
> 
>       <shortcut
>             class="cmtplugin.launch.ROOTLaunchShortcut"
>             id="cmtplugin.launcher.shortcut.root"
>             label="ROOT"
>             modes="run, debug">
>          <configurationType
>                id="cmtplugin.launcher.root">
>          </configurationType>
>          <perspective
>                id="org.eclipse.cdt.ui.CPerspective">
>          </perspective>
>          <contextualLaunch>
>             <enablement>
>                <with
>                      variable="selection">
>                   <count
>                         value="1">
>                   </count>
>                </with>
>             </enablement>
>          </contextualLaunch>
>       </shortcut>
> 
> 
> > HTH
> > Toni
> >
> > > -----Original Message-----
> > > From: cdt-dev-bounces@xxxxxxxxxxx
> > > [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Karol Krizka
> > > Sent: Friday, July 11, 2008 10:22 PM
> > > To: CDT General developers list.
> > > Subject: [cdt-dev] Run As Shortcuts For .C Files
> > >
> > > Hi,
> > >
> > > I'm trying to add a "Run As" launch shortcute for a file 
> that ends in
> > > .C. The reason I am trying to do this is I am writing a 
> CDT plugin for
> > > a C Interpreter that takes in macros stored in files that 
> end in the
> > > extension .C.
> > >
> > > I tried to use the launchShortcut approach and I defined a new
> > > shortcut that becomes enabled when you select a .C file. 
> But when I
> > > right-click on such a file in "Project Exporer", I do not 
> see the Run
> > > As entry at all. Then when I try the same thing in the Java
> > > Perspective and the Package Explorer, everything works fain.
> > >
> > > Do you have any ideas about what could be wrong?
> > >
> > > --
> > > Cheers,
> > > Karol Krizka
> > > _______________________________________________
> > > cdt-dev mailing list
> > > cdt-dev@xxxxxxxxxxx
> > > https://dev.eclipse.org/mailman/listinfo/cdt-dev
> >
> > _______________________________________________
> > cdt-dev mailing list
> > cdt-dev@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/cdt-dev
> 
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
> 


Back to the top