本文整理汇总了Java中org.netbeans.spi.navigator.NavigatorPanel类的典型用法代码示例。如果您正苦于以下问题:Java NavigatorPanel类的具体用法?Java NavigatorPanel怎么用?Java NavigatorPanel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NavigatorPanel类属于org.netbeans.spi.navigator包,在下文中一共展示了NavigatorPanel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: cacheLastSelPanel
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
/** Remembers given panel for current context type */
private void cacheLastSelPanel(final NavigatorPanel panel) {
final Collection<? extends NavigatorLookupHint> hints = curHintsRes != null ? curHintsRes.allInstances() : null;
requestProcessor.post(new Runnable() {
@Override
public void run() {
LOG.fine("cacheLastSelPanel - looking for mime");
String mime = findMimeForContext(hints);
if (mime != null) {
String className = panel.getClass().getName();
NbPreferences.forModule(NavigatorController.class).put(mime, className);
LOG.fine("cacheLastSelPanel - cached " + className + "for mime " + mime);
}
}
});
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:NavigatorController.java
示例2: getLastSelPanel
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
/** Finds last selected panel for current context type */
private NavigatorPanel getLastSelPanel (List<NavigatorPanel> panels, String mime) {
if (mime == null) {
return null;
}
String className = NbPreferences.forModule(NavigatorController.class).get(mime, null);
if (className == null) {
return null;
}
LOG.fine("getLastSelPanel - found cached " + className + "for mime " + mime);
for (NavigatorPanel curPanel : panels) {
if (className.equals(curPanel.getClass().getName())) {
LOG.fine("getLastSelPanel - returning cached " + className + "for mime " + mime);
return curPanel;
}
}
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:NavigatorController.java
示例3: testGetProviders
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
public void testGetProviders () throws Exception {
UnitTestUtils.prepareTest(new String [] { "/org/netbeans/modules/navigator/resources/testGetProvidersLayer.xml" });
ProviderRegistry providerReg = ProviderRegistry.getInstance();
System.out.println("Asking for non-existent type...");
assertEquals(0, providerReg.getProviders("image/non_existent_type").size());
System.out.println("Asking for non-existent class...");
assertEquals(0, providerReg.getProviders("text/plain").size());
System.out.println("Asking for valid type and provider...");
Collection<? extends NavigatorPanel> result = providerReg.getProviders(MARVELOUS_DATA_TYPE);
assertEquals(1, result.size());
NavigatorPanel np = result.iterator().next();
assertTrue(np instanceof MarvelousDataTypeProvider);
MarvelousDataTypeProvider provider = (MarvelousDataTypeProvider)np;
assertEquals(MARVELOUS_DATA_TYPE_NAME, provider.getDisplayName());
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:ProviderRegistryTest.java
示例4: missingNavigatorAPIHack
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
static void missingNavigatorAPIHack(
@NonNull final ActionEvent ev,
@NonNull final JavaSource context,
@NullAllowed final JTextComponent target) {
final Action openNavigator = FileUtil.getConfigObject(
"Actions/Window/org-netbeans-modules-navigator-ShowNavigatorAction.instance",
Action.class);
if (openNavigator != null) {
openNavigator.actionPerformed(ev);
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
NavigatorHandler.activateNavigator();
final Collection<? extends NavigatorPanel> panels = getPanels(context);
NavigatorPanel cmp = null;
for (NavigatorPanel panel : panels) {
if (panel.getComponent().getClass() == ClassMemberPanelUI.class) {
cmp = panel;
break;
}
}
if (cmp != null) {
NavigatorHandler.activatePanel(cmp);
((ClassMemberPanelUI)cmp.getComponent()).setContext(context, target);
}
}
});
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:ShowMembersAction.java
示例5: getPanels
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
private static Collection<? extends NavigatorPanel> getPanels(@NonNull final JavaSource context) {
final Collection<? extends FileObject> files = context.getFileObjects();
assert files.size() == 1;
return Lookups.forPath(
String.format(
"Navigator/Panels/%s/", //NOI18N
files.iterator().next().getMIMEType())).lookupAll(NavigatorPanel.class);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ShowMembersAction.java
示例6: navigatorTCClosed
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
/** Stops listening to selected nodes and active component */
private void navigatorTCClosed() {
if (panelLookupNodesResult == null || closed) {
return;
}
LOG.fine("Entering navigatorTCClosed");
curNodesRes.removeLookupListener(this);
curHintsRes.removeLookupListener(this);
panelLookupNodesResult.removeLookupListener(panelLookupListener);
curNodesRes = null;
curHintsRes = null;
synchronized (CUR_NODES_LOCK) {
curNodes = Collections.emptyList();
}
weakNodesL = Collections.emptyList();
// #113764: mem leak fix - update lookup - force ClientsLookup to free its delegates
clientsLookup.lookup(Object.class);
panelLookupWithNodes.setNodes(null);
// #104145: panelDeactivated called if needed
NavigatorPanel selPanel = navigatorTC.getSelectedPanel();
if (selPanel != null) {
selPanel.panelDeactivated();
}
lastActivatedRef = null;
currentPanels = null;
navigatorTC.setPanels(null, null);
panelLookupNodesResult = null;
LOG.fine("navigatorTCClosed: activated nodes: " + navigatorTC.getTopComponent().getActivatedNodes());
if (navigatorTC.getTopComponent().getActivatedNodes() != null) {
LOG.fine("navigatorTCClosed: clearing act nodes...");
navigatorTC.getTopComponent().setActivatedNodes(new Node[0]);
}
closed = true;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:NavigatorController.java
示例7: obtainProviders
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
/**
* Shortcut for test purposes
*
* @node Nodes collection context, may be empty.
*/
List<NavigatorPanel> obtainProviders(Collection<? extends Node> nodes) {
Lookup globalContext = Utilities.actionsGlobalContext();
NavigatorLookupPanelsPolicy panelsPolicy = globalContext.lookup(NavigatorLookupPanelsPolicy.class);
Collection<? extends NavigatorLookupHint> lkpHints = globalContext.lookupAll(NavigatorLookupHint.class);
return obtainProviders(nodes, panelsPolicy, lkpHints);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:NavigatorController.java
示例8: getSelectedPanelLookup
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
/** Returns lookup of selected panel or null */
private Lookup getSelectedPanelLookup () {
NavigatorPanel selPanel = navigatorTC.getSelectedPanel();
if (selPanel != null) {
Lookup panelLkp = selPanel.getLookup();
if (panelLkp != null) {
return panelLkp;
}
}
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:NavigatorController.java
示例9: panelMatch
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
public boolean panelMatch(NavigatorPanel panel) {
if (panel == null) {
return false;
}
if (this.getClass().equals(panel.getClass())) {
return super.equals(panel);
}
if (delegate != null) {
return delegate.equals(panel);
} else if (panel.getDisplayName().equals(attrs.get("displayName"))) {
return initialize().equals(panel);
} else {
return false;
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:LazyPanel.java
示例10: register
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
private void register(Element e, NavigatorPanel.Registration r) throws LayerGenerationException {
String suffix = layer(e).instanceFile("dummy", null, null, r, null).getPath().substring("dummy".length()); // e.g. /my-Panel.instance
layer(e).file(ProviderRegistry.PANELS_FOLDER + r.mimeType() + suffix).
methodvalue("instanceCreate", LazyPanel.class.getName(), "create").
instanceAttribute("delegate", NavigatorPanel.class, r, null).
position(r.position()).
bundlevalue("displayName", r.displayName()).
write();
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:NavigatorPanelRegistrationProcessor.java
示例11: setPanels
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
/** Sets content of navigator to given panels, selecting given one
* @param panels List of panels
* @param select Panel to be selected, shown
*/
@Override
public void setPanels (List<? extends NavigatorPanel> panels, NavigatorPanel select) {
this.panels = panels;
int panelsCount = panels == null ? -1 : panels.size();
selectedPanel = null;
toolbarComponent = null;
// clear regular content
panelSelector.removeActionListener(panelSelectionListener);
contentArea.removeAll();
panelSelector.removeAllItems();
// no panel, so make UI look empty
if (panelsCount <= 0) {
setToEmpty();
} else {
// #63777: hide panel selector when only one panel available
holderPanel.setVisible(panelsCount != 1 || (select instanceof NavigatorPanelWithToolbar && ((NavigatorPanelWithToolbar)select).getToolbarComponent() != null));
boolean selectFound = false;
for (NavigatorPanel curPanel : panels) {
panelSelector.addItem(curPanel.getDisplayName());
if (curPanel == select) {
selectFound = true;
}
}
panelSelector.addActionListener(panelSelectionListener);
if (selectFound) {
setSelectedPanel(select);
} else {
setSelectedPanel(panels.get(0));
}
// show if was hidden
resetFromEmpty();
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:NavigatorTC.java
示例12: getProviders
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
/** Finds appropriate providers for given data content type
* (similar to mime type)
* and returns list of provider classes.
*
* @return Collection of providers, which implements NavigatorPanel interface.
* Never return null, only empty List if no provider exists for given content type.
*/
public Collection<? extends NavigatorPanel> getProviders (String contentType) {
if (contentTypes2Providers == null) {
contentTypes2Providers = new HashMap<String, Collection<? extends NavigatorPanel>>(15);
}
Collection<? extends NavigatorPanel> result = contentTypes2Providers.get(contentType);
if (result == null) {
// load and instantiate provider classes
result = loadProviders(contentType);
contentTypes2Providers.put(contentType, result);
}
return result;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:ProviderRegistry.java
示例13: loadProviders
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
/** Returns collection of NavigatorPanels or empty collection if no provider
* exist for given content type
*/
private Collection<? extends NavigatorPanel> loadProviders (String contentType) {
String path = PANELS_FOLDER + contentType;
Lookup.Result<NavigatorPanel> result = Lookups.forPath(path).lookup(NAV_PANEL_TEMPLATE);
return result.allInstances();
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ProviderRegistry.java
示例14: testBugfix104145_DeactivatedNotCalled
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
public void testBugfix104145_DeactivatedNotCalled () throws Exception {
System.out.println("Testing bugfix 104145...");
InstanceContent ic = getInstanceContent();
TestLookupHint ostravskiHint = new TestLookupHint("ostravski/gyzd");
ic.add(ostravskiHint);
NavigatorTC navTC = NavigatorTC.getInstance();
NavigatorTCHandle navTCH = new NavigatorTCHandle(navTC);
try {
navTCH.open();
waitForProviders(navTC);
NavigatorPanel selPanel = navTC.getSelectedPanel();
OstravskiGyzdProvider ostravak = (OstravskiGyzdProvider) selPanel;
ostravak.resetDeactCalls();
navTCH.close();
int deact = ostravak.getPanelDeactivatedCallsCount();
assertEquals("panelDeactivated expected to be called once but called " + deact + " times.",
1, deact);
} finally {
// clean in finally block so that test doesn't affect others
navTCH.close();
ic.remove(ostravskiHint);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:NavigatorTCTest.java
示例15: testBugfix80155_NotEmptyOnProperties
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
public void testBugfix80155_NotEmptyOnProperties () throws Exception {
System.out.println("Testing bugfix 80155, keeping content on Properties window and similar...");
InstanceContent ic = getInstanceContent();
TestLookupHint ostravskiHint = new TestLookupHint("ostravski/gyzd");
ic.add(ostravskiHint);
NavigatorTC navTC = NavigatorTC.getInstance();
NavigatorTCHandle navTCH = new NavigatorTCHandle(navTC);
try {
navTCH.open();
waitForProviders(navTC);
NavigatorPanel selPanel = navTC.getSelectedPanel();
assertNotNull("Selected panel is null", selPanel);
ic.remove(ostravskiHint);
// wait for selected node change to be applied, because changes are
// reflected with little delay
waitForChange();
// after 80155 fix, previous navigator should keep its content even when
// new component was activated, but didn't contain any activated nodes or navigator lookup hint
selPanel = navTC.getSelectedPanel();
assertNotNull("Selected panel is null", selPanel);
assertTrue("Panel class not expected", selPanel instanceof OstravskiGyzdProvider);
} finally {
// cleanup
navTCH.close();
ic.remove(ostravskiHint);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:NavigatorTCTest.java
示例16: testFeature98125_UndoRedo
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
/** Test for IZ feature #98125. It tests ability of NavigatorPanelWithUndo
* implementors to provide UndoRedo support for their view through
* navigator TopComponent.
*/
public void testFeature98125_UndoRedo () throws Exception {
System.out.println("Testing feature #98125, providing UndoRedo...");
InstanceContent ic = getInstanceContent();
TestLookupHint undoHint = new TestLookupHint("undoRedo/tester");
ic.add(undoHint);
NavigatorTC navTC = NavigatorTC.getInstance();
NavigatorTCHandle navTCH = new NavigatorTCHandle(navTC);
try {
navTCH.open();
waitForProviders(navTC);
NavigatorPanel selPanel = navTC.getSelectedPanel();
assertNotNull("Selected panel should not be null", navTC.getSelectedPanel());
assertTrue("Panel class not expected", selPanel instanceof UndoRedoProvider);
UndoRedoProvider provider = (UndoRedoProvider)selPanel;
UndoRedo panelUndo = provider.getUndoRedo();
UndoRedo tcUndo = navTC.getUndoRedo();
assertTrue("Expected undo manager " + panelUndo + ", but got " + tcUndo, panelUndo == tcUndo);
} finally {
// cleanup
navTCH.close();
ic.remove(undoHint);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:NavigatorTCTest.java
示例17: testFeature217091_Toolbar
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
public void testFeature217091_Toolbar () throws Exception {
InstanceContent ic = getInstanceContent();
TestLookupHint toolbarHint = new TestLookupHint("toolbar/tester");
ic.add(toolbarHint);
NavigatorTC navTC = NavigatorTC.getInstance();
NavigatorTCHandle navTCH = new NavigatorTCHandle(navTC);
try {
navTCH.open();
waitForProviders(navTC);
NavigatorPanel selPanel = navTC.getSelectedPanel();
assertNotNull("Selected panel should not be null", navTC.getSelectedPanel());
assertTrue("Panel class not expected", selPanel instanceof ToolbarProvider);
ToolbarProvider provider = (ToolbarProvider)selPanel;
JComponent toolbarProvider = provider.getToolbarComponent();
JComponent toolbarTC = navTC.getToolbar();
assertTrue("Expected toolbar " + toolbarProvider + ", but got " + toolbarTC, toolbarProvider == toolbarTC);
} finally {
// cleanup
navTCH.close();
ic.remove(toolbarHint);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:NavigatorTCTest.java
示例18: getPanel
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
@NavigatorPanel.Registration(mimeType = "text/x-cls", displayName = "Apex")
public static SalesForceNavigationPanel getPanel() {
if (panel == null) {
panel = new SalesForceNavigationPanel();
}
return panel;
}
开发者ID:fundacionjala,项目名称:oblivion-netbeans-plugin,代码行数:8,代码来源:SalesForceNavigationPanel.java
示例19: activatePanel
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
/** Activates given panel. Throws IllegalArgumentException if panel is
* not available for activation.
*/
public void activatePanel (NavigatorPanel panel) {
LOG.fine("activatePanel - entered, panel: " + panel);
String iaeText = "Panel is not available for activation: "; //NOI18N
if (currentPanels == null) {
if (inUpdate) {
LOG.fine("activatePanel - premature exit - currentPanels == null, inUpdate == true");
cacheLastSelPanel(panel);
return;
} else {
throw new IllegalArgumentException(iaeText + panel);
}
}
NavigatorPanel toActivate = null;
boolean contains = false;
for (NavigatorPanel navigatorPanel : currentPanels) {
if (navigatorPanel instanceof LazyPanel) {
contains = ((LazyPanel) navigatorPanel).panelMatch(panel);
} else if (panel instanceof LazyPanel) {
contains = ((LazyPanel) panel).panelMatch(navigatorPanel);
} else {
contains = navigatorPanel.equals(panel);
}
if (contains) {
toActivate = navigatorPanel;
break;
}
}
if (!contains) {
if (inUpdate) {
LOG.fine("activatePanel - premature exit - panel is not contained in currenPanels");
cacheLastSelPanel(panel);
return;
} else {
throw new IllegalArgumentException(iaeText + panel + " - not part of " + currentPanels);
}
}
NavigatorPanel oldPanel = navigatorTC.getSelectedPanel();
if (!toActivate.equals(oldPanel)) {
if (oldPanel != null) {
oldPanel.panelDeactivated();
}
toActivate.panelActivated(clientsLookup);
navigatorTC.setSelectedPanel(toActivate);
// selected panel changed, update selPanelLookup to listen correctly
panelLookup.lookup(Object.class);
LOG.fine("activatePanel - normal exit - caching panel: " + panel);
cacheLastSelPanel(toActivate);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:53,代码来源:NavigatorController.java
示例20: showProviders
import org.netbeans.spi.navigator.NavigatorPanel; //导入依赖的package包/类
/** Shows obtained navigator providers
* @param providers obtained providers
* @force if true that update is forced even if it means clearing navigator content
*/
private void showProviders(List<NavigatorPanel> providers, String mimeType, boolean force) {
try {
List oldProviders = currentPanels;
final boolean areNewProviders = providers != null && !providers.isEmpty();
// navigator remains empty, do nothing
if (oldProviders == null && providers == null) {
LOG.fine("Exit because nav remain empty, force: " + force);
return;
}
NavigatorPanel selPanel = navigatorTC.getSelectedPanel();
// don't call panelActivated/panelDeactivated if the same provider is
// still available, it's client's responsibility to listen to
// context changes while active
if (oldProviders != null && oldProviders.contains(selPanel)
&& providers != null && providers.contains(selPanel)) {
// trigger resultChanged() call on client side
clientsLookup.lookup(Node.class);
// #93123: refresh providers list if needed
if (!oldProviders.equals(providers)) {
currentPanels = providers;
navigatorTC.setPanels(providers, selPanel);
}
// #100122: update activated nodes of Navigator TC
updateActNodesAndTitle();
LOG.fine("Exit because same provider and panel, notified. Force: " + force);
return;
}
if (selPanel != null) {
// #61334: don't deactivate previous providers if there are no new ones
if (!areNewProviders && !force) {
LOG.fine("Exit because no new providers, force: " + force);
return;
}
selPanel.panelDeactivated();
}
// #67849: curNode's lookup cleanup, held through ClientsLookup delegates
clientsLookup.lookup(Node.class);
NavigatorPanel newSel = null;
if (areNewProviders) {
newSel = getLastSelPanel(providers, mimeType);
if (newSel == null) {
newSel = providers.get(0);
}
newSel.panelActivated(clientsLookup);
}
currentPanels = providers;
navigatorTC.setPanels(providers, newSel);
// selected panel changed, update selPanelLookup to listen correctly
panelLookup.lookup(Object.class);
updateActNodesAndTitle();
updateWhenActivated = false;
LOG.fine("Normal exit, change to new provider, force: " + force);
} finally {
inUpdate = false;
navigatorTC.getTopComponent().makeBusy(false);
//in case of asynch obtain providers it is needed to request focus while TC is activated
if (tcActivating && navigatorTC.allowAsyncUpdate()) {
navigatorTC.getTopComponent().requestFocus();
tcActivating = false;
}
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:77,代码来源:NavigatorController.java
注:本文中的org.netbeans.spi.navigator.NavigatorPanel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论