use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class LoginDialogV2 method createBrandingArea.
protected void createBrandingArea(Composite container) {
brandingArea = new Composite(container, SWT.NONE);
brandingArea.setLayout(new FormLayout());
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
ImageDescriptor imageDescriptor = brandingService.getLoginVImage();
GridData brandingAreaGridData = new GridData(GridData.FILL_BOTH);
if (imageDescriptor != null) {
Image imageCanvas = imageDescriptor.createImage();
// int width = (int) Math.ceil(realWidthRate * imageCanvas.getBounds().width);
// maybe use the same rate for
int width = (int) Math.ceil(realHeightRate * imageCanvas.getBounds().width);
// image width and height is
// better
int height = (int) Math.ceil(realHeightRate * imageCanvas.getBounds().height);
Image scaledImage = scaleImage(imageCanvas, width, height);
brandingArea.setBackgroundImage(scaledImage);
brandingAreaGridData.widthHint = scaledImage.getBounds().width;
brandingAreaGridData.heightHint = scaledImage.getBounds().height;
} else {
brandingAreaGridData.widthHint = (int) Math.ceil(realWidthRate * 200);
brandingAreaGridData.heightHint = (int) Math.ceil(realHeightRate * 280);
}
brandingArea.setLayoutData(brandingAreaGridData);
errorMessageArea = new Composite(brandingArea, SWT.NONE);
FormData formData = new FormData();
formData.bottom = new FormAttachment(100, -5);
formData.left = new FormAttachment(0, 5);
formData.right = new FormAttachment(100, -5);
errorMessageArea.setLayoutData(formData);
GridLayout layout = new GridLayout(1, false);
layout.marginHeight = 10;
layout.marginWidth = 10;
errorMessageArea.setLayout(layout);
errorTextLabel = new StyledText(errorMessageArea, SWT.WRAP);
errorTextLabel.setEditable(false);
errorTextLabel.setCaret(null);
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
errorTextLabel.setLayoutData(layoutData);
}
use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class LoginDialog method configureShell.
/**
* @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
*/
@Override
protected void configureShell(final Shell newShell) {
super.configureShell(newShell);
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
//$NON-NLS-1$
newShell.setText(Messages.getString("LoginDialog.title", brandingService.getFullProductName()));
}
use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class ProcessController method createControl.
@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;
IElementParameter processTypeParameter = param.getChildParameters().get(EParameterName.PROCESS_TYPE_PROCESS.getName());
Text labelText;
final DecoratedField dField = new DecoratedField(subComposite, SWT.BORDER, 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;
//$NON-NLS-1$
btn = getWidgetFactory().createButton(subComposite, "", SWT.PUSH);
btnSize = btn.computeSize(SWT.DEFAULT, SWT.DEFAULT);
btn.setImage(ImageProvider.getImage(CoreUIPlugin.getImageDescriptor(DOTS_BUTTON)));
btn.addSelectionListener(listenerSelection);
//$NON-NLS-1$
btn.setData(PARAMETER_NAME, param.getName() + ":" + processTypeParameter.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);
// **********************
//$NON-NLS-1$
hashCurControls.put(param.getName() + ":" + processTypeParameter.getName(), labelText);
Point initialSize = dField.getLayoutControl().computeSize(SWT.DEFAULT, SWT.DEFAULT);
// feature 19312
IElementParameter useDynamicJobParameter = param.getElement().getElementParameter(EParameterName.USE_DYNAMIC_JOB.getName());
if (useDynamicJobParameter != null && useDynamicJobParameter instanceof IElementParameter) {
Object useDynamicJobValue = useDynamicJobParameter.getValue();
if (useDynamicJobValue != null && useDynamicJobValue instanceof Boolean) {
isSelectUseDynamic = (Boolean) useDynamicJobValue;
}
}
Control lastControlUsed = btn;
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
boolean allowVerchange = brandingService.getBrandingConfiguration().isAllowChengeVersion();
if (allowVerchange) {
lastControlUsed = addJobVersionCombo(subComposite, param.getChildParameters().get(EParameterName.PROCESS_TYPE_VERSION.getName()), lastControlUsed, numInRow + 1, nbInRow, top);
}
if (!isSelectUseDynamic) {
addContextCombo(subComposite, param.getChildParameters().get(EParameterName.PROCESS_TYPE_CONTEXT.getName()), lastControlUsed, numInRow + 1, nbInRow, top);
}
dynamicProperty.setCurRowSize(Math.max(initialSize.y, btnSize.y) + ITabbedPropertyConstants.VSPACE);
return btn;
}
use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class UserComponentsProvider method getInstallationFolder.
@Override
public File getInstallationFolder() throws IOException {
String componentsPath = IComponentsFactory.COMPONENTS_LOCATION;
IBrandingService breaningService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
if (breaningService.isPoweredOnlyCamel()) {
componentsPath = IComponentsFactory.CAMEL_COMPONENTS_LOCATION;
}
Bundle b = Platform.getBundle(componentsPath);
File installationFolder = null;
//$NON-NLS-1$
IPath nullPath = new Path("");
URL url = FileLocator.find(b, nullPath, null);
URL fileUrl = FileLocator.toFileURL(url);
File bundleFolder = new File(fileUrl.getPath());
IPath path = new Path(IComponentsFactory.COMPONENTS_INNER_FOLDER).append(IComponentsFactory.EXTERNAL_COMPONENTS_INNER_FOLDER);
path = path.append(ComponentUtilities.getExtFolder(getFolderName()));
installationFolder = new File(bundleFolder, path.toOSString());
return installationFolder;
}
use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class CodeGenerator method initializeJetBean.
/**
* Initialize Jet Bean to pass to the Jet Generator.
*
* @param argument the node to convert
* @return the initialized JetBean
*/
private JetBean initializeJetBean(Object argument) {
JetBean jetBean = new JetBean();
if (argument == null) {
jetBean.setJetPluginRepository(CodeGeneratorActivator.PLUGIN_ID);
} else {
if (argument instanceof CodeGeneratorArgument) {
CodeGeneratorArgument codeArgument = (CodeGeneratorArgument) argument;
if (codeArgument.getArgument() instanceof INode) {
String componentsPath = IComponentsFactory.COMPONENTS_LOCATION;
IBrandingService breaningService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
if (breaningService.isPoweredOnlyCamel()) {
componentsPath = IComponentsFactory.CAMEL_COMPONENTS_LOCATION;
}
jetBean.setJetPluginRepository(componentsPath);
} else {
jetBean.setJetPluginRepository(CodeGeneratorActivator.PLUGIN_ID);
}
} else {
jetBean.setJetPluginRepository(CodeGeneratorActivator.PLUGIN_ID);
}
}
jetBean.setArgument(argument);
return jetBean;
}
Aggregations