diff options
author | jonas | 2014-10-19 11:00:20 +0000 |
---|---|---|
committer | jonas | 2014-10-19 11:00:20 +0000 |
commit | fbc2f2e3b52afb1f2282e757f00ea7d19858a1a2 (patch) | |
tree | f674afee43f546c46f1d47a4195ae4a9d851272a | |
parent | e9f7727486a37dd1c8e952e0a41f021de2a6426e (diff) | |
download | org.eclipse.e4.tools-I20141019-2200.tar.gz org.eclipse.e4.tools-I20141019-2200.tar.xz org.eclipse.e4.tools-I20141019-2200.zip |
Bug 444340 - Externalize Strings - Added Message classes to editor3xI20141019-2200
11 files changed, 364 insertions, 284 deletions
diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/Messages.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/Messages.java new file mode 100644 index 00000000..ba3b7537 --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/Messages.java @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2011-2014 EclipseSource Muenchen GmbH and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Jonas - initial API and implementation + ******************************************************************************/ +package org.eclipse.e4.tools.emf.editor3x; + +import org.eclipse.osgi.util.NLS; + +/** + * @author Jonas + * + */ +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.e4.tools.emf.editor3x.messages"; //$NON-NLS-1$ + public static String ModelEditorPreferencePage_Color; + public static String ModelEditorPreferencePage_ForcesReadOnlyXMITab; + public static String ModelEditorPreferencePage_FormTab; + public static String ModelEditorPreferencePage_GeneratedID; + public static String ModelEditorPreferencePage_ListTabe; + public static String ModelEditorPreferencePage_NotRenderedColor; + public static String ModelEditorPreferencePage_NotVisibleAndNotRenderedColor; + public static String ModelEditorPreferencePage_NotVisibleColor; + public static String ModelEditorPreferencePage_RememberColumnSettings; + public static String ModelEditorPreferencePage_RememberFilterSettings; + public static String ModelEditorPreferencePage_RequiresReopeningModel; + public static String ModelEditorPreferencePage_SearchableTree; + public static String ModelEditorPreferencePage_ShowID; + public static String ModelMoveParticipant_CreatingChange; + public static String RedoAction_Redo; + public static String UndoAction_Undo; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java index b97ffe58..4512b79e 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelEditorPreferencePage.java @@ -56,13 +56,13 @@ public class ModelEditorPreferencePage extends PreferencePage implements IWorkbe { final Group group = new Group(result, SWT.NONE); - group.setText("Color"); + group.setText(Messages.ModelEditorPreferencePage_Color); group.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1)); group.setLayout(new GridLayout(2, false)); { fColorValueNotRendered = new ColorFieldEditor(ModelEditorPreferences.NOT_RENDERED_COLOR, - "Not rendered color", group); + Messages.ModelEditorPreferencePage_NotRenderedColor, group); fColorValueNotRendered.setPage(this); fColorValueNotRendered.setPreferenceStore(getPreferenceStore()); fColorValueNotRendered.load(); @@ -70,7 +70,7 @@ public class ModelEditorPreferencePage extends PreferencePage implements IWorkbe { fColorValueNotVisible = new ColorFieldEditor(ModelEditorPreferences.NOT_VISIBLE_COLOR, - "Not visible color", group); + Messages.ModelEditorPreferencePage_NotVisibleColor, group); fColorValueNotVisible.setPage(this); fColorValueNotVisible.setPreferenceStore(getPreferenceStore()); fColorValueNotVisible.load(); @@ -79,7 +79,7 @@ public class ModelEditorPreferencePage extends PreferencePage implements IWorkbe { fColorValueNotVisibleAndRendered = new ColorFieldEditor( ModelEditorPreferences.NOT_VISIBLE_AND_RENDERED_COLOR, - "Not visible and not rendered color", group); + Messages.ModelEditorPreferencePage_NotVisibleAndNotRenderedColor, group); fColorValueNotVisibleAndRendered.setPage(this); fColorValueNotVisibleAndRendered.setPreferenceStore(getPreferenceStore()); fColorValueNotVisibleAndRendered.load(); @@ -88,7 +88,7 @@ public class ModelEditorPreferencePage extends PreferencePage implements IWorkbe { final Group group = new Group(result, SWT.NONE); - group.setText("Form Tab"); + group.setText(Messages.ModelEditorPreferencePage_FormTab); group.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1)); group.setLayout(new GridLayout(2, false)); @@ -96,7 +96,7 @@ public class ModelEditorPreferencePage extends PreferencePage implements IWorkbe final Composite container = new Composite(group, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1)); fAutoGeneratedId = new BooleanFieldEditor(ModelEditorPreferences.AUTO_CREATE_ELEMENT_ID, - "Autogenerate Element-Id", container); + Messages.ModelEditorPreferencePage_GeneratedID, container); fAutoGeneratedId.setPage(this); fAutoGeneratedId.setPreferenceStore(getPreferenceStore()); fAutoGeneratedId.load(); @@ -105,7 +105,7 @@ public class ModelEditorPreferencePage extends PreferencePage implements IWorkbe { final Composite container = new Composite(group, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1)); - fShowXMIId = new BooleanFieldEditor(ModelEditorPreferences.SHOW_XMI_ID, "Show XMI:ID", container); + fShowXMIId = new BooleanFieldEditor(ModelEditorPreferences.SHOW_XMI_ID, Messages.ModelEditorPreferencePage_ShowID, container); fShowXMIId.setPage(this); fShowXMIId.setPreferenceStore(getPreferenceStore()); fShowXMIId.load(); @@ -115,8 +115,8 @@ public class ModelEditorPreferencePage extends PreferencePage implements IWorkbe final Composite container = new Composite(group, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1)); fShowSearch = new BooleanFieldEditor(ModelEditorPreferences.TAB_FORM_SEARCH_SHOW, - "Searchable tree on form tab\n" - + "(forces read only XMI tab)\n" + "(requires reopening model)", container); + Messages.ModelEditorPreferencePage_SearchableTree + + Messages.ModelEditorPreferencePage_ForcesReadOnlyXMITab + Messages.ModelEditorPreferencePage_RequiresReopeningModel, container); fShowSearch.setPage(this); fShowSearch.setPreferenceStore(getPreferenceStore()); fShowSearch.load(); @@ -126,7 +126,7 @@ public class ModelEditorPreferencePage extends PreferencePage implements IWorkbe { final Group group = new Group(result, SWT.NONE); - group.setText("List Tab"); + group.setText(Messages.ModelEditorPreferencePage_ListTabe); group.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1)); group.setLayout(new GridLayout(2, false)); @@ -135,13 +135,13 @@ public class ModelEditorPreferencePage extends PreferencePage implements IWorkbe container.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false, 2, 1)); fRememberColumns = new BooleanFieldEditor(ModelEditorPreferences.LIST_TAB_REMEMBER_COLUMNS, - "Remember column settings when reopening editor ", container); + Messages.ModelEditorPreferencePage_RememberColumnSettings, container); fRememberColumns.setPage(this); fRememberColumns.setPreferenceStore(getPreferenceStore()); fRememberColumns.load(); fRememberFilters = new BooleanFieldEditor(ModelEditorPreferences.LIST_TAB_REMEMBER_FILTERS, - "Remember filter settings when reopening editor", container); + Messages.ModelEditorPreferencePage_RememberFilterSettings, container); fRememberFilters.setPage(this); fRememberFilters.setPreferenceStore(getPreferenceStore()); fRememberFilters.load(); diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelMoveParticipant.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelMoveParticipant.java index 10d825f6..fbef832d 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelMoveParticipant.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelMoveParticipant.java @@ -6,8 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Wim Jongman <wim.jongman@remainsoftware.com> - Bug 395174: e4xmi should participate in package renaming - * Bug 432892: Eclipse 4 Application does not work after renaming the project name + * Wim Jongman <wim.jongman@remainsoftware.com> - Bug 395174: e4xmi should participate in package renaming + * Bug 432892: Eclipse 4 Application does not work after renaming the project name ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x; @@ -62,13 +62,13 @@ public class ModelMoveParticipant extends MoveParticipant { @Override public RefactoringStatus checkConditions(IProgressMonitor pMonitor, - CheckConditionsContext pContext) throws OperationCanceledException { + CheckConditionsContext pContext) throws OperationCanceledException { return new RefactoringStatus(); } @Override public Change createChange(IProgressMonitor pMonitor) throws CoreException, - OperationCanceledException { + OperationCanceledException { pMonitor.beginTask("Creating Change ..", IProgressMonitor.UNKNOWN); @@ -92,21 +92,21 @@ public class ModelMoveParticipant extends MoveParticipant { } private Change createFileChange(IProgressMonitor pMonitor, IFile file) - throws CoreException { + throws CoreException { - String newUrl = "platform:/plugin/"; + String newUrl = "platform:/plugin/"; //$NON-NLS-1$ if (getArguments().getDestination() instanceof IFolder) { - IFolder folder = (IFolder) getArguments().getDestination(); - newUrl += folder.getProject().getName() + "/" - + folder.getProjectRelativePath().toString() + "/" - + file.getName(); + final IFolder folder = (IFolder) getArguments().getDestination(); + newUrl += folder.getProject().getName() + "/" //$NON-NLS-1$ + + folder.getProjectRelativePath().toString() + "/" //$NON-NLS-1$ + + file.getName(); } else { - IProject project = (IProject) getArguments().getDestination(); - newUrl += project.getName() + "/" + file.getName(); + final IProject project = (IProject) getArguments().getDestination(); + newUrl += project.getName() + "/" + file.getName(); //$NON-NLS-1$ } - String oldUrl = "platform:/plugin" + file.getFullPath(); + final String oldUrl = "platform:/plugin" + file.getFullPath(); //$NON-NLS-1$ fModel.addTextRename(oldUrl, newUrl); @@ -114,21 +114,21 @@ public class ModelMoveParticipant extends MoveParticipant { } private Change createPackageChange(IProgressMonitor pMonitor, - IPackageFragment pPckage) throws CoreException, - OperationCanceledException { - String fromBundle = Util.getBundleSymbolicName(pPckage.getJavaProject() - .getProject()); + IPackageFragment pPckage) throws CoreException, + OperationCanceledException { + final String fromBundle = Util.getBundleSymbolicName(pPckage.getJavaProject() + .getProject()); - IPackageFragmentRoot fragmentRoot = (IPackageFragmentRoot) getArguments() - .getDestination(); - String toBundle = Util.getBundleSymbolicName(fragmentRoot - .getJavaProject().getProject()); + final IPackageFragmentRoot fragmentRoot = (IPackageFragmentRoot) getArguments() + .getDestination(); + final String toBundle = Util.getBundleSymbolicName(fragmentRoot + .getJavaProject().getProject()); - final String newUrl = "bundleclass://" + toBundle + "/" - + pPckage.getElementName(); + final String newUrl = "bundleclass://" + toBundle + "/" //$NON-NLS-1$ //$NON-NLS-2$ + + pPckage.getElementName(); - String oldUrl = "bundleclass://" + fromBundle + "/" - + pPckage.getElementName(); + final String oldUrl = "bundleclass://" + fromBundle + "/" //$NON-NLS-1$ //$NON-NLS-2$ + + pPckage.getElementName(); fModel.addTextRename(oldUrl, newUrl); @@ -136,24 +136,24 @@ public class ModelMoveParticipant extends MoveParticipant { } private Change createClassChange(IProgressMonitor pMonitor, IType pType) - throws CoreException, OperationCanceledException { - String fromBundle = Util.getBundleSymbolicName(fType.getJavaProject() - .getProject()); - String fromClassname = pType.getFullyQualifiedName(); - - IPackageFragment fragment = (IPackageFragment) getArguments() - .getDestination(); - String toBundle = Util.getBundleSymbolicName(fragment.getJavaProject() - .getProject()); - String toClassName = fragment.getElementName().length() == 0 ? pType - .getElementName() : fragment.getElementName() + "." - + pType.getElementName(); - - return RefactorParticipantDelegate.createChange( - pMonitor, - fModel.addTextRename("bundleclass://" + fromBundle + "/" - + fromClassname, "bundleclass://" + toBundle + "/" - + toClassName)); + throws CoreException, OperationCanceledException { + final String fromBundle = Util.getBundleSymbolicName(fType.getJavaProject() + .getProject()); + final String fromClassname = pType.getFullyQualifiedName(); + + final IPackageFragment fragment = (IPackageFragment) getArguments() + .getDestination(); + final String toBundle = Util.getBundleSymbolicName(fragment.getJavaProject() + .getProject()); + final String toClassName = fragment.getElementName().length() == 0 ? pType + .getElementName() : fragment.getElementName() + "." //$NON-NLS-1$ + + pType.getElementName(); + + return RefactorParticipantDelegate.createChange( + pMonitor, + fModel.addTextRename("bundleclass://" + fromBundle + "/" //$NON-NLS-1$ //$NON-NLS-2$ + + fromClassname, "bundleclass://" + toBundle + "/" //$NON-NLS-1$ //$NON-NLS-2$ + + toClassName)); } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelRenameParticipant.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelRenameParticipant.java index 439e9134..6a2952e6 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelRenameParticipant.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/ModelRenameParticipant.java @@ -6,9 +6,9 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Wim Jongman <wim.jongman@remainsoftware.com> - Bug 395174: e4xmi should participate in package renaming - * Bug 432892: Eclipse 4 Application does not work after renaming the project name + * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation + * Wim Jongman <wim.jongman@remainsoftware.com> - Bug 395174: e4xmi should participate in package renaming + * Bug 432892: Eclipse 4 Application does not work after renaming the project name ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x; @@ -27,7 +27,7 @@ import org.eclipse.ltk.core.refactoring.RefactoringStatus; import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext; public class ModelRenameParticipant extends - org.eclipse.ltk.core.refactoring.participants.RenameParticipant { +org.eclipse.ltk.core.refactoring.participants.RenameParticipant { private IType fType; private IPackageFragment fPckage; private IFile fFile; @@ -68,18 +68,18 @@ public class ModelRenameParticipant extends @Override public String getName() { - return "Workbench Model Contribution Participant"; + return "Workbench Model Contribution Participant"; //$NON-NLS-1$ } @Override public RefactoringStatus checkConditions(IProgressMonitor pm, - CheckConditionsContext context) throws OperationCanceledException { + CheckConditionsContext context) throws OperationCanceledException { return new RefactoringStatus(); } @Override public Change createChange(IProgressMonitor pm) throws CoreException, - OperationCanceledException { + OperationCanceledException { fModel = RefactorModel.getModel(this); @@ -107,36 +107,37 @@ public class ModelRenameParticipant extends } private Change createProjectChange(IProgressMonitor pm, IProject project) - throws CoreException { + throws CoreException { - if (!getArguments().getUpdateReferences()) + if (!getArguments().getUpdateReferences()) { return null; + } - fModel.addTextRename("platform:/plugin/" + project.getName() + "/", - "platform:/plugin/" + getArguments().getNewName() + "/"); - fModel.addTextRename("bundleclass://" + project.getName() + "/", - "bundleclass://" + getArguments().getNewName() + "/"); + fModel.addTextRename("platform:/plugin/" + project.getName() + "/", //$NON-NLS-1$ //$NON-NLS-2$ + "platform:/plugin/" + getArguments().getNewName() + "/"); //$NON-NLS-1$ //$NON-NLS-2$ + fModel.addTextRename("bundleclass://" + project.getName() + "/", //$NON-NLS-1$ //$NON-NLS-2$ + "bundleclass://" + getArguments().getNewName() + "/"); //$NON-NLS-1$ //$NON-NLS-2$ fModel.setProjectRename(project, ((IWorkspaceRoot) project.getParent()) - .getProject(getArguments().getNewName())); + .getProject(getArguments().getNewName())); return RefactorParticipantDelegate.createChange(pm, fModel); } private Change createFolderChange(IProgressMonitor pm, IFolder folder) - throws CoreException { + throws CoreException { - String SPLIT = "/"; + String SPLIT = "/"; //$NON-NLS-1$ if (folder.getParent().getFullPath().segmentCount() == 1) { - SPLIT = ""; + SPLIT = ""; //$NON-NLS-1$ } - String newUrl = "platform:/plugin/" + folder.getProject().getName() - + "/" + folder.getParent().getProjectRelativePath().toString() - + SPLIT + getArguments().getNewName(); + final String newUrl = "platform:/plugin/" + folder.getProject().getName() //$NON-NLS-1$ + + "/" + folder.getParent().getProjectRelativePath().toString() //$NON-NLS-1$ + + SPLIT + getArguments().getNewName(); - String oldUrl = "platform:/plugin" + folder.getFullPath(); + final String oldUrl = "platform:/plugin" + folder.getFullPath(); //$NON-NLS-1$ fModel.addTextRename(oldUrl, newUrl); @@ -144,49 +145,49 @@ public class ModelRenameParticipant extends } private Change createFileChange(IProgressMonitor pm, IFile file) - throws CoreException { + throws CoreException { - String SPLIT = "/"; + String SPLIT = "/"; //$NON-NLS-1$ if (file.getParent().getFullPath().segmentCount() == 1) { - SPLIT = ""; + SPLIT = ""; //$NON-NLS-1$ } - String newUrl = "platform:/plugin/" + file.getProject().getName() + "/" - + file.getParent().getProjectRelativePath().toString() + SPLIT - + getArguments().getNewName(); - String oldUrl = "platform:/plugin" + file.getFullPath(); + final String newUrl = "platform:/plugin/" + file.getProject().getName() + "/" //$NON-NLS-1$ //$NON-NLS-2$ + + file.getParent().getProjectRelativePath().toString() + SPLIT + + getArguments().getNewName(); + final String oldUrl = "platform:/plugin" + file.getFullPath(); //$NON-NLS-1$ fModel.addTextRename(oldUrl, newUrl); return RefactorParticipantDelegate.createChange(pm, fModel); } private Change createPackageChange(IProgressMonitor pm, - IPackageFragment pckage) throws CoreException { - String bundle = Util.getBundleSymbolicName(pckage.getJavaProject() - .getProject()); + IPackageFragment pckage) throws CoreException { + final String bundle = Util.getBundleSymbolicName(pckage.getJavaProject() + .getProject()); - final String newUrl = "bundleclass://" + bundle + "/" - + getArguments().getNewName(); + final String newUrl = "bundleclass://" + bundle + "/" //$NON-NLS-1$ //$NON-NLS-2$ + + getArguments().getNewName(); - String oldUrl = "bundleclass://" + bundle + "/" - + pckage.getElementName(); + final String oldUrl = "bundleclass://" + bundle + "/" //$NON-NLS-1$ //$NON-NLS-2$ + + pckage.getElementName(); fModel.addTextRename(oldUrl, newUrl); return RefactorParticipantDelegate.createChange(pm, fModel); } private Change createClassChange(IProgressMonitor pm, IType type) - throws CoreException { - String bundle = Util.getBundleSymbolicName(type.getJavaProject() - .getProject()); - - final String newUrl = "bundleclass://" - + bundle - + "/" - + (type.getPackageFragment().getElementName().length() == 0 ? getArguments() - .getNewName() : type.getPackageFragment() - .getElementName() + "." + getArguments().getNewName()); - String oldUrl = "bundleclass://" + bundle + "/" - + type.getFullyQualifiedName().replace(".", "\\."); + throws CoreException { + final String bundle = Util.getBundleSymbolicName(type.getJavaProject() + .getProject()); + + final String newUrl = "bundleclass://" //$NON-NLS-1$ + + bundle + + "/" //$NON-NLS-1$ + + (type.getPackageFragment().getElementName().length() == 0 ? getArguments() + .getNewName() : type.getPackageFragment() + .getElementName() + "." + getArguments().getNewName()); //$NON-NLS-1$ + final String oldUrl = "bundleclass://" + bundle + "/" //$NON-NLS-1$ //$NON-NLS-2$ + + type.getFullyQualifiedName().replace(".", "\\."); //$NON-NLS-1$//$NON-NLS-2$ fModel.addTextRename(oldUrl, newUrl); return RefactorParticipantDelegate.createChange(pm, fModel); diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java index bde3a2a1..29fa40b6 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/PDEClassContributionProvider.java @@ -6,8 +6,8 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 436281, Bug 436280 + * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation + * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 436281, Bug 436280 ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x; @@ -35,52 +35,55 @@ import org.eclipse.jdt.core.search.TypeNameRequestor; import org.eclipse.pde.internal.core.util.PDEJavaHelper; public class PDEClassContributionProvider implements IClassContributionProvider { - private SearchEngine searchEngine; + private final SearchEngine searchEngine; + public PDEClassContributionProvider() { searchEngine = new SearchEngine(); } + @Override @SuppressWarnings("restriction") public void findContribution(final Filter filter, final ContributionResultHandler handler) { boolean followReferences = true; - if (filter.getSearchScope().contains(ResourceSearchScope.PROJECT) && !filter.getSearchScope().contains(ResourceSearchScope.REFERENCES)) { + if (filter.getSearchScope().contains(ResourceSearchScope.PROJECT) + && !filter.getSearchScope().contains(ResourceSearchScope.REFERENCES)) { followReferences = false; } IJavaSearchScope scope = null; - if (followReferences == false){ - IJavaProject javaProject = JavaCore.create(filter.project); + if (followReferences == false) { + final IJavaProject javaProject = JavaCore.create(filter.project); IPackageFragmentRoot[] roots; try { roots = javaProject.getPackageFragmentRoots(); scope = SearchEngine.createJavaSearchScope(roots, false); - } catch (JavaModelException e) { + } catch (final JavaModelException e) { e.printStackTrace(); } - }else{ + } else { // filter.project may be null in the live editor scope = filter.project != null ? PDEJavaHelper - .getSearchScope(filter.project) : SearchEngine - .createWorkspaceScope(); + .getSearchScope(filter.project) : SearchEngine + .createWorkspaceScope(); } char[] packageName = null; char[] typeName = null; String currentContent = filter.namePattern; - int index = currentContent.lastIndexOf('.'); + final int index = currentContent.lastIndexOf('.'); if (index == -1) { // There is no package qualification // Perform the search only on the type name typeName = currentContent.toCharArray(); - if( currentContent.startsWith("*") ) { - if( ! currentContent.endsWith("*") ) { - currentContent += "*"; + if (currentContent.startsWith("*")) { //$NON-NLS-1$ + if (!currentContent.endsWith("*")) { //$NON-NLS-1$ + currentContent += "*"; //$NON-NLS-1$ } typeName = currentContent.toCharArray(); - packageName = "*".toCharArray(); + packageName = "*".toCharArray(); //$NON-NLS-1$ } - - } else if ((index + 1) == currentContent.length()) { + + } else if (index + 1 == currentContent.length()) { // There is a package qualification and the last character is a // dot // Perform the search for all types under the given package @@ -89,93 +92,96 @@ public class PDEClassContributionProvider implements IClassContributionProvider // Package name without the trailing dot packageName = currentContent.substring(0, index).toCharArray(); } else { - // There is a package qualification, followed by a dot, and + // There is a package qualification, followed by a dot, and // a type fragment // Type name without the package qualification typeName = currentContent.substring(index + 1).toCharArray(); // Package name without the trailing dot packageName = currentContent.substring(0, index).toCharArray(); } - -// char[] packageName = "at.bestsolution.e4.handlers".toCharArray(); -// char[] typeName = "*".toCharArray(); - - TypeNameRequestor req = new TypeNameRequestor() { + + // char[] packageName = "at.bestsolution.e4.handlers".toCharArray(); + // char[] typeName = "*".toCharArray(); + + final TypeNameRequestor req = new TypeNameRequestor() { @Override - public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, char[][] enclosingTypeNames, String path) { + public void acceptType(int modifiers, char[] packageName, char[] simpleTypeName, + char[][] enclosingTypeNames, String path) { // Accept search results from the JDT SearchEngine - String cName = new String(simpleTypeName); - String pName = new String(packageName); -// String label = cName + " - " + pName; //$NON-NLS-1$ - String content = pName.length() == 0 ? cName : pName + "." + cName; //$NON-NLS-1$ - -// System.err.println("Found: " + label + " => " + pName + " => " + path); - - IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path); - - if( resource != null ) { - IProject project = resource.getProject(); - IFile f = project.getFile("/META-INF/MANIFEST.MF"); - - if( f != null && f.exists() ) { + final String cName = new String(simpleTypeName); + final String pName = new String(packageName); + // String label = cName + " - " + pName; //$NON-NLS-1$ + final String content = pName.length() == 0 ? cName : pName + "." + cName; //$NON-NLS-1$ + + // System.err.println("Found: " + label + " => " + pName + " => " + path); + + final IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(path); + + if (resource != null) { + final IProject project = resource.getProject(); + final IFile f = project.getFile("/META-INF/MANIFEST.MF"); //$NON-NLS-1$ + + if (f != null && f.exists()) { BufferedReader r = null; try { - InputStream s = f.getContents(); + final InputStream s = f.getContents(); r = new BufferedReader(new InputStreamReader(s)); String line; - while( (line = r.readLine()) != null ) { - if( line.startsWith("Bundle-SymbolicName:") ) { - int start = line.indexOf(':'); + while ((line = r.readLine()) != null) { + if (line.startsWith("Bundle-SymbolicName:")) { //$NON-NLS-1$ + final int start = line.indexOf(':'); int end = line.indexOf(';'); - if( end == -1 ) { + if (end == -1) { end = line.length(); } - ContributionData data = new ContributionData(line.substring(start+1,end).trim(), content, "Java", null); + final ContributionData data = new ContributionData(line.substring(start + 1, end) + .trim(), content, "Java", null); //$NON-NLS-1$ handler.result(data); break; } } - - } catch (CoreException e) { + + } catch (final CoreException e) { // TODO Auto-generated catch block e.printStackTrace(); - } catch (IOException e) { + } catch (final IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { - if( r != null ) { + if (r != null) { try { r.close(); - } catch (IOException e) { + } catch (final IOException e) { // TODO Auto-generated catch block e.printStackTrace(); - } + } } } } } - - - //Image image = (Flags.isInterface(modifiers)) ? PDEPluginImages.get(PDEPluginImages.OBJ_DESC_GENERATE_INTERFACE) : PDEPluginImages.get(PDEPluginImages.OBJ_DESC_GENERATE_CLASS); - //addProposalToCollection(c, startOffset, length, label, content, image); + + // Image image = (Flags.isInterface(modifiers)) ? + // PDEPluginImages.get(PDEPluginImages.OBJ_DESC_GENERATE_INTERFACE) : + // PDEPluginImages.get(PDEPluginImages.OBJ_DESC_GENERATE_CLASS); + // addProposalToCollection(c, startOffset, length, label, content, image); } }; - + try { searchEngine.searchAllTypeNames( - packageName, - SearchPattern.R_PATTERN_MATCH, - typeName, - SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CAMELCASE_MATCH, - IJavaSearchConstants.CLASS, - scope, - req, - IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null); - } catch (JavaModelException e) { + packageName, + SearchPattern.R_PATTERN_MATCH, + typeName, + SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CAMELCASE_MATCH, + IJavaSearchConstants.CLASS, + scope, + req, + IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, null); + } catch (final JavaModelException e) { // TODO Auto-generated catch block e.printStackTrace(); } - + handler.moreResults(0, filter); } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RedoAction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RedoAction.java index 36c0b85a..4a1a5f57 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RedoAction.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RedoAction.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation + * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x; @@ -19,12 +19,14 @@ public class RedoAction extends Action { public RedoAction(IModelResource resource) { this.resource = resource; - this.listener = new IModelResource.ModelListener() { + listener = new IModelResource.ModelListener() { + @Override public void commandStackChanged() { update(); } + @Override public void dirtyChanged() { } @@ -43,12 +45,12 @@ public class RedoAction extends Action { private void update() { if (resource.getEditingDomain().getCommandStack().canRedo()) { - setText("Redo " - + resource.getEditingDomain().getCommandStack() - .getRedoCommand().getLabel()); + setText(Messages.RedoAction_Redo + " " //$NON-NLS-1$ + + resource.getEditingDomain().getCommandStack() + .getRedoCommand().getLabel()); setEnabled(true); } else { - setText("Redo"); + setText(Messages.RedoAction_Redo); setEnabled(false); } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RefactorParticipantDelegate.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RefactorParticipantDelegate.java index ba25f774..802c284d 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RefactorParticipantDelegate.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/RefactorParticipantDelegate.java @@ -6,8 +6,9 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation - * Wim Jongman <wim.jongman@remainsoftware.com> Bug 432892: Eclipse 4 Application does not work after renaming the project name + * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation + * Wim Jongman <wim.jongman@remainsoftware.com> Bug 432892: Eclipse 4 Application does not work after renaming the + * project name ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x; @@ -34,12 +35,12 @@ import org.eclipse.text.edits.TextEditGroup; class RefactorParticipantDelegate { - private static final String E4_MODEL_CHANGES = "Eclipse 4 Application Model Changes"; + private static final String E4_MODEL_CHANGES = "Eclipse 4 Application Model Changes"; //$NON-NLS-1$ /** * Creates a set of changes and returns a new {@link CompositeChange} or * adds the changes to the passed {@link CompositeChange}. - * + * * @param pProgressMonitor * @param pParticipant * @param pOldUrl @@ -53,44 +54,44 @@ class RefactorParticipantDelegate { * @throws OperationCanceledException */ public static CompositeChange createChange( - IProgressMonitor pProgressMonitor, final RefactorModel pModel) + IProgressMonitor pProgressMonitor, final RefactorModel pModel) throws CoreException, OperationCanceledException { - String[] filenames = { "*.e4xmi", "plugin.xml" }; - FileTextSearchScope scope = FileTextSearchScope.newWorkspaceScope( - filenames, false); + final String[] filenames = { "*.e4xmi", "plugin.xml" }; //$NON-NLS-1$ //$NON-NLS-2$ + final FileTextSearchScope scope = FileTextSearchScope.newWorkspaceScope( + filenames, false); final Map<IFile, TextFileChange> changes = new HashMap<IFile, TextFileChange>(); - TextSearchRequestor searchRequestor = new TextSearchRequestor() { + final TextSearchRequestor searchRequestor = new TextSearchRequestor() { @Override public boolean acceptPatternMatch(TextSearchMatchAccess matchAccess) - throws CoreException { - IFile file = matchAccess.getFile(); + throws CoreException { + final IFile file = matchAccess.getFile(); TextFileChange change = changes.get(file); if (change == null) { - TextChange textChange = pModel.getTextChange(file); + final TextChange textChange = pModel.getTextChange(file); if (textChange != null) { return false; } if (pModel.isProjectRename() - && file.getProject().equals(pModel.getOldProject())) { + && file.getProject().equals(pModel.getOldProject())) { // The project/resources get refactored before the // TextChange is applied, therefore we need their // future locations - IProject newProject = pModel.getNewProject(); + final IProject newProject = pModel.getNewProject(); // If the model is in a non-standard location the // new project will keep that location, only the project // will be changed - IPath oldFile = file.getFullPath().removeFirstSegments( - 1); - IFile newFile = newProject.getFile(oldFile); + final IPath oldFile = file.getFullPath().removeFirstSegments( + 1); + final IFile newFile = newProject.getFile(oldFile); change = new MovedTextFileChange(file.getName(), - newFile, file); + newFile, file); change.setEdit(new MultiTextEdit()); changes.put(file, change); @@ -101,34 +102,35 @@ class RefactorParticipantDelegate { } } - ReplaceEdit edit = new ReplaceEdit( - matchAccess.getMatchOffset(), - matchAccess.getMatchLength(), - pModel.getNewTextCurrentIndex()); + final ReplaceEdit edit = new ReplaceEdit( + matchAccess.getMatchOffset(), + matchAccess.getMatchLength(), + pModel.getNewTextCurrentIndex()); change.addEdit(edit); change.addTextEditGroup(new TextEditGroup(E4_MODEL_CHANGES, - edit)); //$NON-NLS-1$ + edit)); return true; } }; CompositeChange result; - TextSearchEngine searchEngine = TextSearchEngine.create(); + final TextSearchEngine searchEngine = TextSearchEngine.create(); for (int count = pModel.getRenameCount(); count > 0; count--) { pModel.setIndex(count - 1); searchEngine.search( - scope, - searchRequestor, - TextSearchEngine.createPattern( - pModel.getOldTextCurrentIndex(), true, false), + scope, + searchRequestor, + TextSearchEngine.createPattern( + pModel.getOldTextCurrentIndex(), true, false), pProgressMonitor); } - if (changes.isEmpty()) + if (changes.isEmpty()) { return null; + } - result = new CompositeChange(E4_MODEL_CHANGES); //$NON-NLS-1$ - for (TextFileChange c : changes.values()) { + result = new CompositeChange(E4_MODEL_CHANGES); + for (final TextFileChange c : changes.values()) { result.add(c); } return result; diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java index 39356e09..d48b3c97 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/TargetElementProviders.java @@ -17,109 +17,115 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.pde.internal.core.PDEExtensionRegistry; public class TargetElementProviders implements IModelElementProvider { - private static final String APP_E4XMI_DEFAULT = "Application.e4xmi"; + private static final String APP_E4XMI_DEFAULT = "Application.e4xmi"; //$NON-NLS-1$ private ResourceSet resourceSet; - + + @Override public void getModelElements(Filter filter, ModelResultHandler handler) { - if( resourceSet == null ) { + if (resourceSet == null) { resourceSet = new ResourceSetImpl(); - PDEExtensionRegistry reg = new PDEExtensionRegistry(); - IExtension[] extensions = reg.findExtensions("org.eclipse.e4.workbench.model", true); - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - - for( IExtension ext : extensions ) { - for( IConfigurationElement el : ext.getConfigurationElements() ) { - if( el.getName().equals("fragment") ) { + final PDEExtensionRegistry reg = new PDEExtensionRegistry(); + IExtension[] extensions = reg.findExtensions("org.eclipse.e4.workbench.model", true); //$NON-NLS-1$ + final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + + for (final IExtension ext : extensions) { + for (final IConfigurationElement el : ext.getConfigurationElements()) { + if (el.getName().equals("fragment")) { //$NON-NLS-1$ URI uri; -// System.err.println("Model-Ext: Checking: " + ext.getContributor().getName()); - IProject p = root.getProject(ext.getContributor().getName()); - if( p.exists() && p.isOpen() ) { - uri = URI.createPlatformResourceURI(ext.getContributor().getName() + "/" + el.getAttribute("uri"), true); + // System.err.println("Model-Ext: Checking: " + ext.getContributor().getName()); + final IProject p = root.getProject(ext.getContributor().getName()); + if (p.exists() && p.isOpen()) { + uri = URI.createPlatformResourceURI( + ext.getContributor().getName() + "/" + el.getAttribute("uri"), true); //$NON-NLS-1$ //$NON-NLS-2$ } else { - uri = URI.createURI("platform:/plugin/" + ext.getContributor().getName() + "/" + el.getAttribute("uri") ); + uri = URI.createURI("platform:/plugin/" + ext.getContributor().getName() + "/" //$NON-NLS-1$ //$NON-NLS-2$ + + el.getAttribute("uri")); //$NON-NLS-1$ } -// System.err.println(uri); + // System.err.println(uri); try { - resourceSet.getResource(uri, true); - } catch (Exception e) { + resourceSet.getResource(uri, true); + } catch (final Exception e) { e.printStackTrace(); -// System.err.println("=============> Failing"); + // System.err.println("=============> Failing"); } } } } - - extensions = reg.findExtensions("org.eclipse.core.runtime.products", true); - for( IExtension ext : extensions ) { - for( IConfigurationElement el : ext.getConfigurationElements() ) { - if( el.getName().equals("product") ) { + + extensions = reg.findExtensions("org.eclipse.core.runtime.products", true); //$NON-NLS-1$ + for (final IExtension ext : extensions) { + for (final IConfigurationElement el : ext.getConfigurationElements()) { + if (el.getName().equals("product")) { //$NON-NLS-1$ boolean xmiPropertyPresent = false; - for( IConfigurationElement prop: el.getChildren("property") ) { - if( prop.getAttribute("name").equals("applicationXMI") ) { - String v = prop.getAttribute("value"); + for (final IConfigurationElement prop : el.getChildren("property")) { //$NON-NLS-1$ + if (prop.getAttribute("name").equals("applicationXMI")) { //$NON-NLS-1$//$NON-NLS-2$ + final String v = prop.getAttribute("value"); //$NON-NLS-1$ setUpResourceSet(root, v); xmiPropertyPresent = true; break; } } - if (!xmiPropertyPresent){ - setUpResourceSet(root, ext.getNamespaceIdentifier()+"/"+APP_E4XMI_DEFAULT); + if (!xmiPropertyPresent) { + setUpResourceSet(root, ext.getNamespaceIdentifier() + "/" + APP_E4XMI_DEFAULT); //$NON-NLS-1$ break; } } } - } + } } - + applyFilter(filter, handler); } private void setUpResourceSet(IWorkspaceRoot root, String v) { - String[] s = v.split("/"); + final String[] s = v.split("/"); //$NON-NLS-1$ URI uri; -// System.err.println("Product-Ext: Checking: " + v + " => P:" + s[0] + ""); - IProject p = root.getProject(s[0]); - if( p.exists() && p.isOpen() ) { - uri = URI.createPlatformResourceURI(v, true ); + // System.err.println("Product-Ext: Checking: " + v + " => P:" + s[0] + ""); + final IProject p = root.getProject(s[0]); + if (p.exists() && p.isOpen()) { + uri = URI.createPlatformResourceURI(v, true); } else { - uri = URI.createURI("platform:/plugin/" + v ); + uri = URI.createURI("platform:/plugin/" + v); //$NON-NLS-1$ } - -// System.err.println(uri); + + // System.err.println(uri); try { - //prevent some unnecessary calls by checking the uri - if (resourceSet.getURIConverter().exists(uri, null) - ) - resourceSet.getResource(uri, true); - } catch (Exception e) { + // prevent some unnecessary calls by checking the uri + if (resourceSet.getURIConverter().exists(uri, null)) { + resourceSet.getResource(uri, true); + } + } catch (final Exception e) { e.printStackTrace(); -// System.err.println("=============> Failing"); + // System.err.println("=============> Failing"); } } - + private void applyFilter(Filter filter, ModelResultHandler handler) { - for (Resource res : resourceSet.getResources()) { - TreeIterator<EObject> it = EcoreUtil.getAllContents(res, - true); - while (it.hasNext()) { - EObject o = it.next(); - if (o.eContainingFeature() != FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS) { - if (o.eClass().equals(filter.eClass)) { -// System.err.println("Found: " + o); - handler.result(o); - } + for (final Resource res : resourceSet.getResources()) { + final TreeIterator<EObject> it = EcoreUtil.getAllContents(res, + true); + while (it.hasNext()) { + final EObject o = it.next(); + if (o.eContainingFeature() != FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS) { + if (o.eClass().equals(filter.eClass)) { + // System.err.println("Found: " + o); + handler.result(o); } } + } } } + @Override public void clearCache() { - if (resourceSet==null) return; - for (Resource r : resourceSet.getResources()) { + if (resourceSet == null) { + return; + } + for (final Resource r : resourceSet.getResources()) { r.unload(); } resourceSet = null; } - + } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java index 6988d3d1..4612c913 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/UndoAction.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation + * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation ******************************************************************************/ package org.eclipse.e4.tools.emf.editor3x; @@ -19,12 +19,14 @@ public class UndoAction extends Action { public UndoAction(IModelResource resource) { this.resource = resource; - this.listener = new IModelResource.ModelListener() { + listener = new IModelResource.ModelListener() { + @Override public void commandStackChanged() { update(); } + @Override public void dirtyChanged() { } }; @@ -41,12 +43,12 @@ public class UndoAction extends Action { private void update() { if (resource.getEditingDomain().getCommandStack().canUndo()) { - setText("Undo " - + resource.getEditingDomain().getCommandStack() - .getUndoCommand().getLabel()); + setText(Messages.UndoAction_Undo + " " //$NON-NLS-2$ + + resource.getEditingDomain().getCommandStack() + .getUndoCommand().getLabel()); setEnabled(true); } else { - setText("Undo"); + setText(Messages.UndoAction_Undo); setEnabled(false); } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/emf/EditUIUtil.java b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/emf/EditUIUtil.java index 4052b79b..9ec1db74 100644 --- a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/emf/EditUIUtil.java +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/emf/EditUIUtil.java @@ -15,7 +15,7 @@ public class EditUIUtil { Class<?> fileClass = null; try { fileClass = IFile.class; - } catch (Exception exception) { + } catch (final Exception exception) { // Ignore any exceptions and assume the class isn't available. } FILE_CLASS = fileClass; @@ -26,15 +26,15 @@ public class EditUIUtil { static { Class<?> fileRevisionClass = null; Method fileRevisionGetURIMethod = null; - Bundle bundle = Platform.getBundle("org.eclipse.team.core"); + final Bundle bundle = Platform.getBundle("org.eclipse.team.core"); //$NON-NLS-1$ if (bundle != null - && (bundle.getState() & (Bundle.ACTIVE | Bundle.STARTING | Bundle.RESOLVED)) != 0) { + && (bundle.getState() & (Bundle.ACTIVE | Bundle.STARTING | Bundle.RESOLVED)) != 0) { try { fileRevisionClass = bundle - .loadClass("org.eclipse.team.core.history.IFileRevision"); + .loadClass("org.eclipse.team.core.history.IFileRevision"); //$NON-NLS-1$ fileRevisionGetURIMethod = fileRevisionClass - .getMethod("getURI"); - } catch (Exception exeption) { + .getMethod("getURI"); //$NON-NLS-1$ + } catch (final Exception exeption) { // Ignore any exceptions and assume the class isn't available. } } @@ -47,7 +47,7 @@ public class EditUIUtil { Class<?> uriEditorInputClass = null; try { uriEditorInputClass = IURIEditorInput.class; - } catch (Exception exception) { + } catch (final Exception exception) { // The class is not available. } URI_EDITOR_INPUT_CLASS = uriEditorInputClass; @@ -56,20 +56,20 @@ public class EditUIUtil { public static URI getURI(IEditorInput editorInput) { if (FILE_CLASS != null) { - IFile file = (IFile) editorInput.getAdapter(FILE_CLASS); + final IFile file = (IFile) editorInput.getAdapter(FILE_CLASS); if (file != null) { return URI.createPlatformResourceURI(file.getFullPath() - .toString(), true); + .toString(), true); } } if (FILE_REVISION_CLASS != null) { - Object fileRevision = editorInput.getAdapter(FILE_REVISION_CLASS); + final Object fileRevision = editorInput.getAdapter(FILE_REVISION_CLASS); if (fileRevision != null) { try { return URI - .createURI(((java.net.URI) FILE_REVISION_GET_URI_METHOD - .invoke(fileRevision)).toString()); - } catch (Exception exception) { + .createURI(((java.net.URI) FILE_REVISION_GET_URI_METHOD + .invoke(fileRevision)).toString()); + } catch (final Exception exception) { // TODO Log error } } @@ -77,8 +77,8 @@ public class EditUIUtil { if (URI_EDITOR_INPUT_CLASS != null) { if (editorInput instanceof IURIEditorInput) { return URI.createURI( - ((IURIEditorInput) editorInput).getURI().toString()) - .trimFragment(); + ((IURIEditorInput) editorInput).getURI().toString()) + .trimFragment(); } } diff --git a/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/messages.properties b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/messages.properties new file mode 100644 index 00000000..9df9660e --- /dev/null +++ b/bundles/org.eclipse.e4.tools.emf.editor3x/src/org/eclipse/e4/tools/emf/editor3x/messages.properties @@ -0,0 +1,16 @@ +ModelEditorPreferencePage_Color=Color +ModelEditorPreferencePage_ForcesReadOnlyXMITab=(forces read only XMI tab)\n +ModelEditorPreferencePage_FormTab=Form Tab +ModelEditorPreferencePage_GeneratedID=Autogenerate Element-Id +ModelEditorPreferencePage_ListTabe=List Tab +ModelEditorPreferencePage_NotRenderedColor=Not rendered color +ModelEditorPreferencePage_NotVisibleAndNotRenderedColor=Not visible and not rendered color +ModelEditorPreferencePage_NotVisibleColor=Not visible color +ModelEditorPreferencePage_RememberColumnSettings=Remember column settings when reopening editor +ModelEditorPreferencePage_RememberFilterSettings=Remember filter settings when reopening editor +ModelEditorPreferencePage_RequiresReopeningModel=(requires reopening model) +ModelEditorPreferencePage_SearchableTree=Searchable tree on form tab\n +ModelEditorPreferencePage_ShowID=Show XMI:ID +ModelMoveParticipant_CreatingChange=Creating Change .. +RedoAction_Redo=Redo +UndoAction_Undo=Undo |