本文整理汇总了Java中com.intellij.openapi.project.ProjectManagerListener类的典型用法代码示例。如果您正苦于以下问题:Java ProjectManagerListener类的具体用法?Java ProjectManagerListener怎么用?Java ProjectManagerListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProjectManagerListener类属于com.intellij.openapi.project包,在下文中一共展示了ProjectManagerListener类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initComponent
import com.intellij.openapi.project.ProjectManagerListener; //导入依赖的package包/类
@Override
public void initComponent() {
MessageBus bus = ApplicationManager.getApplication().getMessageBus();
connection = bus.connect();
ProjectManager.getInstance().addProjectManagerListener(new ProjectManagerListener() {
@Override
public void projectOpened(Project project) {
Config config = Config.getInstance(project);
if(config == null) {
return;
}
if(!config.isConfigFilled()) {
Notifications.Bus.notify(
new Notification("Settings Error", "Gherkin TS Runner", "Settings have to be filled.", NotificationType.WARNING)
);
return;
}
connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new GherkinFileEditorManagerListener(project));
}
});
}
示例2: canClose
import com.intellij.openapi.project.ProjectManagerListener; //导入依赖的package包/类
@Override
public boolean canClose(Project project) {
if (LOG.isDebugEnabled()) {
LOG.debug("enter: canClose()");
}
for (ProjectManagerListener listener : myListeners) {
try {
if (!listener.canCloseProject(project)) return false;
}
catch (Throwable e) {
LOG.warn(e); // DO NOT LET ANY PLUGIN to prevent closing due to exception
}
}
return true;
}
示例3: AppEngineRuntimeInstance
import com.intellij.openapi.project.ProjectManagerListener; //导入依赖的package包/类
AppEngineRuntimeInstance() {
createdDeployments = ArrayListMultimap.create();
projectClosingListener =
new ProjectManagerListener() {
@Override
public void projectClosing(Project project) {
disconnect();
}
};
}
示例4: replaceStatusBar
import com.intellij.openapi.project.ProjectManagerListener; //导入依赖的package包/类
private void replaceStatusBar() {
final MessageBusConnection connect = ApplicationManager.getApplication().getMessageBus().connect();
// On app init, set the statusbar borders
connect.subscribe(ProjectManager.TOPIC, new ProjectManagerListener() {
@Override
public void projectOpened(@Nullable final Project projectFromCommandLine) {
MTThemeManager.getInstance().setStatusBarBorders();
}
});
// And also on config change
connect.subscribe(ConfigNotifier.CONFIG_TOPIC, mtConfig -> MTThemeManager.getInstance().setStatusBarBorders());
}
示例5: fireProjectClosing
import com.intellij.openapi.project.ProjectManagerListener; //导入依赖的package包/类
private void fireProjectClosing(Project project) {
if (LOG.isDebugEnabled()) {
LOG.debug("enter: fireProjectClosing()");
}
for (ProjectManagerListener listener : myListeners) {
try {
listener.projectClosing(project);
}
catch (Exception e) {
LOG.error(e);
}
}
}
示例6: addProjectManagerListener
import com.intellij.openapi.project.ProjectManagerListener; //导入依赖的package包/类
@Override
public void addProjectManagerListener(@NotNull final ProjectManagerListener listener, @NotNull Disposable parentDisposable) {
addProjectManagerListener(listener);
Disposer.register(parentDisposable, new Disposable() {
@Override
public void dispose() {
removeProjectManagerListener(listener);
}
});
}
示例7: removeProjectManagerListener
import com.intellij.openapi.project.ProjectManagerListener; //导入依赖的package包/类
@Override
public void removeProjectManagerListener(@NotNull Project project, @NotNull ProjectManagerListener listener) {
List<ProjectManagerListener> listeners = project.getUserData(LISTENERS_IN_PROJECT_KEY);
LOG.assertTrue(listeners != null);
boolean removed = listeners.remove(listener);
LOG.assertTrue(removed);
}
示例8: fireProjectOpened
import com.intellij.openapi.project.ProjectManagerListener; //导入依赖的package包/类
private void fireProjectOpened(Project project) {
if (LOG.isDebugEnabled()) {
LOG.debug("projectOpened");
}
for (ProjectManagerListener listener : myListeners) {
try {
listener.projectOpened(project);
}
catch (Exception e) {
LOG.error(e);
}
}
}
示例9: fireProjectClosed
import com.intellij.openapi.project.ProjectManagerListener; //导入依赖的package包/类
private void fireProjectClosed(Project project) {
if (LOG.isDebugEnabled()) {
LOG.debug("projectClosed");
}
for (ProjectManagerListener listener : myListeners) {
try {
listener.projectClosed(project);
}
catch (Exception e) {
LOG.error(e);
}
}
}
示例10: WebWelcomeFrameManager
import com.intellij.openapi.project.ProjectManagerListener; //导入依赖的package包/类
@Inject
public WebWelcomeFrameManager(@Nonnull Application application) {
application.getMessageBus().connect().subscribe(ProjectManager.TOPIC, new ProjectManagerListener() {
@Override
public void projectOpened(Project project) {
Window window = myWindow;
myWindow = null;
if (window != null) {
WebApplication.invokeOnCurrentSession(window::close);
}
}
});
}
示例11: addNotify
import com.intellij.openapi.project.ProjectManagerListener; //导入依赖的package包/类
@Override
public void addNotify() {
myDisposable = Disposer.newDisposable("ETF dispose");
Disposer.register(myDisposable, this::releaseEditorLater);
if (myProject != null) {
ProjectManagerListener listener = new ProjectManagerListener() {
@Override
public void projectClosing(Project project) {
releaseEditor(myEditor);
myEditor = null;
}
};
ProjectManager.getInstance().addProjectManagerListener(myProject, listener);
Disposer.register(myDisposable, ()->ProjectManager.getInstance().removeProjectManagerListener(myProject, listener));
}
if (myEditor != null) {
releaseEditorLater();
}
boolean isFocused = isFocusOwner();
initEditor();
super.addNotify();
if (myNextFocusable != null) {
myEditor.getContentComponent().setNextFocusableComponent(myNextFocusable);
myNextFocusable = null;
}
revalidate();
if (isFocused) {
IdeFocusManager.getGlobalInstance().doForceFocusWhenFocusSettlesDown(this);
}
}
示例12: getListeners
import com.intellij.openapi.project.ProjectManagerListener; //导入依赖的package包/类
@NotNull
private static List<ProjectManagerListener> getListeners(Project project) {
List<ProjectManagerListener> array = project.getUserData(LISTENERS_IN_PROJECT_KEY);
if (array == null) return Collections.emptyList();
return array;
}