[forge-issues] [JBoss JIRA] (FORGE-2671) UIContext - Allow to open a file on a specific element / line number

George Gastaldi (JIRA) issues at jboss.org
Thu Aug 18 12:25:00 EDT 2016


    [ https://issues.jboss.org/browse/FORGE-2671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13281009#comment-13281009 ] 

George Gastaldi commented on FORGE-2671:
----------------------------------------

[~davsclaus],

MethodSource implements {{org.jboss.forge.roaster.model.source.LocationCapable}} that has the information needed. I think it would be something like (haven't fully tested): 

{code:java}
MethodSource method = ...;
uiContext.setSelection(Selections.from(
               (r) -> UIRegionBuilder.create(r)
                        .startPosition(method.getStartPosition())
                        .endPosition(method.getEndPosition())
                        .startLine(method.getLineNumber())
                        .endLine(method.getLineNumber()),
               Arrays.asList(javaResource)));
{code}

> UIContext - Allow to open a file on a specific element / line number
> --------------------------------------------------------------------
>
>                 Key: FORGE-2671
>                 URL: https://issues.jboss.org/browse/FORGE-2671
>             Project: Forge
>          Issue Type: Feature Request
>          Components: UI - API
>    Affects Versions: 3.2.3.Final
>            Reporter: Claus Ibsen
>            Assignee: George Gastaldi
>             Fix For: 3.3.0.Final
>
>
> [12:19:40]  <davsclaus>	gastaldi thanks for the open file - it works nicely
> [12:19:41]  <davsclaus>	https://github.com/fabric8io/fabric8-forge/blob/49efd47241fbe1805d5fc42184be1a9ec63512d3/addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/CamelNewCamelContextXmlCommand.java#L194
> [12:19:56]  <davsclaus>	one thing I would like to be able to do is to position the cursor on a specific element / line
> [12:20:02]  <davsclaus>	currently the cursor is open on line 1
> [12:20:12]  <davsclaus>	eg typically in a license header in the file etc
> [12:20:32]  <@gastaldi>	Ah
> [12:20:32]  <davsclaus>	i would like to set the cursor to a newly created class / method / field etc
> [12:20:45]  <davsclaus>	or in a .properties file / plain file - to say line 35 etc
> [12:21:00]  <@gastaldi>	Hm I think that's doable. Can you @issue it?



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the forge-issues mailing list