Skip to content

Commit 32178e4

Browse files
committed
Improvment
1 parent d07e9e3 commit 32178e4

3 files changed

Lines changed: 20 additions & 14 deletions

File tree

modules/BlueskyGephi/src/main/java/fr/totetmatt/blueskygephi/BlueskyGephi.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,9 @@ public class BlueskyGephi {
5252
private GraphModel graphModel;
5353

5454
public BlueskyGephi() {
55-
initProjectAndWorkspace();
56-
5755
}
5856

59-
private void initProjectAndWorkspace() {
57+
private void ensureProject() {
6058
ProjectController projectController = Lookup.getDefault().lookup(ProjectController.class);
6159
Project currentProject = projectController.getCurrentProject();
6260
if (currentProject == null) {
@@ -275,12 +273,14 @@ private void initGraphTable() {
275273
}
276274

277275
public void fetchFollowerFollowsFromActors(List<String> actors, boolean isFollowsActive, boolean isFollowersActive, boolean isBlocksActive) {
276+
ensureProject();
278277
graphModel = Lookup.getDefault().lookup(GraphController.class).getGraphModel();
279278
initGraphTable();
280279
actors.stream().forEach(actor -> fetchFollowerFollowsFromActor(actor, null, isFollowsActive, isFollowersActive, getIsDeepSearch()));
281280
}
282281

283282
public void fetchFollowerFollowsFromActors(List<String> actors) {
283+
ensureProject();
284284
graphModel = Lookup.getDefault().lookup(GraphController.class).getGraphModel();
285285
initGraphTable();
286286
actors

modules/BlueskyGephi/src/main/java/fr/totetmatt/blueskygephi/BlueskyGephiMainPanel.java

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,36 @@
1616
import org.openide.awt.ActionReference;
1717
import org.openide.util.Exceptions;
1818
import org.openide.util.Lookup;
19+
import org.openide.util.NbBundle;
1920
import org.openide.windows.TopComponent;
2021

2122
/**
2223
*
2324
* @author totetmatt
2425
*/
25-
2626
@TopComponent.Description(preferredID = "BlueskyGephiMainPanel",
27-
iconBase = "fr/totetmatt/gephi/twitter/twitterlogo.png"
28-
)
29-
30-
31-
@ActionReference(path = "Menu/Window", position = 334)
32-
@TopComponent.OpenActionRegistration(displayName = "Bluesky Gephi",
33-
preferredID = "MainTwitterStreamerWindow")
27+
persistenceType = TopComponent.PERSISTENCE_ALWAYS)
28+
@TopComponent.Registration(mode = "layoutmode", openAtStartup = true, roles = {"overview"}, position = 2)
3429
@ActionID(category = "Window", id = "fr.totetmatt.blueskygephi.BlueskyGephiMainPanel")
35-
@TopComponent.Registration(mode = "layoutmode", openAtStartup = true, position=2)
30+
@ActionReference(path = "Menu/Window", position = 334)
31+
@TopComponent.OpenActionRegistration(displayName = "#CTL_BlueskyGephiMainPanel",
32+
preferredID = "BlueskyGephiMainPanel")
3633
public class BlueskyGephiMainPanel extends TopComponent {
3734
protected static final Logger consoleLogger = Logger.getLogger(BlueskyGephiMainPanel.class.getName());
38-
private final BlueskyGephi blueskyGephi;
35+
private static final Logger logger = Logger.getLogger(BlueskyGephiMainPanel.class.getName());
36+
private BlueskyGephi blueskyGephi;
3937
/**
4038
* Creates new form BlueskyGephiMainPanel
4139
*/
4240
public BlueskyGephiMainPanel() {
4341
initComponents();
44-
blueskyGephi = Lookup.getDefault().lookup(BlueskyGephi.class);
42+
setName(NbBundle.getMessage(BlueskyGephiMainPanel.class, "CTL_BlueskyGephiMainPanel"));
43+
setToolTipText(NbBundle.getMessage(BlueskyGephiMainPanel.class, "HINT_BlueskyGephiMainPanel"));
44+
blueskyGephi = Lookup.getDefault().lookup(BlueskyGephi.class);
45+
if (blueskyGephi == null) {
46+
logger.warning("BlueskyGephi service not available");
47+
return;
48+
}
4549
credentialsHostField.setText(blueskyGephi.getHost());
4650
credentialsHandleField.setText(blueskyGephi.getHandle());
4751
credentialsPasswordField.setText(blueskyGephi.getPassword());

modules/BlueskyGephi/src/main/resources/fr/totetmatt/blueskygephi/Bundle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
CTL_BlueskyGephiMainPanel=Bluesky Gephi
2+
HINT_BlueskyGephiMainPanel=Import network from Bluesky / AtProtocol
13
BlueskyGephiMainPanel.toolTipText=Bluesky Gephi
24
BlueskyGephiMainPanel.Credentials.toolTipText=Credentials
35
BlueskyGephiMainPanel.credentialsPanel.border.title=Credentials

0 commit comments

Comments
 (0)