Search in sources :

Example 61 with PropertiesComponent

use of com.intellij.ide.util.PropertiesComponent in project flutter-intellij by flutter.

the class FlutterInitializer method setCanReportAnalytics.

public static void setCanReportAnalytics(boolean canReportAnalytics) {
    if (getCanReportAnalytics() != canReportAnalytics) {
        final boolean wasReporting = getCanReportAnalytics();
        final PropertiesComponent properties = PropertiesComponent.getInstance();
        properties.setValue(analyticsOptOutKey, !canReportAnalytics);
        if (analytics != null) {
            analytics.setCanSend(getCanReportAnalytics());
        }
        if (!wasReporting && canReportAnalytics) {
            getAnalytics().sendScreenView("main");
        }
    }
}
Also used : PropertiesComponent(com.intellij.ide.util.PropertiesComponent)

Example 62 with PropertiesComponent

use of com.intellij.ide.util.PropertiesComponent in project flutter-intellij by flutter.

the class FlutterUtils method disableGradleProjectMigrationNotification.

public static void disableGradleProjectMigrationNotification(@NotNull Project project) {
    final String showMigrateToGradlePopup = "show.migrate.to.gradle.popup";
    final PropertiesComponent properties = PropertiesComponent.getInstance(project);
    if (properties.getValue(showMigrateToGradlePopup) == null) {
        properties.setValue(showMigrateToGradlePopup, "false");
    }
}
Also used : PropertiesComponent(com.intellij.ide.util.PropertiesComponent)

Example 63 with PropertiesComponent

use of com.intellij.ide.util.PropertiesComponent in project flutter-intellij by flutter.

the class FlutterRunNotifications method checkForDisplayFirstReload.

private void checkForDisplayFirstReload() {
    final PropertiesComponent properties = PropertiesComponent.getInstance(myProject);
    final boolean alreadyRun = properties.getBoolean(RELOAD_ALREADY_RUN);
    if (!alreadyRun) {
        properties.setValue(RELOAD_ALREADY_RUN, true);
        final Notification notification = new Notification(FlutterMessages.FLUTTER_NOTIFICATION_GOUP_ID, FlutterBundle.message("flutter.reload.firstRun.title"), FlutterBundle.message("flutter.reload.firstRun.content"), NotificationType.INFORMATION);
        notification.setIcon(FlutterIcons.HotReload);
        notification.addAction(new AnAction("Learn more") {

            @Override
            public void actionPerformed(AnActionEvent event) {
                BrowserUtil.browse(FlutterBundle.message("flutter.reload.firstRun.url"));
                notification.expire();
            }
        });
        Notifications.Bus.notify(notification);
    }
}
Also used : AnActionEvent(com.intellij.openapi.actionSystem.AnActionEvent) PropertiesComponent(com.intellij.ide.util.PropertiesComponent) AnAction(com.intellij.openapi.actionSystem.AnAction)

Example 64 with PropertiesComponent

use of com.intellij.ide.util.PropertiesComponent in project flutter-intellij by flutter.

the class FlutterSettings method sendSettingsToAnalytics.

public void sendSettingsToAnalytics(Analytics analytics) {
    final PropertiesComponent properties = getPropertiesComponent();
    // Send data on the number of experimental features enabled by users.
    analytics.sendEvent("settings", "ping");
    if (isEnablePreviewDart2()) {
        analytics.sendEvent("settings", "enableDart2");
    } else if (isDisablePreviewDart2()) {
        analytics.sendEvent("settings", "disableDart2");
    }
    if (isReloadOnSave()) {
        analytics.sendEvent("settings", afterLastPeriod(reloadOnSaveKey));
    }
    if (isFormatCodeOnSave()) {
        analytics.sendEvent("settings", afterLastPeriod(formatCodeOnSaveKey));
        if (isOrganizeImportsOnSaveKey()) {
            analytics.sendEvent("settings", afterLastPeriod(organizeImportsOnSaveKey));
        }
    }
    if (isOpenInspectorOnAppLaunch()) {
        analytics.sendEvent("settings", afterLastPeriod(openInspectorOnAppLaunchKey));
    }
    if (isShowOnlyWidgets()) {
        analytics.sendEvent("settings", afterLastPeriod(showOnlyWidgetsKey));
    }
    if (isShowPreviewArea()) {
        analytics.sendEvent("settings", afterLastPeriod(showPreviewAreaKey));
    }
    if (isShowHeapDisplay()) {
        analytics.sendEvent("settings", afterLastPeriod(showHeapDisplayKey));
    }
}
Also used : PropertiesComponent(com.intellij.ide.util.PropertiesComponent)

Example 65 with PropertiesComponent

use of com.intellij.ide.util.PropertiesComponent in project liferay-ide by liferay.

the class LiferayProjectTemplateList method restoreSelection.

public void restoreSelection() {
    PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
    String templateName = propertiesComponent.getValue(_PROJECT_WIZARD_TEMPLATE);
    if ((templateName != null) && (_templateList.getModel() instanceof CollectionListModel)) {
        List<ProjectTemplate> list = ((CollectionListModel<ProjectTemplate>) _templateList.getModel()).toList();
        ProjectTemplate template = ContainerUtil.find(list, template1 -> templateName.equals(template1.getName()));
        if (template != null) {
            _templateList.setSelectedValue(template, true);
        }
    }
    ListSelectionModel listSelectionModel = _templateList.getSelectionModel();
    listSelectionModel.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(ListSelectionEvent event) {
            ProjectTemplate template = getSelectedTemplate();
            if (template != null) {
                PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
                propertiesComponent.setValue(_PROJECT_WIZARD_TEMPLATE, template.getName());
            }
        }
    });
}
Also used : ListSelectionEvent(javax.swing.event.ListSelectionEvent) ListSelectionModel(javax.swing.ListSelectionModel) CollectionListModel(com.intellij.ui.CollectionListModel) PropertiesComponent(com.intellij.ide.util.PropertiesComponent) ProjectTemplate(com.intellij.platform.ProjectTemplate) ArchivedProjectTemplate(com.intellij.platform.templates.ArchivedProjectTemplate) ListSelectionListener(javax.swing.event.ListSelectionListener)

Aggregations

PropertiesComponent (com.intellij.ide.util.PropertiesComponent)71 File (java.io.File)9 NotNull (org.jetbrains.annotations.NotNull)8 VirtualFile (com.intellij.openapi.vfs.VirtualFile)7 Project (com.intellij.openapi.project.Project)6 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 IdeaPluginDescriptor (com.intellij.ide.plugins.IdeaPluginDescriptor)3 CommitStepException (com.intellij.ide.wizard.CommitStepException)3 Notification (com.intellij.notification.Notification)3 NotificationListener (com.intellij.notification.NotificationListener)3 JDOMException (org.jdom.JDOMException)3 Nullable (org.jetbrains.annotations.Nullable)3 SdkPaths.validateAndroidSdk (com.android.tools.idea.sdk.SdkPaths.validateAndroidSdk)2 Module (com.intellij.openapi.module.Module)2 ProjectTemplate (com.intellij.platform.ProjectTemplate)2 CollectionListModel (com.intellij.ui.CollectionListModel)2 THashMap (gnu.trove.THashMap)2 TIntArrayList (gnu.trove.TIntArrayList)2 Analytics (io.flutter.analytics.Analytics)2