本文整理匯總了Java中org.openide.windows.TopComponent.getDisplayName方法的典型用法代碼示例。如果您正苦於以下問題:Java TopComponent.getDisplayName方法的具體用法?Java TopComponent.getDisplayName怎麽用?Java TopComponent.getDisplayName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openide.windows.TopComponent
的用法示例。
在下文中一共展示了TopComponent.getDisplayName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: someoneActivated
import org.openide.windows.TopComponent; //導入方法依賴的package包/類
private void someoneActivated() {
TopComponent win = TopComponent.getRegistry().getActivated();
if (LOG.isLoggable(Level.FINER)) {
String winId;
if (win == null) {
winId = "<null>";
} else {
String winName = win.getDisplayName();
if (winName == null) {
winName = win.getHtmlDisplayName();
}
if (winName == null) {
winName = win.getName();
}
if (winName != null) {
winName = '"' + winName + '"';
} else {
winName = "<noname>";
}
winId = winName + '(' + win.getClass().getName() + ')';
}
LOG.log(Level.FINER, "someoneActivated ({0})", winId);
}
if ((win == null) || (win instanceof CloneableEditorSupport.Pane)) {
return;
}
Object key = getActionMapKey();
ActionMap actionMap = win.getActionMap();
if ((actionMap.get(key) == null) && activatedOnWindows.add(win)) {
Action ls = getAction();
actionMap.put(key, ls);
win.putClientProperty(getMappedActionKey(),
new WeakReference<Action>(ls));
}
}
示例2: createSwitcherItems
import org.openide.windows.TopComponent; //導入方法依賴的package包/類
private Item[] createSwitcherItems(final TabDisplayer displayer) {
java.util.List<TabData> tabs = displayer.getModel().getTabs();
Item[] items = new Item[tabs.size()];
int i = 0;
int selIdx = displayer.getSelectionModel().getSelectedIndex();
TabData selectedTab = selIdx >= 0 ? displayer.getModel().getTab(selIdx) : null;
for (TabData tab : tabs) {
String name;
String htmlName;
if (tab.getComponent() instanceof TopComponent) {
TopComponent tabTC = (TopComponent) tab.getComponent();
name = tabTC.getDisplayName();
// #68291 fix - some hostile top components have null display name
if (name == null) {
name = tabTC.getName();
}
htmlName = tabTC.getHtmlDisplayName();
if (htmlName == null) {
htmlName = name;
}
} else {
name = htmlName = tab.getText();
}
items[i++] = new Item(
new ActivatableTab(tab),
name,
htmlName,
tab,
tab == selectedTab);
}
return items;
}
示例3: extractDisplayName
import org.openide.windows.TopComponent; //導入方法依賴的package包/類
private static String extractDisplayName( TopComponent tc ) {
String name = tc.getShortName();
if( name == null || name.isEmpty() ) {
name = tc.getHtmlDisplayName();
}
if( name == null || name.isEmpty() ) {
name = tc.getDisplayName();
}
if( name == null || name.isEmpty() ) {
name = tc.getName();
}
return name;
}
示例4: createSwitcherItems
import org.openide.windows.TopComponent; //導入方法依賴的package包/類
private Item[] createSwitcherItems(final Controller controller) {
ProjectSupport projectSupport = ProjectSupport.getDefault();
final boolean sortByProject = Settings.getDefault().isSortDocumentListByProject()
&& projectSupport.isEnabled();
java.util.List<TabData> tabs = controller.getTabModel().getTabs();
ArrayList<Item> items = new ArrayList<Item>(tabs.size());
int selIdx = controller.getSelectedIndex();
TabData selectedTab = selIdx >= 0 && selIdx < controller.getTabModel().size() ? controller.getTabModel().getTab(selIdx) : null;
boolean hasProjectInfo = false;
for (TabData tab : tabs) {
String name;
String htmlName;
if (tab.getComponent() instanceof TopComponent) {
TopComponent tabTC = (TopComponent) tab.getComponent();
name = tabTC.getDisplayName();
// #68291 fix - some hostile top components have null display name
if (name == null) {
name = tabTC.getName();
}
htmlName = tabTC.getHtmlDisplayName();
if (htmlName == null) {
htmlName = name;
}
} else {
name = htmlName = tab.getText();
}
ProjectProxy project = null;
if( sortByProject ) {
project = projectSupport.getProjectForTab( tab );
hasProjectInfo |= null != project;
}
items.add( new Item(
new ActivatableTab(tab),
name,
htmlName,
tab,
tab == selectedTab,
project));
}
Collections.sort( items );
if( sortByProject && hasProjectInfo ) {
//add project headers
ProjectProxy currentProject = null;
for( int i=0; i<items.size(); i++ ) {
Item item = items.get( i );
ProjectProxy p = item.getProject();
if( null != p && !p.equals( currentProject ) ) {
items.add( i, Item.create( p ) );
} else if( null == p && null != currentProject ) {
items.add( i, DocumentSwitcherTable.NO_PROJECT_SEPARATOR );
}
currentProject = p;
}
}
return items.toArray( new Item[items.size()] );
}