我有一些日文字符的目录/文件.如果我尝试读取包含(例如)的文件名(不是内容),则我收到包含 的字符串.如果我尝试创建一个包含ク的文件/目录,则显示包含?的文件/目录.
例如:我列出了文件.
File file = new File(".");
String[] filesAndDirs = file.list();
Run Code Online (Sandbox Code Playgroud)
filesAndDirs数组现在包含这个特殊字符的目录.String现在只包含 .接缝没有什么可解码的,因为即使对于不同的字符,a getbytes也只显示文件名中每个字符的"-17 -65 -67".
我使用MacOS 10.8.2 Java 7_10和Netbeans.
有任何想法吗?
先感谢您 :)
我尝试在我的 Eclipe-RCP 应用程序中使用我的旧代码。我使用了所有带有依赖项的旧 maven 项目,并使用 maven-bundle-plugin 创建了一个 osgi 包。
现在我把所有东西都装在一个新的 osgi jar 中。
如何从此 osgi jar 创建 p2 更新站点以与 tycho 和 eclipse 目标平台一起使用?
我试过:https : //docs.sonatype.org/display/TYCHO/How+to+make+existing+OSGi+bundles+consumable+by+Tycho
如果我将生成的文件放在 Web 服务器上,eclipse 不会将其识别为“软件站点”。
如何在不使用 Eclipse UI 的情况下从现有的 osgi 包创建 p2 软件站点,该过程必须在我的构建服务器的后台运行。
有没有办法使用 Maven (Tycho)/Gradle 从现有的 osgi 包自动创建 p2 更新站点?
我在运行时创建一个 MWindow
MWindow window = _modelService.createModelElement(MWindow.class);
window.setWidth(200);
window.setHeight(300);
// add new Window to the application
// @Inject
// MApplication _application;
_application.getChildren().add(window);
Run Code Online (Sandbox Code Playgroud)
比我添加一个部分
EModelService windowModelService = window.getContext().get(EModelService.class);
EPartService windowPartService = window.getContext().get(EPartService.class);
// find part if exists
MPart part = windowPartService.findPart("partId");
if (part == null) {
// create if not exists
part = windowPartService.createPart("partId");
}
// Required if initial not visible
part.setVisible(true);
// Show the part
MPart newPart = windowPartService.showPart(part, PartState.VISIBLE);
Run Code Online (Sandbox Code Playgroud)
但我不知道在不再使用该窗口后如何关闭或处置它。Mwindow 没有关闭/处置或退出功能。如果我尝试简单地从应用程序中删除它,我会得到 npe。
如何摆脱窗户?
我尝试将swt TreeViewer打印到png文件.附:
Tree tree = treeViewer.getTree();
Image image = new Image(display, tree.getSize().x, tree.getParent().getSize().y);
GC gc = new GC(image);
System.out.println(new File(pathToSave).getAbsolutePath());
tree.print(gc);
ImageLoader loader = new ImageLoader();
loader.data = new ImageData[] { image.getImageData() };
loader.save(pathToSave, SWT.IMAGE_PNG);
gc.dispose();
image.dispose();
Run Code Online (Sandbox Code Playgroud)
png仅包含树的可见部分.树有一个滚动条,因为它包含的元素多于表单上的元素.
我想打印所有元素可见而没有滚动条的树.有任何想法吗?
在swing组件上我可以使用.paintall().. swt组件似乎不知道.