diff --git a/src/project-settings/assets/classpath/features/ClasspathConfigurationView.tsx b/src/project-settings/assets/classpath/features/ClasspathConfigurationView.tsx
index be9d475d..889a940f 100644
--- a/src/project-settings/assets/classpath/features/ClasspathConfigurationView.tsx
+++ b/src/project-settings/assets/classpath/features/ClasspathConfigurationView.tsx
@@ -5,7 +5,6 @@ import React, { useEffect } from "react";
import { useSelector, useDispatch } from "react-redux";
import { Dispatch } from "@reduxjs/toolkit";
import Output from "./components/Output";
-import ProjectSelector from "./components/ProjectSelector";
import Sources from "./components/Sources";
import Libraries from "./components/Libraries";
import Exception from "./components/Exception";
@@ -16,7 +15,7 @@ import { ClasspathRequest } from "../../vscode/utils";
import { VSCodePanelTab, VSCodePanelView, VSCodePanels, VSCodeProgressRing } from "@vscode/webview-ui-toolkit/react";
import { ProjectType } from "../../../../utils/webview";
import UnmanagedFolderSources from "./components/UnmanagedFolderSources";
-import Footer from "./components/Footer";
+import Hint from "./components/Hint";
import "../style.scss";
import { listProjects, setProjectType } from "../../mainpage/features/commonSlice";
@@ -39,35 +38,32 @@ const ClasspathConfigurationView = (): JSX.Element => {
content = ;
} else {
content = (
-
-
-
-
- onClickTab("source")}>Sources
- onClickTab("jdk")}>JDK Runtime
- onClickTab("libraries")}>Libraries
-
- {[ProjectType.Gradle, ProjectType.Maven].includes(projectType) && ()}
- {projectType !== ProjectType.Gradle && projectType !== ProjectType.Maven && ()}
- {projectType === ProjectType.UnmanagedFolder && ()}
-
-
-
-
-
-
-
-
-
-
+
+
+ onClickTab("source")}>Sources
+ onClickTab("jdk")}>JDK Runtime
+ onClickTab("libraries")}>Libraries
+
+ {[ProjectType.Gradle, ProjectType.Maven].includes(projectType) && ()}
+ {projectType !== ProjectType.Gradle && projectType !== ProjectType.Maven && ()}
+ {projectType === ProjectType.UnmanagedFolder && ()}
+
+
+
+
+
+
+
+
+
);
}
const onMessage = (event: any) => {
- const {data} = event;
+ const { data } = event;
if (data.command === "classpath.onDidListProjects") {
- dispatch(initializeProjectsData({projectsNum: data.projectInfo?.length}));
+ dispatch(initializeProjectsData({ projectsNum: data.projectInfo?.length }));
dispatch(listProjects(data.projectInfo));
} else if (data.command === "classpath.onDidListVmInstalls") {
dispatch(listVmInstalls(data.vmInstalls))
@@ -98,11 +94,7 @@ const ClasspathConfigurationView = (): JSX.Element => {
}
}, []);
- return (
-
- {content}
-
- );
+ return content;
};
export default ClasspathConfigurationView;
diff --git a/src/project-settings/assets/classpath/features/components/Hint.tsx b/src/project-settings/assets/classpath/features/components/Hint.tsx
new file mode 100644
index 00000000..a942713e
--- /dev/null
+++ b/src/project-settings/assets/classpath/features/components/Hint.tsx
@@ -0,0 +1,51 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT license.
+
+import { VSCodeLink} from "@vscode/webview-ui-toolkit/react";
+import React, { useEffect } from "react";
+import { ProjectInfo } from "../../../../handlers/classpath/types";
+import { useSelector } from "react-redux";
+import { ProjectType } from "../../../../../utils/webview";
+import { updateMaxHeight } from "../../utils";
+import { ClasspathRequest } from "../../../vscode/utils";
+
+const Hint = (): JSX.Element => {
+
+ const activeProjectIndex: number = useSelector((state: any) => state.commonConfig.ui.activeProjectIndex);
+ const projects: ProjectInfo[] = useSelector((state: any) => state.commonConfig.data.projects);
+ const projectType: ProjectType[] = useSelector((state: any) => state.commonConfig.data.projectType);
+
+ let buildFile: string = "";
+ if (projectType[activeProjectIndex] === ProjectType.Maven) {
+ buildFile = "pom.xml";
+ } else if (projectType[activeProjectIndex] === ProjectType.Gradle) {
+ buildFile = "build.gradle";
+ }
+
+ const handleOpenBuildFile = () => {
+ ClasspathRequest.onClickGotoProjectConfiguration(projects[activeProjectIndex].rootPath, projectType[activeProjectIndex]);
+ };
+
+ useEffect(() => {
+ updateMaxHeight();
+ window.addEventListener('resize', updateMaxHeight);
+ return () => {
+ window.removeEventListener("resize", updateMaxHeight);
+ }
+ }, [projectType]);
+
+ return (
+
+ {(projectType[activeProjectIndex] === ProjectType.Gradle || projectType[activeProjectIndex] === ProjectType.Maven) &&
+
+
+ '{projects[activeProjectIndex].name}' is imported by {projectType[activeProjectIndex]}, changes made to the classpath might be lost after reloading.
+ To make permanent changes, please edit the handleOpenBuildFile()}>{buildFile} file.
+
+
+ }
+
+ );
+};
+
+export default Hint;
diff --git a/src/project-settings/assets/classpath/features/components/JdkRuntime.tsx b/src/project-settings/assets/classpath/features/components/JdkRuntime.tsx
index 2c04188c..2159e794 100644
--- a/src/project-settings/assets/classpath/features/components/JdkRuntime.tsx
+++ b/src/project-settings/assets/classpath/features/components/JdkRuntime.tsx
@@ -2,7 +2,7 @@
// Licensed under the MIT license.
import React, { Dispatch, useEffect, useState } from "react";
-import { ClasspathRequest } from "../../../vscode/utils";
+import { ClasspathRequest, CommonRequest } from "../../../vscode/utils";
import { VSCodeDivider, VSCodeDropdown, VSCodeOption, } from "@vscode/webview-ui-toolkit/react";
import { useDispatch, useSelector } from "react-redux";
import { VmInstall } from "../../../../handlers/classpath/types";
@@ -22,7 +22,7 @@ const JdkRuntime = (): JSX.Element => {
if (path === "add-new-jdk") {
ClasspathRequest.onWillAddNewJdk();
} else if (path === "download-jdk") {
- ClasspathRequest.onWillExecuteCommand("java.installJdk")
+ CommonRequest.onWillExecuteCommand("java.installJdk")
} else {
dispatch(setJdks({
activeProjectIndex,
diff --git a/src/project-settings/assets/classpath/features/components/UnmanagedFolderSources.tsx b/src/project-settings/assets/classpath/features/components/UnmanagedFolderSources.tsx
index cb395793..13ad3d5c 100644
--- a/src/project-settings/assets/classpath/features/components/UnmanagedFolderSources.tsx
+++ b/src/project-settings/assets/classpath/features/components/UnmanagedFolderSources.tsx
@@ -68,7 +68,7 @@ const UnmanagedFolderSources = (): JSX.Element => {
setHoveredRow(`sources-${index}`)} onMouseLeave={() => setHoveredRow(null)} key={source.path}>
-
+
{source.path}
{hoveredRow === `sources-${index}` && projectType === ProjectType.UnmanagedFolder && (
diff --git a/src/project-settings/assets/classpath/style.scss b/src/project-settings/assets/classpath/style.scss
index 435c700d..af1fdf40 100644
--- a/src/project-settings/assets/classpath/style.scss
+++ b/src/project-settings/assets/classpath/style.scss
@@ -1,18 +1,13 @@
.root {
- min-width: 560px;
- margin: 8px 18px 0;
+ display: flex;
+ flex-direction: column;
+ justify-content: space-between;
+ flex: 1;
}
.setting-header {
color: var(--vscode-settings-headerForeground);
}
-
-.setting-footer {
- position: fixed;
- bottom: 0;
- width: 80%;
- background: var(--background);
-}
.setting-section {
width: 100%;
diff --git a/src/project-settings/assets/classpath/utils.ts b/src/project-settings/assets/classpath/utils.ts
index 32948b1a..d9934ff9 100644
--- a/src/project-settings/assets/classpath/utils.ts
+++ b/src/project-settings/assets/classpath/utils.ts
@@ -10,6 +10,10 @@ export const updateMaxHeight = () => {
if (projectSelector) {
maxHeight -= projectSelector.getBoundingClientRect().height;
}
+ const hinter = document.getElementById("hint");
+ if (hinter) {
+ maxHeight -= hinter.getBoundingClientRect().height;
+ }
const footer = document.getElementById("footer");
if (footer) {
maxHeight -= footer.getBoundingClientRect().height;
diff --git a/src/project-settings/assets/mainpage/features/ProjectSettingView.tsx b/src/project-settings/assets/mainpage/features/ProjectSettingView.tsx
index 32c4ba47..2ba3a99b 100644
--- a/src/project-settings/assets/mainpage/features/ProjectSettingView.tsx
+++ b/src/project-settings/assets/mainpage/features/ProjectSettingView.tsx
@@ -7,6 +7,10 @@ import ClasspathConfigurationView from "../../classpath/features/ClasspathConfig
import { updateActiveTab } from "../../classpath/features/classpathConfigurationViewSlice";
import "../style.scss";
import { updateActiveSection } from "./commonSlice";
+import ProjectSelector from "./component/ProjectSelector";
+import { VSCodeDivider } from "@vscode/webview-ui-toolkit/react";
+import Footer from "./component/Footer";
+import SideBar from "./component/SideBar";
const ProjectSettingView = (): JSX.Element => {
const activeSection: string = useSelector((state: any) => state.commonConfig.ui.activeSection);
@@ -35,7 +39,7 @@ const ProjectSettingView = (): JSX.Element => {
if (routes.length > 1) {
switch (routes[0]) {
case "classpath":
- // TODO: sometimes when directly trigger 'COnfigure Java Runtime', the tab won't
+ // TODO: sometimes when directly trigger 'Configure Java Runtime', the tab won't
// focus to the JDK part, need to investigate
dispatch(updateActiveTab(routes[1]));
break;
@@ -46,26 +50,20 @@ const ProjectSettingView = (): JSX.Element => {
}
}
- const onClickNavBarItem = (panelId: string) => {
- dispatch(updateActiveSection(panelId));
- };
-
return (
-
-
-
-
-
onClickNavBarItem("classpath")}>
- Classpath
-
-
-
-
-
+
+
);
};
diff --git a/src/project-settings/assets/classpath/features/components/Footer.tsx b/src/project-settings/assets/mainpage/features/component/Footer.tsx
similarity index 59%
rename from src/project-settings/assets/classpath/features/components/Footer.tsx
rename to src/project-settings/assets/mainpage/features/component/Footer.tsx
index 82ddf12b..8b7fa0f1 100644
--- a/src/project-settings/assets/classpath/features/components/Footer.tsx
+++ b/src/project-settings/assets/mainpage/features/component/Footer.tsx
@@ -1,19 +1,17 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
-import { VSCodeButton, VSCodeDivider, VSCodeLink} from "@vscode/webview-ui-toolkit/react";
+import { VSCodeButton } from "@vscode/webview-ui-toolkit/react";
import { Dispatch } from "@reduxjs/toolkit";
import React, { useEffect } from "react";
import { ClasspathEntry, ProjectInfo } from "../../../../handlers/classpath/types";
import { useDispatch, useSelector } from "react-redux";
import { ProjectType } from "../../../../../utils/webview";
-import { updateMaxHeight } from "../../utils";
-import { updateLoadingState } from "../classpathConfigurationViewSlice";
+import { updateLoadingState } from "../../../classpath/features/classpathConfigurationViewSlice";
import { ClasspathRequest } from "../../../vscode/utils";
const Footer = (): JSX.Element => {
- const activeProjectIndex: number = useSelector((state: any) => state.commonConfig.ui.activeProjectIndex);
const projects: ProjectInfo[] = useSelector((state: any) => state.commonConfig.data.projects);
const sources: ClasspathEntry[][] = useSelector((state: any) => state.classpathConfig.data.sources);
const defaultOutput: string[] = useSelector((state: any) => state.classpathConfig.data.output);
@@ -24,17 +22,6 @@ const Footer = (): JSX.Element => {
const dispatch: Dispatch
= useDispatch();
- let buildFile: string = "";
- if (projectType[activeProjectIndex] === ProjectType.Maven) {
- buildFile = "pom.xml";
- } else if (projectType[activeProjectIndex] === ProjectType.Gradle) {
- buildFile = "build.gradle";
- }
-
- const handleOpenBuildFile = () => {
- ClasspathRequest.onClickGotoProjectConfiguration(projects[activeProjectIndex].rootPath, projectType[activeProjectIndex]);
- };
-
const handleApply = () => {
ClasspathRequest.onWillUpdateClassPaths(
projects.map(p => p.rootPath),
@@ -60,25 +47,8 @@ const Footer = (): JSX.Element => {
}
}, []);
- useEffect(() => {
- updateMaxHeight();
- window.addEventListener('resize', updateMaxHeight);
- return () => {
- window.removeEventListener("resize", updateMaxHeight);
- }
- }, [projectType]);
-
return (
-