Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diff with existing source #64

Merged
merged 1 commit into from
Nov 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,18 @@
<id>org.netbeans.api:org-netbeans-modules-db-core</id>
<type>impl</type>
</dependency>
<dependency>
<id>org.netbeans.api:org-netbeans-modules-diff</id>
<type>impl</type>
</dependency>
<dependency>
<id>org.netbeans.modules:org-netbeans-modules-maven</id>
<type>impl</type>
</dependency>
<dependency>
<id>org.netbeans.modules:org-netbeans-modules-maven-embedder</id>
<type>impl</type>
</dependency>
</moduleDependencies>
<publicPackages>
<publicPackage>io.github.jeddict.ai</publicPackage>
Expand Down Expand Up @@ -440,7 +452,21 @@
<artifactId>org-openide-text</artifactId>
<version>RELEASE230</version>
</dependency>

<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-netbeans-modules-diff</artifactId>
<version>RELEASE230</version>
</dependency>
<dependency>
<groupId>org.netbeans.modules</groupId>
<artifactId>org-netbeans-modules-maven</artifactId>
<version>RELEASE230</version>
</dependency>
<dependency>
<groupId>org.netbeans.modules</groupId>
<artifactId>org-netbeans-modules-maven-embedder</artifactId>
<version>RELEASE230</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
17 changes: 11 additions & 6 deletions src/main/java/io/github/jeddict/ai/actions/OpenChatAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,18 @@ public void actionPerformed(ActionEvent e) {
String currentSelectedText = currenteditor.getSelectedText();
final StyledDocument currentDocument = (StyledDocument) currenteditor.getDocument();
int currentSelectionStartPosition = currenteditor.getSelectionStart();
FileObject currentfile = NbEditorUtilities.getDataObject(currentDocument).getPrimaryFile();
if (currentfile != null) {
if (currentSelectedText == null || currentSelectedText.isEmpty()) {
insertAndReformat(currentDocument, content, currentSelectionStartPosition, 0);
} else {
insertAndReformat(currentDocument, content, currentSelectionStartPosition, currentSelectedText.length());
DataObject currentDO = NbEditorUtilities.getDataObject(currentDocument);
if (currentDO != null) {
FileObject currentfile = currentDO.getPrimaryFile();
if (currentfile != null) {
if (currentSelectedText == null || currentSelectedText.isEmpty()) {
insertAndReformat(currentDocument, content, currentSelectionStartPosition, 0);
} else {
insertAndReformat(currentDocument, content, currentSelectionStartPosition, currentSelectedText.length());
}
}
} else {
javax.swing.JOptionPane.showMessageDialog(null, "Please select text in the original editor before updating.");
}
}
});
Expand Down
Loading
Loading