Skip to content

Commit

Permalink
[Modern Find/Replace] Refactor FindReplaceDialog
Browse files Browse the repository at this point in the history
The FindReplaceDialog's business-logic is now handled in the
FindReplacer.
The FindReplacer communicates using a FindReplaceStatus object which is
polled by FindReplaceDialog as needed and allows for displaying correct
messages in the Interface.

This Refactoring is required so that the business-logic can be reused in
the new FindReplace overlay, as proposed in issue eclipse-platform#1090
  • Loading branch information
Wittmaxi committed Oct 2, 2023
1 parent 0847f8e commit 527ed76
Show file tree
Hide file tree
Showing 3 changed files with 1,006 additions and 789 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*******************************************************************************
* Copyright (c) 2023 Vector Informatik GmbH and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Vector Informatik GmbH - initial API and implementation
*******************************************************************************/

package org.eclipse.ui.texteditor;

/**
* Use by FindAndReplace to signal warnings, errors and messages to
* FindAndReplaceDialog and FindAndReplaceOverlay.
*
* @since 3.17
*/
class FindAndReplaceMessageStatus {
private boolean error;
private boolean warning;
private String message;

public void resetStatus() {
error = false;
warning = false;
setMessage(""); //$NON-NLS-1$
}

public String getMessage() {
return message;
}

public void setMessage(String message) {
this.message = message;
}

public boolean isError() {
return error;
}

public void setError(boolean error) {
this.error = error;
}

public void setWarning(boolean warning) {
this.warning = warning;
}

public boolean isWarning() {
return warning;
}

@Override
public FindAndReplaceMessageStatus clone() {
FindAndReplaceMessageStatus ret = new FindAndReplaceMessageStatus();
ret.setMessage(message);
ret.setError(isError());
ret.setWarning(isWarning());
return ret;
}

}
Loading

0 comments on commit 527ed76

Please sign in to comment.