use of org.openide.windows.TopComponent in project enclojure by EricThorsen.
the class ReplTopComponent method findInstance.
/**
* Obtain the ReplTopComponent instance. Never call {@link #getDefault} directly!
*/
public static synchronized ReplTopComponent findInstance() {
String ideReplID = PREFERRED_ID_prefix + IDE_REPL;
TopComponent win = WindowManager.getDefault().findTopComponent(ideReplID);
if (win == null) {
LOG.log(Level.WARNING, "Cannot find " + ideReplID + " component. It will not be located properly in the window system.");
return getDefault();
}
if (win instanceof ReplTopComponent) {
return (ReplTopComponent) win;
}
LOG.log(Level.WARNING, "There seem to be multiple components with the '" + ideReplID + "' ID. That is a potential source of errors and unexpected behavior.");
return getDefault();
}
use of org.openide.windows.TopComponent in project netbeans-mmd-plugin by raydac.
the class MMDGraphEditor method copyNameToCallbackTopComponent.
private void copyNameToCallbackTopComponent() {
final MultiViewElementCallback c = this.callback;
if (c != null) {
final TopComponent tc = c.getTopComponent();
if (tc != null) {
tc.setHtmlDisplayName(this.getHtmlDisplayName());
tc.setDisplayName(this.getDisplayName());
tc.setName(this.getName());
tc.setToolTipText(this.getToolTipText());
}
}
if (this.editorSupport != null) {
this.editorSupport.updateTitles();
}
}
use of org.openide.windows.TopComponent in project netbeans-mmd-plugin by raydac.
the class MMDNavigator method extractDataFromContextAndUpdate.
private void extractDataFromContextAndUpdate() {
final Lookup.Result<? extends MMDEditorSupport> ctx = this.context;
if (ctx == null) {
this.currentSupport = null;
} else {
Collection<? extends MMDEditorSupport> clct = ctx.allInstances();
if (clct.isEmpty()) {
final TopComponent active = TopComponent.getRegistry().getActivated();
if (active != null) {
clct = active.getLookup().lookupAll(MMDEditorSupport.class);
}
}
if (clct.isEmpty()) {
this.currentSupport = null;
} else {
this.currentSupport = clct.iterator().next();
if (this.currentSupport != null) {
this.currentSupport.getDataObject().getPrimaryFile().removeFileChangeListener(this);
this.currentSupport.getDataObject().getPrimaryFile().addFileChangeListener(this);
}
}
}
updateContent();
}
use of org.openide.windows.TopComponent in project ACS by ACS-Community.
the class TestActionButtons method main.
public static void main(String[] args) {
TopComponent tc = new TopComponent();
tc.setName("TestActionButtions");
tc.setLayout(new BorderLayout());
tc.setPreferredSize(new Dimension(DEFAULT_WIDTH, DEFAULT_HEIGHT));
JLabel lab = new JLabel("Actions are enabled if you select nodes in the IDE", JLabel.CENTER);
tc.add(lab, BorderLayout.CENTER);
JPanel panel = ActionUtils.createJButtonPanel(new Class[] { OpenLocalExplorerAction.class, PropertiesAction.class });
tc.add(panel, BorderLayout.SOUTH);
WindowUtils.openInMode(tc, "TestActionButtons");
}
use of org.openide.windows.TopComponent in project ACS by ACS-Community.
the class WindowUtils method findTopComponent.
/**
* Utility method: Returns the TopComponent with the given programmatic name in the given workspace,
* or <code>null</code> if there is no such TopComponent.
* @param workspace the workspace in which to look for the TopComponent
* @param componentName the programmatic name of the TopComponent
* @return Returns the TopComponent with the given programmatic name,
* or <code>null</code> if there is no such TopComponent
*/
public static TopComponent findTopComponent(Workspace workspace, String componentName) {
Assertion.assertTrue(workspace != null, "workspace != null");
Assertion.assertTrue(componentName != null, "componentName != null");
Iterator modesIterator = workspace.getModes().iterator();
while (modesIterator.hasNext()) {
Mode mode = (Mode) modesIterator.next();
TopComponent[] tcs = mode.getTopComponents();
for (int i = 0; i < tcs.length; i++) {
TopComponent element = tcs[i];
if (element.getName().equals(componentName)) {
return element;
}
}
}
return null;
}
Aggregations