org.eclipse.jface.viewers.ICheckStateListener Java Examples

The following examples show how to use org.eclipse.jface.viewers.ICheckStateListener. 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: 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 #2
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 #3
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 #4
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 #5
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 #6
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 #7
Source File: ImportTraceWizardPage.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Create the import source selection widget. (Copied from
 * WizardResourceImportPage but instead always uses the internal
 * ResourceTreeAndListGroup to keep compatibility with Kepler)
 */
@Override
protected void createFileSelectionGroup(Composite parent) {

    // Just create with a dummy root.
    fSelectionGroup = new ResourceTreeAndListGroup(parent,
            new FileSystemElement("Dummy", null, true), //$NON-NLS-1$
            getFolderProvider(), new WorkbenchLabelProvider(),
            getFileProvider(), new WorkbenchLabelProvider(), SWT.NONE,
            DialogUtil.inRegularFontMode(parent));

    ICheckStateListener listener = event -> updateWidgetEnablements();

    WorkbenchViewerComparator comparator = new WorkbenchViewerComparator();
    fSelectionGroup.setTreeComparator(comparator);
    fSelectionGroup.setListComparator(comparator);
    fSelectionGroup.addCheckStateListener(listener);

}
 
Example #8
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 #9
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 #10
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 #11
Source File: PackageFilterEditor.java    From eclipse-cs with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Creates the tree viewer.
 *
 * @param parent
 *          the parent composite
 * @return the tree viewer
 */
protected CheckboxTreeViewer createTreeViewer(Composite parent) {

  mViewer = new CheckboxTreeViewer(parent, SWT.BORDER);
  mViewer.setContentProvider(mContentProvider);
  mViewer.setLabelProvider(mLabelProvider);

  mViewer.addCheckStateListener(new ICheckStateListener() {
    @Override
    public void checkStateChanged(CheckStateChangedEvent event) {

      IContainer element = (IContainer) event.getElement();

      if (isRecursivelyExcludeSubTree() && !isGrayed(element)) {
        setSubElementsGrayedChecked(element, event.getChecked());
      } else if (isRecursivelyExcludeSubTree() && isGrayed(element)) {
        mViewer.setGrayChecked(element, true);
      }
    }
  });

  mViewer.setInput(mInput);
  mViewer.setCheckedElements(getInitialElementSelections().toArray());
  adaptRecurseBehaviour();
  if (mExpandedElements != null) {
    mViewer.setExpandedElements(mExpandedElements);
  }

  return mViewer;
}
 
Example #12
Source File: InvoiceCorrectionWizard.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createControl(Composite parent){
	container = new Composite(parent, SWT.NONE);
	container.setLayout(new GridLayout(1, false));
	
	Composite tableComp = new Composite(container, SWT.NONE);
	tableComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	viewer = CheckboxTableViewer.newCheckList(tableComp,
		SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	viewer.getTable().setLinesVisible(true);
	viewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	viewer.setContentProvider(new ArrayContentProvider());
	viewer.setInput(invoiceCorrectionDTO.getHistory());
	viewer.addCheckStateListener(new ICheckStateListener() {
		
		@Override
		public void checkStateChanged(CheckStateChangedEvent event){
			viewer.setChecked(event.getElement(), !event.getChecked());
		}
	});
	viewer.setLabelProvider(new WizardLabelProvider());
	
	TableColumn singleColumn = new TableColumn(viewer.getTable(), SWT.NONE);
	TableColumnLayout tableColumnLayout = new TableColumnLayout();
	tableColumnLayout.setColumnData(singleColumn, new ColumnWeightData(100));
	tableComp.setLayout(tableColumnLayout);
	
	
	Label lblOutput = new Label(container, SWT.NONE);
	lblOutput.setText("Ausgabe");
	GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
	gd.heightHint = 100;
	txtOutput =
		new Text(container,
		SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL | SWT.READ_ONLY);
	txtOutput.setLayoutData(gd);
	setControl(container);
	setPageComplete(!invoiceCorrectionDTO.getHistory().isEmpty());
}
 
Example #13
Source File: CompositeFactory.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
public static ContainerCheckedTreeViewer createCheckedTreeViewer(final AbstractDialog dialog, final Composite parent, final int height, final int span) {
    final GridData gridData = new GridData();
    gridData.heightHint = height;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalSpan = span;

    final ContainerCheckedTreeViewer viewer = new ContainerCheckedTreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    final Tree tree = viewer.getTree();
    tree.setLayoutData(gridData);

    viewer.setContentProvider(new TreeNodeContentProvider());
    viewer.setLabelProvider(new ViewLabelProvider());

    if (dialog != null) {
        viewer.addCheckStateListener(new ICheckStateListener() {

            @Override
            public void checkStateChanged(final CheckStateChangedEvent event) {
                dialog.validate();
            }

        });
    }

    return viewer;
}
 
Example #14
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 #15
Source File: AbstractSelectImportedObjectDialog.java    From erflute with Apache License 2.0 5 votes vote down vote up
private void setListener() {
    viewer.addCheckStateListener(new ICheckStateListener() {

        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            validate();
        }
    });
}
 
Example #16
Source File: SelectImportedSchemaDialog.java    From erflute with Apache License 2.0 5 votes vote down vote up
private void setListener() {
    viewer.addCheckStateListener(new ICheckStateListener() {

        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            validate();
        }
    });
}
 
Example #17
Source File: ExtractInterfaceWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private void addMemberListComposite(Composite result) {
	Composite composite= new Composite(result, SWT.NONE);
	GridLayout layout= new GridLayout();
	layout.numColumns= 2;
	layout.marginWidth= 0;
	layout.marginHeight= 0;
	composite.setLayout(layout);
	GridData gd= new GridData(GridData.FILL_BOTH);
	gd.heightHint= convertHeightInCharsToPixels(12);
	gd.horizontalSpan= 2;
	composite.setLayoutData(gd);

	fTableViewer= CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
	fTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
	fTableViewer.setLabelProvider(createLabelProvider());
	fTableViewer.setContentProvider(new ArrayContentProvider());
	try {
		fTableViewer.setInput(getExtractableMembers());
	} catch (JavaModelException e) {
		ExceptionHandler.handle(e, RefactoringMessages.ExtractInterfaceInputPage_Extract_Interface, RefactoringMessages.ExtractInterfaceInputPage_Internal_Error);
		fTableViewer.setInput(new IMember[0]);
	}
	fTableViewer.addCheckStateListener(new ICheckStateListener(){
		public void checkStateChanged(CheckStateChangedEvent event) {
			ExtractInterfaceInputPage.this.updateUIElementEnablement();
		}
	});
	fTableViewer.setComparator(new JavaElementComparator());
	fTableViewer.getControl().setEnabled(anyMembersToExtract());

	createButtonComposite(composite);
}
 
Example #18
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 #19
Source File: AbstractSelectImportedObjectDialog.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
private void setListener() {
	this.viewer.addCheckStateListener(new ICheckStateListener() {

		public void checkStateChanged(CheckStateChangedEvent event) {
			validate();
		}

	});
}
 
Example #20
Source File: JavadocTreeWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void createInputGroup(Composite composite) {

		createLabel(composite, SWT.NONE, JavadocExportMessages.JavadocTreeWizardPage_checkboxtreeandlistgroup_label, createGridData(6));
		Composite c= new Composite(composite, SWT.NONE);
		GridLayout layout= new GridLayout();
		layout.numColumns= 1;
		layout.makeColumnsEqualWidth= true;
		layout.marginWidth= 0;
		layout.marginHeight= 0;
		c.setLayout(layout);
		c.setLayoutData(createGridData(GridData.FILL_BOTH, 6, 0));

		ITreeContentProvider treeContentProvider= new JavadocProjectContentProvider();
		ITreeContentProvider listContentProvider= new JavadocMemberContentProvider();
		fInputGroup= new CheckboxTreeAndListGroup(c, this, treeContentProvider, new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT), listContentProvider, new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT), SWT.NONE, convertWidthInCharsToPixels(60), convertHeightInCharsToPixels(7));

		fInputGroup.addCheckStateListener(new ICheckStateListener() {
			public void checkStateChanged(CheckStateChangedEvent e) {
				doValidation(TREESTATUS);
			}
		});
		fInputGroup.setTreeComparator(new JavaElementComparator());

		SWTUtil.setAccessibilityText(fInputGroup.getTree(), JavadocExportMessages.JavadocTreeWizardPage_tree_accessibility_message);
		SWTUtil.setAccessibilityText(fInputGroup.getTable(), JavadocExportMessages.JavadocTreeWizardPage_table_accessibility_message);

		IJavaElement[] elements= fStore.getInitialElements();
		setTreeChecked(elements);
		if (elements.length > 0) {
			fInputGroup.setTreeSelection(new StructuredSelection(elements[0].getJavaProject()));
		}

		fInputGroup.aboutToOpen();
	}
 
Example #21
Source File: EnhancedCheckBoxTableViewer.java    From eclipse-cs with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Notifies any check state listeners that a check state changed has been received. Only listeners
 * registered at the time this method is called are notified.
 *
 * @param event
 *          a check state changed event
 * @see ICheckStateListener#checkStateChanged
 */
private void fireCheckStateChanged(final CheckStateChangedEvent event) {
  Object[] array = checkStateListeners.getListeners();
  for (int i = 0; i < array.length; i++) {
    final ICheckStateListener l = (ICheckStateListener) array[i];
    SafeRunnable.run(new SafeRunnable() {
      @Override
      public void run() {
        l.checkStateChanged(event);
      }
    });
  }
}
 
Example #22
Source File: SelectImportedSchemaDialog.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
private void setListener() {
	this.viewer.addCheckStateListener(new ICheckStateListener() {

		public void checkStateChanged(CheckStateChangedEvent event) {
			validate();
		}

	});
}
 
Example #23
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 #24
Source File: ShowSummaryFieldDialog.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private void createSummaryFiledViewer( Composite dialogArea )
{
	Table table = new Table( dialogArea, SWT.BORDER
			| SWT.SINGLE
			| SWT.H_SCROLL
			| SWT.V_SCROLL
			| SWT.FULL_SELECTION
			| SWT.CHECK );
	table.setLinesVisible( true );
	table.setHeaderVisible( true );

	GridData gd = new GridData( GridData.FILL_BOTH );
	gd.heightHint = 250;
	table.setLayoutData( gd );

	summaryFieldViewer = new CheckboxTableViewer( table );
	SummaryFieldProvider provider = new SummaryFieldProvider( );

	for ( int i = 0; i < columnNames.length; i++ )
	{
		TableColumn column = new TableColumn( table, SWT.LEFT );
		column.setText( columnNames[i] );
		column.setWidth( columnWidth[i] );
	}
	ComboBoxCellEditor comboCell = new ComboBoxCellEditor( table,
			new String[0],
			SWT.READ_ONLY );
	// TextCellEditor textCell = new TextCellEditor(table, SWT.NONE);
	cellEditor = new CellEditor[]{
			null, comboCell
	};
	summaryFieldViewer.setColumnProperties( columnNames );
	summaryFieldViewer.setCellEditors( cellEditor );
	summaryFieldViewer.setCellModifier( cellModifier );
	summaryFieldViewer.setUseHashlookup( true );
	summaryFieldViewer.setContentProvider( provider );
	summaryFieldViewer.setLabelProvider( provider );

	summaryFieldViewer.addCheckStateListener( new ICheckStateListener( ) {

		public void checkStateChanged( CheckStateChangedEvent event )
		{
			MeasureInfo info = (MeasureInfo) event.getElement( );
			if ( event.getChecked( ) )
			{
				info.setShow( true );
			}
			else
			{
				info.setShow( false );
			}
			checkOKButtonStatus( );
		}

	} );
}
 
Example #25
Source File: CordovaPluginCatalogViewer.java    From thym with Eclipse Public License 1.0 4 votes vote down vote up
public void addCheckStateListener(ICheckStateListener listener) {
	pluginTreeViewer.addCheckStateListener(listener);
}
 
Example #26
Source File: EnhancedCheckBoxTableViewer.java    From eclipse-cs with GNU Lesser General Public License v2.1 4 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void addCheckStateListener(ICheckStateListener listener) {
  checkStateListeners.add(listener);
}
 
Example #27
Source File: PyConfigureExceptionDialog.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
    // page group
    Composite composite = (Composite) super.createDialogArea(parent);

    initializeDialogUnits(composite);

    createMessageArea(composite);

    listViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
    data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
    listViewer.getTable().setLayoutData(data);

    listViewer.setLabelProvider(labelProvider);
    listViewer.setContentProvider(contentProvider);

    createSelectionButtons(composite);

    initContent();
    // initialize page
    if (!getInitialElementSelections().isEmpty()) {
        checkInitialSelections();
    }

    Dialog.applyDialogFont(composite);

    getViewer().addFilter(new ViewerFilter() {
        @Override
        public boolean select(Viewer viewer, Object parentElement, Object element) {
            if (getCheckBoxTableViewer().getChecked(element)) {
                addToSelectedElements(element);
            }
            return matchExceptionToShowInList(element);
        }
    });

    getCheckBoxTableViewer().addCheckStateListener(new ICheckStateListener() {
        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            if (event.getChecked()) {
                addToSelectedElements(event.getElement());
            } else {
                removeFromSelectedElements(event.getElement());
            }
        }
    });

    createCustomExceptionUI(composite);
    createDealingWithExceptionsOptions(composite);

    return composite;
}
 
Example #28
Source File: CodeAssistAdvancedConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void createSeparateViewer(Composite composite) {
	fSeparateViewer= CheckboxTableViewer.newCheckList(composite, SWT.SINGLE | SWT.BORDER);
	Table table= fSeparateViewer.getTable();
	table.setHeaderVisible(false);
	table.setLinesVisible(false);
	table.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 1, 1));

	TableColumn nameColumn= new TableColumn(table, SWT.NONE);
	nameColumn.setText(PreferencesMessages.CodeAssistAdvancedConfigurationBlock_separate_table_category_column_title);
	nameColumn.setResizable(false);

	fSeparateViewer.setContentProvider(new ArrayContentProvider());

	ITableLabelProvider labelProvider= new SeparateTableLabelProvider();
	fSeparateViewer.setLabelProvider(labelProvider);
	fSeparateViewer.setInput(fModel.elements);

	final int ICON_AND_CHECKBOX_WITH= 50;
	final int HEADER_MARGIN= 20;
	int minNameWidth= computeWidth(table, nameColumn.getText()) + HEADER_MARGIN;
	for (int i= 0; i < fModel.elements.size(); i++) {
		minNameWidth= Math.max(minNameWidth, computeWidth(table, labelProvider.getColumnText(fModel.elements.get(i), 0)) + ICON_AND_CHECKBOX_WITH);
	}

	nameColumn.setWidth(minNameWidth);

	fSeparateViewer.addCheckStateListener(new ICheckStateListener() {
		public void checkStateChanged(CheckStateChangedEvent event) {
			boolean checked= event.getChecked();
			ModelElement element= (ModelElement) event.getElement();
			element.setSeparateCommand(checked);
		}
	});

	table.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			handleTableSelection();
		}
	});

}
 
Example #29
Source File: CodeAssistAdvancedConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void createDefaultViewer(Composite composite, int h_span) {
	fDefaultViewer= CheckboxTableViewer.newCheckList(composite, SWT.SINGLE | SWT.BORDER);
	Table table= fDefaultViewer.getTable();
	table.setHeaderVisible(true);
	table.setLinesVisible(false);
	table.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, h_span, 1));

	TableColumn nameColumn= new TableColumn(table, SWT.NONE);
	nameColumn.setText(PreferencesMessages.CodeAssistAdvancedConfigurationBlock_default_table_category_column_title);
	nameColumn.setResizable(false);
	TableColumn keyColumn= new TableColumn(table, SWT.NONE);
	keyColumn.setText(PreferencesMessages.CodeAssistAdvancedConfigurationBlock_default_table_keybinding_column_title);
	keyColumn.setResizable(false);

	fDefaultViewer.addCheckStateListener(new ICheckStateListener() {
		public void checkStateChanged(CheckStateChangedEvent event) {
			boolean checked= event.getChecked();
			ModelElement element= (ModelElement) event.getElement();
			element.setInDefaultCategory(checked);
		}
	});

	fDefaultViewer.setContentProvider(new ArrayContentProvider());

	DefaultTableLabelProvider labelProvider= new DefaultTableLabelProvider();
	fDefaultViewer.setLabelProvider(labelProvider);
	fDefaultViewer.setInput(fModel.elements);
	fDefaultViewer.setComparator(new ViewerComparator()); // sort alphabetically

	final int ICON_AND_CHECKBOX_WITH= 50;
	final int HEADER_MARGIN= 20;
	int minNameWidth= computeWidth(table, nameColumn.getText()) + HEADER_MARGIN;
	int minKeyWidth= computeWidth(table, keyColumn.getText()) + HEADER_MARGIN;
	for (int i= 0; i < fModel.elements.size(); i++) {
		minNameWidth= Math.max(minNameWidth, computeWidth(table, labelProvider.getColumnText(fModel.elements.get(i), 0)) + ICON_AND_CHECKBOX_WITH);
		minKeyWidth= Math.max(minKeyWidth, computeWidth(table, labelProvider.getColumnText(fModel.elements.get(i), 1)));
	}

	nameColumn.setWidth(minNameWidth);
	keyColumn.setWidth(minKeyWidth);
}
 
Example #30
Source File: CheckboxTreeAndListGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
 *	Notifies all checked state listeners that the passed element has had
 *	its checked state changed to the passed state
 * @param event
 */
protected void notifyCheckStateChangeListeners(CheckStateChangedEvent event) {
	Iterator<ICheckStateListener> listenersEnum= fListeners.iterator();
	while (listenersEnum.hasNext())
		 listenersEnum.next().checkStateChanged(event);
}