-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Server Panel and refactored code #152
- Loading branch information
1 parent
3d520a1
commit 2a3734e
Showing
8 changed files
with
88 additions
and
23 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
src/main/java-intellij/com/mercedesbenz/sechub/plugin/idea/window/SecHubPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.mercedesbenz.sechub.plugin.idea.window; | ||
|
||
import javax.swing.*; | ||
|
||
public interface SecHubPanel { | ||
JPanel getContent(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/main/java-intellij/com/mercedesbenz/sechub/plugin/idea/window/SecHubServerPanel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.mercedesbenz.sechub.plugin.idea.window; | ||
|
||
import com.intellij.openapi.diagnostic.Logger; | ||
import com.intellij.ui.components.JBPanel; | ||
import com.intellij.ui.components.JBTextField; | ||
import com.mercedesbenz.sechub.sdk.settings.AppSettings; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
import java.util.Objects; | ||
|
||
public class SecHubServerPanel implements SecHubPanel{ | ||
|
||
private static final Logger LOG = Logger.getInstance(SecHubServerPanel.class); | ||
private static SecHubServerPanel INSTANCE; | ||
private JPanel contentPanel; | ||
private final JBTextField serverUrlText = new JBTextField(); | ||
|
||
public SecHubServerPanel() { | ||
createComponents(); | ||
} | ||
|
||
public static void registerInstance(SecHubServerPanel secHubToolWindow) { | ||
LOG.info("register tool windows instance:" + secHubToolWindow); | ||
INSTANCE = secHubToolWindow; | ||
} | ||
|
||
public static SecHubServerPanel getInstance() { | ||
return INSTANCE; | ||
} | ||
|
||
@Override | ||
public JPanel getContent() { | ||
return contentPanel; | ||
} | ||
|
||
public void update(String serverURL) { | ||
serverUrlText.setText(serverURL); | ||
} | ||
|
||
private void createComponents() { | ||
contentPanel = new JBPanel<>(); | ||
contentPanel.setLayout(new BorderLayout()); | ||
|
||
JPanel top = new JPanel(new BorderLayout()); | ||
String serverURL = Objects.requireNonNull(AppSettings.getInstance().getState()).serverURL; | ||
serverUrlText.setText(serverURL); | ||
serverUrlText.setEditable(false); | ||
|
||
top.add(new JLabel("Server URL: "), BorderLayout.WEST); | ||
top.add(serverUrlText); | ||
contentPanel.add(top, BorderLayout.NORTH); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters