Search in sources :

Example 1 with Environment

use of com.evolveum.midpoint.studio.impl.Environment 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 Environment

use of com.evolveum.midpoint.studio.impl.Environment 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 Environment

use of com.evolveum.midpoint.studio.impl.Environment 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 Environment

use of com.evolveum.midpoint.studio.impl.Environment 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 Environment

use of com.evolveum.midpoint.studio.impl.Environment 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

Environment (com.evolveum.midpoint.studio.impl.Environment)32 EnvironmentService (com.evolveum.midpoint.studio.impl.EnvironmentService)13 Project (com.intellij.openapi.project.Project)10 MidPointClient (com.evolveum.midpoint.studio.impl.MidPointClient)8 IOException (java.io.IOException)8 ArrayList (java.util.ArrayList)7 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 MidPointService (com.evolveum.midpoint.studio.impl.MidPointService)5 PrismContext (com.evolveum.midpoint.prism.PrismContext)4 ObjectTypes (com.evolveum.midpoint.schema.constants.ObjectTypes)4 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)4 NotNull (org.jetbrains.annotations.NotNull)4 ComboObjectTypes (com.evolveum.midpoint.studio.action.browse.ComboObjectTypes)3 MidPointObject (com.evolveum.midpoint.studio.client.MidPointObject)3 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)3 BufferedWriter (java.io.BufferedWriter)3 OutputStreamWriter (java.io.OutputStreamWriter)3 Writer (java.io.Writer)3 List (java.util.List)3 PrismPropertyDefinition (com.evolveum.midpoint.prism.PrismPropertyDefinition)2