org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants Java Examples

The following examples show how to use org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants. 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: TextPropertySection.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createControls(parent, aTabbedPropertySheetPage);
    Composite composite = getWidgetFactory().createFlatFormComposite(parent);
    
    FormData data;

    this.text = getWidgetFactory().createText(composite, getDefaultValue()); //$NON-NLS-1$
    
    data = new FormData();
    data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
    data.right = new FormAttachment(textBoxSize, 0);
    data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
    this.text.setLayoutData(data);

    CLabel labelLabel = getWidgetFactory().createCLabel(composite, getPropertyDefinition().getName()); //$NON-NLS-1$
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(text, -ITabbedPropertyConstants.HSPACE);
    data.top = new FormAttachment(text, 0, SWT.CENTER);
    labelLabel.setLayoutData(data);
}
 
Example #2
Source File: RouteResourceController.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
public int estimateRowSize(Composite subComposite, IElementParameter param) {
    final DecoratedField dField = new DecoratedField(subComposite, SWT.BORDER, new IControlCreator() {

        public Control createControl(Composite parent, int style) {
            return getWidgetFactory().createButton(parent, EParameterName.ROUTE_RESOURCE_TYPE.getDisplayName(), SWT.None);
        }

    });
    Point initialSize = dField.getLayoutControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
    dField.getLayoutControl().dispose();

    return initialSize.y + ITabbedPropertyConstants.VSPACE;
}
 
Example #3
Source File: ConfigOptionController.java    From tesb-studio-se with Apache License 2.0 4 votes vote down vote up
@Override
public Control createControl(Composite subComposite, IElementParameter param, int numInRow, int nbInRow, int top,
        Control lastControl) {

    Button theBtn = getWidgetFactory().createButton(subComposite, "", SWT.PUSH); //$NON-NLS-1$
    theBtn.setBackground(subComposite.getBackground());
    if (param.getDisplayName().equals("")) { //$NON-NLS-1$
        theBtn.setImage(ImageProvider.getImage(CoreUIPlugin.getImageDescriptor(DOTS_BUTTON)));
    } else {
        theBtn.setText(param.getDisplayName());
    }
    FormData data = new FormData();
    if (isInWizard()) {
        if (lastControl != null) {
            data.right = new FormAttachment(lastControl, 0);
        } else {
            data.right = new FormAttachment(100, -ITabbedPropertyConstants.HSPACE);
        }
    } else {
        if (lastControl != null) {
            data.left = new FormAttachment(lastControl, 0);
        } else {
            data.left = new FormAttachment((((numInRow - 1) * MAX_PERCENT) / nbInRow), 0);
        }
    }
    data.top = new FormAttachment(0, top);
    theBtn.setLayoutData(data);
    theBtn.setEnabled(!param.isReadOnly());
    theBtn.setData(param);
    hashCurControls.put(param.getName(), theBtn);
    theBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Command cmd = createCommand((Button) e.getSource());
            executeCommand(cmd);
        }
    });
    Point initialSize = theBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    dynamicProperty.setCurRowSize(initialSize.y + ITabbedPropertyConstants.VSPACE);

    if (nexusServerBean == null) {
        theBtn.setVisible(false);
    }

    Display.getDefault().asyncExec(new Runnable() {

        @Override
        public void run() {
            refresh(param, true);
        }

    });

    return theBtn;
}
 
Example #4
Source File: RouteResourceController.java    From tesb-studio-se with Apache License 2.0 4 votes vote down vote up
@Override
public Control createControl(final Composite subComposite, final IElementParameter param, final int numInRow,
        final int nbInRow, final int top, final Control lastControl) {
    this.curParameter = param;
    this.paramFieldType = param.getFieldType();
    FormData data;

    final DecoratedField dField = new DecoratedField(subComposite, SWT.BORDER | SWT.READ_ONLY,
            new SelectAllTextControlCreator());
    if (param.isRequired()) {
        FieldDecoration decoration = FieldDecorationRegistry.getDefault().getFieldDecoration(
                FieldDecorationRegistry.DEC_REQUIRED);
        dField.addFieldDecoration(decoration, SWT.RIGHT | SWT.TOP, false);
    }
    Control cLayout = dField.getLayoutControl();

    labelText = (Text) dField.getControl();

    labelText.setData(PARAMETER_NAME, param.getName());

    cLayout.setBackground(subComposite.getBackground());
    labelText.setEditable(false);
    if (elem instanceof Node) {
        labelText.setToolTipText(VARIABLE_TOOLTIP + param.getVariableName());
    }

    addDragAndDropTarget(labelText);

    CLabel labelLabel = getWidgetFactory().createCLabel(subComposite, param.getDisplayName());
    data = new FormData();
    if (lastControl != null) {
        data.left = new FormAttachment(lastControl, 0);
    } else {
        data.left = new FormAttachment(((numInRow - 1) * MAX_PERCENT) / (nbInRow + 1), 0);
    }
    data.top = new FormAttachment(0, top);
    labelLabel.setLayoutData(data);
    if (numInRow != 1) {
        labelLabel.setAlignment(SWT.RIGHT);
    }

    data = new FormData();
    int currentLabelWidth = STANDARD_LABEL_WIDTH;
    GC gc = new GC(labelLabel);
    Point labelSize = gc.stringExtent(param.getDisplayName());
    gc.dispose();
    if ((labelSize.x + ITabbedPropertyConstants.HSPACE) > currentLabelWidth) {
        currentLabelWidth = labelSize.x + ITabbedPropertyConstants.HSPACE;
    }

    if (numInRow == 1) {
        if (lastControl != null) {
            data.left = new FormAttachment(lastControl, currentLabelWidth);
        } else {
            data.left = new FormAttachment(0, currentLabelWidth);
        }

    } else {
        data.left = new FormAttachment(labelLabel, 0, SWT.RIGHT);
    }
    data.right = new FormAttachment((numInRow * MAX_PERCENT) / (nbInRow + 1), 0);
    data.top = new FormAttachment(0, top);
    cLayout.setLayoutData(data);

    Button btn;
    Point btnSize;

    btn = getWidgetFactory().createButton(subComposite, "", SWT.PUSH); //$NON-NLS-1$
    btnSize = btn.computeSize(SWT.DEFAULT, SWT.DEFAULT);

    btn.setImage(ImageProvider.getImage(CoreUIPlugin.getImageDescriptor(DOTS_BUTTON)));

    btn.addSelectionListener(listenerSelection);
    btn.setData(PARAMETER_NAME, param.getName());
    btn.setEnabled(!param.isReadOnly());
    data = new FormData();
    data.left = new FormAttachment(cLayout, 0);
    data.right = new FormAttachment(cLayout, STANDARD_BUTTON_WIDTH, SWT.RIGHT);
    data.top = new FormAttachment(0, top);
    data.height = STANDARD_HEIGHT - 2;
    btn.setLayoutData(data);

    hashCurControls.put(param.getName(), labelText);
    Point initialSize = dField.getLayoutControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
    Control lastControlUsed = btn;
    lastControlUsed = addVersionCombo(subComposite,
            param.getChildParameters().get(EParameterName.ROUTE_RESOURCE_TYPE_VERSION.getName()), lastControlUsed,
            numInRow + 1, nbInRow, top);
    dynamicProperty.setCurRowSize(Math.max(initialSize.y, btnSize.y) + ITabbedPropertyConstants.VSPACE);
    return btn;
}
 
Example #5
Source File: ReflectivityDataPropertySection.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * This operation draws the (initial) controls in the properties view based
 * on the input. Adds the <code>DataComponent</code> to a
 * <code>DataComponentComposite</code> to be used in the properties view.
 */
@Override
public void createControls(Composite parent,
		TabbedPropertySheetPage aTabbedPropertySheetPage) {
	super.createControls(parent, aTabbedPropertySheetPage);
	// Get the default background color.
	Color backgroundColor = parent.getBackground();

	// Create a section for the data composites.
	section = getWidgetFactory().createSection(parent,
			Section.SHORT_TITLE_BAR | Section.DESCRIPTION);
	section.setText(data.getName());
	section.setDescription(data.getDescription());
	section.setBackground(backgroundColor);

	dataComposite = new DataComponentComposite(data, section, SWT.NONE);

	// Sets the entries to be enabled to the state of the isEnabled flag
	Control[] children = dataComposite.getChildren();
	for (Control child : children) {
		if (child instanceof IEntryComposite) {
			IEntryComposite entry = (IEntryComposite) child;
			entry.getComposite().setEnabled(isEnabled);
		}
	}

	GridLayout clientLayout = new GridLayout(2, true);

	// Set the margins and spacing based on the tabbed property
	// constants.
	clientLayout.marginLeft = ITabbedPropertyConstants.HMARGIN;
	clientLayout.marginRight = ITabbedPropertyConstants.HMARGIN;
	clientLayout.marginTop = ITabbedPropertyConstants.VMARGIN;
	clientLayout.marginBottom = ITabbedPropertyConstants.VMARGIN;
	clientLayout.horizontalSpacing = ITabbedPropertyConstants.HSPACE;
	clientLayout.verticalSpacing = ITabbedPropertyConstants.VSPACE;
	dataComposite.setLayout(clientLayout);

	// Make the background of the section client white unless ICE is in
	// debug mode.
	if (System.getProperty("DebugICE") == null) {
		dataComposite.setBackground(backgroundColor);
	} else {
		dataComposite.setBackground(
				Display.getCurrent().getSystemColor(SWT.COLOR_RED));
	}

	// Adapt the composite to be rendered with the default widget factory
	// toolkit
	getWidgetFactory().adapt(dataComposite);

	// Set the client area for the section.
	section.setClient(dataComposite);

	return;
}
 
Example #6
Source File: ComponentPropertySection.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * This operation draws the controls in the properties view based on the
 * input.
 */
@Override
public void createControls(Composite parent,
		TabbedPropertySheetPage aTabbedPropertySheetPage) {
	super.createControls(parent, aTabbedPropertySheetPage);

	// Get the default background color (white).
	Color backgroundColor = parent.getBackground();

	// Create a section for the data composites.
	section = getWidgetFactory().createSection(parent,
			ExpandableComposite.SHORT_TITLE_BAR | Section.DESCRIPTION);
	section.setText("Node properties");
	section.setDescription("All properties available for "
			+ "this node can be modified here.");
	section.setBackground(backgroundColor);

	// Create the Composite that contains all DataComponentComposites.
	final Composite client = new Composite(section, SWT.NONE);
	// Set the layout of the client area so that all DataComponentComposites
	// are stacked on top of each other.
	GridLayout clientLayout = new GridLayout();
	// Set the margins and spacing based on the tabbed property constants.
	clientLayout.marginLeft = ITabbedPropertyConstants.HMARGIN;
	clientLayout.marginRight = ITabbedPropertyConstants.HMARGIN;
	clientLayout.marginTop = ITabbedPropertyConstants.VMARGIN;
	clientLayout.marginBottom = ITabbedPropertyConstants.VMARGIN;
	clientLayout.horizontalSpacing = ITabbedPropertyConstants.HSPACE;
	clientLayout.verticalSpacing = ITabbedPropertyConstants.VSPACE;
	client.setLayout(clientLayout);

	// Make the background of the section client white unless ICE is in
	// debug mode.
	if (System.getProperty("DebugICE") == null) {
		client.setBackground(backgroundColor);
	} else {
		client.setBackground(
				Display.getCurrent().getSystemColor(SWT.COLOR_RED));
	}

	// Set the client area for the section.
	section.setClient(client);

	// Get the property viewer's ScrolledComposite and its first Composite
	// (its "client" Composite).
	scrollCompositeClient = section.getParent().getParent().getParent()
			.getParent();
	scrollComposite = (ScrolledComposite) scrollCompositeClient.getParent();

	// Add a listener to resize the Section's properties and update the
	// ScrollComposite's minimum bounds correctly based on the displayed
	// properties.
	scrollComposite.addControlListener(new ControlAdapter() {
		@Override
		public void controlResized(ControlEvent e) {
			resizeProperties();
		}
	});

	return;
}
 
Example #7
Source File: TreePropertySection.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * This operation draws the (initial) controls in the properties view based
 * on the input. In this case, there are initially no widgets to prepare.
 */
@Override
public void createControls(Composite parent,
		TabbedPropertySheetPage aTabbedPropertySheetPage) {
	super.createControls(parent, aTabbedPropertySheetPage);

	// Get the default background color.
	Color backgroundColor = parent.getBackground();

	// Create a section for the data composites.
	section = getWidgetFactory().createSection(parent,
			ExpandableComposite.SHORT_TITLE_BAR | Section.DESCRIPTION);
	section.setText("Node properties");
	section.setDescription("All properties available for "
			+ "this node can be modified here.");
	section.setBackground(backgroundColor);

	// Create the Composite that contains all DataComponentComposites.
	final Composite client = new Composite(section, SWT.NONE);
	GridLayout clientLayout = new GridLayout(2, false);
	// Set the margins and spacing based on the tabbed property constants.
	clientLayout.marginLeft = ITabbedPropertyConstants.HMARGIN;
	clientLayout.marginRight = ITabbedPropertyConstants.HMARGIN;
	clientLayout.marginTop = ITabbedPropertyConstants.VMARGIN;
	clientLayout.marginBottom = ITabbedPropertyConstants.VMARGIN;
	clientLayout.horizontalSpacing = ITabbedPropertyConstants.HSPACE;
	clientLayout.verticalSpacing = ITabbedPropertyConstants.VSPACE;
	client.setLayout(clientLayout);

	// Make the background of the section client white unless ICE is in
	// debug mode.
	if (System.getProperty("DebugICE") == null) {
		client.setBackground(backgroundColor);
	} else {
		client.setBackground(
				Display.getCurrent().getSystemColor(SWT.COLOR_RED));
	}

	// Set the client area for the section.
	section.setClient(client);

	// Get the property viewer's ScrolledComposite and its first Composite
	// (its "client" Composite).
	scrollCompositeClient = section.getParent().getParent().getParent()
			.getParent();
	scrollComposite = (ScrolledComposite) scrollCompositeClient.getParent();

	// Add a listener to resize the Section's properties and update the
	// ScrollComposite's minimum bounds correctly based on the displayed
	// properties.
	scrollComposite.addControlListener(new ControlAdapter() {
		@Override
		public void controlResized(ControlEvent e) {
			resizePropertyView();
		}
	});

	// Create the type Combo Composite.
	typeComposite = createTypeComposite(client);
	GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
	gridData.horizontalSpan = 2;
	typeComposite.setLayoutData(gridData);
	// Refresh the contents of the type Combo and its containing Composite.
	refreshTypeWidgets();

	// Create the table of properties.
	tableViewer = createTableViewer(client);
	// Set the table's layout data so it occupies all spare space in the
	// property section client.
	tableViewer.getControl()
			.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	// Create the add/delete buttons.
	Composite buttonComposite = createButtons(client);
	// The button Composite shouldn't grab any space. Align it along the
	// center and top of the space to the right of the table.
	buttonComposite
			.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false));

	return;
}