org.eclipse.jface.viewers.CheckStateChangedEvent Java Examples

The following examples show how to use org.eclipse.jface.viewers.CheckStateChangedEvent. 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: OverrideMethodsPage.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
private void createTreeViewer(Composite treeComp) {
    treeViewer = new ContainerCheckedTreeViewer(treeComp);
    treeViewer.addCheckStateListener(new ICheckStateListener() {
        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            processSelectionChange();
        }
    });

    treeViewer.setContentProvider(classProvider);
    treeViewer.setLabelProvider(labelProvider);
    treeViewer.setAutoExpandLevel(2);
    // treeViewer.addFilter(new MethodViewerFilter());
    treeViewer.setUseHashlookup(true);
    treeViewer.setInput("");
    treeViewer.setSelection(new StructuredSelection(treeViewer.getExpandedElements()[0]));
}
 
Example #2
Source File: MultipleFolderSelectionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Creates the tree viewer.
 *
 * @param parent the parent composite
 * @return the tree viewer
 */
protected CheckboxTreeViewer createTreeViewer(Composite parent) {
	fViewer = new CheckboxTreeViewer(parent, SWT.BORDER);

	fViewer.setContentProvider(fContentProvider);
	fViewer.setLabelProvider(fLabelProvider);
	fViewer.addCheckStateListener(new ICheckStateListener() {
		public void checkStateChanged(CheckStateChangedEvent event) {
			updateOKStatus();
		}
	});

	fViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
	if (fFilters != null) {
		for (int i = 0; i != fFilters.size(); i++)
			fViewer.addFilter(fFilters.get(i));
	}

	fViewer.setInput(fInput);

	return fViewer;
}
 
Example #3
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 #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: PathsProvider.java    From spotbugs with GNU Lesser General Public License v2.1 6 votes vote down vote up
protected PathsProvider(TableViewer viewer, FindbugsPropertyPage propertyPage) {
    this.propertyPage = propertyPage;
    this.paths = new ArrayList<>();
    this.viewer = viewer;
    if (viewer instanceof CheckboxTableViewer) {
        CheckboxTableViewer tv = (CheckboxTableViewer) viewer;
        tv.setCheckStateProvider(this);
        tv.addCheckStateListener(new ICheckStateListener() {
            @Override
            public void checkStateChanged(CheckStateChangedEvent event) {
                boolean checked = event.getChecked();
                IPathElement element = (IPathElement) event.getElement();
                element.setEnabled(checked);
                handleContendChanged();
            }
        });
    }
    this.control = viewer.getTable();
    listeners = new ListenerList();
    viewer.setContentProvider(this);
}
 
Example #6
Source File: SDKsPreferencePage.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
    if (isCancelEvents) return;
    try{
        isCancelEvents = true;

        Sdk activeSdk = sdkRegistry.getDefaultSdk();
        if (activeSdk == event.getElement() && !event.getChecked()) {
            sdkTableViewer.setChecked(activeSdk, true);
        }
        else if (activeSdk != event.getElement()) {
            if (activeSdk != null) {
                sdkTableViewer.setChecked(activeSdk, false);
            }
            activeSdk = (Sdk)event.getElement();
            sdkRegistry.setDefaultSdk(activeSdk.getName());
            getApplyButton().setEnabled(true);

        }
    }
    finally{
        isCancelEvents = false;
    }
}
 
Example #7
Source File: FieldToContractInputMappingViewerCheckStateManagerTest.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void should_regeneratedAttributes_whenReselectParent() {
    final FieldToContractInputMappingViewerCheckStateManager checkedStateManager = new FieldToContractInputMappingViewerCheckStateManager();
    final FieldToContractInputMapping rootMapping = new RelationFieldToContractInputMapping(
            Mockito.mock(RelationField.class));
    final SimpleFieldToContractInputMapping childMapping1 = new SimpleFieldToContractInputMapping(
            Mockito.mock(SimpleField.class));
    final SimpleFieldToContractInputMapping childMapping2 = new SimpleFieldToContractInputMapping(
            Mockito.mock(SimpleField.class));
    rootMapping.addChild(childMapping1);
    rootMapping.addChild(childMapping2);
    final CheckboxTreeViewer viewer = aCheckBoxTreeViewer(Lists.newArrayList(rootMapping));
    checkedStateManager.checkStateChanged(new CheckStateChangedEvent(viewer, rootMapping, false));
    assertThat(rootMapping.isGenerated()).isFalse();
    assertThat(childMapping1.isGenerated()).isFalse();
    assertThat(childMapping2.isGenerated()).isFalse();
    checkedStateManager.checkStateChanged(new CheckStateChangedEvent(viewer, rootMapping, true));
    assertThat(rootMapping.isGenerated()).isTrue();
    assertThat(childMapping1.isGenerated()).isTrue();
    assertThat(childMapping2.isGenerated()).isTrue();
}
 
Example #8
Source File: FieldToContractInputMappingViewerCheckStateManagerTest.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void should_not_deselectParent_IfNoChildIsSelected() {
    final FieldToContractInputMappingViewerCheckStateManager checkedStateManager = new FieldToContractInputMappingViewerCheckStateManager();

    final FieldToContractInputMapping rootMapping = new RelationFieldToContractInputMapping(
            Mockito.mock(RelationField.class));
    final SimpleFieldToContractInputMapping childMapping1 = new SimpleFieldToContractInputMapping(
            Mockito.mock(SimpleField.class));
    final SimpleFieldToContractInputMapping childMapping2 = new SimpleFieldToContractInputMapping(
            Mockito.mock(SimpleField.class));
    rootMapping.addChild(childMapping1);
    rootMapping.addChild(childMapping2);
    final CheckboxTreeViewer viewer = aCheckBoxTreeViewer(Lists.newArrayList(rootMapping));
    checkedStateManager.checkStateChanged(new CheckStateChangedEvent(viewer, childMapping2, true));
    checkedStateManager.checkStateChanged(new CheckStateChangedEvent(viewer, childMapping1, false));

    assertThat(viewer.getChecked(rootMapping)).isTrue();
}
 
Example #9
Source File: FieldToContractInputMappingViewerCheckStateManagerTest.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void should_deselectParent_IfNoChildIsSelected() {
    final FieldToContractInputMappingViewerCheckStateManager checkedStateManager = new FieldToContractInputMappingViewerCheckStateManager();

    final FieldToContractInputMapping rootMapping = new RelationFieldToContractInputMapping(
            Mockito.mock(RelationField.class));
    final SimpleFieldToContractInputMapping childMapping = new SimpleFieldToContractInputMapping(
            Mockito.mock(SimpleField.class));
    rootMapping.addChild(childMapping);
    final CheckboxTreeViewer viewer = aCheckBoxTreeViewer(Lists.newArrayList(rootMapping));

    checkedStateManager.checkStateChanged(new CheckStateChangedEvent(viewer, childMapping, false));

    assertThat(viewer.getChecked(rootMapping)).isFalse();
    assertThat(rootMapping.isGenerated()).isFalse();
}
 
Example #10
Source File: FieldToContractInputMappingViewerCheckStateManagerTest.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void should_selectParentIfChildIsSelected() {
    final FieldToContractInputMappingViewerCheckStateManager checkedStateManager = new FieldToContractInputMappingViewerCheckStateManager();

    final FieldToContractInputMapping rootMapping = new RelationFieldToContractInputMapping(
            Mockito.mock(RelationField.class));
    final SimpleFieldToContractInputMapping childMapping = new SimpleFieldToContractInputMapping(
            Mockito.mock(SimpleField.class));
    rootMapping.addChild(childMapping);
    final CheckboxTreeViewer viewer = aCheckBoxTreeViewer(Lists.newArrayList(rootMapping));

    checkedStateManager.checkStateChanged(new CheckStateChangedEvent(viewer, childMapping, true));

    assertThat(viewer.getChecked(rootMapping)).isTrue();
    assertThat(rootMapping.isGenerated()).isTrue();
}
 
Example #11
Source File: WizardExportResourcesPage2.java    From translationstudio8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates the checkbox tree and list for selecting resources.
 * @param parent
 *            the parent control
 */
protected final void createResourcesGroup(Composite parent) {

	// create the input element, which has the root resource
	// as its only child
	List input = new ArrayList();
	IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
	for (int i = 0; i < projects.length; i++) {
		if (projects[i].isOpen()) {
			input.add(projects[i]);
		}
	}

	this.resourceGroup = new ResourceTreeAndListGroup(parent, input, getResourceProvider(IResource.FOLDER
			| IResource.PROJECT), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(),
			getResourceProvider(IResource.FILE), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(),
			SWT.NONE, DialogUtil.inRegularFontMode(parent));

	ICheckStateListener listener = new ICheckStateListener() {
		public void checkStateChanged(CheckStateChangedEvent event) {
			updateWidgetEnablements();
		}
	};

	this.resourceGroup.addCheckStateListener(listener);
}
 
Example #12
Source File: CheckedCamelDependenciesPanel.java    From tesb-studio-se with Apache License 2.0 6 votes vote down vote up
@Override
protected TableViewer createTableViewer() {
    final CheckboxTableViewer viewer = CheckboxTableViewer.newCheckList(this, SWT.MULTI | SWT.H_SCROLL
        | SWT.V_SCROLL | SWT.BORDER);
    viewer.setCheckStateProvider(checkStateProvider);
    viewer.addCheckStateListener(new ICheckStateListener() {
        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            if (((ManifestItem) event.getElement()).isBuiltIn()) {
                viewer.setChecked(event.getElement(), !event.getChecked());
            } else {
                ((ManifestItem) event.getElement()).setOptional(!event.getChecked());
                fireDependenciesChangedListener();
            }
        }
    });
    return viewer;
}
 
Example #13
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 #14
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 #15
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 #16
Source File: TaxonomyCheckboxListView.java    From slr-toolkit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
	Optional<Document> activeDocument = ModelRegistryPlugin.getModelRegistry().getActiveDocument();
	if (activeDocument.isPresent()) {
		Document document = activeDocument.get();
		Command changeCommand = new ExecuteCommand() {
			@Override
			public void execute() {
				final Term element = (Term) event.getElement();
				setTermChanged(document, element, event.getChecked());
			}
		};
		executeCommand(changeCommand);
	}
	viewer.update(event.getElement(), null);
}
 
Example #17
Source File: WizardExportResourcesPage2.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates the checkbox tree and list for selecting resources.
 * @param parent
 *            the parent control
 */
protected final void createResourcesGroup(Composite parent) {

	// create the input element, which has the root resource
	// as its only child
	List input = new ArrayList();
	IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
	for (int i = 0; i < projects.length; i++) {
		if (projects[i].isOpen()) {
			input.add(projects[i]);
		}
	}

	this.resourceGroup = new ResourceTreeAndListGroup(parent, input, getResourceProvider(IResource.FOLDER
			| IResource.PROJECT), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(),
			getResourceProvider(IResource.FILE), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(),
			SWT.NONE, DialogUtil.inRegularFontMode(parent));

	ICheckStateListener listener = new ICheckStateListener() {
		public void checkStateChanged(CheckStateChangedEvent event) {
			updateWidgetEnablements();
		}
	};

	this.resourceGroup.addCheckStateListener(listener);
}
 
Example #18
Source File: ConstructorFieldPage.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
private void createTreeViewer(Composite treeComp) {
    treeViewer = new ContainerCheckedTreeViewer(treeComp);
    treeViewer.addCheckStateListener(new ICheckStateListener() {
        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            getRequestProcessor().setCheckedElements(treeViewer.getCheckedElements());
            ConstructorFieldPage.this.getWizard().getContainer().updateButtons();
        }
    });

    treeViewer.setContentProvider(classProvider);
    treeViewer.setLabelProvider(labelProvider);
    treeViewer.setAutoExpandLevel(2);
    treeViewer.setInput("");
    treeViewer.setSelection(new StructuredSelection(treeViewer.getExpandedElements()[0]));
}
 
Example #19
Source File: GeneratePropertiesPage.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
private void createTreeViewer(Composite treeComp) {
    treeViewer = new ContainerCheckedTreeViewer(treeComp);
    treeViewer.addCheckStateListener(new ICheckStateListener() {
        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            getRequestProcsseor().setCheckedElements(treeViewer.getCheckedElements());
            GeneratePropertiesPage.this.getWizard().getContainer().updateButtons();
        }
    });

    treeViewer.setContentProvider(classProvider);
    treeViewer.setLabelProvider(labelProvider);
    treeViewer.setAutoExpandLevel(2);
    treeViewer.setInput("");
    treeViewer.setSelection(new StructuredSelection(treeViewer.getExpandedElements()[0]));
}
 
Example #20
Source File: TreeExpandingDoubleClickListener.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
public void doubleClick(DoubleClickEvent event) {
	IStructuredSelection selection = (IStructuredSelection) event
			.getSelection();
	Object firstElement = selection.getFirstElement();
	if (treeViewer.isExpandable(firstElement)) {
		boolean expanded = treeViewer.getExpandedState(firstElement);
		treeViewer.setExpandedState(firstElement, !expanded);
	} else {
		// FIXME :: does not trigger validation
		boolean newState = !treeViewer.getChecked(firstElement);
		treeViewer.setChecked(firstElement, newState);
		if (checkStateListener != null) {
			checkStateListener
					.checkStateChanged(new CheckStateChangedEvent(
							treeViewer, firstElement, newState));
		}
	}
}
 
Example #21
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 #22
Source File: CheckNodeTreeView.java    From depan with Apache License 2.0 6 votes vote down vote up
@Override
protected CheckboxTreeViewer createTreeViewer(Composite parent) {
  int style = SWT.VIRTUAL | SWT.FULL_SELECTION | SWT.BORDER
      | SWT.H_SCROLL | SWT.V_SCROLL;
  CheckboxTreeViewer result = new CheckboxTreeViewer(parent, style);
  result.setLabelProvider(new WorkbenchLabelProvider());
  result.setContentProvider(new BaseWorkbenchContentProvider());
  result.setComparator(new NodeWrapperTreeSorter());

  result.addCheckStateListener(new ICheckStateListener() {
    @Override
    public void checkStateChanged(CheckStateChangedEvent event) {
      if (recursiveTreeSelect) {
        tree.setSubtreeChecked(event.getElement(), event.getChecked());
      }
    }
  });

  tree = result;
  return result;
}
 
Example #23
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 #24
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 #25
Source File: LevelViewDialog.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private void createLevelViewer( Composite parent )
{
	levelViewer = new CheckboxTreeViewer( parent, SWT.SINGLE | SWT.BORDER );

	GridData gd = new GridData( GridData.FILL_BOTH );
	gd.widthHint = 340;
	gd.heightHint = 250;
	levelViewer.getTree( ).setLayoutData( gd );

	levelViewer.setContentProvider( new CubeContentProvider( ) );
	levelViewer.setLabelProvider( new CubeLabelProvider( ) );
	levelViewer.addCheckStateListener( new ICheckStateListener( ) {

		public void checkStateChanged( CheckStateChangedEvent event )
		{

			LevelHandle item = (LevelHandle) event.getElement( );
			if ( event.getChecked( ) )
			{
				if ( !showLevels.contains( item ) )
					showLevels.add( item );
			}
			else
			{
				if ( showLevels.contains( item ) )
					showLevels.remove( item );
			}

			checkOKButtonStatus( );
		}

	} );
}
 
Example #26
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 #27
Source File: ConfigureWorkingSetAssignementAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected CheckboxTableViewer createTableViewer(Composite parent) {

			final CheckboxTableViewer result= CheckboxTableViewer.newCheckList(parent, SWT.BORDER | SWT.MULTI);
			result.addCheckStateListener(new ICheckStateListener() {
				public void checkStateChanged(CheckStateChangedEvent event) {
					GrayedCheckedModelElement element= (GrayedCheckedModelElement)event.getElement();
					result.setGrayed(element, false);
					if (event.getChecked()) {
						element.select();
					} else {
						element.deselect();
					}
					result.update(element, null);
				}
			});
			GridData data= new GridData(GridData.FILL_BOTH);
			data.heightHint= convertHeightInCharsToPixels(20);
			data.widthHint= convertWidthInCharsToPixels(50);
			result.getTable().setLayoutData(data);

			result.addFilter(new Filter());
			result.setLabelProvider(new GrayedCheckedModelLabelProvider());
			result.setSorter(new GrayedCheckModelElementSorter());
			result.setContentProvider(new GrayedCheckedModelContentProvider());

			result.setInput(fModel);
			result.setCheckedElements(fModel.getChecked());
			result.setGrayedElements(fModel.getGrayed());

			return result;
		}
 
Example #28
Source File: CheckedListDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void doCheckStateChanged(CheckStateChangedEvent e) {
	if (e.getChecked()) {
		@SuppressWarnings("unchecked")
		E element= (E) e.getElement();
		fCheckedElements.add(element);
	} else {
		fCheckedElements.remove(e.getElement());
	}
	checkStateChanged();
}
 
Example #29
Source File: CheckedListDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected TableViewer createTableViewer(Composite parent) {
	Table table= new Table(parent, SWT.CHECK | getListStyle());
	table.setFont(parent.getFont());
	CheckboxTableViewer tableViewer= new CheckboxTableViewer(table);
	tableViewer.addCheckStateListener(new ICheckStateListener() {
		public void checkStateChanged(CheckStateChangedEvent e) {
			doCheckStateChanged(e);
		}
	});
	return tableViewer;
}
 
Example #30
Source File: SliceProfileDialog.java    From JDeodorant with MIT License 5 votes vote down vote up
public void checkStateChanged(CheckStateChangedEvent event) {
	PlainVariable element = (PlainVariable)event.getElement();
	enabledVariableMap.put(element, event.getChecked());
	int index = getColumnIndex(element);
	if(event.getChecked())
		sliceProfileTableViewer.getTable().getColumn(index).setWidth(columnWidthMap.get(element));
	else
		sliceProfileTableViewer.getTable().getColumn(index).setWidth(0);
	updateMetrics();
}