/mvn");
+ }
+
+ addLabelAndWidget("Maven Path", m_mavenPath, layout, row);
+
+ addHelpButton(
+ "Only required for indexing projects using Maven.
"
+ "Provide the location of your installed Maven executable. You can also use the auto detection below.
"
+ , layout, row
+ );
+ row++;
+
+ m_mavenPathDetector = utility::getMavenExecutablePathDetector();
+ addMavenPathDetection(layout, row);
}
- javaVersionString += "Java 8";
-
- addHelpButton((
- "Only required for indexing Java projects.
"
- "Provide the location of the jvm library inside the installation of your " + javaVersionString +
- " runtime environment (for information on how to set this take a look at "
- ""
- "Finding Java Runtime Library Location or use the auto detection below)
").c_str(),
- layout, row
- );
- row++;
-
- m_javaPathDetector = utility::getJavaRuntimePathDetector();
- addJavaPathDetection(layout, row);
-
- // jvm max memory
- m_jvmMaximumMemory = addLineEdit(
- "JVM Maximum Memory",
- "Specify the maximum amount of memory that will be allocated by the indexer's JVM (values are in MB). Set "
- "this value to -1 to use the JVM's default setting.
"
- "Warning: You may experience a sudden slowdown during the course of indexing when setting this value "
- "too low. This may also happen when using the JVM's default setting.
",
- layout, row
- );
- layout->setRowMinimumHeight(row - 1, 30);
-
- // maven path
- m_mavenPath = new QtLocationPicker(this);
-
- if (QSysInfo::windowsVersion() != QSysInfo::WV_None)
- {
- m_mavenPath->setFileFilter("Maven command (mvn.cmd)");
- m_mavenPath->setPlaceholderText("/bin/mvn.cmd");
- }
- else
- {
- m_mavenPath->setFileFilter("Maven command (mvn)");
- m_mavenPath->setPlaceholderText("/mvn");
- }
-
- addLabelAndWidget("Maven Path", m_mavenPath, layout, row);
-
- addHelpButton(
- "Only required for indexing projects using Maven.
"
- "Provide the location of your installed Maven executable. You can also use the auto detection below.
"
- , layout, row
- );
- row++;
-
- m_mavenPathDetector = utility::getMavenExecutablePathDetector();
- addMavenPathDetection(layout, row);
addGap(layout, row);
@@ -290,6 +312,8 @@ void QtProjectWizzardContentPreferences::load()
m_jvmMaximumMemory->setText(QString::number(appSettings->getJavaMaximumMemory()));
+ m_jreSystemLibraryPaths->setList(appSettings->getJreSystemLibraryPaths());
+
if (m_mavenPath)
{
m_mavenPath->setText(QString::fromStdString(appSettings->getMavenPath().str()));
@@ -332,6 +356,8 @@ void QtProjectWizzardContentPreferences::save()
appSettings->setJavaPath(m_javaPath->getText().toStdString());
}
+ appSettings->setJreSystemLibraryPaths(m_jreSystemLibraryPaths->getList());
+
int jvmMaximumMemory = m_jvmMaximumMemory->text().toInt();
if (jvmMaximumMemory) appSettings->setJavaMaximumMemory(jvmMaximumMemory);
@@ -363,6 +389,13 @@ void QtProjectWizzardContentPreferences::javaPathDetectionClicked()
}
}
+void QtProjectWizzardContentPreferences::jreSystemLibraryPathsDetectionClicked()
+{
+ std::vector paths = m_jreSystemLibraryPathsDetector->getPaths(m_jreSystemLibraryPathsDetectorBox->currentText().toStdString());
+ std::vector oldPaths = m_jreSystemLibraryPaths->getList();
+ m_jreSystemLibraryPaths->setList(utility::unique(utility::concat(oldPaths, paths)));
+}
+
void QtProjectWizzardContentPreferences::mavenPathDetectionClicked()
{
std::vector paths = m_mavenPathDetector->getPaths(m_mavenPathDetectorBox->currentText().toStdString());
@@ -424,6 +457,40 @@ void QtProjectWizzardContentPreferences::addJavaPathDetection(QGridLayout* layou
row++;
}
+void QtProjectWizzardContentPreferences::addJreSystemLibraryPathsDetection(QGridLayout* layout, int& row)
+{
+ const std::vector detectorNames = m_jreSystemLibraryPathsDetector->getWorkingDetectorNames();
+ if (detectorNames.empty())
+ {
+ return;
+ }
+
+ QLabel* label = new QLabel("Auto detection from:");
+
+ m_jreSystemLibraryPathsDetectorBox = new QComboBox();
+
+ for (const std::string& detectorName: detectorNames)
+ {
+ m_jreSystemLibraryPathsDetectorBox->addItem(detectorName.c_str());
+ }
+
+ QPushButton* button = new QPushButton("detect");
+ button->setObjectName("windowButton");
+ connect(button, SIGNAL(clicked()), this, SLOT(jreSystemLibraryPathsDetectionClicked()));
+
+ QHBoxLayout* hlayout = new QHBoxLayout();
+ hlayout->setContentsMargins(0, 0, 0, 0);
+ hlayout->addWidget(label);
+ hlayout->addWidget(m_jreSystemLibraryPathsDetectorBox);
+ hlayout->addWidget(button);
+
+ QWidget* detectionWidget = new QWidget();
+ detectionWidget->setLayout(hlayout);
+
+ layout->addWidget(detectionWidget, row, QtProjectWizzardWindow::BACK_COL, Qt::AlignLeft | Qt::AlignTop);
+ row++;
+}
+
void QtProjectWizzardContentPreferences::addMavenPathDetection(QGridLayout* layout, int& row)
{
std::vector detectorNames = m_mavenPathDetector->getWorkingDetectorNames();
diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h
index b45bbc0b..cfb399cc 100644
--- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h
+++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.h
@@ -8,6 +8,7 @@
#include "qt/element/QtFontPicker.h"
#include "qt/element/QtLocationPicker.h"
+#include "qt/element/QtDirectoryListBox.h"
#include "qt/window/project_wizzard/QtProjectWizzardContent.h"
#include "utility/path_detector/CombinedPathDetector.h"
@@ -30,12 +31,14 @@ public:
private slots:
void colorSchemeChanged(int index);
void javaPathDetectionClicked();
+ void jreSystemLibraryPathsDetectionClicked();
void mavenPathDetectionClicked();
void loggingEnabledChanged();
void indexerThreadsChanges(int index);
private:
void addJavaPathDetection(QGridLayout* layout, int& row);
+ void addJreSystemLibraryPathsDetection(QGridLayout* layout, int& row);
void addMavenPathDetection(QGridLayout* layout, int& row);
void addTitle(QString title, QGridLayout* layout, int& row);
@@ -72,13 +75,16 @@ private:
QCheckBox* m_multiProcessIndexing;
std::shared_ptr m_javaPathDetector;
+ std::shared_ptr m_jreSystemLibraryPathsDetector;
std::shared_ptr m_mavenPathDetector;
QComboBox* m_javaPathDetectorBox;
+ QComboBox* m_jreSystemLibraryPathsDetectorBox;
QComboBox* m_mavenPathDetectorBox;
QtLocationPicker* m_javaPath;
- QtLocationPicker* m_mavenPath;
+ QtDirectoryListBox* m_jreSystemLibraryPaths;
QLineEdit* m_jvmMaximumMemory;
+ QtLocationPicker* m_mavenPath;
};
#endif // QT_PROJECT_WIZZARD_CONTENT_PREFERENCES_H
diff --git a/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.cpp b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.cpp
new file mode 100644
index 00000000..9939a501
--- /dev/null
+++ b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.cpp
@@ -0,0 +1,35 @@
+#include "utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.h"
+
+#include "utility/path_detector/java_runtime/JavaPathDetector.h"
+
+#include "settings/ApplicationSettings.h"
+#include "utility/file/FilePath.h"
+#include "utility/file/FileSystem.h"
+
+JreSystemLibraryPathDetector::JreSystemLibraryPathDetector(std::shared_ptr javaPathDetector)
+ : PathDetector("JRE System Library")
+ , m_javaPathDetector(javaPathDetector)
+{
+}
+
+JreSystemLibraryPathDetector::~JreSystemLibraryPathDetector()
+{
+}
+
+std::vector JreSystemLibraryPathDetector::getPaths() const
+{
+ std::vector paths;
+ for (const FilePath& jrePath: m_javaPathDetector->getPaths())
+ {
+ const FilePath javaRoot = jrePath.parentDirectory().parentDirectory().parentDirectory();
+ for (const FilePath& jarPath : FileSystem::getFilePathsFromDirectory(javaRoot.concat(FilePath("lib")), {".jar"}))
+ {
+ paths.push_back(jarPath);
+ }
+ if (!paths.empty())
+ {
+ break;
+ }
+ }
+ return paths;
+}
diff --git a/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.h b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.h
new file mode 100644
index 00000000..9c9196bc
--- /dev/null
+++ b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.h
@@ -0,0 +1,22 @@
+#ifndef JRE_SYSTEM_LIBRARY_PATH_DETECTOR_H
+#define JRE_SYSTEM_LIBRARY_PATH_DETECTOR_H
+
+#include
+
+#include "utility/path_detector/PathDetector.h"
+
+class JavaPathDetector;
+
+class JreSystemLibraryPathDetector: public PathDetector
+{
+public:
+ JreSystemLibraryPathDetector(std::shared_ptr javaPathDetector);
+ virtual ~JreSystemLibraryPathDetector();
+
+ virtual std::vector getPaths() const;
+
+private:
+ std::shared_ptr m_javaPathDetector;
+};
+
+#endif // JRE_SYSTEM_LIBRARY_PATH_DETECTOR_H
diff --git a/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorLinux.cpp b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorLinux.cpp
new file mode 100644
index 00000000..793cefba
--- /dev/null
+++ b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorLinux.cpp
@@ -0,0 +1,12 @@
+#include "utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorLinux.h"
+
+#include "utility/path_detector/java_runtime/JavaPathDetectorLinux.h"
+
+JreSystemLibraryPathDetectorLinux::JreSystemLibraryPathDetectorLinux(const std::string javaVersion)
+ : JreSystemLibraryPathDetector(std::make_shared(javaVersion))
+{
+}
+
+JreSystemLibraryPathDetectorLinux::~JreSystemLibraryPathDetectorLinux()
+{
+}
diff --git a/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorLinux.h b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorLinux.h
new file mode 100644
index 00000000..4a5226ed
--- /dev/null
+++ b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorLinux.h
@@ -0,0 +1,13 @@
+#ifndef JRE_SYSTEM_LIBRARY_PATH_DETECTOR_LINUX_H
+#define JRE_SYSTEM_LIBRARY_PATH_DETECTOR_LINUX_H
+
+#include "utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.h"
+
+class JreSystemLibraryPathDetectorLinux: public JreSystemLibraryPathDetector
+{
+public:
+ JreSystemLibraryPathDetectorLinux(const std::string javaVersion);
+ virtual ~JreSystemLibraryPathDetectorLinux();
+};
+
+#endif // JRE_SYSTEM_LIBRARY_PATH_DETECTOR_LINUX_H
diff --git a/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorMac.cpp b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorMac.cpp
new file mode 100644
index 00000000..5621c66b
--- /dev/null
+++ b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorMac.cpp
@@ -0,0 +1,12 @@
+#include "utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorMac.h"
+
+#include "utility/path_detector/java_runtime/JavaPathDetectorMac.h"
+
+JreSystemLibraryPathDetectorMac::JreSystemLibraryPathDetectorMac(const std::string javaVersion)
+ : JreSystemLibraryPathDetector(std::make_shared(javaVersion))
+{
+}
+
+JreSystemLibraryPathDetectorMac::~JreSystemLibraryPathDetectorMac()
+{
+}
diff --git a/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorMac.h b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorMac.h
new file mode 100644
index 00000000..c508d32d
--- /dev/null
+++ b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorMac.h
@@ -0,0 +1,13 @@
+#ifndef JRE_SYSTEM_LIBRARY_PATH_DETECTOR_MAC_H
+#define JRE_SYSTEM_LIBRARY_PATH_DETECTOR_MAC_H
+
+#include "utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.h"
+
+class JreSystemLibraryPathDetectorMac: public JreSystemLibraryPathDetector
+{
+public:
+ JreSystemLibraryPathDetectorMac(const std::string javaVersion);
+ virtual ~JreSystemLibraryPathDetectorMac();
+};
+
+#endif // JRE_SYSTEM_LIBRARY_PATH_DETECTOR_MAC_H
diff --git a/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorWindows.cpp b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorWindows.cpp
new file mode 100644
index 00000000..9cce4a95
--- /dev/null
+++ b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorWindows.cpp
@@ -0,0 +1,12 @@
+#include "utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorWindows.h"
+
+#include "utility/path_detector/java_runtime/JavaPathDetectorWindows.h"
+
+JreSystemLibraryPathDetectorWindows::JreSystemLibraryPathDetectorWindows(const std::string javaVersion)
+ : JreSystemLibraryPathDetector(std::make_shared(javaVersion))
+{
+}
+
+JreSystemLibraryPathDetectorWindows::~JreSystemLibraryPathDetectorWindows()
+{
+}
diff --git a/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorWindows.h b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorWindows.h
new file mode 100644
index 00000000..68d82bf9
--- /dev/null
+++ b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorWindows.h
@@ -0,0 +1,13 @@
+#ifndef JRE_SYSTEM_LIBRARY_PATH_DETECTOR_WINDOWS_H
+#define JRE_SYSTEM_LIBRARY_PATH_DETECTOR_WINDOWS_H
+
+#include "utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.h"
+
+class JreSystemLibraryPathDetectorWindows: public JreSystemLibraryPathDetector
+{
+public:
+ JreSystemLibraryPathDetectorWindows(const std::string javaVersion);
+ virtual ~JreSystemLibraryPathDetectorWindows();
+};
+
+#endif // JRE_SYSTEM_LIBRARY_PATH_DETECTOR_WINDOWS_H
diff --git a/src/lib_gui/utility/utilityPathDetection.cpp b/src/lib_gui/utility/utilityPathDetection.cpp
index 8a9e78f3..a5721ea0 100644
--- a/src/lib_gui/utility/utilityPathDetection.cpp
+++ b/src/lib_gui/utility/utilityPathDetection.cpp
@@ -6,6 +6,10 @@
#include "utility/path_detector/java_runtime/JavaPathDetectorMac.h"
#include "utility/path_detector/java_runtime/JavaPathDetectorWindows.h"
+#include "utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorLinux.h"
+#include "utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorMac.h"
+#include "utility/path_detector/jre_system_library/JreSystemLibraryPathDetectorWindows.h"
+
#include "utility/path_detector/maven_executable/MavenPathDetectorUnix.h"
#include "utility/path_detector/maven_executable/MavenPathDetectorWindows.h"
@@ -32,6 +36,25 @@ std::shared_ptr utility::getJavaRuntimePathDetector()
return combinedDetector;
}
+std::shared_ptr utility::getJreSystemLibraryPathsDetector()
+{
+ std::shared_ptr combinedDetector = std::make_shared();
+ if (QSysInfo::windowsVersion() != QSysInfo::WV_None)
+ {
+ combinedDetector->addDetector(std::make_shared("1.8"));
+ }
+ else if (QSysInfo::macVersion() != QSysInfo::MV_None)
+ {
+ combinedDetector->addDetector(std::make_shared("1.8"));
+ }
+ else
+ {
+ combinedDetector->addDetector(std::make_shared("1.8"));
+ }
+
+ return combinedDetector;
+}
+
std::shared_ptr utility::getMavenExecutablePathDetector()
{
std::shared_ptr combinedDetector = std::make_shared();
diff --git a/src/lib_gui/utility/utilityPathDetection.h b/src/lib_gui/utility/utilityPathDetection.h
index 0030e321..893c97fd 100644
--- a/src/lib_gui/utility/utilityPathDetection.h
+++ b/src/lib_gui/utility/utilityPathDetection.h
@@ -6,6 +6,7 @@
namespace utility
{
std::shared_ptr getJavaRuntimePathDetector();
+ std::shared_ptr getJreSystemLibraryPathsDetector();
std::shared_ptr getMavenExecutablePathDetector();
std::shared_ptr getCxxVsHeaderPathDetector();
diff --git a/src/lib_java/project/SourceGroupJava.cpp b/src/lib_java/project/SourceGroupJava.cpp
index 722c5a29..7c5cb62b 100644
--- a/src/lib_java/project/SourceGroupJava.cpp
+++ b/src/lib_java/project/SourceGroupJava.cpp
@@ -184,7 +184,7 @@ std::vector SourceGroupJava::getClassPath()
std::vector classPath;
- for (const FilePath& classpath: m_settings->getClasspathsExpandedAndAbsolute())
+ for (const FilePath& classpath: m_settings->getClasspathExpandedAndAbsolute())
{
if (classpath.exists())
{
@@ -193,6 +193,15 @@ std::vector SourceGroupJava::getClassPath()
}
}
+ if (m_settings->getUseJreSystemLibrary())
+ {
+ for (const FilePath& systemLibraryPath: ApplicationSettings::getInstance()->getJreSystemLibraryPathsExpanded())
+ {
+ LOG_INFO("Adding JRE system library path to classpath: " + systemLibraryPath.str());
+ classPath.push_back(systemLibraryPath);
+ }
+ }
+
if (m_settings->getMavenDependenciesDirectoryExpandedAndAbsolute().exists())
{
std::vector mavenJarPaths = FileSystem::getFilePathsFromDirectory(