本文整理汇总了Java中org.eclipse.gef.palette.PaletteEntry类的典型用法代码示例。如果您正苦于以下问题:Java PaletteEntry类的具体用法?Java PaletteEntry怎么用?Java PaletteEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PaletteEntry类属于org.eclipse.gef.palette包,在下文中一共展示了PaletteEntry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createEditPart
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的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;
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:21,代码来源:PaletteTreeEditPartFactory.java
示例2: compare
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的package包/类
@Override
public int compare(PaletteEntry o1, PaletteEntry o2) {
if (o1 instanceof PaletteTreeNode) {
if (o2 instanceof PaletteTreeNode) {
int result = ((PaletteTreeNode) o1).getPriority().compareTo(((PaletteTreeNode) o2).getPriority());
if (result != 0) {
return result;
}
} else {
return 1;
}
} else if (o2 instanceof PaletteTreeNode) {
return -1;
}
return o1.getLabel().compareTo(o2.getLabel());
}
开发者ID:eclipse,项目名称:triquetrum,代码行数:17,代码来源:TriqPaletteBehavior.java
示例3: getPaletteEntries
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的package包/类
public Map<String, List<PaletteEntry>> getPaletteEntries() {
Map<String, List<PaletteEntry>> map = new HashMap<String, List<PaletteEntry>>();
for (IComponentFactory f : nodeFactory) {
IPaletteContributor ipc = f.getPaletteEntries();
if (ipc != null) {
Map<String, List<PaletteEntry>> paletteEntries = ipc.getPaletteEntries();
if (paletteEntries != null) {
for (String key : paletteEntries.keySet()) {
List<PaletteEntry> ol = map.get(key);
if (ol == null)
map.put(key, paletteEntries.get(key));
else
ol.addAll(paletteEntries.get(key));
}
}
}
}
return map;
}
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:20,代码来源:ExtensionManager.java
示例4: createElements
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的package包/类
public static PaletteDrawer createElements(PaletteRoot paletteRoot, List<String> ignore, PaletteGroup p,
Map<String, List<PaletteEntry>> map) {
PaletteDrawer drawer = createGroup(paletteRoot, ignore, p.getName(), p.getImage());
// drawer.add(createJDEntry(MCallout.getIconDescriptor(), MCallout.class));
drawer.add(createJDEntry(MTextField.getIconDescriptor(), MTextField.class));
drawer.add(createJDEntry(MStaticText.getIconDescriptor(), MStaticText.class));
drawer.add(createJDEntry(MImage.getIconDescriptor(), MImage.class));
drawer.add(createJDEntry(MBreak.getIconDescriptor(), MBreak.class));
drawer.add(createJDEntry(MRectangle.getIconDescriptor(), MRectangle.class));
drawer.add(createJDEntry(MEllipse.getIconDescriptor(), MEllipse.class));
drawer.add(createJDEntry(MLine.getIconDescriptor(), MLine.class));
// drawer.add(createJDEntry(MGenericElement.getIconDescriptor(), MGenericElement.class));
drawer.add(createJDEntry(MFrame.getIconDescriptor(), MFrame.class));
drawer.add(createJDEntry(MSubreport.getIconDescriptor(), MSubreport.class));
getEntries4Key(drawer, ignore, p.getId(), map);
return drawer;
}
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:22,代码来源:JDPaletteFactory.java
示例5: getToolTipText
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的package包/类
/**
* Get the tool tip text for this palette edit part.
*
* @return the tool tip text.
*/
protected String getToolTipText() {
String text = null;
PaletteEntry entry = (PaletteEntry) getModel();
String desc = entry.getDescription();
boolean needName = nameNeededInToolTip();
if (desc == null || desc.trim().equals(entry.getLabel())
|| desc.trim().equals("")) { //$NON-NLS-1$
if (needName)
text = entry.getLabel();
} else {
if (needName)
text = entry.getLabel()
+ " " //$NON-NLS-1$
+ PaletteMessages.NAME_DESCRIPTION_SEPARATOR
+ " " + desc; //$NON-NLS-1$
else
text = desc;
}
if (text != null && text.trim().equals(""))//$NON-NLS-1$
return null;
return text;
}
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:28,代码来源:PaletteEditPart.java
示例6: createEditPart
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的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;
}
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:27,代码来源:PaletteEditPartFactory.java
示例7: reveal
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的package包/类
/**
* @see ScrollingGraphicalViewer#reveal(EditPart)
*/
public void reveal(EditPart part) {
// If the given part is a drawer, we don't need to expand it. Hence,
// when invoking
// findContainingDrawer(), we use part.getParent()
DrawerEditPart drawer = findContainingDrawer(part.getParent());
if (drawer != null && !drawer.isExpanded())
drawer.setExpanded(true);
// if the part is inside a stack, set it to be the top level item of the
// stack.
if (part.getParent() != null
&& part.getParent() instanceof PaletteStackEditPart)
((PaletteStack) part.getParent().getModel())
.setActiveEntry((PaletteEntry) part.getModel());
super.reveal(part);
}
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:19,代码来源:PaletteViewer.java
示例8: createControl
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的package包/类
/**
* @see org.eclipse.gef.ui.palette.customize.EntryPage#createControl(Composite,
* PaletteEntry)
*/
public void createControl(Composite parent, PaletteEntry entry) {
this.entry = entry;
panel = new Composite(parent, SWT.NONE);
panel.setFont(parent.getFont());
GridLayout gridLayout = new GridLayout(1, false);
gridLayout.marginWidth = 0;
gridLayout.marginHeight = 0;
panel.setLayout(gridLayout);
Control[] tablist = new Control[3];
createLabel(panel, SWT.NONE, PaletteMessages.NAME_LABEL);
tablist[0] = createNameText(panel);
createLabel(panel, SWT.NONE, PaletteMessages.DESCRIPTION_LABEL);
tablist[1] = createDescText(panel);
tablist[2] = createHiddenCheckBox(panel);
panel.setTabList(tablist);
}
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:26,代码来源:DefaultEntryPage.java
示例9: createDescText
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的package包/类
/**
* Creates the <code>Text</code> where the description of the entry is to be
* displayed.
*
* @param panel
* The Composite in which the <code>Text</code> is to be created
* @return The newly created <code>Text</code>
*/
protected Text createDescText(Composite panel) {
String desc = entry.getDescription();
Text description = createText(panel, SWT.MULTI | SWT.WRAP | SWT.BORDER
| SWT.V_SCROLL, desc);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.widthHint = 150;
data.heightHint = description.computeTrim(0, 0, 10, FigureUtilities
.getFontMetrics(description.getFont()).getHeight() * 2).height;
description.setLayoutData(data);
if (getPermission() >= PaletteEntry.PERMISSION_LIMITED_MODIFICATION) {
description.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
handleDescriptionChanged(((Text) e.getSource()).getText());
}
});
}
return description;
}
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:27,代码来源:DefaultEntryPage.java
示例10: createHiddenCheckBox
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的package包/类
/**
* Creates the <code>Button</code> (CheckBox) for indicating the hidden
* status of the entry. It initializes it with the current hidden state of
* entry.
*
* @param panel
* The Composite in which the Button is to be created
* @return The newly created Button
*/
protected Button createHiddenCheckBox(Composite panel) {
Button hidden = new Button(panel, SWT.CHECK);
hidden.setFont(panel.getFont());
hidden.setText(PaletteMessages.HIDDEN_LABEL);
hidden.setSelection(!entry.isVisible());
if (getPermission() == PaletteEntry.PERMISSION_NO_MODIFICATION) {
hidden.setEnabled(false);
} else {
hidden.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
handleHiddenSelected(((Button) e.getSource())
.getSelection());
}
});
}
return hidden;
}
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:29,代码来源:DefaultEntryPage.java
示例11: createText
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的package包/类
/**
* Creates a <code>Text</code>. This method is mainly a result of
* code-factoring.
*
* @param panel
* The Composite in which the Text is to be created
* @param style
* The stylebits for the Text
* @param text
* The text to be displayed in the Text
* @return a text widget with griddata constraint
*/
protected Text createText(Composite panel, int style, String text) {
if (getEntry() instanceof PaletteSeparator
|| getPermission() < PaletteEntry.PERMISSION_LIMITED_MODIFICATION) {
style = style | SWT.READ_ONLY;
}
Text textBox = new Text(panel, style);
textBox.setFont(panel.getFont());
if (text != null)
textBox.setText(text);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.widthHint = 200;
textBox.setLayoutData(data);
return textBox;
}
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:28,代码来源:DefaultEntryPage.java
示例12: createControl
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的package包/类
/**
* @see org.eclipse.gef.ui.palette.customize.EntryPage#createControl(Composite,
* PaletteEntry)
*/
public void createControl(Composite parent, PaletteEntry entry) {
super.createControl(parent, entry);
openDrawerOption = createOpenDrawerInitiallyOption(getComposite());
pinDrawerOption = createPinDrawerInitiallyOption(getComposite());
Control[] oldTablist = getComposite().getTabList();
if (!contains(oldTablist, openDrawerOption)) {
// This means that the super class must've set a specific tab order
// on this
// composite. We need to add the two newly created controls to this
// tab order.
Control[] newTablist = new Control[oldTablist.length + 2];
System.arraycopy(oldTablist, 0, newTablist, 0, oldTablist.length);
newTablist[newTablist.length - 2] = openDrawerOption;
newTablist[newTablist.length - 1] = pinDrawerOption;
getComposite().setTabList(newTablist);
}
}
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:24,代码来源:DrawerEntryPage.java
示例13: createOpenDrawerInitiallyOption
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的package包/类
/**
* Creates the button that provides the option to pin a drawer open at
* start-up.
*
* @param panel
* The parent Composite
* @return The button for the new option
*/
protected Button createOpenDrawerInitiallyOption(Composite panel) {
Button b = new Button(panel, SWT.CHECK);
b.setFont(panel.getFont());
b.setText(PaletteMessages.EXPAND_DRAWER_AT_STARTUP_LABEL);
b.setSelection(getDrawer().isInitiallyOpen());
if (getPermission() >= PaletteEntry.PERMISSION_LIMITED_MODIFICATION) {
b.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
handleOpenSelected(((Button) e.getSource()).getSelection());
}
});
} else {
b.setEnabled(false);
}
return b;
}
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:26,代码来源:DrawerEntryPage.java
示例14: createPinDrawerInitiallyOption
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的package包/类
/**
* Creates the button that provides the option to have a drawer open at
* start-up.
*
* @param panel
* The parent Composite
* @return The button for the new option
*/
protected Button createPinDrawerInitiallyOption(Composite panel) {
Button pinOption = new Button(panel, SWT.CHECK);
pinOption.setFont(panel.getFont());
pinOption.setText(PaletteMessages.DRAWER_PIN_AT_STARTUP);
GridData data = new GridData();
data.horizontalIndent = 15;
pinOption.setLayoutData(data);
pinOption.setEnabled(openDrawerOption.getSelection()
&& openDrawerOption.isEnabled());
pinOption.setSelection(getDrawer().isInitiallyPinned());
if (getPermission() >= PaletteEntry.PERMISSION_LIMITED_MODIFICATION) {
pinOption.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
handlePinSelected(((Button) e.getSource()).getSelection());
}
});
}
return pinOption;
}
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:28,代码来源:DrawerEntryPage.java
示例15: handlePropertyChanged
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的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);
}
}
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:28,代码来源:PaletteTreeProvider.java
示例16: getEntryPage
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的package包/类
/**
* Returns the <code>EntryPage</code> for the given
* <code>PaletteEntry</code>. The <code>EntryPage</code> is retrieved from
* the customizer. If the given entry is <code>null</code>,
* <code>null</code> will be returned. If the customizer returns
* <code>null</code> for the valid entry, a default page will be created and
* returned.
*
* @param entry
* The PaletteEntry whose properties need to be displayed
* @return The EntryPage with the properties of the given PaletteEntry
*/
protected EntryPage getEntryPage(PaletteEntry entry) {
if (entry == null) {
return null;
}
if (entriesToPages.containsKey(entry)) {
return (EntryPage) entriesToPages.get(entry);
}
EntryPage page = getCustomizer().getPropertiesPage(entry);
if (page == null) {
page = new DefaultEntryPage();
}
page.createControl(propertiesPanelContainer, entry);
page.setPageContainer(this);
entriesToPages.put(entry, page);
return page;
}
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:32,代码来源:PaletteCustomizerDialog.java
示例17: handleOutlineSelectionChanged
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的package包/类
/**
* This is the method that is called everytime the selection in the outline
* (treeviewer) changes.
*/
protected void handleOutlineSelectionChanged() {
PaletteEntry entry = getSelectedPaletteEntry();
if (activeEntry == entry) {
return;
}
if (errorMessage != null) {
MessageDialog dialog = new MessageDialog(getShell(),
PaletteMessages.ERROR,
null,
PaletteMessages.ABORT_PAGE_FLIPPING_MESSAGE
+ "\n" + errorMessage, //$NON-NLS-1$
MessageDialog.ERROR,
new String[] { IDialogConstants.OK_LABEL }, 0);
dialog.open();
treeviewer.addPostSelectionChangedListener(pageFlippingPreventer);
} else {
setActiveEntry(entry);
}
updateActions();
}
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:27,代码来源:PaletteCustomizerDialog.java
示例18: update
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的package包/类
public void update() {
boolean enabled = false;
PaletteEntry entry = getSelectedPaletteEntry();
if (entry == null) {
entry = getPaletteRoot();
}
// Enable or disable the FactoryWrapperActions
for (Iterator iter = factories.iterator(); iter.hasNext();) {
FactoryWrapperAction action = (FactoryWrapperAction) iter
.next();
action.setEnabled(action.canCreate(entry));
enabled = enabled || action.isEnabled();
}
// Enable this action IFF at least one of the new actions is enabled
setEnabled(enabled);
}
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:18,代码来源:PaletteCustomizerDialog.java
示例19: refreshVisuals
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的package包/类
/**
* @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
*/
protected void refreshVisuals() {
DetailedLabelFigure fig = (DetailedLabelFigure) getFigure();
PaletteEntry entry = getPaletteEntry();
fig.setName(entry.getLabel());
fig.setDescription(entry.getDescription());
if (getPreferenceSource().useLargeIcons())
setImageDescriptor(entry.getLargeIcon());
else
setImageDescriptor(entry.getSmallIcon());
int layoutMode = getLayoutSetting();
fig.setLayoutMode(layoutMode);
if (layoutMode == PaletteViewerPreferences.LAYOUT_COLUMNS) {
fig.setBorder(ToolEntryEditPart.ICON_BORDER);
} else if (layoutMode == PaletteViewerPreferences.LAYOUT_LIST
|| layoutMode == PaletteViewerPreferences.LAYOUT_DETAILS) {
fig.setBorder(ToolEntryEditPart.LIST_BORDER);
} else if (layoutMode == PaletteViewerPreferences.LAYOUT_ICONS
&& !isToolbarItem()) {
fig.setBorder(ToolEntryEditPart.ICON_BORDER);
} else {
fig.setBorder(null);
}
super.refreshVisuals();
}
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:28,代码来源:TemplateEditPart.java
示例20: refreshVisuals
import org.eclipse.gef.palette.PaletteEntry; //导入依赖的package包/类
/**
* @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
*/
protected void refreshVisuals() {
PaletteEntry entry = getPaletteEntry();
customLabel.setName(entry.getLabel());
customLabel.setDescription(entry.getDescription());
if (getPreferenceSource().useLargeIcons())
setImageDescriptor(entry.getLargeIcon());
else
setImageDescriptor(entry.getSmallIcon());
int layoutMode = getLayoutSetting();
customLabel.setLayoutMode(layoutMode);
if (layoutMode == PaletteViewerPreferences.LAYOUT_COLUMNS) {
customLabel.setBorder(ICON_BORDER);
} else if (layoutMode == PaletteViewerPreferences.LAYOUT_LIST
|| layoutMode == PaletteViewerPreferences.LAYOUT_DETAILS) {
customLabel.setBorder(LIST_BORDER);
} else if (layoutMode == PaletteViewerPreferences.LAYOUT_ICONS
&& !isToolbarItem()) {
customLabel.setBorder(ICON_BORDER);
} else {
customLabel.setBorder(null);
}
super.refreshVisuals();
}
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:29,代码来源:ToolEntryEditPart.java
注:本文中的org.eclipse.gef.palette.PaletteEntry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论