org.eclipse.swt.custom.TreeEditor Java Examples

The following examples show how to use org.eclipse.swt.custom.TreeEditor. 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: ExecutionContextLabelProvider.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
protected static void addNativeCheckbox(ViewerCell cell, Object element, Object value,
		TreeEditorDisposeListener listener) {

	TreeItem currentItem = (TreeItem) cell.getItem();
	ExecutionSlot execSlot = (ExecutionSlot) element;
	String cellKey = ((CompositeSlot) execSlot.eContainer()).getName() + "." + execSlot.getName();
	if (viewerCells.get(cellKey) == null || viewerCells.get(cellKey).isDisposed()
			|| (viewerCells.get(cellKey).getSelection() != ((Boolean) value).booleanValue())) {
		manageEditorDisposal(currentItem, listener);
		TreeEditor editor = createEditor(currentItem);
		Composite comp = createEditorComposite(currentItem);
		final Button button = createNativeCheckboxCellWidget(element, comp);
		editor.setEditor(comp, currentItem, cell.getColumnIndex()); // update editor content
		viewerCells.put(cellKey, button);
	}
}
 
Example #2
Source File: ScriptDialog.java    From hop with Apache License 2.0 5 votes vote down vote up
private void addRenameTowTreeScriptItems() {
  lastItem = new TreeItem[ 1 ];
  editor = new TreeEditor( wTree );
  wTree.addListener( SWT.Selection, new Listener() {
    public void handleEvent( Event event ) {
      final TreeItem item = (TreeItem) event.item;
      renameFunction( item );
    }
  } );
}
 
Example #3
Source File: ScriptValuesModDialog.java    From hop with Apache License 2.0 5 votes vote down vote up
private void addRenameTowTreeScriptItems() {
  lastItem = new TreeItem[ 1 ];
  editor = new TreeEditor( wTree );
  wTree.addListener( SWT.Selection, new Listener() {
    public void handleEvent( Event event ) {
      final TreeItem item = (TreeItem) event.item;
      renameFunction( item );
    }
  } );
}
 
Example #4
Source File: UserDefinedJavaClassDialog.java    From hop with Apache License 2.0 5 votes vote down vote up
private void addRenameToTreeScriptItems() {
  lastItem = new TreeItem[ 1 ];
  editor = new TreeEditor( wTree );
  wTree.addListener( SWT.Selection, new Listener() {
    public void handleEvent( Event event ) {
      final TreeItem item = (TreeItem) event.item;
      renameFunction( item );
    }
  } );
}
 
Example #5
Source File: ExecutionContextLabelProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected void disposeTreeEditor() {
	if (currentItem.getData(EDITOR_DATA) != null) {
		TreeEditor editor = (TreeEditor) currentItem.getData(EDITOR_DATA);
		editor.getEditor().dispose();
		editor.dispose();

	}
}
 
Example #6
Source File: ExecutionContextLabelProvider.java    From statecharts with Eclipse Public License 1.0 5 votes vote down vote up
protected static TreeEditor createEditor(TreeItem currentItem) {
	TreeEditor editor = new TreeEditor(currentItem.getParent());
	editor.grabVertical = true;
	editor.grabHorizontal = true;
	currentItem.setData(TreeEditorDisposeListener.EDITOR_DATA, editor);
	return editor;
}
 
Example #7
Source File: ScriptDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void addRenameTowTreeScriptItems() {
  lastItem = new TreeItem[1];
  editor = new TreeEditor( wTree );
  wTree.addListener( SWT.Selection, new Listener() {
    public void handleEvent( Event event ) {
      final TreeItem item = (TreeItem) event.item;
      renameFunction( item );
    }
  } );
}
 
Example #8
Source File: ScriptValuesModDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void addRenameTowTreeScriptItems() {
  lastItem = new TreeItem[1];
  editor = new TreeEditor( wTree );
  wTree.addListener( SWT.Selection, new Listener() {
    public void handleEvent( Event event ) {
      final TreeItem item = (TreeItem) event.item;
      renameFunction( item );
    }
  } );
}
 
Example #9
Source File: UserDefinedJavaClassDialog.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
private void addRenameToTreeScriptItems() {
  lastItem = new TreeItem[1];
  editor = new TreeEditor( wTree );
  wTree.addListener( SWT.Selection, new Listener() {
    public void handleEvent( Event event ) {
      final TreeItem item = (TreeItem) event.item;
      renameFunction( item );
    }
  } );
}
 
Example #10
Source File: ReportPropertySheetPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void createControl( Composite parent )
{
	container = new Composite( parent, SWT.NONE );
	GridLayout layout = new GridLayout( );
	layout.marginWidth = layout.marginHeight = 0;
	container.setLayout( layout );
	title = new TabbedPropertyTitle( container,
			FormWidgetFactory.getInstance( ) );
	title.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );

	title.setActions( new Action[]{
			new GroupSortingAction( ),
			new AlphabeticSortingAction( ),
			new LocalModelAction( )
	} );

	Composite viewerContainer = new Composite( container, SWT.NONE );
	layout = new GridLayout( );
	layout.marginWidth = 10;
	layout.marginHeight = 3;
	viewerContainer.setLayout( layout );
	viewerContainer.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	viewer = new CustomTreeViewer( viewerContainer, SWT.FULL_SELECTION );
	tableTree = viewer.getTree( );
	tableTree.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	tableTree.setHeaderVisible( true );
	tableTree.setLinesVisible( true );

	viewer.setContentProvider( provider );

	TreeViewerColumn tvc1 = new TreeViewerColumn( viewer, SWT.NONE );
	tvc1.getColumn( ).setText( COLUMN_TITLE_PROPERTY );
	tvc1.getColumn( ).setWidth( 300 );
	tvc1.setLabelProvider( new DelegatingStyledCellLabelProvider( new ReportPropertySheetNameLabelProvider( ) ) );

	TreeViewerColumn tvc2 = new TreeViewerColumn( viewer, SWT.NONE );
	tvc2.getColumn( ).setText( COLUMN_TITLE_VALUE );
	tvc2.getColumn( ).setWidth( 400 );
	tvc2.setLabelProvider( new DelegatingStyledCellLabelProvider( new ReportPropertySheetValueLabelProvider( ) ) );

	AlphabeticallyViewSorter sorter = new AlphabeticallyViewSorter( );
	sorter.setAscending( true );
	viewer.setSorter( sorter );

	hookControl( );

	// create a new table tree editor
	tableTreeEditor = new TreeEditor( tableTree );

	// create the editor listener
	createEditorListener( );

	handleGlobalAction( );

	// suport the mediator
	SessionHandleAdapter.getInstance( )
			.getMediator( moduleHandle )
			.addColleague( this );

	FormWidgetFactory.getInstance( ).paintFormStyle( parent );
	FormWidgetFactory.getInstance( ).adapt( parent );

	IWorkbenchPage page = getSite( ).getPage( );

	MementoBuilder builder = new MementoBuilder( );
	if ( ( propertySheetMemento = builder.getRootMemento( )
			.getChild( IPageLayout.ID_PROP_SHEET ) ) == null )
	{
		propertySheetMemento = builder.getRootMemento( )
				.createChild( IPageLayout.ID_PROP_SHEET,
						MementoElement.Type_View );
	}

	if ( ( viewerMemento = propertySheetMemento.getChild( propertyViewerID ) ) == null )
	{
		viewerMemento = propertySheetMemento.createChild( propertyViewerID,
				MementoElement.Type_Viewer );
	}

	page.addSelectionListener( this );
	// handleSelectionChanged( page.getSelection( ) );
}
 
Example #11
Source File: AdvancePropertyDescriptor.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public Control createControl( Composite parent )
{
	container = new Composite( parent, SWT.NONE );
	GridLayout layout = UIUtil.createGridLayoutWithoutMargin( 1, false );
	layout.marginTop = 2;
	layout.marginWidth = layout.marginBottom = 1;
	container.setLayout( layout );
	container.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	initSortingType( );

	viewer = new CustomTreeViewer( container, SWT.FULL_SELECTION );

	tableTree = viewer.getTree( );
	GridData gd = new GridData( GridData.FILL_BOTH );
	tableTree.setLayoutData( gd );
	tableTree.setHeaderVisible( true );
	tableTree.setLinesVisible( true );

	viewer.setContentProvider( provider.getContentProvier( ) );

	TreeViewerColumn tvc1 = new TreeViewerColumn( viewer, SWT.NONE );
	tvc1.getColumn( ).setText( COLUMN_TITLE_PROPERTY );
	tvc1.getColumn( ).setWidth( 300 );
	tvc1.setLabelProvider( new DelegatingStyledCellLabelProvider( provider.getNameLabelProvier( ) ) );

	TreeViewerColumn tvc2 = new TreeViewerColumn( viewer, SWT.NONE );
	tvc2.getColumn( ).setText( COLUMN_TITLE_VALUE );
	tvc2.getColumn( ).setWidth( 400 );
	tvc2.setLabelProvider( new DelegatingStyledCellLabelProvider( provider.getValueLabelProvier( ) ) );

	AlphabeticallyViewSorter sorter = new AlphabeticallyViewSorter( );
	sorter.setAscending( true );
	viewer.setSorter( sorter );

	hookControl( );

	// create a new table tree editor
	tableTreeEditor = new TreeEditor( tableTree );

	// create the editor listener
	createEditorListener( );

	MementoBuilder builder = new MementoBuilder( );
	if ( ( propertySheetMemento = builder.getRootMemento( )
			.getChild( IPageLayout.ID_PROP_SHEET ) ) == null )
	{
		propertySheetMemento = builder.getRootMemento( )
				.createChild( IPageLayout.ID_PROP_SHEET,
						MementoElement.Type_View );
	}

	if ( ( viewerMemento = propertySheetMemento.getChild( propertyViewerID ) ) == null )
	{
		viewerMemento = propertySheetMemento.createChild( propertyViewerID,
				MementoElement.Type_Viewer );
	}

	return container;
}
 
Example #12
Source File: RenameResourceAndCloseEditorAction.java    From translationstudio8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new action.
 * 
 * @param shell
 *            the shell for any dialogs
 * @param tree
 *            the tree
 * @deprecated see {@link #RenameResourceAction(IShellProvider, Tree)}
 */
public RenameResourceAndCloseEditorAction(Shell shell, Tree tree) {
	this(shell);
	this.navigatorTree = tree;
	this.treeEditor = new TreeEditor(tree);
}
 
Example #13
Source File: RenameResourceAndCloseEditorAction.java    From translationstudio8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new action.
 * 
 * @param provider
 *            the shell provider for any dialogs
 * @param tree
 *            the tree
 * @since 3.4
 */
public RenameResourceAndCloseEditorAction(IShellProvider provider, Tree tree) {
	this(provider);
	this.navigatorTree = tree;
	this.treeEditor = new TreeEditor(tree);
}
 
Example #14
Source File: RenameResourceAndCloseEditorAction.java    From tmxeditor8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new action.
 * 
 * @param shell
 *            the shell for any dialogs
 * @param tree
 *            the tree
 * @deprecated see {@link #RenameResourceAction(IShellProvider, Tree)}
 */
public RenameResourceAndCloseEditorAction(Shell shell, Tree tree) {
	this(shell);
	this.navigatorTree = tree;
	this.treeEditor = new TreeEditor(tree);
}
 
Example #15
Source File: RenameResourceAndCloseEditorAction.java    From tmxeditor8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Creates a new action.
 * 
 * @param provider
 *            the shell provider for any dialogs
 * @param tree
 *            the tree
 * @since 3.4
 */
public RenameResourceAndCloseEditorAction(IShellProvider provider, Tree tree) {
	this(provider);
	this.navigatorTree = tree;
	this.treeEditor = new TreeEditor(tree);
}