本文整理汇总了Java中org.eclipse.wst.server.core.IServer.getServerState方法的典型用法代码示例。如果您正苦于以下问题:Java IServer.getServerState方法的具体用法?Java IServer.getServerState怎么用?Java IServer.getServerState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.wst.server.core.IServer
的用法示例。
在下文中一共展示了IServer.getServerState方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getActionsFromSelection
import org.eclipse.wst.server.core.IServer; //导入方法依赖的package包/类
@Override
protected List<IAction> getActionsFromSelection(IServer server) {
CloudFoundryServer cloudFoundryServer = (CloudFoundryServer) server.loadAdapter(CloudFoundryServer.class, null);
if (cloudFoundryServer == null || server.getServerState() != IServer.STATE_STARTED) {
return Collections.emptyList();
}
List<IAction> actions = new ArrayList<IAction>();
return actions;
}
示例2: getActionsFromSelection
import org.eclipse.wst.server.core.IServer; //导入方法依赖的package包/类
@Override
protected List<IAction> getActionsFromSelection(IServer server) {
DockerFoundryServer cloudFoundryServer = (DockerFoundryServer) server.loadAdapter(DockerFoundryServer.class, null);
if (cloudFoundryServer == null || server.getServerState() != IServer.STATE_STARTED) {
return Collections.emptyList();
}
List<IAction> actions = new ArrayList<IAction>();
return actions;
}
示例3: isRunning
import org.eclipse.wst.server.core.IServer; //导入方法依赖的package包/类
private static boolean isRunning(IServer server) {
return server.getServerState() == IServer.STATE_STARTED
|| server.getServerState() == IServer.STATE_STARTING;
}
示例4: restartServer
import org.eclipse.wst.server.core.IServer; //导入方法依赖的package包/类
private void restartServer(IServer server, IProgressMonitor monitor) throws CoreException {
monitor.subTask("Restarting server"); //$NON-NLS-1$
final CountDownLatch eventLatch = new CountDownLatch(1);
IServerListener serverListener = new IServerListener() {
public void serverChanged(ServerEvent event) {
if (event.getState() == IServer.STATE_STARTED) {
eventLatch.countDown();
}
}
};
try {
server.addServerListener(serverListener);
if (server.getServerState() != IServer.STATE_STARTED) {
server.start(ILaunchManager.DEBUG_MODE, monitor);
}
else if (server.getServerRestartState()) {
server.restart(ILaunchManager.DEBUG_MODE, monitor);
}
else {
return;
}
// wait 10 seconds
monitor.subTask("Waiting for server to start"); //$NON-NLS-1$
for (int i = 0; i < 50; i++) {
try {
if (eventLatch.await(200, TimeUnit.MILLISECONDS)) {
break;
}
}
catch (InterruptedException e) {
throw new OperationCanceledException();
}
if (monitor != null && monitor.isCanceled()) {
throw new OperationCanceledException();
}
}
}
finally {
server.removeServerListener(serverListener);
}
}