@SuppressWarnings({"HardCodedStringLiteral"}) public String toString() { return getClass().getName() + "[myId=" + myId + "; myVisible=" + myVisible + "; myShowStripeButton=" + myShowStripeButton + "; myActive=" + myActive + "; myAnchor=" + myAnchor + "; myOrder=" + myOrder + "; myAutoHide=" + myAutoHide + "; myWeight=" + myWeight + "; mySideWeight=" + mySideWeight + "; myType=" + myType + "; myInternalType=" + myInternalType + "; myFloatingBounds=" + myFloatingBounds + "; mySplitMode=" + mySplitMode + "; myContentUiType=" + myContentUiType.getName() + ']'; }
@Override @SuppressWarnings({"EmptyCatchBlock"}) public void readExternal(final Element element) { myId = element.getAttributeValue(ID_ATTR); myWasRead = true; try { myActive = Boolean.valueOf(element.getAttributeValue(ACTIVE_ATTR)).booleanValue(); } catch (NumberFormatException ignored) { } try { myAnchor = ToolWindowAnchor.fromText(element.getAttributeValue(ANCHOR_ATTR)); } catch (IllegalArgumentException ignored) { } myAutoHide = Boolean.valueOf(element.getAttributeValue(AUTOHIDE_ATTR)).booleanValue(); try { myInternalType = ToolWindowType.valueOf(element.getAttributeValue(INTERNAL_TYPE_ATTR)); } catch (IllegalArgumentException ignored) { } try { setTypeAndCheck(ToolWindowType.valueOf(element.getAttributeValue(TYPE_ATTR))); } catch (IllegalArgumentException ignored) { } myVisible = Boolean.valueOf(element.getAttributeValue(VISIBLE_ATTR)).booleanValue(); if (element.getAttributeValue(SHOW_STRIPE_BUTTON) != null) { myShowStripeButton = Boolean.valueOf(element.getAttributeValue(SHOW_STRIPE_BUTTON)).booleanValue(); } try { myWeight = Float.parseFloat(element.getAttributeValue(WEIGHT_ATTR)); } catch (NumberFormatException ignored) { } try { String value = element.getAttributeValue(SIDE_WEIGHT_ATTR); if (value != null) { mySideWeight = Float.parseFloat(value); } } catch (NumberFormatException ignored) { } try { myOrder = Integer.valueOf(element.getAttributeValue(ORDER_ATTR)).intValue(); } catch (NumberFormatException ignored) { } try { int x = Integer.parseInt(element.getAttributeValue(X_ATTR)); int y = Integer.parseInt(element.getAttributeValue(Y_ATTR)); int width = Integer.parseInt(element.getAttributeValue(WIDTH_ATTR)); int height = Integer.parseInt(element.getAttributeValue(HEIGHT_ATTR)); myFloatingBounds = new Rectangle(x, y, width, height); } catch (NumberFormatException ignored) { } mySplitMode = Boolean.parseBoolean(element.getAttributeValue(SIDE_TOOL_ATTR)); myContentUiType = ToolWindowContentUiType.getInstance(element.getAttributeValue(CONTENT_UI_ATTR)); }
@Override public void writeExternal(final Element element) { element.setAttribute(ID_ATTR, myId); element.setAttribute(ACTIVE_ATTR, Boolean.toString(myActive)); element.setAttribute(ANCHOR_ATTR, myAnchor.toString()); element.setAttribute(AUTOHIDE_ATTR, Boolean.toString(myAutoHide)); element.setAttribute(INTERNAL_TYPE_ATTR, myInternalType.toString()); element.setAttribute(TYPE_ATTR, myType.toString()); element.setAttribute(VISIBLE_ATTR, Boolean.toString(myVisible)); element.setAttribute(SHOW_STRIPE_BUTTON, Boolean.toString(myShowStripeButton)); element.setAttribute(WEIGHT_ATTR, Float.toString(myWeight)); element.setAttribute(SIDE_WEIGHT_ATTR, Float.toString(mySideWeight)); element.setAttribute(ORDER_ATTR, Integer.toString(myOrder)); element.setAttribute(SIDE_TOOL_ATTR, Boolean.toString(mySplitMode)); element.setAttribute(CONTENT_UI_ATTR, myContentUiType.getName()); if (myFloatingBounds != null) { element.setAttribute(X_ATTR, Integer.toString(myFloatingBounds.x)); element.setAttribute(Y_ATTR, Integer.toString(myFloatingBounds.y)); element.setAttribute(WIDTH_ATTR, Integer.toString(myFloatingBounds.width)); element.setAttribute(HEIGHT_ATTR, Integer.toString(myFloatingBounds.height)); } }