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));
}
}
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);
});
});
}
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);
});
}
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);
});
}
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());
}
Aggregations