Skip to content

Commit

Permalink
add icons to repo
Browse files Browse the repository at this point in the history
  • Loading branch information
artpar committed Feb 7, 2024
1 parent 35d84e2 commit 9a32a71
Show file tree
Hide file tree
Showing 22 changed files with 46 additions and 30 deletions.
76 changes: 46 additions & 30 deletions src/main/java/com/insidious/plugin/ui/library/LibraryComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,7 @@ public LibraryComponent(Project project) {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
selectedMocks.clear();
selectedCandidates.clear();

for (DeclaredMockItemPanel listedMockItem : listedMockItems) {
listedMockItem.setSelected(false);
}
for (StoredCandidateItemPanel listedMockItem : listedCandidateItems) {
listedMockItem.setSelected(false);
}
updateSelectionLabel();
clearSelection();
reloadItems();
}
});
Expand Down Expand Up @@ -107,7 +98,6 @@ public void mouseClicked(MouseEvent e) {
}
});

deleteButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

deleteButton.addMouseListener(new MouseAdapter() {
@Override
Expand All @@ -119,10 +109,13 @@ public void mouseClicked(MouseEvent e) {
return;
}
DialogBuilder builder = new DialogBuilder(project);
builder.addOkAction();
builder.addCancelAction();
builder.setTitle("Confirm Delete");
builder.setErrorText(
"Are you sure you want to delete " + selectedCount + " mock definition" + (selectedCount == 1 ? "s" : ""));

builder.setCenterPanel(new JLabel(
"Are you sure you want to delete " + selectedCount + " mock definition" + (selectedCount == 1 ? "s" : "")));

builder.setOkOperation(() -> {
for (DeclaredMock selectedMock : selectedMocks) {
atomicRecordService.deleteMockDefinition(selectedMock);
Expand All @@ -132,14 +125,18 @@ public void mouseClicked(MouseEvent e) {
"Deleted " + selectedCount + " mock definition" + (selectedCount == 1 ? "s" : ""),
NotificationType.INFORMATION);
});
builder.show();

} else if (filterModel.isShowTests()) {
int selectedCount = selectedCandidates.size();
DialogBuilder builder = new DialogBuilder(project);
builder.addOkAction();
builder.addCancelAction();
builder.setTitle("Confirm Delete");
builder.setErrorText(
"Are you sure you want to delete " + selectedCount + " relay test" + (selectedCount == 1 ? "s" : ""));

builder.setCenterPanel(new JLabel(
"Are you sure you want to delete " + selectedCount + " relay test" + (selectedCount == 1 ? "s" : "")));

builder.setOkOperation(() -> {
for (StoredCandidate storedCandidate : selectedCandidates) {
atomicRecordService.deleteStoredCandidate(storedCandidate.getMethod(),
Expand All @@ -150,6 +147,7 @@ public void mouseClicked(MouseEvent e) {
+ (selectedCount == 1 ? "s" : ""),
NotificationType.INFORMATION);
});
builder.show();

}

Expand All @@ -166,22 +164,26 @@ public void onSelect(DeclaredMock item) {
@Override
public void onUnSelect(DeclaredMock item) {
selectedMocks.remove(item);
updateSelectionLabel();
}

@Override
public void onDelete(DeclaredMock item) {

DialogBuilder builder = new DialogBuilder(project);
builder.addOkAction();
builder.addCancelAction();
builder.setTitle("Confirm Delete");
builder.setErrorText("Are you sure you want to delete " + "mock definition");
builder.setCenterPanel(new JLabel("Are you sure you want to delete " + "mock definition"));

builder.setOkOperation(() -> {
atomicRecordService.deleteMockDefinition(item);
reloadItems();
InsidiousNotification.notifyMessage(
"Deleted " + "mock definition",
NotificationType.INFORMATION);
});
builder.show();
}

@Override
Expand All @@ -199,24 +201,26 @@ public void onSelect(StoredCandidate item) {
@Override
public void onUnSelect(StoredCandidate item) {
selectedCandidates.remove(item);
updateSelectionLabel();
}

@Override
public void onDelete(StoredCandidate item) {

DialogBuilder builder = new DialogBuilder(project);
builder.addOkAction();
builder.addCancelAction();
builder.setTitle("Confirm Delete");
builder.setErrorText("Are you sure you want to delete " + "replay test");
builder.setCenterPanel(new JLabel("Are you sure you want to delete " + "replay test"));
builder.setOkOperation(() -> {
atomicRecordService.deleteStoredCandidate(item.getMethod(), item.getCandidateId());
reloadItems();
InsidiousNotification.notifyMessage(
"Deleted " + "replay test",
NotificationType.INFORMATION);
reloadItems();
});

reloadItems();
builder.show();
}

@Override
Expand All @@ -238,19 +242,13 @@ public void mouseClicked(MouseEvent e) {
});
reloadItems();

includeMocksCheckBox.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
logger.warn("filter type checkbox change: " + e);
}
});

includeMocksCheckBox.addActionListener(e -> {
boolean reload = false;
if (includeMocksCheckBox.isSelected()) {
if (filterModel.isShowTests()) {
filterModel.setShowMocks(true);
filterModel.setShowTests(false);
updateSelectionLabel();
reload = true;
}
}
Expand All @@ -266,6 +264,7 @@ public void stateChanged(ChangeEvent e) {
if (filterModel.isShowMocks()) {
filterModel.setShowMocks(false);
filterModel.setShowTests(true);
updateSelectionLabel();
reload = true;
}
}
Expand Down Expand Up @@ -322,14 +321,30 @@ public void mouseClicked(MouseEvent e) {

}

private void clearSelection() {
selectedMocks.clear();
selectedCandidates.clear();

for (DeclaredMockItemPanel listedMockItem : listedMockItems) {
listedMockItem.setSelected(false);
}
for (StoredCandidateItemPanel listedMockItem : listedCandidateItems) {
listedMockItem.setSelected(false);
}
updateSelectionLabel();
}

private void updateSelectionLabel() {
int count;
if (filterModel.isShowMocks()) {
int selectedMocksCount = selectedMocks.size();
selectAllLabel.setText(selectedMocksCount + " selected");
count = selectedMocks.size();
selectAllLabel.setText(count + " selected");
} else {
int selectedMocksCount = selectedCandidates.size();
selectAllLabel.setText(selectedMocksCount + " selected");
count = selectedCandidates.size();
selectAllLabel.setText(count + " selected");
}
deleteButton.setVisible(count > 0);
deleteButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
}

private GridBagConstraints createGBCForFakeComponent(int yIndex) {
Expand Down Expand Up @@ -451,6 +466,7 @@ public void reloadItems() {

listedMockItems.clear();
listedCandidateItems.clear();
clearSelection();

itemScrollPanel.setViewportView(itemsContainer);

Expand Down
Binary file added src/main/resources/icons/png/arrow-left-up-line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/png/braces-line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/png/close-line-black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/png/delete-bin-3-line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/png/edit-line-black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/png/equalizer-line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/png/execute.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/png/expand-up-down-line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/png/link.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/png/number-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/png/number-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/png/number-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/png/number-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/png/number-5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/png/pushpin-2-fill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/png/pushpin-2-line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/png/pushpin-line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/png/step-icon-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/icons/png/unpin-line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9a32a71

Please sign in to comment.