-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleanup task - missing references configuration
- Loading branch information
Showing
12 changed files
with
159 additions
and
31 deletions.
There are no files selected for viewing
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
61 changes: 61 additions & 0 deletions
61
...-idea-plugin/src/main/java/com/evolveum/midpoint/studio/impl/MissingReferencesAction.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,61 @@ | ||
package com.evolveum.midpoint.studio.impl; | ||
|
||
import com.evolveum.midpoint.studio.impl.configuration.ObjectReferencesConfiguration; | ||
import com.evolveum.midpoint.studio.ui.cleanup.MissingObjectRefsDialog; | ||
import com.evolveum.midpoint.studio.util.ActionUtils; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType; | ||
import com.intellij.notification.Notification; | ||
import com.intellij.notification.NotificationAction; | ||
import com.intellij.openapi.actionSystem.AnActionEvent; | ||
import com.intellij.openapi.project.Project; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.List; | ||
|
||
public class MissingReferencesAction extends NotificationAction { | ||
|
||
private final List<ObjectReferenceType> data; | ||
|
||
public MissingReferencesAction(@NotNull List<ObjectReferenceType> data) { | ||
super("Fix missing objects..."); | ||
|
||
this.data = data; | ||
} | ||
|
||
@Override | ||
public void update(@NotNull AnActionEvent e) { | ||
super.update(e); | ||
|
||
// todo fix, this doesn't work! it's not even called. same for download missing notification action | ||
// e.getPresentation().setVisible(!references.isEmpty()); | ||
} | ||
|
||
@Override | ||
public void actionPerformed(AnActionEvent e, Notification notification) { | ||
Project project = e.getProject(); | ||
|
||
|
||
// todo get settings and pass proper configuration part to dialog | ||
|
||
MissingObjectRefsDialog dialog = new MissingObjectRefsDialog(project, List.of()); | ||
if (!dialog.showAndGet()) { | ||
return; | ||
} | ||
|
||
List<ObjectReferenceType> references = createRefsForDownload(dialog.getData()); | ||
if (references.isEmpty()) { | ||
return; | ||
} | ||
|
||
ActionUtils.runDownloadTask(project, references, false); | ||
} | ||
|
||
private List<ObjectReferenceType> createRefsForDownload(List<ObjectReferencesConfiguration> objects) { | ||
return List.of(); // todo implement | ||
} | ||
|
||
@Override | ||
public boolean isDumbAware() { | ||
return true; | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2,7 +2,9 @@ | |
|
||
public enum DownloadActionConfiguration { | ||
|
||
NEVER, | ||
|
||
ALWAYS, | ||
|
||
FILE_NOT_EXISTS, | ||
OBJECT_NOT_AVAILABLE, | ||
} |
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
37 changes: 37 additions & 0 deletions
37
...plugin/src/main/java/com/evolveum/midpoint/studio/ui/cleanup/MissingObjectRefsDialog.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,37 @@ | ||
package com.evolveum.midpoint.studio.ui.cleanup; | ||
|
||
import com.evolveum.midpoint.studio.impl.configuration.ObjectReferencesConfiguration; | ||
import com.evolveum.midpoint.studio.ui.MissingObjectRefsEditor; | ||
import com.intellij.openapi.project.Project; | ||
import com.intellij.openapi.ui.DialogPanel; | ||
import com.intellij.openapi.ui.DialogWrapper; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import javax.swing.*; | ||
import java.util.List; | ||
|
||
public class MissingObjectRefsDialog extends DialogWrapper { | ||
|
||
private final MissingObjectRefsEditor editor; | ||
|
||
private final DialogPanel panel; | ||
|
||
public MissingObjectRefsDialog(@Nullable Project project, @NotNull List<ObjectReferencesConfiguration> objects) { | ||
super(project); | ||
|
||
editor = new MissingObjectRefsEditor(project, objects); | ||
panel = editor.createComponent(); | ||
|
||
init(); | ||
} | ||
|
||
@Override | ||
protected @Nullable JComponent createCenterPanel() { | ||
return panel; | ||
} | ||
|
||
public @NotNull List<ObjectReferencesConfiguration> getData() { | ||
return List.of(); // todo implement | ||
} | ||
} |
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
30 changes: 30 additions & 0 deletions
30
...io-idea-plugin/src/main/kotlin/com/evolveum/midpoint/studio/ui/MissingObjectRefsEditor.kt
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,30 @@ | ||
package com.evolveum.midpoint.studio.ui | ||
|
||
import com.evolveum.midpoint.studio.impl.configuration.ObjectReferencesConfiguration | ||
import com.evolveum.midpoint.studio.ui.cleanup.MissingObjectRefsTable | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.ui.DialogPanel | ||
import com.intellij.ui.components.JBScrollPane | ||
import com.intellij.ui.dsl.builder.Align | ||
import com.intellij.ui.dsl.builder.panel | ||
|
||
class MissingObjectRefsEditor(val project: Project, val objects: List<ObjectReferencesConfiguration>) { | ||
|
||
private val table: MissingObjectRefsTable | ||
|
||
init { | ||
table = MissingObjectRefsTable() | ||
table.tableModel.data = objects | ||
} | ||
|
||
fun createComponent(): DialogPanel { | ||
return panel { | ||
// todo implement | ||
row { | ||
cell(JBScrollPane(table)) | ||
.align(Align.FILL) | ||
} | ||
.resizableRow() | ||
} | ||
} | ||
} |
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