Example usage for com.intellij.openapi.ui Messages getQuestionIcon

List of usage examples for com.intellij.openapi.ui Messages getQuestionIcon

Introduction

In this page you can find the example usage for com.intellij.openapi.ui Messages getQuestionIcon.

Prototype

@NotNull
    public static Icon getQuestionIcon() 

Source Link

Usage

From source file:org.intellij.plugins.xpathView.ui.InputExpressionDialog.java

License:Apache License

protected void init() {
    myForm.getIcon().setText(null);/*w w w .jav  a2 s.  c  o m*/
    myForm.getIcon().setIcon(Messages.getQuestionIcon());

    myForm.getEditContextButton().addActionListener(new ActionListener() {

        @SuppressWarnings({ "unchecked" })
        public void actionPerformed(ActionEvent e) {
            final HistoryElement selectedItem = myModel.getSelectedItem();

            final Collection<Namespace> n;
            final Collection<Variable> v;
            if (selectedItem != null) {
                n = selectedItem.namespaces;
                v = selectedItem.variables;
            } else {
                n = Collections.emptySet();
                v = Collections.emptySet();
            }

            // FIXME
            final Collection<Namespace> namespaces = myNamespaceCache != null
                    ? merge(myNamespaceCache, n, false)
                    : n;

            final Set<String> unresolvedPrefixes = findUnresolvedPrefixes();
            final EditContextDialog dialog = new EditContextDialog(myProject, unresolvedPrefixes, namespaces, v,
                    myContextProvider);

            dialog.show();

            if (dialog.isOK()) {
                final Pair<Collection<Namespace>, Collection<Variable>> context = dialog.getContext();
                final Collection<Namespace> newNamespaces = context.getFirst();
                final Collection<Variable> newVariables = context.getSecond();

                updateContext(newNamespaces, newVariables);

                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        final Editor editor = getEditor();
                        if (editor != null) {
                            editor.getContentComponent().grabFocus();
                        }
                    }
                });
            }
        }
    });

    updateOkAction();

    super.init();
}

From source file:org.intellij.stripes.actions.StripesNewActionBeanAction.java

License:Apache License

@NotNull
@Override//w w w .j a  v a2s .  c  o m
protected PsiElement[] invokeDialog(Project project, PsiDirectory directory) {
    MyInputValidator validator = new MyInputValidator(project, directory);
    Messages.showInputDialog(project, "Enter Name for New Stripes ActionBean", "New Stripes Action Bean",
            Messages.getQuestionIcon(), "", validator);
    return validator.getCreatedElements();
}

From source file:org.jboss.forge.plugin.idea.runtime.UIPromptImpl.java

License:Open Source License

@Override
public String prompt(final String message) {
    ApplicationManager.getApplication().invokeAndWait(new Runnable() {
        @Override/*from  w w w .j  a v a  2s.  c om*/
        public void run() {
            stringValue = Messages.showInputDialog("", message, Messages.getQuestionIcon());
        }
    }, ModalityState.any());
    return stringValue;
}

From source file:org.jboss.forge.plugin.idea.runtime.UIPromptImpl.java

License:Open Source License

@Override
public boolean promptBoolean(final String message) {
    ApplicationManager.getApplication().invokeAndWait(new Runnable() {
        @Override//from w  w  w  .  j a  va  2  s  . c o m
        public void run() {
            booleanValue = Messages.showYesNoDialog(message, "", Messages.getQuestionIcon()) == Messages.YES;
        }
    }, ModalityState.any());
    return booleanValue;
}

From source file:org.jboss.forge.plugin.idea.runtime.UIPromptImpl.java

License:Open Source License

@Override
public boolean promptBoolean(final String message, final boolean defaultValue) {
    ApplicationManager.getApplication().invokeAndWait(new Runnable() {
        @Override/*from  w ww  . j  a va2  s .  c o  m*/
        public void run() {
            int result = Messages.showYesNoCancelDialog(message, "", Messages.getQuestionIcon());
            booleanValue = result == Messages.CANCEL ? defaultValue : result == Messages.YES;
        }
    }, ModalityState.any());
    return booleanValue;
}

From source file:org.jboss.forge.plugin.idea.ui.component.many.TextBoxMultipleComponentBuilder.java

License:Open Source License

@Override
public ForgeComponent build(final UIContext context, final InputComponent<?, Object> input) {
    return new ListComponent((UIInputMany) input) {
        @Override//from  www  . j  a va  2s  . c om
        protected String editSelectedItem(String item) {
            return showEditDialog("Edit item", item);
        }

        @Override
        protected String findItemToAdd() {
            return showEditDialog("Add item", "");
        }

        private String showEditDialog(String title, final String initialValue) {
            return Messages.showInputDialog(IDEUtil.projectFromContext(context), "", title,
                    Messages.getQuestionIcon(), initialValue, null);
        }
    };
}

From source file:org.jetbrains.android.actions.AndroidEnableAdbServiceAction.java

License:Apache License

private static boolean askForClosingDebugSessions(@NotNull Project project) {
    final List<Pair<ProcessHandler, RunContentDescriptor>> pairs = new ArrayList<Pair<ProcessHandler, RunContentDescriptor>>();

    for (Project p : ProjectManager.getInstance().getOpenProjects()) {
        final ProcessHandler[] processes = ExecutionManager.getInstance(p).getRunningProcesses();

        for (ProcessHandler process : processes) {
            if (!process.isProcessTerminated()) {
                final AndroidSessionInfo info = process.getUserData(AndroidDebugRunner.ANDROID_SESSION_INFO);
                if (info != null) {
                    pairs.add(Pair.create(process, info.getDescriptor()));
                }/*from w w  w . j  a v a 2 s .  co m*/
            }
        }
    }

    if (pairs.size() == 0) {
        return true;
    }

    final StringBuilder s = new StringBuilder();

    for (Pair<ProcessHandler, RunContentDescriptor> pair : pairs) {
        if (s.length() > 0) {
            s.append('\n');
        }
        s.append(pair.getSecond().getDisplayName());
    }

    final int r = Messages.showYesNoDialog(project,
            AndroidBundle.message("android.debug.sessions.will.be.closed", s),
            AndroidBundle.message("android.disable.adb.service.title"), Messages.getQuestionIcon());
    return r == Messages.YES;
}

From source file:org.jetbrains.android.actions.CreateTypedResourceFileAction.java

License:Apache License

@NotNull
@Override/*  w  w  w  .ja v  a2  s.com*/
protected PsiElement[] invokeDialog(Project project, PsiDirectory directory) {
    InputValidator validator = createValidator(project, directory);
    Messages.showInputDialog(project, AndroidBundle.message("new.file.dialog.text"),
            AndroidBundle.message("new.typed.resource.dialog.title", myResourcePresentableName),
            Messages.getQuestionIcon(), "", validator);
    return PsiElement.EMPTY_ARRAY;
}

From source file:org.jetbrains.android.AndroidResourceRenameResourceProcessor.java

License:Apache License

@Nullable
private static String getResourceName(Project project, String newFieldName, String oldResourceName) {
    if (newFieldName.indexOf('_') < 0)
        return newFieldName;
    if (oldResourceName.indexOf('_') < 0 && oldResourceName.indexOf('.') >= 0) {
        String suggestion = newFieldName.replace('_', '.');
        newFieldName = Messages.showInputDialog(project,
                AndroidBundle.message("rename.resource.dialog.text", oldResourceName),
                RefactoringBundle.message("rename.title"), Messages.getQuestionIcon(), suggestion, null);
    }/*from w  w w  . jav a2 s .c  o  m*/
    return newFieldName;
}

From source file:org.jetbrains.android.AndroidResourceRenameResourceProcessor.java

License:Apache License

private static void prepareResourceFileRenaming(PsiFile file, String newName,
        Map<PsiElement, String> allRenames, AndroidFacet facet) {
    Project project = file.getProject();
    ResourceManager manager = facet.getLocalResourceManager();
    String type = manager.getFileResourceType(file);
    if (type == null)
        return;//from   w w  w  .  ja  v a 2  s.c  om
    String name = file.getName();

    if (AndroidCommonUtils.getResourceName(type, name)
            .equals(AndroidCommonUtils.getResourceName(type, newName))) {
        return;
    }

    List<PsiFile> resourceFiles = manager.findResourceFiles(type,
            AndroidCommonUtils.getResourceName(type, name), true, false);
    List<PsiFile> alternativeResources = new ArrayList<PsiFile>();
    for (PsiFile resourceFile : resourceFiles) {
        if (!resourceFile.getManager().areElementsEquivalent(file, resourceFile)
                && resourceFile.getName().equals(name)) {
            alternativeResources.add(resourceFile);
        }
    }
    if (alternativeResources.size() > 0) {
        int r = 0;
        if (ASK) {
            r = Messages.showYesNoDialog(project, message("rename.alternate.resources.question"),
                    message("rename.dialog.title"), Messages.getQuestionIcon());
        }
        if (r == 0) {
            for (PsiFile candidate : alternativeResources) {
                allRenames.put(candidate, newName);
            }
        } else {
            return;
        }
    }
    PsiField[] resFields = AndroidResourceUtil.findResourceFieldsForFileResource(file, false);
    for (PsiField resField : resFields) {
        String newFieldName = AndroidCommonUtils.getResourceName(type, newName);
        allRenames.put(resField, AndroidResourceUtil.getFieldNameByResourceName(newFieldName));
    }
}