/*----------------------------------------------------------------------------
Copyright (c)2000 TogetherSoft LLC. Patents pending. All rights reserved.
----------------------------------------------------------------------------*/
package com.togethersoft.modules.tutorial;
import com.togethersoft.openapi.ide.IdeContext;
import com.togethersoft.openapi.ide.IdeScript;
import com.togethersoft.openapi.ide.message.IdeMessageManager;
import com.togethersoft.openapi.ide.message.IdeMessageManagerAccess;
import com.togethersoft.openapi.ide.message.IdeMessageType;
/**
* This script shows how to make Together's message pane visible/invisible.
* It is a very simple script but it can be used as a template for scripts dealing with the visibility
* of a message pane. In the next lesson you will learn how to add new pages to the message pane.
* @author TogetherSoft LLC
*/
public class Lesson9 implements IdeScript {
public void run(IdeContext context) {
IdeMessageManagerAccess.printMessage(IdeMessageType.INFORMATION, "Lesson9 script: started");
messageManager = IdeMessageManagerAccess.getMessageManager();
if (messageManager.isPaneVisible()) {
makeInvisible("Currently message pane is visible. Now we will make it invisible.");
makeVisible("Ok, message pane is invisible. Now we will make it visible again.");
}
else {
makeVisible("Currently message pane is invisible. Now we will make it visible.");
makeInvisible("Ok, message pane is visible. Now we will make it invisible again.");
}
IdeMessageManagerAccess.printMessage(IdeMessageType.INFORMATION, "Lesson9 script: finished");
}
private void makeVisible(String text) {
IdeMessageManagerAccess.printMessage(IdeMessageType.INFORMATION_MODAL, text);
messageManager.setPaneVisible(true);
}
private void makeInvisible(String text) {
IdeMessageManagerAccess.printMessage(IdeMessageType.INFORMATION_MODAL, text);
messageManager.setPaneVisible(false);
}
private IdeMessageManager messageManager;
}
|