本文整理汇总了Java中org.openide.windows.TopComponent.getHtmlDisplayName方法的典型用法代码示例。如果您正苦于以下问题:Java TopComponent.getHtmlDisplayName方法的具体用法?Java TopComponent.getHtmlDisplayName怎么用?Java TopComponent.getHtmlDisplayName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.windows.TopComponent
的用法示例。
在下文中一共展示了TopComponent.getHtmlDisplayName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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()] );
}
示例5: initEditorDocuments
import org.openide.windows.TopComponent; //导入方法依赖的package包/类
private void initEditorDocuments() {
elementsList = new JList() {
@Override
public String getToolTipText(MouseEvent event) {
int index = locationToIndex(event.getPoint());
if (index != -1) {
EditorListElement element = (EditorListElement) elementsList.getModel().getElementAt(index);
return element.fileObject.getPath();
}
return null;
}
};
List<EditorListElement> elements = new ArrayList<EditorListElement>();
WindowManager wm = WindowManager.getDefault();
Set<? extends Mode> modes = wm.getModes();
for (Mode mode : modes) {
if (wm.isEditorMode(mode)) {
TopComponent[] tcs = mode.getTopComponents();
for (TopComponent tc : tcs) {
Lookup lukap = tc.getLookup();
FileObject fo = lukap.lookup(FileObject.class);
if (fo == null) {
DataObject dobj = lukap.lookup(DataObject.class);
if (dobj != null) {
fo = dobj.getPrimaryFile();
}
}
if (fo != null && fo != peer) {
if (tc.getHtmlDisplayName() != null) {
elements.add(new EditorListElement(fo, tc.getHtmlDisplayName(), true));
} else {
elements.add(new EditorListElement(fo, tc.getName(), false));
}
}
}
}
}
elementsList.setListData(elements.toArray(new EditorListElement[elements.size()]));
elementsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
elementsList.addListSelectionListener(this);
elementsList.setCellRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent (JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
if (isSelected && value instanceof EditorListElement && ((EditorListElement) value).isHtml()) {
value = stripHtml(((EditorListElement) value).toString());
}
return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
}
private String stripHtml (String htmlText) {
if (null == htmlText) {
return null;
}
String res = htmlText.replaceAll("<[^>]*>", ""); // NOI18N // NOI18N
res = res.replaceAll(" ", " "); // NOI18N // NOI18N
res = res.trim();
return res;
}
});
JScrollPane sp = new JScrollPane(elementsList);
jPanel1.add(sp);
}