本文整理汇总了Java中org.eclipse.ui.dialogs.SaveAsDialog.setTitle方法的典型用法代码示例。如果您正苦于以下问题:Java SaveAsDialog.setTitle方法的具体用法?Java SaveAsDialog.setTitle怎么用?Java SaveAsDialog.setTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.dialogs.SaveAsDialog
的用法示例。
在下文中一共展示了SaveAsDialog.setTitle方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doSaveAs
import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
@Override
public void doSaveAs()
{
SaveAsDialog dialog = new SaveAsDialog(getEditorSite().getShell());
dialog.setOriginalFile(file);
dialog.setTitle("Speichern unter");
int result = dialog.open();
if (result == Dialog.OK) try
{
SerializationManager.save(map, ResourcesPlugin.getWorkspace().getRoot().getFile(dialog.getResult()));
setDirty(false);
}
catch(ResourceException e)
{
showError("Datei konnte nicht gespeichert werden.", e);
}
}
示例2: handleProjectJarnameBrowse
import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
/**
* Uses the standard container selection dialog to choose the new value for
* the container field.
*/
private void handleProjectJarnameBrowse() {
String jarname = getJarname();
SaveAsDialog dialog = new SaveAsDialog(getShell());
String name = jarname;
if (name == null) {
name = "fatjar_output.jar";
}
IProject project = jproject.getProject();
IFile iFile = project.getFile(name);
dialog.setOriginalFile(iFile);
dialog.setTitle("Select Output Jar-Name"); //$NON-NLS-1$
if (dialog.open() == SaveAsDialog.OK) {
IPath saveFile = dialog.getResult();
if (saveFile != null) {
String path = saveFile.toString();
String projectName = jproject.getElementName();
if (!path.startsWith("/" + projectName + "/")) {
MessageDialog.openInformation(getShell(), "Fat Jar Select Output",
"output must be stored in project " + projectName);
} else {
if (!"jar".equals(saveFile.getFileExtension().toLowerCase()))
saveFile = saveFile.addFileExtension("jar");
saveFile = saveFile.removeFirstSegments(1).removeTrailingSeparator();
jarnameText.setText(saveFile.toOSString());
}
}
}
}
示例3: handleProjectJarnameBrowse
import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
/**
* Uses the standard container selection dialog to
* choose the new value for the container field.
*/
private void handleProjectJarnameBrowse() {
String jarname = getJarname();
SaveAsDialog dialog = new SaveAsDialog(getShell());
String name = jarname;
if (name == null) {
name = "fatjar_output.jar";
}
IFile iFile = jproject.getIFile(name);
dialog.setOriginalFile(iFile);
dialog.setTitle("Select Output Jar-Name"); //$NON-NLS-1$
if (dialog.open() == SaveAsDialog.OK) {
IPath saveFile= dialog.getResult();
if (saveFile != null) {
String path = saveFile.toString();
String projectName = jproject.getJproject().getElementName();
if (!path.startsWith("/" + projectName + "/")) {
MessageDialog.openInformation(getShell(), "Fat Jar Select Output", "output must be stored in project " + projectName);
}
else {
if (!"jar".equals(saveFile.getFileExtension().toLowerCase()))
saveFile = saveFile.addFileExtension("jar");
saveFile = saveFile.removeFirstSegments(1).removeTrailingSeparator();
jarnameText.setText(saveFile.toOSString());
}
}
}
}
示例4: handleSaveSettings
import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
private void handleSaveSettings() {
SaveAsDialog dialog = new SaveAsDialog(getShell());
String name = BuildFatJar.absPropertiesFilename;
if (name == null) {
name = "settings.fatjar";
}
int pos = name.lastIndexOf(File.separatorChar);
if (pos != -1) {
name = name.substring(pos+1);
}
IProject project = jproject.getJproject().getProject();
IFile iFile = project.getFile(name);
dialog.setOriginalFile(iFile);
// dialog.setOriginalName(name);
dialog.setTitle("Save FatJar Settings"); //$NON-NLS-1$
if (dialog.open() == SaveAsDialog.OK) {
IPath saveFile= dialog.getResult();
if (saveFile != null) {
String path = saveFile.toString();
String projectName = jproject.getJproject().getElementName();
if (!path.startsWith("/" + projectName + "/")) {
MessageDialog.openInformation(getShell(), "Fat Jar Save Settings", "settings must be stored in project " + projectName);
}
else {
if (!"fatjar".equals(saveFile.getFileExtension()))
saveFile = saveFile.addFileExtension("fatjar");
BuildProperties buildProps = fjew.getBuildProperties();
if (buildProps != null) {
saveConfig(saveFile, buildProps.toProperties());
}
}
}
}
}
示例5: handleExportANT
import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
private void handleExportANT() {
SaveAsDialog dialog = new SaveAsDialog(getShell());
String name = "build.xml";
IProject project = jproject.getJproject().getProject();
IFile iFile = project.getFile(name);
dialog.setOriginalFile(iFile);
// dialog.setOriginalName(name);
dialog.setTitle("Export ANT build file"); //$NON-NLS-1$
if (dialog.open() == SaveAsDialog.OK) {
IPath saveFile= dialog.getResult();
if (saveFile != null) {
String path = saveFile.toString();
String projectName = jproject.getJproject().getElementName();
if (!"xml".equals(saveFile.getFileExtension()))
saveFile = saveFile.addFileExtension("xml");
boolean ok = true;
IFile buildFile = project.getWorkspace().getRoot().getFile(saveFile);
if (buildFile != null) {
IStatus status = AguiPlugin.askFileWriteAccess(buildFile);
if ((status != null) && !status.isOK()) {
ok = false;
Shell shell = new Shell();
MessageDialog.openError(shell, "Fat Jar Plug-In Error", "Export ANT, write access denied: " + status.toString());
}
}
if (ok) {
SourceInfo[] sourceInfo = getANTBuildInfo();
exportANTBuild(saveFile, sourceInfo);
}
}
}
}
示例6: handleSaveSettings
import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
private void handleSaveSettings() {
SaveAsDialog dialog = new SaveAsDialog(getShell());
String name = BuildFatJar.absPropertiesFilename;
if (name == null) {
name = "settings.fatjar";
}
int pos = name.lastIndexOf(File.separatorChar);
if (pos != -1) {
name = name.substring(pos + 1);
}
IProject project = jproject.getProject();
IFile iFile = project.getFile(name);
dialog.setOriginalFile(iFile);
// dialog.setOriginalName(name);
dialog.setTitle("Save FatJar Settings"); //$NON-NLS-1$
if (dialog.open() == SaveAsDialog.OK) {
IPath saveFile = dialog.getResult();
if (saveFile != null) {
String path = saveFile.toString();
String projectName = jproject.getElementName();
if (!path.startsWith("/" + projectName + "/")) {
MessageDialog
.openInformation(getShell(),
"Fat Jar Save Settings",
"settings must be stored in project "
+ projectName);
} else {
if (!"fatjar".equals(saveFile.getFileExtension()))
saveFile = saveFile.addFileExtension("fatjar");
Properties props = fjew.getProperties();
if (props != null) {
saveConfig(saveFile, props);
}
}
}
}
}
示例7: handleExportANT
import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
private void handleExportANT() {
SaveAsDialog dialog = new SaveAsDialog(getShell());
String name = "build.xml";
IProject project = jproject.getProject();
IFile iFile = project.getFile(name);
dialog.setOriginalFile(iFile);
// dialog.setOriginalName(name);
dialog.setTitle("Export ANT build file"); //$NON-NLS-1$
if (dialog.open() == SaveAsDialog.OK) {
IPath saveFile = dialog.getResult();
if (saveFile != null) {
String path = saveFile.toString();
String projectName = jproject.getElementName();
if (!"xml".equals(saveFile.getFileExtension()))
saveFile = saveFile.addFileExtension("xml");
boolean ok = true;
IFile buildFile = project.getWorkspace().getRoot().getFile(
saveFile);
if (buildFile != null) {
IStatus status = AguiPlugin.askFileWriteAccess(buildFile);
if ((status != null) && !status.isOK()) {
ok = false;
Shell shell = new Shell();
MessageDialog.openError(shell, "Fat Jar Plug-In Error",
"Export ANT, write access denied: "
+ status.toString());
}
}
if (ok) {
SourceInfo[] sourceInfo = getANTBuildInfo();
exportANTBuild(saveFile, sourceInfo);
}
}
}
}
示例8: execute
import org.eclipse.ui.dialogs.SaveAsDialog; //导入方法依赖的package包/类
/**
* Execute command.
*
* @param event the event argument.
* @throws ExecutionException the ExecutionException.
* @return null.
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
ISelection selection = HandlerUtil.getCurrentSelection(event);
if (!(selection instanceof StructuredSelection)) {
return null;
}
StructuredSelection structuredSelection = (StructuredSelection) selection;
if (structuredSelection.isEmpty()) {
return null;
}
// gets the diagram file.
IFile selectedDiagramFile = (IFile) structuredSelection.getFirstElement();
// gets model.
IFile selectedModelFile = ModelUtil
.getModelFileFromDiagramFile(selectedDiagramFile);
if (!selectedModelFile.exists()) {
MessageWriter
.showErrorMessageBox(Messages.CopyDcaseFileSelectionAdapter_1);
return null;
}
// shows a dialog to select target.
SaveAsDialog dialog = new SaveAsDialog(DcaseEditorUtil
.getActiveWindowShell());
dialog.setOriginalFile(selectedDiagramFile);
dialog.create();
dialog.setTitle(Messages.CopyDcaseFileSelectionAdapter_2);
dialog.setMessage(Messages.CopyDcaseFileSelectionAdapter_3);
dialog.getShell().setText(Messages.CopyDcaseFileSelectionAdapter_2);
// terminates if canceled.
if (dialog.open() == Window.CANCEL) {
return null;
}
// gets target path.
IPath destDiagramPath = dialog.getResult();
if (destDiagramPath == null) {
return null;
}
// removes file extension.
IPath destBase = destDiagramPath.removeFileExtension();
// copies diagram.
IFile destDiagramFile = ResourcesPlugin.getWorkspace().getRoot()
.getFile(
destBase.addFileExtension(selectedDiagramFile
.getFileExtension()));
// copies model.
IFile destModelPath = FileUtil.copyFileTo(selectedModelFile,
destBase.addFileExtension(selectedModelFile.getFileExtension()));
// updates the reference to the GMF model file of the GMF diagram file.
ModelUtil.updateModelFileReference(selectedDiagramFile,
destModelPath, destDiagramFile, false);
} catch (DcaseSystemException de) {
MessageWriter.writeMessageToErrorLog(de);
MessageWriter.showMessageBoxSeeErroLog();
}
return null;
}