/** Allows subclasses to create their own version * of <code>CloneableEditor</code> component. * @return the {@link CloneableEditor} for this support */ protected CloneableEditor createCloneableEditor() { return new CloneableEditor(this); }
private JComponent initLoading() { setLayout(new BorderLayout()); JLabel loadingLbl = new JLabel(NbBundle.getMessage(CloneableEditor.class, "LBL_EditorLoading")); // NOI18N loadingLbl.setOpaque(true); loadingLbl.setHorizontalAlignment(SwingConstants.CENTER); loadingLbl.setBorder(new EmptyBorder(new Insets(11, 11, 11, 11))); loadingLbl.setVisible(false); add(loadingLbl, BorderLayout.CENTER); return loadingLbl; }
/** Asks the associated {@link CloneableEditorSupport} to initialize * this editor via its {@link CloneableEditorSupport#initializeCloneableEditor(org.openide.text.CloneableEditor)} * method. By default called from the support on various occasions including * shortly after creation and * after the {@link CloneableEditor} has been deserialized. * * @since 6.37 */ protected final void initializeBySupport() { cloneableEditorSupport().initializeCloneableEditor(this); }
/** * callback for the Pane implementation to adjust itself to the openAt() request. */ public void ensureVisible() { open(); requestVisible(); } }
/** * Resolves deserialized object. Overrides superclass method. Adds checking * for object validity. In case this object is invalid * throws {@link java.io.InvalidObjectException InvalidObjectException}. * @throws ObjecStreamException When problem during serialization occures. * @throws InvalidObjectException When deserialized <code>CloneableEditor</code> * is invalid and shouldn't be used. */ protected Object readResolve() throws ObjectStreamException { if (discard()) { throw new java.io.InvalidObjectException("Deserialized component is invalid: " + this); // NOI18N } else { initializeBySupport(); return this; } }
if(initialized || discard()) { return; Document doc = support.getDocument(); setLayout (new BorderLayout ()); "ACS_CloneableEditor_QuietEditorPane", this.getName())); pane.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(CloneableEditor.class, "ACSD_CloneableEditor_QuietEditorPane", this.getAccessibleContext().getAccessibleDescription())); javax.swing.ActionMap am = getActionMap(); paneMap.put(DefaultEditorKit.cutAction, getAction(DefaultEditorKit.cutAction)); paneMap.put(DefaultEditorKit.copyAction, getAction(DefaultEditorKit.copyAction)); paneMap.put("delete", getAction(DefaultEditorKit.deleteNextCharAction)); // NOI18N paneMap.put(DefaultEditorKit.pasteAction, getAction(DefaultEditorKit.pasteAction)); + " return null component"); // NOI18N add(customComponent, BorderLayout.CENTER); } else { // not custom editor add (noBorderPane, BorderLayout.CENTER); add(customToolbar, BorderLayout.NORTH);
+ " this:[" + Integer.toHexString(System.identityHashCode(this)) + "]" + " support:[" + Integer.toHexString(System.identityHashCode(support)) + "]" + " Name:" + CloneableEditor.this.getName()); add(support.wrapEditorComponent(customComponent), BorderLayout.CENTER); } else { // not custom editor add(support.wrapEditorComponent(noBorderPane), BorderLayout.CENTER); Border b = (Border) UIManager.get("Nb.Editor.Toolbar.border"); //NOI18N customToolbar.setBorder(b); add(customToolbar, BorderLayout.NORTH); remove(tmpComp); ActionMap p = getActionMap().getParent(); getActionMap().setParent(null); getActionMap().setParent(p); requestFocusInWindow(); CloneableEditorSupport ces = cloneableEditorSupport(); if (ces != null) { ces.firePropertyChange(EditorCookie.Observable.PROP_OPENED_PANES, null, null);
/** Performs needed initialization */ private void initialize() { if (initialized || discard()) { return; } final QuietEditorPane tmp = new QuietEditorPane(); tmp.getAccessibleContext().setAccessibleName( NbBundle.getMessage(CloneableEditor.class, "ACS_CloneableEditor_QuietEditorPane", this.getName()) ); tmp.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage( CloneableEditor.class, "ACSD_CloneableEditor_QuietEditorPane", this.getAccessibleContext().getAccessibleDescription() ) ); tmp.putClientProperty("usedByCloneableEditor", true); this.pane = tmp; this.initialized = true; this.isComponentOpened = true; this.doInitialize = new DoInitialize(tmp); }
if (!discard ()) { cursorPosition = offset; updateName();
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal(in); int offset; Object firstObject = in.readObject(); // New deserialization that uses Env environment, // and which could be null(!) see writeExternal. if (firstObject instanceof CloneableOpenSupport.Env) { CloneableOpenSupport.Env env = (CloneableOpenSupport.Env) firstObject; CloneableOpenSupport os = env.findCloneableOpenSupport(); support = (CloneableEditorSupport) os; } // load cursor position offset = ((Integer) in.readObject()).intValue(); if (!discard()) { cursorPosition = offset; } updateName(); isComponentOpened = true; if (in.available() > 0) { boolean associate = in.readBoolean(); if (associate && support != null) { associateLookup(support.getLookup()); } } }
+ " ce:[" + Integer.toHexString(System.identityHashCode(CloneableEditor.this)) + "]" + " support:[" + Integer.toHexString(System.identityHashCode(support)) + "]" + " Name:" + CloneableEditor.this.getName()); javax.swing.ActionMap am = getActionMap(); if (newInitialize() && k instanceof Callable) { try { ((Callable) k).call(); LOG.log(Level.FINE,"DoInitialize.initNonVisual doc and kit are set" + " Time:" + System.currentTimeMillis() + " Thread:" + Thread.currentThread().getName() + " ce:[" + Integer.toHexString(System.identityHashCode(CloneableEditor.this)) + "]" + " this:[" + Integer.toHexString(System.identityHashCode(this)) + "]" LOG.log(Level.FINE,"DoInitialize.initNonVisual Call notifyAll" + " Time:" + System.currentTimeMillis() + " Thread:" + Thread.currentThread().getName() + " [" + Integer.toHexString(System.identityHashCode(CloneableEditor.this)) + "]" + " Name:" + CloneableEditor.this.getName());
public JEditorPane getEditorPane() { initialize (); return pane; }
/** Overrides superclass version. Opens top component only if * it is in valid state. * (Editor top component may become invalid after deserialization).<br> * Also tries to open all other top components which are docked * in editor mode on given workspace, but not visible.<br> */ public void open(Workspace workspace) { if(discard()) { ErrorManager.getDefault().log(ErrorManager.WARNING, "Can not open " + this + " component," // NOI18N + " its support environment is not valid" // NOI18N + " [support=" + support + ", env=" // NOI18N + (support == null ? null : support.env()) + "]"); // NOI18N } else { Workspace realWorkspace = (workspace == null) ? WindowManager.getDefault().getCurrentWorkspace() : workspace; dockIfNeeded(realWorkspace); super.open(workspace); } }
/** * Replaces serializing object. Overrides superclass method. Adds checking * for object validity. In case this object is invalid * throws {@link java.io.NotSerializableException NotSerializableException}. * @throws ObjectStreamException When problem during serialization occures. * @throws NotSerializableException When this <code>CloneableEditor</code> * is invalid and doesn't want to be serialized. */ @Override protected Object writeReplace() throws ObjectStreamException { if (discard()) { throw new NotSerializableException("Serializing component is invalid: " + this); // NOI18N } return super.writeReplace(); }
private Mode editorMode(Workspace workspace) { Mode ourMode = workspace.findMode(this); if (ourMode == null) { ourMode = workspace.createMode( CloneableEditorSupport.EDITOR_MODE, getName(), CloneableEditorSupport.class.getResource( "/org/openide/resources/editorMode.gif" // NOI18N ) ); } return ourMode; }
releasePane(); initialized = false; initVisualFinished = false; CloneableEditorSupport ces = cloneableEditorSupport();
if(initialized || discard()) { return; Document doc = support.getDocument(); setLayout (new BorderLayout ()); "ACS_CloneableEditor_QuietEditorPane", this.getName())); pane.getAccessibleContext().setAccessibleDescription( NbBundle.getMessage(CloneableEditor.class, "ACSD_CloneableEditor_QuietEditorPane", this.getAccessibleContext().getAccessibleDescription())); javax.swing.ActionMap am = getActionMap(); paneMap.put(DefaultEditorKit.cutAction, getAction(DefaultEditorKit.cutAction)); paneMap.put(DefaultEditorKit.copyAction, getAction(DefaultEditorKit.copyAction)); paneMap.put("delete", getAction(DefaultEditorKit.deleteNextCharAction)); // NOI18N paneMap.put(DefaultEditorKit.pasteAction, getAction(DefaultEditorKit.pasteAction)); + " return null component"); // NOI18N add(customComponent, BorderLayout.CENTER); } else { // not custom editor add (noBorderPane, BorderLayout.CENTER); add(customToolbar, BorderLayout.NORTH);
/** * callback for the Pane implementation to adjust itself to the openAt() request. */ public void ensureVisible() { open(); requestVisible(); }
if (!discard ()) { cursorPosition = offset; updateName();
public JEditorPane getEditorPane() { initialize (); return pane; }