Search in sources :

Example 61 with MessageDialog

use of org.eclipse.jface.dialogs.MessageDialog in project webtools.servertools by eclipse.

the class ServerUIPlugin method promptIfDirty.

/**
 * Prompts the user if the server is dirty. Returns true if the server was
 * not dirty or if the user decided to continue anyway. Returns false if
 * the server is dirty and the user chose to cancel the operation.
 *
 * @param shell a shell
 * @param server a server
 * @return boolean
 */
public static boolean promptIfDirty(Shell shell, IServer server) {
    if (server == null)
        return false;
    if (!(server instanceof IServerWorkingCopy))
        return true;
    String title = Messages.resourceDirtyDialogTitle;
    IServerWorkingCopy wc = (IServerWorkingCopy) server;
    if (wc.isDirty()) {
        String message = NLS.bind(Messages.resourceDirtyDialogMessage, server.getName());
        String[] labels = new String[] { Messages.resourceDirtyDialogContinue, IDialogConstants.CANCEL_LABEL };
        MessageDialog dialog = new MessageDialog(shell, title, null, message, MessageDialog.INFORMATION, labels, 0);
        if (dialog.open() != 0)
            return false;
    }
    return true;
}
Also used : MessageDialog(org.eclipse.jface.dialogs.MessageDialog)

Example 62 with MessageDialog

use of org.eclipse.jface.dialogs.MessageDialog in project mdw-designer by CenturyLinkCloud.

the class ProcessEditor method promptToSaveOverrideAttributes.

private int promptToSaveOverrideAttributes() {
    String msg = getProcess().getName() + " has unsaved override attributes.  Save changes?";
    String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL };
    MessageDialog attrsSaveDialog = new MessageDialog(getSite().getShell(), "Save Attributes", null, msg, MessageDialog.QUESTION, buttons, 0);
    return attrsSaveDialog.open();
}
Also used : MessageDialog(org.eclipse.jface.dialogs.MessageDialog)

Example 63 with MessageDialog

use of org.eclipse.jface.dialogs.MessageDialog in project azure-tools-for-java by Microsoft.

the class HDInsightHelperImpl method createRefreshHdiReaderStorageAccountsWarningForm.

public void createRefreshHdiReaderStorageAccountsWarningForm(@NotNull RefreshableNode node, @NotNull String aseDeepLink) {
    Display.getDefault().asyncExec(() -> {
        String title = "Storage Access Denied";
        String warningText = "You have Read-only permission for this cluster. Please ask the cluster owner or user " + "access administrator to upgrade your role to HDInsight Cluster Operator in the Azure Portal, or " + "use Azure Storage Explorer to access the storages associated with this cluster.";
        // String[] dialogButtonLabels = new String[] {"Link this cluster", "Cancel"};
        String[] dialogButtonLabels = new String[] { "Ok" };
        MessageDialog warningDialog = new MessageDialog(PluginUtil.getParentShell(), title, null, warningText, MessageDialog.WARNING, dialogButtonLabels, 0);
        warningDialog.open();
    // if (warningDialog.open() == 0) {
    // try {
    // DefaultLoader.getIdeHelper().openLinkInBrowser(aseDeepLink);
    // } catch (Exception ex) {
    // DefaultLoader.getUIHelper().showError(ex.getMessage(), "HDInsight Explorer");
    // }
    // }
    });
}
Also used : MessageDialog(org.eclipse.jface.dialogs.MessageDialog)

Example 64 with MessageDialog

use of org.eclipse.jface.dialogs.MessageDialog in project azure-tools-for-java by Microsoft.

the class HDInsightHelperImpl method createRefreshHdiLinkedClusterStorageAccountsWarningForm.

public void createRefreshHdiLinkedClusterStorageAccountsWarningForm(@NotNull RefreshableNode node, @NotNull String aseDeepLink) {
    Display.getDefault().asyncExec(() -> {
        String title = "Storage Access Denied";
        String warningText = "You are only linked to HDInsight cluster through Ambari credentials. Please use Azure " + "Storage Explorer to access the storage associated with this cluster.";
        // String[] dialogButtonLabels = new String[] {"Open Azure Storage Explorer", "Cancel"};
        String[] dialogButtonLabels = new String[] { "Ok" };
        MessageDialog warningDialog = new MessageDialog(PluginUtil.getParentShell(), title, null, warningText, MessageDialog.WARNING, dialogButtonLabels, 0);
        warningDialog.open();
    // if (warningDialog.open() == 0) {
    // try {
    // DefaultLoader.getIdeHelper().openLinkInBrowser(aseDeepLink);
    // } catch (Exception ex) {
    // DefaultLoader.getUIHelper().showError(ex.getMessage(), "HDInsight Explorer");
    // }
    // }
    });
}
Also used : MessageDialog(org.eclipse.jface.dialogs.MessageDialog)

Example 65 with MessageDialog

use of org.eclipse.jface.dialogs.MessageDialog in project azure-tools-for-java by Microsoft.

the class HDInsightHelperImpl method createRefreshHdiReaderJobsWarningForm.

public void createRefreshHdiReaderJobsWarningForm(@NotNull HDInsightRootModule module, @NotNull ClusterDetail clusterDetail) {
    Display.getDefault().asyncExec(() -> {
        String title = "Cluster Job Access Denied";
        String warningText = "You have Read-only permission for this cluster. Please ask the cluster owner or user " + "access administrator to upgrade your role to HDInsight Cluster Operator in the Azure Portal, or " + "‘Link this cluster’ through Ambari credentials to view the corresponding jobs.";
        String[] dialogButtonLabels = new String[] { "Link this cluster", "Cancel" };
        MessageDialog warningDialog = new MessageDialog(PluginUtil.getParentShell(), title, null, warningText, MessageDialog.WARNING, dialogButtonLabels, 0);
        if (warningDialog.open() == 0) {
            // First button pressed
            AddNewHDInsightReaderClusterForm linkClusterForm = new AddNewHDInsightReaderClusterForm(PluginUtil.getParentShell(), module, clusterDetail);
            linkClusterForm.open();
        }
    });
}
Also used : MessageDialog(org.eclipse.jface.dialogs.MessageDialog) AddNewHDInsightReaderClusterForm(com.microsoft.azuretools.azureexplorer.forms.AddNewHDInsightReaderClusterForm)

Aggregations

MessageDialog (org.eclipse.jface.dialogs.MessageDialog)129 Shell (org.eclipse.swt.widgets.Shell)27 CoreException (org.eclipse.core.runtime.CoreException)16 IPath (org.eclipse.core.runtime.IPath)14 File (java.io.File)10 ArrayList (java.util.ArrayList)10 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)10 InvocationTargetException (java.lang.reflect.InvocationTargetException)9 Composite (org.eclipse.swt.widgets.Composite)9 SelectionEvent (org.eclipse.swt.events.SelectionEvent)7 Point (org.eclipse.swt.graphics.Point)7 IOException (java.io.IOException)6 IFile (org.eclipse.core.resources.IFile)6 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)6 List (java.util.List)5 IStatus (org.eclipse.core.runtime.IStatus)5 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)5 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)5 IWorkspaceRoot (org.eclipse.core.resources.IWorkspaceRoot)4 Path (org.eclipse.core.runtime.Path)4