Search in sources :

Example 36 with UISettings

use of com.intellij.ide.ui.UISettings in project intellij-community by JetBrains.

the class ActivateNavigationBarAction method update.

@Override
public void update(@NotNull AnActionEvent e) {
    final Project project = e.getProject();
    UISettings settings = UISettings.getInstance();
    final boolean enabled = project != null && settings.getShowNavigationBar() && !settings.getPresentationMode();
    e.getPresentation().setEnabled(enabled);
}
Also used : Project(com.intellij.openapi.project.Project) UISettings(com.intellij.ide.ui.UISettings)

Example 37 with UISettings

use of com.intellij.ide.ui.UISettings in project intellij-community by JetBrains.

the class StudyProjectComponent method projectOpened.

@Override
public void projectOpened() {
    Course course = StudyTaskManager.getInstance(myProject).getCourse();
    // Check if user has javafx lib in his JDK. Now bundled JDK doesn't have this lib inside.
    if (StudyUtils.hasJavaFx()) {
        Platform.setImplicitExit(false);
    }
    if (course != null && !course.isAdaptive() && !course.isUpToDate()) {
        final Notification notification = new Notification("Update.course", "Course Updates", "Course is ready to <a href=\"update\">update</a>", NotificationType.INFORMATION, new NotificationListener() {

            @Override
            public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
                FileEditorManagerEx.getInstanceEx(myProject).closeAllFiles();
                ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
                    ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true);
                    return execCancelable(() -> {
                        updateCourse();
                        return true;
                    });
                }, "Updating Course", true, myProject);
                EduUtils.synchronize();
                course.setUpdated();
            }
        });
        notification.notify(myProject);
    }
    StudyUtils.registerStudyToolWindow(course, myProject);
    StartupManager.getInstance(myProject).runWhenProjectIsInitialized(() -> ApplicationManager.getApplication().invokeLater((DumbAwareRunnable) () -> ApplicationManager.getApplication().runWriteAction((DumbAwareRunnable) () -> {
        Course course1 = StudyTaskManager.getInstance(myProject).getCourse();
        if (course1 != null) {
            UISettings instance = UISettings.getInstance();
            instance.setHideToolStripes(false);
            instance.fireUISettingsChanged();
            registerShortcuts();
            EduUsagesCollector.projectTypeOpened(course1.isAdaptive() ? EduNames.ADAPTIVE : EduNames.STUDY);
        }
    })));
    myBusConnection = ApplicationManager.getApplication().getMessageBus().connect();
    myBusConnection.subscribe(EditorColorsManager.TOPIC, new EditorColorsListener() {

        @Override
        public void globalSchemeChange(EditorColorsScheme scheme) {
            final StudyToolWindow toolWindow = StudyUtils.getStudyToolWindow(myProject);
            if (toolWindow != null) {
                toolWindow.updateFonts(myProject);
            }
        }
    });
}
Also used : EditorColorsListener(com.intellij.openapi.editor.colors.EditorColorsListener) HyperlinkEvent(javax.swing.event.HyperlinkEvent) UISettings(com.intellij.ide.ui.UISettings) EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme) StudyToolWindow(com.jetbrains.edu.learning.ui.StudyToolWindow) StudyProjectGenerator.flushCourse(com.jetbrains.edu.learning.courseGeneration.StudyProjectGenerator.flushCourse) Notification(com.intellij.notification.Notification) DumbAwareRunnable(com.intellij.openapi.project.DumbAwareRunnable) NotificationListener(com.intellij.notification.NotificationListener)

Example 38 with UISettings

use of com.intellij.ide.ui.UISettings in project android by JetBrains.

the class AndroidEditorTitleProviderTest method test.

public void test() {
    VirtualFile vFile = myFixture.copyFileToProject("R.java", "gen/p1/p2/R.java");
    PsiFile file = PsiManager.getInstance(getProject()).findFile(vFile);
    assertNotNull(file);
    checkTitle("AndroidManifest.xml", null);
    checkTitle("gen/p1/p2/R.java", null);
    checkTitle("res/wrong/path.xml", null);
    checkTitle("res/layout/file.xml", null);
    UISettings uiSettings = UISettings.getInstance();
    boolean prev = uiSettings.getHdeKnownExtensionInTabs();
    try {
        uiSettings.setHdeKnownExtensionInTabs(false);
        checkTitle("res/layout-land/file.xml", "land/file.xml");
        checkTitle("res/layout-xlarge/file.xml", "xlarge/file.xml");
        checkTitle("res/values-large-hdpi/strings.xml", "large-hdpi/strings.xml");
        uiSettings.setHdeKnownExtensionInTabs(true);
        checkTitle("res/layout-land/file.xml", "land/file");
        checkTitle("res/layout-xlarge/file.xml", "xlarge/file");
        checkTitle("res/values-large-hdpi/strings.xml", "large-hdpi/strings");
    } finally {
        // For later chained tests
        uiSettings.setHdeKnownExtensionInTabs(prev);
    }
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) UISettings(com.intellij.ide.ui.UISettings) PsiFile(com.intellij.psi.PsiFile)

Aggregations

UISettings (com.intellij.ide.ui.UISettings)38 EditorSettingsExternalizable (com.intellij.openapi.editor.ex.EditorSettingsExternalizable)8 Project (com.intellij.openapi.project.Project)4 CodeInsightSettings (com.intellij.codeInsight.CodeInsightSettings)3 RichCopySettings (com.intellij.openapi.editor.richcopy.settings.RichCopySettings)3 VcsApplicationSettings (com.intellij.openapi.vcs.VcsApplicationSettings)3 EditorColorsScheme (com.intellij.openapi.editor.colors.EditorColorsScheme)2 VirtualFile (com.intellij.openapi.vfs.VirtualFile)2 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 HyperlinkEvent (javax.swing.event.HyperlinkEvent)2 DaemonCodeAnalyzerSettings (com.intellij.codeInsight.daemon.DaemonCodeAnalyzerSettings)1 QuickDocOnMouseOverManager (com.intellij.codeInsight.documentation.QuickDocOnMouseOverManager)1 ColorBlindness (com.intellij.ide.ui.ColorBlindness)1 UISettingsListener (com.intellij.ide.ui.UISettingsListener)1 PropertiesComponent (com.intellij.ide.util.PropertiesComponent)1 Notification (com.intellij.notification.Notification)1 NotificationListener (com.intellij.notification.NotificationListener)1 Application (com.intellij.openapi.application.Application)1 ApplicationManager.getApplication (com.intellij.openapi.application.ApplicationManager.getApplication)1