Example usage for org.eclipse.jface.dialogs MessageDialog WARNING

List of usage examples for org.eclipse.jface.dialogs MessageDialog WARNING

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs MessageDialog WARNING.

Prototype

int WARNING

To view the source code for org.eclipse.jface.dialogs MessageDialog WARNING.

Click Source Link

Document

Constant for the warning image, or a simple dialog with the warning image and a single OK button (value 4).

Usage

From source file:com.salesforce.ide.ui.handlers.AddNatureHandler.java

License:Open Source License

@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
    final IWorkbench workbench = HandlerUtil.getActiveWorkbenchWindowChecked(event).getWorkbench();
    final IProject project = getProjectChecked(event);
    try {/*from ww  w  . j ava 2s.c om*/
        if (project.hasNature(DefaultNature.NATURE_ID)) {
            Utils.openInfo("Force.com Default Nature Exists",
                    "Force.com Default Nature already exists on project '" + project.getName() + "'.");
            return null;
        }
    } catch (CoreException e) {
        String logMessage = Utils.generateCoreExceptionLog(e);
        logger.error("Unable to apply Force.com Default Nature to project '" + project.getName() + "': "
                + logMessage, e);
        Utils.openError(e, "Force.com Default Nature Error",
                "Problems adding Force.com Default Nature to project '" + project.getName() + "': "
                        + e.getMessage());
        return null;
    }

    applyNature(workbench, project);
    updateDecorators(workbench);

    DialogUtils.getInstance().okMessage("Force.com Project Properties",
            UIMessages.getString("AddForceNature.Properties.message"), MessageDialog.WARNING);
    (new OpenForcePerspectiveAction()).run();

    return null;
}

From source file:com.salesforce.ide.ui.internal.startup.ForceStartup.java

License:Open Source License

public void earlyStartup() {
    if (!Utils.isSkipCompatibilityCheck()) {
        Bundle bundle = Platform.getBundle(Constants.PREV_IDE_BUNDLE_NAME);
        if (bundle != null) {
            int state = bundle.getState();
            if (logger.isDebugEnabled()) {
                StringBuilder debugInfo = new StringBuilder("Current state of older version bundle '");
                debugInfo.append(Constants.PREV_IDE_BUNDLE_NAME + "' is '" + state + "'");
                debugInfo.append("Ref: UNINSTALLED=" + Bundle.UNINSTALLED + ", INSTALLED=" + Bundle.INSTALLED
                        + ", RESOLVED=" + Bundle.RESOLVED + ", STARTING=" + Bundle.STARTING + ", STOPPING="
                        + Bundle.STOPPING + ", ACTIVE=" + Bundle.ACTIVE + ")");
                logger.debug(debugInfo);
            }//from  w  w  w . j  a v a2  s  . c om

            if (state != Bundle.STOPPING || state != Bundle.UNINSTALLED) {
                String title = UIMessages.getString("Force.Startup.Compatibility.Warning.title");

                String bundleName = (String) bundle.getHeaders().get(Constants.BUNDLE_ATTRIBUTE_NAME);
                String bundleVersion = (String) bundle.getHeaders().get(Constants.BUNDLE_ATTRIBUTE_VERSION);
                String dialogMsg = UIMessages.getString("Force.Startup.Compatibility.Warning.message",
                        new String[] { bundleName, bundleVersion });

                MessageDialogRunnable messageDialogRunnable = new MessageDialogRunnable(title, null, dialogMsg,
                        MessageDialog.WARNING, new String[] { IDialogConstants.OK_LABEL }, 0);
                Display.getDefault().asyncExec(messageDialogRunnable);

            }
        }
    }

    Display.getDefault().asyncExec(new Runnable() {
        public void run() {
            IPerspectiveDescriptor[] perspectives = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
                    .getActivePage().getOpenPerspectives();
            if (Utils.isNotEmpty(perspectives)) {

                for (IPerspectiveDescriptor perspectiveDescriptor : perspectives) {
                    if (perspectiveDescriptor.getId().startsWith(Constants.SFDC_PREFIX)) {
                        logger.debug("Found " + perspectiveDescriptor.getId() + " perspective"); //$NON-NLS-1$ //$NON-NLS-2$
                    }
                }
            }
        }
    });

    addPackageManifestChangeListener();
}

From source file:com.salesforce.ide.ui.refactoring.BaseRefactorController.java

License:Open Source License

protected void testDeploy(IProgressMonitor monitor)
        throws OperationCanceledException, InterruptedException, ServiceException, ForceRemoteException {
    DeployResultExt deployResultExt = null;
    ProjectPackageList projectPackageList = refactorModel.getProjectPackageList();

    monitorCheck(monitor);//from   ww  w .  j av  a2  s. c  o m

    try {
        try {
            deployResultExt = ContainerDelegate.getInstance().getServiceLocator().getPackageDeployService()
                    .deployDelete(projectPackageList, true, monitor);
        } catch (ServiceTimeoutException ex) {
            deployResultExt = ContainerDelegate.getInstance().getServiceLocator().getPackageDeployService()
                    .handleDeployServiceTimeoutException(ex, "test deploy", monitor);
        }

        if (!deployResultExt.isSuccess()) {
            deployResultExt.getMessageHandler().sort(DeployMessageExt.SORT_RESULT);
            DeployMessage[] deployMessages = deployResultExt.getMessageHandler().getMessages();
            for (DeployMessage deployMessage : deployMessages) {
                if (!deployMessage.isSuccess()) {
                    logger.warn("Component '" + deployMessage.getFullName() + "' failed test delete: '"
                            + deployMessage.getProblem() + "'. will be deleted locally only.");

                    projectPackageList.removeComponentByFilePath(deployMessage.getFileName(), true, true);
                    monitorCheck(monitor);
                    MessageDialogRunnable messageDialogRunnable = new MessageDialogRunnable(
                            "Remote Delete Error", null,
                            UIMessages.getString("Refactor.Delete.Complete.CannotDelete.message",
                                    new String[] { deployMessage.getFileName(), deployMessage.getProblem() }),
                            MessageDialog.WARNING,
                            new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
                    Display.getDefault().syncExec(messageDialogRunnable);

                    if (messageDialogRunnable.getAction() == 1) {
                        logger.warn("Canceling delete operation");
                        throw new OperationCanceledException("Delete operation canceled");
                    }
                }
            }
        }
    } catch (InterruptedException e) {
        throw new OperationCanceledException(e.getMessage());
    } catch (DeployException e) {
        logger.error("Unable to perform server delete", e);
    } catch (ForceConnectionException e) {
        logger.warn("Unable to perform server delete", e);
    }
}

From source file:com.salesforce.ide.ui.views.runtest.RunTestsLaunchConfigurationDelegate.java

License:Open Source License

/**
  * Pop up a confirmation dialog regarding asynchronous test run while debugging
  * @return False if abort, true if continue
  *///  w  w  w  .  j  a  va 2  s  .  c  o  m
@VisibleForTesting
public boolean confirmAsyncTestRunWhileDebugging() {
    Display display = getDisplay();
    final AtomicInteger choice = new AtomicInteger(0);

    display.syncExec(new Runnable() {
        @Override
        public void run() {
            choice.set(
                    DialogUtils.getInstance().cancelContinueMessage(Messages.LaunchDelegate_ConfirmDialogTitle,
                            Messages.LaunchDelegate_CannotLaunchAsyncWhileDebugging, MessageDialog.WARNING));
        }
    });

    return choice.get() == 1;
}

From source file:com.salesforce.ide.upgrade.internal.UpgradeNotifier.java

License:Open Source License

protected int openUpgradeDialog(String projectName) {
    return DialogUtils.getInstance().yesNoMessage(UpgradeMessages.getString("UpgradeAlert.title"),
            UpgradeMessages.getString("UpgradeAlert.message",
                    new String[] { projectName, serviceLocator.getProjectService().getIdeReleaseName() }),
            MessageDialog.WARNING);
}

From source file:com.salesforce.ide.upgrade.ui.wizards.UpgradeWizard.java

License:Open Source License

@Override
public boolean performCancel() {
    int result = DialogUtils.getInstance().yesNoMessage(UpgradeMessages.getString("UpgradeWizard.Cancel.title"),
            UpgradeMessages.getString("UpgradeWizard.Cancel.message"), MessageDialog.WARNING);
    return !(result > 0);
}

From source file:com.sap.netweaver.porta.ide.eclipse.server.ui.dialogs.NoWSGateDialog.java

License:Open Source License

public NoWSGateDialog(Shell parentShell, NoWSGateException exception) {
    super(parentShell, "Deploy Web Service Not Available", null, /* dialogTitleImage */
            exception.getLocalizedMessage(), MessageDialog.WARNING,
            new String[] { "&Open Instructions", IDialogConstants.CLOSE_LABEL }, 0);
    this.endpoint = exception.getEndpoint();
}

From source file:com.sap.netweaver.porta.ide.eclipse.server.ui.dialogs.PublishProblemDialog.java

License:Open Source License

private static int getImage(DeployResultStatus status) {
    switch (status) {
    case ERROR:/*from  w  w w .j  a v  a 2 s  . c  o m*/
        return MessageDialog.ERROR;
    case WARNING:
        return MessageDialog.WARNING;
    default:
        return MessageDialog.NONE;
    }
}

From source file:com.siteview.mde.internal.ui.wizards.imports.PluginImportWizard.java

License:Open Source License

public boolean performFinish() {
    page1.storeSettings();/*from w  ww .j ava2s.c  o  m*/
    ((BaseImportWizardSecondPage) page1.getNextPage()).storeSettings();
    final IMonitorModelBase[] models = getModelsToImport();
    int launchedConfiguration = getConflictingConfigurationsCount(models);
    if (launchedConfiguration > 0) {
        String message = launchedConfiguration == 1 ? MDEUIMessages.PluginImportWizard_runningConfigDesc
                : MDEUIMessages.PluginImportWizard_runningConfigsDesc;
        MessageDialog dialog = new MessageDialog(getShell(),
                MDEUIMessages.PluginImportWizard_runningConfigsTitle, null, message, MessageDialog.WARNING,
                new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
        if (dialog.open() != IDialogConstants.OK_ID)
            return false;

    }
    if (page1.getImportType() == PluginImportOperation.IMPORT_FROM_REPOSITORY) {
        if (getContainer().getCurrentPage() instanceof BaseImportWizardSecondPage) {
            // ensure to set the models to import when finished is pressed without advancing to the repository pages
            page1.configureBundleImportPages(models);
        }
    }
    // finish contributed pages
    if (!page1.finishPages()) {
        return false;
    }
    doImportOperation(page1.getImportType(), models, page2.forceAutoBuild(), launchedConfiguration > 0,
            page1.getAlternateSourceLocations(), page1.getImportDescriptions());

    return true;
}

From source file:com.softlanding.rse.extensions.compare.CompareDialog.java

License:Open Source License

protected void okPressed() {
    if (editButton.getSelection() && ExtensionsPlugin.getDefault().getPreferenceStore()
            .getBoolean(ExtensionsPlugin.PREFERENCE_COMPARE_MERGE_WARNING)) {
        WarningDialog dialog = new WarningDialog(getShell(),
                ExtensionsPlugin.getResourceString("CompareDialog.15"), null, //$NON-NLS-1$
                ExtensionsPlugin.getResourceString("CompareDialog.16"), MessageDialog.WARNING, //$NON-NLS-1$
                new String[] { ExtensionsPlugin.getResourceString("CompareDialog.17"), //$NON-NLS-1$
                        ExtensionsPlugin.getResourceString("CompareDialog.18") }, //$NON-NLS-1$
                0);//from   w  w  w. ja  v  a2 s.co  m
        if (dialog.open() == WarningDialog.CANCEL) {
            super.cancelPressed();
            return;
        }
    }
    if (editButton.getSelection())
        settings.put("CompareDialog.mode", "e"); //$NON-NLS-1$ //$NON-NLS-2$
    else
        settings.put("CompareDialog.mode", "b"); //$NON-NLS-1$ //$NON-NLS-2$
    openForEdit = editButton.getSelection();
    if (compareConnection == null) {
        compareConnection = compareConnectionCombo.getISeriesConnection();
    }
    compareLibrary = compareMemberPrompt.getLibraryName();
    compareFile = compareMemberPrompt.getFileName();
    compareMember = compareMemberPrompt.getMemberName();
    super.okPressed();
}