/** * Cancels any linked mode model on the specified document. If there is no * model, nothing happens. * * @param document the document whose <code>LinkedModeModel</code> should * be canceled */ public static void closeAllModels(IDocument document) { LinkedModeManager.cancelManager(document); }
/** * Cancels any linked mode manager for the specified document. * * @param document the document whose <code>LinkedModeManager</code> should be canceled */ public static void cancelManager(IDocument document) { LinkedModeManager mgr= fgManagers.get(document); if (mgr != null) mgr.closeAllEnvironments(); }
/** * Checks whether there is already a linked mode model installed on any of * the <code>documents</code>. * * @param documents the <code>IDocument</code>s of interest * @return <code>true</code> if there is an existing model, <code>false</code> * otherwise */ public static boolean hasInstalledModel(IDocument[] documents) { // if there is a manager, there also is a model return LinkedModeManager.hasManager(documents); }
/** * Returns the model currently active on <code>document</code> at * <code>offset</code>, or <code>null</code> if there is none. * * @param document the document for which the caller asks for a * model * @param offset the offset into <code>document</code>, as there may be * several models on a document * @return the model currently active on <code>document</code>, or * <code>null</code> */ public static LinkedModeModel getModel(IDocument document, int offset) { if (!hasInstalledModel(document)) return null; LinkedModeManager mgr= LinkedModeManager.getLinkedManager(new IDocument[] {document}, false); if (mgr != null) return mgr.getTopEnvironment(); return null; }
if (force) { for (LinkedModeManager m : mgrs) { m.closeAllEnvironments(); mgr= new LinkedModeManager();
LinkedModeManager manager= LinkedModeManager.getLinkedManager(documents, force); return false; if (!manager.nestEnvironment(this, force)) if (force) Assert.isTrue(false);
private void closeAllEnvironments() { while (!fEnvironments.isEmpty()) { LinkedModeModel env= fEnvironments.pop(); env.exit(ILinkedModeListener.NONE); } removeManager(); }
/** * Returns the model currently active on <code>document</code> at * <code>offset</code>, or <code>null</code> if there is none. * * @param document the document for which the caller asks for a * model * @param offset the offset into <code>document</code>, as there may be * several models on a document * @return the model currently active on <code>document</code>, or * <code>null</code> */ public static LinkedModeModel getModel(IDocument document, int offset) { if (!hasInstalledModel(document)) return null; LinkedModeManager mgr= LinkedModeManager.getLinkedManager(new IDocument[] {document}, false); if (mgr != null) return mgr.getTopEnvironment(); return null; }
for (Iterator<LinkedModeManager> it= mgrs.iterator(); it.hasNext(); ) { LinkedModeManager m= it.next(); m.closeAllEnvironments(); mgr= new LinkedModeManager();
LinkedModeManager manager= LinkedModeManager.getLinkedManager(documents, force); return false; if (!manager.nestEnvironment(this, force)) if (force) Assert.isTrue(false);
private void closeAllEnvironments() { while (!fEnvironments.isEmpty()) { LinkedModeModel env= fEnvironments.pop(); env.exit(ILinkedModeListener.NONE); } removeManager(); }
/** * Checks whether there is already a linked mode model installed on any of * the <code>documents</code>. * * @param documents the <code>IDocument</code>s of interest * @return <code>true</code> if there is an existing model, <code>false</code> * otherwise */ public static boolean hasInstalledModel(IDocument[] documents) { // if there is a manager, there also is a model return LinkedModeManager.hasManager(documents); }
/** * Notify the manager about a leaving model. * * @param model the model to nest * @param flags the reason and commands for leaving linked mode */ private void left(LinkedModeModel model, int flags) { if (!fEnvironments.contains(model)) return; while (!fEnvironments.isEmpty()) { LinkedModeModel env= fEnvironments.pop(); if (env == model) break; env.exit(ILinkedModeListener.NONE); } if (fEnvironments.isEmpty()) { removeManager(); } }
/** * Cancels any linked mode model on the specified document. If there is no * model, nothing happens. * * @param document the document whose <code>LinkedModeModel</code> should * be canceled */ public static void closeAllModels(IDocument document) { LinkedModeManager.cancelManager(document); }
/** * Cancels any linked mode manager for the specified document. * * @param document the document whose <code>LinkedModeManager</code> should be canceled */ public static void cancelManager(IDocument document) { LinkedModeManager mgr= fgManagers.get(document); if (mgr != null) mgr.closeAllEnvironments(); }
/** * Checks whether there is already a model installed on <code>document</code>. * * @param document the <code>IDocument</code> of interest * @return <code>true</code> if there is an existing model, <code>false</code> * otherwise */ public static boolean hasInstalledModel(IDocument document) { // if there is a manager, there also is a model return LinkedModeManager.hasManager(document); }
/** * Notify the manager about a leaving model. * * @param model the model to nest * @param flags the reason and commands for leaving linked mode */ private void left(LinkedModeModel model, int flags) { if (!fEnvironments.contains(model)) return; while (!fEnvironments.isEmpty()) { LinkedModeModel env= fEnvironments.pop(); if (env == model) break; env.exit(ILinkedModeListener.NONE); } if (fEnvironments.isEmpty()) { removeManager(); } }
/** * Returns whether there exists a <code>LinkedModeManager</code> on any of the <code>documents</code>. * * @param documents the documents of interest * @return <code>true</code> if there exists a <code>LinkedModeManager</code> on any of the <code>documents</code>, <code>false</code> otherwise */ public static boolean hasManager(IDocument[] documents) { for (int i= 0; i < documents.length; i++) { if (hasManager(documents[i])) return true; } return false; }
/** * Returns whether there exists a <code>LinkedModeManager</code> on any of the <code>documents</code>. * * @param documents the documents of interest * @return <code>true</code> if there exists a <code>LinkedModeManager</code> on any of the <code>documents</code>, <code>false</code> otherwise */ public static boolean hasManager(IDocument[] documents) { for (IDocument document : documents) { if (hasManager(document)) return true; } return false; }
/** * Checks whether there is already a model installed on <code>document</code>. * * @param document the <code>IDocument</code> of interest * @return <code>true</code> if there is an existing model, <code>false</code> * otherwise */ public static boolean hasInstalledModel(IDocument document) { // if there is a manager, there also is a model return LinkedModeManager.hasManager(document); }