diff options
author | Jacques Bouthillier | 2014-07-04 17:53:34 +0000 |
---|---|---|
committer | Jacques Bouthillier | 2014-07-04 17:53:34 +0000 |
commit | b9c85048fe3ec6de1ab3f5ed12e7f9ae8cff80e1 (patch) | |
tree | 6c496927cf81d6778666003ce746bae5e2a55e1d | |
parent | 9fd96c97f3291c1e7f30f3120fae3f03c02197f2 (diff) | |
download | org.eclipse.mylyn.reviews-b9c85048fe3ec6de1ab3f5ed12e7f9ae8cff80e1.tar.gz org.eclipse.mylyn.reviews-b9c85048fe3ec6de1ab3f5ed12e7f9ae8cff80e1.tar.xz org.eclipse.mylyn.reviews-b9c85048fe3ec6de1ab3f5ed12e7f9ae8cff80e1.zip |
434112: [dashboard] Internationalize all strings
Change-Id: I59480c696b1589cbca0f2501fbbac359fe975754
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=434112
Signed-off-by: Jacques Bouthillier <lmcbout@gmail.com>
41 files changed, 683 insertions, 480 deletions
diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.gerrit.dashboard.ui/META-INF/MANIFEST.MF index c160a1652..943e49dbb 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/META-INF/MANIFEST.MF +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/META-INF/MANIFEST.MF @@ -4,6 +4,7 @@ Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.mylyn.gerrit.dashboard.ui;singleton:=true Bundle-Version: 2.3.0.qualifier Bundle-Activator: org.eclipse.mylyn.gerrit.dashboard.ui.GerritUi +Bundle-Localization: OSGI-INF/l10n/bundle Require-Bundle: org.eclipse.ui, org.eclipse.ui.forms, org.eclipse.core.runtime, @@ -44,4 +45,5 @@ Export-Package: org.eclipse.mylyn.gerrit.dashboard.internal.utils;x-internal:=tr org.eclipse.swt.widgets, org.eclipse.mylyn.internal.gerrit.core, org.eclipse.mylyn.gerrit.dashboard.ui.internal.model" -Import-Package: com.google.gerrit.reviewdb;version="2.1.5" +Import-Package: com.google.common.base;version="15.0.0", + com.google.gerrit.reviewdb;version="2.1.5" diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/OSGI-INF/l10n/bundle.properties b/org.eclipse.mylyn.gerrit.dashboard.ui/OSGI-INF/l10n/bundle.properties new file mode 100644 index 000000000..271460b7c --- /dev/null +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/OSGI-INF/l10n/bundle.properties @@ -0,0 +1,77 @@ +############################################################################### +# Copyright (c) 2014 Ericsson +# +# All rights reserved. This program and the accompanying materials are +# made available under the terms of the Eclipse Public License v1.0 which +# accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Properties file for org.eclipse.mylyn.gerrit.dashboard.ui +# +# Contributors: +# Jacques Bouthillier - Initial implementation +############################################################################### +pluginName = Mylyn Reviews Gerrit-Dashboard UI +providerName = Eclipse Mylyn +category.name = Gerrit Dashboard +view.name = Gerrit Dashboard +command.showTask = Show Task Repositories +command.title = Gerrit Dashboard +command.all = All +command.tooltipAllOpen = Find all Open Reviews for the selected repository +command.my = My +command.tooltipMyWatchedChanges = Find my Watched Changes reviews for the selected repository +command.documentation = Documentation +command.tooltipDocumentation = Open Gerrit documentation +command.open = Open +command.tooltipOpen = Find all Open Reviews for the selected repository +command.merged = Merged +command.tooltipMerged = Find all Merged Reviews for the selected repository +command.abandoned = Abandoned +command.tooltipAbandoned = Find all Abandoned Reviews for the selected repository +command.watchChanges = Watched Changes +command.tooltipWatchChanges = Find my watched changes for the selected repository +command.changes = Changes +command.tooltipChanges = Find my changes for the selected repository +command.drafts = Drafts +command.tooltipDrafts = Find my draft changes for the selected repository +command.starred = Starred Changes +command.tooltipStarred = Find my starred changes for the selected repository +command.draftComment = Draft Comments +command.tooltipDraftComment = Find my draft comments for the selected repository +command.projectList = List +command.tooltipProjectList = Find the project list for the selected repository +command.groupList = List +command.tooltipGroupList = Find the groups list for the selected repository +command.documentIndex = Index +command.tooltipDocumentIndex = Open documentation index +command.documemtSearching = Searching +command.tooltipDocumentSearching = Open documentation of searching changes +command.documentUploading = Uploading +command.tooltipDocumentUploading = Open documentation of uploading changes +command.documentAccess = Access Controls +command.tooltipDocumentAccess = Open access controls documentation +command.documentRest = REST API +command.tooltipDocumentRest = Open REST API documentation +command.name.selectCurrent = Select current Gerrit repository +command.name.addRepository = Add Gerrit Repository... +command.name.showTaskRepository = Task Repositories... +commandParameter.name.viewId = viewId +command.name.allOpen = AllOpen +command.name.allMerged = AllMerged +command.name.allAbandonned = AllAbandoned +command.name.myChanges = MyChanges +command.name.myDraftsChanges = MyDraftsChanges +command.name.myWatchedChanges = MyWatchedChanges +command.name.myStarredChanges = MyStarredChanges +command.name.myDraftsCommentsChanges = MyDraftCommentsChanges +command.name.projectList = ProjectLists +command.name.groupList = GroupLists +command.name.documentIndex = DocumentationIndex +command.name.documentSearching = DocumentationSearching +command.name.documentUploading = DocumentationUploading +command.name.documentAccess = DocumentationAccessControls +command.name.documentRestApi = DocumentationRestAPI +command.name.starReview = Star Review +context.descriptionView = Gerrit Dashboard View +context.name = Dashboard View
\ No newline at end of file diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/build.properties b/org.eclipse.mylyn.gerrit.dashboard.ui/build.properties index cf1cf405d..e57cc1c8c 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/build.properties +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/build.properties @@ -15,7 +15,7 @@ bin.includes = plugin.xml,\ .,\ icons/,\ contexts.xml,\ - plugin.properties,\ .options,\ - about.html + about.html,\ + OSGI-INF/l10n/bundle.properties src.includes = about.html diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/plugin.properties b/org.eclipse.mylyn.gerrit.dashboard.ui/plugin.properties deleted file mode 100644 index e632bd4b0..000000000 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/plugin.properties +++ /dev/null @@ -1,12 +0,0 @@ -############################################################################### -# Copyright (c) 2013 Ericsson AB and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Ericsson AB - initial API and implementation -############################################################################### -pluginName = Mylyn Reviews Gerrit-Dashboard UI (Incubation) -providerName = Eclipse Mylyn diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/plugin.xml b/org.eclipse.mylyn.gerrit.dashboard.ui/plugin.xml index 0c6204546..6d790cba4 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/plugin.xml +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/plugin.xml @@ -8,11 +8,11 @@ <extension point="org.eclipse.ui.views"> <category - name="Gerrit Dashboard " + name="%category.name" id="org.eclipse.mylyn.gerrit.dashboard.ui"> </category> <view - name="Gerrit Dashboard" + name="%view.name" icon="icons/view16/gerrit.png" category="org.eclipse.mylyn.ui" class="org.eclipse.mylyn.gerrit.dashboard.ui.views.GerritTableView" @@ -65,7 +65,7 @@ <command commandId="command.showTaskRepo" id="Task.Repositories" - label="Show Task Repositories" + label="%command.showTask" style="push"> <parameter name="org.eclipse.ui.views.showView.viewId" @@ -80,7 +80,7 @@ commandId="org.eclipse.mylyn.gerrit.dashboard.ui.selectCurrentGerrit" icon="icons/view16/repository-middle.gif" id="GerritDashboard.dropdown.toolbar.initiateGerrit" - label="Gerrit Dashboard" + label="%command.title" style="pulldown"> </command> <!-- <separator @@ -91,9 +91,9 @@ <command commandId="org.eclipse.mylyn.gerrit.dashboard.ui.allOpenReviews" id="GerritDashboardUI.dropdown.toolbar.AddAllOpenReviews" - label="All" + label="%command.all" style="pulldown" - tooltip="Find all Open Reviews for the selected repository"> + tooltip="%command.tooltipAllOpen"> </command> <separator name="addition1" @@ -102,9 +102,9 @@ <command commandId="org.eclipse.mylyn.gerrit.dashboard.ui.myWatchedChanges" id="GerritDashboardUI.dropdown.toolbar.MyWatchedChanges" - label="My" + label="%command.my" style="pulldown" - tooltip="Find my Watched Changes reviews for the selected repository"> + tooltip="%command.tooltipMyWatchedChanges"> </command> <separator name="addition2" @@ -137,9 +137,9 @@ <command commandId="org.eclipse.mylyn.gerrit.dashboard.ui.documentationIndex" id="GerritDashboardUI.dropdown.toolbar.Documentation" - label="Documentation" + label="%command.documentation" style="pulldown" - tooltip="Open Gerrit documentation"> + tooltip="%command.tooltipDocumentation"> </command> <separator name="additions" @@ -155,23 +155,23 @@ <command commandId="org.eclipse.mylyn.gerrit.dashboard.ui.allOpenReviews" id="GerritDashboardUI.dropdown.toolbar.addOpenReviews" - label="Open" + label="%command.open" style="push" - tooltip="Find all Open Reviews for the selected repository"> + tooltip="%command.tooltipOpen"> </command> <command commandId="org.eclipse.mylyn.gerrit.dashboard.ui.allMergedReviews" id="org.eclipse.mylyn.gerrit.dashboard.ui.allMergedReviews" - label="Merged" + label="%command.merged" style="push" - tooltip="Find all Merged Reviews for the selected repository"> + tooltip="%command.tooltipMerged"> </command> <command commandId="org.eclipse.mylyn.gerrit.dashboard.ui.allAbandonedReviews" id="org.eclipse.mylyn.gerrit.dashboard.ui.allAbandonedReviews" - label="Abandoned" + label="%command.abandoned" style="push" - tooltip="Find all Abandoned Reviews for the selected repository"> + tooltip="%command.tooltipAbandoned"> </command> <separator @@ -186,37 +186,37 @@ <command commandId="org.eclipse.mylyn.gerrit.dashboard.ui.myWatchedChanges" id="org.eclipse.mylyn.gerrit.dashboard.ui.myWatchedChanges" - label="Watched Changes" + label="%command.watchChanges" style="push" - tooltip="Find my watched changes for the selected repository"> + tooltip="%command.tooltipWatchChanges"> </command> <command commandId="org.eclipse.mylyn.gerrit.dashboard.ui.myChanges" id="GerritDashboardUI.dropdown.toolbar.myChanges" - label="Changes" + label="%command.changes" style="push" - tooltip="Find my changes for the selected repository"> + tooltip="%command.tooltipChanges"> </command> <command commandId="org.eclipse.mylyn.gerrit.dashboard.ui.myDrafts" id="org.eclipse.mylyn.gerrit.dashboard.ui.myDrafts" - label="Drafts" + label="%command.drafts" style="push" - tooltip="Find my draft changes for the selected repository"> + tooltip="%command.tooltipDrafts"> </command> <command commandId="org.eclipse.mylyn.gerrit.dashboard.ui.myStarredChanges" id="org.eclipse.mylyn.gerrit.dashboard.ui.myStarredChanges" - label="Starred Changes" + label="%command.starred" style="push" - tooltip="Find my starred changes for the selected repository"> + tooltip="%command.tooltipStarred"> </command> <command commandId="org.eclipse.mylyn.gerrit.dashboard.ui.myDraftComments" id="org.eclipse.mylyn.gerrit.dashboard.ui.myDraftComments" - label="Draft Comments" + label="%command.draftComment" style="push" - tooltip="Find my draft comments for the selected repository"> + tooltip="%command.tooltipDraftComment"> </command> <separator @@ -232,9 +232,9 @@ <command commandId="org.eclipse.mylyn.gerrit.dashboard.ui.projectList" id="GerritDashboardUI.dropdown.toolbar.projectList" - label="List" + label="%command.projectList" style="push" - tooltip="Find the project list for the selected repository"> + tooltip="%command.tooltipProjectList"> </command> <separator @@ -250,9 +250,9 @@ <command commandId="org.eclipse.mylyn.gerrit.dashboard.ui.groupList" id="GerritDashboardUI.dropdown.toolbar.groupList" - label="List" + label="%command.groupList" style="push" - tooltip="Find the groups list for the selected repository"> + tooltip="%command.tooltipGroupList"> </command> <separator @@ -268,40 +268,40 @@ <command commandId="org.eclipse.mylyn.gerrit.dashboard.ui.documentationIndex" id="GerritDashboardUI.dropdown.toolbar.documentationIndex" - label="Index" + label="%command.documentIndex" style="push" - tooltip="Open documentation index"> + tooltip="%command.tooltipDocumentIndex"> </command> <command commandId="org.eclipse.mylyn.gerrit.dashboard.ui.documentationSearching" id="GerritDashboardUI.dropdown.toolbar.documentationSearching" - label="Searching" + label="%command.documemtSearching" style="push" - tooltip="Open documentation of searching changes"> + tooltip="%command.tooltipDocumentSearching"> </command> <command commandId="org.eclipse.mylyn.gerrit.dashboard.ui.documentationUploading" id="GerritDashboardUI.dropdown.toolbar.documentationUploading" - label="Uploading" + label="%command.documentUploading" style="push" - tooltip="Open documentation of uploading changes"> + tooltip="%command.tooltipDocumentUploading"> </command> <command commandId="org.eclipse.mylyn.gerrit.dashboard.ui.documentationAccessControls" id="GerritDashboardUI.dropdown.toolbar.documentationAccessControls" - label="Access Controls" + label="%command.documentAccess" style="push" - tooltip="Open access controls documentation"> + tooltip="%command.tooltipDocumentAccess"> </command> <command commandId="org.eclipse.mylyn.gerrit.dashboard.ui.documentationRestAPI" id="GerritDashboardUI.dropdown.toolbar.documentationRestAPI" - label="REST API" + label="%command.documentRest" style="push" - tooltip="Open REST API documentation"> + tooltip="%command.tooltipDocumentRest"> </command> @@ -327,20 +327,20 @@ <command id="org.eclipse.mylyn.gerrit.dashboard.ui.selectCurrentGerrit" - name="Select current Gerrit repository"> + name="%command.name.selectCurrent"> </command> <command id="org.eclipse.mylyn.gerrit.dashboard.ui.addGerritSite" - name="Add Gerrit Repository..."> + name="%command.name.addRepository"> </command> <command defaultHandler="org.eclipse.ui.handlers.ShowViewHandler" id="command.showTaskRepo" - name="Task Repositories..."> + name="%command.name.showTaskRepository"> <commandParameter id="org.eclipse.ui.views.showView.viewId" - name="viewId" + name="%commandParameter.name.viewId" optional="true" values="org.eclipse.ui.internal.registry.ViewParameterValues"> </commandParameter> @@ -350,82 +350,82 @@ --> <command id="org.eclipse.mylyn.gerrit.dashboard.ui.allOpenReviews" - name="AllOpen"> + name="%command.name.allOpen"> </command> <command id="org.eclipse.mylyn.gerrit.dashboard.ui.allMergedReviews" - name="AllMerged"> + name="%command.name.allMerged"> </command> <command id="org.eclipse.mylyn.gerrit.dashboard.ui.allAbandonedReviews" - name="AllAbandoned"> + name="%command.name.allAbandonned"> </command> <!-- The following are the commands under the "My" sub-menu --> <command id="org.eclipse.mylyn.gerrit.dashboard.ui.myChanges" - name="MyChanges"> + name="%command.name.myChanges"> </command> <command id="org.eclipse.mylyn.gerrit.dashboard.ui.myDrafts" - name="MyDraftsChanges"> + name="%command.name.myDraftsChanges"> </command> <command id="org.eclipse.mylyn.gerrit.dashboard.ui.myWatchedChanges" - name="MyWatchedChanges"> + name="%command.name.myWatchedChanges"> </command> <command id="org.eclipse.mylyn.gerrit.dashboard.ui.myStarredChanges" - name="MyStarredChanges"> + name="%command.name.myStarredChanges"> </command> <command id="org.eclipse.mylyn.gerrit.dashboard.ui.myDraftComments" - name="MyDraftCommentsChanges"> + name="%command.name.myDraftsCommentsChanges"> </command> <!-- The following are the commands under the "Projects" sub-menu --> <command id="org.eclipse.mylyn.gerrit.dashboard.ui.projectList" - name="ProjectLists"> + name="%command.name.projectList"> </command> <!-- The following are the commands under the "Groups" sub-menu --> <command id="org.eclipse.mylyn.gerrit.dashboard.ui.groupList" - name="GroupLists"> + name="%command.name.groupList"> </command> <!-- The following are the commands under the "Documentation" sub-menu --> <command id="org.eclipse.mylyn.gerrit.dashboard.ui.documentationIndex" - name="DocumentationIndex"> + name="%command.name.documentIndex"> </command> <command id="org.eclipse.mylyn.gerrit.dashboard.ui.documentationSearching" - name="DocumentationSearching"> + name="%command.name.documentSearching"> </command> <command id="org.eclipse.mylyn.gerrit.dashboard.ui.documentationUploading" - name="DocumentationUploading"> + name="%command.name.documentUploading"> </command> <command id="org.eclipse.mylyn.gerrit.dashboard.ui.documentationAccessControls" - name="DocumentationAccessControls"> + name="%command.name.documentAccess"> </command> <command id="org.eclipse.mylyn.gerrit.dashboard.ui.documentationRestAPI" - name="DocumentationRestAPI"> + name="%command.name.documentRestApi"> </command> <!-- The following are the commands under the "Review TableList" sub-menu --> <command id="org.eclipse.mylyn.gerrit.dashboard.ui.adjustMyStarred" - name="Star Review"> + name="%command.name.starReview"> </command> </extension> @@ -537,9 +537,9 @@ <extension point="org.eclipse.ui.contexts"> <context - description="Gerrit Dashboard View" + description="%context.descriptionView" id="org.eclipse.mylyn.gerrit.dashboard.ui.context" - name="Dashboard View" + name="%context.name" parentId="org.eclipse.ui.contexts.window"> </context> </extension> diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/GerritUi.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/GerritUi.java index 7aae8b4ea..464c7b694 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/GerritUi.java +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/GerritUi.java @@ -74,7 +74,7 @@ public class GerritUi extends AbstractUIPlugin { fPlugin = this; Ftracer = new Tracer(); Ftracer.init(PLUGIN_ID); - Ftracer.traceDebug("plugin started"); + Ftracer.traceDebug("plugin started"); //$NON-NLS-1$ } /* 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 0deb35562..92948f692 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 @@ -1,34 +1,29 @@ /******************************************************************************* * Copyright (c) 2013 Ericsson AB and others. - * + * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v1.0 which * accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Description: - * - * This class implements the "Add ..." a new Gerrit + * + * This class implements the "Add ..." a new Gerrit * project locations. - * + * * Contributors: * Jacques Bouthillier - Created for Mylyn Review Dashboard-Gerrit project - * + * ******************************************************************************/ package org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands; -import java.util.Map; -import java.util.Set; - import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.runtime.Status; -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.UIUtils; import org.eclipse.mylyn.gerrit.dashboard.ui.views.GerritTableView; import org.eclipse.mylyn.internal.gerrit.core.GerritQuery; -import org.eclipse.mylyn.tasks.core.TaskRepository; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.Widget; @@ -45,15 +40,13 @@ public class AddGerritSiteHandler extends AbstractHandler { private GerritServerUtility fServerUtil = null; - private Map<TaskRepository, String> fMapRepoServer = null; - // ------------------------------------------------------------------------ // Methods // ------------------------------------------------------------------------ /** * Method execute. - * + * * @param aEvent * ExecutionEvent * @return Object @@ -61,8 +54,7 @@ public class AddGerritSiteHandler extends AbstractHandler { */ public Object execute(final ExecutionEvent aEvent) { - GerritPlugin.Ftracer.traceInfo("Create the Add button to search the Gerrit location "); //$NON-NLS-1$ - String menuItemText = ""; + String menuItemText = ""; //$NON-NLS-1$ fServerUtil = GerritServerUtility.getInstance(); Object obj = aEvent.getTrigger(); GerritTableView reviewTableView = GerritTableView.getActiveView(); @@ -73,27 +65,13 @@ public class AddGerritSiteHandler extends AbstractHandler { if (objWidget instanceof MenuItem) { MenuItem menuItem = (MenuItem) objWidget; menuItemText = menuItem.getText(); - GerritPlugin.Ftracer.traceInfo("MenuItem: " + menuItemText + "\t value: " - + aEvent.getParameter(menuItemText) + " VS saved: " + fServerUtil.getLastSavedGerritServer()); - fMapRepoServer = fServerUtil.getGerritMapping(); String stURL = fServerUtil.getMenuSelectionURL(menuItemText); - GerritPlugin.Ftracer.traceInfo("URL for the menuItemText: " + stURL); - if (!fMapRepoServer.isEmpty()) { - Set<TaskRepository> mapSet = fMapRepoServer.keySet(); - GerritPlugin.Ftracer.traceInfo("-------------------"); - for (TaskRepository key : mapSet) { - GerritPlugin.Ftracer.traceInfo("Map Key name: " + key.getRepositoryLabel() + "\t URL: " - + fMapRepoServer.get(key)); - } - } // Open the review table first; reviewTableView.openView(); //Verify if we selected the "Add.." button or a pre=defined Gerrit if (stURL != null) { if (stURL.equals(fServerUtil.getLastSavedGerritServer())) { - GerritPlugin.Ftracer.traceInfo("LAST SAVED server is the SAME "); - fServerUtil.getReviewListFromServer(); //Initiate the request for the list of reviews with a default query reviewTableView.processCommands(GerritQuery.MY_WATCHED_CHANGES); @@ -102,7 +80,6 @@ public class AddGerritSiteHandler extends AbstractHandler { } else { //Store the new Gerrit server into a file fServerUtil.saveLastGerritServer(stURL); - fServerUtil.getReviewListFromServer(); //Initiate the request for the list of reviews with a default query reviewTableView.processCommands(GerritQuery.MY_WATCHED_CHANGES); @@ -118,11 +95,10 @@ public class AddGerritSiteHandler extends AbstractHandler { // return dialogObj; //JB Dec 19, 2013 - //The previous line are blocked for now until we can add + //The previous line are blocked for now until we can add //a new Gerrit Server from the "Add Gerrit Repository.." button - UIUtils.showErrorDialog("Use Button [Task Repositories...] to define a new Gerrit Server", - "Button [Add Gerrit Repository...] is not ready"); + UIUtils.showErrorDialog(Messages.AddGerritSiteHandler_defineNewServer, + Messages.AddGerritSiteHandler_buttonNotReady); return obj; } - } diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/Messages.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/Messages.java new file mode 100644 index 000000000..4e9944ce0 --- /dev/null +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/Messages.java @@ -0,0 +1,36 @@ +/******************************************************************************* + * Copyright (c) 2014 Ericsson AB and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jacques Bouthillier - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands.messages"; //$NON-NLS-1$ + + public static String AddGerritSiteHandler_buttonNotReady; + + public static String AddGerritSiteHandler_defineNewServer; + + public static String SelectReviewSiteHandler_exception; + + public static String SelectReviewSiteHandler_searchCommand; + + public static String SelectReviewSiteHandler_dashboardUiJob; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/SelectReviewSiteHandler.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/SelectReviewSiteHandler.java index 00beeecbb..53d049357 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/SelectReviewSiteHandler.java +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/SelectReviewSiteHandler.java @@ -1,25 +1,22 @@ /******************************************************************************* * Copyright (c) 2013 Ericsson AB and others. - * + * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v1.0 which * accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Description: - * + * * This class implements the search to pre-filled the list of Gerrit * project locations. - * + * * Contributors: * Jacques Bouthillier - Created for Mylyn Review Gerrit Dashboard project - * + * ******************************************************************************/ package org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands; -import java.util.Map; -import java.util.Set; - import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.runtime.IProgressMonitor; @@ -32,40 +29,28 @@ 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.views.GerritTableView; import org.eclipse.mylyn.internal.gerrit.core.GerritQuery; -import org.eclipse.mylyn.tasks.core.TaskRepository; +import org.eclipse.osgi.util.NLS; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.handlers.IHandlerService; /** * @author Jacques Bouthillier - * @version $Revision: 1.0 $ */ public class SelectReviewSiteHandler extends AbstractHandler { // ------------------------------------------------------------------------ - // Constants - // ------------------------------------------------------------------------ - - /** - * Field COMMAND_MESSAGE. (value is ""Opening Element..."") - */ - private static final String COMMAND_MESSAGE = "Search Gerrit locations ..."; - - // ------------------------------------------------------------------------ // Variables // ------------------------------------------------------------------------ private GerritServerUtility fServerUtil = null; - private Map<TaskRepository, String> fMapRepoServer = null; - // ------------------------------------------------------------------------ // Methods // ------------------------------------------------------------------------ /** * Method execute. - * + * * @param aEvent * ExecutionEvent * @return Object @@ -80,50 +65,34 @@ public class SelectReviewSiteHandler extends AbstractHandler { reviewTableView.openView(); - final Job job = new Job(COMMAND_MESSAGE) { - - public String familyName = UIConstants.DASHBOARD_UI_JOB_FAMILY; + final Job job = new Job(Messages.SelectReviewSiteHandler_searchCommand) { @Override public boolean belongsTo(Object aFamily) { - return familyName.equals(aFamily); + return Messages.SelectReviewSiteHandler_dashboardUiJob.equals(aFamily); + } @Override public IStatus run(IProgressMonitor aMonitor) { - aMonitor.beginTask(COMMAND_MESSAGE, IProgressMonitor.UNKNOWN); + aMonitor.beginTask(Messages.SelectReviewSiteHandler_searchCommand, IProgressMonitor.UNKNOWN); //Map the Gerrit server fServerUtil = GerritServerUtility.getInstance(); - //Debug purpose, see which project have a gerrit server - fMapRepoServer = fServerUtil.getGerritMapping(); - if (!fMapRepoServer.isEmpty()) { - Set<TaskRepository> mapSet = fMapRepoServer.keySet(); - GerritPlugin.Ftracer.traceInfo("-------------------"); - for (TaskRepository key : mapSet) { - GerritPlugin.Ftracer.traceInfo("Map Key repo name : " + key.getRepositoryLabel() + "\t URL: " - + fMapRepoServer.get(key)); - } - } - //End Debug - String serverToUsed = fServerUtil.getLastSavedGerritServer(); if (serverToUsed != null) { //Initiate the request for the list of reviews with a default query reviewTableView.processCommands(GerritQuery.MY_WATCHED_CHANGES); } else { - //Need to open the Dialogue to fill a Gerrit server - GerritPlugin.Ftracer.traceInfo("Need to open the Dialogue to fill a gerrit server "); - //Get the service IWorkbench workbench = GerritUi.getDefault().getWorkbench(); IHandlerService handlerService = (IHandlerService) workbench.getService(IHandlerService.class); try { - handlerService.executeCommand(UIConstants.ADD_GERRIT_SITE_COMMAND_ID, null); } catch (Exception ex) { - GerritPlugin.Ftracer.traceError("Exception: " + ex.toString()); + GerritPlugin.Ftracer.traceError(NLS.bind(Messages.SelectReviewSiteHandler_exception, + ex.toString())); // GerritUi.getDefault().logError("Exception: ", ex); // throw new RuntimeException("org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands.AddGerritSite not found"); diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/all/AllAbandonedReviewsHandler.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/all/AllAbandonedReviewsHandler.java index e1eb5a5e9..6bb6527cd 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/all/AllAbandonedReviewsHandler.java +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/all/AllAbandonedReviewsHandler.java @@ -1,14 +1,14 @@ /******************************************************************************* * Copyright (c) 2013 Ericsson - * + * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v1.0 which * 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 Abandoned reviews handler. - * + * * Contributors: * Jacques Bouthillier - Initial Implementation of the plug-in handler ******************************************************************************/ @@ -18,13 +18,11 @@ package org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands.all; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; -import org.eclipse.mylyn.gerrit.dashboard.ui.GerritUi; import org.eclipse.mylyn.gerrit.dashboard.ui.views.GerritTableView; import org.eclipse.mylyn.internal.gerrit.core.GerritQuery; /** * @author Jacques Bouthillier - * @version $Revision: 1.0 $ */ public class AllAbandonedReviewsHandler extends AbstractHandler { @@ -34,13 +32,10 @@ public class AllAbandonedReviewsHandler extends AbstractHandler { */ @Override public Object execute(ExecutionEvent aEvent) throws ExecutionException { - GerritUi.Ftracer.traceInfo("Search the Gerrit reviews for All Abandonned "); //$NON-NLS-1$ - GerritTableView reviewTableView = GerritTableView.getActiveView(); // see http://gerrit-documentation.googlecode.com/svn/Documentation/2.5.2/user-search.html //for All > AbandonedOpen--> status:abandoned - GerritUi.Ftracer.traceInfo("Execute command : " + GerritQuery.QUERY_ALL_ABANDONED_CHANGES); //$NON-NLS-1$ reviewTableView.processCommands(GerritQuery.QUERY_ALL_ABANDONED_CHANGES); return null; diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/all/AllMergedReviewsHandler.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/all/AllMergedReviewsHandler.java index 875027e7f..1d1f88929 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/all/AllMergedReviewsHandler.java +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/all/AllMergedReviewsHandler.java @@ -18,7 +18,6 @@ package org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands.all; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; -import org.eclipse.mylyn.gerrit.dashboard.ui.GerritUi; import org.eclipse.mylyn.gerrit.dashboard.ui.views.GerritTableView; import org.eclipse.mylyn.internal.gerrit.core.GerritQuery; @@ -34,13 +33,10 @@ public class AllMergedReviewsHandler extends AbstractHandler { */ @Override public Object execute(ExecutionEvent aEvent) throws ExecutionException { - - GerritUi.Ftracer.traceInfo("Search the Gerrit reviews for All Merged "); //$NON-NLS-1$ GerritTableView reviewTableView = GerritTableView.getActiveView(); // see http://gerrit-documentation.googlecode.com/svn/Documentation/2.5.2/user-search.html //for All > AbandonedOpen--> status:merged - GerritUi.Ftracer.traceInfo("Execute command : " + GerritQuery.QUERY_ALL_MERGED_CHANGES); //$NON-NLS-1$ reviewTableView.processCommands(GerritQuery.QUERY_ALL_MERGED_CHANGES); return null; diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/all/AllOpenReviewsHandler.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/all/AllOpenReviewsHandler.java index 415030112..11ce88109 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/all/AllOpenReviewsHandler.java +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/all/AllOpenReviewsHandler.java @@ -19,7 +19,6 @@ package org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands.all; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.mylyn.gerrit.dashboard.ui.GerritUi; import org.eclipse.mylyn.gerrit.dashboard.ui.views.GerritTableView; import org.eclipse.mylyn.internal.gerrit.core.GerritQuery; @@ -39,14 +38,10 @@ public class AllOpenReviewsHandler extends AbstractHandler { * @see org.eclipse.core.commands.IHandler#execute(ExecutionEvent) */ public Object execute(final ExecutionEvent aEvent) { - - GerritUi.Ftracer.traceInfo("Search the Gerrit reviews for All Open "); //$NON-NLS-1$ - GerritTableView reviewTableView = GerritTableView.getActiveView(); // see http://gerrit-documentation.googlecode.com/svn/Documentation/2.5.2/user-search.html //for All > Open--> status:open (or is:open) - GerritUi.Ftracer.traceInfo("Execute command : " + GerritQuery.ALL_OPEN_CHANGES); //$NON-NLS-1$ reviewTableView.processCommands(GerritQuery.ALL_OPEN_CHANGES); return null; diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/documentation/Messages.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/documentation/Messages.java new file mode 100644 index 000000000..6c0c79d3f --- /dev/null +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/documentation/Messages.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2014 Ericsson AB and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jacques Bouthillier - initial API and implementation + *******************************************************************************/ +package org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands.documentation; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands.documentation.messages"; //$NON-NLS-1$ + + public static String RestAPIHandler_selectedServer; + + public static String RestAPIHandler_serverTooOld; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/documentation/RestAPIHandler.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/documentation/RestAPIHandler.java index 6b38c8792..03483db81 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/documentation/RestAPIHandler.java +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/documentation/RestAPIHandler.java @@ -22,6 +22,7 @@ import org.eclipse.mylyn.gerrit.dashboard.ui.GerritUi; import org.eclipse.mylyn.gerrit.dashboard.ui.internal.utils.GerritServerUtility; import org.eclipse.mylyn.gerrit.dashboard.ui.internal.utils.UIUtils; import org.eclipse.mylyn.gerrit.dashboard.ui.views.GerritTableView; +import org.eclipse.osgi.util.NLS; /** * @author Jacques Bouthillier @@ -37,12 +38,11 @@ public class RestAPIHandler extends AbstractHandler { */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { - GerritUi.Ftracer.traceInfo("Search the documentation RestAPIHandler "); //$NON-NLS-1$ GerritTableView view = GerritTableView.getActiveView(); if (view.isGerritVersionBefore_2_5()) { - String msg = "Selected Gerrit server: " + view.getlastGerritServerVersion().toString(); - String reason = "Gerrit server is too old, need at least Gerrit version 2.5 \nto get Gerrit Code Review - REST API documentation."; + String msg = NLS.bind(Messages.RestAPIHandler_selectedServer, view.getlastGerritServerVersion().toString()); + String reason = Messages.RestAPIHandler_serverTooOld; GerritUi.Ftracer.traceInfo(msg); UIUtils.showErrorDialog(msg, reason); return null; diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/documentation/messages.properties b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/documentation/messages.properties new file mode 100644 index 000000000..c0c6411d1 --- /dev/null +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/documentation/messages.properties @@ -0,0 +1,13 @@ +############################################################################### +# Copyright (c) 2014 Ericsson AB and others. +# +# All rights reserved. This program and the accompanying materials are +# made available under the terms of the Eclipse Public License v1.0 which +# accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Jacques Bouthillier - Initial implementation +############################################################################### +RestAPIHandler_selectedServer=Selected Gerrit server: {0} +RestAPIHandler_serverTooOld=Gerrit server is too old, need at least Gerrit version 2.5 \nto get Gerrit Code Review - REST API documentation. diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/groups/GroupListHandler.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/groups/GroupListHandler.java index 65d0899e2..6f543c699 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/groups/GroupListHandler.java +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/groups/GroupListHandler.java @@ -19,7 +19,6 @@ 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; /** @@ -34,9 +33,6 @@ public class GroupListHandler extends AbstractHandler { */ @Override public Object execute(ExecutionEvent aEvent) throws ExecutionException { - GerritUi.Ftracer.traceInfo("Search the Gerrit reviews for Groups List "); //$NON-NLS-1$ - - GerritUi.Ftracer.traceInfo("Execute: GroupList() "); //$NON-NLS-1$ try { UIUtils.notInplementedDialog(aEvent.getCommand().getName()); } catch (NotDefinedException e) { diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/messages.properties b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/messages.properties new file mode 100644 index 000000000..d1f0d20fe --- /dev/null +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/messages.properties @@ -0,0 +1,16 @@ +############################################################################### +# Copyright (c) 2014 Ericsson AB and others. +# +# All rights reserved. This program and the accompanying materials are +# made available under the terms of the Eclipse Public License v1.0 which +# accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Jacques Bouthillier - Initial implementation +############################################################################### +AddGerritSiteHandler_buttonNotReady=Button [Add Gerrit Repository...] is not ready +AddGerritSiteHandler_defineNewServer=Use Button [Task Repositories...] to define a new Gerrit Server +SelectReviewSiteHandler_exception=Exception: {0} +SelectReviewSiteHandler_searchCommand=Search Gerrit locations ... +SelectReviewSiteHandler_dashboardUiJob=DASHBOARD_UI diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyChangesReviewsHandler.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyChangesReviewsHandler.java index 45bdf8419..49e76e21e 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyChangesReviewsHandler.java +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyChangesReviewsHandler.java @@ -18,7 +18,6 @@ package org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands.my; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; -import org.eclipse.mylyn.gerrit.dashboard.ui.GerritUi; import org.eclipse.mylyn.gerrit.dashboard.ui.views.GerritTableView; import org.eclipse.mylyn.internal.gerrit.core.GerritQuery; @@ -34,12 +33,10 @@ public class MyChangesReviewsHandler extends AbstractHandler { */ @Override public Object execute(ExecutionEvent aEvent) throws ExecutionException { - GerritUi.Ftracer.traceInfo("Search the Gerrit reviews for My changes "); //$NON-NLS-1$ // see http://gerrit-documentation.googlecode.com/svn/Documentation/2.5.2/user-search.html //for MY > Changes--> has:draft GerritTableView reviewTableView = GerritTableView.getActiveView(); - GerritUi.Ftracer.traceInfo("Execute command : " + GerritQuery.MY_CHANGES); //$NON-NLS-1$ reviewTableView.processCommands(GerritQuery.MY_CHANGES); return null; diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyDraftCommentsReviewsHandler.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyDraftCommentsReviewsHandler.java index 8e9b2cd2b..3c1e529db 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyDraftCommentsReviewsHandler.java +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyDraftCommentsReviewsHandler.java @@ -18,7 +18,6 @@ package org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands.my; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; -import org.eclipse.mylyn.gerrit.dashboard.ui.GerritUi; import org.eclipse.mylyn.gerrit.dashboard.ui.views.GerritTableView; import org.eclipse.mylyn.internal.gerrit.core.GerritQuery; @@ -34,12 +33,10 @@ public class MyDraftCommentsReviewsHandler extends AbstractHandler { */ @Override public Object execute(ExecutionEvent aEvent) throws ExecutionException { - GerritUi.Ftracer.traceInfo("Search the Gerrit reviews for My Drafts Comments "); //$NON-NLS-1$ GerritTableView reviewTableView = GerritTableView.getActiveView(); // see http://gerrit-documentation.googlecode.com/svn/Documentation/2.5.2/user-search.html //for MY > Drafts Comments--> has:draft - GerritUi.Ftracer.traceInfo("Execute command : " + "My > Draft Comments"); //$NON-NLS-1$ reviewTableView.processCommands(GerritQuery.QUERY_MY_DRAFTS_COMMENTS_CHANGES); return null; diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyDraftsReviewsHandler.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyDraftsReviewsHandler.java index 91268d6e8..a5d0b2c34 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyDraftsReviewsHandler.java +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyDraftsReviewsHandler.java @@ -18,7 +18,6 @@ package org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands.my; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; -import org.eclipse.mylyn.gerrit.dashboard.ui.GerritUi; import org.eclipse.mylyn.gerrit.dashboard.ui.views.GerritTableView; import org.eclipse.mylyn.internal.gerrit.core.GerritQuery; @@ -34,13 +33,10 @@ public class MyDraftsReviewsHandler extends AbstractHandler { */ @Override public Object execute(ExecutionEvent aEvent) throws ExecutionException { - GerritUi.Ftracer.traceInfo("Search the Gerrit reviews for My Drafts "); //$NON-NLS-1$ - GerritTableView reviewTableView = GerritTableView.getActiveView(); // see http://gerrit-documentation.googlecode.com/svn/Documentation/2.5.2/user-search.html //for MY > Drafts --> is:draft - GerritUi.Ftracer.traceInfo("Execute command : " + "My > Drafts"); //$NON-NLS-1$ reviewTableView.processCommands(GerritQuery.QUERY_MY_DRAFTS_CHANGES); return null; diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyStarredChangesReviewsHandler.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyStarredChangesReviewsHandler.java index 222559c3b..dac812b2c 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyStarredChangesReviewsHandler.java +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyStarredChangesReviewsHandler.java @@ -18,7 +18,6 @@ package org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands.my; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; -import org.eclipse.mylyn.gerrit.dashboard.ui.GerritUi; import org.eclipse.mylyn.gerrit.dashboard.ui.views.GerritTableView; import org.eclipse.mylyn.internal.gerrit.core.GerritQuery; @@ -34,14 +33,10 @@ public class MyStarredChangesReviewsHandler extends AbstractHandler { */ @Override public Object execute(ExecutionEvent aEvent) throws ExecutionException { - GerritUi.Ftracer.traceInfo("Search the Gerrit reviews for My Starred Changes "); //$NON-NLS-1$ - GerritTableView reviewTableView = GerritTableView.getActiveView(); // see http://gerrit-documentation.googlecode.com/svn/Documentation/2.5.2/user-search.html //for My > Starred Changess--> is:starred - GerritUi.Ftracer.traceInfo("Execute command : " + "My > Starred Changes"); //$NON-NLS-1$ - reviewTableView.processCommands(GerritQuery.QUERY_MY_STARRED_CHANGES); return null; diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyWatchedChangesReviewsHandler.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyWatchedChangesReviewsHandler.java index f50506843..99e16faf2 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyWatchedChangesReviewsHandler.java +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/my/MyWatchedChangesReviewsHandler.java @@ -18,7 +18,6 @@ package org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands.my; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; -import org.eclipse.mylyn.gerrit.dashboard.ui.GerritUi; import org.eclipse.mylyn.gerrit.dashboard.ui.views.GerritTableView; import org.eclipse.mylyn.internal.gerrit.core.GerritQuery; @@ -38,7 +37,6 @@ public class MyWatchedChangesReviewsHandler extends AbstractHandler { // see http://gerrit-documentation.googlecode.com/svn/Documentation/2.5.2/user-search.html //for My > Watched Changes--> status:open is:watched - GerritUi.Ftracer.traceInfo("Execute command : " + GerritQuery.MY_WATCHED_CHANGES); //$NON-NLS-1$ reviewTableView.processCommands(GerritQuery.MY_WATCHED_CHANGES); return null; 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 013c016fa..a88c54ea4 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 @@ -15,7 +15,6 @@ 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.mylyn.gerrit.dashboard.ui.GerritUi; import org.eclipse.mylyn.gerrit.dashboard.ui.views.GerritTableView; import org.eclipse.mylyn.internal.gerrit.core.GerritQuery; @@ -33,16 +32,6 @@ public class ProjectListHandler extends AbstractHandler { */ @Override public Object execute(ExecutionEvent aEvent) throws ExecutionException { - GerritUi.Ftracer.traceInfo("Search the Gerrit reviews for Projects List "); //$NON-NLS-1$ - - GerritUi.Ftracer.traceInfo("Execute: ProjectList() "); //$NON-NLS-1$ -// try { -// UIUtils.notInplementedDialog(aEvent.getCommand().getName()); -// } catch (NotDefinedException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// return null; GerritTableView reviewTableView = GerritTableView.getActiveView(); // see http://gerrit-documentation.googlecode.com/svn/Documentation/2.5.2/user-search.html diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/table/AdjustMyStarredHandler.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/table/AdjustMyStarredHandler.java index ad1177f0b..1aa5f231d 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/table/AdjustMyStarredHandler.java +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/table/AdjustMyStarredHandler.java @@ -37,8 +37,6 @@ import org.eclipse.swt.widgets.Display; */ public class AdjustMyStarredHandler extends AbstractHandler { - private static final String COMMAND_MESSAGE = "Adjust Starred flag..."; - private GerritTask item = null; /* @@ -59,7 +57,7 @@ public class AdjustMyStarredHandler extends AbstractHandler { return null; } - final Job job = new Job(COMMAND_MESSAGE) { + final Job job = new Job(Messages.AdjustMyStarredHandler_commandMessage) { @Override protected IStatus run(IProgressMonitor monitor) { diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/table/Messages.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/table/Messages.java new file mode 100644 index 000000000..3f57447a6 --- /dev/null +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/table/Messages.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2014 Ericsson AB and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jacques Bouthillier - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands.table; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands.table.messages"; //$NON-NLS-1$ + + public static String AdjustMyStarredHandler_commandMessage; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/table/messages.properties b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/table/messages.properties new file mode 100644 index 000000000..3fa906ddc --- /dev/null +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/commands/table/messages.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2014 Ericsson AB and others. +# +# All rights reserved. This program and the accompanying materials are +# made available under the terms of the Eclipse Public License v1.0 which +# accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Jacques Bouthillier - Initial implementation +############################################################################### +AdjustMyStarredHandler_commandMessage=Adjust Starred flag... diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/menus/DynamicMenuAddition.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/menus/DynamicMenuAddition.java index 7cbb57155..974f60408 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/menus/DynamicMenuAddition.java +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/menus/DynamicMenuAddition.java @@ -45,7 +45,7 @@ public class DynamicMenuAddition extends CompoundContributionItem implements IWo /** * Field SELECT_PICTURE_FILE. (value is ""icons/select.gif"") */ - private static String SELECT_PICTURE_FILE = "icons/select.gif"; + private static String SELECT_PICTURE_FILE = "icons/select.gif"; //$NON-NLS-1$ // private static String IMAGE_ID = "imageId"; @@ -87,7 +87,7 @@ public class DynamicMenuAddition extends CompoundContributionItem implements IWo @Override protected IContributionItem[] getContributionItems() { - GerritPlugin.Ftracer.traceInfo("\t\t DynamicMenuAddition .getContributionItems()"); + GerritPlugin.Ftracer.traceInfo("\t\t DynamicMenuAddition .getContributionItems()"); //$NON-NLS-1$ CommandContributionItem[] contributionItems = new CommandContributionItem[0]; if (fServer != null) { fMapServer = fServer.getGerritMapping(); @@ -96,13 +96,13 @@ public class DynamicMenuAddition extends CompoundContributionItem implements IWo if (fMapServer != null && !fMapServer.isEmpty()) { Set<TaskRepository> mapSet = fMapServer.keySet(); String lastSelected = fServer.getLastSavedGerritServer(); - GerritPlugin.Ftracer.traceInfo("-------------------"); + GerritPlugin.Ftracer.traceInfo("-------------------"); //$NON-NLS-1$ int size = mapSet.size(); contributionItems = new CommandContributionItem[size]; int count = 0; for (TaskRepository key : mapSet) { - GerritPlugin.Ftracer.traceInfo("Map Key: " + key.getRepositoryLabel() + "\t URL: " + GerritPlugin.Ftracer.traceInfo("Map Key: " + key.getRepositoryLabel() + "\t URL: " //$NON-NLS-1$//$NON-NLS-2$ + fMapServer.get(key)); CommandContributionItemParameter contributionParameter = new CommandContributionItemParameter( fServiceLocator, fMapServer.get(key), UIConstants.ADD_GERRIT_SITE_COMMAND_ID, @@ -129,8 +129,6 @@ public class DynamicMenuAddition extends CompoundContributionItem implements IWo //Read the Gerrit potential servers fServer = GerritServerUtility.getInstance(); - GerritPlugin.Ftracer.traceInfo("\t\t DynamicMenuAddition .initialize()()"); - } } diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/Messages.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/Messages.java new file mode 100644 index 000000000..48daad74f --- /dev/null +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/Messages.java @@ -0,0 +1,43 @@ +/******************************************************************************* + * Copyright (c) 2014 Ericsson AB and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jacques Bouthillier - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.gerrit.dashboard.ui.internal.model; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.mylyn.gerrit.dashboard.ui.internal.model.messages"; //$NON-NLS-1$ + + public static String ReviewTableDefinition_branch; + + public static String ReviewTableDefinition_codeReview; + + public static String ReviewTableDefinition_id; + + public static String ReviewTableDefinition_owner; + + public static String ReviewTableDefinition_project; + + public static String ReviewTableDefinition_subject; + + public static String ReviewTableDefinition_updated; + + public static String ReviewTableDefinition_verify; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableDefinition.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableDefinition.java index 70213545a..7a552d511 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableDefinition.java +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/ReviewTableDefinition.java @@ -22,7 +22,6 @@ import org.eclipse.swt.SWT; /** * @author Jacques Bouthillier * @version $Revision: 1.0 $ - * */ // ------------------------------------------------------------------------ // Constants @@ -30,23 +29,27 @@ import org.eclipse.swt.SWT; // Definition of the review table list {name, width of the column, Resizeable, // Moveable} public enum ReviewTableDefinition { - // Name Width Resize Moveable - STARRED( "", 20, false, true, SWT.LEFT), - ID( "ID", 80, false, true, SWT.LEFT), - SUBJECT( "Subject", 200, true, true, SWT.LEFT), - OWNER( "Owner", 140, true, true, SWT.LEFT), - PROJECT( "Project", 200, true, true, SWT.LEFT), - BRANCH( "Branch", 100, true, true, SWT.LEFT), - UPDATED( "Updated", 100, true, true, SWT.RIGHT), - CR( "CR", 28, false, true, SWT.LEFT), + // Name Width Resize Moveable + STARRED("", 20, false, true, SWT.LEFT), //$NON-NLS-1$ + ID(Messages.ReviewTableDefinition_id, 80, false, true, SWT.LEFT), // + SUBJECT(Messages.ReviewTableDefinition_subject, 200, true, true, SWT.LEFT), // + OWNER(Messages.ReviewTableDefinition_owner, 140, true, true, SWT.LEFT), // + PROJECT(Messages.ReviewTableDefinition_project, 200, true, true, SWT.LEFT), // + BRANCH(Messages.ReviewTableDefinition_branch, 100, true, true, SWT.LEFT), // + UPDATED(Messages.ReviewTableDefinition_updated, 100, true, true, SWT.RIGHT), // + CR(Messages.ReviewTableDefinition_codeReview, 28, false, true, SWT.LEFT), // // IC( "IC", 28, false, true, SWT.LEFT), - VERIFY( "V", 28, false, true, SWT.LEFT); - - private final String fHeader; - private final int fwidth; + VERIFY(Messages.ReviewTableDefinition_verify, 28, false, true, SWT.LEFT); + + private final String fHeader; + + private final int fwidth; + private final boolean fResize; + private final boolean fMoveable; - private final int fAlignment; + + private final int fAlignment; private ReviewTableDefinition(String aName, int aWidth, boolean aResize, boolean aMove, int align) { fHeader = aName; 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 4afa3f913..fb60d0ea5 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 @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright (c) 2013 Ericsson - * + * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v1.0 which * accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Jacques Bouthillier - Initial Implementation of the label provider ******************************************************************************/ @@ -25,7 +25,7 @@ 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 $ */ @@ -35,25 +35,25 @@ public class ReviewTableLabelProvider extends LabelProvider implements ITableLab // Constants // ------------------------------------------------------------------------ - private final String EMPTY_STRING = ""; + private final String EMPTY_STRING = ""; //$NON-NLS-1$ // +2 Names of images used to represent review-checked - public static final String CHECKED_IMAGE = "greenCheck"; + public static final String CHECKED_IMAGE = "greenCheck.png"; //$NON-NLS-1$ // -2 Names of images used to represent review-not OK - public static final String NOT_OK_IMAGE = "redNot"; + public static final String NOT_OK_IMAGE = "redNot.png"; //$NON-NLS-1$ // -1 - public static final String MINUS_ONE = "minusOne"; + public static final String MINUS_ONE = "minusOne.png"; //$NON-NLS-1$ // +1 - public static final String PLUS_ONE = "plusOne"; + public static final String PLUS_ONE = "plusOne.png"; //$NON-NLS-1$ // Names of images used to represent STAR FILLED - public static final String STAR_FILLED = "starFilled"; + public static final String STAR_FILLED = "starFilled.gif"; //$NON-NLS-1$ // Names of images used to represent STAR OPEN - public static final String STAR_OPEN = "starOpen"; + public static final String STAR_OPEN = "starOpen.gif"; //$NON-NLS-1$ // Value stored to define the state of the review item. public static final int NOT_OK_IMAGE_STATE = -2; @@ -87,19 +87,19 @@ public class ReviewTableLabelProvider extends LabelProvider implements ITableLab */ static { - String iconPath = "icons/view16/"; + String iconPath = "icons/view16/"; //$NON-NLS-1$ - fImageRegistry.put(CHECKED_IMAGE, GerritUi.getImageDescriptor(iconPath + CHECKED_IMAGE + ".png")); + fImageRegistry.put(CHECKED_IMAGE, GerritUi.getImageDescriptor(iconPath + CHECKED_IMAGE)); - fImageRegistry.put(NOT_OK_IMAGE, GerritUi.getImageDescriptor(iconPath + NOT_OK_IMAGE + ".png")); + fImageRegistry.put(NOT_OK_IMAGE, GerritUi.getImageDescriptor(iconPath + NOT_OK_IMAGE)); - fImageRegistry.put(MINUS_ONE, GerritUi.getImageDescriptor(iconPath + MINUS_ONE + ".png")); + fImageRegistry.put(MINUS_ONE, GerritUi.getImageDescriptor(iconPath + MINUS_ONE)); - fImageRegistry.put(PLUS_ONE, GerritUi.getImageDescriptor(iconPath + PLUS_ONE + ".png")); + fImageRegistry.put(PLUS_ONE, GerritUi.getImageDescriptor(iconPath + PLUS_ONE)); - fImageRegistry.put(STAR_FILLED, GerritUi.getImageDescriptor(iconPath + STAR_FILLED + ".gif")); + fImageRegistry.put(STAR_FILLED, GerritUi.getImageDescriptor(iconPath + STAR_FILLED)); - fImageRegistry.put(STAR_OPEN, GerritUi.getImageDescriptor(iconPath + STAR_OPEN + ".gif")); + fImageRegistry.put(STAR_OPEN, GerritUi.getImageDescriptor(iconPath + STAR_OPEN)); } // ------------------------------------------------------------------------ @@ -114,7 +114,7 @@ public class ReviewTableLabelProvider extends LabelProvider implements ITableLab /** * Return an image representing the state of the object - * + * * @param int aState * @return Image */ @@ -138,7 +138,7 @@ public class ReviewTableLabelProvider extends LabelProvider implements ITableLab /** * Return an image representing the state of the object - * + * * @param int aState * @return Image */ @@ -160,7 +160,7 @@ public class ReviewTableLabelProvider extends LabelProvider implements ITableLab /** * Return an image representing the state of the ID object - * + * * @param Boolean * aState * @return Image @@ -177,7 +177,7 @@ public class ReviewTableLabelProvider extends LabelProvider implements ITableLab /** * Return the text associated to the column - * + * * @param Object * structure of the table * @param int column index @@ -215,13 +215,13 @@ public class ReviewTableLabelProvider extends LabelProvider implements ITableLab // if (null != value && !value.equals(EMPTY_STRING)) { // return formatValue (value); // } -// return EMPTY_STRING; +// return EMPTY_STRING; // case 9: // value = reviewSummary.getAttribute(GerritTask.VERIFY_STATE); // if (null != value && !value.equals(EMPTY_STRING)) { // return formatValue (value); // } -// return EMPTY_STRING; +// return EMPTY_STRING; default: return EMPTY_STRING; } @@ -240,13 +240,13 @@ public class ReviewTableLabelProvider extends LabelProvider implements ITableLab // String st = "+" + aSt; // return st; // } -// return aSt; +// return aSt; // // } /** * Return the image associated to the column - * + * * @param Object * structure of the table * @param int column index @@ -313,7 +313,7 @@ public class ReviewTableLabelProvider extends LabelProvider implements ITableLab /** * Adjust the column color - * + * * @param Object * ReviewTableListItem * @param int columnIndex @@ -330,21 +330,21 @@ public class ReviewTableLabelProvider extends LabelProvider implements ITableLab // st = item.getAttribute(GerritTask.REVIEW_STATE); // if (st != null) { // value = st.equals(EMPTY_STRING) ? 0 : Integer -// .parseInt(st); +// .parseInt(st); // } break; case 8: // ReviewTableDefinition.IC.ordinal(): // st = item.getAttribute(GerritTask.IS_IPCLEAN); // if (st != null) { // value = st.equals(EMPTY_STRING) ? 0 : Integer -// .parseInt(st); +// .parseInt(st); // } // break; // case 9: // ReviewTableDefinition.VERIFY.ordinal(): // st = item.getAttribute(GerritTask.VERIFY_STATE); // if (st != null) { // value = st.equals(EMPTY_STRING) ? 0 : Integer -// .parseInt(st); +// .parseInt(st); // } break; } @@ -370,10 +370,10 @@ public class ReviewTableLabelProvider extends LabelProvider implements ITableLab // To modify when we can verify the review state String state = item.getAttribute(GerritTask.IS_STARRED); if (state != null) { - if (state.equals("true")) { + if (state.equals(Boolean.toString(true))) { return INCOMING_COLOR; - } else if (state.equals("false")) { + } else if (state.equals(Boolean.toString(false))) { return CLOSED_COLOR; } } 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 fbb91c691..18aa5724d 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 @@ -1,11 +1,11 @@ /******************************************************************************* * Copyright (c) 2013 Ericsson - * + * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v1.0 which * accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * Jacques Bouthillier - Initial Implementation of the table view ******************************************************************************/ @@ -13,15 +13,19 @@ package org.eclipse.mylyn.gerrit.dashboard.ui.internal.model; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.TableLayout; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.mylyn.commons.core.StatusHandler; import org.eclipse.mylyn.gerrit.dashboard.core.GerritTask; import org.eclipse.mylyn.gerrit.dashboard.ui.GerritUi; import org.eclipse.mylyn.gerrit.dashboard.ui.internal.commands.table.AdjustMyStarredHandler; import org.eclipse.mylyn.gerrit.dashboard.ui.internal.utils.UIUtils; +import org.eclipse.mylyn.internal.gerrit.core.GerritCorePlugin; import org.eclipse.mylyn.tasks.core.IAttributeContainer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ControlEvent; @@ -40,7 +44,7 @@ import org.eclipse.swt.widgets.TableItem; /** * This class implements the implementation of the review table view. - * + * * @author Jacques Bouthillier */ public class UIReviewTable { @@ -105,14 +109,11 @@ public class UIReviewTable { @Override public void widgetSelected(SelectionEvent e) { - // TODO Auto-generated method stub - GerritUi.Ftracer.traceInfo("Table selection: " + e.toString()); + GerritUi.Ftracer.traceInfo("Table selection: " + e.toString()); //$NON-NLS-1$ } @Override public void widgetDefaultSelected(SelectionEvent e) { - // TODO Auto-generated method stub - } }); @@ -125,7 +126,7 @@ public class UIReviewTable { /** * Create each column for the List of Reviews - * + * * @param aParent * @param aViewer */ @@ -135,10 +136,10 @@ public class UIReviewTable { //Get the review table definition ReviewTableDefinition[] tableInfo = ReviewTableDefinition.values(); int size = tableInfo.length; - GerritUi.Ftracer.traceInfo("Table Name Width Resize Moveable"); + GerritUi.Ftracer.traceInfo("Table Name Width Resize Moveable"); //$NON-NLS-1$ for (int index = 0; index < size; index++) { - GerritUi.Ftracer.traceInfo("index [ " + index + " ] " + tableInfo[index].getName() + "\t: " - + tableInfo[index].getWidth() + "\t: " + tableInfo[index].getResize() + "\t: " + GerritUi.Ftracer.traceInfo("index [ " + index + " ] " + tableInfo[index].getName() + "\t: " //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + + tableInfo[index].getWidth() + "\t: " + tableInfo[index].getResize() + "\t: " //$NON-NLS-1$ //$NON-NLS-2$ + tableInfo[index].getMoveable()); TableViewerColumn col = createTableViewerColumn(tableInfo[index]); @@ -202,7 +203,7 @@ public class UIReviewTable { /** * Create each column in the review table list - * + * * @param ReviewTableDefinition * @return TableViewerColumn */ @@ -220,7 +221,7 @@ public class UIReviewTable { private final Listener mouseButtonListener = new Listener() { public void handleEvent(Event aEvent) { - GerritUi.Ftracer.traceInfo("mouseButtonListener() for " + aEvent.button); + GerritUi.Ftracer.traceInfo("mouseButtonListener() for " + aEvent.button); //$NON-NLS-1$ switch (aEvent.type) { case SWT.MouseDown: // Left Click @@ -246,9 +247,9 @@ public class UIReviewTable { AdjustMyStarredHandler handler = new AdjustMyStarredHandler(); try { handler.execute(new ExecutionEvent()); - } catch (ExecutionException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + } catch (ExecutionException excutionException) { + StatusHandler.log(new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, + excutionException.getMessage(), excutionException)); } } // Right Click @@ -269,19 +270,16 @@ public class UIReviewTable { */ private void processItemSelection() { ISelection tableSelection = fViewer.getSelection(); - GerritUi.Ftracer.traceInfo("Selected : " + tableSelection.getClass()); if (!tableSelection.isEmpty()) { if (tableSelection instanceof IStructuredSelection) { Object obj = ((IStructuredSelection) tableSelection).getFirstElement(); - GerritUi.Ftracer.traceInfo("Selected table selection class: " + obj.getClass()); if (obj instanceof GerritTask) { IAttributeContainer item = (IAttributeContainer) obj; - GerritUi.Ftracer.traceInfo("Selected table OBJECT selection ID: " - + item.getAttribute(GerritTask.SHORT_CHANGE_ID) + "\t subject: " + GerritUi.Ftracer.traceInfo("Selected table OBJECT selection ID: " //$NON-NLS-1$ + + item.getAttribute(GerritTask.SHORT_CHANGE_ID) + "\t subject: " //$NON-NLS-1$ + item.getAttribute(GerritTask.SUBJECT)); } } } } - } diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/messages.properties b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/messages.properties new file mode 100644 index 000000000..f83a8df9b --- /dev/null +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/model/messages.properties @@ -0,0 +1,19 @@ +############################################################################### +# Copyright (c) 2014 Ericsson AB and others. +# +# All rights reserved. This program and the accompanying materials are +# made available under the terms of the Eclipse Public License v1.0 which +# accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Jacques Bouthillier - Initial implementation +############################################################################### +ReviewTableDefinition_branch=Branch +ReviewTableDefinition_codeReview=CR +ReviewTableDefinition_id=ID +ReviewTableDefinition_owner=Owner +ReviewTableDefinition_project=Project +ReviewTableDefinition_subject=Subject +ReviewTableDefinition_updated=Updated +ReviewTableDefinition_verify=V 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 bcda80970..276bd1109 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 @@ -1,14 +1,14 @@ /******************************************************************************* * Copyright (c) 2013 Ericsson - * + * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v1.0 which * 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 ******************************************************************************/ @@ -58,22 +58,22 @@ public class GerritServerUtility { /** * Field LAST_GERRIT_FILE. (value is ""lastGerrit.txt"") */ - private static final String LAST_GERRIT_FILE = "lastGerrit.txt"; + private static final String LAST_GERRIT_FILE = "lastGerrit.txt"; //$NON-NLS-1$ /** * Field LAST_COMMANDS_FILE. (value is ""lastCommands.txt"") */ - private static final String LAST_COMMANDS_FILE = "lastCommands.txt"; + private static final String LAST_COMMANDS_FILE = "lastCommands.txt"; //$NON-NLS-1$ /** * Field ECLIPSE_GERRIT_DEFAULT. (value is ""https://git.eclipse.org/r/"") */ - private final String ECLIPSE_GERRIT_DEFAULT = "https://git.eclipse.org/r/"; + private final String ECLIPSE_GERRIT_DEFAULT = "https://git.eclipse.org/r/"; //$NON-NLS-1$ /** * Field SLASH. (value is ""/"") */ - private final String SLASH = "/"; + private final String SLASH = "/"; //$NON-NLS-1$ // ------------------------------------------------------------------------ // Variables @@ -103,7 +103,7 @@ public class GerritServerUtility { /** * Build a list of Gerrit server to display in the combo box in the dialogue window - * + * * @param aTaskRepo */ private void adjustTemplatemanager(TaskRepository aTaskRepo) { @@ -113,8 +113,8 @@ public class GerritServerUtility { // printTaskRepository(aTaskRepo); for (RepositoryTemplate template : templateManager.getTemplates(GerritConnector.CONNECTOR_KIND)) { String convertedRemoteURL = aTaskRepo.getRepositoryUrl(); - GerritPlugin.Ftracer.traceInfo("\t template.label: " + template.label + "\t repo label: " - + aTaskRepo.getRepositoryLabel() + " repo getname: " + convertedRemoteURL); + GerritPlugin.Ftracer.traceInfo("\t template.label: " + template.label + "\t repo label: " //$NON-NLS-1$ //$NON-NLS-2$ + + aTaskRepo.getRepositoryLabel() + " repo getname: " + convertedRemoteURL); //$NON-NLS-1$ //Test the name and the remoteURL to reduce duplications if (template.label.equals(aTaskRepo.getRepositoryLabel()) || template.repositoryUrl.equals(convertedRemoteURL)) { @@ -130,10 +130,10 @@ public class GerritServerUtility { //Create a repository template RepositoryTemplate templateTest = new RepositoryTemplate(aTaskRepo.getRepositoryLabel(), - aTaskRepo.getRepositoryUrl(), aTaskRepo.getCharacterEncoding(), aTaskRepo.getVersion(), "", "", "", + aTaskRepo.getRepositoryUrl(), aTaskRepo.getCharacterEncoding(), aTaskRepo.getVersion(), "", "", "", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ aTaskRepo.getUserName(), anonymous, true); - //Set the attributes + //Set the attributes Map<String, String> attributes = aTaskRepo.getProperties(); Set<Entry<String, String>> value = attributes.entrySet(); @@ -149,11 +149,11 @@ public class GerritServerUtility { RepositoryTemplateManager templateManager = TasksUiPlugin.getRepositoryTemplateManager(); if (templateManager != null) { for (RepositoryTemplate template : templateManager.getTemplates(GerritConnector.CONNECTOR_KIND)) { - GerritPlugin.Ftracer.traceInfo("------------======================------------------"); + GerritPlugin.Ftracer.traceInfo("------------======================------------------"); //$NON-NLS-1$ Set<Entry<String, String>> value = template.getAttributes().entrySet(); if (value != null) { for (Map.Entry<String, String> entry : value) { - GerritPlugin.Ftracer.traceInfo("key: " + entry.getKey() + "\tvalue: " + entry.getValue()); + GerritPlugin.Ftracer.traceInfo("key: " + entry.getKey() + "\tvalue: " + entry.getValue()); //$NON-NLS-1$//$NON-NLS-2$ } } } @@ -162,7 +162,7 @@ public class GerritServerUtility { /** * Build and return the File storing the persistent data - * + * * @param String * aFile * @return File @@ -176,7 +176,7 @@ public class GerritServerUtility { /** * Build a URL for Gerrit documentation - * + * * @param aRequest * specific documentation * @return URL complete URL fo the selected site based on the Gerrit server and version @@ -200,7 +200,7 @@ public class GerritServerUtility { /** * Search for a similar page in the eclipse editor - * + * * @param aUrl * @return String */ @@ -227,7 +227,7 @@ public class GerritServerUtility { /** * Return the mapping of the available Gerrit server used in the user workspace - * + * * @return Map<Repository, String> */ public Map<TaskRepository, String> getGerritMapping() { @@ -241,19 +241,19 @@ public class GerritServerUtility { TaskRepositoryManager repositoryManager = TasksUiPlugin.getRepositoryManager(); if (repositoryManager != null) { //Only get the TaskRepository related to Gerrit review connnector - GerritPlugin.Ftracer.traceInfo("--------Review repo ---------------"); + GerritPlugin.Ftracer.traceInfo("--------Review repo ---------------"); //$NON-NLS-1$ Set<TaskRepository> reviewRepo = repositoryManager.getRepositories(GerritConnector.CONNECTOR_KIND); if (reviewRepo != null) { for (TaskRepository taskRepo : reviewRepo) { - GerritPlugin.Ftracer.traceInfo("Add Gerrit Review repo: " + taskRepo.getRepositoryLabel() - + "\t url: " + taskRepo.getRepositoryUrl()); + GerritPlugin.Ftracer.traceInfo("Add Gerrit Review repo: " + taskRepo.getRepositoryLabel() //$NON-NLS-1$ + + "\t url: " + taskRepo.getRepositoryUrl()); //$NON-NLS-1$ fResultTask.put(taskRepo, taskRepo.getRepositoryUrl()); if (null != taskRepo.getRepositoryUrl()) { adjustTemplatemanager(taskRepo); } } } - //Print a the end the info for all Gerrit + //Print a the end the info for all Gerrit printRepositoryTemplate(); } @@ -262,7 +262,7 @@ public class GerritServerUtility { /** * Save the selected Gerrit server URL - * + * * @param aURL * @return Boolean */ @@ -284,7 +284,7 @@ public class GerritServerUtility { /** * Return the last selected Gerrit server used - * + * * @return String */ public String getLastSavedGerritServer() { @@ -297,7 +297,7 @@ public class GerritServerUtility { lastGerritURL = in.readLine(); in.close(); } catch (IOException e1) { - //When there is no file, + //When there is no file, //e1.printStackTrace(); } } @@ -306,7 +306,7 @@ public class GerritServerUtility { /** * Get the Gerrit URL based on the provided string - * + * * @param Menu * string aSt * @return URL as a string @@ -316,12 +316,12 @@ public class GerritServerUtility { fResultTask = getGerritMapping(); if (!fResultTask.isEmpty()) { Set<TaskRepository> mapSet = fResultTask.keySet(); - GerritPlugin.Ftracer.traceInfo("-------------------"); + GerritPlugin.Ftracer.traceInfo("-------------------"); //$NON-NLS-1$ for (TaskRepository key : mapSet) { if (key.getRepositoryLabel().equals(aSt)) { urlStr = fResultTask.get(key); - GerritPlugin.Ftracer.traceInfo("Map Key: " + key.getRepositoryLabel() + "\t URL: " + GerritPlugin.Ftracer.traceInfo("Map Key: " + key.getRepositoryLabel() + "\t URL: " //$NON-NLS-1$//$NON-NLS-2$ + fResultTask.get(key)); return urlStr; } @@ -333,7 +333,7 @@ public class GerritServerUtility { /** * Get the Gerrit task Repository - * + * * @param string * aSt * @return TaskRepository @@ -342,11 +342,11 @@ public class GerritServerUtility { fResultTask = getGerritMapping(); if (aStURL != null && !fResultTask.isEmpty()) { Set<TaskRepository> mapSet = fResultTask.keySet(); - GerritPlugin.Ftracer.traceInfo("-------------------"); + GerritPlugin.Ftracer.traceInfo("-------------------"); //$NON-NLS-1$ for (TaskRepository key : mapSet) { if (key.getRepositoryUrl().equals(aStURL)) { - GerritPlugin.Ftracer.traceInfo("Key label : " + key.getRepositoryLabel() + "\t URL: " + GerritPlugin.Ftracer.traceInfo("Key label : " + key.getRepositoryLabel() + "\t URL: " //$NON-NLS-1$ //$NON-NLS-2$ + fResultTask.get(key)); return key; } @@ -358,7 +358,7 @@ public class GerritServerUtility { /** * Open the web browser for the specific documentation - * + * * @param String * aDocumentation requested documentation */ @@ -373,24 +373,22 @@ public class GerritServerUtility { url = buildDocumentationURL(aDocumentation); try { - //Using NULL as a browser id will create a new editor each time, + //Using NULL as a browser id will create a new editor each time, //so we need to see if there is already an editor for this help String id = getEditorId(url); workBenchSupport.createBrowser(id).openURL(url); } catch (PartInitException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } catch (MalformedURLException e1) { - // TODO Auto-generated catch block e1.printStackTrace(); } - GerritUi.Ftracer.traceInfo("openWebBrowser for " + url); + GerritUi.Ftracer.traceInfo("openWebBrowser for " + url); //$NON-NLS-1$ } /** * Save the list of the last 5 commands - * + * * @param LinkedHashSet * <String> * @return Boolean @@ -418,7 +416,7 @@ public class GerritServerUtility { /** * Return the list of the last commands saved - * + * * @return Set */ public Set<String> getListLastCommands() { @@ -434,54 +432,11 @@ public class GerritServerUtility { } in.close(); } catch (IOException e1) { - //When there is no file, + //When there is no file, //e1.printStackTrace(); } } return lastCommands; } - /** - * 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(); -// // List<GerritReviewSummary> reviews = getReviewListFromRepository(repository, GerritQuery.MY_WATCHED_CHANGES); -// // 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" ); -// } - } -// -// /** -// * -// */ -// public static List<GerritReviewSummary> getReviewListFromRepository(TaskRepository repository, String query) { -// List<GerritReviewSummary> results = new ArrayList<GerritReviewSummary>(); -// GerritQueryHandler handler = new GerritQueryHandler(repository, query); -// IStatus status = handler.performQuery(); -// if (status.isOK()) { -// for (GerritReviewSummary summary : handler.getQueryResult()) { -// if (summary.getAttribute(GerritReviewSummary.DATE_COMPLETION) == null) { -// GerritPlugin.Ftracer.traceInfo(summary.toString()); -// results.add(summary); -// } -// } -// } -// return results; -// } - } diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/Messages.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/Messages.java new file mode 100644 index 000000000..a0b8b556b --- /dev/null +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/Messages.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2014 Ericsson AB and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jacques Bouthillier - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.gerrit.dashboard.ui.internal.utils; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.mylyn.gerrit.dashboard.ui.internal.utils.messages"; //$NON-NLS-1$ + + public static String SelectionDialog_question; + + public static String SelectionDialog_selectTitle; + + public static String UIUtils_dashboardInfo; + + public static String UIUtils_dashboardInformation; + + public static String UIUtils_methodNotReady; + + public static String UIUtils_notImplemented; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/SelectionDialog.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/SelectionDialog.java index a432be9d6..3ed388d94 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/SelectionDialog.java +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/SelectionDialog.java @@ -37,10 +37,6 @@ public class SelectionDialog extends FormDialog { private String fSelection = null; - private final String fTitle = "Select a Gerit server"; - - private final String fQuestion = "Question ? "; - public SelectionDialog(Shell parent, List<TaskRepository> listTaskRepository) { super(parent); this.fListTaskRepository = listTaskRepository; @@ -48,8 +44,8 @@ public class SelectionDialog extends FormDialog { @Override protected void createFormContent(final IManagedForm mform) { - mform.getForm().setText(fTitle); - mform.getForm().getShell().setText(fQuestion); + mform.getForm().setText(Messages.SelectionDialog_selectTitle); + mform.getForm().getShell().setText(Messages.SelectionDialog_question); final ScrolledForm sform = mform.getForm(); sform.setExpandHorizontal(true); diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/UIConstants.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/UIConstants.java index 34d4a287d..3fb57b3ea 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/UIConstants.java +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/UIConstants.java @@ -1,23 +1,22 @@ // $codepro.audit.disable com.instantiations.assist.eclipse.analysis.audit.rule.effectivejava.alwaysOverridetoString.alwaysOverrideToString, com.instantiations.assist.eclipse.analysis.deserializeabilitySecurity, com.instantiations.assist.eclipse.analysis.enforceCloneableUsageSecurity /******************************************************************************* * Copyright (c) 2013 Ericsson AB and others. - * + * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v1.0 which * accompanies this distribution, and is available at> * http://www.eclipse.org/legal/epl-v10.html - * + * * Description: - * + * * This class defines various constants used in the Gerrit Dashboard UI plugin - * + * * Contributors: * Jacques Bouthillier - Add some definitions for Mylyn Review Gerrit Dashboard project - * + * ******************************************************************************/ package org.eclipse.mylyn.gerrit.dashboard.ui.internal.utils; -import java.util.TimeZone; /** * @authot Jacques Bouthillier @@ -25,40 +24,6 @@ import java.util.TimeZone; */ public class UIConstants { // $codepro.audit.disable convertClassToInterface - // ------------------------------------------------------------------------ - // Constants - // ------------------------------------------------------------------------ - - /** - * Field TIME_ZONE_OFFSET. (value is "TimeZone.getDefault().getOffset(System.currentTimeMillis()") - */ - public final static long TIME_ZONE_OFFSET = TimeZone.getDefault().getOffset(System.currentTimeMillis()); - - //Test Constants - /** - * Field DASHBOARD_UI_JOB_FAMILY. - */ - public static final String DASHBOARD_UI_JOB_FAMILY = "DASHBOARD_UI"; - - /** - * Field DEFAULT_REPOSITORY. (value is ""https://"") - */ - public static final String DEFAULT_REPOSITORY = "https://"; - - /** - * Field ADD_GERRIT_SITE_COMMAND_ID. (value is ""org.eclipse.mylyn.gerrit.dashboard.ui.addGerritSite"") - */ - public static final String ADD_GERRIT_SITE_COMMAND_ID = "org.eclipse.mylyn.gerrit.dashboard.ui.addGerritSite"; - - /** - * Field ADJUST_MY_STARRED_NAME. (value is ""Star Review"") - */ - public static final String ADJUST_MY_STARRED_NAME = "Star Review"; - - //Test Constants - /** - * Field ADJUST_MY_STARRED_COMMAND_ID. (value is ""org.eclipse.mylyn.gerrit.dashboard.ui.adjustMyStarred"") - */ - public static final String ADJUST_MY_STARRED_COMMAND_ID = "org.eclipse.mylyn.gerrit.dashboard.ui.adjustMyStarred"; + public static final String ADD_GERRIT_SITE_COMMAND_ID = "org.eclipse.mylyn.gerrit.dashboard.ui.addGerritSite"; //$NON-NLS-1$ } 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 0f36128c8..cb928dc99 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 @@ -19,13 +19,13 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.mylyn.gerrit.dashboard.ui.GerritUi; +import org.eclipse.osgi.util.NLS; import org.eclipse.swt.layout.FormLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; /** * @author Jacques Bouthillier - * @version $Revision: 1.0 $ */ public class UIUtils { @@ -36,10 +36,10 @@ public class UIUtils { * @param String */ public static void notInplementedDialog(String aSt) { - GerritUi.Ftracer.traceWarning("Not Implemented yet"); - final ErrorDialog dialog = new ErrorDialog(null, "Gerrit Dashboard Information", "This method [ " + aSt - + " ] is not ready yet", new Status(IStatus.INFO, GerritUi.PLUGIN_ID, 0, "Not Implemented yet", null), - IStatus.INFO); + GerritUi.Ftracer.traceWarning(Messages.UIUtils_notImplemented); + final ErrorDialog dialog = new ErrorDialog(null, Messages.UIUtils_dashboardInformation, NLS.bind( + Messages.UIUtils_methodNotReady, aSt), new Status(IStatus.INFO, GerritUi.PLUGIN_ID, 0, + Messages.UIUtils_notImplemented, null), IStatus.INFO); Display.getDefault().syncExec(new Runnable() { public void run() { dialog.open(); @@ -58,7 +58,7 @@ public class UIUtils { */ public static void showErrorDialog(String aMsg, String aReason) { GerritUi.Ftracer.traceWarning(aMsg + "\t reason: " + aReason); - final ErrorDialog dialog = new ErrorDialog(null, "Gerrit Dashboard Info", aMsg, new Status(IStatus.INFO, + final ErrorDialog dialog = new ErrorDialog(null, Messages.UIUtils_dashboardInfo, aMsg, new Status(IStatus.INFO, GerritUi.PLUGIN_ID, 0, aReason, null), IStatus.INFO); Display.getDefault().syncExec(new Runnable() { public void run() { diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/messages.properties b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/messages.properties new file mode 100644 index 000000000..e4471683e --- /dev/null +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/internal/utils/messages.properties @@ -0,0 +1,17 @@ +############################################################################### +# Copyright (c) 2014 Ericsson AB and others. +# +# All rights reserved. This program and the accompanying materials are +# made available under the terms of the Eclipse Public License v1.0 which +# accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Jacques Bouthillier - Initial implementation +############################################################################### +SelectionDialog_question=Question ? +SelectionDialog_selectTitle=Select a Gerrit server +UIUtils_dashboardInfo=Gerrit Dashboard Info +UIUtils_dashboardInformation=Gerrit Dashboard Information +UIUtils_methodNotReady=This method [ {0} ] is not ready yet +UIUtils_notImplemented=Not Implemented yet diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/views/GerritTableView.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/views/GerritTableView.java index 4b792581a..8cc2f8a4c 100644 --- a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/views/GerritTableView.java +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/views/GerritTableView.java @@ -52,7 +52,6 @@ import org.eclipse.mylyn.gerrit.dashboard.ui.internal.model.ReviewTableData; import org.eclipse.mylyn.gerrit.dashboard.ui.internal.model.UIReviewTable; import org.eclipse.mylyn.gerrit.dashboard.ui.internal.utils.GerritServerUtility; import org.eclipse.mylyn.gerrit.dashboard.ui.internal.utils.SelectionDialog; -import org.eclipse.mylyn.gerrit.dashboard.ui.internal.utils.UIConstants; import org.eclipse.mylyn.gerrit.dashboard.ui.internal.utils.UIUtils; import org.eclipse.mylyn.internal.gerrit.core.GerritConnector; import org.eclipse.mylyn.internal.gerrit.core.GerritCorePlugin; @@ -97,6 +96,8 @@ import org.eclipse.ui.part.ViewPart; import org.eclipse.ui.services.IServiceLocator; import org.osgi.framework.Version; +import com.google.common.base.Strings; + /** * This class initiate a new workbench view. The view shows data obtained from Gerrit Dashboard model. The view is * connected to the model using a content provider. @@ -115,24 +116,16 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener // ------------------------------------------------------------------------ //Constant to move to GerritQuery.java. Those values need to match the Gerrit request in GerritClient - public static final String MY_CHANGES_STRING = "owner:self OR reviewer:self"; + public static final String MY_CHANGES_STRING = "owner:self OR reviewer:self"; //$NON-NLS-1$ - public static final String MY_WATCHED_CHANGES_STRING = "is:watched status:open"; + public static final String MY_WATCHED_CHANGES_STRING = "is:watched status:open"; //$NON-NLS-1$ - public static final String ALL_OPEN_CHANGES_STRING = "status:open"; + public static final String ALL_OPEN_CHANGES_STRING = "status:open"; //$NON-NLS-1$ /** * The ID of the view as specified by the extension. */ - public static final String VIEW_ID = "org.eclipse.mylyn.gerrit.dashboard.ui.views.GerritTableView"; - - private static final String COMMAND_MESSAGE = "Search Gerrit info ..."; - - private static final String SEARCH_BTN = "Search"; - - private static final String TOTAL_COUNT = "Total reviews: "; - - private static final String GERRIT_LABEL = " - Gerrit "; + public static final String VIEW_ID = "org.eclipse.mylyn.gerrit.dashboard.ui.views.GerritTableView"; //$NON-NLS-1$ private static final int SEARCH_WIDTH = 350; @@ -140,13 +133,11 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener private static final int VERSION_WIDTH = 35; - private static final String SEARCH_TOOLTIP = "Ex. status:open (or is:open) \n status:merged \n " - + "is:draft \n status:open project:Foo \n " + "See explanation by selecting in the toolbar \n " - + "Documentation > Searching"; - //Numbers of menu items in the Search pulldown menu; SEARCH_SIZE_MENU_LIST + 1 will be the max private static final int SEARCH_SIZE_MENU_LIST = 4; + private static final String ADJUST_MY_STARRED_COMMAND_ID = "org.eclipse.mylyn.gerrit.dashboard.ui.adjustMyStarred"; //$NON-NLS-1$ + // ------------------------------------------------------------------------ // Member variables // ------------------------------------------------------------------------ @@ -296,7 +287,7 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener hookDoubleClickAction(); // Start the periodic refresh job - fTableRefreshJob = new TableRefreshJob(fViewer, "Refresh table"); + fTableRefreshJob = new TableRefreshJob(fViewer, Messages.GerritTableView_refreshTable); // Listen on query results TasksUiPlugin.getTaskList().addChangeListener(this); @@ -360,7 +351,7 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener //Label to display Total reviews fReviewsTotalLabel = new Label(leftSearchForm, SWT.NONE); - fReviewsTotalLabel.setText(TOTAL_COUNT); + fReviewsTotalLabel.setText(Messages.GerritTableView_totalReview); fReviewsTotalResultLabel = new Label(leftSearchForm, SWT.NONE); fReviewsTotalResultLabel.setLayoutData(new GridData(VERSION_WIDTH, SWT.DEFAULT)); @@ -379,10 +370,10 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener //Create a SEARCH text data entry fSearchRequestText = new Combo(rightSsearchForm, SWT.NONE); fSearchRequestText.setLayoutData(new GridData(SEARCH_WIDTH, SWT.DEFAULT)); - fSearchRequestText.setToolTipText(SEARCH_TOOLTIP); + fSearchRequestText.setToolTipText(Messages.GerritTableView_tooltipSearch); //Get the last saved commands fRequestList = fServerUtil.getListLastCommands(); - setSearchText(""); + setSearchText(""); //$NON-NLS-1$ //Handle the CR in the search text fSearchRequestText.addListener(SWT.DefaultSelection, new Listener() { @@ -397,7 +388,7 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener //Create a SEARCH button fSearchRequestBtn = new Button(rightSsearchForm, SWT.NONE); - fSearchRequestBtn.setText(SEARCH_BTN); + fSearchRequestBtn.setText(Messages.GerritTableView_search); fSearchRequestBtn.addListener(SWT.Selection, new Listener() { @Override @@ -409,7 +400,7 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener } private void hookContextMenu() { - MenuManager menuMgr = new MenuManager("#PopupMenu"); + MenuManager menuMgr = new MenuManager(Messages.GerritTableView_popupMenu); menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(new IMenuListener() { public void menuAboutToShow(IMenuManager manager) { @@ -486,10 +477,9 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener IServiceLocator serviceLocator = getViewSite().getActionBars().getServiceLocator(); CommandContributionItem[] contributionItems = new CommandContributionItem[1]; CommandContributionItemParameter contributionParameter = new CommandContributionItemParameter(serviceLocator, - UIConstants.ADJUST_MY_STARRED_NAME, UIConstants.ADJUST_MY_STARRED_COMMAND_ID, - CommandContributionItem.STYLE_PUSH); + Messages.GerritTableView_starredName, ADJUST_MY_STARRED_COMMAND_ID, CommandContributionItem.STYLE_PUSH); - contributionParameter.label = UIConstants.ADJUST_MY_STARRED_NAME; + contributionParameter.label = Messages.GerritTableView_starredName; contributionParameter.visibleEnabled = true; contributionItems[0] = new CommandContributionItem(contributionParameter); @@ -502,7 +492,7 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener } public TaskRepository getTaskRepository() { - processCommands(""); //To initialize the fTaskRepository + processCommands(""); //To initialize the fTaskRepository //$NON-NLS-1$ return fTaskRepository; } @@ -602,10 +592,10 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener //We should have a TaskRepository here, otherwise, the user need to define one if (fTaskRepository == null) { - UIUtils.showErrorDialog("You need to define a Gerrit repository.", - "No Gerrit repository has been selected yet."); + UIUtils.showErrorDialog(Messages.GerritTableView_defineRepository, + Messages.GerritTableView_noGerritRepository); } else { - if (aQuery != null && !aQuery.equals("")) { + if (aQuery != null && !aQuery.equals("")) { //$NON-NLS-1$ updateTable(fTaskRepository, aQuery); } } @@ -620,8 +610,8 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener */ public void setStarred(String taskID, boolean starred, IProgressMonitor progressMonitor) throws CoreException { if (fTaskRepository == null) { - UIUtils.showErrorDialog("You need to define a Gerrit repository.", - "No Gerrit repository has been selected yet."); + UIUtils.showErrorDialog(Messages.GerritTableView_defineRepository, + Messages.GerritTableView_noGerritRepository); } else { fConnector.setStarred(fTaskRepository, taskID, starred, progressMonitor); } @@ -662,7 +652,7 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener GerritClient gerritClient = fConnector.getClient(fTaskRepository); try { version = gerritClient.getVersion(new NullProgressMonitor()); - GerritUi.Ftracer.traceInfo("Selected version: " + version.toString()); + GerritUi.Ftracer.traceInfo("Selected version: " + version.toString()); //$NON-NLS-1$ } catch (GerritException e) { StatusHandler.log(new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, e.getMessage(), e)); } @@ -695,19 +685,17 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener */ private Object updateTable(final TaskRepository aTaskRepo, final String aQueryType) { - String cmdMessage = COMMAND_MESSAGE + " " + aTaskRepo.getUrl() + " : " + aQueryType; + String cmdMessage = NLS.bind(Messages.GerritTableView_commandMessage, aTaskRepo.getUrl(), aQueryType); final Job job = new Job(cmdMessage) { - public String familyName = UIConstants.DASHBOARD_UI_JOB_FAMILY; - @Override public boolean belongsTo(Object aFamily) { - return familyName.equals(aFamily); + return Messages.GerritTableView_dashboardUiJob.equals(aFamily); } @Override public IStatus run(final IProgressMonitor aMonitor) { - GerritPlugin.Ftracer.traceInfo("repository: " + aTaskRepo.getUrl() + "\t query: " + aQueryType); //$NON-NLS-1$ + GerritPlugin.Ftracer.traceInfo("repository: " + aTaskRepo.getUrl() + "\t query: " + aQueryType); //$NON-NLS-1$ //$NON-NLS-2$ // If there is only have one Gerrit server, we can proceed as if it was already used before IStatus status = null; @@ -734,8 +722,6 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener } if (gerritClient != null) { try { - GerritUi.Ftracer.traceInfo("GerritClient: " - + gerritClient.getVersion(new NullProgressMonitor())); setRepositoryVersionLabel(aTaskRepo.getRepositoryLabel(), gerritClient.getVersion(new NullProgressMonitor()).toString()); } catch (GerritException e) { @@ -747,6 +733,7 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener }); } } catch (GerritQueryException e) { + status = e.getStatus(); StatusHandler.log(new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, e.getStatus().getMessage(), e)); } @@ -768,7 +755,7 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener private void setSearchText(String aSt) { if (!fSearchRequestText.isDisposed()) { - if (aSt != null && aSt != "") { + if (aSt != null && aSt != "") { //$NON-NLS-1$ int index = -1; String[] ar = fSearchRequestText.getItems(); for (int i = 0; i < ar.length; i++) { @@ -795,11 +782,11 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener } fSearchRequestText.setItems(reverseOrder(fRequestList.toArray(new String[0]))); - if (aSt != null && aSt != "") { + if (aSt != null && aSt != "") { //$NON-NLS-1$ fSearchRequestText.select(0); } else { //Leave the text empty - fSearchRequestText.setText(""); + fSearchRequestText.setText(""); //$NON-NLS-1$ } } } @@ -828,7 +815,7 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener Display.getDefault().syncExec(new Runnable() { public void run() { str[0] = fSearchRequestText.getText().trim(); - GerritUi.Ftracer.traceInfo("Custom string: " + str[0]); + GerritUi.Ftracer.traceInfo("Custom string: " + str[0]); //$NON-NLS-1$ } }); return str[0]; @@ -843,8 +830,8 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener private void displayWarning(final String st) { Display.getDefault().syncExec(new Runnable() { public void run() { - final MessageDialog dialog = new MessageDialog(null, "Warning", null, st, MessageDialog.WARNING, - new String[] { IDialogConstants.CANCEL_LABEL }, 0); + final MessageDialog dialog = new MessageDialog(null, Messages.GerritTableView_warning, null, st, + MessageDialog.WARNING, new String[] { IDialogConstants.CANCEL_LABEL }, 0); dialog.open(); } }); @@ -865,21 +852,20 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener //Test for Anonymous user if (queryType.equals(GerritQuery.MY_CHANGES) || queryType.equals(GerritQuery.QUERY_MY_DRAFTS_COMMENTS_CHANGES)) { - displayWarning("This operation is not allowed as Anonymous user: " + queryType); + displayWarning(NLS.bind(Messages.GerritTableView_warningAnonymous, queryType)); return Status.CANCEL_STATUS; } else if (queryType == GerritQuery.CUSTOM) { - int foundSelf = getSearchText().toLowerCase().indexOf("self"); + int foundSelf = getSearchText().toLowerCase().indexOf("self"); //$NON-NLS-1$ int foundhasDraft = getSearchText().toLowerCase().indexOf(GerritQuery.QUERY_MY_DRAFTS_COMMENTS_CHANGES); if (foundSelf != -1 || foundhasDraft != -1) { - displayWarning("This operation is not allowed as Anonymous user in search field: " - + getSearchText()); + displayWarning(NLS.bind(Messages.GerritTableView_warningSearchAnonymous, getSearchText())); return Status.CANCEL_STATUS; } } } // Format the query id - String queryId = rtv.getTitle() + " - " + queryType; + String queryId = rtv.getTitle() + " - " + queryType; //$NON-NLS-1$ RepositoryQuery query = null; @@ -896,7 +882,7 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener } if (query.getAttribute(GerritQuery.QUERY_STRING).isEmpty()) { - displayWarning("The query string cannot be empty, please enter a value."); + displayWarning(Messages.GerritTableView_warningEmptyValue); return Status.CANCEL_STATUS; } @@ -940,13 +926,12 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener if (ok) { status = fConnector.performQuery(repository, aQuery, resultCollector, null, new NullProgressMonitor()); } else { - status = new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, NLS.bind("Missing Git connector for : {0}", - aQuery.getAttribute(GerritQuery.PROJECT))); + status = new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, NLS.bind( + Messages.GerritTableView_missingGitConnector, aQuery.getAttribute(GerritQuery.PROJECT))); } if (!status.isOK()) { - String msg = "Unable to read the Gerrit server."; - throw new GerritQueryException(status, msg); + throw new GerritQueryException(status, Messages.GerritTableView_serverNotRead); } // Extract the result @@ -1005,9 +990,8 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener * Add/update a review */ private synchronized void updateReview(TaskTask task) { - String summary = task.getSummary(); boolean ourQuery = task.getParentContainers().contains(fCurrentQuery); - if (ourQuery && summary != null && !summary.equals("")) { + if (ourQuery && !Strings.isNullOrEmpty(task.getSummary())) { try { TaskData taskData = fConnector.getTaskData(getTaskRepository(), task.getTaskId(), new NullProgressMonitor()); @@ -1025,8 +1009,7 @@ public class GerritTableView extends ViewPart implements ITaskListChangeListener private void setRepositoryVersionLabel(String aRepo, String aVersion) { if (!fRepositoryVersionResulLabel.isDisposed()) { // e.g. "Eclipse.org Reviews - Gerrit 2.6.1" - String s = aRepo + GERRIT_LABEL + aVersion; - fRepositoryVersionResulLabel.setText(s); + fRepositoryVersionResulLabel.setText(NLS.bind(Messages.GerritTableView_gerritLabel, aRepo, aVersion)); } } diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/views/Messages.java b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/views/Messages.java new file mode 100644 index 000000000..ec35a44c3 --- /dev/null +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/views/Messages.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2014 Ericsson AB and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jacques Bouthillier - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.gerrit.dashboard.ui.views; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.mylyn.gerrit.dashboard.ui.views.messages"; //$NON-NLS-1$ + + public static String GerritTableView_commandMessage; + + public static String GerritTableView_defineRepository; + + public static String GerritTableView_gerritLabel; + + public static String GerritTableView_missingGitConnector; + + public static String GerritTableView_noGerritRepository; + + public static String GerritTableView_popupMenu; + + public static String GerritTableView_refreshTable; + + public static String GerritTableView_search; + + public static String GerritTableView_serverNotRead; + + public static String GerritTableView_tooltipSearch; + + public static String GerritTableView_totalReview; + + public static String GerritTableView_warning; + + public static String GerritTableView_warningAnonymous; + + public static String GerritTableView_warningEmptyValue; + + public static String GerritTableView_warningSearchAnonymous; + + public static String GerritTableView_starredName; + + public static String GerritTableView_dashboardUiJob; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/views/messages.properties b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/views/messages.properties new file mode 100644 index 000000000..fa7c08db9 --- /dev/null +++ b/org.eclipse.mylyn.gerrit.dashboard.ui/src/org/eclipse/mylyn/gerrit/dashboard/ui/views/messages.properties @@ -0,0 +1,29 @@ +############################################################################### +# Copyright (c) 2014 Ericsson AB and others. +# +# All rights reserved. This program and the accompanying materials are +# made available under the terms of the Eclipse Public License v1.0 which +# accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# Jacques Bouthillier - Initial implementation +############################################################################### +GerritTableView_commandMessage=Search Gerrit info ... {0} : {1} +GerritTableView_defineRepository=You need to define a Gerrit repository. +GerritTableView_gerritLabel={0} - Gerrit {1} +GerritTableView_missingGitConnector=Missing Git connector for : {0} +GerritTableView_noGerritRepository=No Gerrit repository has been selected yet. +GerritTableView_popupMenu=\#PopupMenu +GerritTableView_refreshTable=Refresh table +GerritTableView_search=Search +GerritTableView_serverNotRead=Unable to read the Gerrit server. +GerritTableView_tooltipSearch=Ex. status:open (or is:open) \n status:merged \n is:draft \n status:open project:Foo \n \ + See explanation by selecting in the toolbar \n Documentation > Searching +GerritTableView_totalReview=Total reviews: +GerritTableView_warning=Warning +GerritTableView_warningAnonymous=This operation is not allowed as Anonymous user: {0} +GerritTableView_warningEmptyValue=The query string cannot be empty, please enter a value. +GerritTableView_warningSearchAnonymous=This operation is not allowed as Anonymous user in search field: {0} +GerritTableView_starredName=Star Review +GerritTableView_dashboardUiJob=DASHBOARD_UI |