Search in sources :

Example 1 with ExternalSystemConfigurableAware

use of com.intellij.openapi.externalSystem.ExternalSystemConfigurableAware in project intellij-community by JetBrains.

the class OpenExternalSystemSettingsCallback method hyperlinkActivated.

@Override
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
    ExternalSystemManager<?, ?, ?, ?, ?> manager;
    if (myLinkedProjectPath == null || !((manager = ExternalSystemApiUtil.getManager(mySystemId)) instanceof ExternalSystemConfigurableAware)) {
        ShowSettingsUtil.getInstance().showSettingsDialog(myProject, mySystemId.getReadableName());
        return;
    }
    final Configurable configurable = ((ExternalSystemConfigurableAware) manager).getConfigurable(myProject);
    if (configurable instanceof AbstractExternalSystemConfigurable) {
        ShowSettingsUtil.getInstance().editConfigurable(myProject, configurable, () -> ((AbstractExternalSystemConfigurable) configurable).selectProject(myLinkedProjectPath));
    }
}
Also used : AbstractExternalSystemConfigurable(com.intellij.openapi.externalSystem.service.settings.AbstractExternalSystemConfigurable) ExternalSystemConfigurableAware(com.intellij.openapi.externalSystem.ExternalSystemConfigurableAware) Configurable(com.intellij.openapi.options.Configurable) AbstractExternalSystemConfigurable(com.intellij.openapi.externalSystem.service.settings.AbstractExternalSystemConfigurable)

Example 2 with ExternalSystemConfigurableAware

use of com.intellij.openapi.externalSystem.ExternalSystemConfigurableAware in project intellij-community by JetBrains.

the class ExternalSystemNotificationManager method processExternalProjectRefreshError.

public void processExternalProjectRefreshError(@NotNull Throwable error, @NotNull String externalProjectName, @NotNull ProjectSystemId externalSystemId) {
    if (myProject.isDisposed() || !myProject.isOpen()) {
        return;
    }
    ExternalSystemManager<?, ?, ?, ?, ?> manager = ExternalSystemApiUtil.getManager(externalSystemId);
    if (!(manager instanceof ExternalSystemConfigurableAware)) {
        return;
    }
    String title = ExternalSystemBundle.message("notification.project.refresh.fail.title", externalSystemId.getReadableName(), externalProjectName);
    String message = ExternalSystemApiUtil.buildErrorMessage(error);
    NotificationCategory notificationCategory = NotificationCategory.ERROR;
    String filePath = null;
    Integer line = null;
    Integer column = null;
    //noinspection ThrowableResultOfMethodCallIgnored
    Throwable unwrapped = RemoteUtil.unwrap(error);
    if (unwrapped instanceof LocationAwareExternalSystemException) {
        LocationAwareExternalSystemException locationAwareExternalSystemException = (LocationAwareExternalSystemException) unwrapped;
        filePath = locationAwareExternalSystemException.getFilePath();
        line = locationAwareExternalSystemException.getLine();
        column = locationAwareExternalSystemException.getColumn();
    }
    NotificationData notificationData = new NotificationData(title, message, notificationCategory, NotificationSource.PROJECT_SYNC, filePath, ObjectUtils.notNull(line, -1), ObjectUtils.notNull(column, -1), false);
    for (ExternalSystemNotificationExtension extension : ExternalSystemNotificationExtension.EP_NAME.getExtensions()) {
        final ProjectSystemId targetExternalSystemId = extension.getTargetExternalSystemId();
        if (!externalSystemId.equals(targetExternalSystemId) && !targetExternalSystemId.equals(ProjectSystemId.IDE)) {
            continue;
        }
        extension.customize(notificationData, myProject, error);
    }
    EditorNotifications.getInstance(myProject).updateAllNotifications();
    showNotification(externalSystemId, notificationData);
}
Also used : ExternalSystemConfigurableAware(com.intellij.openapi.externalSystem.ExternalSystemConfigurableAware) LocationAwareExternalSystemException(com.intellij.openapi.externalSystem.model.LocationAwareExternalSystemException) ProjectSystemId(com.intellij.openapi.externalSystem.model.ProjectSystemId)

Aggregations

ExternalSystemConfigurableAware (com.intellij.openapi.externalSystem.ExternalSystemConfigurableAware)2 LocationAwareExternalSystemException (com.intellij.openapi.externalSystem.model.LocationAwareExternalSystemException)1 ProjectSystemId (com.intellij.openapi.externalSystem.model.ProjectSystemId)1 AbstractExternalSystemConfigurable (com.intellij.openapi.externalSystem.service.settings.AbstractExternalSystemConfigurable)1 Configurable (com.intellij.openapi.options.Configurable)1