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/tasks/ui/ui/wizards/AbstractRepositorySettingsPage.java (-6 / +2 lines)
Lines 140-148 Link Here
140
					// ignore
140
					// ignore
141
				}
141
				}
142
			});
142
			});
143
144
			// Label anonymousLabel = new Label(container, SWT.NONE);
145
			// anonymousLabel.setText("");
146
		}
143
		}
147
144
148
		userNameEditor = new StringFieldEditor("", LABEL_USER, StringFieldEditor.UNLIMITED, container);
145
		userNameEditor = new StringFieldEditor("", LABEL_USER, StringFieldEditor.UNLIMITED, container);
Lines 151-160 Link Here
151
			oldUsername = repository.getUserName();
148
			oldUsername = repository.getUserName();
152
			oldPassword = repository.getPassword();
149
			oldPassword = repository.getPassword();
153
			try {
150
			try {
154
				String repositoryLabel = repository.getProperty(IRepositoryConstants.PROPERTY_LABEL);
151
				String repositoryLabel = repository.getRepositoryLabel();
155
				if (repositoryLabel != null && repositoryLabel.length() > 0) {
152
				if (repositoryLabel != null && repositoryLabel.length() > 0) {
156
					repositoryLabelCombo.add(repositoryLabel);
153
					repositoryLabelCombo.setText(repositoryLabel);
157
					repositoryLabelCombo.select(0);
158
				}
154
				}
159
				serverUrlEditor.setStringValue(repository.getUrl());
155
				serverUrlEditor.setStringValue(repository.getUrl());
160
				userNameEditor.setStringValue(repository.getUserName());
156
				userNameEditor.setStringValue(repository.getUserName());
(-)testsrc/org/eclipse/mylar/sandbox/tests/AllSandboxTests.java (+1 lines)
Lines 17-22 Link Here
17
		TestSuite suite = new TestSuite("Test for org.eclipse.mylar.sandbox.tests");
17
		TestSuite suite = new TestSuite("Test for org.eclipse.mylar.sandbox.tests");
18
		//$JUnit-BEGIN$
18
		//$JUnit-BEGIN$
19
		
19
		
20
//		suite.addTest(WebRepositoryConnectorTest.suite());
20
//		suite.addTestSuite(SharedTaskFolderTest.class);
21
//		suite.addTestSuite(SharedTaskFolderTest.class);
21
//		suite.addTestSuite(BugzillaActiveSearchTest.class);
22
//		suite.addTestSuite(BugzillaActiveSearchTest.class);
22
		//$JUnit-END$
23
		//$JUnit-END$
(-)src/org/eclipse/mylar/internal/sandbox/web/WebRepositoryConnector.java (+12 lines)
Lines 104-109 Link Here
104
			"http://sourceforge.net/tracker/index.php?func=detail&group_id=84122&atid=575154&aid=",
104
			"http://sourceforge.net/tracker/index.php?func=detail&group_id=84122&atid=575154&aid=",
105
			"http://sourceforge.net/tracker/?atid=575154&group_id=84122",
105
			"http://sourceforge.net/tracker/?atid=575154&group_id=84122",
106
		    "<a href=\"/tracker/index.php\\?func=detail&amp;aid=(.+?)&amp;group_id=84122&amp;atid=575154\">(.+?)</a>"),
106
		    "<a href=\"/tracker/index.php\\?func=detail&amp;aid=(.+?)&amp;group_id=84122&amp;atid=575154\">(.+?)</a>"),
107
		new WebRepositoryTemplate("phpbb.com (phpBB)", 
108
			"http://www.phpbb.com/phpBB/",
109
			"http://www.phpbb.com/phpBB/posting.php?mode=newtopic&f=1",
110
			"http://www.phpbb.com/phpBB/viewtopic.php?t=",
111
			"http://www.phpbb.com/phpBB/viewforum.php?f=1",
112
		    "<a href=\"viewtopic.php\\?t=(\\d+?)(?:&.+?)?\" class=\"topictitle\">(.+?)</a>"),
113
		new WebRepositoryTemplate("Spring IDE Forum (vBulletin)", 
114
			"http://forum.springframework.org/forumdisplay.php?f=32",
115
			"http://forum.springframework.org/newthread.php?do=newthread&f=32",
116
			"http://forum.springframework.org/showthread.php?t=",
117
			"http://forum.springframework.org/forumdisplay.php?f=32",
118
		    "<a href=\"showthread.php\\?.+?t=(\\d+?)\" id=\"thread_title_\\1\">(.+?)</a>"),
107
	};
119
	};
108
	
120
	
109
	
121
	
(-)src/org/eclipse/mylar/internal/sandbox/web/WebRepositorySettingsPage.java (-81 / +30 lines)
Lines 22-110 Link Here
22
import org.eclipse.swt.widgets.Composite;
22
import org.eclipse.swt.widgets.Composite;
23
23
24
/**
24
/**
25
 * Settings page for generic web-based repository connector
25
 * Settings page for generic web-based repository connector 
26
 * 
26
 * 
27
 * @author Eugene Kuleshov
27
 * @author Eugene Kuleshov
28
 */
28
 */
29
public class WebRepositorySettingsPage extends AbstractRepositorySettingsPage implements IPropertyChangeListener {
29
public class WebRepositorySettingsPage extends AbstractRepositorySettingsPage implements IPropertyChangeListener {
30
	private static final String TITLE = "Web Repository Settings";
30
	private static final String TITLE = "Web Repository Settings";
31
32
	private static final String DESCRIPTION = "Generic web-based repository connector";
31
	private static final String DESCRIPTION = "Generic web-based repository connector";
33
32
34
	protected StringFieldEditor taskPrefixUrlEditor;
33
	protected StringFieldEditor taskPrefixUrlEditor;
35
36
	protected StringFieldEditor newTaskUrlEditor;
34
	protected StringFieldEditor newTaskUrlEditor;
37
35
	
38
	private static WebRepositoryInfo[] REPOSITORY_TEMPLATES = {
36
	
39
			new WebRepositoryInfo(
40
					"Subclipse (IssueZilla)",
41
					// "http://subclipse.tigris.org/issues/buglist.cgi?issue_status=NEW&issue_status=STARTED&issue_status=REOPENED&order=Issue+Number",
42
					"http://subclipse.tigris.org/issues/",
43
					"http://subclipse.tigris.org/issues/enter_bug.cgi?component=subclipse",
44
					"http://subclipse.tigris.org/issues/show_bug.cgi?id="),
45
			new WebRepositoryInfo(
46
					"GlasFish (IssueZilla)",
47
					// "https://glassfish.dev.java.net/issues/buglist.cgi?component=glassfish&issue_status=NEW&issue_status=STARTED&issue_status=REOPENED&order=Issue+Number",
48
					"https://glassfish.dev.java.net/servlets/ProjectIssues",
49
					"https://glassfish.dev.java.net/issues/enter_bug.cgi?issue_type=DEFECT",
50
					"https://glassfish.dev.java.net/issues/show_bug.cgi?id="),
51
			new WebRepositoryInfo("Spring Framework (Jira)",
52
					"http://opensource.atlassian.com/projects/spring/browse/SPR",
53
					"http://opensource.atlassian.com/projects/spring/secure/CreateIssue!default.jspa",
54
					"http://opensource.atlassian.com/projects/spring/browse/"),
55
			new WebRepositoryInfo("ASM (GForge)", "http://forge.objectweb.org/tracker/?atid=100023&group_id=23",
56
					"http://forge.objectweb.org/tracker/?func=add&group_id=23&atid=100023",
57
					"http://forge.objectweb.org/tracker/index.php?func=detail&group_id=23&atid=100023&aid="),
58
			new WebRepositoryInfo("edgewall.org (Trac)",
59
					// "http://trac.edgewall.org/query?status=new&status=assigned&status=reopened&order=id"
60
					"http://trac.edgewall.org/", "http://trac.edgewall.org/newticket",
61
					"http://trac.edgewall.org/ticket/"), };
62
63
	public WebRepositorySettingsPage(AbstractRepositoryConnector connector) {
37
	public WebRepositorySettingsPage(AbstractRepositoryConnector connector) {
64
		super(TITLE, DESCRIPTION, connector);
38
		super(TITLE, DESCRIPTION, connector);
65
	}
39
	}
66
40
67
	@Override
41
	@Override
68
	protected void createAdditionalControls(Composite parent) {
42
	protected void createAdditionalControls(Composite parent) {
69
		for (WebRepositoryInfo info : REPOSITORY_TEMPLATES) {
43
		for (WebRepositoryTemplate template : WebRepositoryConnector.REPOSITORY_TEMPLATES) {
70
			if (repositoryLabelCombo.indexOf(info.label) == -1) {
44
			if(repositoryLabelCombo.indexOf(template.label)==-1) { 
71
				repositoryLabelCombo.add(info.label);
45
				repositoryLabelCombo.add(template.label);
72
			}
46
			}
73
		}
47
		}
74
48
		
75
		repositoryLabelCombo.addSelectionListener(new SelectionListener() {
49
		repositoryLabelCombo.addSelectionListener(new SelectionListener() {
76
50
77
			public void widgetSelected(SelectionEvent e) {
51
				public void widgetSelected(SelectionEvent e) {
78
				WebRepositoryInfo info = getInfo(repositoryLabelCombo.getText());
52
					WebRepositoryTemplate template = WebRepositoryConnector.getTemplate(repositoryLabelCombo.getText());
79
				if (info != null) {
53
					if(template!=null) {
80
					serverUrlEditor.setStringValue(info.repositoryUrl);
54
						serverUrlEditor.setStringValue(template.url);
81
					taskPrefixUrlEditor.setStringValue(info.taskPrefix);
55
						taskPrefixUrlEditor.setStringValue(template.prefix);
82
					newTaskUrlEditor.setStringValue(info.newTaskUrl);
56
						newTaskUrlEditor.setStringValue(template.newTask);
83
				}
84
			}
85
86
			public void widgetDefaultSelected(SelectionEvent e) {
87
				// ignore
88
			}
89
90
			private WebRepositoryInfo getInfo(String text) {
91
				for (WebRepositoryInfo info : REPOSITORY_TEMPLATES) {
92
					if (text.equals(info.label)) {
93
						return info;
94
					}
57
					}
95
				}
58
				}
96
				return null;
97
			}
98
		});
99
59
100
		taskPrefixUrlEditor = new StringFieldEditor("taskPrefixUrl", "Task prefix URL:", StringFieldEditor.UNLIMITED,
60
				public void widgetDefaultSelected(SelectionEvent e) {
101
				parent);
61
					// ignore
62
				}
63
				
64
			});
65
		
66
		taskPrefixUrlEditor = new StringFieldEditor("taskPrefixUrl", "Task prefix URL:", StringFieldEditor.UNLIMITED, parent);
102
		taskPrefixUrlEditor.setPropertyChangeListener(this);
67
		taskPrefixUrlEditor.setPropertyChangeListener(this);
103
68
		
104
		newTaskUrlEditor = new StringFieldEditor("newTaskUrl", "New task URL:", StringFieldEditor.UNLIMITED, parent);
69
		newTaskUrlEditor = new StringFieldEditor("newTaskUrl", "New task URL:", StringFieldEditor.UNLIMITED, parent);
105
		newTaskUrlEditor.setPropertyChangeListener(this);
70
		newTaskUrlEditor.setPropertyChangeListener(this);
106
71
		
107
		if (repository != null) {
72
		if(repository!=null) {
108
			taskPrefixUrlEditor.setStringValue(repository.getProperty(WebRepositoryConnector.PROPERTY_TASK_PREFIX_URL));
73
			taskPrefixUrlEditor.setStringValue(repository.getProperty(WebRepositoryConnector.PROPERTY_TASK_PREFIX_URL));
109
			newTaskUrlEditor.setStringValue(repository.getProperty(WebRepositoryConnector.PROPERTY_NEW_TASK_URL));
74
			newTaskUrlEditor.setStringValue(repository.getProperty(WebRepositoryConnector.PROPERTY_NEW_TASK_URL));
110
		}
75
		}
Lines 118-128 Link Here
118
		// ignore
83
		// ignore
119
	}
84
	}
120
85
86
	
121
	// IPropertyChangeListener
87
	// IPropertyChangeListener
122
88
	
123
	public void propertyChange(PropertyChangeEvent event) {
89
	public void propertyChange(PropertyChangeEvent event) {
124
		Object source = event.getSource();
90
		Object source = event.getSource();
125
		if (source == taskPrefixUrlEditor || source == newTaskUrlEditor) {
91
		if(source==taskPrefixUrlEditor || source == newTaskUrlEditor) {
126
			getWizard().getContainer().updateButtons();
92
			getWizard().getContainer().updateButtons();
127
		}
93
		}
128
	}
94
	}
Lines 130-156 Link Here
130
	@Override
96
	@Override
131
	public TaskRepository createTaskRepository() {
97
	public TaskRepository createTaskRepository() {
132
		TaskRepository repository = super.createTaskRepository();
98
		TaskRepository repository = super.createTaskRepository();
133
		repository.setProperty(WebRepositoryConnector.PROPERTY_TASK_PREFIX_URL, taskPrefixUrlEditor.getStringValue());
99
		repository.setProperty(WebRepositoryConnector.PROPERTY_TASK_PREFIX_URL, taskPrefixUrlEditor.getStringValue()); 
134
		repository.setProperty(WebRepositoryConnector.PROPERTY_NEW_TASK_URL, newTaskUrlEditor.getStringValue());
100
		repository.setProperty(WebRepositoryConnector.PROPERTY_NEW_TASK_URL, newTaskUrlEditor.getStringValue()); 
135
		return repository;
101
		return repository;
136
	}
102
	}
137
103
	
138
	private static class WebRepositoryInfo {
139
		public final String label;
140
141
		public final String repositoryUrl;
142
143
		public final String newTaskUrl;
144
145
		public final String taskPrefix;
146
147
		public WebRepositoryInfo(String label, String repositoryUrl, String newTaskUrl, String taskPrefix) {
148
			this.label = label;
149
			this.repositoryUrl = repositoryUrl;
150
			this.newTaskUrl = newTaskUrl;
151
			this.taskPrefix = taskPrefix;
152
		}
153
154
	}
155
156
}
104
}
105

Return to bug 145123