use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class ImportProjectAsWizardPage method evaluateSpecifiedPath.
private void evaluateSpecifiedPath(String path) {
if (path.equals(lastPath)) {
return;
}
// on an empty path empty selectedProjects
if (path == null || path.length() == 0) {
checkFieldsValue();
return;
}
final boolean dirSelected = this.projectFromDirectoryRadio.getSelection();
File directory = new File(path);
Collection projectFiles = new ArrayList();
Collection talendProjectFiles = new ArrayList();
if (!dirSelected && ArchiveFileManipulations.isTarFile(path)) {
TarFile sourceTarFile = getSpecifiedTarSourceFile(path);
if (sourceTarFile == null) {
return;
}
TarLeveledStructureProvider provider = new TarLeveledStructureProvider(sourceTarFile);
Object child = provider.getRoot();
if (!ImportProjectsUtilities.collectProjectFilesFromProvider(projectFiles, provider, child, 0, null, IProjectDescription.DESCRIPTION_FILE_NAME)) {
return;
}
if (!ImportProjectsUtilities.collectProjectFilesFromProvider(talendProjectFiles, provider, child, 0, null, FileConstants.LOCAL_PROJECT_FILENAME)) {
return;
}
if (!ImportProjectsUtilities.collectProjectFilesFromProvider(talendProjectFiles, provider, child, 0, null, FileConstants.OLD_TALEND_PROJECT_FILENAME)) {
return;
}
} else if (!dirSelected && ArchiveFileManipulations.isZipFile(path)) {
ZipFile sourceFile = getSpecifiedZipSourceFile(path);
if (sourceFile == null) {
return;
}
ZipLeveledStructureProvider provider = new ZipLeveledStructureProvider(sourceFile);
Object child = provider.getRoot();
if (!ImportProjectsUtilities.collectProjectFilesFromProvider(projectFiles, provider, child, 0, null, IProjectDescription.DESCRIPTION_FILE_NAME)) {
return;
}
if (!ImportProjectsUtilities.collectProjectFilesFromProvider(talendProjectFiles, provider, child, 0, null, FileConstants.LOCAL_PROJECT_FILENAME)) {
return;
}
if (!ImportProjectsUtilities.collectProjectFilesFromProvider(talendProjectFiles, provider, child, 0, null, FileConstants.OLD_TALEND_PROJECT_FILENAME)) {
return;
}
} else if (dirSelected && directory.isDirectory()) {
if (!ImportProjectsUtilities.collectProjectFilesFromDirectory(projectFiles, directory, null, IProjectDescription.DESCRIPTION_FILE_NAME)) {
return;
}
if (!ImportProjectsUtilities.collectProjectFilesFromDirectory(talendProjectFiles, directory, null, FileConstants.LOCAL_PROJECT_FILENAME)) {
return;
}
if (!ImportProjectsUtilities.collectProjectFilesFromDirectory(talendProjectFiles, directory, null, FileConstants.OLD_TALEND_PROJECT_FILENAME)) {
return;
}
}
lastPath = path;
if (projectFiles.size() != 1 || talendProjectFiles.size() != 1) {
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
String string = //$NON-NLS-1$
Messages.getString(//$NON-NLS-1$
"ImportProjectAsWizardPage.error.notATalendProject", brandingService.getShortProductName());
fileContentStatus = new Status(IStatus.ERROR, RepositoryPlugin.PLUGIN_ID, IStatus.OK, string, null);
} else {
fileContentStatus = createOkStatus();
}
checkFieldsValue();
}
use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class JobJavaScriptOSGIForESBManager method createAnalyzer.
protected Analyzer createAnalyzer(ExportFileResource libResource, ProcessItem processItem) throws IOException {
Analyzer analyzer = new Analyzer();
Jar bin = new Jar(classesLocation);
analyzer.setJar(bin);
final String bundleName = processItem.getProperty().getLabel();
String symbolicName = bundleName;
// http://jira.talendforge.org/browse/TESB-5382 LiXiaopeng
Project project = ProjectManager.getInstance().getCurrentProject();
if (project != null) {
String proName = project.getLabel();
if (proName != null) {
symbolicName = proName.toLowerCase() + '.' + symbolicName;
}
}
analyzer.setProperty(Analyzer.BUNDLE_NAME, bundleName);
analyzer.setProperty(Analyzer.BUNDLE_SYMBOLICNAME, symbolicName);
analyzer.setProperty(Analyzer.BUNDLE_VERSION, getBundleVersion());
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
analyzer.setProperty(Analyzer.BUNDLE_VENDOR, //$NON-NLS-1$
brandingService.getFullProductName() + " (" + brandingService.getAcronym() + '_' + RepositoryPlugin.getDefault().getBundle().getVersion().toString() + //$NON-NLS-1$
")");
addOsgiDependencies(analyzer, libResource, processItem);
//$NON-NLS-1$
final StringBuilder bundleClasspath = new StringBuilder(".");
final StringBuilder bundleNativeCode = new StringBuilder();
Set<String> relativePathList = libResource.getRelativePathList();
for (String path : relativePathList) {
Set<URL> resources = libResource.getResourcesByRelativePath(path);
for (URL url : resources) {
File dependencyFile = new File(FilesUtils.getFileRealPath(url.getPath()));
String relativePath = libResource.getDirectoryName() + PATH_SEPARATOR + dependencyFile.getName();
bundleClasspath.append(MANIFEST_ITEM_SEPARATOR).append(relativePath);
bin.putResource(relativePath, new FileResource(dependencyFile));
// Add dynamic library declaration in manifest
if (relativePath.toLowerCase().endsWith(DLL_FILE) || relativePath.toLowerCase().endsWith(SO_FILE)) {
bundleNativeCode.append(libResource.getDirectoryName() + PATH_SEPARATOR + dependencyFile.getName()).append(OSGI_OS_CODE);
}
}
}
analyzer.setProperty(Analyzer.BUNDLE_CLASSPATH, bundleClasspath.toString());
// TESB-15680: Add Bundle-NativeCode in manifest
if (bundleNativeCode.length() > 0) {
bundleNativeCode.setLength(bundleNativeCode.length() - 1);
analyzer.setProperty(Analyzer.BUNDLE_NATIVECODE, bundleNativeCode.toString());
}
return analyzer;
}
use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class JavaJobScriptsExportWSWizardPage method createControl.
@Override
public void createControl(Composite parent) {
initializeDialogUnits(parent);
GridLayout layout = new GridLayout();
SashForm sash = createExportTree(parent);
// Added a scrolled composite by Marvin Wang on Feb. 27, 2012 for bug TDI-19198.
scrolledComposite = new ScrolledComposite(sash, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
pageComposite = new Group(scrolledComposite, SWT.NONE);
pageComposite.setLayout(layout);
pageComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
pageComposite.setFont(parent.getFont());
setControl(sash);
sash.setWeights(new int[] { 0, 1, 23 });
layout = new GridLayout();
layout.marginHeight = 0;
layout.verticalSpacing = 0;
destinationNameFieldComposite = new Composite(pageComposite, SWT.NONE);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
destinationNameFieldComposite.setLayoutData(gridData);
destinationNameFieldComposite.setLayout(layout);
destinationNameFieldInnerComposite = new Composite(destinationNameFieldComposite, SWT.NONE);
gridData = new GridData(GridData.FILL_HORIZONTAL);
destinationNameFieldInnerComposite.setLayoutData(gridData);
destinationNameFieldInnerComposite.setLayout(layout);
createDestinationGroup(destinationNameFieldInnerComposite);
// createExportTree(pageComposite);
if (!isMultiNodes()) {
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
boolean allowVerchange = brandingService.getBrandingConfiguration().isAllowChengeVersion();
if (allowVerchange) {
createJobVersionGroup(pageComposite);
} else {
selectedJobVersion = "0.1";
}
}
createExportTypeGroup(pageComposite);
createOptionsGroupButtons(pageComposite);
// ie.- local
restoreResourceSpecificationWidgetValues();
updateWidgetEnablements();
setPageComplete(determinePageCompletion());
giveFocusToDestination();
pageComposite.setSize(pageComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
scrolledComposite.setMinSize(pageComposite.getSize());
scrolledComposite.setContent(pageComposite);
}
use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class ConnectionFormComposite method validateFields.
private boolean validateFields() {
String errorMsg = null;
boolean valid = true;
if (dialog.getOKButton() != null) {
dialog.getOKButton().setEnabled(true);
}
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
boolean isOnlyRemoteConnection = brandingService.getBrandingConfiguration().isOnlyRemoteConnection();
boolean usesMailCheck = brandingService.getBrandingConfiguration().isUseMailLoginCheck();
LabelText emptyUrl = null;
if (getRepository() != null) {
for (LabelText currentUrlLabel : dynamicRequiredControls.get(getRepository()).values()) {
if (valid && currentUrlLabel.getText().length() == 0) {
emptyUrl = currentUrlLabel;
}
}
}
if (valid && getRepository() == null) {
//$NON-NLS-1$
errorMsg = Messages.getString("connections.form.emptyField.repository");
} else if (valid && getTextName().length() == 0) {
//$NON-NLS-1$
errorMsg = Messages.getString("connections.form.emptyField.connname");
} else if (valid && getUser().length() == 0) {
//$NON-NLS-1$
errorMsg = Messages.getString("connections.form.emptyField.username");
} else if (valid && isLocalConnection() && !Pattern.matches(RepositoryConstants.MAIL_PATTERN, getUser())) {
//$NON-NLS-1$
errorMsg = Messages.getString("connections.form.malformedField.username");
} else if (valid && emptyUrl != null) {
//$NON-NLS-1$
errorMsg = Messages.getString("connections.form.dynamicFieldEmpty", emptyUrl.getLabel());
} else if (valid && !this.isValidatedWorkspace(this.getWorkspace())) {
//$NON-NLS-1$
errorMsg = Messages.getString("ConnectionFormComposite.workspaceInvalid");
} else if (valid && isOnlyRemoteConnection) {
// Uniserv feature 8,Add new Extension point to allow Uniserv to add some custom controls during TAC
// connection check
List<ILoginConnectionService> loginConnections = LoginConnectionManager.getRemoteConnectionService();
for (ILoginConnectionService loginConncetion : loginConnections) {
errorMsg = loginConncetion.checkConnectionValidation(getTextName(), getDesc(), getUser(), getPassword(), getWorkspace(), connection.getDynamicFields().get(RepositoryConstants.REPOSITORY_URL));
}
} else if (valid && getTextName() != null) {
List<ConnectionBean> connectionBeanList = dialog.getConnections();
if (connectionBeanList != null && connectionBeanList.size() > 1) {
for (ConnectionBean connectionBean : connectionBeanList) {
String connectionBeanName = connectionBean.getName();
if (connectionBeanName != null) {
if (this.connection != connectionBean) {
if (connectionBeanName.equals(getTextName())) {
//$NON-NLS-1$
errorMsg = Messages.getString("ConnectionFormComposite.connectionNameInvalid");
}
}
}
}
}
}
if (errorMsg != null && !errorMsg.equals("")) {
//$NON-NLS-1$
valid = false;
}
if (!valid) {
dialog.setErrorMessage(errorMsg);
if (dialog.getOKButton() != null) {
dialog.getOKButton().setEnabled(false);
}
} else {
dialog.setErrorMessage(null);
}
if (connection != null) {
connection.setComplete(valid);
connectionsListComposite.refresh(connection);
}
return valid;
}
use of org.talend.core.ui.branding.IBrandingService in project tdi-studio-se by Talend.
the class ConnectionsDialog method configureShell.
@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()));
}
Aggregations