use of com.evolveum.midpoint.studio.impl.EnvironmentService in project midpoint-studio by Evolveum.
the class VerifyAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getProject();
VirtualFile[] selectedFiles = ApplicationManager.getApplication().runReadAction((Computable<VirtualFile[]>) () -> e.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY));
if (selectedFiles == null || selectedFiles.length == 0) {
MidPointUtils.publishNotification(project, NOTIFICATION_KEY, ACTION_NAME, "No files selected for cleanup", NotificationType.WARNING);
return;
}
List<VirtualFile> toProcess = MidPointUtils.filterXmlFiles(selectedFiles);
if (toProcess.isEmpty()) {
MidPointUtils.publishNotification(project, NOTIFICATION_KEY, ACTION_NAME, "No files matched for verification (xml)", NotificationType.WARNING);
return;
}
MidPointService mm = MidPointService.getInstance(project);
EnvironmentService em = EnvironmentService.getInstance(project);
Environment env = em.getSelected();
mm.focusConsole();
mm.printToConsole(env, VerifyAction.class, "Starting verification using midpoint schema bundled in MidPoint Studio.");
processFiles(e, mm, env, toProcess);
mm.printToConsole(env, VerifyAction.class, "Verification finished");
}
use of com.evolveum.midpoint.studio.impl.EnvironmentService in project midpoint-studio by Evolveum.
the class DiffRemoteTask method doRun.
@Override
protected void doRun(ProgressIndicator indicator) {
super.doRun(indicator);
indicator.setIndeterminate(false);
EnvironmentService em = EnvironmentService.getInstance(getProject());
VirtualFile[] selectedFiles = UIUtil.invokeAndWaitIfNeeded(() -> event.getData(PlatformDataKeys.VIRTUAL_FILE_ARRAY));
List<VirtualFile> toProcess = MidPointUtils.filterXmlFiles(selectedFiles);
if (toProcess.isEmpty()) {
MidPointUtils.publishNotification(getProject(), NOTIFICATION_KEY, TITLE, "No files matched for " + TITLE + " (xml)", NotificationType.WARNING);
return;
}
processFiles(indicator, toProcess);
}
use of com.evolveum.midpoint.studio.impl.EnvironmentService in project midpoint-studio by Evolveum.
the class SelectEnvironment method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
EnvironmentService manager = EnvironmentService.getInstance(e.getProject());
manager.select(environment != null ? environment.getId() : null);
}
use of com.evolveum.midpoint.studio.impl.EnvironmentService in project midpoint-studio by Evolveum.
the class ExpanderTest method testExpandFile.
private void testExpandFile(String fileExpected, String fileToExpand, String... expandChunkFiles) {
for (String s : expandChunkFiles) {
myFixture.configureByFile(s);
}
PsiFile file = myFixture.configureByFile(fileToExpand);
Editor editor = myFixture.getEditor();
String text = editor.getDocument().getText();
Project project = getProject();
Environment environment = new Environment();
EnvironmentService es = EnvironmentService.getInstance(project);
es.add(environment);
EncryptionService cm = project != null ? EncryptionService.getInstance(project) : null;
Expander expander = new Expander(environment, cm, project);
String result = expander.expand(text, file.getVirtualFile());
LOG.info("Expanded result:\n" + result);
Diff d = DiffBuilder.compare(Input.fromFile(new File(getTestDataPath(), fileExpected))).withTest(Input.fromString(result)).build();
if (d.hasDifferences()) {
LOG.error(d.fullDescription());
fail();
}
}
Aggregations