Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacques Bouthillier2014-03-27 12:00:19 +0000
committerJacques Bouthillier2014-03-27 12:00:19 +0000
commit5bca8d17430fd13ea1389b01be51269861a78773 (patch)
treef453f15e8b89e0cab7b2da6a3afa93e8ec93a444
parentc33fbb118f6ef1a2de04f5a909a03e8e628727ce (diff)
downloadorg.eclipse.mylyn.reviews-5bca8d17430fd13ea1389b01be51269861a78773.tar.gz
org.eclipse.mylyn.reviews-5bca8d17430fd13ea1389b01be51269861a78773.tar.xz
org.eclipse.mylyn.reviews-5bca8d17430fd13ea1389b01be51269861a78773.zip
Remove unused code from Gerrit Dashboard bundle
Change-Id: I8421a325350c97ea7522b6790376e4713f6782b0 Signed-off-by: Tomasz Zarna <tomasz.zarna@tasktop.com>
-rw-r--r--org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/internal/menus/DynamicMenuAddition.java9
-rw-r--r--org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/internal/utils/GerritServerUtility.java206
-rw-r--r--org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/AddGerritSiteHandler.java121
-rw-r--r--org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/projects/ProjectListHandler.java7
-rw-r--r--org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableLabelProvider.java9
-rw-r--r--org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/UIReviewTable.java57
-rw-r--r--org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/GerritServerUtility.java170
-rw-r--r--org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/UIUtils.java1
8 files changed, 12 insertions, 568 deletions
diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/internal/menus/DynamicMenuAddition.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/internal/menus/DynamicMenuAddition.java
index 59f396bb8..06dcaf83c 100644
--- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/internal/menus/DynamicMenuAddition.java
+++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/internal/menus/DynamicMenuAddition.java
@@ -6,10 +6,6 @@
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Description:
- * This class implements the Dynamic menu selection to pre-filled the list of gerrit
- * project locations.
- *
* Contributors:
* Jacques Bouthillier - Initial Implementation of the dynamic menu selection
******************************************************************************/
@@ -33,6 +29,9 @@ import org.eclipse.ui.menus.IWorkbenchContribution;
import org.eclipse.ui.services.IServiceLocator;
/**
+ * This class implements the Dynamic menu selection to pre-filled the list of gerrit
+ * project locations.
+ *
* @author Jacques Bouthillier
* @version $Revision: 1.0 $
*
@@ -85,7 +84,7 @@ public class DynamicMenuAddition extends CompoundContributionItem implements IWo
.traceInfo("\t\t DynamicMenuAddition .getContributionItems()");
CommandContributionItem[] contributionItems = new CommandContributionItem[0];
if (fServer != null) {
- fMapServer = fServer.getGerritMapping();
+ fMapServer = GerritServerUtility.getGerritMapping();
}
if (fMapServer != null && !fMapServer.isEmpty()) {
diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/internal/utils/GerritServerUtility.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/internal/utils/GerritServerUtility.java
index 1724c13f8..540ed3b1c 100644
--- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/internal/utils/GerritServerUtility.java
+++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/internal/utils/GerritServerUtility.java
@@ -6,9 +6,6 @@
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Description:
- * This class implements some utility for the Gerrit servers.
- *
* Contributors:
* Jacques Bouthillier - Initial Implementation of the server selection
******************************************************************************/
@@ -22,18 +19,11 @@ import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.egit.core.RepositoryCache;
-import org.eclipse.egit.core.RepositoryUtil;
-import org.eclipse.jgit.lib.Config;
-import org.eclipse.jgit.lib.ConfigConstants;
-import org.eclipse.jgit.lib.Repository;
import org.eclipse.mylyn.gerrit.dashboard.GerritPlugin;
import org.eclipse.mylyn.gerrit.dashboard.ui.GerritUi;
import org.eclipse.mylyn.internal.gerrit.core.GerritConnector;
@@ -45,6 +35,8 @@ import org.eclipse.mylyn.tasks.core.TaskRepository;
/**
+ * This class implements some utility for the Gerrit servers.
+ *
* @author Jacques Bouthillier
* @version $Revision: 1.0 $
*
@@ -57,21 +49,6 @@ public class GerritServerUtility {
// ------------------------------------------------------------------------
/**
- * Field GERRIT_PORT. (value is "":29418"")
- */
- private static final String GERRIT_PORT = ":29418";
-
- /**
- * Field AT. (value is ""@"")
- */
- private static final String AT = "@";
-
- /**
- * Field AT. (value is ""https://"")
- */
- private static final String HTTPS = "https://";
-
- /**
* Field LAST_GERRIT_FILE. (value is ""lastGerrit.txt"")
*/
private static final String LAST_GERRIT_FILE = "lastGerrit.txt";
@@ -90,13 +67,6 @@ public class GerritServerUtility {
public GerritServerUtility() {
instance = this;
mapConfiguredGerritServer();
-
- //LATER: Map the workspace gerrit to the menu option
- //addWorkspaceGerritRepo();
-
- //Begin Test
- //testTaskRepo(); not needed anymore
- //End Test
}
// ------------------------------------------------------------------------
@@ -136,7 +106,6 @@ public class GerritServerUtility {
RepositoryTemplateManager templateManager = TasksUiPlugin.getRepositoryTemplateManager();
//Verify to only add once in the repository template
Boolean found = false;
- // printTaskRepository(aTaskRepo);
for (RepositoryTemplate template : templateManager.getTemplates(GerritConnector.CONNECTOR_KIND)) {
String convertedRemoteURL = aTaskRepo.getRepositoryUrl() ;
GerritPlugin.Ftracer.traceInfo("\t template.label: " + template.label
@@ -186,90 +155,6 @@ public class GerritServerUtility {
}
}
- private void printTaskRepository(TaskRepository aTask) {
- Set<Entry<String, String>> value = aTask.getProperties().entrySet();
- for (Map.Entry<String, String> entry : value) {
- GerritPlugin.Ftracer.traceInfo("TaskRepo key: " + entry.getKey()
- + "\tvalue: " + entry.getValue());
- }
- GerritPlugin.Ftracer.traceInfo(" UserName: " + aTask.getUserName());
- GerritPlugin.Ftracer
- .traceInfo("===================================");
- }
-
- /**
- * This method use the Gerrit from the git server in the workspace
- */
- private void addWorkspaceGerritRepo () {
- RepositoryUtil repoUtil = org.eclipse.egit.core.Activator.getDefault().getRepositoryUtil();
- List<String> repoPaths = repoUtil.getConfiguredRepositories();
- RepositoryCache repositoryCache = org.eclipse.egit.core.Activator.getDefault().getRepositoryCache();
- Repository repo = null;
-
- for (String repoPath : repoPaths) {
- GerritPlugin.Ftracer.traceInfo("List Gerrit repository: " + repoPath );
- File gitDir = new File(repoPath);
- if (!gitDir.exists()) {
- GerritPlugin.Ftracer.traceInfo("Gerrit repository do not exist: " + gitDir.getPath());
- continue;
- }
- try {
- repo = repositoryCache.lookupRepository(gitDir);
- GerritPlugin.Ftracer.traceInfo("\trepository config after lookup: " +
- repo.getConfig());
- } catch (IOException e) {
- e.printStackTrace();
- }
- if (repo != null) {
- Config config = new Config(repo.getConfig());
- //Look to get the remotes URL
- Set<String> remotes = config.getSubsections(ConfigConstants.CONFIG_REMOTE_SECTION);
- for (String remote: remotes) {
- String remoteURL = config.getString(ConfigConstants.CONFIG_REMOTE_SECTION,
- remote,
- ConfigConstants.CONFIG_KEY_URL);
- GerritPlugin.Ftracer.traceInfo("\t\t " + remote +" -> remoteURL: " + remoteURL );
-
- //Test if this is a Gerrit server and add it to the Dialogue combo
- String convertedRemoteURL = getReformatGerritServer(remoteURL) ;
- if (null != convertedRemoteURL ) {
- TaskRepository taskRepo = new TaskRepository(GerritConnector.CONNECTOR_KIND, convertedRemoteURL);
- taskRepo.setRepositoryLabel(convertedRemoteURL);
- fResultTask.put(taskRepo, taskRepo.getRepositoryUrl());
- adjustTemplatemanager(taskRepo);
-
- }
- }
- }
- }
- }
-
-
- //Note the Gerrit server for "git.eclipse.org" in config is
- // not the same as in the task Repository: "git.eclipse.org/r"
- /**
- * Verify if the gerrit remote URL has the gerrit port (29418 )
- * @param aRemoteURL
- * @return String remote converted URL
- */
- private String getReformatGerritServer(String aRemoteURL) {
- //Test if this is a Gerrit server or not
- String[] strParsePort = aRemoteURL.split(GERRIT_PORT);
- if (strParsePort.length == 2) {
- //Do not convert it for now
- return aRemoteURL;
-// //We found a Gerrit server, lets build the URL
-// //String[] strParseServer = strParsePort[0].split(AT);
-// int index = strParsePort[0].indexOf(AT);
-// String server = strParsePort[0].substring(++index);
-// StringBuilder sb = new StringBuilder();
-// sb.append(HTTPS);
-// sb.append(server);
-// return sb.toString();
- }
- return null;
- }
-
private File getLastGerritFile () {
IPath ipath = GerritUi.getDefault().getStateLocation();
String fileName = ipath.append(LAST_GERRIT_FILE).toPortableString();
@@ -386,91 +271,4 @@ public class GerritServerUtility {
return null;
}
- /**
- * Read the Gerrit server to populate the list of reviews
- */
- public void getReviewListFromServer () {
- //Get the Gerrit URL to query
- String urlToUsed = getLastSavedGerritServer ();
-
- if (urlToUsed != null) {
- //Initiate the request to populate the list of Reviews
- GerritPlugin.Ftracer.traceInfo("use the following Gerrit URL to populate the list of reviews: " + urlToUsed);
-
- // TODO: Make it pick the right repository
- Set<TaskRepository> gerritRepositories = fResultTask.keySet();
- Iterator<TaskRepository> it = gerritRepositories.iterator();
- if (it.hasNext()) {
- TaskRepository repository = it.next();
- // TODO: populate the Gerrit Dashboard with 'reviews'
- }
- } else {
- //Open the dialogue to populate a Gerrit server, Should not happen here
- GerritPlugin.Ftracer.traceInfo("Need to open the dialogue to populate a gerrit server" );
- }
- }
-
- /******************************************************************/
- /******************************************************************/
- /******************************************************************/
- /******************************************************************/
- /******** TEST *************************************************/
- /******************************************************************/
- /******************************************************************/
- /******************************************************************/
- /******************************************************************/
-
- private void testTaskRepo () {
- // TaskRepository repository = new TaskRepository(GerritConnector.CONNECTOR_KIND, "http://repository"); //$NON-NLS-1$
-// final TaskRepository repository = new TaskRepository(GerritConnector.CONNECTOR_KIND, "https://"); //$NON-NLS-1$
-
- final TaskRepository repository = getTaskRepository(); //$NON-NLS-1$
- GerritPlugin.Ftracer.traceInfo("repository: " + repository.getUrl()); //$NON-NLS-1$
-// int ret = TasksUiUtil.openEditRepositoryWizard(repository); //Generate a null pointer for the workbench window
-
-
- GerritPlugin.Ftracer.traceInfo("Before: repository url: " + repository.getUrl() ); //$NON-NLS-1$
-
- }
-
- /**
- * Look at the current Gerrit repository and return a default value
- * i.e the first Gerrit if found ???
- * @return TaskRepository
- */
- private TaskRepository getTaskRepository () {
- TaskRepository taskRepo = null;
- /**
- * Field DEFAULT_REPOSITORY. (value is ""https://repository"")
- */
- String DEFAULT_REPOSITORY = "https://";
- //Reset the list of Gerrit server
- fResultTask.clear();
-
-
- //Test to read the TaskRepositories
-
- TaskRepositoryManager repositoryManager = TasksUiPlugin.getRepositoryManager();
-
- //List all repositories in the the TaskRepositories view
- List <TaskRepository>listallRepo = repositoryManager.getAllRepositories();
- for (int i = 0;i < listallRepo.size(); i++) {
- GerritPlugin.Ftracer.traceInfo("TaskRepositoryManager repository: [ " + i + " ] : " + listallRepo.get(i).getRepositoryLabel() );
- }
-
- //Only get the TaskRepository related to Gerrit review connnector
- GerritPlugin.Ftracer.traceInfo("--------Review repo ---------------");
- Set<TaskRepository> reviewRepo = repositoryManager.getRepositories(GerritConnector.CONNECTOR_KIND);
- for (TaskRepository tp: reviewRepo) {
- GerritPlugin.Ftracer.traceInfo("Only Gerrit Review repo: " + tp.getRepositoryLabel() + "\t url: " + tp.getRepositoryUrl());
- }
-
- //Testing bugzilla but need to add the mylyn bugzilla in plugin dependencies
-// for (RepositoryTemplate template : templateManager.getTemplates(BugzillaCorePlugin.CONNECTOR_KIND)) {
-// GerritPlugin.Ftracer.traceInfo("Gerrit Bugzilla repository: " + template.label + "\t URL: " + template.repositoryUrl);
-// }
-
- return taskRepo;
- }
-
}
diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/AddGerritSiteHandler.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/AddGerritSiteHandler.java
index 754a368b8..3e70dae31 100644
--- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/AddGerritSiteHandler.java
+++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/AddGerritSiteHandler.java
@@ -22,22 +22,13 @@ import java.util.Set;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.mylyn.gerrit.dashboard.GerritPlugin;
import org.eclipse.mylyn.gerrit.dashboard.ui.internal.utils.GerritServerUtility;
-import org.eclipse.mylyn.gerrit.dashboard.ui.internal.utils.UIConstants;
import org.eclipse.mylyn.gerrit.dashboard.ui.internal.utils.UIUtils;
import org.eclipse.mylyn.gerrit.dashboard.ui.views.GerritTableView;
-import org.eclipse.mylyn.internal.gerrit.core.GerritConnector;
import org.eclipse.mylyn.internal.gerrit.core.GerritQuery;
-import org.eclipse.mylyn.internal.tasks.ui.wizards.EditRepositoryWizard;
import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.ui.wizards.TaskRepositoryWizardDialog;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Widget;
@@ -50,15 +41,6 @@ import org.eclipse.swt.widgets.Widget;
public class AddGerritSiteHandler extends AbstractHandler {
// ------------------------------------------------------------------------
- // Constants
- // ------------------------------------------------------------------------
-
- /**
- * Field COMMAND_MESSAGE. (value is ""Add a Gerrit location ..."")
- */
- private static final String COMMAND_MESSAGE = "Add a Gerrit location ...";
-
- // ------------------------------------------------------------------------
// Variables
// ------------------------------------------------------------------------
@@ -144,108 +126,5 @@ public class AddGerritSiteHandler extends AbstractHandler {
UIUtils.showErrorDialog("Use Button [Task Repositories...] to define a new Gerrit Server", "Button [Add Gerrit Repository...] is not ready");
return obj;
}
-
- /**
- * Initiate a JOB to open the Gerrit definition dialogue
- * @return Object
- */
- private Object openDialogue () {
- final Job job = new Job(COMMAND_MESSAGE) {
-
- public String familyName = UIConstants.DASHBOARD_UI_JOB_FAMILY;
-
- @Override
- public boolean belongsTo(Object aFamily) {
- return familyName.equals(aFamily);
- }
-
- @Override
- public IStatus run(final IProgressMonitor aMonitor) {
- aMonitor.beginTask(COMMAND_MESSAGE, IProgressMonitor.UNKNOWN);
-
- TaskRepository taskRepository = getTaskRepository("");
-
- GerritPlugin.Ftracer.traceInfo("repository: " + taskRepository.getUrl()); //$NON-NLS-1$
-
- final EditRepositoryWizard wizard = new EditRepositoryWizard(taskRepository);
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- WizardDialog dialog = new TaskRepositoryWizardDialog(wizard.getShell(), wizard);
- dialog.create();
- dialog.setBlockOnOpen(true);
- dialog.open();
- }
- });
-
- //When the wizard is closed
- taskRepository = wizard.getRepository();//Possibility the taskRepository has changed
- if (taskRepository.getUrl().isEmpty() ||
- taskRepository.getUrl().endsWith(UIConstants.DEFAULT_REPOSITORY)) {
- //User selected the Cancel button
- GerritPlugin.Ftracer.traceInfo("AFTER: repository: CANCEL " ); //$NON-NLS-1$
- } else {
- GerritPlugin.Ftracer.traceInfo("AFTER: repository: : FINISH " ); //$NON-NLS-1$
- fServerUtil.saveLastGerritServer(taskRepository.getUrl());
- //Test if we already have the Gerrit server in our internal map
- TaskRepository taskRepositoryTmp = fServerUtil.getTaskRepo (taskRepository.getUrl());
- if (taskRepositoryTmp == null) {
- //Need to re-map our internal Gerrit Repo
- fServerUtil.getGerritMapping();
- }
- /*****************************************************/
- /* */
- /* Now, we need to get the Gerrit repo data */
- /* and populate the list of Reviews */
- /* */
- /* */
- /*****************************************************/
- fServerUtil.getReviewListFromServer ();
- GerritTableView reviewTableView = GerritTableView
- .getActiveView();
-
- //Set the table view with the last TaskRepo and the default query
- reviewTableView.processCommands(GerritQuery.MY_WATCHED_CHANGES);
-
- }
-
- GerritPlugin.Ftracer.traceInfo("AFTER: repository: : " + taskRepository.getUrl() +
- "\n\t repo: " + taskRepository.getRepositoryUrl() ); //$NON-NLS-1$
-
-
- aMonitor.done();
- return Status.OK_STATUS;
- }
- };
- job.setUser(true);
- job.schedule();
- return null;
- }
-
-
- /**
- * Look at the current Gerrit repository and return a default value
- *
- * @param String default URL
- * @return TaskRepository
- */
- private TaskRepository getTaskRepository (String aUrl) {
- TaskRepository taskRepo = null;
- //Search for the current Gerrit connector
- taskRepo = GerritServerUtility.getInstance().getTaskRepo(aUrl);
-
- if (taskRepo == null) {
- if (aUrl != null) {
- taskRepo = new TaskRepository (GerritConnector.CONNECTOR_KIND, aUrl);
- } else {
- //Create a default Task repo
- taskRepo = new TaskRepository (GerritConnector.CONNECTOR_KIND, UIConstants.DEFAULT_REPOSITORY);
- }
-
- } else {
- GerritPlugin.Ftracer.traceInfo("Repo already in list: " + taskRepo.getRepositoryLabel());
-
- }
- return taskRepo;
- }
}
diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/projects/ProjectListHandler.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/projects/ProjectListHandler.java
index 791285dbd..bc64a3171 100644
--- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/projects/ProjectListHandler.java
+++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/projects/ProjectListHandler.java
@@ -6,9 +6,6 @@
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Description:
- * This class implements the implementation of the Dashboard-Gerrit UI project list reviews handler.
- *
* Contributors:
* Jacques Bouthillier - Initial Implementation of the plug-in handler
******************************************************************************/
@@ -18,13 +15,13 @@ package org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands.projects;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.mylyn.gerrit.dashboard.ui.GerritUi;
-import org.eclipse.mylyn.gerrit.dashboard.ui.internal.utils.UIUtils;
import org.eclipse.mylyn.gerrit.dashboard.ui.views.GerritTableView;
import org.eclipse.mylyn.internal.gerrit.core.GerritQuery;
/**
+ * This class implements the implementation of the Dashboard-Gerrit UI project list reviews handler.
+ *
* @author Jacques Bouthillier
* @version $Revision: 1.0 $
*
diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableLabelProvider.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableLabelProvider.java
index 0c010ad6e..89fbb508c 100644
--- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableLabelProvider.java
+++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableLabelProvider.java
@@ -6,9 +6,6 @@
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Description:
- * This class implements the implementation of the Dashboard-Gerrit UI view label provider.
- *
* Contributors:
* Jacques Bouthillier - Initial Implementation of the label provider
******************************************************************************/
@@ -27,6 +24,8 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
/**
+ * This class implements the implementation of the Dashboard-Gerrit UI view label provider.
+ *
* @author Jacques Bouthillier
* @version $Revision: 1.0 $
*
@@ -326,11 +325,7 @@ public class ReviewTableLabelProvider extends LabelProvider implements
@Override
public Color getForeground(Object aElement, int aColumnIndex) {
if (aElement instanceof GerritTask) {
- GerritTask item = (GerritTask) aElement;
int value = 0;
- String st = null;
- // GerritPlugin.Ftracer.traceWarning("getForeground() object CR : "
- // + item.getCr() + "\tcolumn : " + aColumnIndex );
if (aColumnIndex == ReviewTableDefinition.CR.ordinal()
// || aColumnIndex == ReviewTableDefinition.IC.ordinal()
|| aColumnIndex == ReviewTableDefinition.VERIFY.ordinal()) {
diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/UIReviewTable.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/UIReviewTable.java
index 54923db45..57d47a8dc 100644
--- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/UIReviewTable.java
+++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/UIReviewTable.java
@@ -6,9 +6,6 @@
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Description:
- * This class implements the implementation of the review table view.
- *
* Contributors:
* Jacques Bouthillier - Initial Implementation of the table view
******************************************************************************/
@@ -30,8 +27,6 @@ import org.eclipse.mylyn.gerrit.dashboard.ui.internal.utils.UIUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Point;
@@ -45,6 +40,8 @@ import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
/**
+ * This class implements the implementation of the review table view.
+ *
* @author Jacques Bouthillier
* @version $Revision: 1.0 $
*
@@ -125,7 +122,6 @@ public class UIReviewTable {
// Add a Key event and mouse down listener
fViewer.getTable().addListener(SWT.MouseDown, mouseButtonListener);
- // fViewer.getTable().addKeyListener(keyEventListener);
return fViewer;
@@ -170,7 +166,6 @@ public class UIReviewTable {
int minimumTableWidth = ReviewTableDefinition.getMinimumWidth();
int mimimumSubjectWidth = ReviewTableDefinition.SUBJECT.getWidth();
int minProjectWidth = ReviewTableDefinition.PROJECT.getWidth();
- int proAndSubjetWidth = mimimumSubjectWidth + minProjectWidth;
//Adjust the subject and project column to take the remaining space
int scrollWidth = table.getVerticalBar().getSize().x;
@@ -245,8 +240,6 @@ public class UIReviewTable {
// Process the Item table handling
processItemSelection();
- // singleClickFocus(tableIndex);
-
}
// For now, use button 2 to modify the starred value column 1
if (aEvent.button == 2) {
@@ -283,52 +276,6 @@ public class UIReviewTable {
};
/**
- * Key Listener to handle the Mouse down event on the ITEM and ANOMALY table
- */
- private KeyListener keyEventListener = new KeyListener() {
-
- public void keyReleased(KeyEvent e) {
- }
-
- public void keyPressed(KeyEvent e) {
- Table table = fViewer.getTable();
- int[] selecteditems = table.getSelectionIndices();
- int val = selecteditems[0];
- if (e.keyCode == SWT.ARROW_UP) {
- // So we need to reduce the selected item
- GerritUi.Ftracer
- .traceInfo("keyEventListener() for ARROW_UP "
- + e.keyCode);
- if (val > 0) {
- val--;
- table.deselect(selecteditems[0]);
- }
- }
-
- if (e.keyCode == SWT.ARROW_DOWN) {
- // So we need to increase the selected item
- GerritUi.Ftracer
- .traceInfo("keyEventListener() for ARROW_DOWN "
- + e.keyCode);
- if (val < table.getItemCount() - 1) {
- val++;
- table.deselect(selecteditems[0]);
- }
- }
-
- // Set the new selection
- table.select(val);
-
- // // Process the Item table handling
- // processItemSelection();
- //
- // // Open the file in the editor
- // singleClickFocus(tableIndex);
-
- }
- };
-
- /**
* Process the selected data from the item table
*/
private void processItemSelection() {
diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/GerritServerUtility.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/GerritServerUtility.java
index f5e262b91..15fc380ef 100644
--- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/GerritServerUtility.java
+++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/GerritServerUtility.java
@@ -26,17 +26,11 @@ import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashSet;
-import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.egit.core.RepositoryCache;
-import org.eclipse.egit.core.RepositoryUtil;
-import org.eclipse.jgit.lib.Config;
-import org.eclipse.jgit.lib.ConfigConstants;
-import org.eclipse.jgit.lib.Repository;
import org.eclipse.mylyn.gerrit.dashboard.GerritPlugin;
import org.eclipse.mylyn.gerrit.dashboard.ui.GerritUi;
import org.eclipse.mylyn.internal.gerrit.core.GerritConnector;
@@ -64,21 +58,6 @@ public class GerritServerUtility {
// ------------------------------------------------------------------------
/**
- * Field GERRIT_PORT. (value is "":29418"")
- */
- private static final String GERRIT_PORT = ":29418";
-
- /**
- * Field AT. (value is ""@"")
- */
- private static final String AT = "@";
-
- /**
- * Field AT. (value is ""https://"")
- */
- private static final String HTTPS = "https://";
-
- /**
* Field LAST_GERRIT_FILE. (value is ""lastGerrit.txt"")
*/
private static final String LAST_GERRIT_FILE = "lastGerrit.txt";
@@ -189,92 +168,6 @@ public class GerritServerUtility {
}
}
- private void printTaskRepository(TaskRepository aTask) {
- Set<Entry<String, String>> value = aTask.getProperties().entrySet();
- if ( value != null) {
- for (Map.Entry<String, String> entry : value) {
- GerritPlugin.Ftracer.traceInfo("TaskRepo key: " + entry.getKey()
- + "\tvalue: " + entry.getValue());
- }
- }
- GerritPlugin.Ftracer.traceInfo(" UserName: " + aTask.getUserName());
- GerritPlugin.Ftracer
- .traceInfo("===================================");
- }
-
- /**
- * This method use the Gerrit from the git server in the workspace
- */
- private void addWorkspaceGerritRepo () {
- RepositoryUtil repoUtil = org.eclipse.egit.core.Activator.getDefault().getRepositoryUtil();
- List<String> repoPaths = repoUtil.getConfiguredRepositories();
- RepositoryCache repositoryCache = org.eclipse.egit.core.Activator.getDefault().getRepositoryCache();
- Repository repo = null;
-
- for (String repoPath : repoPaths) {
- GerritPlugin.Ftracer.traceInfo("List Gerrit repository: " + repoPath );
- File gitDir = new File(repoPath);
- if (!gitDir.exists()) {
- GerritPlugin.Ftracer.traceInfo("Gerrit repository do not exist: " + gitDir.getPath());
- continue;
- }
- try {
- repo = repositoryCache.lookupRepository(gitDir);
- GerritPlugin.Ftracer.traceInfo("\trepository config after lookup: " +
- repo.getConfig());
- } catch (IOException e) {
- e.printStackTrace();
- }
- if (repo != null) {
- Config config = new Config(repo.getConfig());
- //Look to get the remotes URL
- Set<String> remotes = config.getSubsections(ConfigConstants.CONFIG_REMOTE_SECTION);
- for (String remote: remotes) {
- String remoteURL = config.getString(ConfigConstants.CONFIG_REMOTE_SECTION,
- remote,
- ConfigConstants.CONFIG_KEY_URL);
- GerritPlugin.Ftracer.traceInfo("\t\t " + remote +" -> remoteURL: " + remoteURL );
-
- //Test if this is a Gerrit server and add it to the Dialogue combo
- String convertedRemoteURL = getReformatGerritServer(remoteURL) ;
- if (null != convertedRemoteURL ) {
- TaskRepository taskRepo = new TaskRepository(GerritConnector.CONNECTOR_KIND, convertedRemoteURL);
- taskRepo.setRepositoryLabel(convertedRemoteURL);
- fResultTask.put(taskRepo, taskRepo.getRepositoryUrl());
- adjustTemplatemanager(taskRepo);
-
- }
- }
- }
- }
- }
-
-
- //Note the Gerrit server for "git.eclipse.org" in config is
- // not the same as in the task Repository: "git.eclipse.org/r"
- /**
- * Verify if the gerrit remote URL has the gerrit port (29418 )
- * @param aRemoteURL
- * @return String remote converted URL
- */
- private String getReformatGerritServer(String aRemoteURL) {
- //Test if this is a Gerrit server or not
- String[] strParsePort = aRemoteURL.split(GERRIT_PORT);
- if (strParsePort.length == 2) {
- //Do not convert it for now
- return aRemoteURL;
-// //We found a Gerrit server, lets build the URL
-// //String[] strParseServer = strParsePort[0].split(AT);
-// int index = strParsePort[0].indexOf(AT);
-// String server = strParsePort[0].substring(++index);
-// StringBuilder sb = new StringBuilder();
-// sb.append(HTTPS);
-// sb.append(server);
-// return sb.toString();
- }
- return null;
- }
-
/**
* Build and return the File storing the persistent data
* @param String aFile
@@ -586,67 +479,4 @@ public class GerritServerUtility {
// return results;
// }
- /******************************************************************/
- /******************************************************************/
- /******************************************************************/
- /******************************************************************/
- /******** TEST *************************************************/
- /******************************************************************/
- /******************************************************************/
- /******************************************************************/
- /******************************************************************/
-
- private void testTaskRepo () {
- // TaskRepository repository = new TaskRepository(GerritConnector.CONNECTOR_KIND, "http://repository"); //$NON-NLS-1$
-// final TaskRepository repository = new TaskRepository(GerritConnector.CONNECTOR_KIND, "https://"); //$NON-NLS-1$
-
- final TaskRepository repository = getTaskRepository(); //$NON-NLS-1$
- GerritPlugin.Ftracer.traceInfo("repository: " + repository.getUrl()); //$NON-NLS-1$
-// int ret = TasksUiUtil.openEditRepositoryWizard(repository); //Generate a null pointer for the workbench window
-
-
- GerritPlugin.Ftracer.traceInfo("Before: repository url: " + repository.getUrl() ); //$NON-NLS-1$
-
- }
-
- /**
- * Look at the current Gerrit repository and return a default value
- * i.e the first Gerrit if found ???
- * @return TaskRepository
- */
- private TaskRepository getTaskRepository () {
- TaskRepository taskRepo = null;
- /**
- * Field DEFAULT_REPOSITORY. (value is ""https://repository"")
- */
- String DEFAULT_REPOSITORY = "https://";
- //Reset the list of Gerrit server
- fResultTask.clear();
-
-
- //Test to read the TaskRepositories
-
- TaskRepositoryManager repositoryManager = TasksUiPlugin.getRepositoryManager();
-
- //List all repositories in the the TaskRepositories view
- List <TaskRepository>listallRepo = repositoryManager.getAllRepositories();
- for (int i = 0;i < listallRepo.size(); i++) {
- GerritPlugin.Ftracer.traceInfo("TaskRepositoryManager repository: [ " + i + " ] : " + listallRepo.get(i).getRepositoryLabel() );
- }
-
- //Only get the TaskRepository related to Gerrit review connnector
- GerritPlugin.Ftracer.traceInfo("--------Review repo ---------------");
- Set<TaskRepository> reviewRepo = repositoryManager.getRepositories(GerritConnector.CONNECTOR_KIND);
- for (TaskRepository tp: reviewRepo) {
- GerritPlugin.Ftracer.traceInfo("Only Gerrit Review repo: " + tp.getRepositoryLabel() + "\t url: " + tp.getRepositoryUrl());
- }
-
- //Testing bugzilla but need to add the mylyn bugzilla in plugin dependencies
-// for (RepositoryTemplate template : templateManager.getTemplates(BugzillaCorePlugin.CONNECTOR_KIND)) {
-// GerritPlugin.Ftracer.traceInfo("Gerrit Bugzilla repository: " + template.label + "\t URL: " + template.repositoryUrl);
-// }
-
- return taskRepo;
- }
-
}
diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/UIUtils.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/UIUtils.java
index 3c7de4948..4d8194e1f 100644
--- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/UIUtils.java
+++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/UIUtils.java
@@ -38,7 +38,6 @@ public class UIUtils {
*
*/
public static void notInplementedDialog(String aSt) {
- String msg = "Not Implemented yet !";
GerritUi.Ftracer.traceWarning("Not Implemented yet");
final ErrorDialog dialog = new ErrorDialog(
null,

Back to the top