/** Updates titles of all editors. */ protected void updateTitles() { Enumeration en = allEditors.getComponents(); while (en.hasMoreElements()) { CloneableTopComponent o = (CloneableTopComponent) en.nextElement(); Pane e = (Pane) o.getClientProperty(PROP_PANE); if ((e == null) && o instanceof Pane) { e = (Pane) o; } if (e != null) { e.updateName(); } else { throw new IllegalStateException("No reference to Pane. Please file a bug against openide/text"); } } }
@Override public void open() { boolean wasNull = getClientProperty( "TopComponentAllowDockAnywhere" ) == null; //NOI18N super.open(); if( wasNull ) { //since we don't define a mode to dock this editor to, the window //system thinks we're an uknown component allowed to dock anywhere //but editor windows can dock into editor modes only, so let's clear //the 'special' flag putClientProperty( "TopComponentAllowDockAnywhere", null); //NOI18N } }
@Override public void readExternal (ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal (in); setStatusLineVisible (in.readBoolean ()); setToolbarVisible (in.readBoolean ()); browserComponent.setURL ((URL) in.readObject ()); }
ce.getComponent().putClientProperty(PROP_PANE, ce); ce.getComponent().setReference(allEditors); replaceTc(last, ctc); } else { ctc.open(); ctc.open();
/** Simply open for an editor. */ protected final CloneableTopComponent openCloneableTopComponent() { //synchronized (allEditors) { synchronized (getLock()) { CloneableTopComponent ret = allEditors.getArbitraryComponent (); if(ret != null) { ret.open(); return ret; } else { // no opened editor String msg = messageOpening (); if (msg != null) { StatusDisplayer.getDefault().setStatusText(msg); } CloneableTopComponent editor = createCloneableTopComponent (); editor.setReference (allEditors); editor.open(); msg = messageOpened (); if (msg == null) { msg = ""; // NOI18N } StatusDisplayer.getDefault().setStatusText(msg); return editor; } } }
@Override public void show(ShowOpenType openType, ShowVisibilityType visibilityType, int column) { CloneableEditorSupport support = pos.getCloneableEditorSupport(); if ((openType == ShowOpenType.NONE) && !support.isDocumentLoaded()) { return; } CloneableEditorSupport.Pane editor = null; if ((openType == ShowOpenType.REUSE) || (openType == ShowOpenType.REUSE_NEW)) { editor = support.openReuse(pos, column, openType); } else if ((openType == ShowOpenType.OPEN) || (openType == ShowOpenType.NONE)) { //For ShowOpenType.NONE if editor is not yet opened method returns above editor = support.openAt(pos, column); } if (editor != null) { if (visibilityType == ShowVisibilityType.FRONT) { editor.getComponent().requestVisible(); editor.getComponent().toFront(); } else if (visibilityType == ShowVisibilityType.FOCUS) { editor.getComponent().requestActive(); } } }
public void run () { CloneableTopComponent editor = openCloneableTopComponent(); editor.requestActive(); } });
@Deprecated public void show(int kind, int column) { CloneableEditorSupport support = pos.getCloneableEditorSupport(); if ((kind == SHOW_TRY_SHOW) && !support.isDocumentLoaded()) { return; } CloneableEditorSupport.Pane editor; if (kind == SHOW_REUSE || kind == SHOW_REUSE_NEW) { editor = support.openReuse(pos, column, kind); } else { editor = support.openAt(pos, column); if (kind == SHOW_TOFRONT) editor.getComponent().toFront(); } if (kind != SHOW_TRY_SHOW && kind != SHOW_SHOW) { editor.getComponent().requestActive(); } }
/** Overrides superclass method. In case it is called first time, * initializes this <code>CloneableEditor</code>. */ @Override protected void componentShowing() { super.componentShowing(); initialize(); }
/** * Indicates whether this component can be closed. * Adds scheduling of "emptying" editor pane and removing all sub components. * {@inheritDoc} */ @Override public boolean canClose() { boolean result = super.canClose(); return result; }
/** Descendants overriding this method must either call * this implementation or fire the * {@link org.openide.cookies.EditorCookie.Observable#PROP_OPENED_PANES} * property change on their own. */ protected void componentOpened() { super.componentOpened(); CloneableEditorSupport ces = cloneableEditorSupport(); if (ces != null) { ces.firePropertyChange(EditorCookie.Observable.PROP_OPENED_PANES, null, null); } }
/** Descendants overriding this method must either call * this implementation or fire the * {@link org.openide.cookies.EditorCookie.Observable#PROP_OPENED_PANES} * property change on their own. */ protected void componentClosed() { super.componentClosed(); CloneableEditorSupport ces = cloneableEditorSupport(); if (ces != null) { ces.firePropertyChange(EditorCookie.Observable.PROP_OPENED_PANES, null, null); } }
/** Transfer the focus to the editor pane. */ @Deprecated @Override public void requestFocus() { super.requestFocus(); if (pane != null) { if ((customComponent != null) && !SwingUtilities.isDescendingFrom(pane, customComponent)) { customComponent.requestFocus(); } else { pane.requestFocus(); } } }
/** Prepares document, creates and initializes * new <code>CloneableEditor</code> component. * Typically do not override this method. * For creating your own <code>CloneableEditor</code> type component * override {@link #createCloneableEditor} method. * * @return the {@link CloneableEditor} for this support */ protected CloneableTopComponent createCloneableTopComponent() { // initializes the document if not initialized prepareDocument(); Pane pane = createPane(); pane.getComponent().putClientProperty(PROP_PANE, pane); return pane.getComponent(); }
ce.getComponent().putClientProperty(PROP_PANE, ce); ce.getComponent().setReference(allEditors); ce.getComponent ().open();
/** Simply open for an editor. */ protected final CloneableTopComponent openCloneableTopComponent() { //synchronized (allEditors) { synchronized (getLock()) { CloneableTopComponent ret = allEditors.getArbitraryComponent (); if(ret != null) { ret.open(); return ret; } else { // no opened editor String msg = messageOpening (); if (msg != null) { StatusDisplayer.getDefault().setStatusText(msg); } CloneableTopComponent editor = createCloneableTopComponent (); editor.setReference (allEditors); editor.open(); msg = messageOpened (); if (msg == null) { msg = ""; // NOI18N } StatusDisplayer.getDefault().setStatusText(msg); return editor; } } }
public void run () { CloneableTopComponent editor = openCloneableTopComponent(); editor.requestActive(); } });
/** Overrides superclass method. In case it is called first time, * initializes this <code>CloneableEditor</code>. */ protected void componentShowing() { super.componentShowing(); initialize(); }
/** Indicates whtehter this componetn can be closed in the workspace. * Overrides superclass method. Adds scheduling of "emptying" * <code>pane</code> field and removing all sub components. */ public boolean canClose(Workspace workspace,boolean last) { boolean result = super.canClose(workspace, last); int closeOp = getCloseOperation(); if(result && ((closeOp == CLOSE_EACH) || (closeOp == CLOSE_LAST && last))) { SwingUtilities.invokeLater( new Runnable() { public void run() { // #23486: pane could not be initialized yet. if(pane != null) { Document doc = support.createStyledDocument( pane.getEditorKit()); pane.setDocument (doc); pane.setEditorKit (null); } removeAll(); initialized = false; } } ); } return result; }
/** Descendants overriding this method must either call * this implementation or fire the * {@link org.openide.cookies.EditorCookie.Observable#PROP_OPENED_PANES} * property change on their own. */ protected void componentOpened() { super.componentOpened(); CloneableEditorSupport ces = cloneableEditorSupport(); if (ces != null) { ces.firePropertyChange(EditorCookie.Observable.PROP_OPENED_PANES, null, null); } }