Repository: apache/incubator-kie-tools
Pull request #3031: [kie-issues#1878] Make it possible to import Data Types from Java classes on the new DMN Editor
Author: login: Adarshvk98
Labels: name: area:dmn
Created: 2025-03-26T08:13:01Z | Merged: 2025-04-15T14:53:31Z

Closes [issue #1878](https://github.com/apache/incubator-kie-issues/issues/1878)  

Based on the initial development PR [#751](https://github.com/apache/incubator-kie-tools/pull/751).

**Showcase :** 

https://github.com/user-attachments/assets/912806da-cf80-4bec-8ab8-9bf12453e4d9


### Key Features

1. Integrates the Import Java Classes Component into the New DMN Editor
2. This feature is only available when the DMN Editor is run inside VS Code Extensions

### Important Considerations

When importing Java classes, the system checks for existing DMN data types that match the selected classes. If a match is found, the user is prompted to decide how to proceed. The user can choose to either:

- Replace the existing type
- Keep both versions as separate types (following the DMN Data Type naming convention: `<class-name>, or <class-name>-<count>` if multiple classes have the same name)

### Future Improvements

- Currently, attributes converted to DMN types do not support lists (collections). it will be good to add support in near future.


Diff:
diff --git a/packages/dmn-editor-envelope/package.json b/packages/dmn-editor-envelope/package.json
index c321f00872c..39df1553aa3 100644
--- a/packages/dmn-editor-envelope/package.json
+++ b/packages/dmn-editor-envelope/package.json
@@ -28,6 +28,7 @@
     "@kie-tools-core/keyboard-shortcuts": "workspace:*",
     "@kie-tools-core/notifications": "workspace:*",
     "@kie-tools-core/react-hooks": "workspace:*",
+    "@kie-tools-core/vscode-java-code-completion": "workspace:*",
     "@kie-tools-core/workspace": "workspace:*",
     "@kie-tools/boxed-expression-component": "workspace:*",
     "@kie-tools/dmn-editor": "workspace:*",
diff --git a/packages/dmn-editor-envelope/src/DmnEditorFactory.tsx b/packages/dmn-editor-envelope/src/DmnEditorFactory.tsx
index 3b024375cf2..61e00ddb636 100644
--- a/packages/dmn-editor-envelope/src/DmnEditorFactory.tsx
+++ b/packages/dmn-editor-envelope/src/DmnEditorFactory.tsx
@@ -18,6 +18,7 @@
  */
 
 import * as React from "react";
+import { useCallback, useMemo } from "react";
 import {
   Editor,
   EditorFactory,
@@ -26,12 +27,13 @@ import {
   KogitoEditorChannelApi,
   EditorTheme,
   DEFAULT_WORKSPACE_ROOT_ABSOLUTE_POSIX_PATH,
+  ChannelType,
   KogitoEditorEnvelopeApi,
 } from "@kie-tools-core/editor/dist/api";
 import { Notification } from "@kie-tools-core/notifications/dist/api";
-import { DmnEditorRoot } from "./DmnEditorRoot";
 import { ResourceContent, ResourcesList, WorkspaceEdit } from "@kie-tools-core/workspace/dist/api";
-import { useCallback } from "react";
+import { DmnEditorRoot, JavaCodeCompletionExposedInteropApi } from "./DmnEditorRoot";
+import { VsCodeNewDmnEditorEnvelopeContext } from "./vscode/VsCodeNewDmnEditorFactory";
 
 export class DmnEditorFactory implements EditorFactory<Editor, KogitoEditorEnvelopeApi, KogitoEditorChannelApi> {
   public createEditor(
@@ -98,6 +100,7 @@ export class DmnEditorInterface implements Editor {
           this.initArgs.workspaceRootAbsolutePosixPath ?? DEFAULT_WORKSPACE_ROOT_ABSOLUTE_POSIX_PATH
         }
         isReadOnly={this.initArgs.isReadOnly}
+        channelType={this.initArgs?.channel}
       />
     );
   }
@@ -109,12 +112,14 @@ export function DmnEditorRootWrapper({
   exposing,
   workspaceRootAbsolutePosixPath,
   isReadOnly,
+  channelType,
   onOpenedBoxedExpressionEditorNodeChange,
 }: {
   envelopeContext?: KogitoEditorEnvelopeContextType<KogitoEditorEnvelopeApi, KogitoEditorChannelApi>;
   exposing: (s: DmnEditorRoot) => void;
   workspaceRootAbsolutePosixPath: string;
   isReadOnly: boolean;
+  channelType?: ChannelType;
   onOpenedBoxedExpressionEditorNodeChange?: (newOpenedNodeId: string | undefined) => void;
 }) {
   const onNewEdit = useCallback(
@@ -149,6 +154,23 @@ export function DmnEditorRootWrapper({
     [envelopeContext]
   );
 
+  const isImportDataTypesFromJavaClassesSupported = useMemo(
+    (): boolean => channelType === ChannelType.VSCODE_DESKTOP || channelType === ChannelType.VSCODE_WEB,
+    [channelType]
+  );
+
+  const javaCodeCompletionService = useMemo((): JavaCodeCompletionExposedInteropApi | undefined => {
+    if (isImportDataTypesFromJavaClassesSupported) {
+      const { channelApi } = envelopeContext as VsCodeNewDmnEditorEnvelopeContext;
+      return {
+        getFields: (fqcn: string, query: string = "") =>
+          channelApi?.requests?.kogitoJavaCodeCompletion__getAccessors(fqcn, query),
+        getClasses: (query: string) => channelApi?.requests?.kogitoJavaCodeCompletion__getClasses(query),
+        isLanguageServerAvailable: () => channelApi?.requests?.kogitoJavaCodeCompletion__isLanguageServerAvailable(),
+      };
+    }
+  }, [envelopeContext, isImportDataTypesFromJavaClassesSupported]);
+
   return (
     <DmnEditorRoot
       exposing={exposing}
@@ -162,6 +184,8 @@ export function DmnEditorRootWrapper({
       workspaceRootAbsolutePosixPath={workspaceRootAbsolutePosixPath}
       keyboardShortcutsService={envelopeContext?.services.keyboardShortcuts}
       isReadOnly={isReadOnly}
+      isImportDataTypesFromJavaClassesSupported={isImportDataTypesFromJavaClassesSupported}
+      javaCodeCompletionService={javaCodeCompletionService}
     />
   );
 }
diff --git a/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx b/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx
index e7f24569353..d73cb4abc80 100644
--- a/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx
+++ b/packages/dmn-editor-envelope/src/DmnEditorRoot.tsx
@@ -39,6 +39,10 @@ import { KeyboardShortcutsService } from "@kie-tools-core/keyboard-shortcuts/dis
 import { Flex } from "@patternfly/react-core/dist/js/layouts/Flex";
 import { EmptyState, EmptyStateBody, EmptyStateIcon } from "@patternfly/react-core/dist/js/components/EmptyState";
 import { Title } from "@patternfly/react-core/dist/js/components/Title";
+import {
+  JavaCodeCompletionAccessor,
+  JavaCodeCompletionClass,
+} from "@kie-tools-core/vscode-java-code-completion/dist/api";
 
 export const EXTERNAL_MODELS_SEARCH_GLOB_PATTERN = "**/*.{dmn,pmml}";
 export const TARGET_DIRECTORY = "target/classes/";
@@ -52,6 +56,12 @@ export const EMPTY_DMN = () => `<?xml version="1.0" encoding="UTF-8"?>
   name="DMN${generateUuid()}">
 </definitions>`;
 
+export interface JavaCodeCompletionExposedInteropApi {
+  getFields(fqcn: string): Promise<JavaCodeCompletionAccessor[]>;
+  getClasses(query: string): Promise<JavaCodeCompletionClass[]>;
+  isLanguageServerAvailable(): Promise<boolean>;
+}
+
 export type DmnEditorRootProps = {
   exposing: (s: DmnEditorRoot) => void;
   onNewEdit: (edit: WorkspaceEdit) => void;
@@ -62,6 +72,8 @@ export type DmnEditorRootProps = {
   workspaceRootAbsolutePosixPath: string;
   keyboardShortcutsService: KeyboardShortcutsService | undefined;
   isReadOnly: boolean;
+  isImportDataTypesFromJavaClassesSupported?: boolean;
+  javaCodeCompletionService?: JavaCodeCompletionExposedInteropApi;
 };
 
 export type DmnEditorRootState = {
@@ -492,6 +504,8 @@ export class DmnEditorRoot extends React.Component<DmnEditorRootProps, DmnEditor
               externalContextDescription={""}
               issueTrackerHref={""}
               isReadOnly={this.state.isReadOnly}
+              isImportDataTypesFromJavaClassesSupported={this.props?.isImportDataTypesFromJavaClassesSupported}
+              javaCodeCompletionService={this.props?.javaCodeCompletionService}
               onModelChange={this.onModelChange}
               onOpenedBoxedExpressionEditorNodeChange={this.props.onOpenedBoxedExpressionEditorNodeChange}
               onRequestExternalModelsAvailableToInclude={this.onRequestExternalModelsAvailableToInclude}
diff --git a/packages/dmn-editor-envelope/src/vscode/VsCodeNewDmnEditorFactory.tsx b/packages/dmn-editor-envelope/src/vscode/VsCodeNewDmnEditorFactory.tsx
new file mode 100644
index 00000000000..c2ac5808b94
--- /dev/null
+++ b/packages/dmn-editor-envelope/src/vscode/VsCodeNewDmnEditorFactory.tsx
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {
+  Editor,
+  EditorFactory,
+  EditorInitArgs,
+  KogitoEditorChannelApi,
+  KogitoEditorEnvelopeApi,
+  KogitoEditorEnvelopeContextType,
+} from "@kie-tools-core/editor/dist/api";
+import { JavaCodeCompletionChannelApi } from "@kie-tools-core/vscode-java-code-completion/dist/api";
+import { DmnEditorInterface } from "../DmnEditorFactory";
+
+export interface VsCodeNewDmnEditorChannelApi extends KogitoEditorChannelApi, JavaCodeCompletionChannelApi {}
+
+export type VsCodeNewDmnEditorEnvelopeContext = KogitoEditorEnvelopeContextType<
+  KogitoEditorEnvelopeApi,
+  VsCodeNewDmnEditorChannelApi
+>;
+
+export class VsCodeNewDmnEditorFactory
+  implements EditorFactory<Editor, KogitoEditorEnvelopeApi, VsCodeNewDmnEditorChannelApi>
+{
+  public createEditor(envelopeContext: VsCodeNewDmnEditorEnvelopeContext, initArgs: EditorInitArgs): Promise<Editor> {
+    return Promise.resolve(new DmnEditorInterface(envelopeContext, initArgs));
+  }
+}
diff --git a/packages/dmn-editor-envelope/src/vscode/index.ts b/packages/dmn-editor-envelope/src/vscode/index.ts
new file mode 100644
index 00000000000..7410d3d41f8
--- /dev/null
+++ b/packages/dmn-editor-envelope/src/vscode/index.ts
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+export * from "./VsCodeNewDmnEditorFactory";
diff --git a/packages/dmn-editor/package.json b/packages/dmn-editor/package.json
index 7afdbd9cd02..9d557b1b750 100644
--- a/packages/dmn-editor/package.json
+++ b/packages/dmn-editor/package.json
@@ -50,6 +50,7 @@
     "@kie-tools/dmn-marshaller": "workspace:*",
     "@kie-tools/feel-input-component": "workspace:*",
     "@kie-tools/i18n-common-dictionary": "workspace:*",
+    "@kie-tools/import-java-classes-component": "workspace:*",
     "@kie-tools/pmml-editor-marshaller": "workspace:*",
     "@kie-tools/xml-parser-ts": "workspace:*",
     "@patternfly/react-core": "^4.276.6",
diff --git a/packages/dmn-editor/src/DmnEditor.tsx b/packages/dmn-editor/src/DmnEditor.tsx
index 711b6bc69e5..0161f7e9d56 100644
--- a/packages/dmn-editor/src/DmnEditor.tsx
+++ b/packages/dmn-editor/src/DmnEditor.tsx
@@ -59,6 +59,7 @@ import "@kie-tools/dmn-marshaller/dist/kie-extensions"; // This is here because
 import "./DmnEditor.css"; // Leave it for last, as this overrides some of the PF and RF styles.
 import { Commands, CommandsContextProvider, useCommands } from "./commands/CommandsContextProvider";
 import { DmnEditorSettingsContextProvider } from "./settings/DmnEditorSettingsContext";
+import { JavaCodeCompletionService } from "@kie-tools/import-java-classes-component/dist/components/ImportJavaClasses/services";
 
 const ON_MODEL_CHANGE_DEBOUNCE_TIME_IN_MS = 500;
 
@@ -172,6 +173,14 @@ export type DmnEditorProps = {
    * but no changes can be made and the model itself is unaltered.
    */
   isReadOnly?: boolean;
+  /**
+   * Boolean flag to check whether the "Import DataTypes From JavaClasses" feature is available.
+   */
+  isImportDataTypesFromJavaClassesSupported?: boolean;
+  /**
+   * This object defines all the API methods which ImportJavaClasses component can use to dialog with the Code Completion Extension
+   */
+  javaCodeCompletionService?: JavaCodeCompletionService;
   /**
    * When users want to jump to another file, this method is called, allowing the controller of this component decide what to do.
    * Links are only rendered if this is provided. Otherwise, paths will be rendered as text.
diff --git a/packages/dmn-editor/src/dataTypes/DataTypes.tsx b/packages/dmn-editor/src/dataTypes/DataTypes.tsx
index 57551a6b931..4bb2bd9377b 100644
--- a/packages/dmn-editor/src/dataTypes/DataTypes.tsx
+++ b/packages/dmn-editor/src/dataTypes/DataTypes.tsx
@@ -50,6 +50,10 @@ import {
 import { PasteIcon } from "@patternfly/react-icons/dist/js/icons/paste-icon";
 import { InputGroup } from "@patternfly/react-core/dist/js/components/InputGroup";
 import { SearchInput } from "@patternfly/react-core/dist/js/components/SearchInput";
+import {
+  ImportJavaClassesWizard,
+  ImportJavaClassesI18nDictionariesProvider,
+} from "@kie-tools/import-java-classes-component";
 import {
   DMN_EDITOR_DATA_TYPES_CLIPBOARD_MIME_TYPE,
   DmnEditorDataTypesClipboard,
@@ -58,6 +62,8 @@ import {
 import { addTopLevelItemDefinition as _addTopLevelItemDefinition } from "../mutations/addTopLevelItemDefinition";
 import { useExternalModels } from "../includedModels/DmnEditorDependenciesContext";
 import { useSettings } from "../settings/DmnEditorSettingsContext";
+import { ImportJavaClassesDropdownItem, ImportJavaClassNameConflictsModal } from "./ImportJavaClasses";
+import { useImportJavaClasses } from "./useImportJavaClasses";
 
 export type DataType = {
   itemDefinition: Normalized<DMN15__tItemDefinition>;
@@ -93,7 +99,7 @@ export function DataTypes() {
   const thisDmnsNamespace = useDmnEditorStore((s) => s.dmn.model.definitions["@_namespace"]);
   const dmnEditorStoreApi = useDmnEditorStoreApi();
   const activeItemDefinitionId = useDmnEditorStore((s) => s.dataTypesEditor.activeItemDefinitionId);
-  const settings = useSettings();
+  const { isReadOnly, isImportDataTypesFromJavaClassesSupported, javaCodeCompletionService } = useSettings();
 
   const [filter, setFilter] = useState("");
   const { externalModelsByNamespace } = useExternalModels();
@@ -105,6 +111,13 @@ export function DataTypes() {
   );
   const dataTypesTree = useDmnEditorStore((s) => s.computed(s).getDataTypes(externalModelsByNamespace).dataTypesTree);
 
+  const [isOpenImportJavaClassesWizard, setOpenImportJavaClassesWizard] = useState(false);
+  const { conflictsClasses, handleConflictAction, handleImportJavaClasses, isConflictsOccured } =
+    useImportJavaClasses();
+  const handleImportJavaClassButtonClick = useCallback(() => {
+    setOpenImportJavaClassesWizard((prevState) => !prevState);
+  }, []);
+
   const activeDataType = useMemo(() => {
     return activeItemDefinitionId ? allDataTypesById.get(activeItemDefinitionId) : undefined;
   }, [activeItemDefinitionId, allDataTypesById]);
@@ -148,7 +161,7 @@ export function DataTypes() {
   );
 
   const pasteTopLevelItemDefinition = useCallback(() => {
-    if (settings.isReadOnly) {
+    if (isReadOnly) {
       return;
     }
     navigator.clipboard.readText().then((text) => {
@@ -169,13 +182,42 @@ export function DataTypes() {
         addTopLevelItemDefinition(itemDefinition);
       }
     });
-  }, [addTopLevelItemDefinition, settings.isReadOnly]);
+  }, [addTopLevelItemDefinition, isReadOnly]);
 
   const [isAddDataTypeDropdownOpen, setAddDataTypeDropdownOpen] = useState(false);
 
   // Using this object because DropdownToggleAction's props doesn't accept a 'title'.
   const extraPropsForDropdownToggleAction = { title: "New Data Type" };
 
+  const addDataTypesDropdownItems = useMemo(() => {
+    const dropdownItems = [
+      <DropdownItem
+        key={"paste"}
+        onClick={() => pasteTopLevelItemDefinition()}
+        style={{ minWidth: "240px" }}
+        icon={<PasteIcon />}
+      >
+        Paste
+      </DropdownItem>,
+    ];
+    if (isImportDataTypesFromJavaClassesSupported && javaCodeCompletionService) {
+      dropdownItems.unshift(
+        <ImportJavaClassesI18nDictionariesProvider key={"import-java-classes"}>
+          <ImportJavaClassesDropdownItem
+            javaCodeCompletionService={javaCodeCompletionService}
+            onClick={handleImportJavaClassButtonClick}
+          />
+        </ImportJavaClassesI18nDictionariesProvider>
+      );
+    }
+    return dropdownItems;
+  }, [
+    isImportDataTypesFromJavaClassesSupported,
+    javaCodeCompletionService,
+    handleImportJavaClassButtonClick,
+    pasteTopLevelItemDefinition,
+  ]);
+
   return (
     <>
       {(dataTypesTree.length <= 0 && (
@@ -206,7 +248,7 @@ export function DataTypes() {
                       onClear={() => setFilter("")}
                     />
 
-                    {!settings.isReadOnly && (
+                    {!isReadOnly && (
                       <Dropdown
                         onSelect={() => setAddDataTypeDropdownOpen(false)}
                         menuAppendTo={document.body}
@@ -229,16 +271,7 @@ export function DataTypes() {
                         }
                         position={DropdownPosition.right}
                         isOpen={isAddDataTypeDropdownOpen}
-                        dropdownItems={[
-                          <DropdownItem
-                            key={"paste"}
-                            onClick={() => pasteTopLevelItemDefinition()}
-                            style={{ minWidth: "240px" }}
-                            icon={<PasteIcon />}
-                          >
-                            Paste
-                          </DropdownItem>,
-                        ]}
+                        dropdownItems={addDataTypesDropdownItems}
                       />
                     )}
                   </InputGroup>
@@ -269,7 +302,7 @@ export function DataTypes() {
                         {(namespace === thisDmnsNamespace && (
                           <DataTypeName
                             relativeToNamespace={thisDmnsNamespace}
-                            isReadOnly={settings.isReadOnly || namespace !== thisDmnsNamespace}
+                            isReadOnly={isReadOnly || namespace !== thisDmnsNamespace}
                             itemDefinition={itemDefinition}
                             isActive={isActive}
                             editMode={"double-click"}
@@ -305,12 +338,29 @@ export function DataTypes() {
             <DrawerContentBody>
               {activeDataType && (
                 <DataTypePanel
-                  isReadOnly={settings.isReadOnly || activeDataType.namespace !== thisDmnsNamespace}
+                  isReadOnly={isReadOnly || activeDataType.namespace !== thisDmnsNamespace}
                   dataType={activeDataType}
                   allDataTypesById={allDataTypesById}
                   editItemDefinition={editItemDefinition}
                 />
               )}
+              {isOpenImportJavaClassesWizard && javaCodeCompletionService && (
+                <ImportJavaClassesI18nDictionariesProvider>
+                  <ImportJavaClassesWizard
+                    javaCodeCompletionService={javaCodeCompletionService}
+                    isOpen={isOpenImportJavaClassesWizard}
+                    onSave={handleImportJavaClasses}
+                    onClose={handleImportJavaClassButtonClick}
+                  />
+                </ImportJavaClassesI18nDictionariesProvider>
+              )}
+              {isConflictsOccured && conflictsClasses?.length > 0 && (
+                <ImportJavaClassNameConflictsModal
+                  isOpen={isConflictsOccured}
+                  handleConfirm={handleConflictAction}
+                  confliectedJavaClasses={conflictsClasses}
+                />
+              )}
             </DrawerContentBody>
           </DrawerContent>
         </Drawer>
diff --git a/packages/dmn-editor/src/dataTypes/DataTypesEmptyState.tsx b/packages/dmn-editor/src/dataTypes/DataTypesEmptyState.tsx
index ce8da83ea4e..3e71841dc0f 100644
--- a/packages/dmn-editor/src/dataTypes/DataTypesEmptyState.tsx
+++ b/packages/dmn-editor/src/dataTypes/DataTypesEmptyState.tsx
@@ -31,9 +31,10 @@ import { Title } from "@patternfly/react-core/dist/js/components/Title";
 import { CubesIcon } from "@patternfly/react-icons/dist/js/icons/cubes-icon";
 import { PasteIcon } from "@patternfly/react-icons/dist/js/icons/paste-icon";
 import { useSettings } from "../settings/DmnEditorSettingsContext";
+import { ImportJavaClassesWrapper } from "./ImportJavaClasses";
 
 export function DataTypesEmptyState({ onAdd, onPaste }: { onAdd: () => void; onPaste: () => void }) {
-  const settings = useSettings();
+  const { isReadOnly, isImportDataTypesFromJavaClassesSupported, javaCodeCompletionService } = useSettings();
 
   return (
     <Flex justifyContent={{ default: "justifyContentCenter" }} style={{ marginTop: "100px" }}>
@@ -46,7 +47,7 @@ export function DataTypesEmptyState({ onAdd, onPaste }: { onAdd: () => void; onP
           {`Data types are referenced in the input and output values for decision tables. Custom data types allow you to reference more complex data types, beyond the simple "default" types.`}
         </EmptyStateBody>
         <br />
-        {!settings.isReadOnly && (
+        {!isReadOnly && (
           <>
             <EmptyStatePrimary>
               <Button variant={ButtonVariant.primary} onClick={onAdd}>
@@ -54,9 +55,17 @@ export function DataTypesEmptyState({ onAdd, onPaste }: { onAdd: () => void; onP
               </Button>
             </EmptyStatePrimary>
             <br />
-            <br />
+            {isImportDataTypesFromJavaClassesSupported && javaCodeCompletionService && (
+              <>
+                or
+                <br />
+                <br />
+                <ImportJavaClassesWrapper javaCodeCompletionService={javaCodeCompletionService} />
+                <br />
+                <br />
+              </>
+            )}
             or
-            <br />
             <EmptyStateSecondaryActions>
               <Button variant={ButtonVariant.link} onClick={onPaste} icon={<PasteIcon />}>
                 Paste data type
diff --git a/packages/dmn-editor/src/dataTypes/ImportJavaClasses.tsx b/packages/dmn-editor/src/dataTypes/ImportJavaClasses.tsx
new file mode 100644
index 00000000000..897b620bbc5
--- /dev/null
+++ b/packages/dmn-editor/src/dataTypes/ImportJavaClasses.tsx
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import * as React from "react";
+import { useCallback, useState } from "react";
+import { DropdownItem } from "@patternfly/react-core/dist/js/components/Dropdown";
+import { Spinner } from "@patternfly/react-core/dist/esm/components/Spinner";
+import PlusIcon from "@patternfly/react-icons/dist/js/icons/plus-icon";
+import { Tooltip } from "@patternfly/react-core/dist/js/components/Tooltip";
+import { Modal, ModalVariant } from "@patternfly/react-core/dist/js/components/Modal";
+import { Button } from "@patternfly/react-core/dist/js/components/Button";
+import { TextContent, Text, TextVariants } from "@patternfly/react-core/dist/js/components/Text";
+import {
+  ImportJavaClasses,
+  JavaClass,
+  JavaCodeCompletionService,
+  useImportJavaClassesWizardI18n,
+  useLanguageServerAvailable,
+} from "@kie-tools/import-java-classes-component";
+import { addTopLevelItemDefinition as _addTopLevelItemDefinition } from "../mutations/addTopLevelItemDefinition";
+import { JavaClassConflictOptions, useImportJavaClasses } from "./useImportJavaClasses";
+import { Radio } from "@patternfly/react-core/dist/esm/components/Radio";
+
+const ImportJavaClassesWrapper = ({
+  javaCodeCompletionService,
+}: {
+  javaCodeCompletionService: JavaCodeCompletionService;
+}) => {
+  const { handleConflictAction, handleImportJavaClasses, conflictsClasses, isConflictsOccured } =
+    useImportJavaClasses();
+  return (
+    <>
+      <ImportJavaClasses
+        loadJavaClassesInDataTypeEditor={handleImportJavaClasses}
+        javaCodeCompletionService={javaCodeCompletionService}
+      />
+      {isConflictsOccured && conflictsClasses?.length > 0 && (
+        <ImportJavaClassNameConflictsModal
+          isOpen={isConflictsOccured}
+          handleConfirm={handleConflictAction}
+          confliectedJavaClasses={conflictsClasses}
+        />
+      )}
+    </>
+  );
+};
+
+const ImportJavaClassesDropdownItem = ({
+  javaCodeCompletionService,
+  ...props
+}: React.ComponentProps<typeof DropdownItem> & { javaCodeCompletionService: JavaCodeCompletionService }) => {
+  const { i18n } = useImportJavaClassesWizardI18n();
+  const { isLanguageServerLoading, isLanguageServerDisabled, isLanguageServerError } =
+    useLanguageServerAvailable(javaCodeCompletionService);
+  const defineTooltipMessage = React.useCallback(() => {
+    if (isLanguageServerDisabled) {
+      return i18n.modalButton.disabledMessage;
+    } else if (isLanguageServerError) {
+      return i18n.modalButton.errorMessage;
+    }
+    return undefined;
+  }, [
+    isLanguageServerDisabled,
+    isLanguageServerError,
+    i18n.modalButton.disabledMessage,
+    i18n.modalButton.errorMessage,
+  ]);
+  return (
+    <>
+      {defineTooltipMessage() ? (
+        <Tooltip content={defineTooltipMessage()}>
+          <DropdownItem
+            style={{ minWidth: "240px" }}
+            icon={isLanguageServerLoading ? <Spinner size="md" /> : <PlusIcon />}
+            isDisabled={isLanguageServerDisabled || isLanguageServerLoading}
+            {...props}
+          >
+            {i18n.modalButton.text}
+          </DropdownItem>
+        </Tooltip>
+      ) : (
+        <DropdownItem
+          style={{ minWidth: "240px" }}
+          icon={isLanguageServerLoading ? <Spinner size="md" /> : <PlusIcon />}
+          isDisabled={isLanguageServerDisabled || isLanguageServerLoading}
+          {...props}
+        >
+          {i18n.modalButton.text}
+        </DropdownItem>
+      )}
+    </>
+  );
+};
+
+const ImportJavaClassNameConflictsModal = ({
+  isOpen,
+  handleConfirm,
+  confliectedJavaClasses,
+}: {
+  isOpen: boolean;
+  handleConfirm: (options: JavaClassConflictOptions) => void;
+  confliectedJavaClasses: JavaClass[];
+}) => {
+  const [action, setAction] = useState<JavaClassConflictOptions>(JavaClassConflictOptions.REPLACE);
+  const handleActionButtonClick = useCallback(() => handleConfirm?.(action), [handleConfirm, action]);
+  const handleRadioBtnClick = useCallback((_, e) => setAction?.(e?.target?.name), []);
+  const classNames = confliectedJavaClasses?.map((javaClass) => javaClass?.name);
+  return (
+    <Modal
+      title="Duplicate DMN Data Type Detected"
+      titleIconVariant="warning"
+      aria-describedby="modal-import-java-classes-conflict-description"
+      showClose={false}
+      isOpen={isOpen}
+      variant={ModalVariant.small}
+      position="top"
+      actions={[
+        <Button key="import-java-classes-conflict-btn" variant="primary" onClick={handleActionButtonClick}>
+          Import
+        </Button>,
+      ]}
+    >
+      <TextContent>
+        {classNames?.length === 1 ? (
+          <Text component={TextVariants.p}>
+            An existing DMN type named <b>{classNames?.join()}</b> has been detected. This type is currently in use
+            within the system. How would you like to proceed?
+          </Text>
+        ) : (
+          <Text component={TextVariants.p}>
+            Multiple DMN types have been detected in the list. The following DMN types are currently in use within the
+            system <b>{classNames?.join()}</b>. How would you like to proceed?
+          </Text>
+        )}
+        <Text
+          component={TextVariants.blockquote}
+          style={{ background: "none", display: "flex", flexDirection: "column", gap: "1rem" }}
+        >
+          <Radio
+            isChecked={action === JavaClassConflictOptions.REPLACE}
+            id={`radio-${JavaClassConflictOptions.REPLACE}`}
+            label={JavaClassConflictOptions.REPLACE}
+            name={JavaClassConflictOptions.REPLACE}
+            onChange={handleRadioBtnClick}
+            description="This option will replace the existing DMN type with the new one."
+            isLabelWrapped={true}
+          />
+          <Radio
+            isChecked={action === JavaClassConflictOptions.KEEP_BOTH}
+            id={`radio-${JavaClassConflictOptions.KEEP_BOTH}`}
+            label={JavaClassConflictOptions.KEEP_BOTH}
+            name={JavaClassConflictOptions.KEEP_BOTH}
+            onChange={handleRadioBtnClick}
+            description="This option will preserve the existing DMN type and create a new one with a unique name."
+            isLabelWrapped={true}
+          />
+        </Text>
+      </TextContent>
+    </Modal>
+  );
+};
+
+export { ImportJavaClassesWrapper, ImportJavaClassesDropdownItem, ImportJavaClassNameConflictsModal };
diff --git a/packages/dmn-editor/src/dataTypes/useImportJavaClasses.ts b/packages/dmn-editor/src/dataTypes/useImportJavaClasses.ts
new file mode 100644
index 00000000000..4200586a4d1
--- /dev/null
+++ b/packages/dmn-editor/src/dataTypes/useImportJavaClasses.ts
@@ -0,0 +1,272 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { useCallback, useMemo, useState } from "react";
+import { JavaClass } from "@kie-tools/import-java-classes-component";
+import { useExternalModels } from "../includedModels/DmnEditorDependenciesContext";
+import { useDmnEditorStore, useDmnEditorStoreApi } from "../store/StoreContext";
+import { findDataTypeById, getNewItemDefinition } from "./DataTypeSpec";
+import { EditItemDefinition } from "./DataTypes";
+
+const NAME_SEPARATOR: string = "-";
+
+export enum JavaClassConflictOptions {
+  REPLACE = "Replace",
+  KEEP_BOTH = "Keep Both",
+}
+
+const useImportJavaClasses = () => {
+  const [isConflictsOccured, setIsConflictsOccured] = useState<boolean>(false);
+  const [conflictsClasses, setConflictsClasses] = useState<JavaClass[]>([]);
+
+  const dmnEditorStoreApi = useDmnEditorStoreApi();
+  const { externalModelsByNamespace } = useExternalModels();
+  const allDataTypesById = useDmnEditorStore(
+    (s) => s.computed(s).getDataTypes(externalModelsByNamespace).allDataTypesById
+  );
+  const dataTypesTree = useDmnEditorStore((s) => s.computed(s).getDataTypes(externalModelsByNamespace).dataTypesTree);
+
+  const dataTypeNames = useMemo(() => {
+    const dataTypeNames = new Set<string>();
+    for (let i = 0, len = dataTypesTree?.length; i < len; i++) {
+      dataTypeNames.add(dataTypesTree?.[i]?.feelName || dataTypesTree?.[i]?.itemDefinition?.["@_name"]);
+    }
+    return dataTypeNames;
+  }, [dataTypesTree]);
+
+  const buildName = useCallback(
+    (nameCandidate: string, namesCount: Map<string, number>, nameSeparator: string = NAME_SEPARATOR): string => {
+      if (namesCount.has(nameCandidate)) {
+        const occurrences = namesCount.get(nameCandidate)!;
+        namesCount.set(nameCandidate, occurrences + 1);
+        return nameCandidate + nameSeparator + occurrences;
+      }
+      namesCount.set(nameCandidate, 1);
+      return nameCandidate;
+    },
+    []
+  );
+
+  const updatePropertiesReferences = useCallback(
+    (javaClasses: JavaClass[], javaClassNameToDMNTypeNameMap: Map<string, string>): JavaClass[] => {
+      return javaClasses.map((javaClass) => {
+        const namesCount: Map<string, number> = new Map();
+        const updatedFields = (javaClass ?? [])?.fields?.map((field) => {
+          const newFieldName = buildName(field?.name, namesCount);
+          if (javaClassNameToDMNTypeNameMap.has(field.type)) {
+            const renamedFieldType = javaClassNameToDMNTypeNameMap.get(field.type)!;
+            return { ...field, name: newFieldName, dmnTypeRef: renamedFieldType };
+          }
+          return { ...field, name: newFieldName };
+        });
+        return { ...javaClass, fields: updatedFields } as JavaClass;
+      });
+    },
+    [buildName]
+  );
+
+  const editItemDefinition = useCallback<EditItemDefinition>(
+    (id, consumer) => {
+      dmnEditorStoreApi.setState((state) => {
+        const { itemDefinition, items, index } = findDataTypeById({
+          definitions: state.dmn.model.definitions,
+          itemDefinitionId: id,
+          allDataTypesById,
+        });
+
+        state.dmn.model.definitions.itemDefinition ??= [];
+        consumer(itemDefinition, items, index, state.dmn.model.definitions.itemDefinition, state);
+      });
+    },
+    [allDataTypesById, dmnEditorStoreApi]
+  );
+
+  const renameJavaClassToDMNName = useCallback(
+    (javaClasses: JavaClass[]): JavaClass[] => {
+      const namesCount: Map<string, number> = new Map();
+      const javaClassNameToDMNTypeNameMap: Map<string, string> = new Map();
+
+      // Map the javaClasses to new renamed classes
+      const renamedJavaClasses = javaClasses.map((javaClass: JavaClass) => {
+        const nameCandidate = javaClass.name.substring(javaClass.name.lastIndexOf(".") + 1);
+        const newName = buildName(nameCandidate, namesCount);
+        javaClassNameToDMNTypeNameMap.set(javaClass.name, newName);
+        return { ...javaClass, name: newName } as JavaClass;
+      });
+
+      // Return the updated Java classes with renamed types
+      return updatePropertiesReferences(renamedJavaClasses, javaClassNameToDMNTypeNameMap);
+    },
+    [updatePropertiesReferences, buildName]
+  );
+
+  const generateUniqueDmnTypeNames = useCallback(
+    (javaClasses: JavaClass[], nameSeparator: string = NAME_SEPARATOR): JavaClass[] => {
+      const namesCount: Map<string, number> = new Map();
+      const javaClassNameToDMNTypeNameMap: Map<string, string> = new Map();
+
+      // Map the javaClasses to new renamed classes
+      const renamedJavaClasses = javaClasses.map((javaClass: JavaClass) => {
+        let newName = javaClass.name;
+
+        // Check if the name already exists in dataTypeNames
+        if (dataTypeNames.has(newName)) {
+          // Initialize counter for this name if it doesn't exist yet
+          if (!namesCount.has(newName)) {
+            namesCount.set(newName, 0);
+          }
+
+          // Increment counter and append it to name until we find a unique one
+          let counter = namesCount.get(newName)!;
+          do {
+            counter++;
+            newName = javaClass.name + nameSeparator + counter;
+          } while (dataTypeNames.has(newName));
+
+          // Update the counter for this base name
+          namesCount.set(javaClass.name, counter);
+        } else {
+          // If it's a new name, add it to our tracking
+          namesCount.set(javaClass.name, 0);
+        }
+
+        // Store the mapping from original class name to new DMN name
+        javaClassNameToDMNTypeNameMap.set(javaClass.name, newName);
+        return { ...javaClass, name: newName } as JavaClass;
+      });
+
+      // Return the updated Java classes with renamed types and references
+      return updatePropertiesReferences(renamedJavaClasses, javaClassNameToDMNTypeNameMap);
+    },
+    [updatePropertiesReferences, dataTypeNames]
+  );
+
+  const overwriteExistingDMNTypes = useCallback(
+    (javaClasses: JavaClass[]) => {
+      for (let i = 0, len = javaClasses?.length; i < len; i++) {
+        const className = javaClasses?.[i]?.name;
+        if (dataTypeNames?.has(className)) {
+          const dataType = dataTypesTree?.find(
+            (type) => type?.feelName === className || type?.itemDefinition?.["@_name"] === className
+          );
+          if (dataType && dataType?.itemDefinition?.["@_id"]) {
+            const itemComponents = javaClasses?.[i]?.fields?.map((field) =>
+              getNewItemDefinition({ "@_name": field?.name, typeRef: { __$$text: field?.dmnTypeRef } })
+            );
+            if (itemComponents && itemComponents?.length > 0) {
+              editItemDefinition(dataType.itemDefinition!["@_id"], (itemDefinition) => {
+                itemDefinition.itemComponent = itemComponents;
+              });
+            }
+          }
+        }
+      }
+    },
+    [dataTypeNames, dataTypesTree, editItemDefinition]
+  );
+
+  const checkNameConflicts = useCallback(
+    (javaClasses: JavaClass[]) => {
+      const updatedJavaClasses = renameJavaClassToDMNName(javaClasses);
+
+      // Pre-allocate arrays to avoid resizing
+      const conflicts: JavaClass[] = [];
+      const nonConflicts: JavaClass[] = [];
+
+      // Use a traditional for loop for better performance
+      for (let i = 0, len = updatedJavaClasses?.length; i < len; i++) {
+        const javaClass = updatedJavaClasses?.[i];
+        const fullClassName = javaClass.name;
+        if (dataTypeNames.has(fullClassName)) conflicts.push(javaClass);
+        else nonConflicts.push(javaClass);
+      }
+
+      return {
+        conflicts,
+        nonConflicts,
+      };
+    },
+    [renameJavaClassToDMNName, dataTypeNames]
+  );
+
+  const mapJavaClassesToDMNItemDefinitions = useCallback(
+    (javaClasses: JavaClass[]): ReturnType<typeof getNewItemDefinition>[] => {
+      return javaClasses?.map((javaClass: JavaClass) => {
+        const itemsComponents = javaClass?.fields?.map((field) =>
+          getNewItemDefinition({ "@_name": field?.name, typeRef: { __$$text: field?.dmnTypeRef } })
+        );
+        return getNewItemDefinition({ "@_name": javaClass?.name, typeRef: undefined, itemComponent: itemsComponents });
+      });
+    },
+    []
+  );
+
+  const importJavaClassesInDataTypeEditor = useCallback(
+    (javaClasses: JavaClass[]) => {
+      if (javaClasses?.length === 0) return;
+      const itemDefinitions = mapJavaClassesToDMNItemDefinitions(javaClasses);
+      dmnEditorStoreApi.setState((state) => {
+        state.dmn.model.definitions.itemDefinition ??= [];
+        state.dmn.model.definitions.itemDefinition?.unshift(...itemDefinitions);
+        // Keep the last selected if any. Default to first on list.
+        state.dataTypesEditor.activeItemDefinitionId = itemDefinitions?.[0]?.["@_id"];
+        state.focus.consumableId = itemDefinitions?.[0]?.["@_id"];
+      });
+    },
+    [dmnEditorStoreApi, mapJavaClassesToDMNItemDefinitions]
+  );
+
+  const handleImportJavaClasses = useCallback(
+    (javaClass: JavaClass[]) => {
+      const { conflicts, nonConflicts } = checkNameConflicts(javaClass);
+      if (nonConflicts?.length !== 0) {
+        importJavaClassesInDataTypeEditor(nonConflicts);
+      }
+      if (conflicts?.length !== 0) {
+        setIsConflictsOccured(true);
+        setConflictsClasses(conflicts);
+      }
+    },
+    [checkNameConflicts, importJavaClassesInDataTypeEditor]
+  );
+
+  const handleConflictAction = useCallback(
+    (action: JavaClassConflictOptions) => {
+      if (conflictsClasses?.length === 0) return;
+      if (action === JavaClassConflictOptions.KEEP_BOTH) {
+        const updatedJavaClasses = generateUniqueDmnTypeNames(conflictsClasses);
+        importJavaClassesInDataTypeEditor(updatedJavaClasses);
+      } else if (action === JavaClassConflictOptions.REPLACE) {
+        overwriteExistingDMNTypes(conflictsClasses);
+      }
+      setIsConflictsOccured(false);
+      setConflictsClasses([]);
+    },
+    [conflictsClasses, generateUniqueDmnTypeNames, importJavaClassesInDataTypeEditor, overwriteExistingDMNTypes]
+  );
+
+  return {
+    handleImportJavaClasses,
+    handleConflictAction,
+    conflictsClasses,
+    isConflictsOccured,
+  };
+};
+
+export { useImportJavaClasses };
diff --git a/packages/dmn-editor/src/settings/DmnEditorSettingsContext.tsx b/packages/dmn-editor/src/settings/DmnEditorSettingsContext.tsx
index 6e2c6ce5a4d..2a44250be16 100644
--- a/packages/dmn-editor/src/settings/DmnEditorSettingsContext.tsx
+++ b/packages/dmn-editor/src/settings/DmnEditorSettingsContext.tsx
@@ -19,9 +19,12 @@
 
 import * as React from "react";
 import { useContext, useMemo } from "react";
+import { JavaCodeCompletionService } from "@kie-tools/import-java-classes-component/dist/components/ImportJavaClasses/services";
 
 export interface DmnEditorSettingsContextType {
   isReadOnly: boolean;
+  isImportDataTypesFromJavaClassesSupported?: boolean;
+  javaCodeCompletionService?: JavaCodeCompletionService;
 }
 
 const DmnEditorSettingsContext = React.createContext<DmnEditorSettingsContextType>({} as any);
@@ -30,14 +33,22 @@ export function useSettings() {
   return useContext(DmnEditorSettingsContext);
 }
 
-export function DmnEditorSettingsContextProvider(_props: React.PropsWithChildren<{ isReadOnly?: boolean }>) {
+export function DmnEditorSettingsContextProvider(
+  _props: React.PropsWithChildren<{
+    isReadOnly?: boolean;
+    isImportDataTypesFromJavaClassesSupported?: boolean;
+    javaCodeCompletionService?: JavaCodeCompletionService;
+  }>
+) {
   const { children, ...props } = _props;
 
   const value = useMemo<DmnEditorSettingsContextType>(
     () => ({
       isReadOnly: props.isReadOnly ?? false,
+      isImportDataTypesFromJavaClassesSupported: props?.isImportDataTypesFromJavaClassesSupported ?? false,
+      javaCodeCompletionService: props?.javaCodeCompletionService,
     }),
-    [props.isReadOnly]
+    [props.isReadOnly, props?.isImportDataTypesFromJavaClassesSupported, props?.javaCodeCompletionService]
   );
 
   return <DmnEditorSettingsContext.Provider value={value}>{children}</DmnEditorSettingsContext.Provider>;
diff --git a/packages/dmn-vscode-extension/src/webview/NewDmnEditorEnvelopeApp.ts b/packages/dmn-vscode-extension/src/webview/NewDmnEditorEnvelopeApp.ts
index 6394450ee70..223c6d580a3 100644
--- a/packages/dmn-vscode-extension/src/webview/NewDmnEditorEnvelopeApp.ts
+++ b/packages/dmn-vscode-extension/src/webview/NewDmnEditorEnvelopeApp.ts
@@ -18,12 +18,12 @@
  */
 
 import * as EditorEnvelope from "@kie-tools-core/editor/dist/envelope";
-import { DmnEditorFactory } from "@kie-tools/dmn-editor-envelope/dist/DmnEditorFactory";
+import { VsCodeNewDmnEditorFactory } from "@kie-tools/dmn-editor-envelope/dist/vscode";
 
 declare const acquireVsCodeApi: any;
 
 EditorEnvelope.init({
   container: document.getElementById("envelope-app")!,
   bus: acquireVsCodeApi(),
-  editorFactory: new DmnEditorFactory(),
+  editorFactory: new VsCodeNewDmnEditorFactory(),
 });
diff --git a/packages/import-java-classes-component/src/components/ImportJavaClasses/ImportJavaClasses.tsx b/packages/import-java-classes-component/src/components/ImportJavaClasses/ImportJavaClasses.tsx
index ef41539f212..d9222eb83f7 100644
--- a/packages/import-java-classes-component/src/components/ImportJavaClasses/ImportJavaClasses.tsx
+++ b/packages/import-java-classes-component/src/components/ImportJavaClasses/ImportJavaClasses.tsx
@@ -18,34 +18,91 @@
  */
 
 import * as React from "react";
+import { useCallback, useState } from "react";
 import {
   importJavaClassesWizardI18nDictionaries,
   ImportJavaClassesWizardI18nContext,
   importJavaClassesWizardI18nDefaults,
+  useImportJavaClassesWizardI18n,
 } from "../../i18n";
 import { I18nDictionariesProvider } from "@kie-tools-core/i18n/dist/react-components";
-import { ImportJavaClassesWizard } from "./ImportJavaClassesWizard";
 import { GWTLayerService, JavaCodeCompletionService } from "./services";
+import { JavaClass } from "./model";
 
-export interface ImportJavaClassesProps {
-  /** Service class which contains all API method to dialog with GWT layer */
-  gwtLayerService: GWTLayerService;
+import {
+  ImportJavaClassesButton,
+  ImportJavaClassesWizard,
+  useLanguageServerAvailable,
+} from "./ImportJavaClassesWizard";
+
+interface ImportJavaClassesProps {
+  /** Service class which contains all API method to dialog with GWT layer (can be removed when Stunner editor support is discontinued ) */
+  gwtLayerService?: GWTLayerService;
   /** Service class which contains all API methods to dialog with Java Code Completion Extension*/
   javaCodeCompletionService: JavaCodeCompletionService;
+  /** Callback function used to load Java classes into the data type editor.*/
+  loadJavaClassesInDataTypeEditor?: (javaClasses: JavaClass[]) => void;
 }
 
-export const ImportJavaClasses = ({ gwtLayerService, javaCodeCompletionService }: ImportJavaClassesProps) => {
+const ImportJavaClassesI18nDictionariesProvider = (
+  props: Omit<
+    React.ComponentProps<typeof I18nDictionariesProvider>,
+    "defaults" | "dictionaries" | "initialLocale" | "ctx"
+  >
+) => (
+  <I18nDictionariesProvider
+    defaults={importJavaClassesWizardI18nDefaults}
+    dictionaries={importJavaClassesWizardI18nDictionaries}
+    initialLocale={navigator.language}
+    ctx={ImportJavaClassesWizardI18nContext}
+    {...props}
+  />
+);
+
+const ImportJavaClasses = ({
+  javaCodeCompletionService,
+  gwtLayerService,
+  loadJavaClassesInDataTypeEditor,
+}: ImportJavaClassesProps) => {
+  const [isOpenImportJavaClassesWizard, setOpenImportJavaClassesWizard] = useState(false);
+  const handleButtonClick = useCallback(() => setOpenImportJavaClassesWizard((prevState) => !prevState), []);
+  const handleWizardSave = useCallback(
+    (javaClasses) => {
+      /* If the GWT layer service is available, it uses the `importJavaClassesInDataTypeEditor` method.
+       * Otherwise, it calls the `loadJavaClassesInDataTypeEditor` callback with the provided Java classes.
+       */
+      if (gwtLayerService) {
+        gwtLayerService?.importJavaClassesInDataTypeEditor?.(javaClasses);
+      } else {
+        loadJavaClassesInDataTypeEditor?.(javaClasses);
+      }
+    },
+    [gwtLayerService, loadJavaClassesInDataTypeEditor]
+  );
   return (
-    <I18nDictionariesProvider
-      defaults={importJavaClassesWizardI18nDefaults}
-      dictionaries={importJavaClassesWizardI18nDictionaries}
-      initialLocale={navigator.language}
-      ctx={ImportJavaClassesWizardI18nContext}
-    >
-      <ImportJavaClassesWizard
-        gwtLayerService={gwtLayerService}
+    <ImportJavaClassesI18nDictionariesProvider>
+      <ImportJavaClassesButton
+        handleButtonClick={handleButtonClick}
         javaCodeCompletionService={javaCodeCompletionService}
       />
-    </I18nDictionariesProvider>
+      {isOpenImportJavaClassesWizard && (
+        <ImportJavaClassesWizard
+          javaCodeCompletionService={javaCodeCompletionService}
+          isOpen={isOpenImportJavaClassesWizard}
+          onSave={handleWizardSave}
+          onClose={handleButtonClick}
+        />
+      )}
+    </ImportJavaClassesI18nDictionariesProvider>
   );
 };
+
+export {
+  ImportJavaClassesProps,
+  ImportJavaClassesI18nDictionariesProvider,
+  ImportJavaClasses,
+  ImportJavaClassesButton,
+  ImportJavaClassesWizard,
+  useLanguageServerAvailable,
+  useImportJavaClassesWizardI18n,
+};
diff --git a/packages/import-java-classes-component/src/components/ImportJavaClasses/ImportJavaClassesWizard.tsx b/packages/import-java-classes-component/src/components/ImportJavaClasses/ImportJavaClassesWizard.tsx
index d4f33a29759..bc82ae05228 100644
--- a/packages/import-java-classes-component/src/components/ImportJavaClasses/ImportJavaClassesWizard.tsx
+++ b/packages/import-java-classes-component/src/components/ImportJavaClasses/ImportJavaClassesWizard.tsx
@@ -18,71 +18,132 @@
  */
 
 import * as React from "react";
+import { useCallback, useEffect, useMemo, useState } from "react";
+import { Button } from "@patternfly/react-core/dist/js/components/Button";
+import { Modal, ModalVariant } from "@patternfly/react-core/dist/js/components/Modal";
+import { Tooltip } from "@patternfly/react-core/dist/js/components/Tooltip";
+import { Wizard } from "@patternfly/react-core/dist/js/components/Wizard";
 import { useImportJavaClassesWizardI18n } from "../../i18n";
 import { ImportJavaClassesWizardFirstStep } from "./ImportJavaClassesWizardFirstStep";
 import { ImportJavaClassesWizardSecondStep } from "./ImportJavaClassesWizardSecondStep";
 import { ImportJavaClassesWizardThirdStep } from "./ImportJavaClassesWizardThirdStep";
-import { useCallback, useEffect, useState } from "react";
 import { JavaClass } from "./model/JavaClass";
 import { JavaField } from "./model/JavaField";
 import { DMNSimpleType } from "./model/DMNSimpleType";
 import { getJavaClassSimpleName } from "./model/JavaClassUtils";
-import { GWTLayerService, JavaCodeCompletionService } from "./services";
-import { Button } from "@patternfly/react-core/dist/js/components/Button";
-import { Modal, ModalVariant } from "@patternfly/react-core/dist/js/components/Modal";
-import { Tooltip } from "@patternfly/react-core/dist/js/components/Tooltip";
-import { Wizard } from "@patternfly/react-core/dist/js/components/Wizard";
+import { JavaCodeCompletionService } from "./services";
 
-export interface ImportJavaClassesWizardProps {
-  /** Service class which contains all API methods to dialog with GWT layer */
-  gwtLayerService: GWTLayerService;
-  /** Service class which contains all API methods to dialog with Java Code Completion Extension*/
+export type LanguageServerStatus = "disable" | "enable" | "loading" | "error";
+
+export type ImportJavaClassesWizardProps = Pick<React.ComponentProps<typeof Modal>, "isOpen" | "onClose"> & {
+  onSave: (javaClass: JavaClass[]) => void;
   javaCodeCompletionService: JavaCodeCompletionService;
-}
+};
 
-export const ImportJavaClassesWizard = ({
-  gwtLayerService,
-  javaCodeCompletionService,
-}: ImportJavaClassesWizardProps) => {
-  type ButtonStatus = "disable" | "enable" | "loading" | "error";
-  const { i18n } = useImportJavaClassesWizardI18n();
-  const [javaClasses, setJavaClasses] = useState<JavaClass[]>([]);
-  const [isOpen, setOpen] = useState(false);
-  const [buttonStatus, setButtonStatus] = useState<ButtonStatus>("loading");
+export interface ImportJavaClassesButtonProps {
+  javaCodeCompletionService: JavaCodeCompletionService;
+  handleButtonClick: () => void;
+}
 
+export const useLanguageServerAvailable = (
+  javaCodeCompletionService: JavaCodeCompletionService
+): {
+  languageServerStatus: LanguageServerStatus;
+  isLanguageServerDisabled: boolean;
+  isLanguageServerLoading: boolean;
+  isLanguageServerError: boolean;
+} => {
+  const [languageServerStatus, setLanguageServerStatus] = useState<LanguageServerStatus>("loading");
   useEffect(() => {
     try {
       javaCodeCompletionService
         .isLanguageServerAvailable()
         .then((available: boolean) => {
-          setButtonStatus(available ? "enable" : "disable");
+          setLanguageServerStatus(available ? "enable" : "disable");
         })
         .catch((reason) => {
-          setButtonStatus("error");
+          setLanguageServerStatus("error");
           console.error(reason);
         });
     } catch (error) {
-      setButtonStatus("error");
+      setLanguageServerStatus("error");
       console.error(error);
     }
   }, [javaCodeCompletionService]);
+  const isLanguageServerDisabled = useMemo(() => {
+    return "enable" !== languageServerStatus;
+  }, [languageServerStatus]);
 
-  const isButtonDisabled = useCallback(() => {
-    return "enable" !== buttonStatus;
-  }, [buttonStatus]);
+  const isLanguageServerLoading = useMemo(() => {
+    return "loading" == languageServerStatus;
+  }, [languageServerStatus]);
 
-  const isButtonLoading = useCallback(() => {
-    return "loading" == buttonStatus;
-  }, [buttonStatus]);
+  const isLanguageServerError = useMemo(() => {
+    return "error" == languageServerStatus;
+  }, [languageServerStatus]);
+
+  return { languageServerStatus, isLanguageServerDisabled, isLanguageServerLoading, isLanguageServerError };
+};
+
+export const ImportJavaClassesButton = ({
+  javaCodeCompletionService,
+  handleButtonClick,
+}: ImportJavaClassesButtonProps) => {
+  const { i18n } = useImportJavaClassesWizardI18n();
+  const { isLanguageServerDisabled, isLanguageServerLoading, isLanguageServerError } =
+    useLanguageServerAvailable(javaCodeCompletionService);
 
   const defineTooltipMessage = useCallback(() => {
-    if ("disable" === buttonStatus) {
+    if (isLanguageServerDisabled) {
       return i18n.modalButton.disabledMessage;
-    } else if ("error" === buttonStatus) {
+    } else if (isLanguageServerError) {
       return i18n.modalButton.errorMessage;
     }
     return undefined;
-  }, [buttonStatus, i18n.modalButton.disabledMessage, i18n.modalButton.errorMessage]);
+  }, [
+    isLanguageServerDisabled,
+    isLanguageServerError,
+    i18n.modalButton.disabledMessage,
+    i18n.modalButton.errorMessage,
+  ]);
+
+  return (
+    <>
+      {defineTooltipMessage() ? (
+        <Tooltip content={defineTooltipMessage()}>
+          <Button
+            data-testid={"modal-wizard-button"}
+            isAriaDisabled={isLanguageServerDisabled}
+            isLoading={isLanguageServerLoading}
+            onClick={handleButtonClick}
+            variant={"secondary"}
+          >
+            {i18n.modalButton.text}
+          </Button>
+        </Tooltip>
+      ) : (
+        <Button
+          data-testid={"modal-wizard-button"}
+          isAriaDisabled={isLanguageServerDisabled}
+          isLoading={isLanguageServerLoading}
+          onClick={handleButtonClick}
+          variant={"secondary"}
+        >
+          {i18n.modalButton.text}
+        </Button>
+      )}
+    </>
+  );
+};
+
+export const ImportJavaClassesWizard = ({
+  javaCodeCompletionService,
+  isOpen,
+  onClose,
+  onSave,
+}: ImportJavaClassesWizardProps) => {
+  const { i18n } = useImportJavaClassesWizardI18n();
+  const [javaClasses, setJavaClasses] = useState<JavaClass[]>([]);
 
   const updateJavaFieldsReferences = useCallback(
     (updatedJavaClasses: JavaClass[], previousJavaClasses: JavaClass[]) => {
@@ -145,17 +206,15 @@ export const ImportJavaClassesWizard = ({
     return javaClasses.length > 0 && javaClasses.every((javaClass) => javaClass.fieldsLoaded);
   }, [javaClasses]);
 
-  const handleButtonClick = useCallback(() => setOpen((prevState) => !prevState), []);
-
   const handleWizardClose = useCallback(() => {
-    handleButtonClick();
     setJavaClasses([]);
-  }, [handleButtonClick]);
+    onClose?.();
+  }, [onClose]);
 
   const handleWizardSave = useCallback(() => {
+    onSave?.(javaClasses);
     handleWizardClose();
-    gwtLayerService.importJavaClassesInDataTypeEditor(javaClasses);
-  }, [javaClasses, handleWizardClose, gwtLayerService]);
+  }, [javaClasses, handleWizardClose, onSave]);
 
   const steps = [
     {
@@ -194,47 +253,20 @@ export const ImportJavaClassesWizard = ({
   ];
 
   return (
-    <>
-      {defineTooltipMessage() ? (
-        <Tooltip content={defineTooltipMessage()}>
-          <Button
-            data-testid={"modal-wizard-button"}
-            isAriaDisabled={isButtonDisabled()}
-            isLoading={isButtonLoading()}
-            onClick={handleButtonClick}
-            variant={"secondary"}
-          >
-            {i18n.modalButton.text}
-          </Button>
-        </Tooltip>
-      ) : (
-        <Button
-          data-testid={"modal-wizard-button"}
-          isAriaDisabled={isButtonDisabled()}
-          isLoading={isButtonLoading()}
-          onClick={handleButtonClick}
-          variant={"secondary"}
-        >
-          {i18n.modalButton.text}
-        </Button>
-      )}
-      {isOpen ? (
-        <Modal
-          description={i18n.modalWizard.description}
-          isOpen={isOpen}
-          onClose={handleWizardClose}
-          title={i18n.modalWizard.title}
-          variant={ModalVariant.large}
-        >
-          <Wizard
-            className={"import-java-classes"}
-            height={600}
-            onClose={handleWizardClose}
-            onSave={handleWizardSave}
-            steps={steps}
-          />
-        </Modal>
-      ) : null}
-    </>
+    <Modal
+      description={i18n.modalWizard.description}
+      isOpen={isOpen}
+      onClose={handleWizardClose}
+      title={i18n.modalWizard.title}
+      variant={ModalVariant.large}
+    >
+      <Wizard
+        className={"import-java-classes"}
+        height={600}
+        onClose={handleWizardClose}
+        onSave={handleWizardSave}
+        steps={steps}
+      />
+    </Modal>
   );
 };
diff --git a/packages/import-java-classes-component/tests/ImportJavaClasses/__snapshots__/ImportJavaClasses.test.tsx.snap b/packages/import-java-classes-component/tests/ImportJavaClasses/__snapshots__/ImportJavaClasses.test.tsx.snap
index f07c335488d..46960a4b629 100644
--- a/packages/import-java-classes-component/tests/ImportJavaClasses/__snapshots__/ImportJavaClasses.test.tsx.snap
+++ b/packages/import-java-classes-component/tests/ImportJavaClasses/__snapshots__/ImportJavaClasses.test.tsx.snap
@@ -10,7 +10,7 @@ exports[`ImportJavaClasses component tests Should close Modal after opening it a
     <button
       aria-disabled="false"
       class="pf-c-button pf-m-secondary pf-m-progress"
-      data-ouia-component-id="OUIA-Generated-Button-secondary-5"
+      data-ouia-component-id="OUIA-Generated-Button-secondary-10"
       data-ouia-component-type="PF4/Button"
       data-ouia-safe="true"
       data-testid="modal-wizard-button"
@@ -32,7 +32,7 @@ exports[`ImportJavaClasses component tests Should move to second step 1`] = `
     <button
       aria-disabled="false"
       class="pf-c-button pf-m-secondary pf-m-progress"
-      data-ouia-component-id="OUIA-Generated-Button-secondary-6"
+      data-ouia-component-id="OUIA-Generated-Button-secondary-12"
       data-ouia-component-type="PF4/Button"
       data-ouia-safe="true"
       data-testid="modal-wizard-button"
@@ -498,7 +498,7 @@ exports[`ImportJavaClasses component tests Should move to second step 1`] = `
                   <button
                     aria-disabled="false"
                     class="pf-c-button pf-m-secondary"
-                    data-ouia-component-id="OUIA-Generated-Button-secondary-7"
+                    data-ouia-component-id="OUIA-Generated-Button-secondary-13"
                     data-ouia-component-type="PF4/Button"
                     data-ouia-safe="true"
                     type="button"
@@ -540,7 +540,7 @@ exports[`ImportJavaClasses component tests Should move to second step and fetch
     <button
       aria-disabled="false"
       class="pf-c-button pf-m-secondary pf-m-progress"
-      data-ouia-component-id="OUIA-Generated-Button-secondary-8"
+      data-ouia-component-id="OUIA-Generated-Button-secondary-15"
       data-ouia-component-type="PF4/Button"
       data-ouia-safe="true"
       data-testid="modal-wizard-button"
@@ -1025,7 +1025,7 @@ exports[`ImportJavaClasses component tests Should move to second step and fetch
                   <button
                     aria-disabled="false"
                     class="pf-c-button pf-m-secondary"
-                    data-ouia-component-id="OUIA-Generated-Button-secondary-9"
+                    data-ouia-component-id="OUIA-Generated-Button-secondary-16"
                     data-ouia-component-type="PF4/Button"
                     data-ouia-safe="true"
                     type="button"
@@ -1067,7 +1067,7 @@ exports[`ImportJavaClasses component tests Should move to third step 1`] = `
     <button
       aria-disabled="false"
       class="pf-c-button pf-m-secondary pf-m-progress"
-      data-ouia-component-id="OUIA-Generated-Button-secondary-13"
+      data-ouia-component-id="OUIA-Generated-Button-secondary-22"
       data-ouia-component-type="PF4/Button"
       data-ouia-safe="true"
       data-testid="modal-wizard-button"
@@ -1527,7 +1527,7 @@ exports[`ImportJavaClasses component tests Should move to third step 1`] = `
                   <button
                     aria-disabled="false"
                     class="pf-c-button pf-m-secondary"
-                    data-ouia-component-id="OUIA-Generated-Button-secondary-14"
+                    data-ouia-component-id="OUIA-Generated-Button-secondary-23"
                     data-ouia-component-type="PF4/Button"
                     data-ouia-safe="true"
                     type="button"
@@ -1569,7 +1569,7 @@ exports[`ImportJavaClasses component tests Should search box with results works
     <button
       aria-disabled="false"
       class="pf-c-button pf-m-secondary pf-m-progress"
-      data-ouia-component-id="OUIA-Generated-Button-secondary-4"
+      data-ouia-component-id="OUIA-Generated-Button-secondary-8"
       data-ouia-component-type="PF4/Button"
       data-ouia-safe="true"
       data-testid="modal-wizard-button"
@@ -1942,7 +1942,7 @@ exports[`ImportJavaClasses component tests Should show Modal after clicking on t
     <button
       aria-disabled="false"
       class="pf-c-button pf-m-secondary pf-m-progress"
-      data-ouia-component-id="OUIA-Generated-Button-secondary-2"
+      data-ouia-component-id="OUIA-Generated-Button-secondary-4"
       data-ouia-component-type="PF4/Button"
       data-ouia-safe="true"
       data-testid="modal-wizard-button"
@@ -2248,7 +2248,7 @@ exports[`ImportJavaClasses component tests should render ImportJavaClasses Butto
     <button
       aria-disabled="false"
       class="pf-c-button pf-m-secondary pf-m-progress"
-      data-ouia-component-id="OUIA-Generated-Button-secondary-1"
+      data-ouia-component-id="OUIA-Generated-Button-secondary-2"
       data-ouia-component-type="PF4/Button"
       data-ouia-safe="true"
       data-testid="modal-wizard-button"
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 64736077e00..da6dfa0b3a7 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -4157,6 +4157,9 @@ importers:
       '@kie-tools/i18n-common-dictionary':
         specifier: workspace:*
         version: link:../i18n-common-dictionary
+      '@kie-tools/import-java-classes-component':
+        specifier: workspace:*
+        version: link:../import-java-classes-component
       '@kie-tools/pmml-editor-marshaller':
         specifier: workspace:*
         version: link:../pmml-editor-marshaller
@@ -4374,6 +4377,9 @@ importers:
       '@kie-tools-core/react-hooks':
         specifier: workspace:*
         version: link:../react-hooks
+      '@kie-tools-core/vscode-java-code-completion':
+        specifier: workspace:*
+        version: link:../vscode-java-code-completion
       '@kie-tools-core/workspace':
         specifier: workspace:*
         version: link:../workspace
diff --git a/repo/graph.dot b/repo/graph.dot
index 2b68ff4712b..3ed38318da1 100644
--- a/repo/graph.dot
+++ b/repo/graph.dot
@@ -108,6 +108,7 @@ digraph G {
   "@kie-tools/dev-deployment-kogito-quarkus-blank-app-image" [ color = "black", fontcolor = "black", style = "dashed, rounded" ];
   "@kie-tools/maven-m2-repo-via-http-image" [ color = "black", fontcolor = "black", style = "dashed, rounded" ];
   "@kie-tools/dmn-editor" [ color = "blue", fontcolor = "blue", style = "rounded" ];
+  "@kie-tools/import-java-classes-component" [ color = "blue", fontcolor = "blue", style = "rounded" ];
   "@kie-tools/pmml-editor-marshaller" [ color = "blue", fontcolor = "blue", style = "rounded" ];
   "@kie-tools/dmn-feel-antlr4-parser" [ color = "blue", fontcolor = "blue", style = "rounded" ];
   "@kie-tools/dmn-marshaller" [ color = "blue", fontcolor = "blue", style = "rounded" ];
@@ -132,7 +133,6 @@ digraph G {
   "@kie-tools/form-code-generator-patternfly-theme" [ color = "blue", fontcolor = "blue", style = "rounded" ];
   "@kie-tools/jbpm-form-code-generator-themes" [ color = "blue", fontcolor = "blue", style = "rounded" ];
   "@kie-tools-core/i18n" [ color = "purple", fontcolor = "purple", style = "rounded" ];
-  "@kie-tools/import-java-classes-component" [ color = "blue", fontcolor = "blue", style = "rounded" ];
   "@kie-tools-core/vscode-java-code-completion" [ color = "purple", fontcolor = "purple", style = "rounded" ];
   "@kie-tools/runtime-tools-process-dev-ui-webapp" [ color = "blue", fontcolor = "blue", style = "rounded" ];
   "@kie-tools/jobs-service-webapp" [ color = "blue", fontcolor = "blue", style = "rounded" ];
@@ -373,6 +373,7 @@ digraph G {
   "@kie-tools/dev-deployment-upload-service" -> "@kie-tools/jest-base" [ style = "dashed", color = "black" ];
   "@kie-tools/dmn-editor" -> "@kie-tools-core/react-hooks" [ style = "solid", color = "blue" ];
   "@kie-tools/dmn-editor" -> "@kie-tools/boxed-expression-component" [ style = "solid", color = "blue" ];
+  "@kie-tools/dmn-editor" -> "@kie-tools/import-java-classes-component" [ style = "solid", color = "blue" ];
   "@kie-tools/dmn-editor" -> "@kie-tools/pmml-editor-marshaller" [ style = "solid", color = "blue" ];
   "@kie-tools/dmn-editor-envelope" -> "@kie-tools-core/editor" [ style = "solid", color = "blue" ];
   "@kie-tools/dmn-editor-envelope" -> "@kie-tools/dmn-editor" [ style = "solid", color = "blue" ];
diff --git a/repo/graph.json b/repo/graph.json
index 66694a3ffe4..18953cd9098 100644
--- a/repo/graph.json
+++ b/repo/graph.json
@@ -154,6 +154,7 @@
       { "id": "@kie-tools/dev-deployment-kogito-quarkus-blank-app" },
       { "id": "@kie-tools/dev-deployment-kogito-quarkus-blank-app-image" },
       { "id": "@kie-tools/maven-m2-repo-via-http-image" },
+      { "id": "@kie-tools/import-java-classes-component" },
       { "id": "@kie-tools/dmn-feel-antlr4-parser" },
       { "id": "@kie-tools/dmn-marshaller" },
       { "id": "@kie-tools/dmn-marshaller-backend-compatibility-tester" },
@@ -170,7 +171,6 @@
       { "id": "@kie-tools/form-code-generator" },
       { "id": "@kie-tools/form-code-generator-bootstrap4-theme" },
       { "id": "@kie-tools/form-code-generator-patternfly-theme" },
-      { "id": "@kie-tools/import-java-classes-component" },
       { "id": "@kie-tools/runtime-tools-process-webapp-components" },
       { "id": "@kie-tools/runtime-tools-shared-webapp-components" },
       { "id": "@kie-tools/jobs-service-webapp" },
@@ -463,6 +463,11 @@
         "target": "@kie-tools/boxed-expression-component",
         "weight": 1
       },
+      {
+        "source": "@kie-tools/dmn-editor",
+        "target": "@kie-tools/import-java-classes-component",
+        "weight": 1
+      },
       {
         "source": "@kie-tools/dmn-editor",
         "target": "@kie-tools/pmml-editor-marshaller",
@@ -1603,6 +1608,31 @@
         "target": "@kie-tools/root-env",
         "weight": 1
       },
+      {
+        "source": "@kie-tools/import-java-classes-component",
+        "target": "@kie-tools-core/vscode-java-code-completion",
+        "weight": 1
+      },
+      {
+        "source": "@kie-tools/import-java-classes-component",
+        "target": "@kie-tools/i18n-common-dictionary",
+        "weight": 1
+      },
+      {
+        "source": "@kie-tools/import-java-classes-component",
+        "target": "@kie-tools-core/monaco-editor",
+        "weight": 1
+      },
+      {
+        "source": "@kie-tools/import-java-classes-component",
+        "target": "@kie-tools-core/patternfly-base",
+        "weight": 1
+      },
+      {
+        "source": "@kie-tools/import-java-classes-component",
+        "target": "@kie-tools-core/webpack-base",
+        "weight": 1
+      },
       {
         "source": "@kie-tools/dmn-feel-antlr4-parser",
         "target": "@kie-tools/dmn-marshaller",
@@ -1788,31 +1818,6 @@
         "target": "@kie-tools-core/webpack-base",
         "weight": 1
       },
-      {
-        "source": "@kie-tools/import-java-classes-component",
-        "target": "@kie-tools-core/vscode-java-code-completion",
-        "weight": 1
-      },
-      {
-        "source": "@kie-tools/import-java-classes-component",
-        "target": "@kie-tools/i18n-common-dictionary",
-        "weight": 1
-      },
-      {
-        "source": "@kie-tools/import-java-classes-component",
-        "target": "@kie-tools-core/monaco-editor",
-        "weight": 1
-      },
-      {
-        "source": "@kie-tools/import-java-classes-component",
-        "target": "@kie-tools-core/patternfly-base",
-        "weight": 1
-      },
-      {
-        "source": "@kie-tools/import-java-classes-component",
-        "target": "@kie-tools-core/webpack-base",
-        "weight": 1
-      },
       {
         "source": "@kie-tools/runtime-tools-process-webapp-components",
         "target": "@kie-tools/runtime-tools-process-enveloped-components",


Reviews:
user: login: jomarko
body: Thank you for the PR. Here is my feedback in few points.

### 01 DESKTOP vs WEB
In code I see `settings.channelType === ChannelType.VSCODE_DESKTOP || settings.channelType === ChannelType.VSCODE_WEB`. I have tried just a desktop. Is here anyone who tried web?

### 02 search
imagine there is class `Person`. User is not able to search it using string like `son` or `person`. User is able to search it just using the proper lower/upper case match and the `startsWith` letters. For example `Pers` will find `Person`

maybe we should do similar updates as we do in https://github.com/apache/incubator-kie-tools/pull/3033 ?

### 03 select multiple classes
Once I selected two classes `Person` and `Person2`, the first one is always imported/loaded as empty structure. However, checking java code, `Person` it is not empty.
![Screenshot 2025-04-01 114910](https://github.com/user-attachments/assets/ce579f26-ca49-40ab-80cd-6b4b87da1f78)
![Screenshot 2025-04-01 114903](https://github.com/user-attachments/assets/d894e5e4-49d5-4758-a3ab-eab7ba8370b5)

### 04 Activator hint
is currently: 
```
Not available, please check if 'Language Support for Java by Red Hat' extension is correctly installed and the Activator Java Class is present in your project.
```
from the ^ it is not so clear to me it should look like:https://github.com/yesamer/dmn-javaclasses-example/blob/main/src/main/java/Activator.java

Points 2 and 3 are probably also in old editor? Probably we can handle them in separate tickets potentially? What is your opinion aboit 1 and 4?
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-01T10:06:33Z
user: login: jomarko
body: Approving the PR as my understanding is this:

### 1
 will be checked once the new VSIX extension is released. Currently for local testing we are blocked because `vscode-test-web` have trouble to install multiple extensions - we need java language support next to dmn vs code extension.
 
 
 ### 2
 Will have a separate ticket
 
 ### 3
 Will have a separate ticket
 
 ### 4
 There does not seem to be enough agreement how to improve. We will keep as it is.
state: APPROVED
author_association: MEMBER
submitted_at: 2025-04-02T13:11:30Z
user: login: yesamer
body: @Adarshvk98 Thank you for implementing this important feature, you did a great job! Approving, I just have a couple of minor things.
state: APPROVED
author_association: MEMBER
submitted_at: 2025-04-03T07:39:48Z
user: login: Adarshvk98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-03T08:02:24Z
user: login: Adarshvk98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-03T08:03:17Z
user: login: jomarko
body: Thank you for PR. Before an approval, I have one very specific corner case to discuss.

### A.dmn
Lets say this file has data type named `Person`

### B.dmn
Lets say this file includes `A.dmn` using default namesspace. So there is no prefix if `B.dmn` file want to access `Person` defined in `A.dmn`. Now imagine `A.dmn` want to import data type from  a java class also named `Person`. The feature correctly detect conflict [1], however if there is conflict with and external data type, we should probably not allow the option `Replace` what do you think?



### [1]
![Screenshot 2025-04-04 154753](https://github.com/user-attachments/assets/82f845eb-91da-4f0c-a4d9-ae30bf65cfc6)

state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-04T13:52:33Z
user: login: Adarshvk98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-07T04:02:32Z
user: login: Adarshvk98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-07T04:29:44Z
user: login: jomarko
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-07T09:05:24Z
user: login: tiagobento
body: Please take my small comment about acronyms into consideration, and also somethings we discussed between ourselves:
- There's no need for the `window` object to be used as means to give the DmnEditor component access to methods related to importing Java classes. You can use `envelopeContext` directly in `dmn-editor-envelope` and remove the indirection.

Thanks!!
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-08T15:36:00Z
user: login: Adarshvk98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T10:56:38Z
user: login: thiagoelg
body: This looks great, thanks @Adarshvk98!

Left some inline comments with some nitpicks regarding variable naming and undefined checks reported by the CI.
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-09T14:40:49Z
user: login: Adarshvk98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T16:12:44Z
user: login: Adarshvk98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T16:13:58Z
user: login: Adarshvk98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T16:14:05Z
user: login: Adarshvk98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T16:14:14Z
user: login: Adarshvk98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T16:15:34Z
user: login: thiagoelg
state: APPROVED
author_association: MEMBER
submitted_at: 2025-04-09T18:08:45Z
user: login: tiagobento
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-09T18:45:38Z
user: login: Adarshvk98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-10T04:16:40Z
user: login: Adarshvk98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-10T15:42:58Z
user: login: tiagobento
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-10T16:23:08Z
user: login: Adarshvk98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-10T16:27:54Z
user: login: tiagobento
body: Sorry, found something that needs double-checking.
state: CHANGES_REQUESTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-11T13:24:20Z
user: login: Adarshvk98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-13T16:05:04Z
user: login: tiagobento
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-15T10:33:59Z
user: login: Adarshvk98
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-15T10:42:00Z
user: login: tiagobento
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-15T14:53:16Z

Review comments:
diff_hunk: @@ -105,6 +111,18 @@ export function DataTypes() {
   );
   const dataTypesTree = useDmnEditorStore((s) => s.computed(s).getDataTypes(externalModelsByNamespace).dataTypesTree);
 
+  const [isOpen, setOpen] = useState(false);
path: packages/dmn-editor/src/dataTypes/DataTypes.tsx
user: login: yesamer
body: I would suggest using a more descriptive variable name. What is open?
created_at: 2025-04-03T07:19:54Z
author_association: MEMBER
diff_hunk: @@ -18,34 +18,91 @@
  */
 
 import * as React from "react";
+import { useCallback, useState } from "react";
 import {
   importJavaClassesWizardI18nDictionaries,
   ImportJavaClassesWizardI18nContext,
   importJavaClassesWizardI18nDefaults,
+  useImportJavaClassesWizardI18n,
 } from "../../i18n";
 import { I18nDictionariesProvider } from "@kie-tools-core/i18n/dist/react-components";
-import { ImportJavaClassesWizard } from "./ImportJavaClassesWizard";
 import { GWTLayerService, JavaCodeCompletionService } from "./services";
+import { JavaClass } from "./model";
 
-export interface ImportJavaClassesProps {
-  /** Service class which contains all API method to dialog with GWT layer */
-  gwtLayerService: GWTLayerService;
+import {
+  ImportJavaClassesButton,
+  ImportJavaClassesWizard,
+  useLanguageServerAvailable,
+} from "./ImportJavaClassesWizard";
+
+interface ImportJavaClassesProps {
+  /** Service class which contains all API method to dialog with GWT layer (can be removed when Stunner editor support is discontinued ) */
+  gwtLayerService?: GWTLayerService;
   /** Service class which contains all API methods to dialog with Java Code Completion Extension*/
   javaCodeCompletionService: JavaCodeCompletionService;
+  /** Callback function used to load Java classes into the data type editor.*/
+  loadJavaClassesInDataTypeEditor?: (javaClasses: JavaClass[]) => void;
 }
 
-export const ImportJavaClasses = ({ gwtLayerService, javaCodeCompletionService }: ImportJavaClassesProps) => {
+const ImportJavaClassesI18nDictionariesProvider = (
+  props: Omit<
+    React.ComponentProps<typeof I18nDictionariesProvider>,
+    "defaults" | "dictionaries" | "initialLocale" | "ctx"
+  >
+) => (
+  <I18nDictionariesProvider
+    defaults={importJavaClassesWizardI18nDefaults}
+    dictionaries={importJavaClassesWizardI18nDictionaries}
+    initialLocale={navigator.language}
+    ctx={ImportJavaClassesWizardI18nContext}
+    {...props}
+  />
+);
+
+const ImportJavaClasses = ({
+  javaCodeCompletionService,
+  gwtLayerService,
+  loadJavaClassesInDataTypeEditor,
+}: ImportJavaClassesProps) => {
+  const [isOpen, setOpen] = useState(false);
path: packages/import-java-classes-component/src/components/ImportJavaClasses/ImportJavaClasses.tsx
user: login: yesamer
body: @Adarshvk98 same
created_at: 2025-04-03T07:31:18Z
author_association: MEMBER
diff_hunk: @@ -105,6 +111,18 @@ export function DataTypes() {
   );
   const dataTypesTree = useDmnEditorStore((s) => s.computed(s).getDataTypes(externalModelsByNamespace).dataTypesTree);
 
+  const [isOpen, setOpen] = useState(false);
path: packages/dmn-editor/src/dataTypes/DataTypes.tsx
user: login: Adarshvk98
body: Done - I’ve added a descriptive variable name for the variable.
created_at: 2025-04-03T08:02:24Z
author_association: CONTRIBUTOR
diff_hunk: @@ -18,34 +18,91 @@
  */
 
 import * as React from "react";
+import { useCallback, useState } from "react";
 import {
   importJavaClassesWizardI18nDictionaries,
   ImportJavaClassesWizardI18nContext,
   importJavaClassesWizardI18nDefaults,
+  useImportJavaClassesWizardI18n,
 } from "../../i18n";
 import { I18nDictionariesProvider } from "@kie-tools-core/i18n/dist/react-components";
-import { ImportJavaClassesWizard } from "./ImportJavaClassesWizard";
 import { GWTLayerService, JavaCodeCompletionService } from "./services";
+import { JavaClass } from "./model";
 
-export interface ImportJavaClassesProps {
-  /** Service class which contains all API method to dialog with GWT layer */
-  gwtLayerService: GWTLayerService;
+import {
+  ImportJavaClassesButton,
+  ImportJavaClassesWizard,
+  useLanguageServerAvailable,
+} from "./ImportJavaClassesWizard";
+
+interface ImportJavaClassesProps {
+  /** Service class which contains all API method to dialog with GWT layer (can be removed when Stunner editor support is discontinued ) */
+  gwtLayerService?: GWTLayerService;
   /** Service class which contains all API methods to dialog with Java Code Completion Extension*/
   javaCodeCompletionService: JavaCodeCompletionService;
+  /** Callback function used to load Java classes into the data type editor.*/
+  loadJavaClassesInDataTypeEditor?: (javaClasses: JavaClass[]) => void;
 }
 
-export const ImportJavaClasses = ({ gwtLayerService, javaCodeCompletionService }: ImportJavaClassesProps) => {
+const ImportJavaClassesI18nDictionariesProvider = (
+  props: Omit<
+    React.ComponentProps<typeof I18nDictionariesProvider>,
+    "defaults" | "dictionaries" | "initialLocale" | "ctx"
+  >
+) => (
+  <I18nDictionariesProvider
+    defaults={importJavaClassesWizardI18nDefaults}
+    dictionaries={importJavaClassesWizardI18nDictionaries}
+    initialLocale={navigator.language}
+    ctx={ImportJavaClassesWizardI18nContext}
+    {...props}
+  />
+);
+
+const ImportJavaClasses = ({
+  javaCodeCompletionService,
+  gwtLayerService,
+  loadJavaClassesInDataTypeEditor,
+}: ImportJavaClassesProps) => {
+  const [isOpen, setOpen] = useState(false);
path: packages/import-java-classes-component/src/components/ImportJavaClasses/ImportJavaClasses.tsx
user: login: Adarshvk98
body: I’ve added a descriptive variable name for the variable here as well.
created_at: 2025-04-03T08:03:17Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import * as React from "react";
+import { useCallback, useState } from "react";
+import { DropdownItem } from "@patternfly/react-core/dist/js/components/Dropdown";
+import { Spinner } from "@patternfly/react-core/dist/esm/components/Spinner";
+import PlusIcon from "@patternfly/react-icons/dist/js/icons/plus-icon";
+import { Tooltip } from "@patternfly/react-core/dist/js/components/Tooltip";
+import { Modal, ModalVariant } from "@patternfly/react-core/dist/js/components/Modal";
+import { Button } from "@patternfly/react-core/dist/js/components/Button";
+import { TextContent, Text, TextVariants } from "@patternfly/react-core/dist/js/components/Text";
+import { HelperText, HelperTextItem } from "@patternfly/react-core/dist/js/components/HelperText";
path: packages/dmn-editor/src/dataTypes/ImportJavaClasses.tsx
user: login: jomarko
body: ```suggestion
```

it is unused
created_at: 2025-04-04T13:09:25Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,282 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { useCallback, useMemo, useState } from "react";
+import { JavaClass, JavaCodeCompletionService } from "@kie-tools/import-java-classes-component";
+import { useExternalModels } from "../includedModels/DmnEditorDependenciesContext";
+import { useDmnEditorStore, useDmnEditorStoreApi } from "../store/StoreContext";
+import { findDataTypeById, getNewItemDefinition } from "./DataTypeSpec";
+import { EditItemDefinition } from "./DataTypes";
+
+const NAME_SEPARATOR: string = "-";
+
+export enum JavaClassConflictOptions {
+  REPLACE = "Replace",
+  KEEP_BOTH = "Keep Both",
+}
+
+const useImportJavaClasses = () => {
+  const [isConflictsOccured, setIsConflictsOccured] = useState<boolean>(false);
+  const [conflictsClasses, setConflictsClasses] = useState<JavaClass[]>([]);
+
+  const dmnEditorStoreApi = useDmnEditorStoreApi();
+  const { externalModelsByNamespace } = useExternalModels();
+  const allDataTypesById = useDmnEditorStore(
+    (s) => s.computed(s).getDataTypes(externalModelsByNamespace).allDataTypesById
+  );
+  const dataTypesTree = useDmnEditorStore((s) => s.computed(s).getDataTypes(externalModelsByNamespace).dataTypesTree);
+
+  const dataTypeNames = useMemo(() => {
+    const dataTypeNames = new Set<string>();
+    for (let i = 0, len = dataTypesTree?.length; i < len; i++) {
+      dataTypeNames.add(dataTypesTree?.[i]?.feelName || dataTypesTree?.[i]?.itemDefinition?.["@_name"]);
+    }
+    return dataTypeNames;
+  }, [dataTypesTree]);
+
+  const buildName = useCallback(
+    (nameCandidate: string, namesCount: Map<string, number>, nameSeparator: string = NAME_SEPARATOR): string => {
+      if (namesCount.has(nameCandidate)) {
+        const occurrences = namesCount.get(nameCandidate)!;
+        namesCount.set(nameCandidate, occurrences + 1);
+        return nameCandidate + nameSeparator + occurrences;
+      }
+      namesCount.set(nameCandidate, 1);
+      return nameCandidate;
+    },
+    []
+  );
+
+  const updatePropertiesReferences = useCallback(
+    (javaClasses: JavaClass[], javaClassNameToDMNTypeNameMap: Map<string, string>): JavaClass[] => {
+      return javaClasses.map((javaClass) => {
+        const namesCount: Map<string, number> = new Map();
+        const updatedFields = (javaClass ?? [])?.fields?.map((field) => {
+          const newFieldName = buildName(field?.name, namesCount);
+          if (javaClassNameToDMNTypeNameMap.has(field.type)) {
+            const renamedFieldType = javaClassNameToDMNTypeNameMap.get(field.type)!;
+            return { ...field, name: newFieldName, dmnTypeRef: renamedFieldType };
+          }
+          return { ...field, name: newFieldName };
+        });
+        return { ...javaClass, fields: updatedFields } as JavaClass;
+      });
+    },
+    [buildName]
+  );
+
+  const editItemDefinition = useCallback<EditItemDefinition>(
+    (id, consumer) => {
+      dmnEditorStoreApi.setState((state) => {
+        const { itemDefinition, items, index } = findDataTypeById({
+          definitions: state.dmn.model.definitions,
+          itemDefinitionId: id,
+          allDataTypesById,
+        });
+
+        state.dmn.model.definitions.itemDefinition ??= [];
+        consumer(itemDefinition, items, index, state.dmn.model.definitions.itemDefinition, state);
+      });
+    },
+    [allDataTypesById, dmnEditorStoreApi]
+  );
+
+  const renameJavaClassToDMNName = useCallback(
+    (javaClasses: JavaClass[]): JavaClass[] => {
+      const namesCount: Map<string, number> = new Map();
+      const javaClassNameToDMNTypeNameMap: Map<string, string> = new Map();
+
+      // Map the javaClasses to new renamed classes
+      const renamedJavaClasses = javaClasses.map((javaClass: JavaClass) => {
+        const nameCandidate = javaClass.name.substring(javaClass.name.lastIndexOf(".") + 1);
+        const newName = buildName(nameCandidate, namesCount);
+        javaClassNameToDMNTypeNameMap.set(javaClass.name, newName);
+        return { ...javaClass, name: newName } as JavaClass;
+      });
+
+      // Return the updated Java classes with renamed types
+      return updatePropertiesReferences(renamedJavaClasses, javaClassNameToDMNTypeNameMap);
+    },
+    [updatePropertiesReferences, buildName]
+  );
+
+  const generateUniqueDMNTypeNames = useCallback(
path: packages/dmn-editor/src/dataTypes/useImportJavaClasses.ts
user: login: jomarko
body: interesting, comparing `generatingUniqueDMNTypeNames` with the line 60 in the same file I am not sure, do we always have the same logic for generating a unique name?


created_at: 2025-04-04T13:25:04Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import * as React from "react";
+import { useCallback, useState } from "react";
+import { DropdownItem } from "@patternfly/react-core/dist/js/components/Dropdown";
+import { Spinner } from "@patternfly/react-core/dist/esm/components/Spinner";
+import PlusIcon from "@patternfly/react-icons/dist/js/icons/plus-icon";
+import { Tooltip } from "@patternfly/react-core/dist/js/components/Tooltip";
+import { Modal, ModalVariant } from "@patternfly/react-core/dist/js/components/Modal";
+import { Button } from "@patternfly/react-core/dist/js/components/Button";
+import { TextContent, Text, TextVariants } from "@patternfly/react-core/dist/js/components/Text";
+import { HelperText, HelperTextItem } from "@patternfly/react-core/dist/js/components/HelperText";
path: packages/dmn-editor/src/dataTypes/ImportJavaClasses.tsx
user: login: Adarshvk98
body: Thanks for pointing that out. I’ve removed the import statement
created_at: 2025-04-07T04:02:32Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,282 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { useCallback, useMemo, useState } from "react";
+import { JavaClass, JavaCodeCompletionService } from "@kie-tools/import-java-classes-component";
+import { useExternalModels } from "../includedModels/DmnEditorDependenciesContext";
+import { useDmnEditorStore, useDmnEditorStoreApi } from "../store/StoreContext";
+import { findDataTypeById, getNewItemDefinition } from "./DataTypeSpec";
+import { EditItemDefinition } from "./DataTypes";
+
+const NAME_SEPARATOR: string = "-";
+
+export enum JavaClassConflictOptions {
+  REPLACE = "Replace",
+  KEEP_BOTH = "Keep Both",
+}
+
+const useImportJavaClasses = () => {
+  const [isConflictsOccured, setIsConflictsOccured] = useState<boolean>(false);
+  const [conflictsClasses, setConflictsClasses] = useState<JavaClass[]>([]);
+
+  const dmnEditorStoreApi = useDmnEditorStoreApi();
+  const { externalModelsByNamespace } = useExternalModels();
+  const allDataTypesById = useDmnEditorStore(
+    (s) => s.computed(s).getDataTypes(externalModelsByNamespace).allDataTypesById
+  );
+  const dataTypesTree = useDmnEditorStore((s) => s.computed(s).getDataTypes(externalModelsByNamespace).dataTypesTree);
+
+  const dataTypeNames = useMemo(() => {
+    const dataTypeNames = new Set<string>();
+    for (let i = 0, len = dataTypesTree?.length; i < len; i++) {
+      dataTypeNames.add(dataTypesTree?.[i]?.feelName || dataTypesTree?.[i]?.itemDefinition?.["@_name"]);
+    }
+    return dataTypeNames;
+  }, [dataTypesTree]);
+
+  const buildName = useCallback(
+    (nameCandidate: string, namesCount: Map<string, number>, nameSeparator: string = NAME_SEPARATOR): string => {
+      if (namesCount.has(nameCandidate)) {
+        const occurrences = namesCount.get(nameCandidate)!;
+        namesCount.set(nameCandidate, occurrences + 1);
+        return nameCandidate + nameSeparator + occurrences;
+      }
+      namesCount.set(nameCandidate, 1);
+      return nameCandidate;
+    },
+    []
+  );
+
+  const updatePropertiesReferences = useCallback(
+    (javaClasses: JavaClass[], javaClassNameToDMNTypeNameMap: Map<string, string>): JavaClass[] => {
+      return javaClasses.map((javaClass) => {
+        const namesCount: Map<string, number> = new Map();
+        const updatedFields = (javaClass ?? [])?.fields?.map((field) => {
+          const newFieldName = buildName(field?.name, namesCount);
+          if (javaClassNameToDMNTypeNameMap.has(field.type)) {
+            const renamedFieldType = javaClassNameToDMNTypeNameMap.get(field.type)!;
+            return { ...field, name: newFieldName, dmnTypeRef: renamedFieldType };
+          }
+          return { ...field, name: newFieldName };
+        });
+        return { ...javaClass, fields: updatedFields } as JavaClass;
+      });
+    },
+    [buildName]
+  );
+
+  const editItemDefinition = useCallback<EditItemDefinition>(
+    (id, consumer) => {
+      dmnEditorStoreApi.setState((state) => {
+        const { itemDefinition, items, index } = findDataTypeById({
+          definitions: state.dmn.model.definitions,
+          itemDefinitionId: id,
+          allDataTypesById,
+        });
+
+        state.dmn.model.definitions.itemDefinition ??= [];
+        consumer(itemDefinition, items, index, state.dmn.model.definitions.itemDefinition, state);
+      });
+    },
+    [allDataTypesById, dmnEditorStoreApi]
+  );
+
+  const renameJavaClassToDMNName = useCallback(
+    (javaClasses: JavaClass[]): JavaClass[] => {
+      const namesCount: Map<string, number> = new Map();
+      const javaClassNameToDMNTypeNameMap: Map<string, string> = new Map();
+
+      // Map the javaClasses to new renamed classes
+      const renamedJavaClasses = javaClasses.map((javaClass: JavaClass) => {
+        const nameCandidate = javaClass.name.substring(javaClass.name.lastIndexOf(".") + 1);
+        const newName = buildName(nameCandidate, namesCount);
+        javaClassNameToDMNTypeNameMap.set(javaClass.name, newName);
+        return { ...javaClass, name: newName } as JavaClass;
+      });
+
+      // Return the updated Java classes with renamed types
+      return updatePropertiesReferences(renamedJavaClasses, javaClassNameToDMNTypeNameMap);
+    },
+    [updatePropertiesReferences, buildName]
+  );
+
+  const generateUniqueDMNTypeNames = useCallback(
path: packages/dmn-editor/src/dataTypes/useImportJavaClasses.ts
user: login: Adarshvk98
body: There are two cases in which we need to rename the DMN type. The first case occurs when there are conflicting class names within the selected Java classes by the user. The second case happens when there is a conflict of class names from the existing DMN type.

The `generatingUniqueDMNTypeNames` function is used to solve the second case. Therefore, there are a few logical changes required, so I keep it separate. I’m not sure if this is what you were trying to point out here.
created_at: 2025-04-07T04:29:44Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,282 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { useCallback, useMemo, useState } from "react";
+import { JavaClass, JavaCodeCompletionService } from "@kie-tools/import-java-classes-component";
+import { useExternalModels } from "../includedModels/DmnEditorDependenciesContext";
+import { useDmnEditorStore, useDmnEditorStoreApi } from "../store/StoreContext";
+import { findDataTypeById, getNewItemDefinition } from "./DataTypeSpec";
+import { EditItemDefinition } from "./DataTypes";
+
+const NAME_SEPARATOR: string = "-";
+
+export enum JavaClassConflictOptions {
+  REPLACE = "Replace",
+  KEEP_BOTH = "Keep Both",
+}
+
+const useImportJavaClasses = () => {
+  const [isConflictsOccured, setIsConflictsOccured] = useState<boolean>(false);
+  const [conflictsClasses, setConflictsClasses] = useState<JavaClass[]>([]);
+
+  const dmnEditorStoreApi = useDmnEditorStoreApi();
+  const { externalModelsByNamespace } = useExternalModels();
+  const allDataTypesById = useDmnEditorStore(
+    (s) => s.computed(s).getDataTypes(externalModelsByNamespace).allDataTypesById
+  );
+  const dataTypesTree = useDmnEditorStore((s) => s.computed(s).getDataTypes(externalModelsByNamespace).dataTypesTree);
+
+  const dataTypeNames = useMemo(() => {
+    const dataTypeNames = new Set<string>();
+    for (let i = 0, len = dataTypesTree?.length; i < len; i++) {
+      dataTypeNames.add(dataTypesTree?.[i]?.feelName || dataTypesTree?.[i]?.itemDefinition?.["@_name"]);
+    }
+    return dataTypeNames;
+  }, [dataTypesTree]);
+
+  const buildName = useCallback(
+    (nameCandidate: string, namesCount: Map<string, number>, nameSeparator: string = NAME_SEPARATOR): string => {
+      if (namesCount.has(nameCandidate)) {
+        const occurrences = namesCount.get(nameCandidate)!;
+        namesCount.set(nameCandidate, occurrences + 1);
+        return nameCandidate + nameSeparator + occurrences;
+      }
+      namesCount.set(nameCandidate, 1);
+      return nameCandidate;
+    },
+    []
+  );
+
+  const updatePropertiesReferences = useCallback(
+    (javaClasses: JavaClass[], javaClassNameToDMNTypeNameMap: Map<string, string>): JavaClass[] => {
+      return javaClasses.map((javaClass) => {
+        const namesCount: Map<string, number> = new Map();
+        const updatedFields = (javaClass ?? [])?.fields?.map((field) => {
+          const newFieldName = buildName(field?.name, namesCount);
+          if (javaClassNameToDMNTypeNameMap.has(field.type)) {
+            const renamedFieldType = javaClassNameToDMNTypeNameMap.get(field.type)!;
+            return { ...field, name: newFieldName, dmnTypeRef: renamedFieldType };
+          }
+          return { ...field, name: newFieldName };
+        });
+        return { ...javaClass, fields: updatedFields } as JavaClass;
+      });
+    },
+    [buildName]
+  );
+
+  const editItemDefinition = useCallback<EditItemDefinition>(
+    (id, consumer) => {
+      dmnEditorStoreApi.setState((state) => {
+        const { itemDefinition, items, index } = findDataTypeById({
+          definitions: state.dmn.model.definitions,
+          itemDefinitionId: id,
+          allDataTypesById,
+        });
+
+        state.dmn.model.definitions.itemDefinition ??= [];
+        consumer(itemDefinition, items, index, state.dmn.model.definitions.itemDefinition, state);
+      });
+    },
+    [allDataTypesById, dmnEditorStoreApi]
+  );
+
+  const renameJavaClassToDMNName = useCallback(
+    (javaClasses: JavaClass[]): JavaClass[] => {
+      const namesCount: Map<string, number> = new Map();
+      const javaClassNameToDMNTypeNameMap: Map<string, string> = new Map();
+
+      // Map the javaClasses to new renamed classes
+      const renamedJavaClasses = javaClasses.map((javaClass: JavaClass) => {
+        const nameCandidate = javaClass.name.substring(javaClass.name.lastIndexOf(".") + 1);
+        const newName = buildName(nameCandidate, namesCount);
+        javaClassNameToDMNTypeNameMap.set(javaClass.name, newName);
+        return { ...javaClass, name: newName } as JavaClass;
+      });
+
+      // Return the updated Java classes with renamed types
+      return updatePropertiesReferences(renamedJavaClasses, javaClassNameToDMNTypeNameMap);
+    },
+    [updatePropertiesReferences, buildName]
+  );
+
+  const generateUniqueDMNTypeNames = useCallback(
path: packages/dmn-editor/src/dataTypes/useImportJavaClasses.ts
user: login: jomarko
body: ok
created_at: 2025-04-07T09:05:24Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,282 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { useCallback, useMemo, useState } from "react";
+import { JavaClass, JavaCodeCompletionService } from "@kie-tools/import-java-classes-component";
+import { useExternalModels } from "../includedModels/DmnEditorDependenciesContext";
+import { useDmnEditorStore, useDmnEditorStoreApi } from "../store/StoreContext";
+import { findDataTypeById, getNewItemDefinition } from "./DataTypeSpec";
+import { EditItemDefinition } from "./DataTypes";
+
+const NAME_SEPARATOR: string = "-";
+
+export enum JavaClassConflictOptions {
+  REPLACE = "Replace",
+  KEEP_BOTH = "Keep Both",
+}
+
+const useImportJavaClasses = () => {
+  const [isConflictsOccured, setIsConflictsOccured] = useState<boolean>(false);
+  const [conflictsClasses, setConflictsClasses] = useState<JavaClass[]>([]);
+
+  const dmnEditorStoreApi = useDmnEditorStoreApi();
+  const { externalModelsByNamespace } = useExternalModels();
+  const allDataTypesById = useDmnEditorStore(
+    (s) => s.computed(s).getDataTypes(externalModelsByNamespace).allDataTypesById
+  );
+  const dataTypesTree = useDmnEditorStore((s) => s.computed(s).getDataTypes(externalModelsByNamespace).dataTypesTree);
+
+  const dataTypeNames = useMemo(() => {
+    const dataTypeNames = new Set<string>();
+    for (let i = 0, len = dataTypesTree?.length; i < len; i++) {
+      dataTypeNames.add(dataTypesTree?.[i]?.feelName || dataTypesTree?.[i]?.itemDefinition?.["@_name"]);
+    }
+    return dataTypeNames;
+  }, [dataTypesTree]);
+
+  const buildName = useCallback(
+    (nameCandidate: string, namesCount: Map<string, number>, nameSeparator: string = NAME_SEPARATOR): string => {
+      if (namesCount.has(nameCandidate)) {
+        const occurrences = namesCount.get(nameCandidate)!;
+        namesCount.set(nameCandidate, occurrences + 1);
+        return nameCandidate + nameSeparator + occurrences;
+      }
+      namesCount.set(nameCandidate, 1);
+      return nameCandidate;
+    },
+    []
+  );
+
+  const updatePropertiesReferences = useCallback(
+    (javaClasses: JavaClass[], javaClassNameToDMNTypeNameMap: Map<string, string>): JavaClass[] => {
+      return javaClasses.map((javaClass) => {
+        const namesCount: Map<string, number> = new Map();
+        const updatedFields = (javaClass ?? [])?.fields?.map((field) => {
+          const newFieldName = buildName(field?.name, namesCount);
+          if (javaClassNameToDMNTypeNameMap.has(field.type)) {
+            const renamedFieldType = javaClassNameToDMNTypeNameMap.get(field.type)!;
+            return { ...field, name: newFieldName, dmnTypeRef: renamedFieldType };
+          }
+          return { ...field, name: newFieldName };
+        });
+        return { ...javaClass, fields: updatedFields } as JavaClass;
+      });
+    },
+    [buildName]
+  );
+
+  const editItemDefinition = useCallback<EditItemDefinition>(
+    (id, consumer) => {
+      dmnEditorStoreApi.setState((state) => {
+        const { itemDefinition, items, index } = findDataTypeById({
+          definitions: state.dmn.model.definitions,
+          itemDefinitionId: id,
+          allDataTypesById,
+        });
+
+        state.dmn.model.definitions.itemDefinition ??= [];
+        consumer(itemDefinition, items, index, state.dmn.model.definitions.itemDefinition, state);
+      });
+    },
+    [allDataTypesById, dmnEditorStoreApi]
+  );
+
+  const renameJavaClassToDMNName = useCallback(
+    (javaClasses: JavaClass[]): JavaClass[] => {
+      const namesCount: Map<string, number> = new Map();
+      const javaClassNameToDMNTypeNameMap: Map<string, string> = new Map();
+
+      // Map the javaClasses to new renamed classes
+      const renamedJavaClasses = javaClasses.map((javaClass: JavaClass) => {
+        const nameCandidate = javaClass.name.substring(javaClass.name.lastIndexOf(".") + 1);
+        const newName = buildName(nameCandidate, namesCount);
+        javaClassNameToDMNTypeNameMap.set(javaClass.name, newName);
+        return { ...javaClass, name: newName } as JavaClass;
+      });
+
+      // Return the updated Java classes with renamed types
+      return updatePropertiesReferences(renamedJavaClasses, javaClassNameToDMNTypeNameMap);
+    },
+    [updatePropertiesReferences, buildName]
+  );
+
+  const generateUniqueDMNTypeNames = useCallback(
path: packages/dmn-editor/src/dataTypes/useImportJavaClasses.ts
user: login: tiagobento
body: ```suggestion
  const generateUniqueDmnTypeNames = useCallback(
```
created_at: 2025-04-08T15:31:09Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,282 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { useCallback, useMemo, useState } from "react";
+import { JavaClass, JavaCodeCompletionService } from "@kie-tools/import-java-classes-component";
+import { useExternalModels } from "../includedModels/DmnEditorDependenciesContext";
+import { useDmnEditorStore, useDmnEditorStoreApi } from "../store/StoreContext";
+import { findDataTypeById, getNewItemDefinition } from "./DataTypeSpec";
+import { EditItemDefinition } from "./DataTypes";
+
+const NAME_SEPARATOR: string = "-";
+
+export enum JavaClassConflictOptions {
+  REPLACE = "Replace",
+  KEEP_BOTH = "Keep Both",
+}
+
+const useImportJavaClasses = () => {
+  const [isConflictsOccured, setIsConflictsOccured] = useState<boolean>(false);
+  const [conflictsClasses, setConflictsClasses] = useState<JavaClass[]>([]);
+
+  const dmnEditorStoreApi = useDmnEditorStoreApi();
+  const { externalModelsByNamespace } = useExternalModels();
+  const allDataTypesById = useDmnEditorStore(
+    (s) => s.computed(s).getDataTypes(externalModelsByNamespace).allDataTypesById
+  );
+  const dataTypesTree = useDmnEditorStore((s) => s.computed(s).getDataTypes(externalModelsByNamespace).dataTypesTree);
+
+  const dataTypeNames = useMemo(() => {
+    const dataTypeNames = new Set<string>();
+    for (let i = 0, len = dataTypesTree?.length; i < len; i++) {
+      dataTypeNames.add(dataTypesTree?.[i]?.feelName || dataTypesTree?.[i]?.itemDefinition?.["@_name"]);
+    }
+    return dataTypeNames;
+  }, [dataTypesTree]);
+
+  const buildName = useCallback(
+    (nameCandidate: string, namesCount: Map<string, number>, nameSeparator: string = NAME_SEPARATOR): string => {
+      if (namesCount.has(nameCandidate)) {
+        const occurrences = namesCount.get(nameCandidate)!;
+        namesCount.set(nameCandidate, occurrences + 1);
+        return nameCandidate + nameSeparator + occurrences;
+      }
+      namesCount.set(nameCandidate, 1);
+      return nameCandidate;
+    },
+    []
+  );
+
+  const updatePropertiesReferences = useCallback(
+    (javaClasses: JavaClass[], javaClassNameToDMNTypeNameMap: Map<string, string>): JavaClass[] => {
+      return javaClasses.map((javaClass) => {
+        const namesCount: Map<string, number> = new Map();
+        const updatedFields = (javaClass ?? [])?.fields?.map((field) => {
+          const newFieldName = buildName(field?.name, namesCount);
+          if (javaClassNameToDMNTypeNameMap.has(field.type)) {
+            const renamedFieldType = javaClassNameToDMNTypeNameMap.get(field.type)!;
+            return { ...field, name: newFieldName, dmnTypeRef: renamedFieldType };
+          }
+          return { ...field, name: newFieldName };
+        });
+        return { ...javaClass, fields: updatedFields } as JavaClass;
+      });
+    },
+    [buildName]
+  );
+
+  const editItemDefinition = useCallback<EditItemDefinition>(
+    (id, consumer) => {
+      dmnEditorStoreApi.setState((state) => {
+        const { itemDefinition, items, index } = findDataTypeById({
+          definitions: state.dmn.model.definitions,
+          itemDefinitionId: id,
+          allDataTypesById,
+        });
+
+        state.dmn.model.definitions.itemDefinition ??= [];
+        consumer(itemDefinition, items, index, state.dmn.model.definitions.itemDefinition, state);
+      });
+    },
+    [allDataTypesById, dmnEditorStoreApi]
+  );
+
+  const renameJavaClassToDMNName = useCallback(
+    (javaClasses: JavaClass[]): JavaClass[] => {
+      const namesCount: Map<string, number> = new Map();
+      const javaClassNameToDMNTypeNameMap: Map<string, string> = new Map();
+
+      // Map the javaClasses to new renamed classes
+      const renamedJavaClasses = javaClasses.map((javaClass: JavaClass) => {
+        const nameCandidate = javaClass.name.substring(javaClass.name.lastIndexOf(".") + 1);
+        const newName = buildName(nameCandidate, namesCount);
+        javaClassNameToDMNTypeNameMap.set(javaClass.name, newName);
+        return { ...javaClass, name: newName } as JavaClass;
+      });
+
+      // Return the updated Java classes with renamed types
+      return updatePropertiesReferences(renamedJavaClasses, javaClassNameToDMNTypeNameMap);
+    },
+    [updatePropertiesReferences, buildName]
+  );
+
+  const generateUniqueDMNTypeNames = useCallback(
path: packages/dmn-editor/src/dataTypes/useImportJavaClasses.ts
user: login: Adarshvk98
body: I’ve made the changes. Please take a look
created_at: 2025-04-09T10:56:38Z
author_association: CONTRIBUTOR
diff_hunk: @@ -230,6 +243,16 @@ export function DataTypes() {
                         position={DropdownPosition.right}
                         isOpen={isAddDataTypeDropdownOpen}
                         dropdownItems={[
+                          settings?.isImportDataTypesFromJavaClassesSupported ? (
+                            <ImportJavaClassesI18nDictionariesProvider key={"import-java-classes"}>
+                              <ImportJavaClassesDropdownItem
+                                javaCodeCompletionService={settings?.javaCodeCompletionService!}
path: packages/dmn-editor/src/dataTypes/DataTypes.tsx
user: login: thiagoelg
body: This can't be `undefined` as per the `ImportJavaClassesDropdownItem` props type... Maybe add a check to the conditional above.
created_at: 2025-04-09T14:20:47Z
author_association: MEMBER
diff_hunk: @@ -230,6 +243,16 @@ export function DataTypes() {
                         position={DropdownPosition.right}
                         isOpen={isAddDataTypeDropdownOpen}
                         dropdownItems={[
+                          settings?.isImportDataTypesFromJavaClassesSupported ? (
+                            <ImportJavaClassesI18nDictionariesProvider key={"import-java-classes"}>
+                              <ImportJavaClassesDropdownItem
+                                javaCodeCompletionService={settings?.javaCodeCompletionService!}
+                                onClick={handleImportJavaClassButtonClick}
+                              />
+                            </ImportJavaClassesI18nDictionariesProvider>
+                          ) : (
+                            <></>
path: packages/dmn-editor/src/dataTypes/DataTypes.tsx
user: login: thiagoelg
body: This will add an empty Dropdown Item if `settings?.isImportDataTypesFromJavaClassesSupported` is false. Won't that look weird?
created_at: 2025-04-09T14:22:16Z
author_association: MEMBER
diff_hunk: @@ -311,6 +334,23 @@ export function DataTypes() {
                   editItemDefinition={editItemDefinition}
                 />
               )}
+              {isOpenImportJavaClassesWizard && (
+                <ImportJavaClassesI18nDictionariesProvider>
+                  <ImportJavaClassesWizard
+                    javaCodeCompletionService={settings?.javaCodeCompletionService!}
path: packages/dmn-editor/src/dataTypes/DataTypes.tsx
user: login: thiagoelg
body: Same issue here, `javaCodeCompletionService` can't be undefined, add it to the check above.
created_at: 2025-04-09T14:22:51Z
author_association: MEMBER
diff_hunk: @@ -54,9 +55,17 @@ export function DataTypesEmptyState({ onAdd, onPaste }: { onAdd: () => void; onP
               </Button>
             </EmptyStatePrimary>
             <br />
-            <br />
+            {settings?.isImportDataTypesFromJavaClassesSupported && (
+              <>
+                or
+                <br />
+                <br />
+                <ImportJavaClassesWrapper javaCodeCompletionService={settings?.javaCodeCompletionService!} />
path: packages/dmn-editor/src/dataTypes/DataTypesEmptyState.tsx
user: login: thiagoelg
body: Last one 😄 
created_at: 2025-04-09T14:23:19Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import * as React from "react";
+import { useCallback, useState } from "react";
+import { DropdownItem } from "@patternfly/react-core/dist/js/components/Dropdown";
+import { Spinner } from "@patternfly/react-core/dist/esm/components/Spinner";
+import PlusIcon from "@patternfly/react-icons/dist/js/icons/plus-icon";
+import { Tooltip } from "@patternfly/react-core/dist/js/components/Tooltip";
+import { Modal, ModalVariant } from "@patternfly/react-core/dist/js/components/Modal";
+import { Button } from "@patternfly/react-core/dist/js/components/Button";
+import { TextContent, Text, TextVariants } from "@patternfly/react-core/dist/js/components/Text";
+import {
+  ImportJavaClasses,
+  JavaClass,
+  JavaCodeCompletionService,
+  useImportJavaClassesWizardI18n,
+  useLanguageServerAvailable,
+} from "@kie-tools/import-java-classes-component";
+import { addTopLevelItemDefinition as _addTopLevelItemDefinition } from "../mutations/addTopLevelItemDefinition";
+import { JavaClassConflictOptions, useImportJavaClasses } from "./useImportJavaClasses";
+import { Radio } from "@patternfly/react-core/dist/esm/components/Radio";
+
+const ImportJavaClassesWrapper = ({
+  javaCodeCompletionService,
+}: {
+  javaCodeCompletionService: JavaCodeCompletionService;
+}) => {
+  const { handleConflictAction, handleImportJavaClasses, conflictsClasses, isConflictsOccured } =
+    useImportJavaClasses();
+  return (
+    <>
+      <ImportJavaClasses
+        loadJavaClassesInDataTypeEditor={handleImportJavaClasses}
+        javaCodeCompletionService={javaCodeCompletionService}
+      />
+      {isConflictsOccured && conflictsClasses?.length > 0 && (
+        <ImportJavaClassNameConflictsModal
+          isOpen={isConflictsOccured}
+          handleConfirm={handleConflictAction}
+          conflictsNames={conflictsClasses}
+        />
+      )}
+    </>
+  );
+};
+
+const ImportJavaClassesDropdownItem = ({
+  javaCodeCompletionService,
+  ...props
+}: React.ComponentProps<typeof DropdownItem> & { javaCodeCompletionService: JavaCodeCompletionService }) => {
+  const { i18n } = useImportJavaClassesWizardI18n();
+  const { isLanguageServerLoading, isLanguageServerDisabled, isLanguageServerError } =
+    useLanguageServerAvailable(javaCodeCompletionService);
+  const defineTooltipMessage = React.useCallback(() => {
+    if (isLanguageServerDisabled) {
+      return i18n.modalButton.disabledMessage;
+    } else if (isLanguageServerError) {
+      return i18n.modalButton.errorMessage;
+    }
+    return undefined;
+  }, [
+    isLanguageServerDisabled,
+    isLanguageServerError,
+    i18n.modalButton.disabledMessage,
+    i18n.modalButton.errorMessage,
+  ]);
+  return (
+    <>
+      {defineTooltipMessage() ? (
+        <Tooltip content={defineTooltipMessage()}>
+          <DropdownItem
+            style={{ minWidth: "240px" }}
+            icon={isLanguageServerLoading ? <Spinner size="md" /> : <PlusIcon />}
+            isDisabled={isLanguageServerDisabled || isLanguageServerLoading}
+            {...props}
+          >
+            {i18n.modalButton.text}
+          </DropdownItem>
+        </Tooltip>
+      ) : (
+        <DropdownItem
+          style={{ minWidth: "240px" }}
+          icon={isLanguageServerLoading ? <Spinner size="md" /> : <PlusIcon />}
+          isDisabled={isLanguageServerDisabled || isLanguageServerLoading}
+          {...props}
+        >
+          {i18n.modalButton.text}
+        </DropdownItem>
+      )}
+    </>
+  );
+};
+
+const ImportJavaClassNameConflictsModal = ({
+  isOpen,
+  handleConfirm,
+  conflictsNames,
+}: {
+  isOpen: boolean;
+  handleConfirm: (options: JavaClassConflictOptions) => void;
+  conflictsNames: JavaClass[];
path: packages/dmn-editor/src/dataTypes/ImportJavaClasses.tsx
user: login: thiagoelg
body: ```suggestion
  confliectedJavaClasses: JavaClass[];
```

I think this better represents what the prop actually is, WDYT?
created_at: 2025-04-09T14:25:36Z
author_association: MEMBER
diff_hunk: @@ -230,6 +243,16 @@ export function DataTypes() {
                         position={DropdownPosition.right}
                         isOpen={isAddDataTypeDropdownOpen}
                         dropdownItems={[
+                          settings?.isImportDataTypesFromJavaClassesSupported ? (
+                            <ImportJavaClassesI18nDictionariesProvider key={"import-java-classes"}>
+                              <ImportJavaClassesDropdownItem
+                                javaCodeCompletionService={settings?.javaCodeCompletionService!}
path: packages/dmn-editor/src/dataTypes/DataTypes.tsx
user: login: Adarshvk98
body: Thanks for taking the time to review this. I’ve made the changes. Please have a look.
created_at: 2025-04-09T16:12:44Z
author_association: CONTRIBUTOR
diff_hunk: @@ -230,6 +243,16 @@ export function DataTypes() {
                         position={DropdownPosition.right}
                         isOpen={isAddDataTypeDropdownOpen}
                         dropdownItems={[
+                          settings?.isImportDataTypesFromJavaClassesSupported ? (
+                            <ImportJavaClassesI18nDictionariesProvider key={"import-java-classes"}>
+                              <ImportJavaClassesDropdownItem
+                                javaCodeCompletionService={settings?.javaCodeCompletionService!}
+                                onClick={handleImportJavaClassButtonClick}
+                              />
+                            </ImportJavaClassesI18nDictionariesProvider>
+                          ) : (
+                            <></>
path: packages/dmn-editor/src/dataTypes/DataTypes.tsx
user: login: Adarshvk98
body: Yes, I agree. I made those changes as well
created_at: 2025-04-09T16:13:58Z
author_association: CONTRIBUTOR
diff_hunk: @@ -311,6 +334,23 @@ export function DataTypes() {
                   editItemDefinition={editItemDefinition}
                 />
               )}
+              {isOpenImportJavaClassesWizard && (
+                <ImportJavaClassesI18nDictionariesProvider>
+                  <ImportJavaClassesWizard
+                    javaCodeCompletionService={settings?.javaCodeCompletionService!}
path: packages/dmn-editor/src/dataTypes/DataTypes.tsx
user: login: Adarshvk98
body: done
created_at: 2025-04-09T16:14:05Z
author_association: CONTRIBUTOR
diff_hunk: @@ -54,9 +55,17 @@ export function DataTypesEmptyState({ onAdd, onPaste }: { onAdd: () => void; onP
               </Button>
             </EmptyStatePrimary>
             <br />
-            <br />
+            {settings?.isImportDataTypesFromJavaClassesSupported && (
+              <>
+                or
+                <br />
+                <br />
+                <ImportJavaClassesWrapper javaCodeCompletionService={settings?.javaCodeCompletionService!} />
path: packages/dmn-editor/src/dataTypes/DataTypesEmptyState.tsx
user: login: Adarshvk98
body: done
created_at: 2025-04-09T16:14:14Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import * as React from "react";
+import { useCallback, useState } from "react";
+import { DropdownItem } from "@patternfly/react-core/dist/js/components/Dropdown";
+import { Spinner } from "@patternfly/react-core/dist/esm/components/Spinner";
+import PlusIcon from "@patternfly/react-icons/dist/js/icons/plus-icon";
+import { Tooltip } from "@patternfly/react-core/dist/js/components/Tooltip";
+import { Modal, ModalVariant } from "@patternfly/react-core/dist/js/components/Modal";
+import { Button } from "@patternfly/react-core/dist/js/components/Button";
+import { TextContent, Text, TextVariants } from "@patternfly/react-core/dist/js/components/Text";
+import {
+  ImportJavaClasses,
+  JavaClass,
+  JavaCodeCompletionService,
+  useImportJavaClassesWizardI18n,
+  useLanguageServerAvailable,
+} from "@kie-tools/import-java-classes-component";
+import { addTopLevelItemDefinition as _addTopLevelItemDefinition } from "../mutations/addTopLevelItemDefinition";
+import { JavaClassConflictOptions, useImportJavaClasses } from "./useImportJavaClasses";
+import { Radio } from "@patternfly/react-core/dist/esm/components/Radio";
+
+const ImportJavaClassesWrapper = ({
+  javaCodeCompletionService,
+}: {
+  javaCodeCompletionService: JavaCodeCompletionService;
+}) => {
+  const { handleConflictAction, handleImportJavaClasses, conflictsClasses, isConflictsOccured } =
+    useImportJavaClasses();
+  return (
+    <>
+      <ImportJavaClasses
+        loadJavaClassesInDataTypeEditor={handleImportJavaClasses}
+        javaCodeCompletionService={javaCodeCompletionService}
+      />
+      {isConflictsOccured && conflictsClasses?.length > 0 && (
+        <ImportJavaClassNameConflictsModal
+          isOpen={isConflictsOccured}
+          handleConfirm={handleConflictAction}
+          conflictsNames={conflictsClasses}
+        />
+      )}
+    </>
+  );
+};
+
+const ImportJavaClassesDropdownItem = ({
+  javaCodeCompletionService,
+  ...props
+}: React.ComponentProps<typeof DropdownItem> & { javaCodeCompletionService: JavaCodeCompletionService }) => {
+  const { i18n } = useImportJavaClassesWizardI18n();
+  const { isLanguageServerLoading, isLanguageServerDisabled, isLanguageServerError } =
+    useLanguageServerAvailable(javaCodeCompletionService);
+  const defineTooltipMessage = React.useCallback(() => {
+    if (isLanguageServerDisabled) {
+      return i18n.modalButton.disabledMessage;
+    } else if (isLanguageServerError) {
+      return i18n.modalButton.errorMessage;
+    }
+    return undefined;
+  }, [
+    isLanguageServerDisabled,
+    isLanguageServerError,
+    i18n.modalButton.disabledMessage,
+    i18n.modalButton.errorMessage,
+  ]);
+  return (
+    <>
+      {defineTooltipMessage() ? (
+        <Tooltip content={defineTooltipMessage()}>
+          <DropdownItem
+            style={{ minWidth: "240px" }}
+            icon={isLanguageServerLoading ? <Spinner size="md" /> : <PlusIcon />}
+            isDisabled={isLanguageServerDisabled || isLanguageServerLoading}
+            {...props}
+          >
+            {i18n.modalButton.text}
+          </DropdownItem>
+        </Tooltip>
+      ) : (
+        <DropdownItem
+          style={{ minWidth: "240px" }}
+          icon={isLanguageServerLoading ? <Spinner size="md" /> : <PlusIcon />}
+          isDisabled={isLanguageServerDisabled || isLanguageServerLoading}
+          {...props}
+        >
+          {i18n.modalButton.text}
+        </DropdownItem>
+      )}
+    </>
+  );
+};
+
+const ImportJavaClassNameConflictsModal = ({
+  isOpen,
+  handleConfirm,
+  conflictsNames,
+}: {
+  isOpen: boolean;
+  handleConfirm: (options: JavaClassConflictOptions) => void;
+  conflictsNames: JavaClass[];
path: packages/dmn-editor/src/dataTypes/ImportJavaClasses.tsx
user: login: Adarshvk98
body: `confliectedJavaClasses` will be a good one. Thanks. I’ve renamed the variable.
created_at: 2025-04-09T16:15:34Z
author_association: CONTRIBUTOR
diff_hunk: @@ -169,13 +182,37 @@ export function DataTypes() {
         addTopLevelItemDefinition(itemDefinition);
       }
     });
-  }, [addTopLevelItemDefinition, settings.isReadOnly]);
+  }, [addTopLevelItemDefinition, isReadOnly]);
 
   const [isAddDataTypeDropdownOpen, setAddDataTypeDropdownOpen] = useState(false);
 
   // Using this object because DropdownToggleAction's props doesn't accept a 'title'.
   const extraPropsForDropdownToggleAction = { title: "New Data Type" };
 
+  const addDataTypesDropdownItems = useMemo(() => {
+    const dropdownItems = [
+      <DropdownItem
+        key={"paste"}
+        onClick={() => pasteTopLevelItemDefinition()}
+        style={{ minWidth: "240px" }}
+        icon={<PasteIcon />}
+      >
+        Paste
+      </DropdownItem>,
+    ];
+    if (isImportDataTypesFromJavaClassesSupported && javaCodeCompletionService) {
+      dropdownItems.unshift(
+        <ImportJavaClassesI18nDictionariesProvider key={"import-java-classes"}>
+          <ImportJavaClassesDropdownItem
+            javaCodeCompletionService={javaCodeCompletionService}
+            onClick={handleImportJavaClassButtonClick}
+          />
+        </ImportJavaClassesI18nDictionariesProvider>
+      );
+    }
+    return dropdownItems;
+  }, [isImportDataTypesFromJavaClassesSupported, javaCodeCompletionService]);
path: packages/dmn-editor/src/dataTypes/DataTypes.tsx
user: login: tiagobento
body: Missing dependency hooks here...
created_at: 2025-04-09T18:45:37Z
author_association: CONTRIBUTOR
diff_hunk: @@ -169,13 +182,37 @@ export function DataTypes() {
         addTopLevelItemDefinition(itemDefinition);
       }
     });
-  }, [addTopLevelItemDefinition, settings.isReadOnly]);
+  }, [addTopLevelItemDefinition, isReadOnly]);
 
   const [isAddDataTypeDropdownOpen, setAddDataTypeDropdownOpen] = useState(false);
 
   // Using this object because DropdownToggleAction's props doesn't accept a 'title'.
   const extraPropsForDropdownToggleAction = { title: "New Data Type" };
 
+  const addDataTypesDropdownItems = useMemo(() => {
+    const dropdownItems = [
+      <DropdownItem
+        key={"paste"}
+        onClick={() => pasteTopLevelItemDefinition()}
+        style={{ minWidth: "240px" }}
+        icon={<PasteIcon />}
+      >
+        Paste
+      </DropdownItem>,
+    ];
+    if (isImportDataTypesFromJavaClassesSupported && javaCodeCompletionService) {
+      dropdownItems.unshift(
+        <ImportJavaClassesI18nDictionariesProvider key={"import-java-classes"}>
+          <ImportJavaClassesDropdownItem
+            javaCodeCompletionService={javaCodeCompletionService}
+            onClick={handleImportJavaClassButtonClick}
+          />
+        </ImportJavaClassesI18nDictionariesProvider>
+      );
+    }
+    return dropdownItems;
+  }, [isImportDataTypesFromJavaClassesSupported, javaCodeCompletionService]);
path: packages/dmn-editor/src/dataTypes/DataTypes.tsx
user: login: Adarshvk98
body: I was wondering if it was really necessary to pass the remaining `handleImportJavaClassButtonClick` and `pasteTopLevelItemDefinition` as dependencies?  because I think the only thing that would change would be the `isImportDataTypesFromJavaClassesSupported` boolean flag and the `javaCodeCompletionService`. I’m not sure if we should add them or not. WDYT?
created_at: 2025-04-10T04:16:39Z
author_association: CONTRIBUTOR
diff_hunk: @@ -169,13 +182,37 @@ export function DataTypes() {
         addTopLevelItemDefinition(itemDefinition);
       }
     });
-  }, [addTopLevelItemDefinition, settings.isReadOnly]);
+  }, [addTopLevelItemDefinition, isReadOnly]);
 
   const [isAddDataTypeDropdownOpen, setAddDataTypeDropdownOpen] = useState(false);
 
   // Using this object because DropdownToggleAction's props doesn't accept a 'title'.
   const extraPropsForDropdownToggleAction = { title: "New Data Type" };
 
+  const addDataTypesDropdownItems = useMemo(() => {
+    const dropdownItems = [
+      <DropdownItem
+        key={"paste"}
+        onClick={() => pasteTopLevelItemDefinition()}
+        style={{ minWidth: "240px" }}
+        icon={<PasteIcon />}
+      >
+        Paste
+      </DropdownItem>,
+    ];
+    if (isImportDataTypesFromJavaClassesSupported && javaCodeCompletionService) {
+      dropdownItems.unshift(
+        <ImportJavaClassesI18nDictionariesProvider key={"import-java-classes"}>
+          <ImportJavaClassesDropdownItem
+            javaCodeCompletionService={javaCodeCompletionService}
+            onClick={handleImportJavaClassButtonClick}
+          />
+        </ImportJavaClassesI18nDictionariesProvider>
+      );
+    }
+    return dropdownItems;
+  }, [isImportDataTypesFromJavaClassesSupported, javaCodeCompletionService]);
path: packages/dmn-editor/src/dataTypes/DataTypes.tsx
user: login: Adarshvk98
body: Added the missing dependencies.
created_at: 2025-04-10T15:42:58Z
author_association: CONTRIBUTOR
diff_hunk: @@ -169,13 +182,37 @@ export function DataTypes() {
         addTopLevelItemDefinition(itemDefinition);
       }
     });
-  }, [addTopLevelItemDefinition, settings.isReadOnly]);
+  }, [addTopLevelItemDefinition, isReadOnly]);
 
   const [isAddDataTypeDropdownOpen, setAddDataTypeDropdownOpen] = useState(false);
 
   // Using this object because DropdownToggleAction's props doesn't accept a 'title'.
   const extraPropsForDropdownToggleAction = { title: "New Data Type" };
 
+  const addDataTypesDropdownItems = useMemo(() => {
+    const dropdownItems = [
+      <DropdownItem
+        key={"paste"}
+        onClick={() => pasteTopLevelItemDefinition()}
+        style={{ minWidth: "240px" }}
+        icon={<PasteIcon />}
+      >
+        Paste
+      </DropdownItem>,
+    ];
+    if (isImportDataTypesFromJavaClassesSupported && javaCodeCompletionService) {
+      dropdownItems.unshift(
+        <ImportJavaClassesI18nDictionariesProvider key={"import-java-classes"}>
+          <ImportJavaClassesDropdownItem
+            javaCodeCompletionService={javaCodeCompletionService}
+            onClick={handleImportJavaClassButtonClick}
+          />
+        </ImportJavaClassesI18nDictionariesProvider>
+      );
+    }
+    return dropdownItems;
+  }, [isImportDataTypesFromJavaClassesSupported, javaCodeCompletionService]);
path: packages/dmn-editor/src/dataTypes/DataTypes.tsx
user: login: tiagobento
body: Adding dependencies pointed by ESLint helps us make sure our React apps are adhering to good reactivity practices. It's a defensive practice we do to not lose control when things change.

Although some people recommend not memoizing by default (I.e., useMemos and useCallbacks), or carefully crafting the list of dependencies for each hook, we found out that standardizing the use of memoization hooks combined with the exhaustive list of dependencies of that hook helped us keep the codebase resilient to changes.

That's more a convention on our side than anything else, really 😊 
created_at: 2025-04-10T16:23:08Z
author_association: CONTRIBUTOR
diff_hunk: @@ -169,13 +182,37 @@ export function DataTypes() {
         addTopLevelItemDefinition(itemDefinition);
       }
     });
-  }, [addTopLevelItemDefinition, settings.isReadOnly]);
+  }, [addTopLevelItemDefinition, isReadOnly]);
 
   const [isAddDataTypeDropdownOpen, setAddDataTypeDropdownOpen] = useState(false);
 
   // Using this object because DropdownToggleAction's props doesn't accept a 'title'.
   const extraPropsForDropdownToggleAction = { title: "New Data Type" };
 
+  const addDataTypesDropdownItems = useMemo(() => {
+    const dropdownItems = [
+      <DropdownItem
+        key={"paste"}
+        onClick={() => pasteTopLevelItemDefinition()}
+        style={{ minWidth: "240px" }}
+        icon={<PasteIcon />}
+      >
+        Paste
+      </DropdownItem>,
+    ];
+    if (isImportDataTypesFromJavaClassesSupported && javaCodeCompletionService) {
+      dropdownItems.unshift(
+        <ImportJavaClassesI18nDictionariesProvider key={"import-java-classes"}>
+          <ImportJavaClassesDropdownItem
+            javaCodeCompletionService={javaCodeCompletionService}
+            onClick={handleImportJavaClassButtonClick}
+          />
+        </ImportJavaClassesI18nDictionariesProvider>
+      );
+    }
+    return dropdownItems;
+  }, [isImportDataTypesFromJavaClassesSupported, javaCodeCompletionService]);
path: packages/dmn-editor/src/dataTypes/DataTypes.tsx
user: login: Adarshvk98
body: Okay, I agree. It makes sense now.
created_at: 2025-04-10T16:27:54Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {
+  Editor,
+  EditorFactory,
+  EditorInitArgs,
+  KogitoEditorChannelApi,
+  KogitoEditorEnvelopeApi,
+  KogitoEditorEnvelopeContextType,
+} from "@kie-tools-core/editor/dist/api";
+import {
+  JavaCodeCompletionAccessor,
+  JavaCodeCompletionClass,
+  JavaCodeCompletionChannelApi,
+} from "@kie-tools-core/vscode-java-code-completion/dist/api";
+
+import { DmnEditorInterface } from "../DmnEditorFactory";
+
+/**
+ * EXPOSED INTEROP API
+ *
+ * This API is exposed from the Envelope to be consumed on Java code.
+ */
path: packages/dmn-editor-envelope/src/vscode/VsCodeNewDmnEditorFactory.tsx
user: login: tiagobento
body: Is this comment true here? Sorry I know there's been a lot of back and forth already but I guess this is not the case this usage of this type, right? It **was** true when we were still using the `window` object, but not anymore. In fact, I think this type might not even be being used right now. Can you please check @Adarshvk98?
created_at: 2025-04-11T13:23:39Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {
+  Editor,
+  EditorFactory,
+  EditorInitArgs,
+  KogitoEditorChannelApi,
+  KogitoEditorEnvelopeApi,
+  KogitoEditorEnvelopeContextType,
+} from "@kie-tools-core/editor/dist/api";
+import {
+  JavaCodeCompletionAccessor,
+  JavaCodeCompletionClass,
+  JavaCodeCompletionChannelApi,
+} from "@kie-tools-core/vscode-java-code-completion/dist/api";
+
+import { DmnEditorInterface } from "../DmnEditorFactory";
+
+/**
+ * EXPOSED INTEROP API
+ *
+ * This API is exposed from the Envelope to be consumed on Java code.
+ */
path: packages/dmn-editor-envelope/src/vscode/VsCodeNewDmnEditorFactory.tsx
user: login: Adarshvk98
body: @tiagobento An interface `JavaCodeCompletionExposedInteropApi` is defined in line 41 and is being used. I believe this also refers to the same meaning as mentioned in the comments ?
created_at: 2025-04-13T16:05:03Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {
+  Editor,
+  EditorFactory,
+  EditorInitArgs,
+  KogitoEditorChannelApi,
+  KogitoEditorEnvelopeApi,
+  KogitoEditorEnvelopeContextType,
+} from "@kie-tools-core/editor/dist/api";
+import {
+  JavaCodeCompletionAccessor,
+  JavaCodeCompletionClass,
+  JavaCodeCompletionChannelApi,
+} from "@kie-tools-core/vscode-java-code-completion/dist/api";
+
+import { DmnEditorInterface } from "../DmnEditorFactory";
+
+/**
+ * EXPOSED INTEROP API
+ *
+ * This API is exposed from the Envelope to be consumed on Java code.
+ */
path: packages/dmn-editor-envelope/src/vscode/VsCodeNewDmnEditorFactory.tsx
user: login: tiagobento
body: What I mean is that this interface no longer represents code that is called from Java code. It's simply a regular interface being used on `DmnEditorRoot`. My suggestion is that we remove the comment and move it to `DmnEditorRoot`.
created_at: 2025-04-15T10:33:57Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {
+  Editor,
+  EditorFactory,
+  EditorInitArgs,
+  KogitoEditorChannelApi,
+  KogitoEditorEnvelopeApi,
+  KogitoEditorEnvelopeContextType,
+} from "@kie-tools-core/editor/dist/api";
+import {
+  JavaCodeCompletionAccessor,
+  JavaCodeCompletionClass,
+  JavaCodeCompletionChannelApi,
+} from "@kie-tools-core/vscode-java-code-completion/dist/api";
+
+import { DmnEditorInterface } from "../DmnEditorFactory";
+
+/**
+ * EXPOSED INTEROP API
+ *
+ * This API is exposed from the Envelope to be consumed on Java code.
+ */
path: packages/dmn-editor-envelope/src/vscode/VsCodeNewDmnEditorFactory.tsx
user: login: Adarshvk98
body: Changes have been made
created_at: 2025-04-15T10:42:00Z
author_association: CONTRIBUTOR

PR comments:
user: login: yesamer
created_at: 2025-03-26T10:47:37Z
body: Well done @Adarshvk98! Can you please confirm the feature is still working in the old editor with your changes?
author_association: MEMBER
user: login: jomarko
created_at: 2025-03-27T03:49:30Z
body: @Adarshvk98 the build is failing
```
 [run-script-if] Finished 'kie-tools--eslint ./src'
  Error: src/vscode/VsCodeNewDmnEditorFactory.tsx(56,51): error TS2314: Generic type 'EditorFactory<E, EnvelopeApi, ChannelApi>' requires 3 type argument(s).
  Error: src/vscode/VsCodeNewDmnEditorFactory.tsx(58,22): error TS2314: Generic type 'KogitoEditorEnvelopeContextType<EnvelopeApi, ChannelApi>' requires 2 type argument(s).
  ```
author_association: MEMBER
user: login: Adarshvk98
created_at: 2025-03-27T04:23:07Z
body: > Well done @Adarshvk98! Can you please confirm the feature is still working in the old editor with your changes?

@yesamer, yeah sure, I'll check and confirm. 
author_association: CONTRIBUTOR
user: login: Adarshvk98
created_at: 2025-03-27T04:23:47Z
body: > @Adarshvk98 the build is failing
> 
> ```
>  [run-script-if] Finished 'kie-tools--eslint ./src'
>   Error: src/vscode/VsCodeNewDmnEditorFactory.tsx(56,51): error TS2314: Generic type 'EditorFactory<E, EnvelopeApi, ChannelApi>' requires 3 type argument(s).
>   Error: src/vscode/VsCodeNewDmnEditorFactory.tsx(58,22): error TS2314: Generic type 'KogitoEditorEnvelopeContextType<EnvelopeApi, ChannelApi>' requires 2 type argument(s).
> ```

I'm checking... 
author_association: CONTRIBUTOR
user: login: Adarshvk98
created_at: 2025-03-27T09:03:22Z
body: > Well done @Adarshvk98! Can you please confirm the feature is still working in the old editor with your changes?

I’ve checked in the old editor, and it’s working fine.
author_association: CONTRIBUTOR
user: login: Adarshvk98
created_at: 2025-04-01T12:24:54Z
body: > Thank you for the PR. Here is my feedback in few points.
> 
> ### 01 DESKTOP vs WEB
> In code I see `settings.channelType === ChannelType.VSCODE_DESKTOP || settings.channelType === ChannelType.VSCODE_WEB`. I have tried just a desktop. Is here anyone who tried web?
> 

- I'm not sure about testing in VSCode Web, as I haven't explored this option before. I couldn't find a way to install a VSIX file in the Extensions tab. If someone could guide me or help me do so, I can test it.

> ### 02 search
> imagine there is class `Person`. User is not able to search it using string like `son` or `person`. User is able to search it just using the proper lower/upper case match and the `startsWith` letters. For example `Pers` will find `Person`
> 
> maybe we should do similar updates as we do in #3033 ?
> 
> ### 03 select multiple classes
> Once I selected two classes `Person` and `Person2`, the first one is always imported/loaded as empty structure. However, checking java code, `Person` it is not empty. ![Screenshot 2025-04-01 114910](https://private-user-images.githubusercontent.com/8044780/428975187-ce579f26-ca49-40ab-80cd-6b4b87da1f78.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDM1MDQ4OTgsIm5iZiI6MTc0MzUwNDU5OCwicGF0aCI6Ii84MDQ0NzgwLzQyODk3NTE4Ny1jZTU3OWYyNi1jYTQ5LTQwYWItODBjZC02YjRiODdkYTFmNzgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDQwMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTA0MDFUMTA0OTU4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9N2Q4YTEyNjIyNGJhZmY3Nzc0YTE5NTE1YzZjNjgzMGYzMTE4ZTc5YjIyYWUyYzY3ZTg2NjdmMmQxOWJjM2JhMiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.zZwXzbh_9vWlNQG0VdpJBSVZIzbVTI-kZ32j31JuzPY) ![Screenshot 2025-04-01 114903](https://private-user-images.githubusercontent.com/8044780/428975195-d894e5e4-49d5-4758-a3ab-eab7ba8370b5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDM1MDQ4OTgsIm5iZiI6MTc0MzUwNDU5OCwicGF0aCI6Ii84MDQ0NzgwLzQyODk3NTE5NS1kODk0ZTVlNC00OWQ1LTQ3NTgtYTNhYi1lYWI3YmE4MzcwYjUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDQwMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTA0MDFUMTA0OTU4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MWU0MTk4ZmFkZmUyOGNmZGU5M2M4Nzc3MWZiZDNjZmZhZGMyNTc2OWI1ZDJmNzI5ZTMyMDdmOGFkYzI3Y2NkMSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.AM3R34FSigsCCz7avPV4WED4XFtD8zpBH8JowVWwqM4)
> 

-  I agree that there is room for improvement in these areas. However, since I haven't touched the overall functionality of the `import-java-classes-component` package (apart from rearranging the component to make it reusable in the new DMN editor), I think these improvements can be considered for a later stage ?

> ### 04 Activator hint
> is currently:
> 
> ```
> Not available, please check if 'Language Support for Java by Red Hat' extension is correctly installed and the Activator Java Class is present in your project.
> ```
> 
> from the ^ it is not so clear to me it should look like:https://github.com/yesamer/dmn-javaclasses-example/blob/main/src/main/java/Activator.java
> 

- The error message is likely an existing message in the old DMN editor and can be considered an improvement.

> Points 2 and 3 are probably also in old editor? Probably we can handle them in separate tickets potentially? What is your opinion aboit 1 and 4?

- I think the current goal is to bring the same feature from the old DMN editor to the new one. While the mentioned points are improvements, I'm not sure if they should be addressed along with this or as a separate tickets. I'd like to hear your thoughts on this, @tiagobento  and @yesamer.


author_association: CONTRIBUTOR
user: login: jomarko
created_at: 2025-04-01T12:37:08Z
body: ### 01 DESKTOP vs WEB
try to search for "run:webmode" in package.json to run in WEB mode
author_association: MEMBER
user: login: yesamer
created_at: 2025-04-01T12:41:56Z
body: @Adarshvk98 I agree with you, the scope of this PR is to move the same existing functionality in the new editor, preserving all the existing features. If there's space for minor improvements, I guess we can consider it. 
However, about points 2 and 3 I would check if the same behavior reproduces in the old editor as well, in particular, point 3 it's very weird. Can you please check it?
author_association: MEMBER
user: login: Adarshvk98
created_at: 2025-04-01T15:59:21Z
body: About point 3, I checked the old editor, and it’s behaving a bit strangely. I tried with a similar example, using “Book” and “Book1” as classes. Initially, when importing two classes, it correctly displayed their attributes and expanded them. However, the second time I tried, the “Book” or “Book1” structure sometimes showed an empty structure.
<img width="1198" alt="image" src="https://github.com/user-attachments/assets/de7b5640-9deb-4391-9a17-113d3d08b5fc" />

Regarding point 2, I believe the function `getClasses` from `javaCodeCompletionService` handles the search, comparison, and retrieval of Java classes. As @jomarko  requested, we might need to modify the logic from the Java side. don’t have much control over the component side. Please correct me if I’m wrong about it. @yesamer 
author_association: CONTRIBUTOR
user: login: yesamer
created_at: 2025-04-02T08:22:01Z
body: @Adarshvk98 Thank you for checking, it seems to me that behavior is not a regression introduced in your changes, so I guess we can analyze them in a separate ticket WDYT @jomarko ?

@ljmotta Can you please review it as well?
author_association: MEMBER
user: login: jomarko
created_at: 2025-04-07T09:06:03Z
body: @Adarshvk98 please, what is your opinion about my point of conflicts with external data types https://github.com/apache/incubator-kie-tools/pull/3031#pullrequestreview-2742951305
author_association: MEMBER
user: login: Adarshvk98
created_at: 2025-04-07T09:58:24Z
body: > @Adarshvk98 please, what is your opinion about my point of conflicts with external data types [#3031 (review)](https://github.com/apache/incubator-kie-tools/pull/3031#pullrequestreview-2742951305)

@jomarko you’re probably right. I think we shouldn’t let user replace the external modal types. but I'm not very sure about what action can be taken further , @tiagobento @yesamer 

A related scenario to consider is what happens when an external model is included that has a type that already exists in our DMN types? 


author_association: CONTRIBUTOR
user: login: yesamer
created_at: 2025-04-08T08:08:52Z
body: > A related scenario to consider is what happens when an external model is included that has a type that already exists in our DMN types?

Good point @Adarshvk98. I would check that case. BTW, In my opinion, the case reported by @jomarko deserves attention, I would suggest opening a separate ticket for that. 
author_association: MEMBER
user: login: jomarko
created_at: 2025-04-14T07:41:33Z
body: @Adarshvk98 @tiagobento please let me know, hwat is the status of this PR. I would like to start my work on https://github.com/apache/incubator-kie-issues/issues/1912 that will touch same code area as #3031
author_association: MEMBER