use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class StandAloneTalendJavaEditor method resetItem.
public void resetItem() throws PersistenceException {
if (item.getProperty().eResource() == null || item.eResource() == null) {
IRepositoryService service = CoreRuntimePlugin.getInstance().getRepositoryService();
IProxyRepositoryFactory factory = service.getProxyRepositoryFactory();
//
// Property updated = factory.getUptodateProperty(getItem().getProperty());
Property updatedProperty = null;
try {
factory.initialize();
IRepositoryViewObject repositoryViewObject = factory.getLastVersion(new Project(ProjectManager.getInstance().getProject(item.getProperty().getItem())), item.getProperty().getId());
if (repositoryViewObject != null) {
updatedProperty = repositoryViewObject.getProperty();
item = (FileItem) updatedProperty.getItem();
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class ExchangeService method openExchangeEditor.
@Override
public void openExchangeEditor() {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (activePage != null) {
Project proj = ProjectManager.getInstance().getCurrentProject();
if (proj.getExchangeUser() == null || checkUserAndPass(proj.getExchangeUser().getUsername(), proj.getExchangeUser().getPassword()) != null) {
if (proj != null) {
if (proj.getExchangeUser().getUsername() == "" && proj.getExchangeUser().getPassword() == "") {
String userEmail = null;
if (proj.getAuthor() != null) {
userEmail = proj.getAuthor().getLogin();
}
TalendForgeDialog tfDialog = new TalendForgeDialog(DisplayUtils.getDefaultShell(), userEmail);
tfDialog.open();
}
// MessageDialog.openError(null, "Exchange", Messages.getString("Exchange.logon.error"));
return;
}
}
try {
ExchangeEditorInput input = new ExchangeEditorInput();
IEditorPart findEditor = activePage.findEditor(input);
if (findEditor == null) {
activePage.openEditor(input, "org.talend.designer.components.exchange.ui.views.ExchangeView");
} else {
activePage.activate(findEditor);
}
} catch (PartInitException e) {
ExceptionHandler.process(e);
}
}
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class SetupProcessDependenciesRoutinesDialog method init.
@SuppressWarnings("unchecked")
private void init(ProcessType process) {
allRoutineItems.clear();
ProjectManager projectManager = ProjectManager.getInstance();
Project currentProject = projectManager.getCurrentProject();
initModels(currentProject);
Set<Project> referenceProjects = new HashSet<Project>();
this.getAllReferenceProjects(currentProject, referenceProjects);
initRefProjects(referenceProjects);
List<RoutinesParameterType> routinesDependencies = process.getParameters().getRoutinesParameter();
List<String> typeNames = new ArrayList<String>();
for (RoutinesParameterType type : routinesDependencies) {
RoutineItemRecord record = new RoutineItemRecord();
record.setName(type.getName());
Property property = findObject(type.getId(), type.getName());
if (property != null) {
// if system, id is not used
record.setId(property.getId());
record.setLabel(property.getLabel());
} else {
record.setHasProblem(true);
// use the record
record.setLabel(type.getName());
}
if (!record.hasProblem()) {
// if lost, willn't display
if (((RoutineItem) property.getItem()).isBuiltIn()) {
systemRoutines.add(record);
} else {
if (typeNames.contains(type.getName())) {
break;
} else {
typeNames.add(type.getName());
userRoutines.add(record);
}
}
}
}
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class ShowRoutineItemsDialog method updateButtons.
@SuppressWarnings("unchecked")
private void updateButtons() {
IStructuredSelection selection = (IStructuredSelection) routineViewer.getSelection();
boolean enabled = !selection.isEmpty();
Iterator iterator = selection.iterator();
while (iterator.hasNext()) {
Object element = iterator.next();
if (element instanceof Property && labelProvider.existed(element) || element instanceof Project) {
enabled = false;
break;
}
}
Button button = getButton(IDialogConstants.OK_ID);
if (button != null && !button.isDisposed()) {
button.setEnabled(enabled);
}
}
use of org.talend.core.model.general.Project in project tdi-studio-se by Talend.
the class SetupProcessDependenciesRoutinesDialog method findObject.
private Property findObject(String idOrName, String name) {
for (Project p : allRoutineItems.keySet()) {
List<Property> list = allRoutineItems.get(p);
if (list != null) {
for (Property property : list) {
String objIdOrName = property.getId();
String objName = property.getLabel();
// objIdOrName = property.getLabel();
if (objIdOrName != null && objIdOrName.equals(idOrName) && property.getItem() instanceof RoutineItem) {
return property;
} else if (objName != null && objName.equals(name) && property.getItem() instanceof RoutineItem) {
return property;
}
}
}
}
return null;
}
Aggregations