IBM Rational Software Modeler
Release 6.0

com.ibm.xtools.pluglets
Class Pluglet

java.lang.Object
  extended bycom.ibm.xtools.pluglets.Pluglet
Direct Known Subclasses:
InsertDateAndTime, ListPerspectives, ListProjects, ShowSelection

public class Pluglet
extends Object

Provides pluglet properties and basic services used by pluglets.

Use the getName method to retrieve the name of the pluglet. Use the getDirectory method to retrieve the full path of the pluglet directory.

To use these properties and basic services, a pluglet class must extend this class. Use of this class and extending the class is optional.


Field Summary
 PrintWriter out
          The output for this pluglet.
 
Constructor Summary
Pluglet()
           
 
Method Summary
 boolean confirm(String message)
          Displays a message dialog with OK and Cancel buttons.
 boolean confirm(String message, String title)
          Displays a message dialog with OK and Cancel buttons and the given title.
 void dumpStack()
          Prints a stack trace of the current thread to the pluglet output writer.
 void dumpStack(PrintWriter writer)
          Prints a stack trace of the current thread to the specified print writer.
 void error(String message)
          Displays an error dialog with an OK button.
 void error(String message, String title)
          Displays an error dialog with an OK button and the given title.
 IPlugletMessageDialog getDialog()
          Retrieves the host's IPlugletMessageDialog implementation.
 String getDirectory()
          Retrieves the full path of the pluglet directory.
 String getFile()
          Retrieves the full path of the pluglet file.
 String getFullName()
          Retrieves the full name of the pluglet.
 String getName()
          Retrieves the name of the pluglet.
 void inform(String message)
          Displays an information dialog with an OK button.
 void inform(String message, String title)
          Displays an information dialog with an OK button and the given title.
 void printStackTrace(Throwable t)
          Prints the throwable and its backtrace to the pluglet output writer.
 void printStackTrace(Throwable t, PrintWriter writer)
          Prints the throwable and its backtrace to the specified print writer.
 String prompt(String message)
          Displays an input dialog with a prompt message, a text input field, and OK and Cancel buttons.
 String prompt(String message, String initialText)
          Displays an input dialog with a prompt message, the text input field initial text, and OK and Cancel buttons.
 String prompt(String message, String initialText, String title)
          Displays an input dialog with a prompt message, the text input field initial text, the title, and OK button and Cancel buttons.
 boolean question(String message)
          Displays a question message dialog with Yes and No buttons.
 boolean question(String message, String title)
          Displays a question message dialog with Yes and No buttons and the given title.
 void setDialog(IPlugletMessageDialog dialog)
          Sets the host's IPlugletMessageDialog implementation.
 void setDirectory(String directory)
          Sets the full path of the pluglet directory.
 void setFile(String file)
          Sets the full path of the pluglet file.
 void setFullName(String fullName)
          Sets the full name of the pluglet.
 void setName(String name)
          Sets the name of the pluglet.
 void warning(String message)
          Displays a warning dialog with an OK button.
 void warning(String message, String title)
          Displays a warning dialog with an OK button and the given title.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

public PrintWriter out
The output for this pluglet.

Constructor Detail

Pluglet

public Pluglet()
Method Detail

getName

public String getName()
Retrieves the name of the pluglet. For example, "HelloWorld".


setName

public void setName(String name)
Sets the name of the pluglet.


getFullName

public String getFullName()
Retrieves the full name of the pluglet. For example, "com.abc.xyz.HelloWorld".


setFullName

public void setFullName(String fullName)
Sets the full name of the pluglet.


getFile

public String getFile()
Retrieves the full path of the pluglet file. For example, "C:\SamplePluglets\com\abc\xyz\HelloWorld.java".


setFile

public void setFile(String file)
Sets the full path of the pluglet file.


getDirectory

public String getDirectory()
Retrieves the full path of the pluglet directory. For example, "C:\SamplePluglets\com\abc\xyz".


setDirectory

public void setDirectory(String directory)
Sets the full path of the pluglet directory.


confirm

public boolean confirm(String message,
                       String title)
Displays a message dialog with OK and Cancel buttons and the given title.

Parameters:
message - The message to be displayed.
title - The title of the message dialog.
Returns:
Returns a boolean value of true when the OK button is pressed. Otherwise, it returns a value of false.

confirm

public boolean confirm(String message)
Displays a message dialog with OK and Cancel buttons. Equivalent to confirm(message, getName()).

Parameters:
message - The message to be displayed.
Returns:
Returns a boolean value of true when the OK button is pressed. Otherwise, it returns a value of false.

error

public void error(String message,
                  String title)
Displays an error dialog with an OK button and the given title.

Parameters:
message - The message to be displayed.
title - The title of the error dialog.

error

public void error(String message)
Displays an error dialog with an OK button. Equivalent to error(message, getName()).

Parameters:
message - The message to be displayed.

inform

public void inform(String message,
                   String title)
Displays an information dialog with an OK button and the given title.

Parameters:
message - The message to be displayed.
title - The title of the information dialog.

inform

public void inform(String message)
Displays an information dialog with an OK button. Equivalent to inform(message, getName()).

Parameters:
message - The message to be displayed.

prompt

public String prompt(String message,
                     String initialText,
                     String title)
Displays an input dialog with a prompt message, the text input field initial text, the title, and OK button and Cancel buttons.

Parameters:
message - The prompt to be displayed.
initialText - The initial text to be displayed in the text input field.
title - The title of the input dialog.
Returns:
Returns the text input when the OK button is pressed, a non-null value but possibly zero-length. Otherwise, it returns a value of null.

prompt

public String prompt(String message,
                     String initialText)
Displays an input dialog with a prompt message, the text input field initial text, and OK and Cancel buttons. Equivalent to prompt(message, initialText, getName()).

Parameters:
message - The prompt to be displayed.
initialText - The initial text to be displayed in the text input field.
Returns:
Returns the text input when the OK button is pressed, a non-null value but possibly zero-length. Otherwise, it returns a value of null.

prompt

public String prompt(String message)
Displays an input dialog with a prompt message, a text input field, and OK and Cancel buttons. Equivalent to prompt(message, "", getName()).

Parameters:
message - The prompt to be displayed.
Returns:
Returns the text input when the OK button is pressed, a non-null value but possibly zero-length. Otherwise, it returns a value of null.

question

public boolean question(String message,
                        String title)
Displays a question message dialog with Yes and No buttons and the given title.

Parameters:
message - The question message to be displayed.
title - The title of the question message dialog.
Returns:
Returns a boolean value of true when the Yes button is pressed. Otherwise, it returns a value of false.

question

public boolean question(String message)
Displays a question message dialog with Yes and No buttons. Equivalent to question(message, getName()).

Parameters:
message - The question message to be displayed.
Returns:
Returns a boolean value of true when the Yes button is pressed. Otherwise, it returns a value of false.

warning

public void warning(String message,
                    String title)
Displays a warning dialog with an OK button and the given title.

Parameters:
message - The message to be displayed.
title - The title of the warning dialog.

warning

public void warning(String message)
Displays a warning dialog with an OK button. Equivalent to warning(message, getName()).

Parameters:
message - The message to be displayed.

printStackTrace

public void printStackTrace(Throwable t,
                            PrintWriter writer)
Prints the throwable and its backtrace to the specified print writer. Only pluglet stack frames are displayed.

Parameters:
t - The throwable whose backtrace is desired.
writer - The PrintWriter to use for output.

printStackTrace

public void printStackTrace(Throwable t)
Prints the throwable and its backtrace to the pluglet output writer. Only pluglet stack frames are displayed.

Parameters:
t - The throwable whose backtrace is desired.

dumpStack

public void dumpStack(PrintWriter writer)
Prints a stack trace of the current thread to the specified print writer. Only pluglet stack frames are displayed. This method is used only for debugging.

Parameters:
writer - The PrintWriter to use for output.

dumpStack

public void dumpStack()
Prints a stack trace of the current thread to the pluglet output writer. Only pluglet stack frames are displayed. This method is used only for debugging.


getDialog

public IPlugletMessageDialog getDialog()
Retrieves the host's IPlugletMessageDialog implementation.


setDialog

public void setDialog(IPlugletMessageDialog dialog)
Sets the host's IPlugletMessageDialog implementation.


IBM Rational Software Modeler
Release 6.0


Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2004. All rights reserved.