use of org.talend.core.model.repository.RepositoryObject in project tdi-studio-se by Talend.
the class StatusManagerSettingPage method refreshCheckedTreeView.
private void refreshCheckedTreeView() {
List<RepositoryNode> nodes = new ArrayList<RepositoryNode>();
for (TableItem item : itemTable.getItems()) {
Object data = item.getData();
if (data instanceof RepositoryObject) {
nodes.add((RepositoryNode) ((RepositoryObject) data).getRepositoryNode());
}
}
treeViewer.setCheckedElements(nodes.toArray());
// treeViewer.refresh();
}
use of org.talend.core.model.repository.RepositoryObject in project tdi-studio-se by Talend.
the class StatusManagerSettingPage method okPressed.
protected void okPressed() {
if (statusCombo == null) {
return;
}
boolean modified = false;
String newStatus = null;
if (getModifiedVersionItems().size() > 0) {
newStatus = statusHelper.getStatusCode(statusCombo.getText());
}
for (RepositoryObject object : getModifiedVersionItems()) {
if (!isFixedstatus()) {
newStatus = object.getStatusCode();
}
if (object != null && object.getProperty() != null) {
if (!newStatus.equals(object.getProperty().getOldStatusCode())) {
isApplied = false;
modified = true;
break;
}
}
}
if (modified) {
boolean confirm = false;
if (isFixedstatus()) {
confirm = //$NON-NLS-1$
MessageDialog.openConfirm(//$NON-NLS-1$
getShell(), //$NON-NLS-1$
Messages.getString("VersionManagementDialog.ConfirmTitle"), //$NON-NLS-1$
Messages.getString("VersionManagementDialog.ConfirmMessage", newStatus));
if (confirm) {
// set all items for new version
for (RepositoryObject object : getModifiedVersionItems()) {
if (techinalButton.getSelection()) {
ERepositoryObjectType type = object.getRepositoryNode().getContentType();
if (!type.equals(ERepositoryObjectType.DOCUMENTATION) && !type.equals(ERepositoryObjectType.BUSINESS_PROCESS)) {
object.setStatusCode(newStatus);
}
} else {
ERepositoryObjectType type = object.getRepositoryNode().getContentType();
if (type.equals(ERepositoryObjectType.DOCUMENTATION) || type.equals(ERepositoryObjectType.BUSINESS_PROCESS)) {
object.setStatusCode(newStatus);
}
}
}
}
} else {
StatusConfirmSettingDialog chanedDialog = new StatusConfirmSettingDialog(getShell(), getModifiedVersionItems(), statusHelper);
confirm = (chanedDialog.open() == Window.OK);
}
if (confirm) {
updateItemsVersion();
}
} else {
if (!getModifiedVersionItems().isEmpty() && !isApplied) {
//$NON-NLS-1$
MessageDialog.openWarning(//$NON-NLS-1$
getShell(), //$NON-NLS-1$
Messages.getString("VersionManagementDialog.WarningTitle"), //$NON-NLS-1$
Messages.getString("VersionManagementDialog.WarningMessages"));
}
}
}
use of org.talend.core.model.repository.RepositoryObject in project tdi-studio-se by Talend.
the class StatusManagerSettingPage method updateItemsVersion.
private void updateItemsVersion() {
IRunnableWithProgress runnable = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
//$NON-NLS-1$
monitor.beginTask("", getModifiedVersionItems().size() * 100);
Set<ERepositoryObjectType> types = new HashSet<ERepositoryObjectType>();
for (RepositoryObject object : getModifiedVersionItems()) {
// IRepositoryViewObject repositoryObject = object.getRepositoryNode().getObject();
if (object != null && object.getProperty() != null) {
if (object.getStatusCode().equals(object.getProperty().getStatusCode())) {
final Item item = object.getProperty().getItem();
item.getProperty().setOldStatusCode(object.getStatusCode());
// types.add(object.getRepositoryNode().getObjectType());
try {
// }
if (object != null) {
// obj.setVersion(object.getNewVersion());
FACTORY.save(project, object.getProperty());
} else {
// FACTORY.save(project, item.getProperty());
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
}
monitor.worked(100);
}
// RepositoryManager.refresh(types);
monitor.done();
}
};
// final ProgressMonitorJobsDialog dialog = new ProgressMonitorJobsDialog(null);
final ProgressMonitorDialog dialog = new ProgressMonitorDialog(null);
try {
dialog.run(false, false, runnable);
} catch (InvocationTargetException e) {
ExceptionHandler.process(e);
} catch (InterruptedException e) {
ExceptionHandler.process(e);
}
}
use of org.talend.core.model.repository.RepositoryObject in project tdi-studio-se by Talend.
the class OpenExistVersionProcessAction method doRun.
@Override
protected void doRun() {
ISelection selection = getSelection();
Object obj = ((IStructuredSelection) selection).getFirstElement();
RepositoryNode node = (RepositoryNode) obj;
IPath path = RepositoryNodeUtilities.getPath(node);
String originalName = node.getObject().getLabel();
RepositoryObject repositoryObj = new RepositoryObject(node.getObject().getProperty());
repositoryObj.setRepositoryNode(node.getObject().getRepositoryNode());
OpenExistVersionProcessWizard wizard = new OpenExistVersionProcessWizard(repositoryObj);
WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
dialog.setPageSize(300, 250);
//$NON-NLS-1$
dialog.setTitle(Messages.getString("OpenExistVersionProcess.open.dialog"));
if (dialog.open() == Dialog.OK) {
refresh(node);
// refresh the corresponding editor's name
IEditorPart part = getCorrespondingEditor(node);
if (part != null && part instanceof IUIRefresher) {
((IUIRefresher) part).refreshName();
} else {
processRoutineRenameOperation(originalName, node, path);
}
}
}
use of org.talend.core.model.repository.RepositoryObject in project tesb-studio-se by Talend.
the class OpenAnotherVersionResourceAction method doRun.
@Override
protected void doRun() {
final IRepositoryNode node = (RepositoryNode) ((IStructuredSelection) getSelection()).getFirstElement();
IPath path = RepositoryNodeUtilities.getPath(node);
String originalName = node.getObject().getLabel();
RepositoryObject repositoryObj = new RepositoryObject(node.getObject().getProperty());
repositoryObj.setRepositoryNode(node.getObject().getRepositoryNode());
OpenAnotherVersionResrouceWizard wizard = new OpenAnotherVersionResrouceWizard(repositoryObj);
WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
dialog.setPageSize(300, 250);
//$NON-NLS-1$
dialog.setTitle("Open another version");
if (dialog.open() == Dialog.OK) {
refresh(node);
// refresh the corresponding editor's name
IEditorPart part = getCorrespondingEditor(node);
if (part != null && part instanceof IUIRefresher) {
((IUIRefresher) part).refreshName();
} else {
processRoutineRenameOperation(originalName, node, path);
}
}
}
Aggregations