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 145123 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylar/internal/sandbox/web/WebQueryWizardPage.java (-3 / +55 lines)
Lines 11-16 Link Here
11
import java.util.regex.Matcher;
11
import java.util.regex.Matcher;
12
import java.util.regex.Pattern;
12
import java.util.regex.Pattern;
13
13
14
import org.eclipse.jface.bindings.keys.KeyStroke;
15
import org.eclipse.jface.fieldassist.ContentProposalAdapter;
16
import org.eclipse.jface.fieldassist.IContentProposal;
17
import org.eclipse.jface.fieldassist.IContentProposalProvider;
18
import org.eclipse.jface.fieldassist.TextContentAdapter;
14
import org.eclipse.jface.wizard.WizardPage;
19
import org.eclipse.jface.wizard.WizardPage;
15
import org.eclipse.mylar.provisional.tasklist.AbstractRepositoryQuery;
20
import org.eclipse.mylar.provisional.tasklist.AbstractRepositoryQuery;
16
import org.eclipse.mylar.provisional.tasklist.MylarTaskListPlugin;
21
import org.eclipse.mylar.provisional.tasklist.MylarTaskListPlugin;
Lines 67-74 Link Here
67
		this.query = query;
72
		this.query = query;
68
73
69
		setTitle("Create web query");
74
		setTitle("Create web query");
70
		setDescription("http://subclipse.tigris.org/issues/buglist.cgi?issue_status=NEW;issue_status=STARTED;issue_status=REOPENED&order=issues.issue_id\n" +
75
		setDescription("Specify URL for web page that show query results and regexp to extract id and description " +
71
			"<a href=\"show_bug.cgi\\?id\\=(.+?)\">.+?<span class=\"summary\">(.+?)</span>");
76
				repository.getUrl());
72
	}
77
	}
73
78
74
	public void createControl(Composite parent) {
79
	public void createControl(Composite parent) {
Lines 118-124 Link Here
118
		regexpLabel.setText("Regexp:");
123
		regexpLabel.setText("Regexp:");
119
		regexpLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, true));
124
		regexpLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, true));
120
125
121
		regexpText = new Text(composite, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER);
126
		regexpText = new Text(composite, SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.WRAP);
122
		GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
127
		GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
123
		gridData.heightHint = 39;
128
		gridData.heightHint = 39;
124
		regexpText.setLayoutData(gridData);
129
		regexpText.setLayoutData(gridData);
Lines 129-134 Link Here
129
				}
134
				}
130
			}
135
			}
131
		});
136
		});
137
		
138
		
139
		ContentProposalAdapter adapter = new ContentProposalAdapter(regexpText, new TextContentAdapter(),
140
				new RegExpProposalProvider(), KeyStroke.getInstance(SWT.CTRL, ' '), null);
132
141
133
		previewTable = new Table(sashForm, SWT.BORDER);
142
		previewTable = new Table(sashForm, SWT.BORDER);
134
		previewTable.setLinesVisible(true);
143
		previewTable.setLinesVisible(true);
Lines 206-210 Link Here
206
		}
215
		}
207
		return webPage;
216
		return webPage;
208
	}
217
	}
218
219
220
	/**
221
	 * Simple proposal provider for regexps  
222
	 */
223
	private static final class RegExpProposalProvider implements IContentProposalProvider {
224
		private static final String[] LABELS = {
225
				"IssueZilla",
226
				"GForge",
227
				"Trac",
228
				"Jira"
229
			};
230
		private static final String[] PROPOSALS = {
231
				"<a href=\"show_bug.cgi\\?id\\=(.+?)\">.+?<span class=\"summary\">(.+?)</span>",
232
				"<a class=\"tracker\" href=\"/tracker/index.php\\?func=detail&aid=(.+?)&group_id=GROUP&atid=ATID\">(.+?)</a></td>",
233
				"<td class=\"summary\"><a title=\"View ticket\" href=\"/project/ticket/(.+?)\">(.+?)</a></td>",
234
				"<td class=\"nav summary\">\\s+?<a href=\"/browse/(.+?)\".+?>(.+?)</a>"
235
			};
236
237
		public IContentProposal[] getProposals(String contents, int position) {
238
			IContentProposal[] res = new IContentProposal[LABELS.length]; 
239
			for (int i = 0; i < LABELS.length; i++) {
240
				final String label = LABELS[i];
241
				final String content = PROPOSALS[i];
242
				res[i] = new IContentProposal() {
243
						public String getContent() {
244
							return content;
245
						}
246
						public int getCursorPosition() {
247
							return content.length();
248
						}
249
						public String getDescription() {
250
							return content;
251
						}
252
						public String getLabel() {
253
							return label;
254
						}
255
					};
256
			}
257
			return res;
258
		}
259
	}
209
	
260
	
210
}
261
}
262

Return to bug 145123