Skip to content

Commit

Permalink
509710: Error message on every 'unknown file type' opening
Browse files Browse the repository at this point in the history
Only log errors in the discovery job, but avoid bothering the user

Bug: 509710
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=509710
  • Loading branch information
creckord committed May 15, 2017
1 parent ffb3282 commit 13e3ba0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public class Messages extends NLS {

public static String AskMerketplaceForFileSupportStrategy_dialogJobName;

public static String DiscoverFileSupportJob_discoveryFailed;

public static String LookupByNatureJob_discoveryFailed;

/**
* Only kept here to give translations time to move the message to the new bundle without causing warnings.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUi;
import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUiPlugin;
import org.eclipse.epp.internal.mpc.ui.Messages;
import org.eclipse.epp.mpc.core.model.INode;
import org.eclipse.epp.mpc.core.model.ISearchResult;
import org.eclipse.epp.mpc.core.service.IMarketplaceService;
import org.eclipse.epp.mpc.core.service.IMarketplaceServiceLocator;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorRegistry;
Expand Down Expand Up @@ -70,8 +72,11 @@ private IStatus run(IMarketplaceService marketplaceService, IProgressMonitor mon
ISearchResult searchResult = marketplaceService.tagged(fileExtensionTag, monitor);
nodes = searchResult.getNodes();
} catch (CoreException ex) {
return new Status(IStatus.ERROR,
MarketplaceClientUiPlugin.getInstance().getBundle().getSymbolicName(), ex.getMessage(), ex);
IStatus status = new Status(IStatus.ERROR, MarketplaceClientUi.BUNDLE_ID,
NLS.bind(Messages.DiscoverFileSupportJob_discoveryFailed, getFileExtensionLabel(fileName)), ex);
// Do not return this status as it would show an error, e.g. when the user is currently offline
MarketplaceClientUi.getLog().log(status);
return Status.CANCEL_STATUS;
}
if (nodes.isEmpty()) {
return Status.OK_STATUS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUi;
import org.eclipse.epp.internal.mpc.ui.MarketplaceClientUiPlugin;
import org.eclipse.epp.internal.mpc.ui.Messages;
import org.eclipse.epp.mpc.core.model.INode;
Expand Down Expand Up @@ -50,9 +51,9 @@ protected IStatus run(IProgressMonitor monitor) {
ISearchResult searchResult = marketplaceService.tagged(fileExtensionTag, monitor);
nodes = searchResult.getNodes();
} catch (CoreException ex) {
IStatus status = new Status(IStatus.ERROR,
MarketplaceClientUiPlugin.getInstance().getBundle().getSymbolicName(), ex.getMessage(), ex);
MarketplaceClientUiPlugin.getInstance().getLog().log(status);
IStatus status = new Status(IStatus.ERROR, MarketplaceClientUi.BUNDLE_ID,
NLS.bind(Messages.LookupByNatureJob_discoveryFailed, natureId), ex);
MarketplaceClientUi.getLog().log(status);
// Do not return this status as it would show an error
return Status.CANCEL_STATUS;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ MarketplaceOrAssociateDialog_descriptionExternalSystemEditor=Your ''{0}'' file w
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
DiscoverFileSupportJob_discoveryFailed=File support discovery for {0} failed
LookupByNatureJob_discoveryFailed=Project nature discovery for {0} failed
MissingNatureDetector_Title=Marketplace solutions available
MissingNatureDetector_Desc=Some helpful solutions are available on Marketplace
MissingNatureDetector_Message=Your IDE is missing natures to properly support your projects.\n\
Expand Down

0 comments on commit 13e3ba0

Please sign in to comment.