Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
feat: remove netbeans connections from connection selection dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
pas-n committed Sep 2, 2022
1 parent 43da74f commit 06c6b8f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.subjects.BehaviorSubject;
import org.jetbrains.annotations.*;
import org.netbeans.api.db.explorer.*;
import org.netbeans.api.project.Project;
import org.openide.util.*;

import javax.swing.*;
import java.io.IOException;
import java.sql.Connection;
import java.util.*;
import java.util.function.Supplier;

Expand Down Expand Up @@ -38,10 +35,6 @@ class SelectConnectionDialogModel extends DefaultComboBoxModel<Object>
SwingUtilities.invokeLater(() -> {
_loadAsync(pProject, pPreselectedSourceName);

// Add all unnamed connections
for (DatabaseConnection c : ConnectionManager.getDefault().getConnections())
availableData.add(new _Item(c));

// init connections
setShowAllConnections(true);

Expand Down Expand Up @@ -300,44 +293,6 @@ private static class _Item
connection = pConnection;
}

_Item(@NotNull DatabaseConnection pConnection)
{
connection = new IPossibleConnectionProvider.IPossibleDBConnection()
{
@NotNull
@Override
public String getURL()
{
return pConnection.getDatabaseURL();
}

@Nullable
@Override
public String getSourceName()
{
return null;
}

@Override
public <T, Ex extends Throwable> T withJDBCConnection(@NotNull IConnectionFunction<T, Ex> pFunction) throws IOException, Ex
{
ConnectionManager.getDefault().showConnectionDialog(pConnection);
Connection jdbcCon = pConnection.getJDBCConnection();
if (jdbcCon == null)
// should not happen
throw new IOException("Connection could not be read. Maybe it is not connected?");
return pFunction.apply(jdbcCon);
}

@NotNull
@Override
public List<ITableMetaInfo> getTableMetaInfos()
{
return List.of(); // At this point there are no meta infomation availabe
}
};
}

@Nullable
public String getOwner()
{
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/adito.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021.2.0
2022.1.3

0 comments on commit 06c6b8f

Please sign in to comment.