Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 199283 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaConnectorUi.java (-14 / +2 lines)
Lines 19-25 Link Here
19
import java.util.regex.Matcher;
19
import java.util.regex.Matcher;
20
import java.util.regex.Pattern;
20
import java.util.regex.Pattern;
21
21
22
import org.eclipse.core.runtime.Platform;
23
import org.eclipse.jface.resource.ImageDescriptor;
22
import org.eclipse.jface.resource.ImageDescriptor;
24
import org.eclipse.jface.text.Region;
23
import org.eclipse.jface.text.Region;
25
import org.eclipse.jface.text.hyperlink.IHyperlink;
24
import org.eclipse.jface.text.hyperlink.IHyperlink;
Lines 34-39 Link Here
34
import org.eclipse.mylyn.internal.bugzilla.ui.TaskAttachmentTableEditorHyperlink;
33
import org.eclipse.mylyn.internal.bugzilla.ui.TaskAttachmentTableEditorHyperlink;
35
import org.eclipse.mylyn.internal.bugzilla.ui.search.BugzillaSearchPage;
34
import org.eclipse.mylyn.internal.bugzilla.ui.search.BugzillaSearchPage;
36
import org.eclipse.mylyn.internal.bugzilla.ui.wizard.NewBugzillaTaskWizard;
35
import org.eclipse.mylyn.internal.bugzilla.ui.wizard.NewBugzillaTaskWizard;
36
import org.eclipse.mylyn.internal.provisional.commons.ui.PlatformUiUtil;
37
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
37
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
38
import org.eclipse.mylyn.tasks.core.ITask;
38
import org.eclipse.mylyn.tasks.core.ITask;
39
import org.eclipse.mylyn.tasks.core.ITaskComment;
39
import org.eclipse.mylyn.tasks.core.ITaskComment;
Lines 47-54 Link Here
47
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage;
47
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositoryQueryPage;
48
import org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPage;
48
import org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPage;
49
import org.eclipse.mylyn.tasks.ui.wizards.RepositoryQueryWizard;
49
import org.eclipse.mylyn.tasks.ui.wizards.RepositoryQueryWizard;
50
import org.osgi.framework.Bundle;
51
import org.osgi.framework.Version;
52
50
53
/**
51
/**
54
 * @author Mik Kersten
52
 * @author Mik Kersten
Lines 69-88 Link Here
69
67
70
	private static final Pattern PATTERN_ATTACHMENT = Pattern.compile(REGEXP_ATTACHMENT, Pattern.CASE_INSENSITIVE);
68
	private static final Pattern PATTERN_ATTACHMENT = Pattern.compile(REGEXP_ATTACHMENT, Pattern.CASE_INSENSITIVE);
71
69
72
	/*
73
	 * because of bug# 322293 (NPE when select Hyperlink from MultipleHyperlinkPresenter List)
74
	 * for MacOS we enable this only if running on Eclipse >= "3.7.0.v201101192000"
75
	 * 
76
	 */
77
	private final boolean doAttachmentTableEditorHyperlink;
70
	private final boolean doAttachmentTableEditorHyperlink;
78
71
79
	public BugzillaConnectorUi() {
72
	public BugzillaConnectorUi() {
80
		super();
73
		doAttachmentTableEditorHyperlink = PlatformUiUtil.supportsMultipleHyperlinkPresenter();
81
		Bundle bundle = Platform.getBundle("org.eclipse.platform"); //$NON-NLS-1$
82
		String versionString = bundle.getHeaders().get("Bundle-Version"); //$NON-NLS-1$
83
84
		Version version = new Version(versionString);
85
		doAttachmentTableEditorHyperlink = version.compareTo(new Version("3.7.0.v201101192000")) >= 0; //$NON-NLS-1$
86
	}
74
	}
87
75
88
	@Override
76
	@Override
(-)src/org/eclipse/mylyn/internal/provisional/commons/ui/PlatformUiUtil.java (+16 lines)
Lines 16-21 Link Here
16
import org.eclipse.core.runtime.Platform;
16
import org.eclipse.core.runtime.Platform;
17
import org.eclipse.swt.SWT;
17
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.custom.StyledText;
18
import org.eclipse.swt.custom.StyledText;
19
import org.osgi.framework.Bundle;
20
import org.osgi.framework.Version;
19
21
20
/**
22
/**
21
 * @author Steffen Pingel
23
 * @author Steffen Pingel
Lines 118-121 Link Here
118
		return 32;
120
		return 32;
119
	}
121
	}
120
122
123
	/**
124
	 * Because of bug# 322293 (NPE when select Hyperlink from MultipleHyperlinkPresenter List) for MacOS we enable this
125
	 * only if running on Eclipse >= "3.7.0.v201101192000"
126
	 */
127
	public static boolean supportsMultipleHyperlinkPresenter() {
128
		if (isMac()) {
129
			Bundle bundle = Platform.getBundle("org.eclipse.platform"); //$NON-NLS-1$
130
			String versionString = (String) bundle.getHeaders().get("Bundle-Version"); //$NON-NLS-1$
131
			Version version = new Version(versionString);
132
			return version.compareTo(new Version("3.7.0.v201101192000")) >= 0; //$NON-NLS-1$
133
		}
134
		return true;
135
	}
136
121
}
137
}
(-)src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorOutlineNode.java (-7 lines)
Lines 31-37 Link Here
31
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
31
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
32
import org.eclipse.mylyn.tasks.core.data.TaskData;
32
import org.eclipse.mylyn.tasks.core.data.TaskData;
33
import org.eclipse.mylyn.tasks.core.data.TaskRelation;
33
import org.eclipse.mylyn.tasks.core.data.TaskRelation;
34
import org.eclipse.mylyn.tasks.core.data.TaskRelation.Direction;
35
import org.eclipse.mylyn.tasks.ui.TasksUi;
34
import org.eclipse.mylyn.tasks.ui.TasksUi;
36
import org.eclipse.osgi.util.NLS;
35
import org.eclipse.osgi.util.NLS;
37
36
Lines 145-156 Link Here
145
						label = NLS.bind(Messages.TaskEditorOutlineNode_TaskRelation_Label,
144
						label = NLS.bind(Messages.TaskEditorOutlineNode_TaskRelation_Label,
146
								new Object[] { taskRelation.getTaskId(), Messages.TaskEditorOutlineNode_unknown_Label });
145
								new Object[] { taskRelation.getTaskId(), Messages.TaskEditorOutlineNode_unknown_Label });
147
					}
146
					}
148
149
					if (taskRelation.getDirection().compareTo(Direction.INWARD) == 0) {
150
						label = label + Messages.TaskEditorOutlineNode_ParentRelation;
151
					} else {
152
						label = label + Messages.TaskEditorOutlineNode_ChildRelation;
153
					}
154
					TaskEditorOutlineNode childNode = new TaskEditorOutlineNode(label);
147
					TaskEditorOutlineNode childNode = new TaskEditorOutlineNode(label);
155
148
156
					childNode.setTaskRelation(taskRelation);
149
					childNode.setTaskRelation(taskRelation);
(-)src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java (-40 / +1 lines)
Lines 1732-1777 Link Here
1732
1732
1733
	@Override
1733
	@Override
1734
	public boolean selectReveal(Object object) {
1734
	public boolean selectReveal(Object object) {
1735
		if (object instanceof String) {
1735
		if (object instanceof TaskEditorOutlineNode) {
1736
			String objString = (String) object;
1737
			if (objString != null && objString.startsWith(TaskAttribute.PREFIX_ATTACHMENT)) {
1738
				AbstractTaskEditorPart actionPart = this.getPart(AbstractTaskEditorPage.ID_PART_ATTACHMENTS);
1739
				if (actionPart != null && actionPart.getControl() instanceof ExpandableComposite) {
1740
					CommonFormUtil.setExpanded((ExpandableComposite) actionPart.getControl(), true);
1741
					if (actionPart.getControl() instanceof Section) {
1742
						Control client = actionPart.getControl();
1743
						if (client instanceof Composite) {
1744
							for (Control control : ((Composite) client).getChildren()) {
1745
								if (control instanceof Composite) {
1746
									for (Control control1 : ((Composite) control).getChildren()) {
1747
										if (control1 instanceof org.eclipse.swt.widgets.Table) {
1748
											org.eclipse.swt.widgets.Table attachmentTable = ((org.eclipse.swt.widgets.Table) control1);
1749
											TableItem[] attachments = attachmentTable.getItems();
1750
											int index = 0;
1751
											for (TableItem attachment : attachments) {
1752
												Object data = attachment.getData();
1753
												if (data instanceof ITaskAttachment) {
1754
													ITaskAttachment attachmentData = ((ITaskAttachment) data);
1755
													if (attachmentData.getTaskAttribute().getId().equals(objString)) {
1756
														attachmentTable.deselectAll();
1757
														attachmentTable.select(index);
1758
														IManagedForm mform = actionPart.getManagedForm();
1759
														ScrolledForm form = mform.getForm();
1760
														EditorUtil.focusOn(form, attachmentTable);
1761
														return true;
1762
													}
1763
												}
1764
												index++;
1765
											}
1766
										}
1767
									}
1768
								}
1769
							}
1770
						}
1771
					}
1772
				}
1773
			}
1774
		} else if (object instanceof TaskEditorOutlineNode) {
1775
			TaskEditorOutlineNode node = (TaskEditorOutlineNode) object;
1736
			TaskEditorOutlineNode node = (TaskEditorOutlineNode) object;
1776
			TaskAttribute attribute = node.getData();
1737
			TaskAttribute attribute = node.getData();
1777
			if (attribute != null) {
1738
			if (attribute != null) {

Return to bug 199283