package bluej.pkgmgr.target.role;

import bluej.pkgmgr.target.ClassTarget;
import bluej.pkgmgr.target.DependentTarget.State;
import bluej.prefmgr.PrefMgr;
import javafx.collections.ObservableList;
import javafx.scene.control.MenuItem;
import javafx.scene.control.SeparatorMenuItem;
import threadchecker.OnThread;
import threadchecker.Tag;


| A role object to represent the behaviour of enums. | | @author Poul Henriksen <polle@mip.sdu.dk> | public class EnumClassRole extends ClassRole{ public final static String ENUM_ROLE_NAME = "EnumTarget";
| Create the enum class role. | public EnumClassRole() { } @OnThread(Tag.Any) public String getRoleName() { return ENUM_ROLE_NAME; } @OnThread(Tag.Any) public String getStereotypeLabel() { return "enum"; }
| Creates a class menu containing any constructors. | | Because we are an enum class we cannot have any constructors | so we override this method to do nothing. | | @param menu the popup menu to add the class menu items to | @param cl Class object associated with this class target | @Override @OnThread(Tag.FXPlatform) public boolean createClassConstructorMenu(ObservableList<MenuItem> menu, ClassTarget ct, Class<?> cl) { return false; }
| Adds role specific items at the bottom of the popup menu for this class target. | | @param menu the menu object to add to | @param ct ClassTarget object associated with this class role | @param state the state of the ClassTarget | | @return true if any menu items have been added | @Override @OnThread(Tag.FXPlatform) public boolean createRoleMenuEnd(ObservableList<MenuItem> menu, ClassTarget ct, State state) { if (PrefMgr.getFlag(PrefMgr.SHOW_TEST_TOOLS)) { if (ct.getAssociation() == null) { menu.add(new SeparatorMenuItem()); menu.add(ct.new CreateTestAction()); } } return true; } @Override @OnThread(Tag.Any) public boolean canConvertToStride() { return false; } }
top, use, map, class EnumClassRole

.   EnumClassRole
.   getRoleName
.   getStereotypeLabel
.   createClassConstructorMenu
.   createRoleMenuEnd
.   canConvertToStride




76 neLoCode + 13 LoComm