Skip to content

Commit

Permalink
reduce usage of ApplicationComponent.disposeComponent (to dispose in …
Browse files Browse the repository at this point in the history
…a correct order (as Disposer))
  • Loading branch information
develar committed Jan 11, 2017
1 parent e5ad040 commit ef1d654
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 24 deletions.
Expand Up @@ -15,8 +15,9 @@
*/
package jetbrains.communicator.idea.monitor;

import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.components.ApplicationComponentAdapter;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.project.ProjectManagerAdapter;
Expand All @@ -26,12 +27,10 @@
import jetbrains.communicator.core.users.PresenceMode;
import jetbrains.communicator.core.users.UserPresence;
import org.apache.log4j.Logger;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;

import java.awt.*;
import java.awt.event.AWTEventListener;
import java.awt.event.KeyEvent;

/**
* @author Kir
Expand All @@ -40,7 +39,7 @@
*
* @see Transport#setOwnPresence(UserPresence)
*/
public class UserActivityMonitor implements ApplicationComponent, Runnable {
public class UserActivityMonitor implements ApplicationComponentAdapter, Disposable, Runnable {
private static final Logger LOG = Logger.getLogger(UserActivityMonitor.class);

private static final int REFRESH_INTERVAL = 60 * 1000;
Expand All @@ -58,13 +57,6 @@ public UserActivityMonitor(ProjectManager projectManager) {
myProjectManager = projectManager;
}

@Override
@NotNull
@NonNls
public String getComponentName() {
return "UserActivityMonitor";
}

@Override
public void initComponent() {
if (ApplicationManager.getApplication().isUnitTestMode()) return;
Expand Down Expand Up @@ -98,7 +90,7 @@ public void projectOpened(Project project) {
}

@Override
public void disposeComponent() {
public void dispose() {
myStop = true;
try {
while (!myThreadDisposed) {
Expand Down
Expand Up @@ -15,7 +15,7 @@

package com.intellij.struts2;

import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.components.ApplicationComponentAdapter;
import com.intellij.openapi.paths.PathReference;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiClass;
Expand All @@ -34,14 +34,8 @@
*
* @author Yann Cébron
*/
public class StrutsApplicationComponent implements ApplicationComponent {

@NonNls
@NotNull
public String getComponentName() {
return "Struts2ApplicationComponent";
}

public class StrutsApplicationComponent implements ApplicationComponentAdapter {
@Override
public void initComponent() {
// TODO remove, this should not be needed --> DOM unique name highlighting not working
ElementPresentationManager.registerNameProvider((NullableFunction<Object, String>)o -> {
Expand All @@ -55,9 +49,6 @@ public void initComponent() {
registerDocumentationProviders();
}

public void disposeComponent() {
}

private static void registerDocumentationProviders() {
ElementPresentationManager.registerDocumentationProvider((NullableFunction<Object, String>)o -> {
if (o instanceof Action) {
Expand Down

0 comments on commit ef1d654

Please sign in to comment.