Search in sources :

Example 1 with ChoiceDialog

use of org.eclipse.che.ide.api.dialogs.ChoiceDialog in project che by eclipse.

the class EditDebugConfigurationsPresenter method createNewConfiguration.

private void createNewConfiguration(final DebugConfigurationType type, final String customName, final Map<String, String> attributes) {
    if (!isViewModified()) {
        reset();
        createConfiguration(type, customName, attributes);
        return;
    }
    final ConfirmCallback saveCallback = new ConfirmCallback() {

        @Override
        public void accepted() {
            updateConfiguration(editedConfiguration);
            reset();
            createConfiguration(type, customName, attributes);
        }
    };
    final ConfirmCallback discardCallback = new ConfirmCallback() {

        @Override
        public void accepted() {
            fetchConfigurations();
            reset();
            createConfiguration(type, customName, attributes);
        }
    };
    final ChoiceDialog dialog = dialogFactory.createChoiceDialog(locale.editConfigurationsSaveChangesTitle(), locale.editConfigurationsSaveChangesConfirmation(editedConfiguration.getName()), coreLocale.save(), locale.editConfigurationsSaveChangesDiscard(), saveCallback, discardCallback);
    dialog.show();
}
Also used : ChoiceDialog(org.eclipse.che.ide.api.dialogs.ChoiceDialog) ConfirmCallback(org.eclipse.che.ide.api.dialogs.ConfirmCallback)

Example 2 with ChoiceDialog

use of org.eclipse.che.ide.api.dialogs.ChoiceDialog in project che by eclipse.

the class EditCommandsPresenter method createNewCommand.

private void createNewCommand(final String type, final String commandLine, final String name, final Map<String, String> attributes) {
    if (!isViewModified()) {
        createCommand(type, commandLine, name, attributes);
        return;
    }
    final ConfirmCallback saveCallback = new ConfirmCallback() {

        @Override
        public void accepted() {
            updateCommand(editedCommand).then(new Operation<CommandImpl>() {

                @Override
                public void apply(CommandImpl arg) throws OperationException {
                    createCommand(type, commandLine, name, attributes);
                }
            });
        }
    };
    final ConfirmCallback discardCallback = new ConfirmCallback() {

        @Override
        public void accepted() {
            refreshView();
            createCommand(type, commandLine, name, attributes);
        }
    };
    ChoiceDialog dialog = dialogFactory.createChoiceDialog(machineLocale.editCommandsSaveChangesTitle(), machineLocale.editCommandsSaveChangesConfirmation(editedCommand.getName()), coreLocale.save(), machineLocale.editCommandsSaveChangesDiscard(), saveCallback, discardCallback);
    dialog.show();
}
Also used : CommandImpl(org.eclipse.che.ide.api.command.CommandImpl) ChoiceDialog(org.eclipse.che.ide.api.dialogs.ChoiceDialog) ConfirmCallback(org.eclipse.che.ide.api.dialogs.ConfirmCallback) OperationException(org.eclipse.che.api.promises.client.OperationException)

Example 3 with ChoiceDialog

use of org.eclipse.che.ide.api.dialogs.ChoiceDialog in project che by eclipse.

the class EditDebugConfigurationsPresenter method onConfigurationSelected.

@Override
public void onConfigurationSelected(final DebugConfiguration configuration) {
    if (!isViewModified()) {
        handleConfigurationSelection(configuration);
        return;
    }
    final ConfirmCallback saveCallback = new ConfirmCallback() {

        @Override
        public void accepted() {
            updateConfiguration(editedConfiguration);
            fetchConfigurations();
            handleConfigurationSelection(configuration);
        }
    };
    final ConfirmCallback discardCallback = new ConfirmCallback() {

        @Override
        public void accepted() {
            reset();
            fetchConfigurations();
            handleConfigurationSelection(configuration);
        }
    };
    final ChoiceDialog dialog = dialogFactory.createChoiceDialog(locale.editConfigurationsSaveChangesTitle(), locale.editConfigurationsSaveChangesConfirmation(editedConfiguration.getName()), coreLocale.save(), locale.editConfigurationsSaveChangesDiscard(), saveCallback, discardCallback);
    dialog.show();
}
Also used : ChoiceDialog(org.eclipse.che.ide.api.dialogs.ChoiceDialog) ConfirmCallback(org.eclipse.che.ide.api.dialogs.ConfirmCallback)

Example 4 with ChoiceDialog

use of org.eclipse.che.ide.api.dialogs.ChoiceDialog in project che by eclipse.

the class EditCommandsPresenter method onCommandSelected.

@Override
public void onCommandSelected(final CommandImpl command) {
    if (!isViewModified()) {
        handleCommandSelection(command);
        return;
    }
    final ConfirmCallback saveCallback = new ConfirmCallback() {

        @Override
        public void accepted() {
            updateCommand(editedCommand).then(new Operation<CommandImpl>() {

                @Override
                public void apply(CommandImpl arg) throws OperationException {
                    refreshView();
                    handleCommandSelection(command);
                }
            });
        }
    };
    final ConfirmCallback discardCallback = new ConfirmCallback() {

        @Override
        public void accepted() {
            refreshView();
            handleCommandSelection(command);
        }
    };
    ChoiceDialog dialog = dialogFactory.createChoiceDialog(machineLocale.editCommandsSaveChangesTitle(), machineLocale.editCommandsSaveChangesConfirmation(editedCommand.getName()), coreLocale.save(), machineLocale.editCommandsSaveChangesDiscard(), saveCallback, discardCallback);
    dialog.show();
}
Also used : CommandImpl(org.eclipse.che.ide.api.command.CommandImpl) ChoiceDialog(org.eclipse.che.ide.api.dialogs.ChoiceDialog) ConfirmCallback(org.eclipse.che.ide.api.dialogs.ConfirmCallback) OperationException(org.eclipse.che.api.promises.client.OperationException)

Aggregations

ChoiceDialog (org.eclipse.che.ide.api.dialogs.ChoiceDialog)4 ConfirmCallback (org.eclipse.che.ide.api.dialogs.ConfirmCallback)4 OperationException (org.eclipse.che.api.promises.client.OperationException)2 CommandImpl (org.eclipse.che.ide.api.command.CommandImpl)2