Skip to content

Commit

Permalink
Fixed #1605 - Targets Drag'n'Drop Windows - add option
Browse files Browse the repository at this point in the history
  • Loading branch information
eselmeister committed Jan 9, 2024
1 parent 6bb7387 commit f729158
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ public void createFieldEditors() {
addField(new FloatFieldEditor(PreferenceSupplier.P_MATCH_QUALITY_UNKNOWN_TARGET, "Match Quality (Unknown Target)", PreferenceSupplier.MIN_MATCH_QUALITY, PreferenceSupplier.MAX_MATCH_QUALITY, getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceSupplier.P_UNKNOWN_TARGET_ADD_RETENTION_INDEX, "Add Retention Index (Unknown Target)", getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceSupplier.P_VERIFY_UNKNOWN_TARGET, "Verify (Unknown Target)", getFieldEditorParent()));
//
addField(new SpacerFieldEditor(getFieldEditorParent()));
addField(new BooleanFieldEditor(PreferenceSupplier.P_ACTIVATE_TARGET_DND_WINDOWS, "Activate Target Drag and Drop for Windows (experimental)", getFieldEditorParent()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,8 @@ public class PreferenceSupplier extends AbstractPreferenceSupplier implements IP
public static final float DEF_RETENTION_INDEX_DEVIATION_ABS_OK = 20.0f;
public static final String P_RETENTION_INDEX_DEVIATION_ABS_WARN = "retentionIndexDeviationAbsoluteWARN";
public static final float DEF_RETENTION_INDEX_DEVIATION_ABS_WARN = 40.0f;
public static final String P_ACTIVATE_TARGET_DND_WINDOWS = "activateTargetDragAndDropWindows";
public static final boolean DEF_ACTIVATE_TARGET_DND_WINDOWS = false;
//
public static final String P_ADD_UNKNOWN_AFTER_DELETE_TARGETS_ALL = "addUnknownAfterDeleteTargetsAll";
public static final boolean DEF_ADD_UNKNOWN_AFTER_DELETE_TARGETS_ALL = false;
Expand Down Expand Up @@ -1165,6 +1167,7 @@ public void initializeDefaults() {
putDefault(P_MATCH_QUALITY_UNKNOWN_TARGET, DEF_MATCH_QUALITY_UNKNOWN_TARGET);
putDefault(P_UNKNOWN_TARGET_ADD_RETENTION_INDEX, DEF_UNKNOWN_TARGET_ADD_RETENTION_INDEX);
putDefault(P_VERIFY_UNKNOWN_TARGET, DEF_VERIFY_UNKNOWN_TARGET);
putDefault(P_ACTIVATE_TARGET_DND_WINDOWS, DEF_ACTIVATE_TARGET_DND_WINDOWS);
//
initializeChromatogramDefaults();
/*
Expand Down Expand Up @@ -1488,4 +1491,9 @@ private void initializeOverlayDefaults() {
putDefault(P_OVERLAY_LOCK_ZOOM, DEF_OVERLAY_LOCK_ZOOM);
putDefault(P_OVERLAY_FOCUS_SELECTION, DEF_OVERLAY_FOCUS_SELECTION);
}
}

public static boolean isActivateTargetDragAndDropWindows() {

return INSTANCE().getBoolean(P_ACTIVATE_TARGET_DND_WINDOWS, DEF_ACTIVATE_TARGET_DND_WINDOWS);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,22 @@ public TargetsListUI(Composite parent, String[] alternativeTitles, int style) {
/*
* https://github.com/eclipse/chemclipse/issues/1354
*/
if(!OperatingSystemUtils.isWindows()) {
if(useDragAndDrop()) {
createDragAndDropProvider();
}
}

private boolean useDragAndDrop() {

if(OperatingSystemUtils.isWindows()) {
if(!PreferenceSupplier.isActivateTargetDragAndDropWindows()) {
return false;
}
}
//
return true;
}

public void setSearchText(String searchText, boolean caseSensitive) {

targetListFilter.setSearchText(searchText, caseSensitive);
Expand Down

0 comments on commit f729158

Please sign in to comment.