|
Lines 114-119
Link Here
|
| 114 |
import org.eclipse.swt.custom.CCombo; |
114 |
import org.eclipse.swt.custom.CCombo; |
| 115 |
import org.eclipse.swt.custom.StackLayout; |
115 |
import org.eclipse.swt.custom.StackLayout; |
| 116 |
import org.eclipse.swt.custom.StyledText; |
116 |
import org.eclipse.swt.custom.StyledText; |
|
|
117 |
import org.eclipse.swt.custom.VerifyKeyListener; |
| 117 |
import org.eclipse.swt.dnd.DND; |
118 |
import org.eclipse.swt.dnd.DND; |
| 118 |
import org.eclipse.swt.dnd.DropTarget; |
119 |
import org.eclipse.swt.dnd.DropTarget; |
| 119 |
import org.eclipse.swt.dnd.FileTransfer; |
120 |
import org.eclipse.swt.dnd.FileTransfer; |
|
Lines 124-129
Link Here
|
| 124 |
import org.eclipse.swt.events.SelectionAdapter; |
125 |
import org.eclipse.swt.events.SelectionAdapter; |
| 125 |
import org.eclipse.swt.events.SelectionEvent; |
126 |
import org.eclipse.swt.events.SelectionEvent; |
| 126 |
import org.eclipse.swt.events.SelectionListener; |
127 |
import org.eclipse.swt.events.SelectionListener; |
|
|
128 |
import org.eclipse.swt.events.VerifyEvent; |
| 127 |
import org.eclipse.swt.graphics.Color; |
129 |
import org.eclipse.swt.graphics.Color; |
| 128 |
import org.eclipse.swt.graphics.Cursor; |
130 |
import org.eclipse.swt.graphics.Cursor; |
| 129 |
import org.eclipse.swt.graphics.Font; |
131 |
import org.eclipse.swt.graphics.Font; |
|
Lines 186-191
Link Here
|
| 186 |
*/ |
188 |
*/ |
| 187 |
public abstract class AbstractRepositoryTaskEditor extends TaskFormPage { |
189 |
public abstract class AbstractRepositoryTaskEditor extends TaskFormPage { |
| 188 |
|
190 |
|
|
|
191 |
/** |
| 192 |
* @author Raphael Ackermann (bug 195514) |
| 193 |
*/ |
| 194 |
private class TabVerifyKeyListener implements VerifyKeyListener { |
| 195 |
|
| 196 |
public void verifyKey(VerifyEvent event) { |
| 197 |
// if there is a tab key, do not "execute" it and instead select the Status control |
| 198 |
if (event.keyCode == SWT.TAB) { |
| 199 |
event.doit = false; |
| 200 |
headerInfoComposite.setFocus(); |
| 201 |
} |
| 202 |
} |
| 203 |
|
| 204 |
} |
| 205 |
|
| 189 |
private static final String ERROR_NOCONNECTIVITY = "Unable to submit at this time. Check connectivity and retry."; |
206 |
private static final String ERROR_NOCONNECTIVITY = "Unable to submit at this time. Check connectivity and retry."; |
| 190 |
|
207 |
|
| 191 |
private static final String LABEL_HISTORY = "History"; |
208 |
private static final String LABEL_HISTORY = "History"; |
|
Lines 232-237
Link Here
|
| 232 |
|
249 |
|
| 233 |
private static final int DESCRIPTION_HEIGHT = 10 * 14; |
250 |
private static final int DESCRIPTION_HEIGHT = 10 * 14; |
| 234 |
|
251 |
|
|
|
252 |
protected static final int SUMMARY_HEIGHT = 20; |
| 253 |
|
| 235 |
private static final String LABEL_BUTTON_SUBMIT = "Submit"; |
254 |
private static final String LABEL_BUTTON_SUBMIT = "Submit"; |
| 236 |
|
255 |
|
| 237 |
private static final String LABEL_COPY_TO_CLIPBOARD = "Copy to Clipboard"; |
256 |
private static final String LABEL_COPY_TO_CLIPBOARD = "Copy to Clipboard"; |
|
Lines 250-256
Link Here
|
| 250 |
|
269 |
|
| 251 |
private boolean expandedStateAttributes = false; |
270 |
private boolean expandedStateAttributes = false; |
| 252 |
|
271 |
|
| 253 |
protected Text summaryText; |
272 |
protected StyledText summaryText; |
| 254 |
|
273 |
|
| 255 |
protected Button submitButton; |
274 |
protected Button submitButton; |
| 256 |
|
275 |
|
|
Lines 264-269
Link Here
|
| 264 |
|
283 |
|
| 265 |
private Composite editorComposite; |
284 |
private Composite editorComposite; |
| 266 |
|
285 |
|
|
|
286 |
protected TextViewer newSummaryTextViewer; |
| 287 |
|
| 267 |
private TextViewer newCommentTextViewer; |
288 |
private TextViewer newCommentTextViewer; |
| 268 |
|
289 |
|
| 269 |
private org.eclipse.swt.widgets.List ccList; |
290 |
private org.eclipse.swt.widgets.List ccList; |
|
Lines 695-701
Link Here
|
| 695 |
|
716 |
|
| 696 |
createSummaryLayout(editorComposite); |
717 |
createSummaryLayout(editorComposite); |
| 697 |
|
718 |
|
| 698 |
Section attributesSection = createSection(editorComposite, getSectionLabel(SECTION_NAME.ATTRIBTUES_SECTION)); |
719 |
attributesSection = createSection(editorComposite, getSectionLabel(SECTION_NAME.ATTRIBTUES_SECTION)); |
| 699 |
attributesSection.setExpanded(expandedStateAttributes || hasAttributeChanges); |
720 |
attributesSection.setExpanded(expandedStateAttributes || hasAttributeChanges); |
| 700 |
|
721 |
|
| 701 |
Composite toolbarComposite = toolkit.createComposite(attributesSection); |
722 |
Composite toolbarComposite = toolkit.createComposite(attributesSection); |
|
Lines 807-817
Link Here
|
| 807 |
} |
828 |
} |
| 808 |
} |
829 |
} |
| 809 |
|
830 |
|
|
|
831 |
/** |
| 832 |
* @author Raphael Ackermann (modifications) (bug 195514) |
| 833 |
* @param composite |
| 834 |
*/ |
| 810 |
protected void createSummaryLayout(Composite composite) { |
835 |
protected void createSummaryLayout(Composite composite) { |
| 811 |
|
|
|
| 812 |
addSummaryText(composite); |
836 |
addSummaryText(composite); |
|
|
837 |
if (newSummaryTextViewer != null) { |
| 838 |
newSummaryTextViewer.getTextWidget().addModifyListener(new ModifyListener() { |
| 839 |
public void modifyText(ModifyEvent e) { |
| 840 |
String sel = summaryText.getText(); |
| 841 |
RepositoryTaskAttribute a = taskData.getAttribute(RepositoryTaskAttribute.SUMMARY); |
| 842 |
if (!(a.getValue().equals(sel))) { |
| 843 |
a.setValue(sel); |
| 844 |
markDirty(true); |
| 845 |
} |
| 846 |
} |
| 847 |
}); |
| 848 |
newSummaryTextViewer.prependVerifyKeyListener(new TabVerifyKeyListener()); |
| 849 |
} |
| 813 |
|
850 |
|
| 814 |
Composite headerInfoComposite = toolkit.createComposite(composite); |
851 |
headerInfoComposite = toolkit.createComposite(composite); |
| 815 |
GridLayout headerLayout = new GridLayout(11, false); |
852 |
GridLayout headerLayout = new GridLayout(11, false); |
| 816 |
headerLayout.verticalSpacing = 1; |
853 |
headerLayout.verticalSpacing = 1; |
| 817 |
headerLayout.marginHeight = 1; |
854 |
headerLayout.marginHeight = 1; |
|
Lines 1219-1228
Link Here
|
| 1219 |
} |
1256 |
} |
| 1220 |
|
1257 |
|
| 1221 |
/** |
1258 |
/** |
| 1222 |
* Adds a text field to display and edit the task's summary. |
1259 |
* Adds a text editor with spell checking enabled to display and edit the task's summary. |
| 1223 |
* |
1260 |
* |
|
|
1261 |
* @author Raphael Ackermann (modifications) (bug 195514) |
| 1224 |
* @param attributesComposite |
1262 |
* @param attributesComposite |
| 1225 |
* The composite to add the text field to. |
1263 |
* The composite to add the text editor to. |
| 1226 |
*/ |
1264 |
*/ |
| 1227 |
protected void addSummaryText(Composite attributesComposite) { |
1265 |
protected void addSummaryText(Composite attributesComposite) { |
| 1228 |
Composite summaryComposite = toolkit.createComposite(attributesComposite); |
1266 |
Composite summaryComposite = toolkit.createComposite(attributesComposite); |
|
Lines 1233-1263
Link Here
|
| 1233 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(summaryComposite); |
1271 |
GridDataFactory.fillDefaults().grab(true, false).applyTo(summaryComposite); |
| 1234 |
|
1272 |
|
| 1235 |
if (taskData != null) { |
1273 |
if (taskData != null) { |
| 1236 |
RepositoryTaskAttribute attribute = taskData.getAttribute(RepositoryTaskAttribute.SUMMARY); |
1274 |
final RepositoryTaskAttribute attribute = taskData.getAttribute(RepositoryTaskAttribute.SUMMARY); |
| 1237 |
if (attribute != null) { |
1275 |
if (attribute != null) { |
| 1238 |
// Label summaryLabel = createLabel(summaryComposite, |
1276 |
|
| 1239 |
// attribute); |
1277 |
newSummaryTextViewer = addTextEditor(repository, summaryComposite, attribute.getValue(), true, SWT.FLAT); |
| 1240 |
// summaryLabel.setFont(TITLE_FONT); |
1278 |
newSummaryTextViewer.setEditable(true); |
| 1241 |
summaryText = createTextField(summaryComposite, attribute, SWT.FLAT); |
1279 |
|
| 1242 |
IThemeManager themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager(); |
1280 |
GridDataFactory.fillDefaults().grab(true, false).hint(DESCRIPTION_WIDTH, SUMMARY_HEIGHT).applyTo( |
| 1243 |
Font summaryFont = themeManager.getCurrentTheme().getFontRegistry().get( |
1281 |
newSummaryTextViewer.getControl()); |
| 1244 |
TaskListColorsAndFonts.TASK_EDITOR_FONT); |
1282 |
newSummaryTextViewer.getControl().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); |
| 1245 |
summaryText.setFont(summaryFont); |
|
|
| 1246 |
|
| 1247 |
GridDataFactory.fillDefaults().grab(true, false).hint(DESCRIPTION_WIDTH, SWT.DEFAULT).applyTo( |
| 1248 |
summaryText); |
| 1249 |
summaryText.addModifyListener(new ModifyListener() { |
| 1250 |
public void modifyText(ModifyEvent e) { |
| 1251 |
String sel = summaryText.getText(); |
| 1252 |
RepositoryTaskAttribute a = taskData.getAttribute(RepositoryTaskAttribute.SUMMARY); |
| 1253 |
if (!(a.getValue().equals(sel))) { |
| 1254 |
a.setValue(sel); |
| 1255 |
markDirty(true); |
| 1256 |
} |
| 1257 |
} |
| 1258 |
}); |
| 1259 |
} |
1283 |
} |
| 1260 |
} |
1284 |
} |
|
|
1285 |
summaryText = newSummaryTextViewer.getTextWidget(); |
| 1261 |
toolkit.paintBordersFor(summaryComposite); |
1286 |
toolkit.paintBordersFor(summaryComposite); |
| 1262 |
} |
1287 |
} |
| 1263 |
|
1288 |
|
|
Lines 2663-2668
Link Here
|
| 2663 |
focusOn(addCommentsTextBox, false); |
2688 |
focusOn(addCommentsTextBox, false); |
| 2664 |
} |
2689 |
} |
| 2665 |
|
2690 |
|
|
|
2691 |
/** |
| 2692 |
* @author Raphael Ackermann (bug 195514) |
| 2693 |
*/ |
| 2694 |
protected void selectAttributes() { |
| 2695 |
focusOn(attributesSection, false); |
| 2696 |
} |
| 2697 |
|
| 2666 |
private void selectDescription() { |
2698 |
private void selectDescription() { |
| 2667 |
focusOn(descriptionTextViewer.getTextWidget(), false); |
2699 |
focusOn(descriptionTextViewer.getTextWidget(), false); |
| 2668 |
} |
2700 |
} |
|
Lines 2745-2750
Link Here
|
| 2745 |
|
2777 |
|
| 2746 |
private boolean formBusy = false; |
2778 |
private boolean formBusy = false; |
| 2747 |
|
2779 |
|
|
|
2780 |
private Composite headerInfoComposite; |
| 2781 |
|
| 2782 |
private Section attributesSection; |
| 2783 |
|
| 2748 |
public void close() { |
2784 |
public void close() { |
| 2749 |
Display activeDisplay = getSite().getShell().getDisplay(); |
2785 |
Display activeDisplay = getSite().getShell().getDisplay(); |
| 2750 |
activeDisplay.asyncExec(new Runnable() { |
2786 |
activeDisplay.asyncExec(new Runnable() { |
|
Lines 2793-2799
Link Here
|
| 2793 |
public void handleEvent(Event event) { |
2829 |
public void handleEvent(Event event) { |
| 2794 |
fireSelectionChanged(new SelectionChangedEvent(selectionProvider, new StructuredSelection( |
2830 |
fireSelectionChanged(new SelectionChangedEvent(selectionProvider, new StructuredSelection( |
| 2795 |
new RepositoryTaskSelection(taskData.getId(), taskData.getRepositoryUrl(), |
2831 |
new RepositoryTaskSelection(taskData.getId(), taskData.getRepositoryUrl(), |
| 2796 |
taskData.getRepositoryKind(), "New Comment", false, taskData.getSummary())))); |
2832 |
taskData.getRepositoryKind(), getSectionLabel(SECTION_NAME.NEWCOMMENT_SECTION), false, |
|
|
2833 |
taskData.getSummary())))); |
| 2797 |
} |
2834 |
} |
| 2798 |
} |
2835 |
} |