本文整理匯總了Java中com.intellij.uiDesigner.inspections.FormInspectionUtil類的典型用法代碼示例。如果您正苦於以下問題:Java FormInspectionUtil類的具體用法?Java FormInspectionUtil怎麽用?Java FormInspectionUtil使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FormInspectionUtil類屬於com.intellij.uiDesigner.inspections包,在下文中一共展示了FormInspectionUtil類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateLabelForBinding
import com.intellij.uiDesigner.inspections.FormInspectionUtil; //導入依賴的package包/類
void updateLabelForBinding(final RadComponent component) {
String value = getValue(component);
String text = FormInspectionUtil.getText(component.getModule(), component);
if (text != null && value != null) {
RadRootContainer root = (RadRootContainer) FormEditingUtil.getRoot(component);
if (root != null) {
RadComponent valueComponent = (RadComponent)FormEditingUtil.findComponent(root, value);
if (valueComponent != null) {
if (valueComponent instanceof RadScrollPane && ((RadScrollPane) valueComponent).getComponentCount() == 1) {
valueComponent = ((RadScrollPane) valueComponent).getComponent(0);
}
BindingProperty.checkCreateBindingFromText(valueComponent, text);
}
}
}
}
示例2: getDefaultBinding
import com.intellij.uiDesigner.inspections.FormInspectionUtil; //導入依賴的package包/類
public static String getDefaultBinding(final RadComponent c) {
RadRootContainer root = (RadRootContainer) FormEditingUtil.getRoot(c);
String binding = null;
String text = FormInspectionUtil.getText(c.getModule(), c);
if (text != null) {
binding = suggestBindingFromText(c, text);
}
if (binding == null) {
binding = InsertComponentProcessor.suggestBinding(root, c.getComponentClassName());
}
return binding;
}
示例3: ensureChildrenVisible
import com.intellij.uiDesigner.inspections.FormInspectionUtil; //導入依賴的package包/類
protected static void ensureChildrenVisible(final RadContainer container) {
if (container.getLayoutManager().areChildrenExclusive()) {
// ensure that components which were hidden by previous layout are visible (IDEADEV-16077)
for (RadComponent child : container.getComponents()) {
final IProperty property = FormInspectionUtil.findProperty(child, SwingProperties.VISIBLE);
if (property == null || property.getPropertyValue(child) == Boolean.TRUE) {
child.getDelegee().setVisible(true);
}
}
}
}
示例4: getFieldNames
import com.intellij.uiDesigner.inspections.FormInspectionUtil; //導入依賴的package包/類
private static String[] getFieldNames(final RadComponent component, final String currentName) {
final ArrayList<String> result = new ArrayList<String>();
if (currentName != null){
result.add(currentName);
}
final IRootContainer root = FormEditingUtil.getRoot(component);
final String className = root.getClassToBind();
if (className == null) {
return ArrayUtil.toStringArray(result);
}
final PsiClass aClass = FormEditingUtil.findClassToBind(component.getModule(), className);
if (aClass == null) {
return ArrayUtil.toStringArray(result);
}
final PsiField[] fields = aClass.getFields();
for (final PsiField field : fields) {
if (field.hasModifierProperty(PsiModifier.STATIC)) {
continue;
}
final String fieldName = field.getName();
if (Comparing.equal(currentName, fieldName)) {
continue;
}
if (!FormEditingUtil.isBindingUnique(component, fieldName, root)) {
continue;
}
final String componentClassName;
if (component instanceof RadErrorComponent) {
componentClassName = component.getComponentClassName();
}
else if (component instanceof RadHSpacer || component instanceof RadVSpacer) {
componentClassName = Spacer.class.getName();
}
else {
componentClassName = component.getComponentClass().getName();
}
final PsiType componentType;
try {
componentType =
JavaPsiFacade.getInstance(component.getProject()).getElementFactory().createTypeFromText(componentClassName, null);
}
catch (IncorrectOperationException e) {
continue;
}
final PsiType fieldType = field.getType();
if (!fieldType.isAssignableFrom(componentType)) {
continue;
}
result.add(fieldName);
}
String text = FormInspectionUtil.getText(component.getModule(), component);
if (text != null) {
String binding = BindingProperty.suggestBindingFromText(component, text);
if (binding != null && !result.contains(binding)) {
result.add(binding);
}
}
final String[] names = ArrayUtil.toStringArray(result);
Arrays.sort(names);
return names;
}
示例5: morphComponent
import com.intellij.uiDesigner.inspections.FormInspectionUtil; //導入依賴的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;
}