Search in sources :

Example 6 with ProjectStructureConfigurable

use of com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable in project android by JetBrains.

the class AndroidCompileUtil method addSourceRoot.

@Nullable
public static SourceFolder addSourceRoot(final ModifiableRootModel model, @NotNull final VirtualFile root) {
    ContentEntry contentEntry = findContentEntryForRoot(model, root);
    if (contentEntry == null) {
        final Project project = model.getProject();
        final String message = "Cannot mark directory '" + FileUtil.toSystemDependentName(root.getPath()) + "' as source root, because it is not located under content root of module '" + model.getModule().getName() + "'\n<a href='fix'>Open Project Structure</a>";
        final Notification notification = new Notification(AndroidBundle.message("android.autogeneration.notification.group"), "Autogeneration Error", message, NotificationType.ERROR, new NotificationListener.Adapter() {

            @Override
            protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
                notification.expire();
                final ProjectStructureConfigurable configurable = ProjectStructureConfigurable.getInstance(project);
                ShowSettingsUtil.getInstance().editConfigurable(project, configurable, new Runnable() {

                    @Override
                    public void run() {
                        final Module module = model.getModule();
                        final AndroidFacet facet = AndroidFacet.getInstance(module);
                        if (facet != null) {
                            configurable.select(facet, true);
                        }
                    }
                });
            }
        });
        Notifications.Bus.notify(notification, project);
        LOG.debug(message);
        return null;
    } else {
        return contentEntry.addSourceFolder(root, JavaSourceRootType.SOURCE, JpsJavaExtensionService.getInstance().createSourceRootProperties("", true));
    }
}
Also used : Project(com.intellij.openapi.project.Project) HyperlinkEvent(javax.swing.event.HyperlinkEvent) Module(com.intellij.openapi.module.Module) Notification(com.intellij.notification.Notification) AndroidFacet(org.jetbrains.android.facet.AndroidFacet) NotificationListener(com.intellij.notification.NotificationListener) ProjectStructureConfigurable(com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable) Nullable(org.jetbrains.annotations.Nullable)

Example 7 with ProjectStructureConfigurable

use of com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable in project intellij-plugins by JetBrains.

the class AddAsSwcLibDialog method openProjectStructure.

private void openProjectStructure(final Module module, final FlexBuildConfiguration bc) {
    ApplicationManager.getApplication().invokeLater(() -> {
        final ProjectStructureConfigurable configurable = ProjectStructureConfigurable.getInstance(myProject);
        ShowSettingsUtil.getInstance().editConfigurable(myProject, configurable, () -> {
            final Place place = FlexBuildConfigurationsExtension.getInstance().getConfigurator().getPlaceFor(module, bc.getName()).putPath(CompositeConfigurable.TAB_NAME, DependenciesConfigurable.TAB_NAME);
            configurable.navigateTo(place, true);
        });
    });
}
Also used : Place(com.intellij.ui.navigation.Place) ProjectStructureConfigurable(com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable)

Example 8 with ProjectStructureConfigurable

use of com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable in project intellij-plugins by JetBrains.

the class FlashProjectStructureErrorsDialog method openProjectStructure.

private void openProjectStructure() {
    final TreePath selectionPath = myTree.getSelectionPath();
    DefaultMutableTreeNode node = selectionPath == null ? null : (DefaultMutableTreeNode) selectionPath.getLastPathComponent();
    Object userObject = node == null ? null : node.getUserObject();
    if (userObject == null)
        return;
    final Ref<Module> moduleRef = new Ref<>();
    final Ref<FlexBuildConfiguration> bcRef = new Ref<>();
    final Ref<FlashProjectStructureProblem> problemRef = new Ref<>();
    if (userObject instanceof FlashProjectStructureProblem) {
        problemRef.set((FlashProjectStructureProblem) userObject);
        node = (DefaultMutableTreeNode) node.getParent();
        userObject = node.getUserObject();
    }
    if (userObject instanceof FlexBuildConfiguration) {
        bcRef.set((FlexBuildConfiguration) userObject);
        node = (DefaultMutableTreeNode) node.getParent();
        userObject = node.getUserObject();
    }
    if (userObject instanceof Module) {
        moduleRef.set((Module) userObject);
    }
    close(CANCEL_EXIT_CODE);
    final ProjectStructureConfigurable configurable = ProjectStructureConfigurable.getInstance(myProject);
    ShowSettingsUtil.getInstance().editConfigurable(myProject, configurable, () -> {
        final Place place;
        if (problemRef.get() instanceof FlashProjectStructureProblem.FlexUnitOutputFolderProblem) {
            place = new Place().putPath(ProjectStructureConfigurable.CATEGORY, configurable.getProjectConfig());
        } else if (moduleRef.isNull()) {
            place = new Place().putPath(ProjectStructureConfigurable.CATEGORY, configurable.getModulesConfig());
        } else if (bcRef.isNull()) {
            place = new Place().putPath(ProjectStructureConfigurable.CATEGORY, configurable.getModulesConfig()).putPath(MasterDetailsComponent.TREE_OBJECT, moduleRef.get());
        } else {
            place = FlexBuildConfigurationsExtension.getInstance().getConfigurator().getPlaceFor(moduleRef.get(), bcRef.get().getName());
            if (!problemRef.isNull()) {
                place.putPath(CompositeConfigurable.TAB_NAME, problemRef.get().tabName);
                place.putPath(FlexBCConfigurable.LOCATION_ON_TAB, problemRef.get().locationOnTab);
            }
        }
        configurable.navigateTo(place, true);
    });
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) ProjectStructureConfigurable(com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable) Ref(com.intellij.openapi.util.Ref) TreePath(javax.swing.tree.TreePath) Module(com.intellij.openapi.module.Module) Place(com.intellij.ui.navigation.Place)

Example 9 with ProjectStructureConfigurable

use of com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable in project intellij-plugins by JetBrains.

the class DeclareConditionalCompilerDefinitionFix method applyFix.

protected void applyFix(final Project project, final PsiElement psiElement, final PsiFile file, final Editor editor) {
    final ProjectStructureConfigurable configurable = ProjectStructureConfigurable.getInstance(project);
    ShowSettingsUtil.getInstance().editConfigurable(project, configurable, () -> {
        final FlexBuildConfiguration bc = FlexBuildConfigurationManager.getInstance(myModule).getActiveConfiguration();
        final Place place = FlexBuildConfigurationsExtension.getInstance().getConfigurator().getPlaceFor(myModule, bc.getName()).putPath(CompositeConfigurable.TAB_NAME, CompilerOptionsConfigurable.TAB_NAME).putPath(FlexBCConfigurable.LOCATION_ON_TAB, CompilerOptionsConfigurable.Location.ConditionalCompilerDefinition).putPath(CompilerOptionsConfigurable.CONDITIONAL_COMPILER_DEFINITION_NAME, myConditionalCompilerDefinitionName);
        configurable.navigateTo(place, true);
    });
}
Also used : FlexBuildConfiguration(com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration) Place(com.intellij.ui.navigation.Place) ProjectStructureConfigurable(com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable)

Example 10 with ProjectStructureConfigurable

use of com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable in project intellij-plugins by JetBrains.

the class FlexBaseRunner method showBCCompilationSkippedWarning.

private static void showBCCompilationSkippedWarning(final Module module, final FlexBuildConfiguration bc) {
    final String message = FlexBundle.message("run.when.ide.builder.turned.off", bc.getName(), module.getName());
    COMPILE_BEFORE_LAUNCH_NOTIFICATION_GROUP.createNotification("", message, NotificationType.WARNING, new NotificationListener() {

        @Override
        public void hyperlinkUpdate(@NotNull final Notification notification, @NotNull final HyperlinkEvent event) {
            if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                notification.expire();
                if ("BuildConfiguration".equals(event.getDescription())) {
                    final ProjectStructureConfigurable projectStructureConfigurable = ProjectStructureConfigurable.getInstance(module.getProject());
                    ShowSettingsUtil.getInstance().editConfigurable(module.getProject(), projectStructureConfigurable, () -> {
                        Place p = FlexBuildConfigurationsExtension.getInstance().getConfigurator().getPlaceFor(module, bc.getName());
                        projectStructureConfigurable.navigateTo(p, true);
                    });
                } else if ("DisableWarning".equals(event.getDescription())) {
                    disableCompilationSkippedWarning(module.getProject());
                }
            }
        }
    }).notify(module.getProject());
}
Also used : HyperlinkEvent(javax.swing.event.HyperlinkEvent) NotNull(org.jetbrains.annotations.NotNull) Place(com.intellij.ui.navigation.Place) ProjectStructureConfigurable(com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable)

Aggregations

ProjectStructureConfigurable (com.intellij.openapi.roots.ui.configuration.ProjectStructureConfigurable)10 Module (com.intellij.openapi.module.Module)4 Place (com.intellij.ui.navigation.Place)4 FlexBuildConfiguration (com.intellij.lang.javascript.flex.projectStructure.model.FlexBuildConfiguration)2 ConfigurationException (com.intellij.openapi.options.ConfigurationException)2 Project (com.intellij.openapi.project.Project)2 HyperlinkEvent (javax.swing.event.HyperlinkEvent)2 Nullable (org.jetbrains.annotations.Nullable)2 FlexBCConfigurable (com.intellij.lang.javascript.flex.projectStructure.ui.FlexBCConfigurable)1 Notification (com.intellij.notification.Notification)1 NotificationListener (com.intellij.notification.NotificationListener)1 Sdk (com.intellij.openapi.projectRoots.Sdk)1 StructureConfigurableContext (com.intellij.openapi.roots.ui.configuration.projectRoot.StructureConfigurableContext)1 Ref (com.intellij.openapi.util.Ref)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1 TreePath (javax.swing.tree.TreePath)1 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)1 NotNull (org.jetbrains.annotations.NotNull)1