summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsdubois2011-12-02 15:35:44 -0500
committersdubois2011-12-02 15:39:11 -0500
commit3ad0ebe14042a5865c0285f1eeeae0622ada265a (patch)
treea399bc3a2549a2435a4ff45df3c4184a576bea13
parent3a23869f767001882006cdd5059a9ecf3eed81da (diff)
downloadorg.eclipse.mylyn.reviews.r4e-3ad0ebe14042a5865c0285f1eeeae0622ada265a.zip
org.eclipse.mylyn.reviews.r4e-3ad0ebe14042a5865c0285f1eeeae0622ada265a.tar.gz
org.eclipse.mylyn.reviews.r4e-3ad0ebe14042a5865c0285f1eeeae0622ada265a.tar.xz
ASSIGNED - bug 360952: Re-factor UI to facilitate Test
https://bugs.eclipse.org/bugs/show_bug.cgi?id=360952 Changed code based on peer review
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/commands/ChangeReviewStateHandler.java3
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/commands/NewReviewItemHandler.java3
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/commands/SendNotificationHandler.java3
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/ISendNotificationInputDialog.java2
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/R4EUIDialogFactory.java172
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/SendNotificationInputDialog.java70
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/navigator/ReviewNavigatorView.java6
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/utils/MailServicesProxy.java32
8 files changed, 196 insertions, 95 deletions
diff --git a/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/commands/ChangeReviewStateHandler.java b/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/commands/ChangeReviewStateHandler.java
index b7bcfce..8927cd8 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/commands/ChangeReviewStateHandler.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/commands/ChangeReviewStateHandler.java
@@ -86,8 +86,9 @@ public class ChangeReviewStateHandler extends AbstractHandler {
R4EUIModelController.setJobInProgress(true);
final ISendNotificationInputDialog dialog = R4EUIDialogFactory.getInstance()
- .createSendNotificationInputDialog(R4EUIModelController.getActiveReview());
+ .getSendNotificationInputDialog();
dialog.create();
+ dialog.adjust(R4EUIModelController.getActiveReview());
final int result = dialog.open();
if (result == Window.OK) {
final int messageType = dialog.getMessageTypeValue();
diff --git a/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/commands/NewReviewItemHandler.java b/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/commands/NewReviewItemHandler.java
index 1ada79f..8418d56 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/commands/NewReviewItemHandler.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/commands/NewReviewItemHandler.java
@@ -39,7 +39,6 @@ import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.mylyn.reviews.r4e.core.model.R4EFileVersion;
import org.eclipse.mylyn.reviews.r4e.core.model.R4EFormalReview;
import org.eclipse.mylyn.reviews.r4e.core.model.R4EItem;
@@ -119,7 +118,7 @@ public class NewReviewItemHandler extends AbstractHandler {
}
//Then iterate through all selections
- for (final Iterator<?> iterator = ((ITreeSelection) selection).iterator(); iterator.hasNext();) {
+ for (final Iterator<?> iterator = ((IStructuredSelection) selection).iterator(); iterator.hasNext();) {
addReviewItemFromTree(iterator.next());
}
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/commands/SendNotificationHandler.java b/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/commands/SendNotificationHandler.java
index af8171d..1224d8f 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/commands/SendNotificationHandler.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/commands/SendNotificationHandler.java
@@ -100,8 +100,9 @@ public class SendNotificationHandler extends AbstractHandler {
R4EUIModelController.setJobInProgress(true);
//if the source is unique and is a Review element, all options are available. Otherwise, only ask questions is supported
final ISendNotificationInputDialog dialog = R4EUIDialogFactory.getInstance()
- .createSendNotificationInputDialog(obj);
+ .getSendNotificationInputDialog();
dialog.create();
+ dialog.adjust(obj);
final int result = dialog.open();
if (result == Window.OK) {
final int messageType = dialog.getMessageTypeValue();
diff --git a/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/ISendNotificationInputDialog.java b/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/ISendNotificationInputDialog.java
index 23731c1..692666e 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/ISendNotificationInputDialog.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/ISendNotificationInputDialog.java
@@ -35,6 +35,8 @@ public interface ISendNotificationInputDialog {
*/
int open();
+ void adjust(Object aSource);
+
/**
* Method getMessageTypeValue
*
diff --git a/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/R4EUIDialogFactory.java b/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/R4EUIDialogFactory.java
index dc5ca71..c7a0702 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/R4EUIDialogFactory.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/R4EUIDialogFactory.java
@@ -22,15 +22,14 @@ import org.eclipse.mylyn.reviews.notifications.spi.NotificationsConnector;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIAnomalyBasic;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIModelController;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIReviewBasic;
-import org.eclipse.mylyn.reviews.r4e.ui.internal.utils.UIUtils;
import org.eclipse.mylyn.versions.ui.ScmUi;
import org.eclipse.mylyn.versions.ui.spi.ScmConnectorUi;
-import org.eclipse.swt.widgets.Shell;
/**
* @author lmcdubo
* @version $Revision: 1.0 $
*/
+@SuppressWarnings("restriction")
public class R4EUIDialogFactory {
// ------------------------------------------------------------------------
@@ -45,82 +44,82 @@ public class R4EUIDialogFactory {
/**
* Field fAnomalyInputDialog.
*/
- IAnomalyInputDialog fAnomalyInputDialog = null;
+ private IAnomalyInputDialog fAnomalyInputDialog = null;
/**
* Field fCalendarDialog.
*/
- ICalendarDialog fCalendarDialog = null;
+ private ICalendarDialog fCalendarDialog = null;
/**
* Field fChangeReviewStateDialog.
*/
- IChangeStateDialog fChangeReviewStateDialog = null;
+ private IChangeStateDialog fChangeReviewStateDialog = null;
/**
* Field fChangeAnomalyStateDialog.
*/
- IChangeStateDialog fChangeAnomalyStateDialog = null;
+ private IChangeStateDialog fChangeAnomalyStateDialog = null;
/**
* Field fCommentInputDialog.
*/
- ICommentInputDialog fCommentInputDialog = null;
+ private ICommentInputDialog fCommentInputDialog = null;
/**
* Field fFindUserDialog.
*/
- IFindUserDialog fFindUserDialog = null;
+ private IFindUserDialog fFindUserDialog = null;
/**
* Field fParticipantInputDialog.
*/
- IParticipantInputDialog fParticipantInputDialog = null;
+ private IParticipantInputDialog fParticipantInputDialog = null;
/**
* Field fReviewGroupInputDialog.
*/
- IReviewGroupInputDialog fReviewGroupInputDialog = null;
+ private IReviewGroupInputDialog fReviewGroupInputDialog = null;
/**
* Field fReviewInputDialog.
*/
- IReviewInputDialog fReviewInputDialog = null;
+ private IReviewInputDialog fReviewInputDialog = null;
/**
* Field fRuleAreaInputDialog.
*/
- IRuleAreaInputDialog fRuleAreaInputDialog = null;
+ private IRuleAreaInputDialog fRuleAreaInputDialog = null;
/**
* Field fRuleInputDialog.
*/
- IRuleInputDialog fRuleInputDialog = null;
+ private IRuleInputDialog fRuleInputDialog = null;
/**
* Field fRuleSetInputDialog.
*/
- IRuleSetInputDialog fRuleSetInputDialog = null;
+ private IRuleSetInputDialog fRuleSetInputDialog = null;
/**
* Field fRuleViolationInputDialog.
*/
- IRuleViolationInputDialog fRuleViolationInputDialog = null;
+ private IRuleViolationInputDialog fRuleViolationInputDialog = null;
/**
* Field fSendNotificationInputDialog.
*/
- ISendNotificationInputDialog fSendNotificationInputDialog = null;
+ private ISendNotificationInputDialog fSendNotificationInputDialog = null;
/**
* Field fScmConnectorUi.
*/
- ScmConnectorUi fScmConnectorUi = null;
+ private ScmConnectorUi fScmConnectorUi = null;
/**
* Field fNotificationsConnector.
*/
- static NotificationsConnector fNotificationsConnector = null;
+ private NotificationsConnector fNotificationsConnector = null;
// ------------------------------------------------------------------------
// Constructors
@@ -149,48 +148,17 @@ public class R4EUIDialogFactory {
}
/**
- * Method createDialogs.
- */
- public void createDialogs() {
- Shell shell = R4EUIModelController.getNavigatorView().getSite().getWorkbenchWindow().getShell();
- fAnomalyInputDialog = new AnomalyInputDialog(shell);
- fCalendarDialog = new CalendarDialog(shell, false);
- fChangeReviewStateDialog = new ChangeStateDialog(shell, R4EUIReviewBasic.class);
- fChangeAnomalyStateDialog = new ChangeStateDialog(shell, R4EUIAnomalyBasic.class);
- fCommentInputDialog = new CommentInputDialog(shell);
- fFindUserDialog = new FindUserDialog(shell);
- fParticipantInputDialog = new ParticipantInputDialog(shell);
- fReviewGroupInputDialog = new ReviewGroupInputDialog(shell);
- fReviewInputDialog = new ReviewInputDialog(shell);
- fRuleAreaInputDialog = new RuleAreaInputDialog(shell);
- fRuleInputDialog = new RuleInputDialog(shell);
- fRuleSetInputDialog = new RuleSetInputDialog(shell);
- fRuleViolationInputDialog = new RuleViolationInputDialog(shell);
- }
-
- /**
- * Method createSendNotificationInputDialog.
- *
- * @param aSource
- * Object
- * @return ISendNotificationInputDialog
- */
- public ISendNotificationInputDialog createSendNotificationInputDialog(Object aSource) {
- if (UIUtils.TEST_MODE == false) {
- fSendNotificationInputDialog = new SendNotificationInputDialog(R4EUIModelController.getNavigatorView()
- .getSite()
- .getWorkbenchWindow()
- .getShell(), aSource);
- }
- return fSendNotificationInputDialog;
- }
-
- /**
* Method getAnomalyInputDialog.
*
* @return IAnomalyInputDialog
*/
public IAnomalyInputDialog getAnomalyInputDialog() {
+ if (null == fAnomalyInputDialog) {
+ fAnomalyInputDialog = new AnomalyInputDialog(R4EUIModelController.getNavigatorView()
+ .getSite()
+ .getWorkbenchWindow()
+ .getShell());
+ }
return fAnomalyInputDialog;
}
@@ -210,6 +178,12 @@ public class R4EUIDialogFactory {
* @return ICalendarDialog
*/
public ICalendarDialog getCalendarDialog() {
+ if (null == fCalendarDialog) {
+ fCalendarDialog = new CalendarDialog(R4EUIModelController.getNavigatorView()
+ .getSite()
+ .getWorkbenchWindow()
+ .getShell(), false);
+ }
return fCalendarDialog;
}
@@ -232,9 +206,21 @@ public class R4EUIDialogFactory {
*/
public IChangeStateDialog getChangeStateDialog(Class<?> aTargetClass) {
if (aTargetClass.equals(R4EUIReviewBasic.class)) {
+ if (null == fChangeReviewStateDialog) {
+ fChangeReviewStateDialog = new ChangeStateDialog(R4EUIModelController.getNavigatorView()
+ .getSite()
+ .getWorkbenchWindow()
+ .getShell(), R4EUIReviewBasic.class);
+ }
return fChangeReviewStateDialog;
}
//Assume AnomalyChangeStateDialog
+ if (null == fChangeAnomalyStateDialog) {
+ fChangeAnomalyStateDialog = new ChangeStateDialog(R4EUIModelController.getNavigatorView()
+ .getSite()
+ .getWorkbenchWindow()
+ .getShell(), R4EUIAnomalyBasic.class);
+ }
return fChangeAnomalyStateDialog;
}
@@ -260,6 +246,12 @@ public class R4EUIDialogFactory {
* @return ICommentInputDialog
*/
public ICommentInputDialog getCommentInputDialog() {
+ if (null == fCommentInputDialog) {
+ fCommentInputDialog = new CommentInputDialog(R4EUIModelController.getNavigatorView()
+ .getSite()
+ .getWorkbenchWindow()
+ .getShell());
+ }
return fCommentInputDialog;
}
@@ -279,6 +271,12 @@ public class R4EUIDialogFactory {
* @return IFindUserDialog
*/
public IFindUserDialog getFindUserDialog() {
+ if (null == fFindUserDialog) {
+ fFindUserDialog = new FindUserDialog(R4EUIModelController.getNavigatorView()
+ .getSite()
+ .getWorkbenchWindow()
+ .getShell());
+ }
return fFindUserDialog;
}
@@ -298,6 +296,12 @@ public class R4EUIDialogFactory {
* @return IParticipantInputDialog
*/
public IParticipantInputDialog getParticipantInputDialog() {
+ if (null == fParticipantInputDialog) {
+ fParticipantInputDialog = new ParticipantInputDialog(R4EUIModelController.getNavigatorView()
+ .getSite()
+ .getWorkbenchWindow()
+ .getShell());
+ }
return fParticipantInputDialog;
}
@@ -317,6 +321,12 @@ public class R4EUIDialogFactory {
* @return IReviewGroupInputDialog
*/
public IReviewGroupInputDialog getReviewGroupInputDialog() {
+ if (null == fReviewGroupInputDialog) {
+ fReviewGroupInputDialog = new ReviewGroupInputDialog(R4EUIModelController.getNavigatorView()
+ .getSite()
+ .getWorkbenchWindow()
+ .getShell());
+ }
return fReviewGroupInputDialog;
}
@@ -336,6 +346,12 @@ public class R4EUIDialogFactory {
* @return IReviewInputDialog
*/
public IReviewInputDialog getReviewInputDialog() {
+ if (null == fReviewInputDialog) {
+ fReviewInputDialog = new ReviewInputDialog(R4EUIModelController.getNavigatorView()
+ .getSite()
+ .getWorkbenchWindow()
+ .getShell());
+ }
return fReviewInputDialog;
}
@@ -355,6 +371,12 @@ public class R4EUIDialogFactory {
* @return IRuleAreaInputDialog
*/
public IRuleAreaInputDialog getRuleAreaInputDialog() {
+ if (null == fRuleAreaInputDialog) {
+ fRuleAreaInputDialog = new RuleAreaInputDialog(R4EUIModelController.getNavigatorView()
+ .getSite()
+ .getWorkbenchWindow()
+ .getShell());
+ }
return fRuleAreaInputDialog;
}
@@ -374,6 +396,12 @@ public class R4EUIDialogFactory {
* @return IRuleInputDialog
*/
public IRuleInputDialog getRuleInputDialog() {
+ if (null == fRuleInputDialog) {
+ fRuleInputDialog = new RuleInputDialog(R4EUIModelController.getNavigatorView()
+ .getSite()
+ .getWorkbenchWindow()
+ .getShell());
+ }
return fRuleInputDialog;
}
@@ -393,6 +421,12 @@ public class R4EUIDialogFactory {
* @return IRuleSetInputDialog
*/
public IRuleSetInputDialog getRuleSetInputDialog() {
+ if (null == fRuleSetInputDialog) {
+ fRuleSetInputDialog = new RuleSetInputDialog(R4EUIModelController.getNavigatorView()
+ .getSite()
+ .getWorkbenchWindow()
+ .getShell());
+ }
return fRuleSetInputDialog;
}
@@ -412,6 +446,12 @@ public class R4EUIDialogFactory {
* @return IRuleViolationInputDialog
*/
public IRuleViolationInputDialog getRuleViolationInputDialog() {
+ if (null == fRuleViolationInputDialog) {
+ fRuleViolationInputDialog = new RuleViolationInputDialog(R4EUIModelController.getNavigatorView()
+ .getSite()
+ .getWorkbenchWindow()
+ .getShell());
+ }
return fRuleViolationInputDialog;
}
@@ -431,6 +471,12 @@ public class R4EUIDialogFactory {
* @return ISendNotificationInputDialog
*/
public ISendNotificationInputDialog getSendNotificationInputDialog() {
+ if (null == fSendNotificationInputDialog) {
+ fSendNotificationInputDialog = new SendNotificationInputDialog(R4EUIModelController.getNavigatorView()
+ .getSite()
+ .getWorkbenchWindow()
+ .getShell());
+ }
return fSendNotificationInputDialog;
}
@@ -460,11 +506,10 @@ public class R4EUIDialogFactory {
* @return ScmConnectorUi
*/
public ScmConnectorUi getScmUiConnector(IProject aProject) {
- if (UIUtils.TEST_MODE == false) {
- return ScmUi.getUiConnector(aProject);
- } else {
- return fScmConnectorUi;
+ if (null == fScmConnectorUi) {
+ fScmConnectorUi = ScmUi.getUiConnector(aProject);
}
+ return fScmConnectorUi;
}
/**
@@ -482,11 +527,10 @@ public class R4EUIDialogFactory {
*
* @return ScmConnectorUi
*/
- public static NotificationsConnector getMailConnector() {
- if (UIUtils.TEST_MODE == false) {
- return R4EUIModelController.getMailConnector();
- } else {
- return fNotificationsConnector;
+ public NotificationsConnector getMailConnector() {
+ if (null == fNotificationsConnector) {
+ fNotificationsConnector = R4EUIModelController.getMailConnector();
}
+ return fNotificationsConnector;
}
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/SendNotificationInputDialog.java b/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/SendNotificationInputDialog.java
index 317102d..f0e13e8 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/SendNotificationInputDialog.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/dialogs/SendNotificationInputDialog.java
@@ -92,11 +92,6 @@ public class SendNotificationInputDialog extends FormDialog implements ISendNoti
// ------------------------------------------------------------------------
/**
- * Field fSource.
- */
- private Object fSource = null;
-
- /**
* Field fMessageType.
*/
private int fMessageType;
@@ -138,10 +133,9 @@ public class SendNotificationInputDialog extends FormDialog implements ISendNoti
* @param aSource
* Object
*/
- public SendNotificationInputDialog(Shell aParentShell, Object aSource) {
+ public SendNotificationInputDialog(Shell aParentShell) {
super(aParentShell);
setBlockOnOpen(true);
- fSource = aSource;
}
// ------------------------------------------------------------------------
@@ -225,6 +219,27 @@ public class SendNotificationInputDialog extends FormDialog implements ISendNoti
basicSectionClient.setLayout(layout);
basicSection.setClient(basicSectionClient);
+ fCompletionButton = toolkit.createButton(basicSectionClient, REVIEW_COMPLETION, SWT.RADIO);
+ fCompletionButton.setToolTipText(R4EUIConstants.NOTIFICATION_COMPLETION_TOOLTIP);
+ fCompletionButton.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
+
+ fQuestionButton = toolkit.createButton(basicSectionClient, QUESTION, SWT.RADIO);
+ fQuestionButton.setToolTipText(R4EUIConstants.NOTIFICATION_QUESTION_TOOLTIP);
+ fQuestionButton.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
+
+ fItemsUpdatedButton = toolkit.createButton(basicSectionClient, UPDATED_REVIEW_ITEMS, SWT.RADIO);
+ fItemsUpdatedButton.setToolTipText(R4EUIConstants.NOTIFICATION_ITEMS_UPDATED_TOOLTIP);
+ fItemsUpdatedButton.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
+
+ fProgressButton = toolkit.createButton(basicSectionClient, REVIEW_PROGRESS, SWT.RADIO);
+ fProgressButton.setToolTipText(R4EUIConstants.NOTIFICATION_PROGRESS_TOOLTIP);
+ fProgressButton.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
+
+ fMeetingButton = toolkit.createButton(basicSectionClient, MEETING_REQUEST, SWT.RADIO);
+ fMeetingButton.setToolTipText(R4EUIConstants.MEETING_REQUEST_TOOLTIP);
+ fMeetingButton.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
+
+ /*
//Look for Review Element
Object elementFound = null;
if (fSource instanceof List) {
@@ -267,6 +282,7 @@ public class SendNotificationInputDialog extends FormDialog implements ISendNoti
fQuestionButton.setToolTipText(R4EUIConstants.NOTIFICATION_QUESTION_TOOLTIP);
fQuestionButton.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false));
}
+ */
}
/**
@@ -287,4 +303,44 @@ public class SendNotificationInputDialog extends FormDialog implements ISendNoti
public int getMessageTypeValue() {
return fMessageType;
}
+
+ public void adjust(Object aSource) {
+ //Look for Review Element
+ Object elementFound = null;
+ if (aSource instanceof List) {
+ for (Object sourceElement : (List<?>) aSource) {
+ elementFound = sourceElement;
+ if (elementFound instanceof R4EUIReviewBasic) {
+ break;
+ }
+ }
+ } else {
+ elementFound = aSource;
+ }
+
+ if (elementFound instanceof R4EUIReviewBasic) {
+ if (((R4EUIReviewBasic) elementFound).isUserReviewed()) {
+ fCompletionButton.setVisible(true);
+ fCompletionButton.setSelection(true);
+ fQuestionButton.setVisible(false);
+ fItemsUpdatedButton.setVisible(false);
+ fProgressButton.setVisible(false);
+ fMeetingButton.setVisible(false);
+ } else {
+ fCompletionButton.setVisible(false);
+ fQuestionButton.setVisible(true);
+ fItemsUpdatedButton.setVisible(true);
+ fProgressButton.setVisible(true);
+ fProgressButton.setSelection(true);
+ fMeetingButton.setVisible(true);
+ }
+ } else {
+ fCompletionButton.setVisible(false);
+ fQuestionButton.setVisible(true);
+ fQuestionButton.setSelection(true);
+ fItemsUpdatedButton.setVisible(false);
+ fProgressButton.setVisible(false);
+ fMeetingButton.setVisible(false);
+ }
+ }
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/navigator/ReviewNavigatorView.java b/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/navigator/ReviewNavigatorView.java
index 2c0e03d..37a4eda 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/navigator/ReviewNavigatorView.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/navigator/ReviewNavigatorView.java
@@ -57,7 +57,6 @@ import org.eclipse.mylyn.reviews.r4e.core.model.serial.impl.OutOfSyncException;
import org.eclipse.mylyn.reviews.r4e.core.model.serial.impl.ResourceHandlingException;
import org.eclipse.mylyn.reviews.r4e.core.versions.ReviewVersionsException;
import org.eclipse.mylyn.reviews.r4e.ui.R4EUIPlugin;
-import org.eclipse.mylyn.reviews.r4e.ui.internal.dialogs.R4EUIDialogFactory;
import org.eclipse.mylyn.reviews.r4e.ui.internal.editors.EditorProxy;
import org.eclipse.mylyn.reviews.r4e.ui.internal.filters.DateComparator;
import org.eclipse.mylyn.reviews.r4e.ui.internal.filters.LinePositionComparator;
@@ -292,11 +291,6 @@ public class ReviewNavigatorView extends ViewPart implements IMenuListener, IPre
//Apply default filters
applyDefaultFilters();
- //Create default dialogs
- if (UIUtils.TEST_MODE == false) {
- R4EUIDialogFactory.getInstance().createDialogs();
- }
-
//Make sure that the User Id in preferences is set to lower case
final IPreferenceStore store = R4EUIPlugin.getDefault().getPreferenceStore();
store.setValue(PreferenceConstants.P_USER_ID, store.getString(PreferenceConstants.P_USER_ID).toLowerCase());
diff --git a/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/utils/MailServicesProxy.java b/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/utils/MailServicesProxy.java
index 0bf0970..2eefaae 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/utils/MailServicesProxy.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui/src/org/eclipse/mylyn/reviews/r4e/ui/internal/utils/MailServicesProxy.java
@@ -178,7 +178,7 @@ public class MailServicesProxy {
* @throws ResourceHandlingException
*/
public static void sendItemsReadyNotification() throws CoreException, ResourceHandlingException {
- if (null != R4EUIDialogFactory.getMailConnector()) {
+ if (null != R4EUIDialogFactory.getInstance().getMailConnector()) {
final String[] messageDestinations = createItemsUpdatedDestinations();
final String messageSubject = createSubject() + " - Items Ready for Review";
final String messageBody = createItemsReadyNotificationMessage(false);
@@ -198,7 +198,7 @@ public class MailServicesProxy {
*/
public static void sendItemsAddedNotification(List<R4EReviewComponent> aAddedElements) throws CoreException,
ResourceHandlingException {
- if (null != R4EUIDialogFactory.getMailConnector()) {
+ if (null != R4EUIDialogFactory.getInstance().getMailConnector()) {
final String[] messageDestinations = createItemsUpdatedDestinations();
final String messageSubject = createSubject() + " - Items Added for Review";
final String messageBody = createUpdatedItemsNotificationMessage(aAddedElements, true);
@@ -218,7 +218,7 @@ public class MailServicesProxy {
*/
public static void sendItemsRemovedNotification(List<R4EReviewComponent> aRemovedElements) throws CoreException,
ResourceHandlingException {
- if (null != R4EUIDialogFactory.getMailConnector()) {
+ if (null != R4EUIDialogFactory.getInstance().getMailConnector()) {
final String[] messageDestinations = createItemsUpdatedDestinations();
final String messageSubject = createSubject() + " - Items Removed from Review";
final String messageBody = createUpdatedItemsNotificationMessage(aRemovedElements, false);
@@ -235,7 +235,7 @@ public class MailServicesProxy {
* @throws ResourceHandlingException
*/
public static void sendProgressNotification() throws CoreException, ResourceHandlingException {
- if (null != R4EUIDialogFactory.getMailConnector()) {
+ if (null != R4EUIDialogFactory.getInstance().getMailConnector()) {
final String[] messageDestinations = createProgressDestinations();
final String messageSubject = createSubject() + " - Participant Progress";
final String messageBody = createProgressNotification(PROGRESS_MESSAGE);
@@ -252,7 +252,7 @@ public class MailServicesProxy {
* @throws ResourceHandlingException
*/
public static void sendCompletionNotification() throws CoreException, ResourceHandlingException {
- if (null != R4EUIDialogFactory.getMailConnector()) {
+ if (null != R4EUIDialogFactory.getInstance().getMailConnector()) {
final String[] messageDestinations = createProgressDestinations();
final String messageSubject = createSubject() + " - Participant Progress (Completed)";
final String messageBody = createProgressNotification(COMPLETION_MESSAGE);
@@ -271,7 +271,7 @@ public class MailServicesProxy {
* @throws ResourceHandlingException
*/
public static void sendQuestion(Object aSource) throws CoreException, ResourceHandlingException {
- if (null != R4EUIDialogFactory.getMailConnector()) {
+ if (null != R4EUIDialogFactory.getInstance().getMailConnector()) {
String[] messageDestinations = null;
messageDestinations = createQuestionDestinations();
final String messageSubject = createSubject() + " - Question regarding review ";
@@ -306,8 +306,9 @@ public class MailServicesProxy {
final IPreferenceStore store = R4EUIPlugin.getDefault().getPreferenceStore();
originatorEmail = store.getString(PreferenceConstants.P_USER_EMAIL);
}
- R4EUIDialogFactory.getMailConnector().sendEmailGraphical(originatorEmail, aDestinations, aSubject, aBody, null,
- null);
+ R4EUIDialogFactory.getInstance()
+ .getMailConnector()
+ .sendEmailGraphical(originatorEmail, aDestinations, aSubject, aBody, null, null);
}
/**
@@ -1064,7 +1065,7 @@ public class MailServicesProxy {
* @throws CoreException
*/
public static void sendMeetingRequest() throws ResourceHandlingException, OutOfSyncException {
- if (null != R4EUIDialogFactory.getMailConnector()) {
+ if (null != R4EUIDialogFactory.getInstance().getMailConnector()) {
boolean meetingInfoFound = false;
@@ -1072,9 +1073,10 @@ public class MailServicesProxy {
R4EMeetingData r4eMeetingData = R4EUIModelController.getActiveReview().getReview().getActiveMeeting();
IMeetingData meetingData = null;
if (null != r4eMeetingData) {
- meetingData = R4EUIDialogFactory.getMailConnector().openAndUpdateMeeting(
- createMeetingData(r4eMeetingData),
- R4EUIModelController.getActiveReview().getReview().getStartDate());
+ meetingData = R4EUIDialogFactory.getInstance()
+ .getMailConnector()
+ .openAndUpdateMeeting(createMeetingData(r4eMeetingData),
+ R4EUIModelController.getActiveReview().getReview().getStartDate());
if (null != meetingData) {
meetingInfoFound = true;
}
@@ -1101,8 +1103,10 @@ public class MailServicesProxy {
final String messageBody = createItemsReadyNotificationMessage(true);
try {
- meetingData = R4EUIDialogFactory.getMailConnector().createMeetingRequest(messageSubject,
- messageBody, messageDestinations, getDefaultStartTime(), DEFAULT_MEETING_DURATION);
+ meetingData = R4EUIDialogFactory.getInstance()
+ .getMailConnector()
+ .createMeetingRequest(messageSubject, messageBody, messageDestinations,
+ getDefaultStartTime(), DEFAULT_MEETING_DURATION);
} catch (CoreException e) {
R4EUIPlugin.Ftracer.traceWarning("Exception: " + e.toString() + " (" + e.getMessage() + ")");
R4EUIPlugin.getDefault().logWarning("Exception: " + e.toString(), e);