Skip to content

Commit

Permalink
implement double click open for zip files
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael5601 committed Aug 16, 2024
1 parent 35c9f4d commit da18d3b
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ filterMatchers=Filter Matchers
preferencesExtPtName=Resource Preferences
resourceModelName=File System Resources
variableProviders=Variable Providers
zipfileContentTypeName = Zip File

markerName = Marker
problemName = Problem
Expand Down
9 changes: 9 additions & 0 deletions resources/bundles/org.eclipse.core.resources/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@
id="preferences"
base-type="org.eclipse.core.runtime.properties"/>
</extension>

<extension point="org.eclipse.core.contenttype.contentTypes">
<file-association content-type="zipfile" file-extensions="zip, jar, war"/>
<content-type
id="archive"
describer="org.eclipse.core.runtime.content.ZipFileContentDescriber"
name="%zipfileContentTypeName"
priority="normal"/>
</extension>

<extension
id="marker"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.core.contenttype; singleton:=true
Bundle-Version: 3.9.500.qualifier
Bundle-Version: 3.10.0.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.equinox.preferences;bundle-version="[3.2.0,4.0.0)",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*******************************************************************************
* Copyright (c) 2024 Vector Informatik GmbH and others.
*
* This program and the accompanying materials are made available under the terms of the Eclipse
* Public License 2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors: Vector Informatik GmbH - initial API and implementation
*******************************************************************************/
package org.eclipse.core.runtime.content;

import java.io.IOException;
import java.io.InputStream;
import org.eclipse.core.internal.content.TextContentDescriber;

/**
* @since 3.10
*
*/
public class ZipFileContentDescriber extends TextContentDescriber {

@Override
public int describe(InputStream contents, IContentDescription description) throws IOException {

IContentType type = description.getContentType();
if (type == null || description == null)
return VALID;

if (type.getId().equals("zipfile")) { //$NON-NLS-1$
return VALID;
}
return INVALID;
}
}

0 comments on commit da18d3b

Please sign in to comment.