/dropbox-focus-intellij-plugin

IntelliJ/Android Studio plugin that integrates Dropbox Focus gradle plugin directly in the IDE.

Primary LanguageKotlinMIT LicenseMIT

Dropbox Focus IntelliJ Plugin

Build Version Downloads

Source code Screenshots

This IntelliJ and Android Studio Plugin provide tooling for Gradle Plugin Focus by Dropbox. The reason is to make it easy to switch focus and preventing open a big project without giving you the option to only select the module that you want to work on.

  • When plugin detect that the project that is being open was Focus plugin, it will prompt a Dialog to Select if you want to select a Module to Focus, Clear current Focus or just leave as it is.
  • Focus on a Module by right-clicking on a Module folder and selecting "Focus on Module"
  • Clearing current focus by right-clicking on root project folder

How the Plugin works by Steps:

  • Resolve the Focus Plugin configuration from your project by reading your settings.gradle[.kts] and looking for a plugins { id("com.dropbox.focus") } declaration.
  • Resolve Focus Gradle plugin configuration if there is one by reading focus {}(Groovy) or configure<com.dropbox.focus.FocusExtension> {}(Kotlin DSL), and it will read properties allSettingsFileName and focusFileName, if it does not have one of the property or even the configuration block, it will use the default configurations values of the Focus Gradle plugin.
  • Resolve all the modules names and directories from allSettingsFileName.
  • Resolve if there is currently a Focus available by reading focusFileName if exists.

Resolution limitations: All the gradle files resolution requires to be to use Literal Strings inside expected blocks. Do not create a variable and pass to it, for example:

plugins {
  val focusPlugin = "com.dropbox.focus"
  id(focusPlugin) version "0.4.0"
}

Here is a working example:

Groovy:

plugins {
  id("com.dropbox.focus") version "0.4.0"
}

focus {
  allSettingsFileName = "settings-all.gradle.kts"
  focusFileName = ".focus"
}

Kotlin:

plugins {
  id("com.dropbox.focus") version "0.4.0"
}

configure<com.dropbox.focus.FocusExtension> {
  allSettingsFileName.set("settings-all.gradle.kts")
  focusFileName.set(".focus")
}

Screenshots

TODO v1

  • Focus tool window listing all possible focus modules
  • Support project dir change on allSettingsFileName, ex: project(":sample:moved").projectDir = file("sample/lib-moved"). Currently, by not supporting this, we can't properly show the Focus on Module on Module that did change their projectDir.
  • Support Gradle Sync also on Android Studio Canary version.
  • Disable Dialog on startup with a checkbox, persist per project.
  • Focus project settings
  • Cache Current Focus Settings and update it by listening to Gradle Syncs

Future Ideas

  • Focus Project View
  • Favorites focus, a way for easily show Focus Modules on top that you most work on.

Building

Just run the gradle task in terminal: ./gradlew buildPlugin. The plugin will be available in /build/distributions/

Installation

  • Using IDE built-in plugin system:

    Settings/Preferences > Plugins > Marketplace > Search for "Dropbox Focus" > Install Plugin

  • Manually:

    Download the latest release or build your self and install it manually using Settings/Preferences > Plugins > ⚙️ > Install plugin from disk...


Plugin based on the IntelliJ Platform Plugin Template.