本文整理汇总了Java中org.openide.windows.TopComponent.getName方法的典型用法代码示例。如果您正苦于以下问题:Java TopComponent.getName方法的具体用法?Java TopComponent.getName怎么用?Java TopComponent.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.windows.TopComponent
的用法示例。
在下文中一共展示了TopComponent.getName方法的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()] );
}