@Override public boolean select(Viewer viewer, Object parentElement, Object element) { if (searchString == null || searchString.length() == 0) { return true; } if (element instanceof PropertyElement) { PropertyElement p = (PropertyElement) element; if (p.getKey().toLowerCase().matches(searchString.toLowerCase())) { return true; } else { return false; } } return true; }
private boolean selectTreePath(Viewer viewer, TreePath parentPath, Object element) { // Cut off children of elements that are shown repeatedly. for (int i = 0; i < parentPath.getSegmentCount() - 1; i++) { if (element.equals(parentPath.getSegment(i))) { return false; } } if (!(viewer instanceof TreeViewer)) { return true; } if (matcher == null) { return true; } TreeViewer treeViewer = (TreeViewer) viewer; Boolean matchingResult = isMatchingOrNull(element); if (matchingResult != null) { return matchingResult; } return hasUnfilteredChild(treeViewer, parentPath, element); }
public DesignDocumentTreeObject(Viewer viewer, DatabaseObject object, boolean inherited) { super(viewer, object, inherited); fFilters = new FolderTreeObject(viewer, "Filters"); fUpdates = new FolderTreeObject(viewer, "Updates"); fViews = new FolderTreeObject(viewer, "Views"); loadFilters(); loadUpdates(); loadViews(); if (object.bNew) { JSONObject json = getObject().getJSONObject(); CouchKey._id.put(json, CouchKey._design.key() + getObject().getName()); CouchKey._rev.remove(json); } syncDocument(); }
/** * {@inheritDoc} * * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject, * org.eclipse.emf.ecore.resource.ResourceSet) * */ public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) { setInitializing(true); if (editingPart != null && key == partKey) { editingPart.setContext(elt, allResource); final ResourceInterface resourceInterface = (ResourceInterface)elt; final GeneralPropertiesEditionPart generalPart = (GeneralPropertiesEditionPart)editingPart; // init values if (isAccessible(GrmViewsRepository.General.Properties.name)) generalPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, resourceInterface.getName())); if (isAccessible(GrmViewsRepository.General.Properties.ownedService)) { ownedServiceSettings = new ReferencesTableSettings(resourceInterface, GrmPackage.eINSTANCE.getResourceInterface_OwnedService()); generalPart.initOwnedService(ownedServiceSettings); } // init filters if (isAccessible(GrmViewsRepository.General.Properties.ownedService)) { generalPart.addFilterToOwnedService(new ViewerFilter() { /** * {@inheritDoc} * * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ public boolean select(Viewer viewer, Object parentElement, Object element) { return (element instanceof String && element.equals("")) || (element instanceof ResourceService); //$NON-NLS-1$ } }); // Start of user code for additional businessfilters for ownedService // End of user code } // init values for referenced views // init filters for referenced views } setInitializing(false); }
@Override public void run() { if (activeEditorPart instanceof IViewerProvider) { Viewer viewer = ((IViewerProvider)activeEditorPart).getViewer(); if (viewer != null) { viewer.refresh(); } } }
@Override public Object[] filter(Viewer viewer, TreePath parentPath, Object[] elements) { int size = elements.length; ArrayList<Object> out = new ArrayList<>(size); for (int i = 0; i < size; ++i) { Object element = elements[i]; if (selectTreePath(viewer, parentPath, element)) { out.add(element); } } return out.toArray(); }
public int compare(Viewer viewer, Object o1, Object o2) { int rc = 0; Execution e1 = (Execution) o1; Execution e2 = (Execution) o2; switch (column) { case ColumnsConst.PROJECT: rc = e1.getStat().getProject().compareTo(e2.getStat().getProject()); break; case ColumnsConst.WHEN: rc = e1.compareTo(e2); break; case ColumnsConst.KIND: rc = e1.getStat().getKind().compareTo(e2.getStat().getKind()); break; case ColumnsConst.CONTEXT: rc = e1.getStat().getContext().compareTo(e2.getStat().getContext()); break; case ColumnsConst.FAILURE: rc = new Boolean (e1.isFailure()).compareTo(new Boolean(e2.isFailure())); break; case ColumnsConst.ELAPSED: rc = e1.elapsed() >= e2.elapsed() ? 1 : -1; break; } // If descending order, flip the direction if (direction == DESCENDING) rc = -rc; return rc; }
@Override protected void unhookViewer(Viewer viewer) { super.unhookViewer(viewer); if (viewer instanceof StructuredViewer) { ((StructuredViewer) viewer).removeOpenListener(_OpenListener); } }
/** * {@inheritDoc} * * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject, * org.eclipse.emf.ecore.resource.ResourceSet) * */ public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) { setInitializing(true); if (editingPart != null && key == partKey) { editingPart.setContext(elt, allResource); final MemoryPartition memoryPartition = (MemoryPartition)elt; final TimingPropertiesEditionPart timingPart = (TimingPropertiesEditionPart)editingPart; // init values if (isAccessible(SrmViewsRepository.Timing.Properties.resCtrlPolicy)) { resCtrlPolicySettings = new ReferencesTableSettings(memoryPartition, GrmPackage.eINSTANCE.getResourceManager_ResCtrlPolicy()); timingPart.initResCtrlPolicy(resCtrlPolicySettings); } // FIXME NO VALID CASE INTO template public updater(editionElement : PropertiesEditionElement, view : View, pec : PropertiesEditionComponent) in widgetControl.mtl module, with the values : concurrentResources, Timing, MemoryPartition. // init filters if (isAccessible(SrmViewsRepository.Timing.Properties.resCtrlPolicy)) { timingPart.addFilterToResCtrlPolicy(new ViewerFilter() { /** * {@inheritDoc} * * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ public boolean select(Viewer viewer, Object parentElement, Object element) { return (element instanceof ResourceControlPolicy); } }); // Start of user code for additional businessfilters for resCtrlPolicy // End of user code } // FIXME NO VALID CASE INTO template public filterUpdater(editionElement : PropertiesEditionElement, view : View, pec : PropertiesEditionComponent) in widgetControl.mtl module, with the values : concurrentResources, Timing, MemoryPartition. // init values for referenced views // init filters for referenced views } setInitializing(false); }
/** * Returns a boolean value * * @param viewer * * @param errorLabel * * This method will always return a boolean value to the caller. * The viewer argument is the specific table viewer for which the user * wants to validate the data. The errorLabel is used just for checking the present status * like whether the calling class has already set its value or not. * */ public static boolean validatePartitionKeyTable(Viewer viewer,Label errorLabel) { errorLabel.setVisible(false); for (HivePartitionFields row : (List<HivePartitionFields>) viewer.getInput()) { if (errorLabel.getVisible()) { return false; } for (int i = 0; i < row.getRowFields().size()- 1; i++) { List<FilterProperties> list=(List<FilterProperties> ) viewer.getData(Constants.PARTITION_KEYS); if (StringUtils.isBlank(row.getRowFields().get(0))) { errorLabel.setVisible(true); errorLabel.setText("Column " + list.get(i).getPropertyname() + " " + Messages.HIVE_FIELD_DIALOG_ERROR); break; } else { if ((StringUtils.isBlank(row.getRowFields().get(i))) && (StringUtils.isNotBlank((row.getRowFields().get(i + 1))))) { errorLabel.setVisible(true); errorLabel.setText("Column " + list.get(i).getPropertyname()+ " " + Messages.HIVE_FIELD_DIALOG_ERROR); break; } else { errorLabel.setVisible(false); } } } } if (!errorLabel.getVisible()) { return true; } return false; }
@Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { try { infos = dservice.getDeviceInformation(); } catch (Exception ne ) { logger.error("Cannot get device information!", ne); } }
@Override public int compare ( final Viewer viewer, final Object e1, final Object e2 ) { if ( ! ( e1 instanceof Event ) || ! ( e2 instanceof Event ) ) { return -super.compare ( viewer, e1, e2 ); } final Event evt1 = (Event)e1; final Event evt2 = (Event)e2; return -evt1.getEntryTimestamp ().compareTo ( evt2.getEntryTimestamp () ); }
@Override public void run () { if ( activeEditorPart instanceof IViewerProvider ) { Viewer viewer = ( (IViewerProvider)activeEditorPart ).getViewer (); if ( viewer != null ) { viewer.refresh (); } } }
public ItemDropAdapter ( final Viewer viewer, final RealtimeListAdapter list ) { super ( viewer ); this.list = list; setFeedbackEnabled ( true ); setSelectionFeedbackEnabled ( true ); }
public void inputChanged ( final Viewer viewer, final Object oldInput, final Object newInput ) { unsubscribe (); this.viewer = viewer; if ( viewer != null ) { this.display = viewer.getControl ().getDisplay (); } if ( newInput != null ) { subcribe ( newInput ); } }
/** * {@inheritDoc} * * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject, * org.eclipse.emf.ecore.resource.ResourceSet) * */ public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) { setInitializing(true); if (editingPart != null && key == partKey) { editingPart.setContext(elt, allResource); final SoftwareResource softwareResource = (SoftwareResource)elt; final TimingPropertiesEditionPart timingPart = (TimingPropertiesEditionPart)editingPart; // init values if (isAccessible(SrmViewsRepository.Timing.Properties.resCtrlPolicy)) { resCtrlPolicySettings = new ReferencesTableSettings(softwareResource, GrmPackage.eINSTANCE.getResourceManager_ResCtrlPolicy()); timingPart.initResCtrlPolicy(resCtrlPolicySettings); } // init filters if (isAccessible(SrmViewsRepository.Timing.Properties.resCtrlPolicy)) { timingPart.addFilterToResCtrlPolicy(new ViewerFilter() { /** * {@inheritDoc} * * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ public boolean select(Viewer viewer, Object parentElement, Object element) { return (element instanceof ResourceControlPolicy); } }); // Start of user code for additional businessfilters for resCtrlPolicy // End of user code } // init values for referenced views // init filters for referenced views } setInitializing(false); }
@Override public void run () { if ( activeEditorPart instanceof IViewerProvider ) { Viewer viewer = ( (IViewerProvider)activeEditorPart ).getViewer (); if ( viewer != null ) { viewer.refresh ( ); } } }
@Override public void inputChanged(Viewer newViewer, Object oldInput, Object newInput) { if (oldInput == null) { IResource resource = (IResource) newInput; /* Abonnement aux changement de ressources. */ if (newInput != null) { resource.getWorkspace().addResourceChangeListener(this); } } this.viewer = newViewer; this.input = (IResource) newInput; }
/** * {@inheritDoc} * * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject, * org.eclipse.emf.ecore.resource.ResourceSet) * */ public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) { setInitializing(true); if (editingPart != null && key == partKey) { editingPart.setContext(elt, allResource); final HardwareIsa hardwareIsa = (HardwareIsa)elt; final TimingPropertiesEditionPart timingPart = (TimingPropertiesEditionPart)editingPart; // init values if (isAccessible(HrmViewsRepository.Timing.TimingProperties.clock)) { // init part clockSettings = new EObjectFlatComboSettings(hardwareIsa, HrmPackage.eINSTANCE.getHardwareResource_Clock()); timingPart.initClock(clockSettings); // set the button mode timingPart.setClockButtonMode(ButtonsModeEnum.BROWSE); } // init filters if (isAccessible(HrmViewsRepository.Timing.TimingProperties.clock)) { timingPart.addFilterToClock(new ViewerFilter() { /** * {@inheritDoc} * * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ public boolean select(Viewer viewer, Object parentElement, Object element) { return (element instanceof String && element.equals("")) || (element instanceof HardwareClock); //$NON-NLS-1$ } }); // Start of user code for additional businessfilters for clock // End of user code } // init values for referenced views // init filters for referenced views } setInitializing(false); }
/** * {@inheritDoc} * * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject, * org.eclipse.emf.ecore.resource.ResourceSet) * */ public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) { setInitializing(true); if (editingPart != null && key == partKey) { editingPart.setContext(elt, allResource); final HardwareSensor hardwareSensor = (HardwareSensor)elt; final TimingPropertiesEditionPart timingPart = (TimingPropertiesEditionPart)editingPart; // init values if (isAccessible(HrmViewsRepository.Timing.TimingProperties.clock)) { // init part clockSettings = new EObjectFlatComboSettings(hardwareSensor, HrmPackage.eINSTANCE.getHardwareResource_Clock()); timingPart.initClock(clockSettings); // set the button mode timingPart.setClockButtonMode(ButtonsModeEnum.BROWSE); } // init filters if (isAccessible(HrmViewsRepository.Timing.TimingProperties.clock)) { timingPart.addFilterToClock(new ViewerFilter() { /** * {@inheritDoc} * * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ public boolean select(Viewer viewer, Object parentElement, Object element) { return (element instanceof String && element.equals("")) || (element instanceof HardwareClock); //$NON-NLS-1$ } }); // Start of user code for additional businessfilters for clock // End of user code } // init values for referenced views // init filters for referenced views } setInitializing(false); }
/** * {@inheritDoc} * * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject, * org.eclipse.emf.ecore.resource.ResourceSet) * */ public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) { setInitializing(true); if (editingPart != null && key == partKey) { editingPart.setContext(elt, allResource); final HardwareMemory hardwareMemory = (HardwareMemory)elt; final TimingPropertiesEditionPart timingPart = (TimingPropertiesEditionPart)editingPart; // init values if (isAccessible(HrmViewsRepository.Timing.TimingProperties.clock)) { // init part clockSettings = new EObjectFlatComboSettings(hardwareMemory, HrmPackage.eINSTANCE.getHardwareResource_Clock()); timingPart.initClock(clockSettings); // set the button mode timingPart.setClockButtonMode(ButtonsModeEnum.BROWSE); } if (isAccessible(HrmViewsRepository.Timing.TimingProperties.timings)) timingPart.setTimings(hardwareMemory.getTimings()); // init filters if (isAccessible(HrmViewsRepository.Timing.TimingProperties.clock)) { timingPart.addFilterToClock(new ViewerFilter() { /** * {@inheritDoc} * * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ public boolean select(Viewer viewer, Object parentElement, Object element) { return (element instanceof String && element.equals("")) || (element instanceof HardwareClock); //$NON-NLS-1$ } }); // Start of user code for additional businessfilters for clock // End of user code } // init values for referenced views // init filters for referenced views } setInitializing(false); }
@Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // TODO Auto-generated method stub }
@Override public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // ignore }
@Override public void inputChanged(Viewer v, Object oldInput, Object newInput) { // ignore }
/** * {@inheritDoc} * * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject, * org.eclipse.emf.ecore.resource.ResourceSet) * */ public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) { setInitializing(true); if (editingPart != null && key == partKey) { editingPart.setContext(elt, allResource); final StorageResource storageResource = (StorageResource)elt; final OtherPropertiesEditionPart otherPart = (OtherPropertiesEditionPart)editingPart; // init values if (isAccessible(GrmViewsRepository.Other.OtherProperties.pServices)) { pServicesSettings = new ReferencesTableSettings(storageResource, GrmPackage.eINSTANCE.getResource_PServices()); otherPart.initPServices(pServicesSettings); } if (isAccessible(GrmViewsRepository.Other.OtherProperties.rServices)) { rServicesSettings = new ReferencesTableSettings(storageResource, GrmPackage.eINSTANCE.getResource_RServices()); otherPart.initRServices(rServicesSettings); } // init filters if (isAccessible(GrmViewsRepository.Other.OtherProperties.pServices)) { otherPart.addFilterToPServices(new ViewerFilter() { /** * {@inheritDoc} * * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ public boolean select(Viewer viewer, Object parentElement, Object element) { return (element instanceof String && element.equals("")) || (element instanceof ResourceService); //$NON-NLS-1$ } }); // Start of user code for additional businessfilters for pServices // End of user code } if (isAccessible(GrmViewsRepository.Other.OtherProperties.rServices)) { otherPart.addFilterToRServices(new EObjectFilter(GrmPackage.Literals.RESOURCE_SERVICE)); // Start of user code for additional businessfilters for rServices // End of user code } // init values for referenced views // init filters for referenced views } setInitializing(false); }
/** * {@inheritDoc} * * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject, * org.eclipse.emf.ecore.resource.ResourceSet) * */ public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) { setInitializing(true); if (editingPart != null && key == partKey) { editingPart.setContext(elt, allResource); final BatchProcess batchProcess = (BatchProcess)elt; final BatchProcessPropertiesEditionPart basePart = (BatchProcessPropertiesEditionPart)editingPart; // init values if (isAccessible(MetamodelViewsRepository.BatchProcess.Properties.name)) basePart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, batchProcess.getName())); if (isAccessible(MetamodelViewsRepository.BatchProcess.Properties.duration)) { // init part durationSettings = new EObjectFlatComboSettings(batchProcess, MetamodelPackage.eINSTANCE.getProcess_Duration()); basePart.initDuration(durationSettings); } if (isAccessible(MetamodelViewsRepository.BatchProcess.Properties.storageOutputFlow)) { storageOutputFlowSettings = new ReferencesTableSettings(batchProcess, MetamodelPackage.eINSTANCE.getProcess_StorageOutputFlow()); basePart.initStorageOutputFlow(storageOutputFlowSettings); } if (isAccessible(MetamodelViewsRepository.BatchProcess.Properties.percentageOfSuccess)) basePart.setPercentageOfSuccess(EEFConverterUtil.convertToString(MetamodelPackage.Literals.PERCENT, batchProcess.getPercentageOfSuccess())); if (isAccessible(MetamodelViewsRepository.BatchProcess.Properties.numberOfLines)) basePart.setNumberOfLines(EEFConverterUtil.convertToString(MetamodelPackage.Literals.POSITIVE_INT_NOT_NULL, batchProcess.getNumberOfChains())); if (isAccessible(MetamodelViewsRepository.BatchProcess.Properties.outputs)) { outputsSettings = new ReferencesTableSettings(batchProcess, MetamodelPackage.eINSTANCE.getBatchProcess_Outputs()); basePart.initOutputs(outputsSettings); } // init filters if (isAccessible(MetamodelViewsRepository.BatchProcess.Properties.storageOutputFlow)) { basePart.addFilterToStorageOutputFlow(new EObjectFilter(MetamodelPackage.Literals.STORAGE_OUTPUT_FLOW)); // Start of user code for additional businessfilters for storageOutputFlow // End of user code } if (isAccessible(MetamodelViewsRepository.BatchProcess.Properties.outputs)) { basePart.addFilterToOutputs(new ViewerFilter() { /** * {@inheritDoc} * * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ public boolean select(Viewer viewer, Object parentElement, Object element) { return (element instanceof String && element.equals("")) || (element instanceof Output); //$NON-NLS-1$ } }); // Start of user code for additional businessfilters for outputs // End of user code } // init values for referenced views // init filters for referenced views } setInitializing(false); }