@Override public void modelChanged(IModelChangedEvent e) { if (e.getChangeType() == IModelChangedEvent.CHANGE) { Object obj = e.getChangedObjects()[0]; if (obj.equals(fInput)) refresh(); } }
@Override public void modelChanged(IModelChangedEvent e) { // No need to call super, handling world changed event here if (e.getChangeType() == IModelChangedEvent.WORLD_CHANGED) { handleModelEventWorldChanged(e); } else if (e.getChangeType() == IModelChangedEvent.CHANGE) { handleModelEventChange(e); } }
private void handleModelEventChange(IModelChangedEvent event) { // Change event Object[] objects = event.getChangedObjects(); IProductObject object = (IProductObject) objects[0]; if (object == null) { // Ignore } else if ((object instanceof IProduct) && (event.getChangedProperty() == IProduct.P_ID)) { updateFieldEnablement(); } }
@Override public void modelChanged(IModelChangedEvent event) { if ((event.getChangeType() == IModelChangedEvent.REMOVE) || (fShowDTD == false) || (fDtdSection == null)) { return; } Object[] objects = event.getChangedObjects(); for (int i = 0; i < objects.length; i++) { if (objects[i] instanceof ISchemaCompositor) fDtdSection.updateDTDLabel(objects[i]); } }
@Override protected void execute(IModelChangedEvent event, boolean undo) { Object[] elements = event.getChangedObjects(); int type = event.getChangeType(); String propertyName = event.getChangedProperty(); IModelChangeProvider model = event.getChangeProvider(); switch (type) { case IModelChangedEvent.INSERT: if (undo) executeRemove(model, elements); else executeAdd(model, elements); break; case IModelChangedEvent.REMOVE: if (undo) executeAdd(model, elements); else executeRemove(model, elements); break; case IModelChangedEvent.CHANGE: if (event instanceof AttributeChangedEvent) { executeAttributeChange((AttributeChangedEvent) event, undo); } else { if (undo) executeChange(elements[0], propertyName, event.getNewValue(), event.getOldValue()); else executeChange(elements[0], propertyName, event.getOldValue(), event.getNewValue()); } } }
@Override protected void addTextEditOperation(ArrayList<TextEdit> ops, IModelChangedEvent event) { Object[] objects = event.getChangedObjects(); if (objects != null) { for (int i = 0; i < objects.length; i++) { Object object = objects[i]; if (object instanceof PDEManifestElement) object = ((PDEManifestElement) object).getHeader(); else if (object instanceof PackageFriend) object = ((PackageFriend) object).getHeader(); if (object instanceof ManifestHeader) { ManifestHeader header = (ManifestHeader) object; TextEdit op = fOperationTable.get(header); if (op != null) { fOperationTable.remove(header); ops.remove(op); } String value = header.getValue(); if (value == null || value.trim().length() == 0) { deleteKey(header, ops); } else { modifyKey(header, ops); } } } } }
@Override public void modelChanged(IModelChangedEvent event) { if (event.getChangeType() == IModelChangedEvent.CHANGE) { Object changedObject = event.getChangedObjects()[0]; if (changedObject instanceof IPluginObject) { IPluginObject obj = (IPluginObject) event.getChangedObjects()[0]; // Ignore events from objects that are not yet in the model. if (!(obj instanceof IPluginBase) && obj.isInTheModel() == false) return; } if (changedObject instanceof IBuildObject) { IBuildObject obj = (IBuildObject) event.getChangedObjects()[0]; // Ignore events from objects that are not yet in the model. if (obj.isInTheModel() == false) return; } } super.modelChanged(event); }
@Override public void modelChanged(IModelChangedEvent event) { if (event.getChangeType() == IModelChangedEvent.WORLD_CHANGED) { fHeader = null; markStale(); return; } if (getExportedPackageHeader().equals(event.getChangedProperty())) { refresh(); // Bug 171896 // Since the model sends a CHANGE event instead of // an INSERT event on the very first addition to the empty table // Selection should fire here to take this first insertion into account Object lastElement = fPackageViewer.getElementAt(fPackageViewer.getTable().getItemCount() - 1); if (lastElement != null) { fPackageViewer.setSelection(new StructuredSelection(lastElement)); } return; } Object[] objects = event.getChangedObjects(); for (Object changedObject : objects) { if (changedObject instanceof ExportPackageObject) { ExportPackageObject object = (ExportPackageObject) changedObject; switch (event.getChangeType()) { case IModelChangedEvent.INSERT: fPackageViewer.add(object); fPackageViewer.setSelection(new StructuredSelection(object), false); fPackageViewer.getTable().setFocus(); break; case IModelChangedEvent.REMOVE: Table table = fPackageViewer.getTable(); int index = table.getSelectionIndex(); fPackageViewer.remove(object); table.setSelection(index < table.getItemCount() ? index : table.getItemCount() - 1); break; default: fPackageViewer.refresh(object); } } } }
/* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.PDESection#modelChanged(org.eclipse.pde.core.IModelChangedEvent) */ public void modelChanged(IModelChangedEvent e) { // No need to call super, handling world changed event here if (e.getChangeType() == IModelChangedEvent.WORLD_CHANGED) { handleModelEventWorldChanged(e); return; } Object[] objects = e.getChangedObjects(); if (e.getChangeType() == IModelChangedEvent.INSERT) { for (int i = 0; i < objects.length; i++) { if (objects[i] instanceof IProductPlugin) fPluginTable.add(objects[i]); } } else if (e.getChangeType() == IModelChangedEvent.REMOVE) { Table table = fPluginTable.getTable(); int index = table.getSelectionIndex(); for (int i = 0; i < objects.length; i++) { if (objects[i] instanceof IProductPlugin) fPluginTable.remove(objects[i]); } // Update Selection int count = table.getItemCount(); if (count == 0) { // Nothing to select } else if (index < count) { table.setSelection(index); } else { table.setSelection(count - 1); } } else if (e.getChangeType() == IModelChangedEvent.CHANGE) { fPluginTable.refresh(); } updateRemoveButtons(false, true); }
@Override public void modelChanged(IModelChangedEvent e) { fComponent = fModel.getDSComponent(); if (e.getChangeType() == IModelChangedEvent.WORLD_CHANGED) { markStale(); } Display display = fEnabledButton.getDisplay(); if (display.getThread() == Thread.currentThread()) updateUIFields(); else display.asyncExec( () -> { if (!fEnabledButton.isDisposed()) updateUIFields(); }); }
public void modelChanged(IModelChangedEvent e) { // No need to call super, handling world changed event here if (e.getChangeType() == IModelChangedEvent.WORLD_CHANGED) { handleModelEventWorldChanged(e); return; } String prop = e.getChangedProperty(); Object[] objects = e.getChangedObjects(); if (prop == null || objects == null || !(objects[0] instanceof IProduct)) return; if (prop.equals(IProduct.P_UID)) { fIdEntry.setValue(e.getNewValue().toString(), true); } else if (prop.equals(IProduct.P_NAME)) { fNameEntry.setValue(e.getNewValue().toString(), true); } else if (prop.equals(IProduct.P_VERSION)) { fVersionEntry.setValue(e.getNewValue().toString(), true); } else if (prop.equals(IProduct.P_INCLUDE_LAUNCHERS)) { fLaunchersButton.setSelection(Boolean.valueOf(e.getNewValue().toString()).booleanValue()); } }
public void modelChanged(IModelChangedEvent event) { if (event.getChangeType() == IModelChangedEvent.WORLD_CHANGED) { markStale(); } Object changeObject = event.getChangedObjects()[0]; if (!(changeObject instanceof IBuildEntry && (((IBuildEntry) changeObject) .getName() .equals(IBuildPropertiesConstants.PROPERTY_BIN_EXCLUDES) || ((IBuildEntry) changeObject) .getName() .equals(IBuildPropertiesConstants.PROPERTY_BIN_INCLUDES)))) return; if ((fParentResource == null && fOriginalResource != null) || (fOriginalResource == null && fParentResource != null)) { initializeCheckState(); return; } if (fParentResource == null && fOriginalResource == null) { if (event.getChangedProperty() != null && event.getChangedProperty().equals(IBuildPropertiesConstants.PROPERTY_BIN_INCLUDES)) { if (event.getOldValue() == null && event.getNewValue() != null) { if (event.getNewValue().equals(".")) // $NON-NLS-1$ return; // adding token IFile file = fBundleRoot.getFile(new Path(event.getNewValue().toString())); if (!file.exists()) return; fParentResource = fOriginalResource = file; isChecked = true; } else if (event.getOldValue() != null && event.getNewValue() == null) { if (event.getOldValue().equals(".")) // $NON-NLS-1$ return; // removing token IFile file = fBundleRoot.getFile(new Path(event.getOldValue().toString())); if (!file.exists()) return; fParentResource = fOriginalResource = file; isChecked = false; } else { return; } } return; } fTreeViewer.setChecked(fParentResource, isChecked); fTreeViewer.setGrayed(fOriginalResource, false); fTreeViewer.setParentsGrayed(fParentResource, true); setParentsChecked(fParentResource); fTreeViewer.setGrayed(fParentResource, false); if (fParentResource instanceof IFolder) { fTreeViewer.setSubtreeChecked(fParentResource, isChecked); setChildrenGrayed(fParentResource, false); } while (!fOriginalResource.equals(fParentResource)) { fTreeViewer.setChecked(fOriginalResource, isChecked); fOriginalResource = fOriginalResource.getParent(); } fParentResource = null; fOriginalResource = null; }