public void setDefaults(IProgressMonitor monitor) {
   IRuntime rt = getServer().getRuntime();
   if (rt != null) {
     getServerWorkingCopy().setName(ServerUtil.getDefaultServerName(rt));
   } else {
     getServerWorkingCopy()
         .setName(ServerUtil.getDefaultServerName(getServer().getServerType().getName()));
   }
 }
 public String getWelcomePageUrl() {
   try {
     JBossServer jbossServer = ServerUtil.checkedGetServerAdapter(server, JBossServer.class);
     String host = jbossServer.getHost();
     host = ServerUtil.formatPossibleIpv6Address(host);
     int webPort = jbossServer.getJBossWebPort();
     String consoleUrl =
         MessageFormat.format(WELCOME_PAGE_URL_PATTERN, host, String.valueOf(webPort));
     return consoleUrl;
   } catch (CoreException ce) {
     return null;
   }
 }
  public static URL getModuleRootURL(IModule module, String host, int port, String contextRoot) {
    if (module == null || module.loadAdapter(IWebModule.class, null) == null) return null;

    IWebModule webModule = (IWebModule) module.loadAdapter(IWebModule.class, null);
    String host2 = ServerUtil.formatPossibleIpv6Address(host);
    String url = host2;
    if (!url.startsWith("http://") && !url.startsWith("https://")) { // $NON-NLS-1$ //$NON-NLS-2$
      url = "http://" + host2; // $NON-NLS-1$
    }
    if (port != 80) url += ":" + port; // $NON-NLS-1$

    if (contextRoot == null) {
      contextRoot = webModule.getContextRoot();
    }
    if (!contextRoot.equals("/") && !contextRoot.equals("./")) // $NON-NLS-1$ //$NON-NLS-2$
    url +=
          contextRoot.startsWith("/")
              ? contextRoot
              : "/" + contextRoot; // $NON-NLS-1$ //$NON-NLS-2$
    if (!url.endsWith("/")) // $NON-NLS-1$
    url += "/"; // $NON-NLS-1$

    try {
      return new URL(url);
    } catch (MalformedURLException murle) {
      return null;
    }
  }
 protected String getVerifyStructureErrorMessage() throws CoreException {
   if (server.getRuntime() == null)
     return NLS.bind(Messages.ServerMissingRuntime, server.getName());
   if (!server.getRuntime().getLocation().toFile().exists())
     return NLS.bind(
         Messages.RuntimeFolderDoesNotExist, server.getRuntime().getLocation().toOSString());
   JBossServer jbossServer = ServerUtil.checkedGetServerAdapter(server, JBossServer.class);
   if (!new File(jbossServer.getConfigDirectory()).exists())
     return NLS.bind(
         Messages.JBossConfigurationFolderDoesNotExist, jbossServer.getConfigDirectory());
   return null;
 }
 public void setDeployFolder(String folder) {
   setAttribute(
       DEPLOY_DIRECTORY,
       ServerUtil.makeRelative(getServer().getRuntime(), new Path(folder)).toString());
 }
 public String getDeployFolder() {
   return ServerUtil.makeGlobal(
           getServer().getRuntime(), new Path(getAttribute(DEPLOY_DIRECTORY, "")))
       .toString(); //$NON-NLS-1$
 }
 public String openBrowseDialog(IServerAttributes server, String original) {
   DirectoryDialog d = new DirectoryDialog(new Shell());
   String filterPath = ServerUtil.makeGlobal(server.getRuntime(), new Path(original)).toString();
   d.setFilterPath(filterPath);
   return d.open();
 }