Java Code Examples for org.eclipse.jface.viewers.CheckStateChangedEvent#getElement()

The following examples show how to use org.eclipse.jface.viewers.CheckStateChangedEvent#getElement() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CheckConfigurationConfigureDialog.java    From eclipse-cs with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
  if (mConfigurable) {
    Module module = (Module) event.getElement();

    if (event.getChecked()) {
      // restore last severity before setting to ignore
      Severity lastEnabled = module.getLastEnabledSeverity();
      if (lastEnabled != null) {
        module.setSeverity(lastEnabled);
      } else {
        module.setSeverity(module.getMetaData().getDefaultSeverityLevel());
      }
    } else {
      module.setSeverity(Severity.ignore);
    }
    mIsDirty = true;
    mTableViewer.refresh(module, true);
  }
  refreshTableViewerState();
}
 
Example 2
Source File: ChartMakerDialog.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void checkStateChanged(@Nullable CheckStateChangedEvent event) {
    if (event == null) {
        return;
    }

    /* Set Y filter if needed */
    if (event.getChecked()) {
        if (fYFilter == null) {
            IDataChartDescriptor<?, ?> descriptor = (IDataChartDescriptor<?, ?>) event.getElement();
            fYFilter = descriptor;
        }
    } else {
        tryResetYFilter();
    }

    /* Refresh controls */
    fSelectionYTable.refresh();
    fAddButton.setEnabled(checkIfButtonReady());

    configureLogscaleCheckboxes();
}
 
Example 3
Source File: TimeGraphFilterDialog.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
    try {
        ITimeGraphEntry entry = (ITimeGraphEntry) event.getElement();
        boolean checked = event.getChecked();
        if (checked) {
            checkElement(entry);
        } else {
            uncheckElement(entry);
        }
    } catch (ClassCastException e) {
        return;
    } finally {
        updateOKStatus();
    }
}
 
Example 4
Source File: LabItemTreeSelectionComposite.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
private void rememberLeafCheckState(CheckStateChangedEvent event){
	Object[] checked = laborViewer.getCheckedElements();
	if (checkState == null) {
		checkState = new ArrayList<GroupItem>(checked.length);
	}
	for (int i = 0; i < checked.length; i++) {
		if (!laborViewer.getGrayed(checked[i])) {
			if (!checkState.contains(checked[i])) {
				if (checked[i] instanceof GroupItem) {
					checkState.add((GroupItem) checked[i]);
				} else
					if ((checked[i] instanceof Group) && (event.getElement() == checked[i])) {
					checkState.addAll(((Group) checked[i]).getItems());
				}
			}
		}
	}
}
 
Example 5
Source File: ExportBarWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void checkStateChanged(final CheckStateChangedEvent event) {
    final Object element = event.getElement();
    if (element instanceof MainProcess) {
        viewer.setGrayChecked(element, false);
        viewer.setChecked(element, event.getChecked());
        for (final AbstractProcess proc : ModelHelper.getAllProcesses((Element) element)) {
            viewer.setChecked(proc, event.getChecked());
            if (event.getChecked()) {
                selectedProcess.add(proc);
            } else {
                selectedProcess.remove(proc);
            }
        }
    }
    if (element instanceof Pool) {
        final MainProcess diagram = ModelHelper.getMainProcess((EObject) element);
        viewer.setGrayChecked(diagram, false);
        if (isGrayed(diagram)) {
            viewer.setGrayChecked(diagram, true);
        } else {
            viewer.setChecked(diagram, event.getChecked());
        }
    }
}
 
Example 6
Source File: ProblemsTreeEditor.java    From cppcheclipse with Apache License 2.0 6 votes vote down vote up
public void checkStateChanged(CheckStateChangedEvent event) {
	Object element = event.getElement();
	// in case of changed category, go to all problems
	if (element instanceof String) {
		ITreeContentProvider contentProvider = (ITreeContentProvider)getTreeViewer().getContentProvider();
		Object[] problems = contentProvider.getChildren(element);
		for (Object problem : problems) {
			if (problem instanceof Problem) {
				((Problem)problem).setEnabled(event.getChecked());
			}
		}
	}
	
	if (element instanceof Problem) {
		((Problem) element).setEnabled(event.getChecked());
	}

}
 
Example 7
Source File: TableCheckStateManager.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
	// Update the underlying TreeProperty. If its value did not change,
	// revert the checkbox to the previous state.
	Object element = event.getElement();
	if (!setValue(element, event.getChecked())) {
		viewer.refresh(element);
	}
}
 
Example 8
Source File: WebSearchPreferencePage.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * (non-Javadoc)
 * @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent)
 */
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
	Object element = event.getElement();
	if (element instanceof SearchEntry) {
		SearchEntry searchEntry = (SearchEntry) element;
		if (searchEntry.isChecked() != event.getChecked()) {
			searchEntry.setChecked(event.getChecked());
			setDirty(true);
		}
	}
}
 
Example 9
Source File: MultipleFolderSelectionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void forceExistingChecked(CheckStateChangedEvent event) {
	if (fExisting != null) {
		Object elem= event.getElement();
		if (fExisting.contains(elem)) {
			fViewer.setChecked(elem, true);
		}
	}
}
 
Example 10
Source File: AbstractDependenciesConfigurationWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void checkStateChanged(final CheckStateChangedEvent event) {
    final Object element = event.getElement();
    if (element instanceof Fragment) {
        ((Fragment) element).setExported(event.getChecked());
    }
    if (element instanceof FragmentContainer) {
        updateChildrenState((FragmentContainer) element, event.getChecked());
    }
    updateParentSate(element);

    getContainer().updateMessage();
}
 
Example 11
Source File: ConstraintAttributeCheckListener.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void checkStateChanged(CheckStateChangedEvent e) {
    Field element = (Field) e.getElement();
    if (e.getChecked()) {
        selectedConstraintObservable.getValue().getFieldNames().add(element.getName());
    } else {
        selectedConstraintObservable.getValue().getFieldNames().remove(element.getName());
    }
    selectedAttributeObservable.setValue(element);
    constraintViewer.refresh(selectedConstraintObservable.getValue());
    formPage.updateDefaultQueries();
}
 
Example 12
Source File: RepositoryImportWizard.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
	viewer.getControl().setRedraw(false);
	Node element = (Node) event.getElement();
	viewer.setGrayed(element, false);
	updateChildren(element, event.getChecked());
	updateParent(element);
	if (element.data != null) {
		updateSelection(element, event.getChecked());
	}
	viewer.getControl().setRedraw(true);
}
 
Example 13
Source File: ModelCheckBoxTree.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void checkStateChanged(CheckStateChangedEvent evt) {
	tree.getControl().setRedraw(false);
	INavigationElement<?> elem = (INavigationElement<?>) evt.getElement();
	tree.setGrayed(elem, false);
	checkChildren(elem, evt.getChecked());
	checkParent(elem);
	tree.getControl().setRedraw(true);
	if (onChange != null) {
		onChange.run();
	}
}
 
Example 14
Source File: CheckstylePropertyPage.java    From eclipse-cs with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void checkStateChanged(CheckStateChangedEvent event) {

  Object element = event.getElement();
  if (element instanceof IFilter) {
    IFilter filter = (IFilter) element;
    if (!filter.isReadonly()) {
      filter.setEnabled(event.getChecked());
    } else {
      event.getCheckable().setChecked(event.getElement(), true);
    }
  }
}
 
Example 15
Source File: ValidPreferenceCheckedTreeViewer.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
public void checkStateChanged(final CheckStateChangedEvent event) {
  // If the item is checked . . .
  update(event.getElement(), null);

  if (event.getElement() instanceof PreferenceRule) {
    ruleChecked(event, (PreferenceRule) event.getElement());
  } else if (event.getElement() instanceof PreferenceCategory) {
    categoryChecked(event, (PreferenceCategory) event.getElement());
  }
}
 
Example 16
Source File: FilterBugsDialog.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
    Object element = event.getElement();
    boolean checked = event.getChecked();

    elementChecked(element, checked);
    updateTextIds();
}
 
Example 17
Source File: FieldToContractInputMappingViewerCheckStateManager.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void checkStateChanged(final CheckStateChangedEvent event) {
    FieldToContractInputMapping mapping = (FieldToContractInputMapping) event.getElement();
    mapping.setGenerated(event.getChecked());
    setGeneratedStatePersistenceIdChild(mapping, event.getChecked());
    CheckboxTreeViewer checkboxTreeViewer = (CheckboxTreeViewer) event.getSource();
    checkboxTreeViewer.setSubtreeChecked(mapping, event.getChecked());
    setChildrenChecked(mapping, event.getChecked());
    selectParentIfChildIsSelected(event, mapping, checkboxTreeViewer);
    deselectParentIfNoChildSelected(event, mapping, checkboxTreeViewer);
    checkboxTreeViewer.getControl().getDisplay().asyncExec(() -> checkboxTreeViewer.refresh());
}
 
Example 18
Source File: ComplexFileSetsEditor.java    From eclipse-cs with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void changeEnabledState(CheckStateChangedEvent event) {
  if (event.getElement() instanceof FileSet) {
    FileSet fileSet = (FileSet) event.getElement();
    fileSet.setEnabled(event.getChecked());
    mViewer.refresh();
  }
}
 
Example 19
Source File: NavigationTreeCheck.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
	viewer.getControl().setRedraw(false);
	Object element = event.getElement();
	viewer.setGrayed(element, false);
	if (element instanceof INavigationElement) {
		INavigationElement<?> naviElement = (INavigationElement<?>) element;
		updateChildren(naviElement, event.getChecked());
		updateParent(naviElement);
	}
	viewer.getControl().setRedraw(true);
}
 
Example 20
Source File: WhiteSpaceTabPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
public void checkStateChanged(CheckStateChangedEvent event) {
	final Node node= (Node)event.getElement();
	node.setChecked(event.getChecked());
	doUpdatePreview();
	notifyValuesModified();
}