本文整理汇总了Java中org.eclipse.wst.server.core.ServerUtil.getServer方法的典型用法代码示例。如果您正苦于以下问题:Java ServerUtil.getServer方法的具体用法?Java ServerUtil.getServer怎么用?Java ServerUtil.getServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.wst.server.core.ServerUtil
的用法示例。
在下文中一共展示了ServerUtil.getServer方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkConflictingLaunches
import org.eclipse.wst.server.core.ServerUtil; //导入方法依赖的package包/类
@VisibleForTesting
void checkConflictingLaunches(ILaunchConfigurationType launchConfigType, String mode,
DefaultRunConfiguration runConfig, ILaunch[] launches) throws CoreException {
for (ILaunch launch : launches) {
if (launch.isTerminated()
|| launch.getLaunchConfiguration() == null
|| launch.getLaunchConfiguration().getType() != launchConfigType) {
continue;
}
IServer otherServer = ServerUtil.getServer(launch.getLaunchConfiguration());
DefaultRunConfiguration otherRunConfig =
generateServerRunConfiguration(launch.getLaunchConfiguration(), otherServer, mode);
IStatus conflicts = checkConflicts(runConfig, otherRunConfig,
new MultiStatus(Activator.PLUGIN_ID, 0,
Messages.getString("conflicts.with.running.server", otherServer.getName()), //$NON-NLS-1$
null));
if (!conflicts.isOK()) {
throw new CoreException(StatusUtil.filter(conflicts));
}
}
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:23,代码来源:LocalAppEngineServerLaunchConfigurationDelegate.java
示例2: loadKarafPlatform
import org.eclipse.wst.server.core.ServerUtil; //导入方法依赖的package包/类
@Override
protected void loadKarafPlatform(final ILaunchConfigurationWorkingCopy configuration) {
try {
server = ServerUtil.getServer(configuration);
if (server == null) {
return;
}
this.karafPlatform = KarafPlatformModelRegistry.findPlatformModel(server.getRuntime().getLocation());
this.startupSection = (StartupSection) this.karafPlatform.getAdapter(StartupSection.class);
this.startupSection.load();
} catch (final CoreException e) {
}
}
示例3: sendQuitRequest
import org.eclipse.wst.server.core.ServerUtil; //导入方法依赖的package包/类
private void sendQuitRequest() throws CoreException {
final IServer server = ServerUtil.getServer(getLaunch().getLaunchConfiguration());
if (server == null) {
return;
}
server.stop(true);
try {
// the stop command is async, let's give it some time to execute
Thread.sleep(2000L);
} catch (InterruptedException e) {
}
}
示例4: getLaunch
import org.eclipse.wst.server.core.ServerUtil; //导入方法依赖的package包/类
@Override
public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) throws CoreException {
IServer server = ServerUtil.getServer(configuration);
DefaultRunConfiguration runConfig = generateServerRunConfiguration(configuration, server, mode);
ILaunch[] launches = getLaunchManager().getLaunches();
checkConflictingLaunches(configuration.getType(), mode, runConfig, launches);
return super.getLaunch(configuration, mode);
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:9,代码来源:LocalAppEngineServerLaunchConfigurationDelegate.java
示例5: finalLaunchCheck
import org.eclipse.wst.server.core.ServerUtil; //导入方法依赖的package包/类
@Override
public boolean finalLaunchCheck(ILaunchConfiguration configuration, String mode,
IProgressMonitor monitor) throws CoreException {
SubMonitor progress = SubMonitor.convert(monitor, 40);
if (!super.finalLaunchCheck(configuration, mode, progress.newChild(20))) {
return false;
}
// If we're auto-publishing before launch, check if there may be stale
// resources not yet published. See
// https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/1832
if (ServerCore.isAutoPublishing() && ResourcesPlugin.getWorkspace().isAutoBuilding()) {
// Must wait for any current autobuild to complete so resource changes are triggered
// and WTP will kick off ResourceChangeJobs. Note that there may be builds
// pending that are unrelated to our resource changes, so simply checking
// <code>JobManager.find(FAMILY_AUTO_BUILD).length > 0</code> produces too many
// false positives.
try {
Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, progress.newChild(20));
} catch (InterruptedException ex) {
/* ignore */
}
IServer server = ServerUtil.getServer(configuration);
if (server.shouldPublish() || hasPendingChangesToPublish()) {
IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(promptStatus);
if (prompter != null) {
Object continueLaunch = prompter
.handleStatus(StaleResourcesStatusHandler.CONTINUE_LAUNCH_REQUEST, configuration);
if (!(Boolean) continueLaunch) {
// cancel the launch so Server.StartJob won't raise an error dialog, since the
// server won't have been started
monitor.setCanceled(true);
return false;
}
return true;
}
}
}
return true;
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:41,代码来源:LocalAppEngineServerLaunchConfigurationDelegate.java
示例6: getReferencedProjects
import org.eclipse.wst.server.core.ServerUtil; //导入方法依赖的package包/类
private static IProject[] getReferencedProjects(ILaunchConfiguration configuration)
throws CoreException {
IServer thisServer = ServerUtil.getServer(configuration);
IModule[] modules = ModuleUtils.getAllModules(thisServer);
Set<IProject> projects = new HashSet<>();
for (IModule module : modules) {
IProject project = module.getProject();
if (project != null) {
projects.add(project);
}
}
return projects.toArray(new IProject[projects.size()]);
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:14,代码来源:LocalAppEngineServerLaunchConfigurationDelegate.java
示例7: getServerFromLaunchConfig
import org.eclipse.wst.server.core.ServerUtil; //导入方法依赖的package包/类
private IServer getServerFromLaunchConfig(ILaunch launch) {
ILaunchConfiguration launchConfig = launch.getLaunchConfiguration();
if (launchConfig == null) {
return null;
}
IServer server = null;
try {
server = ServerUtil.getServer(launchConfig);
} catch (CoreException e) {
logError("getServerFromLaunchConfig: Getting the WTP server error.", e);
return null;
}
return server;
}
示例8: computeSourceContainers
import org.eclipse.wst.server.core.ServerUtil; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public ISourceContainer[] computeSourceContainers(ILaunchConfiguration configuration, IProgressMonitor monitor) throws CoreException
{
IServer server = ServerUtil.getServer(configuration);
SourcePathComputerVisitor visitor = new SourcePathComputerVisitor(configuration);
IModule[] modules = server.getModules();
for (int i = 0; i < modules.length; i++)
{
ModuleTraverser.traverse(modules[i],visitor,monitor);
}
return visitor.getSourceContainers();
}
示例9: preLaunchCheck
import org.eclipse.wst.server.core.ServerUtil; //导入方法依赖的package包/类
@Override
protected void preLaunchCheck(
final ILaunchConfiguration configuration,
final ILaunch launch,
final IProgressMonitor monitor)
throws CoreException
{
super.preLaunchCheck(configuration, launch, monitor);
server = ServerUtil.getServer(configuration);
if (server == null) {
return;
}
monitor.worked(5);
final IPath runtimeLocation = server.getRuntime().getLocation();
this.karafPlatform = KarafPlatformModelRegistry.findPlatformModel(runtimeLocation);
final IPath workingArea = new Path(getConfigDir(configuration).getAbsolutePath());
workingKarafPlatform = new WorkingKarafPlatformModel(workingArea, karafPlatform);
karafServer = (KarafServerBehavior) server.loadAdapter(KarafServerBehavior.class, null);
monitor.worked(10);
}
示例10: setupLaunchConfiguration
import org.eclipse.wst.server.core.ServerUtil; //导入方法依赖的package包/类
@Override
public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy, IProgressMonitor monitor)
throws CoreException {
IServer server = ServerUtil.getServer(workingCopy);
if (server == null) {
return;
}
String projectName = workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
if (projectName == null) {
projectName = server.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
}
IJavaProject proj = JavaRuntime.getJavaProject(workingCopy);
Collection<String> mainClasses = MainClassDetector.findMainClasses(proj, monitor);
if (mainClasses.isEmpty()) {
return;
}
if ( mainClasses.size() > 1) {
//TODO handle multiple Main classes
}
String mainClass = mainClasses.iterator().next();
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, mainClass);
StringBuilder vmArgs = new StringBuilder(DEVAULT_VM_ARGS);
int targetPort = 8080;
int portOffset = SocketUtil.detectPortOffset(targetPort);
if (portOffset > 0) {
targetPort += portOffset;
vmArgs.append(" -Dswarm.port.offset=").append(portOffset);
}
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs.toString());
final ControllableServerBehavior behavior = (ControllableServerBehavior)JBossServerBehaviorUtils.getControllableBehavior(server);
//TODO parse Main class AST to detect default context root?
if (behavior != null) {
//XXX seems weird/wrong
behavior.putSharedData("welcomePage", "http://localhost:"+targetPort+"/");
}
//if m2e project only
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, "org.jboss.tools.servers.wildfly.swarm.launchconfig.classpathProvider");
}
示例11: onServerStarted
import org.eclipse.wst.server.core.ServerUtil; //导入方法依赖的package包/类
/**
* Possibly start the GWT Super Dev Mode CodeServer. <br/>
* <br/>
* This starts as separate process, which allows for custom args modification. <br/>
* It adds a launcher id to both processes for reference. <br/>
* 1. Get it from classic launch config <br/>
* 2. Get it from server VM properties <br/>
*/
protected void onServerStarted(DebugEvent event) {
onAfterWebServerStarted(event);
IProcess runtimeProcess = (IProcess) event.getSource();
ILaunch launch = runtimeProcess.getLaunch();
ILaunchConfiguration launchConfig = launch.getLaunchConfiguration();
String launchMode = launch.getLaunchMode();
IServer server = null;
try {
server = ServerUtil.getServer(launchConfig);
} catch (CoreException e) {
logError("possiblyLaunchGwtSuperDevModeCodeServer: Could get the WTP server.", e);
return;
}
if (server == null) {
logMessage("possiblyLaunchGwtSuperDevModeCodeServer: No WTP server runtime found.");
return;
}
IFacetedProject gwtFacetedProject = GwtFacetUtils.getGwtFacetedProject(server);
// If one of the server modules has a gwt facet
if (gwtFacetedProject == null) {
logMessage("possiblyLaunchGwtSuperDevModeCodeServer: Does not have a GWT Facet.");
return;
}
// Sync Option - the sync is off, ignore stopping the server
if (!GWTProjectProperties.getFacetSyncCodeServer(gwtFacetedProject.getProject())) {
logMessage("possiblyLaunchGwtSuperDevModeCodeServer: GWT Facet project properties, the code server sync is off.");
return;
}
/**
* Get the war output path for the `-launcherDir` in SDM launcher
*/
String launcherDir = getLauncherDirectory(server, launchConfig, gwtFacetedProject);
// LauncherId used to reference and terminate the the process
String launcherId = setLauncherIdToWtpRunTimeLaunchConfig(launchConfig);
logMessage("possiblyLaunchGwtSuperDevModeCodeServer: Launching GWT Super Dev Mode CodeServer. launcherId="
+ launcherId + " launcherDir=" + launcherDir);
// Just in case
if (launchMode == null) {
// run the code server, no need to debug it
launchMode = "run";
}
if (launcherId == null) { // ids to link two processes together
logMessage("possiblyLaunchGwtSuperDevModeCodeServer: No launcherId.");
}
// Add server urls to DevMode view for easy clicking on
addServerUrlsToDevModeView(launch);
// Creates ore launches an existing Super Dev Mode Code Server process
GwtSuperDevModeCodeServerLaunchUtil.launch(gwtFacetedProject.getProject(), launchMode, launcherDir, launcherId);
}