use of com.evolveum.midpoint.studio.impl.EnvironmentService in project midpoint-studio by Evolveum.
the class TestConnectionAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getProject();
EnvironmentService em = EnvironmentService.getInstance(project);
Environment selected = em.getSelected();
Task.Backgroundable task = new Task.Backgroundable(e.getProject(), "Testing connection for '" + selected.getName() + "'") {
@Override
public void run(@NotNull ProgressIndicator indicator) {
new RunnableUtils.PluginClasspathRunnable() {
@Override
public void runWithPluginClassLoader() {
testConnection(project, selected);
}
}.run();
}
};
ProgressManager.getInstance().runProcessWithProgressAsynchronously(task, new BackgroundableProcessIndicator(task));
}
use of com.evolveum.midpoint.studio.impl.EnvironmentService in project midpoint-studio by Evolveum.
the class ComboEnvironments method createPopupActionGroup.
@NotNull
@Override
protected DefaultActionGroup createPopupActionGroup(JComponent jComponent) {
DefaultActionGroup group = new DefaultActionGroup();
Project project = DataManager.getInstance().getDataContext(jComponent).getData(CommonDataKeys.PROJECT);
EnvironmentService manager = EnvironmentService.getInstance(project);
for (Environment env : manager.getEnvironments()) {
group.add(new SelectEnvironment(env));
}
group.addSeparator();
group.add(new SelectEnvironment(null));
group.addSeparator();
AnAction editEnvironments = ActionManager.getInstance().getAction(EditEnvironments.ACTION_ID);
group.add(editEnvironments);
return group;
}
use of com.evolveum.midpoint.studio.impl.EnvironmentService in project midpoint-studio by Evolveum.
the class ComboEnvironments method update.
@Override
public void update(AnActionEvent e) {
super.update(e);
if (e.getProject() == null) {
return;
}
EnvironmentService envManager = EnvironmentService.getInstance(e.getProject());
Environment env = envManager.getSelected();
String text = env != null ? env.getName() : "None Selected";
getTemplatePresentation().setText(text);
e.getPresentation().setText(text);
}
use of com.evolveum.midpoint.studio.impl.EnvironmentService in project midpoint-studio by Evolveum.
the class AsyncAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
if (e.getProject() == null) {
return;
}
EnvironmentService em = EnvironmentService.getInstance(e.getProject());
Environment env = em.getSelected();
T task = createTask(e, env);
ProgressManager.getInstance().run(task);
}
use of com.evolveum.midpoint.studio.impl.EnvironmentService in project midpoint-studio by Evolveum.
the class EnvironmentColor method update.
@Override
public void update(AnActionEvent e) {
super.update(e);
if (e.getPresentation() == null || e.getProject() == null) {
return;
}
JComponent panel = ObjectUtils.tryCast(e.getPresentation().getClientProperty(CustomComponentAction.COMPONENT_KEY), JComponent.class);
if (panel == null) {
return;
}
EnvironmentService envManager = EnvironmentService.getInstance(e.getProject());
Environment env = envManager.getSelected();
if (env == null || env.getColor() == null) {
panel.setOpaque(false);
return;
}
panel.setOpaque(true);
panel.setBackground(env.getColor().asAwtColor());
}
Aggregations