mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-10 06:02:09 +00:00
GP-4875 - Updated how providers track user changes to the title
This commit is contained in:
parent
aac3e5ad1c
commit
1cb3796bc2
@ -640,13 +640,13 @@ class ComponentNode extends Node {
|
||||
return; // cancelled
|
||||
}
|
||||
|
||||
// If the user changes the name, then we want to replace all of the
|
||||
// parts of the title with that name. We skip the subtitle, as that
|
||||
// doesn't make sense in that case.
|
||||
provider.setTitle(newName); // title on window
|
||||
provider.setSubTitle(""); // part after the title
|
||||
provider.setTabText(newName); // text on the tab
|
||||
placeholder.update();
|
||||
// If the user changes the name, then we want to replace all of the parts of the
|
||||
// title with that name. We do not supply a custom subtitle, as that doesn't make
|
||||
// sense in this case, but we clear it so the user's title is the only thing
|
||||
// visible. This means that providers can still update the subtitle later.
|
||||
provider.setCustomTitle(newName); // title on window
|
||||
provider.setSubTitle(""); // part after the title
|
||||
provider.setCustomTabText(newName); // text on the tab
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,9 @@
|
||||
* 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.
|
||||
@ -88,9 +88,13 @@ public abstract class ComponentProvider implements HelpDescriptor, ActionContext
|
||||
protected Tool dockingTool;
|
||||
private String name;
|
||||
private final String owner;
|
||||
|
||||
private String title;
|
||||
private String subTitle;
|
||||
private String tabText;
|
||||
private String customTitle;
|
||||
private String customTabText;
|
||||
private String customSubTitle;
|
||||
|
||||
private Set<DockingActionIf> actionSet = new LinkedHashSet<>();
|
||||
|
||||
@ -549,6 +553,10 @@ public abstract class ComponentProvider implements HelpDescriptor, ActionContext
|
||||
* @param title the title string to use.
|
||||
*/
|
||||
public void setTitle(String title) {
|
||||
if (customTitle != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.title = title;
|
||||
if (isInTool()) {
|
||||
dockingTool.updateTitle(this);
|
||||
@ -561,6 +569,10 @@ public abstract class ComponentProvider implements HelpDescriptor, ActionContext
|
||||
* @param subTitle the sub-title string to use.
|
||||
*/
|
||||
public void setSubTitle(String subTitle) {
|
||||
if (customSubTitle != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.subTitle = subTitle;
|
||||
if (isInTool()) {
|
||||
dockingTool.updateTitle(this);
|
||||
@ -572,7 +584,56 @@ public abstract class ComponentProvider implements HelpDescriptor, ActionContext
|
||||
* @param tabText the tab text.
|
||||
*/
|
||||
public void setTabText(String tabText) {
|
||||
if (customTabText != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.tabText = tabText;
|
||||
if (isInTool()) {
|
||||
dockingTool.updateTitle(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The new custom title. Setting the title here prevents future calls to
|
||||
* {@link #setTitle(String)} from having any effect. This is done to preserve the custom
|
||||
* title.
|
||||
* @param title the title
|
||||
*/
|
||||
public void setCustomTitle(String title) {
|
||||
this.customTitle = title;
|
||||
this.title = title;
|
||||
if (isInTool()) {
|
||||
dockingTool.updateTitle(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The new custom tab text. Setting the text here prevents future calls to
|
||||
* {@link #setTabText(String)} from having any effect. This is done to preserve the custom
|
||||
* tab text.
|
||||
* @param tabText the text
|
||||
*/
|
||||
public void setCustomTabText(String tabText) {
|
||||
this.customTabText = tabText;
|
||||
this.tabText = tabText;
|
||||
if (isInTool()) {
|
||||
dockingTool.updateTitle(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The new custom sub-title. Setting the sub-title here prevents future calls to
|
||||
* {@link #setSubTitle(String)} from having any effect. This is done to preserve the custom
|
||||
* sub-title.
|
||||
* @param subTitle the sub-title
|
||||
*/
|
||||
public void setCustomSubTitle(String subTitle) {
|
||||
this.customSubTitle = subTitle;
|
||||
this.subTitle = subTitle;
|
||||
if (isInTool()) {
|
||||
dockingTool.updateTitle(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user