@Override public int promptToSaveOnClose() { int returnCode; if (_isTourDirty == false) { returnCode = ISaveablePart2.NO; } _isSavingInProgress = true; { if (saveTourWithValidation()) { returnCode = ISaveablePart2.NO; } else { returnCode = ISaveablePart2.CANCEL; } } _isSavingInProgress = false; return returnCode; }
@Override public int promptToSaveOnClose() { if(this.dirty) { if(MessageDialog.openConfirm(getEditorSite().getShell(), "Warning", "Modification of '"+partName+"' is not saved, are you sure to close without saving?")) { return ISaveablePart2.NO; } else { return ISaveablePart2.CANCEL; } } return YES; }
/*************************************************************************** * Called when the procedure view is about to close and the procedure status * implies that the procedure is not directly closeable **************************************************************************/ @Override public int promptToSaveOnClose() { Logger.debug("Procedure not directly closeable, asking user", Level.GUI, this); Shell shell = Display.getCurrent().getActiveShell(); CloseProcDialog dialog = new CloseProcDialog(shell, getModel()); int retcode = dialog.open(); Logger.debug("User selection " + retcode, Level.GUI, this); if (retcode == IDialogConstants.CANCEL_ID) { Logger.debug("Cancelling closure", Level.GUI, this); return ISaveablePart2.CANCEL; } else if (retcode == CloseProcDialog.DETACH) { m_closeMode = ProcedureViewCloseMode.DETACH; } else if (retcode == CloseProcDialog.BACKGROUND) { m_closeMode = ProcedureViewCloseMode.BACKGROUND; } else if (retcode == CloseProcDialog.KILL) { m_closeMode = ProcedureViewCloseMode.KILL; } else if (retcode == CloseProcDialog.CLOSE) { m_closeMode = ProcedureViewCloseMode.CLOSE; } return ISaveablePart2.NO; }
/*************************************************************************** * Update the closeable property **************************************************************************/ private void updateCloseable(ExecutorStatus status) { // Set the closeable flag. If closeable is false, it means that // the procedure is in such status that it cannot be just unloaded // therefore the user must choose wether explicitly abort/kill it or // not. boolean notifyCloseable = false; if (status != ExecutorStatus.LOADED && status != ExecutorStatus.FINISHED && status != ExecutorStatus.ABORTED && status != ExecutorStatus.ERROR) { if (m_closeable) notifyCloseable = true; m_closeable = false; } else { if (!m_closeable) notifyCloseable = true; m_closeable = true; } // Notify changes only if (notifyCloseable) { firePropertyChange(ISaveablePart2.PROP_DIRTY); } }
@Override public void doSave(IProgressMonitor monitor) { if(MessageDialog.openConfirm(getEditorSite().getShell(), "Question", "Are you sure to save?")) { } else { return; } try { this.orc.replace(this.oldBlock, this.newBlock, this.blockOutNames); } catch (RemoteException e) { e.printStackTrace(); MessageDialog.openError(new Shell(), "Error", e.getMessage()); return; } if(this.bInput != null && this.bInput.isChanged()) { this.bInput.benchmark(); } else { if(this.blockGroups!=null && !this.blockGroups.isEmpty()) { int count = 0; int i = 0; while(i < count) { BlockInput blkinput = this.htGroupBInputs.get(this.blockGroups.get(i)); blkinput.benchmark(); i++; } } } this.dirty = false; firePropertyChange(ISaveablePart2.PROP_DIRTY); }
public void SetDirty(boolean dirty) { this.dirty = dirty; firePropertyChange(ISaveablePart2.PROP_DIRTY); }
public int promptToSaveOnClose(){ return GlobalActions.fixLayoutAction.isChecked() ? ISaveablePart2.CANCEL : ISaveablePart2.NO; }
@Override public int promptToSaveOnClose(){ return GlobalActions.fixLayoutAction.isChecked() ? ISaveablePart2.CANCEL : ISaveablePart2.NO; }
/*********************************************************************************************** * Die folgenden 6 Methoden implementieren das Interface ISaveablePart2 Wir benötigen das * Interface nur, um das Schliessen einer View zu verhindern, wenn die Perspektive fixiert ist. * Gibt es da keine einfachere Methode? */ @Override public int promptToSaveOnClose(){ return GlobalActions.fixLayoutAction.isChecked() ? ISaveablePart2.CANCEL : ISaveablePart2.NO; }
@Override public int promptToSaveOnClose() { return GlobalActions.fixLayoutAction.isChecked() ? ISaveablePart2.CANCEL : ISaveablePart2.NO; }
public int promptToSaveOnClose() { return GlobalActions.fixLayoutAction.isChecked() ? ISaveablePart2.CANCEL : ISaveablePart2.NO; }
/*********************************************************************************************** * Die folgenden 6 Methoden implementieren das Interface ISaveablePart2 Wir benötigen das * Interface nur, um das Schliessen einer View zu verhindern, wenn die Perspektive fixiert ist. * Gibt es da keine einfachere Methode? */ public int promptToSaveOnClose(){ return GlobalActions.fixLayoutAction.isChecked() ? ISaveablePart2.CANCEL : ISaveablePart2.NO; }