public void run() { if (document == null) { return; } document.setSelectedComponents(ScreenViewController.SCREEN_ID, Collections.<DesignComponent>emptySet()); } }
public void run() { document.setSelectedComponents(null, Collections.singleton(selectedCommandSource)); } });
@Override public void redo () throws CannotRedoException { super.redo (); document.setSelectedComponents (null, newSelection); }
@Override public void undo () throws CannotUndoException { super.undo (); document.setSelectedComponents (null, oldSelection); }
public void run() { if ((e.getModifiersEx() & MouseEvent.CTRL_DOWN_MASK) == MouseEvent.CTRL_DOWN_MASK) { // invert selection Collection<DesignComponent> currentSelection = doc.getSelectedComponents(); newSelection.addAll(currentSelection); if (currentSelection.contains(component)) { newSelection.remove(component); } else { newSelection.add(component); } } else { newSelection.add(component); } doc.setSelectedComponents(ScreenViewController.SCREEN_ID, newSelection); } });
public static void selectComponentProducerResult (ComponentProducer.Result result) { DesignComponent component = result != null ? result.getMainComponent () : null; if (component != null) component.getDocument ().setSelectedComponents ("accept", Collections.singleton (component)); // NOI18N }
public void run() { DesignComponent component = devicePanel.getDesignComponentAt(e.getPoint()); if ((e.getModifiers() & InputEvent.CTRL_MASK) == InputEvent.CTRL_MASK) { if (component != null) { ArrayList<DesignComponent> list = new ArrayList<DesignComponent> (document.getSelectedComponents()); if (! list.remove(component)) list.add(component); document.setSelectedComponents(ScreenViewController.SCREEN_ID, list); } } else { if (component == null) { document.setSelectedComponents(ScreenViewController.SCREEN_ID, Collections.<DesignComponent>emptySet()); } else if (!document.getSelectedComponents().contains(component)) { if (component.getPresenter(ScreenDisplayPresenter.class) != null) { component.getPresenter(ScreenDisplayPresenter.class). getView().requestFocusInWindow(); } document.setSelectedComponents(ScreenViewController.SCREEN_ID, Collections.singleton(component)); } } } });
@Override public Result accept (Transferable transferable, AcceptSuggestion suggestion) { Result result = super.accept(transferable, suggestion); DesignComponent image = result.getComponents().iterator().next(); FileObject fileObject = super.getNodeFileObject(transferable); if (fileObject == null) return result; String path = getFileClasspath(fileObject); image.writeProperty(ImageCD.PROP_RESOURCE_PATH , MidpTypes.createStringValue(path)); MidpDocumentSupport.getCategoryComponent(getComponent().getDocument(), ResourcesCategoryCD.TYPEID).addComponent(image); getComponent().getDocument().setSelectedComponents(this.toString(), Collections.singleton(image)); return result; }
/** * Removes a component from the component tree and removes references to this component from all property values * in all components in the document. * <p> * Note: It does not allows to remove the root component. * @param component the component */ public void deleteComponent (DesignComponent component) { assert transactionManager.isWriteAccess (); assert component != null && component != rootComponent; assert component.getDocument () == this; Collection<DesignComponent> components = component.getComponents (); if (components.size () > 0) Debug.warning ("Children has to be deleted before deleting the component", component, components); // NOI18N component.removeFromParentComponent (); ComponentDescriptor descriptor = component.getComponentDescriptor (); if (descriptor != null) for (PropertyDescriptor property : descriptor.getPropertyDescriptors ()) component.resetToDefault (property.getName ()); if (selectedComponents.contains (component)) { HashSet<DesignComponent> selected = new HashSet<DesignComponent> (selectedComponents); selected.remove (component); setSelectedComponents ("deleteComponent", selected); // NOI18N } assert ! Debug.isComponentReferencedInRootTree (component) : "Component (" + component + ") is referenced still after deletion"; // NOI18N }
setSelectedComponents ("deleteComponent", selected); // NOI18N