Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
ebab28de
Unverified
Commit
ebab28de
authored
Mar 30, 2020
by
Chetan Patil
Committed by
GitHub
Mar 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes Type name to delete project/screen (#2101)
parent
03209c86
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
357 additions
and
37 deletions
+357
-37
appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java
...engine/src/com/google/appinventor/client/OdeMessages.java
+9
-0
appinventor/appengine/src/com/google/appinventor/client/explorer/commands/DeleteFileCommand.java
...pinventor/client/explorer/commands/DeleteFileCommand.java
+224
-37
appinventor/appengine/src/com/google/appinventor/client/explorer/commands/SaveScreenCheckpointCommand.java
...client/explorer/commands/SaveScreenCheckpointCommand.java
+120
-0
appinventor/appengine/src/com/google/appinventor/client/widgets/LabeledTextBox.java
...com/google/appinventor/client/widgets/LabeledTextBox.java
+4
-0
No files found.
appinventor/appengine/src/com/google/appinventor/client/OdeMessages.java
View file @
ebab28de
...
...
@@ -117,6 +117,10 @@ public interface OdeMessages extends Messages, AutogeneratedOdeMessages {
@DefaultMessage
(
"Checkpoint ..."
)
@Description
(
"Label of the button for checkpoint"
)
String
checkpointButton
();
@DefaultMessage
(
"Create checkpoint before deleting"
)
@Description
(
"Label of the CheckBox for checkpoint"
)
String
checkBoxButton
();
@DefaultMessage
(
"Toggle Tutorial"
)
@Description
(
"Label for the Toggle Tutorial Button"
)
...
...
@@ -139,6 +143,11 @@ public interface OdeMessages extends Messages, AutogeneratedOdeMessages {
"There is no undo.\nAre you sure you want to delete {0}?"
)
@Description
(
"Confirmation query for removing a screen"
)
String
reallyDeleteForm
(
String
formName
);
@DefaultMessage
(
"Warning: You are deleting a screen.\nThis operation cannot be undone.\n"
+
"Please type the name of the screen {0} into the box below to confirm you really want to do this."
)
@Description
(
"Confirmation query for removing a screen"
)
String
reallyDeleteWarning
(
String
formName
);
@DefaultMessage
(
"Open the Blocks Editor"
)
@Description
(
"Label of the button for opening the blocks editor"
)
...
...
appinventor/appengine/src/com/google/appinventor/client/explorer/commands/DeleteFileCommand.java
View file @
ebab28de
This diff is collapsed.
Click to expand it.
appinventor/appengine/src/com/google/appinventor/client/explorer/commands/SaveScreenCheckpointCommand.java
0 → 100644
View file @
ebab28de
// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2011-2012 MIT, All rights reserved
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
package
com.google.appinventor.client.explorer.commands
;
import
com.google.appinventor.client.Ode
;
import
static
com
.
google
.
appinventor
.
client
.
Ode
.
MESSAGES
;
import
com.google.appinventor.client.OdeAsyncCallback
;
import
com.google.appinventor.client.explorer.project.Project
;
import
com.google.appinventor.client.explorer.project.ProjectComparators
;
import
com.google.appinventor.shared.rpc.project.youngandroid.YoungAndroidFormNode
;
import
com.google.appinventor.shared.rpc.project.youngandroid.YoungAndroidSourceNode
;
import
com.google.appinventor.client.widgets.LabeledTextBox
;
import
com.google.appinventor.client.youngandroid.TextValidators
;
import
com.google.appinventor.shared.rpc.project.ProjectNode
;
import
com.google.appinventor.shared.rpc.project.ProjectRootNode
;
import
com.google.appinventor.shared.rpc.project.UserProject
;
import
com.google.appinventor.client.widgets.Validator
;
import
com.google.gwt.event.dom.client.ClickEvent
;
import
com.google.gwt.event.dom.client.ClickHandler
;
import
com.google.gwt.event.dom.client.KeyCodes
;
import
com.google.gwt.event.dom.client.KeyUpEvent
;
import
com.google.gwt.event.dom.client.KeyUpHandler
;
import
com.google.gwt.i18n.client.DateTimeFormat
;
import
com.google.gwt.user.client.Command
;
import
com.google.gwt.user.client.DeferredCommand
;
import
com.google.gwt.user.client.ui.Button
;
import
com.google.gwt.user.client.ui.DialogBox
;
import
com.google.gwt.user.client.ui.Grid
;
import
com.google.gwt.user.client.ui.HorizontalPanel
;
import
com.google.gwt.user.client.ui.Label
;
import
com.google.gwt.user.client.ui.ScrollPanel
;
import
com.google.gwt.user.client.ui.VerticalPanel
;
import
com.google.gwt.user.client.ui.Widget
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
/**
* A command that brings up a wizard to copy a Young Android project.
*
* @author lizlooney@google.com (Liz Looney)
*/
public
final
class
SaveScreenCheckpointCommand
extends
ChainableCommand
{
private
boolean
checkpoint
;
/**
* Creates a new command for copying a project.
*
* @param checkpoint whether the copy is a checkpoint
*/
public
SaveScreenCheckpointCommand
(
boolean
checkpoint
)
{
this
.
checkpoint
=
checkpoint
;
}
@Override
public
boolean
willCallExecuteNextCommand
()
{
return
false
;
// Is there a way to do this for this command?
}
@Override
public
void
execute
(
final
ProjectNode
node
)
{
handleOkClick
(
node
.
getProjectRoot
());
}
private
void
handleOkClick
(
ProjectRootNode
oldProjectNode
)
{
String
oldName
=
oldProjectNode
.
getName
()+
"_Screen"
;
String
defaultNewName
;
if
(
checkpoint
)
{
String
prefix
=
MESSAGES
.
defaultCheckpointProjectName
(
oldName
,
""
);
List
<
Project
>
checkpointProjects
=
Ode
.
getInstance
().
getProjectManager
().
getProjects
(
prefix
);
String
nextSuffix
;
if
(
checkpointProjects
.
isEmpty
())
{
nextSuffix
=
"1"
;
}
else
{
// Find the highest number in the checkpoint projects' names.
int
highestNumber
=
0
;
int
prefixLength
=
prefix
.
length
();
for
(
Project
checkpointProject
:
checkpointProjects
)
{
String
checkpointName
=
checkpointProject
.
getProjectName
();
try
{
highestNumber
=
Math
.
max
(
highestNumber
,
Integer
.
parseInt
(
checkpointName
.
substring
(
prefixLength
)));
}
catch
(
NumberFormatException
e
)
{
continue
;
}
}
nextSuffix
=
Integer
.
toString
(
highestNumber
+
1
);
}
defaultNewName
=
MESSAGES
.
defaultCheckpointProjectName
(
oldName
,
nextSuffix
);
}
else
{
// Save As
defaultNewName
=
MESSAGES
.
defaultSaveAsProjectName
(
oldName
);
}
copyProjectAction
(
oldProjectNode
,
defaultNewName
);
}
protected
void
copyProjectAction
(
ProjectRootNode
oldProjectNode
,
String
newName
)
{
final
Ode
ode
=
Ode
.
getInstance
();
OdeAsyncCallback
<
UserProject
>
callback
=
new
OdeAsyncCallback
<
UserProject
>(
// failure message
MESSAGES
.
copyProjectError
())
{
@Override
public
void
onSuccess
(
UserProject
newProjectInfo
)
{
// Update project list
Project
newProject
=
ode
.
getProjectManager
().
addProject
(
newProjectInfo
);
if
(!
checkpoint
)
{
ode
.
openYoungAndroidProjectInDesigner
(
newProject
);
}
}
};
// Create new copy on the backend
ode
.
getProjectService
().
copyProject
(
oldProjectNode
.
getProjectId
(),
newName
,
callback
);
}
}
appinventor/appengine/src/com/google/appinventor/client/widgets/LabeledTextBox.java
View file @
ebab28de
...
...
@@ -155,6 +155,10 @@ public class LabeledTextBox extends Composite {
public
void
setErrorMessage
(
String
errorMessage
)
{
this
.
errorMessage
=
errorMessage
;
}
public
void
setColor
(
String
color
)
{
textbox
.
getElement
().
getStyle
().
setBorderColor
(
color
);
}
/**
* Check to see if a textbox contains valid text. True if text is valid, false otherwise
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment