本文整理汇总了Java中org.eclipse.gef.palette.CombinedTemplateCreationEntry类的典型用法代码示例。如果您正苦于以下问题:Java CombinedTemplateCreationEntry类的具体用法?Java CombinedTemplateCreationEntry怎么用?Java CombinedTemplateCreationEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CombinedTemplateCreationEntry类属于org.eclipse.gef.palette包,在下文中一共展示了CombinedTemplateCreationEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mouseHover
import org.eclipse.gef.palette.CombinedTemplateCreationEntry; //导入依赖的package包/类
@Override
public void mouseHover(MouseEvent e) {
final java.awt.Point mouseLocation1 = MouseInfo.getPointerInfo().getLocation();
EditPart paletteInternalController = viewer.findObjectAt(new Point(
e.x, e.y));
if(paletteInternalController.getModel() instanceof CombinedTemplateCreationEntry){
setGenericComponent(paletteInternalController);
// Hide tooltip if already showing
hidePaletteToolTip();
showToolTipWithDelay(mouseLocation1);
}
}
示例2: setGenericComponent
import org.eclipse.gef.palette.CombinedTemplateCreationEntry; //导入依赖的package包/类
/**
*
* set genericComponent to selected/hovered component in palette
*
* @param paletteInternalController
* @return
*/
private CreateRequest setGenericComponent(EditPart paletteInternalController) {
CombinedTemplateCreationEntry addedPaletteTool = (CombinedTemplateCreationEntry) paletteInternalController
.getModel();
CreateRequest componentRequest = new CreateRequest();
componentRequest.setFactory(new SimpleFactory((Class) addedPaletteTool
.getTemplate()));
genericComponent = (Component) componentRequest
.getNewObject();
logger.debug("genericComponent - " + genericComponent.toString());
return componentRequest;
}
示例3: checkSearchedComponentFoundInPalette
import org.eclipse.gef.palette.CombinedTemplateCreationEntry; //导入依赖的package包/类
private boolean checkSearchedComponentFoundInPalette(final ELTGraphicalEditor editor,
final Map<String, PaletteDrawer> categoryPaletteContainer, final List<Component> componentsConfig,
List<Component> matchingComponents, String searchedString) {
boolean matchFound = false;
for (Component componentConfig : componentsConfig) {
String componentName = componentConfig.getNameInPalette().toUpperCase();
if (Constants.UNKNOWN_COMPONENT.equalsIgnoreCase(componentConfig.getName()))
continue;
if (componentName.contains(searchedString.trim())) {
CombinedTemplateCreationEntry component = getComponentToAddInContainer(editor, componentConfig);
categoryPaletteContainer.get(componentConfig.getCategory().name()).add(component);
matchingComponents.add(componentConfig);
matchFound = true;
if (label != null) {
label.dispose();
}
}
}
return matchFound;
}
示例4: createToolEntry
import org.eclipse.gef.palette.CombinedTemplateCreationEntry; //导入依赖的package包/类
private CreationToolEntry createToolEntry(final Class<?> nodeClass,final String name,String desc,final int width,final int height){
SimpleFactory nodeFactory=new SimpleFactory(nodeClass){
@Override
public Object getNewObject() {
AbstractNodeElement node=instanceNode(nodeClass,name,width,height);
return node;
}
};
String nodeName=instanceNode(nodeClass,name,width,height).nodeName();
NodeImageConfig config=Activator.getPreference().getNodeImageConfigByName(nodeName);
if(config==null){
throw new RuntimeException("当前没有为名为"+nodeName+"的节点预定义配置信息!");
}
ImageDescriptor descriptor=ImageDescriptor.createFromImage(config.getSmallImage());
return new CombinedTemplateCreationEntry(name,desc,nodeFactory,descriptor,descriptor);
}
示例5: selectionChanged
import org.eclipse.gef.palette.CombinedTemplateCreationEntry; //导入依赖的package包/类
/**
* Sets the selected EditPart and refreshes the enabled state of this
* action.
*
* @see ISelectionChangedListener#selectionChanged(SelectionChangedEvent)
*/
public void selectionChanged(SelectionChangedEvent event) {
ISelection s = event.getSelection();
if (!(s instanceof IStructuredSelection))
return;
IStructuredSelection selection = (IStructuredSelection) s;
template = null;
if (selection != null && selection.size() == 1) {
Object obj = selection.getFirstElement();
if (obj instanceof EditPart) {
Object model = ((EditPart) obj).getModel();
if (model instanceof CombinedTemplateCreationEntry)
template = ((CombinedTemplateCreationEntry) model)
.getTemplate();
else if (model instanceof PaletteTemplateEntry)
template = ((PaletteTemplateEntry) model).getTemplate();
}
}
refresh();
}
示例6: createCombinedEntry
import org.eclipse.gef.palette.CombinedTemplateCreationEntry; //导入依赖的package包/类
private CombinedTemplateCreationEntry createCombinedEntry(
Component compponent) {
Class<?> clazz = null;
try {
clazz = Class.forName(compponent.getClazz());
} catch (Exception e) {
clazz = Simple.class;
}
if (clazz == null) return null;
CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
compponent.getDisplayName(), compponent.getDescript(), clazz,
new ModelCreationFactory(compponent, clazz),
ImageDescriptor.createFromFile(TaskFigure.class,
compponent.getIconSmall()),
ImageDescriptor.createFromFile(TaskFigure.class,
compponent.getIconLarge()));
return combined;
}
示例7: createAutoText
import org.eclipse.gef.palette.CombinedTemplateCreationEntry; //导入依赖的package包/类
private static CombinedTemplateCreationEntry createAutoText( String label,
String shortDesc, Object template )
{
AbstractToolHandleExtends preHandle = BasePaletteFactory.getAbstractToolHandleExtendsFromPaletteName(template);
ImageDescriptor icon = ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_AUTOTEXT );
ImageDescriptor largeIcon = ReportPlatformUIImages.getImageDescriptor( IReportGraphicConstants.ICON_AUTOTEXT_LARGE );
CombinedTemplateCreationEntry entry = new ReportCombinedTemplateCreationEntry( label,
shortDesc,
template,
new ReportElementFactory( template ),
icon,
largeIcon,
preHandle );
return entry;
}
示例8: createQuickTools
import org.eclipse.gef.palette.CombinedTemplateCreationEntry; //导入依赖的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;
}
示例9: getToolEntryForClass
import org.eclipse.gef.palette.CombinedTemplateCreationEntry; //导入依赖的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;
}
示例10: getProposals
import org.eclipse.gef.palette.CombinedTemplateCreationEntry; //导入依赖的package包/类
@Override
public IContentProposal[] getProposals(String contents, int position) {
proposalList.clear();
List<PaletteContainer> paletteEntry = paletteRoot.getChildren();
for (PaletteContainer paletteContainer : paletteEntry) {
List<PaletteEntry> paletteDrawersList = paletteContainer.getChildren();
for (PaletteEntry paletteDrawer : paletteDrawersList) {
if (StringUtils.containsIgnoreCase(
paletteDrawer.getParent().getLabel() + " : " + paletteDrawer.getLabel(), contents)) {
String componentName = ((Class) ((CombinedTemplateCreationEntry) paletteDrawer).getTemplate())
.getSimpleName();
componentDetails = new ComponentDetails();
Component component = XMLConfigUtil.INSTANCE.getComponent(componentName);
componentDetails.setName(componentName);
componentDetails.setCategoryAndPalletteName(
paletteDrawer.getParent().getLabel() + " : " + paletteDrawer.getLabel());
componentDetails.setDescription(component.getDescription());
componentDetails.setDescriptor(paletteDrawer.getSmallIcon());
proposalList.add(new ComponentContentProposal(componentDetails));
}
}
}
componentDetails = new ComponentDetails();
componentDetails.setName(COMMENT_BOX);
componentDetails.setCategoryAndPalletteName(COMMENT_BOX);
componentDetails.setDescription(COMMENT_BOX);
componentDetails.setDescriptor(getCommentBoxImageDisDescriptor());
proposalList.add(new ComponentContentProposal(componentDetails));
return proposalList.toArray(new IContentProposal[0]);
}
示例11: showAllContainers
import org.eclipse.gef.palette.CombinedTemplateCreationEntry; //导入依赖的package包/类
private void showAllContainers(final PaletteRoot paletteRoot, final ELTGraphicalEditor editor,
final Map<String, PaletteDrawer> categoryPaletteContainer, final List<Component> componentsConfig) {
for (Component componentConfig : componentsConfig) {
if (Constants.UNKNOWN_COMPONENT.equalsIgnoreCase(componentConfig.getName()))
continue;
CombinedTemplateCreationEntry component = getComponentToAddInContainer(editor, componentConfig);
categoryPaletteContainer.get(componentConfig.getCategory().name()).add(component);
showClosedPaletteContainersWhenSearchTextBoxIsEmpty(paletteRoot.getChildren());
}
if (label != null) {
label.dispose();
}
}
示例12: getComponentToAddInContainer
import org.eclipse.gef.palette.CombinedTemplateCreationEntry; //导入依赖的package包/类
private CombinedTemplateCreationEntry getComponentToAddInContainer(ELTGraphicalEditor eLEtlGraphicalEditor,
Component componentConfig) {
Class<?> clazz = DynamicClassProcessor.INSTANCE.createClass(componentConfig);
CombinedTemplateCreationEntry component = new CombinedTemplateCreationEntry(componentConfig.getNameInPalette(),
null, clazz, new SimpleFactory(clazz),
ImageDescriptor.createFromURL(eLEtlGraphicalEditor.prepareIconPathURL(componentConfig
.getPaletteIconPath())), ImageDescriptor.createFromURL(eLEtlGraphicalEditor
.prepareIconPathURL(componentConfig.getPaletteIconPath())));
return component;
}
示例13: createShapesDrawer
import org.eclipse.gef.palette.CombinedTemplateCreationEntry; //导入依赖的package包/类
private void createShapesDrawer(PaletteRoot palette) throws RuntimeException, SAXException, IOException {
Map<String, PaletteDrawer> categoryPaletteConatiner = new HashMap<>();
for (CategoryType category : CategoryType.values()) {
if(category.name().equalsIgnoreCase(Constants.UNKNOWN_COMPONENT_CATEGORY)){
continue;
}
PaletteDrawer p = createPaletteContainer(category.name());
addContainerToPalette(palette, p);
categoryPaletteConatiner.put(category.name(), p);
}
List<Component> componentsConfig = XMLConfigUtil.INSTANCE.getComponentConfig();
//To show the components in sorted order in palette
Collections.sort(componentsConfig, new Comparator<Component>() {
public int compare(Component component1, Component component2) {
return component1.getNameInPalette().compareToIgnoreCase(component2.getNameInPalette());
};
});
for (Component componentConfig : componentsConfig) {
Class<?> clazz = DynamicClassProcessor.INSTANCE.createClass(componentConfig);
if(componentConfig.getName().equalsIgnoreCase(Constants.UNKNOWN_COMPONENT)){
continue;
}
CombinedTemplateCreationEntry component = new CombinedTemplateCreationEntry(
componentConfig.getNameInPalette(), null, clazz,
new SimpleFactory(clazz),
ImageDescriptor.createFromURL(
prepareIconPathURL(componentConfig.getPaletteIconPath())),
ImageDescriptor.createFromURL(
prepareIconPathURL(componentConfig.getPaletteIconPath())));
categoryPaletteConatiner.get(componentConfig.getCategory().name()).add(component);
}
}
示例14: createPaletteDrawer
import org.eclipse.gef.palette.CombinedTemplateCreationEntry; //导入依赖的package包/类
private static PaletteDrawer createPaletteDrawer() {
PaletteDrawer drawer = new PaletteDrawer("Elements");
CombinedTemplateCreationEntry table = new CombinedTemplateCreationEntry("Table", "This is table tool", Table.class, new SimpleFactory(
Table.class), Activator.getImageDescriptor(Activator.IMAGE_TABLE_16), Activator.getImageDescriptor(Activator.IMAGE_TABLE_24));
drawer.add(table);
CombinedTemplateCreationEntry column = new CombinedTemplateCreationEntry("Column", "This is column tool", Column.class, new SimpleFactory(
Column.class), Activator.getImageDescriptor(Activator.IMAGE_COLUMN_16), Activator.getImageDescriptor(Activator.IMAGE_COLUMN_24));
drawer.add(column);
ConnectionCreationToolEntry connection = new ConnectionCreationToolEntry("Connection", "this is table connection", new SimpleFactory(
Connection.class), Activator.getImageDescriptor(Activator.IMAGE_CONNECTION_16),
Activator.getImageDescriptor(Activator.IMAGE_CONNECTION_24));
drawer.add(connection);
return drawer;
}
示例15: getNewObject
import org.eclipse.gef.palette.CombinedTemplateCreationEntry; //导入依赖的package包/类
@Override
public Object getNewObject() {
TriqDiagramEditor activeEditor = EditorUtils.getSelectedDiagramEditor();
if (activeEditor != null) {
Shell shell = activeEditor.getSite().getShell();
AddActorToUserLibraryDialog dialog = new AddActorToUserLibraryDialog(shell, handle);
dialog.setBlockOnOpen(true);
int dialogReturnCode = dialog.open();
if (Dialog.OK == dialogReturnCode) {
String modelName = dialog.modelName;
String modelClass = dialog.modelClass;
String libraryName = targetTreeNode.getFullTreePath('.');
String elementType = "CompositeActor";
Map<String, String> properties = new HashMap<>();
properties.put("displayName", modelName);
properties.put("class", modelClass);
properties.put("type", elementType);
properties.put("libraryName", libraryName);
Event event = new Event(LibraryManager.ADD_EVENT_TOPIC, properties);
try {
TriqEditorPlugin.getDefault().getEventAdminService().postEvent(event);
} catch (NullPointerException e) {
StatusManager.getManager().handle(
new Status(IStatus.ERROR, TriqEditorPlugin.getID(), "Event bus not available, impossible to trigger an addition event for the user library."),
StatusManager.BLOCK);
}
TriqFeatureProvider featureProvider = (TriqFeatureProvider) activeEditor.getDiagramTypeProvider().getFeatureProvider();
ICreateFeature createFeature = featureProvider.buildCreateFeature(null, null, modelName, modelClass, null, null,
BoCategory.CompositeActor, null);
TriqPaletteRoot.DefaultCreationFactory cf = new TriqPaletteRoot.DefaultCreationFactory(createFeature, ICreateFeature.class);
CombinedTemplateCreationEntry pe = new CombinedTemplateCreationEntry(modelName, modelClass, cf, cf, null, null);
pe.setToolClass(GFCreationTool.class);
return pe;
}
}
return null;
}