Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [recommenders-dev] [SnipMatch] How to insert selection MatchNode into current editor

Hi Cheng,

Basically the shell has a dispose listener attached to it that checks to see whether the shell was closed by canceling or by confirming. If the user canceled, any previewed code is removed. If confirmed, the snippet is reinserted in "final" mode (including helpers, etc.).

I can't fully remember why we do this in the dispose listener, but I trust that there was a good reason. Feel free to improve it!

Zi

On 29 March 2012 22:20, Chen Cheng <chengchendoc@xxxxxxxxx> wrote:
Hi Zi,

Thank you for your response, i am refactoring little by little.

I have found out the reason, i can use this code snip to insert selection snipcode, but then i use "shell.close()" to dispose current input text box etc, this operation will remote inserted code in editor. I have no idea why it happen. Why dispose a Shell object will affect code in current editor?

2012/3/30 Zi Ye <zi@xxxxxxx>
That seems to be the code from the DisposeListener of the SearchBox, and as far as I know, there aren't any other requirements.
Are you doing a rewrite, or are you refactoring little by little? I don't know what you've changed.

On 28 March 2012 22:56, Chen Cheng <chengchendoc@xxxxxxxxx> wrote:
Hi Doug & Zi,

We can just use these code to insert code snip of MatchNode instance into current editor, right ? 

try {
env.reset();
((JavaSnippetMatchEnvironment) env).applyMatch(matches.get(0), false, 300);
} catch (Exception e) {
e.printStackTrace();
}

Is there any prerequisite? I am refactoring search result display module for SnipMatch, and should use this method to insert current selection MatchNode into editor, but it seems does not work for me, i am reading and trying to find out the issue. But I think may be you guys can give me a hand

--
Best Regards From Cheng Chen [chengchendoc@xxxxxxxxx]

_______________________________________________
recommenders-dev mailing list
recommenders-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/recommenders-dev



_______________________________________________
recommenders-dev mailing list
recommenders-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/recommenders-dev




--
Best Regards From Cheng Chen [chengchendoc@xxxxxxxxx]

_______________________________________________
recommenders-dev mailing list
recommenders-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/recommenders-dev



Back to the top