当前位置: 首页>>代码示例>>Java>>正文


Java Palette.getInstance方法代码示例

本文整理汇总了Java中com.intellij.uiDesigner.palette.Palette.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java Palette.getInstance方法的具体用法?Java Palette.getInstance怎么用?Java Palette.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.uiDesigner.palette.Palette的用法示例。


在下文中一共展示了Palette.getInstance方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:NoLabelForInspection.java

示例2: 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;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ComponentTree.java

示例3: 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;
	}
}
 
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:23,代码来源:ComponentTree.java

示例4: 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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FormEditingUtil.java

示例5: 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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:PaletteListPopupStep.java

示例6: 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()));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AddTabAction.java

示例7: 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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:FirstComponentInsertLocation.java

示例8: 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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FormPropertyTableCellRenderer.java

示例9: 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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:RadTabbedPane.java

示例10: 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();
}
 
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:11,代码来源:FormEditingUtil.java

示例11: morphComponent

import com.intellij.uiDesigner.palette.Palette; //导入方法依赖的package包/类
private static boolean morphComponent(final GuiEditor editor, final RadComponent oldComponent, ComponentItem targetItem) {
  targetItem = InsertComponentProcessor.replaceAnyComponentItem(editor, targetItem, "Morph to Non-Palette Component");
  if (targetItem == null) {
    return false;
  }
  final RadComponent newComponent = InsertComponentProcessor.createInsertedComponent(editor, targetItem);
  if (newComponent == null) return false;
  newComponent.setBinding(oldComponent.getBinding());
  newComponent.setCustomLayoutConstraints(oldComponent.getCustomLayoutConstraints());
  newComponent.getConstraints().restore(oldComponent.getConstraints());

  updateBoundFieldType(editor, oldComponent, targetItem);

  final IProperty[] oldProperties = oldComponent.getModifiedProperties();
  final Palette palette = Palette.getInstance(editor.getProject());
  for(IProperty prop: oldProperties) {
    IntrospectedProperty newProp = palette.getIntrospectedProperty(newComponent, prop.getName());
    if (newProp == null || !prop.getClass().equals(newProp.getClass())) continue;
    Object oldValue = prop.getPropertyValue(oldComponent);
    try {
      //noinspection unchecked
      newProp.setValue(newComponent, oldValue);
    }
    catch (Exception e) {
      // ignore
    }
  }

  retargetComponentProperties(editor, oldComponent, newComponent);
  final RadContainer parent = oldComponent.getParent();
  int index = parent.indexOfComponent(oldComponent);
  parent.removeComponent(oldComponent);
  parent.addComponent(newComponent, index);
  newComponent.setSelected(true);

  if (oldComponent.isDefaultBinding()) {
    final String text = FormInspectionUtil.getText(newComponent.getModule(), newComponent);
    if (text != null) {
      String binding = BindingProperty.suggestBindingFromText(newComponent, text);
      if (binding != null) {
        new BindingProperty(newComponent.getProject()).setValueEx(newComponent, binding);
      }
    }
    newComponent.setDefaultBinding(true);
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:48,代码来源:MorphAction.java

示例12: getPalette

import com.intellij.uiDesigner.palette.Palette; //导入方法依赖的package包/类
public Palette getPalette() {
  if (myPalette == null) {
    return Palette.getInstance(getProject());
  }
  return myPalette;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:RadComponent.java


注:本文中的com.intellij.uiDesigner.palette.Palette.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。