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

The following examples show how to use org.eclipse.swt.SWT#NULL . 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: SdkToolsControlAddDialog.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void createControl(Composite parent) {
    initializeDialogUnits(parent);
    Composite container = new Composite(parent, SWT.NULL);
    setControl(container);

    container.setLayout(new GridLayout(2, false));

    SWTFactory.createVerticalSpacer(container, 2.0);
    SWTFactory.createLabel(container, Messages.SdkToolsControlAddDialog_GroupName + ':', 1);
    text = SWTFactory.createSingleText(container,  1);
    text.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validatePage();
        }
    });
    
    text.setText(groupName);
    text.setFocus();
    validatePage();
}
 
Example 2
Source File: MultiTrackerPanel.java    From BiglyBT with GNU General Public License v2.0 6 votes vote down vote up
void refreshDetails() {
  configDetails.removeAll();
  List trackers = ((NewTorrentWizard) wizard).trackers;
  Iterator iter = trackers.iterator();
  while(iter.hasNext()) {
      List trackerGroup = (List) iter.next();
      TreeItem itemRoot = new TreeItem(configDetails,SWT.NULL);
      Messages.setLanguageText(itemRoot, "wizard.multitracker.group");
      Iterator iter2 = trackerGroup.iterator();
      while(iter2.hasNext()) {
        String url = (String) iter2.next();
        new TreeItem(itemRoot,SWT.NULL).setText(url);
      }
      itemRoot.setExpanded(true);
  }
}
 
Example 3
Source File: CompositeTable.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * (non-API) Method resize. Resize this table's contents. Called from within
 * the custom layout manager.
 */
protected final void resize() {
	if (isRunTime()) {
		Control[] children = getChildren();
		int childrenLength = 0;
		for (int i = 0; i < children.length; i++) {
			if (!(children[i] instanceof InternalCompositeTable)) {
				++childrenLength;
			}
		}
		if (numChildrenLastTime != childrenLength) {
			resizeAndRecordPrototypeRows();
			showPrototypes(false);
			contentPane.dispose();
			contentPane = new InternalCompositeTable(this, SWT.NULL);
		}
		updateVisibleRows();
	} else {
		resizeAndRecordPrototypeRows();
	}
}
 
Example 4
Source File: SubtractOptionPart.java    From depan with Apache License 2.0 6 votes vote down vote up
private Composite createBaseControl(Composite parent) {
  Composite result = Widgets.buildGridContainer(parent, 3);

  // Row 1) Container selection
  Label label = new Label(result, SWT.NULL);
  label.setText("&Base:");

  baseText = new Text(result, SWT.BORDER | SWT.SINGLE);
  baseText.setLayoutData(Widgets.buildHorzFillData());
  if (null != baseContainer) {
    baseText.setText(baseContainer.getFullPath().toString());
  }

  Button button = new Button(result, SWT.PUSH);
  button.setText("Browse...");

  // Install listeners after initial value assignments
  button.addSelectionListener(new SelectionAdapter() {

    @Override
    public void widgetSelected(SelectionEvent e) {
      handleBaseBrowse();
    }
  });
  return result;
}
 
Example 5
Source File: NewGoWizardPage.java    From goclipse with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @see IDialogPage#createControl(Composite)
 */
@Override
   public void createControl(Composite parent) {
	Composite container = new Composite(parent, SWT.NULL);
	sourceFileComposite = new NewSourceFileComposite(container, SWT.NULL);
	sourceFileComposite.addDialogChangedListener(this);
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	sourceFileComposite.setLayoutData(gd);
	
	GridLayout layout = new GridLayout();
	container.setLayout(layout);
	layout.numColumns = 1;
	layout.verticalSpacing = 9;
	initialize();
	dialogChanged();
	setControl(container);
}
 
Example 6
Source File: INSDEnvironmentPage.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * Adds the combo.
 *
 * @param parent the parent
 * @param strLabel the str label
 * @return the combo
 */
private Combo addCombo(Composite parent, String strLabel) {
  Label label = new Label(parent, SWT.NULL);
  label.setText(strLabel);

  Combo text = new Combo(parent, SWT.BORDER | SWT.SINGLE);
  GridData gd = new GridData(GridData.FILL_HORIZONTAL);
  // gd.grabExcessHorizontalSpace = true;
  gd.widthHint = 100;
  text.setLayoutData(gd);

  text.addModifyListener(new ModifyListener() {
    @Override
    public void modifyText(ModifyEvent e) {
      dialogChanged();
    }
  });
  return text;
}
 
Example 7
Source File: TaskTagConfigurationBlock.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
@Override
protected Control doCreateContents(Composite parent) {
	GridLayout layout = new GridLayout();
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	layout.numColumns = 2;

	PixelConverter conv = new PixelConverter(parent);

	Composite markersComposite = new Composite(parent, SWT.NULL);
	markersComposite.setLayout(layout);
	markersComposite.setFont(parent.getFont());

	GridData data = new GridData(GridData.FILL_BOTH);
	data.widthHint = conv.convertWidthInCharsToPixels(50);
	Control listControl = taskTags.getListControl(markersComposite);
	listControl.setLayoutData(data);

	Control buttonsControl = taskTags.getButtonBox(markersComposite);
	buttonsControl.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING));

	caseSensitiveCheckBox.doFillIntoGrid(markersComposite, 2);

	return markersComposite;
}
 
Example 8
Source File: ComponentTitledBorder.java    From arx with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new instance.
 *
 * @param parent
 * @param controller
 * @param title
 * @param id
 */
public ComponentTitledBorder(Composite parent, Controller controller, String title, String id){

    folder = new CTabFolder(parent, SWT.TOP | SWT.BORDER | SWT.FLAT);
    folder.setUnselectedCloseVisible(false);
    folder.setSimple(false);
    
    // Create help button
    if (controller != null) SWTUtil.createHelpButton(controller, folder, id);

    // Prevent closing
    folder.addCTabFolder2Listener(new CTabFolder2Adapter() {
        @Override
        public void close(final CTabFolderEvent event) {
            event.doit = false;
        }
    });
    
    // Create general tab
    tab = new CTabItem(folder, SWT.NULL);
    tab.setText(title);
    tab.setShowClose(false);

    folder.setSelection(tab);
}
 
Example 9
Source File: NewDataflowProjectWizardLandingPage.java    From google-cloud-eclipse with Apache License 2.0 5 votes vote down vote up
private static Combo addCombo(Composite formComposite, String labelText, boolean readOnly) {
  addLabel(formComposite, labelText);

  Combo combo = new Combo(formComposite,
      SWT.DROP_DOWN | (readOnly ? SWT.READ_ONLY : SWT.NULL));
  combo.setLayoutData(gridSpan(GridData.FILL_HORIZONTAL, 2));
  return combo;
}
 
Example 10
Source File: PickOverrideKeysAndParmName.java    From uima-uimaj with Apache License 2.0 5 votes vote down vote up
/**
 * Adds the selected parms.
 *
 * @param parms the parms
 * @param keyName the key name
 */
/*
 * Filter overridable parameters to exclude: 
 * - already overridden (can't override same parameter twice) 
 * - those with different type or multi-valued-ness 
 */
private void addSelectedParms(ConfigurationParameter[] parms, String keyName) {
  /*boolean isMultiValued = (null != parameterDialog) ? parameterDialog.multiValueUI
          .getSelection() : cp.isMultiValued();
  String type = (null != parameterDialog) ? parameterDialog.parmTypeUI.getText() : cp.getType();*/
  boolean isMultiValued = cp.isMultiValued();
  String type = cp.getType();

  if (null != parms) {
    for (int i = 0; i < parms.length; i++) {
      // multi-valued-ness must match
      if ((isMultiValued != parms[i].isMultiValued()))
        continue;
      // types must match, but we also allow if no type is spec'd - not sure if this is useful
      if ((null != type && !"".equals(type) && //$NON-NLS-1$
      !type.equals(parms[i].getType())))
        continue;
      // parameter must not be already overridden, unless we're editing an existing one
      String override = keyName + '/' + parms[i].getName();
      if (adding && null != ParameterDelegatesSection.getOverridingParmName(override, cg))
        continue;

      TableItem tableItem = new TableItem(paramsUI, SWT.NULL);
      tableItem.setText(parms[i].getName());
      tableItem.setData(parms[i]);
    }
  }
}
 
Example 11
Source File: ProjectSettingLanguagePage.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create contents of the preference page.
 * @param parent
 */
@Override
public Control createContents(Composite parent) {
	Composite container = new Composite(parent, SWT.NULL);
	container.setLayout(new GridLayout(1, false));

	// source language control
	Group sourceLanguageGrp = new Group(container, SWT.NONE);
	sourceLanguageGrp.setLayout(new GridLayout(1, false));
	sourceLanguageGrp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	sourceLanguageGrp.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.sourceLanguageGrp"));

	srcLangComboViewer = new TableComboViewer(sourceLanguageGrp, SWT.READ_ONLY | SWT.BORDER);
	TableCombo tableCombo = srcLangComboViewer.getTableCombo();
	// set options.
	tableCombo.setShowTableLines(false);
	tableCombo.setShowTableHeader(false);
	tableCombo.setDisplayColumnIndex(-1);
	tableCombo.setShowImageWithinSelection(true);
	tableCombo.setShowColorWithinSelection(false);
	tableCombo.setShowFontWithinSelection(false);
	tableCombo.setVisibleItemCount(20);

	srcLangComboViewer.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	srcLangComboViewer.setLabelProvider(new LanguageLabelProvider());
	srcLangComboViewer.setContentProvider(new ArrayContentProvider());
	srcLangComboViewer.setInput(languages);
	srcLangComboViewer.setComparer(elementComparer);
	initDataBindings();
	// end source language

	// target language control
	Group targetLanguageGrp = new Group(container, SWT.NONE);
	targetLanguageGrp.setLayout(new GridLayout(3, false));
	targetLanguageGrp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
	targetLanguageGrp.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.targetLanguageGrp"));
	targetLangControl.createControl(targetLanguageGrp);
	parent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
	return container;
}
 
Example 12
Source File: ViewUtils.java    From BiglyBT with GNU General Public License v2.0 5 votes vote down vote up
private static void setViewRequires( Composite genComposite, boolean one_or_more ){
	if (genComposite == null || genComposite.isDisposed()) {
		return;
	}
	Utils.disposeComposite(genComposite, false);

	Label lab = new Label(genComposite, SWT.NULL);
	
	if ( genComposite.getLayout() instanceof GridLayout ){
		GridData gridData = new GridData(SWT.CENTER, SWT.CENTER, true, true);
		gridData.verticalIndent = 10;
		lab.setLayoutData(gridData);
	}else{
		lab.setLayoutData( Utils.getFilledFormData());
	}
	Messages.setLanguageText(lab, one_or_more?"view.one.or.more.download":"view.one.download.only");

	genComposite.layout(true);

	Composite parent = genComposite.getParent();
	if (parent instanceof ScrolledComposite) {
		ScrolledComposite scrolled_comp = (ScrolledComposite) parent;

		Rectangle r = scrolled_comp.getClientArea();
		scrolled_comp.setMinSize(genComposite.computeSize(r.width, SWT.DEFAULT ));
	}

}
 
Example 13
Source File: ComponentTitledFolder.java    From arx with Apache License 2.0 5 votes vote down vote up
/**
 * Sets an entry visible
 * @return
 */
private boolean setVisible(String text) {
    List<TitledFolderEntry> list = getInvisibleEntries();
    
    // Find
    for (TitledFolderEntry entry : list) {
        if (entry.text.equals(text)) {

            // Shift
            int index = entry.index;
            for (TitledFolderEntry other : list) {
                if (other.index < entry.index) {
                    index--;
                }
            }
            
            // Show
            CTabItem item = new CTabItem(folder, SWT.NULL, index);
            item.setText(entry.text);
            if (entry.image!=null) item.setImage(entry.image);
            item.setShowClose(false);
            item.setControl(entry.control);
            return true;
        }
    }
    return false;
}
 
Example 14
Source File: AboutWindow.java    From ProtocolAnalyzer with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Auto-generated main method to display this
 * org.eclipse.swt.widgets.Dialog inside a new Shell.
 */
public static void main(String[] args) {
    try {
        Display display = Display.getDefault();
        Shell shell = new Shell(display);
        AboutWindow inst = new AboutWindow(shell, SWT.NULL);
        inst.open();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 15
Source File: CompositeTableSnippet6.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public AddressEditor(Composite parent, int style) {
	super(parent, style | SWT.BORDER);
	
	setLayout(new GridLayout(2, true));
	new Label(this, SWT.NULL).setText("Name:");
	new Label(this, SWT.NULL);
	
	name = new Text(this, SWT.BORDER);
	name.setLayoutData(spanGD());
	
	new Label(this, SWT.NULL).setText("Address:");
	new Label(this, SWT.NULL);
	
	address1 = new Text(this, SWT.BORDER);
	address1.setLayoutData(spanGD());
	address2 = new Text(this, SWT.BORDER);
	address2.setLayoutData(spanGD());
	
	new Label(this, SWT.NULL).setText("City:");
	new Label(this, SWT.NULL).setText("State:");
	
	city = new Text(this, SWT.BORDER);
	city.setLayoutData(fillGD());
	state = new Combo(this, SWT.BORDER);
	state.setLayoutData(fillGD());
	
	new Label(this, SWT.NULL).setText("Zip:");
	new Label(this, SWT.NULL);
	
	postalCode = new Text(this, SWT.BORDER);
	postalCode.setLayoutData(spanGD());
}
 
Example 16
Source File: TableHierarchicalExample.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Create the controls that compose the console test.
 * 
 */
protected void createControls(IHierarchicalJaretTableModel hierarchicalModel) {
    GridLayout gl = new GridLayout();
    gl.numColumns = 1;
    _shell.setLayout(gl);

    GridData gd = new GridData(GridData.FILL_BOTH);

    _jt = new JaretTable(_shell, SWT.V_SCROLL | SWT.H_SCROLL);
    _jt.setLayoutData(gd);

    IHierarchicalJaretTableModel hmodel = hierarchicalModel;

    if (hierarchicalModel == null) {

        ITableNode root = new DummyTableNode("tn1", "tn1", "Root", "This the root node");
        ITableNode r1 = new DummyTableNode("tn11", "tn12", "1", "Child 1 of the root");
        ITableNode r2 = new DummyTableNode("tn12", "tn12", "2", "Child 2 of the root");
        ITableNode r3 = new DummyTableNode("tn13", "tn13", "3", "Child 3 of the root");
        root.addNode(r1);
        root.addNode(r2);
        root.addNode(r3);

        r1.addNode(new DummyTableNode("tn111", "tn111", "1", "A second level child"));
        r1.addNode(new DummyTableNode("tn112", "tn112", "2", "Another second level child"));

        ITableNode n1 = new DummyTableNode("tn131", "tn131", "1", "A second level child");
        r3.addNode(n1);
        ITableNode n2 = new DummyTableNode("tn132", "tn132", "2", "Another second level child");
        r3.addNode(n2);

        n1.addNode(new DummyTableNode("tn1311", "tn1311", "1", "A third level child"));
        n1.addNode(new DummyTableNode("tn1312", "tn1312", "2", "Another third level child"));

        DefaultHierarchicalTableModel dhmodel = new DefaultHierarchicalTableModel(root);
        hmodel = dhmodel;

        if (SUPPORT_DND) {
            // init the simple drag and drop handling
            initDND(_jt, _shell);
        }
    }

    _jt.setTableModel(hmodel);
    StdHierarchicalTableModel model = (StdHierarchicalTableModel) _jt.getTableModel();
    IColumn hcol = new HierarchyColumn();
    // create and setup hierarchy renderer
    final TableHierarchyRenderer hierarchyRenderer = new TableHierarchyRenderer();
    hierarchyRenderer.setLabelProvider(new LabelProvider());
    hierarchyRenderer.setDrawIcons(true);
    hierarchyRenderer.setDrawLabels(true);
    _jt.registerCellRenderer(hcol, hierarchyRenderer);
    model.addColumn(hcol);

    model.addColumn(new PropCol("b1", "column 1", "B1"));
    model.addColumn(new PropCol("t1", "column 2", "T1"));
    model.addColumn(new PropCol("t2", "column 3", "T2"));
    model.addColumn(new PropCol("t3", "column 4", "T3"));

    JaretTableActionFactory af = new JaretTableActionFactory();

    MenuManager mm = new MenuManager();
    mm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_CONFIGURECOLUMNS));
    _jt.setHeaderContextMenu(mm.createContextMenu(_jt));

    MenuManager rm = new MenuManager();
    rm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_OPTROWHEIGHT));
    rm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_OPTALLROWHEIGHTS));
    _jt.setRowContextMenu(rm.createContextMenu(_jt));

    TableControlPanel ctrlPanel = new TableControlPanel(_shell, SWT.NULL, _jt);

    Label l = new Label(_shell, SWT.NONE);
    l.setText("Level width:");
    final Scale levelWidthScale = new Scale(_shell, SWT.HORIZONTAL);
    levelWidthScale.setMaximum(40);
    levelWidthScale.setMinimum(0);
    levelWidthScale.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent ev) {
            int val = levelWidthScale.getSelection();
            hierarchyRenderer.setLevelWidth(val);
            _jt.redraw();
        }
    });

}
 
Example 17
Source File: UISWTViewSkinAdapter.java    From BiglyBT with GNU General Public License v2.0 4 votes vote down vote up
protected void
initialise(
	Composite		parent,
	Object			data_source )
{
	Composite skin_area = new Composite( parent, SWT.NULL );

	skin_area.setLayout( new FormLayout());

	skin_area.setLayoutData( new GridData( GridData.FILL_BOTH ));

	skin.initialize( skin_area, wrapper_id );

	so = skin.getSkinObjectByID( target_id );

	so.triggerListeners( SWTSkinObjectListener.EVENT_DATASOURCE_CHANGED, data_source );

	so.setVisible( true );

	skin.layout();
}
 
Example 18
Source File: SimpleFileSetsEditor.java    From eclipse-cs with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Control createContents(Composite parent) throws CheckstylePluginException {

  mController = new Controller();

  // group composite containing the config settings
  Group configArea = new Group(parent, SWT.NULL);
  configArea.setText(Messages.SimpleFileSetsEditor_titleSimpleConfig);
  configArea.setLayout(new FormLayout());

  this.mBtnManageConfigs = new Button(configArea, SWT.PUSH);
  this.mBtnManageConfigs.setText(Messages.SimpleFileSetsEditor_btnManageConfigs);
  this.mBtnManageConfigs.addSelectionListener(mController);
  FormData fd = new FormData();
  fd.top = new FormAttachment(0, 3);
  fd.right = new FormAttachment(100, -3);
  this.mBtnManageConfigs.setLayoutData(fd);

  mComboViewer = new ComboViewer(configArea);
  mComboViewer.getCombo().setVisibleItemCount(10);
  mComboViewer.setContentProvider(new CheckConfigurationContentProvider());
  mComboViewer.setLabelProvider(new CheckConfigurationLabelProvider());
  mComboViewer.setComparator(new CheckConfigurationViewerSorter());
  mComboViewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  mComboViewer.addSelectionChangedListener(mController);
  fd = new FormData();
  fd.left = new FormAttachment(0, 3);
  fd.top = new FormAttachment(0, 3);
  fd.right = new FormAttachment(mBtnManageConfigs, -3, SWT.LEFT);
  // fd.right = new FormAttachment(100, -3);
  mComboViewer.getCombo().setLayoutData(fd);

  // Description
  Label lblConfigDesc = new Label(configArea, SWT.LEFT);
  lblConfigDesc.setText(Messages.SimpleFileSetsEditor_lblDescription);
  fd = new FormData();
  fd.left = new FormAttachment(0, 3);
  fd.top = new FormAttachment(mComboViewer.getCombo(), 3, SWT.BOTTOM);
  fd.right = new FormAttachment(100, -3);
  lblConfigDesc.setLayoutData(fd);

  this.mTxtConfigDescription = new Text(configArea,
          SWT.LEFT | SWT.WRAP | SWT.MULTI | SWT.READ_ONLY | SWT.BORDER | SWT.VERTICAL);
  fd = new FormData();
  fd.left = new FormAttachment(0, 3);
  fd.top = new FormAttachment(lblConfigDesc, 0, SWT.BOTTOM);
  fd.right = new FormAttachment(100, -3);
  fd.bottom = new FormAttachment(100, -3);
  this.mTxtConfigDescription.setLayoutData(fd);

  // init the check configuration combo
  mComboViewer.setInput(mPropertyPage.getProjectConfigurationWorkingCopy());
  if (mDefaultFileSet.getCheckConfig() != null) {
    mComboViewer.setSelection(new StructuredSelection(mDefaultFileSet.getCheckConfig()));
  }

  return configArea;
}
 
Example 19
Source File: ScriptValuesMetaModDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void buildSpecialFunctionsTree() {

    TreeItem item = new TreeItem( wTree, SWT.NULL );
    item.setImage( guiresource.getImageBol() );
    item.setText( BaseMessages.getString( PKG, "ScriptValuesDialogMod.TansformConstant.Label" ) );
    TreeItem itemT = new TreeItem( item, SWT.NULL );
    itemT.setImage( imageArrowGreen );
    itemT.setText( "SKIP_PIPELINE" );
    itemT.setData( "SKIP_PIPELINE" );
    // itemT = new TreeItem(item, SWT.NULL);
    // itemT.setText("ABORT_PIPELINE");
    // itemT.setData("ABORT_PIPELINE");
    itemT = new TreeItem( item, SWT.NULL );
    itemT.setImage( imageArrowGreen );
    itemT.setText( "ERROR_PIPELINE" );
    itemT.setData( "ERROR_PIPELINE" );
    itemT = new TreeItem( item, SWT.NULL );
    itemT.setImage( imageArrowGreen );
    itemT.setText( "CONTINUE_PIPELINE" );
    itemT.setData( "CONTINUE_PIPELINE" );

    item = new TreeItem( wTree, SWT.NULL );
    item.setImage( guiresource.getImageBol() );
    item.setText( BaseMessages.getString( PKG, "ScriptValuesDialogMod.TransformFunctions.Label" ) );
    String strData = "";

    // Adding the Grouping Items to the Tree
    TreeItem itemStringFunctionsGroup = new TreeItem( item, SWT.NULL );
    itemStringFunctionsGroup.setImage( imageUnderGreen );
    itemStringFunctionsGroup
      .setText( BaseMessages.getString( PKG, "ScriptValuesDialogMod.StringFunctions.Label" ) );
    itemStringFunctionsGroup.setData( "Function" );
    TreeItem itemNumericFunctionsGroup = new TreeItem( item, SWT.NULL );
    itemNumericFunctionsGroup.setImage( imageUnderGreen );
    itemNumericFunctionsGroup.setText( BaseMessages
      .getString( PKG, "ScriptValuesDialogMod.NumericFunctions.Label" ) );
    itemNumericFunctionsGroup.setData( "Function" );
    TreeItem itemDateFunctionsGroup = new TreeItem( item, SWT.NULL );
    itemDateFunctionsGroup.setImage( imageUnderGreen );
    itemDateFunctionsGroup.setText( BaseMessages.getString( PKG, "ScriptValuesDialogMod.DateFunctions.Label" ) );
    itemDateFunctionsGroup.setData( "Function" );
    TreeItem itemLogicFunctionsGroup = new TreeItem( item, SWT.NULL );
    itemLogicFunctionsGroup.setImage( imageUnderGreen );
    itemLogicFunctionsGroup.setText( BaseMessages.getString( PKG, "ScriptValuesDialogMod.LogicFunctions.Label" ) );
    itemLogicFunctionsGroup.setData( "Function" );
    TreeItem itemSpecialFunctionsGroup = new TreeItem( item, SWT.NULL );
    itemSpecialFunctionsGroup.setImage( imageUnderGreen );
    itemSpecialFunctionsGroup.setText( BaseMessages
      .getString( PKG, "ScriptValuesDialogMod.SpecialFunctions.Label" ) );
    itemSpecialFunctionsGroup.setData( "Function" );
    TreeItem itemFileFunctionsGroup = new TreeItem( item, SWT.NULL );
    itemFileFunctionsGroup.setImage( imageUnderGreen );
    itemFileFunctionsGroup.setText( BaseMessages.getString( PKG, "ScriptValuesDialogMod.FileFunctions.Label" ) );
    itemFileFunctionsGroup.setData( "Function" );

    // Loading the Default delivered JScript Functions
    // Method[] methods = ScriptValuesAddedFunctions.class.getMethods();
    // String strClassType = ScriptValuesAddedFunctions.class.toString();

    Hashtable<String, String> hatFunctions = scVHelp.getFunctionList();

    Vector<String> v = new Vector<String>( hatFunctions.keySet() );
    Collections.sort( v );

    for ( String strFunction : v ) {
      String strFunctionType = hatFunctions.get( strFunction );
      int iFunctionType = Integer.valueOf( strFunctionType ).intValue();

      TreeItem itemFunction = null;
      switch ( iFunctionType ) {
        case ScriptValuesAddedFunctions.STRING_FUNCTION:
          itemFunction = new TreeItem( itemStringFunctionsGroup, SWT.NULL );
          break;
        case ScriptValuesAddedFunctions.NUMERIC_FUNCTION:
          itemFunction = new TreeItem( itemNumericFunctionsGroup, SWT.NULL );
          break;
        case ScriptValuesAddedFunctions.DATE_FUNCTION:
          itemFunction = new TreeItem( itemDateFunctionsGroup, SWT.NULL );
          break;
        case ScriptValuesAddedFunctions.LOGIC_FUNCTION:
          itemFunction = new TreeItem( itemLogicFunctionsGroup, SWT.NULL );
          break;
        case ScriptValuesAddedFunctions.SPECIAL_FUNCTION:
          itemFunction = new TreeItem( itemSpecialFunctionsGroup, SWT.NULL );
          break;
        case ScriptValuesAddedFunctions.FILE_FUNCTION:
          itemFunction = new TreeItem( itemFileFunctionsGroup, SWT.NULL );
          break;
        default:
          break;
      }
      if ( itemFunction != null ) {
        itemFunction.setText( strFunction );
        itemFunction.setImage( imageArrowGreen );
        strData = "jsFunction";
        itemFunction.setData( strData );
      }
    }
  }
 
Example 20
Source File: FolderSelectionGroup.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Create group
 * 
 * @param parent
 */
public void create( Composite parent )
{
	// get font
	Font font = parent.getFont( );

	// label control
	Label label = new Label( parent, SWT.LEFT );
	label.setFont( font );
	label.setText( this.labelText );

	Composite composite = new Composite( parent, SWT.NULL );
	GridLayout layout = new GridLayout( );
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	layout.numColumns = 2;
	composite.setLayout( layout );

	GridData data = new GridData( GridData.FILL_HORIZONTAL );
	composite.setLayoutData( data );

	// text control
	text = new Text( composite, SWT.BORDER );
	text.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	text.setFont( font );
	text.setText( this.textValue );
	text.addVerifyListener( new VerifyListener( ) {

		public void verifyText( VerifyEvent e )
		{
			e.doit = e.text.indexOf( DELIMITER ) < 0;
		}
	} );

	// directory selection button
	button = new Button( composite, SWT.PUSH );
	button.setFont( font );
	button.setText( this.buttonText );
	button.addSelectionListener( new SelectionAdapter( ) {

		public void widgetSelected( SelectionEvent event )
		{
			dialog = new DirectoryDialog( PlatformUI.getWorkbench( )
					.getDisplay( ).getActiveShell( ) );

			dialog.setText( dialogTitle );
			dialog.setMessage( dialogMessage );
			dialog.setFilterPath( dialogFilterPath );
			String folderName = dialog.open( );
			if ( folderName == null )
			{
				return;
			}
			text.setText( folderName );
		}
	} );
}