Search in sources :

Example 1 with EnvironmentService

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));
}
Also used : Project(com.intellij.openapi.project.Project) Task(com.intellij.openapi.progress.Task) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) BackgroundableProcessIndicator(com.intellij.openapi.progress.impl.BackgroundableProcessIndicator) Environment(com.evolveum.midpoint.studio.impl.Environment) EnvironmentService(com.evolveum.midpoint.studio.impl.EnvironmentService) NotNull(org.jetbrains.annotations.NotNull) RunnableUtils(com.evolveum.midpoint.studio.util.RunnableUtils)

Example 2 with EnvironmentService

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;
}
Also used : Project(com.intellij.openapi.project.Project) Environment(com.evolveum.midpoint.studio.impl.Environment) EnvironmentService(com.evolveum.midpoint.studio.impl.EnvironmentService) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with EnvironmentService

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);
}
Also used : Environment(com.evolveum.midpoint.studio.impl.Environment) EnvironmentService(com.evolveum.midpoint.studio.impl.EnvironmentService)

Example 4 with EnvironmentService

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);
}
Also used : Environment(com.evolveum.midpoint.studio.impl.Environment) EnvironmentService(com.evolveum.midpoint.studio.impl.EnvironmentService)

Example 5 with EnvironmentService

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());
}
Also used : Environment(com.evolveum.midpoint.studio.impl.Environment) EnvironmentService(com.evolveum.midpoint.studio.impl.EnvironmentService)

Aggregations

EnvironmentService (com.evolveum.midpoint.studio.impl.EnvironmentService)19 Environment (com.evolveum.midpoint.studio.impl.Environment)12 Project (com.intellij.openapi.project.Project)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)5 MidPointClient (com.evolveum.midpoint.studio.impl.MidPointClient)4 MidPointService (com.evolveum.midpoint.studio.impl.MidPointService)3 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)3 File (java.io.File)3 IOException (java.io.IOException)3 PrismContext (com.evolveum.midpoint.prism.PrismContext)2 ObjectTypes (com.evolveum.midpoint.schema.constants.ObjectTypes)2 ComboObjectTypes (com.evolveum.midpoint.studio.action.browse.ComboObjectTypes)2 Expander (com.evolveum.midpoint.studio.impl.Expander)2 RunnableUtils (com.evolveum.midpoint.studio.util.RunnableUtils)2 PsiFile (com.intellij.psi.PsiFile)2 NotNull (org.jetbrains.annotations.NotNull)2 PrismPropertyDefinition (com.evolveum.midpoint.prism.PrismPropertyDefinition)1 SearchResultList (com.evolveum.midpoint.schema.SearchResultList)1 ComboQueryType (com.evolveum.midpoint.studio.action.browse.ComboQueryType)1 EncryptionService (com.evolveum.midpoint.studio.impl.EncryptionService)1