本文整理匯總了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);
}