Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

All the bound cloud applications are re-pushed if deleting one bound pro... #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,13 @@ public void handleError(IStatus status, BehaviourEventType eventType) {

}

/**
* Shows a confirmation dialog with the given operation title and message, and
* asks the user the determine whether to execute the target operation.
*
* @param title the title of the target operation
* @param message the message presented to the user
* @return true if the user chooses to execute the target operation, false otherwise
*/
public abstract boolean confirmTheOperation(final String title, final String message);
}
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ public void applicationStarting(CloudFoundryServer server, CloudFoundryApplicati
// TODO Auto-generated method stub

}

@Override
public boolean confirmTheOperation(String title, String message) {
// ignore
return false;
}
}

private static class AppStateTrackerEntry {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ public class Messages extends NLS {

public static String ModuleResourceApplicationArchive_ERROR_NO_DEPLOYABLE_RES_FOUND;

public static String REPUSH_CLOUD_APP_CONFIRMATION_TITLE;

public static String REPUSH_CLOUD_APP_CONFIRMATION_MESSAGE;

private static final String BUNDLE_NAME = CloudFoundryPlugin.PLUGIN_ID + ".internal.Messages"; //$NON-NLS-1$

static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,5 @@ ROUTES=Getting routes for domain - {0}
EMPTY_URL_ERROR=Enter a deployment URL
JavaWebApplicationDelegate_ERROR_NO_MAPPED_APP_URL=No mapped application URLs set in application deployment information.
ModuleResourceApplicationArchive_ERROR_NO_DEPLOYABLE_RES_FOUND=Unable to deploy module. No deployable resources found for module: {0} with id: {1}
REPUSH_CLOUD_APP_CONFIRMATION_TITLE=Confirm to repush cloud application
REPUSH_CLOUD_APP_CONFIRMATION_MESSAGE=Are you sure to repush the bound cloud application {0} ?
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,9 @@ else if (!module[0].isExternal()) {
// publish
op = new PushApplicationOperation(module);
}
else if (deltaKind == ServerBehaviourDelegate.CHANGED) {
else if (deltaKind == ServerBehaviourDelegate.CHANGED && CloudFoundryPlugin.getCallback()
.confirmTheOperation(Messages.REPUSH_CLOUD_APP_CONFIRMATION_TITLE,
NLS.bind(Messages.REPUSH_CLOUD_APP_CONFIRMATION_MESSAGE, module[0].getName()))) {
op = getApplicationOperation(module, ApplicationAction.UPDATE_RESTART);
}
// Republish the root module if any of the child module requires
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,9 @@ public void applicationStarting(CloudFoundryServer server, CloudFoundryApplicati
// TODO Auto-generated method stub
}

@Override
public boolean confirmTheOperation(String title, String message) {
// ignore
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,23 @@ public IStatus runInUIThread(IProgressMonitor monitor) {
}
}

/**
* {@inheritDoc}
*/
@Override
public boolean confirmTheOperation(final String title, final String message) {
final boolean[] confirm = new boolean[1];
confirm[0] = false;
Display.getDefault().syncExec(new Runnable() {

public void run() {
confirm[0] = MessageDialog.openConfirm(
Display.getCurrent().getActiveShell(),
title,
message);
}

});
return confirm[0];
}
}