本文整理汇总了Java中org.eclipse.wst.server.core.IServer.STATE_STOPPING属性的典型用法代码示例。如果您正苦于以下问题:Java IServer.STATE_STOPPING属性的具体用法?Java IServer.STATE_STOPPING怎么用?Java IServer.STATE_STOPPING使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.wst.server.core.IServer
的用法示例。
在下文中一共展示了IServer.STATE_STOPPING属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateName
/**
* Update the shown name with the server stop/stopping state.
*/
private void updateName(int serverState) {
final String computedName;
if (serverState == IServer.STATE_STARTING) {
computedName = Messages.getString("SERVER_STARTING_TEMPLATE", unprefixedName);
} else if (serverState == IServer.STATE_STOPPING) {
computedName = Messages.getString("SERVER_STOPPING_TEMPLATE", unprefixedName);
} else if (serverState == IServer.STATE_STOPPED) {
computedName = Messages.getString("SERVER_STOPPED_TEMPLATE", unprefixedName);
} else {
computedName = unprefixedName;
}
UIJob nameUpdateJob = new UIJob("Update server name") {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
LocalAppEngineConsole.this.setName(computedName);
return Status.OK_STATUS;
}
};
nameUpdateJob.setSystem(true);
nameUpdateJob.schedule();
}
示例2: configureToolBar
private void configureToolBar(IToolBarManager toolbarManager) {
terminateAction = new Action(Messages.actionStop) {
@Override
public void run() {
//code to execute when button is pressed
LocalAppEngineServerBehaviour serverBehaviour = console.getServerBehaviourDelegate();
if (serverBehaviour != null) {
// try to initiate a nice shutdown
boolean force = serverBehaviour.getServer().getServerState() == IServer.STATE_STOPPING;
serverBehaviour.stop(force);
}
update();
}
};
terminateAction.setToolTipText(Messages.actionStopToolTip);
terminateAction.setImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_STOP));
terminateAction.setHoverImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_STOP));
terminateAction.setDisabledImageDescriptor(ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_STOP));
toolbarManager.appendToGroup(IConsoleConstants.LAUNCH_GROUP, terminateAction);
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:21,代码来源:LocalAppEngineConsolePageParticipant.java
示例3: stop
@Override
public void stop(boolean force) {
int serverState = getServer().getServerState();
if (serverState == IServer.STATE_STOPPED) {
return;
}
// If the server seems to be running, and we haven't already tried to stop it,
// then try to shut it down nicely
if (devServer != null && (!force || serverState != IServer.STATE_STOPPING)) {
setServerState(IServer.STATE_STOPPING);
DefaultStopConfiguration stopConfig = new DefaultStopConfiguration();
if (isDevAppServer1()) {
stopConfig.setAdminPort(serverPort);
} else {
stopConfig.setAdminPort(adminPort);
}
try {
devServer.stop(stopConfig);
} catch (AppEngineException ex) {
logger.log(Level.WARNING, "Error terminating server: " + ex.getMessage(), ex); //$NON-NLS-1$
}
} else {
// we've already given it a chance
logger.info("forced stop: destroying associated processes"); //$NON-NLS-1$
if (devProcess != null) {
devProcess.destroy();
devProcess = null;
}
devServer = null;
setServerState(IServer.STATE_STOPPED);
}
}
示例4: runAndWait
@Override
public T runAndWait(DockerClient client, SubMonitor monitor) throws CoreException {
DockerFoundryServer cloudServer = getCloudServer();
if (cloudServer.getDockerfile() == null || cloudServer.getDockerfile().length() == 0) {
DockerFoundryPlugin.getCallback().getCredentials(cloudServer);
}
Server server = (Server) cloudServer.getServer();
// Any Server request will require the server to be connected, so update
// the server state
if (server.getServerState() == IServer.STATE_STOPPED || server.getServerState() == IServer.STATE_STOPPING) {
server.setServerState(IServer.STATE_STARTING);
}
try {
T result = super.runAndWait(client, monitor);
// No errors at this stage, therefore assume operation was completed
// successfully, and update
// server state accordingly
if (server.getServerState() != IServer.STATE_STARTED) {
server.setServerState(IServer.STATE_STARTED);
}
return result;
}
catch (CoreException ce) {
// If the server state was starting and the error is related when
// the operation was
// attempted, but the operation failed
// set the server state back to stopped.
if (CloudErrorUtil.isConnectionError(ce) && server.getServerState() == IServer.STATE_STARTING) {
server.setServerState(IServer.STATE_STOPPED);
}
// server.setServerPublishState(IServer.PUBLISH_STATE_NONE);
throw ce;
}
}
示例5: runAndWait
@Override
public T runAndWait(CloudFoundryOperations client, SubMonitor monitor) throws CoreException {
CloudFoundryServer cloudServer = getCloudServer();
if (!cloudServer.isSso()) {
// The username/password should not be null in non-sso scenario.
if (cloudServer.getUsername() == null || cloudServer.getUsername().length() == 0
|| cloudServer.getPassword() == null || cloudServer.getPassword().length() == 0) {
CloudFoundryPlugin.getCallback().getCredentials(cloudServer);
}
} else {
if(cloudServer.getToken() == null) {
CloudFoundryPlugin.getCallback().ssoLoginUserPrompt(cloudServer);
}
}
Server server = (Server) cloudServer.getServer();
// Any Server request will require the server to be connected, so update
// the server state
if (server.getServerState() == IServer.STATE_STOPPED || server.getServerState() == IServer.STATE_STOPPING) {
server.setServerState(IServer.STATE_STARTING);
}
try {
T result = super.runAndWait(client, monitor);
// No errors at this stage, therefore assume operation was completed
// successfully, and update
// server state accordingly
if (server.getServerState() != IServer.STATE_STARTED) {
server.setServerState(IServer.STATE_STARTED);
}
return result;
}
catch (CoreException ce) {
// If the server state was starting and the error is related when
// the operation was
// attempted, but the operation failed
// set the server state back to stopped.
if (CloudErrorUtil.isConnectionError(ce) && server.getServerState() == IServer.STATE_STARTING) {
server.setServerState(IServer.STATE_STOPPED);
}
// server.setServerPublishState(IServer.PUBLISH_STATE_NONE);
throw ce;
}
}
示例6: promptCredentialsAndRun
public T promptCredentialsAndRun(IProgressMonitor monitor) throws CoreException {
CloudFoundryServer cloudServer = getCloudServer();
if (!cloudServer.isSso()) {
// The username/password should not be null in non-sso scenario.
if (cloudServer.getUsername() == null || cloudServer.getUsername().length() == 0
|| cloudServer.getPassword() == null || cloudServer.getPassword().length() == 0) {
CloudFoundryPlugin.getCallback().getCredentials(cloudServer);
}
}
else {
if (cloudServer.getToken() == null) {
CloudFoundryPlugin.getCallback().ssoLoginUserPrompt(cloudServer);
}
}
Server server = (Server) cloudServer.getServer();
// Any Server request will require the server to be connected, so update
// the server state
if (server.getServerState() == IServer.STATE_STOPPED || server.getServerState() == IServer.STATE_STOPPING) {
server.setServerState(IServer.STATE_STARTING);
}
try {
CFClient client = getClient(monitor);
if (client == null) {
throw CloudErrorUtil.toCoreException(NLS.bind(Messages.ERROR_NO_CLIENT, requestLabel));
}
httpTrace(client);
T result = checkClientConnectionAndRun(client, monitor);
// No errors at this stage, therefore assume operation was completed
// successfully, and update
// server state accordingly
if (server.getServerState() != IServer.STATE_STARTED) {
server.setServerState(IServer.STATE_STARTED);
}
return result;
}
catch (CoreException ce) {
// If the server state was starting and the error is related when
// the operation was
// attempted, but the operation failed
// set the server state back to stopped.
if (CloudErrorUtil.isConnectionError(ce) && server.getServerState() == IServer.STATE_STARTING) {
server.setServerState(IServer.STATE_STOPPED);
}
// server.setServerPublishState(IServer.PUBLISH_STATE_NONE);
throw ce;
}
}