You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2016/03/03 16:43:23 UTC

svn commit: r1733483 - in /sling/trunk/tooling/ide: eclipse-core/src/org/apache/sling/ide/eclipse/core/ eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/

Author: rombert
Date: Thu Mar  3 15:43:22 2016
New Revision: 1733483

URL: http://svn.apache.org/viewvc?rev=1733483&view=rev
Log:
SLING-5583 - Add defaults to server creation page in the project
creation wizard

Create a DefaultSlingLaunchpadConfiguration class which is used in the
SetupServerWizard.

Added:
    sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/DefaultSlingLaunchpadConfiguration.java
Modified:
    sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/AbstractNewSlingApplicationWizard.java
    sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/SetupServerWizardPage.java

Added: sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/DefaultSlingLaunchpadConfiguration.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/DefaultSlingLaunchpadConfiguration.java?rev=1733483&view=auto
==============================================================================
--- sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/DefaultSlingLaunchpadConfiguration.java (added)
+++ sling/trunk/tooling/ide/eclipse-core/src/org/apache/sling/ide/eclipse/core/DefaultSlingLaunchpadConfiguration.java Thu Mar  3 15:43:22 2016
@@ -0,0 +1,47 @@
+package org.apache.sling.ide.eclipse.core;
+
+/**
+ * The <tt>DefaultSlingLaunchpadConfiguration</tt> specifies reasonable defaults when
+ * configuring a new Sling server instance.
+ *
+ */
+public class DefaultSlingLaunchpadConfiguration implements ISlingLaunchpadConfiguration {
+
+    public static final ISlingLaunchpadConfiguration INSTANCE = new DefaultSlingLaunchpadConfiguration();
+    
+    @Override
+    public int getPort() {
+        return 8080;
+    }
+
+    @Override
+    public int getDebugPort() {
+        return 30303;
+    }
+
+    @Override
+    public String getContextPath() {
+        return "/";
+    }
+
+    @Override
+    public String getUsername() {
+        return "admin";
+    }
+
+    @Override
+    public String getPassword() {
+        return "admin";
+    }
+
+    @Override
+    public boolean bundleInstallLocally() {
+        return true;
+    }
+
+    @Override
+    public boolean resolveSourcesInDebugMode() {
+        return true;
+    }
+
+}
\ No newline at end of file

Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/AbstractNewSlingApplicationWizard.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/AbstractNewSlingApplicationWizard.java?rev=1733483&r1=1733482&r2=1733483&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/AbstractNewSlingApplicationWizard.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/AbstractNewSlingApplicationWizard.java Thu Mar  3 15:43:22 2016
@@ -24,6 +24,8 @@ import java.util.LinkedList;
 import java.util.List;
 
 import org.apache.sling.ide.eclipse.core.ConfigurationHelper;
+import org.apache.sling.ide.eclipse.core.DefaultSlingLaunchpadConfiguration;
+import org.apache.sling.ide.eclipse.core.ISlingLaunchpadConfiguration;
 import org.apache.sling.ide.eclipse.ui.WhitelabelSupport;
 import org.apache.sling.ide.eclipse.ui.internal.Activator;
 import org.eclipse.core.resources.IProject;
@@ -251,4 +253,8 @@ public abstract class AbstractNewSlingAp
     }
 
     public abstract String doGetWindowTitle();
+    
+    protected ISlingLaunchpadConfiguration getDefaultConfig() {
+        return DefaultSlingLaunchpadConfiguration.INSTANCE;
+    }
 }
\ No newline at end of file

Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/SetupServerWizardPage.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/SetupServerWizardPage.java?rev=1733483&r1=1733482&r2=1733483&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/SetupServerWizardPage.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/SetupServerWizardPage.java Thu Mar  3 15:43:22 2016
@@ -18,19 +18,12 @@ package org.apache.sling.ide.eclipse.ui.
 
 import static org.apache.sling.ide.eclipse.ui.internal.SlingLaunchpadCombo.ValidationFlag.SKIP_SERVER_STARTED;
 
-import java.io.IOException;
-import java.io.InputStream;
 
-import org.apache.sling.ide.artifacts.EmbeddedArtifact;
-import org.apache.sling.ide.artifacts.EmbeddedArtifactLocator;
+import org.apache.sling.ide.eclipse.core.ISlingLaunchpadConfiguration;
 import org.apache.sling.ide.eclipse.core.ISlingLaunchpadServer;
 import org.apache.sling.ide.eclipse.core.SlingLaunchpadConfigurationDefaults;
 import org.apache.sling.ide.eclipse.ui.internal.Activator;
 import org.apache.sling.ide.eclipse.ui.internal.SlingLaunchpadCombo;
-import org.apache.sling.ide.osgi.OsgiClient;
-import org.apache.sling.ide.osgi.OsgiClientException;
-import org.apache.sling.ide.osgi.OsgiClientFactory;
-import org.apache.sling.ide.transport.RepositoryInfo;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
@@ -57,7 +50,6 @@ import org.eclipse.wst.server.core.IServ
 import org.eclipse.wst.server.core.IServerType;
 import org.eclipse.wst.server.core.IServerWorkingCopy;
 import org.eclipse.wst.server.core.ServerCore;
-import org.osgi.framework.Version;
 
 public class SetupServerWizardPage extends WizardPage {
 	
@@ -79,11 +71,14 @@ public class SetupServerWizardPage exten
 
     private Button skipServerConfiguration;
 
+    private ISlingLaunchpadConfiguration config;
+
     public SetupServerWizardPage(AbstractNewSlingApplicationWizard parent) {
 		super("chooseArchetypePage");
         setTitle("Select or Create Server");
         setDescription("This step defines which server to use with the new project.");
 		setImageDescriptor(parent.getLogo());
+		config = parent.getDefaultConfig();
 	}
 
     @Override
@@ -144,18 +139,23 @@ public class SetupServerWizardPage exten
 	    
         newLabel(container, "Host name:");
         newServerHostnameName = newText(container);
+        newServerHostnameName.setText("localhost");
 	    
         newLabel(container, "Port:");
         newServerPort = newText(container);
+        newServerPort.setText(Integer.toString(config.getPort()));
         
         newLabel(container, "Username:");
         newServerUsername = newText(container);
+        newServerUsername.setText(config.getUsername());
 
         newLabel(container, "Password:");
         newServerPassword = newText(container);
+        newServerPassword.setText(config.getPassword());
 	    
         newLabel(container, "Debug Port:");
         newServerDebugPort = newText(container);
+        newServerDebugPort.setText(Integer.toString(config.getDebugPort()));
 	    
 	    SelectionAdapter radioListener = new SelectionAdapter() {
 			public void widgetSelected(SelectionEvent e) {
@@ -315,7 +315,7 @@ public class SetupServerWizardPage exten
 			
 			IRuntimeType serverRuntime = ServerCore.findRuntimeType("org.apache.sling.ide.launchpadRuntimeType");
 			try {
-                // TODO there should be a nicer API for creating this, and also a central place for defaults
+                // TODO there should be a nicer API for creating this
                 // TODO - we should not be creating runtimes, but maybe matching against existing ones
                 IRuntime runtime = serverRuntime.createRuntime(null, monitor);
                 runtime = runtime.createWorkingCopy().save(true, monitor);