本文整理汇总了Java中com.intellij.uiDesigner.palette.Palette类的典型用法代码示例。如果您正苦于以下问题:Java Palette类的具体用法?Java Palette怎么用?Java Palette使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Palette类属于com.intellij.uiDesigner.palette包,在下文中一共展示了Palette类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BoundIconRenderer
import com.intellij.uiDesigner.palette.Palette; //导入依赖的package包/类
public BoundIconRenderer(@NotNull final PsiElement element) {
myElement = element;
if (myElement instanceof PsiField) {
final PsiField field = (PsiField)myElement;
final PsiType type = field.getType();
if (type instanceof PsiClassType) {
PsiClass componentClass = ((PsiClassType)type).resolve();
if (componentClass != null) {
String qName = componentClass.getQualifiedName();
if (qName != null) {
final ComponentItem item = Palette.getInstance(myElement.getProject()).getItem(qName);
if (item != null) {
myIcon = item.getIcon();
}
}
}
}
myQName = field.getContainingClass().getQualifiedName() + "#" + field.getName();
}
else {
myQName = ((PsiClass) element).getQualifiedName();
}
}
示例2: setSelectionValue
import com.intellij.uiDesigner.palette.Palette; //导入依赖的package包/类
/**
* @return false if some of the set value operations have failed; true if everything successful
*/
private boolean setSelectionValue(Property property, Object newValue) {
if (!setPropValue(property, mySelection.get(0), newValue)) return false;
for(int i=1; i<mySelection.size(); i++) {
if (property instanceof IntrospectedProperty) {
IntrospectedProperty[] props = Palette.getInstance(myProject).getIntrospectedProperties(mySelection.get(i));
for(IntrospectedProperty otherProperty: props) {
if (otherProperty.getName().equals(property.getName())) {
if (!setPropValue(otherProperty, mySelection.get(i), newValue)) return false;
break;
}
}
}
else {
if (!setPropValue(property, mySelection.get(i), newValue)) return false;
}
}
return true;
}
示例3: run
import com.intellij.uiDesigner.palette.Palette; //导入依赖的package包/类
public void run() {
if (!myEditor.ensureEditable()) {
return;
}
Runnable runnable = new Runnable() {
public void run() {
final Palette palette = Palette.getInstance(myEditor.getProject());
IntrospectedProperty[] props = palette.getIntrospectedProperties(myLabel);
boolean modified = false;
for(IntrospectedProperty prop: props) {
if (prop.getName().equals(SwingProperties.LABEL_FOR) && prop instanceof IntroComponentProperty) {
IntroComponentProperty icp = (IntroComponentProperty) prop;
icp.setValueEx(myLabel, myComponent.getId());
modified = true;
break;
}
}
if (modified) myEditor.refreshAndSave(false);
}
};
CommandProcessor.getInstance().executeCommand(myEditor.getProject(), runnable,
UIDesignerBundle.message("inspection.no.label.for.command"), null);
}
示例4: getComponentIcon
import com.intellij.uiDesigner.palette.Palette; //导入依赖的package包/类
public static Icon getComponentIcon(final RadComponent component) {
if (!(component instanceof RadErrorComponent)) {
final Palette palette = Palette.getInstance(component.getProject());
final ComponentItem item = palette.getItem(component.getComponentClassName());
final Icon icon;
if (item != null) {
icon = item.getSmallIcon();
}
else {
icon = UIDesignerIcons.Unknown_small;
}
return icon;
}
else {
return AllIcons.General.Error;
}
}
示例5: getComponentIcon
import com.intellij.uiDesigner.palette.Palette; //导入依赖的package包/类
public static Icon getComponentIcon(final RadComponent component)
{
if(!(component instanceof RadErrorComponent))
{
final Palette palette = Palette.getInstance(component.getProject());
final ComponentItem item = palette.getItem(component.getComponentClassName());
final Icon icon;
if(item != null)
{
icon = item.getSmallIcon();
}
else
{
icon = UIDesignerIcons.Unknown_small;
}
return icon;
}
else
{
return AllIcons.General.Error;
}
}
示例6: getDefaultConstraints
import com.intellij.uiDesigner.palette.Palette; //导入依赖的package包/类
public static GridConstraints getDefaultConstraints(final RadComponent component) {
final Palette palette = Palette.getInstance(component.getProject());
final ComponentItem item = palette.getItem(component.getComponentClassName());
if (item != null) {
return item.getDefaultConstraints();
}
return new GridConstraints();
}
示例7: getSelectionValue
import com.intellij.uiDesigner.palette.Palette; //导入依赖的package包/类
private Object getSelectionValue(final Property property) {
if (mySelection.size() == 0) {
return null;
}
//noinspection unchecked
Object result = property.getValue(mySelection.get(0));
for(int i=1; i<mySelection.size(); i++) {
Object otherValue = null;
if (property instanceof IntrospectedProperty) {
IntrospectedProperty[] props = Palette.getInstance(myProject).getIntrospectedProperties(mySelection.get(i));
for(IntrospectedProperty otherProperty: props) {
if (otherProperty.getName().equals(property.getName())) {
otherValue = otherProperty.getValue(mySelection.get(i));
break;
}
}
}
else {
//noinspection unchecked
otherValue = property.getValue(mySelection.get(i));
}
if (!Comparing.equal(result, otherValue)) {
return null;
}
}
return result;
}
示例8: PaletteListPopupStep
import com.intellij.uiDesigner.palette.Palette; //导入依赖的package包/类
PaletteListPopupStep(GuiEditor editor, ComponentItem initialSelection, final Processor<ComponentItem> runnable, final String title) {
myInitialSelection = initialSelection;
myRunnable = runnable;
myProject = editor.getProject();
Palette palette = Palette.getInstance(editor.getProject());
for(GroupItem group: palette.getToolWindowGroups()) {
Collections.addAll(myItems, group.getItems());
}
myTitle = title;
}
示例9: actionPerformed
import com.intellij.uiDesigner.palette.Palette; //导入依赖的package包/类
protected void actionPerformed(final GuiEditor editor, final List<RadComponent> selection, final AnActionEvent e) {
RadTabbedPane tabbedPane = (RadTabbedPane) selection.get(0);
Palette palette = Palette.getInstance(editor.getProject());
final RadComponent radComponent = InsertComponentProcessor.createPanelComponent(editor);
final ComponentDropLocation dropLocation = tabbedPane.getDropLocation(null);
dropLocation.processDrop(editor, new RadComponent[] { radComponent }, null,
new ComponentItemDragObject(palette.getPanelItem()));
}
示例10: processDrop
import com.intellij.uiDesigner.palette.Palette; //导入依赖的package包/类
@Override public void processDrop(final GuiEditor editor,
final RadComponent[] components,
final GridConstraints[] constraintsToAdjust,
final ComponentDragObject dragObject) {
RadAbstractGridLayoutManager gridLayout = myContainer.getGridLayoutManager();
if (myContainer.getGridRowCount() == 0 && myContainer.getGridColumnCount() == 0) {
gridLayout.insertGridCells(myContainer, 0, false, true, true);
gridLayout.insertGridCells(myContainer, 0, true, true, true);
}
super.processDrop(editor, components, constraintsToAdjust, dragObject);
Palette palette = Palette.getInstance(editor.getProject());
ComponentItem hSpacerItem = palette.getItem(HSpacer.class.getName());
ComponentItem vSpacerItem = palette.getItem(VSpacer.class.getName());
InsertComponentProcessor icp = new InsertComponentProcessor(editor);
if (myXPart == 0) {
insertSpacer(icp, hSpacerItem, GridInsertMode.ColumnAfter);
}
if (myXPart == 2) {
insertSpacer(icp, hSpacerItem, GridInsertMode.ColumnBefore);
}
if (myYPart == 0) {
insertSpacer(icp, vSpacerItem, GridInsertMode.RowAfter);
}
if (myYPart == 2) {
insertSpacer(icp, vSpacerItem, GridInsertMode.RowBefore);
}
}
示例11: FormPropertyTableCellRenderer
import com.intellij.uiDesigner.palette.Palette; //导入依赖的package包/类
FormPropertyTableCellRenderer(@NotNull final Project project) {
myPalette = Palette.getInstance(project);
myAttrs1 = SimpleTextAttributes.REGULAR_BOLD_ATTRIBUTES;
myAttrs2 = SimpleTextAttributes.REGULAR_ATTRIBUTES;
myAttrs3 = new SimpleTextAttributes(SimpleTextAttributes.STYLE_PLAIN, Color.GRAY);
setFocusBorderAroundIcon(true);
}
示例12: run
import com.intellij.uiDesigner.palette.Palette; //导入依赖的package包/类
public void run() {
String scrollPane = JScrollPane.class.getName();
ComponentItem item = Palette.getInstance(myEditor.getProject()).getItem(scrollPane);
SurroundAction action = new SurroundAction(item == null ? JBScrollPane.class.getName() : scrollPane);
ArrayList<RadComponent> targetList = new ArrayList<RadComponent>(Collections.singletonList(myComponent));
action.actionPerformed(myEditor, targetList, null);
}
示例13: processDrop
import com.intellij.uiDesigner.palette.Palette; //导入依赖的package包/类
public void processDrop(GuiEditor editor,
RadComponent[] components,
GridConstraints[] constraintsToAdjust,
ComponentDragObject dragObject) {
if (myInsertBeforeId != null) {
for(int i=0; i<getTabbedPane().getTabCount(); i++) {
if (getRadComponent(i).getId().equals(myInsertBeforeId)) {
myInsertIndex = i;
break;
}
}
}
if (myInsertIndex > getTabbedPane().getTabCount()) {
myInsertIndex = getTabbedPane().getTabCount();
}
RadComponent componentToAdd = components [0];
if (componentToAdd instanceof RadContainer) {
addComponent(componentToAdd, myInsertIndex);
}
else {
Palette palette = Palette.getInstance(editor.getProject());
RadContainer panel = InsertComponentProcessor.createPanelComponent(editor);
addComponent(panel);
panel.getDropLocation(null).processDrop(editor, new RadComponent[] { componentToAdd }, null,
new ComponentItemDragObject(palette.getPanelItem()));
}
getTabbedPane().setSelectedIndex(myInsertIndex);
}
示例14: getDefaultConstraints
import com.intellij.uiDesigner.palette.Palette; //导入依赖的package包/类
public static GridConstraints getDefaultConstraints(final RadComponent component)
{
final Palette palette = Palette.getInstance(component.getProject());
final ComponentItem item = palette.getItem(component.getComponentClassName());
if(item != null)
{
return item.getDefaultConstraints();
}
return new GridConstraints();
}
示例15: getSelectionValue
import com.intellij.uiDesigner.palette.Palette; //导入依赖的package包/类
private Object getSelectionValue(final Property property)
{
if(mySelection.size() == 0)
{
return null;
}
//noinspection unchecked
Object result = property.getValue(mySelection.get(0));
for(int i = 1; i < mySelection.size(); i++)
{
Object otherValue = null;
if(property instanceof IntrospectedProperty)
{
IntrospectedProperty[] props = Palette.getInstance(myProject).getIntrospectedProperties(mySelection.get(i));
for(IntrospectedProperty otherProperty : props)
{
if(otherProperty.getName().equals(property.getName()))
{
otherValue = otherProperty.getValue(mySelection.get(i));
break;
}
}
}
else
{
//noinspection unchecked
otherValue = property.getValue(mySelection.get(i));
}
if(!Comparing.equal(result, otherValue))
{
return null;
}
}
return result;
}