493772: Discovery of single-segment files shows name as extension in pop-up
Bug: 493772
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=493772
diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/AskMarketPlaceForFileSupportStrategy.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/AskMarketPlaceForFileSupportStrategy.java
index e66a218..6299c0e 100644
--- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/AskMarketPlaceForFileSupportStrategy.java
+++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/AskMarketPlaceForFileSupportStrategy.java
@@ -68,6 +68,8 @@
IMarketplaceService marketplaceService = locator.getDefaultMarketplaceService();
String[] split = fileName.split("\\."); //$NON-NLS-1$
final String fileExtension = split[split.length - 1];
+ final String fileExtensionLabel = fileExtension.length() == fileName.length() ? fileName
+ : "*." + fileExtension; //$NON-NLS-1$
String query = "fileExtension_" + fileExtension; //$NON-NLS-1$]
ISearchResult searchResult = null;
try {
@@ -100,7 +102,7 @@
public IStatus runInUIThread(IProgressMonitor monitor) {
final Shell shell = WorkbenchUtil.getShell();
final MarketplaceOrAssociateDialog dialog = new MarketplaceOrAssociateDialog(shell,
- fileExtension, res);
+ fileExtensionLabel, res);
if (dialog.open() == IDialogConstants.OK_ID) {
if (dialog.isShowProposals()) {
IMarketplaceClientService marketplaceClientService = MarketplaceClient
diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/MarketplaceOrAssociateDialog.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/MarketplaceOrAssociateDialog.java
index 601e410..adea103 100644
--- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/MarketplaceOrAssociateDialog.java
+++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/MarketplaceOrAssociateDialog.java
@@ -35,7 +35,7 @@
public class MarketplaceOrAssociateDialog extends TitleAreaDialog {
- private final String fileExtension;
+ private final String fileExtensionLabel;
private final IEditorDescriptor currentEditor;
@@ -49,9 +49,9 @@
private Image wizban;
- protected MarketplaceOrAssociateDialog(Shell shell, String fileExtension, IEditorDescriptor currentEditor) {
+ protected MarketplaceOrAssociateDialog(Shell shell, String fileExtensionLabel, IEditorDescriptor currentEditor) {
super(shell);
- this.fileExtension = fileExtension;
+ this.fileExtensionLabel = fileExtensionLabel;
this.currentEditor = currentEditor;
setHelpAvailable(false);
setShellStyle(getShellStyle() | SWT.RESIZE);
@@ -60,7 +60,7 @@
@Override
public Control createDialogArea(Composite parent) {
setTitle(Messages.MarketplaceOrAssociateDialog_title);
- setMessage(NLS.bind(Messages.MarketplaceOrAssociateDialog_message, fileExtension));
+ setMessage(NLS.bind(Messages.MarketplaceOrAssociateDialog_message, fileExtensionLabel));
wizban = DiscoveryImages.BANNER_DISOVERY.createImage();
setTitleImage(wizban);
@@ -91,7 +91,7 @@
associateRadio = new Button(res, SWT.RADIO);
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.TOP).grab(true, false).applyTo(associateRadio);
associateRadio
- .setText(NLS.bind(Messages.MarketplaceOrAssociateDialog_associate, fileExtension,
+ .setText(NLS.bind(Messages.MarketplaceOrAssociateDialog_associate, fileExtensionLabel,
currentEditor.getLabel()));
associateRadio.addSelectionListener(new SelectionAdapter() {
@Override
@@ -137,17 +137,17 @@
if (IEditorRegistry.SYSTEM_INPLACE_EDITOR_ID.equals(editorId)) {
return NLS.bind(
Messages.MarketplaceOrAssociateDialog_descriptionEmbeddedSystemEditor,
- fileExtension);
+ fileExtensionLabel);
} else if (IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID.equals(editorId)) {
return NLS.bind(
Messages.MarketplaceOrAssociateDialog_descriptionExternalSystemEditor,
- fileExtension);
+ fileExtensionLabel);
} else if (IDEWorkbenchPlugin.DEFAULT_TEXT_EDITOR_ID.equals(editorId)) {
return NLS.bind(
Messages.MarketplaceOrAssociateDialog_descriptionSimpleTextEditor,
- fileExtension);
+ fileExtensionLabel);
} else {
- return NLS.bind(Messages.MarketplaceOrAssociateDialog_message, fileExtension);
+ return NLS.bind(Messages.MarketplaceOrAssociateDialog_message, fileExtensionLabel);
}
}
diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/messages.properties b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/messages.properties
index 121d117..9e83764 100644
--- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/messages.properties
+++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/messages.properties
@@ -19,11 +19,11 @@
MarketplaceClientUi_connectionProblem=Connection failed\n\nThis is most often caused by a problem with your internet connection. Please check your internet connection and retry.
MarketplaceOrAssociateDialog_title=Editors available on marketplace
MarketplaceOrAssociateDialog_linkToPreferences=See also <a>Preferences for File Associations</a>
-MarketplaceOrAssociateDialog_message=Better editor support for ''*.{0}'' files is available on the Marketplace.
+MarketplaceOrAssociateDialog_message=Better editor support for ''{0}'' files is available on the Marketplace.
MarketplaceOrAssociateDialog_showProposals=Show marketplace proposals and let me install them.
-MarketplaceOrAssociateDialog_associate=Associate ''*.{0}'' files with current editor ({1}) and do not ask again.
-MarketplaceOrAssociateDialog_descriptionEmbeddedSystemEditor=Your ''*.{0}'' file was opened in an embedded system editor, which might not be fully integrated. Better editor support is available on the Marketplace.
-MarketplaceOrAssociateDialog_descriptionExternalSystemEditor=Your ''*.{0}'' file was opened in an external system editor. Better editor support is available on the Marketplace.
-MarketplaceOrAssociateDialog_descriptionSimpleTextEditor=Your ''*.{0}'' file was opened in a simple text editor. Better editor support is available on the Marketplace.
+MarketplaceOrAssociateDialog_associate=Associate ''{0}'' files with current editor ({1}) and do not ask again.
+MarketplaceOrAssociateDialog_descriptionEmbeddedSystemEditor=Your ''{0}'' file was opened in an embedded system editor, which might not be fully integrated. Better editor support is available on the Marketplace.
+MarketplaceOrAssociateDialog_descriptionExternalSystemEditor=Your ''{0}'' file was opened in an external system editor. Better editor support is available on the Marketplace.
+MarketplaceOrAssociateDialog_descriptionSimpleTextEditor=Your ''{0}'' file was opened in a simple text editor. Better editor support is available on the Marketplace.
AskMarketPlaceForFileSupportStrategy_jobName=Search Marketplace for compatible editors
AskMerketplaceForFileSupportStrategy_dialogJobName=Proposals dialog