com.intellij.notification.impl.NotificationsConfigurationImpl Java Examples

The following examples show how to use com.intellij.notification.impl.NotificationsConfigurationImpl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FindManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Inject
public FindManagerImpl(Project project, FindSettings findSettings, UsageViewManager anotherManager) {
  myProject = project;
  myBus = project.getMessageBus();
  findSettings.initModelBySetings(myFindInProjectModel);

  myFindInFileModel.setCaseSensitive(findSettings.isLocalCaseSensitive());
  myFindInFileModel.setWholeWordsOnly(findSettings.isLocalWholeWordsOnly());
  myFindInFileModel.setRegularExpressions(findSettings.isLocalRegularExpressions());

  myFindUsagesManager = new FindUsagesManager(myProject, anotherManager);
  myFindInProjectModel.setMultipleFiles(true);

  NotificationsConfigurationImpl.remove("FindInPath");
  Disposer.register(project, new Disposable() {
    @Override
    public void dispose() {
      if (myHelper != null) {
        Disposer.dispose(myHelper);
      }
    }
  });
}
 
Example #2
Source File: Notifications.java    From KodeBeagle with Apache License 2.0 6 votes vote down vote up
public final void save() {
    NotificationDisplayType notificationDisplayType = NotificationDisplayType.NONE;

    boolean shouldLog = false;
    propertiesComponent.setValue(RefreshActionBase.NOTIFICATION_CHECKBOX_VALUE,
            String.valueOf(this.getNotificationsCheckBoxValue()));
    propertiesComponent.setValue(RefreshActionBase.LOGGING_CHECKBOX_VALUE,
            String.valueOf(this.getLoggingCheckBoxValue()));

    if (this.getNotificationsCheckBoxValue()) {
        notificationDisplayType = NotificationDisplayType.BALLOON;
    }

    if (this.getLoggingCheckBoxValue()) {
        shouldLog = true;
    }

    NotificationsConfigurationImpl.getNotificationsConfiguration().changeSettings(
            MainWindowBase.KODEBEAGLE, notificationDisplayType, shouldLog, false);
}
 
Example #3
Source File: Notifications.java    From KodeBeagle with Apache License 2.0 5 votes vote down vote up
private void retrieve() {
    boolean isNotificationEnabled = false;
    if (NotificationsConfigurationImpl.getSettings(MainWindowBase.KODEBEAGLE).getDisplayType()
            != NotificationDisplayType.NONE) {
        isNotificationEnabled = true;
    }

    this.setNotificationsCheckBoxValue(isNotificationEnabled);
    this.setLoggingCheckBoxValue(NotificationsConfigurationImpl.getSettings(
            MainWindowBase.KODEBEAGLE).isShouldLog());
}
 
Example #4
Source File: NotificationsConfigurablePanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void apply() {
  if (myRemoved) {
    NotificationsConfigurationImpl.remove(getGroupId());
  }
  else {
    NotificationsConfigurationImpl.getInstanceImpl().changeSettings(myVersion);
  }
}
 
Example #5
Source File: SystemNotificationsImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void notify(@Nonnull String notificationName, @Nonnull String title, @Nonnull String text) {
  if (NotificationsConfigurationImpl.getInstanceImpl().SYSTEM_NOTIFICATIONS && !myApplication.isActive()) {
    Notifier notifier = myNotifier.getValue();
    if (notifier != null) {
      notifier.notify(notificationName, title, text);
    }
  }
}
 
Example #6
Source File: AppearanceOptionsTopHitProvider.java    From consulo with Apache License 2.0 5 votes vote down vote up
static BooleanOptionDescription notifications(String option, String field) {
  return new PublicFieldBasedOptionDescription(option, "reference.settings.ide.settings.notifications", field) {
    @Override
    public Object getInstance() {
      return NotificationsConfigurationImpl.getInstanceImpl();
    }
  };
}
 
Example #7
Source File: EventLog.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void printNotification(Notification notification) {
  if (!NotificationsConfigurationImpl.getSettings(notification.getGroupId()).isShouldLog()) {
    return;
  }
  myProjectModel.addNotification(notification);

  EventLogConsole console = getConsole(notification);
  if (console == null) {
    myInitial.add(notification);
  }
  else {
    doPrintNotification(notification, console);
  }
}
 
Example #8
Source File: EventLogConsole.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void addConfigureNotificationAction(@Nonnull DefaultActionGroup actions, @Nonnull String groupId) {
  DefaultActionGroup displayTypeGroup = new DefaultActionGroup("Notification Display Type", true);
  NotificationSettings settings = NotificationsConfigurationImpl.getSettings(groupId);
  NotificationDisplayType current = settings.getDisplayType();

  for (NotificationDisplayType type : NotificationDisplayType.values()) {
    if (type != NotificationDisplayType.TOOL_WINDOW || NotificationsConfigurationImpl.getInstanceImpl().hasToolWindowCapability(groupId)) {
      displayTypeGroup.add(new DisplayTypeAction(settings, type, current));
    }
  }

  actions.add(displayTypeGroup);
  actions.addSeparator();
}
 
Example #9
Source File: NotificationsConfigurablePanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void reset() {
  final List<SettingsWrapper> list = myTable.getAllSettings();
  for (SettingsWrapper settingsWrapper : list) {
    settingsWrapper.reset();
  }

  NotificationsConfigurationImpl configuration = NotificationsConfigurationImpl.getInstanceImpl();
  myDisplayBalloons.setSelected(configuration.SHOW_BALLOONS);
  mySystemNotifications.setSelected(configuration.SYSTEM_NOTIFICATIONS);

  myTable.invalidate();
  myTable.repaint();
}
 
Example #10
Source File: NotificationsConfigurablePanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public void apply() {
  final List<SettingsWrapper> list = myTable.getAllSettings();
  for (SettingsWrapper settingsWrapper : list) {
    settingsWrapper.apply();
  }

  NotificationsConfigurationImpl configuration = NotificationsConfigurationImpl.getInstanceImpl();
  configuration.SHOW_BALLOONS = myDisplayBalloons.isSelected();
  configuration.SYSTEM_NOTIFICATIONS = mySystemNotifications.isSelected();
}
 
Example #11
Source File: LogModel.java    From consulo with Apache License 2.0 5 votes vote down vote up
void addNotification(Notification notification) {
  long stamp = System.currentTimeMillis();
  NotificationDisplayType type = NotificationsConfigurationImpl.getSettings(notification.getGroupId()).getDisplayType();
  if (notification.isImportant() || (type != NotificationDisplayType.NONE && type != NotificationDisplayType.TOOL_WINDOW)) {
    synchronized (myNotifications) {
      myNotifications.add(notification);
    }
  }
  myStamps.put(notification, stamp);
  setStatusMessage(notification, stamp);
  fireModelChanged();
}
 
Example #12
Source File: NotificationsConfigurablePanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public boolean isModified() {
  final List<SettingsWrapper> list = myTable.getAllSettings();
  for (SettingsWrapper settingsWrapper : list) {
    if (settingsWrapper.hasChanged()) {
      return true;
    }
  }

  NotificationsConfigurationImpl configuration = NotificationsConfigurationImpl.getInstanceImpl();
  return configuration.SHOW_BALLOONS != myDisplayBalloons.isSelected() ||
         configuration.SYSTEM_NOTIFICATIONS != mySystemNotifications.isSelected();
}
 
Example #13
Source File: EventLogConsole.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void setSelected(AnActionEvent e, boolean state) {
  if (state) {
    NotificationsConfigurationImpl.getInstanceImpl().changeSettings(mySettings.withDisplayType(myType));
  }
}
 
Example #14
Source File: NotificationsConfigurablePanel.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
private NotificationSettings getOriginalSettings() {
  return NotificationsConfigurationImpl.getSettings(getGroupId());
}
 
Example #15
Source File: EventLogToolWindowFactory.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void setSelected(AnActionEvent e, boolean state) {
  NotificationsConfigurationImpl.getInstanceImpl().SHOW_BALLOONS = state;
}
 
Example #16
Source File: EventLogToolWindowFactory.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isSelected(AnActionEvent e) {
  return NotificationsConfigurationImpl.getInstanceImpl().SHOW_BALLOONS;
}
 
Example #17
Source File: ConsoleLogToolWindowFactory.java    From aem-ide-tooling-4-intellij with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isSelected(AnActionEvent e) {
    return NotificationsConfigurationImpl.getInstanceImpl().SHOW_BALLOONS;
}
 
Example #18
Source File: NotificationBalloonActionProvider.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public List<BalloonImpl.ActionButton> createActions() {
  myActions = new ArrayList<BalloonImpl.ActionButton>();

  if (!myLayoutData.showSettingButton || myDisplayGroupId == null ||
      !NotificationsConfigurationImpl.getInstanceImpl().isRegistered(myDisplayGroupId)) {
    mySettingButton = null;
  }
  else {
    mySettingButton = myBalloon.new ActionButton(
            AllIcons.Ide.Notification.Gear, AllIcons.Ide.Notification.GearHover,
            "Configure Notification", new Consumer<MouseEvent>() {
      @Override
      public void consume(MouseEvent event) {
        myBalloon.runWithSmartFadeoutPause(new Runnable() {
          @Override
          public void run() {
            final NotificationsConfigurable configurable = new NotificationsConfigurable();
            ShowSettingsUtil.getInstance().editConfigurable(myLayoutData.project, configurable, new Runnable() {
              @Override
              public void run() {
                //noinspection ConstantConditions
                configurable.enableSearch(myDisplayGroupId).run();
              }
            });
          }
        });
      }
    }) {
      @Override
      public void repaint() {
        super.repaint();
        if (myRepaintPanel != null) {
          myRepaintPanel.repaint();
        }
      }
    };
    myActions.add(mySettingButton);

    if (myRepaintPanel != null) {
      myLayoutData.showActions = new Computable<Boolean>() {
        @Override
        public Boolean compute() {
          for (BalloonImpl.ActionButton action : myActions) {
            if (!action.isShowing() || !action.hasPaint()) {
              return Boolean.FALSE;
            }
          }
          return Boolean.TRUE;
        }
      };
    }
  }

  myCloseButton = myBalloon.new ActionButton(
          AllIcons.Ide.Notification.Close, AllIcons.Ide.Notification.CloseHover,
          "Close Notification (Alt-Click close all notifications)", new Consumer<MouseEvent>() {
    @Override
    public void consume(MouseEvent event) {
      final int modifiers = event.getModifiers();
      //noinspection SSBasedInspection
      SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
          if ((modifiers & InputEvent.ALT_MASK) != 0) {
            myLayoutData.closeAll.run();
          }
          else {
            myBalloon.hide();
          }
        }
      });
    }
  }) {
    @Override
    protected void paintIcon(@Nonnull Graphics g, @Nonnull Icon icon) {
      icon.paintIcon(this, g, CloseHoverBounds.x, CloseHoverBounds.y);
    }
  };
  myActions.add(myCloseButton);

  return myActions;
}
 
Example #19
Source File: ConsoleLogToolWindowFactory.java    From aem-ide-tooling-4-intellij with Apache License 2.0 4 votes vote down vote up
@Override
public void setSelected(AnActionEvent e, boolean state) {
    NotificationsConfigurationImpl.getInstanceImpl().SHOW_BALLOONS = state;
}