Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine the context value of the nodes in the project explorer #311

Merged
merged 6 commits into from
Aug 31, 2020

Conversation

jdneo
Copy link
Member

@jdneo jdneo commented Aug 24, 2020

This PR is to better expose the node context value.

Context Value Format

java:<node type>[+<attribute>]*

Available Node Types:

Currently, available node types are:

  • workspaceFolder
  • project
  • container
  • packageRoot
  • package
  • jar

Not available node types are:

  • folder
  • file
  • type (class, enum, interface,...)

Below picture illustrates the different node types
image

Attributes:

For each node type, it may have some attributes. Every attribute will start with a +.

Common Attributes:

  • +uri: The node has uri

Specific Attributes:

Project Node:

  • +java: Java project
  • +maven: Maven project
  • +gradle: Gradle project

Container Node:

  • +jre: Container for JRE
  • +maven: Container for Maven
  • +gradle: Container for Gradle
  • +referencedLibrary: Container for Referenced Libraries

Package Root Node:

  • +source: Source package root.
  • +resource: Resource package root

Package Node:

  • +source: Source package
  • +binary: Binary package (Expanded inside a binary jar)

Jar Node:

  • +referencedLibrary: Referenced Library jar

Usage example:

For example, A node for a Maven project may have the following context value:

java:project+maven+uri

If you want to register a command on that node, you can write your when clause as:

"when": "view == javaProjectExplorer && viewItem =~ /java:project(?=.*?\\b\\+maven\\b)(?=.*?\\b\\+uri\\b)/",

@jdneo jdneo added this to the 0.13.0 milestone Aug 24, 2020
testforstephen
testforstephen previously approved these changes Aug 24, 2020
Eskibear
Eskibear previously approved these changes Aug 24, 2020
@jdneo jdneo dismissed stale reviews from Eskibear and testforstephen via 8055b68 August 27, 2020 01:59
@jdneo jdneo merged commit 1409594 into master Aug 31, 2020
@jdneo jdneo deleted the cs/contextValue branch August 31, 2020 02:00
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.

3 participants