use of org.talend.designer.core.model.components.EParameterName in project tdi-studio-se by Talend.
the class DesignerCoreService method getDisplayForProcessParameterFromName.
/**
*
* DOC YeXiaowei Comment method "getDisplayForProcessParameterFromName".
*
* @param name
* @return
*/
@Override
public String getDisplayForProcessParameterFromName(final String name) {
for (EParameterName param : EParameterName.values()) {
String keyName = name;
//$NON-NLS-1$
String suffix = "";
if (name.endsWith("_IMPLICIT_CONTEXT")) {
//$NON-NLS-1$
//$NON-NLS-1$
keyName = name.substring(0, name.indexOf("_IMPLICIT_CONTEXT"));
//$NON-NLS-1$
suffix = " (implict context)";
}
if (param.name().equals(keyName)) {
return param.getDisplayName() + suffix;
}
}
if (name.equals(IJobSettingConstants.PROPERTY_TYPE_IMPLICIT_CONTEXT_PROPERTY_TYPE)) {
//$NON-NLS-1$
return Messages.getString("DesignerCoreService.property");
} else if (name.equals(IJobSettingConstants.PROPERTY_TYPE_IMPLICIT_CONTEXT_REPOSITORY_PROPERTY_TYPE)) {
//$NON-NLS-1$
return Messages.getString("DesignerCoreService.propertySource");
} else if (name.equals(IJobSettingConstants.PROPERTY_TYPE_PROPERTY_TYPE)) {
//$NON-NLS-1$
return Messages.getString("DesignerCoreService.property");
} else if (name.equals(IJobSettingConstants.PROPERTY_TYPE_REPOSITORY_PROPERTY_TYPE)) {
//$NON-NLS-1$
return Messages.getString("DesignerCoreService.propertySource");
}
return name;
}
use of org.talend.designer.core.model.components.EParameterName in project tdi-studio-se by Talend.
the class NotesPasteCommand method createNoteList.
@SuppressWarnings("unchecked")
private void createNoteList() {
int firstIndex = 0;
int index = 0;
noteList = new ArrayList<Note>();
// create the notes
for (NoteEditPart copiedNodePart : noteParts) {
Note copiedNote = (Note) copiedNodePart.getModel();
Note pastedNote = new Note();
pastedNote.setOpaque(copiedNote.isOpaque());
pastedNote.setText(copiedNote.getText());
pastedNote.setSize(copiedNote.getSize());
// see bug 0005571: Copy/Paste of Note doesn't keep Format
EParameterName[] params = new EParameterName[] { EParameterName.NOTE_FONT, EParameterName.FONT_SIZE, EParameterName.FONT_BOLD, EParameterName.FONT_ITALIC, EParameterName.NOTE_LINECOLOR, EParameterName.NOTE_COLOR, EParameterName.NOTETXT_COLOR, EParameterName.NOTETXT_LEFT, EParameterName.NOTETXT_RIGHT, EParameterName.NOTETXT_CENTER, EParameterName.NOTELABEL_CENTER, EParameterName.NOTETXT_TOP, EParameterName.NOTETXT_BOTTOM };
for (EParameterName param : params) {
Object value = copiedNote.getElementParameter(param.getName()).getValue();
pastedNote.getElementParameter(param.getName()).setValue(value);
}
pastedNote.setOpaque(copiedNote.isOpaque());
pastedNote.setProcess(process);
Point location = null;
if (getCursorLocation() == null) {
location = copiedNote.getLocation();
} else {
location = getCursorLocation();
index = noteParts.indexOf(copiedNodePart);
}
if (process.isGridEnabled()) {
// replace the component to set it on the grid if it's enabled
int tempVar = location.x / TalendEditor.GRID_SIZE;
location.x = tempVar * TalendEditor.GRID_SIZE;
tempVar = location.y / TalendEditor.GRID_SIZE;
location.y = tempVar * TalendEditor.GRID_SIZE;
}
pastedNote.setLocation(findLocationForNote(location, copiedNote.getSize(), index, firstIndex));
noteList.add(pastedNote);
}
}
use of org.talend.designer.core.model.components.EParameterName in project tdi-studio-se by Talend.
the class ImplicitContextLoadHelper method saveValuesToPreferencePage.
/**
* DOC hcw Comment method "saveValuesToPreferencePage".
*
* @param elem
* @param extraComposite
*/
public static void saveValuesToPreferencePage(Element element, ExtraComposite extraComposite) {
ECodeLanguage language = LanguageManager.getCurrentLanguage();
//$NON-NLS-1$
String languagePrefix = language.toString() + "_";
EParameterName[] params = { EParameterName.IMPLICIT_TCONTEXTLOAD, EParameterName.FROM_FILE_FLAG, EParameterName.FROM_DATABASE_FLAG, EParameterName.IMPLICIT_TCONTEXTLOAD_FILE, EParameterName.FIELDSEPARATOR, EParameterName.DB_TYPE, EParameterName.HOST, EParameterName.PORT, EParameterName.DBNAME, EParameterName.SCHEMA_DB, EParameterName.USER, EParameterName.PASS, EParameterName.DBFILE, EParameterName.DBTABLE, EParameterName.QUERY_CONDITION, EParameterName.LOAD_NEW_VARIABLE, EParameterName.NOT_LOAD_OLD_VARIABLE, EParameterName.PRINT_OPERATIONS, EParameterName.DISABLE_WARNINGS, EParameterName.DISABLE_ERROR, EParameterName.DISABLE_INFO };
Map<String, EParameterName> extraParams = new HashMap<String, EParameterName>();
for (EParameterName param : params) {
extraParams.put(getExtraParameterName(param), param);
}
List<? extends IElementParameter> elementParameters = element.getElementParameters();
for (IElementParameter elementParameter : elementParameters) {
String name = elementParameter.getName();
Object value = elementParameter.getValue();
if (name.equals(getExtraParameterName(EParameterName.PROPERTY_TYPE))) {
savePropertyTypeToPreference(extraComposite, languagePrefix, elementParameter);
} else if (extraParams.containsKey(name)) {
if (value instanceof String) {
PREFERENCE_STORE.setValue(languagePrefix + getExtraParameterName(extraParams.get(name)), removeQuote((String) value));
} else if (value instanceof Boolean) {
PREFERENCE_STORE.setValue(languagePrefix + getExtraParameterName(extraParams.get(name)), (Boolean) value);
}
}
}
}
use of org.talend.designer.core.model.components.EParameterName in project tdi-studio-se by Talend.
the class ImplicitContextLoadHelper method loadPreferenceValues.
/**
* DOC hcw Comment method "loadPreferenceValues".
*
* @return
*/
@SuppressWarnings("unchecked")
private static Map loadPreferenceValues() {
Map values = new HashMap();
ECodeLanguage language = LanguageManager.getCurrentLanguage();
//$NON-NLS-1$
String languagePrefix = language.toString() + "_";
EParameterName[] params = { EParameterName.IMPLICIT_TCONTEXTLOAD, EParameterName.FROM_FILE_FLAG, EParameterName.FROM_DATABASE_FLAG, EParameterName.PRINT_OPERATIONS, EParameterName.DISABLE_WARNINGS, EParameterName.DISABLE_ERROR, EParameterName.DISABLE_INFO };
putValuesToMap(values, languagePrefix, params, Boolean.class);
params = new EParameterName[] { EParameterName.IMPLICIT_TCONTEXTLOAD_FILE, EParameterName.FIELDSEPARATOR, EParameterName.DB_TYPE, EParameterName.LOAD_NEW_VARIABLE, EParameterName.NOT_LOAD_OLD_VARIABLE };
putValuesToMap(values, languagePrefix, params, String.class);
String propertyType = (String) getPreferenceValue(languagePrefix, EParameterName.PROPERTY_TYPE, String.class);
if (!propertyType.equals(EmfComponent.BUILTIN)) {
params = new EParameterName[] { EParameterName.HOST, EParameterName.PORT, EParameterName.DBNAME, EParameterName.SCHEMA_DB, EParameterName.USER, EParameterName.PASS, EParameterName.DBFILE, EParameterName.DBTABLE, EParameterName.QUERY_CONDITION };
putValuesToMap(values, languagePrefix, params, String.class);
}
return values;
}
Aggregations