use of org.talend.core.model.process.IProcess2 in project tdi-studio-se by Talend.
the class BasicNotePropertyComposite method refresh.
public void refresh() {
IProcess2 process = note.getProcess();
if (process != null) {
boolean readOnly = process.isReadOnly();
if (check != null && !check.isDisposed()) {
check.setEnabled(!readOnly);
}
if (text != null && !text.isDisposed()) {
text.setEnabled(!readOnly);
}
if (fontFamilyCombo != null && !fontFamilyCombo.isDisposed()) {
fontFamilyCombo.setEnabled(!readOnly);
}
if (fontSizeCombo != null && !fontSizeCombo.isDisposed()) {
fontSizeCombo.setEnabled(!readOnly);
}
checkButton(leftBtn, readOnly);
checkButton(rightBtn, readOnly);
checkButton(centreBtn, readOnly);
checkButton(centreLabelBtn, readOnly);
checkButton(topBtn, readOnly);
checkButton(bottomBtn, readOnly);
checkButton(fontBoldButton, readOnly);
checkButton(fontItalicButton, readOnly);
checkButton(fillColorButton, readOnly);
checkButton(fontColorButton, readOnly);
checkButton(lineColorButton, readOnly);
}
}
use of org.talend.core.model.process.IProcess2 in project tdi-studio-se by Talend.
the class SubjobContainerPart method createFigure.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
*/
@Override
protected IFigure createFigure() {
SubjobContainer container = (SubjobContainer) this.getModel();
Boolean isDisplaySubjobs = (container).isDisplayed();
if (!isDisplaySubjobs) {
Figure figure = new FreeformLayer();
figure.setLayoutManager(new FreeformLayout());
return figure;
}
IProcess2 process = container.getProcess();
//$NON-NLS-1$
Object obj = process.getAdditionalProperties().get("FRAMEWORK");
SubjobContainerFigure subjobContainer = null;
if ("Spark Streaming".equals(obj) && !(process.getProperty().getItem() instanceof JobletProcessItem)) {
//$NON-NLS-1$
subjobContainer = new SparkStreamingSubjobContainerFigure(container);
} else {
subjobContainer = new SubjobContainerFigure(container);
}
return subjobContainer;
}
use of org.talend.core.model.process.IProcess2 in project tdi-studio-se by Talend.
the class SubjobContainerFigure method initFigure.
/**
* DOC rdubois Comment method "initFigure".
*/
protected void initFigure() {
outlineFigure = new RoundedRectangle();
rectFig = new RoundedRectangle();
titleFigure = new SimpleHtmlFigure();
titleFigure.setOpaque(true);
collapseFigure = new SubjobCollapseFigure();
collapseFigure.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent event) {
IProcess2 process = subjobContainer.getProcess();
if (!process.isReadOnly()) {
PropertyChangeCommand ppc = new PropertyChangeCommand(subjobContainer, EParameterName.COLLAPSED.getName(), !subjobContainer.isCollapsed());
boolean executed = false;
if (process instanceof IGEFProcess) {
IDesignerCoreUIService designerCoreUIService = CoreUIPlugin.getDefault().getDesignerCoreUIService();
if (designerCoreUIService != null) {
executed = designerCoreUIService.executeCommand((IGEFProcess) process, ppc);
}
}
if (!executed) {
ppc.execute();
}
reSelection();
}
}
});
}
use of org.talend.core.model.process.IProcess2 in project tdi-studio-se by Talend.
the class SubjobContainerFigure method reSelection.
protected void reSelection() {
// select the start node.
if (subjobContainer.isCollapsed()) {
IProcess2 process = subjobContainer.getProcess();
AbstractMultiPageTalendEditor editor = (AbstractMultiPageTalendEditor) process.getEditor();
Node startNode = subjobContainer.getSubjobStartNode();
if (startNode != null && editor != null) {
if ((startNode.isJoblet() && !startNode.getNodeContainer().isCollapsed()) || startNode.getJunitNode() != null) {
editor.getTalendEditor().getViewer().deselectAll();
return;
}
editor.selectNode(startNode);
}
}
}
use of org.talend.core.model.process.IProcess2 in project tdi-studio-se by Talend.
the class MavenVersionManagementProjectSettingPage method updateItemsVersion.
protected void updateItemsVersion() {
List<ItemVersionObject> JobsOpenedInEditor = new ArrayList<ItemVersionObject>();
List<ItemVersionObject> closedJobs = new ArrayList<ItemVersionObject>();
boolean hasJobOpenedInEditor = false;
StringBuilder builder = new StringBuilder();
for (ItemVersionObject object : checkedObjects) {
if (RepositoryManager.isOpenedItemInEditor(object.getRepositoryNode().getObject())) {
hasJobOpenedInEditor = true;
JobsOpenedInEditor.add(object);
//$NON-NLS-1$
builder.append(object.getRepositoryNode().getObject().getLabel() + ", ");
} else {
closedJobs.add(object);
}
}
if (builder.length() > 0) {
builder.delete(builder.length() - 2, builder.length());
}
if (hasJobOpenedInEditor) {
MessageDialog.openWarning(Display.getCurrent().getActiveShell(), //$NON-NLS-1$
Messages.getString("VersionManagementDialog.WarningTitle2"), //$NON-NLS-1$
Messages.getString("VersionManagementDialog.openedInEditorMessage", builder.toString()));
IWorkbenchWindow workBench = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (workBench != null) {
IWorkbenchPage page = workBench.getActivePage();
IEditorReference[] editorRefs = page.getEditorReferences();
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreUIService.class)) {
IDesignerCoreUIService service = (IDesignerCoreUIService) GlobalServiceRegister.getDefault().getService(IDesignerCoreUIService.class);
if (service != null) {
for (IEditorReference editorRef : editorRefs) {
IEditorPart editor = editorRef.getEditor(false);
if (editor instanceof IMultiPageTalendEditor) {
IProcess2 process = ((IMultiPageTalendEditor) editor).getProcess();
String version = null;
for (ItemVersionObject object : JobsOpenedInEditor) {
if (object.getItem().getProperty().getId().equals(process.getId())) {
version = object.getNewVersion();
break;
}
}
if (version != null) {
String jobDefaultVersion = MavenVersionUtils.getDefaultVersion(process.getProperty().getVersion());
if (version.equals(jobDefaultVersion)) {
// if default, set null to remove key from property.
version = null;
}
Command command = service.crateMavenDeploymentValueChangeCommand(process, MavenConstants.NAME_USER_VERSION, version);
if (process instanceof IGEFProcess) {
service.executeCommand((IGEFProcess) process, command);
}
}
}
}
}
}
}
}
final IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
@Override
public void run(final IProgressMonitor monitor) throws CoreException {
RepositoryWorkUnit<Object> rwu = new //$NON-NLS-1$
RepositoryWorkUnit<Object>(//$NON-NLS-1$
project, //$NON-NLS-1$
"Update items Maven version") {
@Override
protected void run() throws LoginException, PersistenceException {
//$NON-NLS-1$
monitor.beginTask("Update items Maven version", closedJobs.size());
for (ItemVersionObject object : closedJobs) {
final Item item = object.getItem();
Property itemProperty = item.getProperty();
MavenVersionUtils.setItemMavenVersion(itemProperty, object.getNewVersion());
monitor.subTask(itemProperty.getLabel());
FACTORY.save(project, itemProperty);
monitor.worked(1);
}
try {
FACTORY.saveProject(project);
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
};
rwu.setAvoidUnloadResources(true);
rwu.executeRun();
monitor.done();
}
};
IRunnableWithProgress iRunnableWithProgress = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
IWorkspace workspace = ResourcesPlugin.getWorkspace();
try {
ISchedulingRule schedulingRule = workspace.getRoot();
// the update the project files need to be done in the workspace runnable to avoid all notification
// of changes before the end of the modifications.
workspace.run(runnable, schedulingRule, IWorkspace.AVOID_UPDATE, monitor);
} catch (CoreException e) {
ExceptionHandler.process(e);
}
}
};
final ProgressMonitorDialog dialog = new ProgressMonitorDialog(null);
try {
dialog.run(false, false, iRunnableWithProgress);
} catch (InvocationTargetException | InterruptedException e) {
ExceptionHandler.process(e);
}
}
Aggregations