diff options
Diffstat (limited to 'plugins')
6 files changed, 57 insertions, 14 deletions
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/META-INF/MANIFEST.MF b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/META-INF/MANIFEST.MF index c8b8ab29d1c..1cf0ab126da 100644 --- a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/META-INF/MANIFEST.MF +++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/META-INF/MANIFEST.MF @@ -5,8 +5,7 @@ Export-Package: org.eclipse.papyrus.eclipse.project.editors.file, org.eclipse.papyrus.eclipse.project.editors.project.filter Require-Bundle: org.eclipse.jdt.core;bundle-version="[3.12.0,4.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.widgets;bundle-version="[3.0.0,4.0.0)", - org.eclipse.pde.core;bundle-version="[3.11.0,4.0.0)";visibility:=reexport, - org.eclipse.pde.ui;bundle-version="[3.9.0,4.0.0)" + org.eclipse.pde.core;bundle-version="[3.11.0,4.0.0)";visibility:=reexport Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy Bundle-Version: 2.1.0.qualifier diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/META-INF/MANIFEST.MF b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/META-INF/MANIFEST.MF index e66689ea384..c49abf4a712 100644 --- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/META-INF/MANIFEST.MF +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/META-INF/MANIFEST.MF @@ -7,7 +7,6 @@ Require-Bundle: org.eclipse.papyrus.infra.onefile;bundle-version="[2.1.0,3.0.0)" org.eclipse.papyrus.infra.emf.gmf;bundle-version="[1.2.0,2.0.0)", org.eclipse.papyrus.infra.core;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)";visibility:=reexport, - org.eclipse.pde.ui;bundle-version="[3.9.0,4.0.0)", org.eclipse.papyrus.infra.internationalization;bundle-version="[1.0.0,2.0.0)" Bundle-Vendor: %providerName Bundle-ActivationPolicy: lazy diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/ControlledResourceTracker.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/ControlledResourceTracker.java index a597edb712c..883e4411008 100644 --- a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/ControlledResourceTracker.java +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/ControlledResourceTracker.java @@ -35,7 +35,6 @@ import org.eclipse.emf.transaction.TransactionalEditingDomainEvent; import org.eclipse.emf.transaction.TransactionalEditingDomainListener; import org.eclipse.emf.transaction.util.TransactionUtil; import org.eclipse.papyrus.infra.internationalization.utils.PropertiesFilesUtils; -import org.eclipse.pde.internal.ui.util.LocaleUtil; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Iterables; @@ -122,10 +121,10 @@ public class ControlledResourceTracker extends AdapterImpl implements Transactio return result; } - + /** * Get the URI modified if necessary (for example, the properties file can have a locale at the end of the file). - * + * * @param uri * The URI of a resource that potentially is in a sub-model unit. * @param initialURI @@ -136,7 +135,7 @@ public class ControlledResourceTracker extends AdapterImpl implements Transactio URI result = initialURI; // If this is a properties file, check if a locale is available at the end of the URI - if (null != uri && null != uri.fileExtension() && uri.fileExtension().equals(PropertiesFilesUtils.PROPERTIES_FILE_EXTENSION)) { //$NON-NLS-1$ + if (null != uri && null != uri.fileExtension() && uri.fileExtension().equals(PropertiesFilesUtils.PROPERTIES_FILE_EXTENSION)) { // Get the last segment final String lastSegment = initialURI.lastSegment(); // Try to remove existing localization @@ -335,7 +334,7 @@ public class ControlledResourceTracker extends AdapterImpl implements Transactio handleAdd(resource, (EObject) msg.getNewValue()); break; } - // case MOVE: moving within the list does not change sub-unit relationships + // case MOVE: moving within the list does not change sub-unit relationships case Notification.REMOVE: { handleRemove(resource, (EObject) msg.getOldValue()); break; diff --git a/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/LocaleUtil.java b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/LocaleUtil.java new file mode 100644 index 00000000000..519a2730a83 --- /dev/null +++ b/plugins/infra/emf/org.eclipse.papyrus.infra.emf.readonly/src/org/eclipse/papyrus/infra/emf/readonly/internal/LocaleUtil.java @@ -0,0 +1,47 @@ +/***************************************************************************** + * Copyright (c) 2020 CEA LIST and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * CEA LIST - Initial API and implementation + * + *****************************************************************************/ + +package org.eclipse.papyrus.infra.emf.readonly.internal; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Code directly reused from org.eclipse.pde.internal.ui.util.LocaleUtil to avoid dependency on ui and internal code + */ +public class LocaleUtil { + + /** + * Smartly trims a {@link String} representing a <code>Bundle-Localization</code> key removing trailing locale and/or .properties extension<br> + * <em>e.g.</em> <code>"bundle_es.properties "</code> --> <code>"bundle"</code> + * + * @param localization + * the {@link String} to trim + * @return the trimmed {@link String} + */ + public static String trimLocalization(String localization) { + String sTrim = localization.trim(); + if (sTrim.endsWith(".properties")) { + sTrim = sTrim.replaceAll(".properties", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } + Pattern p = Pattern.compile(".*(_[a-z]{2}(_[A-Z]{2})?)$"); //$NON-NLS-1$ + Matcher m = p.matcher(sTrim); + if (m.matches()) { + sTrim = sTrim.substring(0, m.start(1)); + } + return sTrim; + } + +}
\ No newline at end of file diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/META-INF/MANIFEST.MF b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/META-INF/MANIFEST.MF index 1bd8feb5a1f..10c17f548b0 100644 --- a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/META-INF/MANIFEST.MF +++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/META-INF/MANIFEST.MF @@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.core.databinding;bundle-version="[1.7.0,2.0.0)";visi org.eclipse.emf.ecore;bundle-version="[2.12.0,3.0.0)";visibility:=reexport, org.eclipse.nebula.widgets.richtext;bundle-version="[1.0.0,2.0.0)", org.eclipse.pde;bundle-version="[3.12.0,4.0.0)", - org.eclipse.pde.ui;bundle-version="[3.9.0,4.0.0)", + org.eclipse.pde.core;bundle-version="[3.9.0,4.0.0)", org.eclipse.e4.ui.model.workbench;bundle-version="[1.2.0,3.0.0)", org.eclipse.e4.core.contexts;bundle-version="[1.5.0,2.0.0)", org.eclipse.emf.edit.ui;bundle-version="[2.12.0,3.0.0)", diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/BundleExplorerDialog.java b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/BundleExplorerDialog.java index 2943fd0e092..4899ccf265a 100644 --- a/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/BundleExplorerDialog.java +++ b/plugins/infra/ui/org.eclipse.papyrus.infra.widgets/src/org/eclipse/papyrus/infra/widgets/editors/BundleExplorerDialog.java @@ -10,7 +10,7 @@ * * Contributors: * Remi Schnekenburger (CEA LIST) remi.schnekenburger@cea.fr - Initial API and implementation - * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - move from oep.customization.palette + * Mickael ADAM (ALL4TEC) mickael.adam@all4tec.net - move from oep.customization.palette *****************************************************************************/ package org.eclipse.papyrus.infra.widgets.editors; @@ -21,11 +21,11 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.papyrus.infra.widgets.Activator; import org.eclipse.papyrus.infra.widgets.messages.Messages; import org.eclipse.pde.core.plugin.IPluginBase; import org.eclipse.pde.core.plugin.IPluginModelBase; -import org.eclipse.pde.internal.ui.PDEPlugin; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; @@ -61,8 +61,7 @@ public class BundleExplorerDialog extends FilteredItemsSelectionDialog { setTitle(Messages.BundleExplorerDialog_PlugInSelectionTitle); setMessage(Messages.BundleExplorerDialog_DialogMessage); fModels = models; - PDEPlugin.getDefault().getLabelProvider().connect(this); - setListLabelProvider(PDEPlugin.getDefault().getLabelProvider()); + setListLabelProvider(new LabelProvider()); } /** @@ -169,7 +168,7 @@ public class BundleExplorerDialog extends FilteredItemsSelectionDialog { @Override protected boolean matches(final String text) { String pattern = patternMatcher.getPattern(); - if (pattern.indexOf(ASTERISK) != 0 && pattern.indexOf(INTERROGATION) != 0 && pattern.indexOf(DOT) != 0) {// $NON-NLS-1$ //$NON-NLS-2$ + if (pattern.indexOf(ASTERISK) != 0 && pattern.indexOf(INTERROGATION) != 0 && pattern.indexOf(DOT) != 0) {// $NON-NLS-1$ pattern = ASTERISK + pattern; patternMatcher.setPattern(pattern); } |