mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
reduce getName().equals()
This commit is contained in:
+2
-2
@@ -519,9 +519,9 @@ public class ProjectStructureConfigurable extends BaseConfigurable implements Se
|
||||
|
||||
@Nullable
|
||||
public Object getData(@NonNls final String dataId) {
|
||||
if (KEY.getName().equals(dataId)) {
|
||||
if (KEY.is(dataId)) {
|
||||
return ProjectStructureConfigurable.this;
|
||||
} else if (History.KEY.getName().equals(dataId)) {
|
||||
} else if (History.KEY.is(dataId)) {
|
||||
return getHistory();
|
||||
} else {
|
||||
return null;
|
||||
|
||||
+2
-2
@@ -546,7 +546,7 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple
|
||||
|
||||
@Nullable
|
||||
public Object getData(@NonNls String dataId) {
|
||||
if (DataKeys.MODULE_CONTEXT_ARRAY.getName().equals(dataId)){
|
||||
if (DataKeys.MODULE_CONTEXT_ARRAY.is(dataId)){
|
||||
final TreePath[] paths = myTree.getSelectionPaths();
|
||||
if (paths != null) {
|
||||
ArrayList<Module> modules = new ArrayList<Module>();
|
||||
@@ -562,7 +562,7 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple
|
||||
return !modules.isEmpty() ? modules.toArray(new Module[modules.size()]) : null;
|
||||
}
|
||||
}
|
||||
if (DataKeys.MODULE_CONTEXT.getName().equals(dataId)){
|
||||
if (DataKeys.MODULE_CONTEXT.is(dataId)){
|
||||
return getSelectedModule();
|
||||
}
|
||||
if (DataConstantsEx.MODIFIABLE_MODULE_MODEL.equals(dataId)){
|
||||
|
||||
@@ -52,7 +52,7 @@ public class RunContentDescriptor {
|
||||
myComponent.putClientProperty(DataManager.CLIENT_PROPERTY_DATA_PROVIDER, new DataProvider() {
|
||||
|
||||
public Object getData(@NonNls final String dataId) {
|
||||
if (RunContentManager.RUN_CONTENT_DESCRIPTOR.getName().equals(dataId)) {
|
||||
if (RunContentManager.RUN_CONTENT_DESCRIPTOR.is(dataId)) {
|
||||
return RunContentDescriptor.this;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -75,13 +75,13 @@ public class GridCellImpl implements GridCell, Disposable {
|
||||
myTabs = new JBTabsImpl(myContext.getProject(), myContext.getActionManager(), myContext.getFocusManager(), container).setDataProvider(new DataProvider() {
|
||||
@Nullable
|
||||
public Object getData(@NonNls final String dataId) {
|
||||
if (ViewContext.CONTENT_KEY.getName().equals(dataId)) {
|
||||
if (ViewContext.CONTENT_KEY.is(dataId)) {
|
||||
TabInfo target = myTabs.getTargetInfo();
|
||||
if (target != null) {
|
||||
return new Content[]{getContentFor(target)};
|
||||
}
|
||||
}
|
||||
else if (ViewContext.CONTEXT_KEY.getName().equals(dataId)) {
|
||||
else if (ViewContext.CONTEXT_KEY.is(dataId)) {
|
||||
return myContext;
|
||||
}
|
||||
|
||||
@@ -250,10 +250,10 @@ public class GridCellImpl implements GridCell, Disposable {
|
||||
|
||||
@Nullable
|
||||
public Object getData(@NonNls final String dataId) {
|
||||
if (ViewContext.CONTENT_KEY.getName().equals(dataId)) {
|
||||
if (ViewContext.CONTENT_KEY.is(dataId)) {
|
||||
return new Content[]{myContent};
|
||||
}
|
||||
else if (ViewContext.CONTEXT_KEY.getName().equals(dataId)) {
|
||||
else if (ViewContext.CONTEXT_KEY.is(dataId)) {
|
||||
return myContext;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -387,9 +387,9 @@ public class GridImpl extends Wrapper implements Grid, Disposable, CellTransform
|
||||
|
||||
@Nullable
|
||||
public Object getData(@NonNls final String dataId) {
|
||||
if (ViewContext.CONTEXT_KEY.getName().equals(dataId)) {
|
||||
if (ViewContext.CONTEXT_KEY.is(dataId)) {
|
||||
return myViewContext;
|
||||
} else if (ViewContext.CONTENT_KEY.getName().equals(dataId)) {
|
||||
} else if (ViewContext.CONTENT_KEY.is(dataId)) {
|
||||
List<Content> contents = getContents();
|
||||
return contents.toArray(new Content[contents.size()]);
|
||||
}
|
||||
|
||||
@@ -144,13 +144,13 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
myTabs = new JBTabsImpl(myProject, myActionManager, myFocusManager, this)
|
||||
.setDataProvider(new DataProvider() {
|
||||
public Object getData(@NonNls final String dataId) {
|
||||
if (ViewContext.CONTENT_KEY.getName().equals(dataId)) {
|
||||
if (ViewContext.CONTENT_KEY.is(dataId)) {
|
||||
TabInfo info = myTabs.getTargetInfo();
|
||||
if (info != null) {
|
||||
return getGridFor(info).getData(dataId);
|
||||
}
|
||||
}
|
||||
else if (ViewContext.CONTEXT_KEY.getName().equals(dataId)) {
|
||||
else if (ViewContext.CONTEXT_KEY.is(dataId)) {
|
||||
return RunnerContentUi.this;
|
||||
}
|
||||
return null;
|
||||
@@ -720,7 +720,7 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
|
||||
|
||||
@Nullable
|
||||
public Object getData(@NonNls final String dataId) {
|
||||
if (KEY.getName().equals(dataId)) {
|
||||
if (KEY.is(dataId)) {
|
||||
return RunnerContentUi.this;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -641,7 +641,7 @@ public class ShowUsagesAction extends AnAction {
|
||||
}
|
||||
|
||||
public Object getData(@NonNls String dataId) {
|
||||
if (LangDataKeys.PSI_ELEMENT.getName().equals(dataId)) {
|
||||
if (LangDataKeys.PSI_ELEMENT.is(dataId)) {
|
||||
final int[] selected = getSelectedRows();
|
||||
if (selected.length == 1) {
|
||||
final Object at = getValueAt(selected[0], 0);
|
||||
|
||||
@@ -341,7 +341,7 @@ public class FileStructureDialog extends DialogWrapper {
|
||||
return selectedElement instanceof Navigatable ? selectedElement : myNavigatable;
|
||||
}
|
||||
|
||||
if (OpenFileDescriptor.NAVIGATE_IN_EDITOR.getName().equals(dataId)) return myEditor;
|
||||
if (OpenFileDescriptor.NAVIGATE_IN_EDITOR.is(dataId)) return myEditor;
|
||||
|
||||
return getDataImpl(dataId);
|
||||
}
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ public class TextEditorPsiDataProvider implements EditorDataProvider {
|
||||
if (dataId.equals(DataConstants.PSI_FILE)) {
|
||||
return getPsiFile(e, file);
|
||||
}
|
||||
if (LangDataKeys.IDE_VIEW.getName().equals(dataId)) {
|
||||
if (LangDataKeys.IDE_VIEW.is(dataId)) {
|
||||
final PsiFile psiFile = PsiManager.getInstance(e.getProject()).findFile(file);
|
||||
final PsiDirectory psiDirectory = psiFile != null ? psiFile.getParent() : null;
|
||||
if (psiDirectory != null && psiDirectory.isPhysical()) {
|
||||
|
||||
@@ -2581,7 +2581,7 @@ public class JBTabsImpl extends JComponent
|
||||
if (value != null) return value;
|
||||
}
|
||||
|
||||
return NAVIGATION_ACTIONS_KEY.getName().equals(dataId) ? this : null;
|
||||
return NAVIGATION_ACTIONS_KEY.is(dataId) ? this : null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -369,10 +369,10 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
|
||||
public Object getData(String dataId) {
|
||||
if (DataConstants.VIRTUAL_FILE_ARRAY.equals(dataId)) {
|
||||
return getSelectedFiles();
|
||||
} else if (KEY.getName().equals(dataId)) {
|
||||
} else if (KEY.is(dataId)) {
|
||||
return FileChooserDialogImpl.this;
|
||||
}
|
||||
else if (FileSystemTree.DATA_KEY.getName().equals(dataId)) {
|
||||
else if (FileSystemTree.DATA_KEY.is(dataId)) {
|
||||
return myFileSystemTree;
|
||||
}
|
||||
return myChooserDescriptor.getUserData(dataId);
|
||||
|
||||
+1
-1
@@ -674,7 +674,7 @@ public class OptionsEditor extends JPanel implements DataProvider, Place.Navigat
|
||||
if (dataId.equals(KEY.getName())) {
|
||||
return this;
|
||||
}
|
||||
return History.KEY.getName().equals(dataId) ? myHistory : null;
|
||||
return History.KEY.is(dataId) ? myHistory : null;
|
||||
}
|
||||
|
||||
public JTree getPreferredFocusedComponent() {
|
||||
|
||||
@@ -906,7 +906,7 @@ public class DialogWrapperPeerImpl extends DialogWrapperPeer implements FocusTra
|
||||
|
||||
public Object getData(@NonNls String dataId) {
|
||||
final DialogWrapper wrapper = myDialogWrapper.get();
|
||||
return PlatformDataKeys.UI_DISPOSABLE.getName().equals(dataId) ? wrapper.getDisposable() : null;
|
||||
return PlatformDataKeys.UI_DISPOSABLE.is(dataId) ? wrapper.getDisposable() : null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ public class SMTRunnerTestTreeView extends TestTreeView {
|
||||
|
||||
@Override
|
||||
public Object getData(final String dataId) {
|
||||
if (dataId.equals(SM_TEST_RUNNER_VIEW.getName())) {
|
||||
if (SM_TEST_RUNNER_VIEW.is(dataId)) {
|
||||
return this;
|
||||
}
|
||||
return super.getData(dataId);
|
||||
|
||||
+1
-1
@@ -158,7 +158,7 @@ public class StatisticsPanel implements DataProvider {
|
||||
}
|
||||
|
||||
public Object getData(@NonNls final String dataId) {
|
||||
if (SM_TEST_RUNNER_STATISTICS.getName().equals(dataId)) {
|
||||
if (SM_TEST_RUNNER_STATISTICS.is(dataId)) {
|
||||
return this;
|
||||
}
|
||||
return TestsUIUtil.getData(getSelectedItem(), dataId, myFrameworkRunningModel);
|
||||
|
||||
+1
-1
@@ -189,7 +189,7 @@ class HeavyIdeaTestFixtureImpl extends BaseFixture implements HeavyIdeaTestFixtu
|
||||
if (dataId.equals(DataConstants.PROJECT)) {
|
||||
return myProject;
|
||||
}
|
||||
else if (dataId.equals(DataConstants.EDITOR) || dataId.equals(OpenFileDescriptor.NAVIGATE_IN_EDITOR.getName())) {
|
||||
else if (dataId.equals(DataConstants.EDITOR) || OpenFileDescriptor.NAVIGATE_IN_EDITOR.is(dataId)) {
|
||||
return FileEditorManager.getInstance(myProject).getSelectedTextEditor();
|
||||
}
|
||||
else {
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ class LightIdeaTestFixtureImpl extends BaseFixture implements LightIdeaTestFixtu
|
||||
if (dataId.equals(DataConstants.PROJECT)) {
|
||||
return getProject();
|
||||
}
|
||||
else if (dataId.equals(DataConstants.EDITOR) || dataId.equals(OpenFileDescriptor.NAVIGATE_IN_EDITOR.getName())) {
|
||||
else if (dataId.equals(DataConstants.EDITOR) || OpenFileDescriptor.NAVIGATE_IN_EDITOR.is(dataId)) {
|
||||
return FileEditorManager.getInstance(getProject()).getSelectedTextEditor();
|
||||
}
|
||||
else {
|
||||
|
||||
+2
-2
@@ -82,10 +82,10 @@ public class RepositoryChangesBrowser extends ChangesBrowser implements DataProv
|
||||
return myUseCase;
|
||||
}
|
||||
|
||||
else if (VcsDataKeys.SELECTED_CHANGES.getName().equals(dataId)) {
|
||||
else if (VcsDataKeys.SELECTED_CHANGES.is(dataId)) {
|
||||
final List<Change> list = myViewer.getSelectedChanges();
|
||||
return list.toArray(new Change [list.size()]);
|
||||
} else if (VcsDataKeys.CHANGE_LEAD_SELECTION.getName().equals(dataId)) {
|
||||
} else if (VcsDataKeys.CHANGE_LEAD_SELECTION.is(dataId)) {
|
||||
final Change highestSelection = myViewer.getHighestLeadSelection();
|
||||
return (highestSelection == null) ? new Change[]{} : new Change[] {highestSelection};
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ public class ChangeListViewerDialog extends DialogWrapper implements DataProvide
|
||||
}
|
||||
|
||||
public Object getData(@NonNls final String dataId) {
|
||||
if (VcsDataKeys.CHANGES.getName().equals(dataId)) {
|
||||
if (VcsDataKeys.CHANGES.is(dataId)) {
|
||||
return myChanges;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -1107,7 +1107,7 @@ public class FileHistoryPanelImpl<S extends CommittedChangeList, U extends Chang
|
||||
else if (VcsDataConstants.VCS_FILE_REVISIONS.equals(dataId)) {
|
||||
return getSelectedRevisions();
|
||||
}
|
||||
else if (VcsDataKeys.CHANGES.getName().equals(dataId)) {
|
||||
else if (VcsDataKeys.CHANGES.is(dataId)) {
|
||||
return getChanges();
|
||||
}
|
||||
else if (VcsDataConstants.VCS_VIRTUAL_FILE.equals(dataId)) {
|
||||
|
||||
@@ -434,11 +434,11 @@ public class VcsHistoryDialog extends DialogWrapper implements DataProvider {
|
||||
}
|
||||
|
||||
public Object getData(@NonNls String dataId) {
|
||||
if (PlatformDataKeys.PROJECT.getName().equals(dataId)) {
|
||||
if (PlatformDataKeys.PROJECT.is(dataId)) {
|
||||
return myProject;
|
||||
} else if (VcsDataKeys.VCS_VIRTUAL_FILE.getName().equals(dataId)) {
|
||||
} else if (VcsDataKeys.VCS_VIRTUAL_FILE.is(dataId)) {
|
||||
return myFile;
|
||||
} else if (VcsDataKeys.VCS_FILE_REVISION.getName().equals(dataId)) {
|
||||
} else if (VcsDataKeys.VCS_FILE_REVISION.is(dataId)) {
|
||||
return myList.getSelectedObject();
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -238,13 +238,13 @@ public class UpdateInfoTree extends PanelWithActionsAndCloseButton implements Di
|
||||
else {
|
||||
return myTreeExpander;
|
||||
}
|
||||
} else if (VcsDataKeys.UPDATE_VIEW_SELECTED_PATH.getName().equals(dataId)) {
|
||||
} else if (VcsDataKeys.UPDATE_VIEW_SELECTED_PATH.is(dataId)) {
|
||||
return mySelectedUrl;
|
||||
} else if (VcsDataKeys.UPDATE_VIEW_FILES_ITERABLE.getName().equals(dataId)) {
|
||||
} else if (VcsDataKeys.UPDATE_VIEW_FILES_ITERABLE.is(dataId)) {
|
||||
return myTreeIterable;
|
||||
} else if (VcsDataKeys.LABEL_BEFORE.getName().equals(dataId)) {
|
||||
} else if (VcsDataKeys.LABEL_BEFORE.is(dataId)) {
|
||||
return myBefore;
|
||||
} else if (VcsDataKeys.LABEL_AFTER.getName().equals(dataId)) {
|
||||
} else if (VcsDataKeys.LABEL_AFTER.is(dataId)) {
|
||||
return myAfter;
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ public class XDebuggerTree extends DnDAwareTree implements DataProvider {
|
||||
|
||||
@Nullable
|
||||
public Object getData(@NonNls final String dataId) {
|
||||
if (XDEBUGGER_TREE_KEY.getName().equals(dataId)) {
|
||||
if (XDEBUGGER_TREE_KEY.is(dataId)) {
|
||||
return this;
|
||||
}
|
||||
return null;
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ public class QuickEditEditor {
|
||||
}
|
||||
|
||||
public Object getData(String s) {
|
||||
if (LangDataKeys.EDITOR.getName().equals(s)) {
|
||||
if (LangDataKeys.EDITOR.is(s)) {
|
||||
return myEditor;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -482,7 +482,7 @@ public class Commander extends JPanel implements PersistentStateComponent<Elemen
|
||||
final Object element = parentElement.getValue();
|
||||
return (element instanceof PsiElement) && ((PsiElement)element).isValid()? element : null;
|
||||
}
|
||||
else if (CompareFiles.DIFF_REQUEST.getName().equals(dataId)) {
|
||||
else if (CompareFiles.DIFF_REQUEST.is(dataId)) {
|
||||
PsiElement primary = getActivePanel().getSelectedElement();
|
||||
PsiElement secondary = getInactivePanel().getSelectedElement();
|
||||
if (primary != null && secondary != null &&
|
||||
|
||||
@@ -244,14 +244,14 @@ public class RepositoryBrowserComponent extends JPanel implements Disposable, Da
|
||||
|
||||
@Nullable
|
||||
public Object getData(@NonNls String dataId) {
|
||||
if (PlatformDataKeys.NAVIGATABLE.getName().equals(dataId)) {
|
||||
if (PlatformDataKeys.NAVIGATABLE.is(dataId)) {
|
||||
final Project project = myVCS.getProject();
|
||||
if (project == null || project.isDefault()) {
|
||||
return null;
|
||||
}
|
||||
final VirtualFile vcsFile = getSelectedVcsFile();
|
||||
return vcsFile != null ? new OpenFileDescriptor(project, vcsFile) : null;
|
||||
} else if (PlatformDataKeys.PROJECT.getName().equals(dataId)) {
|
||||
} else if (PlatformDataKeys.PROJECT.is(dataId)) {
|
||||
return myVCS.getProject();
|
||||
}
|
||||
return null;
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ public class FormMergerTreeStructureProvider implements TreeStructureProvider {
|
||||
|
||||
public Object getData(Collection<AbstractTreeNode> selected, String dataId) {
|
||||
if (selected != null) {
|
||||
if (dataId.equals(Form.DATA_KEY.getName())) {
|
||||
if (Form.DATA_KEY.is(dataId)) {
|
||||
List<Form> result = new ArrayList<Form>();
|
||||
for(AbstractTreeNode node: selected) {
|
||||
if (node.getValue() instanceof Form) {
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ public class HighlightingOutputConsole extends AdditionalTabComponent implements
|
||||
|
||||
@Nullable
|
||||
public Object getData(@NonNls String dataId) {
|
||||
if (dataId.equals(LangDataKeys.EDITOR.getName())) {
|
||||
if (LangDataKeys.EDITOR.is(dataId)) {
|
||||
return getEditor();
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user