View unanswered posts | View active topics


Reply to topic  [ 10 posts ] 
ASClassWizard question or feature request 
Author Message
Member

Joined: Sat Nov 15, 2008 4:00 am
Posts: 171
Post ASClassWizard question or feature request
Hi. I'm trying to create few classes one by one in chain.
Is there any way to know when ASClassWizard complete creation new class and choosed class package, class name, super class ... etc?
Thanks.


Tue Feb 28, 2012 3:57 pm
Profile
Online
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 10736
Location: Paris, France
Post Re: ASClassWizard question or feature request
You should look into its PluginMain.cs code...


Tue Feb 28, 2012 4:16 pm
Profile WWW
Member

Joined: Sat Nov 15, 2008 4:00 am
Posts: 171
Post Re: ASClassWizard question or feature request
Yes. Now I'm catch the EventType.FileSwitch, but maybe there are more clear way to catch creation complete with lastFileOptions data in event args?


Tue Feb 28, 2012 4:46 pm
Profile
Online
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 10736
Location: Paris, France
Post Re: ASClassWizard question or feature request
If this information isn't public/dispatched then suggest a patch that we'll integrate.


Tue Feb 28, 2012 8:53 pm
Profile WWW
Member

Joined: Sat Nov 15, 2008 4:00 am
Posts: 171
Post Re: ASClassWizard question or feature request
Ok. Maybe addition features not needed for me, seems that all working fine.

But another problem:

on EventType.FileSwitch I'm trying to generate nesessary imports in this way

Code:
ClassModel activeClass = ASContext.Context.CurrentModel.GetPublicClass();
ASGenerator.GenerateJob(GeneratorJobType.AddImport, viewClass, activeClass, null, null);

ClassModel viewClass - is a class created before

and import generates in wrong place - before class package (in first line of my newly created class)
what I'm doing wrong? :roll:


Wed Feb 29, 2012 12:19 am
Profile
Online
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 10736
Location: Paris, France
Post Re: ASClassWizard question or feature request
Hum, I'm not sure the generator is totally safe to use like that...

But maybe the problem is that you modify the file during the FileSwitch event before the code completion was updated.
Try setting your event handler priority to Low for checking FileSwitch - it's an option of EventManager.AddEventHandler() in your PluginMain.cs.


Wed Feb 29, 2012 10:46 pm
Profile WWW
Member

Joined: Sat Nov 15, 2008 4:00 am
Posts: 171
Post Re: ASClassWizard question or feature request
No. with LOW prioity the same wrong result
I got this
Code:
import com.plumber.view.NewViewComponent;
package com.plumber.view.mediators
{
   import org.robotlegs.mvcs.Mediator;
...


but should be this

Code:
package com.plumber.view.mediators
{
   import com.plumber.view.NewViewComponent;
   import org.robotlegs.mvcs.Mediator;
...


Is there any other "official" way to generate import?
Maybe event for codecompletion/generator is ready to use or model is fully updated for current file?

I'm know that I can get imports members, get the line of last/first import and insert my import as string in that position :)
That sould work, but its not so friendly solution.

And another questions, where and how I can store perprojects plugin settings?


Wed Feb 29, 2012 11:51 pm
Profile
Online
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 10736
Location: Paris, France
Post Re: ASClassWizard question or feature request
Well then either you try debugging the problem or insert the import "manually". Or provide your plugin code so I can debug it.

For project storage, it's not exposed in the IProject (that's a mistake I guess) so you must reference Project Manager plugin, cast the IProject to Project and then you have:
- project.Storage (Dictionary<string, string>) : store key/value data
- project.Save() : persist your changes (or they are not guaranteed to be saved)


Thu Mar 01, 2012 8:15 am
Profile WWW
Member

Joined: Sat Nov 15, 2008 4:00 am
Posts: 171
Post Re: ASClassWizard question or feature request
Thanks for help, Philippe.

About imports, ASGenerator work well if active document has a focus.
So after file switch event I just set carret positon inside document and ASGenerator generates imports in correct place. :)

Another portion of questions:
1. How to know if user canceled Class creation (closed ASClassWizard) ?
2. Is a Class Model conatin comments (in similar way as regions) ?
3. What means EventType.FileTemplate event and when it dispatched?


Thu Mar 01, 2012 9:25 pm
Profile
Online
Admin

Joined: Wed Aug 31, 2005 7:27 am
Posts: 10736
Location: Paris, France
Post Re: ASClassWizard question or feature request
I can't quite answer about cancellation and messages.
I suggest you inspect all the messages happening during a class creation / cancellation.


Fri Mar 02, 2012 11:05 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 10 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.