Java Code Examples for org.eclipse.swt.layout.GridData#GRAB_VERTICAL

The following examples show how to use org.eclipse.swt.layout.GridData#GRAB_VERTICAL . 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: ExceptionDialog.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected Text createTextArea(Composite parent) {
	_textArea = new Text(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
			| SWT.MULTI);

	StringWriter sw = new StringWriter();
	PrintWriter pw = new PrintWriter(sw);
	_exception.printStackTrace(pw);

	_textArea.setText(sw.toString());

	GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
			| GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL
			| GridData.GRAB_VERTICAL);
	data.heightHint = 200;
	data.horizontalSpan = 2;
	_textArea.setLayoutData(data);
	_textArea.setFont(parent.getFont());
	_textArea.setEditable(false);
	_textCreated = true;
	return _textArea;
}
 
Example 2
Source File: LogFileTypeDialog.java    From LogViewer with Eclipse Public License 2.0 6 votes vote down vote up
protected Control createDialogArea(Composite parent) {
   	String fileTypeName = "File";
	// create composite
	Composite composite = (Composite) super.createDialogArea(parent);
	// create combo
	typeCombo = new Combo(composite,SWT.LEFT);
	GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
	typeCombo.setLayoutData(data);
	// fill
   	IConsole[] consoles = ConsolePlugin.getDefault().getConsoleManager().getConsoles();
   	typeCombo.add(fileTypeName);
   	value = fileTypeName;    	
   	for (int i=0;i<consoles.length;i++) {
   		typeCombo.add("Console: " + consoles[i].getName());
   	}
	applyDialogFont(composite);
	return composite;
}
 
Example 3
Source File: SVNWizardPage.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
protected TreeViewer createResourceSelectionTree(Composite composite, int types, int span) {
	TreeViewer tree = new TreeViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
	tree.setUseHashlookup(true);
	tree.setContentProvider(getResourceProvider(types));
	tree.setLabelProvider(
		new DecoratingLabelProvider(
			new WorkbenchLabelProvider(), 
			SVNUIPlugin.getPlugin().getWorkbench().getDecoratorManager().getLabelDecorator()));
	tree.setSorter(new ResourceSorter(ResourceSorter.NAME));
	
	GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
	data.heightHint = LIST_HEIGHT_HINT;
	data.horizontalSpan = span;
	tree.getControl().setLayoutData(data);
	return tree;
}
 
Example 4
Source File: FindbugsPropertyPage.java    From spotbugs with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void createConfigurationTabFolder(Composite composite) {
    tabFolder = new TabFolder(composite, SWT.TOP);
    GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL | GridData.FILL_VERTICAL
            | GridData.GRAB_VERTICAL);
    layoutData.verticalIndent = -5;
    tabFolder.setLayoutData(layoutData);

    reportConfigurationTab = createReportConfigurationTab(tabFolder);
    filterFilesTab = createFilterFilesTab(tabFolder);
    workspaceSettingsTab = createWorkspaceSettings(tabFolder);
    detectorTab = createDetectorConfigurationTab(tabFolder);
}
 
Example 5
Source File: RebootConfirmDialog.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected Control createDialogArea(Composite parent) {
	// create composite
	Composite composite = (Composite) super.createDialogArea(parent);
	// create message
	if (message != null) {
		Label label = new Label(composite, SWT.WRAP);
		label.setText(message);
		GridData data = new GridData(GridData.GRAB_HORIZONTAL
				| GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
				| GridData.VERTICAL_ALIGN_CENTER);
		data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
		label.setLayoutData(data);
		label.setFont(parent.getFont());
	}
	// label=new Label(composite,SWT.NONE);
	// label.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
	// | GridData.HORIZONTAL_ALIGN_FILL));
	// label.setText("12345678");
	errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
	errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
			| GridData.HORIZONTAL_ALIGN_FILL));
	errorMessageText.setBackground(errorMessageText.getDisplay()
			.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
	// Set the error message text
	// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
	setErrorMessage(errorMessage);

	applyDialogFont(composite);
	return composite;
}
 
Example 6
Source File: InputDialogWithLongMessage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    // create message
    if (message != null) {
        Text messageText = new Text(composite,
                SWT.BORDER | SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL);
        messageText.setText(message);
        GridData data = new GridData(GridData.GRAB_HORIZONTAL
                | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
                | GridData.VERTICAL_ALIGN_CENTER);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        messageText.setLayoutData(data);
        messageText.setFont(parent.getFont());
    }
    text = new Text(composite, getInputTextStyle());
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
            | GridData.HORIZONTAL_ALIGN_FILL));
    text.addModifyListener(e -> validateInput());
    errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
            | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay()
            .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    // Set the error message text
    // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
    setErrorMessage(errorMessage);

    applyDialogFont(composite);
    return composite;
}
 
Example 7
Source File: ScriptEditor.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent){
	Composite ret = new Composite(parent, SWT.NONE);
	GridData full =
		new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
	ret.setLayoutData(full);
	ret.setLayout(new FillLayout());
	text = new Text(ret, SWT.MULTI | SWT.BORDER);
	text.setText(StringTool.unNull(script));
	return ret;
}
 
Example 8
Source File: TabRenameDialog.java    From LogViewer with Eclipse Public License 2.0 5 votes vote down vote up
protected Control createDialogArea(Composite parent) {
	// create composite
	Composite composite = (Composite) super.createDialogArea(parent);
	// create text input field
	nameField = new Text(composite,SWT.LEFT);
	GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
	nameField.setLayoutData(data);
	// fill the text with the current tab name
	nameField.setText(oldValue);
	applyDialogFont(composite);
	return composite;
}
 
Example 9
Source File: TermDbManagerDialog.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	final Composite composite = (Composite) super.createDialogArea(parent);
	GridLayout parentLayout = ((GridLayout) composite.getLayout());
	parentLayout.numColumns = 4;
	parentLayout.marginHeight = 0;
	parentLayout.marginWidth = 0;
	parentLayout.marginTop = 0;
	parentLayout.verticalSpacing = 0;
	parentLayout.horizontalSpacing = 0;

	Control treeControl = createTreeAreaContents(composite);
	createSash(composite, treeControl);

	Label versep = new Label(composite, SWT.SEPARATOR | SWT.VERTICAL);
	GridData verGd = new GridData(GridData.FILL_VERTICAL | GridData.GRAB_VERTICAL);

	versep.setLayoutData(verGd);
	versep.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true));

	Composite pageAreaComposite = new Composite(composite, SWT.NONE);
	pageAreaComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
	GridLayout layout = new GridLayout(1, true);
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	layout.verticalSpacing = 0;
	pageAreaComposite.setLayout(layout);

	// Build the Page container
	Composite pageContainer = createPageContainer(pageAreaComposite);
	GridData pageContainerData = new GridData(GridData.FILL_BOTH);
	pageContainerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN;
	pageContainer.setLayoutData(pageContainerData);
	// Build the separator line
	Label bottomSeparator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
	bottomSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
	return composite;
}
 
Example 10
Source File: InputURLDialog.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected Control createDialogArea(Composite parent) {
      // create composite
      Composite composite = (Composite) super.createDialogArea(parent);
      // create message
      if (message != null) {
          Label label = new Label(composite, SWT.WRAP);
          label.setText(message);
          GridData data = new GridData(GridData.GRAB_HORIZONTAL
                  | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
                  | GridData.VERTICAL_ALIGN_CENTER);
          data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
          label.setLayoutData(data);
          label.setFont(parent.getFont());
      }
      combo = new CCombo(composite, getInputComboStyle());
      combo.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
              | GridData.HORIZONTAL_ALIGN_FILL));
      combo.addModifyListener(new ModifyListener() {
          public void modifyText(ModifyEvent e) {
              validateInput();
          }
      });
      errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
      errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
              | GridData.HORIZONTAL_ALIGN_FILL));
      errorMessageText.setBackground(errorMessageText.getDisplay()
              .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
errorMessageText.setForeground(errorMessageText.getDisplay()
		.getSystemColor(SWT.COLOR_RED));
      // Set the error message text
      // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
      setErrorMessage(errorMessage);

      applyDialogFont(composite);
      return composite;
  }
 
Example 11
Source File: CommentTemplateEditDialog.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected Control createDialogArea(Composite parent) {
      // create composite
      Composite composite = (Composite) super.createDialogArea(parent);
      // create message
      if (message != null) {
          Label label = new Label(composite, SWT.WRAP);
          label.setText(message);
          GridData data = new GridData(GridData.GRAB_HORIZONTAL
                  | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
                  | GridData.VERTICAL_ALIGN_CENTER);
          data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
          label.setLayoutData(data);
          label.setFont(parent.getFont());
      }
      text = new Text(composite, SWT.MULTI | SWT.BORDER);
      GridData gd = new GridData(GridData.GRAB_HORIZONTAL
              | GridData.HORIZONTAL_ALIGN_FILL);
gd.heightHint = convertHeightInCharsToPixels(5);
text.setLayoutData(gd);
      text.addModifyListener(new ModifyListener() {
          public void modifyText(ModifyEvent e) {
              validateInput();
          }
      });
      errorMessageText = new Text(composite, SWT.READ_ONLY);
      errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
              | GridData.HORIZONTAL_ALIGN_FILL));
      errorMessageText.setBackground(errorMessageText.getDisplay()
              .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));

      applyDialogFont(composite);
      return composite;
  }
 
Example 12
Source File: TermDbManagerDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create contents of the dialog.
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
	final Composite composite = (Composite) super.createDialogArea(parent);
	GridLayout parentLayout = ((GridLayout) composite.getLayout());
	parentLayout.numColumns = 4;
	parentLayout.marginHeight = 0;
	parentLayout.marginWidth = 0;
	parentLayout.marginTop = 0;
	parentLayout.verticalSpacing = 0;
	parentLayout.horizontalSpacing = 0;

	Control treeControl = createTreeAreaContents(composite);
	createSash(composite, treeControl);

	Label versep = new Label(composite, SWT.SEPARATOR | SWT.VERTICAL);
	GridData verGd = new GridData(GridData.FILL_VERTICAL | GridData.GRAB_VERTICAL);

	versep.setLayoutData(verGd);
	versep.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true));

	Composite pageAreaComposite = new Composite(composite, SWT.NONE);
	pageAreaComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
	GridLayout layout = new GridLayout(1, true);
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	layout.verticalSpacing = 0;
	pageAreaComposite.setLayout(layout);

	// Build the Page container
	Composite pageContainer = createPageContainer(pageAreaComposite);
	GridData pageContainerData = new GridData(GridData.FILL_BOTH);
	pageContainerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN;
	pageContainer.setLayoutData(pageContainerData);
	// Build the separator line
	Label bottomSeparator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
	bottomSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
	return composite;
}
 
Example 13
Source File: ReverseConversionWizardPage.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 创建文件列表区域
 * @param contents
 *            ;
 */
private Composite createFilesGroup(Composite contents) {
	Composite filesComposite = new Composite(contents, SWT.NONE);
	filesComposite.setLayout(new GridLayout(1, false));
	filesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));

	filesTable = new Table(filesComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI
			| SWT.FULL_SELECTION);

	GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
	tableData.heightHint = 100;
	filesTable.setLayoutData(tableData);
	filesTable.setLinesVisible(true);
	filesTable.setHeaderVisible(true);

	filesTable.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			TableItem[] selected = filesTable.getSelection();
			if (selected.length == 0) {
				return;
			}

			String strTgtEnc = ""; //$NON-NLS-1$

			for (int i = 0; i < selected.length; i++) {
				String curTgtEnc = selected[i].getText(2);
				if (i == 0) {
					strTgtEnc = curTgtEnc;
				} else {
					if (!strTgtEnc.equals(curTgtEnc)) {
						strTgtEnc = ""; //$NON-NLS-1$
						break;
					}
				}
			}

			if (!"".equals(strTgtEnc)) { //$NON-NLS-1$
				tgtEncCombo.setText(strTgtEnc);
			} else {
				tgtEncCombo.deselectAll();
			}
		}
	});
	tableViewer = new TableViewer(filesTable);

	lineNumberColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
	lineNumberColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.lineNumberColumn"));
	
	xliffColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
	xliffColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.xliffColumn")); //$NON-NLS-1$

	tgtEncColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
	tgtEncColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.tgtEncColumn")); //$NON-NLS-1$

	targetColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
	targetColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.targetColumn")); //$NON-NLS-1$

	IValueProperty[] valueProperties = BeanProperties.values(ConversionConfigBean.class, new String[] {
			"index","source", "targetEncoding", "target" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
	ViewerSupport.bind(tableViewer, new WritableList(conversionConfigBeans, ConversionConfigBean.class),
			valueProperties);

	filesComposite.addPaintListener(new PaintListener() {
		public void paintControl(PaintEvent arg0) {
			int width = filesTable.getClientArea().width;
			lineNumberColumn.setWidth(width * 1 / 10);
			targetColumn.setWidth(width * 4 / 10);
			tgtEncColumn.setWidth(width * 1 / 10);
			xliffColumn.setWidth(width * 4 / 10);
		}
	});
	return filesComposite;
}
 
Example 14
Source File: HsPreferenceDialog.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
protected Control createDialogArea(Composite parent) {
	Composite composite = new Composite(parent, SWT.NONE);
	GridLayout parentcomLayout = new GridLayout();
	parentcomLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
	parentcomLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
	parentcomLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
	parentcomLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
	composite.setLayout(parentcomLayout);
	composite.setLayoutData(new GridData(GridData.FILL_BOTH));
	applyDialogFont(composite);

	GridLayout parentLayout = ((GridLayout) composite.getLayout());
	parentLayout.numColumns = 4;
	parentLayout.marginHeight = 0;
	parentLayout.marginWidth = 0;
	parentLayout.verticalSpacing = 0;
	parentLayout.horizontalSpacing = 0;

	composite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

	Control treeControl = createTreeAreaContents(composite);
	createSash(composite, treeControl);

	Label versep = new Label(composite, SWT.SEPARATOR | SWT.VERTICAL);
	GridData verGd = new GridData(GridData.FILL_VERTICAL | GridData.GRAB_VERTICAL);

	versep.setLayoutData(verGd);
	versep.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true));

	Composite pageAreaComposite = new Composite(composite, SWT.NONE);
	pageAreaComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
	GridLayout layout = new GridLayout(1, true);
	layout.marginHeight = 0;
	layout.marginWidth = 0;
	layout.verticalSpacing = 0;
	pageAreaComposite.setLayout(layout);

	// Build the Page container
	Composite pageContainer = createPageContainer(pageAreaComposite);
	GridData pageContainerData = new GridData(GridData.FILL_BOTH);
	pageContainerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN;
	pageContainer.setLayoutData(pageContainerData);

	super.setPageContainer(pageContainer);
	// Build the separator line
	Label bottomSeparator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
	bottomSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
	return composite;
}
 
Example 15
Source File: ReverseConversionWizardPage.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 创建文件列表区域
 * @param contents
 *            ;
 */
private Composite createFilesGroup(Composite contents) {
	Composite filesComposite = new Composite(contents, SWT.NONE);
	filesComposite.setLayout(new GridLayout(1, false));
	filesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));

	filesTable = new Table(filesComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI
			| SWT.FULL_SELECTION);

	GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
	tableData.heightHint = 100;
	filesTable.setLayoutData(tableData);
	filesTable.setLinesVisible(true);
	filesTable.setHeaderVisible(true);

	filesTable.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			TableItem[] selected = filesTable.getSelection();
			if (selected.length == 0) {
				return;
			}

			String strTgtEnc = ""; //$NON-NLS-1$

			for (int i = 0; i < selected.length; i++) {
				String curTgtEnc = selected[i].getText(1);
				if (i == 0) {
					strTgtEnc = curTgtEnc;
				} else {
					if (!strTgtEnc.equals(curTgtEnc)) {
						strTgtEnc = ""; //$NON-NLS-1$
						break;
					}
				}
			}

			if (!"".equals(strTgtEnc)) { //$NON-NLS-1$
				tgtEncCombo.setText(strTgtEnc);
			} else {
				tgtEncCombo.deselectAll();
			}
		}
	});
	tableViewer = new TableViewer(filesTable);

	xliffColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
	xliffColumn.setText("XLIFF 文件"); //$NON-NLS-1$

	tgtEncColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
	tgtEncColumn.setText("目标编码"); //$NON-NLS-1$

	targetColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
	targetColumn.setText("目标文件"); //$NON-NLS-1$

	IValueProperty[] valueProperties = BeanProperties.values(ConversionConfigBean.class, new String[] {
			"source", "targetEncoding", "target" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
	ViewerSupport.bind(tableViewer, new WritableList(conversionConfigBeans, ConversionConfigBean.class),
			valueProperties);

	filesComposite.addPaintListener(new PaintListener() {
		public void paintControl(PaintEvent arg0) {
			int width = filesTable.getClientArea().width;
			targetColumn.setWidth(width * 4 / 10);
			tgtEncColumn.setWidth(width * 2 / 10);
			xliffColumn.setWidth(width * 4 / 10);
		}
	});
	return filesComposite;
}
 
Example 16
Source File: UpdateTMWizardPage.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
public void createContent(Composite parent) {
	TableViewer tableViewer = new TableViewer(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
	final Table table = tableViewer.getTable();
	GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
	tableData.heightHint = 160;
	table.setLayoutData(tableData);
	table.setLinesVisible(true);
	table.setHeaderVisible(true);
	
	TableColumn columnNumber = new TableColumn(table, SWT.LEFT);
	columnNumber.setText(Messages.getString("wizard.UpdateTMWizardPage.columnNumber"));
	columnNumber.setWidth(50);
	
	TableColumn columnPath = new TableColumn(table, SWT.LEFT);
	columnPath.setText(Messages.getString("wizard.UpdateTMWizardPage.columnPath"));
	columnPath.setWidth(400);
	
	tableViewer.setLabelProvider(new TableViewerLabelProvider());
	tableViewer.setContentProvider(new ArrayContentProvider());
	tableViewer.setInput(getTableInfo());
	
	Group groupStatus = new Group(parent, SWT.None);
	groupStatus.setLayout(new GridLayout());
	groupStatus.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	groupStatus.setText(Messages.getString("dialog.UpdateTMDialog.lbl"));
	btnDraft = new Button(groupStatus, SWT.CHECK);
	btnDraft.setText(Messages.getString("dialog.UpdateTMDialog.btnDraft"));

	btnTranslated = new Button(groupStatus, SWT.CHECK);
	btnTranslated.setText(Messages.getString("dialog.UpdateTMDialog.btnTranslated"));
	btnTranslated.setSelection(true);

	btnApproved = new Button(groupStatus, SWT.CHECK);
	btnApproved.setText(Messages.getString("dialog.UpdateTMDialog.btnApproved"));
	btnApproved.setSelection(true);

	btnSignedOff = new Button(groupStatus, SWT.CHECK);
	btnSignedOff.setText(Messages.getString("dialog.UpdateTMDialog.btnSignedOff"));
	btnSignedOff.setSelection(true);
	
	btnLocked = new Button(groupStatus, SWT.CHECK);
	btnLocked.setText(Messages.getString("dialog.UpdateTMWizardPage.btnLocked"));
}
 
Example 17
Source File: ConfigurationWizardRepositorySourceProviderPage.java    From APICloud-Studio with GNU General Public License v3.0 4 votes vote down vote up
public void createControl(Composite parent) {
	Composite outerContainer = new Composite(parent,SWT.NONE);
	outerContainer.setLayout(new GridLayout());
	outerContainer.setLayoutData(
	new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
	
	Composite treeGroup = new Composite(outerContainer, SWT.NONE);
	GridLayout treeLayout = new GridLayout();
	treeLayout.numColumns = 1;
	treeGroup.setLayout(treeLayout);
	treeGroup.setLayoutData(
	new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));

	treeViewer = new TreeViewer(treeGroup, SWT.BORDER | SWT.SINGLE);
	treeViewer.setLabelProvider(new RepositorySourceLabelProvider());	
	treeViewer.setContentProvider(new RepositorySourceContentProvider());
	treeViewer.setUseHashlookup(true);
	GridData layoutData = new GridData();
	layoutData.grabExcessHorizontalSpace = true;
	layoutData.grabExcessVerticalSpace = true;
	layoutData.horizontalAlignment = GridData.FILL;
	layoutData.verticalAlignment = GridData.FILL;
	layoutData.minimumHeight = 300;
	layoutData.minimumWidth = 300;
	treeViewer.getControl().setLayoutData(layoutData);
	treeViewer.setInput(this);
	
	treeViewer.setSelection(new StructuredSelection("URL"));
	
	treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
		public void selectionChanged(SelectionChangedEvent event) {
			Object selectedObject = ((IStructuredSelection)treeViewer.getSelection()).getFirstElement();
			if (selectedObject instanceof ISVNRepositorySourceProvider) {
				selectedRepositorySourceProvider = (ISVNRepositorySourceProvider)selectedObject;
			}
			else {
				selectedRepositorySourceProvider = null;
			}
			setPageComplete(!treeViewer.getSelection().isEmpty());
		}		
	});
	
	Hyperlink repositoryProviderLink = new Hyperlink(treeGroup, SWT.NONE);
	repositoryProviderLink.setUnderlined(true);
	repositoryProviderLink.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
	repositoryProviderLink.setText("Click here to see the list of available providers.");
	repositoryProviderLink.setToolTipText(REPOSITORY_PROVIDERS_WIKI_URL);
	repositoryProviderLink.addHyperlinkListener(new HyperlinkAdapter() {
		public void linkActivated(HyperlinkEvent evt) {
			showAvailableProviders();		
		}
	});
	
       Composite cloudForgeComposite = new CloudForgeComposite(outerContainer, SWT.NONE);
       GridData data = new GridData(GridData.VERTICAL_ALIGN_END | GridData.GRAB_VERTICAL | GridData.FILL_VERTICAL);
       cloudForgeComposite.setLayoutData(data);

	setControl(outerContainer);
}
 
Example 18
Source File: SDViewerPage.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
    GridLayout gl = new GridLayout();
    gl.marginHeight = 0;
    gl.marginWidth = 0;
    parent.setLayout(gl);
    Composite page = new Composite(parent, SWT.NONE);
    GridLayout pageLayout = new GridLayout();
    pageLayout.numColumns = 2;
    GridData pageLayoutdata = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    page.setLayoutData(pageLayoutdata);
    page.setLayout(pageLayout);

    fTooltip = new BooleanFieldEditor(ISDPreferences.PREF_TOOLTIP, Messages.SequenceDiagram_ShowTooltips, page);
    fTooltip.setPreferenceStore(fPreferences.getPreferenceStore());
    fTooltip.load();

    // link font with zoom pref
    fLink = new BooleanFieldEditor(ISDPreferences.PREF_LINK_FONT, Messages.SequenceDiagram_IncreaseFontSizeWhenZooming, page);
    fLink.setPreferenceStore(fPreferences.getPreferenceStore());
    fLink.load();

    fNoExternalTime = new BooleanFieldEditor(ISDPreferences.PREF_EXCLUDE_EXTERNAL_TIME, Messages.SequenceDiagram_ExcludeExternalTime, page);
    fNoExternalTime.setPreferenceStore(fPreferences.getPreferenceStore());
    fNoExternalTime.load();

    // use gradient color pref
    fUseGrad = new BooleanFieldEditor(ISDPreferences.PREF_USE_GRADIENT, Messages.SequenceDiagram_UseGradientColor, page);
    fUseGrad.setPreferenceStore(fPreferences.getPreferenceStore());
    fUseGrad.load();

    Label separator = new Label(page, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);
    GridData sepData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL);
    separator.setLayoutData(sepData);

    Composite prefPage = new Composite(page, SWT.NONE);
    GridLayout prefPageLayout = new GridLayout();
    prefPage.setLayoutData(pageLayoutdata);
    prefPageLayout.numColumns = 1;
    prefPage.setLayout(prefPageLayout);

    // swimLane width pref
    fLifelineWidth = new IntegerFieldEditor(ISDPreferences.PREF_LIFELINE_WIDTH, Messages.SequenceDiagram_LifelineWidth, prefPage);
    fLifelineWidth.setPreferenceStore(fPreferences.getPreferenceStore());
    fLifelineWidth.setValidRange(119, 500);
    fLifelineWidth.load();

    // not very nice
    new Label(prefPage, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);
    new Label(prefPage, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);

    // Font list pref
    fClassItemList = new List(prefPage, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    GridData tabItemLayoutdata = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    fClassItemList.setLayoutData(tabItemLayoutdata);

    String[] fontList2 = SDViewPref.getFontList2();
    for (int i = 0; i < fontList2.length; i++) {
        fClassItemList.add(fontList2[i]);
    }
    fClassItemList.setSelection(0);
    fClassItemList.addSelectionListener(this);
    fButtonArea = new Composite(prefPage, SWT.NONE);
    GridData tabItemLayoutdata2 = new GridData(GridData.HORIZONTAL_ALIGN_FILL/* |GridData.GRAB_HORIZONTAL */| GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL);
    fButtonArea.setLayoutData(tabItemLayoutdata2);
    GridLayout buttonAreaLayout = new GridLayout();
    buttonAreaLayout.numColumns = 1;
    fButtonArea.setLayout(buttonAreaLayout);

    // font selector initialise for the lifeline font pref
    String[] fontList = SDViewPref.getFontList();
    fFont = new FontFieldEditor(fontList[0], "",//$NON-NLS-1$
            Messages.SequenceDiagram_AaBbYyZz, fButtonArea);
    fFont.getPreviewControl().setSize(500, 500);
    fFont.setPreferenceStore(fPreferences.getPreferenceStore());
    fFont.load();

    fBackGroundColor = new ColorFieldEditor(fontList[0] + SDViewPref.BACK_COLOR_POSTFIX, Messages.SequenceDiagram_Background, fButtonArea);
    fBackGroundColor.setPreferenceStore(fPreferences.getPreferenceStore());
    fBackGroundColor.load();

    fLineColor = new ColorFieldEditor(fontList[0] + SDViewPref.FORE_COLOR_POSTFIX, Messages.SequenceDiagram_Lines, fButtonArea);
    fLineColor.setPreferenceStore(fPreferences.getPreferenceStore());
    fLineColor.load();

    fTextColor = new ColorFieldEditor(fontList[0] + SDViewPref.TEXT_COLOR_POSTFIX, Messages.SequenceDiagram_Text, fButtonArea);
    fTextColor.setPreferenceStore(fPreferences.getPreferenceStore());
    fTextColor.load();
    swapPref(true);
    Dialog.applyDialogFont(page);

    return page;
}
 
Example 19
Source File: UpdateTMWizardPage.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
public void createContent(Composite parent) {
	TableViewer tableViewer = new TableViewer(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
	final Table table = tableViewer.getTable();
	GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
	tableData.heightHint = 160;
	table.setLayoutData(tableData);
	table.setLinesVisible(true);
	table.setHeaderVisible(true);
	
	TableColumn columnNumber = new TableColumn(table, SWT.LEFT);
	columnNumber.setText(Messages.getString("wizard.UpdateTMWizardPage.columnNumber"));
	columnNumber.setWidth(50);
	
	TableColumn columnPath = new TableColumn(table, SWT.LEFT);
	columnPath.setText(Messages.getString("wizard.UpdateTMWizardPage.columnPath"));
	columnPath.setWidth(400);
	
	tableViewer.setLabelProvider(new TableViewerLabelProvider());
	tableViewer.setContentProvider(new ArrayContentProvider());
	tableViewer.setInput(getTableInfo());
	
	Group groupStatus = new Group(parent, SWT.None);
	groupStatus.setLayout(new GridLayout());
	groupStatus.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	groupStatus.setText(Messages.getString("dialog.UpdateTMDialog.lbl"));
	btnDraft = new Button(groupStatus, SWT.CHECK);
	btnDraft.setText(Messages.getString("dialog.UpdateTMDialog.btnDraft"));

	btnTranslated = new Button(groupStatus, SWT.CHECK);
	btnTranslated.setText(Messages.getString("dialog.UpdateTMDialog.btnTranslated"));
	btnTranslated.setSelection(true);

	btnApproved = new Button(groupStatus, SWT.CHECK);
	btnApproved.setText(Messages.getString("dialog.UpdateTMDialog.btnApproved"));
	btnApproved.setSelection(true);

	btnSignedOff = new Button(groupStatus, SWT.CHECK);
	btnSignedOff.setText(Messages.getString("dialog.UpdateTMDialog.btnSignedOff"));
	btnSignedOff.setSelection(true);
	
	btnLocked = new Button(groupStatus, SWT.CHECK);
	btnLocked.setText(Messages.getString("dialog.UpdateTMWizardPage.btnLocked"));
}
 
Example 20
Source File: ReverseConversionWizardPage.java    From tmxeditor8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 创建文件列表区域
 * @param contents
 *            ;
 */
private Composite createFilesGroup(Composite contents) {
	Composite filesComposite = new Composite(contents, SWT.NONE);
	filesComposite.setLayout(new GridLayout(1, false));
	filesComposite.setLayoutData(new GridData(GridData.FILL_BOTH));

	filesTable = new Table(filesComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI
			| SWT.FULL_SELECTION);

	GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH);
	tableData.heightHint = 100;
	filesTable.setLayoutData(tableData);
	filesTable.setLinesVisible(true);
	filesTable.setHeaderVisible(true);

	filesTable.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			TableItem[] selected = filesTable.getSelection();
			if (selected.length == 0) {
				return;
			}

			String strTgtEnc = ""; //$NON-NLS-1$

			for (int i = 0; i < selected.length; i++) {
				String curTgtEnc = selected[i].getText(1);
				if (i == 0) {
					strTgtEnc = curTgtEnc;
				} else {
					if (!strTgtEnc.equals(curTgtEnc)) {
						strTgtEnc = ""; //$NON-NLS-1$
						break;
					}
				}
			}

			if (!"".equals(strTgtEnc)) { //$NON-NLS-1$
				tgtEncCombo.setText(strTgtEnc);
			} else {
				tgtEncCombo.deselectAll();
			}
		}
	});
	tableViewer = new TableViewer(filesTable);

	xliffColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
	xliffColumn.setText("XLIFF 文件"); //$NON-NLS-1$

	tgtEncColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
	tgtEncColumn.setText("目标编码"); //$NON-NLS-1$

	targetColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn();
	targetColumn.setText("目标文件"); //$NON-NLS-1$

	IValueProperty[] valueProperties = BeanProperties.values(ConversionConfigBean.class, new String[] {
			"source", "targetEncoding", "target" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
	ViewerSupport.bind(tableViewer, new WritableList(conversionConfigBeans, ConversionConfigBean.class),
			valueProperties);

	filesComposite.addPaintListener(new PaintListener() {
		public void paintControl(PaintEvent arg0) {
			int width = filesTable.getClientArea().width;
			targetColumn.setWidth(width * 4 / 10);
			tgtEncColumn.setWidth(width * 2 / 10);
			xliffColumn.setWidth(width * 4 / 10);
		}
	});
	return filesComposite;
}