Java Code Examples for org.eclipse.swt.widgets.ScrollBar#removeListener()

The following examples show how to use org.eclipse.swt.widgets.ScrollBar#removeListener() . 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: ConsoleAutoScrollPageParticipant.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
public void dispose()
{
	if (textWidget != null && !textWidget.isDisposed())
	{
		textWidget.removeListener(SWT.MouseDown, listener);
		textWidget.removeListener(SWT.MouseMove, listener);
		textWidget.removeListener(SWT.MouseUp, listener);
		textWidget.removeListener(SWT.KeyDown, listener);
		textWidget.removeListener(SWT.KeyUp, listener);
		textWidget.removeListener(SWT.Resize, listener);
		ScrollBar vBar = textWidget.getVerticalBar();
		if (vBar != null && !vBar.isDisposed())
		{
			vBar.removeListener(SWT.Selection, listener);
		}
	}
	textWidget = null;
	listener = null;
}
 
Example 2
Source File: BonitaContentProposalAdapter.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
void removeListeners() {
    if (isValid()) {
        proposalTable.removeListener(SWT.FocusOut, this);
        final ScrollBar scrollbar = proposalTable.getVerticalBar();
        if (scrollbar != null) {
            scrollbar.removeListener(SWT.Selection, this);
        }

        getShell().removeListener(SWT.Deactivate, this);
        getShell().removeListener(SWT.Close, this);
    }

    if (control != null && !control.isDisposed()) {

        control.removeListener(SWT.MouseDoubleClick, this);
        control.removeListener(SWT.MouseDown, this);
        control.removeListener(SWT.Dispose, this);
        control.removeListener(SWT.FocusOut, this);

        final Shell controlShell = control.getShell();
        controlShell.removeListener(SWT.Move, this);
        controlShell.removeListener(SWT.Resize, this);
    }
}
 
Example 3
Source File: HorizontalViewportLayer.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
	public boolean doCommand(ILayerCommand command) {
		boolean b = super.doCommand(command);
		if (command instanceof ClientAreaResizeCommand && command.convertToTargetLayer(this)) {
			ClientAreaResizeCommand clientAreaResizeCommand = (ClientAreaResizeCommand) command;
			final ScrollBar vBar = clientAreaResizeCommand.getScrollable().getVerticalBar(); // 垂直滚动条
			Listener[] listeners = vBar.getListeners(SWT.Selection);
			for (Listener listener : listeners) { // 清除默认的 Selection 监听(在类 ScrollBarHandlerTemplate 中添加的)
				vBar.removeListener(SWT.Selection, listener);
			}
			vBar.addListener(SWT.Selection, new Listener() {
				
				private ViewportLayer viewportLayer = HorizontalViewportLayer.this;
				private IUniqueIndexLayer scrollableLayer = viewportLayer.getScrollableLayer();
				
				public void handleEvent(Event event) {
					// 滚动滚动条前提交当前处于编辑状态的文本段
					HsMultiActiveCellEditor.commit(true);
					ScrollBar scrollBar = (ScrollBar) event.widget;
					
					int position = scrollableLayer.getRowPositionByY(scrollBar.getSelection());
					
					viewportLayer.invalidateVerticalStructure();
					viewportLayer.setOriginRowPosition(position);
					vBar.setIncrement(viewportLayer.getRowHeightByPosition(0));
					
//					HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.getCurrent());
				}
			});
		}

		return b;
	}
 
Example 4
Source File: HorizontalViewportLayer.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean doCommand(ILayerCommand command) {
	boolean b = super.doCommand(command);
	if (command instanceof ClientAreaResizeCommand && command.convertToTargetLayer(this)) {
		ClientAreaResizeCommand clientAreaResizeCommand = (ClientAreaResizeCommand) command;
		final ScrollBar vBar = clientAreaResizeCommand.getScrollable().getVerticalBar(); // 垂直滚动条
		Listener[] listeners = vBar.getListeners(SWT.Selection);
		for (Listener listener : listeners) { // 清除默认的 Selection 监听(在类 ScrollBarHandlerTemplate 中添加的)
			vBar.removeListener(SWT.Selection, listener);
		}
		vBar.addListener(SWT.Selection, new Listener() {

			private ViewportLayer viewportLayer = HorizontalViewportLayer.this;
			private IUniqueIndexLayer scrollableLayer = viewportLayer.getScrollableLayer();

			public void handleEvent(Event event) {
				// 滚动滚动条前提交当前处于编辑状态的文本段
				if (TeActiveCellEditor.isValid())
					TeActiveCellEditor.commit();
				ScrollBar scrollBar = (ScrollBar) event.widget;

				int position = scrollableLayer.getRowPositionByY(scrollBar.getSelection());

				viewportLayer.invalidateVerticalStructure();
				viewportLayer.setOriginRowPosition(position);
				vBar.setIncrement(viewportLayer.getRowHeightByPosition(0));

			}
		});
	}

	return b;
}
 
Example 5
Source File: HorizontalViewportLayer.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean doCommand(ILayerCommand command) {
	boolean b = super.doCommand(command);
	if (command instanceof ClientAreaResizeCommand && command.convertToTargetLayer(this)) {
		ClientAreaResizeCommand clientAreaResizeCommand = (ClientAreaResizeCommand) command;
		final ScrollBar vBar = clientAreaResizeCommand.getScrollable().getVerticalBar(); // 垂直滚动条
		Listener[] listeners = vBar.getListeners(SWT.Selection);
		for (Listener listener : listeners) { // 清除默认的 Selection 监听(在类 ScrollBarHandlerTemplate 中添加的)
			vBar.removeListener(SWT.Selection, listener);
		}
		vBar.addListener(SWT.Selection, new Listener() {
			
			private ViewportLayer viewportLayer = HorizontalViewportLayer.this;
			private IUniqueIndexLayer scrollableLayer = viewportLayer.getScrollableLayer();
			
			public void handleEvent(Event event) {
				// 滚动滚动条前提交当前处于编辑状态的文本段
				HsMultiActiveCellEditor.commit(true);
				ScrollBar scrollBar = (ScrollBar) event.widget;
				
				int position = scrollableLayer.getRowPositionByY(scrollBar.getSelection());
				
				viewportLayer.invalidateVerticalStructure();
				viewportLayer.setOriginRowPosition(position);
				vBar.setIncrement(viewportLayer.getRowHeightByPosition(0));
				
				HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.getCurrent());
			}
		});
	}

	return b;
}