Skip to content

Migrate io.flutter.font.ProjectOpenListener to backgroundPostStartupActivity #7873

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

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions flutter-idea/src/io/flutter/font/FontPreviewStartupActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright 2024 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/

package io.flutter.font

import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.startup.ProjectActivity

/**
* This class functionality was previous provided by ProjectOpenListener.java, as part of
* https://github.com/flutter/flutter-intellij/issues/6953, the functionality was moved over
* as a ProjectActivity and backgroundPostStartupActivity extension.
*/
class FontPreviewStartupActivity : ProjectActivity {
override suspend fun execute(project: Project) {
// Ensure this isn't part of testing
if (ApplicationManager.getApplication().isUnitTestMode) {
return
}
FontPreviewProcessor.analyze(project)
}
}
31 changes: 0 additions & 31 deletions flutter-idea/src/io/flutter/font/ProjectOpenListener.java

This file was deleted.

9 changes: 4 additions & 5 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,6 @@

</actions>

<applicationListeners>
<listener class="io.flutter.font.ProjectOpenListener"
topic="com.intellij.openapi.project.ProjectManagerListener"/>
</applicationListeners>

<extensionPoints>
<extensionPoint name="gradleSyncProvider" interface="io.flutter.android.GradleSyncProvider"/>
<extensionPoint name="colorPickerProvider" interface="io.flutter.editor.ColorPickerProvider"/>
Expand All @@ -330,6 +325,10 @@
serviceImplementation="io.flutter.bazel.WorkspaceCache"/>
<projectService serviceImplementation="io.flutter.pub.PubRootCache"/>

<backgroundPostStartupActivity id="FontPreviewStartupActivity"
implementation="io.flutter.font.FontPreviewStartupActivity"
order="last"/>

<configurationType implementation="io.flutter.run.FlutterRunConfigurationType"/>
<runConfigurationProducer implementation="io.flutter.run.FlutterRunConfigurationProducer"/>
<programRunner implementation="io.flutter.run.FlutterRunner"/>
Expand Down
9 changes: 4 additions & 5 deletions resources/META-INF/plugin_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,6 @@

</actions>

<applicationListeners>
<listener class="io.flutter.font.ProjectOpenListener"
topic="com.intellij.openapi.project.ProjectManagerListener"/>
</applicationListeners>

<extensionPoints>
<extensionPoint name="gradleSyncProvider" interface="io.flutter.android.GradleSyncProvider"/>
<extensionPoint name="colorPickerProvider" interface="io.flutter.editor.ColorPickerProvider"/>
Expand All @@ -267,6 +262,10 @@
serviceImplementation="io.flutter.bazel.WorkspaceCache"/>
<projectService serviceImplementation="io.flutter.pub.PubRootCache"/>

<backgroundPostStartupActivity id="FontPreviewStartupActivity"
implementation="io.flutter.font.FontPreviewStartupActivity"
order="last"/>

<configurationType implementation="io.flutter.run.FlutterRunConfigurationType"/>
<runConfigurationProducer implementation="io.flutter.run.FlutterRunConfigurationProducer"/>
<programRunner implementation="io.flutter.run.FlutterRunner"/>
Expand Down
Loading