Skip to content

Commit

Permalink
Unify access to static members
Browse files Browse the repository at this point in the history
Applies the following cleanup rules concerning static member access to
all projects in order to be conform with defined save actions:
* change non-static accesses to static members using declaring type
* change indirect accesses to static members to direct accesses
  • Loading branch information
HeikoKlare committed Apr 14, 2024
1 parent 100ceaf commit 0aef264
Show file tree
Hide file tree
Showing 17 changed files with 35 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void run() {
toolBarManager.appendToGroup("file", saveAction); //$NON-NLS-1$
}

inplaceAction = new Action(CompareWin32Messages.WordMergeViewer_2, Action.AS_CHECK_BOX) {
inplaceAction = new Action(CompareWin32Messages.WordMergeViewer_2, IAction.AS_CHECK_BOX) {
@Override
public void run() {
toggleInplaceExternalState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import org.eclipse.team.ui.mapping.ITeamContentProviderDescriptor;
import org.eclipse.team.ui.mapping.ITeamContentProviderManager;
import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
import org.eclipse.team.ui.synchronize.ModelMergeOperation;
import org.eclipse.team.ui.synchronize.ModelOperation;
import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant;

Expand Down Expand Up @@ -147,7 +146,7 @@ public void dispose() {
private ModelProvider[] getEnabledModelProviders() {
Set<ModelProvider> result = new HashSet<>();
ModelProvider[] providers = ((ModelSynchronizeParticipant)configuration.getParticipant()).getEnabledModelProviders();
providers = ModelMergeOperation.sortByExtension(providers);
providers = ModelOperation.sortByExtension(providers);
for (ModelProvider provider : providers) {
ITeamContentProviderDescriptor desc = TeamUI.getTeamContentProviderManager().getDescriptor(provider.getId());
if (desc != null && desc.isEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
import org.eclipse.team.examples.filesystem.FileSystemPlugin;
import org.eclipse.team.internal.ui.mapping.SynchronizationResourceMappingContext;
import org.eclipse.team.ui.mapping.ISynchronizationCompareAdapter;
import org.eclipse.team.ui.synchronize.ModelMergeOperation;
import org.eclipse.team.ui.synchronize.ModelOperation;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.Page;

Expand Down Expand Up @@ -159,7 +159,7 @@ public int compare(Viewer viewer, Object e1, Object e2) {
return super.compare(viewer, e1, e2);
}
private int compare(ResourceMapping m1, ResourceMapping m2) {
ModelProvider[] sorted = ModelMergeOperation.sortByExtension(new ModelProvider[] { m1.getModelProvider(), m2.getModelProvider() });
ModelProvider[] sorted = ModelOperation.sortByExtension(new ModelProvider[] { m1.getModelProvider(), m2.getModelProvider() });
return sorted[0] == m1.getModelProvider() ? -1 : 1;
}
private String getLabel(ResourceMapping mapping) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
import org.eclipse.team.core.history.IFileRevision;
import org.eclipse.team.core.mapping.IMergeContext;
import org.eclipse.team.core.mapping.IResourceDiff;
import org.eclipse.team.core.mapping.ISynchronizationContext;
import org.eclipse.team.core.mapping.ResourceMappingMerger;
import org.eclipse.team.core.mapping.provider.MergeStatus;
import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
import org.eclipse.team.core.mapping.provider.SynchronizationContext;
import org.eclipse.team.examples.filesystem.FileSystemPlugin;
import org.eclipse.team.examples.model.ModelObject;
import org.eclipse.team.examples.model.ModelObjectDefinitionFile;
Expand All @@ -68,7 +68,7 @@ public IStatus merge(IMergeContext mergeContext, IProgressMonitor monitor) throw
try {
IStatus status;
// Only override the merge for three-way synchronizations
if (mergeContext.getType() == SynchronizationContext.THREE_WAY) {
if (mergeContext.getType() == ISynchronizationContext.THREE_WAY) {
monitor.beginTask("Merging model elements", 100);
status = mergeModelElements(mergeContext, SubMonitor.convert(monitor, 50));
// Stop the merge if there was a failure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.List;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.plugin.AbstractUIPlugin;
Expand Down Expand Up @@ -93,7 +94,7 @@ protected void initializeDefaultPreferences() {
*/
public void logError(Throwable exception, String message) {
String pluginId= getBundle().getSymbolicName();
Status status= new Status(Status.ERROR, pluginId, Status.OK, message, exception);
Status status= new Status(IStatus.ERROR, pluginId, IStatus.OK, message, exception);
getLog().log(status);
if (isDebugging()) {
System.out.println(message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormText;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
Expand Down Expand Up @@ -181,9 +182,9 @@ public void getName(AccessibleEvent e) {
}

private static int getSectionStyle() {
int style = Section.EXPANDED ;
int style = ExpandableComposite.EXPANDED ;
if (RelatedTopicsPart.isUseDynamicHelp()) {
style = style | Section.TWISTIE;
style = style | ExpandableComposite.TWISTIE;
}
return style;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormText;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
Expand Down Expand Up @@ -85,8 +86,8 @@ public void done(IJobChangeEvent event) {
}

public DynamicHelpPart(Composite parent, FormToolkit toolkit) {
super(parent, toolkit, Section.EXPANDED | Section.TWISTIE
| Section.TITLE_BAR);
super(parent, toolkit, ExpandableComposite.EXPANDED | ExpandableComposite.TWISTIE
| ExpandableComposite.TITLE_BAR);
// configure section
Section section = getSection();
section.setText(Messages.SearchPart_title);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormText;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ImageHyperlink;
Expand Down Expand Up @@ -112,8 +113,8 @@ public boolean matches(EngineDescriptor desc) {
}

public Control createControl(Composite parent, final FormToolkit toolkit) {
section = toolkit.createSection(parent, Section.SHORT_TITLE_BAR | Section.COMPACT | Section.TWISTIE
| Section.EXPANDED | Section.LEFT_TEXT_CLIENT_ALIGNMENT);
section = toolkit.createSection(parent, ExpandableComposite.SHORT_TITLE_BAR | ExpandableComposite.COMPACT | ExpandableComposite.TWISTIE
| ExpandableComposite.EXPANDED | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT);
// section.marginHeight = 10;
container = toolkit.createComposite(section);
TableWrapLayout layout = new TableWrapLayout();
Expand Down Expand Up @@ -421,7 +422,7 @@ void updateResults(boolean reflow) {
String elabel = null;
if (isPotentialHit) {
// add "(potential hit)"
elabel = Messages.bind(Messages.SearchPart_potential_hit, hit.getLabel());
elabel = NLS.bind(Messages.SearchPart_potential_hit, hit.getLabel());
}
else {
elabel = hit.getLabel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.HyperlinkGroup;
import org.eclipse.ui.forms.HyperlinkSettings;
import org.eclipse.ui.forms.widgets.FormToolkit;

/**
Expand Down Expand Up @@ -96,7 +96,7 @@ protected Control createContents(Composite parent) {
ensureMinimumHeight(parent.getShell());

toolkit = new FormToolkit(parent.getDisplay());
toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkGroup.UNDERLINE_HOVER);
toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER);
toolkit.getColors().initializeSectionToolBarColors();
Composite container = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.HyperlinkGroup;
import org.eclipse.ui.forms.HyperlinkSettings;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.part.ViewPart;

Expand All @@ -60,7 +60,7 @@ public class HelpView extends ViewPart implements IPartListener2, ISelectionChan
@Override
public void createPartControl(Composite parent) {
toolkit = new FormToolkit(parent.getDisplay());
toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkGroup.UNDERLINE_HOVER);
toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER);
toolkit.getColors().initializeSectionToolBarColors();
reusableHelpPart.createControl(parent, toolkit);
reusableHelpPart.setDefaultContextHelpText(Messages.HelpView_defaultText);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.window.Window;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTError;
Expand Down Expand Up @@ -1701,7 +1702,7 @@ private void toggleShowAll(boolean checked) {
getShowAllMessage(),
Messages.AskShowAll_toggleMessage, false,
store, PROMPT_KEY);
if (dialog.getReturnCode() != MessageDialogWithToggle.OK) {
if (dialog.getReturnCode() != Window.OK) {
showAllAction.setChecked(false);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
Expand Down Expand Up @@ -126,7 +127,7 @@ private void doNew() {
WizardDialog dialog = new WizardDialog(getShell(), wizard);
dialog.create();
dialog.getShell().setSize(400, 500);
if (dialog.open()==WizardDialog.OK) {
if (dialog.open()==Window.OK) {
EngineTypeDescriptor etdesc = wizard.getSelectedEngineType();
EngineDescriptor desc = new EngineDescriptor(descManager);
desc.setEngineType(etdesc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.window.Window;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
Expand Down Expand Up @@ -453,7 +454,7 @@ private String getNewName(String oldName, boolean isRename) {
String dialogTitle = isRename ?
Messages.RenameDialog_wtitle : Messages.NewDialog_wtitle;
dialog.getShell().setText(dialogTitle);
if (dialog.open()==RenameDialog.OK) {
if (dialog.open()==Window.OK) {
return dialog.getNewName();
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.window.Window;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.cheatsheets.CheatSheetPlugin;
import org.eclipse.ui.internal.cheatsheets.Messages;
Expand Down Expand Up @@ -49,7 +50,7 @@ public void run() {
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), restartTasks, labelProvider);
dlg.open();
labelProvider.dispose();
if (dlg.getReturnCode() == ConfirmRestartDialog.OK) {
if (dlg.getReturnCode() == Window.OK) {
CompositeCheatSheetModel model = (CompositeCheatSheetModel) restartTasks[0].getCompositeCheatSheet();
model.resetTasks(restartTasks);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ private boolean initCheatSheetView() {
if (!parseStatus.isOK()) {
CheatSheetPlugin.getPlugin().getLog().log(parseStatus);
}
if(parseStatus.getSeverity() == Status.ERROR){
if(parseStatus.getSeverity() == IStatus.ERROR){

// Error during parsing.
// Something is wrong with the Cheat sheet content file at the xml level.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.commands.ICommandImageService;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.internal.intro.impl.model.AbstractIntroPartImplementation;
Expand Down Expand Up @@ -459,7 +460,7 @@ private String asDataURL(ImageDescriptor descriptor) {

@Override
public void createContent(String id, Composite parent, FormToolkit toolkit) {
Section section = toolkit.createSection(parent, Section.EXPANDED);
Section section = toolkit.createSection(parent, ExpandableComposite.EXPANDED);
TableViewer tableViewer = new TableViewer(toolkit.createTable(section, SWT.FULL_SELECTION));
tableViewer.setLabelProvider(new URLLabelProvider() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import org.eclipse.help.internal.util.ProductPreferences;
import org.eclipse.help.internal.util.SequenceResolver;
import org.eclipse.jface.action.Action;
import org.eclipse.ui.internal.intro.impl.model.AbstractIntroIdElement;
import org.eclipse.ui.internal.intro.impl.model.ExtensionMap;
import org.eclipse.ui.internal.intro.impl.model.IntroTheme;
import org.eclipse.ui.internal.intro.universal.contentdetect.ContentDetector;
import org.eclipse.ui.internal.intro.universal.util.ImageUtil;
import org.eclipse.ui.internal.intro.universal.util.PreferenceArbiter;
Expand Down Expand Up @@ -219,7 +219,7 @@ private String resolveFile(Bundle bundle, String path) throws IOException {
* @return same path with a prefixed theme directory component
*/
private String getThemePrefixedPath(String path) {
String prefix = themeProperties != null ? themeProperties.get(IntroTheme.ATT_ID) : null;
String prefix = themeProperties != null ? themeProperties.get(AbstractIntroIdElement.ATT_ID) : null;
prefix = prefix == null ? "" : prefix.trim(); //$NON-NLS-1$
if (prefix.length() == 0) {
return null;
Expand Down

0 comments on commit 0aef264

Please sign in to comment.