Skip to content

Comments

Introduce TerminalViewId instead of nullable id and secondaryId#2030

Merged
laeubi merged 1 commit intoeclipse-platform:masterfrom
ruspl-afed:terminal_view_id
Jul 13, 2025
Merged

Introduce TerminalViewId instead of nullable id and secondaryId#2030
laeubi merged 1 commit intoeclipse-platform:masterfrom
ruspl-afed:terminal_view_id

Conversation

@ruspl-afed
Copy link
Contributor

@ruspl-afed ruspl-afed commented Jul 11, 2025

Currently there is a pair of arguments in a number of signatures String id, String secondaryId each of which may be null.

Instead of this pair a new type introduced that also handles the logic of calculation for the next secondary id.

As a result the client code may be simplified to look like this: UIPlugin.getConsoleManager().showConsoleView(new TerminalViewId().next());

@ruspl-afed
Copy link
Contributor Author

@laeubi this is what I would like to suggest as further step for our discussion

@github-actions
Copy link
Contributor

github-actions bot commented Jul 11, 2025

Test Results

 1 947 files  ±0   1 947 suites  ±0   1h 26m 16s ⏱️ - 2m 41s
 4 718 tests ±0   4 694 ✅ ±0   24 💤 ±0  0 ❌ ±0 
14 154 runs  ±0  13 987 ✅ ±0  167 💤 ±0  0 ❌ ±0 

Results for commit bebe6a5. ± Comparison against base commit 15b942c.

♻️ This comment has been updated with latest results.

Comment on lines 66 to 51
public TerminalViewId next() {
return new TerminalViewId(primary, nextSecondaryId());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All call-sites of next() seem to perform new TerminalId().next() so it this really suitable here as an instance method and should not be more a static method like

Suggested change
public TerminalViewId next() {
return new TerminalViewId(primary, nextSecondaryId());
}
public static TerminalViewId create() {
return new TerminalViewId(IUIConstants.ID, nextSecondaryId(IUConstants.ID));
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not so sure regarding this.
We allow to specify primary id for some reason, perhaps we expect terminal view with another view id to use this API (may be similar with what we have for "Problem" view family).

* @see IUIConstants#ID
* @see IViewReference#getSecondaryId()
*/
public final class TerminalViewId {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we probably make this a record class?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we don't want to use record for API types. But ok, I did.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HannesWell @akurtakov do we have any such agreement for platform?

@ruspl-afed
Copy link
Contributor Author

Thank you for your review @laeubi
All your comments were considered, the only point to discuss is "what is the purpose of using different primary terminal view id"

@laeubi
Copy link
Contributor

laeubi commented Jul 12, 2025

Sadly infrastructure is still down :-
But Github looks good already.

@jonahgraham any thoughts about having different primary view IDs?

@laeubi
Copy link
Contributor

laeubi commented Jul 13, 2025

Currently there is a pair of arguments in a number of signatures `String
id, String secondaryId` each of which may be `null`.

Instead of this pair a new type introduced that also handles the logic
of calculation for the next secondary id.

As a result the client code much be simplified to look like this:
`UIPlugin.getConsoleManager().showConsoleView(new
TerminalViewId().next());`
@ruspl-afed
Copy link
Contributor Author

@ruspl-afed there are three javadoc issues to be fixed:

@laeubi everything is green now, I suggest to merge this PR and then create others if needed

@laeubi laeubi merged commit 66abeec into eclipse-platform:master Jul 13, 2025
18 checks passed
@ruspl-afed ruspl-afed deleted the terminal_view_id branch July 13, 2025 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants