Java Code Examples for org.eclipse.swt.SWT#NO_FOCUS

The following examples show how to use org.eclipse.swt.SWT#NO_FOCUS . 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: TableViewPainted.java    From BiglyBT with GNU General Public License v2.0 6 votes vote down vote up
/** Creates a composite within the specified composite and sets its layout
 * to a default FillLayout().
 *
 * @param composite to create your Composite under
 * @return The newly created composite
 */
@Override
public Composite createMainPanel(Composite composite) {
	TableViewSWTPanelCreator mainPanelCreator = getMainPanelCreator();
	if (mainPanelCreator != null) {
		return mainPanelCreator.createTableViewPanel(composite);
	}
	Composite panel = new Composite(composite, SWT.NO_FOCUS);
	composite.getLayout();
	GridLayout layout = new GridLayout();
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	panel.setLayout(layout);

	Object parentLayout = composite.getLayout();
	if (parentLayout == null || (parentLayout instanceof GridLayout)) {
		panel.setLayoutData(new GridData(GridData.FILL_BOTH));
	}

	return panel;
}
 
Example 2
Source File: CellExpressionViewer.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void createToolbar(final int style, final TabbedPropertySheetWidgetFactory widgetFactory) {
    toolbar = new ToolBar(control, SWT.FLAT | SWT.NO_FOCUS);
    toolbar.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(false, false).create());
    toolbar.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    final ToolItem editControl = new ToolItem(toolbar, SWT.FLAT);
    editControl.setImage(Pics.getImage(PicsConstants.edit));
    editControl.setData(SWTBOT_WIDGET_ID_KEY, SWTBOT_ID_EDITBUTTON);
    editControl.addDisposeListener(disposeListener);
    editControl.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            editDialog = CellExpressionViewer.this.createEditDialog();
            openEditDialog(editDialog);
        }
    });
}
 
Example 3
Source File: BonitaContentProposalAdapter.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Control createDialogArea(final Composite parent) {
    text = new Text(parent, SWT.MULTI | SWT.READ_ONLY | SWT.WRAP | SWT.NO_FOCUS);

    // Use the compact margins employed by PopupDialog.
    final GridData gd = new GridData(GridData.BEGINNING | GridData.FILL_BOTH);
    gd.horizontalIndent = PopupDialog.POPUP_HORIZONTALSPACING;
    gd.verticalIndent = PopupDialog.POPUP_VERTICALSPACING;
    text.setLayoutData(gd);
    text.setText(contents);

    // since SWT.NO_FOCUS is only a hint...
    text.addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(final FocusEvent event) {
            ContentProposalPopup.this.close();
        }
    });
    return text;
}
 
Example 4
Source File: ExpressionViewer.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected ToolItem createEraseToolItem(final ToolBar tb) {
    eraseControl = new ToolItem(tb, SWT.PUSH | SWT.NO_FOCUS);
    eraseControl.setImage(Pics.getImage(PicsConstants.clear));
    eraseControl.setToolTipText(Messages.eraseExpression);

    /* For test purpose */
    eraseControl.setData(SWTBOT_WIDGET_ID_KEY, SWTBOT_ID_ERASEBUTTON);
    eraseControl.addListener(SWT.Selection, new Listener() {

        @Override
        public void handleEvent(final Event event) {
            erase(getSelectedExpression());
        }

    });

    eraseControl.addDisposeListener(disposeListener);
    return eraseControl;
}
 
Example 5
Source File: FindingsUiUtil.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Returns all actions from the sub toolbar
 * 
 * @param c
 * @param iObservation
 * @param horizontalGrap
 * @return
 */
public static List<Action> createToolbarSubComponents(Composite c, IObservation iObservation,
	int horizontalGrap){
	
	List<Action> actions = new ArrayList<>();
	String comment = iObservation.getComment().orElse("");
	
	ToolBarManager menuManager = new ToolBarManager(SWT.FLAT | SWT.HORIZONTAL | SWT.NO_FOCUS);
	Action commentableAction = new CommentAction(c.getShell(), comment);
	menuManager.add(commentableAction);
	menuManager.createControl(c)
		.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false, horizontalGrap, 1));
	actions.add(commentableAction);
	
	return actions;
}
 
Example 6
Source File: AttributeEditionControl.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createToolbar(Composite parent) {
    ToolBar toolBar = new ToolBar(parent, SWT.HORIZONTAL | SWT.LEFT | SWT.NO_FOCUS | SWT.FLAT);
    formPage.getToolkit().adapt(toolBar);

    ToolItem addFieldItem = new ToolItem(toolBar, SWT.PUSH);
    addFieldItem.setImage(BusinessObjectPlugin.getImage("/icons/add.png"));
    addFieldItem.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, ADD_ATTRIBUTE_BUTTON_ID);
    addFieldItem.setToolTipText(Messages.addFieldTooltip);
    addFieldItem.addListener(SWT.Selection, e -> addAttribute());

    deleteFieldItem = new ToolItem(toolBar, SWT.PUSH);
    deleteFieldItem.setData(SWTBotConstants.SWTBOT_WIDGET_ID_KEY, REMOVE_ATTRIBUTE_BUTTON_ID);
    deleteFieldItem.setImage(BusinessObjectPlugin.getImage("/icons/delete_icon.png"));
    deleteFieldItem.setToolTipText(Messages.deleteFieldTooltip);
    deleteFieldItem.addListener(SWT.Selection, e -> removeSelectedAttribute());

    upFieldItem = new ToolItem(toolBar, SWT.PUSH);
    upFieldItem.setImage(BusinessObjectPlugin.getImage("/icons/up.png"));
    upFieldItem.setToolTipText(Messages.up);
    upFieldItem.addListener(SWT.Selection, e -> upSelectedAttribute());

    downFieldItem = new ToolItem(toolBar, SWT.PUSH);
    downFieldItem.setImage(BusinessObjectPlugin.getImage("/icons/down.png"));
    downFieldItem.setToolTipText(Messages.down);
    downFieldItem.addListener(SWT.Selection, e -> downSelectedAttribute());
}
 
Example 7
Source File: SelectDataWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public void createBusinessVariableTableViewerComposite(final Composite parent, final DataBindingContext dbc) {
    businessVariableTableViewerComposite = new Composite(parent, SWT.NONE);
    businessVariableTableViewerComposite.setLayout(GridLayoutFactory.swtDefaults().create());
    businessVariableTableViewerComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    final TableViewer businessDataTableViewer = new TableViewer(businessVariableTableViewerComposite,
            SWT.BORDER | SWT.SINGLE | SWT.NO_FOCUS | SWT.H_SCROLL
                    | SWT.V_SCROLL);
    businessDataTableViewer.getTable().setLayout(GridLayoutFactory.fillDefaults().create());
    businessDataTableViewer.getTable()
            .setLayoutData(GridDataFactory.fillDefaults().grab(true, true).hint(200, 100).create());
    final ObservableListContentProvider contentProvider = new ObservableListContentProvider();
    businessDataTableViewer.setContentProvider(contentProvider);
    final IObservableSet knownElements = contentProvider.getKnownElements();
    final IObservableMap[] labelMaps = EMFObservables.observeMaps(knownElements,
            new EStructuralFeature[] { ProcessPackage.Literals.ELEMENT__NAME,
                    ProcessPackage.Literals.DATA__MULTIPLE,
                    ProcessPackage.Literals.JAVA_OBJECT_DATA__CLASS_NAME });
    businessDataTableViewer
            .setLabelProvider(new BusinessObjectDataStyledLabelProvider(businessObjectStore, labelMaps));
    businessDataTableViewer
            .setInput(new WritableList(availableBusinessData, ProcessPackage.Literals.BUSINESS_OBJECT_DATA));
    final IViewerObservableValue observeSingleSelection = ViewersObservables
            .observeSingleSelection(businessDataTableViewer);
    dbc.bindValue(observeSingleSelection, selectedDataObservable);
    businessVariableButton.addSelectionListener(createBusinessVariableSelectionAdapter());
}
 
Example 8
Source File: BufferDialog.java    From e4macs with Eclipse Public License 1.0 6 votes vote down vote up
private Control createBufferTip(Composite parent, IEditorReference ref) {

		Composite result = new Composite(parent, SWT.NO_FOCUS);
		Color bg = parent.getBackground();
		result.setBackground(bg);
		GridLayout gridLayout = new GridLayout();
		gridLayout.numColumns = 1;
		result.setLayout(gridLayout);

		StyledText name = new StyledText(result, SWT.READ_ONLY | SWT.HIDE_SELECTION);
		// italics results in slightly clipped text unless extended
		String text = ref.getTitleToolTip() + ' ';
		name.setText(text);
		name.setBackground(bg);
		name.setCaret(null);
		StyleRange styleIt = new StyleRange(0, text.length(), null, bg);
		styleIt.fontStyle = SWT.ITALIC;
		name.setStyleRange(styleIt);
		
		return result;
	}
 
Example 9
Source File: AbstractPopupSheet.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private Link createHelpLink( Composite parent )
{
	Link link = new Link( parent, SWT.WRAP | SWT.NO_FOCUS );
	link.setLayoutData( new GridData( GridData.HORIZONTAL_ALIGN_CENTER ) );
	link.setText( "<a>" + IDialogConstants.HELP_LABEL + "</a>" ); //$NON-NLS-1$ //$NON-NLS-2$
	link.setToolTipText( IDialogConstants.HELP_LABEL );
	link.addSelectionListener( new SelectionAdapter( ) {

		public void widgetSelected( SelectionEvent e )
		{
			helpPressed( );
		}
	} );
	return link;
}
 
Example 10
Source File: ComponentStatusLabel.java    From arx with Apache License 2.0 5 votes vote down vote up
/**
 * Checkstyle method.
 *
 * @param style
 * @return
 */
private static int checkStyle(int style) {
    if ((style & SWT.BORDER) != 0) style |= SWT.SHADOW_IN;
    int mask = SWT.SHADOW_IN | SWT.SHADOW_OUT | SWT.SHADOW_NONE | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
    style = style & mask;
    return style |= SWT.NO_FOCUS | SWT.DOUBLE_BUFFERED;
}
 
Example 11
Source File: CDatePanel.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private void createHeader() {
	header = new VPanel(panel, SWT.NONE);
	VGridLayout layout = new VGridLayout(3, true);
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	header.setLayout(layout);
	header.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false));

	VButton b = new VButton(header, SWT.ARROW | SWT.LEFT | SWT.NO_FOCUS);
	b.setFill(getDisplay().getSystemColor(SWT.COLOR_GRAY));
	b.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
	b.addListener(SWT.Selection, event -> {
		calendar.add(Calendar.MONTH, -1);
		updateMonths();
	});

	b = new VButton(header, SWT.PUSH | SWT.NO_FOCUS);
	b.setText("Today");
	b.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
	b.addListener(SWT.Selection, event -> {
		calendar.setTimeInMillis(System.currentTimeMillis());
		updateMonths();
	});

	b = new VButton(header, SWT.ARROW | SWT.RIGHT | SWT.NO_FOCUS);
	b.setFill(getDisplay().getSystemColor(SWT.COLOR_GRAY));
	b.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
	b.addListener(SWT.Selection, event -> {
		calendar.add(Calendar.MONTH, 1);
		updateMonths();
	});

	headerSize = header.computeSize(-1, -1).y;
}
 
Example 12
Source File: TexInformationControl.java    From texlipse with Eclipse Public License 1.0 5 votes vote down vote up
public TexInformationControl(TexEditor editor, Shell container) {
    this.editor = editor;
    document = editor.getTexDocument();
    refMana = editor.getDocumentModel().getRefMana();
    shell = new Shell(container, SWT.NO_FOCUS | SWT.ON_TOP | SWT.MODELESS);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 3;
    layout.marginWidth = 3;
    shell.setLayout(layout);
    display = shell.getDisplay();
    shell.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
}
 
Example 13
Source File: BusinessDataViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private Composite createEmptyBDMComposite(Composite parent) {
    Composite client = widgetFactory.createComposite(parent);
    client.setLayout(GridLayoutFactory.fillDefaults().create());
    client.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    Composite emptyBDMComposite = widgetFactory.createComposite(client);
    emptyBDMComposite.setLayout(GridLayoutFactory.fillDefaults().create());
    emptyBDMComposite
            .setLayoutData(GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).grab(true, true).create());

    final ImageHyperlink imageHyperlink = widgetFactory.createImageHyperlink(emptyBDMComposite, SWT.NO_FOCUS);
    imageHyperlink.setLayoutData(GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.FILL).create());
    imageHyperlink.setImage(Pics.getImage("defineBdm_60.png", DataPlugin.getDefault()));
    imageHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            commandExecutor.executeCommand(DEFINE_BDM_COMMAND, null);
        }
    });

    Link labelLink = new Link(emptyBDMComposite, SWT.NO_FOCUS);
    widgetFactory.adapt(labelLink, false, false);
    labelLink.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.CENTER).create());
    labelLink.setText(Messages.defineBdmTooltip);
    labelLink.addListener(SWT.Selection, e -> commandExecutor.executeCommand(DEFINE_BDM_COMMAND, null));

    return client;
}
 
Example 14
Source File: TmfAbstractToolTipHandler.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public Point create() {
    Composite parent = getParent();
    Table<ToolTipString, ToolTipString, ToolTipString> model = getModel();
    if (parent == null || model.size() == 0) {
        // avoid displaying empty tool tips.
        return null;
    }
    setupControl(parent);
    ScrolledComposite scrolledComposite = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);
    setupControl(scrolledComposite);

    Composite composite = new Composite(scrolledComposite, SWT.NONE);
    fComposite = composite;
    composite.setLayout(new GridLayout(3, false));
    setupControl(composite);
    Set<ToolTipString> rowKeySet = model.rowKeySet();
    for (ToolTipString row : rowKeySet) {
        Set<Entry<ToolTipString, ToolTipString>> entrySet = model.row(row).entrySet();
        for (Entry<ToolTipString, ToolTipString> entry : entrySet) {
            Label nameLabel = new Label(composite, SWT.NO_FOCUS);
            nameLabel.setText(entry.getKey().toString());
            setupControl(nameLabel);
            Label separator = new Label(composite, SWT.NO_FOCUS | SWT.SEPARATOR | SWT.VERTICAL);
            GridData gd = new GridData(SWT.CENTER, SWT.CENTER, false, false);
            gd.heightHint = nameLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
            separator.setLayoutData(gd);
            setupControl(separator);
            Label valueLabel = new Label(composite, SWT.NO_FOCUS);
            valueLabel.setText(entry.getValue().toString());
            setupControl(valueLabel);
        }
    }
    scrolledComposite.setContent(composite);
    Point preferredSize = computePreferredSize();
    scrolledComposite.setMinSize(preferredSize.x, preferredSize.y);
    return preferredSize;
}
 
Example 15
Source File: AnnotationExpansionControl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
	 * Creates a new control.
	 *
	 * @param parent parent shell
	 * @param shellStyle additional style flags
	 * @param access the annotation access
	 */
	public AnnotationExpansionControl(Shell parent, int shellStyle, IAnnotationAccess access) {
		fPaintListener= new MyPaintListener();
		fMouseTrackListener= new MyMouseTrackListener();
		fMouseListener= new MyMouseListener();
		fMenuDetectListener= new MyMenuDetectListener();
		fDisposeListener= new MyDisposeListener();
		fViewportListener= new IViewportListener() {

			public void viewportChanged(int verticalOffset) {
				dispose();
			}

		};
		fLayouter= new LinearLayouter();

		if (access instanceof IAnnotationAccessExtension)
			fAnnotationAccessExtension= (IAnnotationAccessExtension) access;

		fShell= new Shell(parent, shellStyle | SWT.NO_FOCUS | SWT.ON_TOP);
		Display display= fShell.getDisplay();
		fShell.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
		fComposite= new Composite(fShell, SWT.NO_FOCUS | SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM);
//		fComposite= new Composite(fShell, SWT.NO_FOCUS | SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.V_SCROLL);

		GridLayout layout= new GridLayout(1, true);
		layout.marginHeight= 0;
		layout.marginWidth= 0;
		fShell.setLayout(layout);

		GridData data= new GridData(GridData.FILL_BOTH);
		data.heightHint= fLayouter.getAnnotationSize() + 2 * fLayouter.getBorderWidth() + 4;
		fComposite.setLayoutData(data);
		fComposite.addMouseTrackListener(new MouseTrackAdapter() {

			@Override
			public void mouseExit(MouseEvent e) {
				if (fComposite == null)
						return;
				Control[] children= fComposite.getChildren();
				Rectangle bounds= null;
				for (int i= 0; i < children.length; i++) {
					if (bounds == null)
						bounds= children[i].getBounds();
					else
						bounds.add(children[i].getBounds());
					if (bounds.contains(e.x, e.y))
						return;
				}

				// if none of the children contains the event, we leave the popup
				dispose();
			}

		});

//		fComposite.getVerticalBar().addListener(SWT.Selection, new Listener() {
//
//			public void handleEvent(Event event) {
//				Rectangle bounds= fShell.getBounds();
//				int x= bounds.x - fLayouter.getAnnotationSize() - fLayouter.getBorderWidth();
//				int y= bounds.y;
//				fShell.setBounds(x, y, bounds.width, bounds.height);
//			}
//
//		});

		Cursor handCursor= getHandCursor(display);
		fShell.setCursor(handCursor);
		fComposite.setCursor(handCursor);

		setInfoSystemColor();
	}
 
Example 16
Source File: TableCombo.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * @param style
 * @return
 */
private static int checkStyle(int style) {
	int mask = SWT.BORDER | SWT.READ_ONLY | SWT.FLAT | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
	return SWT.NO_FOCUS | (style & mask);
}
 
Example 17
Source File: CTree.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
private static int checkStyle(int style) {
	int mask = SWT.BORDER | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT
			| SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.MULTI
			| SWT.NO_FOCUS | SWT.CHECK;
	return (style & mask);
}
 
Example 18
Source File: PositiveNegativeColorDialog.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
protected Control createDialogArea( Composite parent )
{
	GridLayout glContent = new GridLayout( );
	glContent.numColumns = 2;
	glContent.horizontalSpacing = 5;
	glContent.verticalSpacing = 5;

	cmpContent = new Composite( parent, SWT.NONE );
	cmpContent.setLayout( glContent );
	cmpContent.setLayoutData( new GridData( GridData.FILL_BOTH ) );

	cmpPos = new Composite( cmpContent, SWT.NONE );
	cmpPos.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	cmpPos.setLayout( new GridLayout( ) );

	cmpNeg = new Composite( cmpContent, SWT.NONE );
	cmpNeg.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	cmpNeg.setLayout( new GridLayout( ) );

	Label lblStartColor = new Label( cmpPos, SWT.NONE );
	GridData gdLBLStartColor = new GridData( );
	lblStartColor.setLayoutData( gdLBLStartColor );
	lblStartColor.setText( Messages.getString( "PositiveNegativeColorDialog.Lbl.PositiveColor" ) ); //$NON-NLS-1$

	fccPosColor = new FillChooserComposite( cmpPos,
			SWT.NONE,
			wizardContext,
			(Fill) mCurrent.getFills( ).get( 0 ),
			false,
			false );
	GridData gdFCCStartColor = new GridData( GridData.FILL_HORIZONTAL );
	fccPosColor.setLayoutData( gdFCCStartColor );
	fccPosColor.addListener( this );

	Label lblEndColor = new Label( cmpNeg, SWT.NONE );
	GridData gdLBLEndColor = new GridData( );
	lblEndColor.setLayoutData( gdLBLEndColor );
	lblEndColor.setText( Messages.getString( "PositiveNegativeColorDialog.Lbl.NegativeColor" ) ); //$NON-NLS-1$

	fccNegColor = new FillChooserComposite( cmpNeg,
			SWT.NONE,
			wizardContext,
			(Fill) mCurrent.getFills( ).get( 1 ),
			false,
			false );
	GridData gdFCCEndColor = new GridData( GridData.FILL_HORIZONTAL );
	fccNegColor.setLayoutData( gdFCCEndColor );
	fccNegColor.addListener( this );

	Group grpPreview = new Group( cmpContent, SWT.NONE );
	GridData gdGRPPreview = new GridData( GridData.FILL_BOTH );
	gdGRPPreview.horizontalSpan = 2;
	grpPreview.setLayoutData( gdGRPPreview );
	grpPreview.setLayout( new FillLayout( ) );
	grpPreview.setText( Messages.getString( "PositiveNegativeColorDialog.Lbl.Preview" ) ); //$NON-NLS-1$

	cnvPreview = new FillCanvas( grpPreview, SWT.NO_FOCUS );
	cnvPreview.setFill( mCurrent );

	return cmpContent;
}
 
Example 19
Source File: TableCombo.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @param style
 * @return
 */
private static int checkStyle(int style) {
    int mask = SWT.BORDER | SWT.READ_ONLY | SWT.FLAT | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT;
    return SWT.NO_FOCUS | (style & mask);
}
 
Example 20
Source File: AbstractDefinitionWizardDialog.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected void createToolbar(final Composite parent) {
    toolbar = new ToolBar(parent, SWT.FLAT);
    toolbar.setLayoutData(GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.CENTER).grab(true, false).create());

    loadItem = new ToolItem(toolbar, SWT.NO_FOCUS | SWT.FLAT);
    loadItem.setImage(Pics.getImage("load_conf.png"));
    loadItem.setText(Messages.loadConfiguration);
    loadItem.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent e) {
            final IWizardPage page = getCurrentPage();
            if (page instanceof AbstractConnectorConfigurationWizardPage) {
                final AbstractConnectorConfigurationWizardPage connectorConfPage = (AbstractConnectorConfigurationWizardPage) page;
                final ConnectorConfiguration connectorConfigurationToLoad = connectorConfPage.getConfiguration();
                final SelectConnectorConfigurationWizard wizard = new SelectConnectorConfigurationWizard(connectorConfigurationToLoad, configurationStore,
                        definitionRepositoryStore);
                final WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
                if (dialog.open() == Dialog.OK) {
                    final IConnectorDefinitionContainer connectorWizard = (IConnectorDefinitionContainer) getWizard();
                    final ConnectorDefinition def = connectorWizard.getDefinition();
                    final IWizardPage namePage = getWizard().getPage(SelectNameAndDescWizardPage.class.getName());
                    if (namePage != null) {
                        final IWizardPage previousNamePage = namePage.getPreviousPage();
                        showPage(namePage);
                        namePage.setPreviousPage(previousNamePage);
                        connectorWizard.recreateConnectorConfigurationPages(def, false);
                    } else {
                        final IWizardPage[] wizardPages = getWizard().getPages();
                        if (wizardPages.length > 1) {
                            final IWizardPage firstPage = wizardPages[0];
                            showPage(firstPage.getNextPage());
                        }
                    }

                    updateButtons();
                }
            }
        }
    });

    saveItem = new ToolItem(toolbar, SWT.NO_FOCUS | SWT.FLAT);
    saveItem.setImage(Pics.getImage("save_conf.png"));
    saveItem.setText(Messages.saveConfiguration);
    final ITestConfigurationListener listener = getTestListener(null, (IWizard) null);
    if (implStore != null && listener != null) {
        testItem = new ToolItem(toolbar, SWT.NO_FOCUS | SWT.FLAT);
        testItem.setImage(Pics.getImage("test.png"));
        testItem.setText(Messages.testConfiguration);
        testItem.setEnabled(false);
    }
}