mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-2868 - Image Cleanup - Removed unused images; removed duplicate
images; fixed image module dependency issues
This commit is contained in:
@@ -3,3 +3,7 @@
|
||||
##MODULE IP: GPL 2 With Classpath Exception
|
||||
Module.manifest||GHIDRA||||END|
|
||||
build.files/buildLocalHelp.xml||GHIDRA||||END|
|
||||
src/main/resources/help/shared/arrow.gif||GHIDRA||||END|
|
||||
src/main/resources/help/shared/note.png||Oxygen Icons - LGPL 3.0|||Oxygen icon theme (dual license; LGPL or CC-SA-3.0)|END|
|
||||
src/main/resources/help/shared/note.yellow.png||Oxygen Icons - LGPL 3.0|||Oxygen icon theme (dual license; LGPL or CC-SA-3.0)|END|
|
||||
src/main/resources/help/shared/tip.png||Oxygen Icons - LGPL 3.0|||Oxygen icon theme (dual license; LGPL or CC-SA-3.0)|END|
|
||||
|
||||
@@ -495,7 +495,13 @@ public class GHelpHTMLEditorKit extends HTMLEditorKit {
|
||||
|
||||
// check if the srcString is a defined theme icon id
|
||||
if (Gui.hasIcon(srcString)) {
|
||||
return new GIcon(srcString).getUrl();
|
||||
//
|
||||
// Wrap the GIcon inside of an IconProvider, as that class can handle a null URL
|
||||
// returned from GIcon. (This can happen if the GIcon is based on a modified icon.)
|
||||
//
|
||||
GIcon gIcon = new GIcon(srcString);
|
||||
IconProvider iconProvider = new IconProvider(gIcon, gIcon.getUrl());
|
||||
return iconProvider.getOrCreateUrl();
|
||||
}
|
||||
|
||||
if (isJavaCode(srcString)) {
|
||||
|
||||
@@ -509,10 +509,7 @@ public class HelpBuildUtils {
|
||||
|
||||
private static URI resolve(Path sourceFile, String ref) throws URISyntaxException {
|
||||
URI resolved;
|
||||
if (ref.startsWith("help/topics")) {
|
||||
resolved = new URI(ref); // help system syntax
|
||||
}
|
||||
else if (ref.startsWith("help/")) {
|
||||
if (ref.startsWith("help/")) {
|
||||
resolved = new URI(ref); // help system syntax
|
||||
}
|
||||
else {
|
||||
@@ -569,8 +566,14 @@ public class HelpBuildUtils {
|
||||
return ImageLocation.createRuntimeLocation(sourceFile, ref, resolved, path);
|
||||
}
|
||||
if (Gui.hasIcon(ref)) {
|
||||
|
||||
//
|
||||
// Wrap the GIcon inside of an IconProvider, as that class can handle a null URL
|
||||
// returned from GIcon. (This can happen if the GIcon is based on a modified icon.)
|
||||
//
|
||||
GIcon gIcon = new GIcon(ref);
|
||||
URL url = gIcon.getUrl();
|
||||
IconProvider iconProvider = new IconProvider(gIcon, gIcon.getUrl());
|
||||
URL url = iconProvider.getOrCreateUrl();
|
||||
URI resolved = url.toURI();
|
||||
Path path = toPath(resolved);
|
||||
return ImageLocation.createRuntimeLocation(sourceFile, ref, resolved, path);
|
||||
|
||||
@@ -95,7 +95,8 @@ public class JavaHelpValidator {
|
||||
Map<HelpFile, Map<String, List<AnchorDefinition>>> duplicateAnchors =
|
||||
helpCollection.getDuplicateAnchorsByFile();
|
||||
debug("\tHelp files with duplicate anchors: " + duplicateAnchors.size());
|
||||
for (Entry<HelpFile, Map<String, List<AnchorDefinition>>> entry : duplicateAnchors.entrySet()) {
|
||||
for (Entry<HelpFile, Map<String, List<AnchorDefinition>>> entry : duplicateAnchors
|
||||
.entrySet()) {
|
||||
HelpFile helpFile = entry.getKey();
|
||||
Map<String, List<AnchorDefinition>> list = entry.getValue();
|
||||
linkDatabase.addDuplicateAnchors(
|
||||
@@ -174,16 +175,59 @@ public class JavaHelpValidator {
|
||||
|
||||
private Path findPathInModules(IMG img) {
|
||||
|
||||
String rawSrc = img.getSrcAttribute();
|
||||
Collection<ResourceFile> moduleRoots = Application.getModuleRootDirectories();
|
||||
for (ResourceFile root : moduleRoots) {
|
||||
ResourceFile resourceDir = new ResourceFile(root, "src/main/resources");
|
||||
Path toCheck = makePath(resourceDir, rawSrc);
|
||||
String src = img.getSrcAttribute();
|
||||
|
||||
// TODO upcoming 'shared' unification
|
||||
// if (src.startsWith(HelpLocation.HELP_IMAGES)) {
|
||||
if (src.startsWith("../../shared/")) {
|
||||
|
||||
// this prefix is a signal to look for images in a special directory inside of the
|
||||
// modules instead of help
|
||||
String imagePath = "help/" + src.substring("../../".length());
|
||||
|
||||
ResourceFile myModule = Application.getMyModuleRootDirectory();
|
||||
ResourceFile resourceDir = new ResourceFile(myModule, "src/main/resources");
|
||||
Path toCheck = makePath(resourceDir, imagePath);
|
||||
if (toCheck != null) {
|
||||
return toCheck;
|
||||
}
|
||||
|
||||
// now try removing the 'shared' portion altogether
|
||||
imagePath = "images/" + src.substring("../../shared/".length());
|
||||
Path path = doFindPathInModules(imagePath);
|
||||
if (path != null) {
|
||||
return path;
|
||||
}
|
||||
|
||||
// TODO upcoming 'shared' unification
|
||||
// Path path = doFindPathInModules(imagePath);
|
||||
// if (path != null) {
|
||||
// return path;
|
||||
// }
|
||||
}
|
||||
|
||||
// TODO upcoming 'shared' unification - fix the few of these that are left-over in the html
|
||||
if (src.startsWith("../images/")) {
|
||||
String imagePath = src.substring("../".length());
|
||||
Path toCheck = doFindPathInModules(imagePath);
|
||||
if (toCheck != null) {
|
||||
return toCheck;
|
||||
}
|
||||
}
|
||||
|
||||
return doFindPathInModules(src);
|
||||
}
|
||||
|
||||
private Path doFindPathInModules(String path) {
|
||||
|
||||
Collection<ResourceFile> moduleRoots = Application.getModuleRootDirectories();
|
||||
for (ResourceFile root : moduleRoots) {
|
||||
ResourceFile resourceDir = new ResourceFile(root, "src/main/resources");
|
||||
Path toCheck = makePath(resourceDir, path);
|
||||
if (toCheck != null) {
|
||||
return toCheck;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import ghidra.util.HelpLocation;
|
||||
import help.HelpBuildUtils;
|
||||
import help.validator.location.HelpModuleLocation;
|
||||
|
||||
@@ -43,7 +44,7 @@ public class HREF implements Comparable<HREF> {
|
||||
this.lineNumber = lineNum;
|
||||
|
||||
URI resolved;
|
||||
if (href.startsWith("help/topics")) {
|
||||
if (href.startsWith(HelpLocation.HELP_TOPICS)) {
|
||||
resolved = new URI(href);
|
||||
}
|
||||
else {
|
||||
@@ -97,7 +98,10 @@ public class HREF implements Comparable<HREF> {
|
||||
return href;
|
||||
}
|
||||
|
||||
/** The relative help path to the destination of this HREF */
|
||||
/**
|
||||
* The relative help path to the destination of this HREF
|
||||
* @return the relative help path to the destination of this HREF
|
||||
*/
|
||||
public Path getReferenceFileHelpPath() {
|
||||
return relativePath;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class IMG implements Comparable<IMG> {
|
||||
* @param sourceFile the source file containing this IMG reference
|
||||
* @param imgSrc the IMG SRC attribute pulled from the HTML file
|
||||
* @param lineNumber the line number of the IMG tag
|
||||
* @throws URISyntaxException
|
||||
* @throws URISyntaxException if there is an exception resolving the image URI
|
||||
*/
|
||||
public IMG(HelpModuleLocation help, Path sourceFile, String imgSrc, int lineNumber)
|
||||
throws URISyntaxException {
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
Java Help Note: JavaHelp does not accept sizes (like in 'margin-top') in anything but
|
||||
px (pixel) or with no type marking.
|
||||
*/
|
||||
|
||||
body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 10px; } /* some padding to improve readability */
|
||||
li { font-family:times new roman; font-size:14pt; }
|
||||
h1 { color:#80a0c0; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
|
||||
h2 { margin: 10px; margin-top: 20px; color:#DDA0DD; font-family:times new roman; font-size:18pt; font-weight:bold; }
|
||||
h3 { margin-left: 10px; margin-top: 20px; color:#6495ED; font-family:times new roman; font-size:14pt; font-weight:bold; }
|
||||
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
|
||||
|
||||
/*
|
||||
P tag code. Most of the help files nest P tags inside of blockquote tags (the was the
|
||||
way it had been done in the beginning). The net effect is that the text is indented. In
|
||||
modern HTML we would use CSS to do this. We need to support the Ghidra P tags, nested in
|
||||
blockquote tags, as well as naked P tags. The following two lines accomplish this. Note
|
||||
that the 'blockquote p' definition will inherit from the first 'p' definition.
|
||||
*/
|
||||
p { margin-left: 40px; font-family:times new roman; font-size:14pt; }
|
||||
blockquote p { margin-left: 10px; }
|
||||
|
||||
p.providedbyplugin { color:#7f7f7f; margin-left: 10px; font-size:14pt; margin-top:100px }
|
||||
p.ProvidedByPlugin { color:#7f7f7f; margin-left: 10px; font-size:14pt; margin-top:100px }
|
||||
p.relatedtopic { color:#9370DB; margin-left: 10px; font-size:14pt; }
|
||||
p.RelatedTopic { color:#9370DB; margin-left: 10px; font-size:14pt; }
|
||||
|
||||
/*
|
||||
We wish for a tables to have space between it and the preceding element, so that text
|
||||
is not too close to the top of the table. Also, nest the table a bit so that it is clear
|
||||
the table relates to the preceding text.
|
||||
*/
|
||||
table { margin-left: 20px; margin-top: 10px; width: 80%;}
|
||||
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
|
||||
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; color: gray;}
|
||||
|
||||
/*
|
||||
Code-like formatting for things such as file system paths and proper names of classes,
|
||||
methods, etc. To apply this to a file path, use this syntax:
|
||||
<CODE CLASS="path">...</CODE>
|
||||
*/
|
||||
code { color: #F5F5F5; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
|
||||
code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
|
||||
@@ -0,0 +1,64 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
WARNING!
|
||||
This file is copied to all help directories. If you change this file, you must copy it
|
||||
to each src/main/help/help/shared directory.
|
||||
|
||||
|
||||
Java Help Note: JavaHelp does not accept sizes (like in 'margin-top') in anything but
|
||||
px (pixel) or with no type marking.
|
||||
|
||||
*/
|
||||
|
||||
body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 10px; } /* some padding to improve readability */
|
||||
li { font-family:times new roman; font-size:14pt; }
|
||||
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
|
||||
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
|
||||
h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
|
||||
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
|
||||
|
||||
/*
|
||||
P tag code. Most of the help files nest P tags inside of blockquote tags (the was the
|
||||
way it had been done in the beginning). The net effect is that the text is indented. In
|
||||
modern HTML we would use CSS to do this. We need to support the Ghidra P tags, nested in
|
||||
blockquote tags, as well as naked P tags. The following two lines accomplish this. Note
|
||||
that the 'blockquote p' definition will inherit from the first 'p' definition.
|
||||
*/
|
||||
p { margin-left: 40px; font-family:times new roman; font-size:14pt; }
|
||||
blockquote p { margin-left: 10px; }
|
||||
|
||||
p.providedbyplugin { color:#7f7f7f; margin-left: 10px; font-size:14pt; margin-top:100px }
|
||||
p.ProvidedByPlugin { color:#7f7f7f; margin-left: 10px; font-size:14pt; margin-top:100px }
|
||||
p.relatedtopic { color:#800080; margin-left: 10px; font-size:14pt; }
|
||||
p.RelatedTopic { color:#800080; margin-left: 10px; font-size:14pt; }
|
||||
|
||||
/*
|
||||
We wish for a tables to have space between it and the preceding element, so that text
|
||||
is not too close to the top of the table. Also, nest the table a bit so that it is clear
|
||||
the table relates to the preceding text.
|
||||
*/
|
||||
table { margin-left: 20px; margin-top: 10px; width: 80%;}
|
||||
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
|
||||
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
|
||||
|
||||
/*
|
||||
Code-like formatting for things such as file system paths and proper names of classes,
|
||||
methods, etc. To apply this to a file path, use this syntax:
|
||||
<CODE CLASS="path">...</CODE>
|
||||
*/
|
||||
code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
|
||||
code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
|
||||
@@ -0,0 +1,64 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
WARNING!
|
||||
This file is copied to all help directories. If you change this file, you must copy it
|
||||
to each src/main/help/help/shared directory.
|
||||
|
||||
|
||||
Java Help Note: JavaHelp does not accept sizes (like in 'margin-top') in anything but
|
||||
px (pixel) or with no type marking.
|
||||
|
||||
*/
|
||||
|
||||
body { margin-bottom: 50px; margin-left: 10px; margin-right: 10px; margin-top: 10px; } /* some padding to improve readability */
|
||||
li { font-family:times new roman; font-size:14pt; }
|
||||
h1 { color:#000080; font-family:times new roman; font-size:36pt; font-style:italic; font-weight:bold; text-align:center; }
|
||||
h2 { margin: 10px; margin-top: 20px; color:#984c4c; font-family:times new roman; font-size:18pt; font-weight:bold; }
|
||||
h3 { margin-left: 10px; margin-top: 20px; color:#0000ff; font-family:times new roman; font-size:14pt; font-weight:bold; }
|
||||
h4 { margin-left: 10px; margin-top: 20px; font-family:times new roman; font-size:14pt; font-style:italic; }
|
||||
|
||||
/*
|
||||
P tag code. Most of the help files nest P tags inside of blockquote tags (the was the
|
||||
way it had been done in the beginning). The net effect is that the text is indented. In
|
||||
modern HTML we would use CSS to do this. We need to support the Ghidra P tags, nested in
|
||||
blockquote tags, as well as naked P tags. The following two lines accomplish this. Note
|
||||
that the 'blockquote p' definition will inherit from the first 'p' definition.
|
||||
*/
|
||||
p { margin-left: 40px; font-family:times new roman; font-size:14pt; }
|
||||
blockquote p { margin-left: 10px; }
|
||||
|
||||
p.providedbyplugin { color:#7f7f7f; margin-left: 10px; font-size:14pt; margin-top:100px }
|
||||
p.ProvidedByPlugin { color:#7f7f7f; margin-left: 10px; font-size:14pt; margin-top:100px }
|
||||
p.relatedtopic { color:#800080; margin-left: 10px; font-size:14pt; }
|
||||
p.RelatedTopic { color:#800080; margin-left: 10px; font-size:14pt; }
|
||||
|
||||
/*
|
||||
We wish for a tables to have space between it and the preceding element, so that text
|
||||
is not too close to the top of the table. Also, nest the table a bit so that it is clear
|
||||
the table relates to the preceding text.
|
||||
*/
|
||||
table { margin-left: 20px; margin-top: 10px; width: 80%;}
|
||||
td { font-family:times new roman; font-size:14pt; vertical-align: top; }
|
||||
th { font-family:times new roman; font-size:14pt; font-weight:bold; background-color: #EDF3FE; }
|
||||
|
||||
/*
|
||||
Code-like formatting for things such as file system paths and proper names of classes,
|
||||
methods, etc. To apply this to a file path, use this syntax:
|
||||
<CODE CLASS="path">...</CODE>
|
||||
*/
|
||||
code { color: black; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
|
||||
code.path { color: #4682B4; font-weight: bold; font-family: courier new, monospace; font-size: 14pt; white-space: nowrap; }
|
||||
BIN
Ghidra/Framework/Help/src/main/resources/help/shared/arrow.gif
Normal file
BIN
Ghidra/Framework/Help/src/main/resources/help/shared/arrow.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 69 B |
BIN
Ghidra/Framework/Help/src/main/resources/help/shared/note.png
Normal file
BIN
Ghidra/Framework/Help/src/main/resources/help/shared/note.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
BIN
Ghidra/Framework/Help/src/main/resources/help/shared/tip.png
Normal file
BIN
Ghidra/Framework/Help/src/main/resources/help/shared/tip.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Reference in New Issue
Block a user