--- a/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/resources/build-impl.xsl
+++ a/j2ee.earproject/src/org/netbeans/modules/j2ee/earproject/resources/build-impl.xsl
@@ -300,6 +300,23 @@
+
+
+
+ Empty placeholder for easier customization.
+ You can override this target in the ../build.xml file.
+
+
+
+ Empty placeholder for easier customization.
+ You can override this target in the ../build.xml file.
+
+
+ -profile-pre-init, init, -profile-post-init
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
pre-init,init-private,init-userdir,init-user,init-project,do-init,post-init,init-check,-init-taskdefs
@@ -818,7 +835,71 @@
-
+
+ =================
+ PROFILING SECTION
+ =================
+
+
+
+ Profile a J2EE project in the IDE.
+
+ profiler.startserver.target
+ start-profiled-server-extraargs
+ start-profiled-server
+
+ profiler.info.jvmargs.extra
+
+
+
+ ${profiler.startserver.target}
+
+
+ run
+
+
+ start-loadgen
+
+
+
+
+
+ ${profiler.j2ee.serverForceRestart}
+ ${profiler.j2ee.serverStartupTimeout}
+ ${profiler.info.javaPlatform}
+
+ ${profiler.info.jvmargs.agent}
+
+
+ ${profiler.j2ee.agentID}
+
+
+
+
+
+
+ ${profiler.j2ee.serverForceRestart}
+ ${profiler.j2ee.serverStartupTimeout}
+ ${profiler.info.javaPlatform}
+
+ ${profiler.info.jvmargs.extra}
+
+
+ ${profiler.info.jvmargs.agent}
+
+
+ ${profiler.j2ee.agentID}
+
+
+
+
+
+
+ ${profiler.loadgen.path}
+
+
+
+
CLEANUP SECTION
--- a/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/resources/build-impl.xsl
+++ a/j2ee.ejbjarproject/src/org/netbeans/modules/j2ee/ejbjarproject/resources/build-impl.xsl
@@ -832,6 +832,23 @@
+
+
+
+ Empty placeholder for easier customization.
+ You can override this target in the ../build.xml file.
+
+
+
+ Empty placeholder for easier customization.
+ You can override this target in the ../build.xml file.
+
+
+ -profile-pre-init, init, -profile-post-init
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
-pre-init,-init-private,-init-userdir,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-debug,-init-taskdefs,-init-ap-cmdline
@@ -1332,7 +1349,71 @@
netbeans.home
init,-pre-debug-fix,-do-debug-fix
-
+
+
+ =================
+ PROFILING SECTION
+ =================
+
+
+
+ Profile a J2EE project in the IDE.
+
+ profiler.startserver.target
+ start-profiled-server-extraargs
+ start-profiled-server
+
+ profiler.info.jvmargs.extra
+
+
+
+ ${profiler.startserver.target}
+
+
+ run
+
+
+ start-loadgen
+
+
+
+
+
+ ${profiler.j2ee.serverForceRestart}
+ ${profiler.j2ee.serverStartupTimeout}
+ ${profiler.info.javaPlatform}
+
+ ${profiler.info.jvmargs.agent}
+
+
+ ${profiler.j2ee.agentID}
+
+
+
+
+
+
+ ${profiler.j2ee.serverForceRestart}
+ ${profiler.j2ee.serverStartupTimeout}
+ ${profiler.info.javaPlatform}
+
+ ${profiler.info.jvmargs.extra}
+
+
+ ${profiler.info.jvmargs.agent}
+
+
+ ${profiler.j2ee.agentID}
+
+
+
+
+
+
+ ${profiler.loadgen.path}
+
+
+
JAVADOC SECTION
@@ -1604,7 +1685,42 @@
netbeans.home
init,-pre-debug-fix,-do-debug-fix-test
-
+
+
+ =========================
+ TESTS PROFILING SECTION
+ =========================
+
+
+
+ netbeans.home
+ profile-init,compile-test-single
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
CLEANUP SECTION
--- a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl
+++ a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl
@@ -692,7 +692,70 @@
-
+
+
+
+
+ Empty placeholder for easier customization.
+ You can override this target in the ../build.xml file.
+
+
+
+ Empty placeholder for easier customization.
+ You can override this target in the ../build.xml file.
+
+
+
+
+ resolve
+
+ name
+
+
+ value
+
+
+
+
+
+
+
+ profile
+
+ classname
+ ${main.class}
+
+
+ customize
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
nbjpdastart
@@ -1334,7 +1397,92 @@
netbeans.home
init,-pre-debug-fix,-do-debug-fix
-
+
+
+ =================
+ PROFILING SECTION
+ =================
+
+
+
+ netbeans.home
+ profile-init,compile
+ Profile a project in the IDE.
+
+
+
+
+
+
+
+
+
+ netbeans.home
+ profile-init,compile-single
+ Profile a selected class in the IDE.
+ Must select one file in the IDE or set profile.class
+
+
+
+
+
+
+
+
+
+ =========================
+ APPLET PROFILING SECTION
+ =========================
+
+
+
+ netbeans.home
+ profile-init,compile-single
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =========================
+ TESTS PROFILING SECTION
+ =========================
+
+
+
+ netbeans.home
+ profile-init,compile-test-single
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
===============
JAVADOC SECTION
--- a/profiler.j2ee/src/org/netbeans/modules/profiler/j2ee/J2EEProjectTypeProfiler.java
+++ a/profiler.j2ee/src/org/netbeans/modules/profiler/j2ee/J2EEProjectTypeProfiler.java
@@ -350,7 +350,7 @@
final FileObject profiledClass) {
switch (type) {
case TARGET_PROFILE:
- return "profile-j2ee"; // NOI18N
+ return "profile"; // NOI18N
case TARGET_PROFILE_TEST:
return null; // not currently supported // "profile-test"; // NOI18N
case TARGET_PROFILE_TEST_SINGLE:
--- a/profiler/src/org/netbeans/modules/profiler/utils/ProjectUtilities.java
+++ a/profiler/src/org/netbeans/modules/profiler/utils/ProjectUtilities.java
@@ -100,6 +100,8 @@
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
@@ -107,6 +109,8 @@
import javax.swing.event.ChangeListener;
import org.netbeans.modules.profiler.NetBeansProfiler;
import org.netbeans.modules.profiler.projectsupport.utilities.SourceUtils;
+import org.netbeans.spi.project.ProjectServiceProvider;
+import org.netbeans.spi.project.ui.ProjectOpenedHook;
import org.openide.loaders.DataObject;
import org.openide.util.lookup.Lookups;
import org.openide.util.lookup.ProxyLookup;
@@ -120,6 +124,29 @@
*/
@Deprecated
public final class ProjectUtilities {
+ @ProjectServiceProvider(service=ProjectOpenedHook.class, projectType={"org-netbeans-modules-java-j2seproject"})
+ final public static class IntegrationUpdater extends ProjectOpenedHook {
+ private Project prj;
+
+ public IntegrationUpdater(Project prj) {
+ this.prj = prj;
+ }
+
+ @Override
+ protected void projectClosed() {
+ // ignore
+ }
+
+ @Override
+ protected void projectOpened() {
+ Element e = ProjectUtils.getAuxiliaryConfiguration(prj)
+ .getConfigurationFragment("data", ProjectUtilities.PROFILER_NAME_SPACE, false); // NOI18N
+
+ if (e != null) {
+ unintegrateProfiler(prj);
+ }
+ }
+ }
//~ Static fields/initializers -----------------------------------------------------------------------------------------------
private static final Logger LOGGER = Logger.getLogger(ProjectUtilities.class.getName());
@@ -310,7 +337,13 @@
return buildDir;
}
+ final private static Pattern PROFILER_INIT = Pattern.compile("<\\s*target\\s+.*?name\\s*=\\s*\"profile-init\"", Pattern.DOTALL | Pattern.MULTILINE);
public static boolean isProfilerIntegrated(Project project) {
+ String buildXml = ProjectUtilities.getProjectBuildScript(project, "nbproject/build-impl.xml"); // NOI18N
+ Matcher m = PROFILER_INIT.matcher(buildXml);
+ if (m.find()) {
+ return true;
+ }
Element e = ProjectUtils.getAuxiliaryConfiguration(project)
.getConfigurationFragment("data", ProjectUtilities.PROFILER_NAME_SPACE, false); // NOI18N
@@ -357,7 +390,11 @@
}
public static String getProjectBuildScript(final Project project) {
- final FileObject buildFile = findBuildFile(project);
+ return getProjectBuildScript(project, "build.xml");
+ }
+
+ public static String getProjectBuildScript(final Project project, final String buildXml) {
+ final FileObject buildFile = findBuildFile(project, buildXml);
if (buildFile == null) {
return null;
}
@@ -403,14 +440,18 @@
Properties props = org.netbeans.modules.profiler.projectsupport.utilities.ProjectUtilities.getProjectProperties(project);
String buildFileName = props != null ? props.getProperty("buildfile") : null; // NOI18N
if (buildFileName != null) {
- buildFile = project.getProjectDirectory().getFileObject(buildFileName);
+ buildFile = findBuildFile(project, buildFileName);
}
if (buildFile == null) {
- buildFile = project.getProjectDirectory().getFileObject("build.xml"); //NOI18N
+ buildFile = findBuildFile(project, "build.xml"); //NOI18N
}
return buildFile;
}
+ public static FileObject findBuildFile(final Project project, final String buildFileName) {
+ return project.getProjectDirectory().getFileObject(buildFileName);
+ }
+
public static java.util.List getProjectDefaultInstrFilters(Project project) {
java.util.List v = new ArrayList();
--- a/web.project/src/org/netbeans/modules/web/project/resources/build-impl.xsl
+++ a/web.project/src/org/netbeans/modules/web/project/resources/build-impl.xsl
@@ -917,6 +917,23 @@
+
+
+
+ Empty placeholder for easier customization.
+ You can override this target in the ../build.xml file.
+
+
+
+ Empty placeholder for easier customization.
+ You can override this target in the ../build.xml file.
+
+
+ -profile-pre-init, init, -profile-post-init
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
-pre-init,-init-private,-init-libraries,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-nbjsdebug,-init-macrodef-debug,-init-taskdefs,-init-ap-cmdline
@@ -1651,7 +1668,71 @@
netbeans.home
init,-pre-debug-fix,-do-debug-fix
-
+
+
+ =================
+ PROFILING SECTION
+ =================
+
+
+
+ Profile a J2EE project in the IDE.
+
+ profiler.startserver.target
+ start-profiled-server-extraargs
+ start-profiled-server
+
+ profiler.info.jvmargs.extra
+
+
+
+ ${profiler.startserver.target}
+
+
+ run
+
+
+ start-loadgen
+
+
+
+
+
+ ${profiler.j2ee.serverForceRestart}
+ ${profiler.j2ee.serverStartupTimeout}
+ ${profiler.info.javaPlatform}
+
+ ${profiler.info.jvmargs.agent}
+
+
+ ${profiler.j2ee.agentID}
+
+
+
+
+
+
+ ${profiler.j2ee.serverForceRestart}
+ ${profiler.j2ee.serverStartupTimeout}
+ ${profiler.info.javaPlatform}
+
+ ${profiler.info.jvmargs.extra}
+
+
+ ${profiler.info.jvmargs.agent}
+
+
+ ${profiler.j2ee.agentID}
+
+
+
+
+
+
+ ${profiler.loadgen.path}
+
+
+
JAVADOC SECTION
@@ -1934,7 +2015,40 @@
init,-pre-debug-fix,-do-debug-fix-test
-
+
+ =========================
+ TESTS PROFILING SECTION
+ =========================
+
+
+
+ netbeans.home
+ profile-init,compile-test-single
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
CLEANUP SECTION