-
Notifications
You must be signed in to change notification settings - Fork 121
PDE should not warn if resource URI of unknown scheme cannot be found #2032
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Dani-Hub
wants to merge
1
commit into
eclipse-pde:master
Choose a base branch
from
Dani-Hub:#2031-PDE_should_not_warn_if_resource_URI_of_unknown_scheme_cannot_be_found
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,11 +11,13 @@ | |
| * Contributors: | ||
| * IBM Corporation - initial API and implementation | ||
| * Martin Karpisek <[email protected]> - Bug 526283 | ||
| * Daniel Kruegler - #2031 - PDE should not warn if resource URI of unknown scheme cannot be found | ||
| *******************************************************************************/ | ||
| package org.eclipse.pde.internal.core.builders; | ||
|
|
||
| import java.io.File; | ||
| import java.util.ArrayList; | ||
| import java.util.Arrays; | ||
| import java.util.HashSet; | ||
| import java.util.Iterator; | ||
| import java.util.Map; | ||
|
|
@@ -597,7 +599,13 @@ private boolean resourceExists(String location) { | |
| } | ||
| } | ||
|
|
||
| return false; | ||
| return isIgnoredResourceUri(location); | ||
| } | ||
|
|
||
| private boolean isIgnoredResourceUri(String location) { | ||
| final var ignoredProtocols = CompilerFlags.getString(fProject, CompilerFlags.P_IGNORED_RESOURCE_PROTOCOLS); | ||
| return Arrays.stream(ignoredProtocols.split(",")).map(p -> p.trim() + ":"). //$NON-NLS-1$ //$NON-NLS-2$ | ||
| anyMatch(s -> location.regionMatches(true, 0, s, 0, s.length())); | ||
| } | ||
|
|
||
| protected void validateJavaAttribute(Element element, Attr attr) { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
| * IBM Corporation - initial API and implementation | ||
| * Code 9 Corporation - on going enhancements and maintenance | ||
| * Johannes Ahlers <[email protected]> - bug 477677 | ||
| * Daniel Kruegler - #2031 - PDE should not warn if resource URI of unknown scheme cannot be found | ||
| *******************************************************************************/ | ||
| package org.eclipse.pde.internal.ui.preferences; | ||
|
|
||
|
|
@@ -45,6 +46,8 @@ | |
| import org.eclipse.core.runtime.preferences.InstanceScope; | ||
| import org.eclipse.jface.dialogs.IDialogSettings; | ||
| import org.eclipse.jface.dialogs.MessageDialog; | ||
| import org.eclipse.jface.layout.GridDataFactory; | ||
| import org.eclipse.jface.layout.GridLayoutFactory; | ||
| import org.eclipse.jface.resource.JFaceResources; | ||
| import org.eclipse.jface.util.Util; | ||
| import org.eclipse.jface.window.Window; | ||
|
|
@@ -227,6 +230,7 @@ protected final static Key getPDEPrefKey(String key) { | |
| private static final Key KEY_P_UNKNOWN_CLASS = getPDEPrefKey(CompilerFlags.P_UNKNOWN_CLASS); | ||
| private static final Key KEY_P_UNKNOWN_RESOURCE = getPDEPrefKey(CompilerFlags.P_UNKNOWN_RESOURCE); | ||
| private static final Key KEY_P_UNKNOWN_IDENTIFIER = getPDEPrefKey(CompilerFlags.P_UNKNOWN_IDENTIFIER); | ||
| private static final Key KEY_P_IGNORED_RESOURCE_PROTOCOLS = getPDEPrefKey(CompilerFlags.P_IGNORED_RESOURCE_PROTOCOLS); | ||
|
|
||
| //general | ||
| private static final Key KEY_P_DISCOURAGED_CLASS = getPDEPrefKey(CompilerFlags.P_DISCOURAGED_CLASS); | ||
|
|
@@ -260,12 +264,20 @@ protected final static Key getPDEPrefKey(String key) { | |
| private static final Key KEY_S_DOC_FOLDER = getPDEPrefKey(CompilerFlags.S_DOC_FOLDER); | ||
| private static final Key KEY_S_OPEN_TAGS = getPDEPrefKey(CompilerFlags.S_OPEN_TAGS); | ||
|
|
||
| private static String[] SEVERITIES = {PDEUIMessages.PDECompilersConfigurationBlock_error, | ||
| private static final String[] SEVERITIES = { PDEUIMessages.PDECompilersConfigurationBlock_error, | ||
| PDEUIMessages.PDECompilersConfigurationBlock_warning, PDEUIMessages.PDECompilersConfigurationBlock_info, | ||
| PDEUIMessages.PDECompilersConfigurationBlock_ignore | ||
| }; | ||
|
|
||
| private static Key[] fgAllKeys = {KEY_F_UNRESOLVED_FEATURES, KEY_F_UNRESOLVED_PLUGINS, KEY_P_BUILD, KEY_P_BUILD_MISSING_OUTPUT, KEY_P_BUILD_SOURCE_LIBRARY, KEY_P_BUILD_OUTPUT_LIBRARY, KEY_P_BUILD_SRC_INCLUDES, KEY_P_BUILD_BIN_INCLUDES, KEY_P_BUILD_JAVA_COMPLIANCE, KEY_P_BUILD_JAVA_COMPILER, KEY_P_BUILD_ENCODINGS, KEY_P_INTERNAL, KEY_P_SERVICE_COMP_WITHOUT_LAZY, KEY_P_NO_AUTOMATIC_MODULE_NAME, KEY_P_DEPRECATED, KEY_P_DISCOURAGED_CLASS, KEY_P_INCOMPATIBLE_ENV, KEY_P_MISSING_EXPORT_PKGS, KEY_P_NO_REQUIRED_ATT, KEY_P_NOT_EXTERNALIZED, KEY_P_UNKNOWN_ATTRIBUTE, KEY_P_UNKNOWN_CLASS, KEY_P_UNKNOWN_ELEMENT, KEY_P_UNKNOWN_IDENTIFIER, KEY_P_UNKNOWN_RESOURCE, KEY_P_UNRESOLVED_EX_POINTS, KEY_P_UNRESOLVED_IMPORTS, KEY_P_VERSION_EXP_PKG, KEY_P_VERSION_IMP_PKG, KEY_P_VERSION_REQ_BUNDLE, KEY_P_VERSION_EXEC_ENV_TOO_LOW, KEY_S_CREATE_DOCS, KEY_S_DOC_FOLDER, KEY_S_OPEN_TAGS }; | ||
| PDEUIMessages.PDECompilersConfigurationBlock_ignore }; | ||
|
|
||
| private static final Key[] fgAllKeys = { KEY_F_UNRESOLVED_FEATURES, KEY_F_UNRESOLVED_PLUGINS, KEY_P_BUILD, | ||
| KEY_P_BUILD_MISSING_OUTPUT, KEY_P_BUILD_SOURCE_LIBRARY, KEY_P_BUILD_OUTPUT_LIBRARY, | ||
| KEY_P_BUILD_SRC_INCLUDES, KEY_P_BUILD_BIN_INCLUDES, KEY_P_BUILD_JAVA_COMPLIANCE, KEY_P_BUILD_JAVA_COMPILER, | ||
| KEY_P_BUILD_ENCODINGS, KEY_P_INTERNAL, KEY_P_SERVICE_COMP_WITHOUT_LAZY, KEY_P_NO_AUTOMATIC_MODULE_NAME, | ||
| KEY_P_DEPRECATED, KEY_P_DISCOURAGED_CLASS, KEY_P_INCOMPATIBLE_ENV, KEY_P_MISSING_EXPORT_PKGS, | ||
| KEY_P_NO_REQUIRED_ATT, KEY_P_NOT_EXTERNALIZED, KEY_P_UNKNOWN_ATTRIBUTE, KEY_P_UNKNOWN_CLASS, | ||
| KEY_P_UNKNOWN_ELEMENT, KEY_P_UNKNOWN_IDENTIFIER, KEY_P_UNKNOWN_RESOURCE, KEY_P_IGNORED_RESOURCE_PROTOCOLS, | ||
| KEY_P_UNRESOLVED_EX_POINTS, KEY_P_UNRESOLVED_IMPORTS, KEY_P_VERSION_EXP_PKG, KEY_P_VERSION_IMP_PKG, | ||
| KEY_P_VERSION_REQ_BUNDLE, KEY_P_VERSION_EXEC_ENV_TOO_LOW, KEY_S_CREATE_DOCS, KEY_S_DOC_FOLDER, | ||
| KEY_S_OPEN_TAGS }; | ||
|
|
||
| /** | ||
| * Constant representing the {@link IDialogSettings} section for this block | ||
|
|
@@ -564,6 +576,10 @@ private Composite createPage(int kind, Composite folder, String name, String des | |
| // References | ||
| client = createExpansibleComposite(sbody, PDEUIMessages.PDECompilersConfigurationBlock_references); | ||
| initializeComboControls(client, new String[] {PDEUIMessages.compilers_p_unknown_element, PDEUIMessages.compilers_p_unknown_attribute, PDEUIMessages.compilers_p_unknown_class, PDEUIMessages.compilers_p_discouraged_class, PDEUIMessages.compilers_p_unknown_resource, PDEUIMessages.compilers_p_unknown_identifier}, new Key[] {KEY_P_UNKNOWN_ELEMENT, KEY_P_UNKNOWN_ATTRIBUTE, KEY_P_UNKNOWN_CLASS, KEY_P_DISCOURAGED_CLASS, KEY_P_UNKNOWN_RESOURCE, KEY_P_UNKNOWN_IDENTIFIER,}, CompilerFlags.PLUGIN_FLAGS); | ||
| Composite comp = createComposite(client, 2, 2, GridData.FILL_HORIZONTAL, 0, 0); | ||
| createTextControl(comp, PDEUIMessages.compilers_p_ignored_uri_protocols, | ||
| KEY_P_IGNORED_RESOURCE_PROTOCOLS, CompilerFlags.PLUGIN_FLAGS); | ||
| SWTFactory.createLabel(comp, PDEUIMessages.compilers_p_ignored_uri_protocols_details, 2); | ||
|
|
||
| break; | ||
| } | ||
|
|
@@ -592,6 +608,17 @@ private void initializeComboControls(Composite composite, String[] labels, Key[] | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * Creates a composite without inheriting the font from its parent. | ||
| */ | ||
| private static Composite createComposite(Composite parent, int columns, int hspan, int fill, int marginwidth, | ||
| int marginheight) { | ||
| Composite composite = new Composite(parent, SWT.NONE); | ||
| GridLayoutFactory.swtDefaults().numColumns(columns).margins(marginwidth, marginheight).applyTo(composite); | ||
| GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(hspan, 1).applyTo(composite); | ||
| return composite; | ||
| } | ||
|
|
||
| /** | ||
| * Creates a checkbox button control in the parent | ||
| */ | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This label should be a tool-tip of the text field instead.
Not having an extra description field makes the UI cleaner.
And it maybe makes the code even simpler as you can maybe even skip the extra container/Composite. But I'm not sure about the latter and it would have to be investigated/tried out.
You can get the text-field by returning it from the
createTextControl()method.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All existing comparable text fields in the Eclipse wizards providing comma-separated lists use an extra label to explain the usage. See for example:
In the File Search dialog we have a comparable pattern:

In the rarer case were no such a label is provided the Eclipse UI does not show a tool tip. I would like to point these out before we change the design. So, given this additional information, do we still want to user your alternative approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All existing comparable text fields in the Eclipse wizards providing comma-separated lists use an extra label to explain the usage. See for example:
In the File Search dialog we have a comparable pattern:

In the rarer case were no such a label is provided the Eclipse UI does not show a tool tip. I would like to point these out before we change the design. So, given this additional information, do we still want to user your alternative approach?