MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / cloneTab

Method cloneTab

src/org/opensourcephysics/tools/DataTool.java:3271–3291  ·  view source on GitHub ↗
(int index, boolean editable)

Source from the content-addressed store, hash-verified

3269 }
3270
3271 protected void cloneTab(int index, boolean editable) {
3272 // determine name of cloned tab
3273 pasteAction(getTabXML(), pasteTabItem);
3274 String name = getTab(index).getName();
3275 String postfix = "_" + ToolsRes.getString("DataTool.Clone.Subscript"); //$NON-NLS-1$ //$NON-NLS-2$
3276 int pt = name.indexOf(postfix);
3277 if (pt >= 0) {
3278 name = name.substring(0, pt);
3279 }
3280 DataToolTab tab = getTab(getTabCount() - 1);
3281 tab.setName(getUniqueTabName(name + postfix));
3282 if (!editable) {
3283 tab.setUserEditable(false);
3284 for (Dataset next : tab.dataManager.getDatasetsRaw()) {
3285 if (next instanceof DataColumn) {
3286 ((DataColumn) next).deletable = false;
3287 }
3288 }
3289 }
3290 refreshTabTitles();
3291 }
3292
3293 protected void pasteAction(String dataString, Object source) {
3294 boolean failed = false;

Callers 1

actionPerformedMethod · 0.95

Calls 11

pasteActionMethod · 0.95
getTabXMLMethod · 0.95
getTabMethod · 0.95
getStringMethod · 0.95
getTabCountMethod · 0.95
setNameMethod · 0.95
getUniqueTabNameMethod · 0.95
setUserEditableMethod · 0.95
refreshTabTitlesMethod · 0.95
getDatasetsRawMethod · 0.80
getNameMethod · 0.65

Tested by

no test coverage detected