List of usage examples for org.eclipse.jface.resource JFaceResources getDialogFont
public static Font getDialogFont()
From source file:org.dafoe.ontologiclevel.Dialog.MappingDialog.java
License:Open Source License
/** * Create contents of the button bar./*from w w w. ja va 2 s. c om*/ * @param parent */ @Override protected void createButtonsForButtonBar(Composite parent) { ((GridLayout) parent.getLayout()).numColumns++; Button button = new Button(parent, SWT.PUSH); button.setText(IDialogConstants.OK_LABEL); button.setFont(JFaceResources.getDialogFont()); button.setData(new Integer(IDialogConstants.OK_ID)); GridData GD = new GridData(GridData.FILL_HORIZONTAL); GD.widthHint = 56; button.setLayoutData(GD); Shell shell = parent.getShell(); if (shell != null) { shell.setDefaultButton(button); } //createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,true); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (ontoObject == null) { setReturnCode(CANCEL); close(); } else { try { if (creerLien()) { setReturnCode(OK); close(); } } catch (Exception exec) { exec.printStackTrace(); } } } }); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:org.dafoe.ontologiclevel.Dialog.NewAnnotationTypeDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { ((GridLayout) parent.getLayout()).numColumns++; Button btnOK = new Button(parent, SWT.PUSH); btnOK.setText(IDialogConstants.OK_LABEL); btnOK.setFont(JFaceResources.getDialogFont()); btnOK.setData(new Integer(IDialogConstants.OK_ID)); GridData GD = new GridData(GridData.FILL_HORIZONTAL); GD.widthHint = 56;/* w w w. j ava2s. com*/ btnOK.setLayoutData(GD); Shell shell = parent.getShell(); if (shell != null) { shell.setDefaultButton(btnOK); } //createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,true); btnOK.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { IBasicDatatype basicDT = listeType.get(comboDropDown.getSelectionIndex()); IOntoAnnotationType annotType = new OntoAnnotationTypeImpl(); annotType.setLabel(getLabel()); annotType.setDataType(basicDT.getLabel()); DatabaseAdapter.saveAnnotationType(annotType); close(); // close dialog } }); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:org.dafoe.ontologiclevel.Dialog.NewClassDialog2.java
License:Open Source License
/** * Create contents of the button bar./*from w ww.j a v a 2 s. c o m*/ * @param parent */ @Override protected void createButtonsForButtonBar(Composite parent) { ((GridLayout) parent.getLayout()).numColumns++; Button button = new Button(parent, SWT.PUSH); button.setText(IDialogConstants.OK_LABEL); button.setFont(JFaceResources.getDialogFont()); button.setData(new Integer(IDialogConstants.OK_ID)); GridData GD = new GridData(GridData.FILL_HORIZONTAL); GD.widthHint = 56; button.setLayoutData(GD); Shell shell = parent.getShell(); if (shell != null) { shell.setDefaultButton(button); } //createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,true); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { try { try { if (tree.getSelection().length > 0) { TreeItem it = tree.getSelection()[0]; if (it.getData() != null) { selectedTermino = (ITerminoOntoObject) it.getData(); } } } catch (Exception exec) { exec.printStackTrace(); } classeName = text.getText(); if (txtNameSpace.getText() != null) classeNameSpace = txtNameSpace.getText(); setReturnCode(OK); close(); } catch (Exception exec) { exec.printStackTrace(); } } }); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:org.dafoe.ontologiclevel.Dialog.NewPropertyDialog2.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { ((GridLayout) parent.getLayout()).numColumns++; Button button = new Button(parent, SWT.PUSH); button.setText(IDialogConstants.OK_LABEL); button.setFont(JFaceResources.getDialogFont()); button.setData(new Integer(IDialogConstants.OK_ID)); GridData GD = new GridData(GridData.FILL_HORIZONTAL); GD.widthHint = 56;/* w ww .j a va 2 s. c o m*/ button.setLayoutData(GD); Shell shell = parent.getShell(); if (shell != null) { shell.setDefaultButton(button); } //createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,true); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { if (creerPropriete()) { setReturnCode(OK); close(); } } }); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:org.dafoe.ontologiclevel.Dialog.SubsumeDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { ((GridLayout) parent.getLayout()).numColumns++; Button button = new Button(parent, SWT.PUSH); button.setText(IDialogConstants.OK_LABEL); button.setFont(JFaceResources.getDialogFont()); button.setData(new Integer(IDialogConstants.OK_ID)); GridData GD = new GridData(GridData.FILL_HORIZONTAL); GD.widthHint = 56;//from ww w . j a va 2s. c o m button.setLayoutData(GD); Shell shell = parent.getShell(); if (shell != null) { shell.setDefaultButton(button); } //createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL,true); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { try { if (tree.getSelection().length > 0) { TreeItem it = tree.getSelection()[0]; if (it.getData() != null) { IClass mere = (IClass) it.getData(); if (!mere.getChildren().contains(classeToSubsume)) { selectedClasse = mere; setReturnCode(OK); close(); } else { MessageBox msg = new MessageBox(getShell(), SWT.ICON_WARNING); msg.setMessage(Messages.getString("SubsumeDialog.CetteClasseEstdjaMere")); //$NON-NLS-1$ msg.open(); } } } } catch (Exception exec) { exec.printStackTrace(); } } }); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:org.dafoe.terminoontologiclevel.ui.dialog.NewClassDialog2.java
License:Open Source License
/** * Create contents of the button bar./*from ww w .ja va 2 s . co m*/ * * @param parent */ @Override protected void createButtonsForButtonBar(Composite parent) { ((GridLayout) parent.getLayout()).numColumns++; Button button = new Button(parent, SWT.PUSH); button.setText(IDialogConstants.OK_LABEL); button.setFont(JFaceResources.getDialogFont()); button.setData(new Integer(IDialogConstants.OK_ID)); GridData GD = new GridData(GridData.FILL_HORIZONTAL); GD.widthHint = 56; button.setLayoutData(GD); Shell shell = parent.getShell(); if (shell != null) { shell.setDefaultButton(button); } button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { try { classeName = text.getText(); setReturnCode(OK); close(); } catch (Exception exec) { exec.printStackTrace(); } } }); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:org.dafoe.terminoontologiclevel.ui.dialog.SubsumeTCDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { ((GridLayout) parent.getLayout()).numColumns++; Button button = new Button(parent, SWT.PUSH); button.setText(IDialogConstants.OK_LABEL); button.setFont(JFaceResources.getDialogFont()); button.setData(new Integer(IDialogConstants.OK_ID)); GridData GD = new GridData(GridData.FILL_HORIZONTAL); GD.widthHint = 56;/*from w ww . j a va2s.c om*/ button.setLayoutData(GD); Shell shell = parent.getShell(); if (shell != null) { shell.setDefaultButton(button); } // createButton(parent, IDialogConstants.OK_ID, // IDialogConstants.OK_LABEL,true); button.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { try { if (tree.getSelection().length > 0) { TreeItem it = tree.getSelection()[0]; if (it.getData() != null) { ITerminoConcept mere = (ITerminoConcept) it.getData(); if (!mere.getChildren().contains(tcToSubsume)) { selectedTC = mere; setReturnCode(OK); close(); } else { MessageBox msg = new MessageBox(getShell(), SWT.ICON_WARNING); msg.setMessage(Messages.getString("SubsumeDialog.1")); //$NON-NLS-1$ msg.open(); } } } } catch (Exception exec) { exec.printStackTrace(); } } }); createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); }
From source file:org.drools.eclipse.flow.ruleflow.view.property.action.ActionDialog.java
License:Apache License
public Control createDialogArea(Composite parent) { GridLayout layout = new GridLayout(); parent.setLayout(layout);/*from w w w .j a v a 2s .c o m*/ layout.numColumns = 2; Composite top = new Composite(parent, SWT.NONE); GridData gd = new GridData(); gd.horizontalSpan = 2; gd.grabExcessHorizontalSpace = true; top.setLayoutData(gd); layout = new GridLayout(); layout.numColumns = 4; top.setLayout(layout); Label label = new Label(top, SWT.NONE); label.setText("Dialect:"); createDialectCombo(top); Button importButton = new Button(top, SWT.PUSH); importButton.setText("Imports ..."); importButton.setFont(JFaceResources.getDialogFont()); importButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { importButtonPressed(); } }); Button globalButton = new Button(top, SWT.PUSH); globalButton.setText("Globals ..."); globalButton.setFont(JFaceResources.getDialogFont()); globalButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { globalButtonPressed(); } }); tabFolder = new TabFolder(parent, SWT.NONE); gd = new GridData(); gd.horizontalSpan = 3; gd.grabExcessHorizontalSpace = true; gd.grabExcessVerticalSpace = true; gd.verticalAlignment = GridData.FILL; gd.horizontalAlignment = GridData.FILL; tabFolder.setLayoutData(gd); TabItem textEditorTab = new TabItem(tabFolder, SWT.NONE); textEditorTab.setText("Textual Editor"); textEditorTab.setControl(createTextualEditor(tabFolder)); return tabFolder; }
From source file:org.drools.eclipse.flow.ruleflow.view.property.constraint.MilestoneConstraintDialog.java
License:Apache License
public Control createDialogArea(Composite parent) { GridLayout layout = new GridLayout(); parent.setLayout(layout);// w w w . j a va2 s . com layout.numColumns = 2; Composite top = new Composite(parent, SWT.NONE); GridData gd = new GridData(); gd.horizontalSpan = 2; gd.grabExcessHorizontalSpace = true; top.setLayoutData(gd); layout = new GridLayout(); layout.numColumns = 3; top.setLayout(layout); Button importButton = new Button(top, SWT.PUSH); importButton.setText("Imports ..."); importButton.setFont(JFaceResources.getDialogFont()); importButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { importButtonPressed(); } }); gd = new GridData(); importButton.setLayoutData(gd); Button globalButton = new Button(top, SWT.PUSH); globalButton.setText("Globals ..."); globalButton.setFont(JFaceResources.getDialogFont()); globalButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { globalButtonPressed(); } }); gd = new GridData(); globalButton.setLayoutData(gd); tabFolder = new TabFolder(parent, SWT.NONE); gd = new GridData(); gd.horizontalSpan = 3; gd.grabExcessHorizontalSpace = true; gd.grabExcessVerticalSpace = true; gd.verticalAlignment = GridData.FILL; gd.horizontalAlignment = GridData.FILL; tabFolder.setLayoutData(gd); TabItem textEditorTab = new TabItem(tabFolder, SWT.NONE); textEditorTab.setText("Textual Editor"); textEditorTab.setControl(createTextualEditor(tabFolder)); return tabFolder; }
From source file:org.drools.eclipse.flow.ruleflow.view.property.constraint.RuleFlowConstraintDialog.java
License:Apache License
public Control createDialogArea(Composite parent) { GridLayout layout = new GridLayout(); parent.setLayout(layout);/*from w w w .ja va2 s .c om*/ layout.numColumns = 2; Composite top = new Composite(parent, SWT.NONE); GridData gd = new GridData(); gd.horizontalSpan = 2; gd.grabExcessHorizontalSpace = true; top.setLayoutData(gd); layout = new GridLayout(); layout.numColumns = 4; top.setLayout(layout); Label l1 = new Label(top, SWT.None); l1.setText("Name:"); gd = new GridData(); l1.setLayoutData(gd); nameText = new Text(top, SWT.BORDER); gd = new GridData(); gd.horizontalAlignment = GridData.FILL; gd.widthHint = 200; gd.horizontalSpan = 3; nameText.setLayoutData(gd); Label l2 = new Label(top, SWT.NONE); gd = new GridData(); l2.setLayoutData(gd); l2.setText("Priority:"); priorityText = new Text(top, SWT.BORDER); gd = new GridData(); gd.widthHint = 200; gd.horizontalSpan = 3; priorityText.setLayoutData(gd); alwaysTrue = new Button(top, SWT.CHECK); alwaysTrue.setText("Always true"); gd = new GridData(); gd.horizontalSpan = 2; alwaysTrue.setLayoutData(gd); Button importButton = new Button(top, SWT.PUSH); importButton.setText("Imports ..."); importButton.setFont(JFaceResources.getDialogFont()); importButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { importButtonPressed(); } }); gd = new GridData(); gd.grabExcessHorizontalSpace = true; gd.horizontalAlignment = GridData.END; importButton.setLayoutData(gd); Button globalButton = new Button(top, SWT.PUSH); globalButton.setText("Globals ..."); globalButton.setFont(JFaceResources.getDialogFont()); globalButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { globalButtonPressed(); } }); gd = new GridData(); gd.horizontalAlignment = GridData.END; globalButton.setLayoutData(gd); Label l3 = new Label(top, SWT.NONE); gd = new GridData(); l3.setLayoutData(gd); l3.setText("Type:"); typeCombo = new Combo(top, SWT.DROP_DOWN | SWT.READ_ONLY); typeCombo.setItems(TYPES); gd = new GridData(); typeCombo.setLayoutData(gd); typeCombo.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { if (completionProcessor != null) { completionProcessor.setType(typeCombo.getText()); } } }); typeCombo.select(0); Label l4 = new Label(top, SWT.NONE); gd = new GridData(); l4.setLayoutData(gd); l4.setText("Dialect:"); dialectCombo = new Combo(top, SWT.DROP_DOWN | SWT.READ_ONLY); dialectCombo.setItems(DIALECTS); dialectCombo.select(0); gd = new GridData(); dialectCombo.setLayoutData(gd); tabFolder = new TabFolder(parent, SWT.NONE); gd = new GridData(); gd.horizontalSpan = 4; gd.grabExcessHorizontalSpace = true; gd.grabExcessVerticalSpace = true; gd.verticalAlignment = GridData.FILL; gd.horizontalAlignment = GridData.FILL; tabFolder.setLayoutData(gd); TabItem textEditorTab = new TabItem(tabFolder, SWT.NONE); textEditorTab.setText("Textual Editor"); textEditorTab.setControl(createTextualEditor(tabFolder)); alwaysTrue.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { tabFolder.setVisible(!alwaysTrue.getSelection()); } public void widgetDefaultSelected(SelectionEvent e) { widgetSelected(e); } }); return tabFolder; }