GVKun编程网logo

Local debugging application launched on tomcat with cargo in IntelliJ

20

对于LocaldebuggingapplicationlaunchedontomcatwithcargoinIntelliJ感兴趣的读者,本文将提供您所需要的所有信息,并且为您提供关于Building

对于Local debugging application launched on tomcat with cargo in IntelliJ感兴趣的读者,本文将提供您所需要的所有信息,并且为您提供关于Building an Automatically Scaling Web Application、Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin[id:xxx.xxx.xxx]、com.intellij.openapi.application.ApplicationActivationListener的实例源码、com.intellij.openapi.application.ApplicationAdapter的实例源码的宝贵知识。

本文目录一览:

Local debugging application launched on tomcat with cargo in IntelliJ

Local debugging application launched on tomcat with cargo in IntelliJ

我试图在我的货物配置中启用调试。我正在使用具有以下配置的cargo-maven2-plugin版本1.4.19。

<plugins>  <plugin>    <groupId>org.codehaus.cargo</groupId>    <artifactId>cargo-maven2-plugin</artifactId>    <version>1.4.19</version>    <configuration>      <container>        <containerId>tomcat8x</containerId>      </container>      <configuration>        <type>standalone</type>        <properties>        <cargo.servlet.port>8080</cargo.servlet.port>        <cargo.jvmargs>          -Xmx2048m          -Xms512m          -Xdebug          -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=63342          -Xnoagent          -Djava.compiler=NONE        </cargo.jvmargs>      </properties>    </configuration>    <deployer>    </deployer>    <deployables>      <deployable type="war" file="target/spa.war"></deployable>      </deployables>    </configuration>  </plugin>

应用程序使用此配置启动,但是IntelliJ从不连接到JVM来启用调试。如何使IntelliJ连接到JVM?

答案1

小编典典

我这样固定。

<plugins>  <plugin>    <groupId>org.codehaus.cargo</groupId>    <artifactId>cargo-maven2-plugin</artifactId>    <version>1.4.19</version>    <configuration>      <container>        <containerId>tomcat8x</containerId>      </container>      <configuration>        <type>standalone</type>        <properties>        <cargo.servlet.port>8080</cargo.servlet.port>        <cargo.jvmargs>          -Xmx2048m          -Xms512m          -Xdebug          -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9009          -Xnoagent          -Djava.compiler=NONE        </cargo.jvmargs>      </properties>    </configuration>    <deployer>    </deployer>    <deployables>      <deployable type="war" file="target/spa.war"></deployable>      </deployables>    </configuration>  </plugin>

我通过更改地址来使用另一个端口。

-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9009

I then created an IntelliJ run config for a remote by going to. Run > EditConfigurations > + > Remote I configured the remote to go to localhost and
the port I had previously chosen <9009>.

完成此操作后,我可以开始运行货物,然后作为一个单独的过程启动调试器以启用调试。

如果需要,可以将suspend参数更改为no。

-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009

然后,无需运行调试器即可开始构建货物。

Building an Automatically Scaling Web Application

Building an Automatically Scaling Web Application

2024年春季云计算课业1:构建一个自动伸缩的Web应用程序
截止日期:2024年4月15日,星期一
1目标和范围
在这项任务中,我们将为(非常)琐碎的Web构建一个小型的自动伸缩测试平台应用任务的目标是熟悉伸缩Web的各个方面应用程序,这将提高您对低级/基本实现的理解
云系统的详细信息。正如我们在课堂上所讨论的,我们可以部署这样一个web应用程序在虚拟机内或在容器内。为了在单个工作站上保持事情的可管理性,或者笔记本电脑,我们将把自己限制在一台主机上,并使用容器。为了模拟饱和的服务器,Web应用程序将是单线程的,并且可以在意图请注意,可以使用虚拟机类似地实现此分配,并且也可以容易地扩展到由多个主机组成的分布式系统。这两者都是但不在此任务范围内。正如在讲座中所讨论的,创建自动缩放Web应用程序。这些组成部分汇总如下图所
实例
将在容器引擎中运行可以看出,分配以部署在容器中的Web应用程序为中心,当传入负载需要时,可以按比例缩小。负载平衡器用于平衡Web应用程序的多个实例(或单个实例,如果这足以维持负载)。缩放控制器负责监控输入负载并在需要时按比例缩小或按比例缩小。负载发生器用于实验评估系统。
2要求
此任务的目标是创建上图所示的设置,并执行许多实验。在提交时必须附带的报告中,您的设置需要必须有充分的文档,必须描述体系结构,并且必须包括已经进行了。作为一个实际的Web应用程序,您将获得一个和琐碎对象存储API。此应用程序为单线程应用程序,可根据需要进行速率限制并且可以在服务HTTP请求中插入随机延迟以模拟负载下的服务器(两者都是其是可配置的)。详见附录A。在本任务中,您将使用podman作为容器引擎。如上所述,我们选择使用容器进行此分配,因为它比完全成熟的虚拟机管理程序,并且需要(显著)更少的内存和磁盘空间用于托管所开发的Web应用程序的多个实例。代 写Building an Automatically 使用podman的一些技巧见附录B。缩放控制器和算法将由您设计和开发。你有空￾dom在缩放算法设计中的应用。该算法可以是基于规则的、基于回归的,或者使用滑动窗口等。我们建议您进行一些“校准”实验￾iments与缩放算法的开发(另请参阅枚举在下面通过校准获得的信息应用于设计和调整缩放缩放控制器的算法。例如,用于缩放决策的设计规则/阈值。首先设置一个特定的目标响应时间可能是得的,以便制定服务级别协议,您也希望在不断增加的客户端负载下实现。最后,该项目是最后通过一组实验来评估缩放控制器的有效性。下表总结了有关不同系统组件的要求:部件要求
Brightspace上提供的Web应用程序。必须使用集装箱发动机吊舱。需要负载平衡器。您可以编写自己的(简单的)负载均衡器,但是也可以自由地选择现有的一个,例如HAProxy。需要负载发电机。您可以编写自己的请求生成器或者使用现有的(例如,jMeter(基于Java)或Locust(Python基于))。我们强烈建议您首先设计实验然后查看是否可以使用现有项目来执行实验。需要缩放控制器。您必须编写自己的缩放控制器。Informa￾要从负载平衡器和/或Web应用程序收集实例。缩放决策是通过执行podman来执行的命令或API调用。另请参见附录D。此缩放控制器将以所选择的编程语言来实现。关于将在项目内进行的实验,以及报告中讨论了:
实验说明
功能测试对负载执行功能实验(或集成测试)发电机和集装箱发动机。这是为了确保工作良好。校准经验￾ments必修的。进行一些校准实验。你很可能希望在进行这些实验的同时开发缩放算法。(a) 确定单个容器的饱和点。以速率播放限制和随机延迟,看看这对响应有什么影响时间(延迟)、请求吞吐量、CPU利用率等。
2.(b) 一个类似的实验,使用不同数量的容器演出规模的印象。(c) 确定生成新容器所需的时间。
需要最后的实验。进行两次有意义的最终实验,评估并展示自动缩放的有效性已经实施。这些实验必须调查反系统对不断增加和减少的客户端请求的响应
以证明该系统将自动向外扩展和向内扩展。调查缩放系统的响应时间并尝试改进这表明可以最大限度地减少失败请求的数量,或者(最好)完全取消,以便遵守某些SLA实验包括更改所使用的缩放决策的规则通过比例控制器,优化产卵的方法或时间新容器(这样它们可以在更短的时间内繁殖),减少振荡等。
3发展环境
要完成此任务,您需要对Linux安装进行管理(root)访问。这可以是您自己的笔记本电脑或工作站,但我们强烈建议创建一个专用的此分配的虚拟机。您可以使用与家庭课业1的设置类似的设置。确保为该虚拟机分配多个核心,这对实验很重要。虚拟机所需的磁盘空间取决于要在中使用的操作系统容器。在小型Alpine操作系统的情况下,4到5 GB应该足够了,否则请考虑10 GB。记录报告中使用的Linux发行版。
4提交和评估
团队最多可由两人组成。在一个由两名成员组成的团队中,我们期望两个成员都为系统的实施和实验。截止日期为2024年4月15日,星期一。根据提交课业
说明如下。如果团队工作出现问题,请通过电子邮件与讲师联系。作为报告的一部分,您必须列出每个团队成员对项目的贡献。可以获得的最大等级是10。等级是括号的总和。什么时候对每个组件进行评分,我们将考虑功能是否完整和有效明显超出任务要求的自己的倡议和想法。
❼ [4(满分10)]提交的完整性和功能性。
❼ [2(满分10)]报告内容和布局的质量。
❼ 【十分之一】校准实验(设计和报告)。
❼ [3(满分10)]评估有效性的实验质量和深度
缩放控制器的。这包括实验设计、必要的负载生成器,报告和解释结果。课业必须通过Brightspace提交。对于每个团队,提交一份预期。请在提交网站的文本框中注明您的姓名和学生证。确保提交的所有文件都包括姓名和学生ID。需要提交以下内容:Web应用程序❼ 用于生成con的命令或Containerfile/Dockerfile的列表￾web应用程序的容器图像。
❼ Web应用程序源,如果进行了修改。负载平衡器❼ 配置文件。
❼ 如果是自己开发的:源代码。
❼ 如果在容器中运行,则列出命令或Containerfile或Dockerfile生成此容器映像。缩放控制器❼ 源代码。生成器❼ 如果是自己开发的:生成器的源代码。
❼ 配置文件和相关扩展模块的源代码如果需要。报告PDF格式的报告(请不要使用Word文件),其中包括
描述:
❼ 实现的体系结构的描述和解释。
❼ 包括您自己的系统图,反映您的设计和实现的体系结构。
❼ 开发环境的描述(例如哪个Linux发行版￾tion已在您的虚拟机中使用)。
❼ 在实施过程中做出的选择。
❼ 对缩放策略设计的清晰解释。使用图表或
在您的解释中列出简洁的伪代码。
❼ 关于“校准”实验的设计和结果的报告。
以下URL返回机器可读的CSV输出,这对您的缩放非常有用控制器:http://10.0.3.6:9999/stats;csv。缩放控制器的注意事项缩放控制器由两个部分组成,可以独立编程(使使用您团队的资源)。监控部分应监控负载平衡器和/或运行web应用程序的容器实例。它需要检索做出扩展决策所需的信息(我们应该向上扩展还是向下扩展?如果是,通过如何扩展许多实例?)。请注意,这指的是MAPE反馈回路。如果您选择使用HAProxy,您可以监视HAProxy守护进程可以选择为您提供统计信息podman部分需要能够创建新的容器实例、停止实例,列出所有实例(及其IP地址)和所有其他容器管理实用程序需要使缩放控制器工作。这是的(最后)执行阶段
MAPE循环。podman命令或API调用可能在默认情况下被阻塞,在这种情况下想要研究异步调用或多线程,以便制作缩放控制器响应能力更强。通过这种方式,您可以继续监视,同时podman命令正在在不同的线程中执行。在指示podman启动或停止容器后,您还需要更新配置负载平衡器的。具体应该如何完成取决于负载平衡器
选择使用。在HAProxy的情况下,没有明确的运行时API来更新服务器。实现这一点最简单的方法是重新生成缩放控制器HAProxy配置文件,将此配置发送到负载平衡器容器(或使用卷装载?)并重新加载HAProxy。Hacky,但它有效,而且似乎在实践中使用!).podman可以通过shell命令进行控制,也可以通过其RESTful API进行控制本API详细记录如下:https://docs.podman.io/en/v3.2.3/_static/api.html.虽然您可以直接将此RESTful API作为目标,但幸运的是
最少Python和Go。我们给出了一个Python API的小例子。在您可以使用此API之前,该模块需要使用pip3安装podman进行安装。获取已定义容器的名称列表:
从podman导入PodmanClient
client=PodmanClient(base_url=“unix:///run/podman/podman.sock")
l=[c.client.counters.list()中c的c.name]获取容器的句柄,如果它正在运行,则打印此容器的IP地址3:
从podman导入PodmanClient
client=PodmanClient(base_url=“unix:///run/podman/podman.sock")
c=客户端.容器.获取(“testcontainer”)
如果c.status==“正在运行”:
print(c.attrs‘NetworkSettings’’podman’)
可以使用.stop()方法停止容器。方法.wait(条件=“正在运行”)等待(阻塞),直到容器正在运行。3字典中的podman access是默认容器网络的名称,请参阅命podmanthon模块有大量文档,在交互式Python中使用help命令壳我们在网上找不到此文档。
测试系统
为了测试完整的系统,您需要使用HTTP负载生成器。选项包括自己写这样一个生成器,jMeter,Locust或其他你认为合适的东西。对于你的实验重要的是首先设计你的实验,然后决定负载或要使用的流量模式生成器。你不想在实验中受到之前的限制
选定的负载生成器。Locust是基于Python的,可以作为命令行实用程序使用。首先,您需要编写一个蝗虫文件(参考网站https://docs.locust.io/en/stable/quickstart.html例如)。之后,您可以开始蝗虫:蝗虫-f mylocustfile.py--无头-u 10-t 300s-r 0.5
其中-u配置(并发)用户的数量,-t配置实验的运行时间-r配置生成客户端的速率。参数的值为以上只是一些例子,你应该建立自己的实验。
WX:codinghelp

Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin[id:xxx.xxx.xxx]

Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin[id:xxx.xxx.xxx]

前言

看下这个完整的bug:

Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [id 'com.github.dcendents.android-maven']

然后吧左边的信息看完全:

Caused by: java.lang.IllegalArgumentException: Unable to determine constructor argument #1: missing parameter of type Factory, 
or no service of type Factory<LoggingManagerInternal>.

根据上述两个其实是告诉我们这个plugin无法加载。

解决

然后进入build.gradle进行查看这个plugin 发现classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'

这一行有一层蒙层,然后打开把鼠标放上去,显示我们的有效版本为2.1,然后try again吧。

com.intellij.openapi.application.ApplicationActivationListener的实例源码

com.intellij.openapi.application.ApplicationActivationListener的实例源码

项目:intellij-ce-playground    文件:PlaybackRunner.java   
public PlaybackRunner(String script,StatusCallback callback,final boolean useDirectActionCall,boolean stopOnAppDeactivation,boolean useTypingTargets) {
  myScript = script;
  myCallback = callback;
  myUseDirectActionCall = useDirectActionCall;
  myUseTypingTargets = useTypingTargets;
  myStopOnAppDeactivation = stopOnAppDeactivation;
  myAppListener = new ApplicationActivationListener.Adapter() {
    @Override
    public void applicationDeactivated(IdeFrame ideFrame) {
      if (myStopOnAppDeactivation) {
        myCallback.message(null,"App lost focus,stopping...",StatusCallback.Type.message);
        stop();
      }
    }
  };
}
项目:intellij-ce-playground    文件:AppIcon.java   
private boolean isAppActive() {
  Application app = ApplicationManager.getApplication();

  if (app != null && myAppListener == null) {
    myAppListener = new ApplicationActivationListener.Adapter() {
      @Override
      public void applicationActivated(IdeFrame ideFrame) {
        hideProgress(ideFrame.getProject(),myCurrentProcessId);
        _setokBadge(ideFrame,false);
        _setTextBadge(ideFrame,null);
      }
    };
    app.getMessageBus().connect().subscribe(ApplicationActivationListener.TOPIC,myAppListener);
  }

  return app != null && app.isActive();
}
项目:consulo    文件:Alarm.java   
public void addRequest(@Nonnull final Runnable request,final int delay,boolean runWithActiveFrameOnly) {
  if (runWithActiveFrameOnly && !ApplicationManager.getApplication().isActive()) {
    final MessageBus bus = ApplicationManager.getApplication().getMessageBus();
    final MessageBusConnection connection = bus.connect(this);
    connection.subscribe(ApplicationActivationListener.TOPIC,new ApplicationActivationListener() {
      @Override
      public void applicationActivated(IdeFrame ideFrame) {
        connection.disconnect();
        addRequest(request,delay);
      }
    });
  }
  else {
    addRequest(request,delay);
  }
}
项目:consulo    文件:PlaybackRunner.java   
public PlaybackRunner(String script,StatusCallback.Type.message);
        stop();
      }
    }
  };
}
项目:consulo-java    文件:UnscrambleManager.java   
private void updateConnection()
{
    final ApplicationEx app = ApplicationManagerEx.getApplicationEx();

    boolean value = PropertiesComponent.getInstance().getBoolean(KEY);
    if(value)
    {
        myConnection = app.getMessageBus().connect();
        myConnection.subscribe(ApplicationActivationListener.TOPIC,myListener);
    }
    else
    {
        if(myConnection != null)
        {
            myConnection.disconnect();
        }
    }
}
项目:intellij-ce-playground    文件:UnscrambleAction.java   
public void afterValueChanged(RegistryValue value) {
  if (value.asBoolean()) {
    ourConnection = app.getMessageBus().connect();
    ourConnection.subscribe(ApplicationActivationListener.TOPIC,LISTENER);
  } else {
    ourConnection.disconnect();
  }
}
项目:intellij-ce-playground    文件:Alarm.java   
public void addRequest(@NotNull final Runnable request,new ApplicationActivationListener.Adapter() {
      @Override
      public void applicationActivated(IdeFrame ideFrame) {
        connection.disconnect();
        addRequest(request,delay);
      }
    });
  } else {
    addRequest(request,delay);
  }
}
项目:intellij-ce-playground    文件:ActionPopupMenuImpl.java   
public void show(final Component component,int x,int y) {
  if (!component.isShowing()) {
    //noinspection HardCodedStringLiteral
    throw new IllegalArgumentException("component must be shown on the screen");
  }

  removeAll();

  // Fill menu. Only after filling menu has non zero size.

  int x2 = Math.max(0,Math.min(x,component.getWidth() - 1)); // fit x into [0,width-1]
  int y2 = Math.max(0,Math.min(y,component.getHeight() - 1)); // fit y into [0,height-1]

  myContext = myDataContextProvider != null ? myDataContextProvider.get() : DataManager.getInstance().getDataContext(component,x2,y2);
  Utils.fillMenu(myGroup,this,true,myPresentationFactory,myContext,myPlace,false,false);
  if (getComponentCount() == 0) {
    return;
  }
  if (myApp != null) {
    if (myApp.isActive()) {
      Component frame = UIUtil.findUltimateParent(component);
      if (frame instanceof IdeFrame) {
        myFrame = (IdeFrame)frame;
      }
      myConnection = myApp.getMessageBus().connect();
      myConnection.subscribe(ApplicationActivationListener.TOPIC,ActionPopupMenuImpl.this);
   }
  }

  super.show(component,x,y);
}
项目:intellij-ce-playground    文件:MountainLionNotifications.java   
private MountainLionNotifications() {
  final MessageBusConnection connection = ApplicationManager.getApplication().getMessageBus().connect();
  connection.subscribe(ApplicationActivationListener.TOPIC,new ApplicationActivationListener.Adapter() {
    @Override
    public void applicationActivated(IdeFrame ideFrame) {
      cleanupDeliverednotifications();
    }
  });
  connection.subscribe(AppLifecycleListener.TOPIC,new AppLifecycleListener.Adapter() {
    @Override
    public void appClosing() {
      cleanupDeliverednotifications();
    }
  });
}
项目:intellij-ce-playground    文件:ApplicationActivationStateManager.java   
private static boolean setActive(Application application,Window window) {
  IdeFrame ideFrame = getIdeFrameFromWindow(window);

  state = State.ACTIVE;
  LOG.debug("The app is in the active state");

  if (ideFrame != null) {
    application.getMessageBus().syncpublisher(ApplicationActivationListener.TOPIC).applicationActivated(ideFrame);
    return true;
  }
  return false;
}
项目:watchdog    文件:IntelliJListener.java   
/**
 * Adds IntelliJ listeners including already opened windows and
 * registers shutdown and debugger listeners.
 */
public void attachListeners() {
    WatchDogEventType.START_IDE.process(this);

    connection.subscribe(ApplicationActivationListener.TOPIC,new IntelliJActivationListener());
    activityListener = new GeneralActivityListener(project.getName());
    EditorFactory.getInstance().addEditorFactoryListener(editorWindowListener,parent);
    attachDebuggerListeners();
}
项目:tools-idea    文件:UnscrambleAction.java   
public void afterValueChanged(RegistryValue value) {
  if (value.asBoolean()) {
    ourConnection = app.getMessageBus().connect();
    ourConnection.subscribe(ApplicationActivationListener.TOPIC,LISTENER);
  } else {
    ourConnection.disconnect();
  }
}
项目:consulo    文件:ActionPopupMenuImpl.java   
@Override
public void show(final Component component,LaterInvocator.isInModalContext());
  if (getComponentCount() == 0) {
    return;
  }
  if (myApp != null) {
    if (myApp.isActive()) {
      Component frame = UIUtil.findUltimateParent(component);
      if (frame instanceof IdeFrame) {
        myFrame = (IdeFrame)frame;
      }
      myConnection = myApp.getMessageBus().connect();
      myConnection.subscribe(ApplicationActivationListener.TOPIC,ActionPopupMenuImpl.this);
    }
  }

  super.show(component,y);
}
项目:consulo    文件:MountainLionNotifications.java   
private MountainLionNotifications() {
  final MessageBusConnection connection = ApplicationManager.getApplication().getMessageBus().connect();
  connection.subscribe(ApplicationActivationListener.TOPIC,new AppLifecycleListener() {
    @Override
    public void appClosing() {
      cleanupDeliverednotifications();
    }
  });
}
项目:consulo    文件:ApplicationActivationStateManager.java   
private static boolean setActive(Application application,Window window) {
  IdeFrame ideFrame = getIdeFrameFromWindow(window);

  state = State.ACTIVE;
  LOG.debug("The app is in the active state");

  if (ideFrame != null) {
    application.getMessageBus().syncpublisher(ApplicationActivationListener.TOPIC).applicationActivated(ideFrame);
    return true;
  }
  return false;
}
项目:intellij-ce-playground    文件:FocusManagerImpl.java   
@SuppressWarnings("UnusedParameters")  // the dependencies are needed to ensure correct loading order
public FocusManagerImpl(ServiceManagerImpl serviceManager,WindowManager wm,UiActivityMonitor monitor) {
  myApp = ApplicationManager.getApplication();
  myQueue = IdeEventQueue.getInstance();
  myActivityMonitor = monitor;

  myFocusedComponentAlarm = new EdtAlarm();
  myForcedFocusRequestsAlarm = new EdtAlarm();
  myIdleAlarm = new EdtAlarm();

  final AppListener myAppListener = new AppListener();
  myApp.getMessageBus().connect().subscribe(ApplicationActivationListener.TOPIC,myAppListener);

  IdeEventQueue.getInstance().adddispatcher(new IdeEventQueue.Eventdispatcher() {
    @Override
    public boolean dispatch(AWTEvent e) {
      if (e instanceof FocusEvent) {
        final FocusEvent fe = (FocusEvent)e;
        final Component c = fe.getComponent();
        if (c instanceof Window || c == null) return false;

        Component parent = UIUtil.findUltimateParent(c);

        if (parent instanceof IdeFrame) {
          myLastFocused.put((IdeFrame)parent,c);
        }
      }
      else if (e instanceof WindowEvent) {
        Window wnd = ((WindowEvent)e).getwindow();
        if (e.getID() == WindowEvent.WINDOW_CLOSED) {
          if (wnd instanceof IdeFrame) {
            myLastFocused.remove(wnd);
            myLastFocusedAtDeactivation.remove(wnd);
          }
        }
      }

      return false;
    }
  },this);

  KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertychangelistener("focusedWindow",new Propertychangelistener() {
    @Override
    public void propertyChange(PropertyChangeEvent evt) {
      if (evt.getNewValue() instanceof IdeFrame) {
        myLastFocusedFrame = (IdeFrame)evt.getNewValue();
      }
    }
  });
}
项目:intellij-ce-playground    文件:PlaybackRunner.java   
public ActionCallback run() {
  myStopRequested = false;

  myRegistryValues.clear();
  final UiActivityMonitor activityMonitor = UiActivityMonitor.getInstance();
  activityMonitor.clear();
  activityMonitor.setActive(true);
  myCurrentStageDepth.clear();
  myPassedStages.clear();
  myContextTimestamp++;

  ApplicationManager.getApplication().getMessageBus().connect(ApplicationManager.getApplication()).subscribe(ApplicationActivationListener.TOPIC,myAppListener);

  try {
    myActionCallback = new ActionCallback();
    myActionCallback.doWhenProcessed(new Runnable() {
      @Override
      public void run() {
        stop();

        SwingUtilities.invokelater(new Runnable() {
          @Override
          public void run() {
            activityMonitor.setActive(false);
            restoreRegistryValues();
          }
        });
      }
    });

    myRobot = new Robot();

    parse();

    new Thread("playback runner") {
      @Override
      public void run() {
        if (myUseDirectActionCall) {
          executeFrom(0,getScriptDir());
        }
        else {
          IdeEventQueue.getInstance().doWhenReady(new Runnable() {
            public void run() {
              executeFrom(0,getScriptDir());
            }
          });
        }
      }
    }.start();
  }
  catch (AWTException e) {
    LOG.error(e);
  }

  return myActionCallback;
}
项目:intellij-ce-playground    文件:FileChooserDialogImpl.java   
protected JComponent createCenterPanel() {
  JPanel panel = new MyPanel();

  myUiUpdater = new MergingUpdateQueue("FileChooserUpdater",200,panel);
  disposer.register(mydisposable,myUiUpdater);
  new UiNotifyConnector(panel,myUiUpdater);

  panel.setBorder(JBUI.Borders.empty());

  createTree();

  final DefaultActionGroup group = createActionGroup();
  ActionToolbar toolBar = ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNowN,group,true);
  toolBar.setTargetComponent(panel);

  final JPanel toolbarPanel = new JPanel(new BorderLayout());
  toolbarPanel.add(toolBar.getComponent(),BorderLayout.CENTER);

  myTextFieldAction = new TextFieldAction() {
    public void linkSelected(final LinkLabel aSource,final Object aLinkData) {
      toggleshowtextField();
    }
  };
  toolbarPanel.add(myTextFieldAction,BorderLayout.EAST);
  JPanel extraToolbarPanel = createExtraToolbarPanel();
  if(extraToolbarPanel != null){
    toolbarPanel.add(extraToolbarPanel,BorderLayout.soUTH);
  }

  myPathTextFieldWrapper = new JPanel(new BorderLayout());
  myPathTextFieldWrapper.setBorder(JBUI.Borders.emptyBottom(2));
  myPathTextField = new FileTextFieldImpl.Vfs(
    FileChooserFactoryImpl.getMacroMap(),getdisposable(),new LocalFsFinder.FileChooserFilter(myChooserDescriptor,myFileSystemTree)) {
    protected void onTextChanged(final String newValue) {
      myUiUpdater.cancelAllUpdates();
      updateTreeFromPath(newValue);
    }
  };
  disposer.register(mydisposable,myPathTextField);
  myPathTextFieldWrapper.add(myPathTextField.getField(),BorderLayout.CENTER);
  if (getRecentFiles().length > 0) {
    myPathTextFieldWrapper.add(createHistoryButton(),BorderLayout.EAST);
  }

  mynorthPanel = new JPanel(new BorderLayout());
  mynorthPanel.add(toolbarPanel,BorderLayout.norTH);


  updateTextFieldShowing();

  panel.add(mynorthPanel,BorderLayout.norTH);

  registerMouseListener(group);

  JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myFileSystemTree.getTree());
  //scrollPane.setBorder(BorderFactory.createLineBorder(new Color(148,154,156)));
  panel.add(scrollPane,BorderLayout.CENTER);
  panel.setPreferredSize(JBUI.size(400));


  panel.add(new JLabel(DRAG_N_DROP_HINT,SwingConstants.CENTER),BorderLayout.soUTH);


  ApplicationManager.getApplication().getMessageBus().connect(getdisposable())
    .subscribe(ApplicationActivationListener.TOPIC,new ApplicationActivationListener.Adapter() {
      @Override
      public void applicationActivated(IdeFrame ideFrame) {
        DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_MODAL,new Runnable() {
          @Override
          public void run() {
            ((SaveAndSyncHandlerImpl)SaveAndSyncHandler.getInstance()).maybeRefresh(ModalityState.current());
          }
        });
      }
    });

  return panel;
}
项目:tools-idea    文件:FocusManagerImpl.java   
@SuppressWarnings("UnusedParameters")  // the dependencies are needed to ensure correct loading order
public FocusManagerImpl(ServiceManagerImpl serviceManager,UiActivityMonitor monitor) {
  myApp = ApplicationManager.getApplication();
  myQueue = IdeEventQueue.getInstance();
  myActivityMonitor = monitor;

  myFocusedComponentAlaram = new EdtAlarm();
  myForcedFocusRequestsAlarm = new EdtAlarm();
  myIdleAlarm = new EdtAlarm();

  final AppListener myAppListener = new AppListener();
  myApp.getMessageBus().connect().subscribe(ApplicationActivationListener.TOPIC,myAppListener);

  IdeEventQueue.getInstance().adddispatcher(new IdeEventQueue.Eventdispatcher() {
    public boolean dispatch(AWTEvent e) {
      if (e instanceof FocusEvent) {
        final FocusEvent fe = (FocusEvent)e;
        final Component c = fe.getComponent();
        if (c instanceof Window || c == null) return false;

        Component parent = SwingUtilities.getwindowAncestor(c);

        if (parent instanceof IdeFrame) {
          myLastFocused.put((IdeFrame)parent,new WeakReference<Component>(c));
        }
      } else if (e instanceof WindowEvent) {
        Window wnd = ((WindowEvent)e).getwindow();
        if (e.getID() == WindowEvent.WINDOW_CLOSED) {
          if (wnd instanceof IdeFrame) {
            myLastFocused.remove((IdeFrame)wnd);
            myLastFocusedAtDeactivation.remove((IdeFrame)wnd);
          }
        }
      }

      return false;
    }
  },new Propertychangelistener() {
    @Override
    public void propertyChange(PropertyChangeEvent evt) {
      if (evt.getNewValue() instanceof IdeFrame) {
        myLastFocusedFrame = (IdeFrame)evt.getNewValue();
      }
    }
  });
}
项目:tools-idea    文件:PlaybackRunner.java   
public ActionCallback run() {
  myStopRequested = false;

  myRegistryValues.clear();
  final UiActivityMonitor activityMonitor = UiActivityMonitor.getInstance();
  activityMonitor.clear();
  activityMonitor.setActive(true);
  myCurrentStageDepth.clear();
  myPassedStages.clear();
  myContextTimestamp++;

  ApplicationManager.getApplication().getMessageBus().connect(myOnStop).subscribe(ApplicationActivationListener.TOPIC,myAppListener);

  try {
    myActionCallback = new ActionCallback();
    myActionCallback.doWhenProcessed(new Runnable() {
      @Override
      public void run() {
        stop();

        SwingUtilities.invokelater(new Runnable() {
          @Override
          public void run() {
            activityMonitor.setActive(false);
            restoreRegistryValues();
          }
        });
      }
    });

    myRobot = new Robot();

    parse();

    new Thread() {
      @Override
      public void run() {
        if (myUseDirectActionCall) {
          executeFrom(0,getScriptDir());
            }
          });
        }
      }
    }.start();
  }
  catch (AWTException e) {
    LOG.error(e);
  }

  return myActionCallback;
}
项目:consulo    文件:FocusManagerImpl.java   
@SuppressWarnings("UnusedParameters")  // the dependencies are needed to ensure correct loading order
public FocusManagerImpl(ServiceManagerImpl serviceManager,UiActivityMonitor monitor) {
  myApp = ApplicationManager.getApplication();
  myQueue = IdeEventQueue.getInstance();
  myActivityMonitor = monitor;

  myFocusedComponentAlarm = new EdtAlarm();
  myForcedFocusRequestsAlarm = new EdtAlarm();

  final AppListener myAppListener = new AppListener();
  myApp.getMessageBus().connect().subscribe(ApplicationActivationListener.TOPIC,myAppListener);

  IdeEventQueue.getInstance().adddispatcher(e -> {
    if (e instanceof FocusEvent) {
      final FocusEvent fe = (FocusEvent)e;
      final Component c = fe.getComponent();
      if (c instanceof Window || c == null) return false;

      Component parent = UIUtil.findUltimateParent(c);

      if (parent instanceof IdeFrame) {
        myLastFocused.put((IdeFrame)parent,c);
      }
    }
    else if (e instanceof WindowEvent) {
      Window wnd = ((WindowEvent)e).getwindow();
      if (e.getID() == WindowEvent.WINDOW_CLOSED) {
        if (wnd instanceof IdeFrame) {
          myLastFocused.remove(wnd);
          myLastFocusedAtDeactivation.remove(wnd);
        }
      }
    }

    return false;
  },new Propertychangelistener() {
    @Override
    public void propertyChange(PropertyChangeEvent evt) {
      if (evt.getNewValue() instanceof IdeFrame) {
        myLastFocusedFrame = (IdeFrame)evt.getNewValue();
      }
    }
  });
}
项目:consulo    文件:PlaybackRunner.java   
public ActionCallback run() {
  myStopRequested = false;

  myRegistryValues.clear();
  final UiActivityMonitor activityMonitor = UiActivityMonitor.getInstance();
  activityMonitor.clear();
  activityMonitor.setActive(true);
  myCurrentStageDepth.clear();
  myPassedStages.clear();
  myContextTimestamp++;

  ApplicationManager.getApplication().getMessageBus().connect(myOnStop).subscribe(ApplicationActivationListener.TOPIC,getScriptDir());
            }
          });
        }
      }
    }.start();
  }
  catch (AWTException e) {
    LOG.error(e);
  }

  return myActionCallback;
}
项目:consulo    文件:FocusDebuggerAction.java   
public FocusDrawer() {
  super("focus debugger");
  Application app = ApplicationManager.getApplication();
  app.getMessageBus().connect().subscribe(ApplicationActivationListener.TOPIC,this);
}
项目:consulo    文件:FileChooserDialogImpl.java   
protected JComponent createCenterPanel() {
  JPanel panel = new MyPanel();

  myUiUpdater = new MergingUpdateQueue("FileChooserUpdater",BorderLayout.EAST);
  JPanel extraToolbarPanel = createExtraToolbarPanel();
  if (extraToolbarPanel != null) {
    toolbarPanel.add(extraToolbarPanel,BorderLayout.soUTH);
  }

  myPathTextFieldWrapper = new JPanel(new BorderLayout());
  myPathTextFieldWrapper.setBorder(JBUI.Borders.emptyBottom(2));
  myPathTextField = new FileTextFieldImpl.Vfs(FileChooserFactoryImpl.getMacroMap(),BorderLayout.CENTER);
  panel.setPreferredSize(JBUI.size(400));


  JLabel hintLabel = new JLabel(DRAG_N_DROP_HINT,SwingConstants.CENTER);
  hintLabel.setForeground(JBColor.gray);
  hintLabel.setFont(JBUI.Fonts.smallFont());
  panel.add(hintLabel,BorderLayout.soUTH);

  ApplicationManager.getApplication().getMessageBus().connect(getdisposable())
          .subscribe(ApplicationActivationListener.TOPIC,new ApplicationActivationListener() {
            @Override
            public void applicationActivated(IdeFrame ideFrame) {
              ((SaveAndSyncHandlerImpl)SaveAndSyncHandler.getInstance()).maybeRefresh(ModalityState.current());
            }
          });

  return panel;
}

com.intellij.openapi.application.ApplicationAdapter的实例源码

com.intellij.openapi.application.ApplicationAdapter的实例源码

项目:google-cloud-intellij    文件:CloudDebugGlobalPoller.java   
/** Begins listening on changes in the background. */
public synchronized void startBackgroundListening() {
  if (watchTimer == null) {
    watchTimer = new Timer("cloud debug watcher",true /* isDaemon */);
    watchTimer.schedule(new CloudDebugGlobalPollerTimerTask(this),DELAY_MS,DELAY_MS);

    ApplicationManager.getApplication()
        .addApplicationListener(
            new ApplicationAdapter() {
              @Override
              public void applicationExiting() {
                if (watchTimer != null) {
                  watchTimer.cancel();
                }
              }
            });
  }
}
项目:consulo    文件:NoSwingUnderWriteAction.java   
static void watchForEvents(Application application) {
  AtomicBoolean reported = new AtomicBoolean();
  IdeEventQueue.getInstance().addPostprocessor(e -> {
    if (application.isWriteAccessAllowed() && reported.compareAndSet(false,true)) {
      LOG.error("AWT events are not allowed inside write action: " + e);
    }
    return true;
  },application);

  application.addApplicationListener(new ApplicationAdapter() {
    @Override
    public void afterWriteActionFinished(@Nonnull Object action) {
      reported.set(false);
    }
  });
}
项目:intellij-ce-playground    文件:ProgressIndicatorUtils.java   
@NotNull
public static ProgressIndicator forceWriteActionPriority(@NotNull final ProgressIndicator progress,@NotNull final disposable builder) {
  ApplicationManager.getApplication().addApplicationListener(new ApplicationAdapter() {
      @Override
      public void beforeWriteActionStart(Object action) {
        if (progress.isRunning()) {
          progress.cancel();
        }
      }
    },builder);
  return progress;
}
项目:tools-idea    文件:ProgressIndicatorUtils.java   
@NotNull
public static ProgressIndicator forceWriteActionPriority(@NotNull final ProgressIndicator progress,builder);
  return progress;
}
项目:consulo    文件:ProgressIndicatorUtils.java   
@Nonnull
public static ProgressIndicator forceWriteActionPriority(@Nonnull ProgressIndicator progress,@Nonnull disposable parentdisposable) {
  ApplicationManager.getApplication().addApplicationListener(new ApplicationAdapter() {
    @Override
    public void beforeWriteActionStart(@Nonnull Object action) {
      if (progress.isRunning()) {
        progress.cancel();
      }
    }
  },parentdisposable);
  return progress;
}
项目:tools-idea    文件:ChooseByNameBase.java   
protected void showtextFieldPanel() {
  final JlayeredPane layeredPane = getlayeredPane();
  final Dimension preferredTextFieldPanelSize = myTextFieldPanel.getPreferredSize();
  final int x = (layeredPane.getWidth() - preferredTextFieldPanelSize.width) / 2;
  final int paneHeight = layeredPane.getHeight();
  final int y = paneHeight / 3 - preferredTextFieldPanelSize.height / 2;

  VISIBLE_LIST_SIZE_LIMIT = Math.max
    (10,(paneHeight - (y + preferredTextFieldPanelSize.height)) / (preferredTextFieldPanelSize.height / 2) - 1);

  ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(myTextFieldPanel,myTextField);
  builder.setCancelCallback(new Computable<Boolean>() {
    @Override
    public Boolean compute() {
      myTextPopup = null;
      close(false);
      return Boolean.TRUE;
    }
  }).setFocusable(true).setRequestFocus(true).setModalContext(false).setCancelOnClickOutside(false);

  Point point = new Point(x,y);
  SwingUtilities.convertPointToScreen(point,layeredPane);
  Rectangle bounds = new Rectangle(point,new Dimension(preferredTextFieldPanelSize.width + 20,preferredTextFieldPanelSize.height));
  myTextPopup = builder.createPopup();
  myTextPopup.setSize(bounds.getSize());
  myTextPopup.setLocation(bounds.getLocation());

  new MnemonicHelper().register(myTextFieldPanel);
  if (myProject != null && !myProject.isDefault()) {
    DaemonCodeAnalyzer.getInstance(myProject).disableupdateByTimer(myTextPopup);
  }

  disposer.register(myTextPopup,new disposable() {
    @Override
    public void dispose() {
      cancelCalcElementsThread();
    }
  });
  ApplicationManager.getApplication().addApplicationListener(new ApplicationAdapter() {
    @Override
    public void beforeWriteActionStart(Object action) {
      CalcElementsThread prevThread = cancelCalcElementsThread();
      if (prevThread != null) {
        prevThread.scheduleRestart();
      }
    }
  },myTextPopup);
  myTextPopup.show(layeredPane);
}

我们今天的关于Local debugging application launched on tomcat with cargo in IntelliJ的分享已经告一段落,感谢您的关注,如果您想了解更多关于Building an Automatically Scaling Web Application、Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin[id:xxx.xxx.xxx]、com.intellij.openapi.application.ApplicationActivationListener的实例源码、com.intellij.openapi.application.ApplicationAdapter的实例源码的相关信息,请在本站查询。

本文标签: