summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorCheng Chen2012-05-01 01:52:23 (EDT)
committer Cheng Chen2012-05-01 01:52:23 (EDT)
commit9ba0c6e5379fec5e240c52cd066a01ff02c03708 (patch)
tree06048ede775fc6d3e1093cd3783640d38f09c24b
parent88b8d2236ae5a07bc8e62b52b41797f70fd3a40d (diff)
downloadorg.eclipse.recommenders-9ba0c6e5379fec5e240c52cd066a01ff02c03708.zip
org.eclipse.recommenders-9ba0c6e5379fec5e240c52cd066a01ff02c03708.tar.gz
org.eclipse.recommenders-9ba0c6e5379fec5e240c52cd066a01ff02c03708.tar.bz2
[snipmatch] switch to local search clientrefs/changes/71/5771/2
for CheckUpdateThread,LoginBox,ProfileBox and SubmitBox Signed-off-by: Cheng Chen <chengchendoc@gmail.com> Change-Id: Ia658f69fed71a2e8bec658ce58d951d1aca92afc
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/CheckUpdateThread.java4
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/LoginBox.java10
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/ProfileBox.java9
-rw-r--r--[-rwxr-xr-x]plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/SubmitBox.java15
4 files changed, 16 insertions, 22 deletions
diff --git a/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/CheckUpdateThread.java b/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/CheckUpdateThread.java
index cdbfddd..963267b 100755..100644
--- a/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/CheckUpdateThread.java
+++ b/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/CheckUpdateThread.java
@@ -13,7 +13,7 @@ import java.io.InputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-import org.eclipse.recommenders.snipmatch.web.MatchClient;
+import org.eclipse.recommenders.snipmatch.search.SearchClient;
import org.eclipse.recommenders.snipmatch.web.PostThread;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;
@@ -27,7 +27,7 @@ import org.w3c.dom.Element;
*/
public class CheckUpdateThread extends PostThread {
- public CheckUpdateThread(MatchClient client) {
+ public CheckUpdateThread(SearchClient client) {
super(client, SnipMatchPlugin.UPDATE_SITE_INFO_URL);
}
diff --git a/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/LoginBox.java b/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/LoginBox.java
index d6276cd..7db915f 100755..100644
--- a/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/LoginBox.java
+++ b/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/LoginBox.java
@@ -12,8 +12,9 @@ import java.net.URL;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.recommenders.snipmatch.search.ClientSwitcher;
+import org.eclipse.recommenders.snipmatch.search.SearchClient;
import org.eclipse.recommenders.snipmatch.web.ILoginListener;
-import org.eclipse.recommenders.snipmatch.web.MatchClient;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
@@ -35,9 +36,8 @@ import org.eclipse.ui.PlatformUI;
/**
* The login interface.
*/
-public class LoginBox {
+public class LoginBox extends ClientSwitcher{
- private MatchClient client;
private Shell shell;
private Text usernameText;
private Text passwordText;
@@ -46,9 +46,7 @@ public class LoginBox {
private Runnable onSuccess;
private Runnable onFail;
- public LoginBox(MatchClient client) {
-
- this.client = client;
+ public LoginBox() {
}
public void show(final String username, final String password,
diff --git a/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/ProfileBox.java b/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/ProfileBox.java
index 3fe9fcf..9da81a0 100755..100644
--- a/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/ProfileBox.java
+++ b/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/ProfileBox.java
@@ -11,9 +11,9 @@ package org.eclipse.recommenders.snipmatch.rcp;
import java.util.ArrayList;
import org.eclipse.recommenders.snipmatch.core.Effect;
+import org.eclipse.recommenders.snipmatch.search.ClientSwitcher;
import org.eclipse.recommenders.snipmatch.web.IDeleteEffectListener;
import org.eclipse.recommenders.snipmatch.web.ILoadProfileListener;
-import org.eclipse.recommenders.snipmatch.web.MatchClient;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
@@ -34,9 +34,8 @@ import org.eclipse.ui.PlatformUI;
* This is the interface that shows the user's own created snippets, and offers controls
* to delete or edit them, or to create a new one.
*/
-public class ProfileBox {
+public class ProfileBox extends ClientSwitcher{
- private MatchClient client;
private Shell shell;
private List effectList;
private Button newButton;
@@ -45,9 +44,7 @@ public class ProfileBox {
private Button okButton;
private ArrayList<Effect> effects;
- public ProfileBox(MatchClient client) {
-
- this.client = client;
+ public ProfileBox() {
this.effects = new ArrayList<Effect>();
}
diff --git a/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/SubmitBox.java b/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/SubmitBox.java
index 958a35d..b4f5406 100755..100644
--- a/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/SubmitBox.java
+++ b/plugins/org.eclipse.recommenders.snipmatch.rcp/src/org/eclipse/recommenders/snipmatch/rcp/SubmitBox.java
@@ -15,9 +15,11 @@ import java.util.Collections;
import org.eclipse.recommenders.snipmatch.core.Effect;
import org.eclipse.recommenders.snipmatch.core.EffectParameter;
import org.eclipse.recommenders.snipmatch.core.MatchEnvironment;
+import org.eclipse.recommenders.snipmatch.search.ClientSwitcher;
+import org.eclipse.recommenders.snipmatch.search.SearchClient;
import org.eclipse.recommenders.snipmatch.web.IDeleteEffectListener;
import org.eclipse.recommenders.snipmatch.web.ISubmitEffectListener;
-import org.eclipse.recommenders.snipmatch.web.MatchClient;
+import org.eclipse.recommenders.snipmatch.web.RemoteMatchClient;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabItem;
@@ -48,9 +50,8 @@ import org.eclipse.ui.PlatformUI;
/**
* This is the interface for creating an editing snippets.
*/
-public class SubmitBox {
+public class SubmitBox extends ClientSwitcher{
- private MatchClient client;
private MatchEnvironment[] envs;
private MatchEnvironment activeEnv;
private Effect effect;
@@ -84,12 +85,11 @@ public class SubmitBox {
private static final Font codeFont = new Font(
PlatformUI.getWorkbench().getDisplay(), "Courier New", 10, SWT.NORMAL);
- public SubmitBox(MatchClient client) {
-
- this.client = client;
+ public SubmitBox() {
}
/**
+ * Show the snippet creation/editing interface.
* @param toEdit The snippet to edit. If null, then the interface is used to create a new snippet.
*/
public void show(Effect toEdit) {
@@ -1369,14 +1369,13 @@ public class SubmitBox {
/* This was an edit, so first make a request to delete the snippet,
* then make a request to add the edited snippet.
*/
-
client.startDeleteEffect(effect, new IDeleteEffectListener() {
@Override
public void deleteEffectSucceeded() {
try {
- Thread.sleep(MatchClient.TIMEOUT);
+ Thread.sleep(RemoteMatchClient.TIMEOUT);
}
catch (InterruptedException e) {
e.printStackTrace();