本文整理汇总了Java中org.eclipse.gef.palette.PaletteContainer类的典型用法代码示例。如果您正苦于以下问题:Java PaletteContainer类的具体用法?Java PaletteContainer怎么用?Java PaletteContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PaletteContainer类属于org.eclipse.gef.palette包,在下文中一共展示了PaletteContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showMatchingContainers
import org.eclipse.gef.palette.PaletteContainer; //导入依赖的package包/类
private void showMatchingContainers(PaletteRoot paletteRoot,
Map<String, PaletteDrawer> categoryPaletteContainer, List<Component> matchingComponents) {
List<PaletteContainer> children = paletteRoot.getChildren();
for (PaletteContainer paletteContainer : children) {
paletteContainer.setVisible(false);
}
for (Component component : matchingComponents) {
for (int i = 0; i < children.size(); i++) {
if (children.get(i).equals(categoryPaletteContainer.get(component.getCategory().name()))) {
children.get(i).setVisible(true);
}
}
}
}
示例2: createEditPart
import org.eclipse.gef.palette.PaletteContainer; //导入依赖的package包/类
/**
* @see org.eclipse.gef.EditPartFactory#createEditPart(EditPart, Object)
*/
@Override
public EditPart createEditPart(EditPart parentEditPart, Object model) {
if (model instanceof UserLibraryTreeNode) {
return new UserLibraryTreeNodeEditPart((PaletteContainer) model);
}
if (model instanceof PaletteContainer) {
if (parentEditPart instanceof UserLibraryTreeNodeEditPart) {
return new UserLibraryTreeNodeEditPart((PaletteContainer) model);
} else {
return new PaletteTreeNodeEditPart((PaletteContainer) model);
}
}
if (model instanceof PaletteEntry) {
return new PaletteEntryEditPart((PaletteEntry) model);
}
return null;
}
示例3: createEditPart
import org.eclipse.gef.palette.PaletteContainer; //导入依赖的package包/类
/**
* @see org.eclipse.gef.EditPartFactory#createEditPart(EditPart, Object)
*/
public EditPart createEditPart(EditPart parentEditPart, Object model) {
if (model instanceof PaletteRoot)
return createMainPaletteEditPart(parentEditPart, model);
if (model instanceof PaletteStack)
return createStackEditPart(parentEditPart, model);
if (model instanceof PaletteContainer) {
Object type = ((PaletteContainer) model).getType();
if (PaletteDrawer.PALETTE_TYPE_DRAWER.equals(type))
return createDrawerEditPart(parentEditPart, model);
if (PaletteGroup.PALETTE_TYPE_GROUP.equals(type)
|| PaletteContainer.PALETTE_TYPE_UNKNOWN.equals(type))
return createGroupEditPart(parentEditPart, model);
if (PaletteToolbar.PALETTE_TYPE_TOOLBAR_GROUP.equals(type))
return createToolbarEditPart(parentEditPart, model);
}
if (model instanceof PaletteTemplateEntry)
return createTemplateEditPart(parentEditPart, model);
if (model instanceof PaletteSeparator)
return createSeparatorEditPart(parentEditPart, model);
if (model instanceof PaletteEntry)
return createEntryEditPart(parentEditPart, model);
return null;
}
示例4: handlePropertyChanged
import org.eclipse.gef.palette.PaletteContainer; //导入依赖的package包/类
/**
* This method is invoked whenever there is any change in the model. It
* updates the viewer with the changes that were made to the model.
* Sub-classes may override this method to change or extend its
* functionality.
*
* @param evt
* The {@link PropertyChangeEvent} that was fired from the model
*/
protected void handlePropertyChanged(PropertyChangeEvent evt) {
PaletteEntry entry = ((PaletteEntry) evt.getSource());
String property = evt.getPropertyName();
if (property.equals(PaletteEntry.PROPERTY_LABEL)
|| property.equals(PaletteEntry.PROPERTY_SMALL_ICON)) {
viewer.update(entry, null);
} else if (property.equals(PaletteEntry.PROPERTY_VISIBLE)) {
viewer.refresh(entry);
} else if (property.equals(PaletteContainer.PROPERTY_CHILDREN)) {
viewer.refresh(entry);
List oldChildren = (List) evt.getOldValue();
for (Iterator iter = oldChildren.iterator(); iter.hasNext();) {
PaletteEntry child = (PaletteEntry) iter.next();
traverseModel(child, false);
}
traverseModel(entry, true);
}
}
示例5: findByLabel
import org.eclipse.gef.palette.PaletteContainer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private <T extends PaletteEntry> T findByLabel(final PaletteContainer thePaletteContainer, final String theLabel) {
final String[] path = theLabel.split("/");
PaletteEntry nextEntry = thePaletteContainer;
NEXT_SEGMENT: for (final String segment : path) {
if (nextEntry instanceof PaletteContainer) {
for (final Object o : ((PaletteContainer) nextEntry).getChildren()) {
final PaletteEntry paletteEntry = (PaletteEntry) o;
if (segment.equals(paletteEntry.getLabel())) {
nextEntry = paletteEntry;
continue NEXT_SEGMENT;
}
}
return null;
} else {
return null;
}
}
return (T) nextEntry;
}
示例6: createFieldDrawer
import org.eclipse.gef.palette.PaletteContainer; //导入依赖的package包/类
private PaletteContainer createFieldDrawer() {
List<PaletteEntry> entries = new ArrayList<PaletteEntry>();
String group = "表单控件";
PaletteDrawer drawer = new PaletteDrawer(group,
ImageDescriptor.createFromFile(TaskFigure.class,
"icons/home.png"));
List<Component> listComp = ConfigManager.getComponents();
for (int i = 0; i < listComp.size(); i++) {
Component comp = (Component) listComp.get(i);
if (!validate(ConfigManager.COMPONENT_TYPE_FIELD, comp)) {
continue;
}
PaletteEntry paletteEntry = createCombinedEntry(comp);
if (paletteEntry == null) {
continue;
}
entries.add(paletteEntry);
}
drawer.addAll(entries);
drawer.setInitialState(2);
return drawer;
}
示例7: createQuickTools
import org.eclipse.gef.palette.PaletteContainer; //导入依赖的package包/类
private static PaletteContainer createQuickTools( )
{
PaletteCategory quickTools = new PaletteCategory( IPreferenceConstants.PALETTE_CONTENT,
Messages.getString( "DesignerPaletteFactory.quicktool.title" ), //$NON-NLS-1$
ReportPlatformUIImages.getImageDescriptor( ISharedImages.IMG_OBJ_FOLDER ) );
ReportElementFactory factory = new ReportElementFactory( AGG_TEMPLATE );
CombinedTemplateCreationEntry combined = new QuickToolsCombinedTemplateCreationEntry( Messages.getString( "DesignerPaletteFactory.quicktool.agg.title" ), //$NON-NLS-1$
Messages.getString( "DesignerPaletteFactory.quicktool.agg.toolTip" ), //$NON-NLS-1$
AGG_TEMPLATE,
factory,
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_AGGREGATION ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_AGGREGATION_LARGE ) ) ;
quickTools.add( combined );
factory = new ReportElementFactory( TIMEPERIOD_TEMPLATE );
combined = new QuickToolsCombinedTemplateCreationEntry( Messages.getString( "DesignerPaletteFactory.quicktool.timeperiod.title" ), //$NON-NLS-1$
Messages.getString( "DesignerPaletteFactory.quicktool.timeperiod.toolTip" ), //$NON-NLS-1$
TIMEPERIOD_TEMPLATE,
factory,
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_TIMEPERIOD ),
ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_ELEMENT_TIMEPERIOD_LARGE ) ) ;
quickTools.add( combined );
return quickTools;
}
示例8: createWc20141Group
import org.eclipse.gef.palette.PaletteContainer; //导入依赖的package包/类
/**
* Creates "wc2014" palette tool group
* @generated
*/
private PaletteContainer createWc20141Group() {
PaletteGroup paletteContainer = new PaletteGroup(
Messages.Wc20141Group_title);
paletteContainer.setId("createWc20141Group"); //$NON-NLS-1$
paletteContainer.add(createTeam1CreationTool());
paletteContainer.add(createTeamAtGroup2CreationTool());
paletteContainer.add(createMatchHome3CreationTool());
paletteContainer.add(createMatchAway4CreationTool());
paletteContainer.add(createGroupMatch5CreationTool());
paletteContainer.add(createEliminationMatch6CreationTool());
paletteContainer.add(createEliminationMatchWinner7CreationTool());
paletteContainer.add(createGroup8CreationTool());
paletteContainer.add(createGroupFirstTeam9CreationTool());
paletteContainer.add(createGroupSecondTeam10CreationTool());
return paletteContainer;
}
示例9: createObjects1Group
import org.eclipse.gef.palette.PaletteContainer; //导入依赖的package包/类
/**
* Creates "Objects" palette tool group
* @generated
*/
private PaletteContainer createObjects1Group() {
PaletteDrawer paletteContainer = new PaletteDrawer(
SimpleBPMN.diagram.part.Messages.Objects1Group_title);
paletteContainer.setId("createObjects1Group"); //$NON-NLS-1$
paletteContainer.add(createANDGateway1CreationTool());
paletteContainer.add(createActivity2CreationTool());
paletteContainer.add(createDataObject3CreationTool());
paletteContainer.add(createEndEvent4CreationTool());
paletteContainer.add(createGroup5CreationTool());
paletteContainer.add(createIntermediateEvent6CreationTool());
paletteContainer.add(createLane7CreationTool());
paletteContainer.add(createORGateway8CreationTool());
paletteContainer.add(createPool9CreationTool());
paletteContainer.add(createStartEvent10CreationTool());
paletteContainer.add(createXORGateway11CreationTool());
return paletteContainer;
}
示例10: findByLabel
import org.eclipse.gef.palette.PaletteContainer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static <T extends PaletteEntry> T findByLabel(final PaletteContainer thePaletteContainer, final String theLabel) {
final String[] path = theLabel.split("/");
PaletteEntry nextEntry = thePaletteContainer;
NEXT_SEGMENT: for (final String segment : path) {
if (nextEntry instanceof PaletteContainer) {
for (final Object o : ((PaletteContainer) nextEntry).getChildren()) {
final PaletteEntry paletteEntry = (PaletteEntry) o;
if (ObjectUtils.equals(segment, paletteEntry.getLabel())) {
nextEntry = paletteEntry;
continue NEXT_SEGMENT;
}
}
return null;
} else {
return null;
}
}
return (T) nextEntry;
}
示例11: getToolEntryForClass
import org.eclipse.gef.palette.PaletteContainer; //导入依赖的package包/类
/**
* Try to find if the palette can create an element of a certain class. Because of current visibility restrictions, we can't actually look for factories or
* try to create such an element. For now, we have to simply look for the template class used by the CombinedTemplateCreationEntry. Ideally, we should
* search for the appropriate model creation factory.
*
* @param c
* The template to find in one of UcmPaletteRoot's CombinedTemplateCreationEntry
* @return the CreationTool that was found in the palette or null if none could be found
*/
private CreationTool getToolEntryForClass(Class c) {
Stack s = new Stack();
List l = getPaletteRoot().getChildren();
for (int i = 0; i < l.size(); i++)
s.push(l.get(i));
while (s.size() > 0) {
Object o = s.pop();
if (o instanceof PaletteContainer) {
l = ((PaletteContainer) o).getChildren();
for (int i = 0; i < l.size(); i++)
s.push(l.get(i));
} else if (o instanceof CombinedTemplateCreationEntry) {
Object template = ((CombinedTemplateCreationEntry) o).getTemplate();
if (template == c) {
return (CreationTool) ((CombinedTemplateCreationEntry) o).createTool();
}
}
}
return null;
}
示例12: isToolEntryPresent
import org.eclipse.gef.palette.PaletteContainer; //导入依赖的package包/类
/**
* Take a ToolEntry class and try to find if an instance of this kind of entry is present in the palette.
*
* @param entry
* The Class of the tool entry you want to verify the existence in the palette.
* @return True if the method find a tool entry of the entry type, else false.
*/
private boolean isToolEntryPresent(Class entry) {
Stack s = new Stack();
List l = getPaletteRoot().getChildren();
for (int i = 0; i < l.size(); i++)
s.push(l.get(i));
while (s.size() > 0) {
Object o = s.pop();
if (o instanceof PaletteContainer) {
l = ((PaletteContainer) o).getChildren();
for (int i = 0; i < l.size(); i++)
s.push(l.get(i));
} else if (o.getClass() == entry) {
return true;
}
}
return false;
}
示例13: createPaletteRoot
import org.eclipse.gef.palette.PaletteContainer; //导入依赖的package包/类
/**
* @generated NOT
*/
protected PaletteRoot createPaletteRoot(PaletteRoot existingPaletteRoot) {
PaletteRoot root = createPaletteRootGen(existingPaletteRoot);
ModelRel modelRel = (ModelRel) this.getDiagram().getElement();
if (!modelRel.isInstancesLevel()) {
for (Object paletteContainer : root.getChildren()) {
for (Object paletteEntry : ((PaletteContainer) paletteContainer)
.getChildren()) {
if (paletteEntry instanceof ToolEntry
&& !(paletteEntry instanceof PanningSelectionToolEntry || paletteEntry instanceof PaletteToolEntry)) {
((ToolEntry) paletteEntry)
.setLabel(((ToolEntry) paletteEntry).getLabel() + " " + modelRel.getLevel().toString().charAt(0) + modelRel.getLevel().toString().toLowerCase().substring(1));
((ToolEntry) paletteEntry)
.setDescription(((ToolEntry) paletteEntry)
.getDescription() + " " + modelRel.getLevel().toString().charAt(0) + modelRel.getLevel().toString().toLowerCase().substring(1));
}
}
}
}
return root;
}
示例14: createNodes1Group
import org.eclipse.gef.palette.PaletteContainer; //导入依赖的package包/类
/**
* Creates "Nodes" palette tool group
* @generated
*/
private PaletteContainer createNodes1Group() {
PaletteDrawer paletteContainer = new PaletteDrawer(
Messages.Nodes1Group_title);
paletteContainer.setId("createNodes1Group"); //$NON-NLS-1$
paletteContainer.setDescription(Messages.Nodes1Group_desc);
paletteContainer.add(createGoal1CreationTool());
paletteContainer.add(createEvidence3CreationTool());
paletteContainer.add(createStrategy2CreationTool());
paletteContainer.add(createContext6CreationTool());
paletteContainer.add(createJustification7CreationTool());
paletteContainer.add(createUserdef0044CreationTool()); // Assumption
paletteContainer.add(createUndeveloped5CreationTool());
paletteContainer.add(createUserdef0055CreationTool()); // Module
paletteContainer.add(createUserdef0066CreationTool()); // Contract
return paletteContainer;
}
示例15: createOptionNodes2Group
import org.eclipse.gef.palette.PaletteContainer; //导入依赖的package包/类
/**
* Creates "Option Nodes" palette tool group
* @generated
*/
private PaletteContainer createOptionNodes2Group() {
PaletteDrawer paletteContainer = new PaletteDrawer(
Messages.OptionNodes2Group_title);
paletteContainer.setId("createOptionNodes2Group"); //$NON-NLS-1$
paletteContainer.setDescription(Messages.OptionNodes2Group_desc);
paletteContainer.add(createMonitor4CreationTool());
paletteContainer.add(createSystem8CreationTool());
paletteContainer.add(createPolicy9CreationTool());
paletteContainer.add(createUserdef0011CreationTool());
paletteContainer.add(createUserdef0022CreationTool());
paletteContainer.add(createUserdef0033CreationTool());
return paletteContainer;
}