|
1 | 1 | /*******************************************************************************
|
2 |
| - * Copyright (c) 2000, 2011 John-Mason P. Shackelford and others. |
| 2 | + * Copyright (c) 2000, 2025 John-Mason P. Shackelford and others. |
3 | 3 | *
|
4 |
| - * This program and the accompanying materials |
| 4 | + * This program and the accompanying materials |
5 | 5 | * are made available under the terms of the Eclipse Public License 2.0
|
6 | 6 | * which accompanies this distribution, and is available at
|
7 | 7 | * https://www.eclipse.org/legal/epl-2.0/
|
8 | 8 | *
|
9 | 9 | * SPDX-License-Identifier: EPL-2.0
|
10 |
| - * |
| 10 | + * |
11 | 11 | * Contributors:
|
12 | 12 | * John-Mason P. Shackelford - initial API and implementation
|
13 | 13 | * IBM Corporation - bug fixes
|
|
27 | 27 | import org.eclipse.jface.text.source.SourceViewer;
|
28 | 28 | import org.eclipse.jface.text.source.SourceViewerConfiguration;
|
29 | 29 | import org.eclipse.jface.text.templates.Template;
|
30 |
| -import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData; |
31 | 30 | import org.eclipse.jface.viewers.IStructuredSelection;
|
32 | 31 | import org.eclipse.swt.SWT;
|
33 | 32 | import org.eclipse.swt.graphics.Font;
|
34 | 33 | import org.eclipse.swt.widgets.Composite;
|
| 34 | +import org.eclipse.text.templates.TemplatePersistenceData; |
35 | 35 | import org.eclipse.ui.PlatformUI;
|
36 | 36 | import org.eclipse.ui.texteditor.templates.TemplatePreferencePage;
|
37 | 37 |
|
@@ -79,8 +79,7 @@ protected void updateViewerInput() {
|
79 | 79 | IStructuredSelection selection = (IStructuredSelection) getTableViewer().getSelection();
|
80 | 80 | SourceViewer viewer = getViewer();
|
81 | 81 |
|
82 |
| - if (selection.size() == 1 && selection.getFirstElement() instanceof TemplatePersistenceData) { |
83 |
| - TemplatePersistenceData data = (TemplatePersistenceData) selection.getFirstElement(); |
| 82 | + if (selection.size() == 1 && selection.getFirstElement() instanceof TemplatePersistenceData data) { |
84 | 83 | Template template = data.getTemplate();
|
85 | 84 | if (AntUIPlugin.getDefault().getPreferenceStore().getBoolean(getFormatterPreferenceKey())) {
|
86 | 85 | String formatted = XmlFormatter.format(template.getPattern(), fFormattingPreferences);
|
|
0 commit comments