use of org.talend.designer.core.ui.editor.connections.ConnectionTraceEditPart in project tdi-studio-se by Talend.
the class ShowBreakpointAction method calculateEnabled.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.ui.actions.WorkbenchPartAction#calculateEnabled()
*/
@Override
protected boolean calculateEnabled() {
// TODO Auto-generated method stub
List parts = getSelectedObjects();
if (parts.size() != 1) {
return false;
}
Object input = parts.get(0);
if (input instanceof ConnectionPart) {
ConnectionPart connPart = (ConnectionPart) input;
List childParts = connPart.getChildren();
for (Object part : childParts) {
if (part != null && part instanceof ConnectionTraceEditPart) {
connection = (Connection) connPart.getModel();
return connection.enableTraces() && PluginChecker.isTraceDebugPluginLoaded();
}
}
}
if (input instanceof ConnLabelEditPart) {
ConnLabelEditPart labelPart = (ConnLabelEditPart) input;
ConnectionPart connPart = (ConnectionPart) labelPart.getParent();
List childParts = connPart.getChildren();
for (Object part : childParts) {
if (part != null && part instanceof ConnectionTraceEditPart) {
connection = (Connection) connPart.getModel();
return connection.enableTraces() && PluginChecker.isTraceDebugPluginLoaded();
}
}
}
if (input instanceof ConnectionTraceEditPart) {
ConnectionTraceEditPart connTrace = (ConnectionTraceEditPart) input;
if (connTrace.getParent() instanceof ConnectionPart) {
ConnectionPart connPart = (ConnectionPart) connTrace.getParent();
connection = (Connection) connPart.getModel();
return connection.enableTraces() && PluginChecker.isTraceDebugPluginLoaded();
}
}
return false;
}
use of org.talend.designer.core.ui.editor.connections.ConnectionTraceEditPart in project tdi-studio-se by Talend.
the class AbstractTraceAction method calculateEnabled.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.ui.actions.WorkbenchPartAction#calculateEnabled()
*/
@Override
protected boolean calculateEnabled() {
List parts = getSelectedObjects();
if (parts.size() != 1) {
return false;
}
Object input = parts.get(0);
if (input instanceof ConnectionPart) {
ConnectionPart connPart = (ConnectionPart) input;
List childParts = connPart.getChildren();
for (Object part : childParts) {
if (part != null && part instanceof ConnectionTraceEditPart) {
Connection conn = (Connection) connPart.getModel();
if (conn.enableTraces() && conn.checkTraceShowEnable()) {
IElementParameter element = conn.getElementParameter(EParameterName.TRACES_CONNECTION_ENABLE.getName());
Boolean flag = (Boolean) element.getValue();
if (flag != isEnableAction()) {
return true;
}
}
}
}
}
if (input instanceof ConnLabelEditPart) {
ConnLabelEditPart labelPart = (ConnLabelEditPart) input;
ConnectionPart connPart = (ConnectionPart) labelPart.getParent();
List childParts = connPart.getChildren();
for (Object part : childParts) {
if (part != null && part instanceof ConnectionTraceEditPart) {
Connection conn = (Connection) connPart.getModel();
if (conn.enableTraces() && conn.checkTraceShowEnable()) {
IElementParameter element = conn.getElementParameter(EParameterName.TRACES_CONNECTION_ENABLE.getName());
Boolean flag = (Boolean) element.getValue();
if (flag != isEnableAction()) {
return true;
}
}
}
}
}
if (input instanceof ConnectionTraceEditPart) {
ConnectionTraceEditPart tracePart = (ConnectionTraceEditPart) input;
ConnectionPart connPart = (ConnectionPart) tracePart.getParent();
Connection conn = (Connection) connPart.getModel();
if (conn.enableTraces() && conn.checkTraceShowEnable()) {
IElementParameter element = conn.getElementParameter(EParameterName.TRACES_CONNECTION_ENABLE.getName());
Boolean flag = (Boolean) element.getValue();
if (flag != isEnableAction()) {
return true;
}
}
}
return false;
}
use of org.talend.designer.core.ui.editor.connections.ConnectionTraceEditPart in project tdi-studio-se by Talend.
the class AbstractTraceAction method run.
@Override
public void run() {
List selection = getSelectedObjects();
Object input = selection.get(0);
if (input instanceof ConnectionPart) {
ConnectionPart connPart = (ConnectionPart) input;
List childParts = connPart.getChildren();
for (Object part : childParts) {
if (part != null && part instanceof ConnectionTraceEditPart) {
ConnectionTraceEditPart tracePart = (ConnectionTraceEditPart) part;
Connection conn = (Connection) connPart.getModel();
execute(new PropertyChangeCommand(conn, EParameterName.TRACES_CONNECTION_ENABLE.getName(), isEnableAction()));
tracePart.refresh();
break;
}
}
}
if (input instanceof ConnLabelEditPart) {
ConnLabelEditPart labelPart = (ConnLabelEditPart) input;
ConnectionPart connPart = (ConnectionPart) labelPart.getParent();
List childParts = connPart.getChildren();
for (Object part : childParts) {
if (part != null && part instanceof ConnectionTraceEditPart) {
ConnectionTraceEditPart tracePart = (ConnectionTraceEditPart) part;
Connection conn = (Connection) connPart.getModel();
execute(new PropertyChangeCommand(conn, EParameterName.TRACES_CONNECTION_ENABLE.getName(), isEnableAction()));
tracePart.refresh();
break;
}
}
}
if (input instanceof ConnectionTraceEditPart) {
ConnectionTraceEditPart tracePart = (ConnectionTraceEditPart) input;
ConnectionPart connPart = (ConnectionPart) tracePart.getParent();
Connection conn = (Connection) connPart.getModel();
execute(new PropertyChangeCommand(conn, EParameterName.TRACES_CONNECTION_ENABLE.getName(), isEnableAction()));
tracePart.refresh();
}
}
use of org.talend.designer.core.ui.editor.connections.ConnectionTraceEditPart in project tdi-studio-se by Talend.
the class FilterTraceColumnAction method calculateEnabled.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.ui.actions.WorkbenchPartAction#calculateEnabled()
*/
@Override
protected boolean calculateEnabled() {
List parts = getSelectedObjects();
if (parts.size() != 1) {
return false;
}
Object input = parts.get(0);
if (input instanceof ConnectionPart) {
ConnectionPart connPart = (ConnectionPart) input;
List childParts = connPart.getChildren();
for (Object part : childParts) {
if (part != null && part instanceof ConnectionTraceEditPart) {
connection = (Connection) connPart.getModel();
return connection.enableTraces() && connection.checkTraceShowEnable();
}
}
}
if (input instanceof ConnLabelEditPart) {
ConnLabelEditPart labelPart = (ConnLabelEditPart) input;
ConnectionPart connPart = (ConnectionPart) labelPart.getParent();
List childParts = connPart.getChildren();
for (Object part : childParts) {
if (part != null && part instanceof ConnectionTraceEditPart) {
connection = (Connection) connPart.getModel();
return connection.enableTraces() && connection.checkTraceShowEnable();
}
}
}
if (input instanceof ConnectionTraceEditPart) {
ConnectionTraceEditPart connTrace = (ConnectionTraceEditPart) input;
if (connTrace.getParent() instanceof ConnectionPart) {
ConnectionPart connPart = (ConnectionPart) connTrace.getParent();
connection = (Connection) connPart.getModel();
return connection.enableTraces() && connection.checkTraceShowEnable();
}
}
return false;
}
use of org.talend.designer.core.ui.editor.connections.ConnectionTraceEditPart in project tdi-studio-se by Talend.
the class PartFactory method createEditPart.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.EditPartFactory#createEditPart(org.eclipse.gef.EditPart, java.lang.Object)
*/
@Override
public EditPart createEditPart(EditPart context, Object model) {
EditPart part = null;
if (model instanceof SubjobContainer) {
part = new SubjobContainerPart();
} else if (model instanceof Process) {
part = new ProcessPart();
} else if (model instanceof Node) {
part = new NodePart();
} else if (model instanceof Connection) {
part = new ConnectionPart();
} else if (model instanceof ConnectionLabel) {
part = new ConnLabelEditPart();
} else if (model instanceof MonitorConnectionLabel) {
part = new MonitorConnectionLabelPart();
} else if (model instanceof ConnectionPerformance) {
part = new ConnectionPerformanceEditPart();
} else if (model instanceof ConnectionTrace) {
part = new ConnectionTraceEditPart();
} else if (model instanceof ConnectionResuming) {
part = new ConnectionResumingEditPart();
} else if (model instanceof NodeLabel) {
part = new NodeLabelEditPart();
} else if (model instanceof NodeContainer) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerGEFService.class)) {
ITestContainerGEFService testContainerService = (ITestContainerGEFService) GlobalServiceRegister.getDefault().getService(ITestContainerGEFService.class);
if (testContainerService != null) {
part = testContainerService.createEditorPart(model);
if (part != null) {
part.setModel(model);
return part;
}
}
}
if (((NodeContainer) model).getNode().isSparkJoblet()) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkJobletProviderService.class)) {
ISparkJobletProviderService sparkService = (ISparkJobletProviderService) GlobalServiceRegister.getDefault().getService(ISparkJobletProviderService.class);
if (sparkService != null) {
part = (EditPart) sparkService.createEditorPart(model);
if (part != null) {
part.setModel(model);
return part;
}
}
}
} else if (((NodeContainer) model).getNode().isSparkStreamingJoblet()) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ISparkStreamingJobletProviderService.class)) {
ISparkStreamingJobletProviderService sparkService = (ISparkStreamingJobletProviderService) GlobalServiceRegister.getDefault().getService(ISparkStreamingJobletProviderService.class);
if (sparkService != null) {
part = (EditPart) sparkService.createEditorPart(model);
if (part != null) {
part.setModel(model);
return part;
}
}
}
} else if (((NodeContainer) model).getNode().isStandardJoblet()) {
part = new JobletContainerPart();
} else if (((NodeContainer) model).getNode().isMapReduce()) {
part = new JobletContainerPart();
} else {
part = new NodeContainerPart();
}
} else if (model instanceof Note) {
part = new NoteEditPart();
} else if (model instanceof NodeError) {
part = new NodeErrorEditPart();
} else if (model instanceof NodeProgressBar) {
part = new NodeProgressBarPart();
} else {
return null;
}
// tell the newly created part about the model object
part.setModel(model);
return part;
}
Aggregations