View | Details | Raw Unified | Return to bug 244653 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskEditorExtensions.java (-3 / +20 lines)
Lines 86-93 Link Here
86
		init();
86
		init();
87
		String id = taskRepository.getProperty(REPOSITORY_PROPERTY_EDITOR_EXTENSION);
87
		String id = taskRepository.getProperty(REPOSITORY_PROPERTY_EDITOR_EXTENSION);
88
		if (id == null) {
88
		if (id == null) {
89
			// TODO 3.1 disabled until bug 244653 is resolved
89
			id = getDefaultTaskEditorExtensionId(taskRepository);
90
			//id = getDefaultTaskEditorExtensionId(taskRepository);
91
		}
90
		}
92
		return id;
91
		return id;
93
	}
92
	}
Lines 96-104 Link Here
96
		repository.setProperty(REPOSITORY_PROPERTY_EDITOR_EXTENSION, editorExtensionId);
95
		repository.setProperty(REPOSITORY_PROPERTY_EDITOR_EXTENSION, editorExtensionId);
97
	}
96
	}
98
97
98
	/**
99
	 * Get the default task editor extension id for the given task repository
100
	 * 
101
	 * @param taskRepository
102
	 * @return the default task editor extension id or null if there is no default
103
	 */
99
	public static String getDefaultTaskEditorExtensionId(TaskRepository taskRepository) {
104
	public static String getDefaultTaskEditorExtensionId(TaskRepository taskRepository) {
105
		return getDefaultTaskEditorExtensionId(taskRepository.getConnectorKind());
106
	}
107
108
	/**
109
	 * Get the default task editor extension id for the given kind of connector
110
	 * 
111
	 * @param connectorKind
112
	 *            the kind of connector
113
	 * 
114
	 * @return the default task editor extension id or null if there is no default
115
	 */
116
	public static String getDefaultTaskEditorExtensionId(String connectorKind) {
100
		init();
117
		init();
101
		return associationByConnectorKind.get(taskRepository.getConnectorKind());
118
		return associationByConnectorKind.get(connectorKind);
102
	}
119
	}
103
120
104
	/**
121
	/**
(-)src/org/eclipse/mylyn/internal/tasks/ui/wizards/EditRepositoryWizard.java (-1 / +4 lines)
Lines 18-23 Link Here
18
import org.eclipse.jface.viewers.IStructuredSelection;
18
import org.eclipse.jface.viewers.IStructuredSelection;
19
import org.eclipse.jface.wizard.Wizard;
19
import org.eclipse.jface.wizard.Wizard;
20
import org.eclipse.mylyn.commons.core.StatusHandler;
20
import org.eclipse.mylyn.commons.core.StatusHandler;
21
import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
21
import org.eclipse.mylyn.internal.tasks.ui.RefactorRepositoryUrlOperation;
22
import org.eclipse.mylyn.internal.tasks.ui.RefactorRepositoryUrlOperation;
22
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
23
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
23
import org.eclipse.mylyn.tasks.core.TaskRepository;
24
import org.eclipse.mylyn.tasks.core.TaskRepository;
Lines 72-78 Link Here
72
73
73
			repository.flushAuthenticationCredentials();
74
			repository.flushAuthenticationCredentials();
74
75
75
			repository.setRepositoryUrl(newUrl);
76
			if (!repository.getConnectorKind().equals(LocalRepositoryConnector.CONNECTOR_KIND)) {
77
				repository.setRepositoryUrl(newUrl);
78
			}
76
			settingsPage.applyTo(repository);
79
			settingsPage.applyTo(repository);
77
			if (oldUrl != null && newUrl != null && !oldUrl.equals(newUrl)) {
80
			if (oldUrl != null && newUrl != null && !oldUrl.equals(newUrl)) {
78
				TasksUiPlugin.getRepositoryManager().notifyRepositoryUrlChanged(repository, oldUrl);
81
				TasksUiPlugin.getRepositoryManager().notifyRepositoryUrlChanged(repository, oldUrl);
(-)plugin.xml (+7 lines)
Lines 8-13 Link Here
8
    <extension-point id="duplicateDetectors" name="duplicateDetectors" schema="schema/duplicateDetectors.exsd"/>
8
    <extension-point id="duplicateDetectors" name="duplicateDetectors" schema="schema/duplicateDetectors.exsd"/>
9
    <extension-point id="presentations" name="presentations" schema="schema/presentations.exsd"/>
9
    <extension-point id="presentations" name="presentations" schema="schema/presentations.exsd"/>
10
    <extension-point id="taskEditorExtensions" name="Task Editor Extension" schema="schema/taskEditorExtensions.exsd"/>
10
    <extension-point id="taskEditorExtensions" name="Task Editor Extension" schema="schema/taskEditorExtensions.exsd"/>
11
    <extension-point id="taskRepositoryPageContributor" name="Task Repository Page Contributor" schema="schema/taskRepositoryPageContributor.exsd"/>
11
12
12
    <extension
13
    <extension
13
          point="org.eclipse.mylyn.context.core.bridges">
14
          point="org.eclipse.mylyn.context.core.bridges">
Lines 1780-1783 Link Here
1780
            type="org.eclipse.mylyn.tasks.core.TaskRepository">
1781
            type="org.eclipse.mylyn.tasks.core.TaskRepository">
1781
      </propertyTester>
1782
      </propertyTester>
1782
   </extension>
1783
   </extension>
1784
    <extension
1785
          point="org.eclipse.mylyn.tasks.ui.taskRepositoryPageContributor">
1786
       <taskRepositoryPageContributor
1787
             class="org.eclipse.mylyn.internal.tasks.ui.wizards.TaskEditorExtensionSettingsContributor">
1788
       </taskRepositoryPageContributor>
1789
    </extension>
1783
</plugin>
1790
</plugin>
(-)src/org/eclipse/mylyn/internal/tasks/ui/LocalRepositoryConnectorUi.java (-1 / +2 lines)
Lines 14-19 Link Here
14
import org.eclipse.jface.resource.ImageDescriptor;
14
import org.eclipse.jface.resource.ImageDescriptor;
15
import org.eclipse.jface.wizard.IWizard;
15
import org.eclipse.jface.wizard.IWizard;
16
import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
16
import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
17
import org.eclipse.mylyn.internal.tasks.ui.wizards.LocalRepositorySettingsPage;
17
import org.eclipse.mylyn.internal.tasks.ui.wizards.NewLocalTaskWizard;
18
import org.eclipse.mylyn.internal.tasks.ui.wizards.NewLocalTaskWizard;
18
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
19
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
19
import org.eclipse.mylyn.tasks.core.ITask;
20
import org.eclipse.mylyn.tasks.core.ITask;
Lines 50-56 Link Here
50
51
51
	@Override
52
	@Override
52
	public ITaskRepositoryPage getSettingsPage(TaskRepository taskRepository) {
53
	public ITaskRepositoryPage getSettingsPage(TaskRepository taskRepository) {
53
		return null;
54
		return new LocalRepositorySettingsPage(taskRepository);
54
	}
55
	}
55
56
56
	@Override
57
	@Override
(-)src/org/eclipse/mylyn/tasks/ui/wizards/AbstractRepositorySettingsPage.java (-18 / +42 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
* Copyright (c) 2004, 2008 Tasktop Technologies and others.
2
 * Copyright (c) 2004, 2008 Tasktop Technologies and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 28-34 Link Here
28
import org.eclipse.jface.operation.IRunnableWithProgress;
28
import org.eclipse.jface.operation.IRunnableWithProgress;
29
import org.eclipse.jface.preference.PreferenceDialog;
29
import org.eclipse.jface.preference.PreferenceDialog;
30
import org.eclipse.jface.preference.StringFieldEditor;
30
import org.eclipse.jface.preference.StringFieldEditor;
31
import org.eclipse.jface.wizard.WizardPage;
32
import org.eclipse.mylyn.commons.core.StatusHandler;
31
import org.eclipse.mylyn.commons.core.StatusHandler;
33
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
32
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
34
import org.eclipse.mylyn.commons.net.AuthenticationType;
33
import org.eclipse.mylyn.commons.net.AuthenticationType;
Lines 67-73 Link Here
67
import org.eclipse.ui.forms.events.HyperlinkEvent;
66
import org.eclipse.ui.forms.events.HyperlinkEvent;
68
import org.eclipse.ui.forms.events.IHyperlinkListener;
67
import org.eclipse.ui.forms.events.IHyperlinkListener;
69
import org.eclipse.ui.forms.widgets.ExpandableComposite;
68
import org.eclipse.ui.forms.widgets.ExpandableComposite;
70
import org.eclipse.ui.forms.widgets.FormToolkit;
71
import org.eclipse.ui.forms.widgets.Hyperlink;
69
import org.eclipse.ui.forms.widgets.Hyperlink;
72
70
73
/**
71
/**
Lines 78-85 Link Here
78
 * @author Rob Elves
76
 * @author Rob Elves
79
 * @author Steffen Pingel
77
 * @author Steffen Pingel
80
 * @author Frank Becker
78
 * @author Frank Becker
79
 * @author David Green
81
 */
80
 */
82
public abstract class AbstractRepositorySettingsPage extends WizardPage implements ITaskRepositoryPage {
81
public abstract class AbstractRepositorySettingsPage extends AbstractExtensibleRepositorySettingsPage implements
82
		ITaskRepositoryPage {
83
83
84
	protected static final String PREFS_PAGE_ID_NET_PROXY = "org.eclipse.ui.net.NetPreferences";
84
	protected static final String PREFS_PAGE_ID_NET_PROXY = "org.eclipse.ui.net.NetPreferences";
85
85
Lines 205-222 Link Here
205
205
206
	private Button disconnectedButton;
206
	private Button disconnectedButton;
207
207
208
	// TODO 3.1 make accessible to subclasses 
209
	private FormToolkit toolkit;
210
211
	/**
208
	/**
212
	 * @since 3.0
209
	 * @since 3.0
213
	 */
210
	 */
214
	public AbstractRepositorySettingsPage(String title, String description, TaskRepository taskRepository) {
211
	public AbstractRepositorySettingsPage(String title, String description, TaskRepository taskRepository) {
215
		super(title);
212
		super(title, description, taskRepository);
216
		this.repository = taskRepository;
217
		this.connector = TasksUi.getRepositoryManager().getRepositoryConnector(getConnectorKind());
213
		this.connector = TasksUi.getRepositoryManager().getRepositoryConnector(getConnectorKind());
218
		setTitle(title);
219
		setDescription(description);
220
		setNeedsAnonymousLogin(false);
214
		setNeedsAnonymousLogin(false);
221
		setNeedsEncoding(true);
215
		setNeedsEncoding(true);
222
		setNeedsTimeZone(true);
216
		setNeedsTimeZone(true);
Lines 228-247 Link Here
228
	/**
222
	/**
229
	 * @since 3.0
223
	 * @since 3.0
230
	 */
224
	 */
225
	@Override
231
	public abstract String getConnectorKind();
226
	public abstract String getConnectorKind();
232
227
233
	@Override
228
	@Override
234
	public void dispose() {
229
	public void dispose() {
235
		super.dispose();
230
		super.dispose();
236
		if (toolkit != null) {
237
			toolkit.dispose();
238
			toolkit = null;
239
		}
240
	}
231
	}
241
232
242
	public void createControl(Composite parent) {
233
	@Override
243
		toolkit = new FormToolkit(TasksUiPlugin.getDefault().getFormColors(parent.getDisplay()));
234
	protected void createContents(Composite parent) {
235
		createSettingControls(parent);
236
	}
244
237
238
	@Override
239
	protected void createSettingControls(Composite parent) {
245
		if (repository != null) {
240
		if (repository != null) {
246
			originalUrl = repository.getRepositoryUrl();
241
			originalUrl = repository.getRepositoryUrl();
247
			AuthenticationCredentials oldCredentials = repository.getCredentials(AuthenticationType.REPOSITORY);
242
			AuthenticationCredentials oldCredentials = repository.getCredentials(AuthenticationType.REPOSITORY);
Lines 628-633 Link Here
628
623
629
		addStatusSection();
624
		addStatusSection();
630
625
626
		addContributionSection();
627
631
		Composite managementComposite = new Composite(compositeContainer, SWT.NULL);
628
		Composite managementComposite = new Composite(compositeContainer, SWT.NULL);
632
		GridLayout managementLayout = new GridLayout(4, false);
629
		GridLayout managementLayout = new GridLayout(4, false);
633
		managementLayout.marginHeight = 0;
630
		managementLayout.marginHeight = 0;
Lines 701-707 Link Here
701
698
702
		updateHyperlinks();
699
		updateHyperlinks();
703
700
704
		setControl(compositeContainer);
705
	}
701
	}
706
702
707
	private void addProxySection() {
703
	private void addProxySection() {
Lines 855-860 Link Here
855
		proxyExpComposite.setExpanded(!systemProxyButton.getSelection());
851
		proxyExpComposite.setExpanded(!systemProxyButton.getSelection());
856
	}
852
	}
857
853
854
	private void addContributionSection() {
855
		Composite composite = toolkit.createComposite(compositeContainer);
856
		GridDataFactory.fillDefaults().grab(true, false).span(2, SWT.DEFAULT).applyTo(composite);
857
858
		GridLayout layout = new GridLayout(1, false);
859
		layout.marginWidth = 0;
860
		layout.marginTop = -5;
861
		composite.setLayout(layout);
862
863
		composite.setBackground(compositeContainer.getBackground());
864
865
		addContributions(composite);
866
	}
867
858
	private void addStatusSection() {
868
	private void addStatusSection() {
859
		ExpandableComposite statusComposite = toolkit.createExpandableComposite(compositeContainer,
869
		ExpandableComposite statusComposite = toolkit.createExpandableComposite(compositeContainer,
860
				ExpandableComposite.COMPACT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
870
				ExpandableComposite.COMPACT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
Lines 1269-1274 Link Here
1269
	/**
1279
	/**
1270
	 * @since 2.2
1280
	 * @since 2.2
1271
	 */
1281
	 */
1282
	@Override
1272
	public void applyTo(TaskRepository repository) {
1283
	public void applyTo(TaskRepository repository) {
1273
		repository.setVersion(getVersion());
1284
		repository.setVersion(getVersion());
1274
		if (needsEncoding()) {
1285
		if (needsEncoding()) {
Lines 1307-1312 Link Here
1307
		}
1318
		}
1308
1319
1309
		repository.setOffline(disconnectedButton.getSelection());
1320
		repository.setOffline(disconnectedButton.getSelection());
1321
1322
		super.applyTo(repository);
1310
	}
1323
	}
1311
1324
1312
	public AbstractRepositoryConnector getConnector() {
1325
	public AbstractRepositoryConnector getConnector() {
Lines 1413-1418 Link Here
1413
		}
1426
		}
1414
	}
1427
	}
1415
1428
1429
	/**
1430
	 * validate settings provided by the {@link #getValidator(TaskRepository) validator}, typically the server settings.
1431
	 */
1416
	protected void validateSettings() {
1432
	protected void validateSettings() {
1417
		final Validator validator = getValidator(createTaskRepository());
1433
		final Validator validator = getValidator(createTaskRepository());
1418
		if (validator == null) {
1434
		if (validator == null) {
Lines 1453-1458 Link Here
1453
		getWizard().getContainer().updateButtons();
1469
		getWizard().getContainer().updateButtons();
1454
	}
1470
	}
1455
1471
1472
	/**
1473
	 * @since 3.1
1474
	 */
1475
	@Override
1476
	protected IStatus validate(IProgressMonitor monitor) {
1477
		return null;
1478
	}
1479
1456
	protected void applyValidatorResult(Validator validator) {
1480
	protected void applyValidatorResult(Validator validator) {
1457
		IStatus status = validator.getStatus();
1481
		IStatus status = validator.getStatus();
1458
		String message = status.getMessage();
1482
		String message = status.getMessage();
(-)src/org/eclipse/mylyn/tasks/ui/wizards/AbstractExtensibleRepositorySettingsPage.java (+377 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2008 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.tasks.ui.wizards;
10
11
import java.lang.reflect.InvocationTargetException;
12
import java.util.ArrayList;
13
import java.util.Collections;
14
import java.util.Comparator;
15
import java.util.List;
16
17
import org.eclipse.core.runtime.IConfigurationElement;
18
import org.eclipse.core.runtime.IExtension;
19
import org.eclipse.core.runtime.IExtensionPoint;
20
import org.eclipse.core.runtime.IExtensionRegistry;
21
import org.eclipse.core.runtime.IProgressMonitor;
22
import org.eclipse.core.runtime.IStatus;
23
import org.eclipse.core.runtime.MultiStatus;
24
import org.eclipse.core.runtime.Platform;
25
import org.eclipse.core.runtime.Status;
26
import org.eclipse.core.runtime.SubProgressMonitor;
27
import org.eclipse.jface.dialogs.IMessageProvider;
28
import org.eclipse.jface.layout.GridDataFactory;
29
import org.eclipse.jface.operation.IRunnableWithProgress;
30
import org.eclipse.jface.wizard.WizardPage;
31
import org.eclipse.mylyn.commons.core.StatusHandler;
32
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
33
import org.eclipse.mylyn.tasks.core.TaskRepository;
34
import org.eclipse.swt.SWT;
35
import org.eclipse.swt.layout.GridLayout;
36
import org.eclipse.swt.widgets.Composite;
37
import org.eclipse.ui.forms.events.ExpansionAdapter;
38
import org.eclipse.ui.forms.events.ExpansionEvent;
39
import org.eclipse.ui.forms.widgets.ExpandableComposite;
40
import org.eclipse.ui.forms.widgets.FormToolkit;
41
42
/**
43
 * An abstract base class for repository settings page that supports the <code>taskRepositoryPageContributor</code>
44
 * extension point.
45
 * 
46
 * {@link ITaskRepositoryPage} implementations are encouraged to extend {@link AbstractRepositorySettingsPage} if
47
 * possible as it provides a standard UI for managing server settings.
48
 * 
49
 * @see AbstractRepositorySettingsPage
50
 * 
51
 * @since 3.1
52
 * 
53
 * @author David Green
54
 */
55
public abstract class AbstractExtensibleRepositorySettingsPage extends WizardPage implements ITaskRepositoryPage {
56
57
	private static final String KIND = "connectorKind";
58
59
	private static final String TASK_REPOSITORY_PAGE_CONTRIBUTOR = "taskRepositoryPageContributor";
60
61
	private static final String TASK_REPOSITORY_PAGE_CONTRIBUTOR_EXTENSION = "org.eclipse.mylyn.tasks.ui.taskRepositoryPageContributor";
62
63
	private static final Comparator<AbstractTaskRepositoryPageContribution> CONTRIBUTION_COMPARATOR = new ContributionComparator();
64
65
	protected final TaskRepository repository;
66
67
	private final List<AbstractTaskRepositoryPageContribution> contributions = new ArrayList<AbstractTaskRepositoryPageContribution>();
68
69
	protected FormToolkit toolkit;
70
71
	protected Composite compositeContainer;
72
73
	private final AbstractTaskRepositoryPageContribution.Listener contributionListener = new AbstractTaskRepositoryPageContribution.Listener() {
74
		public void validationRequired(AbstractTaskRepositoryPageContribution contribution) {
75
			validatePageSettings();
76
		}
77
	};
78
79
	public AbstractExtensibleRepositorySettingsPage(String title, String description, TaskRepository repository) {
80
		super(title);
81
		if (repository != null && !repository.getConnectorKind().equals(getConnectorKind())) {
82
			throw new IllegalArgumentException();
83
		}
84
		this.repository = repository;
85
		setTitle(title);
86
		setDescription(description);
87
	}
88
89
	/**
90
	 * Get the kind of connector supported by this page.
91
	 * 
92
	 * @return the kind of connector, never null
93
	 */
94
	public abstract String getConnectorKind();
95
96
	@Override
97
	public void dispose() {
98
		if (toolkit != null) {
99
			toolkit.dispose();
100
			toolkit = null;
101
		}
102
		super.dispose();
103
	}
104
105
	public void createControl(Composite parent) {
106
		toolkit = new FormToolkit(TasksUiPlugin.getDefault().getFormColors(parent.getDisplay()));
107
108
		compositeContainer = new Composite(parent, SWT.NULL);
109
		GridLayout layout = new GridLayout(1, true);
110
		compositeContainer.setLayout(layout);
111
112
		createContents(compositeContainer);
113
114
		setControl(compositeContainer);
115
	}
116
117
	/**
118
	 * Create the contents of the page. Subclasses may override this method to change where the contributions are added.
119
	 */
120
	protected void createContents(Composite parent) {
121
		createSettingControls(parent);
122
123
		addContributions(parent);
124
	}
125
126
	/**
127
	 * create the controls of this page
128
	 */
129
	protected abstract void createSettingControls(Composite parent);
130
131
	@Override
132
	public boolean isPageComplete() {
133
		return super.isPageComplete() && conributionsIsPageComplete();
134
	}
135
136
	@Override
137
	public boolean canFlipToNextPage() {
138
		return super.canFlipToNextPage() && contributionsCanFlipToNextPage();
139
	}
140
141
	private boolean contributionsCanFlipToNextPage() {
142
		for (AbstractTaskRepositoryPageContribution contribution : contributions) {
143
			if (!contribution.canFlipToNextPage()) {
144
				return false;
145
			}
146
		}
147
		return true;
148
	}
149
150
	private boolean conributionsIsPageComplete() {
151
		for (AbstractTaskRepositoryPageContribution contribution : contributions) {
152
			if (!contribution.isPageComplete()) {
153
				return false;
154
			}
155
		}
156
		return true;
157
	}
158
159
	/**
160
	 * subclasses should only call this method if they override {@link #createContents(Composite)}
161
	 * 
162
	 * @param parentControl
163
	 *            the container into which the contributions will create their UI
164
	 */
165
	protected void addContributions(Composite parentControl) {
166
		List<ITaskRepositoryPageContributor> contributors = findApplicableContributors();
167
		for (ITaskRepositoryPageContributor contributor : contributors) {
168
			AbstractTaskRepositoryPageContribution contribution = contributor.createContribution(getConnectorKind(),
169
					repository);
170
			if (contribution != null) {
171
				contributions.add(contribution);
172
				contribution.addListener(contributionListener);
173
			}
174
		}
175
		if (!contributions.isEmpty()) {
176
			Collections.sort(contributions, CONTRIBUTION_COMPARATOR);
177
178
			for (AbstractTaskRepositoryPageContribution contribution : contributions) {
179
180
				ExpandableComposite section = toolkit.createExpandableComposite(parentControl,
181
						ExpandableComposite.COMPACT | ExpandableComposite.TWISTIE | ExpandableComposite.TITLE_BAR);
182
				section.clientVerticalSpacing = 0;
183
				section.setBackground(parentControl.getBackground());
184
				section.setFont(parentControl.getFont());
185
				section.addExpansionListener(new ExpansionAdapter() {
186
					@Override
187
					public void expansionStateChanged(ExpansionEvent e) {
188
						getControl().getShell().pack();
189
					}
190
				});
191
				section.setText(contribution.getTitle());
192
				section.setToolTipText(contribution.getDescription());
193
194
				GridDataFactory.fillDefaults().grab(true, false).applyTo(section);
195
196
				Composite sectionContentsContainer = toolkit.createComposite(section);
197
				sectionContentsContainer.setBackground(parentControl.getBackground());
198
				contribution.createControl(sectionContentsContainer, toolkit);
199
200
				section.setClient(sectionContentsContainer);
201
			}
202
		}
203
	}
204
205
	/**
206
	 * Validate the settings of this page, not including contributions. This method should not be called directly by
207
	 * page implementations. Implementations of this method must be capable of running in a non-UI thread.
208
	 * 
209
	 * @return the status, or null if there are no messages.
210
	 * 
211
	 * @see #validatePageSettings()
212
	 */
213
	protected abstract IStatus validate(IProgressMonitor monitor);
214
215
	/**
216
	 * Overriding methods should call <code>super.applyTo(repository)</code>
217
	 */
218
	public void applyTo(TaskRepository repository) {
219
		applyContributionSettingsTo(repository);
220
	}
221
222
	private void applyContributionSettingsTo(TaskRepository repository) {
223
		for (AbstractTaskRepositoryPageContribution contribution : contributions) {
224
			contribution.applyTo(repository);
225
		}
226
	}
227
228
	/**
229
	 * compute the validation
230
	 * 
231
	 * @return a status if there is a message to display, otherwise null
232
	 */
233
	private IStatus computeValidation(IProgressMonitor monitor) {
234
		int factor = 100;
235
		monitor.beginTask("Validating settings", (contributions.size() + 1) * factor);
236
237
		IStatus cumulativeResult = null;
238
239
		// validate the page
240
		{
241
			SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, factor);
242
			cumulativeResult = validate(subMonitor);
243
			subMonitor.done();
244
		}
245
246
		// validate contributions
247
		for (AbstractTaskRepositoryPageContribution contribution : contributions) {
248
			SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, factor);
249
			IStatus result = contribution.validate(subMonitor);
250
			if (result != null) {
251
				if (cumulativeResult == null) {
252
					cumulativeResult = result;
253
				} else if (cumulativeResult instanceof MultiStatus) {
254
					((MultiStatus) cumulativeResult).add(result);
255
				} else {
256
					cumulativeResult = new MultiStatus(cumulativeResult.getPlugin(), cumulativeResult.getCode(),
257
							new IStatus[] { cumulativeResult, result }, null, null);
258
				}
259
			}
260
			subMonitor.done();
261
		}
262
		monitor.done();
263
		return cumulativeResult;
264
	}
265
266
	/**
267
	 * Validate all settings in the page including contributions. This method should be called whenever a setting is
268
	 * changed on the page.
269
	 * 
270
	 * The results of validation are applied and the buttons of the page are updated.
271
	 * 
272
	 * @see #validate(IProgressMonitor)
273
	 * @see #applyValidationResult(IStatus[])
274
	 */
275
	protected void validatePageSettings() {
276
		final Object[] result = new Object[1];
277
		try {
278
			getWizard().getContainer().run(true, true, new IRunnableWithProgress() {
279
				public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
280
					result[0] = computeValidation(monitor);
281
				}
282
			});
283
		} catch (InvocationTargetException e) {
284
			StatusHandler.fail(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
285
					"Internal error validating repository", e.getCause()));
286
			return;
287
		} catch (InterruptedException e) {
288
			// canceled
289
			return;
290
		}
291
		applyValidationResult((IStatus[]) result[0]);
292
		getWizard().getContainer().updateButtons();
293
	}
294
295
	/**
296
	 * Apply the results of validation to the page. The implementation finds the most {@link IStatus#getSeverity()
297
	 * severe} status and {@link #setMessage(String, int) applies the message} to the page.
298
	 * 
299
	 * @param statuses
300
	 *            an array of statuses that indicate the result of validation, or null
301
	 */
302
	protected void applyValidationResult(IStatus[] statuses) {
303
		if (statuses == null || statuses.length == 0) {
304
			setMessage(null, IMessageProvider.INFORMATION);
305
			setErrorMessage(null);
306
		} else {
307
			// find the most severe status
308
			IStatus status = statuses[0];
309
			for (IStatus s : statuses) {
310
				if (status == null || s.getSeverity() > status.getSeverity()) {
311
					status = s;
312
				}
313
			}
314
			int messageType;
315
			switch (status.getSeverity()) {
316
			case IStatus.OK:
317
			case IStatus.INFO:
318
				messageType = IMessageProvider.INFORMATION;
319
				break;
320
			case IStatus.WARNING:
321
				messageType = IMessageProvider.WARNING;
322
				break;
323
			case IStatus.ERROR:
324
			default:
325
				messageType = IMessageProvider.ERROR;
326
				break;
327
			}
328
			setErrorMessage(null);
329
			setMessage(status.getMessage(), messageType);
330
		}
331
	}
332
333
	private List<ITaskRepositoryPageContributor> findApplicableContributors() {
334
		List<ITaskRepositoryPageContributor> contributors = new ArrayList<ITaskRepositoryPageContributor>();
335
336
		IExtensionRegistry registry = Platform.getExtensionRegistry();
337
338
		IExtensionPoint editorExtensionPoint = registry.getExtensionPoint(TASK_REPOSITORY_PAGE_CONTRIBUTOR_EXTENSION);
339
		IExtension[] editorExtensions = editorExtensionPoint.getExtensions();
340
		for (IExtension extension : editorExtensions) {
341
			IConfigurationElement[] elements = extension.getConfigurationElements();
342
			for (IConfigurationElement element : elements) {
343
				if (element.getName().equals(TASK_REPOSITORY_PAGE_CONTRIBUTOR)) {
344
					String kind = element.getAttribute(KIND);
345
					if (kind == null || "".equals(kind) || getConnectorKind().equals(kind)) {
346
						try {
347
							Object contributor = element.createExecutableExtension("class");
348
							contributors.add((ITaskRepositoryPageContributor) contributor);
349
						} catch (Exception e) {
350
							StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not load "
351
									+ TASK_REPOSITORY_PAGE_CONTRIBUTOR, e));
352
						}
353
					}
354
				}
355
			}
356
		}
357
358
		return contributors;
359
	}
360
361
	private static class ContributionComparator implements Comparator<AbstractTaskRepositoryPageContribution> {
362
363
		public int compare(AbstractTaskRepositoryPageContribution o1, AbstractTaskRepositoryPageContribution o2) {
364
			if (o1 == o2) {
365
				return 0;
366
			}
367
			String s1 = o1.getTitle();
368
			String s2 = o2.getTitle();
369
			int i = s1.compareTo(s2);
370
			if (i == 0) {
371
				i = new Integer(System.identityHashCode(o1)).compareTo(System.identityHashCode(o2));
372
			}
373
			return i;
374
		}
375
376
	}
377
}
(-)src/org/eclipse/mylyn/tasks/ui/wizards/ITaskRepositoryPageContributor.java (+33 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2008 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.tasks.ui.wizards;
10
11
import org.eclipse.mylyn.tasks.core.TaskRepository;
12
13
/**
14
 * Implementors are capable of contributing to the settings page for a task repository.
15
 * 
16
 * @since 3.1
17
 * 
18
 * @author David Green
19
 */
20
public interface ITaskRepositoryPageContributor {
21
	/**
22
	 * create a contribution to a task repository
23
	 * 
24
	 * @param connectorKind
25
	 *            the kind of connector for which a contribution should be created
26
	 * @param repository
27
	 *            the repository for which contributions are desired, which may be null if the wizard is creating a new
28
	 *            repository
29
	 * 
30
	 * @return the contribution, or null if the contributor should not contribute to the given repository
31
	 */
32
	AbstractTaskRepositoryPageContribution createContribution(String connectorKind, TaskRepository repository);
33
}
(-)src/org/eclipse/mylyn/tasks/ui/wizards/AbstractTaskRepositoryPageContribution.java (+148 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.tasks.ui.wizards;
10
11
import java.util.List;
12
import java.util.concurrent.CopyOnWriteArrayList;
13
14
import org.eclipse.core.runtime.IProgressMonitor;
15
import org.eclipse.core.runtime.IStatus;
16
import org.eclipse.jface.dialogs.IDialogPage;
17
import org.eclipse.jface.wizard.IWizardPage;
18
import org.eclipse.mylyn.tasks.core.TaskRepository;
19
import org.eclipse.swt.widgets.Composite;
20
import org.eclipse.ui.forms.widgets.FormToolkit;
21
22
/**
23
 * A contribution to a {@link ITaskRepositoryPage}.
24
 * 
25
 * @see ITaskRepositoryPageContributor
26
 * 
27
 * @since 3.1
28
 * 
29
 * @author David Green
30
 */
31
public abstract class AbstractTaskRepositoryPageContribution {
32
33
	/**
34
	 * a listener interface that should be implemented by classes wishing to be notified of changes that occur within
35
	 * the contribution.
36
	 */
37
	public interface Listener {
38
		/**
39
		 * Called when the state of the contribution changes such that validation should be performed
40
		 * 
41
		 * @param contribution
42
		 *            the contribution that changed
43
		 * 
44
		 * @see ITaskRepositoryPageContribution#validate(IProgressMonitor)
45
		 */
46
		public void validationRequired(AbstractTaskRepositoryPageContribution contribution);
47
	}
48
49
	private final List<Listener> listeners = new CopyOnWriteArrayList<Listener>();
50
51
	private final String title;
52
53
	private final String description;
54
55
	/**
56
	 * the repository for which this contribution was created, or null if it was created for a new repository
57
	 */
58
	protected final TaskRepository repository;
59
60
	/**
61
	 * the kind of connector for which this contribution was created
62
	 */
63
	protected final String connectorKind;
64
65
	protected AbstractTaskRepositoryPageContribution(String title, String description, String connectorKind,
66
			TaskRepository repository) {
67
		this.title = title;
68
		this.description = description;
69
		this.connectorKind = connectorKind;
70
		this.repository = repository;
71
	}
72
73
	/**
74
	 * Add a listener to this contribution. The contribution must notify the listener at the appropriate times, for
75
	 * example when a setting has changed in the UI.
76
	 * 
77
	 * @see #removeListener(Listener)
78
	 */
79
	public void addListener(Listener listener) {
80
		listeners.add(listener);
81
	}
82
83
	/**
84
	 * Remove a listener from this contribution.
85
	 * 
86
	 * @see #addListener(Listener)
87
	 */
88
	public void removeListener(Listener listener) {
89
		listeners.remove(listener);
90
	}
91
92
	/**
93
	 * @see IDialogPage#createControl(Composite)
94
	 */
95
	public abstract void createControl(Composite parent, FormToolkit toolkit);
96
97
	/**
98
	 * @see IDialogPage#getTitle()
99
	 */
100
	public String getTitle() {
101
		return title;
102
	}
103
104
	/**
105
	 * @see IDialogPage#getDescription()
106
	 */
107
	public String getDescription() {
108
		return description;
109
	}
110
111
	/**
112
	 * @see IWizardPage#isPageComplete()
113
	 */
114
	public abstract boolean isPageComplete();
115
116
	/**
117
	 * @see IWizardPage#canFlipToNextPage()
118
	 */
119
	public abstract boolean canFlipToNextPage();
120
121
	/**
122
	 * Validate the settings of the contribution. Contributions should expect this method to be called often and should
123
	 * thus return quickly. Implementations of this method must be capable of running in a non-UI thread.
124
	 * 
125
	 * @return the status (errors) on the contribution, or null if there are none. A MultiStatus should be used to
126
	 *         return multiple error messages or warnings.
127
	 */
128
	public abstract IStatus validate(IProgressMonitor monitor);
129
130
	/**
131
	 * Apply the settings in the contribution to the given repository.
132
	 * 
133
	 * @param repository
134
	 *            the repository to which settings should be applied
135
	 * 
136
	 * @see ITaskRepositoryPage#applyTo(TaskRepository)
137
	 */
138
	public abstract void applyTo(TaskRepository repository);
139
140
	/**
141
	 * fire the validation required event.
142
	 */
143
	protected void fireValidationRequired() {
144
		for (Listener l : listeners) {
145
			l.validationRequired(this);
146
		}
147
	}
148
}
(-)src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskEditorExtensionSettingsContribution.java (+161 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2007 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.internal.tasks.ui.wizards;
10
11
import java.util.SortedSet;
12
13
import org.eclipse.core.runtime.IProgressMonitor;
14
import org.eclipse.core.runtime.IStatus;
15
import org.eclipse.jface.resource.FontRegistry;
16
import org.eclipse.jface.resource.JFaceResources;
17
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorExtensions;
18
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorExtensions.RegisteredTaskEditorExtension;
19
import org.eclipse.mylyn.tasks.core.TaskRepository;
20
import org.eclipse.mylyn.tasks.ui.wizards.AbstractTaskRepositoryPageContribution;
21
import org.eclipse.swt.SWT;
22
import org.eclipse.swt.events.SelectionAdapter;
23
import org.eclipse.swt.events.SelectionEvent;
24
import org.eclipse.swt.events.SelectionListener;
25
import org.eclipse.swt.graphics.Font;
26
import org.eclipse.swt.graphics.FontData;
27
import org.eclipse.swt.layout.GridLayout;
28
import org.eclipse.swt.widgets.Button;
29
import org.eclipse.swt.widgets.Composite;
30
import org.eclipse.swt.widgets.Widget;
31
import org.eclipse.ui.forms.widgets.FormToolkit;
32
33
/**
34
 * A contribution that adds a section for 'Task Editor Extension'.
35
 * 
36
 * @author David Green
37
 */
38
public class TaskEditorExtensionSettingsContribution extends AbstractTaskRepositoryPageContribution {
39
40
	private static final String LABEL_NONE = "Plain Text";
41
42
	private static final String LABEL_DEFAULT_SUFFIX = " (default)";
43
44
	private static final String DATA_EDITOR_EXTENSION = "editorExtension";
45
46
	private final SelectionListener listener = new SelectionAdapter() {
47
		@Override
48
		public void widgetSelected(SelectionEvent e) {
49
			selectedExtensionId = (String) ((Widget) e.getSource()).getData(DATA_EDITOR_EXTENSION);
50
			fireValidationRequired();
51
		}
52
	};
53
54
	private String selectedExtensionId = null;
55
56
	public TaskEditorExtensionSettingsContribution(String connectorKind, TaskRepository repository) {
57
		super("Editor", "Select the capabilities of the the task editor", connectorKind, repository);
58
	}
59
60
	@Override
61
	public void applyTo(TaskRepository repository) {
62
		TaskEditorExtensions.setTaskEditorExtensionId(repository, selectedExtensionId == null ? "none"
63
				: selectedExtensionId);
64
	}
65
66
	@Override
67
	public boolean canFlipToNextPage() {
68
		return true;
69
	}
70
71
	@Override
72
	public boolean isPageComplete() {
73
		return true;
74
	}
75
76
	@Override
77
	public void createControl(Composite parent, FormToolkit toolkit) {
78
		parent.setLayout(new GridLayout(1, true));
79
80
		String defaultExtensionId = TaskEditorExtensions.getDefaultTaskEditorExtensionId(connectorKind);
81
		selectedExtensionId = repository == null ? defaultExtensionId
82
				: TaskEditorExtensions.getTaskEditorExtensionId(repository);
83
84
		Button noneButton;
85
		{ // configure a 'none' button
86
			String noneTitle = LABEL_NONE;
87
88
			boolean isDefault = defaultExtensionId == null || defaultExtensionId.length() == 0;
89
			if (isDefault) {
90
				noneTitle += LABEL_DEFAULT_SUFFIX;
91
			}
92
			noneButton = toolkit.createButton(parent, noneTitle, SWT.RADIO);
93
			if (isDefault) {
94
				adjustForDefault(noneButton);
95
			}
96
97
			noneButton.addSelectionListener(listener);
98
		}
99
100
		boolean foundSelection = false;
101
102
		// now add selection buttons for all registered extensions
103
		SortedSet<RegisteredTaskEditorExtension> allEditorExtensions = TaskEditorExtensions.getTaskEditorExtensions();
104
		for (RegisteredTaskEditorExtension editorExtension : allEditorExtensions) {
105
			String name = editorExtension.getName();
106
107
			boolean isDefault = editorExtension.getId().equals(defaultExtensionId);
108
			if (isDefault) {
109
				name += LABEL_DEFAULT_SUFFIX;
110
			}
111
			Button button = toolkit.createButton(parent, name, SWT.RADIO);
112
			if (isDefault) {
113
				adjustForDefault(button);
114
			}
115
116
			if (editorExtension.getId().equals(selectedExtensionId)) {
117
				foundSelection = true;
118
				button.setSelection(true);
119
			}
120
			button.setText(name);
121
			button.setData(DATA_EDITOR_EXTENSION, editorExtension.getId());
122
			button.addSelectionListener(listener);
123
		}
124
		if (!foundSelection) {
125
			noneButton.setSelection(true);
126
		}
127
	}
128
129
	private void adjustForDefault(Button button) {
130
		Font font = button.getFont();
131
		button.setFont(getBold(font));
132
	}
133
134
	private Font getBold(Font font) {
135
		FontData[] originalFontData = font.getFontData();
136
		FontData fontData = originalFontData[0];
137
		if ((fontData.getStyle() & SWT.BOLD) != 0) {
138
			return font;
139
		}
140
141
		FontRegistry fontRegistry = JFaceResources.getFontRegistry();
142
		String key = fontData.getName() + '-' + fontData.getHeight() + "-" + fontData.getLocale() + "-"
143
				+ fontData.getStyle() + "-bold";
144
145
		if (!fontRegistry.hasValueFor(key)) {
146
			FontData[] boldFontDatas = new FontData[originalFontData.length];
147
			int index = -1;
148
			for (FontData fd : originalFontData) {
149
				boldFontDatas[++index] = new FontData(fd.getName(), fd.getHeight(), fd.getStyle() | SWT.BOLD);
150
			}
151
			fontRegistry.put(key, boldFontDatas);
152
		}
153
		return fontRegistry.get(key);
154
	}
155
156
	@Override
157
	public IStatus validate(IProgressMonitor monitor) {
158
		// nothing to validate
159
		return null;
160
	}
161
}
(-)src/org/eclipse/mylyn/internal/tasks/ui/wizards/LocalRepositorySettingsPage.java (+44 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2008 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.internal.tasks.ui.wizards;
10
11
import org.eclipse.core.runtime.IProgressMonitor;
12
import org.eclipse.core.runtime.IStatus;
13
import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
14
import org.eclipse.mylyn.tasks.core.TaskRepository;
15
import org.eclipse.mylyn.tasks.ui.wizards.AbstractExtensibleRepositorySettingsPage;
16
import org.eclipse.swt.widgets.Composite;
17
18
public class LocalRepositorySettingsPage extends AbstractExtensibleRepositorySettingsPage {
19
20
	public LocalRepositorySettingsPage(TaskRepository taskRepository) {
21
		super("Local Repository Settings", "Configure the local repository", taskRepository);
22
	}
23
24
	@Override
25
	public String getConnectorKind() {
26
		return LocalRepositoryConnector.CONNECTOR_KIND;
27
	}
28
29
	public String getRepositoryUrl() {
30
		return null;
31
	}
32
33
	@Override
34
	protected void createSettingControls(Composite parent) {
35
		// nothing to do, since the local repository has no settings
36
	}
37
38
	@Override
39
	protected IStatus validate(IProgressMonitor monitor) {
40
		// nothing to do
41
		return null;
42
	}
43
44
}
(-)schema/taskRepositoryPageContributor.exsd (+109 lines)
Added Link Here
1
<?xml version='1.0' encoding='UTF-8'?>
2
<!-- Schema file written by PDE -->
3
<schema targetNamespace="org.eclipse.mylyn.tasks.ui" xmlns="http://www.w3.org/2001/XMLSchema">
4
<annotation>
5
      <appinfo>
6
         <meta.schema plugin="org.eclipse.mylyn.tasks.ui" id="taskRepositoryPageContributor" name="Task Repository Page Contributor"/>
7
      </appinfo>
8
      <documentation>
9
         [Enter description of this extension point.]
10
      </documentation>
11
   </annotation>
12
13
   <element name="extension">
14
      <annotation>
15
         <appinfo>
16
            <meta.element />
17
         </appinfo>
18
      </annotation>
19
      <complexType>
20
         <sequence>
21
            <element ref="taskRepositoryPageContributor" minOccurs="1" maxOccurs="unbounded"/>
22
         </sequence>
23
         <attribute name="point" type="string" use="required">
24
            <annotation>
25
               <documentation>
26
                  
27
               </documentation>
28
            </annotation>
29
         </attribute>
30
         <attribute name="id" type="string">
31
            <annotation>
32
               <documentation>
33
                  
34
               </documentation>
35
            </annotation>
36
         </attribute>
37
         <attribute name="name" type="string">
38
            <annotation>
39
               <documentation>
40
                  
41
               </documentation>
42
               <appinfo>
43
                  <meta.attribute translatable="true"/>
44
               </appinfo>
45
            </annotation>
46
         </attribute>
47
      </complexType>
48
   </element>
49
50
   <element name="taskRepositoryPageContributor">
51
      <complexType>
52
         <attribute name="class" type="string" use="required">
53
            <annotation>
54
               <documentation>
55
                  
56
               </documentation>
57
               <appinfo>
58
                  <meta.attribute kind="java" basedOn=":org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPageContributor"/>
59
               </appinfo>
60
            </annotation>
61
         </attribute>
62
         <attribute name="connectorKind" type="string">
63
            <annotation>
64
               <documentation>
65
                  the kind of repository connector for which this contributor should be used, or &quot;&quot; (the empty string) if it applies to all connectors
66
               </documentation>
67
            </annotation>
68
         </attribute>
69
      </complexType>
70
   </element>
71
72
   <annotation>
73
      <appinfo>
74
         <meta.section type="since"/>
75
      </appinfo>
76
      <documentation>
77
         [Enter the first release in which this extension point appears.]
78
      </documentation>
79
   </annotation>
80
81
   <annotation>
82
      <appinfo>
83
         <meta.section type="examples"/>
84
      </appinfo>
85
      <documentation>
86
         [Enter extension point usage example here.]
87
      </documentation>
88
   </annotation>
89
90
   <annotation>
91
      <appinfo>
92
         <meta.section type="apiinfo"/>
93
      </appinfo>
94
      <documentation>
95
         [Enter API information here.]
96
      </documentation>
97
   </annotation>
98
99
   <annotation>
100
      <appinfo>
101
         <meta.section type="implementation"/>
102
      </appinfo>
103
      <documentation>
104
         [Enter information about supplied implementation of this extension point.]
105
      </documentation>
106
   </annotation>
107
108
109
</schema>
(-)src/org/eclipse/mylyn/internal/tasks/ui/wizards/TaskEditorExtensionSettingsContributor.java (+36 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2004, 2008 Mylyn project committers and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *******************************************************************************/
8
9
package org.eclipse.mylyn.internal.tasks.ui.wizards;
10
11
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorExtensions;
12
import org.eclipse.mylyn.tasks.core.TaskRepository;
13
import org.eclipse.mylyn.tasks.ui.wizards.AbstractTaskRepositoryPageContribution;
14
import org.eclipse.mylyn.tasks.ui.wizards.ITaskRepositoryPageContributor;
15
16
/**
17
 * A contributor that adds {@link TaskEditorExtensionSettingsContribution} to all repositories
18
 * 
19
 * @see TaskEditorExtensionSettingsContribution
20
 * 
21
 * @author David Green
22
 */
23
public class TaskEditorExtensionSettingsContributor implements ITaskRepositoryPageContributor {
24
25
	public TaskEditorExtensionSettingsContributor() {
26
	}
27
28
	public AbstractTaskRepositoryPageContribution createContribution(String connectorKind, TaskRepository repository) {
29
		// don't return a contribution if there are no extensions
30
		if (TaskEditorExtensions.getTaskEditorExtensions().isEmpty()) {
31
			return null;
32
		}
33
		return new TaskEditorExtensionSettingsContribution(connectorKind, repository);
34
	}
35
36
}

Return to bug 244653