diff --git a/.classpath b/.classpath index 40b1fe4..794e45c 100644 --- a/.classpath +++ b/.classpath @@ -4,6 +4,5 @@ - diff --git a/plugin.xml b/plugin.xml index ec98307..7394550 100644 --- a/plugin.xml +++ b/plugin.xml @@ -49,7 +49,7 @@ + name="ePomodoro"> iterator=strucSelection.iterator(); iterator.hasNext();) { - Object element=iterator.next(); - if (element instanceof TimerMessage) { - TimerMessage message=(TimerMessage) element; - Address source=message.getSourceAddress(); - try { - MessageDialog dialog=new MessageDialog(Display.getDefault().getActiveShell(), "Write message for " + message.getSender()); - String textToSend=dialog.open(); - if (textToSend != null && !textToSend.equals("")) { + if (!strucSelection.isEmpty()) { + String senders=null; + for (TimerMessage timeMessage : (List) strucSelection.toList()) { + if (senders == null) + senders=timeMessage.getSender(); + else + senders+=", " + timeMessage.getSender(); + } + // See http://bingjava.appspot.com/model?id=752002 + InputDialog dialog=new InputDialog(window.getShell(), "Write message to " + senders, "Enter your message here:", "", NON_EMPTY_VALIDATOR) { + /** + * Override this method to make the text field multilined and give it a scroll bar. But... + */ + @Override + protected int getInputTextStyle() { + return SWT.MULTI | SWT.BORDER | SWT.V_SCROLL; + } + + /** + * ...it still is just one line high. This hack is not very nice, but at least it gets the job done... ;o) + */ + @Override + protected Control createDialogArea(Composite parent) { + Control res=super.createDialogArea(parent); + ((GridData) this.getText().getLayoutData()).heightHint=100; + return res; + } + }; + if (dialog.open() == Window.OK) { + for (TimerMessage message : (List) strucSelection.toList()) { + Address source=message.getSourceAddress(); + try { TextMessage msg=(TextMessage) Communication.createMessage(TextMessage.class); - msg.setMessage(textToSend); + msg.setMessage(dialog.getValue()); Activator.getDefault().getCommunication().sendMessage(msg, source); + } catch (Exception e) { + e.printStackTrace(); } - } catch (Exception e) { - e.printStackTrace(); } } }